http://linux.bkbits.net/linux-2.5 nickpiggin@yahoo.com.au[torvalds]|ChangeSet|20050103015104|03835 nickpiggin # This is a BitKeeper generated diff -Nru style patch. # # ChangeSet # 2005/01/02 17:51:04-08:00 nickpiggin@yahoo.com.au # [PATCH] ia64 4-level pgtable fix # # Fix a 4-level page table bug that slipped through (introduced by me, # not Andi). # # Compiles and boots on ia64 and 2-level i386. # # Signed-off-by: Nick Piggin # Signed-off-by: Linus Torvalds # # mm/memory.c # 2005/01/02 16:40:56-08:00 nickpiggin@yahoo.com.au +2 -2 # ia64 4-level pgtable fix # # include/asm-ia64/pgtable.h # 2005/01/02 16:45:04-08:00 nickpiggin@yahoo.com.au +1 -1 # ia64 4-level pgtable fix # # ChangeSet # 2005/01/02 17:49:03-08:00 torvalds@evo.osdl.org # x86 single-step: fix up comments and cleanup. # # Pretty much all the TF-related comments were stale, and # had been for a long time. Fix them up, clean up code. # # arch/i386/kernel/traps.c # 2005/01/02 17:48:53-08:00 torvalds@evo.osdl.org +11 -15 # x86 single-step: fix up comments and cleanup. # # Pretty much all the TF-related comments were stale, and # had been for a long time. Fix them up, clean up code. # # ChangeSet # 2005/01/02 17:17:29-08:00 torvalds@ppc970.osdl.org # x86 ptrace: remove long stale (and bitrotted) test for # PT_DTRACE without PT_PTRACED. # # Long ago, the "D" in PT_DTRACE meant "Delayed", and it was used # as a flag to mark that we had ptrace'd the process but no longer # did so. That hasn't been true in a while now, and the flag should # probably be renamed, but in the meantime the test for PT_PTRACED # being cleared had been corrupted into something totally nonsensical. # # Pointed out by Andi Kleen. # # arch/i386/kernel/traps.c # 2005/01/02 17:17:15-08:00 torvalds@ppc970.osdl.org +0 -2 # x86 ptrace: remove long stale (and bitrotted) test for # PT_DTRACE without PT_PTRACED. # # Long ago, the "D" in PT_DTRACE meant "Delayed", and it was used # as a flag to mark that we had ptrace'd the process but no longer # did so. That hasn't been true in a while now, and the flag should # probably be renamed, but in the meantime the test for PT_PTRACED # being cleared had been corrupted into something totally nonsensical. # # Pointed out by Andi Kleen. # # ChangeSet # 2005/01/02 20:27:25+00:00 rmk@flint.arm.linux.org.uk # [MMC] Fix UNSTUFF_BITS # # Quieten down compiler warnings, and fix an off-by-one bug when # deciding whether to include the next word. # # drivers/mmc/mmc.c # 2005/01/02 20:24:16+00:00 rmk@flint.arm.linux.org.uk +4 -3 # Quieten compiler warnings. # Fix off-by-one bug when deciding whether to include the next word. # # ChangeSet # 2005/01/02 11:45:13-08:00 torvalds@evo.osdl.org # acpi video device enumeration: fix incorrect device list allocation # # It didn't allocate space for the final terminating entry, # which caused it to overwrite the next slab entry, which in turn # sometimes ended up being a slab array cache pointer. End result: # total slab cache corruption at a random time afterwards. Very # nasty. # # drivers/acpi/video.c # 2005/01/02 11:45:03-08:00 torvalds@evo.osdl.org +1 -1 # acpi video device enumeration: fix incorrect device list allocation # # It didn't allocate space for the final terminating entry, # which caused it to overwrite the next slab entry, which in turn # sometimes ended up being a slab array cache pointer. End result: # total slab cache corruption at a random time afterwards. Very # nasty. # # ChangeSet # 2005/01/02 10:49:42-08:00 viro@parcelfarce.linux.theplanet.co.uk # [PATCH] diskonchip missing iomem annotations # # some trivial iomem annotations were still missing # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # include/linux/mtd/doc2000.h # 2004/12/29 12:36:39-08:00 viro@parcelfarce.linux.theplanet.co.uk +2 -2 # diskonchip missing iomem annotations # # drivers/mtd/nand/diskonchip.c # 2004/12/29 12:36:39-08:00 viro@parcelfarce.linux.theplanet.co.uk +2 -2 # diskonchip missing iomem annotations # # drivers/mtd/devices/docprobe.c # 2004/12/29 12:36:39-08:00 viro@parcelfarce.linux.theplanet.co.uk +8 -8 # diskonchip missing iomem annotations # # drivers/mtd/devices/doc2001plus.c # 2004/12/29 12:36:39-08:00 viro@parcelfarce.linux.theplanet.co.uk +3 -3 # diskonchip missing iomem annotations # # drivers/mtd/devices/doc2001.c # 2004/12/29 12:36:39-08:00 viro@parcelfarce.linux.theplanet.co.uk +3 -3 # diskonchip missing iomem annotations # # drivers/mtd/devices/doc2000.c # 2004/12/29 12:36:39-08:00 viro@parcelfarce.linux.theplanet.co.uk +4 -4 # diskonchip missing iomem annotations # # ChangeSet # 2005/01/02 10:49:27-08:00 viro@parcelfarce.linux.theplanet.co.uk # [PATCH] pc300 portability fixes # # local variable used to store flags after spin_lock_irqsave() should be # unsigned long, not u32. That should complete the 64bit cleanups in # there. # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # drivers/net/wan/pc300_drv.c # 2004/12/29 11:25:16-08:00 viro@parcelfarce.linux.theplanet.co.uk +5 -5 # pc300 portability fixes # # ChangeSet # 2005/01/02 10:49:14-08:00 viro@parcelfarce.linux.theplanet.co.uk # [PATCH] ppc uaccess annotations # # - get_user() __gu_val should be unsigned long (same as with i386 patch) # - __copy_to_user() et.al. didn't have proper type checking # - documented the casts in __copy_tofrom_user() calls with __force. # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # include/asm-ppc/uaccess.h # 2004/12/29 11:25:16-08:00 viro@parcelfarce.linux.theplanet.co.uk +18 -10 # ppc uaccess annotations # # ChangeSet # 2005/01/02 10:47:03-08:00 rusty@rustcorp.com.au # [PATCH] Fix cleanup path when sysctl registration fails # # nfsim gains sysctl support, and sure enough, --failtest uncovered an # unregister when the registration had failed. # # Signed-off-by: Linus Torvalds # # net/ipv4/netfilter/ip_conntrack_standalone.c # 2004/12/30 00:18:29-08:00 rusty@rustcorp.com.au +3 -1 # Fix cleanup path when sysctl registration fails # # ChangeSet # 2005/01/02 10:46:04-08:00 rusty@rustcorp.com.au # [PATCH] Fix proc removal in ip_conntrack_standalone # # Someone thought it would be clever if proc code ignores removal of # non-existent entries. Hence, we missed that /proc/net/stat/ip_conntrack # is never removed on module removal or init failure. # # Found by nfsim. # # Signed-off-by: Linus Torvalds # # net/ipv4/netfilter/ip_conntrack_standalone.c # 2004/12/29 22:39:53-08:00 rusty@rustcorp.com.au +2 -2 # Fix proc removal in ip_conntrack_standalone # # ChangeSet # 2005/01/02 09:49:29-08:00 rddunlap@osdl.org # [PATCH] parport_pc: don't mix module parameter styles # # Somehow parport_pc.c ended up with mixed old-style and new-style module # parameters, but mixing them is not allowed. # # Use module_param() instead of MODULE_PARM() -- cannot be mixed. # # Signed-off-by: Randy Dunlap # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/parport/parport_pc.c # 2005/01/02 01:37:36-08:00 rddunlap@osdl.org +2 -2 # parport_pc: don't mix module parameter styles # # ChangeSet # 2005/01/02 09:49:16-08:00 wli@holomorphy.com # [PATCH] sparc32: fix blank screen problem in cg6.c # # Although the CG6 framebuffer is detected and initialized, without this # patch all it displays is a blank screen. Tested on an Ultra 1 with a # TGX+. # # Originally from Bob Breuer for the CG14. # # Signed-off-by: Adam Kropelin # Acked-by: William Irwin # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/video/cg6.c # 2005/01/02 01:37:36-08:00 wli@holomorphy.com +4 -0 # sparc32: fix blank screen problem in cg6.c # # ChangeSet # 2005/01/02 09:49:03-08:00 wli@holomorphy.com # [PATCH] sparc32: remove conflicting definition of _exit() # # sparc32 had a conflicting _exit, removed the line from asm- # sparc/unistd.h. This is the same change that DaveM made to sparc64 here: # http://linux.bkbits.net:8080/linux-2.6/diffs/include/asm- # sparc64/unistd.h@1.33 # # Warning was: # In file included from include/linux/unistd.h:9, # from init/main.c:45: # include/asm/unistd.h:489: warning: conflicting types for built-in # function '_exit' # # Signed-off-by: Tom 'spot' Callaway # Acked-by: William Irwin # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-sparc/unistd.h # 2005/01/02 01:37:36-08:00 wli@holomorphy.com +0 -1 # sparc32: remove conflicting definition of _exit() # # ChangeSet # 2005/01/02 09:48:52-08:00 wli@holomorphy.com # [PATCH] sparc32: fix incomplete irqreturn_t sweep in include/asm-sparc/floppy.h # # Squelch the floppy compile warning: # # include/asm/floppy.h: In function `sun_fd_request_irq': # include/asm/floppy.h:276: warning: passing arg 2 of `request_fast_irq' # from incompatible pointer type # # Signed-off-by: Tom 'spot' Callaway # Acked-by: William Irwin # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-sparc/floppy.h # 2005/01/02 01:37:36-08:00 wli@holomorphy.com +1 -1 # sparc32: fix incomplete irqreturn_t sweep in include/asm-sparc/floppy.h # # ChangeSet # 2005/01/02 09:48:39-08:00 wli@holomorphy.com # [PATCH] sparc32: fix missing handling for VM fault codes # # Fix missing cases for vm fault codes in sparc32 fault handling, and # convert the entire file to using symbolic fault codes. This fixes a # latent bug where an allocation failure returns to the kernel instead of # delivering an error as expected. # # Signed-off-by: William Irwin # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/sparc/mm/fault.c # 2005/01/02 01:37:36-08:00 wli@holomorphy.com +12 -8 # sparc32: fix missing handling for VM fault codes # # ChangeSet # 2005/01/02 09:48:26-08:00 wli@holomorphy.com # [PATCH] sparc32: fix sbus rtc warnings # # Add a sparc #ifdef to drivers/char/rtc.c and iomem annotations to # drivers/sbus/char/rtc.c # # Signed-off-by: William Irwin # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/sbus/char/rtc.c # 2005/01/02 01:37:35-08:00 wli@holomorphy.com +3 -2 # sparc32: fix sbus rtc warnings # # drivers/char/rtc.c # 2005/01/02 01:37:35-08:00 wli@holomorphy.com +1 -1 # sparc32: fix sbus rtc warnings # # ChangeSet # 2005/01/02 09:48:13-08:00 wli@holomorphy.com # [PATCH] sparc32: unused variable in sunsu.c # # serio is unused except in the #ifdef CONFIG_SERIO paths. To kill the # warning, make the declaration conditional on the same. # # Signed-off-by: William Irwin # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/serial/sunsu.c # 2005/01/02 01:37:35-08:00 wli@holomorphy.com +2 -0 # sparc32: unused variable in sunsu.c # # ChangeSet # 2005/01/02 09:48:00-08:00 wli@holomorphy.com # [PATCH] sparc32: arch/sparc/kernel/pcic.c iomem annotations # # arch/sparc/kernel/pcic.c trips numerous warnings due to iomem # annotations. This patch adds various needed iomem annotations. # # Signed-off-by: William Irwin # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-sparc/pcic.h # 2005/01/02 01:37:35-08:00 wli@holomorphy.com +3 -3 # sparc32: arch/sparc/kernel/pcic.c iomem annotations # # include/asm-sparc/io.h # 2005/01/02 01:37:35-08:00 wli@holomorphy.com +6 -6 # sparc32: arch/sparc/kernel/pcic.c iomem annotations # # arch/sparc/kernel/pcic.c # 2005/01/02 01:37:35-08:00 wli@holomorphy.com +10 -11 # sparc32: arch/sparc/kernel/pcic.c iomem annotations # # ChangeSet # 2005/01/02 09:47:47-08:00 wli@holomorphy.com # [PATCH] sparc32: fix missing return value for svr4_setcontext() # # sparc32 svr4_setcontext() needs to return a value in the SIGSEGV path. # # Signed-off-by: William Irwin # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/sparc/kernel/signal.c # 2005/01/02 01:37:35-08:00 wli@holomorphy.com +1 -0 # sparc32: fix missing return value for svr4_setcontext() # # ChangeSet # 2005/01/02 09:47:34-08:00 wli@holomorphy.com # [PATCH] sparc32: fix initrd memcpy problem # # The latter hunk of the forwarded patch has already been applied, so # please apply the patch as it appears in the un-forwarded part. I've # taken some liberties in adding the Acked/Signed-off lines in what I # hope is an agreeable way. # # On Sun, Nov 14, 2004 at 11:16:40PM -0500, Jurij Smakov wrote: # > As a followup: I have tried fiddling more with the memcpy() routine. # > Insight from Rob Radez and comments in arch/sparc/lib/blockops.S suggest, # > that __copy_1page assumes that the memory regions copied are aligned on a # > double-word boundary. I have checked, that in the cramfs case it wasn't # > true, the destination was not aligned on the double-word boundary. So, I # > have implemented a simple workaround (see patch below), which together # > with Bob Breuer's iommu.c fix [0] made 2.6.8 kernel to boot on my # > machine (SS10 with Ross Hypersparc CPU)! I also confirm, that adding the # > suggested fix to the srmmu.c also [1] breaks sunlance on my machine. With # > that "fix" the line 'eth0: Memory error, status 88c3, addr 3713ba' is # > displayed continuously during boot, when it comes to configuring network # > interfaces. The successful patch for me is: # # Acked-by: William Irwin # Acked-by: Dave Miller # Signed-off-by: Jurij Smakov # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-sparc/string.h # 2005/01/02 01:37:35-08:00 wli@holomorphy.com +3 -0 # sparc32: fix initrd memcpy problem # # ChangeSet # 2005/01/02 09:47:21-08:00 wli@holomorphy.com # [PATCH] sparc32: sun4d update # # Chris Newport and Thomas Bogendoerfer have been working to get the # sun4d port functional again. This patch updates 2.6.10-rc3 to a current # snapshot of their work. It does the following 3 things: # # (1) add sun4d hook to sbus_bus_ranges_init() # (2) fix up pgd_offset() call in sun4d iommu code # (3) fix up sun4d's definition of current # # Signed-off-by: Chris Newport # Signed-off-by: Thomas Bogendoerfer # Acked-by: William Irwin # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-sparc/winmacro.h # 2005/01/02 01:37:35-08:00 wli@holomorphy.com +6 -3 # sparc32: sun4d update # # include/asm-sparc/sbus.h # 2005/01/02 01:37:35-08:00 wli@holomorphy.com +2 -0 # sparc32: sun4d update # # include/asm-sparc/asi.h # 2005/01/02 01:37:35-08:00 wli@holomorphy.com +2 -1 # sparc32: sun4d update # # drivers/sbus/sbus.c # 2005/01/02 01:37:35-08:00 wli@holomorphy.com +14 -0 # sparc32: sun4d update # # arch/sparc/prom/ranges.c # 2005/01/02 01:37:35-08:00 wli@holomorphy.com +1 -1 # sparc32: sun4d update # # arch/sparc/mm/io-unit.c # 2005/01/02 01:37:35-08:00 wli@holomorphy.com +1 -1 # sparc32: sun4d update # # arch/sparc/kernel/sun4d_smp.c # 2005/01/02 01:37:35-08:00 wli@holomorphy.com +5 -13 # sparc32: sun4d update # # ChangeSet # 2005/01/02 09:47:08-08:00 wli@holomorphy.com # [PATCH] sparc32: fix hypersparc dvma # # DVMA is having aliasing problems. Bob originally sent in the following # description: # # At some point in the past, Bob Breuer wrote: # > Here's the preliminary patch. This time around, both the hme # > and esp drivers are working for me. This replaces my previous # > patch and is against the vanilla 2.6.9 kernel. I've tried to # > reduce the amount of unnecessary cache flushing, therefore this # > will need some testing on non-hypersparc cpus also. It needs # > some cleanup yet, and will be rediffed against a later kernel. # > I'm looking for comments and feedback. # # This patch represents one of those subsequent rediffings. # # Signed-off-by: Bob Breuer # Acked-by: William Irwin # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-sparc/bitext.h # 2005/01/02 01:37:34-08:00 wli@holomorphy.com +1 -0 # sparc32: fix hypersparc dvma # # arch/sparc/mm/iommu.c # 2005/01/02 01:37:34-08:00 wli@holomorphy.com +22 -6 # sparc32: fix hypersparc dvma # # arch/sparc/lib/bitext.c # 2005/01/02 01:37:34-08:00 wli@holomorphy.com +12 -6 # sparc32: fix hypersparc dvma # # ChangeSet # 2005/01/02 09:46:55-08:00 akpm@osdl.org # [PATCH] floppy build fix # # drivers/block/floppy.c: In function `init_module': # drivers/block/floppy.c:4598: error: parse error before "UTS_RELEASE" # # Not sure what went wrong here - just kill the thing. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/block/floppy.c # 2005/01/02 01:37:34-08:00 akpm@osdl.org +0 -2 # floppy build fix # # ChangeSet # 2005/01/02 09:46:42-08:00 akpm@osdl.org # [PATCH] fix inet6_sk for non IPV6 builds again # # The recent ipv6 "fix" broke the build: # # security/selinux/avc.c: In function `avc_audit': # security/selinux/avc.c:581: warning: implicit declaration of function `inet6_sk' # security/selinux/avc.c:581: warning: initialization makes pointer from integer without a cast # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/linux/ipv6.h # 2005/01/02 01:37:34-08:00 akpm@osdl.org +11 -0 # fix inet6_sk for non IPV6 builds again # # ChangeSet # 2005/01/02 09:46:29-08:00 michal@logix.cz # [PATCH] Add Michal Ludvig to CREDITS # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # CREDITS # 2005/01/02 01:37:34-08:00 michal@logix.cz +9 -0 # Add Michal Ludvig to CREDITS # # ChangeSet # 2005/01/02 09:46:16-08:00 michal@logix.cz # [PATCH] VIA PadLock compilation fixes # # This patch contains two fixes for VIA PadLock compilation with GCC 2.95.3 # and GCC 3.4.3 (original patch was tested with 3.3.4 only). # # Signed-off-by: Michal Ludvig # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/crypto/padlock-aes.c # 2005/01/02 01:37:34-08:00 michal@logix.cz +14 -16 # VIA PadLock compilation fixes # # ChangeSet # 2005/01/02 09:46:03-08:00 akpm@osdl.org # [PATCH] ia64 PTRS_PER_PGD build fix # # mm/memory.c:1944:6: missing binary operator before token "long" # # The preprocessor doesn't like the typecast.... # # PTRS_PER_PGD isn't used in assembly code, so this looks to be safe enough.. # # This patch helps, but the ia64 build is still broken. There is no # implementation of __pmd_alloc(). # # Cc: Nick Piggin # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-ia64/pgtable.h # 2005/01/02 01:37:13-08:00 akpm@osdl.org +1 -1 # ia64 PTRS_PER_PGD build fix # # ChangeSet # 2005/01/02 09:45:50-08:00 akpm@osdl.org # [PATCH] sparc64 pmd_offset() fix # # mm/memory.c: In function `zeromap_pud_range': # mm/memory.c:1053: warning: suggest parentheses around + or - inside shift # mm/memory.c: In function `remap_pud_range': # mm/memory.c:1170: warning: suggest parentheses around + or - inside shift # # Parenthesize this macro arg. # # Cc: Nick Piggin # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-sparc64/pgtable.h # 2005/01/02 01:36:40-08:00 akpm@osdl.org +1 -1 # sparc64 pmd_offset() fix # # ChangeSet # 2005/01/02 09:45:38-08:00 akpm@osdl.org # [PATCH] setup_pci.c build fix # # On sparc64: # # drivers/ide/setup-pci.c:310: error: `DMA_32BIT_MASK' undeclared (first use in this function) # drivers/ide/setup-pci.c:310: error: (Each undeclared identifier is reported only once # drivers/ide/setup-pci.c:310: error: for each function it appears in.) # # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/ide/setup-pci.c # 2005/01/02 01:36:39-08:00 akpm@osdl.org +1 -0 # setup_pci.c build fix # # ChangeSet # 2005/01/02 09:40:33-08:00 rusty@rustcorp.com.au # [PATCH] ipt_ECN corrupt checksum fix # # Nasty bug, caught while writing the ECN target test. Corrupts # checksums of packets when target is used on them. # # Let this be a warning on the evils of casts. # # Signed-off-by: Linus Torvalds # # net/ipv4/netfilter/ipt_ECN.c # 2005/01/02 02:56:47-08:00 rusty@rustcorp.com.au +1 -1 # ipt_ECN corrupt checksum fix # # ChangeSet # 2005/01/01 14:02:07-08:00 ak@suse.de # [PATCH] convert x86_64 to 4 level page tables # # Converted to true 4levels. The address space per process is expanded to # 47bits now, the supported physical address space is 46bits. # # Lmbench fork/exit numbers are down a few percent because it has to walk # much more pagetables, but some planned future optimizations will # hopefully recover it. # # See Documentation/x86_64/mm.txt for more details on the memory map. # # Signed-off-by: Andi Kleen # # Converted to pud_t by Nick Piggin. # # Signed-off-by: Nick Piggin # Signed-off-by: Linus Torvalds # # include/asm-x86_64/processor.h # 2004/12/22 01:33:05-08:00 ak@suse.de +2 -2 # convert x86_64 to 4 level page tables # # include/asm-x86_64/pgtable.h # 2004/12/22 01:34:25-08:00 ak@suse.de +57 -83 # convert x86_64 to 4 level page tables # # include/asm-x86_64/pgalloc.h # 2004/12/22 01:33:05-08:00 ak@suse.de +33 -5 # convert x86_64 to 4 level page tables # # include/asm-x86_64/pda.h # 2004/12/22 01:33:05-08:00 ak@suse.de +0 -1 # convert x86_64 to 4 level page tables # # include/asm-x86_64/page.h # 2004/12/22 01:33:05-08:00 ak@suse.de +6 -6 # convert x86_64 to 4 level page tables # # include/asm-x86_64/mmu_context.h # 2004/12/22 01:33:05-08:00 ak@suse.de +1 -4 # convert x86_64 to 4 level page tables # # include/asm-x86_64/e820.h # 2004/12/22 01:33:05-08:00 ak@suse.de +0 -3 # convert x86_64 to 4 level page tables # # arch/x86_64/mm/pageattr.c # 2004/12/22 01:33:05-08:00 ak@suse.de +21 -13 # convert x86_64 to 4 level page tables # # arch/x86_64/mm/ioremap.c # 2004/12/22 01:33:05-08:00 ak@suse.de +33 -10 # convert x86_64 to 4 level page tables # # arch/x86_64/mm/init.c # 2004/12/22 01:33:05-08:00 ak@suse.de +46 -55 # convert x86_64 to 4 level page tables # # arch/x86_64/mm/fault.c # 2004/12/22 01:33:05-08:00 ak@suse.de +65 -46 # convert x86_64 to 4 level page tables # # arch/x86_64/kernel/setup64.c # 2004/12/22 01:33:05-08:00 ak@suse.de +2 -11 # convert x86_64 to 4 level page tables # # arch/x86_64/kernel/reboot.c # 2004/12/22 01:33:05-08:00 ak@suse.de +1 -1 # convert x86_64 to 4 level page tables # # arch/x86_64/kernel/init_task.c # 2004/12/22 01:33:05-08:00 ak@suse.de +0 -2 # convert x86_64 to 4 level page tables # # arch/x86_64/kernel/head.S # 2004/12/22 01:33:05-08:00 ak@suse.de +0 -1 # convert x86_64 to 4 level page tables # # arch/x86_64/kernel/acpi/sleep.c # 2004/12/22 01:33:05-08:00 ak@suse.de +6 -2 # convert x86_64 to 4 level page tables # # arch/x86_64/ia32/syscall32.c # 2004/12/22 01:33:05-08:00 ak@suse.de +19 -12 # convert x86_64 to 4 level page tables # # Documentation/x86_64/mm.txt # 2004/12/22 01:33:05-08:00 ak@suse.de +22 -146 # convert x86_64 to 4 level page tables # # ChangeSet # 2005/01/01 14:01:54-08:00 nickpiggin@yahoo.com.au # [PATCH] convert ia64 to generic nopud header # # Convert ia64 architecture over to handle 4 level pagetables. # # Signed-off-by: Nick Piggin # Signed-off-by: Linus Torvalds # # include/asm-ia64/tlb.h # 2004/12/22 01:32:06-08:00 nickpiggin@yahoo.com.au +6 -0 # convert ia64 to generic nopud header # # include/asm-ia64/pgtable.h # 2004/12/22 01:32:20-08:00 nickpiggin@yahoo.com.au +8 -8 # convert ia64 to generic nopud header # # include/asm-ia64/pgalloc.h # 2004/12/22 01:32:06-08:00 nickpiggin@yahoo.com.au +2 -3 # convert ia64 to generic nopud header # # arch/ia64/mm/init.c # 2004/12/22 01:32:06-08:00 nickpiggin@yahoo.com.au +12 -2 # convert ia64 to generic nopud header # # arch/ia64/mm/hugetlbpage.c # 2004/12/22 01:32:06-08:00 nickpiggin@yahoo.com.au +14 -6 # convert ia64 to generic nopud header # # arch/ia64/mm/fault.c # 2004/12/22 01:32:06-08:00 nickpiggin@yahoo.com.au +6 -1 # convert ia64 to generic nopud header # # ChangeSet # 2005/01/01 14:01:39-08:00 ak@suse.de # [PATCH] convert i386 to generic nopud header # # i386 works with 2 and 3 levels # # Signed-off-by: Andi Kleen # # Converted to use pud_t by Nick Piggin # # Signed-off-by: Nick Piggin # Signed-off-by: Linus Torvalds # # include/asm-i386/pgtable.h # 2004/12/22 01:31:49-08:00 ak@suse.de +1 -0 # convert i386 to generic nopud header # # include/asm-i386/pgtable-3level.h # 2004/12/22 01:31:49-08:00 ak@suse.de +13 -11 # convert i386 to generic nopud header # # include/asm-i386/pgalloc.h # 2004/12/22 01:31:49-08:00 ak@suse.de +1 -2 # convert i386 to generic nopud header # # arch/i386/mm/pgtable.c # 2004/12/22 01:31:49-08:00 ak@suse.de +10 -2 # convert i386 to generic nopud header # # arch/i386/mm/pageattr.c # 2004/12/22 01:31:49-08:00 ak@suse.de +10 -4 # convert i386 to generic nopud header # # arch/i386/mm/ioremap.c # 2004/12/22 01:31:49-08:00 ak@suse.de +6 -1 # convert i386 to generic nopud header # # arch/i386/mm/init.c # 2004/12/22 01:31:49-08:00 ak@suse.de +12 -6 # convert i386 to generic nopud header # # arch/i386/mm/hugetlbpage.c # 2004/12/22 01:31:49-08:00 ak@suse.de +6 -2 # convert i386 to generic nopud header # # arch/i386/mm/fault.c # 2004/12/22 01:31:49-08:00 ak@suse.de +10 -3 # convert i386 to generic nopud header # # arch/i386/kernel/vm86.c # 2004/12/22 01:31:49-08:00 ak@suse.de +10 -1 # convert i386 to generic nopud header # # ChangeSet # 2005/01/01 14:01:24-08:00 nickpiggin@yahoo.com.au # [PATCH] introduce fallback header # # Add a temporary "fallback" header so architectures can run with the 4level # patgetables patch without modification. All architectures should be # converted to use the folding headers (include/asm-generic/pgtable-nop?d.h) # as soon as possible, and the fallback header removed. # # Make all architectures include the fallback header, except i386, because that # architecture has earlier been converted to use pgtable-nopmd.h under the 3 # level system, which is not compatible with the fallback header. # # Signed-off-by: Nick Piggin # Signed-off-by: Linus Torvalds # # mm/memory.c # 2004/12/22 01:36:07-08:00 nickpiggin@yahoo.com.au +25 -0 # introduce fallback header # # include/linux/mm.h # 2004/12/22 01:36:07-08:00 nickpiggin@yahoo.com.au +6 -0 # introduce fallback header # # include/asm-x86_64/pgtable.h # 2004/12/22 01:38:06-08:00 nickpiggin@yahoo.com.au +2 -0 # introduce fallback header # # include/asm-v850/pgtable.h # 2004/12/22 01:36:07-08:00 nickpiggin@yahoo.com.au +2 -0 # introduce fallback header # # include/asm-um/pgtable.h # 2004/12/22 01:36:07-08:00 nickpiggin@yahoo.com.au +2 -0 # introduce fallback header # # include/asm-sparc64/pgtable.h # 2004/12/22 01:36:07-08:00 nickpiggin@yahoo.com.au +2 -0 # introduce fallback header # # include/asm-generic/4level-fixup.h # 2004/12/22 01:38:01-08:00 nickpiggin@yahoo.com.au +34 -0 # introduce fallback header # # include/asm-sparc/pgtable.h # 2004/12/22 01:36:07-08:00 nickpiggin@yahoo.com.au +2 -0 # introduce fallback header # # include/asm-sh64/pgtable.h # 2004/12/22 01:36:07-08:00 nickpiggin@yahoo.com.au +2 -0 # introduce fallback header # # include/asm-sh/pgtable.h # 2004/12/22 01:36:07-08:00 nickpiggin@yahoo.com.au +2 -0 # introduce fallback header # # include/asm-s390/pgtable.h # 2004/12/22 01:36:07-08:00 nickpiggin@yahoo.com.au +2 -0 # introduce fallback header # # include/asm-ppc64/pgtable.h # 2004/12/22 01:36:07-08:00 nickpiggin@yahoo.com.au +2 -0 # introduce fallback header # # include/asm-ppc/pgtable.h # 2004/12/22 01:36:07-08:00 nickpiggin@yahoo.com.au +2 -0 # introduce fallback header # # include/asm-parisc/pgtable.h # 2004/12/22 01:36:07-08:00 nickpiggin@yahoo.com.au +2 -0 # introduce fallback header # # include/asm-mips/pgtable.h # 2004/12/22 01:36:07-08:00 nickpiggin@yahoo.com.au +2 -0 # introduce fallback header # # include/asm-m68knommu/pgtable.h # 2004/12/22 01:36:07-08:00 nickpiggin@yahoo.com.au +2 -0 # introduce fallback header # # include/asm-m68k/pgtable.h # 2004/12/22 01:36:07-08:00 nickpiggin@yahoo.com.au +2 -0 # introduce fallback header # # include/asm-m32r/pgtable.h # 2004/12/22 01:36:07-08:00 nickpiggin@yahoo.com.au +2 -0 # introduce fallback header # # include/asm-ia64/pgtable.h # 2004/12/22 01:38:07-08:00 nickpiggin@yahoo.com.au +2 -0 # introduce fallback header # # include/asm-h8300/pgtable.h # 2004/12/22 01:36:07-08:00 nickpiggin@yahoo.com.au +2 -0 # introduce fallback header # # include/asm-generic/tlb.h # 2004/12/22 01:36:07-08:00 nickpiggin@yahoo.com.au +2 -0 # introduce fallback header # # include/asm-generic/4level-fixup.h # 2004/12/22 01:38:01-08:00 nickpiggin@yahoo.com.au +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-generic/4level-fixup.h # # include/asm-cris/pgtable.h # 2004/12/22 01:36:07-08:00 nickpiggin@yahoo.com.au +2 -0 # introduce fallback header # # include/asm-arm26/pgtable.h # 2004/12/22 01:36:07-08:00 nickpiggin@yahoo.com.au +2 -0 # introduce fallback header # # include/asm-arm/pgtable.h # 2004/12/22 01:36:07-08:00 nickpiggin@yahoo.com.au +2 -0 # introduce fallback header # # include/asm-alpha/pgtable.h # 2004/12/22 01:36:07-08:00 nickpiggin@yahoo.com.au +2 -0 # introduce fallback header # # ChangeSet # 2005/01/01 14:01:09-08:00 ak@suse.de # [PATCH] convert Linux to 4-level page tables # # Extend the Linux MM to 4level page tables. # # This is the core patch for mm/*, fs/*, include/linux/* # # It breaks all architectures, which will be fixed in separate patches. # # The conversion is quite straight forward. All the functions walking the page # table hierarchy have been changed to deal with another level at the top. The # additional level is called pml4. # # mm/memory.c has changed a lot because it did most of the heavy lifting here. # Most of the changes here are extensions of the previous code. # # Signed-off-by: Andi Kleen # # Converted by Nick Piggin to use the pud_t 'page upper' level between pgd # and pmd instead of Andi's pml4 level above pgd. # # Signed-off-by: Nick Piggin # Signed-off-by: Linus Torvalds # # mm/vmalloc.c # 2004/12/22 01:31:46-08:00 ak@suse.de +83 -30 # convert Linux to 4-level page tables # # mm/swapfile.c # 2004/12/22 01:31:46-08:00 ak@suse.de +60 -21 # convert Linux to 4-level page tables # # mm/rmap.c # 2004/12/22 01:31:46-08:00 ak@suse.de +18 -3 # convert Linux to 4-level page tables # # mm/msync.c # 2004/12/22 01:31:46-08:00 ak@suse.de +43 -12 # convert Linux to 4-level page tables # # mm/mremap.c # 2004/12/22 01:31:46-08:00 ak@suse.de +23 -6 # convert Linux to 4-level page tables # # mm/mprotect.c # 2004/12/22 01:31:46-08:00 ak@suse.de +47 -18 # convert Linux to 4-level page tables # # mm/mempolicy.c # 2004/12/22 01:31:46-08:00 ak@suse.de +17 -5 # convert Linux to 4-level page tables # # mm/memory.c # 2004/12/22 01:35:55-08:00 ak@suse.de +317 -91 # convert Linux to 4-level page tables # # mm/fremap.c # 2004/12/22 01:31:46-08:00 ak@suse.de +14 -4 # convert Linux to 4-level page tables # # include/linux/mm.h # 2004/12/22 01:35:55-08:00 ak@suse.de +14 -6 # convert Linux to 4-level page tables # # fs/exec.c # 2004/12/22 01:31:46-08:00 ak@suse.de +5 -1 # convert Linux to 4-level page tables # # drivers/char/drm/drm_memory.h # 2004/12/22 01:31:46-08:00 ak@suse.de +2 -1 # convert Linux to 4-level page tables # # ChangeSet # 2005/01/01 14:00:55-08:00 nickpiggin@yahoo.com.au # [PATCH] introduce 4-level nopud folding header # # Generic headers to fold the 4-level pagetable into 3 levels. # # Signed-off-by: Nick Piggin # Signed-off-by: Linus Torvalds # # include/asm-generic/tlb.h # 2004/12/22 01:35:55-08:00 nickpiggin@yahoo.com.au +6 -0 # introduce 4-level nopud folding header # # include/asm-generic/pgtable-nopud.h # 2004/12/22 01:31:45-08:00 nickpiggin@yahoo.com.au +56 -0 # introduce 4-level nopud folding header # # include/asm-generic/pgtable-nopmd.h # 2004/12/22 01:31:45-08:00 nickpiggin@yahoo.com.au +23 -22 # introduce 4-level nopud folding header # # include/asm-generic/pgtable-nopud.h # 2004/12/22 01:31:45-08:00 nickpiggin@yahoo.com.au +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-generic/pgtable-nopud.h # # ChangeSet # 2005/01/01 14:00:42-08:00 nickpiggin@yahoo.com.au # [PATCH] replace clear_page_tables with clear_page_range # # Rename clear_page_tables to clear_page_range. clear_page_range takes byte # ranges, and aggressively frees page table pages. Maybe useful to control # page table memory consumption on 4-level architectures (and even 3 level # ones). # # Possible downsides are: # - flush_tlb_pgtables gets called more often (only a problem for sparc64 # AFAIKS). # # - the opportunistic "expand to fill PGDIR_SIZE hole" logic that ensures # something actually gets done under the old system is still in place. # This could sometimes make unmapping small regions more inefficient. There # are some other solutions to look at if this is the case though. # # Signed-off-by: Nick Piggin # Signed-off-by: Linus Torvalds # # mm/mmap.c # 2004/12/22 01:31:45-08:00 nickpiggin@yahoo.com.au +10 -14 # replace clear_page_tables with clear_page_range # # mm/memory.c # 2004/12/22 01:35:56-08:00 nickpiggin@yahoo.com.au +49 -31 # replace clear_page_tables with clear_page_range # # include/linux/mm.h # 2004/12/22 01:35:56-08:00 nickpiggin@yahoo.com.au +1 -1 # replace clear_page_tables with clear_page_range # # arch/ia64/mm/hugetlbpage.c # 2004/12/22 01:35:53-08:00 nickpiggin@yahoo.com.au +2 -13 # replace clear_page_tables with clear_page_range # # arch/i386/mm/pgtable.c # 2004/12/22 01:35:54-08:00 nickpiggin@yahoo.com.au +1 -1 # replace clear_page_tables with clear_page_range # # ChangeSet # 2005/01/01 14:00:27-08:00 ak@suse.de # [PATCH] split copy_page_range # # Split copy_page_range into the usual set of page table walking functions. # Needed to handle the complexity when moving to 4 levels. # # Signed-off-by: Andi Kleen # # Split out from Andi Kleen's 4level patch by Nick Piggin. # # Signed-off-by: Nick Piggin # Signed-off-by: Linus Torvalds # # mm/memory.c # 2004/12/22 01:35:58-08:00 ak@suse.de +153 -139 # split copy_page_range # # ChangeSet # 2005/01/01 14:00:15-08:00 nickpiggin@yahoo.com.au # [PATCH] convert i386 to generic nopmd header # # Adapt the i386 architecture to use the generic 2-level folding header. # Just to show how it is done. # # Signed-off-by: Nick Piggin # Signed-off-by: Linus Torvalds # # include/asm-i386/pgtable.h # 2004/12/22 01:35:54-08:00 nickpiggin@yahoo.com.au +3 -10 # convert i386 to generic nopmd header # # include/asm-i386/pgtable-3level.h # 2004/12/22 01:35:54-08:00 nickpiggin@yahoo.com.au +11 -0 # convert i386 to generic nopmd header # # include/asm-i386/pgtable-2level.h # 2004/12/22 01:31:43-08:00 nickpiggin@yahoo.com.au +8 -25 # convert i386 to generic nopmd header # # include/asm-i386/pgtable-2level-defs.h # 2004/12/22 01:31:43-08:00 nickpiggin@yahoo.com.au +0 -2 # convert i386 to generic nopmd header # # include/asm-i386/pgalloc.h # 2004/12/22 01:35:54-08:00 nickpiggin@yahoo.com.au +7 -10 # convert i386 to generic nopmd header # # include/asm-i386/page.h # 2004/12/22 01:31:43-08:00 nickpiggin@yahoo.com.au +2 -4 # convert i386 to generic nopmd header # # include/asm-i386/mmzone.h # 2004/12/22 01:31:44-08:00 nickpiggin@yahoo.com.au +0 -1 # convert i386 to generic nopmd header # # ChangeSet # 2005/01/01 14:00:01-08:00 nickpiggin@yahoo.com.au # [PATCH] generic 3-level nopmd folding header # # Generic headers to fold the 3-level pagetable into 2 levels. # # Signed-off-by: Nick Piggin # Signed-off-by: Linus Torvalds # # include/asm-generic/pgtable-nopmd.h # 2004/12/22 01:35:57-08:00 nickpiggin@yahoo.com.au +59 -0 # generic 3-level nopmd folding header # # include/asm-generic/pgtable-nopmd.h # 2004/12/22 01:35:57-08:00 nickpiggin@yahoo.com.au +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-generic/pgtable-nopmd.h # # ChangeSet # 2005/01/01 13:59:48-08:00 nickpiggin@yahoo.com.au # [PATCH] parentheses to x86-64 macro # # Add parentheses to x86-64's pgd_index's arguments # # Signed-off-by: Nick Piggin # Signed-off-by: Linus Torvalds # # include/asm-x86_64/pgtable.h # 2004/12/22 01:35:55-08:00 nickpiggin@yahoo.com.au +1 -1 # parentheses to x86-64 macro # # ChangeSet # 2005/01/01 13:47:42-08:00 torvalds@evo.osdl.org # x86: single-step over "popf" without corrupting state. # # This still leaves "pushf" able to see that somebody is # single-stepping us, but that is at least something you # can work around. # # arch/i386/kernel/ptrace.c # 2005/01/01 13:47:31-08:00 torvalds@evo.osdl.org +83 -1 # x86: single-step over "popf" without corrupting state. # # This still leaves "pushf" able to see that somebody is # single-stepping us, but that is at least something you # can work around. # # ChangeSet # 2005/01/01 13:11:08-08:00 torvalds@evo.osdl.org # x86: be a lot more careful about TF handling. # # This should fix Wine for some games that otherwise # seem to think that they run under a debugger. # # arch/i386/kernel/traps.c # 2005/01/01 13:10:57-08:00 torvalds@evo.osdl.org +11 -2 # x86: be a lot more careful about TF handling. # # This should fix Wine for some games that otherwise # seem to think that they run under a debugger. # # arch/i386/kernel/signal.c # 2005/01/01 13:10:57-08:00 torvalds@evo.osdl.org +7 -21 # x86: be a lot more careful about TF handling. # # This should fix Wine for some games that otherwise # seem to think that they run under a debugger. # # arch/i386/kernel/ptrace.c # 2005/01/01 13:10:57-08:00 torvalds@evo.osdl.org +27 -8 # x86: be a lot more careful about TF handling. # # This should fix Wine for some games that otherwise # seem to think that they run under a debugger. # # ChangeSet # 2005/01/01 12:24:01-08:00 torvalds@evo.osdl.org # x86: common send_sigtrap helper for debug event SIGTRAP's, # and use that for system call single-step events. # # This one also gets the user mode test right, and makes sure # the siginfo is not leaking any stack contents. # # include/asm-i386/ptrace.h # 2005/01/01 12:23:50-08:00 torvalds@evo.osdl.org +2 -0 # x86: common send_sigtrap helper for debug event SIGTRAP's, # and use that for system call single-step events. # # This one also gets the user mode test right, and makes sure # the siginfo is not leaking any stack contents. # # arch/i386/kernel/traps.c # 2005/01/01 12:23:50-08:00 torvalds@evo.osdl.org +1 -13 # x86: common send_sigtrap helper for debug event SIGTRAP's, # and use that for system call single-step events. # # This one also gets the user mode test right, and makes sure # the siginfo is not leaking any stack contents. # # arch/i386/kernel/ptrace.c # 2005/01/01 12:23:50-08:00 torvalds@evo.osdl.org +27 -5 # x86: common send_sigtrap helper for debug event SIGTRAP's, # and use that for system call single-step events. # # This one also gets the user mode test right, and makes sure # the siginfo is not leaking any stack contents. # # ChangeSet # 2005/01/01 12:21:12-08:00 torvalds@evo.osdl.org # Now that sparse looks into asms, fix the fake anti-optimizer cast # macro to use the right address space. # # include/asm-i386/uaccess.h # 2005/01/01 12:21:02-08:00 torvalds@evo.osdl.org +1 -1 # Now that sparse looks into asms, fix the fake anti-optimizer cast # macro to use the right address space. # # ChangeSet # 2005/01/01 19:02:55+00:00 rmk@flint.arm.linux.org.uk # [ARM] Remove static mapping for RTC on Integrator/AP # # arch/arm/mach-integrator/integrator_ap.c # 2005/01/01 18:59:49+00:00 rmk@flint.arm.linux.org.uk +0 -2 # Remove static mapping for RTC # # ChangeSet # 2005/01/01 18:08:52+00:00 rmk@flint.arm.linux.org.uk # [ARM] Update Integrator RTC driver. # # This updates the Integrator RTC driver to use the ARM common RTC # interface, and converts the driver to behave as a standard AMBA # peripheral driver. # # arch/arm/mach-integrator/time.c # 2005/01/01 18:06:08+00:00 rmk@flint.arm.linux.org.uk +180 -15 # Convert integrator RTC driver to use common rtc interface and # convert to a standard AMBA driver. # # ChangeSet # 2005/01/01 16:29:07+00:00 dsaxena@net.rmk.(none) # [ARM PATCH] 2338/1: IXP465 and IXDPG465 header file updates # # Patch from Deepak Saxena # # Update IXP4xx header files with new registers for IXP46x CPU family. # # Replaces 2306/1 # # Signed-off-by: Deepak Saxena # Signed-off-by: Russell King # # include/asm-arm/arch-ixp4xx/ixp4xx-regs.h # 2004/12/30 19:13:53+00:00 dsaxena@net.rmk.(none) +32 -0 # [PATCH] 2338/1: IXP465 and IXDPG465 header file updates # # include/asm-arm/arch-ixp4xx/irqs.h # 2004/12/30 19:13:53+00:00 dsaxena@net.rmk.(none) +21 -1 # [PATCH] 2338/1: IXP465 and IXDPG465 header file updates # # include/asm-arm/arch-ixp4xx/hardware.h # 2004/12/30 19:13:53+00:00 dsaxena@net.rmk.(none) +7 -0 # [PATCH] 2338/1: IXP465 and IXDPG465 header file updates # # include/asm-arm/arch-ixp4xx/entry-macro.S # 2004/12/30 19:13:46+00:00 dsaxena@net.rmk.(none) +13 -0 # [PATCH] 2338/1: IXP465 and IXDPG465 header file updates # # ChangeSet # 2005/01/01 23:20:59+11:00 airlied@starflyer.(none) # drm: core changes broke i810/830 # # Reported by Joseph Fannin during -mm, revert incorrect change. # # Signed-off-by: Dave Airlie # # drivers/char/drm/i830_drv.c # 2005/01/01 23:20:50+11:00 airlied@starflyer.(none) +1 -1 # drm: core changes broke i810/830 # # Reported by Joseph Fannin during -mm, revert incorrect change. # # Signed-off-by: Dave Airlie # # drivers/char/drm/i810_drv.c # 2005/01/01 23:20:50+11:00 airlied@starflyer.(none) +1 -1 # drm: core changes broke i810/830 # # Reported by Joseph Fannin during -mm, revert incorrect change. # # Signed-off-by: Dave Airlie # # ChangeSet # 2004/12/31 18:36:38+11:00 airlied@starflyer.(none) # drm: make reclaim_buffers take dev argument # # Allow drivers to override reclaim_buffers in an OS-independent # way by passing drm_device_t* as first parameter, like in the # BSD version. # # From: Felix Kuehling # Signed-off-by: Dave Airlie # # drivers/char/drm/i830_drv.h # 2004/12/31 18:36:29+11:00 airlied@starflyer.(none) +1 -1 # drm: make reclaim_buffers take dev argument # # Allow drivers to override reclaim_buffers in an OS-independent # way by passing drm_device_t* as first parameter, like in the # BSD version. # # From: Felix Kuehling # Signed-off-by: Dave Airlie # # drivers/char/drm/i830_dma.c # 2004/12/31 18:36:29+11:00 airlied@starflyer.(none) +2 -4 # drm: make reclaim_buffers take dev argument # # Allow drivers to override reclaim_buffers in an OS-independent # way by passing drm_device_t* as first parameter, like in the # BSD version. # # From: Felix Kuehling # Signed-off-by: Dave Airlie # # drivers/char/drm/i810_drv.h # 2004/12/31 18:36:29+11:00 airlied@starflyer.(none) +1 -1 # drm: make reclaim_buffers take dev argument # # Allow drivers to override reclaim_buffers in an OS-independent # way by passing drm_device_t* as first parameter, like in the # BSD version. # # From: Felix Kuehling # Signed-off-by: Dave Airlie # # drivers/char/drm/i810_dma.c # 2004/12/31 18:36:29+11:00 airlied@starflyer.(none) +2 -4 # drm: make reclaim_buffers take dev argument # # Allow drivers to override reclaim_buffers in an OS-independent # way by passing drm_device_t* as first parameter, like in the # BSD version. # # From: Felix Kuehling # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_fops.c # 2004/12/31 18:36:29+11:00 airlied@starflyer.(none) +1 -1 # drm: make reclaim_buffers take dev argument # # Allow drivers to override reclaim_buffers in an OS-independent # way by passing drm_device_t* as first parameter, like in the # BSD version. # # From: Felix Kuehling # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_dma.c # 2004/12/31 18:36:29+11:00 airlied@starflyer.(none) +1 -3 # drm: make reclaim_buffers take dev argument # # Allow drivers to override reclaim_buffers in an OS-independent # way by passing drm_device_t* as first parameter, like in the # BSD version. # # From: Felix Kuehling # Signed-off-by: Dave Airlie # # drivers/char/drm/drmP.h # 2004/12/31 18:36:29+11:00 airlied@starflyer.(none) +2 -2 # drm: make reclaim_buffers take dev argument # # Allow drivers to override reclaim_buffers in an OS-independent # way by passing drm_device_t* as first parameter, like in the # BSD version. # # From: Felix Kuehling # Signed-off-by: Dave Airlie # # ChangeSet # 2004/12/31 18:24:53+11:00 airlied@starflyer.(none) # drm: use spin_lock_init instead of SPIN_LOCK_UNLOCKED # # From: Jon Smirl # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_stub.c # 2004/12/31 18:24:45+11:00 airlied@starflyer.(none) +1 -1 # drm: use spin_lock_init instead of SPIN_LOCK_UNLOCKED # # From: Jon Smirl # Signed-off-by: Dave Airlie # # ChangeSet # 2004/12/31 18:18:54+11:00 airlied@starflyer.(none) # drm: correct historic mis-attribution of copyright # # From: Keith Withwell # Signed-off-by: Dave Airlie # # drivers/char/drm/sis_ds.h # 2004/12/31 18:18:45+11:00 airlied@starflyer.(none) +2 -2 # drm: correct historic mis-attribution of copyright # # From: Keith Withwell # Signed-off-by: Dave Airlie # # drivers/char/drm/sis_ds.c # 2004/12/31 18:18:45+11:00 airlied@starflyer.(none) +2 -2 # drm: correct historic mis-attribution of copyright # # From: Keith Withwell # Signed-off-by: Dave Airlie # # ChangeSet # 2004/12/31 18:15:21+11:00 airlied@starflyer.(none) # Make 1-bit fields be unsigned (no sign bit :). # sparse complains about them: # drivers/char/drm/sis_ds.h:88:12: warning: dubious one-bit signed bitfield # drivers/char/drm/sis_ds.h:89:16: warning: dubious one-bit signed bitfield # # Signed-off-by: Randy Dunlap # Signed-off-by: Dave Airlie # # drivers/char/drm/sis_ds.h # 2004/12/31 18:15:12+11:00 airlied@starflyer.(none) +2 -2 # Make 1-bit fields be unsigned (no sign bit :). # sparse complains about them: # drivers/char/drm/sis_ds.h:88:12: warning: dubious one-bit signed bitfield # drivers/char/drm/sis_ds.h:89:16: warning: dubious one-bit signed bitfield # # Signed-off-by: Randy Dunlap # Signed-off-by: Dave Airlie # # ChangeSet # 2004/12/31 12:46:36+11:00 airlied@starflyer.(none) # drm: Use wbinvd macro instead of assembly for it, # # From: Stefan Dirsch # Signed-off-by: Dave Airlie # # drivers/char/drm/ati_pcigart.c # 2004/12/31 12:46:27+11:00 airlied@starflyer.(none) +1 -1 # drm: Use wbinvd macro instead of assembly for it, # # From: Stefan Dirsch # Signed-off-by: Dave Airlie # # ChangeSet # 2004/12/31 00:26:38+00:00 dsaxena@net.rmk.(none) # [ARM PATCH] 2307/1: Add IXP46x and IXDPG465 implementation # # Patch from Deepak Saxena # # Patch adds implementation details for IXP46x CPUs and new IXDPG465 # reference platform. # # Signed-off-by: Deepak Saxena # Signed-off-by: Russell King # # arch/arm/mach-ixp4xx/ixdp425-setup.c # 2004/12/14 18:39:27+00:00 dsaxena@net.rmk.(none) +18 -0 # [PATCH] 2307/1: Add IXP46x and IXDPG465 implementation # # arch/arm/mach-ixp4xx/ixdp425-pci.c # 2004/12/14 17:57:55+00:00 dsaxena@net.rmk.(none) +2 -3 # [PATCH] 2307/1: Add IXP46x and IXDPG465 implementation # # arch/arm/mach-ixp4xx/common.c # 2004/12/14 17:22:07+00:00 dsaxena@net.rmk.(none) +18 -4 # [PATCH] 2307/1: Add IXP46x and IXDPG465 implementation # # arch/arm/mach-ixp4xx/common-pci.c # 2004/12/14 03:16:53+00:00 dsaxena@net.rmk.(none) +4 -3 # [PATCH] 2307/1: Add IXP46x and IXDPG465 implementation # # arch/arm/mach-ixp4xx/Kconfig # 2004/12/14 17:43:46+00:00 dsaxena@net.rmk.(none) +17 -1 # [PATCH] 2307/1: Add IXP46x and IXDPG465 implementation # # ChangeSet # 2004/12/31 00:20:31+00:00 dsaxena@net.rmk.(none) # [ARM PATCH] 2339/1: Don't mask IRQ_STATUS with IXP2000_VALID_IRQ_MASK # # Patch from Deepak Saxena # # Supersedes 2226/1 # # According to the IXP Programmer's Reference Manual, a read from # IRQ_STATUS can only return '1' for IRQ sources that have been # explicitly enabled in IRQ_ENABLE. So if we never enable 'invalid' # IRQ sources, we don't actually have to mask off IRQ_STATUS with # IXP2000_VALID_IRQ_MASK. # # Signed-off-by: Deepak Saxena # Signed-off-by: Russell King # # include/asm-arm/arch-ixp2000/entry-macro.S # 2004/12/30 20:07:56+00:00 dsaxena@net.rmk.(none) +0 -5 # [PATCH] 2339/1: Don't mask IRQ_STATUS with IXP2000_VALID_IRQ_MASK # # ChangeSet # 2004/12/31 00:14:52+00:00 rmk@flint.arm.linux.org.uk # [ARM] Add missing end of comment. # # include/asm-arm/arch-integrator/entry-macro.S # 2004/12/31 00:12:02+00:00 rmk@flint.arm.linux.org.uk +1 -0 # Add missing end of comment. # # ChangeSet # 2004/12/30 15:23:01-08:00 torvalds@ppc970.osdl.org # Merge bk://bart.bkbits.net/ide-2.6 # into ppc970.osdl.org:/home/torvalds/v2.6/linux # # include/linux/pci_ids.h # 2004/12/30 15:22:56-08:00 torvalds@ppc970.osdl.org +0 -0 # Auto merged # # arch/i386/pci/irq.c # 2004/12/30 15:22:56-08:00 torvalds@ppc970.osdl.org +0 -0 # Auto merged # # ChangeSet # 2004/12/30 15:21:16-08:00 acme@conectiva.com.br # [PATCH] Fix net/core/sock.o build failure # # This fixes a build failure that happens when you don't select IPV6. # # Signed-off-by: Linus Torvalds # # include/linux/ipv6.h # 2004/12/29 14:22:45-08:00 acme@conectiva.com.br +1 -1 # Fix net/core/sock.o build failure # # ChangeSet # 2004/12/30 22:40:35+01:00 bzolnier@trik.(none) # [patch] Intel ICH7 DID's, PIRQ and PATA support # # From: Jason Gaston # # This patch adds the Intel ICH7 DID's to the pci_ids.h file # and updates the piix driver and related files for PATA support. # # bart: this patch also adds PIRQ support # # Signed-off-by: Bartlomiej Zolnierkiewicz # # include/linux/pci_ids.h # 2004/12/28 16:07:28+01:00 bzolnier@trik.(none) +24 -0 # [patch] Intel ICH7 DID's, PIRQ and PATA support # # drivers/ide/pci/piix.h # 2004/12/28 16:07:28+01:00 bzolnier@trik.(none) +2 -1 # [patch] Intel ICH7 DID's, PIRQ and PATA support # # drivers/ide/pci/piix.c # 2004/12/28 16:07:28+01:00 bzolnier@trik.(none) +3 -0 # [patch] Intel ICH7 DID's, PIRQ and PATA support # # arch/i386/pci/irq.c # 2004/12/28 16:07:28+01:00 bzolnier@trik.(none) +2 -0 # [patch] Intel ICH7 DID's, PIRQ and PATA support # # ChangeSet # 2004/12/30 20:29:23+01:00 bzolnier@trik.(none) # [ide] make host drivers aware of the changes made to ide_setup_pci_device{s} # # - nothing clever here: the most noticeable change is the change of # returned value for (*init_setup) in struct ide_pci_device_s which # goes from void to int. Anything else is editing and checking for # errors in the output of the compiler; # - pci_disable_device() added for the error path in pci_init_sgiioc4(); # - BUG() removed in amd74xx_probe(): good old printk() is enough. # # Signed-off-by: Francois Romieu # Signed-off-by: Bartlomiej Zolnierkiewicz # # include/linux/ide.h # 2004/12/29 23:58:32+01:00 bzolnier@trik.(none) +1 -1 # [ide] make host drivers aware of the changes made to ide_setup_pci_device{s} # # drivers/ide/pci/via82cxxx.c # 2004/12/29 23:58:32+01:00 bzolnier@trik.(none) +1 -2 # [ide] make host drivers aware of the changes made to ide_setup_pci_device{s} # # drivers/ide/pci/trm290.c # 2004/12/29 23:58:32+01:00 bzolnier@trik.(none) +1 -2 # [ide] make host drivers aware of the changes made to ide_setup_pci_device{s} # # drivers/ide/pci/triflex.c # 2004/12/29 23:58:32+01:00 bzolnier@trik.(none) +1 -3 # [ide] make host drivers aware of the changes made to ide_setup_pci_device{s} # # drivers/ide/pci/slc90e66.c # 2004/12/29 23:58:32+01:00 bzolnier@trik.(none) +1 -2 # [ide] make host drivers aware of the changes made to ide_setup_pci_device{s} # # drivers/ide/pci/sl82c105.c # 2004/12/29 23:58:32+01:00 bzolnier@trik.(none) +1 -2 # [ide] make host drivers aware of the changes made to ide_setup_pci_device{s} # # drivers/ide/pci/sis5513.c # 2004/12/29 23:58:32+01:00 bzolnier@trik.(none) +1 -2 # [ide] make host drivers aware of the changes made to ide_setup_pci_device{s} # # drivers/ide/pci/siimage.c # 2004/12/29 23:58:32+01:00 bzolnier@trik.(none) +1 -2 # [ide] make host drivers aware of the changes made to ide_setup_pci_device{s} # # drivers/ide/pci/sgiioc4.c # 2004/12/29 23:58:32+01:00 bzolnier@trik.(none) +15 -4 # [ide] make host drivers aware of the changes made to ide_setup_pci_device{s} # # drivers/ide/pci/serverworks.h # 2004/12/29 23:58:32+01:00 bzolnier@trik.(none) +2 -2 # [ide] make host drivers aware of the changes made to ide_setup_pci_device{s} # # drivers/ide/pci/serverworks.c # 2004/12/29 23:58:32+01:00 bzolnier@trik.(none) +5 -6 # [ide] make host drivers aware of the changes made to ide_setup_pci_device{s} # # drivers/ide/pci/sc1200.c # 2004/12/29 23:58:32+01:00 bzolnier@trik.(none) +1 -2 # [ide] make host drivers aware of the changes made to ide_setup_pci_device{s} # # drivers/ide/pci/rz1000.c # 2004/12/29 23:58:32+01:00 bzolnier@trik.(none) +1 -2 # [ide] make host drivers aware of the changes made to ide_setup_pci_device{s} # # drivers/ide/pci/piix.h # 2004/12/29 23:58:32+01:00 bzolnier@trik.(none) +1 -1 # [ide] make host drivers aware of the changes made to ide_setup_pci_device{s} # # drivers/ide/pci/piix.c # 2004/12/29 23:58:32+01:00 bzolnier@trik.(none) +3 -4 # [ide] make host drivers aware of the changes made to ide_setup_pci_device{s} # # drivers/ide/pci/pdc202xx_old.h # 2004/12/29 23:58:32+01:00 bzolnier@trik.(none) +3 -3 # [ide] make host drivers aware of the changes made to ide_setup_pci_device{s} # # drivers/ide/pci/pdc202xx_old.c # 2004/12/29 23:58:32+01:00 bzolnier@trik.(none) +11 -9 # [ide] make host drivers aware of the changes made to ide_setup_pci_device{s} # # drivers/ide/pci/pdc202xx_new.h # 2004/12/29 23:58:32+01:00 bzolnier@trik.(none) +3 -3 # [ide] make host drivers aware of the changes made to ide_setup_pci_device{s} # # drivers/ide/pci/pdc202xx_new.c # 2004/12/29 23:58:32+01:00 bzolnier@trik.(none) +13 -14 # [ide] make host drivers aware of the changes made to ide_setup_pci_device{s} # # drivers/ide/pci/opti621.h # 2004/12/29 23:58:32+01:00 bzolnier@trik.(none) +1 -1 # [ide] make host drivers aware of the changes made to ide_setup_pci_device{s} # # drivers/ide/pci/opti621.c # 2004/12/29 23:58:32+01:00 bzolnier@trik.(none) +3 -4 # [ide] make host drivers aware of the changes made to ide_setup_pci_device{s} # # drivers/ide/pci/ns87415.c # 2004/12/29 23:58:32+01:00 bzolnier@trik.(none) +1 -2 # [ide] make host drivers aware of the changes made to ide_setup_pci_device{s} # # drivers/ide/pci/it8172.c # 2004/12/30 20:27:27+01:00 bzolnier@trik.(none) +1 -2 # [ide] make host drivers aware of the changes made to ide_setup_pci_device{s} # # drivers/ide/pci/hpt366.h # 2004/12/29 23:58:32+01:00 bzolnier@trik.(none) +3 -3 # [ide] make host drivers aware of the changes made to ide_setup_pci_device{s} # # drivers/ide/pci/hpt366.c # 2004/12/29 23:58:32+01:00 bzolnier@trik.(none) +16 -17 # [ide] make host drivers aware of the changes made to ide_setup_pci_device{s} # # drivers/ide/pci/hpt34x.c # 2004/12/29 23:58:32+01:00 bzolnier@trik.(none) +1 -2 # [ide] make host drivers aware of the changes made to ide_setup_pci_device{s} # # drivers/ide/pci/generic.c # 2004/12/30 20:27:07+01:00 bzolnier@trik.(none) +1 -2 # [ide] make host drivers aware of the changes made to ide_setup_pci_device{s} # # drivers/ide/pci/cy82c693.c # 2004/12/29 23:58:32+01:00 bzolnier@trik.(none) +3 -2 # [ide] make host drivers aware of the changes made to ide_setup_pci_device{s} # # drivers/ide/pci/cs5530.c # 2004/12/29 23:58:32+01:00 bzolnier@trik.(none) +1 -2 # [ide] make host drivers aware of the changes made to ide_setup_pci_device{s} # # drivers/ide/pci/cmd64x.c # 2004/12/29 23:58:32+01:00 bzolnier@trik.(none) +1 -2 # [ide] make host drivers aware of the changes made to ide_setup_pci_device{s} # # drivers/ide/pci/atiixp.c # 2004/12/29 23:58:32+01:00 bzolnier@trik.(none) +1 -2 # [ide] make host drivers aware of the changes made to ide_setup_pci_device{s} # # drivers/ide/pci/amd74xx.c # 2004/12/29 23:58:32+01:00 bzolnier@trik.(none) +6 -3 # [ide] make host drivers aware of the changes made to ide_setup_pci_device{s} # # drivers/ide/pci/alim15x3.c # 2004/12/29 23:58:32+01:00 bzolnier@trik.(none) +1 -2 # [ide] make host drivers aware of the changes made to ide_setup_pci_device{s} # # drivers/ide/pci/aec62xx.h # 2004/12/29 23:58:32+01:00 bzolnier@trik.(none) +2 -2 # [ide] make host drivers aware of the changes made to ide_setup_pci_device{s} # # drivers/ide/pci/aec62xx.c # 2004/12/29 23:58:32+01:00 bzolnier@trik.(none) +5 -6 # [ide] make host drivers aware of the changes made to ide_setup_pci_device{s} # # ChangeSet # 2004/12/30 20:16:30+01:00 bzolnier@trik.(none) # [ide] propagate the error status in ide_pci_enable/ide_setup_pci_controller # # - no need to overwrite the status code returned by the pci_xyz() functions; # - jump into the new century and use DMA_32BIT_MASK; # - misc cleanup in the error paths. It should not add a huge value in # ide_pci_enable() due to the FIXME comment but it should not bite too hard # either. # # Signed-off-by: Francois Romieu # Signed-off-by: Bartlomiej Zolnierkiewicz # # drivers/ide/setup-pci.c # 2004/12/30 20:16:19+01:00 bzolnier@trik.(none) +37 -21 # [ide] propagate the error status in ide_pci_enable/ide_setup_pci_controller # # ChangeSet # 2004/12/30 20:08:53+01:00 bzolnier@trik.(none) # [ide] clean up error path in do_ide_setup_pci_device() # # ide_setup_pci_controller() puts the device in a PCI enabled state. # The patch adds a small helper to balance it when things go wrong. # # Actually the helper does not *exactly* balance the setup: if it can # not do a better job, ide_setup_pci_controller() may only enable some # BARS whereas the new counterpart will try to disable everything. # # Signed-off-by: Francois Romieu # Signed-off-by: Bartlomiej Zolnierkiewicz # # drivers/ide/setup-pci.c # 2004/12/29 23:42:45+01:00 bzolnier@trik.(none) +13 -2 # [ide] clean up error path in do_ide_setup_pci_device() # # ChangeSet # 2004/12/30 19:26:14+01:00 bzolnier@trik.(none) # [ide] propagation of error code in PCI IDE setup # # - Change the return value and the prototype of do_ide_setup_pci_device # Due to lack of appropriate return status code, the current clients of # do_ide_setup_pci_device() can not distinguish a failing invocation # from a successfull one. The patch modify do_ide_setup_pci_device() so # that it can propagate some of the errors from the lower layers. # # - Make ide_setup_pci_device() aware of the change and propagate the news # itself. I only gave a quick sight to create_proc_ide_interfaces() (and # ide_remove_proc_entries()) but they do seem sane and it should not matter # if it fails or not. # # - ide_setup_pci_devices(): mostly the same thing than ide_setup_pci_device(). # do not look trivially suspect. # # Signed-off-by: Francois Romieu # Signed-off-by: Bartlomiej Zolnierkiewicz # # include/linux/ide.h # 2004/12/30 19:26:04+01:00 bzolnier@trik.(none) +2 -2 # [ide] propagation of error code in PCI IDE setup # # drivers/ide/setup-pci.c # 2004/12/30 19:26:04+01:00 bzolnier@trik.(none) +55 -28 # [ide] propagation of error code in PCI IDE setup # # ChangeSet # 2004/12/30 19:07:00+01:00 bzolnier@trik.(none) # [ide] fix return codes in the generic PCI IDE driver # # From: Alan Cox # # This patch updates ide/pci/generic.c to fix the incorrect returns # causing PCI devices to be left reserved wrongly by the driver. # # From: Francois Romieu # # Use -ENODEV instead of -EAGAIN. # # Signed-off-by: Bartlomiej Zolnierkiewicz # # drivers/ide/pci/generic.c # 2004/12/30 19:06:50+01:00 bzolnier@trik.(none) +8 -6 # [ide] fix return codes in the generic PCI IDE driver # # ChangeSet # 2004/12/30 19:00:56+01:00 bzolnier@trik.(none) # [ide] it8172: incorrect return from it8172_init_one() # # From: Alan Cox # # Several IDE drivers return positive values as errors in the PCI setup # code. Unfortunately the PCI layer considers positive values as success # so the driver skips the device but still claims it and things then go # downhill. # # This fixes the IT8172 driver. # # From: Francois Romieu # # Use -ENODEV instead of -EAGAIN. # # Signed-off-by: Bartlomiej Zolnierkiewicz # # drivers/ide/pci/it8172.c # 2004/12/30 19:00:46+01:00 bzolnier@trik.(none) +1 -1 # [ide] it8172: incorrect return from it8172_init_one() # # ChangeSet # 2004/12/29 17:32:38-08:00 viro@parcelfarce.linux.theplanet.co.uk # [PATCH] i386 uaccess annotations # # get_user() stores result in a local variable that later gets cast to # integer or pointer type. The proper type for that is unsigned long. # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # include/asm-i386/uaccess.h # 2004/12/29 11:25:15-08:00 viro@parcelfarce.linux.theplanet.co.uk +4 -2 # i386 uaccess annotations # # ChangeSet # 2004/12/29 23:21:55+01:00 bzolnier@trik.(none) # [ide] fix cleanup_module() in ide.c # # DMA should be already released by ide_unregister() # (unless interface is still busy). # # Signed-off-by: Bartlomiej Zolnierkiewicz # # drivers/ide/ide.c # 2004/12/29 23:21:46+01:00 bzolnier@trik.(none) +1 -4 # [ide] fix cleanup_module() in ide.c # # ChangeSet # 2004/12/29 23:11:22+01:00 bzolnier@trik.(none) # [ide] ide-proc: kill destroy_proc_ide_interfaces() # # /proc interface entries should be already unregistered # by ide_unregister() (unless interface is still busy). # # Signed-off-by: Bartlomiej Zolnierkiewicz # # drivers/ide/ide-proc.c # 2004/12/26 00:19:15+01:00 bzolnier@trik.(none) +0 -15 # [ide] ide-proc: kill destroy_proc_ide_interfaces() # # ChangeSet # 2004/12/29 21:00:56+00:00 davis_g@com.rmk.(none) # [ARM PATCH] 2327/1: Thumb ld/st alignment fault fixups # # Patch from George G. Davis # # Adds support for Thumb ld/st alignment fault fixups via conversion of # Thumb ld/st instruction forms into equivalent ARM instructions and # reusing ARM alignment fault handler for Thumb instructions. This # implementation was inspired by and initially based on the algorithm # found in gdb/sim/arm/thumbemu.c. # # I've backed out the silly 'T' suffix on PC in this version as requested # by RMK. At this point, I prefer to avoid making any of the other changes # discussed, e.g. dump_instr() for bad instruction cases, in order to get # the basic Thumb support change committed. # # Thanks! # # Signed-off-by: George G. Davis # Signed-off-by: Russell King # # arch/arm/mm/alignment.c # 2004/12/29 00:00:00+00:00 davis_g@com.rmk.(none) +145 -7 # [PATCH] 2327/1: Thumb ld/st alignment fault fixups # # ChangeSet # 2004/12/29 20:39:53+00:00 tony@com.rmk.(none) # [ARM PATCH] 2336/1: OMAP update 1/2: Arch files, take 2 # # Patch from Tony Lindgren # # This patch syncs the mainline kernel with the linux-omap tree. # The highlights of the patch are: # - Add OMAP board specific low-level init functions for smc91x Ethernet # - DMA audio functions by Nishant Menon # - Remove references to OMAP specific serial.h # # This is an updated version of ARM patch 2331/1 with extra comments # added to the omap_get_dma_src_pos() and omap_get_dma_dst_pos() functions # as recommended by RMK. # # Signed-off-by: Tony Lindgren # Signed-off-by: Russell King # # arch/arm/mach-omap/pm.c # 2004/12/27 20:48:59+00:00 tony@com.rmk.(none) +9 -3 # [PATCH] 2336/1: OMAP update 1/2: Arch files, take 2 # # arch/arm/mach-omap/dma.c # 2004/12/27 20:46:42+00:00 tony@com.rmk.(none) +49 -4 # [PATCH] 2336/1: OMAP update 1/2: Arch files, take 2 # # arch/arm/mach-omap/common.c # 2004/12/27 22:18:34+00:00 tony@com.rmk.(none) +7 -7 # [PATCH] 2336/1: OMAP update 1/2: Arch files, take 2 # # arch/arm/mach-omap/board-perseus2.c # 2004/12/27 20:48:59+00:00 tony@com.rmk.(none) +17 -5 # [PATCH] 2336/1: OMAP update 1/2: Arch files, take 2 # # arch/arm/mach-omap/board-osk.c # 2004/12/27 22:18:34+00:00 tony@com.rmk.(none) +13 -3 # [PATCH] 2336/1: OMAP update 1/2: Arch files, take 2 # # arch/arm/mach-omap/board-innovator.c # 2004/12/27 22:18:34+00:00 tony@com.rmk.(none) +21 -8 # [PATCH] 2336/1: OMAP update 1/2: Arch files, take 2 # # arch/arm/mach-omap/board-h3.c # 2004/12/27 22:18:34+00:00 tony@com.rmk.(none) +21 -7 # [PATCH] 2336/1: OMAP update 1/2: Arch files, take 2 # # arch/arm/mach-omap/board-h2.c # 2004/12/27 22:18:34+00:00 tony@com.rmk.(none) +15 -3 # [PATCH] 2336/1: OMAP update 1/2: Arch files, take 2 # # ChangeSet # 2004/12/29 10:43:28-08:00 viro@parcelfarce.linux.theplanet.co.uk # [PATCH] ppc __iomem annotations - ->cfg_addr # # ->cfg_addr is an iomem pointer; annotated as such, setup_indirect_pci() # cleaned up. # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # include/asm-ppc/pci-bridge.h # 2004/12/28 16:02:37-08:00 viro@parcelfarce.linux.theplanet.co.uk +2 -2 # ppc __iomem annotations - ->cfg_addr # # arch/ppc/syslib/indirect_pci.c # 2004/12/28 16:02:37-08:00 viro@parcelfarce.linux.theplanet.co.uk +8 -8 # ppc __iomem annotations - ->cfg_addr # # arch/ppc/platforms/pmac_pci.c # 2004/12/28 16:02:37-08:00 viro@parcelfarce.linux.theplanet.co.uk +2 -4 # ppc __iomem annotations - ->cfg_addr # # ChangeSet # 2004/12/29 10:43:15-08:00 viro@parcelfarce.linux.theplanet.co.uk # [PATCH] ppc __iomem annotations - openpic # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # include/asm-ppc/open_pic.h # 2004/12/28 16:02:36-08:00 viro@parcelfarce.linux.theplanet.co.uk +2 -2 # ppc __iomem annotations - openpic # # arch/ppc/syslib/open_pic_defs.h # 2004/12/28 16:02:36-08:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1 # ppc __iomem annotations - openpic # # arch/ppc/syslib/open_pic.c # 2004/12/28 16:02:36-08:00 viro@parcelfarce.linux.theplanet.co.uk +21 -21 # ppc __iomem annotations - openpic # # ChangeSet # 2004/12/29 10:43:02-08:00 viro@parcelfarce.linux.theplanet.co.uk # [PATCH] ppc __iomem annotations - gg2 # # gg2_pci_config_base is an iomem pointer. # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # include/asm-ppc/gg2.h # 2004/12/28 16:02:36-08:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1 # ppc __iomem annotations - gg2 # # arch/ppc/platforms/chrp_setup.c # 2004/12/28 16:02:36-08:00 viro@parcelfarce.linux.theplanet.co.uk +4 -5 # ppc __iomem annotations - gg2 # # arch/ppc/platforms/chrp_pci.c # 2004/12/28 16:02:36-08:00 viro@parcelfarce.linux.theplanet.co.uk +4 -3 # ppc __iomem annotations - gg2 # # ChangeSet # 2004/12/29 10:42:49-08:00 viro@parcelfarce.linux.theplanet.co.uk # [PATCH] ppc __iomem annotations - ->cfg_data # # struct pci_controller ->cfg_data annotated as iomem pointer; users # modified accordingly... # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # include/asm-ppc/pci-bridge.h # 2004/12/28 16:02:36-08:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1 # ppc __iomem annotations - ->cfg_data # # arch/ppc/syslib/indirect_pci.c # 2004/12/28 16:02:36-08:00 viro@parcelfarce.linux.theplanet.co.uk +9 -9 # ppc __iomem annotations - ->cfg_data # # arch/ppc/platforms/prep_pci.c # 2004/12/28 16:02:36-08:00 viro@parcelfarce.linux.theplanet.co.uk +8 -8 # ppc __iomem annotations - ->cfg_data # # arch/ppc/platforms/pmac_pci.c # 2004/12/28 16:02:36-08:00 viro@parcelfarce.linux.theplanet.co.uk +40 -42 # ppc __iomem annotations - ->cfg_data # # arch/ppc/platforms/chrp_pci.c # 2004/12/28 16:02:36-08:00 viro@parcelfarce.linux.theplanet.co.uk +9 -10 # ppc __iomem annotations - ->cfg_data # # ChangeSet # 2004/12/29 10:42:36-08:00 viro@parcelfarce.linux.theplanet.co.uk # [PATCH] av7110_hw __user annotations fix # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # drivers/media/dvb/ttpci/av7110_hw.c # 2004/12/28 11:29:54-08:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1 # av7110_hw __user annotations fix # # ChangeSet # 2004/12/29 10:42:23-08:00 viro@parcelfarce.linux.theplanet.co.uk # [PATCH] dib3000 portability fix # # size_t is %zd, not %d... # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # drivers/media/dvb/frontends/dib3000-common.h # 2004/12/28 11:29:54-08:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1 # dib3000 portability fix # # ChangeSet # 2004/12/29 10:42:10-08:00 viro@parcelfarce.linux.theplanet.co.uk # [PATCH] tda80xx.c portability fix # # should include asm/irq.h, not linux/irq.h # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # drivers/media/dvb/frontends/tda80xx.c # 2004/12/28 11:29:53-08:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1 # tda80xx.c portability fix # # ChangeSet # 2004/12/29 10:41:57-08:00 viro@parcelfarce.linux.theplanet.co.uk # [PATCH] more isa-ectomy # # switch to ioremap + normal iomem access primitives # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # drivers/char/i8k.c # 2004/12/28 11:07:48-08:00 viro@parcelfarce.linux.theplanet.co.uk +25 -22 # more isa-ectomy # # arch/i386/kernel/traps.c # 2004/12/28 11:07:48-08:00 viro@parcelfarce.linux.theplanet.co.uk +3 -1 # more isa-ectomy # # arch/i386/kernel/dmi_scan.c # 2004/12/28 11:07:48-08:00 viro@parcelfarce.linux.theplanet.co.uk +7 -6 # more isa-ectomy # # ChangeSet # 2004/12/29 10:41:44-08:00 viro@parcelfarce.linux.theplanet.co.uk # [PATCH] hotplug NULL noise removal # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # drivers/pci/hotplug/pciehp_hpc.c # 2004/12/28 11:02:33-08:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1 # hotplug NULL noise removal # # ChangeSet # 2004/12/29 10:41:31-08:00 viro@parcelfarce.linux.theplanet.co.uk # [PATCH] ppc io.h annotations # # * prototypes converted to standard ones # * bunch of useless casts killed in ioread*/iowrite* # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # include/asm-ppc/io.h # 2004/12/27 19:11:33-08:00 viro@parcelfarce.linux.theplanet.co.uk +12 -10 # ppc io.h annotations # # ChangeSet # 2004/12/29 10:41:18-08:00 viro@parcelfarce.linux.theplanet.co.uk # [PATCH] x86_64 io.h annotations # # x86-64 memcpy_toio(), memcpy_fromio(), memset_io() and read{b,w,l,q}(), # switched to standard prototypes. # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # include/asm-x86_64/io.h # 2004/12/27 18:56:21-08:00 viro@parcelfarce.linux.theplanet.co.uk +12 -12 # x86_64 io.h annotations # # arch/x86_64/lib/io.c # 2004/12/27 18:56:21-08:00 viro@parcelfarce.linux.theplanet.co.uk +4 -4 # x86_64 io.h annotations # # ChangeSet # 2004/12/29 10:41:06-08:00 viro@parcelfarce.linux.theplanet.co.uk # [PATCH] cinergy __user annotations # # __user annotations in new code. # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # drivers/media/dvb/cinergyT2/cinergyT2.c # 2004/12/26 22:04:22-08:00 viro@parcelfarce.linux.theplanet.co.uk +4 -4 # cinergy __user annotations # # ChangeSet # 2004/12/29 10:40:52-08:00 viro@parcelfarce.linux.theplanet.co.uk # [PATCH] mxser annotations and compile fixes # # a) __user annotations # b) NULL noise removals # c) added missing ifdef CONFIG_PCI around the loop over mxser_pcibrds # during init. # d) declaration of CMSPAR in case if it had been undefined moved up # prior to the first use # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # drivers/char/mxser.c # 2004/12/26 22:04:22-08:00 viro@parcelfarce.linux.theplanet.co.uk +47 -43 # mxser annotations and compile fixes # # ChangeSet # 2004/12/29 10:40:39-08:00 viro@parcelfarce.linux.theplanet.co.uk # [PATCH] zatm fix # # Repairs the breakage introduced in gcc4 fixes. Original had expanded # to # # ((struct zatm_dev *)(dev)->dev_data) = zatm_dev; # # and that's what gcc4 had complained about (cast-as-lvalue). Proper fix is, # of course, # # dev->dev_data = zatm_dev; # # What we have in 2.6.10 is # # dev = (struct atm_dev *)zatm_dev; # # which doesn't cause complaints, but doesn't do anything good (leak + corruption # at the very least). # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # drivers/atm/zatm.c # 2004/12/26 22:04:22-08:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1 # zatm fix # # ChangeSet # 2004/12/29 10:40:24-08:00 viro@parcelfarce.linux.theplanet.co.uk # [PATCH] affs headers cleanup # # kernel-only stuff moved from affs headers in include/linux to # fs/affs/affs.h; includes in fs/affs/*.c sanitized. # # That's the patch that had been ACKed by Roman + move of function-like # macros from amigaffs.h (also ACKed) + removal of ancient #if 0'ed junk # from declaration of affs_inode_info (spotted and suggested by Roman). # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # include/linux/amigaffs.h # 2004/12/26 22:04:23-08:00 viro@parcelfarce.linux.theplanet.co.uk +0 -132 # affs headers cleanup # # include/linux/affs_fs.h # 2004/12/26 22:04:23-08:00 viro@parcelfarce.linux.theplanet.co.uk +0 -89 # affs headers cleanup # # fs/affs/symlink.c # 2004/12/26 22:04:23-08:00 viro@parcelfarce.linux.theplanet.co.uk +1 -8 # affs headers cleanup # # fs/affs/super.c # 2004/12/26 22:04:23-08:00 viro@parcelfarce.linux.theplanet.co.uk +2 -18 # affs headers cleanup # # fs/affs/namei.c # 2004/12/26 22:04:23-08:00 viro@parcelfarce.linux.theplanet.co.uk +1 -14 # affs headers cleanup # # fs/affs/inode.c # 2004/12/26 22:04:23-08:00 viro@parcelfarce.linux.theplanet.co.uk +1 -21 # affs headers cleanup # # fs/affs/file.c # 2004/12/26 22:04:23-08:00 viro@parcelfarce.linux.theplanet.co.uk +1 -18 # affs headers cleanup # # fs/affs/dir.c # 2004/12/26 22:04:23-08:00 viro@parcelfarce.linux.theplanet.co.uk +1 -11 # affs headers cleanup # # fs/affs/affs.h # 2004/12/29 10:40:16-08:00 viro@parcelfarce.linux.theplanet.co.uk +304 -0 # # fs/affs/bitmap.c # 2004/12/26 22:04:23-08:00 viro@parcelfarce.linux.theplanet.co.uk +1 -9 # affs headers cleanup # # fs/affs/amigaffs.c # 2004/12/26 22:04:23-08:00 viro@parcelfarce.linux.theplanet.co.uk +1 -8 # affs headers cleanup # # fs/affs/affs.h # 2004/12/29 10:40:16-08:00 viro@parcelfarce.linux.theplanet.co.uk +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/fs/affs/affs.h # # BitKeeper/deleted/.del-affs_fs_sb.h~92e539b5b05bc854 # 2004/12/29 10:40:16-08:00 viro@parcelfarce.linux.theplanet.co.uk +0 -0 # Delete: include/linux/affs_fs_sb.h # # BitKeeper/deleted/.del-affs_fs_i.h~383cf65512c8acae # 2004/12/29 10:40:15-08:00 viro@parcelfarce.linux.theplanet.co.uk +0 -0 # Delete: include/linux/affs_fs_i.h # # ChangeSet # 2004/12/29 15:41:46+00:00 tony@com.rmk.(none) # [ARM PATCH] 2329/1: Update Kconfig for OMAP processor options # # Patch from Tony Lindgren # # Updates processor specific Kconfig options for OMAP # # Signed-off-by: Tony Lindgren # Signed-off-by: Russell King # # arch/arm/mm/Kconfig # 2004/12/27 22:18:35+00:00 tony@com.rmk.(none) +5 -4 # [PATCH] 2329/1: Update Kconfig for OMAP processor options # # ChangeSet # 2004/12/29 15:36:14+00:00 tony@com.rmk.(none) # [ARM PATCH] 2328/1: ARM Kconfig updates for OMAP leds # # Patch from Tony Lindgren # # ARM Kconfig updates for OMAP leds # # Signed-off-by: Tony Lindgren # Signed-off-by: Russell King # # arch/arm/Kconfig # 2004/12/27 20:12:55+00:00 tony@com.rmk.(none) +2 -2 # [PATCH] 2328/1: ARM Kconfig updates for OMAP leds # # ChangeSet # 2004/12/29 15:30:34+00:00 dsaxena@net.rmk.(none) # [ARM PATCH] 2326/1: Fix IXP2000 timer implementation # # Patch from Deepak Saxena # # This patch fixes two issues with the IXP2000 timer implementation: # # - We currently to not account for lost timer interrupts # - We currently do not check for rollover within gettimeoffset() # # Signed-off-by: Deepak Saxena # Signed-off-by: Russell King # # include/asm-arm/arch-ixp2000/ixp2000-regs.h # 2004/12/22 23:25:34+00:00 dsaxena@net.rmk.(none) +1 -0 # [PATCH] 2326/1: Fix IXP2000 timer implementation # # arch/arm/mach-ixp2000/core.c # 2004/12/22 21:31:45+00:00 dsaxena@net.rmk.(none) +29 -6 # [PATCH] 2326/1: Fix IXP2000 timer implementation # # ChangeSet # 2004/12/29 15:25:09+00:00 dsaxena@net.rmk.(none) # [ARM PATCH] 2325/1: Cleanup IXP2000 reset handling # # Patch from Deepak Saxena # # On IXDP2801 we need to write a magic sequence to the CPLD to ensure # a full system reset instead of just CPU reset. Also cleanup some # comments and copyrights while we are in here. # # Signed-off-by: Deepak Saxena # Signed-off-by: Russell King # # include/asm-arm/arch-ixp2000/system.h # 2004/12/22 21:07:23+00:00 dsaxena@net.rmk.(none) +21 -2 # [PATCH] 2325/1: Cleanup IXP2000 reset handling # # ChangeSet # 2004/12/29 15:20:01+00:00 davis_g@com.rmk.(none) # [ARM PATCH] 2324/1: Convert ARM proc files to use domain and pgtable manifest constants # # Patch from George G. Davis # # Convert ARM proc files to use manifest constants defined in pgtable.h # and domain.h. This is a prelude to allow renumbering domains. The # domain renumbering is required to implement support for ARMv6 MMU # super sections where domain 0 is implied. Although this is technically # only required for ARMv6, it seemed reasonable to clean up all proc # files while here. # # I did a test build with and without this patch applied and confirmed # that all proc file binaries are unchanged when this patch is applied. # # Signed-off-by: George G. Davis # Signed-off-by: Russell King # # include/asm-arm/domain.h # 2004/12/29 00:00:00+00:00 davis_g@com.rmk.(none) +3 -1 # [PATCH] 2324/1: Convert ARM proc files to use domain and pgtable manifest constants # # arch/arm/mm/proc-xscale.S # 2004/12/29 00:00:00+00:00 davis_g@com.rmk.(none) +55 -11 # [PATCH] 2324/1: Convert ARM proc files to use domain and pgtable manifest constants # # arch/arm/mm/proc-v6.S # 2004/12/29 00:00:00+00:00 davis_g@com.rmk.(none) +10 -2 # [PATCH] 2324/1: Convert ARM proc files to use domain and pgtable manifest constants # # arch/arm/mm/proc-sa1100.S # 2004/12/29 00:00:00+00:00 davis_g@com.rmk.(none) +15 -3 # [PATCH] 2324/1: Convert ARM proc files to use domain and pgtable manifest constants # # arch/arm/mm/proc-sa110.S # 2004/12/29 00:00:00+00:00 davis_g@com.rmk.(none) +10 -2 # [PATCH] 2324/1: Convert ARM proc files to use domain and pgtable manifest constants # # arch/arm/mm/proc-arm926.S # 2004/12/29 00:00:00+00:00 davis_g@com.rmk.(none) +11 -2 # [PATCH] 2324/1: Convert ARM proc files to use domain and pgtable manifest constants # # arch/arm/mm/proc-arm925.S # 2004/12/29 00:00:00+00:00 davis_g@com.rmk.(none) +13 -3 # [PATCH] 2324/1: Convert ARM proc files to use domain and pgtable manifest constants # # arch/arm/mm/proc-arm922.S # 2004/12/29 00:00:00+00:00 davis_g@com.rmk.(none) +11 -2 # [PATCH] 2324/1: Convert ARM proc files to use domain and pgtable manifest constants # # arch/arm/mm/proc-arm920.S # 2004/12/29 00:00:00+00:00 davis_g@com.rmk.(none) +11 -2 # [PATCH] 2324/1: Convert ARM proc files to use domain and pgtable manifest constants # # arch/arm/mm/proc-arm720.S # 2004/12/29 00:00:00+00:00 davis_g@com.rmk.(none) +21 -4 # [PATCH] 2324/1: Convert ARM proc files to use domain and pgtable manifest constants # # arch/arm/mm/proc-arm6_7.S # 2004/12/29 00:00:00+00:00 davis_g@com.rmk.(none) +15 -3 # [PATCH] 2324/1: Convert ARM proc files to use domain and pgtable manifest constants # # arch/arm/mm/proc-arm1026.S # 2004/12/29 00:00:00+00:00 davis_g@com.rmk.(none) +9 -2 # [PATCH] 2324/1: Convert ARM proc files to use domain and pgtable manifest constants # # arch/arm/mm/proc-arm1022.S # 2004/12/29 00:00:00+00:00 davis_g@com.rmk.(none) +9 -2 # [PATCH] 2324/1: Convert ARM proc files to use domain and pgtable manifest constants # # arch/arm/mm/proc-arm1020e.S # 2004/12/29 00:00:00+00:00 davis_g@com.rmk.(none) +10 -2 # [PATCH] 2324/1: Convert ARM proc files to use domain and pgtable manifest constants # # arch/arm/mm/proc-arm1020.S # 2004/12/29 00:00:00+00:00 davis_g@com.rmk.(none) +8 -2 # [PATCH] 2324/1: Convert ARM proc files to use domain and pgtable manifest constants # # ChangeSet # 2004/12/29 15:02:36+00:00 tony@com.rmk.(none) # [ARM PATCH] 2332/1: OMAP update 1/2: Include files # # Patch from Tony Lindgren # # This patch syncs the mainline kernel with the linux-omap tree. # The patch mostly contains minor fixes and extra register definitions # by various OMAP developers. # # Signed-off-by: Tony Lindgren # Signed-off-by: Russell King # # include/asm-arm/arch-omap/omap16xx.h # 2004/12/27 20:09:02+00:00 tony@com.rmk.(none) +2 -1 # [PATCH] 2332/1: OMAP update 1/2: Include files # # include/asm-arm/arch-omap/mux.h # 2004/12/27 20:09:02+00:00 tony@com.rmk.(none) +12 -0 # [PATCH] 2332/1: OMAP update 1/2: Include files # # include/asm-arm/arch-omap/irqs.h # 2004/12/27 20:09:02+00:00 tony@com.rmk.(none) +2 -0 # [PATCH] 2332/1: OMAP update 1/2: Include files # # include/asm-arm/arch-omap/hardware.h # 2004/12/27 20:09:02+00:00 tony@com.rmk.(none) +1 -1 # [PATCH] 2332/1: OMAP update 1/2: Include files # # include/asm-arm/arch-omap/gpio.h # 2004/12/27 20:09:02+00:00 tony@com.rmk.(none) +1 -0 # [PATCH] 2332/1: OMAP update 1/2: Include files # # include/asm-arm/arch-omap/dma.h # 2004/12/27 20:09:02+00:00 tony@com.rmk.(none) +4 -0 # [PATCH] 2332/1: OMAP update 1/2: Include files # # ChangeSet # 2004/12/28 23:28:15-08:00 drm.adm@bkbits.net # Merge bkbits.net:/repos/l/linux/linux-2.5 # into bkbits.net:/repos/d/drm/drm-2.6 # # drivers/char/drm/drm_drv.c # 2004/12/28 23:27:40-08:00 drm.adm@bkbits.net +1 -1 # backout conflicting changes .. will # later... # # drivers/char/drm/drm_drv.c # 2004/12/28 23:23:50-08:00 drm.adm@bkbits.net +0 -0 # Merge rename: drivers/char/drm/drm_drv.h -> drivers/char/drm/drm_drv.c # # ChangeSet # 2004/12/28 22:05:31+01:00 bzolnier@trik.(none) # [ide] serverworks: add support for CSB6 RAID # # From: Alan Cox # # The ServerWorks chips include a RAID variant that the 2.6 driver didn't # support. This enables support for this and removes a pile of #if and # other pointless obfuscations. This removes the need to use various # vendor binary only drivers for CSB6 RAID. # # Signed-off-by: Bartlomiej Zolnierkiewicz # # drivers/ide/pci/serverworks.c # 2004/12/26 19:50:17+01:00 bzolnier@trik.(none) +2 -18 # [ide] serverworks: add support for CSB6 RAID # # ChangeSet # 2004/12/28 20:35:01+01:00 bzolnier@trik.(none) # [ide] add "ide=nodma" to documentation # # Here's a quick patch to add the currently-undocumented ide=nodma option # to the Documentation/ide.txt file. Since the code does not mark this # option as obsolete as far as I can see, I can only assume that it should # be in the documentation # # Signed-off-by: Vadim Lobanov # Signed-off-by: Bartlomiej Zolnierkiewicz # # Documentation/ide.txt # 2004/12/26 22:58:19+01:00 bzolnier@trik.(none) +2 -0 # [ide] add "ide=nodma" to documentation # # ChangeSet # 2004/12/27 22:45:18-08:00 davem@nuts.davemloft.net # [SPARC64]: Include infiniband driver config and update defconfig. # # Signed-off-by: David S. Miller # # arch/sparc64/defconfig # 2004/12/27 22:44:46-08:00 davem@nuts.davemloft.net +24 -4 # [SPARC64]: Include infiniband driver config and update defconfig. # # arch/sparc64/Kconfig # 2004/12/27 22:44:46-08:00 davem@nuts.davemloft.net +2 -0 # [SPARC64]: Include infiniband driver config and update defconfig. # # ChangeSet # 2004/12/27 22:30:04-08:00 davem@nuts.davemloft.net # Merge nuts.davemloft.net:/disk1/BK/ib-2.6 # into nuts.davemloft.net:/disk1/BK/net-2.6 # # net/ipv4/arp.c # 2004/12/27 22:29:52-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # include/net/ip.h # 2004/12/27 22:29:52-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # MAINTAINERS # 2004/12/27 22:29:52-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # ChangeSet # 2004/12/27 22:26:29-08:00 roland@topspin.com # [INFINIBAND]: InfiniBand MAINTAINERS entry # # Add OpenIB maintainers information to MAINTAINERS. # # Signed-off-by: Roland Dreier # Signed-off-by: David S. Miller # # MAINTAINERS # 2004/12/27 22:26:10-08:00 roland@topspin.com +11 -0 # [INFINIBAND]: InfiniBand MAINTAINERS entry # # Add OpenIB maintainers information to MAINTAINERS. # # Signed-off-by: Roland Dreier # Signed-off-by: David S. Miller # # ChangeSet # 2004/12/27 22:25:37-08:00 roland@topspin.com # [INFINIBAND]: Add InfiniBand Documentation files # # Add files to Documentation/infiniband that describe the tree under # /sys/class/infiniband, the IPoIB driver and the userspace MAD access driver. # # Signed-off-by: Roland Dreier # Signed-off-by: David S. Miller # # Documentation/infiniband/user_mad.txt # 2004/12/27 22:25:05-08:00 roland@topspin.com +81 -0 # [INFINIBAND]: Add InfiniBand Documentation files # # Documentation/infiniband/sysfs.txt # 2004/12/27 22:25:05-08:00 roland@topspin.com +64 -0 # [INFINIBAND]: Add InfiniBand Documentation files # # Documentation/infiniband/user_mad.txt # 2004/12/27 22:25:05-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/Documentation/infiniband/user_mad.txt # # Documentation/infiniband/sysfs.txt # 2004/12/27 22:25:05-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/Documentation/infiniband/sysfs.txt # # Documentation/infiniband/ipoib.txt # 2004/12/27 22:25:04-08:00 roland@topspin.com +56 -0 # [INFINIBAND]: Add InfiniBand Documentation files # # Documentation/infiniband/ipoib.txt # 2004/12/27 22:25:04-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/Documentation/infiniband/ipoib.txt # # ChangeSet # 2004/12/27 22:24:37-08:00 roland@topspin.com # [INFINIBAND]: Document InfiniBand ioctl use # # Add the 0x1b ioctl magic number used by ib_umad module to # Documentation/ioctl-number.txt. # # Signed-off-by: Roland Dreier # Signed-off-by: David S. Miller # # Documentation/ioctl-number.txt # 2004/12/27 22:24:18-08:00 roland@topspin.com +1 -0 # [INFINIBAND]: Document InfiniBand ioctl use # # Add the 0x1b ioctl magic number used by ib_umad module to # Documentation/ioctl-number.txt. # # Signed-off-by: Roland Dreier # Signed-off-by: David S. Miller # # ChangeSet # 2004/12/27 22:23:44-08:00 roland@topspin.com # [INFINIBAND]: Add IPoIB userspace MAD support # # Add a driver that provides a character special device for each # InfiniBand port. This device allows userspace to send and receive # MADs via write() and read() (with some control operations implemented # as ioctls). # # All operations are 32/64 clean and have been tested with 32-bit # userspace running on a ppc64 kernel. # # Signed-off-by: Roland Dreier # Signed-off-by: David S. Miller # # drivers/infiniband/core/Makefile # 2004/12/27 22:23:12-08:00 roland@topspin.com +3 -1 # [INFINIBAND]: Add IPoIB userspace MAD support # # drivers/infiniband/include/ib_user_mad.h # 2004/12/27 22:23:10-08:00 roland@topspin.com +123 -0 # [INFINIBAND]: Add IPoIB userspace MAD support # # drivers/infiniband/include/ib_user_mad.h # 2004/12/27 22:23:10-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/include/ib_user_mad.h # # drivers/infiniband/core/user_mad.c # 2004/12/27 22:23:08-08:00 roland@topspin.com +738 -0 # [INFINIBAND]: Add IPoIB userspace MAD support # # drivers/infiniband/core/user_mad.c # 2004/12/27 22:23:08-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/core/user_mad.c # # ChangeSet # 2004/12/27 22:22:21-08:00 roland@topspin.com # [INFINIBAND]: Add IPoIB multicast and partition code # # Add functions for handling IPoIB multicast and multiple partitions. # # Signed-off-by: Roland Dreier # Signed-off-by: David S. Miller # # drivers/infiniband/ulp/ipoib/ipoib_vlan.c # 2004/12/27 22:21:51-08:00 roland@topspin.com +177 -0 # [INFINIBAND]: Add IPoIB multicast and partition code # # drivers/infiniband/ulp/ipoib/ipoib_vlan.c # 2004/12/27 22:21:51-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/ulp/ipoib/ipoib_vlan.c # # drivers/infiniband/ulp/ipoib/ipoib_multicast.c # 2004/12/27 22:21:49-08:00 roland@topspin.com +981 -0 # [INFINIBAND]: Add IPoIB multicast and partition code # # drivers/infiniband/ulp/ipoib/ipoib_multicast.c # 2004/12/27 22:21:49-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/ulp/ipoib/ipoib_multicast.c # # ChangeSet # 2004/12/27 22:21:15-08:00 roland@topspin.com # [INFINIBAND]: Add IPoIB (IP-over-InfiniBand) driver # # Add a driver that implements the (IPoIB) IP-over-InfiniBand protocol. # This is a network device driver of type ARPHRD_INFINIBAND (and # addr_len INFINIBAND_ALEN bytes). # # The ARP/ND implementation for this driver is not completely # straightforward, because InfiniBand requires an additional path lookup # be performed (through an IB-specific mechanism) after a remote # hardware address has been resolved. We are very open to suggestions # of a better way to handle this than the current implementation. # # Although IB has a special multicast group join mode intended to # support IP multicast routing (non member join), no means to identify # different multicast styles has yet been determined, so all joins by # the driver are currently full member joins. We are looking for # guidance in how to solve this. # # The IPoIB protocol/encapsulation is described in the Internet-Drafts # http://www.ietf.org/internet-drafts/draft-ietf-ipoib-architecture-04.txt # http://www.ietf.org/internet-drafts/draft-ietf-ipoib-ip-over-infiniband-08.txt # # Signed-off-by: Roland Dreier # Signed-off-by: David S. Miller # # drivers/infiniband/Makefile # 2004/12/27 22:20:37-08:00 roland@topspin.com +1 -0 # [INFINIBAND]: Add IPoIB (IP-over-InfiniBand) driver # # drivers/infiniband/Kconfig # 2004/12/27 22:20:37-08:00 roland@topspin.com +2 -0 # [INFINIBAND]: Add IPoIB (IP-over-InfiniBand) driver # # drivers/infiniband/ulp/ipoib/ipoib_verbs.c # 2004/12/27 22:20:35-08:00 roland@topspin.com +254 -0 # [INFINIBAND]: Add IPoIB (IP-over-InfiniBand) driver # # drivers/infiniband/ulp/ipoib/ipoib_main.c # 2004/12/27 22:20:35-08:00 roland@topspin.com +1079 -0 # [INFINIBAND]: Add IPoIB (IP-over-InfiniBand) driver # # drivers/infiniband/ulp/ipoib/ipoib_ib.c # 2004/12/27 22:20:35-08:00 roland@topspin.com +678 -0 # [INFINIBAND]: Add IPoIB (IP-over-InfiniBand) driver # # drivers/infiniband/ulp/ipoib/ipoib_fs.c # 2004/12/27 22:20:35-08:00 roland@topspin.com +287 -0 # [INFINIBAND]: Add IPoIB (IP-over-InfiniBand) driver # # drivers/infiniband/ulp/ipoib/ipoib.h # 2004/12/27 22:20:35-08:00 roland@topspin.com +350 -0 # [INFINIBAND]: Add IPoIB (IP-over-InfiniBand) driver # # drivers/infiniband/ulp/ipoib/Makefile # 2004/12/27 22:20:35-08:00 roland@topspin.com +11 -0 # [INFINIBAND]: Add IPoIB (IP-over-InfiniBand) driver # # drivers/infiniband/ulp/ipoib/ipoib_verbs.c # 2004/12/27 22:20:35-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/ulp/ipoib/ipoib_verbs.c # # drivers/infiniband/ulp/ipoib/ipoib_main.c # 2004/12/27 22:20:35-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/ulp/ipoib/ipoib_main.c # # drivers/infiniband/ulp/ipoib/ipoib_ib.c # 2004/12/27 22:20:35-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/ulp/ipoib/ipoib_ib.c # # drivers/infiniband/ulp/ipoib/ipoib_fs.c # 2004/12/27 22:20:35-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/ulp/ipoib/ipoib_fs.c # # drivers/infiniband/ulp/ipoib/ipoib.h # 2004/12/27 22:20:35-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/ulp/ipoib/ipoib.h # # drivers/infiniband/ulp/ipoib/Makefile # 2004/12/27 22:20:35-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/ulp/ipoib/Makefile # # drivers/infiniband/ulp/ipoib/Kconfig # 2004/12/27 22:20:33-08:00 roland@topspin.com +33 -0 # [INFINIBAND]: Add IPoIB (IP-over-InfiniBand) driver # # drivers/infiniband/ulp/ipoib/Kconfig # 2004/12/27 22:20:33-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/ulp/ipoib/Kconfig # # ChangeSet # 2004/12/27 22:19:47-08:00 roland@topspin.com # [INFINIBAND]: IPoIB IPv6 support # # Add ipv6_ib_mc_map() to convert IPv6 multicast addresses to IPoIB # hardware addresses, and add support for autoconfiguration for devices # with type ARPHRD_INFINIBAND. # # The mapping for multicast addresses is described in # http://www.ietf.org/internet-drafts/draft-ietf-ipoib-ip-over-infiniband-08.txt # # Signed-off-by: Nitin Hande # Signed-off-by: Roland Dreier # Signed-off-by: David S. Miller # # net/ipv6/ndisc.c # 2004/12/27 22:19:28-08:00 roland@topspin.com +3 -0 # [INFINIBAND]: IPoIB IPv6 support # # Add ipv6_ib_mc_map() to convert IPv6 multicast addresses to IPoIB # hardware addresses, and add support for autoconfiguration for devices # with type ARPHRD_INFINIBAND. # # The mapping for multicast addresses is described in # http://www.ietf.org/internet-drafts/draft-ietf-ipoib-ip-over-infiniband-08.txt # # Signed-off-by: Nitin Hande # Signed-off-by: Roland Dreier # Signed-off-by: David S. Miller # # net/ipv6/addrconf.c # 2004/12/27 22:19:28-08:00 roland@topspin.com +9 -1 # [INFINIBAND]: IPoIB IPv6 support # # Add ipv6_ib_mc_map() to convert IPv6 multicast addresses to IPoIB # hardware addresses, and add support for autoconfiguration for devices # with type ARPHRD_INFINIBAND. # # The mapping for multicast addresses is described in # http://www.ietf.org/internet-drafts/draft-ietf-ipoib-ip-over-infiniband-08.txt # # Signed-off-by: Nitin Hande # Signed-off-by: Roland Dreier # Signed-off-by: David S. Miller # # include/net/if_inet6.h # 2004/12/27 22:19:27-08:00 roland@topspin.com +15 -0 # [INFINIBAND]: IPoIB IPv6 support # # Add ipv6_ib_mc_map() to convert IPv6 multicast addresses to IPoIB # hardware addresses, and add support for autoconfiguration for devices # with type ARPHRD_INFINIBAND. # # The mapping for multicast addresses is described in # http://www.ietf.org/internet-drafts/draft-ietf-ipoib-ip-over-infiniband-08.txt # # Signed-off-by: Nitin Hande # Signed-off-by: Roland Dreier # Signed-off-by: David S. Miller # # ChangeSet # 2004/12/27 22:18:50-08:00 roland@topspin.com # [INFINIBAND]: IPoIB IPv4 multicast # # Add ip_ib_mc_map() to convert IPv4 multicast addresses to IPoIB # hardware addresses. Also add so INFINIBAND_ALEN # has a home. # # The mapping for multicast addresses is described in # http://www.ietf.org/internet-drafts/draft-ietf-ipoib-ip-over-infiniband-08.txt # # Signed-off-by: Roland Dreier # Signed-off-by: David S. Miller # # net/ipv4/arp.c # 2004/12/27 22:18:16-08:00 roland@topspin.com +3 -0 # [INFINIBAND]: IPoIB IPv4 multicast # # include/net/ip.h # 2004/12/27 22:18:16-08:00 roland@topspin.com +33 -0 # [INFINIBAND]: IPoIB IPv4 multicast # # include/linux/if_infiniband.h # 2004/12/27 22:18:10-08:00 roland@topspin.com +29 -0 # [INFINIBAND]: IPoIB IPv4 multicast # # include/linux/if_infiniband.h # 2004/12/27 22:18:10-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/include/linux/if_infiniband.h # # ChangeSet # 2004/12/27 22:17:23-08:00 roland@topspin.com # [INFINIBAND]: Add Mellanox HCA low-level driver (MAD) # # Add MAD (management datagram) code for Mellanox HCA driver. # # Signed-off-by: Roland Dreier # Signed-off-by: David S. Miller # # drivers/infiniband/hw/mthca/mthca_mad.c # 2004/12/27 22:16:54-08:00 roland@topspin.com +320 -0 # [INFINIBAND]: Add Mellanox HCA low-level driver (MAD) # # drivers/infiniband/hw/mthca/mthca_mad.c # 2004/12/27 22:16:54-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/hw/mthca/mthca_mad.c # # ChangeSet # 2004/12/27 22:16:33-08:00 roland@topspin.com # [INFINIBAND]: Add Mellanox HCA low-level driver (last bits) # # Add code for remaining InfiniBand objects (address vectors, multicast # groups, memory regions and protection domains) # # Signed-off-by: Roland Dreier # Signed-off-by: David S. Miller # # drivers/infiniband/hw/mthca/mthca_pd.c # 2004/12/27 22:16:03-08:00 roland@topspin.com +80 -0 # [INFINIBAND]: Add Mellanox HCA low-level driver (last bits) # # drivers/infiniband/hw/mthca/mthca_mr.c # 2004/12/27 22:16:03-08:00 roland@topspin.com +396 -0 # [INFINIBAND]: Add Mellanox HCA low-level driver (last bits) # # drivers/infiniband/hw/mthca/mthca_mcg.c # 2004/12/27 22:16:03-08:00 roland@topspin.com +376 -0 # [INFINIBAND]: Add Mellanox HCA low-level driver (last bits) # # drivers/infiniband/hw/mthca/mthca_pd.c # 2004/12/27 22:16:03-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/hw/mthca/mthca_pd.c # # drivers/infiniband/hw/mthca/mthca_mr.c # 2004/12/27 22:16:03-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/hw/mthca/mthca_mr.c # # drivers/infiniband/hw/mthca/mthca_mcg.c # 2004/12/27 22:16:03-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/hw/mthca/mthca_mcg.c # # drivers/infiniband/hw/mthca/mthca_av.c # 2004/12/27 22:16:02-08:00 roland@topspin.com +219 -0 # [INFINIBAND]: Add Mellanox HCA low-level driver (last bits) # # drivers/infiniband/hw/mthca/mthca_av.c # 2004/12/27 22:16:02-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/hw/mthca/mthca_av.c # # ChangeSet # 2004/12/27 22:15:37-08:00 roland@topspin.com # [INFINIBAND]: Add Mellanox HCA low-level driver (QP/CQ) # # Add CQ (completion queue) and QP (queue pair) code for Mellanox HCA driver. # # Signed-off-by: Roland Dreier # Signed-off-by: David S. Miller # # drivers/infiniband/hw/mthca/mthca_qp.c # 2004/12/27 22:15:08-08:00 roland@topspin.com +1536 -0 # [INFINIBAND]: Add Mellanox HCA low-level driver (QP/CQ) # # drivers/infiniband/hw/mthca/mthca_qp.c # 2004/12/27 22:15:08-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/hw/mthca/mthca_qp.c # # drivers/infiniband/hw/mthca/mthca_cq.c # 2004/12/27 22:15:07-08:00 roland@topspin.com +836 -0 # [INFINIBAND]: Add Mellanox HCA low-level driver (QP/CQ) # # drivers/infiniband/hw/mthca/mthca_cq.c # 2004/12/27 22:15:07-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/hw/mthca/mthca_cq.c # # ChangeSet # 2004/12/27 22:14:43-08:00 roland@topspin.com # [INFINIBAND]: Add Mellanox HCA low-level driver (initialization) # # Add device initializaton code for Mellanox HCA driver. # # Signed-off-by: Roland Dreier # Signed-off-by: David S. Miller # # drivers/infiniband/hw/mthca/mthca_reset.c # 2004/12/27 22:14:13-08:00 roland@topspin.com +232 -0 # [INFINIBAND]: Add Mellanox HCA low-level driver (initialization) # # drivers/infiniband/hw/mthca/mthca_profile.h # 2004/12/27 22:14:13-08:00 roland@topspin.com +62 -0 # [INFINIBAND]: Add Mellanox HCA low-level driver (initialization) # # drivers/infiniband/hw/mthca/mthca_reset.c # 2004/12/27 22:14:13-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/hw/mthca/mthca_reset.c # # drivers/infiniband/hw/mthca/mthca_profile.h # 2004/12/27 22:14:13-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/hw/mthca/mthca_profile.h # # drivers/infiniband/hw/mthca/mthca_profile.c # 2004/12/27 22:14:11-08:00 roland@topspin.com +226 -0 # [INFINIBAND]: Add Mellanox HCA low-level driver (initialization) # # drivers/infiniband/hw/mthca/mthca_profile.c # 2004/12/27 22:14:11-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/hw/mthca/mthca_profile.c # # ChangeSet # 2004/12/27 22:13:44-08:00 roland@topspin.com # [INFINIBAND]: Add Mellanox HCA low-level driver (EQ) # # Add event queue code for Mellanox HCA driver. # # Signed-off-by: Roland Dreier # Signed-off-by: David S. Miller # # drivers/infiniband/hw/mthca/mthca_eq.c # 2004/12/27 22:13:13-08:00 roland@topspin.com +690 -0 # [INFINIBAND]: Add Mellanox HCA low-level driver (EQ) # # drivers/infiniband/hw/mthca/mthca_eq.c # 2004/12/27 22:13:13-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/hw/mthca/mthca_eq.c # # ChangeSet # 2004/12/27 22:12:48-08:00 roland@topspin.com # [INFINIBAND]: Add Mellanox HCA low-level driver (FW commands) # # Add firmware command processing code for Mellanox HCA driver. # # Signed-off-by: Roland Dreier # Signed-off-by: David S. Miller # # drivers/infiniband/hw/mthca/mthca_cmd.h # 2004/12/27 22:12:16-08:00 roland@topspin.com +276 -0 # [INFINIBAND]: Add Mellanox HCA low-level driver (FW commands) # # drivers/infiniband/hw/mthca/mthca_cmd.h # 2004/12/27 22:12:16-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/hw/mthca/mthca_cmd.h # # drivers/infiniband/hw/mthca/mthca_cmd.c # 2004/12/27 22:12:15-08:00 roland@topspin.com +1573 -0 # [INFINIBAND]: Add Mellanox HCA low-level driver (FW commands) # # drivers/infiniband/hw/mthca/mthca_cmd.c # 2004/12/27 22:12:15-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/hw/mthca/mthca_cmd.c # # ChangeSet # 2004/12/27 22:11:50-08:00 roland@topspin.com # [INFINIBAND]: Add Mellanox HCA low-level driver (midlayer interface) # # Add midlayer interface code for Mellanox HCA driver. # # Signed-off-by: Roland Dreier # Signed-off-by: David S. Miller # # drivers/infiniband/hw/mthca/mthca_provider.h # 2004/12/27 22:11:18-08:00 roland@topspin.com +225 -0 # [INFINIBAND]: Add Mellanox HCA low-level driver (midlayer interface) # # drivers/infiniband/hw/mthca/mthca_provider.h # 2004/12/27 22:11:18-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/hw/mthca/mthca_provider.h # # drivers/infiniband/hw/mthca/mthca_provider.c # 2004/12/27 22:11:16-08:00 roland@topspin.com +627 -0 # [INFINIBAND]: Add Mellanox HCA low-level driver (midlayer interface) # # drivers/infiniband/hw/mthca/mthca_provider.c # 2004/12/27 22:11:16-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/hw/mthca/mthca_provider.c # # ChangeSet # 2004/12/27 22:10:49-08:00 roland@topspin.com # [INFINIBAND]: Add Mellanox HCA low-level driver # # Add a low-level driver for Mellanox MT23108 and MT25208 HCAs. The # MT25208 is only fully supported when in MT23108 compatibility mode; # only the very beginnings of support for native MT25208 mode (required # for HCAs without local memory) is present. # # (As a side note, I believe this driver would be the first in-tree # consumer of the PCI MSI/MSI-X API) # # Signed-off-by: Roland Dreier # Signed-off-by: David S. Miller # # drivers/infiniband/Makefile # 2004/12/27 22:10:10-08:00 roland@topspin.com +1 -0 # [INFINIBAND]: Add Mellanox HCA low-level driver # # drivers/infiniband/Kconfig # 2004/12/27 22:10:10-08:00 roland@topspin.com +2 -0 # [INFINIBAND]: Add Mellanox HCA low-level driver # # drivers/infiniband/hw/mthca/mthca_main.c # 2004/12/27 22:10:08-08:00 roland@topspin.com +936 -0 # [INFINIBAND]: Add Mellanox HCA low-level driver # # drivers/infiniband/hw/mthca/mthca_doorbell.h # 2004/12/27 22:10:08-08:00 roland@topspin.com +123 -0 # [INFINIBAND]: Add Mellanox HCA low-level driver # # drivers/infiniband/hw/mthca/mthca_dev.h # 2004/12/27 22:10:08-08:00 roland@topspin.com +391 -0 # [INFINIBAND]: Add Mellanox HCA low-level driver # # drivers/infiniband/hw/mthca/mthca_config_reg.h # 2004/12/27 22:10:08-08:00 roland@topspin.com +55 -0 # [INFINIBAND]: Add Mellanox HCA low-level driver # # drivers/infiniband/hw/mthca/mthca_allocator.c # 2004/12/27 22:10:08-08:00 roland@topspin.com +179 -0 # [INFINIBAND]: Add Mellanox HCA low-level driver # # drivers/infiniband/hw/mthca/Makefile # 2004/12/27 22:10:08-08:00 roland@topspin.com +12 -0 # [INFINIBAND]: Add Mellanox HCA low-level driver # # drivers/infiniband/hw/mthca/mthca_main.c # 2004/12/27 22:10:08-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/hw/mthca/mthca_main.c # # drivers/infiniband/hw/mthca/mthca_doorbell.h # 2004/12/27 22:10:08-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/hw/mthca/mthca_doorbell.h # # drivers/infiniband/hw/mthca/mthca_dev.h # 2004/12/27 22:10:08-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/hw/mthca/mthca_dev.h # # drivers/infiniband/hw/mthca/mthca_config_reg.h # 2004/12/27 22:10:08-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/hw/mthca/mthca_config_reg.h # # drivers/infiniband/hw/mthca/mthca_allocator.c # 2004/12/27 22:10:08-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/hw/mthca/mthca_allocator.c # # drivers/infiniband/hw/mthca/Makefile # 2004/12/27 22:10:08-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/hw/mthca/Makefile # # drivers/infiniband/hw/mthca/Kconfig # 2004/12/27 22:10:06-08:00 roland@topspin.com +26 -0 # [INFINIBAND]: Add Mellanox HCA low-level driver # # drivers/infiniband/hw/mthca/Kconfig # 2004/12/27 22:10:06-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/hw/mthca/Kconfig # # ChangeSet # 2004/12/27 22:09:20-08:00 roland@topspin.com # [INFINIBAND]: Add InfiniBand SA (Subnet Administration) query support # # Add support for sending queries to the SA (Subnet Administration). In # particular the PathRecord and MCMember (multicast group member) used # by the IP-over-InfiniBand driver are implemented. # # Signed-off-by: Roland Dreier # Signed-off-by: David S. Miller # # drivers/infiniband/core/Makefile # 2004/12/27 22:08:42-08:00 roland@topspin.com +3 -1 # [INFINIBAND]: Add InfiniBand SA (Subnet Administration) query support # # drivers/infiniband/include/ib_sa.h # 2004/12/27 22:08:39-08:00 roland@topspin.com +280 -0 # [INFINIBAND]: Add InfiniBand SA (Subnet Administration) query support # # drivers/infiniband/include/ib_sa.h # 2004/12/27 22:08:39-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/include/ib_sa.h # # drivers/infiniband/core/sa_query.c # 2004/12/27 22:08:37-08:00 roland@topspin.com +866 -0 # [INFINIBAND]: Add InfiniBand SA (Subnet Administration) query support # # drivers/infiniband/core/sa_query.c # 2004/12/27 22:08:37-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/core/sa_query.c # # ChangeSet # 2004/12/27 22:07:43-08:00 roland@topspin.com # [INFINIBAND]: Add InfiniBand MAD SMI support # # Add MAD layer SMI (Subnet Management Interface) code. # # Signed-off-by: Roland Dreier # Signed-off-by: David S. Miller # # drivers/infiniband/core/smi.h # 2004/12/27 22:07:11-08:00 roland@topspin.com +67 -0 # [INFINIBAND]: Add InfiniBand MAD SMI support # # drivers/infiniband/core/smi.h # 2004/12/27 22:07:11-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/core/smi.h # # drivers/infiniband/core/smi.c # 2004/12/27 22:07:09-08:00 roland@topspin.com +234 -0 # [INFINIBAND]: Add InfiniBand MAD SMI support # # drivers/infiniband/core/smi.c # 2004/12/27 22:07:09-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/core/smi.c # # ChangeSet # 2004/12/27 22:06:34-08:00 roland@topspin.com # [INFINIBAND]: Add InfiniBand MAD (management datagram) support (private headers) # # Add MAD layer private implementation headers. # # Signed-off-by: Roland Dreier # Signed-off-by: David S. Miller # # drivers/infiniband/core/mad_priv.h # 2004/12/27 22:06:02-08:00 roland@topspin.com +194 -0 # [INFINIBAND]: Add InfiniBand MAD (management datagram) support (private headers) # # drivers/infiniband/core/agent_priv.h # 2004/12/27 22:06:02-08:00 roland@topspin.com +64 -0 # [INFINIBAND]: Add InfiniBand MAD (management datagram) support (private headers) # # drivers/infiniband/core/mad_priv.h # 2004/12/27 22:06:02-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/core/mad_priv.h # # drivers/infiniband/core/agent_priv.h # 2004/12/27 22:06:02-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/core/agent_priv.h # # drivers/infiniband/core/agent.h # 2004/12/27 22:06:00-08:00 roland@topspin.com +55 -0 # [INFINIBAND]: Add InfiniBand MAD (management datagram) support (private headers) # # drivers/infiniband/core/agent.h # 2004/12/27 22:06:00-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/core/agent.h # # ChangeSet # 2004/12/27 22:05:25-08:00 roland@topspin.com # [INFINIBAND]: Add InfiniBand MAD (management datagram) support # # Add support for handling InfiniBand MADs (management datagrams), # including sending and receiving MADs as well as passing MADs on to # local agents. # # This is required for an SM (subnet manager) to discover and configure # the host, since the SM's query MADs must be passed to the local SMA # (subnet management agent). In addition, this support is used by upper # level protocols to send queries to and receive responses from the SM. # # Signed-off-by: Roland Dreier # Signed-off-by: David S. Miller # # drivers/infiniband/core/Makefile # 2004/12/27 22:04:49-08:00 roland@topspin.com +3 -1 # [INFINIBAND]: Add InfiniBand MAD (management datagram) support # # drivers/infiniband/core/mad.c # 2004/12/27 22:04:26-08:00 roland@topspin.com +2632 -0 # [INFINIBAND]: Add InfiniBand MAD (management datagram) support # # drivers/infiniband/core/mad.c # 2004/12/27 22:04:26-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/core/mad.c # # drivers/infiniband/core/agent.c # 2004/12/27 22:04:25-08:00 roland@topspin.com +399 -0 # [INFINIBAND]: Add InfiniBand MAD (management datagram) support # # drivers/infiniband/core/agent.c # 2004/12/27 22:04:25-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/core/agent.c # # ChangeSet # 2004/12/27 22:03:33-08:00 roland@topspin.com # [INFINIBAND]: Add InfiniBand MAD (management datagram) support (public headers) # # Add public headers for handling InfiniBand MADs (management # datagrams), including sending and receiving MADs as well as passing # MADs on to local agents. # # Signed-off-by: Roland Dreier # Signed-off-by: David S. Miller # # drivers/infiniband/include/ib_smi.h # 2004/12/27 22:03:05-08:00 roland@topspin.com +96 -0 # [INFINIBAND]: Add InfiniBand MAD (management datagram) support (public headers) # # drivers/infiniband/include/ib_smi.h # 2004/12/27 22:03:05-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/include/ib_smi.h # # drivers/infiniband/include/ib_mad.h # 2004/12/27 22:03:03-08:00 roland@topspin.com +404 -0 # [INFINIBAND]: Add InfiniBand MAD (management datagram) support (public headers) # # drivers/infiniband/include/ib_mad.h # 2004/12/27 22:03:03-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/include/ib_mad.h # # ChangeSet # 2004/12/27 22:02:08-08:00 roland@topspin.com # [INFINIBAND]: Hook up drivers/infiniband # # Add the appropriate lines to drivers/Kconfig and drivers/Makefile so # that the kernel configuration and build systems know about drivers/infiniband. # # Signed-off-by: Roland Dreier # Signed-off-by: David S. Miller # # drivers/Makefile # 2004/12/27 22:01:46-08:00 roland@topspin.com +1 -0 # [INFINIBAND]: Hook up drivers/infiniband # # Add the appropriate lines to drivers/Kconfig and drivers/Makefile so # that the kernel configuration and build systems know about drivers/infiniband. # # Signed-off-by: Roland Dreier # Signed-off-by: David S. Miller # # drivers/Kconfig # 2004/12/27 22:01:46-08:00 roland@topspin.com +2 -0 # [INFINIBAND]: Hook up drivers/infiniband # # Add the appropriate lines to drivers/Kconfig and drivers/Makefile so # that the kernel configuration and build systems know about drivers/infiniband. # # Signed-off-by: Roland Dreier # Signed-off-by: David S. Miller # # ChangeSet # 2004/12/27 21:58:49-08:00 roland@topspin.com # [INFINIBAND]: Add core InfiniBand support # # Add implementation of core InfiniBand support. This can be thought of # as a midlayer that provides an abstraction between low-level hardware # drivers and upper level protocols (such as IP-over-InfiniBand). # # Signed-off-by: Roland Dreier # Signed-off-by: David S. Miller # # drivers/infiniband/core/verbs.c # 2004/12/27 21:58:13-08:00 roland@topspin.com +433 -0 # [INFINIBAND]: Add core InfiniBand support # # drivers/infiniband/core/ud_header.c # 2004/12/27 21:58:13-08:00 roland@topspin.com +365 -0 # [INFINIBAND]: Add core InfiniBand support # # drivers/infiniband/core/sysfs.c # 2004/12/27 21:58:13-08:00 roland@topspin.com +725 -0 # [INFINIBAND]: Add core InfiniBand support # # drivers/infiniband/core/packer.c # 2004/12/27 21:58:13-08:00 roland@topspin.com +201 -0 # [INFINIBAND]: Add core InfiniBand support # # drivers/infiniband/core/fmr_pool.c # 2004/12/27 21:58:13-08:00 roland@topspin.com +507 -0 # [INFINIBAND]: Add core InfiniBand support # # drivers/infiniband/core/device.c # 2004/12/27 21:58:13-08:00 roland@topspin.com +614 -0 # [INFINIBAND]: Add core InfiniBand support # # drivers/infiniband/core/core_priv.h # 2004/12/27 21:58:13-08:00 roland@topspin.com +52 -0 # [INFINIBAND]: Add core InfiniBand support # # drivers/infiniband/core/cache.c # 2004/12/27 21:58:13-08:00 roland@topspin.com +328 -0 # [INFINIBAND]: Add core InfiniBand support # # drivers/infiniband/core/Makefile # 2004/12/27 21:58:13-08:00 roland@topspin.com +6 -0 # [INFINIBAND]: Add core InfiniBand support # # drivers/infiniband/Makefile # 2004/12/27 21:58:13-08:00 roland@topspin.com +1 -0 # [INFINIBAND]: Add core InfiniBand support # # drivers/infiniband/core/verbs.c # 2004/12/27 21:58:13-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/core/verbs.c # # drivers/infiniband/core/ud_header.c # 2004/12/27 21:58:13-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/core/ud_header.c # # drivers/infiniband/core/sysfs.c # 2004/12/27 21:58:13-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/core/sysfs.c # # drivers/infiniband/core/packer.c # 2004/12/27 21:58:13-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/core/packer.c # # drivers/infiniband/core/fmr_pool.c # 2004/12/27 21:58:13-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/core/fmr_pool.c # # drivers/infiniband/core/device.c # 2004/12/27 21:58:13-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/core/device.c # # drivers/infiniband/core/core_priv.h # 2004/12/27 21:58:13-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/core/core_priv.h # # drivers/infiniband/core/cache.c # 2004/12/27 21:58:13-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/core/cache.c # # drivers/infiniband/core/Makefile # 2004/12/27 21:58:13-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/core/Makefile # # drivers/infiniband/Makefile # 2004/12/27 21:58:13-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/Makefile # # drivers/infiniband/Kconfig # 2004/12/27 21:58:11-08:00 roland@topspin.com +10 -0 # [INFINIBAND]: Add core InfiniBand support # # drivers/infiniband/Kconfig # 2004/12/27 21:58:11-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/Kconfig # # ChangeSet # 2004/12/27 21:57:29-08:00 roland@topspin.com # [INFINIBAND]: Add core InfiniBand support (public headers) # # Add public headers for core InfiniBand support. This can be thought # of as a midlayer that provides an abstraction between low-level # hardware drivers and upper level protocols (such as # IP-over-InfiniBand). # # Signed-off-by: Roland Dreier # Signed-off-by: David S. Miller # # drivers/infiniband/include/ib_verbs.h # 2004/12/27 21:56:56-08:00 roland@topspin.com +1249 -0 # [INFINIBAND]: Add core InfiniBand support (public headers) # # Add public headers for core InfiniBand support. This can be thought # of as a midlayer that provides an abstraction between low-level # hardware drivers and upper level protocols (such as # IP-over-InfiniBand). # # Signed-off-by: Roland Dreier # Signed-off-by: David S. Miller # # drivers/infiniband/include/ib_pack.h # 2004/12/27 21:56:56-08:00 roland@topspin.com +245 -0 # [INFINIBAND]: Add core InfiniBand support (public headers) # # Add public headers for core InfiniBand support. This can be thought # of as a midlayer that provides an abstraction between low-level # hardware drivers and upper level protocols (such as # IP-over-InfiniBand). # # Signed-off-by: Roland Dreier # Signed-off-by: David S. Miller # # drivers/infiniband/include/ib_fmr_pool.h # 2004/12/27 21:56:56-08:00 roland@topspin.com +92 -0 # [INFINIBAND]: Add core InfiniBand support (public headers) # # Add public headers for core InfiniBand support. This can be thought # of as a midlayer that provides an abstraction between low-level # hardware drivers and upper level protocols (such as # IP-over-InfiniBand). # # Signed-off-by: Roland Dreier # Signed-off-by: David S. Miller # # drivers/infiniband/include/ib_verbs.h # 2004/12/27 21:56:56-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/include/ib_verbs.h # # drivers/infiniband/include/ib_pack.h # 2004/12/27 21:56:56-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/include/ib_pack.h # # drivers/infiniband/include/ib_fmr_pool.h # 2004/12/27 21:56:56-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/include/ib_fmr_pool.h # # drivers/infiniband/include/ib_cache.h # 2004/12/27 21:56:54-08:00 roland@topspin.com +53 -0 # [INFINIBAND]: Add core InfiniBand support (public headers) # # Add public headers for core InfiniBand support. This can be thought # of as a midlayer that provides an abstraction between low-level # hardware drivers and upper level protocols (such as # IP-over-InfiniBand). # # Signed-off-by: Roland Dreier # Signed-off-by: David S. Miller # # drivers/infiniband/include/ib_cache.h # 2004/12/27 21:56:54-08:00 roland@topspin.com +0 -0 # BitKeeper file /disk1/BK/ib-2.6/drivers/infiniband/include/ib_cache.h # # ChangeSet # 2004/12/27 21:30:55-08:00 davem@nuts.davemloft.net # Merge bk://kernel.bkbits.net/acme/connection_sock-2.6 # into nuts.davemloft.net:/disk1/BK/net-2.6 # # net/ipv4/udp.c # 2004/12/27 21:30:44-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # net/ipv4/tcp_timer.c # 2004/12/27 21:30:44-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # net/ipv4/tcp_minisocks.c # 2004/12/27 21:30:43-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # net/ipv4/tcp_input.c # 2004/12/27 21:30:43-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # net/ipv4/raw.c # 2004/12/27 21:30:43-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # net/ipv4/ip_sockglue.c # 2004/12/27 21:30:43-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # net/ipv4/igmp.c # 2004/12/27 21:30:43-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # net/ipv4/icmp.c # 2004/12/27 21:30:43-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # net/ipv4/af_inet.c # 2004/12/27 21:30:43-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # include/net/tcp.h # 2004/12/27 21:30:42-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # ChangeSet # 2004/12/27 21:26:00-08:00 tgraf@suug.ch # [PKT_SCHED]: dsmark should ignore ECN bits # # Taking ECN bits into account doesn't make sense. The two bits were # still unused at the time the code was written so this brings back the # old behaviour. # # Signed-off-by: Thomas Graf # Signed-off-by: David S. Miller # # net/sched/sch_dsmark.c # 2004/12/27 21:25:39-08:00 tgraf@suug.ch +5 -2 # [PKT_SCHED]: dsmark should ignore ECN bits # # Taking ECN bits into account doesn't make sense. The two bits were # still unused at the time the code was written so this brings back the # old behaviour. # # Signed-off-by: Thomas Graf # Signed-off-by: David S. Miller # # ChangeSet # 2004/12/27 21:25:02-08:00 oleg@tv-sign.ru # [NET]: Use prefetching in skb_queue_walk(). # # This patch changes skb_queue_walk() in the same manner # as in list_for_each() prefetch optimization, see # http://marc.theaimsgroup.com/?l=linux-kernel&m=110399132418587 # # Signed-off-by: Oleg Nesterov # Signed-off-by: David S. Miller # # include/linux/skbuff.h # 2004/12/27 21:24:42-08:00 oleg@tv-sign.ru +3 -3 # [NET]: Use prefetching in skb_queue_walk(). # # This patch changes skb_queue_walk() in the same manner # as in list_for_each() prefetch optimization, see # http://marc.theaimsgroup.com/?l=linux-kernel&m=110399132418587 # # Signed-off-by: Oleg Nesterov # Signed-off-by: David S. Miller # # ChangeSet # 2004/12/27 21:12:16-08:00 davem@nuts.davemloft.net # [LLC]: llc_sap_list_lock really does need to be exported. # # For the case where CONFIG_LLC2 is modular and thus # llc_proc.c needs to get at this symbol. # # Signed-off-by: David S. Miller # # net/llc/llc_core.c # 2004/12/27 21:11:29-08:00 davem@nuts.davemloft.net +1 -0 # [LLC]: llc_sap_list_lock really does need to be exported. # # ChangeSet # 2004/12/27 21:08:40-08:00 davem@nuts.davemloft.net # [SPARC64]: Fix typo in previous change, s/IS_SOCK/S_ISSOCK/ # # Signed-off-by: David S. Miller # # arch/sparc64/solaris/timod.c # 2004/12/27 21:08:08-08:00 davem@nuts.davemloft.net +1 -1 # [SPARC64]: Fix typo in previous change, s/IS_SOCK/S_ISSOCK/ # # ChangeSet # 2004/12/27 21:04:56-08:00 davem@nuts.davemloft.net # [IRDA]: More staticization becomes possible in ircomm_ttp.c # # Signed-off-by: David S. Miller # # net/irda/ircomm/ircomm_ttp.c # 2004/12/27 21:04:23-08:00 davem@nuts.davemloft.net +57 -27 # [IRDA]: More staticization becomes possible in ircomm_ttp.c # # ChangeSet # 2004/12/27 20:55:17-08:00 matthew@wil.cx # [SPARC64]: Stop referencing i_sock directly. # # Use S_ISSOCK() instead. # # Signed-off-by: Matthew Wilcox # Signed-off-by: David S. Miller # # arch/sparc64/solaris/timod.c # 2004/12/27 20:54:56-08:00 matthew@wil.cx +2 -4 # [SPARC64]: Stop referencing i_sock directly. # # Use S_ISSOCK() instead. # # Signed-off-by: Matthew Wilcox # Signed-off-by: David S. Miller # # arch/sparc64/solaris/socksys.c # 2004/12/27 20:54:56-08:00 matthew@wil.cx +1 -1 # [SPARC64]: Stop referencing i_sock directly. # # Use S_ISSOCK() instead. # # Signed-off-by: Matthew Wilcox # Signed-off-by: David S. Miller # # arch/sparc64/solaris/ioctl.c # 2004/12/27 20:54:56-08:00 matthew@wil.cx +2 -2 # [SPARC64]: Stop referencing i_sock directly. # # Use S_ISSOCK() instead. # # Signed-off-by: Matthew Wilcox # Signed-off-by: David S. Miller # # ChangeSet # 2004/12/27 20:54:03-08:00 juhl-lkml@dif.dk # [IRDA]: Kill useless parens from return statements in irnet.h # # Signed-off-by: Jesper Juhl # Signed-off-by: David S. Miller # # net/irda/irnet/irnet.h # 2004/12/27 20:53:24-08:00 juhl-lkml@dif.dk +2 -2 # [IRDA]: Kill useless parens from return statements in irnet.h # # ChangeSet # 2004/12/27 20:52:34-08:00 bunk@stusta.de # [IPVS]: Remove subscribers-only mailing list from MAINTAINERS. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # MAINTAINERS # 2004/12/27 20:52:13-08:00 bunk@stusta.de +0 -1 # [IPVS]: Remove subscribers-only mailing list from MAINTAINERS. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # ChangeSet # 2004/12/27 20:51:40-08:00 bunk@stusta.de # [PKT_SCHED]: Staticize and other cleanups. # # The patch below contans the following possible cleanups: # - make some needlessly global code static # - sch_htb.c: #undef HTB_DEBUG # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/sched/sch_prio.c # 2004/12/27 20:51:20-08:00 bunk@stusta.de +2 -1 # [PKT_SCHED]: Staticize and other cleanups. # # The patch below contans the following possible cleanups: # - make some needlessly global code static # - sch_htb.c: #undef HTB_DEBUG # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/sched/sch_ingress.c # 2004/12/27 20:51:20-08:00 bunk@stusta.de +1 -1 # [PKT_SCHED]: Staticize and other cleanups. # # The patch below contans the following possible cleanups: # - make some needlessly global code static # - sch_htb.c: #undef HTB_DEBUG # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/sched/sch_htb.c # 2004/12/27 20:51:20-08:00 bunk@stusta.de +1 -1 # [PKT_SCHED]: Staticize and other cleanups. # # The patch below contans the following possible cleanups: # - make some needlessly global code static # - sch_htb.c: #undef HTB_DEBUG # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/sched/sch_generic.c # 2004/12/27 20:51:20-08:00 bunk@stusta.de +2 -2 # [PKT_SCHED]: Staticize and other cleanups. # # The patch below contans the following possible cleanups: # - make some needlessly global code static # - sch_htb.c: #undef HTB_DEBUG # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/sched/sch_dsmark.c # 2004/12/27 20:51:20-08:00 bunk@stusta.de +1 -1 # [PKT_SCHED]: Staticize and other cleanups. # # The patch below contans the following possible cleanups: # - make some needlessly global code static # - sch_htb.c: #undef HTB_DEBUG # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/sched/sch_api.c # 2004/12/27 20:51:20-08:00 bunk@stusta.de +6 -5 # [PKT_SCHED]: Staticize and other cleanups. # # The patch below contans the following possible cleanups: # - make some needlessly global code static # - sch_htb.c: #undef HTB_DEBUG # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/sched/police.c # 2004/12/27 20:51:20-08:00 bunk@stusta.de +4 -4 # [PKT_SCHED]: Staticize and other cleanups. # # The patch below contans the following possible cleanups: # - make some needlessly global code static # - sch_htb.c: #undef HTB_DEBUG # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/sched/gact.c # 2004/12/27 20:51:20-08:00 bunk@stusta.de +1 -1 # [PKT_SCHED]: Staticize and other cleanups. # # The patch below contans the following possible cleanups: # - make some needlessly global code static # - sch_htb.c: #undef HTB_DEBUG # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # include/net/act_api.h # 2004/12/27 20:51:20-08:00 bunk@stusta.de +0 -3 # [PKT_SCHED]: Staticize and other cleanups. # # The patch below contans the following possible cleanups: # - make some needlessly global code static # - sch_htb.c: #undef HTB_DEBUG # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # ChangeSet # 2004/12/27 20:50:34-08:00 bunk@stusta.de # [RXRPC]: Staticize and remove unused globals and exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global function: # - transport.c: rxrpc_clear_transport # - remove the following unneeded EXPORT_SYMBOL: # - rxrpc_syms.c: rxrpc_call_flush # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/rxrpc/transport.c # 2004/12/27 20:50:14-08:00 bunk@stusta.de +0 -10 # [RXRPC]: Staticize and remove unused globals and exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global function: # - transport.c: rxrpc_clear_transport # - remove the following unneeded EXPORT_SYMBOL: # - rxrpc_syms.c: rxrpc_call_flush # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/rxrpc/rxrpc_syms.c # 2004/12/27 20:50:14-08:00 bunk@stusta.de +0 -1 # [RXRPC]: Staticize and remove unused globals and exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global function: # - transport.c: rxrpc_clear_transport # - remove the following unneeded EXPORT_SYMBOL: # - rxrpc_syms.c: rxrpc_call_flush # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/rxrpc/peer.c # 2004/12/27 20:50:14-08:00 bunk@stusta.de +3 -1 # [RXRPC]: Staticize and remove unused globals and exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global function: # - transport.c: rxrpc_clear_transport # - remove the following unneeded EXPORT_SYMBOL: # - rxrpc_syms.c: rxrpc_call_flush # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/rxrpc/internal.h # 2004/12/27 20:50:14-08:00 bunk@stusta.de +0 -3 # [RXRPC]: Staticize and remove unused globals and exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global function: # - transport.c: rxrpc_clear_transport # - remove the following unneeded EXPORT_SYMBOL: # - rxrpc_syms.c: rxrpc_call_flush # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/rxrpc/connection.c # 2004/12/27 20:50:13-08:00 bunk@stusta.de +3 -1 # [RXRPC]: Staticize and remove unused globals and exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global function: # - transport.c: rxrpc_clear_transport # - remove the following unneeded EXPORT_SYMBOL: # - rxrpc_syms.c: rxrpc_call_flush # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/rxrpc/call.c # 2004/12/27 20:50:13-08:00 bunk@stusta.de +9 -6 # [RXRPC]: Staticize and remove unused globals and exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global function: # - transport.c: rxrpc_clear_transport # - remove the following unneeded EXPORT_SYMBOL: # - rxrpc_syms.c: rxrpc_call_flush # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # include/rxrpc/transport.h # 2004/12/27 20:50:13-08:00 bunk@stusta.de +0 -2 # [RXRPC]: Staticize and remove unused globals and exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global function: # - transport.c: rxrpc_clear_transport # - remove the following unneeded EXPORT_SYMBOL: # - rxrpc_syms.c: rxrpc_call_flush # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # include/rxrpc/packet.h # 2004/12/27 20:50:13-08:00 bunk@stusta.de +0 -2 # [RXRPC]: Staticize and remove unused globals and exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global function: # - transport.c: rxrpc_clear_transport # - remove the following unneeded EXPORT_SYMBOL: # - rxrpc_syms.c: rxrpc_call_flush # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # include/rxrpc/call.h # 2004/12/27 20:50:13-08:00 bunk@stusta.de +0 -5 # [RXRPC]: Staticize and remove unused globals and exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global function: # - transport.c: rxrpc_clear_transport # - remove the following unneeded EXPORT_SYMBOL: # - rxrpc_syms.c: rxrpc_call_flush # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # ChangeSet # 2004/12/27 20:49:18-08:00 bunk@stusta.de # [ROSE]: Staticize and remove unused global functions. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/rose/rose_subr.c # 2004/12/27 20:48:58-08:00 bunk@stusta.de +3 -1 # [ROSE]: Staticize and remove unused global functions. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/rose/rose_route.c # 2004/12/27 20:48:58-08:00 bunk@stusta.de +2 -2 # [ROSE]: Staticize and remove unused global functions. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/rose/rose_link.c # 2004/12/27 20:48:58-08:00 bunk@stusta.de +7 -32 # [ROSE]: Staticize and remove unused global functions. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/rose/rose_dev.c # 2004/12/27 20:48:58-08:00 bunk@stusta.de +0 -32 # [ROSE]: Staticize and remove unused global functions. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/rose/af_rose.c # 2004/12/27 20:48:58-08:00 bunk@stusta.de +1 -1 # [ROSE]: Staticize and remove unused global functions. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # include/net/rose.h # 2004/12/27 20:48:57-08:00 bunk@stusta.de +0 -8 # [ROSE]: Staticize and remove unused global functions. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # ChangeSet # 2004/12/27 20:48:19-08:00 bunk@stusta.de # [NETROM]: Make needlessly global code static. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/netrom/nr_route.c # 2004/12/27 20:47:59-08:00 bunk@stusta.de +3 -2 # [NETROM]: Make needlessly global code static. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/netrom/af_netrom.c # 2004/12/27 20:47:59-08:00 bunk@stusta.de +1 -1 # [NETROM]: Make needlessly global code static. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # ChangeSet # 2004/12/27 20:46:42-08:00 bunk@stusta.de # [LLC]: Staticize and remove unnecessary functions and exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global functions: # - lc_c_ac.c: llc_conn_ac_report_status # - lc_c_ac.c: llc_conn_ac_send_dm_rsp_f_set_f_flag # - lc_c_ac.c: llc_conn_ac_resend_i_cmd_p_set_1 # - lc_c_ac.c: llc_conn_ac_resend_i_cmd_p_set_1_or_send_rr # - lc_c_ac.c: llc_conn_ac_send_ack_cmd_p_set_1 # - lc_c_ac.c: llc_conn_ac_send_ua_rsp_f_set_f_flag # - lc_c_ac.c: llc_conn_ac_set_f_flag_p # - llc_c_ev.c: llc_conn_ev_conn_resp # - llc_c_ev.c: llc_conn_ev_rst_resp # - llc_c_ev.c: llc_conn_ev_rx_xxx_cmd_pbit_set_0 # - llc_c_ev.c: llc_conn_ev_rx_xxx_yyy # - llc_c_ev.c: llc_conn_ev_any_tmr_exp # - llc_c_ev.c: llc_conn_ev_qlfy_init_p_f_cycle # - llc_c_ev.c: llc_conn_ev_qlfy_set_status_impossible # - llc_c_ev.c: llc_conn_ev_qlfy_set_status_received # - llc_if.c: llc_build_and_send_reset_pkt # - llc_pdu.c: llc_pdu_decode_cr_bit # - remove the following unneeded EXPORT_SYMBOL: # - llc_core.c: llc_sap_list_lock # # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/llc/llc_station.c # 2004/12/27 20:46:22-08:00 bunk@stusta.de +1 -1 # [LLC]: Staticize and remove unnecessary functions and exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global functions: # - lc_c_ac.c: llc_conn_ac_report_status # - lc_c_ac.c: llc_conn_ac_send_dm_rsp_f_set_f_flag # - lc_c_ac.c: llc_conn_ac_resend_i_cmd_p_set_1 # - lc_c_ac.c: llc_conn_ac_resend_i_cmd_p_set_1_or_send_rr # - lc_c_ac.c: llc_conn_ac_send_ack_cmd_p_set_1 # - lc_c_ac.c: llc_conn_ac_send_ua_rsp_f_set_f_flag # - lc_c_ac.c: llc_conn_ac_set_f_flag_p # - llc_c_ev.c: llc_conn_ev_conn_resp # - llc_c_ev.c: llc_conn_ev_rst_resp # - llc_c_ev.c: llc_conn_ev_rx_xxx_cmd_pbit_set_0 # - llc_c_ev.c: llc_conn_ev_rx_xxx_yyy # - llc_c_ev.c: llc_conn_ev_any_tmr_exp # - llc_c_ev.c: llc_conn_ev_qlfy_init_p_f_cycle # - llc_c_ev.c: llc_conn_ev_qlfy_set_status_impossible # - llc_c_ev.c: llc_conn_ev_qlfy_set_status_received # - llc_if.c: llc_build_and_send_reset_pkt # - llc_pdu.c: llc_pdu_decode_cr_bit # - remove the following unneeded EXPORT_SYMBOL: # - llc_core.c: llc_sap_list_lock # # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/llc/llc_sap.c # 2004/12/27 20:46:22-08:00 bunk@stusta.de +3 -2 # [LLC]: Staticize and remove unnecessary functions and exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global functions: # - lc_c_ac.c: llc_conn_ac_report_status # - lc_c_ac.c: llc_conn_ac_send_dm_rsp_f_set_f_flag # - lc_c_ac.c: llc_conn_ac_resend_i_cmd_p_set_1 # - lc_c_ac.c: llc_conn_ac_resend_i_cmd_p_set_1_or_send_rr # - lc_c_ac.c: llc_conn_ac_send_ack_cmd_p_set_1 # - lc_c_ac.c: llc_conn_ac_send_ua_rsp_f_set_f_flag # - lc_c_ac.c: llc_conn_ac_set_f_flag_p # - llc_c_ev.c: llc_conn_ev_conn_resp # - llc_c_ev.c: llc_conn_ev_rst_resp # - llc_c_ev.c: llc_conn_ev_rx_xxx_cmd_pbit_set_0 # - llc_c_ev.c: llc_conn_ev_rx_xxx_yyy # - llc_c_ev.c: llc_conn_ev_any_tmr_exp # - llc_c_ev.c: llc_conn_ev_qlfy_init_p_f_cycle # - llc_c_ev.c: llc_conn_ev_qlfy_set_status_impossible # - llc_c_ev.c: llc_conn_ev_qlfy_set_status_received # - llc_if.c: llc_build_and_send_reset_pkt # - llc_pdu.c: llc_pdu_decode_cr_bit # - remove the following unneeded EXPORT_SYMBOL: # - llc_core.c: llc_sap_list_lock # # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/llc/llc_proc.c # 2004/12/27 20:46:22-08:00 bunk@stusta.de +2 -2 # [LLC]: Staticize and remove unnecessary functions and exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global functions: # - lc_c_ac.c: llc_conn_ac_report_status # - lc_c_ac.c: llc_conn_ac_send_dm_rsp_f_set_f_flag # - lc_c_ac.c: llc_conn_ac_resend_i_cmd_p_set_1 # - lc_c_ac.c: llc_conn_ac_resend_i_cmd_p_set_1_or_send_rr # - lc_c_ac.c: llc_conn_ac_send_ack_cmd_p_set_1 # - lc_c_ac.c: llc_conn_ac_send_ua_rsp_f_set_f_flag # - lc_c_ac.c: llc_conn_ac_set_f_flag_p # - llc_c_ev.c: llc_conn_ev_conn_resp # - llc_c_ev.c: llc_conn_ev_rst_resp # - llc_c_ev.c: llc_conn_ev_rx_xxx_cmd_pbit_set_0 # - llc_c_ev.c: llc_conn_ev_rx_xxx_yyy # - llc_c_ev.c: llc_conn_ev_any_tmr_exp # - llc_c_ev.c: llc_conn_ev_qlfy_init_p_f_cycle # - llc_c_ev.c: llc_conn_ev_qlfy_set_status_impossible # - llc_c_ev.c: llc_conn_ev_qlfy_set_status_received # - llc_if.c: llc_build_and_send_reset_pkt # - llc_pdu.c: llc_pdu_decode_cr_bit # - remove the following unneeded EXPORT_SYMBOL: # - llc_core.c: llc_sap_list_lock # # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/llc/llc_pdu.c # 2004/12/27 20:46:22-08:00 bunk@stusta.de +0 -13 # [LLC]: Staticize and remove unnecessary functions and exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global functions: # - lc_c_ac.c: llc_conn_ac_report_status # - lc_c_ac.c: llc_conn_ac_send_dm_rsp_f_set_f_flag # - lc_c_ac.c: llc_conn_ac_resend_i_cmd_p_set_1 # - lc_c_ac.c: llc_conn_ac_resend_i_cmd_p_set_1_or_send_rr # - lc_c_ac.c: llc_conn_ac_send_ack_cmd_p_set_1 # - lc_c_ac.c: llc_conn_ac_send_ua_rsp_f_set_f_flag # - lc_c_ac.c: llc_conn_ac_set_f_flag_p # - llc_c_ev.c: llc_conn_ev_conn_resp # - llc_c_ev.c: llc_conn_ev_rst_resp # - llc_c_ev.c: llc_conn_ev_rx_xxx_cmd_pbit_set_0 # - llc_c_ev.c: llc_conn_ev_rx_xxx_yyy # - llc_c_ev.c: llc_conn_ev_any_tmr_exp # - llc_c_ev.c: llc_conn_ev_qlfy_init_p_f_cycle # - llc_c_ev.c: llc_conn_ev_qlfy_set_status_impossible # - llc_c_ev.c: llc_conn_ev_qlfy_set_status_received # - llc_if.c: llc_build_and_send_reset_pkt # - llc_pdu.c: llc_pdu_decode_cr_bit # - remove the following unneeded EXPORT_SYMBOL: # - llc_core.c: llc_sap_list_lock # # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/llc/llc_if.c # 2004/12/27 20:46:22-08:00 bunk@stusta.de +0 -24 # [LLC]: Staticize and remove unnecessary functions and exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global functions: # - lc_c_ac.c: llc_conn_ac_report_status # - lc_c_ac.c: llc_conn_ac_send_dm_rsp_f_set_f_flag # - lc_c_ac.c: llc_conn_ac_resend_i_cmd_p_set_1 # - lc_c_ac.c: llc_conn_ac_resend_i_cmd_p_set_1_or_send_rr # - lc_c_ac.c: llc_conn_ac_send_ack_cmd_p_set_1 # - lc_c_ac.c: llc_conn_ac_send_ua_rsp_f_set_f_flag # - lc_c_ac.c: llc_conn_ac_set_f_flag_p # - llc_c_ev.c: llc_conn_ev_conn_resp # - llc_c_ev.c: llc_conn_ev_rst_resp # - llc_c_ev.c: llc_conn_ev_rx_xxx_cmd_pbit_set_0 # - llc_c_ev.c: llc_conn_ev_rx_xxx_yyy # - llc_c_ev.c: llc_conn_ev_any_tmr_exp # - llc_c_ev.c: llc_conn_ev_qlfy_init_p_f_cycle # - llc_c_ev.c: llc_conn_ev_qlfy_set_status_impossible # - llc_c_ev.c: llc_conn_ev_qlfy_set_status_received # - llc_if.c: llc_build_and_send_reset_pkt # - llc_pdu.c: llc_pdu_decode_cr_bit # - remove the following unneeded EXPORT_SYMBOL: # - llc_core.c: llc_sap_list_lock # # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/llc/llc_core.c # 2004/12/27 20:46:22-08:00 bunk@stusta.de +3 -4 # [LLC]: Staticize and remove unnecessary functions and exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global functions: # - lc_c_ac.c: llc_conn_ac_report_status # - lc_c_ac.c: llc_conn_ac_send_dm_rsp_f_set_f_flag # - lc_c_ac.c: llc_conn_ac_resend_i_cmd_p_set_1 # - lc_c_ac.c: llc_conn_ac_resend_i_cmd_p_set_1_or_send_rr # - lc_c_ac.c: llc_conn_ac_send_ack_cmd_p_set_1 # - lc_c_ac.c: llc_conn_ac_send_ua_rsp_f_set_f_flag # - lc_c_ac.c: llc_conn_ac_set_f_flag_p # - llc_c_ev.c: llc_conn_ev_conn_resp # - llc_c_ev.c: llc_conn_ev_rst_resp # - llc_c_ev.c: llc_conn_ev_rx_xxx_cmd_pbit_set_0 # - llc_c_ev.c: llc_conn_ev_rx_xxx_yyy # - llc_c_ev.c: llc_conn_ev_any_tmr_exp # - llc_c_ev.c: llc_conn_ev_qlfy_init_p_f_cycle # - llc_c_ev.c: llc_conn_ev_qlfy_set_status_impossible # - llc_c_ev.c: llc_conn_ev_qlfy_set_status_received # - llc_if.c: llc_build_and_send_reset_pkt # - llc_pdu.c: llc_pdu_decode_cr_bit # - remove the following unneeded EXPORT_SYMBOL: # - llc_core.c: llc_sap_list_lock # # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/llc/llc_conn.c # 2004/12/27 20:46:22-08:00 bunk@stusta.de +4 -3 # [LLC]: Staticize and remove unnecessary functions and exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global functions: # - lc_c_ac.c: llc_conn_ac_report_status # - lc_c_ac.c: llc_conn_ac_send_dm_rsp_f_set_f_flag # - lc_c_ac.c: llc_conn_ac_resend_i_cmd_p_set_1 # - lc_c_ac.c: llc_conn_ac_resend_i_cmd_p_set_1_or_send_rr # - lc_c_ac.c: llc_conn_ac_send_ack_cmd_p_set_1 # - lc_c_ac.c: llc_conn_ac_send_ua_rsp_f_set_f_flag # - lc_c_ac.c: llc_conn_ac_set_f_flag_p # - llc_c_ev.c: llc_conn_ev_conn_resp # - llc_c_ev.c: llc_conn_ev_rst_resp # - llc_c_ev.c: llc_conn_ev_rx_xxx_cmd_pbit_set_0 # - llc_c_ev.c: llc_conn_ev_rx_xxx_yyy # - llc_c_ev.c: llc_conn_ev_any_tmr_exp # - llc_c_ev.c: llc_conn_ev_qlfy_init_p_f_cycle # - llc_c_ev.c: llc_conn_ev_qlfy_set_status_impossible # - llc_c_ev.c: llc_conn_ev_qlfy_set_status_received # - llc_if.c: llc_build_and_send_reset_pkt # - llc_pdu.c: llc_pdu_decode_cr_bit # - remove the following unneeded EXPORT_SYMBOL: # - llc_core.c: llc_sap_list_lock # # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/llc/llc_c_ev.c # 2004/12/27 20:46:22-08:00 bunk@stusta.de +0 -88 # [LLC]: Staticize and remove unnecessary functions and exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global functions: # - lc_c_ac.c: llc_conn_ac_report_status # - lc_c_ac.c: llc_conn_ac_send_dm_rsp_f_set_f_flag # - lc_c_ac.c: llc_conn_ac_resend_i_cmd_p_set_1 # - lc_c_ac.c: llc_conn_ac_resend_i_cmd_p_set_1_or_send_rr # - lc_c_ac.c: llc_conn_ac_send_ack_cmd_p_set_1 # - lc_c_ac.c: llc_conn_ac_send_ua_rsp_f_set_f_flag # - lc_c_ac.c: llc_conn_ac_set_f_flag_p # - llc_c_ev.c: llc_conn_ev_conn_resp # - llc_c_ev.c: llc_conn_ev_rst_resp # - llc_c_ev.c: llc_conn_ev_rx_xxx_cmd_pbit_set_0 # - llc_c_ev.c: llc_conn_ev_rx_xxx_yyy # - llc_c_ev.c: llc_conn_ev_any_tmr_exp # - llc_c_ev.c: llc_conn_ev_qlfy_init_p_f_cycle # - llc_c_ev.c: llc_conn_ev_qlfy_set_status_impossible # - llc_c_ev.c: llc_conn_ev_qlfy_set_status_received # - llc_if.c: llc_build_and_send_reset_pkt # - llc_pdu.c: llc_pdu_decode_cr_bit # - remove the following unneeded EXPORT_SYMBOL: # - llc_core.c: llc_sap_list_lock # # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/llc/llc_c_ac.c # 2004/12/27 20:46:22-08:00 bunk@stusta.de +14 -113 # [LLC]: Staticize and remove unnecessary functions and exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global functions: # - lc_c_ac.c: llc_conn_ac_report_status # - lc_c_ac.c: llc_conn_ac_send_dm_rsp_f_set_f_flag # - lc_c_ac.c: llc_conn_ac_resend_i_cmd_p_set_1 # - lc_c_ac.c: llc_conn_ac_resend_i_cmd_p_set_1_or_send_rr # - lc_c_ac.c: llc_conn_ac_send_ack_cmd_p_set_1 # - lc_c_ac.c: llc_conn_ac_send_ua_rsp_f_set_f_flag # - lc_c_ac.c: llc_conn_ac_set_f_flag_p # - llc_c_ev.c: llc_conn_ev_conn_resp # - llc_c_ev.c: llc_conn_ev_rst_resp # - llc_c_ev.c: llc_conn_ev_rx_xxx_cmd_pbit_set_0 # - llc_c_ev.c: llc_conn_ev_rx_xxx_yyy # - llc_c_ev.c: llc_conn_ev_any_tmr_exp # - llc_c_ev.c: llc_conn_ev_qlfy_init_p_f_cycle # - llc_c_ev.c: llc_conn_ev_qlfy_set_status_impossible # - llc_c_ev.c: llc_conn_ev_qlfy_set_status_received # - llc_if.c: llc_build_and_send_reset_pkt # - llc_pdu.c: llc_pdu_decode_cr_bit # - remove the following unneeded EXPORT_SYMBOL: # - llc_core.c: llc_sap_list_lock # # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # include/net/llc_sap.h # 2004/12/27 20:46:22-08:00 bunk@stusta.de +0 -1 # [LLC]: Staticize and remove unnecessary functions and exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global functions: # - lc_c_ac.c: llc_conn_ac_report_status # - lc_c_ac.c: llc_conn_ac_send_dm_rsp_f_set_f_flag # - lc_c_ac.c: llc_conn_ac_resend_i_cmd_p_set_1 # - lc_c_ac.c: llc_conn_ac_resend_i_cmd_p_set_1_or_send_rr # - lc_c_ac.c: llc_conn_ac_send_ack_cmd_p_set_1 # - lc_c_ac.c: llc_conn_ac_send_ua_rsp_f_set_f_flag # - lc_c_ac.c: llc_conn_ac_set_f_flag_p # - llc_c_ev.c: llc_conn_ev_conn_resp # - llc_c_ev.c: llc_conn_ev_rst_resp # - llc_c_ev.c: llc_conn_ev_rx_xxx_cmd_pbit_set_0 # - llc_c_ev.c: llc_conn_ev_rx_xxx_yyy # - llc_c_ev.c: llc_conn_ev_any_tmr_exp # - llc_c_ev.c: llc_conn_ev_qlfy_init_p_f_cycle # - llc_c_ev.c: llc_conn_ev_qlfy_set_status_impossible # - llc_c_ev.c: llc_conn_ev_qlfy_set_status_received # - llc_if.c: llc_build_and_send_reset_pkt # - llc_pdu.c: llc_pdu_decode_cr_bit # - remove the following unneeded EXPORT_SYMBOL: # - llc_core.c: llc_sap_list_lock # # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # include/net/llc_pdu.h # 2004/12/27 20:46:21-08:00 bunk@stusta.de +0 -1 # [LLC]: Staticize and remove unnecessary functions and exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global functions: # - lc_c_ac.c: llc_conn_ac_report_status # - lc_c_ac.c: llc_conn_ac_send_dm_rsp_f_set_f_flag # - lc_c_ac.c: llc_conn_ac_resend_i_cmd_p_set_1 # - lc_c_ac.c: llc_conn_ac_resend_i_cmd_p_set_1_or_send_rr # - lc_c_ac.c: llc_conn_ac_send_ack_cmd_p_set_1 # - lc_c_ac.c: llc_conn_ac_send_ua_rsp_f_set_f_flag # - lc_c_ac.c: llc_conn_ac_set_f_flag_p # - llc_c_ev.c: llc_conn_ev_conn_resp # - llc_c_ev.c: llc_conn_ev_rst_resp # - llc_c_ev.c: llc_conn_ev_rx_xxx_cmd_pbit_set_0 # - llc_c_ev.c: llc_conn_ev_rx_xxx_yyy # - llc_c_ev.c: llc_conn_ev_any_tmr_exp # - llc_c_ev.c: llc_conn_ev_qlfy_init_p_f_cycle # - llc_c_ev.c: llc_conn_ev_qlfy_set_status_impossible # - llc_c_ev.c: llc_conn_ev_qlfy_set_status_received # - llc_if.c: llc_build_and_send_reset_pkt # - llc_pdu.c: llc_pdu_decode_cr_bit # - remove the following unneeded EXPORT_SYMBOL: # - llc_core.c: llc_sap_list_lock # # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # include/net/llc_conn.h # 2004/12/27 20:46:21-08:00 bunk@stusta.de +0 -3 # [LLC]: Staticize and remove unnecessary functions and exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global functions: # - lc_c_ac.c: llc_conn_ac_report_status # - lc_c_ac.c: llc_conn_ac_send_dm_rsp_f_set_f_flag # - lc_c_ac.c: llc_conn_ac_resend_i_cmd_p_set_1 # - lc_c_ac.c: llc_conn_ac_resend_i_cmd_p_set_1_or_send_rr # - lc_c_ac.c: llc_conn_ac_send_ack_cmd_p_set_1 # - lc_c_ac.c: llc_conn_ac_send_ua_rsp_f_set_f_flag # - lc_c_ac.c: llc_conn_ac_set_f_flag_p # - llc_c_ev.c: llc_conn_ev_conn_resp # - llc_c_ev.c: llc_conn_ev_rst_resp # - llc_c_ev.c: llc_conn_ev_rx_xxx_cmd_pbit_set_0 # - llc_c_ev.c: llc_conn_ev_rx_xxx_yyy # - llc_c_ev.c: llc_conn_ev_any_tmr_exp # - llc_c_ev.c: llc_conn_ev_qlfy_init_p_f_cycle # - llc_c_ev.c: llc_conn_ev_qlfy_set_status_impossible # - llc_c_ev.c: llc_conn_ev_qlfy_set_status_received # - llc_if.c: llc_build_and_send_reset_pkt # - llc_pdu.c: llc_pdu_decode_cr_bit # - remove the following unneeded EXPORT_SYMBOL: # - llc_core.c: llc_sap_list_lock # # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # include/net/llc_c_ev.h # 2004/12/27 20:46:21-08:00 bunk@stusta.de +0 -12 # [LLC]: Staticize and remove unnecessary functions and exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global functions: # - lc_c_ac.c: llc_conn_ac_report_status # - lc_c_ac.c: llc_conn_ac_send_dm_rsp_f_set_f_flag # - lc_c_ac.c: llc_conn_ac_resend_i_cmd_p_set_1 # - lc_c_ac.c: llc_conn_ac_resend_i_cmd_p_set_1_or_send_rr # - lc_c_ac.c: llc_conn_ac_send_ack_cmd_p_set_1 # - lc_c_ac.c: llc_conn_ac_send_ua_rsp_f_set_f_flag # - lc_c_ac.c: llc_conn_ac_set_f_flag_p # - llc_c_ev.c: llc_conn_ev_conn_resp # - llc_c_ev.c: llc_conn_ev_rst_resp # - llc_c_ev.c: llc_conn_ev_rx_xxx_cmd_pbit_set_0 # - llc_c_ev.c: llc_conn_ev_rx_xxx_yyy # - llc_c_ev.c: llc_conn_ev_any_tmr_exp # - llc_c_ev.c: llc_conn_ev_qlfy_init_p_f_cycle # - llc_c_ev.c: llc_conn_ev_qlfy_set_status_impossible # - llc_c_ev.c: llc_conn_ev_qlfy_set_status_received # - llc_if.c: llc_build_and_send_reset_pkt # - llc_pdu.c: llc_pdu_decode_cr_bit # - remove the following unneeded EXPORT_SYMBOL: # - llc_core.c: llc_sap_list_lock # # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # include/net/llc_c_ac.h # 2004/12/27 20:46:21-08:00 bunk@stusta.de +0 -19 # [LLC]: Staticize and remove unnecessary functions and exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global functions: # - lc_c_ac.c: llc_conn_ac_report_status # - lc_c_ac.c: llc_conn_ac_send_dm_rsp_f_set_f_flag # - lc_c_ac.c: llc_conn_ac_resend_i_cmd_p_set_1 # - lc_c_ac.c: llc_conn_ac_resend_i_cmd_p_set_1_or_send_rr # - lc_c_ac.c: llc_conn_ac_send_ack_cmd_p_set_1 # - lc_c_ac.c: llc_conn_ac_send_ua_rsp_f_set_f_flag # - lc_c_ac.c: llc_conn_ac_set_f_flag_p # - llc_c_ev.c: llc_conn_ev_conn_resp # - llc_c_ev.c: llc_conn_ev_rst_resp # - llc_c_ev.c: llc_conn_ev_rx_xxx_cmd_pbit_set_0 # - llc_c_ev.c: llc_conn_ev_rx_xxx_yyy # - llc_c_ev.c: llc_conn_ev_any_tmr_exp # - llc_c_ev.c: llc_conn_ev_qlfy_init_p_f_cycle # - llc_c_ev.c: llc_conn_ev_qlfy_set_status_impossible # - llc_c_ev.c: llc_conn_ev_qlfy_set_status_received # - llc_if.c: llc_build_and_send_reset_pkt # - llc_pdu.c: llc_pdu_decode_cr_bit # - remove the following unneeded EXPORT_SYMBOL: # - llc_core.c: llc_sap_list_lock # # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # ChangeSet # 2004/12/27 20:45:07-08:00 bunk@stusta.de # [IRDA]: Staticize and remove unnecessary exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global functions: # - discovery.c: irlmp_find_device # - ircomm/ircomm_param.c: ircomm_param_flush # - irda_device.c: irda_device_set_dtr_rts # - irda_device.c: irda_device_change_speed # - irda_device.c: irda_device_set_mode # - iriap.c: iriap_getinfobasedetails_request # - iriap.c: iriap_getinfobasedetails_confirm # - iriap.c: iriap_getobjects_request # - iriap.c: iriap_getobjects_confirm # - iriap.c: iriap_getvalue # - irlan_client.c: irlan_client_reconnect_data_channel # - irlap_frame.c: irlap_send_frmr_frame # - irlmp.c: irlmp_status_request # - remove the follwong unused global variables: # - irnet/irnet_ppp.c: irnet_ppp_ops # - irsysctl.c: sysctl_compression # - qos.c: #ifndef CONFIG_IRDA_DYNAMIC_WINDOW irlap_requested_line_capacity # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/irda/qos.c # 2004/12/27 20:44:25-08:00 bunk@stusta.de +16 -9 # [IRDA]: Staticize and remove unnecessary exports. # # net/irda/parameters.c # 2004/12/27 20:44:25-08:00 bunk@stusta.de +6 -5 # [IRDA]: Staticize and remove unnecessary exports. # # net/irda/irttp.c # 2004/12/27 20:44:25-08:00 bunk@stusta.de +8 -4 # [IRDA]: Staticize and remove unnecessary exports. # # net/irda/irsysctl.c # 2004/12/27 20:44:25-08:00 bunk@stusta.de +0 -1 # [IRDA]: Staticize and remove unnecessary exports. # # net/irda/irnet/irnet_ppp.h # 2004/12/27 20:44:25-08:00 bunk@stusta.de +0 -7 # [IRDA]: Staticize and remove unnecessary exports. # # net/irda/irnet/irnet_ppp.c # 2004/12/27 20:44:25-08:00 bunk@stusta.de +7 -1 # [IRDA]: Staticize and remove unnecessary exports. # # net/irda/irnet/irnet.h # 2004/12/27 20:44:25-08:00 bunk@stusta.de +0 -2 # [IRDA]: Staticize and remove unnecessary exports. # # net/irda/irmod.c # 2004/12/27 20:44:25-08:00 bunk@stusta.de +2 -2 # [IRDA]: Staticize and remove unnecessary exports. # # net/irda/irlmp.c # 2004/12/27 20:44:25-08:00 bunk@stusta.de +5 -7 # [IRDA]: Staticize and remove unnecessary exports. # # net/irda/irlap_frame.c # 2004/12/27 20:44:25-08:00 bunk@stusta.de +5 -30 # [IRDA]: Staticize and remove unnecessary exports. # # net/irda/irlap_event.c # 2004/12/27 20:44:25-08:00 bunk@stusta.de +1 -1 # [IRDA]: Staticize and remove unnecessary exports. # # net/irda/irlap.c # 2004/12/27 20:44:25-08:00 bunk@stusta.de +5 -3 # [IRDA]: Staticize and remove unnecessary exports. # # net/irda/irlan/irlan_provider.c # 2004/12/27 20:44:25-08:00 bunk@stusta.de +3 -3 # [IRDA]: Staticize and remove unnecessary exports. # # net/irda/irlan/irlan_common.c # 2004/12/27 20:44:25-08:00 bunk@stusta.de +20 -12 # [IRDA]: Staticize and remove unnecessary exports. # # net/irda/irlan/irlan_client.c # 2004/12/27 20:44:25-08:00 bunk@stusta.de +3 -38 # [IRDA]: Staticize and remove unnecessary exports. # # net/irda/irias_object.c # 2004/12/27 20:44:25-08:00 bunk@stusta.de +3 -3 # [IRDA]: Staticize and remove unnecessary exports. # # net/irda/iriap.c # 2004/12/27 20:44:25-08:00 bunk@stusta.de +19 -32 # [IRDA]: Staticize and remove unnecessary exports. # # net/irda/irda_device.c # 2004/12/27 20:44:25-08:00 bunk@stusta.de +1 -69 # [IRDA]: Staticize and remove unnecessary exports. # # net/irda/ircomm/ircomm_tty_ioctl.c # 2004/12/27 20:44:25-08:00 bunk@stusta.de +1 -1 # [IRDA]: Staticize and remove unnecessary exports. # # net/irda/ircomm/ircomm_tty_attach.c # 2004/12/27 20:44:25-08:00 bunk@stusta.de +7 -5 # [IRDA]: Staticize and remove unnecessary exports. # # net/irda/ircomm/ircomm_tty.c # 2004/12/27 20:44:25-08:00 bunk@stusta.de +4 -3 # [IRDA]: Staticize and remove unnecessary exports. # # net/irda/ircomm/ircomm_param.c # 2004/12/27 20:44:25-08:00 bunk@stusta.de +0 -17 # [IRDA]: Staticize and remove unnecessary exports. # # net/irda/ircomm/ircomm_lmp.c # 2004/12/27 20:44:25-08:00 bunk@stusta.de +65 -63 # [IRDA]: Staticize and remove unnecessary exports. # # net/irda/ircomm/ircomm_event.c # 2004/12/27 20:44:25-08:00 bunk@stusta.de +1 -1 # [IRDA]: Staticize and remove unnecessary exports. # # net/irda/ircomm/ircomm_core.c # 2004/12/27 20:44:25-08:00 bunk@stusta.de +2 -2 # [IRDA]: Staticize and remove unnecessary exports. # # net/irda/discovery.c # 2004/12/27 20:44:25-08:00 bunk@stusta.de +0 -35 # [IRDA]: Staticize and remove unnecessary exports. # # net/irda/af_irda.c # 2004/12/27 20:44:25-08:00 bunk@stusta.de +2 -2 # [IRDA]: Staticize and remove unnecessary exports. # # include/net/irda/qos.h # 2004/12/27 20:44:25-08:00 bunk@stusta.de +0 -1 # [IRDA]: Staticize and remove unnecessary exports. # # include/net/irda/parameters.h # 2004/12/27 20:44:25-08:00 bunk@stusta.de +0 -2 # [IRDA]: Staticize and remove unnecessary exports. # # include/net/irda/irttp.h # 2004/12/27 20:44:25-08:00 bunk@stusta.de +0 -3 # [IRDA]: Staticize and remove unnecessary exports. # # include/net/irda/irlmp.h # 2004/12/27 20:44:25-08:00 bunk@stusta.de +0 -3 # [IRDA]: Staticize and remove unnecessary exports. # # include/net/irda/irlap_frame.h # 2004/12/27 20:44:25-08:00 bunk@stusta.de +0 -1 # [IRDA]: Staticize and remove unnecessary exports. # # include/net/irda/irlap.h # 2004/12/27 20:44:25-08:00 bunk@stusta.de +0 -2 # [IRDA]: Staticize and remove unnecessary exports. # # include/net/irda/irlan_common.h # 2004/12/27 20:44:25-08:00 bunk@stusta.de +0 -3 # [IRDA]: Staticize and remove unnecessary exports. # # include/net/irda/irlan_client.h # 2004/12/27 20:44:25-08:00 bunk@stusta.de +0 -3 # [IRDA]: Staticize and remove unnecessary exports. # # include/net/irda/iriap.h # 2004/12/27 20:44:25-08:00 bunk@stusta.de +0 -10 # [IRDA]: Staticize and remove unnecessary exports. # # include/net/irda/irda_device.h # 2004/12/27 20:44:25-08:00 bunk@stusta.de +0 -2 # [IRDA]: Staticize and remove unnecessary exports. # # include/net/irda/ircomm_tty_attach.h # 2004/12/27 20:44:25-08:00 bunk@stusta.de +0 -1 # [IRDA]: Staticize and remove unnecessary exports. # # include/net/irda/ircomm_tty.h # 2004/12/27 20:44:25-08:00 bunk@stusta.de +0 -2 # [IRDA]: Staticize and remove unnecessary exports. # # include/net/irda/ircomm_ttp.h # 2004/12/27 20:44:25-08:00 bunk@stusta.de +0 -31 # [IRDA]: Staticize and remove unnecessary exports. # # include/net/irda/ircomm_param.h # 2004/12/27 20:44:25-08:00 bunk@stusta.de +0 -1 # [IRDA]: Staticize and remove unnecessary exports. # # include/net/irda/ircomm_lmp.h # 2004/12/27 20:44:25-08:00 bunk@stusta.de +0 -27 # [IRDA]: Staticize and remove unnecessary exports. # # include/net/irda/ircomm_event.h # 2004/12/27 20:44:25-08:00 bunk@stusta.de +0 -1 # [IRDA]: Staticize and remove unnecessary exports. # # ChangeSet # 2004/12/27 20:34:31-08:00 kaber@trash.net # [IPV4]: Let people know where to obtain the ss tool from. # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # net/ipv4/Kconfig # 2004/12/27 20:34:11-08:00 kaber@trash.net +4 -1 # [IPV4]: Let people know where to obtain the ss tool from. # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # ChangeSet # 2004/12/27 19:50:18-08:00 bunk@stusta.de # [IPV4]: Staticize and remove unneeded exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global functions: # - fib_rules.c: fib_rules_map_destination # - xfrm4_policy.: xfrm4_fini # - remove the following unneeded EXPORT_SYMBOL: # - tcp_timer.c: tcp_timer_bug_msg # # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/ipv4/xfrm4_policy.c # 2004/12/27 19:49:58-08:00 bunk@stusta.de +0 -7 # [IPV4]: Staticize and remove unneeded exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global functions: # - fib_rules.c: fib_rules_map_destination # - xfrm4_policy.: xfrm4_fini # - remove the following unneeded EXPORT_SYMBOL: # - tcp_timer.c: tcp_timer_bug_msg # # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/ipv4/udp.c # 2004/12/27 19:49:58-08:00 bunk@stusta.de +8 -5 # [IPV4]: Staticize and remove unneeded exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global functions: # - fib_rules.c: fib_rules_map_destination # - xfrm4_policy.: xfrm4_fini # - remove the following unneeded EXPORT_SYMBOL: # - tcp_timer.c: tcp_timer_bug_msg # # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/ipv4/tcp_timer.c # 2004/12/27 19:49:58-08:00 bunk@stusta.de +0 -3 # [IPV4]: Staticize and remove unneeded exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global functions: # - fib_rules.c: fib_rules_map_destination # - xfrm4_policy.: xfrm4_fini # - remove the following unneeded EXPORT_SYMBOL: # - tcp_timer.c: tcp_timer_bug_msg # # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/ipv4/tcp_minisocks.c # 2004/12/27 19:49:58-08:00 bunk@stusta.de +3 -1 # [IPV4]: Staticize and remove unneeded exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global functions: # - fib_rules.c: fib_rules_map_destination # - xfrm4_policy.: xfrm4_fini # - remove the following unneeded EXPORT_SYMBOL: # - tcp_timer.c: tcp_timer_bug_msg # # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/ipv4/tcp_input.c # 2004/12/27 19:49:57-08:00 bunk@stusta.de +14 -2 # [IPV4]: Staticize and remove unneeded exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global functions: # - fib_rules.c: fib_rules_map_destination # - xfrm4_policy.: xfrm4_fini # - remove the following unneeded EXPORT_SYMBOL: # - tcp_timer.c: tcp_timer_bug_msg # # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/ipv4/route.c # 2004/12/27 19:49:57-08:00 bunk@stusta.de +16 -16 # [IPV4]: Staticize and remove unneeded exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global functions: # - fib_rules.c: fib_rules_map_destination # - xfrm4_policy.: xfrm4_fini # - remove the following unneeded EXPORT_SYMBOL: # - tcp_timer.c: tcp_timer_bug_msg # # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/ipv4/raw.c # 2004/12/27 19:49:57-08:00 bunk@stusta.de +2 -2 # [IPV4]: Staticize and remove unneeded exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global functions: # - fib_rules.c: fib_rules_map_destination # - xfrm4_policy.: xfrm4_fini # - remove the following unneeded EXPORT_SYMBOL: # - tcp_timer.c: tcp_timer_bug_msg # # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/ipv4/ipconfig.c # 2004/12/27 19:49:57-08:00 bunk@stusta.de +6 -6 # [IPV4]: Staticize and remove unneeded exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global functions: # - fib_rules.c: fib_rules_map_destination # - xfrm4_policy.: xfrm4_fini # - remove the following unneeded EXPORT_SYMBOL: # - tcp_timer.c: tcp_timer_bug_msg # # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/ipv4/ip_sockglue.c # 2004/12/27 19:49:57-08:00 bunk@stusta.de +1 -1 # [IPV4]: Staticize and remove unneeded exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global functions: # - fib_rules.c: fib_rules_map_destination # - xfrm4_policy.: xfrm4_fini # - remove the following unneeded EXPORT_SYMBOL: # - tcp_timer.c: tcp_timer_bug_msg # # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/ipv4/ip_gre.c # 2004/12/27 19:49:57-08:00 bunk@stusta.de +3 -3 # [IPV4]: Staticize and remove unneeded exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global functions: # - fib_rules.c: fib_rules_map_destination # - xfrm4_policy.: xfrm4_fini # - remove the following unneeded EXPORT_SYMBOL: # - tcp_timer.c: tcp_timer_bug_msg # # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/ipv4/igmp.c # 2004/12/27 19:49:57-08:00 bunk@stusta.de +8 -8 # [IPV4]: Staticize and remove unneeded exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global functions: # - fib_rules.c: fib_rules_map_destination # - xfrm4_policy.: xfrm4_fini # - remove the following unneeded EXPORT_SYMBOL: # - tcp_timer.c: tcp_timer_bug_msg # # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/ipv4/icmp.c # 2004/12/27 19:49:57-08:00 bunk@stusta.de +2 -2 # [IPV4]: Staticize and remove unneeded exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global functions: # - fib_rules.c: fib_rules_map_destination # - xfrm4_policy.: xfrm4_fini # - remove the following unneeded EXPORT_SYMBOL: # - tcp_timer.c: tcp_timer_bug_msg # # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/ipv4/fib_rules.c # 2004/12/27 19:49:57-08:00 bunk@stusta.de +1 -7 # [IPV4]: Staticize and remove unneeded exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global functions: # - fib_rules.c: fib_rules_map_destination # - xfrm4_policy.: xfrm4_fini # - remove the following unneeded EXPORT_SYMBOL: # - tcp_timer.c: tcp_timer_bug_msg # # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/ipv4/fib_frontend.c # 2004/12/27 19:49:57-08:00 bunk@stusta.de +3 -3 # [IPV4]: Staticize and remove unneeded exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global functions: # - fib_rules.c: fib_rules_map_destination # - xfrm4_policy.: xfrm4_fini # - remove the following unneeded EXPORT_SYMBOL: # - tcp_timer.c: tcp_timer_bug_msg # # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/ipv4/devinet.c # 2004/12/27 19:49:57-08:00 bunk@stusta.de +2 -2 # [IPV4]: Staticize and remove unneeded exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global functions: # - fib_rules.c: fib_rules_map_destination # - xfrm4_policy.: xfrm4_fini # - remove the following unneeded EXPORT_SYMBOL: # - tcp_timer.c: tcp_timer_bug_msg # # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/ipv4/arp.c # 2004/12/27 19:49:57-08:00 bunk@stusta.de +4 -4 # [IPV4]: Staticize and remove unneeded exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global functions: # - fib_rules.c: fib_rules_map_destination # - xfrm4_policy.: xfrm4_fini # - remove the following unneeded EXPORT_SYMBOL: # - tcp_timer.c: tcp_timer_bug_msg # # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/ipv4/af_inet.c # 2004/12/27 19:49:57-08:00 bunk@stusta.de +4 -4 # [IPV4]: Staticize and remove unneeded exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global functions: # - fib_rules.c: fib_rules_map_destination # - xfrm4_policy.: xfrm4_fini # - remove the following unneeded EXPORT_SYMBOL: # - tcp_timer.c: tcp_timer_bug_msg # # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # include/net/xfrm.h # 2004/12/27 19:49:57-08:00 bunk@stusta.de +0 -1 # [IPV4]: Staticize and remove unneeded exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global functions: # - fib_rules.c: fib_rules_map_destination # - xfrm4_policy.: xfrm4_fini # - remove the following unneeded EXPORT_SYMBOL: # - tcp_timer.c: tcp_timer_bug_msg # # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # include/net/tcp.h # 2004/12/27 19:49:57-08:00 bunk@stusta.de +0 -16 # [IPV4]: Staticize and remove unneeded exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global functions: # - fib_rules.c: fib_rules_map_destination # - xfrm4_policy.: xfrm4_fini # - remove the following unneeded EXPORT_SYMBOL: # - tcp_timer.c: tcp_timer_bug_msg # # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # include/net/ipconfig.h # 2004/12/27 19:49:57-08:00 bunk@stusta.de +0 -11 # [IPV4]: Staticize and remove unneeded exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global functions: # - fib_rules.c: fib_rules_map_destination # - xfrm4_policy.: xfrm4_fini # - remove the following unneeded EXPORT_SYMBOL: # - tcp_timer.c: tcp_timer_bug_msg # # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # include/net/ip_fib.h # 2004/12/27 19:49:57-08:00 bunk@stusta.de +0 -2 # [IPV4]: Staticize and remove unneeded exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global functions: # - fib_rules.c: fib_rules_map_destination # - xfrm4_policy.: xfrm4_fini # - remove the following unneeded EXPORT_SYMBOL: # - tcp_timer.c: tcp_timer_bug_msg # # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # include/net/ip.h # 2004/12/27 19:49:57-08:00 bunk@stusta.de +0 -2 # [IPV4]: Staticize and remove unneeded exports. # # The patch below contains the following possible cleanups: # - make some needlessly global code static # - remove the following unused global functions: # - fib_rules.c: fib_rules_map_destination # - xfrm4_policy.: xfrm4_fini # - remove the following unneeded EXPORT_SYMBOL: # - tcp_timer.c: tcp_timer_bug_msg # # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # ChangeSet # 2004/12/27 18:54:21-08:00 bunk@stusta.de # [IPX]: Make needlessly global code static. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/ipx/ipx_proc.c # 2004/12/27 18:54:01-08:00 bunk@stusta.de +3 -3 # [IPX]: Make needlessly global code static. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/ipx/af_ipx.c # 2004/12/27 18:54:01-08:00 bunk@stusta.de +8 -2 # [IPX]: Make needlessly global code static. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # include/net/ipx.h # 2004/12/27 18:54:01-08:00 bunk@stusta.de +0 -8 # [IPX]: Make needlessly global code static. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # ChangeSet # 2004/12/27 18:49:21-08:00 bunk@stusta.de # [IPVS]: Make needlessly global code static. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/ipv4/ipvs/ip_vs_proto_icmp.c # 2004/12/27 18:49:01-08:00 bunk@stusta.de +2 -2 # [IPVS]: Make needlessly global code static. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/ipv4/ipvs/ip_vs_proto.c # 2004/12/27 18:49:01-08:00 bunk@stusta.de +2 -2 # [IPVS]: Make needlessly global code static. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/ipv4/ipvs/ip_vs_ctl.c # 2004/12/27 18:49:01-08:00 bunk@stusta.de +1 -1 # [IPVS]: Make needlessly global code static. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/ipv4/ipvs/ip_vs_conn.c # 2004/12/27 18:49:01-08:00 bunk@stusta.de +1 -1 # [IPVS]: Make needlessly global code static. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/ipv4/ipvs/ip_vs_app.c # 2004/12/27 18:49:01-08:00 bunk@stusta.de +1 -1 # [IPVS]: Make needlessly global code static. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # ChangeSet # 2004/12/27 18:41:46-08:00 bunk@stusta.de # [AF_PACKET]: Make needlessly global code static. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/packet/af_packet.c # 2004/12/27 18:41:26-08:00 bunk@stusta.de +11 -10 # [AF_PACKET]: Make needlessly global code static. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # ChangeSet # 2004/12/27 18:40:25-08:00 bunk@stusta.de # [NETLINK]: Staticize and remove unused functions. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/netlink/af_netlink.c # 2004/12/27 18:40:05-08:00 bunk@stusta.de +1 -27 # [NETLINK]: Staticize and remove unused functions. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # include/linux/netlink.h # 2004/12/27 18:40:05-08:00 bunk@stusta.de +0 -3 # [NETLINK]: Staticize and remove unused functions. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # ChangeSet # 2004/12/27 18:38:23-08:00 bunk@stusta.de # [AF_NET]: Mark pfkey_table static. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/key/af_key.c # 2004/12/27 18:38:03-08:00 bunk@stusta.de +1 -1 # [AF_NET]: Mark pfkey_table static. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # ChangeSet # 2004/12/27 18:36:20-08:00 bunk@stusta.de # [NET]: Mark eth_header_parse static. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/ethernet/eth.c # 2004/12/27 18:36:00-08:00 bunk@stusta.de +1 -1 # [NET]: Mark eth_header_parse static. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # include/linux/etherdevice.h # 2004/12/27 18:36:00-08:00 bunk@stusta.de +0 -2 # [NET]: Mark eth_header_parse static. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # ChangeSet # 2004/12/27 18:33:52-08:00 bunk@stusta.de # [XFRM]: Staticize, and remove unused global functions. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/xfrm/xfrm_user.c # 2004/12/27 18:33:32-08:00 bunk@stusta.de +2 -2 # [XFRM]: Staticize, and remove unused global functions. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/xfrm/xfrm_state.c # 2004/12/27 18:33:32-08:00 bunk@stusta.de +5 -2 # [XFRM]: Staticize, and remove unused global functions. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/xfrm/xfrm_policy.c # 2004/12/27 18:33:32-08:00 bunk@stusta.de +4 -4 # [XFRM]: Staticize, and remove unused global functions. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/xfrm/xfrm_export.c # 2004/12/27 18:33:32-08:00 bunk@stusta.de +0 -1 # [XFRM]: Staticize, and remove unused global functions. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/xfrm/xfrm_algo.c # 2004/12/27 18:33:32-08:00 bunk@stusta.de +0 -8 # [XFRM]: Staticize, and remove unused global functions. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # include/net/xfrm.h # 2004/12/27 18:33:32-08:00 bunk@stusta.de +0 -5 # [XFRM]: Staticize, and remove unused global functions. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # ChangeSet # 2004/12/27 18:32:23-08:00 bunk@stusta.de # [X25]: Staticize, and remove unused global functions. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/x25/x25_proc.c # 2004/12/27 18:32:03-08:00 bunk@stusta.de +2 -2 # [X25]: Staticize, and remove unused global functions. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/x25/x25_link.c # 2004/12/27 18:32:03-08:00 bunk@stusta.de +5 -28 # [X25]: Staticize, and remove unused global functions. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/x25/x25_dev.c # 2004/12/27 18:32:03-08:00 bunk@stusta.de +0 -23 # [X25]: Staticize, and remove unused global functions. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/x25/af_x25.c # 2004/12/27 18:32:03-08:00 bunk@stusta.de +4 -4 # [X25]: Staticize, and remove unused global functions. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # include/net/x25.h # 2004/12/27 18:32:03-08:00 bunk@stusta.de +0 -5 # [X25]: Staticize, and remove unused global functions. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # ChangeSet # 2004/12/27 18:30:49-08:00 bunk@stusta.de # [AF_UNIX]: Mark needlessly global code static. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/unix/sysctl_net_unix.c # 2004/12/27 18:30:29-08:00 bunk@stusta.de +1 -1 # [AF_UNIX]: Mark needlessly global code static. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/unix/af_unix.c # 2004/12/27 18:30:29-08:00 bunk@stusta.de +1 -1 # [AF_UNIX]: Mark needlessly global code static. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # ChangeSet # 2004/12/27 18:29:36-08:00 bunk@stusta.de # [SUNRPC]: Staticize, kill unused functions, and remove unneeded exports. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/sunrpc/xprt.c # 2004/12/27 18:29:16-08:00 bunk@stusta.de +5 -3 # [SUNRPC]: Staticize, kill unused functions, and remove unneeded exports. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/sunrpc/xdr.c # 2004/12/27 18:29:16-08:00 bunk@stusta.de +3 -130 # [SUNRPC]: Staticize, kill unused functions, and remove unneeded exports. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/sunrpc/svcauth_unix.c # 2004/12/27 18:29:16-08:00 bunk@stusta.de +3 -3 # [SUNRPC]: Staticize, kill unused functions, and remove unneeded exports. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/sunrpc/svcauth.c # 2004/12/27 18:29:16-08:00 bunk@stusta.de +2 -1 # [SUNRPC]: Staticize, kill unused functions, and remove unneeded exports. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/sunrpc/sunrpc_syms.c # 2004/12/27 18:29:16-08:00 bunk@stusta.de +0 -1 # [SUNRPC]: Staticize, kill unused functions, and remove unneeded exports. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/sunrpc/sched.c # 2004/12/27 18:29:16-08:00 bunk@stusta.de +4 -1 # [SUNRPC]: Staticize, kill unused functions, and remove unneeded exports. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/sunrpc/rpc_pipe.c # 2004/12/27 18:29:16-08:00 bunk@stusta.de +2 -7 # [SUNRPC]: Staticize, kill unused functions, and remove unneeded exports. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/sunrpc/pmap_clnt.c # 2004/12/27 18:29:16-08:00 bunk@stusta.de +2 -2 # [SUNRPC]: Staticize, kill unused functions, and remove unneeded exports. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/sunrpc/cache.c # 2004/12/27 18:29:16-08:00 bunk@stusta.de +9 -32 # [SUNRPC]: Staticize, kill unused functions, and remove unneeded exports. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/sunrpc/auth_gss/svcauth_gss.c # 2004/12/27 18:29:16-08:00 bunk@stusta.de +2 -2 # [SUNRPC]: Staticize, kill unused functions, and remove unneeded exports. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/sunrpc/auth_gss/gss_spkm3_mech.c # 2004/12/27 18:29:16-08:00 bunk@stusta.de +3 -6 # [SUNRPC]: Staticize, kill unused functions, and remove unneeded exports. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/sunrpc/auth_gss/gss_krb5_mech.c # 2004/12/27 18:29:16-08:00 bunk@stusta.de +0 -3 # [SUNRPC]: Staticize, kill unused functions, and remove unneeded exports. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/sunrpc/auth_gss/gss_krb5_crypto.c # 2004/12/27 18:29:16-08:00 bunk@stusta.de +1 -1 # [SUNRPC]: Staticize, kill unused functions, and remove unneeded exports. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/sunrpc/auth_gss/gss_generic_token.c # 2004/12/27 18:29:16-08:00 bunk@stusta.de +0 -35 # [SUNRPC]: Staticize, kill unused functions, and remove unneeded exports. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/sunrpc/auth_gss/auth_gss.c # 2004/12/27 18:29:16-08:00 bunk@stusta.de +1 -1 # [SUNRPC]: Staticize, kill unused functions, and remove unneeded exports. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/sunrpc/auth.c # 2004/12/27 18:29:16-08:00 bunk@stusta.de +1 -1 # [SUNRPC]: Staticize, kill unused functions, and remove unneeded exports. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # include/linux/sunrpc/xprt.h # 2004/12/27 18:29:16-08:00 bunk@stusta.de +0 -3 # [SUNRPC]: Staticize, kill unused functions, and remove unneeded exports. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # include/linux/sunrpc/xdr.h # 2004/12/27 18:29:16-08:00 bunk@stusta.de +0 -6 # [SUNRPC]: Staticize, kill unused functions, and remove unneeded exports. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # include/linux/sunrpc/sched.h # 2004/12/27 18:29:16-08:00 bunk@stusta.de +0 -1 # [SUNRPC]: Staticize, kill unused functions, and remove unneeded exports. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # include/linux/sunrpc/gss_asn1.h # 2004/12/27 18:29:16-08:00 bunk@stusta.de +0 -2 # [SUNRPC]: Staticize, kill unused functions, and remove unneeded exports. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # include/linux/sunrpc/cache.h # 2004/12/27 18:29:16-08:00 bunk@stusta.de +0 -5 # [SUNRPC]: Staticize, kill unused functions, and remove unneeded exports. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # include/linux/sunrpc/auth.h # 2004/12/27 18:29:16-08:00 bunk@stusta.de +0 -2 # [SUNRPC]: Staticize, kill unused functions, and remove unneeded exports. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # ChangeSet # 2004/12/27 18:25:23-08:00 bunk@stusta.de # [NET]: No need to export sock_readv_writev # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/socket.c # 2004/12/27 18:25:03-08:00 bunk@stusta.de +3 -2 # [NET]: No need to export sock_readv_writev # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # include/linux/net.h # 2004/12/27 18:25:03-08:00 bunk@stusta.de +0 -4 # [NET]: No need to export sock_readv_writev # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # ChangeSet # 2004/12/27 18:24:18-08:00 bunk@stusta.de # [AX25]: Staticize functions, and remove unused global function. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/ax25/ax25_ds_subr.c # 2004/12/27 18:23:58-08:00 bunk@stusta.de +1 -1 # [AX25]: Staticize functions, and remove unused global function. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/ax25/ax25_addr.c # 2004/12/27 18:23:58-08:00 bunk@stusta.de +0 -20 # [AX25]: Staticize functions, and remove unused global function. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/ax25/af_ax25.c # 2004/12/27 18:23:58-08:00 bunk@stusta.de +1 -1 # [AX25]: Staticize functions, and remove unused global function. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # include/net/ax25.h # 2004/12/27 18:23:58-08:00 bunk@stusta.de +0 -3 # [AX25]: Staticize functions, and remove unused global function. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # ChangeSet # 2004/12/27 18:23:16-08:00 bunk@stusta.de # [APPLETALK]: Make some code static. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/appletalk/ddp.c # 2004/12/27 18:22:56-08:00 bunk@stusta.de +3 -3 # [APPLETALK]: Make some code static. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/appletalk/atalk_proc.c # 2004/12/27 18:22:56-08:00 bunk@stusta.de +3 -3 # [APPLETALK]: Make some code static. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # net/appletalk/aarp.c # 2004/12/27 18:22:56-08:00 bunk@stusta.de +2 -2 # [APPLETALK]: Make some code static. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # include/linux/atalk.h # 2004/12/27 18:22:56-08:00 bunk@stusta.de +0 -2 # [APPLETALK]: Make some code static. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # ChangeSet # 2004/12/27 18:18:32-08:00 bunk@stusta.de # [SUNRPC]: Remove unused file net/sunrpc/auth_gss/sunrpcgss_syms.c # # Signed-off-by: David S. Miller # # BitKeeper/deleted/.del-sunrpcgss_syms.c~1faadca444e4da14 # 2004/12/27 18:17:57-08:00 bunk@stusta.de +0 -0 # Delete: net/sunrpc/auth_gss/sunrpcgss_syms.c # # ChangeSet # 2004/12/27 18:15:09-08:00 bunk@stusta.de # [SUNRPC]: Remove unused file net/sunrpc/svcauth_des.c # # Signed-off-by: David S. Miller # # BitKeeper/deleted/.del-svcauth_des.c~6e3893ce7064e0ed # 2004/12/27 18:14:36-08:00 bunk@stusta.de +0 -0 # Delete: net/sunrpc/svcauth_des.c # # ChangeSet # 2004/12/27 18:12:59-08:00 bunk@stusta.de # [SUNRPC]: Remove unused file net/sunrpc/auth_gss/gss_pseudoflavors.c # # Signed-off-by: David S. Miller # # BitKeeper/deleted/.del-gss_pseudoflavors.c~2f397379d8d33406 # 2004/12/27 18:12:09-08:00 bunk@stusta.de +0 -0 # Delete: net/sunrpc/auth_gss/gss_pseudoflavors.c # # ChangeSet # 2004/12/27 18:08:07-08:00 chas@cmf.nrl.navy.mil # [ATM]: small atm cleanups (from Adrian Bunk ) # # Signed-off-by: Chas Williams # Signed-off-by: David S. Miller # # drivers/atm/nicstarmac.h # 2004/12/27 18:07:47-08:00 chas@cmf.nrl.navy.mil +0 -1 # [ATM]: small atm cleanups (from Adrian Bunk ) # # Signed-off-by: Chas Williams # Signed-off-by: David S. Miller # # drivers/atm/nicstarmac.c # 2004/12/27 18:07:47-08:00 chas@cmf.nrl.navy.mil +4 -1 # [ATM]: small atm cleanups (from Adrian Bunk ) # # Signed-off-by: Chas Williams # Signed-off-by: David S. Miller # # drivers/atm/iphase.h # 2004/12/27 18:07:47-08:00 chas@cmf.nrl.navy.mil +0 -4 # [ATM]: small atm cleanups (from Adrian Bunk ) # # Signed-off-by: Chas Williams # Signed-off-by: David S. Miller # # drivers/atm/iphase.c # 2004/12/27 18:07:47-08:00 chas@cmf.nrl.navy.mil +7 -10 # [ATM]: small atm cleanups (from Adrian Bunk ) # # Signed-off-by: Chas Williams # Signed-off-by: David S. Miller # # drivers/atm/idt77252.h # 2004/12/27 18:07:47-08:00 chas@cmf.nrl.navy.mil +1 -1 # [ATM]: small atm cleanups (from Adrian Bunk ) # # Signed-off-by: Chas Williams # Signed-off-by: David S. Miller # # drivers/atm/idt77105.h # 2004/12/27 18:07:47-08:00 chas@cmf.nrl.navy.mil +0 -1 # [ATM]: small atm cleanups (from Adrian Bunk ) # # Signed-off-by: Chas Williams # Signed-off-by: David S. Miller # # drivers/atm/idt77105.c # 2004/12/27 18:07:47-08:00 chas@cmf.nrl.navy.mil +1 -1 # [ATM]: small atm cleanups (from Adrian Bunk ) # # Signed-off-by: Chas Williams # Signed-off-by: David S. Miller # # drivers/atm/he.h # 2004/12/27 18:07:47-08:00 chas@cmf.nrl.navy.mil +0 -43 # [ATM]: small atm cleanups (from Adrian Bunk ) # # Signed-off-by: Chas Williams # Signed-off-by: David S. Miller # # drivers/atm/he.c # 2004/12/27 18:07:47-08:00 chas@cmf.nrl.navy.mil +43 -1 # [ATM]: small atm cleanups (from Adrian Bunk ) # # Signed-off-by: Chas Williams # Signed-off-by: David S. Miller # # drivers/atm/firestream.c # 2004/12/27 18:07:47-08:00 chas@cmf.nrl.navy.mil +6 -6 # [ATM]: small atm cleanups (from Adrian Bunk ) # # Signed-off-by: Chas Williams # Signed-off-by: David S. Miller # # drivers/atm/atmtcp.c # 2004/12/27 18:07:47-08:00 chas@cmf.nrl.navy.mil +3 -3 # [ATM]: small atm cleanups (from Adrian Bunk ) # # Signed-off-by: Chas Williams # Signed-off-by: David S. Miller # # drivers/atm/ambassador.c # 2004/12/27 18:07:47-08:00 chas@cmf.nrl.navy.mil +2 -2 # [ATM]: small atm cleanups (from Adrian Bunk ) # # Signed-off-by: Chas Williams # Signed-off-by: David S. Miller # # ChangeSet # 2004/12/27 18:06:57-08:00 tgraf@suug.ch # [PKT_SCHED]: Validate policer configuration TLVs. # # Signed-off-by: Thomas Graf # Signed-off-by: David S. Miller # # net/sched/police.c # 2004/12/27 18:06:37-08:00 tgraf@suug.ch +22 -8 # [PKT_SCHED]: Validate policer configuration TLVs. # # Signed-off-by: Thomas Graf # Signed-off-by: David S. Miller # # ChangeSet # 2004/12/27 23:57:10-02:00 acme@conectiva.com.br # [INET] move inet_sock into inet_opt and rename it to inet_sock # # With this we can remove all the cut'n'pasted layouts in all inet_sock # derived classes, such as tcp_sock, udp_sock, sctp_sock, etc. # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # security/selinux/avc.c # 2004/12/27 23:56:34-02:00 acme@conectiva.com.br +2 -2 # [INET] move inet_sock into inet_opt and rename it to inet_sock # # With this we can remove all the cut'n'pasted layouts in all inet_sock # derived classes, such as tcp_sock, udp_sock, sctp_sock, etc. # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/sctp/protocol.c # 2004/12/27 23:56:34-02:00 acme@conectiva.com.br +2 -2 # [INET] move inet_sock into inet_opt and rename it to inet_sock # # With this we can remove all the cut'n'pasted layouts in all inet_sock # derived classes, such as tcp_sock, udp_sock, sctp_sock, etc. # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/sctp/ipv6.c # 2004/12/27 23:56:34-02:00 acme@conectiva.com.br +3 -3 # [INET] move inet_sock into inet_opt and rename it to inet_sock # # With this we can remove all the cut'n'pasted layouts in all inet_sock # derived classes, such as tcp_sock, udp_sock, sctp_sock, etc. # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/sctp/input.c # 2004/12/27 23:56:34-02:00 acme@conectiva.com.br +1 -1 # [INET] move inet_sock into inet_opt and rename it to inet_sock # # With this we can remove all the cut'n'pasted layouts in all inet_sock # derived classes, such as tcp_sock, udp_sock, sctp_sock, etc. # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/ipv6/udp.c # 2004/12/27 23:56:34-02:00 acme@conectiva.com.br +6 -6 # [INET] move inet_sock into inet_opt and rename it to inet_sock # # With this we can remove all the cut'n'pasted layouts in all inet_sock # derived classes, such as tcp_sock, udp_sock, sctp_sock, etc. # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/ipv6/tcp_ipv6.c # 2004/12/27 23:56:34-02:00 acme@conectiva.com.br +10 -10 # [INET] move inet_sock into inet_opt and rename it to inet_sock # # With this we can remove all the cut'n'pasted layouts in all inet_sock # derived classes, such as tcp_sock, udp_sock, sctp_sock, etc. # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/ipv6/raw.c # 2004/12/27 23:56:34-02:00 acme@conectiva.com.br +5 -5 # [INET] move inet_sock into inet_opt and rename it to inet_sock # # With this we can remove all the cut'n'pasted layouts in all inet_sock # derived classes, such as tcp_sock, udp_sock, sctp_sock, etc. # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/ipv6/ip6_output.c # 2004/12/27 23:56:34-02:00 acme@conectiva.com.br +3 -3 # [INET] move inet_sock into inet_opt and rename it to inet_sock # # With this we can remove all the cut'n'pasted layouts in all inet_sock # derived classes, such as tcp_sock, udp_sock, sctp_sock, etc. # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/ipv6/datagram.c # 2004/12/27 23:56:34-02:00 acme@conectiva.com.br +2 -2 # [INET] move inet_sock into inet_opt and rename it to inet_sock # # With this we can remove all the cut'n'pasted layouts in all inet_sock # derived classes, such as tcp_sock, udp_sock, sctp_sock, etc. # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/ipv6/af_inet6.c # 2004/12/27 23:56:34-02:00 acme@conectiva.com.br +4 -6 # [INET] move inet_sock into inet_opt and rename it to inet_sock # # With this we can remove all the cut'n'pasted layouts in all inet_sock # derived classes, such as tcp_sock, udp_sock, sctp_sock, etc. # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/ipv4/udp.c # 2004/12/27 23:56:34-02:00 acme@conectiva.com.br +10 -10 # [INET] move inet_sock into inet_opt and rename it to inet_sock # # With this we can remove all the cut'n'pasted layouts in all inet_sock # derived classes, such as tcp_sock, udp_sock, sctp_sock, etc. # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/ipv4/tcp_timer.c # 2004/12/27 23:56:34-02:00 acme@conectiva.com.br +1 -1 # [INET] move inet_sock into inet_opt and rename it to inet_sock # # With this we can remove all the cut'n'pasted layouts in all inet_sock # derived classes, such as tcp_sock, udp_sock, sctp_sock, etc. # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/ipv4/tcp_output.c # 2004/12/27 23:56:34-02:00 acme@conectiva.com.br +1 -1 # [INET] move inet_sock into inet_opt and rename it to inet_sock # # With this we can remove all the cut'n'pasted layouts in all inet_sock # derived classes, such as tcp_sock, udp_sock, sctp_sock, etc. # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/ipv4/tcp_minisocks.c # 2004/12/27 23:56:34-02:00 acme@conectiva.com.br +1 -1 # [INET] move inet_sock into inet_opt and rename it to inet_sock # # With this we can remove all the cut'n'pasted layouts in all inet_sock # derived classes, such as tcp_sock, udp_sock, sctp_sock, etc. # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/ipv4/tcp_ipv4.c # 2004/12/27 23:56:34-02:00 acme@conectiva.com.br +16 -16 # [INET] move inet_sock into inet_opt and rename it to inet_sock # # With this we can remove all the cut'n'pasted layouts in all inet_sock # derived classes, such as tcp_sock, udp_sock, sctp_sock, etc. # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/ipv4/tcp_input.c # 2004/12/27 23:56:34-02:00 acme@conectiva.com.br +1 -1 # [INET] move inet_sock into inet_opt and rename it to inet_sock # # With this we can remove all the cut'n'pasted layouts in all inet_sock # derived classes, such as tcp_sock, udp_sock, sctp_sock, etc. # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/ipv4/tcp_diag.c # 2004/12/27 23:56:34-02:00 acme@conectiva.com.br +7 -7 # [INET] move inet_sock into inet_opt and rename it to inet_sock # # With this we can remove all the cut'n'pasted layouts in all inet_sock # derived classes, such as tcp_sock, udp_sock, sctp_sock, etc. # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/ipv4/tcp.c # 2004/12/27 23:56:34-02:00 acme@conectiva.com.br +2 -2 # [INET] move inet_sock into inet_opt and rename it to inet_sock # # With this we can remove all the cut'n'pasted layouts in all inet_sock # derived classes, such as tcp_sock, udp_sock, sctp_sock, etc. # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/ipv4/raw.c # 2004/12/27 23:56:34-02:00 acme@conectiva.com.br +7 -7 # [INET] move inet_sock into inet_opt and rename it to inet_sock # # With this we can remove all the cut'n'pasted layouts in all inet_sock # derived classes, such as tcp_sock, udp_sock, sctp_sock, etc. # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/ipv4/netfilter/ip_conntrack_core.c # 2004/12/27 23:56:34-02:00 acme@conectiva.com.br +1 -1 # [INET] move inet_sock into inet_opt and rename it to inet_sock # # With this we can remove all the cut'n'pasted layouts in all inet_sock # derived classes, such as tcp_sock, udp_sock, sctp_sock, etc. # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/ipv4/ipvs/ip_vs_sync.c # 2004/12/27 23:56:34-02:00 acme@conectiva.com.br +3 -3 # [INET] move inet_sock into inet_opt and rename it to inet_sock # # With this we can remove all the cut'n'pasted layouts in all inet_sock # derived classes, such as tcp_sock, udp_sock, sctp_sock, etc. # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/ipv4/ip_sockglue.c # 2004/12/27 23:56:34-02:00 acme@conectiva.com.br +6 -6 # [INET] move inet_sock into inet_opt and rename it to inet_sock # # With this we can remove all the cut'n'pasted layouts in all inet_sock # derived classes, such as tcp_sock, udp_sock, sctp_sock, etc. # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/ipv4/ip_output.c # 2004/12/27 23:56:34-02:00 acme@conectiva.com.br +8 -8 # [INET] move inet_sock into inet_opt and rename it to inet_sock # # With this we can remove all the cut'n'pasted layouts in all inet_sock # derived classes, such as tcp_sock, udp_sock, sctp_sock, etc. # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/ipv4/igmp.c # 2004/12/27 23:56:34-02:00 acme@conectiva.com.br +8 -8 # [INET] move inet_sock into inet_opt and rename it to inet_sock # # With this we can remove all the cut'n'pasted layouts in all inet_sock # derived classes, such as tcp_sock, udp_sock, sctp_sock, etc. # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/ipv4/icmp.c # 2004/12/27 23:56:33-02:00 acme@conectiva.com.br +2 -2 # [INET] move inet_sock into inet_opt and rename it to inet_sock # # With this we can remove all the cut'n'pasted layouts in all inet_sock # derived classes, such as tcp_sock, udp_sock, sctp_sock, etc. # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/ipv4/datagram.c # 2004/12/27 23:56:33-02:00 acme@conectiva.com.br +1 -1 # [INET] move inet_sock into inet_opt and rename it to inet_sock # # With this we can remove all the cut'n'pasted layouts in all inet_sock # derived classes, such as tcp_sock, udp_sock, sctp_sock, etc. # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/ipv4/af_inet.c # 2004/12/27 23:56:33-02:00 acme@conectiva.com.br +5 -5 # [INET] move inet_sock into inet_opt and rename it to inet_sock # # With this we can remove all the cut'n'pasted layouts in all inet_sock # derived classes, such as tcp_sock, udp_sock, sctp_sock, etc. # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # include/net/tcp.h # 2004/12/27 23:56:33-02:00 acme@conectiva.com.br +1 -1 # [INET] move inet_sock into inet_opt and rename it to inet_sock # # With this we can remove all the cut'n'pasted layouts in all inet_sock # derived classes, such as tcp_sock, udp_sock, sctp_sock, etc. # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # include/net/sctp/sctp.h # 2004/12/27 23:56:33-02:00 acme@conectiva.com.br +3 -9 # [INET] move inet_sock into inet_opt and rename it to inet_sock # # With this we can remove all the cut'n'pasted layouts in all inet_sock # derived classes, such as tcp_sock, udp_sock, sctp_sock, etc. # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # include/net/icmp.h # 2004/12/27 23:56:33-02:00 acme@conectiva.com.br +1 -7 # [INET] move inet_sock into inet_opt and rename it to inet_sock # # With this we can remove all the cut'n'pasted layouts in all inet_sock # derived classes, such as tcp_sock, udp_sock, sctp_sock, etc. # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # include/linux/udp.h # 2004/12/27 23:56:33-02:00 acme@conectiva.com.br +1 -5 # [INET] move inet_sock into inet_opt and rename it to inet_sock # # With this we can remove all the cut'n'pasted layouts in all inet_sock # derived classes, such as tcp_sock, udp_sock, sctp_sock, etc. # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # include/linux/tcp.h # 2004/12/27 23:56:33-02:00 acme@conectiva.com.br +1 -5 # [INET] move inet_sock into inet_opt and rename it to inet_sock # # With this we can remove all the cut'n'pasted layouts in all inet_sock # derived classes, such as tcp_sock, udp_sock, sctp_sock, etc. # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # include/linux/ipv6.h # 2004/12/27 23:56:33-02:00 acme@conectiva.com.br +4 -10 # [INET] move inet_sock into inet_opt and rename it to inet_sock # # With this we can remove all the cut'n'pasted layouts in all inet_sock # derived classes, such as tcp_sock, udp_sock, sctp_sock, etc. # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # include/linux/ip.h # 2004/12/27 23:56:33-02:00 acme@conectiva.com.br +10 -14 # [INET] move inet_sock into inet_opt and rename it to inet_sock # # With this we can remove all the cut'n'pasted layouts in all inet_sock # derived classes, such as tcp_sock, udp_sock, sctp_sock, etc. # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # ChangeSet # 2004/12/27 15:41:28-05:00 stkn@gentoo.org # [libata] add #include (fixes 2.4 alpha build) # # drivers/scsi/libata-core.c # 2004/12/27 15:41:22-05:00 stkn@gentoo.org +1 -0 # [libata] add #include (fixes 2.4 alpha build) # # ChangeSet # 2004/12/27 15:29:14-05:00 albertcc@tw.ibm.com # [libata] verify ATAPI DMA for a given request is OK # # After some testing, it seems that some PATA host adapter (ex. pdc20275) cannot # work reliably with specific request buffer sizes under ATAPI DMA mode. # # Detailed test result: # 4096, 2048, 1024, 512, 256: OK # 384, 257, 255, 128, 96, 64, 32: failed (irq lost) # # It seems multiple of 256 bytes are the safe ATAPI DMA buffer sizes to use. # # Attached please find the patch to fix the pdc2027x ATAPI DMA problem. # # Changes: # 1. Add a callback function "check_atapi_dma()" to ata_port_operations such that libata core # can ask the driver: "Can this command be processed in ATAPI DMA mode safely? " # when the the command is received. # 2. ATAPI DMA is off by default if the callback function is not provided by the driver # # If the callback function is not provided by the driver, the ATAPI DMA should be as is. # The ATAPI DMA is already controlled by dev->flags. # # BTW, the patch isolates the ATAPI DMA workaround to the pdc20275 driver itself, # not impacting libata core . # # Signed-off-by: Albert Lee # # include/linux/libata.h # 2004/12/27 15:29:08-05:00 albertcc@tw.ibm.com +2 -0 # [libata] verify ATAPI DMA for a given request is OK # # After some testing, it seems that some PATA host adapter (ex. pdc20275) cannot # work reliably with specific request buffer sizes under ATAPI DMA mode. # # Detailed test result: # 4096, 2048, 1024, 512, 256: OK # 384, 257, 255, 128, 96, 64, 32: failed (irq lost) # # It seems multiple of 256 bytes are the safe ATAPI DMA buffer sizes to use. # # Attached please find the patch to fix the pdc2027x ATAPI DMA problem. # # Changes: # 1. Add a callback function "check_atapi_dma()" to ata_port_operations such that libata core # can ask the driver: "Can this command be processed in ATAPI DMA mode safely? " # when the the command is received. # 2. ATAPI DMA is off by default if the callback function is not provided by the driver # # If the callback function is not provided by the driver, the ATAPI DMA should be as is. # The ATAPI DMA is already controlled by dev->flags. # # BTW, the patch isolates the ATAPI DMA workaround to the pdc20275 driver itself, # not impacting libata core . # # Signed-off-by: Albert Lee # # drivers/scsi/libata.h # 2004/12/27 15:29:08-05:00 albertcc@tw.ibm.com +1 -0 # [libata] verify ATAPI DMA for a given request is OK # # After some testing, it seems that some PATA host adapter (ex. pdc20275) cannot # work reliably with specific request buffer sizes under ATAPI DMA mode. # # Detailed test result: # 4096, 2048, 1024, 512, 256: OK # 384, 257, 255, 128, 96, 64, 32: failed (irq lost) # # It seems multiple of 256 bytes are the safe ATAPI DMA buffer sizes to use. # # Attached please find the patch to fix the pdc2027x ATAPI DMA problem. # # Changes: # 1. Add a callback function "check_atapi_dma()" to ata_port_operations such that libata core # can ask the driver: "Can this command be processed in ATAPI DMA mode safely? " # when the the command is received. # 2. ATAPI DMA is off by default if the callback function is not provided by the driver # # If the callback function is not provided by the driver, the ATAPI DMA should be as is. # The ATAPI DMA is already controlled by dev->flags. # # BTW, the patch isolates the ATAPI DMA workaround to the pdc20275 driver itself, # not impacting libata core . # # Signed-off-by: Albert Lee # # drivers/scsi/libata-scsi.c # 2004/12/27 15:29:08-05:00 albertcc@tw.ibm.com +5 -0 # [libata] verify ATAPI DMA for a given request is OK # # After some testing, it seems that some PATA host adapter (ex. pdc20275) cannot # work reliably with specific request buffer sizes under ATAPI DMA mode. # # Detailed test result: # 4096, 2048, 1024, 512, 256: OK # 384, 257, 255, 128, 96, 64, 32: failed (irq lost) # # It seems multiple of 256 bytes are the safe ATAPI DMA buffer sizes to use. # # Attached please find the patch to fix the pdc2027x ATAPI DMA problem. # # Changes: # 1. Add a callback function "check_atapi_dma()" to ata_port_operations such that libata core # can ask the driver: "Can this command be processed in ATAPI DMA mode safely? " # when the the command is received. # 2. ATAPI DMA is off by default if the callback function is not provided by the driver # # If the callback function is not provided by the driver, the ATAPI DMA should be as is. # The ATAPI DMA is already controlled by dev->flags. # # BTW, the patch isolates the ATAPI DMA workaround to the pdc20275 driver itself, # not impacting libata core . # # Signed-off-by: Albert Lee # # drivers/scsi/libata-core.c # 2004/12/27 15:29:08-05:00 albertcc@tw.ibm.com +17 -0 # [libata] verify ATAPI DMA for a given request is OK # # After some testing, it seems that some PATA host adapter (ex. pdc20275) cannot # work reliably with specific request buffer sizes under ATAPI DMA mode. # # Detailed test result: # 4096, 2048, 1024, 512, 256: OK # 384, 257, 255, 128, 96, 64, 32: failed (irq lost) # # It seems multiple of 256 bytes are the safe ATAPI DMA buffer sizes to use. # # Attached please find the patch to fix the pdc2027x ATAPI DMA problem. # # Changes: # 1. Add a callback function "check_atapi_dma()" to ata_port_operations such that libata core # can ask the driver: "Can this command be processed in ATAPI DMA mode safely? " # when the the command is received. # 2. ATAPI DMA is off by default if the callback function is not provided by the driver # # If the callback function is not provided by the driver, the ATAPI DMA should be as is. # The ATAPI DMA is already controlled by dev->flags. # # BTW, the patch isolates the ATAPI DMA workaround to the pdc20275 driver itself, # not impacting libata core . # # Signed-off-by: Albert Lee # # ChangeSet # 2004/12/27 15:24:53-05:00 albertcc@tw.ibm.com # [libata] PIO error handling improvement # # Tested burning CD-RW with libata-dev-2.6 and cdrecord: # 1. ATAPI DMA mode - tested OK # 2. ATAPI PIO mode - test failed when cdrecord finishes burning and issues MODE_SELECT to the device. # # After checking the log, it showed that MODE_SELECT caused ata_pio_complete() to return error. # However, the error is not handled by ata_pio_task(). # # Attached please find the patch for ata_pio_task() error handling for your review. # (The patch is against the libata-dev-2.6 tree. ) # # Changes in the patch: # 1. End the PIO task when PIO_ST_IDLE state is entered # 2. End the PIO task after PIO_ST_TMOUT and PIO_ST_ERR state handled by ata_pio_error() # 3. Remove the first "if" statement to handle the error condition returned from # ata_pio_block(), ata_pio_complete() and ata_pio_poll(). # # Change #2 is not so necessary since ata_pio_error() will put the cmd to PIO_ST_IDLE state # after the error condition is handled. The change just saves a function call to queue_work(). # # Tested OK on on my machine with pdc20275 and ASUS CD-RW drive. # # Signed-off-by: Albert Lee # # drivers/scsi/libata-core.c # 2004/12/27 15:24:47-05:00 albertcc@tw.ibm.com +9 -10 # [libata] PIO error handling improvement # # Tested burning CD-RW with libata-dev-2.6 and cdrecord: # 1. ATAPI DMA mode - tested OK # 2. ATAPI PIO mode - test failed when cdrecord finishes burning and issues MODE_SELECT to the device. # # After checking the log, it showed that MODE_SELECT caused ata_pio_complete() to return error. # However, the error is not handled by ata_pio_task(). # # Attached please find the patch for ata_pio_task() error handling for your review. # (The patch is against the libata-dev-2.6 tree. ) # # Changes in the patch: # 1. End the PIO task when PIO_ST_IDLE state is entered # 2. End the PIO task after PIO_ST_TMOUT and PIO_ST_ERR state handled by ata_pio_error() # 3. Remove the first "if" statement to handle the error condition returned from # ata_pio_block(), ata_pio_complete() and ata_pio_poll(). # # Change #2 is not so necessary since ata_pio_error() will put the cmd to PIO_ST_IDLE state # after the error condition is handled. The change just saves a function call to queue_work(). # # Tested OK on on my machine with pdc20275 and ASUS CD-RW drive. # # Signed-off-by: Albert Lee # # ChangeSet # 2004/12/27 15:22:51-05:00 albertcc@tw.ibm.com # [libata] use PIO mode for request sense # # Signed-off-by: Albert Lee # # drivers/scsi/libata-core.c # 2004/12/27 15:22:45-05:00 albertcc@tw.ibm.com +4 -11 # [libata] use PIO mode for request sense # # Signed-off-by: Albert Lee # # ChangeSet # 2004/12/27 15:13:29-05:00 bunk@stusta.de # [PATCH] drivers/char/hw_random.c: make a variable static # # Signed-off-by: Jeff Garzik # # drivers/char/hw_random.c # 2004/11/06 18:10:39-05:00 bunk@stusta.de +1 -1 # drivers/char/hw_random.c: make a variable static (fwd) # # ChangeSet # 2004/12/27 15:13:16-05:00 james4765@verizon.net # [PATCH] hw_random: Minor cleanup to hw_random.c # # Clean up in drivers/char/hw_random.c: # Make debug #defines a little easier to understand. # Small whitespace cleanup. # Change some printk()'s into pr_info()'s. # Add KERN_ constant to debug printk(). # # Signed-off-by: James Nelson # Signed-off-by: Jeff Garzik # # drivers/char/hw_random.c # 2004/12/26 11:22:27-05:00 james4765@verizon.net +15 -18 # hw_random: Minor cleanup to hw_random.c # # ChangeSet # 2004/12/27 10:28:42-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 # 2004/12/27 10:28:38-08:00 torvalds@ppc970.osdl.org +0 -0 # Auto merged # # drivers/scsi/qla2xxx/qla_rscn.c # 2004/12/27 10:28:38-08:00 torvalds@ppc970.osdl.org +0 -0 # Auto merged # # drivers/scsi/aacraid/linit.c # 2004/12/27 10:28:38-08:00 torvalds@ppc970.osdl.org +0 -0 # Auto merged # # drivers/scsi/scsi_lib.c # 2004/12/27 10:28:37-08:00 torvalds@ppc970.osdl.org +0 -0 # Auto merged # # drivers/scsi/aacraid/aacraid.h # 2004/12/27 10:28:37-08:00 torvalds@ppc970.osdl.org +0 -0 # Auto merged # # drivers/scsi/Kconfig # 2004/12/27 10:28:37-08:00 torvalds@ppc970.osdl.org +0 -0 # Auto merged # # ChangeSet # 2004/12/27 10:24:28-08:00 arjan@infradead.org # [PATCH] drivers/acpi/ibm_acpi.o .init.text refers to .exit.text # # the ibm_acpi.c driver references acpi_ibm_exit() from it's __init function, # which means the exit function isn't allowed to be __exit since __exit # functions are not part of vmlinux while __init functions are. # # Signed-off-by: Arjan van de Ven # Signed-off-by: Linus Torvalds # # drivers/acpi/ibm_acpi.c # 2004/12/27 02:20:31-08:00 arjan@infradead.org +1 -1 # drivers/acpi/ibm_acpi.o .init.text refers to .exit.text # # ChangeSet # 2004/12/27 10:21:04-08:00 torvalds@ppc970.osdl.org # Merge bk://linux-voyager.bkbits.net/mca-2.6 # into ppc970.osdl.org:/home/torvalds/v2.6/linux # # include/asm-sparc/processor.h # 2004/12/27 10:21:00-08:00 torvalds@ppc970.osdl.org +0 -0 # Auto merged # # arch/i386/kernel/time.c # 2004/12/27 10:21:00-08:00 torvalds@ppc970.osdl.org +0 -0 # Auto merged # # ChangeSet # 2004/12/27 10:19:24-08:00 torvalds@ppc970.osdl.org # Revert duplicate AC97 id's. # # They were already there, properly sorted too. # # sound/pci/intel8x0.c # 2004/12/27 10:19:17-08:00 torvalds@ppc970.osdl.org +0 -18 # Revert duplicate AC97 id's. # # They were already there, properly sorted too. # # ChangeSet # 2004/12/27 10:06:23-06:00 jejb@mulgrave.(none) # SCSI: fix compile warning in fc transport class # # CC [M] drivers/scsi/scsi_transport_fc.o # drivers/scsi/scsi_transport_fc.c: In function `fc_stat_show': # drivers/scsi/scsi_transport_fc.c:634: warning: long long unsigned int format, long unsigned int arg (arg 4) # # To us %llx on a 64 bit platform we have to cast u64 to # unsigned long long. # # Signed-off-by: James Bottomley # # drivers/scsi/scsi_transport_fc.c # 2004/12/27 10:04:13-06:00 jejb@mulgrave.(none) +1 -1 # SCSI: fix compile warning in fc transport class # # ChangeSet # 2004/12/27 09:52:25-06:00 jejb@mulgrave.(none) # SCSI: Add FC transport host attributes # # From: James.Smart@Emulex.Com # # This patch updates the fc_transport with attributes for local FC ports # (e.g. Hosts). The port attributes are defined per HBAAPI v2.0 definitions. # # This patch results in the following in /sys/class: # ----------------------------------------------------- # # [jsmart@elxware class]$ cd /sys/class # [jsmart@elxware class]$ ls # fc_host graphics misc pci_bus scsi_host usb_host # fc_transport input net scsi_device tty vc # firmware mem netlink scsi_generic usb # [jsmart@elxware class]$ cd fc_host # [jsmart@elxware fc_host]$ ls # host4 # # [jsmart@elxware fc_host]$ cd host4 # [jsmart@elxware host4]$ ls # device host_port_maxframe_size host_port_supported_speeds # host_fabric_name host_port_name host_port_symbolic_name # host_link_down_tmo host_port_speed host_port_type # host_node_name host_port_state host_tgtid_bind_type # host_port_active_fc4s host_port_supported_classes statistics # host_port_id host_port_supported_fc4s # [jsmart@elxware host4]$ ls -ld * # lrwxrwxrwx 1 root root 0 Oct 13 18:24 device -> ../../../devices/platform/host4 # -r--r--r-- 1 root root 4096 Oct 13 18:24 host_fabric_name # -rw-r--r-- 1 root root 4096 Oct 13 18:24 host_link_down_tmo # -r--r--r-- 1 root root 4096 Oct 13 18:24 host_node_name # -r--r--r-- 1 root root 4096 Oct 13 18:24 host_port_active_fc4s # -r--r--r-- 1 root root 4096 Oct 13 18:24 host_port_id # -r--r--r-- 1 root root 4096 Oct 13 18:24 host_port_maxframe_size # -r--r--r-- 1 root root 4096 Oct 13 18:24 host_port_name # -r--r--r-- 1 root root 4096 Oct 13 18:24 host_port_speed # -r--r--r-- 1 root root 4096 Oct 13 18:24 host_port_state # -r--r--r-- 1 root root 4096 Oct 13 18:24 host_port_supported_classes # -r--r--r-- 1 root root 4096 Oct 13 18:24 host_port_supported_fc4s # -r--r--r-- 1 root root 4096 Oct 13 18:24 host_port_supported_speeds # -r--r--r-- 1 root root 4096 Oct 13 18:24 host_port_symbolic_name # -r--r--r-- 1 root root 4096 Oct 13 18:24 host_port_type # -rw-r--r-- 1 root root 4096 Oct 13 18:24 host_tgtid_bind_type # drwxr-xr-x 2 root root 0 Oct 13 18:24 statistics # # # Using the following script (/tmp/show_attributes): # #!/bin/sh # FILES=`ls *` # for file in $FILES; do # if [ -f $file ] ; then # echo "$file : " `cat $file` # fi # done # # Here's a sample of querying the attributes: # # [jsmart@elxware /]$ cd /sys/class/fc_host/host4 # [jsmart@elxware host4]$ /tmp/show_attributes # host_fabric_name : 0x33334444ffeeddcc # host_link_down_tmo : 30 # host_node_name : 0x78563412aabbccdd # host_port_active_fc4s : hex: 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f # host_port_id : 0x789abc # host_port_maxframe_size : 2511 bytes # host_port_name : 0xefcdab9011223344 # host_port_speed : 2 Gbit # host_port_state : Online # host_port_supported_classes : Class 2, Class 3 # host_port_supported_fc4s : hex: 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f # host_port_supported_speeds : 2 Gbit, 4 Gbit, 10 Gbit # host_port_symbolic_name : LP9052 Dual Port Adapter # host_port_type : NPort (fabric via point-to-point) # host_tgtid_bind_type : wwpn (World Wide Port Name) # # Signed-off-by: James Bottomley # # include/scsi/scsi_transport_fc.h # 2004/12/27 09:51:06-06:00 jejb@mulgrave.(none) +207 -28 # SCSI: Add FC transport host attributes # # drivers/scsi/scsi_transport_fc.c # 2004/12/27 09:51:06-06:00 jejb@mulgrave.(none) +400 -53 # SCSI: Add FC transport host attributes # # ChangeSet # 2004/12/27 09:13:20-06:00 sleddog@us.ibm.com # [PATCH] ibmvscsi: replace schedule_timeout() with msleep() # # Description: Use msleep() instead of schedule_timeout() # to guarantee the task delays as expected. Originally # submitted to linux-scsi by the janitors, and resubmitted # by boutcher (after testing :-) # # Signed-off-by: Nishanth Aravamudan # Signed-off-by: Maximilian Attems # Signed-off-by: Dave Boutcher # Signed-off-by: James Bottomley # # drivers/scsi/ibmvscsi/ibmvscsi.c # 2004/10/20 19:41:22-05:00 sleddog@us.ibm.com +2 -2 # ibmvscsi: replace schedule_timeout() with msleep() # # ChangeSet # 2004/12/27 10:58:39+00:00 dvrabel@com.rmk.(none) # [ARM PATCH] 2323/1: Expand IXP4XX_WATCHDOG config help text # # Patch from David Vrabel # # Expand the IXP4XX_WATCHDOG (IXP4xx internal watchdog) config option help text with a note about its ineffectiveness. # # Signed-off-by: David Vrabel # Signed-off-by: Russell King # # drivers/char/watchdog/Kconfig # 2004/12/22 10:54:00+00:00 dvrabel@com.rmk.(none) +5 -0 # [PATCH] 2323/1: Expand IXP4XX_WATCHDOG config help text # # ChangeSet # 2004/12/27 10:53:36+00:00 catalin.marinas@com.rmk.(none) # [ARM PATCH] 2322/1: Enable ARM922T configuration option for Integrator # # Patch from Catalin Marinas # # This patch enables the ARM922T configuration option for the # Integrator platforms (there is an Excalibur core module available). # # Signed-off-by: Catalin Marinas # Signed-off-by: Russell King # # arch/arm/mm/Kconfig # 2004/12/27 00:00:00+00:00 catalin.marinas@com.rmk.(none) +3 -3 # [PATCH] 2322/1: Enable ARM922T configuration option for Integrator # # ChangeSet # 2004/12/27 10:48:52+00:00 dsaxena@net.rmk.(none) # [ARM PATCH] 2264/1: Move platform-specific code out of entry-armv.S # # Patch from Deepak Saxena # # This patch borrows from the uclinux source where they have moved # the per-platform code for get_irqnr_and_base, disable_fiq, and # irq_prio_table out of entry-armv.S. However, instead of putting the # macros in arch/arm/mach-$(MACHINE)/entry-header.S, we just have # it in the machine's incdir. This means we don't need the extra # complexity of creating symlink at build time. The patch also removes # the irq_prio_table as a requirement for all machines and makes it # specific to IOC/IOMD machines. # # This patch drastically shrinks entry-armv.S and allows us to delete # and add machines without having to touch generic code (there were two # dead machines laying around in entry-armv.S). # # Tested on IXP4xx and test-built for just about every defconfig. # # Signed-off-by: Deepak Saxena # Signed-off-by: Russell King # # include/asm-arm/hardware/entry-macro-iomd.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +145 -0 # [PATCH] 2264/1: Move platform-specific code out of entry-armv.S # # include/asm-arm/arch-versatile/entry-macro.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +35 -0 # [PATCH] 2264/1: Move platform-specific code out of entry-armv.S # # include/asm-arm/arch-shark/entry-macro.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +35 -0 # [PATCH] 2264/1: Move platform-specific code out of entry-armv.S # # include/asm-arm/arch-sa1100/entry-macro.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +41 -0 # [PATCH] 2264/1: Move platform-specific code out of entry-armv.S # # include/asm-arm/arch-s3c2410/entry-macro.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +127 -0 # [PATCH] 2264/1: Move platform-specific code out of entry-armv.S # # include/asm-arm/arch-rpc/entry-macro.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +3 -0 # [PATCH] 2264/1: Move platform-specific code out of entry-armv.S # # include/asm-arm/arch-pxa/entry-macro.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +31 -0 # [PATCH] 2264/1: Move platform-specific code out of entry-armv.S # # arch/arm/kernel/entry-header.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +1 -0 # [PATCH] 2264/1: Move platform-specific code out of entry-armv.S # # include/asm-arm/hardware/entry-macro-iomd.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +0 -0 # BitKeeper file /usr/src/bk/linux-2.6-rmk/include/asm-arm/hardware/entry-macro-iomd.S # # include/asm-arm/arch-versatile/entry-macro.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +0 -0 # BitKeeper file /usr/src/bk/linux-2.6-rmk/include/asm-arm/arch-versatile/entry-macro.S # # include/asm-arm/arch-shark/entry-macro.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +0 -0 # BitKeeper file /usr/src/bk/linux-2.6-rmk/include/asm-arm/arch-shark/entry-macro.S # # include/asm-arm/arch-sa1100/entry-macro.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +0 -0 # BitKeeper file /usr/src/bk/linux-2.6-rmk/include/asm-arm/arch-sa1100/entry-macro.S # # include/asm-arm/arch-s3c2410/entry-macro.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +0 -0 # BitKeeper file /usr/src/bk/linux-2.6-rmk/include/asm-arm/arch-s3c2410/entry-macro.S # # include/asm-arm/arch-rpc/entry-macro.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +0 -0 # BitKeeper file /usr/src/bk/linux-2.6-rmk/include/asm-arm/arch-rpc/entry-macro.S # # include/asm-arm/arch-pxa/entry-macro.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +0 -0 # BitKeeper file /usr/src/bk/linux-2.6-rmk/include/asm-arm/arch-pxa/entry-macro.S # # include/asm-arm/arch-omap/entry-macro.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +32 -0 # [PATCH] 2264/1: Move platform-specific code out of entry-armv.S # # include/asm-arm/arch-lh7a40x/entry-macro.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +67 -0 # [PATCH] 2264/1: Move platform-specific code out of entry-armv.S # # include/asm-arm/arch-l7200/entry-macro.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +29 -0 # [PATCH] 2264/1: Move platform-specific code out of entry-armv.S # # include/asm-arm/arch-ixp4xx/entry-macro.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +26 -0 # [PATCH] 2264/1: Move platform-specific code out of entry-armv.S # # include/asm-arm/arch-ixp2000/entry-macro.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +59 -0 # [PATCH] 2264/1: Move platform-specific code out of entry-armv.S # # include/asm-arm/arch-iop3xx/entry-macro.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +61 -0 # [PATCH] 2264/1: Move platform-specific code out of entry-armv.S # # include/asm-arm/arch-integrator/entry-macro.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +35 -0 # [PATCH] 2264/1: Move platform-specific code out of entry-armv.S # # include/asm-arm/arch-imx/entry-macro.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +29 -0 # [PATCH] 2264/1: Move platform-specific code out of entry-armv.S # # include/asm-arm/arch-h720x/entry-macro.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +60 -0 # [PATCH] 2264/1: Move platform-specific code out of entry-armv.S # # include/asm-arm/arch-epxa10db/entry-macro.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +25 -0 # [PATCH] 2264/1: Move platform-specific code out of entry-armv.S # # include/asm-arm/arch-ebsa285/entry-macro.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +105 -0 # [PATCH] 2264/1: Move platform-specific code out of entry-armv.S # # include/asm-arm/arch-ebsa110/entry-macro.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +33 -0 # [PATCH] 2264/1: Move platform-specific code out of entry-armv.S # # include/asm-arm/arch-clps711x/entry-macro.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +51 -0 # [PATCH] 2264/1: Move platform-specific code out of entry-armv.S # # arch/arm/kernel/entry-armv.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +0 -996 # [PATCH] 2264/1: Move platform-specific code out of entry-armv.S # # include/asm-arm/arch-omap/entry-macro.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +0 -0 # BitKeeper file /usr/src/bk/linux-2.6-rmk/include/asm-arm/arch-omap/entry-macro.S # # include/asm-arm/arch-lh7a40x/entry-macro.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +0 -0 # BitKeeper file /usr/src/bk/linux-2.6-rmk/include/asm-arm/arch-lh7a40x/entry-macro.S # # include/asm-arm/arch-l7200/entry-macro.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +0 -0 # BitKeeper file /usr/src/bk/linux-2.6-rmk/include/asm-arm/arch-l7200/entry-macro.S # # include/asm-arm/arch-ixp4xx/entry-macro.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +0 -0 # BitKeeper file /usr/src/bk/linux-2.6-rmk/include/asm-arm/arch-ixp4xx/entry-macro.S # # include/asm-arm/arch-ixp2000/entry-macro.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +0 -0 # BitKeeper file /usr/src/bk/linux-2.6-rmk/include/asm-arm/arch-ixp2000/entry-macro.S # # include/asm-arm/arch-iop3xx/entry-macro.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +0 -0 # BitKeeper file /usr/src/bk/linux-2.6-rmk/include/asm-arm/arch-iop3xx/entry-macro.S # # include/asm-arm/arch-integrator/entry-macro.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +0 -0 # BitKeeper file /usr/src/bk/linux-2.6-rmk/include/asm-arm/arch-integrator/entry-macro.S # # include/asm-arm/arch-imx/entry-macro.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +0 -0 # BitKeeper file /usr/src/bk/linux-2.6-rmk/include/asm-arm/arch-imx/entry-macro.S # # include/asm-arm/arch-h720x/entry-macro.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +0 -0 # BitKeeper file /usr/src/bk/linux-2.6-rmk/include/asm-arm/arch-h720x/entry-macro.S # # include/asm-arm/arch-epxa10db/entry-macro.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +0 -0 # BitKeeper file /usr/src/bk/linux-2.6-rmk/include/asm-arm/arch-epxa10db/entry-macro.S # # include/asm-arm/arch-ebsa285/entry-macro.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +0 -0 # BitKeeper file /usr/src/bk/linux-2.6-rmk/include/asm-arm/arch-ebsa285/entry-macro.S # # include/asm-arm/arch-ebsa110/entry-macro.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +0 -0 # BitKeeper file /usr/src/bk/linux-2.6-rmk/include/asm-arm/arch-ebsa110/entry-macro.S # # include/asm-arm/arch-clps711x/entry-macro.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +0 -0 # BitKeeper file /usr/src/bk/linux-2.6-rmk/include/asm-arm/arch-clps711x/entry-macro.S # # include/asm-arm/arch-cl7500/entry-macro.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +3 -0 # [PATCH] 2264/1: Move platform-specific code out of entry-armv.S # # include/asm-arm/arch-cl7500/entry-macro.S # 2004/11/17 23:16:28+00:00 dsaxena@net.rmk.(none) +0 -0 # BitKeeper file /usr/src/bk/linux-2.6-rmk/include/asm-arm/arch-cl7500/entry-macro.S # # ChangeSet # 2004/12/27 04:31:00-05:00 jgarzik@pobox.com # Merge pobox.com:/garz/repo/netdev-2.6/janitor # into pobox.com:/garz/repo/net-drivers-2.6 # # drivers/net/tulip/tulip_core.c # 2004/12/27 04:30:57-05:00 jgarzik@pobox.com +0 -0 # Auto merged # # drivers/net/r8169.c # 2004/12/27 04:30:57-05:00 jgarzik@pobox.com +0 -0 # Auto merged # # drivers/net/e100.c # 2004/12/27 04:30:57-05:00 jgarzik@pobox.com +0 -0 # Auto merged # # ChangeSet # 2004/12/27 04:29:21-05:00 jgarzik@pobox.com # Merge pobox.com:/garz/repo/netdev-2.6/misc # into pobox.com:/garz/repo/net-drivers-2.6 # # drivers/net/Kconfig # 2004/12/27 04:29:18-05:00 jgarzik@pobox.com +0 -0 # Auto merged # # ChangeSet # 2004/12/27 04:26:39-05:00 jgarzik@pobox.com # Merge pobox.com:/garz/repo/netdev-2.6/viro-eth1 # into pobox.com:/garz/repo/net-drivers-2.6 # # drivers/net/wireless/netwave_cs.c # 2004/12/27 04:26:36-05:00 jgarzik@pobox.com +0 -0 # Auto merged # # drivers/net/wireless/airo.c # 2004/12/27 04:26:36-05:00 jgarzik@pobox.com +0 -0 # Auto merged # # drivers/net/tokenring/olympic.c # 2004/12/27 04:26:36-05:00 jgarzik@pobox.com +0 -0 # Auto merged # # drivers/net/tokenring/lanstreamer.c # 2004/12/27 04:26:36-05:00 jgarzik@pobox.com +0 -0 # Auto merged # # drivers/net/sundance.c # 2004/12/27 04:26:36-05:00 jgarzik@pobox.com +0 -0 # Auto merged # # ChangeSet # 2004/12/26 22:20:57-08:00 alan@lxorguk.ukuu.org.uk # [PATCH] Early ALI watchdog support # # Originally submitted by Mike Waychison in # August but apparently lost. # # Signed-off-by: Alan Cox # Signed-off-by: Linus Torvalds # # drivers/char/watchdog/alim7101_wdt.c # 2004/12/26 09:25:46-08:00 alan@lxorguk.ukuu.org.uk +42 -4 # Early ALI watchdog support # # ChangeSet # 2004/12/26 22:20:44-08:00 alan@lxorguk.ukuu.org.uk # [PATCH] quiet scsi ioctls warnings # # SCSI ioctls can ask for a lot of memory and fail. We don't need to vomit # in the log file for this case. Again taken from the Red Hat minor # patches applied for FC3. # # Original-patch: Arjan van de Ven # Signed-off-by: Alan Cox # Signed-off-by: Linus Torvalds # # drivers/block/scsi_ioctl.c # 2004/12/26 09:27:51-08:00 alan@lxorguk.ukuu.org.uk +1 -1 # quiet scsi ioctls warnings # # ChangeSet # 2004/12/26 22:20:32-08:00 alan@lxorguk.ukuu.org.uk # [PATCH] Paul Laufer CREDITS address update # # Paul Laufer informed the list that he had changed address and his change # of address had been ignored so CREDITS was still wrong although other # files had been updated. # # Fix this. # # Signed-off-by: Alan Cox # Signed-off-by: Linus Torvalds # # CREDITS # 2004/12/26 09:29:08-08:00 alan@lxorguk.ukuu.org.uk +1 -1 # Paul Laufer CREDITS address update # # ChangeSet # 2004/12/26 22:20:19-08:00 alan@lxorguk.ukuu.org.uk # [PATCH] make microcode text less confusing # # Red Hat got some confused customers due to this message. The confused # user case is when they update the BIOS and all of a sudden we have "no # suitable data" yet we did before. We (Arjan van de Ven) thus changed it # to "No new microcode" which is much much clearer. # # Signed-off-by: Alan Cox # Signed-off-by: Linus Torvalds # # arch/i386/kernel/microcode.c # 2004/12/26 09:30:43-08:00 alan@lxorguk.ukuu.org.uk +1 -1 # make microcode text less confusing # # ChangeSet # 2004/12/26 22:20:06-08:00 alan@lxorguk.ukuu.org.uk # [PATCH] i810 more AC97 tunings # # Add some more funky AC97 knowledge to the intel8x0 driver. These come # from Red Hat and its partners and are included in our shipping code. # # Signed-off-by: Alan Cox # Signed-off-by: Linus Torvalds # # sound/pci/intel8x0.c # 2004/12/26 08:56:05-08:00 alan@lxorguk.ukuu.org.uk +18 -0 # i810 more AC97 tunings # # ChangeSet # 2004/12/26 22:15:27-08:00 torvalds@ppc970.osdl.org # Merge bk://linux-dj.bkbits.net/agpgart # into ppc970.osdl.org:/home/torvalds/v2.6/linux # # include/linux/pci_ids.h # 2004/12/26 22:15:23-08:00 torvalds@ppc970.osdl.org +0 -0 # Auto merged # # ChangeSet # 2004/12/26 22:14:57-05:00 jgarzik@pobox.com # Merge pobox.com:/garz/repo/netdev-2.6/s2io # into pobox.com:/garz/repo/net-drivers-2.6 # # drivers/net/Kconfig # 2004/12/26 22:14:54-05:00 jgarzik@pobox.com +0 -0 # Auto merged # # ChangeSet # 2004/12/26 22:13:59-05:00 jgarzik@pobox.com # Merge pobox.com:/garz/repo/netdev-2.6/r8169 # into pobox.com:/garz/repo/net-drivers-2.6 # # drivers/net/r8169.c # 2004/12/26 22:13:57-05:00 jgarzik@pobox.com +0 -0 # Auto merged # # drivers/net/Kconfig # 2004/12/26 22:13:56-05:00 jgarzik@pobox.com +0 -0 # Auto merged # # ChangeSet # 2004/12/25 13:54:06-08:00 davem@nuts.davemloft.net # Merge nuts.davemloft.net:/disk1/BK/net-2.6.11 # into nuts.davemloft.net:/disk1/BK/net-2.6 # # net/sched/act_api.c # 2004/12/25 13:53:55-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # ChangeSet # 2004/12/24 00:03:49-05:00 len.brown@intel.com # Merge intel.com:/home/lenb/src/26-stable-dev # into intel.com:/home/lenb/src/26-latest-dev # # drivers/acpi/pci_irq.c # 2004/12/24 00:03:38-05:00 len.brown@intel.com +0 -0 # Auto merged # # drivers/acpi/hardware/hwsleep.c # 2004/12/24 00:03:38-05:00 len.brown@intel.com +0 -0 # Auto merged # # ChangeSet # 2004/12/23 23:43:30-05:00 len.brown@intel.com # [ACPI] Fix suspend/resume lockup issue # by leaving Bus Master Arbitration enabled. # The ACPI spec mandates it be disabled only for C3. # # http://bugzilla.kernel.org/show_bug.cgi?id=3599 # # Signed-off-by: David Shaohua Li # Signed-off-by: Len Brown # # drivers/acpi/hardware/hwsleep.c # 2004/12/16 23:21:28-05:00 len.brown@intel.com +0 -16 # Fix suspend/resume lockup issue # by leaving Bus Master Arbitration enabled. # # ChangeSet # 2004/12/23 23:38:32-05:00 len.brown@intel.com # [ACPI] apply via_interrupt_line_quirk in ACPI mode # the same way it is applied in legacy mode. # Delete redundant quirks. # # http://bugzilla.kernel.org/show_bug.cgi?id=3319 # # Signed-off-by: David Shaohua Li # Signed-off-by: Len Brown # # drivers/pci/quirks.c # 2004/12/23 23:38:24-05:00 len.brown@intel.com +5 -24 # via_interrupt_line_quirk # # drivers/acpi/pci_irq.c # 2004/12/23 23:38:24-05:00 len.brown@intel.com +4 -0 # via_interrupt_line_quirk # # arch/i386/pci/irq.c # 2004/12/23 23:38:24-05:00 len.brown@intel.com +2 -2 # via_interrupt_line_quirk # # ChangeSet # 2004/12/23 23:11:56-05:00 len.brown@intel.com # [ACPI] another fix to the stack-audit patch # http://bugzilla.kernel.org/show_bug.cgi?id=2901 # # Signed-off-by: Len Brown # # drivers/acpi/pci_irq.c # 2004/12/23 23:11:50-05:00 len.brown@intel.com +2 -5 # another fix to the stack-audit patch # # ChangeSet # 2004/12/23 15:10:05-05:00 len.brown@intel.com # Merge intel.com:/home/lenb/src/26-stable-dev # into intel.com:/home/lenb/src/26-latest-dev # # drivers/acpi/thermal.c # 2004/12/23 15:10:01-05:00 len.brown@intel.com +0 -0 # Auto merged # # drivers/acpi/pci_bind.c # 2004/12/23 15:10:01-05:00 len.brown@intel.com +0 -0 # Auto merged # # ChangeSet # 2004/12/23 15:07:34-05:00 len.brown@intel.com # [ACPI] two fixups where promotion and demotion were mixed up # # Signed-off-by: Dominik Brodowski # Signed-off-by: Len Brown # # drivers/acpi/processor_idle.c # 2004/12/23 08:39:58-05:00 len.brown@intel.com +2 -2 # two fixups where promotion and demotion were mixed up # # ChangeSet # 2004/12/23 14:39:34-05:00 len.brown@intel.com # [ACPI] fix to the stack-audit patch # http://bugzilla.kernel.org/show_bug.cgi?id=2901 # # Signed-off-by: Len Brown # # drivers/acpi/thermal.c # 2004/12/23 14:39:26-05:00 len.brown@intel.com +1 -1 # fix stack-audit patch # # drivers/acpi/pci_bind.c # 2004/12/23 14:39:26-05:00 len.brown@intel.com +1 -1 # fix stack-audit patch # # ChangeSet # 2004/12/23 14:20:02-05:00 len.brown@intel.com # [ACPI] add "processor.nocst" parameter # which blocks _CST parsing and always uses FADT info instead. # # Signed-off-by: Dominik Brodowski # Signed-off-by: Len Brown # # drivers/acpi/processor_idle.c # 2004/12/23 08:25:32-05:00 len.brown@intel.com +10 -3 # add "processor.nocst" parameter # # ChangeSet # 2004/12/23 14:18:22-05:00 len.brown@intel.com # [ACPI] Let C4 demote to C3, not directly to C2. # # Signed-off-by: Dominik Brodowski # Signed-off-by: Len Brown # # drivers/acpi/processor_idle.c # 2004/12/23 08:25:29-05:00 len.brown@intel.com +1 -4 # Let C4 demote to C3, not directly to C2. # # ChangeSet # 2004/12/23 14:13:35-05:00 len.brown@intel.com # # [ACPI] tweak /proc/acpi/processor/CPU0/power format # Current policy is to name both C-state-types and the actual C-States # "C[0-n]". Follow this rule... # # Signed-off-by: Dominik Brodowski # # drivers/acpi/processor_idle.c # 2004/12/23 08:25:24-05:00 len.brown@intel.com +7 -7 # tweak /proc/acpi/processor/CPU0/power format # # ChangeSet # 2004/12/23 13:06:55-06:00 jejb@mulgrave.(none) # SCSI: update 53c700 to use the change_queue_type API # # Signed-off-by: James Bottomley # # drivers/scsi/53c700.h # 2004/12/23 13:05:45-06:00 jejb@mulgrave.(none) +21 -1 # SCSI: update 53c700 to use the change_queue_type API # # drivers/scsi/53c700.c # 2004/12/23 13:05:44-06:00 jejb@mulgrave.(none) +55 -23 # SCSI: update 53c700 to use the change_queue_type API # # ChangeSet # 2004/12/23 13:01:49-06:00 jejb@mulgrave.(none) # SCSI: add queue_type entry in sysfs # # This adds an extra attribute to tell you what type of queueing the # driver is using: none, simple or ordered. If the driver supplies the # change_queue_type API, you can also alter this (which would allow the # turning on or off of TCQ). # # I also fixed the change_queue_depth not to allow the user to go below # one. # # Signed-off-by: James Bottomley # # include/scsi/scsi_tcq.h # 2004/12/23 13:00:32-06:00 jejb@mulgrave.(none) +46 -6 # SCSI: add queue_type entry in sysfs # # include/scsi/scsi_host.h # 2004/12/23 13:00:32-06:00 jejb@mulgrave.(none) +12 -2 # SCSI: add queue_type entry in sysfs # # drivers/scsi/scsi_sysfs.c # 2004/12/23 13:00:32-06:00 jejb@mulgrave.(none) +57 -0 # SCSI: add queue_type entry in sysfs # # ChangeSet # 2004/12/23 12:37:42-06:00 p_gortmaker@yahoo.com # [PATCH] scsi/advansys.c fix !CONFIG_PCI # # advansys.c fails to build for old ISA cards when CONFIG_PCI is not # enabled. # # Signed-off-by: Paul Gortmaker # Signed-off-by: James Bottomley # # drivers/scsi/advansys.c # 2004/12/19 23:04:35-06:00 p_gortmaker@yahoo.com +5 -5 # scsi/advansys.c fix !CONFIG_PCI # # ChangeSet # 2004/12/23 13:16:18-05:00 len.brown@intel.com # [ACPI] max_cstate shall limit C-states not C-state-types. # # Signed-off-by: Dominik Brodowski # Signed-off-by: Len Brown # # drivers/acpi/processor_idle.c # 2004/12/23 08:24:13-05:00 len.brown@intel.com +6 -4 # max_cstate shall limit C-states not C-state types. # # drivers/acpi/osl.c # 2004/12/23 08:09:11-05:00 len.brown@intel.com +2 -1 # max_cstate shall limit C-states not C-state types. # # ChangeSet # 2004/12/22 18:25:25-05:00 davej@redhat.com # [AGPGART] Fix agp=off. # # agp=off disabled the agpgart driver, but not the chipset specific drivers, # which still did their init routines. Chaos ensued. # # Signed-off-by: Dave Jones # # drivers/char/agp/via-agp.c # 2004/12/22 18:25:04-05:00 davej@redhat.com +2 -0 # [AGPGART] Fix agp=off. # # agp=off disabled the agpgart driver, but not the chipset specific drivers, # which still did their init routines. Chaos ensued. # # Signed-off-by: Dave Jones # # drivers/char/agp/uninorth-agp.c # 2004/12/22 18:25:04-05:00 davej@redhat.com +2 -0 # [AGPGART] Fix agp=off. # # agp=off disabled the agpgart driver, but not the chipset specific drivers, # which still did their init routines. Chaos ensued. # # Signed-off-by: Dave Jones # # drivers/char/agp/sworks-agp.c # 2004/12/22 18:25:04-05:00 davej@redhat.com +2 -0 # [AGPGART] Fix agp=off. # # agp=off disabled the agpgart driver, but not the chipset specific drivers, # which still did their init routines. Chaos ensued. # # Signed-off-by: Dave Jones # # drivers/char/agp/sis-agp.c # 2004/12/22 18:25:04-05:00 davej@redhat.com +2 -0 # [AGPGART] Fix agp=off. # # agp=off disabled the agpgart driver, but not the chipset specific drivers, # which still did their init routines. Chaos ensued. # # Signed-off-by: Dave Jones # # drivers/char/agp/nvidia-agp.c # 2004/12/22 18:25:04-05:00 davej@redhat.com +2 -0 # [AGPGART] Fix agp=off. # # agp=off disabled the agpgart driver, but not the chipset specific drivers, # which still did their init routines. Chaos ensued. # # Signed-off-by: Dave Jones # # drivers/char/agp/i460-agp.c # 2004/12/22 18:25:04-05:00 davej@redhat.com +2 -0 # [AGPGART] Fix agp=off. # # agp=off disabled the agpgart driver, but not the chipset specific drivers, # which still did their init routines. Chaos ensued. # # Signed-off-by: Dave Jones # # drivers/char/agp/hp-agp.c # 2004/12/22 18:25:04-05:00 davej@redhat.com +2 -0 # [AGPGART] Fix agp=off. # # agp=off disabled the agpgart driver, but not the chipset specific drivers, # which still did their init routines. Chaos ensued. # # Signed-off-by: Dave Jones # # drivers/char/agp/efficeon-agp.c # 2004/12/22 18:25:04-05:00 davej@redhat.com +3 -0 # [AGPGART] Fix agp=off. # # agp=off disabled the agpgart driver, but not the chipset specific drivers, # which still did their init routines. Chaos ensued. # # Signed-off-by: Dave Jones # # drivers/char/agp/ati-agp.c # 2004/12/22 18:25:04-05:00 davej@redhat.com +2 -0 # [AGPGART] Fix agp=off. # # agp=off disabled the agpgart driver, but not the chipset specific drivers, # which still did their init routines. Chaos ensued. # # Signed-off-by: Dave Jones # # drivers/char/agp/amd-k7-agp.c # 2004/12/22 18:25:04-05:00 davej@redhat.com +2 -0 # [AGPGART] Fix agp=off. # # agp=off disabled the agpgart driver, but not the chipset specific drivers, # which still did their init routines. Chaos ensued. # # Signed-off-by: Dave Jones # # drivers/char/agp/alpha-agp.c # 2004/12/22 18:25:04-05:00 davej@redhat.com +2 -0 # [AGPGART] Fix agp=off. # # agp=off disabled the agpgart driver, but not the chipset specific drivers, # which still did their init routines. Chaos ensued. # # Signed-off-by: Dave Jones # # drivers/char/agp/ali-agp.c # 2004/12/22 18:25:04-05:00 davej@redhat.com +2 -0 # [AGPGART] Fix agp=off. # # agp=off disabled the agpgart driver, but not the chipset specific drivers, # which still did their init routines. Chaos ensued. # # Signed-off-by: Dave Jones # # ChangeSet # 2004/12/22 17:10:35-05:00 davej@redhat.com # [AGPGART] ULI M1689 support. # # From: Peer.Chen@uli.com.tw # Signed-off-by: Dave Jones # # include/linux/pci_ids.h # 2004/12/22 17:10:20-05:00 davej@redhat.com +1 -0 # [AGPGART] ULI M1689 support. # # From: Peer.Chen@uli.com.tw # Signed-off-by: Dave Jones # # drivers/char/agp/amd64-agp.c # 2004/12/22 17:10:20-05:00 davej@redhat.com +77 -1 # [AGPGART] ULI M1689 support. # # From: Peer.Chen@uli.com.tw # Signed-off-by: Dave Jones # # ChangeSet # 2004/12/22 02:14:30-05:00 len.brown@intel.com # [ACPI] Export /sys/module/processor/parameters/max_cstate # # Signed-off-by: Dominik Brodowski # Signed-off-by: Len Brown # # drivers/acpi/processor_idle.c # 2004/12/14 07:19:52-05:00 len.brown@intel.com +1 -1 # Import patch acpi-16-max-cstate-in-sysfs # # ChangeSet # 2004/12/22 01:03:07-05:00 len.brown@intel.com # [ACPI] Consolidate code in processor_idle(). # Only symbols "exported" are _init(), _exit() and _cst_has_changed() # # Signed-off-by: Dominik Brodowski # Signed-off-by: Len Brown # # include/acpi/processor.h # 2004/12/14 07:14:54-05:00 len.brown@intel.com +4 -6 # Import patch acpi-15-power-only-init-modify-exit # # drivers/acpi/processor_idle.c # 2004/12/14 07:14:54-05:00 len.brown@intel.com +109 -8 # Import patch acpi-15-power-only-init-modify-exit # # drivers/acpi/processor_core.c # 2004/12/14 07:14:54-05:00 len.brown@intel.com +2 -67 # Import patch acpi-15-power-only-init-modify-exit # # ChangeSet # 2004/12/22 00:54:22-05:00 len.brown@intel.com # [ACPI] Notify the BIOS that Linux can handle _CST. # # http://bugzilla.kernel.org/show_bug.cgi?id=1958 # # Signed-off-by: Bruno Ducrot # Signed-off-by: Dominik Brodowski # Signed-off-by: Len Brown # # drivers/acpi/processor_core.c # 2004/12/14 07:14:15-05:00 len.brown@intel.com +8 -0 # Notify the BIOS that Linux can handle _CST. # # ChangeSet # 2004/12/22 00:48:28-05:00 len.brown@intel.com # [ACPI] Handle _CST change notifications # # It is necessary to unload the processor idle handle for # a short period of time to avoid for nasty races -- # and we don't want to grab too many locks # so that the idle handler continues to be speedy. # # http://bugzilla.kernel.org/show_bug.cgi?id=1958 # # Signed-off-by: Bruno Ducrot # Signed-off-by: Dominik Brodowski # Signed-off-by: Len Brown # # include/acpi/processor.h # 2004/12/14 07:13:36-05:00 len.brown@intel.com +1 -0 # Handle _CST change notifications # # drivers/acpi/processor_idle.c # 2004/12/14 07:13:36-05:00 len.brown@intel.com +27 -0 # Handle _CST change notifications # # drivers/acpi/processor_core.c # 2004/12/14 07:13:36-05:00 len.brown@intel.com +1 -1 # Handle _CST change notifications # # ChangeSet # 2004/12/22 00:45:13-05:00 len.brown@intel.com # [ACPI] Add _CST parsing # # http://bugzilla.kernel.org/show_bug.cgi?id=1958 # # Signed-off-by: Bruno Ducrot # Signed-off-by: Dominik Brodowski # Signed-off-by: Len Brown # # include/acpi/processor.h # 2004/12/14 07:12:57-05:00 len.brown@intel.com +14 -1 # Add _CST parsing # # drivers/acpi/processor_idle.c # 2004/12/14 07:12:57-05:00 len.brown@intel.com +149 -10 # Add _CST parsing # # ChangeSet # 2004/12/22 00:26:58-05:00 len.brown@intel.com # [ACPI] make the c-state policy decisions of demotion and promotion # independent of the assumption "one state per type." # make the state a pointer inside struct acpi_processor_cx_policy. # make max_cstate aware of c-state types instead of c-state number. # # http://bugzilla.kernel.org/show_bug.cgi?id=1958 # # Signed-off-by: Dominik Brodowski # Signed-off-by: Len Brown # # include/acpi/processor.h # 2004/12/14 07:12:12-05:00 len.brown@intel.com +3 -1 # Import patch acpi-11-power-policy-independent-of-states # # drivers/acpi/processor_idle.c # 2004/12/14 07:11:00-05:00 len.brown@intel.com +71 -66 # Import patch acpi-11-power-policy-independent-of-states # # ChangeSet # 2004/12/22 00:16:32-05:00 len.brown@intel.com # [ACPI] make power.state a pointer # # http://bugzilla.kernel.org/show_bug.cgi?id=1958 # # Signed-off-by: Dominik Brodowski # Signed-off-by: Len Brown # # include/acpi/processor.h # 2004/12/14 07:08:31-05:00 len.brown@intel.com +1 -1 # make power.state a pointer # # drivers/acpi/processor_idle.c # 2004/12/14 07:09:32-05:00 len.brown@intel.com +32 -18 # make power.state a pointer # # ChangeSet # 2004/12/22 00:12:13-05:00 len.brown@intel.com # [ACPI] deleted unused default c-state # # http://bugzilla.kernel.org/show_bug.cgi?id=1958 # # Signed-off-by: Dominik Brodowski # Signed-off-by: Len Brown # # drivers/acpi/processor_idle.c # 2004/12/13 19:29:47-05:00 len.brown@intel.com +0 -3 # deleted unused default c-state # # ChangeSet # 2004/12/22 00:05:34-05:00 len.brown@intel.com # [ACPI] Split up the extraction of information from the FADT # and the pblk_address (acpi_processor_get_power_info_fadt()) # and the validation whether the state is indeed available # (acpi_processor_power_verify()). # # http://bugzilla.kernel.org/show_bug.cgi?id=1958 # # Signed-off-by: Bruno Ducrot # Signed-off-by: Dominik Brodowski # Signed-off-by: Len Brown # # include/acpi/processor.h # 2004/12/13 19:24:07-05:00 len.brown@intel.com +1 -0 # acpi_processor_get_power_info_fadt() & acpi_processor_power_verify() # # drivers/acpi/processor_idle.c # 2004/12/13 19:28:33-05:00 len.brown@intel.com +162 -118 # acpi_processor_get_power_info_fadt() & acpi_processor_power_verify() # # drivers/acpi/processor_core.c # 2004/12/13 19:24:07-05:00 len.brown@intel.com +2 -4 # acpi_processor_get_power_info_fadt() & acpi_processor_power_verify() # # ChangeSet # 2004/12/21 23:54:21-05:00 davej@redhat.com # [AGPGART] Fix up two stupid bugs in the posting fixes. # # Spotted by MASAO TAKAHASHI # Signed-off-by: Dave Jones # # drivers/char/agp/intel-agp.c # 2004/12/21 23:53:58-05:00 davej@redhat.com +2 -2 # [AGPGART] Fix up two stupid bugs in the posting fixes. # # Spotted by MASAO TAKAHASHI # Signed-off-by: Dave Jones # # ChangeSet # 2004/12/21 23:53:22-05:00 len.brown@intel.com # [ACPI] Differentiate between C-States and C-state type. # # http://bugzilla.kernel.org/show_bug.cgi?id=1958 # # Signed-off-by: Bruno Ducrot # Signed-off-by: Dominik Brodowski # Signed-off-by: Len Brown # # include/acpi/processor.h # 2004/12/13 19:22:59-05:00 len.brown@intel.com +1 -0 # C-state type # # drivers/acpi/processor_idle.c # 2004/12/13 19:23:33-05:00 len.brown@intel.com +42 -17 # C-state type # # ChangeSet # 2004/12/21 22:58:56-05:00 len.brown@intel.com # [ACPI] Shorten the times IRQs are disabled in throttling. # During calculations no disabling is necessary. # # Signed-off-by: Dominik Brodowski # Signed-off-by: Len Brown # # drivers/acpi/processor_throttling.c # 2004/11/27 10:29:36-05:00 len.brown@intel.com +4 -4 # Shorten the times IRQs are disabled in throttling. # # ChangeSet # 2004/12/21 22:57:16-05:00 len.brown@intel.com # [ACPI] Finalize the splitting of processor.c by moving the rest to processor_core.c # # Signed-off-by: Dominik Brodowski # Signed-off-by: Len Brown # # drivers/acpi/processor_core.c # 2004/12/13 19:21:31-05:00 len.brown@intel.com +26 -28 # Finalize the splitting of processor.c by moving the rest to processor_core.c # # drivers/acpi/Makefile # 2004/12/13 19:20:38-05:00 len.brown@intel.com +4 -4 # Finalize the splitting of processor.c by moving the rest to processor_core.c # # ChangeSet # 2004/12/21 22:54:46-05:00 len.brown@intel.com # [ACPI] Split the ACPI Processor passive cooling code into a different file # # Signed-off-by: Dominik Brodowski # Signed-off-by: Len Brown # # drivers/acpi/processor_thermal.c # 2004/12/13 19:20:03-05:00 len.brown@intel.com +406 -0 # Split the ACPI Processor passive cooling code into a different file # # include/acpi/processor.h # 2004/12/13 19:20:03-05:00 len.brown@intel.com +19 -0 # Split the ACPI Processor passive cooling code into a different file # # drivers/acpi/processor_thermal.c # 2004/12/13 19:20:03-05:00 len.brown@intel.com +0 -0 # BitKeeper file /home/lenb/src/26-latest-dev/drivers/acpi/processor_thermal.c # # drivers/acpi/processor.c # 2004/12/13 19:20:03-05:00 len.brown@intel.com +2 -360 # Split the ACPI Processor passive cooling code into a different file # # drivers/acpi/Makefile # 2004/12/13 19:20:03-05:00 len.brown@intel.com +2 -1 # Split the ACPI Processor passive cooling code into a different file # # ChangeSet # 2004/12/21 22:53:35-05:00 len.brown@intel.com # [ACPI] Split the ACPI Processor C-States handling into a different file # # Signed-off-by: Dominik Brodowski # Signed-off-by: Len Brown # # drivers/acpi/processor_idle.c # 2004/12/13 19:37:33-05:00 len.brown@intel.com +637 -0 # Split the ACPI Processor C-States handling into a different file # # include/acpi/processor.h # 2004/12/13 19:37:21-05:00 len.brown@intel.com +8 -0 # Split the ACPI Processor C-States handling into a different file # # drivers/acpi/processor_idle.c # 2004/12/13 19:37:33-05:00 len.brown@intel.com +0 -0 # BitKeeper file /home/lenb/src/26-latest-dev/drivers/acpi/processor_idle.c # # drivers/acpi/processor.c # 2004/12/13 19:37:21-05:00 len.brown@intel.com +3 -588 # Split the ACPI Processor C-States handling into a different file # # drivers/acpi/Makefile # 2004/12/13 19:37:21-05:00 len.brown@intel.com +2 -2 # Split the ACPI Processor C-States handling into a different file # # ChangeSet # 2004/12/21 22:51:57-05:00 len.brown@intel.com # [ACPI] Split the ACPI Processor T-States handling into a different file # # Signed-off-by: Dominik Brodowski # Signed-off-by: Len Brown # # include/acpi/processor.h # 2004/12/13 19:09:37-05:00 len.brown@intel.com +22 -0 # Split the ACPI Processor T-States handling into a different file # # drivers/acpi/processor_throttling.c # 2004/12/13 19:09:37-05:00 len.brown@intel.com +351 -0 # Split the ACPI Processor T-States handling into a different file # # drivers/acpi/processor.c # 2004/12/13 19:09:56-05:00 len.brown@intel.com +1 -313 # Split the ACPI Processor T-States handling into a different file # # drivers/acpi/Makefile # 2004/12/13 19:09:37-05:00 len.brown@intel.com +1 -1 # Split the ACPI Processor T-States handling into a different file # # drivers/acpi/processor_throttling.c # 2004/12/13 19:09:37-05:00 len.brown@intel.com +0 -0 # BitKeeper file /home/lenb/src/26-latest-dev/drivers/acpi/processor_throttling.c # # ChangeSet # 2004/12/21 22:47:29-05:00 len.brown@intel.com # [ACPI] Split the ACPI Processor P-States library into a different file # # Signed-off-by: Dominik Brodowski # Signed-off-by: Len Brown # # drivers/acpi/processor_perflib.c # 2004/12/13 19:08:55-05:00 len.brown@intel.com +666 -0 # Split the ACPI Processor P-States library into a different file # # include/acpi/processor.h # 2004/12/13 19:04:00-05:00 len.brown@intel.com +25 -0 # Split the ACPI Processor P-States library into a different file # # drivers/acpi/processor_perflib.c # 2004/12/13 19:08:55-05:00 len.brown@intel.com +0 -0 # BitKeeper file /home/lenb/src/26-latest-dev/drivers/acpi/processor_perflib.c # # drivers/acpi/processor.c # 2004/12/13 19:07:47-05:00 len.brown@intel.com +3 -641 # Split the ACPI Processor P-States library into a different file # # drivers/acpi/Makefile # 2004/12/13 19:04:00-05:00 len.brown@intel.com +6 -1 # Split the ACPI Processor P-States library into a different file # # ChangeSet # 2004/12/21 22:08:59-05:00 len.brown@intel.com # Merge intel.com:/home/lenb/src/26-stable-dev # into intel.com:/home/lenb/src/26-latest-dev # # drivers/acpi/tables/tbconvrt.c # 2004/12/21 22:08:55-05:00 len.brown@intel.com +0 -0 # Auto merged # # drivers/acpi/pci_link.c # 2004/12/21 22:08:55-05:00 len.brown@intel.com +0 -0 # Auto merged # # drivers/acpi/osl.c # 2004/12/21 22:08:55-05:00 len.brown@intel.com +0 -0 # Auto merged # # ChangeSet # 2004/12/21 16:57:44-05:00 len.brown@intel.com # [ACPI] ACPICA 20041210 from Bob Moore # # ACPI 3.0 support is nearing completion in both the iASL # compiler and the ACPI CA core subsystem. # # Fixed a problem in the ToDecimalString operator where the # resulting string length was incorrectly calculated. The # length is now calculated exactly, eliminating incorrect # AE_STRING_LIMIT exceptions. # # Fixed a problem in the ToHexString operator to allow a # maximum 200 character string to be produced. # # Fixed a problem in the internal string-to-buffer and # buffer-to-buffer copy routine where the length of the # resulting buffer was not truncated to the new size (if # the target buffer already existed). # # Signed-off-by: Len Brown # # include/acpi/amlresrc.h # 2004/12/21 16:41:33-05:00 len.brown@intel.com +25 -1 # ACPICA 20041210 # # include/acpi/actbl2.h # 2004/12/21 16:41:34-05:00 len.brown@intel.com +1 -1 # ACPICA 20041210 # # include/acpi/aclocal.h # 2004/12/21 16:41:34-05:00 len.brown@intel.com +1 -1 # ACPICA 20041210 # # include/acpi/acdisasm.h # 2004/12/21 16:41:34-05:00 len.brown@intel.com +6 -0 # ACPICA 20041210 # # include/acpi/acconfig.h # 2004/12/21 16:41:34-05:00 len.brown@intel.com +2 -2 # ACPICA 20041210 # # drivers/acpi/tables/tbconvrt.c # 2004/12/21 16:41:37-05:00 len.brown@intel.com +2 -2 # ACPICA 20041210 # # drivers/acpi/executer/exstorob.c # 2004/12/21 16:41:38-05:00 len.brown@intel.com +10 -9 # ACPICA 20041210 # # drivers/acpi/executer/exconvrt.c # 2004/12/21 16:41:38-05:00 len.brown@intel.com +56 -40 # ACPICA 20041210 # # ChangeSet # 2004/12/21 12:54:09-05:00 len.brown@intel.com # [ACPI] fix return syntax # # Signed-off-by: Pavel Machek # Signed-off-by: Jesper Juhl # # drivers/acpi/toshiba_acpi.c # 2004/12/20 17:46:15-05:00 len.brown@intel.com +2 -2 # fix return syntax # # drivers/acpi/pci_link.c # 2004/12/20 17:42:13-05:00 len.brown@intel.com +2 -2 # fix return syntax # # drivers/acpi/osl.c # 2004/12/20 17:40:29-05:00 len.brown@intel.com +3 -3 # fix return syntax # # drivers/acpi/asus_acpi.c # 2004/12/20 17:35:32-05:00 len.brown@intel.com +9 -9 # fix return syntax # # ChangeSet # 2004/12/21 09:41:18-06:00 bunk@stusta.de # [PATCH] SCSI NCR53C9x.c: some cleanups # # Make two functions static # # Remove the old polling esp_command() entry point. # # Signed-off-by: Adrian Bunk # Signed-off-by: James Bottomley # # drivers/scsi/NCR53C9x.h # 2004/11/13 09:27:41-06:00 bunk@stusta.de +0 -1 # SCSI NCR53C9x.c: some cleanups # # drivers/scsi/NCR53C9x.c # 2004/11/13 09:28:23-06:00 bunk@stusta.de +2 -13 # SCSI NCR53C9x.c: some cleanups # # ChangeSet # 2004/12/21 09:36:37-06:00 bunk@stusta.de # [PATCH] SCSI mca_53c9x.c: make 2 functions static # # The patch below makes two functions without external users static. # # Signed-off-by: Adrian Bunk # Signed-off-by: James Bottomley # # drivers/scsi/mca_53c9x.c # 2004/11/13 15:42:22-06:00 bunk@stusta.de +2 -2 # SCSI mca_53c9x.c: make 2 functions static # # ChangeSet # 2004/12/21 09:32:13-06:00 bunk@stusta.de # [PATCH] SCSI ibmmca.c: make a struct static # # Signed-off-by: Adrian Bunk # Signed-off-by: James Bottomley # # drivers/scsi/ibmmca.c # 2004/11/13 14:50:49-06:00 bunk@stusta.de +1 -1 # SCSI ibmmca.c: make a struct static # # ChangeSet # 2004/12/20 21:58:46-05:00 len.brown@intel.com # Merge intel.com:/home/lenb/src/26-stable-dev # into intel.com:/home/lenb/src/26-latest-dev # # include/asm-i386/acpi.h # 2004/12/20 21:58:42-05:00 len.brown@intel.com +0 -0 # Auto merged # # ChangeSet # 2004/12/20 15:17:24-08:00 shemminger@osdl.org # [TCP]: Efficient port randomization (rev 3) # # okay, here is the revised version. Testing shows that it # is more consistent, and just as fast as existing code, # probably because of the getting rid of portalloc_lock and # better distribution. # # Signed-off-by: Stephen Hemminger # Signed-off-by: David S. Miller # # net/ipv4/tcp_ipv4.c # 2004/12/20 15:17:01-08:00 shemminger@osdl.org +25 -37 # [TCP]: Efficient port randomization (rev 3) # # okay, here is the revised version. Testing shows that it # is more consistent, and just as fast as existing code, # probably because of the getting rid of portalloc_lock and # better distribution. # # Signed-off-by: Stephen Hemminger # Signed-off-by: David S. Miller # # include/linux/random.h # 2004/12/20 15:17:01-08:00 shemminger@osdl.org +1 -0 # [TCP]: Efficient port randomization (rev 3) # # okay, here is the revised version. Testing shows that it # is more consistent, and just as fast as existing code, # probably because of the getting rid of portalloc_lock and # better distribution. # # Signed-off-by: Stephen Hemminger # Signed-off-by: David S. Miller # # drivers/char/random.c # 2004/12/20 15:17:01-08:00 shemminger@osdl.org +18 -0 # [TCP]: Efficient port randomization (rev 3) # # okay, here is the revised version. Testing shows that it # is more consistent, and just as fast as existing code, # probably because of the getting rid of portalloc_lock and # better distribution. # # Signed-off-by: Stephen Hemminger # Signed-off-by: David S. Miller # # ChangeSet # 2004/12/20 12:40:03-05:00 len.brown@intel.com # Merge intel.com:/home/lenb/bk/26-latest-ref # into intel.com:/home/lenb/src/26-latest-dev # # Documentation/kernel-parameters.txt # 2004/12/20 12:39:59-05:00 len.brown@intel.com +0 -0 # Auto merged # # ChangeSet # 2004/12/19 14:59:06-06:00 brking@us.ibm.com # [PATCH] ipr: Bump driver version to 2.0.12 # # Bump driver version # # Signed-off-by: Brian King # Signed-off-by: James Bottomley # # drivers/scsi/ipr.h # 2004/12/14 17:09:02-06:00 brking@us.ibm.com +2 -2 # ipr: Bump driver version to 2.0.12 # # ChangeSet # 2004/12/19 14:54:06-06:00 brking@us.ibm.com # [PATCH] ipr: whitespace fixes # # Whitespace fixes. # # Signed-off-by: Brian King # Signed-off-by: James Bottomley # # drivers/scsi/ipr.h # 2004/12/14 17:06:41-06:00 brking@us.ibm.com +11 -11 # ipr: whitespace fixes # # ChangeSet # 2004/12/19 14:50:00-06:00 brking@us.ibm.com # [PATCH] ipr: Remove dead code # # Removes some unused debug code. # # Signed-off-by: Brian King # Signed-off-by: James Bottomley # # drivers/scsi/ipr.h # 2004/12/14 17:06:38-06:00 brking@us.ibm.com +0 -15 # ipr: Remove dead code # # ChangeSet # 2004/12/19 14:44:29-06:00 brking@us.ibm.com # [PATCH] ipr: new RAID error # # Adds support for logging a new RAID error that can be returned on # new ipr adapters. # # Signed-off-by: Brian King # Signed-off-by: James Bottomley # # drivers/scsi/ipr.c # 2004/12/14 17:06:35-06:00 brking@us.ibm.com +2 -0 # ipr: new RAID error # # ChangeSet # 2004/12/19 14:33:37-06:00 brking@us.ibm.com # [PATCH] ipr: PCI-X capabilities setup fix # # From: Andrew Vasquez # # While performing some PCI-X command register tuning with some of # QLogic's cards, I stumbled upon some suspect code in ipr.c. It appears # the two functions ipr_save_pcix_cmd_reg() and ipr_set_pcix_cmd_reg() are # actually reading/updating the PCI-X capabilities register and not in # fact the PCI-X command register -- some code from # ipr_save_pcix_cmd_reg(): # # ... # int pcix_cmd_reg = pci_find_capability(ioa_cfg->pdev, PCI_CAP_ID_PCIX); # # if (pcix_cmd_reg == 0) { # dev_err(&ioa_cfg->pdev->dev, "Failed to save PCI-X command register\n"); # return -EIO; # } # # pcix_cmd_reg points to the PCI-X capabilities register. Yet, the read: # # if (pci_read_config_word(ioa_cfg->pdev, pcix_cmd_reg, # &ioa_cfg->saved_pcix_cmd_reg) != PCIBIOS_SUCCESSFUL) { # dev_err(&ioa_cfg->pdev->dev, "Failed to save PCI-X command register\n"); # return -EIO; # } # # and subsequent update of the bits: # # ioa_cfg->saved_pcix_cmd_reg |= PCI_X_CMD_DPERR_E | PCI_X_CMD_ERO; # # should actually apply to the PCI-X Command register 2 bytes further into # config space. So, the following: # # if (pci_read_config_word(ioa_cfg->pdev, pcix_cmd_reg, # # should actually read as: # # if (pci_read_config_word(ioa_cfg->pdev, pcix_cmd_reg + PCI_X_CMD, # # The same is true for the 'save' case. # # Luckily, most devices hardwire the PCI-X capabilities register so the # write is effectively a NOOP. # # Signed-off-by: Brian King # Signed-off-by: James Bottomley # # drivers/scsi/ipr.c # 2004/12/14 17:06:30-06:00 brking@us.ibm.com +2 -2 # ipr: PCI-X capabilities setup fix # # ChangeSet # 2004/12/19 13:55:16-06:00 brking@us.ibm.com # [PATCH] ipr: Allow Query Resource State adapter command to # # The ipr adapters support an adapter command directed at the device # resource called "Query Resource State". It can be used to retrieve # state information about the resource it is sent to, including the # currently negotiated scsi speed. The adapter interface requires the # IPR_RQTYPE_IOACMD to be set on this command, so we set it if the # command code matches. # # Signed-off-by: Brian King # Signed-off-by: James Bottomley # # drivers/scsi/ipr.h # 2004/12/14 17:06:25-06:00 brking@us.ibm.com +1 -0 # ipr: Allow Query Resource State adapter command to # # drivers/scsi/ipr.c # 2004/12/14 17:06:25-06:00 brking@us.ibm.com +2 -1 # ipr: Allow Query Resource State adapter command to # # ChangeSet # 2004/12/19 13:49:55-06:00 markh@osdl.org # [PATCH] aacraid 2.6: Support for new cards # # This patch adds support for new aacraid cards. # # Signed-off-by: Mark Haverkamp # Signed-off-by: James Bottomley # # drivers/scsi/aacraid/linit.c # 2004/12/14 16:01:39-06:00 markh@osdl.org +66 -58 # aacraid 2.6: Support for new cards # # drivers/scsi/aacraid/aacraid.h # 2004/12/06 12:17:29-06:00 markh@osdl.org +18 -1 # aacraid 2.6: Support for new cards # # ChangeSet # 2004/12/19 13:23:28-06:00 jejb@mulgrave.(none) # SCSI: convert 53c700 driver to use change_queue_depth API # # Signed-off-by: James Bottomley # # drivers/scsi/53c700.c # 2004/12/19 13:21:53-06:00 jejb@mulgrave.(none) +6 -17 # convert 53c700 driver to use change_queue_depth API # # ChangeSet # 2004/12/19 13:19:57-06:00 jejb@mulgrave.(none) # SCSI:add change_queue_depth API to scsi host template # # Originally, the 53c700 driver implemented queue_depth changing as an # attribute override, primarily as a demonstration of how it should be # done. Now that a large number of drivers wish to implement this # functionality, it should become an API rather than an attribute # override, since the latter are supposed to be used as one off extensions # rather than the de-facto API. # # Signed-off-by: James Bottomley # # include/scsi/scsi_host.h # 2004/12/19 13:18:37-06:00 jejb@mulgrave.(none) +12 -0 # add change_queue_depth API to scsi host template # # drivers/scsi/scsi_sysfs.c # 2004/12/19 13:18:37-06:00 jejb@mulgrave.(none) +37 -3 # add change_queue_depth API to scsi host template # # ChangeSet # 2004/12/19 12:43:44-06:00 andrew.vasquez@qlogic.com # qla2xxx: Update driver version # # Update version number to 8.00.02b4-k. # # Signed-off-by: Andrew Vasquez # Signed-off-by: James Bottomley # # drivers/scsi/qla2xxx/qla_version.h # 2004/12/09 00:18:01-06:00 andrew.vasquez@qlogic.com +3 -3 # qla2xxx: Update driver version # # ChangeSet # 2004/12/19 12:41:11-06:00 jejb@mulgrave.(none) # qla2xxx: 23xx/63xx firmware updates # # From: Andrew Vasquez # # Resync with latest released firmware -- 3.03.08. # # Remove ql6322_fw.c file. # # Signed-off-by: Andrew Vasquez # Signed-off-by: James Bottomley # # drivers/scsi/qla2xxx/ql6312_fw.c # 2004/12/19 12:38:40-06:00 jejb@mulgrave.(none) +6911 -6666 # qla2xxx: 23xx/63xx firmware updates # # drivers/scsi/qla2xxx/ql2322_fw.c # 2004/12/19 12:38:40-06:00 jejb@mulgrave.(none) +6629 -6590 # qla2xxx: 23xx/63xx firmware updates # # drivers/scsi/qla2xxx/ql2300_fw.c # 2004/12/19 12:38:39-06:00 jejb@mulgrave.(none) +6983 -6941 # qla2xxx: 23xx/63xx firmware updates # # BitKeeper/deleted/.del-ql6322_fw.c~29d555524cf69da # 2004/12/19 12:37:05-06:00 jejb@mulgrave.(none) +0 -7433 # Delete: drivers/scsi/qla2xxx/ql6322_fw.c # # ChangeSet # 2004/12/19 12:32:44-06:00 andrew.vasquez@qlogic.com # qla2xxx: Consolidate ISP63xx support # # Recent ISP6312 FLX firmware can support both ISP6312 and # ISP6322 chips. Consolidate ISP6322 handling into the # ISP6312 firmware loader files. # # Remove ql6322.c file. # # Signed-off-by: Andrew Vasquez # Signed-off-by: James Bottomley # # drivers/scsi/qla2xxx/qla_def.h # 2004/12/09 00:16:47-06:00 andrew.vasquez@qlogic.com +1 -5 # qla2xxx: Consolidate ISP63xx support # # drivers/scsi/qla2xxx/ql6312.c # 2004/12/09 00:16:47-06:00 andrew.vasquez@qlogic.com +13 -1 # qla2xxx: Consolidate ISP63xx support # # drivers/scsi/qla2xxx/Makefile # 2004/12/09 00:16:47-06:00 andrew.vasquez@qlogic.com +0 -2 # qla2xxx: Consolidate ISP63xx support # # drivers/scsi/qla2xxx/Kconfig # 2004/12/09 00:16:47-06:00 andrew.vasquez@qlogic.com +4 -10 # qla2xxx: Consolidate ISP63xx support # # BitKeeper/deleted/.del-ql6322.c~c61deeb919dae129 # 2004/12/19 12:31:11-06:00 andrew.vasquez@qlogic.com +0 -0 # Delete: drivers/scsi/qla2xxx/ql6322.c # # ChangeSet # 2004/12/19 12:28:06-06:00 andrew.vasquez@qlogic.com # qla2xxx: Code scrubbing # # Misc. driver-code scrubbing: # # o Correct qla2300 module description. # o Resync with latest firmware structure definitions. # o White-space cleanup. # o Add additional display of driver internals when debug # is enabled. # # Signed-off-by: Andrew Vasquez # Signed-off-by: James Bottomley # # drivers/scsi/qla2xxx/qla_os.c # 2004/12/09 00:15:37-06:00 andrew.vasquez@qlogic.com +10 -10 # qla2xxx: Code scrubbing # # drivers/scsi/qla2xxx/qla_isr.c # 2004/12/09 00:15:37-06:00 andrew.vasquez@qlogic.com +5 -4 # qla2xxx: Code scrubbing # # drivers/scsi/qla2xxx/qla_init.c # 2004/12/09 00:15:37-06:00 andrew.vasquez@qlogic.com +1 -1 # qla2xxx: Code scrubbing # # drivers/scsi/qla2xxx/qla_def.h # 2004/12/09 00:15:37-06:00 andrew.vasquez@qlogic.com +11 -6 # qla2xxx: Code scrubbing # # drivers/scsi/qla2xxx/ql2300.c # 2004/12/09 00:15:37-06:00 andrew.vasquez@qlogic.com +1 -1 # qla2xxx: Code scrubbing # # ChangeSet # 2004/12/19 12:23:34-06:00 andrew.vasquez@qlogic.com # qla2xxx: ISR fixes # # Interrupt handler fixes: # # o Mark HBA offline in case the firmware cannot recover # after and ISP system-error. # o Correct issue where the loop-down-timer was not properly # being cleared during a port-update event. # # Signed-off-by: Andrew Vasquez # Signed-off-by: James Bottomley # # drivers/scsi/qla2xxx/qla_isr.c # 2004/12/09 00:15:02-06:00 andrew.vasquez@qlogic.com +12 -4 # qla2xxx: ISR fixes # # ChangeSet # 2004/12/19 12:16:44-06:00 andrew.vasquez@qlogic.com # qla2xxx: Small fixes # # o Issue a big-hammer to recover if the driver is unable # retrieve the host's loop-id. # o Correct failure to not add an fc_lun_t object for lun # 0. # o Interrogate only the relevant bits (peripheral # qualifier and device-type) of INQUIRY data. # o Correct issue where driver would incorrectly fail-out # of initializing an ISP if an device-discovery SNS scan # failed. # o Correct issue where the qla2x00_fabric_login() would # return an incorrect error status during mailbox # command execution. # # Signed-off-by: Andrew Vasquez # Signed-off-by: James Bottomley # # drivers/scsi/qla2xxx/qla_init.c # 2004/12/09 00:14:27-06:00 andrew.vasquez@qlogic.com +22 -11 # qla2xxx: Small fixes # # ChangeSet # 2004/12/19 12:12:20-06:00 andrew.vasquez@qlogic.com # qla2xxx: NVRAM id-list updates # # Resync with latest NVRAM subsystem ID list. # # Signed-off-by: Andrew Vasquez # Signed-off-by: James Bottomley # # drivers/scsi/qla2xxx/qla_devtbl.h # 2004/12/09 00:13:51-06:00 andrew.vasquez@qlogic.com +63 -29 # qla2xxx: NVRAM id-list updates # # ChangeSet # 2004/12/19 12:07:33-06:00 andrew.vasquez@qlogic.com # qla2xxx: NVRAM updates # # Address several NVRAM access issues: # # o Add support for write-protected NVRAM chips used with # ISP2322 and ISP6322. # o Correct code to not perform an erase data during NVRAM # update. # o Correct issuance of NVRAM delay after PCI posting call. # # Signed-off-by: Andrew Vasquez # Signed-off-by: James Bottomley # # drivers/scsi/qla2xxx/qla_sup.c # 2004/12/09 00:13:14-06:00 andrew.vasquez@qlogic.com +60 -33 # qla2xxx: NVRAM updates # # drivers/scsi/qla2xxx/qla_os.c # 2004/12/09 00:13:14-06:00 andrew.vasquez@qlogic.com +1 -0 # qla2xxx: NVRAM updates # # drivers/scsi/qla2xxx/qla_gbl.h # 2004/12/09 00:13:14-06:00 andrew.vasquez@qlogic.com +1 -0 # qla2xxx: NVRAM updates # # drivers/scsi/qla2xxx/qla_def.h # 2004/12/09 00:13:14-06:00 andrew.vasquez@qlogic.com +2 -0 # qla2xxx: NVRAM updates # # ChangeSet # 2004/12/19 12:00:57-06:00 andrew.vasquez@qlogic.com # qla2xxx: Tx/Rx Sensitivity additions # # Add support for new transmit/receive sensitivity settings when # updating an ISPs serial-link options. # # Signed-off-by: Andrew Vasquez # Signed-off-by: James Bottomley # # drivers/scsi/qla2xxx/qla_init.c # 2004/12/09 00:12:38-06:00 andrew.vasquez@qlogic.com +45 -14 # qla2xxx: Tx/Rx Sensitivity additions # # drivers/scsi/qla2xxx/qla_def.h # 2004/12/09 00:12:38-06:00 andrew.vasquez@qlogic.com +22 -3 # qla2xxx: Tx/Rx Sensitivity additions # # ChangeSet # 2004/12/19 11:54:26-06:00 andrew.vasquez@qlogic.com # qla2xxx: Dead code removal # # From: Christoph Hellwig # # remove dead code, add missing statics # # Signed-off-by: Andrew Vasquez # Signed-off-by: James Bottomley # # drivers/scsi/qla2xxx/qla_rscn.c # 2004/12/09 00:12:03-06:00 andrew.vasquez@qlogic.com +1 -1 # qla2xxx: Dead code removal # # drivers/scsi/qla2xxx/qla_os.c # 2004/12/09 00:12:03-06:00 andrew.vasquez@qlogic.com +16 -125 # qla2xxx: Dead code removal # # drivers/scsi/qla2xxx/qla_mbx.c # 2004/12/09 00:12:03-06:00 andrew.vasquez@qlogic.com +1 -502 # qla2xxx: Dead code removal # # drivers/scsi/qla2xxx/qla_iocb.c # 2004/12/09 00:12:03-06:00 andrew.vasquez@qlogic.com +2 -95 # qla2xxx: Dead code removal # # drivers/scsi/qla2xxx/qla_init.c # 2004/12/09 00:12:03-06:00 andrew.vasquez@qlogic.com +4 -509 # qla2xxx: Dead code removal # # drivers/scsi/qla2xxx/qla_gbl.h # 2004/12/09 00:12:03-06:00 andrew.vasquez@qlogic.com +0 -43 # qla2xxx: Dead code removal # # drivers/scsi/qla2xxx/qla_devtbl.h # 2004/12/09 00:12:03-06:00 andrew.vasquez@qlogic.com +2 -2 # qla2xxx: Dead code removal # # ChangeSet # 2004/12/19 10:06:32-06:00 jejb@mulgrave.(none) # SCSI: Add FC transport host statistics # # From: James.Smart@Emulex.Com # # This patch updates the fc_transport with statistics for local FC ports # (e.g. Hosts). The statistics are defined per HBAAPI v2.0 definitions. # # Caveats: # ------------ # - The information below is supplied by a simple test driver # that does not # talk to real hardware, but fully acts as a LLDD that supports the # fc transport. # # # This patch results in the following in /sys/class: # ----------------------------------------------------- # # [jsmart@elxware class]$ cd /sys/class # [jsmart@elxware class]$ ls # fc_host graphics misc pci_bus scsi_host usb_host # fc_transport input net scsi_device tty vc # firmware mem netlink scsi_generic usb # [jsmart@elxware class]$ cd fc_host # [jsmart@elxware fc_host]$ ls # host4 # # [jsmart@elxware fc_host]$ cd host4 # [jsmart@elxware host4]$ ls # device host_link_down_tmo statistics # [jsmart@elxware host4]$ ls -ld * # lrwxrwxrwx 1 root root 0 Oct 13 17:16 device -> # ../../../devices/platform/host4 # -rw-r--r-- 1 root root 4096 Oct 13 17:16 host_link_down_tmo # drwxr-xr-x 2 root root 0 Oct 13 17:16 statistics # # [jsmart@elxware host4]$ cd statistics # dumped_frames invalid_crc_count # prim_seq_protocol_err_count # error_frames invalid_tx_word_count reset_statistics # fcp_control_requests link_failure_count rx_frames # fcp_input_megabytes lip_count rx_words # fcp_input_requests loss_of_signal_count seconds_since_last_reset # fcp_output_megabytes loss_of_sync_count tx_frames # fcp_output_requests nos_count tx_words # # Signed-off-by: James Bottomley # # include/scsi/scsi_transport_fc.h # 2004/12/19 10:05:27-06:00 jejb@mulgrave.(none) +36 -0 # Add FC transport host statistics # # drivers/scsi/scsi_transport_fc.c # 2004/12/19 10:05:27-06:00 jejb@mulgrave.(none) +110 -0 # Add FC transport host statistics # # ChangeSet # 2004/12/19 10:01:12-06:00 jejb@mulgrave.(none) # SCSI: Add basic infrastructure for transport host statistics # # From: James.Smart@Emulex.Com # # This patch adds the basic hooks to the scsi subsystem to # support transport-specific statistics to be added to a host. # Its basic nature follows the way in which net devices showed # their statistics. # # Signed-off-by: James Bottomley # # include/scsi/scsi_transport.h # 2004/12/19 09:59:15-06:00 jejb@mulgrave.(none) +1 -0 # Add basic infrastructure for transport host statistics # # drivers/scsi/scsi_sysfs.c # 2004/12/19 09:59:15-06:00 jejb@mulgrave.(none) +8 -0 # Add basic infrastructure for transport host statistics # # drivers/scsi/hosts.c # 2004/12/19 09:59:14-06:00 jejb@mulgrave.(none) +6 -2 # Add basic infrastructure for transport host statistics # # ChangeSet # 2004/12/16 01:32:04-05:00 davej@redhat.com # [AGPGART] Fix masking (causes crash on 460GX). # virt_to_page(phys_to_virt(masked_addr)) still works. But the 460GX # sticks bits in the middle, so the free blows up. # # I've tested the agp_allocate_memory() change on Intel 460GX. I don't have # hardware to test the Intel MCH change, but it looks to me like the same # problem. # # Signed-off-by: Bjorn Helgaas # Signed-off-by: Dave Jones # # drivers/char/agp/intel-mch-agp.c # 2004/12/16 01:31:44-05:00 davej@redhat.com +1 -1 # [AGPGART] Fix masking (causes crash on 460GX). # virt_to_page(phys_to_virt(masked_addr)) still works. But the 460GX # sticks bits in the middle, so the free blows up. # # I've tested the agp_allocate_memory() change on Intel 460GX. I don't have # hardware to test the Intel MCH change, but it looks to me like the same # problem. # # Signed-off-by: Bjorn Helgaas # Signed-off-by: Dave Jones # # drivers/char/agp/generic.c # 2004/12/16 01:31:44-05:00 davej@redhat.com +1 -2 # [AGPGART] Fix masking (causes crash on 460GX). # virt_to_page(phys_to_virt(masked_addr)) still works. But the 460GX # sticks bits in the middle, so the free blows up. # # I've tested the agp_allocate_memory() change on Intel 460GX. I don't have # hardware to test the Intel MCH change, but it looks to me like the same # problem. # # Signed-off-by: Bjorn Helgaas # Signed-off-by: Dave Jones # # ChangeSet # 2004/12/16 01:26:04-05:00 davej@redhat.com # [AGPGART] Announce Intel 460GX when found. # # Most AGP chipset drivers announce the bridge found, and i460gx used # to, but it seems to have gotten dropped somewhere along the way. # # Signed-off-by: Bjorn Helgaas # Signed-off-by: Dave Jones # # drivers/char/agp/i460-agp.c # 2004/12/16 01:25:44-05:00 davej@redhat.com +2 -0 # [AGPGART] Announce Intel 460GX when found. # # Most AGP chipset drivers announce the bridge found, and i460gx used # to, but it seems to have gotten dropped somewhere along the way. # # Signed-off-by: Bjorn Helgaas # Signed-off-by: Dave Jones # # ChangeSet # 2004/12/15 20:46:09-05:00 davej@redhat.com # [AGPGART] Add missing cache flush to the generic remove routine. # # It's not entirely clear whether this is needed, or it was working around # the missing PCI Posting workaround. Until we know any better, make # the generic routine do what the per chipset routines do. # # Spotted-by: Alan Cox # Signed-off-by: Dave Jones # # drivers/char/agp/generic.c # 2004/12/15 20:45:49-05:00 davej@redhat.com +1 -0 # [AGPGART] Add missing cache flush to the generic remove routine. # # It's not entirely clear whether this is needed, or it was working around # the missing PCI Posting workaround. Until we know any better, make # the generic routine do what the per chipset routines do. # # Spotted-by: Alan Cox # Signed-off-by: Dave Jones # # ChangeSet # 2004/12/15 20:43:26-05:00 davej@redhat.com # [AGPGART] Remove unnecessary parenthesis on return statements. # # Signed-off-by: Dave Jones # # drivers/char/agp/intel-mch-agp.c # 2004/12/15 20:43:09-05:00 davej@redhat.com +18 -18 # [AGPGART] Remove unnecessary parenthesis on return statements. # # Signed-off-by: Dave Jones # # drivers/char/agp/intel-agp.c # 2004/12/15 20:43:09-05:00 davej@redhat.com +28 -28 # [AGPGART] Remove unnecessary parenthesis on return statements. # # Signed-off-by: Dave Jones # # drivers/char/agp/i460-agp.c # 2004/12/15 20:43:09-05:00 davej@redhat.com +2 -2 # [AGPGART] Remove unnecessary parenthesis on return statements. # # Signed-off-by: Dave Jones # # drivers/char/agp/efficeon-agp.c # 2004/12/15 20:43:09-05:00 davej@redhat.com +2 -2 # [AGPGART] Remove unnecessary parenthesis on return statements. # # Signed-off-by: Dave Jones # # ChangeSet # 2004/12/15 20:30:41-05:00 davej@redhat.com # [AGPGART] Another missing PCI Posting bugfix. # # Signed-off-by: Dave Jones # # drivers/char/agp/sworks-agp.c # 2004/12/15 20:30:19-05:00 davej@redhat.com +1 -0 # [AGPGART] Another missing PCI Posting bugfix. # # Signed-off-by: Dave Jones # # ChangeSet # 2004/12/15 20:24:52-05:00 davej@redhat.com # [AGPGART] More PCI Posting bugs. # # Signed-off-by: Dave Jones # # drivers/char/agp/nvidia-agp.c # 2004/12/15 20:24:29-05:00 davej@redhat.com +3 -1 # [AGPGART] More PCI Posting bugs. # # Signed-off-by: Dave Jones # # drivers/char/agp/generic.c # 2004/12/15 20:24:29-05:00 davej@redhat.com +9 -3 # [AGPGART] More PCI Posting bugs. # # Signed-off-by: Dave Jones # # drivers/char/agp/amd64-agp.c # 2004/12/15 20:24:29-05:00 davej@redhat.com +1 -0 # [AGPGART] More PCI Posting bugs. # # Signed-off-by: Dave Jones # # ChangeSet # 2004/12/15 19:56:29-05:00 davej@redhat.com # [AGPGART] Fix up PCI posting bugs. # Also remove a pointless wrapper. # # Signed-off-by: Dave Jones # # drivers/char/agp/sworks-agp.c # 2004/12/15 19:54:35-05:00 davej@redhat.com +12 -13 # [AGPGART] Fix up PCI posting bugs. # Also remove a pointless wrapper. # # Signed-off-by: Dave Jones # # drivers/char/agp/intel-mch-agp.c # 2004/12/15 19:54:35-05:00 davej@redhat.com +22 -18 # [AGPGART] Fix up PCI posting bugs. # Also remove a pointless wrapper. # # Signed-off-by: Dave Jones # # drivers/char/agp/intel-agp.c # 2004/12/15 19:54:34-05:00 davej@redhat.com +55 -53 # [AGPGART] Fix up PCI posting bugs. # Also remove a pointless wrapper. # # Signed-off-by: Dave Jones # # drivers/char/agp/hp-agp.c # 2004/12/15 19:54:34-05:00 davej@redhat.com +28 -23 # [AGPGART] Fix up PCI posting bugs. # Also remove a pointless wrapper. # # Signed-off-by: Dave Jones # # drivers/char/agp/ati-agp.c # 2004/12/15 19:54:34-05:00 davej@redhat.com +12 -5 # [AGPGART] Fix up PCI posting bugs. # Also remove a pointless wrapper. # # Signed-off-by: Dave Jones # # drivers/char/agp/amd-k7-agp.c # 2004/12/15 19:54:34-05:00 davej@redhat.com +19 -12 # [AGPGART] Fix up PCI posting bugs. # Also remove a pointless wrapper. # # Signed-off-by: Dave Jones # # drivers/char/agp/agp.h # 2004/12/15 19:54:34-05:00 davej@redhat.com +0 -10 # [AGPGART] Fix up PCI posting bugs. # Also remove a pointless wrapper. # # Signed-off-by: Dave Jones # # ChangeSet # 2004/12/15 12:56:22-08:00 davem@nuts.davemloft.net # Merge nuts.davemloft.net:/disk1/BK/network-2.6.11 # into nuts.davemloft.net:/disk1/BK/net-2.6.11 # # net/ipv4/netfilter/ip_conntrack_standalone.c # 2004/12/15 12:56:11-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # net/core/dev.c # 2004/12/15 12:56:10-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # include/net/act_api.h # 2004/12/15 12:56:10-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # arch/sparc64/defconfig # 2004/12/15 12:56:10-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # arch/mips/defconfig # 2004/12/15 12:56:10-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # arch/mips/configs/rm200_defconfig # 2004/12/15 12:56:10-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # arch/mips/configs/ip22_defconfig # 2004/12/15 12:56:10-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # arch/m68k/configs/sun3x_defconfig # 2004/12/15 12:56:10-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # arch/m68k/configs/sun3_defconfig # 2004/12/15 12:56:10-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # arch/m68k/configs/q40_defconfig # 2004/12/15 12:56:09-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # arch/m68k/configs/mvme16x_defconfig # 2004/12/15 12:56:09-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # arch/m68k/configs/mvme147_defconfig # 2004/12/15 12:56:09-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # arch/m68k/configs/mac_defconfig # 2004/12/15 12:56:09-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # arch/m68k/configs/hp300_defconfig # 2004/12/15 12:56:09-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # arch/m68k/configs/bvme6000_defconfig # 2004/12/15 12:56:09-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # arch/m68k/configs/atari_defconfig # 2004/12/15 12:56:09-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # arch/m68k/configs/apollo_defconfig # 2004/12/15 12:56:09-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # arch/m68k/configs/amiga_defconfig # 2004/12/15 12:56:09-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # ChangeSet # 2004/12/15 13:42:10-05:00 davej@redhat.com # [AGPGART] Fix TLB flushing issues with change_page_attr() # # Calls to change_page_attr() need an explicit call to # global_flush_tlb() afterwards. The AGP code didn't # do this in a number of cases. This patch makes # map_page_into_agp/unmap_page_from_agp do the calls # themselves, which takes care of most of the problem. # # The Intel AGP driver also has some slightly different calls to what # map_page_into_agp() does, as it changes 4 contiguous pages. # Introduce explicit flushes afterwards there too. # # Thanks to Alan Cox for pointing this out. # # Signed-off-by: Dave Jones # # include/asm-x86_64/agp.h # 2004/12/15 13:42:04-05:00 davej@redhat.com +2 -3 # [AGPGART] Fix TLB flushing issues with change_page_attr() # # Calls to change_page_attr() need an explicit call to # global_flush_tlb() afterwards. The AGP code didn't # do this in a number of cases. This patch makes # map_page_into_agp/unmap_page_from_agp do the calls # themselves, which takes care of most of the problem. # # The Intel AGP driver also has some slightly different calls to what # map_page_into_agp() does, as it changes 4 contiguous pages. # Introduce explicit flushes afterwards there too. # # Thanks to Alan Cox for pointing this out. # # Signed-off-by: Dave Jones # # include/asm-i386/agp.h # 2004/12/15 13:42:04-05:00 davej@redhat.com +2 -2 # [AGPGART] Fix TLB flushing issues with change_page_attr() # # Calls to change_page_attr() need an explicit call to # global_flush_tlb() afterwards. The AGP code didn't # do this in a number of cases. This patch makes # map_page_into_agp/unmap_page_from_agp do the calls # themselves, which takes care of most of the problem. # # The Intel AGP driver also has some slightly different calls to what # map_page_into_agp() does, as it changes 4 contiguous pages. # Introduce explicit flushes afterwards there too. # # Thanks to Alan Cox for pointing this out. # # Signed-off-by: Dave Jones # # drivers/char/agp/intel-agp.c # 2004/12/15 13:42:04-05:00 davej@redhat.com +5 -2 # [AGPGART] Fix TLB flushing issues with change_page_attr() # # Calls to change_page_attr() need an explicit call to # global_flush_tlb() afterwards. The AGP code didn't # do this in a number of cases. This patch makes # map_page_into_agp/unmap_page_from_agp do the calls # themselves, which takes care of most of the problem. # # The Intel AGP driver also has some slightly different calls to what # map_page_into_agp() does, as it changes 4 contiguous pages. # Introduce explicit flushes afterwards there too. # # Thanks to Alan Cox for pointing this out. # # Signed-off-by: Dave Jones # # drivers/char/agp/generic.c # 2004/12/15 13:42:04-05:00 davej@redhat.com +23 -0 # [AGPGART] Fix TLB flushing issues with change_page_attr() # # Calls to change_page_attr() need an explicit call to # global_flush_tlb() afterwards. The AGP code didn't # do this in a number of cases. This patch makes # map_page_into_agp/unmap_page_from_agp do the calls # themselves, which takes care of most of the problem. # # The Intel AGP driver also has some slightly different calls to what # map_page_into_agp() does, as it changes 4 contiguous pages. # Introduce explicit flushes afterwards there too. # # Thanks to Alan Cox for pointing this out. # # Signed-off-by: Dave Jones # # drivers/char/agp/ati-agp.c # 2004/12/15 13:42:04-05:00 davej@redhat.com +0 -3 # [AGPGART] Fix TLB flushing issues with change_page_attr() # # Calls to change_page_attr() need an explicit call to # global_flush_tlb() afterwards. The AGP code didn't # do this in a number of cases. This patch makes # map_page_into_agp/unmap_page_from_agp do the calls # themselves, which takes care of most of the problem. # # The Intel AGP driver also has some slightly different calls to what # map_page_into_agp() does, as it changes 4 contiguous pages. # Introduce explicit flushes afterwards there too. # # Thanks to Alan Cox for pointing this out. # # Signed-off-by: Dave Jones # # ChangeSet # 2004/12/15 13:41:06-05:00 davej@redhat.com # [AGPGART] Add support for ALI M1681/M1683 # # Signed-off-by: Dave Jones # # include/linux/pci_ids.h # 2004/12/15 13:41:00-05:00 davej@redhat.com +3 -1 # [AGPGART] Add support for ALI M1681/M1683 # # Signed-off-by: Dave Jones # # drivers/char/agp/ali-agp.c # 2004/12/15 13:41:00-05:00 davej@redhat.com +9 -0 # [AGPGART] Add support for ALI M1681/M1683 # # Signed-off-by: Dave Jones # # ChangeSet # 2004/12/15 13:40:41-05:00 davej@redhat.com # [AGPGART] Simplify global_cache_flush # # on_each_cpu does the right thing in the UP case, so we can # kill those ugly ifdefs. # # Signed-off-by: Dave Jones # # drivers/char/agp/generic.c # 2004/12/15 13:40:34-05:00 davej@redhat.com +0 -6 # [AGPGART] Simplify global_cache_flush # # on_each_cpu does the right thing in the UP case, so we can # kill those ugly ifdefs. # # Signed-off-by: Dave Jones # # ChangeSet # 2004/12/15 13:39:28-05:00 davej@redhat.com # [AGPGART] isoch.c: replace pci_find_device with pci_get_device # # As pci_find_device is going away soon I have converted this file to use # pci_get_device instead. for_each_pci_dev is just a macro wrapper around # pci_get_device. I have compile tested it. If anyone has this hardware # and could test it that would be great. # # Signed-off-by: Hanna Linder # Signed-off-by: Dave Jones # # drivers/char/agp/isoch.c # 2004/12/15 13:39:21-05:00 davej@redhat.com +1 -1 # [AGPGART] isoch.c: replace pci_find_device with pci_get_device # # As pci_find_device is going away soon I have converted this file to use # pci_get_device instead. for_each_pci_dev is just a macro wrapper around # pci_get_device. I have compile tested it. If anyone has this hardware # and could test it that would be great. # # Signed-off-by: Hanna Linder # Signed-off-by: Dave Jones # # ChangeSet # 2004/12/15 13:38:35-05:00 davej@redhat.com # [AGPGART] intel-mch-agp.c: replace pci_find_device with pci_get_device # # As pci_find_device is going away soon I have converted this file to use # pci_get_device instead. I have compile tested it. If anyone has this hardware # and could test it that would be great. # # Signed-off-by: Hanna Linder # Signed-off-by: Dave Jones # # drivers/char/agp/intel-mch-agp.c # 2004/12/15 13:38:28-05:00 davej@redhat.com +3 -2 # [AGPGART] intel-mch-agp.c: replace pci_find_device with pci_get_device # # As pci_find_device is going away soon I have converted this file to use # pci_get_device instead. I have compile tested it. If anyone has this hardware # and could test it that would be great. # # Signed-off-by: Hanna Linder # Signed-off-by: Dave Jones # # ChangeSet # 2004/12/15 13:38:11-05:00 davej@redhat.com # [AGPGART] intel-agp.c: replace pci_find_device with pci_get_device # # As pci_find_device is going away soon I have converted this file to use # pci_get_device instead. I have compile tested it. If anyone has this hardware # and could test it that would be great. # # Signed-off-by: Hanna Linder # Signed-off-by: Dave Jones # # drivers/char/agp/intel-agp.c # 2004/12/15 13:38:05-05:00 davej@redhat.com +4 -3 # [AGPGART] intel-agp.c: replace pci_find_device with pci_get_device # # As pci_find_device is going away soon I have converted this file to use # pci_get_device instead. I have compile tested it. If anyone has this hardware # and could test it that would be great. # # Signed-off-by: Hanna Linder # Signed-off-by: Dave Jones # # ChangeSet # 2004/12/15 13:36:47-05:00 davej@redhat.com # [AGPGART] generic.c: replace pci_find_device with pci_get_device # # As pci_find_device is going away soon I have converted this file # to use pci_get_device instead. I have compile tested it. # If anyone has this hardware and could test it that would be great. # # Signed-off-by: Hanna Linder # Signed-off-by: Dave Jones # # drivers/char/agp/generic.c # 2004/12/15 13:36:41-05:00 davej@redhat.com +2 -2 # [AGPGART] generic.c: replace pci_find_device with pci_get_device # # As pci_find_device is going away soon I have converted this file # to use pci_get_device instead. I have compile tested it. # If anyone has this hardware and could test it that would be great. # # Signed-off-by: Hanna Linder # Signed-off-by: Dave Jones # # ChangeSet # 2004/12/15 13:34:02-05:00 davej@redhat.com # [AGPGART] amd64-agp.c replace pci_find_device with pci_get_device # As pci_find_device is going away soon I have converted this file # to use pci_get_device instead. I have compile tested it. # If anyone has this hardware and could test it that would be great. # # Signed-off-by: Hanna Linder # Signed-off-by: Dave Jones # # drivers/char/agp/amd64-agp.c # 2004/12/15 13:33:56-05:00 davej@redhat.com +8 -3 # [AGPGART] amd64-agp.c replace pci_find_device with pci_get_device # As pci_find_device is going away soon I have converted this file # to use pci_get_device instead. I have compile tested it. # If anyone has this hardware and could test it that would be great. # # Signed-off-by: Hanna Linder # Signed-off-by: Dave Jones # # ChangeSet # 2004/12/11 19:15:36-06:00 jejb@mulgrave.(none) # SCSI: Quieten the incorrect state change message # # Make it a scsi logging message instead (under ERROR_RECOVERY) # # Signed-off-by: James Bottomley # # drivers/scsi/scsi_lib.c # 2004/12/11 19:14:44-06:00 jejb@mulgrave.(none) +6 -5 # SCSI: Quieten the incorrect state change message # # ChangeSet # 2004/12/08 00:40:23-05:00 len.brown@intel.com # [ACPI] fix polarity of CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI message # # Signed-off-by: Len Brown # # arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c # 2004/12/08 00:36:27-05:00 len.brown@intel.com +1 -1 # complain about CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI missing only when it is missing # # ChangeSet # 2004/12/08 00:33:06-05:00 len.brown@intel.com # [ACPI] remove duplicate _PDC #defines resulting from mis-merge # # Signed-off-by: Zhenyu Z. Wang # Signed-off-by: Len Brown # # include/asm-i386/acpi.h # 2004/12/08 00:32:58-05:00 len.brown@intel.com +0 -6 # remove duplicate #defines resulting from mis-merge # # ChangeSet # 2004/12/07 19:27:33-05:00 jgarzik@pobox.com # drivers/block/floppy: kill #include linux/version.h # # Appears to be unnecessary. # # drivers/block/floppy.c # 2004/12/07 19:27:27-05:00 jgarzik@pobox.com +0 -1 # drivers/block/floppy: kill #include linux/version.h # # Appears to be unnecessary. # # ChangeSet # 2004/12/07 18:46:10-05:00 jgarzik@pobox.com # Merge pobox.com:/garz/repo/linux-2.6 into pobox.com:/garz/repo/misc-2.6 # # sound/oss/soundcard.c # 2004/12/07 18:46:07-05:00 jgarzik@pobox.com +0 -0 # Auto merged # # sound/oss/i810_audio.c # 2004/12/07 18:46:07-05:00 jgarzik@pobox.com +0 -0 # Auto merged # # ChangeSet # 2004/12/06 17:23:23-05:00 len.brown@intel.com # Merge intel.com:/home/lenb/src/26-stable-dev # into intel.com:/home/lenb/src/26-latest-dev # # drivers/acpi/tables/tbxfroot.c # 2004/12/06 17:23:20-05:00 len.brown@intel.com +0 -0 # Auto merged # # ChangeSet # 2004/12/06 17:12:37-05:00 len.brown@intel.com # [ACPI] ACPICA 20041203 from Bob Moore and Alexey Starikovskiy # # The low-level field insertion/extraction code (exfldio) # has been completely rewritten to eliminate unnecessary # complexity, bugs, and boundary conditions. # # Fixed a problem in the ToInteger, ToBuffer, ToHexString, # and ToDecimalString operators where the input operand could # be inadvertently deleted if no conversion was necessary # (e.g., if the input to ToInteger was an Integer object.) # # Fixed a problem with the ToDecimalString and ToHexString # where an incorrect exception code was returned if the # resulting string would be > 200 chars. AE_STRING_LIMIT is # now returned. # # Fixed a problem with the Concatenate operator where AE_OK # was always returned, even if the operation failed. # # Fixed a problem in oswinxf (used by AcpiExec and iASL) # to allow > 128 semaphores to be allocated. # # Signed-off-by: Len Brown # # include/acpi/amlcode.h # 2004/12/06 16:15:20-05:00 len.brown@intel.com +1 -0 # ACPICA 20041203 # # include/acpi/acobject.h # 2004/12/06 16:15:20-05:00 len.brown@intel.com +1 -3 # ACPICA 20041203 # # include/acpi/acmacros.h # 2004/12/06 16:15:21-05:00 len.brown@intel.com +1 -0 # ACPICA 20041203 # # include/acpi/acconfig.h # 2004/12/06 16:15:21-05:00 len.brown@intel.com +1 -1 # ACPICA 20041203 # # drivers/acpi/parser/psopcode.c # 2004/12/06 16:15:25-05:00 len.brown@intel.com +4 -4 # ACPICA 20041203 # # drivers/acpi/executer/exprep.c # 2004/12/06 16:15:26-05:00 len.brown@intel.com +2 -22 # ACPICA 20041203 # # drivers/acpi/executer/exoparg1.c # 2004/12/06 16:15:26-05:00 len.brown@intel.com +22 -4 # ACPICA 20041203 # # drivers/acpi/executer/exmisc.c # 2004/12/06 16:15:26-05:00 len.brown@intel.com +1 -1 # ACPICA 20041203 # # drivers/acpi/executer/exfldio.c # 2004/12/06 16:15:26-05:00 len.brown@intel.com +114 -432 # ACPICA 20041203 # # drivers/acpi/executer/exdump.c # 2004/12/06 16:15:26-05:00 len.brown@intel.com +0 -3 # ACPICA 20041203 # # drivers/acpi/events/evgpe.c # 2004/12/06 16:15:25-05:00 len.brown@intel.com +13 -13 # ACPICA 20041203 # # drivers/acpi/dispatcher/dswexec.c # 2004/12/06 16:15:25-05:00 len.brown@intel.com +16 -8 # ACPICA 20041203 # # drivers/acpi/dispatcher/dsopcode.c # 2004/12/06 16:15:25-05:00 len.brown@intel.com +2 -3 # ACPICA 20041203 # # ChangeSet # 2004/12/06 16:57:17-05:00 len.brown@intel.com # [ACPI] ACPICA 20041119 from Bob Moore # # Fixed a problem in acpi_ex_convert_to_integer # where new integers were not truncated to 32 bits for # 32-bit ACPI tables. This routine converts buffers and # strings to integers. # # Implemented support to store a value to an Index() on a # String object. This is an ACPI 2.0 feature that had not # yet been implemented. # # Implemented new behavior for storing objects to individual # package elements (via the Index() operator). The # previous behavior was to invoke the implicit conversion # rules if an object was already present at the index. # The new behavior is to simply delete any existing object # and directly store the new object. Although the ACPI # specification seems unclear on this subject, other ACPI # implementations behave in this manner. (This is the root # of the AE_BAD_HEX_CONSTANT issue.) # # Modified the RSDP memory scan mechanism to support the # extended checksum for ACPI 2.0 (and above) RSDPs. Note # that the search continues until a valid RSDP signature is # found with a valid checksum. # # Signed-off-by: Len Brown # # include/acpi/acoutput.h # 2004/12/06 16:02:10-05:00 len.brown@intel.com +1 -1 # ACPICA 20041119 # # include/acpi/acmacros.h # 2004/12/06 16:02:10-05:00 len.brown@intel.com +12 -12 # ACPICA 20041119 # # include/acpi/acconfig.h # 2004/12/06 16:02:10-05:00 len.brown@intel.com +1 -1 # ACPICA 20041119 # # drivers/acpi/tables/tbxfroot.c # 2004/12/06 16:02:13-05:00 len.brown@intel.com +34 -11 # ACPICA 20041119 # # drivers/acpi/tables/tbrsdt.c # 2004/12/06 16:02:13-05:00 len.brown@intel.com +1 -0 # ACPICA 20041119 # # drivers/acpi/executer/exstore.c # 2004/12/06 16:02:13-05:00 len.brown@intel.com +26 -36 # ACPICA 20041119 # # drivers/acpi/executer/exoparg2.c # 2004/12/06 16:02:13-05:00 len.brown@intel.com +2 -2 # ACPICA 20041119 # # drivers/acpi/executer/exdump.c # 2004/12/06 16:56:20-05:00 len.brown@intel.com +5 -3 # ACPICA 20041119 # # drivers/acpi/executer/exconvrt.c # 2004/12/06 16:02:13-05:00 len.brown@intel.com +9 -7 # ACPICA 20041119 # # drivers/acpi/executer/exconfig.c # 2004/12/06 16:02:13-05:00 len.brown@intel.com +1 -1 # ACPICA 20041119 # # ChangeSet # 2004/12/06 15:58:53-05:00 len.brown@intel.com # merge # # drivers/acpi/processor.c # 2004/12/06 15:58:46-05:00 len.brown@intel.com +1 -1 # merge # # ChangeSet # 2004/12/06 14:38:49-06:00 bunk@stusta.de # [PATCH] i386 mca.c: small cleanups # # The patch below contains the following cleanups: # - make spinlock mca_lock static # - make struct mca_standard_resources static # # Signed-off-by: Adrian Bunk # Signed-off-by: James Bottomley # # include/asm-i386/mca.h # 2004/12/01 01:03:10-06:00 bunk@stusta.de +0 -3 # i386 mca.c: small cleanups # # arch/i386/kernel/mca.c # 2004/12/01 01:03:44-06:00 bunk@stusta.de +2 -2 # i386 mca.c: small cleanups # # include/linux/acpi.h # 2004/12/06 15:23:34-05:00 len.brown@intel.com +0 -0 # Auto merged # # drivers/acpi/pci_irq.c # 2004/12/06 15:23:34-05:00 len.brown@intel.com +0 -0 # Auto merged # # drivers/acpi/pci_bind.c # 2004/12/06 15:23:34-05:00 len.brown@intel.com +0 -0 # Auto merged # # drivers/acpi/bus.c # 2004/12/06 15:23:33-05:00 len.brown@intel.com +0 -0 # Auto merged # # ChangeSet # 2004/12/06 14:23:20-06:00 matthew@wil.cx # [PATCH] Move MCA_bus to linux/mca.h # # - Move MCA_bus declaration from to # - Define it in mca.c, not setup.c # - EXPORT_SYMBOL it at the site of its definition. # - Fix up random files to include for the use of the MCA_bus # symbol # - Delete some unnecessary ifdefs. # - Delete some unneeded comments. # # Signed-off-by: James Bottomley # # include/linux/mca.h # 2004/12/01 14:54:03-06:00 matthew@wil.cx +3 -11 # Move MCA_bus to linux/mca.h # # include/asm-x86_64/processor.h # 2004/12/01 14:54:03-06:00 matthew@wil.cx +0 -6 # Move MCA_bus to linux/mca.h # # include/asm-v850/processor.h # 2004/12/01 14:54:03-06:00 matthew@wil.cx +0 -7 # Move MCA_bus to linux/mca.h # # include/asm-sparc64/processor.h # 2004/12/01 14:54:03-06:00 matthew@wil.cx +0 -4 # Move MCA_bus to linux/mca.h # # include/asm-sparc/processor.h # 2004/12/01 14:54:03-06:00 matthew@wil.cx +0 -6 # Move MCA_bus to linux/mca.h # # include/asm-sh64/processor.h # 2004/12/01 14:54:03-06:00 matthew@wil.cx +0 -6 # Move MCA_bus to linux/mca.h # # include/asm-sh/processor.h # 2004/12/01 14:54:03-06:00 matthew@wil.cx +0 -6 # Move MCA_bus to linux/mca.h # # include/asm-ppc64/processor.h # 2004/12/01 14:54:01-06:00 matthew@wil.cx +0 -6 # Move MCA_bus to linux/mca.h # # include/asm-ppc/processor.h # 2004/12/01 14:54:01-06:00 matthew@wil.cx +0 -6 # Move MCA_bus to linux/mca.h # # include/asm-parisc/processor.h # 2004/12/01 14:54:01-06:00 matthew@wil.cx +0 -3 # Move MCA_bus to linux/mca.h # # include/asm-mips/processor.h # 2004/12/01 14:54:01-06:00 matthew@wil.cx +0 -6 # Move MCA_bus to linux/mca.h # # include/asm-m68knommu/processor.h # 2004/12/01 14:54:01-06:00 matthew@wil.cx +0 -5 # Move MCA_bus to linux/mca.h # # include/asm-i386/processor.h # 2004/12/01 14:54:00-06:00 matthew@wil.cx +0 -5 # Move MCA_bus to linux/mca.h # # include/asm-h8300/processor.h # 2004/12/01 14:53:59-06:00 matthew@wil.cx +0 -5 # Move MCA_bus to linux/mca.h # # include/asm-arm26/processor.h # 2004/12/01 14:53:59-06:00 matthew@wil.cx +0 -3 # Move MCA_bus to linux/mca.h # # include/asm-arm/processor.h # 2004/12/01 14:53:59-06:00 matthew@wil.cx +0 -3 # Move MCA_bus to linux/mca.h # # include/asm-alpha/processor.h # 2004/12/01 14:53:59-06:00 matthew@wil.cx +0 -6 # Move MCA_bus to linux/mca.h # # drivers/serial/8250.c # 2004/12/01 14:53:57-06:00 matthew@wil.cx +1 -2 # Move MCA_bus to linux/mca.h # # arch/i386/kernel/time.c # 2004/12/01 14:53:46-06:00 matthew@wil.cx +2 -3 # Move MCA_bus to linux/mca.h # # arch/i386/kernel/setup.c # 2004/12/01 14:53:46-06:00 matthew@wil.cx +11 -2 # Move MCA_bus to linux/mca.h # # arch/i386/kernel/mca.c # 2004/12/01 14:53:40-06:00 matthew@wil.cx +3 -0 # Move MCA_bus to linux/mca.h # # arch/i386/kernel/i386_ksyms.c # 2004/12/01 14:53:40-06:00 matthew@wil.cx +0 -1 # Move MCA_bus to linux/mca.h # # ChangeSet # 2004/12/06 15:00:40-05:00 len.brown@intel.com # build fix # # include/acpi/acpixf.h # 2004/12/06 15:00:29-05:00 len.brown@intel.com +1 -1 # build fix # # ChangeSet # 2004/12/06 11:38:01-06:00 jejb@mulgrave.(none) # Rename SCSI ChangeLog to reflect its venarability # # The last time it was modified was 1997, so add the # date range of applicability to its name. # # Signed-off-by: James Bottomley # # Documentation/scsi/ChangeLog.1992-1997 # 2004/12/06 11:36:04-06:00 jejb@mulgrave.(none) +0 -0 # Rename: Documentation/scsi/ChangeLog -> Documentation/scsi/ChangeLog.1992-1997 # # ChangeSet # 2004/12/06 01:43:31-05:00 len.brown@intel.com # Merge intel.com:/home/lenb/src/26-stable-dev # into intel.com:/home/lenb/src/26-latest-dev # # drivers/acpi/ec.c # 2004/12/06 01:43:27-05:00 len.brown@intel.com +0 -0 # Auto merged # # ChangeSet # 2004/12/06 01:40:07-05:00 len.brown@intel.com # [ACPI] 32-bit EC access # # http://bugzilla.kernel.org/show_bug.cgi?id=1744 # # Signed-off-by: Luming Yu # Signed-off-by: Len Brown # # drivers/acpi/ec.c # 2004/12/01 08:46:15-05:00 len.brown@intel.com +24 -0 # 32-bit EC access # # ChangeSet # 2004/12/06 00:09:58-05:00 len.brown@intel.com # Merge intel.com:/home/lenb/src/26-stable-dev # into intel.com:/home/lenb/src/26-latest-dev # # drivers/acpi/events/evxfevnt.c # 2004/12/06 00:09:54-05:00 len.brown@intel.com +0 -0 # Auto merged # # ChangeSet # 2004/12/06 00:08:27-05:00 len.brown@intel.com # build fix # # drivers/acpi/events/evxfevnt.c # 2004/12/06 00:08:18-05:00 len.brown@intel.com +1 -2 # build fix # # ChangeSet # 2004/12/06 00:03:42-05:00 len.brown@intel.com # Merge intel.com:/home/lenb/src/26-stable-dev # into intel.com:/home/lenb/src/26-latest-dev # # drivers/acpi/thermal.c # 2004/12/06 00:03:38-05:00 len.brown@intel.com +0 -0 # Auto merged # # drivers/acpi/sleep/proc.c # 2004/12/06 00:03:38-05:00 len.brown@intel.com +0 -0 # Auto merged # # drivers/acpi/pci_link.c # 2004/12/06 00:03:38-05:00 len.brown@intel.com +0 -0 # Auto merged # # drivers/acpi/pci_irq.c # 2004/12/06 00:03:38-05:00 len.brown@intel.com +0 -0 # Auto merged # # drivers/acpi/ec.c # 2004/12/06 00:03:38-05:00 len.brown@intel.com +0 -0 # Auto merged # # drivers/acpi/bus.c # 2004/12/06 00:03:38-05:00 len.brown@intel.com +0 -0 # Auto merged # # Documentation/kernel-parameters.txt # 2004/12/06 00:03:38-05:00 len.brown@intel.com +0 -0 # Auto merged # # ChangeSet # 2004/12/05 23:40:35-05:00 len.brown@intel.com # [ACPI] fixes from stack consumption audit # # http://bugzilla.kernel.org/show_bug.cgi?id=2901 # # Signed-off-by: Luming Yu # Signed-off-by: Len Brown # # drivers/acpi/video.c # 2004/12/01 06:31:48-05:00 len.brown@intel.com +7 -6 # stack consumption audit # # drivers/acpi/thermal.c # 2004/12/01 06:49:30-05:00 len.brown@intel.com +22 -5 # stack consumption audit # # drivers/acpi/pci_link.c # 2004/12/01 06:42:40-05:00 len.brown@intel.com +36 -26 # stack consumption audit # # drivers/acpi/pci_irq.c # 2004/12/01 06:31:47-05:00 len.brown@intel.com +12 -2 # stack consumption audit # # drivers/acpi/pci_bind.c # 2004/12/01 06:31:47-05:00 len.brown@intel.com +30 -7 # stack consumption audit # # ChangeSet # 2004/12/05 23:38:12-05:00 len.brown@intel.com # [ACPI] handle GPE sharing between button and lid # # http://bugzilla.kernel.org/show_bug.cgi?id=3518 # # Signed-off-by: David Shaohua Li # Signed-off-by: Len Brown # # drivers/acpi/sleep/proc.c # 2004/12/05 23:38:04-05:00 len.brown@intel.com +17 -0 # sharing GPE w/ button and LID # # ChangeSet # 2004/12/05 23:23:53-05:00 len.brown@intel.com # [ACPI] add "acpi_fake_ecdt" workaround for Gateway: # ex_access_region Region EmbeddedControl(3) has no handler # # http://bugzilla.kernel.org/show_bug.cgi?id=1690 # # Signed-off-by: David Shaohua Li # Signed-off-by: Len Brown # # drivers/acpi/ec.c # 2004/12/05 23:23:45-05:00 len.brown@intel.com +107 -4 # "acpi_fake_ecdt" # # Documentation/kernel-parameters.txt # 2004/12/05 23:23:45-05:00 len.brown@intel.com +2 -0 # "acpi_fake_ecdt" # # ChangeSet # 2004/12/05 23:10:31-05:00 len.brown@intel.com # [ACPI] fix "Error getting context for object" warning # http://bugzilla.kernel.org/show_bug.cgi?id=3805 # # Signed-off-by: David Shaohua Li # Signed-off-by: Len Brown # # drivers/pnp/pnpacpi/core.c # 2004/11/25 20:28:37-05:00 len.brown@intel.com +3 -3 # fix "Error getting context for object" warning # # drivers/acpi/bus.c # 2004/11/25 20:09:42-05:00 len.brown@intel.com +1 -1 # fix "Error getting context for object" warning # # ChangeSet # 2004/12/05 22:52:35-05:00 len.brown@intel.com # [ACPI] S3 resume using RTC # http://bugzilla.kernel.org/show_bug.cgi?id=1320 # # By: Patrick Mochel, Karol Kozimor, Shaohua Li # Signed-off-by: Len Brown # # drivers/acpi/sleep/proc.c # 2004/11/22 22:02:27-05:00 len.brown@intel.com +36 -25 # wake on RTC # # ChangeSet # 2004/12/03 22:40:32-05:00 len.brown@intel.com # [ACPI] fix VIA IRQ issue by enabling VIA quirk # http://bugzilla.kernel.org/show_bug.cgi?id=3319 # # Signed-off-by: David Shaohua Li # Signed-off-by: Len Brown # # drivers/pci/quirks.c # 2004/12/02 20:01:29-05:00 len.brown@intel.com +1 -0 # yet another example of VIA quirk # # ChangeSet # 2004/12/02 17:12:47-05:00 rl@hellgate.ch # [PATCH] via-rhine: WOL band-aid # # After I disabled legacy WOL (i.e. controlled by EEPROM rather than # driver) in 2.6.9, several people reported regressions. Legacy WOL had # worked for them, but now it didn't anymore. The Right Way (TM) to fix # this will get the driver to set up working WOL for all hardware, but a # simpler solution will have to do for the time being: If a user requests # magic packet WOL, the driver re-enables legacy WOL. Yeah, I know it's # cheating. # # This version applies against -mm. I suggest to put it there for testing # and into 2.6.11 if feedback is good. # # Thanks to Pavel Ruzicka for testing. # # Roger # # Signed-off-by: Roger Luethi # Signed-off-by: Jeff Garzik # # drivers/net/via-rhine.c # 2004/11/30 17:32:01-05:00 rl@hellgate.ch +13 -5 # via-rhine: WOL band-aid # # ChangeSet # 2004/12/02 16:54:31-05:00 jgarzik@pobox.com # Merge pobox.com:/garz/repo/linux-2.6 # into pobox.com:/garz/repo/netdev-2.6/via-rhine # # drivers/net/via-rhine.c # 2004/12/02 16:54:27-05:00 jgarzik@pobox.com +0 -0 # Auto merged # # ChangeSet # 2004/12/01 21:50:03-08:00 davem@nuts.davemloft.net # Merge nuts.davemloft.net:/disk1/BK/net-2.6.11-work # into nuts.davemloft.net:/disk1/BK/net-2.6.11 # # net/xfrm/xfrm_policy.c # 2004/12/01 21:49:52-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # net/core/skbuff.c # 2004/12/01 21:49:52-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # arch/sparc64/defconfig # 2004/12/01 21:49:52-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # arch/mips/configs/rm200_defconfig # 2004/12/01 21:49:51-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # arch/m68k/configs/sun3x_defconfig # 2004/12/01 21:49:51-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # arch/m68k/configs/sun3_defconfig # 2004/12/01 21:49:51-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # arch/m68k/configs/q40_defconfig # 2004/12/01 21:49:51-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # arch/m68k/configs/mvme16x_defconfig # 2004/12/01 21:49:51-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # arch/m68k/configs/mvme147_defconfig # 2004/12/01 21:49:51-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # arch/m68k/configs/mac_defconfig # 2004/12/01 21:49:51-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # arch/m68k/configs/hp300_defconfig # 2004/12/01 21:49:51-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # arch/m68k/configs/bvme6000_defconfig # 2004/12/01 21:49:51-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # arch/m68k/configs/atari_defconfig # 2004/12/01 21:49:51-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # arch/m68k/configs/apollo_defconfig # 2004/12/01 21:49:51-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # arch/m68k/configs/amiga_defconfig # 2004/12/01 21:49:51-08:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # ChangeSet # 2004/12/01 23:50:22-05:00 len.brown@intel.com # Merge intel.com:/home/lenb/bk/26-latest-ref # into intel.com:/home/lenb/src/26-latest-dev # # arch/ia64/kernel/process.c # 2004/12/01 23:50:18-05:00 len.brown@intel.com +0 -0 # Auto merged # # ChangeSet # 2004/12/01 19:21:17-05:00 len.brown@intel.com # Merge intel.com:/home/lenb/bk/26-latest-ref # into intel.com:/home/lenb/src/26-latest-dev # # arch/ia64/kernel/process.c # 2004/12/01 19:21:13-05:00 len.brown@intel.com +0 -0 # Auto merged # # ChangeSet # 2004/11/30 22:04:39-08:00 tgraf@suug.ch # [RTNETLINK]: Link attribute modification by interface name. # # This patch allows modification of link attributes by the interface name, # avoids the requirement of translating a name to an ifindex first, and # provides better atomicity to userspace. It works by setting the ifindex # to a negative number and provide the interface name via the IFLA_IFNAME # TLV and let the kernel lookup the device by name instead of ifindex. Changing # the interface name will not work using this method because IFLA_IFNAME also # transports the new interface name. The patch also fixes a possible source for # bugs if IFNAMSIZ is ever changed to a number not aligned to RTA_ALIGNTO. # # Signed-off-by: Thomas Graf # Signed-off-by: David S. Miller # # net/core/rtnetlink.c # 2004/11/30 22:04:20-08:00 tgraf@suug.ch +18 -3 # [RTNETLINK]: Link attribute modification by interface name. # # This patch allows modification of link attributes by the interface name, # avoids the requirement of translating a name to an ifindex first, and # provides better atomicity to userspace. It works by setting the ifindex # to a negative number and provide the interface name via the IFLA_IFNAME # TLV and let the kernel lookup the device by name instead of ifindex. Changing # the interface name will not work using this method because IFLA_IFNAME also # transports the new interface name. The patch also fixes a possible source for # bugs if IFNAMSIZ is ever changed to a number not aligned to RTA_ALIGNTO. # # Signed-off-by: Thomas Graf # Signed-off-by: David S. Miller # # ChangeSet # 2004/11/30 22:01:06-08:00 michal@logix.cz # [CRYPTO]: Standalone VIA PadLock driver. # # Signed-off-by: David S. Miller # # include/linux/crypto.h # 2004/11/30 22:00:21-08:00 michal@logix.cz +3 -0 # [CRYPTO]: Standalone VIA PadLock driver. # # drivers/Makefile # 2004/11/30 22:00:21-08:00 michal@logix.cz +1 -0 # [CRYPTO]: Standalone VIA PadLock driver. # # crypto/Kconfig # 2004/11/30 22:00:21-08:00 michal@logix.cz +1 -0 # [CRYPTO]: Standalone VIA PadLock driver. # # drivers/crypto/padlock.h # 2004/11/30 22:00:15-08:00 michal@logix.cz +36 -0 # [CRYPTO]: Standalone VIA PadLock driver. # # drivers/crypto/padlock-generic.c # 2004/11/30 22:00:15-08:00 michal@logix.cz +63 -0 # [CRYPTO]: Standalone VIA PadLock driver. # # drivers/crypto/padlock-aes.c # 2004/11/30 22:00:15-08:00 michal@logix.cz +470 -0 # [CRYPTO]: Standalone VIA PadLock driver. # # drivers/crypto/Makefile # 2004/11/30 22:00:15-08:00 michal@logix.cz +7 -0 # [CRYPTO]: Standalone VIA PadLock driver. # # drivers/crypto/padlock.h # 2004/11/30 22:00:15-08:00 michal@logix.cz +0 -0 # BitKeeper file /disk1/BK/net-2.6.11/drivers/crypto/padlock.h # # drivers/crypto/padlock-generic.c # 2004/11/30 22:00:15-08:00 michal@logix.cz +0 -0 # BitKeeper file /disk1/BK/net-2.6.11/drivers/crypto/padlock-generic.c # # drivers/crypto/padlock-aes.c # 2004/11/30 22:00:15-08:00 michal@logix.cz +0 -0 # BitKeeper file /disk1/BK/net-2.6.11/drivers/crypto/padlock-aes.c # # drivers/crypto/Makefile # 2004/11/30 22:00:15-08:00 michal@logix.cz +0 -0 # BitKeeper file /disk1/BK/net-2.6.11/drivers/crypto/Makefile # # drivers/crypto/Kconfig # 2004/11/30 22:00:13-08:00 michal@logix.cz +23 -0 # [CRYPTO]: Standalone VIA PadLock driver. # # drivers/crypto/Kconfig # 2004/11/30 22:00:13-08:00 michal@logix.cz +0 -0 # BitKeeper file /disk1/BK/net-2.6.11/drivers/crypto/Kconfig # # ChangeSet # 2004/11/30 21:55:37-08:00 bunk@stusta.de # [CRYPTO]: Make some code static # # This patch below makes some needlessly global code # static. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # crypto/tcrypt.h # 2004/11/30 21:55:18-08:00 bunk@stusta.de +51 -51 # [CRYPTO]: Make some code static # # This patch below makes some needlessly global code # static. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # crypto/tcrypt.c # 2004/11/30 21:55:18-08:00 bunk@stusta.de +1 -1 # [CRYPTO]: Make some code static # # This patch below makes some needlessly global code # static. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # crypto/sha512.c # 2004/11/30 21:55:18-08:00 bunk@stusta.de +1 -1 # [CRYPTO]: Make some code static # # This patch below makes some needlessly global code # static. # # Signed-off-by: Adrian Bunk # Signed-off-by: David S. Miller # # ChangeSet # 2004/11/30 21:51:06-08:00 robert.olsson@data.slu.se # [IPV4]: FIB cleanup, fib_detect_death() # # Remove dependancy upon fib_hash specific # fn_hash_select_dflt and move it over to # fib_semantics.c # # Signed-off-by: David S. Miller # # net/ipv4/fib_semantics.c # 2004/11/30 21:50:04-08:00 robert.olsson@data.slu.se +23 -0 # [IPV4]: FIB cleanup, fib_detect_death() # # net/ipv4/fib_lookup.h # 2004/11/30 21:50:04-08:00 robert.olsson@data.slu.se +3 -0 # [IPV4]: FIB cleanup, fib_detect_death() # # net/ipv4/fib_hash.c # 2004/11/30 21:50:04-08:00 robert.olsson@data.slu.se +2 -25 # [IPV4]: FIB cleanup, fib_detect_death() # # ChangeSet # 2004/11/30 21:45:25-08:00 robert.olsson@data.slu.se # [IPV4]: FIB cleanup, fib_find_alias() # # Abstract out fib_node arg usage in fib_find_alias(), # move to fib_semantics.c # # Signed-off-by: David S. Miller # # net/ipv4/fib_semantics.c # 2004/11/30 21:44:45-08:00 robert.olsson@data.slu.se +18 -0 # [IPV4]: FIB cleanup, fib_find_alias() # # net/ipv4/fib_lookup.h # 2004/11/30 21:44:45-08:00 robert.olsson@data.slu.se +2 -0 # [IPV4]: FIB cleanup, fib_find_alias() # # net/ipv4/fib_hash.c # 2004/11/30 21:44:45-08:00 robert.olsson@data.slu.se +10 -22 # [IPV4]: FIB cleanup, fib_find_alias() # # ChangeSet # 2004/11/30 21:37:16-08:00 davem@nuts.davemloft.net # [IPV4]: FIB cleanup, rtmsg_fib() # # Based largely upon a patch by Robert Olsson. # # Abstract out rtmsg_fib() so that it does not depend # upon fib_hash internal datastructures, move it to # fib_semantics.c # # Signed-off-by: David S. Miller # # net/ipv4/fib_semantics.c # 2004/11/30 21:36:06-08:00 davem@nuts.davemloft.net +27 -0 # [IPV4]: FIB cleanup, rtmsg_fib() # # net/ipv4/fib_lookup.h # 2004/11/30 21:36:06-08:00 davem@nuts.davemloft.net +3 -0 # [IPV4]: FIB cleanup, rtmsg_fib() # # net/ipv4/fib_hash.c # 2004/11/30 21:36:06-08:00 davem@nuts.davemloft.net +2 -34 # [IPV4]: FIB cleanup, rtmsg_fib() # # ChangeSet # 2004/11/30 17:38:34-05:00 len.brown@intel.com # merge # # drivers/acpi/scan.c # 2004/11/30 17:38:27-05:00 len.brown@intel.com +0 -2 # merge # # BitKeeper/deleted/.del-acpi_ksyms.c~3e52a41ca5aed029 # 2004/11/30 17:15:57-05:00 len.brown@intel.com +0 -0 # Auto merged # # drivers/acpi/pci_irq.c # 2004/11/30 17:15:57-05:00 len.brown@intel.com +0 -0 # Auto merged # # drivers/acpi/pci_bind.c # 2004/11/30 17:15:57-05:00 len.brown@intel.com +0 -0 # Auto merged # # drivers/acpi/bus.c # 2004/11/30 17:15:57-05:00 len.brown@intel.com +0 -0 # Auto merged # # drivers/acpi/Makefile # 2004/11/30 17:15:57-05:00 len.brown@intel.com +0 -0 # Auto merged # # arch/i386/kernel/acpi/boot.c # 2004/11/30 17:15:57-05:00 len.brown@intel.com +0 -0 # Auto merged # # BitKeeper/deleted/.del-acpi_ksyms.c~3e52a41ca5aed029 # 2004/11/30 17:15:57-05:00 len.brown@intel.com +0 -0 # Merge rename: drivers/acpi/acpi_ksyms.c -> BitKeeper/deleted/.del-acpi_ksyms.c~3e52a41ca5aed029 # # ChangeSet # 2004/11/27 13:35:38+01:00 kaber@coreworks.de # [NETFILTER]: Verify NAT manips have been applied before reversing them in icmp_reply_translation # # ICMP errors may be generated for packets that don't have # all NAT manips applied yet. Verify manips have been applied # before reversing them. # # Signed-off-by: Patrick McHardy # # net/ipv4/netfilter/ip_nat_core.c # 2004/11/27 13:35:30+01:00 kaber@coreworks.de +36 -0 # [NETFILTER]: Verify NAT manips have been applied before reversing them in icmp_reply_translation # # ICMP errors may be generated for packets that don't have # all NAT manips applied yet. Verify manips have been applied # before reversing them. # # Signed-off-by: Patrick McHardy # # net/ipv4/netfilter/ip_conntrack_standalone.c # 2004/11/27 13:35:30+01:00 kaber@coreworks.de +1 -0 # [NETFILTER]: Verify NAT manips have been applied before reversing them in icmp_reply_translation # # ICMP errors may be generated for packets that don't have # all NAT manips applied yet. Verify manips have been applied # before reversing them. # # Signed-off-by: Patrick McHardy # # ChangeSet # 2004/11/27 13:26:24+01:00 kaber@coreworks.de # [NETFILTER]: Apply PRE_ROUTING manips in LOCAL_OUT for locally generated icmp errors # # Locally generated ICMP errors never hit PRE_ROUTING. Fixes invalid # addressed ICMP errors for SNATed packets. # # Signed-off-by: Patrick McHardy # # net/ipv4/netfilter/ip_nat_core.c # 2004/11/27 13:26:17+01:00 kaber@coreworks.de +8 -0 # [NETFILTER]: Apply PRE_ROUTING manips in LOCAL_OUT for locally generated icmp errors # # Locally generated ICMP errors never hit PRE_ROUTING. Fixes invalid # addressed ICMP errors for SNATed packets. # # Signed-off-by: Patrick McHardy # # ChangeSet # 2004/11/27 13:15:30+01:00 kaber@coreworks.de # [NETFILTER]: Save a level of indentation in icmp_reply_translation # # Signed-off-by: Patrick McHardy # # net/ipv4/netfilter/ip_nat_core.c # 2004/11/27 13:15:22+01:00 kaber@coreworks.de +25 -29 # [NETFILTER]: Save a level of indentation in icmp_reply_translation # # Signed-off-by: Patrick McHardy # # ChangeSet # 2004/11/27 12:20:20+01:00 kaber@coreworks.de # [NETFILTER]: Remove CONFIG_IP_NF_NAT_LOCAL config option # # Signed-off-by: Patrick McHardy # # net/ipv4/netfilter/ip_nat_standalone.c # 2004/11/27 12:20:13+01:00 kaber@coreworks.de +4 -22 # [NETFILTER]: Remove CONFIG_IP_NF_NAT_LOCAL config option # # Signed-off-by: Patrick McHardy # # net/ipv4/netfilter/ip_nat_rule.c # 2004/11/27 12:20:13+01:00 kaber@coreworks.de +0 -11 # [NETFILTER]: Remove CONFIG_IP_NF_NAT_LOCAL config option # # Signed-off-by: Patrick McHardy # # net/ipv4/netfilter/ip_nat_core.c # 2004/11/27 12:20:13+01:00 kaber@coreworks.de +0 -8 # [NETFILTER]: Remove CONFIG_IP_NF_NAT_LOCAL config option # # Signed-off-by: Patrick McHardy # # net/ipv4/netfilter/Kconfig # 2004/11/27 12:20:13+01:00 kaber@coreworks.de +0 -14 # [NETFILTER]: Remove CONFIG_IP_NF_NAT_LOCAL config option # # Signed-off-by: Patrick McHardy # # include/linux/netfilter_ipv4/ip_nat.h # 2004/11/27 12:20:13+01:00 kaber@coreworks.de +0 -5 # [NETFILTER]: Remove CONFIG_IP_NF_NAT_LOCAL config option # # Signed-off-by: Patrick McHardy # # arch/sparc64/defconfig # 2004/11/27 12:20:13+01:00 kaber@coreworks.de +0 -1 # [NETFILTER]: Remove CONFIG_IP_NF_NAT_LOCAL config option # # Signed-off-by: Patrick McHardy # # arch/ppc64/defconfig # 2004/11/27 12:20:13+01:00 kaber@coreworks.de +0 -1 # [NETFILTER]: Remove CONFIG_IP_NF_NAT_LOCAL config option # # Signed-off-by: Patrick McHardy # # arch/ppc64/configs/pSeries_defconfig # 2004/11/27 12:20:13+01:00 kaber@coreworks.de +0 -1 # [NETFILTER]: Remove CONFIG_IP_NF_NAT_LOCAL config option # # Signed-off-by: Patrick McHardy # # arch/ppc64/configs/iSeries_defconfig # 2004/11/27 12:20:13+01:00 kaber@coreworks.de +0 -1 # [NETFILTER]: Remove CONFIG_IP_NF_NAT_LOCAL config option # # Signed-off-by: Patrick McHardy # # arch/ppc64/configs/g5_defconfig # 2004/11/27 12:20:13+01:00 kaber@coreworks.de +0 -1 # [NETFILTER]: Remove CONFIG_IP_NF_NAT_LOCAL config option # # Signed-off-by: Patrick McHardy # # arch/ppc/defconfig # 2004/11/27 12:20:13+01:00 kaber@coreworks.de +0 -1 # [NETFILTER]: Remove CONFIG_IP_NF_NAT_LOCAL config option # # Signed-off-by: Patrick McHardy # # arch/ppc/configs/pplus_defconfig # 2004/11/27 12:20:13+01:00 kaber@coreworks.de +0 -1 # [NETFILTER]: Remove CONFIG_IP_NF_NAT_LOCAL config option # # Signed-off-by: Patrick McHardy # # arch/ppc/configs/pmac_defconfig # 2004/11/27 12:20:13+01:00 kaber@coreworks.de +0 -1 # [NETFILTER]: Remove CONFIG_IP_NF_NAT_LOCAL config option # # Signed-off-by: Patrick McHardy # # arch/ppc/configs/pcore_defconfig # 2004/11/27 12:20:13+01:00 kaber@coreworks.de +0 -1 # [NETFILTER]: Remove CONFIG_IP_NF_NAT_LOCAL config option # # Signed-off-by: Patrick McHardy # # arch/ppc/configs/menf1_defconfig # 2004/11/27 12:20:13+01:00 kaber@coreworks.de +0 -1 # [NETFILTER]: Remove CONFIG_IP_NF_NAT_LOCAL config option # # Signed-off-by: Patrick McHardy # # arch/ppc/configs/k2_defconfig # 2004/11/27 12:20:13+01:00 kaber@coreworks.de +0 -1 # [NETFILTER]: Remove CONFIG_IP_NF_NAT_LOCAL config option # # Signed-off-by: Patrick McHardy # # arch/ppc/configs/ibmchrp_defconfig # 2004/11/27 12:20:13+01:00 kaber@coreworks.de +0 -1 # [NETFILTER]: Remove CONFIG_IP_NF_NAT_LOCAL config option # # Signed-off-by: Patrick McHardy # # arch/ppc/configs/common_defconfig # 2004/11/27 12:20:13+01:00 kaber@coreworks.de +0 -1 # [NETFILTER]: Remove CONFIG_IP_NF_NAT_LOCAL config option # # Signed-off-by: Patrick McHardy # # arch/ppc/configs/apus_defconfig # 2004/11/27 12:20:13+01:00 kaber@coreworks.de +0 -1 # [NETFILTER]: Remove CONFIG_IP_NF_NAT_LOCAL config option # # Signed-off-by: Patrick McHardy # # arch/ppc/configs/adir_defconfig # 2004/11/27 12:20:13+01:00 kaber@coreworks.de +0 -1 # [NETFILTER]: Remove CONFIG_IP_NF_NAT_LOCAL config option # # Signed-off-by: Patrick McHardy # # arch/parisc/configs/n4000_defconfig # 2004/11/27 12:20:13+01:00 kaber@coreworks.de +0 -1 # [NETFILTER]: Remove CONFIG_IP_NF_NAT_LOCAL config option # # Signed-off-by: Patrick McHardy # # arch/parisc/configs/c3000_defconfig # 2004/11/27 12:20:13+01:00 kaber@coreworks.de +0 -1 # [NETFILTER]: Remove CONFIG_IP_NF_NAT_LOCAL config option # # Signed-off-by: Patrick McHardy # # arch/parisc/configs/a500_defconfig # 2004/11/27 12:20:13+01:00 kaber@coreworks.de +0 -1 # [NETFILTER]: Remove CONFIG_IP_NF_NAT_LOCAL config option # # Signed-off-by: Patrick McHardy # # arch/mips/defconfig # 2004/11/27 12:20:13+01:00 kaber@coreworks.de +0 -1 # [NETFILTER]: Remove CONFIG_IP_NF_NAT_LOCAL config option # # Signed-off-by: Patrick McHardy # # arch/mips/configs/rm200_defconfig # 2004/11/27 12:20:13+01:00 kaber@coreworks.de +0 -1 # [NETFILTER]: Remove CONFIG_IP_NF_NAT_LOCAL config option # # Signed-off-by: Patrick McHardy # # arch/mips/configs/ip22_defconfig # 2004/11/27 12:20:13+01:00 kaber@coreworks.de +0 -1 # [NETFILTER]: Remove CONFIG_IP_NF_NAT_LOCAL config option # # Signed-off-by: Patrick McHardy # # arch/m68k/configs/sun3x_defconfig # 2004/11/27 12:20:13+01:00 kaber@coreworks.de +0 -1 # [NETFILTER]: Remove CONFIG_IP_NF_NAT_LOCAL config option # # Signed-off-by: Patrick McHardy # # arch/m68k/configs/sun3_defconfig # 2004/11/27 12:20:13+01:00 kaber@coreworks.de +0 -1 # [NETFILTER]: Remove CONFIG_IP_NF_NAT_LOCAL config option # # Signed-off-by: Patrick McHardy # # arch/m68k/configs/q40_defconfig # 2004/11/27 12:20:13+01:00 kaber@coreworks.de +0 -1 # [NETFILTER]: Remove CONFIG_IP_NF_NAT_LOCAL config option # # Signed-off-by: Patrick McHardy # # arch/m68k/configs/mvme16x_defconfig # 2004/11/27 12:20:13+01:00 kaber@coreworks.de +0 -1 # [NETFILTER]: Remove CONFIG_IP_NF_NAT_LOCAL config option # # Signed-off-by: Patrick McHardy # # arch/m68k/configs/mvme147_defconfig # 2004/11/27 12:20:13+01:00 kaber@coreworks.de +0 -1 # [NETFILTER]: Remove CONFIG_IP_NF_NAT_LOCAL config option # # Signed-off-by: Patrick McHardy # # arch/m68k/configs/mac_defconfig # 2004/11/27 12:20:13+01:00 kaber@coreworks.de +0 -1 # [NETFILTER]: Remove CONFIG_IP_NF_NAT_LOCAL config option # # Signed-off-by: Patrick McHardy # # arch/m68k/configs/hp300_defconfig # 2004/11/27 12:20:13+01:00 kaber@coreworks.de +0 -1 # [NETFILTER]: Remove CONFIG_IP_NF_NAT_LOCAL config option # # Signed-off-by: Patrick McHardy # # arch/m68k/configs/bvme6000_defconfig # 2004/11/27 12:20:13+01:00 kaber@coreworks.de +0 -1 # [NETFILTER]: Remove CONFIG_IP_NF_NAT_LOCAL config option # # Signed-off-by: Patrick McHardy # # arch/m68k/configs/atari_defconfig # 2004/11/27 12:20:13+01:00 kaber@coreworks.de +0 -1 # [NETFILTER]: Remove CONFIG_IP_NF_NAT_LOCAL config option # # Signed-off-by: Patrick McHardy # # arch/m68k/configs/apollo_defconfig # 2004/11/27 12:20:13+01:00 kaber@coreworks.de +0 -1 # [NETFILTER]: Remove CONFIG_IP_NF_NAT_LOCAL config option # # Signed-off-by: Patrick McHardy # # arch/m68k/configs/amiga_defconfig # 2004/11/27 12:20:13+01:00 kaber@coreworks.de +0 -1 # [NETFILTER]: Remove CONFIG_IP_NF_NAT_LOCAL config option # # Signed-off-by: Patrick McHardy # # arch/i386/defconfig # 2004/11/27 12:20:13+01:00 kaber@coreworks.de +0 -1 # [NETFILTER]: Remove CONFIG_IP_NF_NAT_LOCAL config option # # Signed-off-by: Patrick McHardy # # arch/arm/configs/ixp4xx_defconfig # 2004/11/27 12:20:13+01:00 kaber@coreworks.de +0 -1 # [NETFILTER]: Remove CONFIG_IP_NF_NAT_LOCAL config option # # Signed-off-by: Patrick McHardy # # arch/arm/configs/ebsa110_defconfig # 2004/11/27 12:20:12+01:00 kaber@coreworks.de +0 -1 # [NETFILTER]: Remove CONFIG_IP_NF_NAT_LOCAL config option # # Signed-off-by: Patrick McHardy # # arch/alpha/defconfig # 2004/11/27 12:20:12+01:00 kaber@coreworks.de +0 -1 # [NETFILTER]: Remove CONFIG_IP_NF_NAT_LOCAL config option # # Signed-off-by: Patrick McHardy # # ChangeSet # 2004/11/27 12:14:54+01:00 kaber@coreworks.de # [NETFILTER]: Release dst_entry in PRE_ROUTING after NAT # # Fixes NAT on loopback. # # Signed-off-by: Patrick McHardy # # net/ipv4/netfilter/ip_nat_standalone.c # 2004/11/27 12:14:47+01:00 kaber@coreworks.de +24 -1 # [NETFILTER]: Release dst_entry in PRE_ROUTING after NAT # # Fixes NAT on loopback. # # Signed-off-by: Patrick McHardy # # ChangeSet # 2004/11/26 11:50:43-06:00 bunk@stusta.de # [PATCH] remove bouncing email address of Deanna Bonds # # The patch below (applies against both 2.4 and 2.6) removes the bouncing # email address of Deanna Bonds (I didn't find a nmore recent address). # # Signed-off-by: Adrian Bunk # Signed-off-by: James Bottomley # # drivers/scsi/dpti.h # 2004/11/24 12:23:56-06:00 bunk@stusta.de +0 -1 # remove bouncing email address of Deanna Bonds # # drivers/scsi/dpt_i2o.c # 2004/11/24 12:24:37-06:00 bunk@stusta.de +0 -1 # remove bouncing email address of Deanna Bonds # # drivers/scsi/dpt/dpti_ioctl.h # 2004/11/24 12:24:27-06:00 bunk@stusta.de +0 -1 # remove bouncing email address of Deanna Bonds # # drivers/scsi/aacraid/README # 2004/11/24 12:24:16-06:00 bunk@stusta.de +1 -1 # remove bouncing email address of Deanna Bonds # # ChangeSet # 2004/11/26 11:47:06-06:00 bunk@stusta.de # [PATCH] SCSI aic7xxx_old.c: make a function static # # The patch below makes the needlessly global function aic7xxx_info # static. # # Signed-off-by: Adrian Bunk # Signed-off-by: James Bottomley # # drivers/scsi/aic7xxx_old/aic7xxx_proc.c # 2004/11/13 10:16:45-06:00 bunk@stusta.de +1 -1 # SCSI aic7xxx_old.c: make a function static # # drivers/scsi/aic7xxx_old.c # 2004/11/13 10:16:12-06:00 bunk@stusta.de +1 -1 # SCSI aic7xxx_old.c: make a function static # # ChangeSet # 2004/11/26 11:45:27-06:00 jejb@mulgrave.(none) # LSI Logic - SAS and FC PCI ID's # # From: Moore, Eric Dean # # Here are new PCI ID's for SAS and Fibre Channel # LSI Logic controllers. # # Signed-off-by: Eric Moore # Signed-off-by: James Bottomley # # include/linux/pci_ids.h # 2004/11/26 11:44:15-06:00 jejb@mulgrave.(none) +10 -0 # LSI Logic - SAS and FC PCI ID's # # ChangeSet # 2004/11/26 11:33:06-06:00 jejb@mulgrave.(none) # fixup dynamic scan aids EXPORT_SYMBOL mismerge # # OK, so I exported the wrong symbols ... # # Signed-off-by: James Bottomley # # drivers/scsi/scsi_scan.c # 2004/11/26 11:31:38-06:00 jejb@mulgrave.(none) +2 -1 # fixup dynamic scan aids EXPORT_SYMBOL mismerge # # ChangeSet # 2004/11/26 10:16:03-06:00 jejb@mulgrave.(none) # scsi: LLDD dynamic scan aids # # From: James.Smart@Emulex.Com # # With rejection fixes around the removal of scsi_syms.c # Signed-off-by: James Bottomley # # include/scsi/scsi_host.h # 2004/11/26 10:15:26-06:00 jejb@mulgrave.(none) +3 -0 # scsi: LLDD dynamic scan aids # # drivers/scsi/scsi_scan.c # 2004/11/26 10:15:26-06:00 jejb@mulgrave.(none) +13 -0 # scsi: LLDD dynamic scan aids # # ChangeSet # 2004/11/26 10:10:46-06:00 axboe@suse.de # [PATCH] kill locking around scsi_done() # # Lets show the mid layer as a good example and remove the host lock # around the scsi_done() call. # # Signed-off-by: Jens Axboe # Signed-off-by: James Bottomley # # ===== drivers/scsi/scsi.c 1.148 vs edited ===== # # drivers/scsi/scsi.c # 2004/11/20 16:25:38-06:00 axboe@suse.de +0 -2 # kill locking around scsi_done() # # ChangeSet # 2004/11/26 10:07:03-06:00 bunk@stusta.de # [PATCH] kill scsi_syms.c # # The patch below removes scsi_syms.c and moves the EXPORT_SYMBOL's to the # files where the actual functions are. # # Signed-off-by: Adrian Bunk # Signed-off-by: James Bottomley # # drivers/scsi/scsicam.c # 2004/11/20 14:31:54-06:00 bunk@stusta.de +3 -0 # kill scsi_syms.c # # drivers/scsi/scsi_sysfs.c # 2004/11/20 14:44:12-06:00 bunk@stusta.de +3 -0 # kill scsi_syms.c # # drivers/scsi/scsi_scan.c # 2004/11/20 14:43:37-06:00 bunk@stusta.de +5 -0 # kill scsi_syms.c # # drivers/scsi/scsi_lib.c # 2004/11/20 14:46:26-06:00 bunk@stusta.de +9 -1 # kill scsi_syms.c # # drivers/scsi/scsi_ioctl.c # 2004/11/20 14:36:32-06:00 bunk@stusta.de +3 -0 # kill scsi_syms.c # # drivers/scsi/scsi_error.c # 2004/11/20 14:46:48-06:00 bunk@stusta.de +6 -0 # kill scsi_syms.c # # drivers/scsi/scsi.c # 2004/11/20 14:46:12-06:00 bunk@stusta.de +11 -0 # kill scsi_syms.c # # drivers/scsi/hosts.c # 2004/11/20 14:30:51-06:00 bunk@stusta.de +8 -0 # kill scsi_syms.c # # drivers/scsi/constants.c # 2004/11/20 14:35:16-06:00 bunk@stusta.de +9 -0 # kill scsi_syms.c # # drivers/scsi/Makefile # 2004/11/20 14:26:17-06:00 bunk@stusta.de +1 -1 # kill scsi_syms.c # # Documentation/scsi/scsi_mid_low_api.txt # 2004/11/20 14:25:56-06:00 bunk@stusta.de +2 -2 # kill scsi_syms.c # # BitKeeper/deleted/.del-scsi_syms.c~8c75b2d48ed73d87 # 2004/11/26 10:06:12-06:00 bunk@stusta.de +0 -0 # Delete: drivers/scsi/scsi_syms.c # # ChangeSet # 2004/11/25 12:07:52-06:00 jejb@mulgrave.(none) # convert eata to pass pointers around # # From: Christoph Hellwig # # pass pointers to Scsi_Host and the private data around instead of using # indices into global arrays all over the place. # # Signed-off-by: James Bottomley # # drivers/scsi/eata.c # 2004/11/25 12:05:43-06:00 jejb@mulgrave.(none) +291 -298 # convert eata to pass pointers around # # ChangeSet # 2004/11/25 11:54:54-06:00 hch@lst.de # [PATCH] feed eata.c through Lindent # # the driver oopses on load for me currently, but to debug it I need to # actually be able to read the source.. # # Signed-off-by: James Bottomley # # drivers/scsi/eata.c # 2004/11/02 07:28:36-06:00 hch@lst.de +1770 -1568 # feed eata.c through Lindent # # ChangeSet # 2004/11/25 11:08:32-06:00 jejb@mulgrave.(none) # Merge ssh://linux-scsi@linux-scsi.bkbits.net/scsi-misc-2.6 # into mulgrave.(none):/home/jejb/BK/scsi-misc-2.6 # # drivers/scsi/hosts.c # 2004/11/25 11:08:25-06:00 jejb@mulgrave.(none) +0 -0 # Auto merged # # drivers/scsi/Kconfig # 2004/11/25 11:08:25-06:00 jejb@mulgrave.(none) +0 -0 # Auto merged # # ChangeSet # 2004/11/24 00:04:10-08:00 lcapitulino@conectiva.com.br # [NET]: __sock_create() cleanup # # The 'i' variable in net/socket.c::__sock_create() is not necessary. It's # have been used to store error codes but there is an 'err' variable already. # # Signed-off-by: Luiz Capitulino # Signed-off-by: Andrew Morton # Signed-off-by: David S. Miller # # net/socket.c # 2004/11/24 00:03:51-08:00 lcapitulino@conectiva.com.br +6 -8 # [NET]: __sock_create() cleanup # # The 'i' variable in net/socket.c::__sock_create() is not necessary. It's # have been used to store error codes but there is an 'err' variable already. # # Signed-off-by: Luiz Capitulino # Signed-off-by: Andrew Morton # Signed-off-by: David S. Miller # # ChangeSet # 2004/11/23 23:57:00-08:00 ahendry@tusc.com.au # [X25]: Remove unused header files. # # Signed-off-by: Andrew Hendry # Signed-off-by: Andrew Morton # Signed-off-by: David S. Miller # # net/x25/x25_timer.c # 2004/11/23 23:56:41-08:00 ahendry@tusc.com.au +0 -14 # [X25]: Remove unused header files. # # Signed-off-by: Andrew Hendry # Signed-off-by: Andrew Morton # Signed-off-by: David S. Miller # # net/x25/x25_subr.c # 2004/11/23 23:56:41-08:00 ahendry@tusc.com.au +0 -14 # [X25]: Remove unused header files. # # Signed-off-by: Andrew Hendry # Signed-off-by: Andrew Morton # Signed-off-by: David S. Miller # # net/x25/x25_out.c # 2004/11/23 23:56:41-08:00 ahendry@tusc.com.au +0 -13 # [X25]: Remove unused header files. # # Signed-off-by: Andrew Hendry # Signed-off-by: Andrew Morton # Signed-off-by: David S. Miller # # net/x25/x25_link.c # 2004/11/23 23:56:41-08:00 ahendry@tusc.com.au +0 -13 # [X25]: Remove unused header files. # # Signed-off-by: Andrew Hendry # Signed-off-by: Andrew Morton # Signed-off-by: David S. Miller # # net/x25/x25_in.c # 2004/11/23 23:56:41-08:00 ahendry@tusc.com.au +0 -14 # [X25]: Remove unused header files. # # Signed-off-by: Andrew Hendry # Signed-off-by: Andrew Morton # Signed-off-by: David S. Miller # # net/x25/x25_facilities.c # 2004/11/23 23:56:41-08:00 ahendry@tusc.com.au +0 -14 # [X25]: Remove unused header files. # # Signed-off-by: Andrew Hendry # Signed-off-by: Andrew Morton # Signed-off-by: David S. Miller # # net/x25/x25_dev.c # 2004/11/23 23:56:41-08:00 ahendry@tusc.com.au +0 -19 # [X25]: Remove unused header files. # # Signed-off-by: Andrew Hendry # Signed-off-by: Andrew Morton # Signed-off-by: David S. Miller # # net/x25/sysctl_net_x25.c # 2004/11/23 23:56:41-08:00 ahendry@tusc.com.au +0 -1 # [X25]: Remove unused header files. # # Signed-off-by: Andrew Hendry # Signed-off-by: Andrew Morton # Signed-off-by: David S. Miller # # net/x25/af_x25.c # 2004/11/23 23:56:41-08:00 ahendry@tusc.com.au +0 -9 # [X25]: Remove unused header files. # # Signed-off-by: Andrew Hendry # Signed-off-by: Andrew Morton # Signed-off-by: David S. Miller # # ChangeSet # 2004/11/23 23:56:04-08:00 ahendry@tusc.com.au # [X25]: When receiving a call, check listening sockets for matching call user data. # # If a listening socket sets call user data, ensure it only receives calls # with matching call user data. Also ensure incoming calls with matching # call user data dont go to another listening socket. # # Signed-off-by: Andrew Hendry # Signed-off-by: Andrew Morton # Signed-off-by: David S. Miller # # net/x25/x25_subr.c # 2004/11/23 23:55:45-08:00 ahendry@tusc.com.au +19 -0 # [X25]: When receiving a call, check listening sockets for matching call user data. # # If a listening socket sets call user data, ensure it only receives calls # with matching call user data. Also ensure incoming calls with matching # call user data dont go to another listening socket. # # Signed-off-by: Andrew Hendry # Signed-off-by: Andrew Morton # Signed-off-by: David S. Miller # # net/x25/af_x25.c # 2004/11/23 23:55:45-08:00 ahendry@tusc.com.au +47 -15 # [X25]: When receiving a call, check listening sockets for matching call user data. # # If a listening socket sets call user data, ensure it only receives calls # with matching call user data. Also ensure incoming calls with matching # call user data dont go to another listening socket. # # Signed-off-by: Andrew Hendry # Signed-off-by: Andrew Morton # Signed-off-by: David S. Miller # # include/net/x25.h # 2004/11/23 23:55:45-08:00 ahendry@tusc.com.au +1 -0 # [X25]: When receiving a call, check listening sockets for matching call user data. # # If a listening socket sets call user data, ensure it only receives calls # with matching call user data. Also ensure incoming calls with matching # call user data dont go to another listening socket. # # Signed-off-by: Andrew Hendry # Signed-off-by: Andrew Morton # Signed-off-by: David S. Miller # # ChangeSet # 2004/11/23 23:54:43-08:00 simlo@phys.au.dk # [ARCNET]: Fixes. # # As previously reported the ArcNet driver didn't work with Preempt and SMB # on. They do now. I have changed the locking system from being a global # arcnet lock to being a lock per device. I used the lock in # dev->hard_start_xmit = arcnet_send_packet. # # Furthermore I added the 'CAP mode' encapsulation. As far as I see it it is # the only encapsulation which actually makes ArcNet usefull over ethernet. # Previously, the driver just ignored the hardware transmit status, now you # can get hardware acknowledge and excessive nacks back to userspace via a # raw socket. The capmode.c is nearly just a copy of arc-rawmode.c. The # difference is that it inserts a ack_tx() handle into the general driver # framework. # # Signed-off-by: Andrew Morton # Signed-off-by: David S. Miller # # include/linux/if_ether.h # 2004/11/23 23:53:52-08:00 simlo@phys.au.dk +1 -0 # [ARCNET]: Fixes. # # include/linux/if_arcnet.h # 2004/11/23 23:53:52-08:00 simlo@phys.au.dk +14 -0 # [ARCNET]: Fixes. # # include/linux/com20020.h # 2004/11/23 23:53:52-08:00 simlo@phys.au.dk +19 -11 # [ARCNET]: Fixes. # # include/linux/arcdevice.h # 2004/11/23 23:53:52-08:00 simlo@phys.au.dk +17 -4 # [ARCNET]: Fixes. # # drivers/net/arcnet/rfc1201.c # 2004/11/23 23:53:52-08:00 simlo@phys.au.dk +2 -0 # [ARCNET]: Fixes. # # drivers/net/arcnet/rfc1051.c # 2004/11/23 23:53:52-08:00 simlo@phys.au.dk +3 -0 # [ARCNET]: Fixes. # # drivers/net/arcnet/com20020.c # 2004/11/23 23:53:52-08:00 simlo@phys.au.dk +19 -9 # [ARCNET]: Fixes. # # drivers/net/arcnet/com20020-isa.c # 2004/11/23 23:53:52-08:00 simlo@phys.au.dk +0 -1 # [ARCNET]: Fixes. # # drivers/net/arcnet/arcnet.c # 2004/11/23 23:53:52-08:00 simlo@phys.au.dk +176 -77 # [ARCNET]: Fixes. # # drivers/net/arcnet/arc-rawmode.c # 2004/11/23 23:53:52-08:00 simlo@phys.au.dk +7 -2 # [ARCNET]: Fixes. # # drivers/net/arcnet/Makefile # 2004/11/23 23:53:52-08:00 simlo@phys.au.dk +1 -0 # [ARCNET]: Fixes. # # drivers/net/arcnet/Kconfig # 2004/11/23 23:53:52-08:00 simlo@phys.au.dk +19 -0 # [ARCNET]: Fixes. # # drivers/net/arcnet/capmode.c # 2004/11/23 23:53:48-08:00 simlo@phys.au.dk +296 -0 # [ARCNET]: Fixes. # # drivers/net/arcnet/capmode.c # 2004/11/23 23:53:48-08:00 simlo@phys.au.dk +0 -0 # BitKeeper file /disk1/BK/net-2.6.11/drivers/net/arcnet/capmode.c # # ChangeSet # 2004/11/23 23:52:02-08:00 acme@conectiva.com.br # [XFRM]: Export xfrm_policy_delete() # # Will be needed for DCCP. # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/xfrm/xfrm_policy.c # 2004/11/23 23:51:43-08:00 acme@conectiva.com.br +2 -0 # [XFRM]: Export xfrm_policy_delete() # # Will be needed for DCCP. # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # ChangeSet # 2004/11/23 23:50:00-08:00 kaber@trash.net # [PKT_SCHED]: Clean up tcf_action_init memory handling # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # net/sched/act_api.c # 2004/11/23 23:49:41-08:00 kaber@trash.net +47 -57 # [PKT_SCHED]: Clean up tcf_action_init memory handling # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # include/net/pkt_cls.h # 2004/11/23 23:49:41-08:00 kaber@trash.net +6 -20 # [PKT_SCHED]: Clean up tcf_action_init memory handling # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # include/net/act_api.h # 2004/11/23 23:49:41-08:00 kaber@trash.net +2 -2 # [PKT_SCHED]: Clean up tcf_action_init memory handling # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # ChangeSet # 2004/11/23 23:47:34-08:00 bdschuym@pandora.be # [EBTABLES]: Add userspace logging via netlink socket. # # The patch below adds the ebtables ulog watcher, that sends packets # to userspace. It is based on ipt_ULOG.c. # # The complete packet, including Ethernet header, is sent to userspace. # The in and out bridge ports are also sent to userspace. Logging is # of course not restricted to IP packets. # An example of a userspace program that receives and parses packets # sent by the ulog watcher is in the ebtables CVS tree under # examples/ulog/ # # Signed-off-by: Bart De Schuymer # Signed-off-by: David S. Miller # # net/bridge/netfilter/ebtables.c # 2004/11/23 23:46:46-08:00 bdschuym@pandora.be +3 -3 # [EBTABLES]: Add userspace logging via netlink socket. # # net/bridge/netfilter/ebt_log.c # 2004/11/23 23:46:46-08:00 bdschuym@pandora.be +3 -2 # [EBTABLES]: Add userspace logging via netlink socket. # # net/bridge/netfilter/Makefile # 2004/11/23 23:46:46-08:00 bdschuym@pandora.be +1 -0 # [EBTABLES]: Add userspace logging via netlink socket. # # net/bridge/netfilter/Kconfig # 2004/11/23 23:46:46-08:00 bdschuym@pandora.be +16 -2 # [EBTABLES]: Add userspace logging via netlink socket. # # include/linux/netfilter_bridge/ebtables.h # 2004/11/23 23:46:46-08:00 bdschuym@pandora.be +3 -3 # [EBTABLES]: Add userspace logging via netlink socket. # # net/bridge/netfilter/ebt_ulog.c # 2004/11/23 23:46:41-08:00 bdschuym@pandora.be +295 -0 # [EBTABLES]: Add userspace logging via netlink socket. # # net/bridge/netfilter/ebt_ulog.c # 2004/11/23 23:46:41-08:00 bdschuym@pandora.be +0 -0 # BitKeeper file /disk1/BK/net-2.6.11/net/bridge/netfilter/ebt_ulog.c # # include/linux/netfilter_bridge/ebt_ulog.h # 2004/11/23 23:46:38-08:00 bdschuym@pandora.be +36 -0 # [EBTABLES]: Add userspace logging via netlink socket. # # include/linux/netfilter_bridge/ebt_ulog.h # 2004/11/23 23:46:38-08:00 bdschuym@pandora.be +0 -0 # BitKeeper file /disk1/BK/net-2.6.11/include/linux/netfilter_bridge/ebt_ulog.h # # ChangeSet # 2004/11/23 18:52:13+11:00 airlied@starflyer.(none) # drm: move the enable device before filling in device info # # This moves the pci_enable_device to before the device info is # filled out as without routeirq this goes wrong.. # # Thanks to Ralf Gerbig for testing this. # # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_stub.c # 2004/11/23 18:52:04+11:00 airlied@starflyer.(none) +3 -1 # drm: move the enable device before filling in device info # # This moves the pci_enable_device to before the device info is # filled out as without routeirq this goes wrong.. # # Thanks to Ralf Gerbig for testing this. # # Signed-off-by: Dave Airlie # # ChangeSet # 2004/11/18 14:13:50-08:00 hch@lst.de # [NET]: Use local_softirq_pending instead of softirq_pending in netif_rx_ni # # Some architectures can optimize local_softirq_pending much better than # softirq_pending(smp_processor_id()), and for all others the former is # just a macro expanding to the later. # # Also this is the last use of softirq_pending() in common code, once this # is in we can soon kill the notation of beeing able to query other cpus # softirq pending count. # # Signed-off-by: David S. Miller # # net/core/dev.c # 2004/11/18 14:13:32-08:00 hch@lst.de +1 -1 # [NET]: Use local_softirq_pending instead of softirq_pending in netif_rx_ni # # Some architectures can optimize local_softirq_pending much better than # softirq_pending(smp_processor_id()), and for all others the former is # just a macro expanding to the later. # # Also this is the last use of softirq_pending() in common code, once this # is in we can soon kill the notation of beeing able to query other cpus # softirq pending count. # # Signed-off-by: David S. Miller # # ChangeSet # 2004/11/18 14:12:39-08:00 hch@lst.de # [NET]: Kill drivers/net/net_init.c # # After the last patch only three routines are left in this file, but all # of the fir into net/core/dev.c much better: # # - {un,}register_netdev are just wrappers around {un,}register_netdevice # from dev.c # - alloc_netdev's counterpart, free_netdev is in dev.c aswell. # # So move over the remaining contents and add some kerneldoc comments # describing the functions. # # Signed-off-by: David S. Miller # # net/core/dev.c # 2004/11/18 14:12:03-08:00 hch@lst.de +108 -4 # [NET]: Kill drivers/net/net_init.c # # drivers/net/Makefile # 2004/11/18 14:12:03-08:00 hch@lst.de +1 -1 # [NET]: Kill drivers/net/net_init.c # # BitKeeper/deleted/.del-net_init.c~818a1a4060953d02 # 2004/11/18 14:11:43-08:00 davem@nuts.davemloft.net +0 -0 # Delete: drivers/net/net_init.c # # ChangeSet # 2004/11/18 14:03:59-08:00 Ian.Pratt@cl.cam.ac.uk # [NET]: Add alloc_skb_from_cache. # # This serves two purposes: firstly, we like to allocate page-sized skbs # as this means we zero-copy transfer of network buffers between guest # operating systems. Secondly, it enables us to have a cache of pages # that have been used for network buffers that we can be more lax about # scrubbing when they change VM ownership (since they could be sniffed on # the wire). # # Signed-off-by: David S. Miller # # net/core/skbuff.c # 2004/11/18 14:02:13-08:00 Ian.Pratt@cl.cam.ac.uk +53 -0 # [NET]: Add alloc_skb_from_cache. # # include/linux/skbuff.h # 2004/11/18 14:02:13-08:00 Ian.Pratt@cl.cam.ac.uk +6 -0 # [NET]: Add alloc_skb_from_cache. # # ChangeSet # 2004/11/17 16:08:01-08:00 util@deuroconsult.ro # [PKT_SCHED]: Allow using nfmark as key in U32 classifier. # # Signed-off-by: Catalin(ux aka Dino) BOIE # Signed-off-by: David S. Miller # # net/sched/cls_u32.c # 2004/11/17 16:07:25-08:00 util@deuroconsult.ro +39 -0 # [PKT_SCHED]: Allow using nfmark as key in U32 classifier. # # Signed-off-by: Catalin(ux aka Dino) BOIE # Signed-off-by: David S. Miller # # net/sched/Kconfig # 2004/11/17 16:07:25-08:00 util@deuroconsult.ro +12 -0 # [PKT_SCHED]: Allow using nfmark as key in U32 classifier. # # Signed-off-by: Catalin(ux aka Dino) BOIE # Signed-off-by: David S. Miller # # include/linux/pkt_cls.h # 2004/11/17 16:07:25-08:00 util@deuroconsult.ro +1 -0 # [PKT_SCHED]: Allow using nfmark as key in U32 classifier. # # Signed-off-by: Catalin(ux aka Dino) BOIE # Signed-off-by: David S. Miller # # ChangeSet # 2004/11/17 10:34:09-06:00 akpm@osdl.org # [PATCH] iscsi_transport build fix # # drivers/scsi/scsi_transport_iscsi.c:176: structure has no member named `sin6_addr' # # Older gcc's dont support anonymous unions. # # Signed-off-by: Andrew Morton # Signed-off-by: James Bottomley # # include/scsi/scsi_transport_iscsi.h # 2004/11/17 03:55:50-06:00 akpm@osdl.org +3 -3 # iscsi_transport build fix # # ChangeSet # 2004/11/16 16:05:58-06:00 jejb@mulgrave.(none) # SCSI: Add missing state transition BLOCK->OFFLINE # # From: James.Smart@Emulex.Com # # Signed-off-by: James Bottomley # # drivers/scsi/scsi_lib.c # 2004/11/16 16:05:38-06:00 jejb@mulgrave.(none) +1 -0 # SCSI: Add missing state transition BLOCK->OFFLINE # # ChangeSet # 2004/11/16 16:01:31-06:00 dougg@torque.net # SCSI: descriptor sense format, mid-level # # - generalize sense data logic to cope with both fixed and # descriptor format # - use KERN_INFO on most printk()s to limit console noise # - retire mid-level usage of sense_class(), sense_error() and # sense_valid() macros which are SCSI-1 remnants. Now only # cpqfcTSinit.c seems to use them # # Signed-off-by: James Bottomley # # drivers/scsi/scsi_scan.c # 2004/11/08 02:33:25-06:00 dougg@torque.net +21 -12 # descriptor sense format, mid-level # # drivers/scsi/scsi_lib.c # 2004/11/08 01:14:41-06:00 dougg@torque.net +16 -12 # descriptor sense format, mid-level # # drivers/scsi/scsi_ioctl.c # 2004/11/08 04:56:44-06:00 dougg@torque.net +18 -12 # descriptor sense format, mid-level # # drivers/scsi/scsi_error.c # 2004/11/08 00:43:52-06:00 dougg@torque.net +35 -12 # descriptor sense format, mid-level # # ChangeSet # 2004/11/16 15:23:21-06:00 michaelc@cs.wisc.edu # [PATCH] iSCSI transport class # # The attached patch adds an iSCSI transport class. It was # built against scsi-misc-2.6. It allows the software/virtual # iSCSI driver to remove at least one of its ioctl commands. # The patch also assumes the no multipath/failover rule in # llds applies to iSCSI drivers, so when we remove our # portal/portal_group failover support it will allow us to # kill all our ioctl commands execpt the session creation one # (that will take more thought). # # We would like to build some functions like the # unblock/block capabilites into the iscsi transport class # like James Smart has done with FC class. but initially we # would like to begin with this smaller patch that only provides # an iscsi sysfs interface. # # Signed-off-by: James Bottomley # # include/scsi/scsi_transport_iscsi.h # 2004/10/29 05:55:13-05:00 michaelc@cs.wisc.edu +178 -0 # iSCSI transport class # # include/scsi/scsi_transport_iscsi.h # 2004/10/29 05:55:13-05:00 michaelc@cs.wisc.edu +0 -0 # BitKeeper file /home/jejb/BK/scsi-misc-2.6/include/scsi/scsi_transport_iscsi.h # # drivers/scsi/scsi_transport_iscsi.c # 2004/10/29 06:30:20-05:00 michaelc@cs.wisc.edu +355 -0 # iSCSI transport class # # drivers/scsi/Makefile # 2004/10/28 22:57:11-05:00 michaelc@cs.wisc.edu +1 -1 # iSCSI transport class # # drivers/scsi/Kconfig # 2004/10/28 22:57:11-05:00 michaelc@cs.wisc.edu +8 -0 # iSCSI transport class # # drivers/scsi/scsi_transport_iscsi.c # 2004/10/29 06:30:20-05:00 michaelc@cs.wisc.edu +0 -0 # BitKeeper file /home/jejb/BK/scsi-misc-2.6/drivers/scsi/scsi_transport_iscsi.c # # ChangeSet # 2004/11/16 13:49:34-06:00 jejb@mulgrave.(none) # SCSI: Add transport destructors # # From: James.Smart@Emulex.Com # # This patch adds host/target/sdev destructor functions to the transport # template. The FC transport is updated to utilize them to cancel any # outstanding timer. It slightly rearranges the slave_xxx functions so # the transport is always involved prior to the LLDD. # # Minor rejection fixes and # Signed-off-by: James Bottomley # # include/scsi/scsi_transport.h # 2004/11/16 13:48:01-06:00 jejb@mulgrave.(none) +5 -0 # SCSI: Add transport destructors # # drivers/scsi/scsi_transport_fc.c # 2004/11/16 13:48:01-06:00 jejb@mulgrave.(none) +16 -0 # SCSI: Add transport destructors # # drivers/scsi/scsi_sysfs.c # 2004/11/16 13:48:01-06:00 jejb@mulgrave.(none) +5 -0 # SCSI: Add transport destructors # # drivers/scsi/scsi_scan.c # 2004/11/16 13:48:01-06:00 jejb@mulgrave.(none) +13 -6 # SCSI: Add transport destructors # # drivers/scsi/hosts.c # 2004/11/16 13:48:01-06:00 jejb@mulgrave.(none) +6 -1 # SCSI: Add transport destructors # # ChangeSet # 2004/11/16 13:42:53-06:00 jejb@mulgrave.(none) # SCSI: updates to constants.c # # From: Douglas Gilbert # # - bring opcode names, asc/ascq strings and sense format # into line with SPC-3 rev 21 (22 September 2004) # - drop SCSI-1 sense buffer decoding [still output it in hex] # - opcode names include those that depend on service actions # including variable length commands ** # - decodes both fixed and descriptor sense data formats # - use KERN_INFO on printk()s that start on new lines # - flag vendor specific asc and acsq codes # - print all bytes of a cdb after the name (previously skipped # the first byte) # - cleanup file, tab to 8 spaces # # Signed-off-by: James Bottomley # # drivers/scsi/constants.c # 2004/11/16 13:41:26-06:00 jejb@mulgrave.(none) +578 -339 # SCSI: updates to constants.c # # ChangeSet # 2004/11/16 13:29:04-06:00 jejb@mulgrave.(none) # update the fc_transport_class to use a workqueue instead of a timeout # # The amount of work that has to be done in the timeout routines is really # a bit much if there's a large number of LUNS. Plus the # device_for_each_child needs user context to get the bus semaphore, so # the solution is to migrate them from a timer to delayed work. # # There's still a race here in that the timer may still be ticking when # the device is destroyed ... To fix this, I think we may need to # introduce a destroy callback to the transport class. # # Signed-off-by: James Bottomley # # include/scsi/scsi_transport_fc.h # 2004/11/16 13:26:54-06:00 jejb@mulgrave.(none) +6 -6 # update the fc_transport_class to use a workqueue instead of a timeout # # drivers/scsi/scsi_transport_fc.c # 2004/11/16 13:26:54-06:00 jejb@mulgrave.(none) +17 -17 # update the fc_transport_class to use a workqueue instead of a timeout # # ChangeSet # 2004/11/16 02:17:36-05:00 jgarzik@pobox.com # [libata sata_uli] add 5281 support, fix SATA phy setup for others # # Contributed by Peer Chen @ ULi and tested by a user. # # drivers/scsi/sata_uli.c # 2004/11/16 02:17:30-05:00 jgarzik@pobox.com +23 -28 # [libata sata_uli] add 5281 support, fix SATA phy setup for others # # Contributed by Peer Chen @ ULi and tested by a user. # # ChangeSet # 2004/11/14 22:20:03-05:00 jgarzik@pobox.com # [sound/oss] use module_param() in soundcard.c and uart401.c # # ChangeSet # 2004/11/14 22:19:16-05:00 jgarzik@pobox.com # [sound/oss i810_audio] use module_param() # # Also, set MODULE_AUTHOR and correct module name in a macro. # # ChangeSet # 2004/11/14 18:33:29-05:00 webvenza@libero.it # [PATCH] convert sis900 to new style parameters # # Signed-off-by: Jeff Garzik # # ChangeSet # 2004/11/14 19:16:42-05:00 ralf@linux-mips.org # [PATCH] Another big 6pack patch # # Below another 6pack patch which I've got sitting in my repository for a # while already. The patch does: # # o Update my callsign # o Cleanup the internal for synchronization with a 6pack TNC a little bit # so it won't result in heaps and piles of messages in syslogs as it used # to do. # o Does paranoia checks for the maximum allowable packet size on transmit. # There was a slight chance this might have resulted in a crash in just # the right configuration. # o Verifies the address family for the SIOCSIFHWADDR network interface # ioctl. # o Tries to do proper locking so nothing will access dev->dev_addr in # midflight while changing the layer 2 address. # o Uses an intermediate buffer for the SIOCSIFHWADDR ioctl so an error in # copy_from_user can't result in a half-modified MAC address. # o Swaps the arguments of decode_prio_command, decode_std_command and # decode_data such that for consistency the struct sixpack pointer will be # the first argument like everywhere else. # # Signed-off-by: Jeff Garzik # # ChangeSet # 2004/11/14 18:29:10-05:00 jgarzik@pobox.com # Merge pobox.com:/garz/repo/linux-2.6 # into pobox.com:/garz/repo/netdev-2.6/misc # # sound/oss/uart401.c # 2004/11/14 22:19:57-05:00 jgarzik@pobox.com +4 -4 # [sound/oss] use module_param() in soundcard.c and uart401.c # # sound/oss/soundcard.c # 2004/11/14 22:19:57-05:00 jgarzik@pobox.com +2 -2 # [sound/oss] use module_param() in soundcard.c and uart401.c # # sound/oss/i810_audio.c # 2004/11/14 22:19:11-05:00 jgarzik@pobox.com +6 -6 # [sound/oss i810_audio] use module_param() # # Also, set MODULE_AUTHOR and correct module name in a macro. # # drivers/net/hamradio/6pack.c # 2004/11/02 13:51:05-05:00 ralf@linux-mips.org +179 -191 # Another big 6pack patch # # drivers/net/sis900.c # 2004/11/12 10:33:20-05:00 webvenza@libero.it +4 -3 # convert sis900 to new style parameters # # drivers/net/Kconfig # 2004/11/14 18:29:06-05:00 jgarzik@pobox.com +0 -0 # Auto merged # # ChangeSet # 2004/11/11 22:23:44+11:00 airlied@starflyer.(none) # drm: in-correct locking in intel drms # # The locking in the intel drms is incorrect it doesn't check # the current context owns the lock, just that someone does. # This could allow strange things to happen with multiple clients. # # From: Stefan Dirsch # Approved-by: Dave Airlie # # drivers/char/drm/i915_irq.c # 2004/11/11 22:23:34+11:00 airlied@starflyer.(none) +1 -4 # drm: in-correct locking in intel drms # # The locking in the intel drms is incorrect it doesn't check # the current context owns the lock, just that someone does. # This could allow strange things to happen with multiple clients. # # From: Stefan Dirsch # Approved-by: Dave Airlie # # drivers/char/drm/i915_dma.c # 2004/11/11 22:23:34+11:00 airlied@starflyer.(none) +5 -16 # drm: in-correct locking in intel drms # # The locking in the intel drms is incorrect it doesn't check # the current context owns the lock, just that someone does. # This could allow strange things to happen with multiple clients. # # From: Stefan Dirsch # Approved-by: Dave Airlie # # drivers/char/drm/i830_irq.c # 2004/11/11 22:23:34+11:00 airlied@starflyer.(none) +1 -4 # drm: in-correct locking in intel drms # # The locking in the intel drms is incorrect it doesn't check # the current context owns the lock, just that someone does. # This could allow strange things to happen with multiple clients. # # From: Stefan Dirsch # Approved-by: Dave Airlie # # drivers/char/drm/i830_dma.c # 2004/11/11 22:23:34+11:00 airlied@starflyer.(none) +6 -24 # drm: in-correct locking in intel drms # # The locking in the intel drms is incorrect it doesn't check # the current context owns the lock, just that someone does. # This could allow strange things to happen with multiple clients. # # From: Stefan Dirsch # Approved-by: Dave Airlie # # drivers/char/drm/i810_dma.c # 2004/11/11 22:23:34+11:00 airlied@starflyer.(none) +10 -37 # drm: in-correct locking in intel drms # # The locking in the intel drms is incorrect it doesn't check # the current context owns the lock, just that someone does. # This could allow strange things to happen with multiple clients. # # From: Stefan Dirsch # Approved-by: Dave Airlie # # ChangeSet # 2004/11/11 21:52:12+11:00 airlied@starflyer.(none) # drm: remove use of drm_agp use agp backend directly. # # This removes the inter module stuff between the DRM and AGP. # # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_drv.c # 2004/11/11 21:52:02+11:00 airlied@starflyer.(none) +0 -1 # drm: remove use of drm_agp use agp backend directly. # # This removes the inter module stuff between the DRM and AGP. # # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_agpsupport.c # 2004/11/11 21:52:02+11:00 airlied@starflyer.(none) +37 -66 # drm: remove use of drm_agp use agp backend directly. # # This removes the inter module stuff between the DRM and AGP. # # Signed-off-by: Dave Airlie # # drivers/char/drm/drmP.h # 2004/11/11 21:52:02+11:00 airlied@starflyer.(none) +0 -1 # drm: remove use of drm_agp use agp backend directly. # # This removes the inter module stuff between the DRM and AGP. # # Signed-off-by: Dave Airlie # # ChangeSet # 2004/11/11 21:15:33+11:00 airlied@starflyer.(none) # drm: fix Kconfig dependency # # fixup DRM/AGP Kconfig inter-dependency... # # From: Roman Zippel # Signed-off-by: Dave Airlie # # drivers/char/drm/Kconfig # 2004/11/11 21:15:23+11:00 airlied@starflyer.(none) +1 -0 # drm: fix Kconfig dependency # # fixup DRM/AGP Kconfig inter-dependency... # # From: Roman Zippel # Signed-off-by: Dave Airlie # # ChangeSet # 2004/11/11 20:53:06+11:00 airlied@starflyer.(none) # drm: fix warning for missing vunmap # # In file included from drivers/char/drm/drmP.h:795, # from drivers/char/drm/drm_dma.c:36: # drivers/char/drm/drm_memory.h: In function `drm_ioremapfree': # drivers/char/drm/drm_memory.h:191: warning: implicit declaration of function # `vunmap' # # Signed-off-by: Andrew Morton # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_memory.h # 2004/11/11 20:52:55+11:00 airlied@starflyer.(none) +1 -0 # drm: fix warning for missing vunmap # # In file included from drivers/char/drm/drmP.h:795, # from drivers/char/drm/drm_dma.c:36: # drivers/char/drm/drm_memory.h: In function `drm_ioremapfree': # drivers/char/drm/drm_memory.h:191: warning: implicit declaration of function # `vunmap' # # Signed-off-by: Andrew Morton # Signed-off-by: Dave Airlie # # ChangeSet # 2004/11/11 02:56:38-05:00 len.brown@intel.com # [ACPI] CPU hotplug, use kobject_hotplug(), kobject_register() # # Signed-off-by: Anil S. Keshavamurthy # Signed-off-by: Len Brown # # drivers/acpi/scan.c # 2004/11/11 02:56:31-05:00 len.brown@intel.com +1 -2 # Use kobject_register() # # drivers/acpi/processor.c # 2004/11/11 02:56:31-05:00 len.brown@intel.com +4 -54 # Use kobject_hotplug() # # drivers/acpi/container.c # 2004/11/11 02:56:31-05:00 len.brown@intel.com +3 -49 # Use kobject_hotplug() # # ChangeSet # 2004/11/11 02:44:40-05:00 len.brown@intel.com # merge # # include/linux/acpi.h # 2004/11/11 02:44:32-05:00 len.brown@intel.com +0 -0 # merge # # drivers/acpi/scan.c # 2004/11/11 02:44:32-05:00 len.brown@intel.com +0 -0 # merge # # drivers/acpi/processor.c # 2004/11/11 02:44:32-05:00 len.brown@intel.com +5 -4 # merge # # drivers/acpi/pci_irq.c # 2004/11/10 23:16:23-05:00 len.brown@intel.com +0 -0 # Auto merged # # drivers/acpi/bus.c # 2004/11/10 23:16:23-05:00 len.brown@intel.com +0 -0 # Auto merged # # arch/i386/kernel/acpi/boot.c # 2004/11/10 23:16:17-05:00 len.brown@intel.com +0 -0 # Auto merged # # ChangeSet # 2004/11/10 22:34:21+11:00 airlied@starflyer.(none) # drm: move ati_pcigart into drm core # # This moves the ati_pcigart code into the drm core. # # From: Jon Smirl # Signed-off-by: Dave Airlie # # drivers/char/drm/radeon_drv.c # 2004/11/10 22:34:12+11:00 airlied@starflyer.(none) +0 -1 # drm: move ati_pcigart into drm core # # This moves the ati_pcigart code into the drm core. # # From: Jon Smirl # Signed-off-by: Dave Airlie # # drivers/char/drm/radeon_cp.c # 2004/11/10 22:34:12+11:00 airlied@starflyer.(none) +0 -1 # drm: move ati_pcigart into drm core # # This moves the ati_pcigart code into the drm core. # # From: Jon Smirl # Signed-off-by: Dave Airlie # # drivers/char/drm/r128_drv.c # 2004/11/10 22:34:12+11:00 airlied@starflyer.(none) +0 -1 # drm: move ati_pcigart into drm core # # This moves the ati_pcigart code into the drm core. # # From: Jon Smirl # Signed-off-by: Dave Airlie # # drivers/char/drm/r128_cce.c # 2004/11/10 22:34:12+11:00 airlied@starflyer.(none) +0 -1 # drm: move ati_pcigart into drm core # # This moves the ati_pcigart code into the drm core. # # From: Jon Smirl # Signed-off-by: Dave Airlie # # drivers/char/drm/ati_pcigart.c # 2004/11/10 22:34:12+11:00 airlied@starflyer.(none) +6 -5 # drm: move ati_pcigart into drm core # # This moves the ati_pcigart code into the drm core. # # From: Jon Smirl # Signed-off-by: Dave Airlie # # drivers/char/drm/Makefile # 2004/11/10 22:34:12+11:00 airlied@starflyer.(none) +1 -1 # drm: move ati_pcigart into drm core # # This moves the ati_pcigart code into the drm core. # # From: Jon Smirl # Signed-off-by: Dave Airlie # # drivers/char/drm/ati_pcigart.c # 2004/11/10 22:26:00+11:00 airlied@starflyer.(none) +0 -0 # Rename: drivers/char/drm/ati_pcigart.h -> drivers/char/drm/ati_pcigart.c # # ChangeSet # 2004/11/08 23:32:53-05:00 jgarzik@pobox.com # Hand-merge module_param() conflicts in s2io net driver. # # drivers/net/s2io.c # 2004/11/08 23:32:47-05:00 jgarzik@pobox.com +2 -14 # Hand-merge module_param() conflicts in s2io net driver. # # drivers/net/s2io.h # 2004/11/08 23:27:33-05:00 jgarzik@pobox.com +0 -0 # Auto merged # # drivers/net/Kconfig # 2004/11/08 23:27:33-05:00 jgarzik@pobox.com +0 -0 # Auto merged # # ChangeSet # 2004/11/08 23:13:41-05:00 raghavendra.koushik@s2io.com # [PATCH] S2io: styling # # Attached is the patch to implement comments about styling # and few other changes. # Following is list of changes. # 1. Incorporated Randy's comment about C99 format for s2io_driver # structure initialization. # 2. Driver version displayed at load time. # 3. If initialization failed in s2io_init_nic(), appropriate error # codes are returned. # 4. #ifdef SET_ETHTOOL_OPS removed in couple of places. # # Signed-off-by: Raghavendra Koushik # Signed-off-by: Ravinandan Arakali # Signed-off-by: Jeff Garzik # # drivers/net/s2io.h # 2004/10/26 19:45:48-04:00 raghavendra.koushik@s2io.com +0 -6 # S2io: styling # # drivers/net/s2io.c # 2004/10/26 19:45:48-04:00 raghavendra.koushik@s2io.com +14 -7 # S2io: styling # # ChangeSet # 2004/11/08 23:13:28-05:00 raghavendra.koushik@s2io.com # [PATCH] S2io: modified loadable parameters # # Attached is the patch to implement module loadable parameters as per new API. # Following is the list of changes. # # 1. Used new module_param() API. # 2. List of variables for tx_fifo_len and rx_ring_sz replaced with array. # 3. Some of the module parameters which can be set thru setpci command have # been removed, such as latency_timer, max_read_byte_cnt, max_split_transactions. # 4. Other parameters which were felt to be not required, such as rx_prio, # tx_prio have been removed. # 5. Interrupt moderation parameters(such as tx_urange_*) are no longer module # loadable parameters since they can be configured thru' a separate patch # available to customers. # 6. Changed default max_read_byte_count to 1024. # 7. If scatter-gather is enabled, checksum is enabled too. # 8. Not verifying if module loadable parameters are within valid range # (verify_load_param() removed). # # Signed-off-by: Raghavendra Koushik # Signed-off-by: Ravinandan Arakali # Signed-off-by: Jeff Garzik # # drivers/net/s2io.h # 2004/10/26 19:43:20-04:00 raghavendra.koushik@s2io.com +0 -1 # S2io: modified loadable parameters # # drivers/net/s2io.c # 2004/10/26 19:43:20-04:00 raghavendra.koushik@s2io.com +58 -428 # S2io: modified loadable parameters # # ChangeSet # 2004/11/08 23:13:17-05:00 raghavendra.koushik@s2io.com # [PATCH] S2io: 2 buffer mode with copy # # This patch addresses the comments by Chris Leech about # skb->mac.ethernet resulting in NULL dereference with the old method # of implementing 2 buffer mode. The new method performs a copy of the # MAC header to the head of the payload. This is a stop-gap measure till # the fragmented skb receive feature in the kernel is made functional. # # Also, using GFP_KERNEL flag for buffer0, buffer1 memory allocation # instead of GFP_ATOMIC. # # Signed-off-by: Raghavendra Koushik # Signed-off-by: Ravinandan Arakali # Signed-off-by: Jeff Garzik # # drivers/net/s2io.c # 2004/10/26 19:40:43-04:00 raghavendra.koushik@s2io.com +14 -24 # S2io: 2 buffer mode with copy # # ChangeSet # 2004/11/08 23:13:06-05:00 raghavendra.koushik@s2io.com # [PATCH] S2io: new functions for card restart # # The attached patch incorporates Jeff's comments related to creating # separate functions for restarting the NIC(without using close and # open entry points) and few other comments. Complete list of changes # are as follows: # # 1. Two new functions s2io_card_down() and s2io_card_up() are defined # and are called during reset procedure instead of close and open # routines. # 2. tasklet_status field is now made as unsigned long. # 3. On getting serious error, queue is stopped before resetting the card. # 4. Removed the check for "queue stopped" in xmit routine. # # Signed-off-by: Raghavendra Koushik # Signed-off-by: Ravinandan Arakali # Signed-off-by: Jeff Garzik # # drivers/net/s2io.h # 2004/10/26 19:36:17-04:00 raghavendra.koushik@s2io.com +7 -1 # S2io: new functions for card restart # # drivers/net/s2io.c # 2004/10/26 19:36:17-04:00 raghavendra.koushik@s2io.com +145 -131 # S2io: new functions for card restart # # ChangeSet # 2004/11/08 23:12:25-05:00 raghavendra.koushik@s2io.com # [PATCH] S2io: two buffer mode # # Attached is the patch for implementing 2-buffer mode on Rx path. # # On certain systems when a DMA has to happen on an un-aligned memory # location performance will take a significant hit. It's standard # practice to offset the Rx buffer address by 2 (as Mac header is 14 # bytes) so the IP header starts from an aligned location. Obviously # using a single Rx buffer both cannot be achieved. Thus XFrame supports # something called 2 buffer Rx mode, where in the Rx'ed frame is split # into 2 parts, one is the Ethernet header and the other is the Ethernet # payload. So now we can allocate proper aligned memory for both buffers, # hence the DMA is not slowed down. Also, the Ethernet payload(starting # from L3 header) is on an aligned location so OS need not have to do # un-aligned accesses to process IP header. To achieve this, the kernel # function eth_type_trans functionality has to be partially implemented # in the driver itself. # # Signed-off-by: Raghavendra Koushik # Signed-off-by: Ravinandan Arakali # Signed-off-by: Jeff Garzik # # drivers/net/s2io.h # 2004/10/12 00:22:23-04:00 raghavendra.koushik@s2io.com +57 -0 # S2io: two buffer mode # # drivers/net/s2io.c # 2004/10/12 19:49:28-04:00 raghavendra.koushik@s2io.com +389 -1 # S2io: two buffer mode # # drivers/net/Kconfig # 2004/10/11 23:06:36-04:00 raghavendra.koushik@s2io.com +11 -0 # S2io: two buffer mode # # ChangeSet # 2004/11/08 23:12:13-05:00 raghavendra.koushik@s2io.com # [PATCH] S2io: NAPI fix # # 1. When processing Rx packets, making sure that get offset of ring # does not cross the put offset. # # 2. when NAPI is not in use a new spinlock(put_lock) is used to make # sure accessing put offset of ring is atomic. # # 3. Also introduced a new vaiable put_pos in nic_t to keep track of # absolute position of the put pointer of Rx ring. # # 4. When NAPI is used, fill_rx_buffer is not called from the interrupt # handler(s2io_isr) . # # 5. In s2io_poll, decrementing packets processed is done inside the # while loop unlike out side it as was being done last time. # # Signed-off-by: Raghavendra Koushik # Signed-off-by: Ravinandan Arakali # Signed-off-by: Jeff Garzik # # drivers/net/s2io.h # 2004/10/12 00:19:45-04:00 raghavendra.koushik@s2io.com +8 -0 # S2io: NAPI fix # # drivers/net/s2io.c # 2004/10/12 00:19:45-04:00 raghavendra.koushik@s2io.com +110 -74 # S2io: NAPI fix # # ChangeSet # 2004/11/08 23:12:02-05:00 raghavendra.koushik@s2io.com # [PATCH] S2io: new txd allocation # # The attached patch contains a modified scheme for allocating Tx descriptor # blocks. # More description follows. # # In the old scheme, the entire Tx descriptor space was allocated in # one go. This could cause driver load to fail on systems with low(or # scattered) memory. The Tx descriptor blocks are now allocated on # per-page basis. A new structure (list_info) has been introduced in # nic_t structure to keep track of the physical and virtual addresses # of every TxD allocated this way. # # Signed-off-by: Raghavendra Koushik # Signed-off-by: Ravinandan Arakali # Signed-off-by: Jeff Garzik # # drivers/net/s2io.h # 2004/10/11 20:20:24-04:00 raghavendra.koushik@s2io.com +9 -8 # S2io: new txd allocation # # drivers/net/s2io.c # 2004/10/11 20:20:24-04:00 raghavendra.koushik@s2io.com +99 -55 # S2io: new txd allocation # # ChangeSet # 2004/11/08 23:11:50-05:00 raghavendra.koushik@s2io.com # [PATCH] S2io: module loadable parameters # # 1. Max Txds per List. # # 2. statistics refresh time # # 3. pause frame control parameters including gap between two successive # frames, threshold watermarks # # 4. RTI and TTI configuration parameters including ranges, packet # counts and timeout periods. For further information please read the # section 3.5 of XFrame H/W spec. # # 5. PCI/PCI-X configuration variables latency_timer, MMRBC and OST. # # 6. OS offload features TSO (If support available) and checksum offload. # # 7. If NAPI is not in use, a variable indicate_max_pkts can be used # to limit number of Rx side packets processed for one call to Rx # Intr handler. # # Signed-off-by: Raghavendra Koushik # Signed-off-by: Ravinandan Arakali # Signed-off-by: Jeff Garzik # # drivers/net/s2io.h # 2004/10/11 18:34:23-04:00 raghavendra.koushik@s2io.com +3 -3 # S2io: module loadable parameters # # drivers/net/s2io.c # 2004/10/11 18:34:23-04:00 raghavendra.koushik@s2io.com +416 -77 # S2io: module loadable parameters # # ChangeSet # 2004/11/08 23:11:10-05:00 raghavendra.koushik@s2io.com # [PATCH] S2io: hardware fixes # # 1. Xena3's with a set of subsystem IDs had Link LED problems, fixed # that specifically for them. # # 2. To write into the Keyed Mac_Cfg register to enable broadcast, # writing two 32 bit writes into it along with a write to the key # register rather than a single write to key and a 64 bit write to # mac_cfg. This is necessary on 32 bit systems where a writeq(64 bit # write) is actually two writel (32 bit writes). # # 3. Writes to some special registers mentioned in UG is being done by # a special macro which defines which 32 bits of the 64 bit register # is to be written first. Again this applies only on 32 bit systems. # # 4. Configured pause frame related water marks and a shared_split # value which describes the Max TXDMA related split transaction that # can be used without giving room for the Rx transactions. # # 5. The mac_rmac_err_reg R1 register will be cleared in the interrupt # handler itself rather than in the scheduled task as was being done # previously. # # 6. Even on PCC_FB_ECC error the card will be reset by disabling # adapter enable bit. # # Signed-off-by: Raghavendra Koushik # Signed-off-by: Ravinandan Arakali # Signed-off-by: Jeff Garzik # # drivers/net/s2io.h # 2004/10/08 18:20:09-04:00 raghavendra.koushik@s2io.com +21 -0 # S2io: hardware fixes # # drivers/net/s2io.c # 2004/10/07 14:45:41-04:00 raghavendra.koushik@s2io.com +109 -21 # S2io: hardware fixes # # ChangeSet # 2004/11/08 23:10:59-05:00 raghavendra.koushik@s2io.com # [PATCH] S2io: optimizations # # 1. Definitions of LOW and PANIC levels of the Rx buffers have changed. # # 2. In wait_for_cmd_complete there is no longer a writeq but just a # read and wait for strobe bit to reset. # # 3. In s2io_isr, the isr_lock has been done away with also the NICs # interrupt are no longer disabled explicitly on entering the interrupt # handler and re-enabled again before leaving it. # # 4. Also clearing the semaphore "tasklet_status" when exiting # erroneously from s2io_isr after failing fill_rx_buffer call. # # 5. The set/reset Tx Csum function through ethtool was added to the # ethtool_ops structure. # # 6. Added a Rx side error code in the rx_osm_handler function. # # 7. No longer stopping and waking Tx queue when link state changes in # s2io_link function. # # 8. removed the isr_lock spinlock from the s2io_nic structure. # # 9. changed parameters which determine thresholds(LOW and PANIC) # to replenish Rx buffers. # This has been found to result in better performance. # # Signed-off-by: Raghavendra Koushik # Signed-off-by: Ravinandan Arakali # Signed-off-by: Jeff Garzik # # drivers/net/s2io.h # 2004/10/06 20:37:48-04:00 raghavendra.koushik@s2io.com +0 -1 # S2io: optimizations # # drivers/net/s2io.c # 2004/10/06 20:37:33-04:00 raghavendra.koushik@s2io.com +26 -59 # S2io: optimizations # # ChangeSet # 2004/11/08 23:10:48-05:00 raghavendra.koushik@s2io.com # [PATCH] S2io: sw bug fixes # # 1. In free_rx_buffers clearing out RxDs not owned by Xena. # # 2. In alarm_intr_handler, when a serr error occurs, schedule a task # to reset the card rather than stopping Tx queue. # # 3. In s2io_close freeing IRQ before calling s2io_reset also added a # new call to flush queued tasks. This is not done if the s2io_close # itself is called from a queued task like s2io_restart_nic. # # 4. read_eeprom function has been changed such that data to be returned # is sent as an input argument and the return value represents a # pass/fail. The previous implementation as Randy had pointed out was # error prone as on failure it returned -1 which can be interpreted # as all ff's, so any data area which contained ff's in the eeprom was # likely to be treated as an error. # # 5. Added a flag "task_flag" to track if the call to s2io_close is # coming from the s2io_restart_nic function or from the ifconfig # down called by user. # # 6. Moved register_netdev call from just after setting entry points # to the end of the s2io_init_nic function. # # 7. In s2io.h field added a new member into the s2io_nic structure # called "task_flag". # # Signed-off-by: Raghavendra Koushik # Signed-off-by: Ravinandan Arakali # Signed-off-by: Jeff Garzik # # drivers/net/s2io.h # 2004/10/06 19:19:53-04:00 raghavendra.koushik@s2io.com +2 -0 # S2io: sw bug fixes # # drivers/net/s2io.c # 2004/10/06 19:19:53-04:00 raghavendra.koushik@s2io.com +37 -21 # S2io: sw bug fixes # # ChangeSet # 2004/11/08 23:10:36-05:00 raghavendra.koushik@s2io.com # [PATCH] S2io: cosmetic changes # # 1. Indentation, change in comment styles, variable name changes etc. # 2. Changed the value written to dtx_control register to force XGXS reset. # 3. weight parameter(NAPI) changed to 90 for better performance. # # Signed-off-by: Raghavendra Koushik # Signed-off-by: Ravinandan Arakali # Signed-off-by: Jeff Garzik # # drivers/net/s2io.h # 2004/10/06 16:03:08-04:00 raghavendra.koushik@s2io.com +63 -127 # S2io: cosmetic changes # # drivers/net/s2io.c # 2004/10/06 16:03:08-04:00 raghavendra.koushik@s2io.com +1000 -943 # S2io: cosmetic changes # # drivers/net/s2io-regs.h # 2004/10/06 16:03:08-04:00 raghavendra.koushik@s2io.com +3 -0 # S2io: cosmetic changes # # ChangeSet # 2004/11/06 12:44:08-05:00 nacc@us.ibm.com # [PATCH] net/gt96100eth: replace gt96100_delay() with msleep_interruptible() # # Uses msleep_interruptible() instead of schedule_timeout() # in the gt96100_delay() function. Corrects one comment to correspond to # the code. # # Signed-off-by: Nishanth Aravamudan # Signed-off-by: Jeff Garzik # # drivers/net/gt96100eth.c # 2004/11/05 12:45:48-05:00 nacc@us.ibm.com +3 -5 # net/gt96100eth: replace gt96100_delay() with msleep_interruptible() # # ChangeSet # 2004/11/06 12:26:16-05:00 jgarzik@pobox.com # Merge pobox.com:/garz/repo/linux-2.6 # into pobox.com:/garz/repo/netdev-2.6/janitor # # drivers/net/8390.c # 2004/11/06 12:26:13-05:00 jgarzik@pobox.com +0 -0 # Auto merged # # ChangeSet # 2004/11/05 20:00:41+11:00 airlied@starflyer.(none) # drm: make pcigart functions inline # # with these unstatic uninline the kernel wouldn't build with both configured. # # Signed-off-by: Dave Airlie # # drivers/char/drm/radeon_cp.c # 2004/11/05 20:00:30+11:00 airlied@starflyer.(none) +1 -0 # drm: make pcigart functions inline # # with these unstatic uninline the kernel wouldn't build with both configured. # # Signed-off-by: Dave Airlie # # drivers/char/drm/r128_cce.c # 2004/11/05 20:00:30+11:00 airlied@starflyer.(none) +1 -0 # drm: make pcigart functions inline # # with these unstatic uninline the kernel wouldn't build with both configured. # # Signed-off-by: Dave Airlie # # drivers/char/drm/ati_pcigart.h # 2004/11/05 20:00:30+11:00 airlied@starflyer.(none) +39 -38 # drm: make pcigart functions inline # # with these unstatic uninline the kernel wouldn't build with both configured. # # Signed-off-by: Dave Airlie # # ChangeSet # 2004/11/04 22:32:38+11:00 airlied@starflyer.(none) # drm: rearrange some functions for new split # # This change moves some functions into different C files to align things # a bit more correctly... # # From: Jon Smirl # Approved-by: Dave Airlie # # drivers/char/drm/drm_stub.c # 2004/11/04 22:32:28+11:00 airlied@starflyer.(none) +73 -7 # drm: rearrange some functions for new split # # This change moves some functions into different C files to align things # a bit more correctly... # # From: Jon Smirl # Approved-by: Dave Airlie # # drivers/char/drm/drm_lock.c # 2004/11/04 22:32:28+11:00 airlied@starflyer.(none) +139 -4 # drm: rearrange some functions for new split # # This change moves some functions into different C files to align things # a bit more correctly... # # From: Jon Smirl # Approved-by: Dave Airlie # # drivers/char/drm/drm_ioctl.c # 2004/11/04 22:32:28+11:00 airlied@starflyer.(none) +8 -0 # drm: rearrange some functions for new split # # This change moves some functions into different C files to align things # a bit more correctly... # # From: Jon Smirl # Approved-by: Dave Airlie # # drivers/char/drm/drm_fops.c # 2004/11/04 22:32:28+11:00 airlied@starflyer.(none) +290 -0 # drm: rearrange some functions for new split # # This change moves some functions into different C files to align things # a bit more correctly... # # From: Jon Smirl # Approved-by: Dave Airlie # # drivers/char/drm/drm_drv.c # 2004/11/04 22:32:28+11:00 airlied@starflyer.(none) +7 -503 # drm: rearrange some functions for new split # # This change moves some functions into different C files to align things # a bit more correctly... # # From: Jon Smirl # Approved-by: Dave Airlie # # drivers/char/drm/drmP.h # 2004/11/04 22:32:28+11:00 airlied@starflyer.(none) +12 -10 # drm: rearrange some functions for new split # # This change moves some functions into different C files to align things # a bit more correctly... # # From: Jon Smirl # Approved-by: Dave Airlie # # ChangeSet # 2004/11/04 21:35:52+11:00 airlied@starflyer.(none) # drm: move fops into drivers # # move the drm file operations into the driver. # # From: Jon Smirl # Approved-by: Dave Airlie # # drivers/char/drm/tdfx_drv.c # 2004/11/04 21:35:43+11:00 airlied@starflyer.(none) +9 -0 # drm: move fops into drivers # # move the drm file operations into the driver. # # From: Jon Smirl # Approved-by: Dave Airlie # # drivers/char/drm/sis_drv.c # 2004/11/04 21:35:43+11:00 airlied@starflyer.(none) +9 -0 # drm: move fops into drivers # # move the drm file operations into the driver. # # From: Jon Smirl # Approved-by: Dave Airlie # # drivers/char/drm/radeon_drv.c # 2004/11/04 21:35:43+11:00 airlied@starflyer.(none) +9 -0 # drm: move fops into drivers # # move the drm file operations into the driver. # # From: Jon Smirl # Approved-by: Dave Airlie # # drivers/char/drm/r128_drv.c # 2004/11/04 21:35:43+11:00 airlied@starflyer.(none) +9 -0 # drm: move fops into drivers # # move the drm file operations into the driver. # # From: Jon Smirl # Approved-by: Dave Airlie # # drivers/char/drm/mga_drv.c # 2004/11/04 21:35:43+11:00 airlied@starflyer.(none) +9 -0 # drm: move fops into drivers # # move the drm file operations into the driver. # # From: Jon Smirl # Approved-by: Dave Airlie # # drivers/char/drm/i915_drv.c # 2004/11/04 21:35:43+11:00 airlied@starflyer.(none) +9 -0 # drm: move fops into drivers # # move the drm file operations into the driver. # # From: Jon Smirl # Approved-by: Dave Airlie # # drivers/char/drm/i830_drv.c # 2004/11/04 21:35:43+11:00 airlied@starflyer.(none) +9 -0 # drm: move fops into drivers # # move the drm file operations into the driver. # # From: Jon Smirl # Approved-by: Dave Airlie # # drivers/char/drm/i810_drv.c # 2004/11/04 21:35:43+11:00 airlied@starflyer.(none) +9 -0 # drm: move fops into drivers # # move the drm file operations into the driver. # # From: Jon Smirl # Approved-by: Dave Airlie # # drivers/char/drm/drm_vm.c # 2004/11/04 21:35:43+11:00 airlied@starflyer.(none) +1 -0 # drm: move fops into drivers # # move the drm file operations into the driver. # # From: Jon Smirl # Approved-by: Dave Airlie # # drivers/char/drm/drm_stub.c # 2004/11/04 21:35:43+11:00 airlied@starflyer.(none) +1 -1 # drm: move fops into drivers # # move the drm file operations into the driver. # # From: Jon Smirl # Approved-by: Dave Airlie # # drivers/char/drm/drm_fops.c # 2004/11/04 21:35:43+11:00 airlied@starflyer.(none) +1 -0 # drm: move fops into drivers # # move the drm file operations into the driver. # # From: Jon Smirl # Approved-by: Dave Airlie # # drivers/char/drm/drm_drv.c # 2004/11/04 21:35:43+11:00 airlied@starflyer.(none) +0 -13 # drm: move fops into drivers # # move the drm file operations into the driver. # # From: Jon Smirl # Approved-by: Dave Airlie # # drivers/char/drm/drmP.h # 2004/11/04 21:35:43+11:00 airlied@starflyer.(none) +1 -3 # drm: move fops into drivers # # move the drm file operations into the driver. # # From: Jon Smirl # Approved-by: Dave Airlie # # ChangeSet # 2004/11/02 22:20:24+11:00 airlied@starflyer.(none) # drm: rename fn_tbl to driver as it is no longer a function table # # This renames the drm_driver_fn to drm_driver and fn_tbl to driver, # this name is makes much more sense now. # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/tdfx_drv.c # 2004/11/02 22:20:15+11:00 airlied@starflyer.(none) +3 -3 # drm: rename fn_tbl to driver as it is no longer a function table # # This renames the drm_driver_fn to drm_driver and fn_tbl to driver, # this name is makes much more sense now. # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/sis_drv.c # 2004/11/02 22:20:15+11:00 airlied@starflyer.(none) +3 -3 # drm: rename fn_tbl to driver as it is no longer a function table # # This renames the drm_driver_fn to drm_driver and fn_tbl to driver, # this name is makes much more sense now. # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/radeon_drv.c # 2004/11/02 22:20:15+11:00 airlied@starflyer.(none) +3 -3 # drm: rename fn_tbl to driver as it is no longer a function table # # This renames the drm_driver_fn to drm_driver and fn_tbl to driver, # this name is makes much more sense now. # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/r128_drv.c # 2004/11/02 22:20:15+11:00 airlied@starflyer.(none) +3 -3 # drm: rename fn_tbl to driver as it is no longer a function table # # This renames the drm_driver_fn to drm_driver and fn_tbl to driver, # this name is makes much more sense now. # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/mga_drv.c # 2004/11/02 22:20:15+11:00 airlied@starflyer.(none) +3 -3 # drm: rename fn_tbl to driver as it is no longer a function table # # This renames the drm_driver_fn to drm_driver and fn_tbl to driver, # this name is makes much more sense now. # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/i915_drv.c # 2004/11/02 22:20:15+11:00 airlied@starflyer.(none) +3 -3 # drm: rename fn_tbl to driver as it is no longer a function table # # This renames the drm_driver_fn to drm_driver and fn_tbl to driver, # this name is makes much more sense now. # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/i830_drv.c # 2004/11/02 22:20:15+11:00 airlied@starflyer.(none) +3 -3 # drm: rename fn_tbl to driver as it is no longer a function table # # This renames the drm_driver_fn to drm_driver and fn_tbl to driver, # this name is makes much more sense now. # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/i810_drv.c # 2004/11/02 22:20:15+11:00 airlied@starflyer.(none) +3 -3 # drm: rename fn_tbl to driver as it is no longer a function table # # This renames the drm_driver_fn to drm_driver and fn_tbl to driver, # this name is makes much more sense now. # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/gamma_dma.c # 2004/11/02 22:20:15+11:00 airlied@starflyer.(none) +6 -6 # drm: rename fn_tbl to driver as it is no longer a function table # # This renames the drm_driver_fn to drm_driver and fn_tbl to driver, # this name is makes much more sense now. # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/ffb_drv.c # 2004/11/02 22:20:15+11:00 airlied@starflyer.(none) +8 -8 # drm: rename fn_tbl to driver as it is no longer a function table # # This renames the drm_driver_fn to drm_driver and fn_tbl to driver, # this name is makes much more sense now. # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_vm.c # 2004/11/02 22:20:15+11:00 airlied@starflyer.(none) +2 -2 # drm: rename fn_tbl to driver as it is no longer a function table # # This renames the drm_driver_fn to drm_driver and fn_tbl to driver, # this name is makes much more sense now. # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_stub.c # 2004/11/02 22:20:15+11:00 airlied@starflyer.(none) +2 -2 # drm: rename fn_tbl to driver as it is no longer a function table # # This renames the drm_driver_fn to drm_driver and fn_tbl to driver, # this name is makes much more sense now. # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_proc.c # 2004/11/02 22:20:15+11:00 airlied@starflyer.(none) +2 -2 # drm: rename fn_tbl to driver as it is no longer a function table # # This renames the drm_driver_fn to drm_driver and fn_tbl to driver, # this name is makes much more sense now. # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_irq.c # 2004/11/02 22:20:15+11:00 airlied@starflyer.(none) +6 -6 # drm: rename fn_tbl to driver as it is no longer a function table # # This renames the drm_driver_fn to drm_driver and fn_tbl to driver, # this name is makes much more sense now. # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_ioctl.c # 2004/11/02 22:20:15+11:00 airlied@starflyer.(none) +6 -6 # drm: rename fn_tbl to driver as it is no longer a function table # # This renames the drm_driver_fn to drm_driver and fn_tbl to driver, # this name is makes much more sense now. # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_fops.c # 2004/11/02 22:20:15+11:00 airlied@starflyer.(none) +2 -2 # drm: rename fn_tbl to driver as it is no longer a function table # # This renames the drm_driver_fn to drm_driver and fn_tbl to driver, # this name is makes much more sense now. # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_drv.c # 2004/11/02 22:20:15+11:00 airlied@starflyer.(none) +45 -45 # drm: rename fn_tbl to driver as it is no longer a function table # # This renames the drm_driver_fn to drm_driver and fn_tbl to driver, # this name is makes much more sense now. # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_context.c # 2004/11/02 22:20:15+11:00 airlied@starflyer.(none) +4 -4 # drm: rename fn_tbl to driver as it is no longer a function table # # This renames the drm_driver_fn to drm_driver and fn_tbl to driver, # this name is makes much more sense now. # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_bufs.c # 2004/11/02 22:20:15+11:00 airlied@starflyer.(none) +3 -3 # drm: rename fn_tbl to driver as it is no longer a function table # # This renames the drm_driver_fn to drm_driver and fn_tbl to driver, # this name is makes much more sense now. # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/drmP.h # 2004/11/02 22:20:15+11:00 airlied@starflyer.(none) +7 -7 # drm: rename fn_tbl to driver as it is no longer a function table # # This renames the drm_driver_fn to drm_driver and fn_tbl to driver, # this name is makes much more sense now. # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # ChangeSet # 2004/11/02 21:59:29+11:00 airlied@starflyer.(none) # drm: drm_memory.c missing from build # # Add drm_memory.c to build. # # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_memory.c # 2004/11/02 21:57:07+11:00 airlied@starflyer.(none) +181 -0 # # drivers/char/drm/drm_memory.c # 2004/11/02 21:57:07+11:00 airlied@starflyer.(none) +0 -0 # BitKeeper file /home/airlied/bitkeeper/drm-test/drivers/char/drm/drm_memory.c # # ChangeSet # 2004/11/02 21:55:16+11:00 airlied@starflyer.(none) # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/tdfx_drv.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +59 -4 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/sis_mm.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +2 -10 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/sis_ds.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +8 -9 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/sis_drv.h # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +14 -0 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/sis_drv.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +75 -2 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/sis_drm.h # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +15 -6 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/radeon_state.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +7 -23 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/radeon_mem.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +10 -11 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/radeon_irq.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +5 -6 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/radeon_drv.h # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +21 -0 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/radeon_drv.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +136 -2 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/radeon_cp.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +6 -7 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/r128_state.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +44 -57 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/r128_irq.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +1 -2 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/r128_drv.h # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +16 -1 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/r128_drv.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +99 -2 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/r128_cce.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +8 -9 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/mga_warp.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +0 -1 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/mga_state.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +0 -1 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/mga_irq.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +1 -2 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/mga_drv.h # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +15 -0 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/mga_drv.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +92 -2 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/mga_dma.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +8 -26 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/i915_mem.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +10 -11 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/i915_irq.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +0 -1 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/i915_drv.h # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +24 -0 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/i915_drv.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +92 -2 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/i915_drm.h # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +25 -12 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/i915_dma.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +5 -22 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/i830_irq.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +0 -1 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/i830_drv.h # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +33 -0 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/i830_drv.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +101 -2 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/i830_drm.h # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +29 -14 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/i830_dma.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +15 -40 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/i810_drv.h # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +31 -4 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/i810_drv.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +93 -2 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/i810_drm.h # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +31 -15 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/i810_dma.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +16 -32 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/ffb_drv.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +4 -6 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_vm.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +61 -59 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_stub.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +34 -120 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_scatter.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +18 -18 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_proc.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +40 -40 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_memory.h # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +0 -158 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_lock.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +5 -5 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_irq.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +20 -18 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_ioctl.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +17 -19 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_init.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +1 -77 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_fops.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +12 -10 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_drv.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +277 -275 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_drawable.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +2 -2 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_dma.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +14 -13 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_core.h # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +11 -17 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_context.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +32 -32 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_bufs.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +70 -69 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_auth.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +15 -15 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_agpsupport.c # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +31 -31 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/drmP.h # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +157 -137 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/ati_pcigart.h # 2004/11/02 21:55:07+11:00 airlied@starflyer.(none) +8 -8 # drm: core/personality split for 2.6 kernel # # This changeset gets rid of the DRM() macros and implements a core DRM module # linked to a per graphics card personality module.. # # Remove old 2.4 module parameters and switch to 2.6 module parameters # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_memory.h # 2004/11/01 20:27:56+11:00 airlied@starflyer.(none) +0 -0 # Rename: drivers/char/drm/drm_memory.c -> drivers/char/drm/drm_memory.h # # drivers/char/drm/tdfx_drv.h # 2004/11/01 20:12:34+11:00 airlied@starflyer.(none) +0 -0 # Rename: drivers/char/drm/tdfx.h -> drivers/char/drm/tdfx_drv.h # # ChangeSet # 2004/10/31 20:52:40+11:00 airlied@starflyer.(none) # Merge starflyer.(none):/home/airlied/bitkeeper/drm-core # into starflyer.(none):/home/airlied/bitkeeper/drm-test # # drivers/char/drm/drm_stub.c # 2004/10/31 20:52:36+11:00 airlied@starflyer.(none) +0 -0 # Auto merged # # drivers/char/drm/drm_proc.c # 2004/10/31 20:52:36+11:00 airlied@starflyer.(none) +0 -0 # Auto merged # # drivers/char/drm/drm_memory.c # 2004/10/31 20:52:36+11:00 airlied@starflyer.(none) +0 -0 # Auto merged # # drivers/char/drm/drm_irq.c # 2004/10/31 20:52:36+11:00 airlied@starflyer.(none) +0 -0 # Auto merged # # drivers/char/drm/drm_drv.c # 2004/10/31 20:52:36+11:00 airlied@starflyer.(none) +0 -0 # Auto merged # # drivers/char/drm/drm_stub.c # 2004/10/31 20:52:36+11:00 airlied@starflyer.(none) +0 -0 # Merge rename: drivers/char/drm/drm_stub.h -> drivers/char/drm/drm_stub.c # # drivers/char/drm/drm_proc.c # 2004/10/31 20:52:36+11:00 airlied@starflyer.(none) +0 -0 # Merge rename: drivers/char/drm/drm_proc.h -> drivers/char/drm/drm_proc.c # # drivers/char/drm/drm_memory.c # 2004/10/31 20:52:36+11:00 airlied@starflyer.(none) +0 -0 # Merge rename: drivers/char/drm/drm_memory.h -> drivers/char/drm/drm_memory.c # # drivers/char/drm/drm_irq.c # 2004/10/31 20:52:36+11:00 airlied@starflyer.(none) +0 -0 # Merge rename: drivers/char/drm/drm_irq.h -> drivers/char/drm/drm_irq.c # # drivers/char/drm/drm_drv.c # 2004/10/31 20:52:36+11:00 airlied@starflyer.(none) +0 -0 # Merge rename: drivers/char/drm/drm_drv.h -> drivers/char/drm/drm_drv.c # # ChangeSet # 2004/10/31 01:14:20-05:00 len.brown@intel.com # [ACPI] fix mis-merge in processor.c # # drivers/acpi/processor.c # 2004/10/31 01:14:09-05:00 len.brown@intel.com +2 -60 # delete dupe acpi_processor_start() definition # # ChangeSet # 2004/10/30 10:59:44-04:00 margitsw@t-online.de # [PATCH] prism54 sparse fixes # # * On top of Linus's sparse changes, here is a # * fix that further reduces sparse warnings. # # We are still left with 2 warnings caused by the # member "data.pointer" in struct "iwreq_data" being # "__user" (from wireless.h). # # Signed-off-by: Jeff Garzik # # drivers/net/wireless/prism54/prismcompat.h # 2004/10/09 09:20:50-04:00 margitsw@t-online.de +4 -0 # prism54 sparse fixes # # drivers/net/wireless/prism54/isl_ioctl.c # 2004/10/09 08:43:06-04:00 margitsw@t-online.de +14 -10 # prism54 sparse fixes # # ChangeSet # 2004/10/30 10:59:34-04:00 margitsw@t-online.de # [PATCH] prism54 fix resume processing # # * We need to enable the device on resume. # # Signed-off-by: Jeff Garzik # # drivers/net/wireless/prism54/islpci_hotplug.c # 2004/10/07 13:16:27-04:00 margitsw@t-online.de +2 -0 # prism54 fix resume processing # # ChangeSet # 2004/10/30 10:31:06-04:00 shemminger@osdl.org # [PATCH] xircom_tulip_cb: convert to using module_param # # Signed-off-by: Stephen Hemminger # Signed-off-by: Jeff Garzik # # drivers/net/tulip/xircom_tulip_cb.c # 2004/10/18 18:27:10-04:00 shemminger@osdl.org +9 -6 # xircom_tulip_cb: convert to using module_param # # ChangeSet # 2004/10/30 10:29:27-04:00 shemminger@osdl.org # [PATCH] tlan: enable faster hash function # # Cleanout dead code, and use better hash function. The faster hash function # was already there, but not turned on by default. Tested hash function for # 10 million random addresses. # # Signed-off-by: Stephen Hemminger # Signed-off-by: Jeff Garzik # # drivers/net/tlan.h # 2004/10/19 14:14:54-04:00 shemminger@osdl.org +21 -55 # tlan: enable faster hash function # # ChangeSet # 2004/10/30 10:29:16-04:00 shemminger@osdl.org # [PATCH] tlan: make inline's static (rev2) # # Make inline functions static to avoid polluting global namespace. # # Signed-off-by: Stephen Hemminger # Signed-off-by: Jeff Garzik # # drivers/net/tlan.h # 2004/10/19 14:09:38-04:00 shemminger@osdl.org +12 -12 # tlan: make inline's static (rev2) # # ChangeSet # 2004/10/30 10:29:05-04:00 shemminger@osdl.org # [PATCH] tlan: get rid of unneeded global vars (rev 2) # # The global variable media_map is never used. And the media table media # can be static. # # Signed-off-by: Stephen Hemminger # Signed-off-by: Jeff Garzik # # drivers/net/tlan.c # 2004/10/19 14:05:01-04:00 shemminger@osdl.org +1 -3 # tlan: get rid of unneeded global vars (rev 2) # # ChangeSet # 2004/10/30 10:28:50-04:00 shemminger@osdl.org # [PATCH] tlan: use netdev_priv (rev 2) # # Use netdev_priv # # Signed-off-by: Stephen Hemminger # Signed-off-by: Jeff Garzik # # drivers/net/tlan.c # 2004/10/19 14:03:02-04:00 shemminger@osdl.org +34 -34 # tlan: use netdev_priv (rev 2) # # ChangeSet # 2004/10/30 10:26:58-04:00 shemminger@osdl.org # [PATCH] hp100: use inline for comple usage of dev->priv # # Make a separate function for the one more complex usage of netdev_priv. # # Signed-off-by: Stephen Hemminger # Signed-off-by: Jeff Garzik # # drivers/net/hp100.c # 2004/10/18 18:57:57-04:00 shemminger@osdl.org +8 -1 # hp100: use inline for comple usage of dev->priv # # ChangeSet # 2004/10/30 10:26:47-04:00 shemminger@osdl.org # [PATCH] hp100: use netdev_priv (rev 2) # # Here is a revised version of the hp100 patch sequence. # First one just does netdev_priv. # Worked with Jean to get these patches tested. # # Signed-off-by: Stephen Hemminger # Signed-off-by: Jeff Garzik # # drivers/net/hp100.c # 2004/10/18 18:51:14-04:00 shemminger@osdl.org +28 -28 # hp100: use netdev_priv (rev 2) # # ChangeSet # 2004/10/30 10:21:25-04:00 linville@tuxdriver.com # [PATCH] tulip: Add MODULE_VERSION # # Add MODULE_VERSION to the tulip-based drivers # # Signed-off-by: John W. Linville # Signed-off-by: Jeff Garzik # # drivers/net/tulip/xircom_tulip_cb.c # 2004/10/29 20:00:00-04:00 linville@tuxdriver.com +1 -0 # tulip: Add MODULE_VERSION # # drivers/net/tulip/winbond-840.c # 2004/10/29 20:00:00-04:00 linville@tuxdriver.com +1 -0 # tulip: Add MODULE_VERSION # # drivers/net/tulip/tulip_core.c # 2004/10/29 20:00:00-04:00 linville@tuxdriver.com +1 -0 # tulip: Add MODULE_VERSION # # drivers/net/tulip/dmfe.c # 2004/10/29 20:00:00-04:00 linville@tuxdriver.com +1 -0 # tulip: Add MODULE_VERSION # # drivers/net/tulip/de2104x.c # 2004/10/29 20:00:00-04:00 linville@tuxdriver.com +1 -0 # tulip: Add MODULE_VERSION # # ChangeSet # 2004/10/30 10:21:14-04:00 linville@tuxdriver.com # [PATCH] e100: Add MODULE_VERSION # # Add MODULE_VERSION to e100 driver. # # Signed-off-by: John W. Linville # Signed-off-by: Jeff Garzik # # drivers/net/e100.c # 2004/10/29 20:00:00-04:00 linville@tuxdriver.com +1 -0 # e100: Add MODULE_VERSION # # ChangeSet # 2004/10/30 10:21:02-04:00 linville@tuxdriver.com # [PATCH] r8169: Add MODULE_VERSION # # Add MODULE_VERSION to r8169 driver. # # Signed-off-by: John W. Linville # Signed-off-by: Jeff Garzik # # drivers/net/r8169.c # 2004/10/29 20:00:00-04:00 linville@tuxdriver.com +1 -0 # r8169: Add MODULE_VERSION # # ChangeSet # 2004/10/30 10:20:51-04:00 linville@tuxdriver.com # [PATCH] 8139too: Add MODULE_VERSION # # Add MODULE_VERSION to 8139too driver. # # Signed-off-by: John W. Linville # Signed-off-by: Jeff Garzik # # drivers/net/8139too.c # 2004/10/29 20:00:00-04:00 linville@tuxdriver.com +1 -0 # 8139too: Add MODULE_VERSION # # ChangeSet # 2004/10/30 10:20:40-04:00 linville@tuxdriver.com # [PATCH] 3c59x: Add MODULE_VERSION # # Add MODULE_VERSION to 3c59x driver. # # Signed-off-by: John W. Linville # Signed-off-by: Jeff Garzik # # drivers/net/3c59x.c # 2004/10/29 20:00:00-04:00 linville@tuxdriver.com +1 -0 # 3c59x: Add MODULE_VERSION # # ChangeSet # 2004/10/30 09:21:19-04:00 linville@tuxdriver.com # [PATCH] r8169: simplify trick if() expression # # Simplify tricky if() expression in rtl8169_vlan_rx_register(). # # Signed-off-by: John W. Linville # Signed-off-by: Jeff Garzik # # drivers/net/r8169.c # 2004/10/22 21:44:26-04:00 linville@tuxdriver.com +2 -1 # r8169: simplify trick if() expression # # ChangeSet # 2004/10/30 09:21:07-04:00 linville@tuxdriver.com # [PATCH] r8169: fix RxVlan bit manipulation # # Fix manipulation of RxVlan bit in rtl8169_vlan_rx_register(), and # remove it from rtl8169_vlan_rx_kill_vid(). # # Signed-off-by: John W. Linville # Signed-off-by: Jeff Garzik # # drivers/net/r8169.c # 2004/10/21 14:44:23-04:00 linville@tuxdriver.com +4 -6 # r8169: fix RxVlan bit manipulation # # ChangeSet # 2004/10/30 09:20:56-04:00 linville@tuxdriver.com # [PATCH] r8169: endian-swap return of rtl8169_tx_vlan_tag() # # Endian-swap return of rtl8169_tx_vlan_tag() in rtl8169_start_xmit() # # Signed-off-by: John W. Linville # Signed-off-by: Jeff Garzik # # drivers/net/r8169.c # 2004/10/21 14:49:05-04:00 linville@tuxdriver.com +1 -1 # r8169: endian-swap return of rtl8169_tx_vlan_tag() # # ChangeSet # 2004/10/30 08:36:13-04:00 hch@lst.de # [PATCH] unexport ei_tx_timeout # # not used by any module # # Signed-off-by: Jeff Garzik # # drivers/net/8390.c # 2004/10/23 10:17:41-04:00 hch@lst.de +0 -1 # unexport ei_tx_timeout # # ChangeSet # 2004/10/30 08:30:02-04:00 webvenza@libero.it # [PATCH] Add Altimata PHY to sis900 driver # # The attached patch fixes a long standing detection problem with the # sis900 driver. # This PHY chip is used on some Pentium 4 with SiS chipset and on the # Acer Aspire 1705SMi (at least) notebook. # # Signed-Off-By: Daniele Venzano # Signed-off-by: Jeff Garzik # # drivers/net/sis900.c # 2004/10/29 20:00:00-04:00 webvenza@libero.it +1 -0 # Add Altimata PHY to sis900 driver # # ChangeSet # 2004/10/30 08:14:50-04:00 bunk@stusta.de # [PATCH] net/skfp/smt.c: remove an unused function # # The patch below removes an unused function from drivers/net/skfp/smt.c # # Signed-off-by: Adrian Bunk # Signed-off-by: Jeff Garzik # # drivers/net/skfp/smt.c # 2004/10/28 17:19:00-04:00 bunk@stusta.de +0 -7 # net/skfp/smt.c: remove an unused function # # ChangeSet # 2004/10/30 08:14:39-04:00 bunk@stusta.de # [PATCH] net/3c505.c: remove unused functions # # Signed-off-by: Adrian Bunk # Signed-off-by: Jeff Garzik # # drivers/net/3c505.c # 2004/10/28 17:23:08-04:00 bunk@stusta.de +0 -10 # net/3c505.c: remove unused functions # # ChangeSet # 2004/10/30 08:14:29-04:00 bunk@stusta.de # [PATCH] bonding: remove an unused function # # Signed-off-by: Adrian Bunk # Signed-off-by: Jeff Garzik # # drivers/net/bonding/bond_3ad.c # 2004/10/28 17:18:19-04:00 bunk@stusta.de +0 -10 # bonding: remove an unused function # # ChangeSet # 2004/10/30 08:14:16-04:00 dave@thedillows.org # [PATCH] net/typhoon.c: use previously-unused function # # A response to Adrian Bunk's "remove unused function" cleanup patch. # # Signed-off-by: Jeff Garzik # # drivers/net/typhoon.c # 2004/10/28 20:06:45-04:00 dave@thedillows.org +1 -2 # net/typhoon.c: remove an unused function # # ChangeSet # 2004/10/30 08:14:05-04:00 khc@pm.waw.pl # [PATCH] net/wan/n2.c: remove an unused function # # Adrian Bunk writes: # > The patch below removes an unused function from drivers/net/wan/n2.c # # A similar thing, for C101 card. # # Signed-off-by: Krzysztof Halasa # Signed-off-by: Jeff Garzik # # drivers/net/wan/c101.c # 2004/10/28 20:18:31-04:00 khc@pm.waw.pl +0 -3 # net/wan/n2.c: remove an unused function # # ChangeSet # 2004/10/30 08:13:54-04:00 bunk@stusta.de # [PATCH] net/wan/n2.c: remove an unused function # # Signed-off-by: Adrian Bunk # Signed-off-by: Jeff Garzik # # drivers/net/wan/n2.c # 2004/10/28 17:20:30-04:00 bunk@stusta.de +0 -5 # net/wan/n2.c: remove an unused function # # ChangeSet # 2004/10/28 05:00:02-04:00 len.brown@intel.com # merge # # include/acpi/acpi_bus.h # 2004/10/28 04:59:55-04:00 len.brown@intel.com +0 -0 # merge # # drivers/acpi/processor.c # 2004/10/28 04:59:55-04:00 len.brown@intel.com +66 -2 # merge # # include/linux/acpi.h # 2004/10/28 04:45:11-04:00 len.brown@intel.com +0 -0 # Auto merged # # drivers/acpi/scan.c # 2004/10/28 04:45:11-04:00 len.brown@intel.com +0 -0 # Auto merged # # ChangeSet # 2004/10/28 04:01:25-04:00 len.brown@intel.com # [ACPI] Initial container driver to support hotplug notifications # on ACPI0004, PNP0A05 and PNP0A06 devices. # # Signed-off-by: Anil S Keshavamurthy # Signed-off-by: Len Brown # # include/acpi/container.h # 2004/09/24 18:26:34-04:00 len.brown@intel.com +13 -0 # Import patch container_drv.patch # # drivers/acpi/container.c # 2004/09/24 18:26:34-04:00 len.brown@intel.com +344 -0 # Import patch container_drv.patch # # include/acpi/container.h # 2004/09/24 18:26:34-04:00 len.brown@intel.com +0 -0 # BitKeeper file /home/lenb/src/26-latest-hotplug/include/acpi/container.h # # drivers/acpi/container.c # 2004/09/24 18:26:34-04:00 len.brown@intel.com +0 -0 # BitKeeper file /home/lenb/src/26-latest-hotplug/drivers/acpi/container.c # # drivers/acpi/Makefile # 2004/09/24 18:26:34-04:00 len.brown@intel.com +1 -0 # Import patch container_drv.patch # # drivers/acpi/Kconfig # 2004/09/24 18:26:34-04:00 len.brown@intel.com +9 -1 # Import patch container_drv.patch # # ChangeSet # 2004/10/28 03:55:03-04:00 len.brown@intel.com # [ACPI] Extend processor driver to support ACPI-based Physical CPU hotplug # # Signed-off-by Anil S Keshavamurthy # Signed-off-by: Len Brown # # drivers/acpi/processor.c # 2004/10/28 03:54:49-04:00 len.brown@intel.com +414 -66 # Import patch processor_drv.patch # # drivers/acpi/Kconfig # 2004/09/24 18:26:31-04:00 len.brown@intel.com +8 -0 # Import patch processor_drv.patch # # ChangeSet # 2004/10/28 03:41:43-04:00 len.brown@intel.com # IA64 CPU hotplug topology # # Extend support for dynamic registration and unregistration of the cpu, # by implementing and exporting arch_register_cpu()/arch_unregister_cpu(). # Also combine multiple implementation of topology_init() functions to # single topology_init() in case of ia64 architecture. # # Signed-off-by: Anil S Keshavamurthy # Signed-off-by: Len Brown # # include/linux/cpu.h # 2004/09/24 18:26:27-04:00 len.brown@intel.com +3 -0 # Import patch topology.patch # # include/asm-ia64/cpu.h # 2004/09/24 18:26:27-04:00 len.brown@intel.com +5 -0 # Import patch topology.patch # # include/asm-i386/cpu.h # 2004/09/24 18:26:27-04:00 len.brown@intel.com +4 -13 # Import patch topology.patch # # drivers/base/cpu.c # 2004/09/24 18:26:27-04:00 len.brown@intel.com +18 -2 # Import patch topology.patch # # arch/ia64/mm/numa.c # 2004/10/28 03:36:29-04:00 len.brown@intel.com +0 -36 # Import patch topology.patch # # arch/ia64/kernel/topology.c # 2004/09/24 18:26:27-04:00 len.brown@intel.com +70 -23 # Import patch topology.patch # # arch/ia64/kernel/Makefile # 2004/09/24 18:26:27-04:00 len.brown@intel.com +2 -1 # Import patch topology.patch # # arch/ia64/dig/Makefile # 2004/09/24 18:26:27-04:00 len.brown@intel.com +0 -5 # Import patch topology.patch # # arch/i386/mach-default/topology.c # 2004/09/24 18:26:27-04:00 len.brown@intel.com +31 -0 # Import patch topology.patch # # ChangeSet # 2004/10/28 03:28:17-04:00 len.brown@intel.com # [ACPI] IA64-specific support for mapping lsapic to cpu array. # analogous i386 and x86_64 code TBD # # Signed-off-by: Anil S Keshavamurthy # Signed-off-by: Len Brown # # include/linux/acpi.h # 2004/09/27 12:55:27-04:00 len.brown@intel.com +14 -0 # Import patch acpi_hotplug_arch.patch # # include/asm-ia64/acpi.h # 2004/09/27 13:00:17-04:00 len.brown@intel.com +1 -1 # Import patch acpi_hotplug_arch.patch # # drivers/acpi/numa.c # 2004/09/27 13:04:23-04:00 len.brown@intel.com +20 -1 # Import patch acpi_hotplug_arch.patch # # arch/ia64/kernel/acpi.c # 2004/10/28 03:26:31-04:00 len.brown@intel.com +106 -2 # Import patch acpi_hotplug_arch.patch # # arch/i386/kernel/acpi/boot.c # 2004/09/27 12:55:27-04:00 len.brown@intel.com +22 -0 # Import patch acpi_hotplug_arch.patch # # ChangeSet # 2004/10/28 03:14:52-04:00 len.brown@intel.com # [ACPI] create ACPI hotplug eject interface # # The kernel when it receives an hardware sci eject request it simply passes this # to user mode agent and the agent in turn will offline all the child devices and # then echo's 1 onto the eject file for that acpi device. # # This patch provides the sysfs "eject" interface for the user mode agent # to notify the core acpi so that the core acpi can trim its bus which # causes .remove function to be called for all child devices. # # For example for LSB0 which is an ejectable device, we will see # /sys/firmware/acpi/namespace/ACPI/_SB/LSB/eject. # # Signed-off-by: Anil S Keshavamurthy # Signed-off-by: Len Brown # # drivers/acpi/scan.c # 2004/09/24 18:26:20-04:00 len.brown@intel.com +153 -0 # Import patch acpi_core_eject.patch # # ChangeSet # 2004/10/28 02:59:39-04:00 len.brown@intel.com # [ACPI] Provide core hotplug support in ACPI # # Create acpi_bus_trim(), acpi_bus_remove() and acpi_pci_unbind(), # The reverse of of acpi_bus_scan(), acpi_bus_add() and acpi_pci_bind() # # Signed-off-by: Anil S Keshavamurthy # Signed-off-by: Len Brown # # include/acpi/acpi_drivers.h # 2004/09/24 18:26:17-04:00 len.brown@intel.com +2 -0 # Import patch acpi_core.patch # # include/acpi/acpi_bus.h # 2004/10/28 02:59:06-04:00 len.brown@intel.com +9 -1 # Import patch acpi_core.patch # # drivers/acpi/scan.c # 2004/09/24 18:26:17-04:00 len.brown@intel.com +122 -9 # Import patch acpi_core.patch # # drivers/acpi/pci_irq.c # 2004/09/24 18:26:17-04:00 len.brown@intel.com +39 -3 # Import patch acpi_core.patch # # drivers/acpi/pci_bind.c # 2004/09/24 18:26:17-04:00 len.brown@intel.com +45 -0 # Import patch acpi_core.patch # # drivers/acpi/bus.c # 2004/09/24 18:26:17-04:00 len.brown@intel.com +0 -4 # Import patch acpi_core.patch # # drivers/acpi/acpi_ksyms.c # 2004/09/24 18:26:17-04:00 len.brown@intel.com +3 -0 # Import patch acpi_core.patch # # ChangeSet # 2004/10/28 00:32:55-04:00 trini@kernel.crashing.org # [PATCH] IBM EMAC Kconfig changes: Add 'select CRC32' # # On Mon, Oct 25, 2004 at 09:12:03AM -0700, Tom Rini wrote: # # > In trying to build for IBM 440GP Eval with CRC32=n, I noticed two # > things. First, all of the IBM EMAC Kconfig bits are space, not tab # > indented, and that IBM EMAC doesn't select CRC32 like all of the other # > enet drivers that need it do. # # Add a 'select CRC32' # # Signed-off-by: Tom Rini # Signed-off-by: Jeff Garzik # # drivers/net/Kconfig # 2004/10/27 20:00:00-04:00 trini@kernel.crashing.org +1 -0 # IBM EMAC Kconfig changes: Add 'select CRC32' # # ChangeSet # 2004/10/28 00:32:45-04:00 trini@kernel.crashing.org # [PATCH] IBM EMAC Kconfig changes # # In trying to build for IBM 440GP Eval with CRC32=n, I noticed two # things. First, all of the IBM EMAC Kconfig bits are space, not tab # indented, and that IBM EMAC doesn't select CRC32 like all of the other # enet drivers that need it do. # # Fix spacing of IBM EMAC Kconfig options. # # Signed-off-by: Tom Rini # Signed-off-by: Jeff Garzik # # drivers/net/Kconfig # 2004/10/27 20:00:00-04:00 trini@kernel.crashing.org +21 -21 # IBM EMAC Kconfig changes # # ChangeSet # 2004/10/27 10:40:50-04:00 shemminger@osdl.org # [PATCH] via-velocity: get rid of unused global # # Get rid of unused global variable, name the enum instead. # # Signed-off-by: Stephen Hemminger # Signed-off-by: Jeff Garzik # # drivers/net/via-velocity.h # 2004/10/18 17:04:11-04:00 shemminger@osdl.org +2 -2 # via-velocity: get rid of unused global # # ChangeSet # 2004/10/27 22:33:20+10:00 airlied@starflyer.(none) # drm: device minor fixups and /proc fixups # # This patch fixes up the DRM to do better minor number accounting # and /proc directory creation, the old code was buggy in a number # of situations with multiple cards, and rather ugly. It is also # a step on the way to the drm_core module. # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_stub.h # 2004/10/27 22:33:12+10:00 airlied@starflyer.(none) +173 -135 # drm: device minor fixups and /proc fixups # # This patch fixes up the DRM to do better minor number accounting # and /proc directory creation, the old code was buggy in a number # of situations with multiple cards, and rather ugly. It is also # a step on the way to the drm_core module. # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_proc.h # 2004/10/27 22:33:12+10:00 airlied@starflyer.(none) +6 -14 # drm: device minor fixups and /proc fixups # # This patch fixes up the DRM to do better minor number accounting # and /proc directory creation, the old code was buggy in a number # of situations with multiple cards, and rather ugly. It is also # a step on the way to the drm_core module. # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_drv.h # 2004/10/27 22:33:12+10:00 airlied@starflyer.(none) +89 -97 # drm: device minor fixups and /proc fixups # # This patch fixes up the DRM to do better minor number accounting # and /proc directory creation, the old code was buggy in a number # of situations with multiple cards, and rather ugly. It is also # a step on the way to the drm_core module. # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # drivers/char/drm/drmP.h # 2004/10/27 22:33:12+10:00 airlied@starflyer.(none) +24 -5 # drm: device minor fixups and /proc fixups # # This patch fixes up the DRM to do better minor number accounting # and /proc directory creation, the old code was buggy in a number # of situations with multiple cards, and rather ugly. It is also # a step on the way to the drm_core module. # # From: Jon Smirl and Dave Airlie # Signed-off-by: Dave Airlie # # ChangeSet # 2004/10/26 17:14:34-04:00 akpm@osdl.org # [PATCH] ray_cs export cleanup # # From: Arjan van de Ven # # The ray_cs driver author seemed to have assumed that he needs to exports # functions he registers with the core kernel via function pointers, that of # course isn't the case so the cleanup below removes this; these functions # aren't used anywhere else nor meant to be (they're even static). # # Signed-off-by: Andrew Morton # Signed-off-by: Jeff Garzik # # drivers/net/wireless/ray_cs.c # 2004/10/24 05:01:51-04:00 akpm@osdl.org +0 -4 # ray_cs export cleanup # # ChangeSet # 2004/10/25 22:10:39-04:00 akpm@osdl.org # [PATCH] r8169 module_param build fix # # Signed-off-by: Andrew Morton # Signed-off-by: Jeff Garzik # # drivers/net/r8169.c # 2004/10/24 05:47:51-04:00 akpm@osdl.org +1 -1 # r8169-module_param-fix # # ChangeSet # 2004/10/25 21:22:35-04:00 jgarzik@pobox.com # Merge pobox.com:/garz/repo/linux-2.6 # into pobox.com:/garz/repo/netdev-2.6/r8169 # # drivers/net/Kconfig # 2004/10/25 21:22:31-04:00 jgarzik@pobox.com +0 -0 # Auto merged # # ChangeSet # 2004/10/24 16:48:01-05:00 jejb@mulgrave.(none) # scsi_debug v 1.75 # # From: Douglas Gilbert # # - fix highmem data transfers # - fix kunmap_atomic() argument # - disable clustering # - allow every_nth < 0 for error continuously once # count is reached # - minor sense buffer handling cleanup # # Signed-off-by: James Bottomley # # drivers/scsi/scsi_debug.c # 2004/10/24 16:47:49-05:00 jejb@mulgrave.(none) +265 -214 # scsi_debug v 1.75 # # ChangeSet # 2004/10/24 16:44:56+10:00 airlied@starflyer.(none) # drm: memory allocation patch # # This removes some unnecessary macros for allocating DRM memory. # It doesn't change any functionality. # # From: Jon Smirl # Signed-off-by: Dave Airlie # # drivers/char/drm/radeon_state.c # 2004/10/24 16:44:47+10:00 airlied@starflyer.(none) +2 -1 # drm: memory allocation patch # # This removes some unnecessary macros for allocating DRM memory. # It doesn't change any functionality. # # From: Jon Smirl # Signed-off-by: Dave Airlie # # drivers/char/drm/radeon_mem.c # 2004/10/24 16:44:47+10:00 airlied@starflyer.(none) +10 -10 # drm: memory allocation patch # # This removes some unnecessary macros for allocating DRM memory. # It doesn't change any functionality. # # From: Jon Smirl # Signed-off-by: Dave Airlie # # drivers/char/drm/r128_state.c # 2004/10/24 16:44:47+10:00 airlied@starflyer.(none) +42 -42 # drm: memory allocation patch # # This removes some unnecessary macros for allocating DRM memory. # It doesn't change any functionality. # # From: Jon Smirl # Signed-off-by: Dave Airlie # # drivers/char/drm/i915_mem.c # 2004/10/24 16:44:47+10:00 airlied@starflyer.(none) +10 -10 # drm: memory allocation patch # # This removes some unnecessary macros for allocating DRM memory. # It doesn't change any functionality. # # From: Jon Smirl # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_os_linux.h # 2004/10/24 16:44:47+10:00 airlied@starflyer.(none) +0 -5 # drm: memory allocation patch # # This removes some unnecessary macros for allocating DRM memory. # It doesn't change any functionality. # # From: Jon Smirl # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_memory_debug.h # 2004/10/24 16:44:47+10:00 airlied@starflyer.(none) +1 -1 # drm: memory allocation patch # # This removes some unnecessary macros for allocating DRM memory. # It doesn't change any functionality. # # From: Jon Smirl # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_memory.h # 2004/10/24 16:44:47+10:00 airlied@starflyer.(none) +3 -17 # drm: memory allocation patch # # This removes some unnecessary macros for allocating DRM memory. # It doesn't change any functionality. # # From: Jon Smirl # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_irq.h # 2004/10/24 16:44:47+10:00 airlied@starflyer.(none) +2 -2 # drm: memory allocation patch # # This removes some unnecessary macros for allocating DRM memory. # It doesn't change any functionality. # # From: Jon Smirl # Signed-off-by: Dave Airlie # # drivers/char/drm/drmP.h # 2004/10/24 16:44:47+10:00 airlied@starflyer.(none) +20 -2 # drm: memory allocation patch # # This removes some unnecessary macros for allocating DRM memory. # It doesn't change any functionality. # # From: Jon Smirl # Signed-off-by: Dave Airlie # # ChangeSet # 2004/10/24 11:54:23+10:00 airlied@starflyer.(none) # drm: initial core move infrastructure change # # Initial infrastructure - move old H files to C files # also Kconfig and Makefile changes # # Signed-off-by: Dave Airlie # # drivers/char/drm/Makefile # 2004/10/24 11:54:11+10:00 airlied@starflyer.(none) +6 -0 # drm: initial core move infrastructure change # # Initial infrastructure - move old H files to C files # also Kconfig and Makefile changes # # Signed-off-by: Dave Airlie # # drivers/char/drm/Kconfig # 2004/10/24 11:54:11+10:00 airlied@starflyer.(none) +1 -1 # drm: initial core move infrastructure change # # Initial infrastructure - move old H files to C files # also Kconfig and Makefile changes # # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_scatter.c # 2004/10/24 11:49:08+10:00 airlied@starflyer.(none) +0 -0 # Rename: drivers/char/drm/drm_scatter.h -> drivers/char/drm/drm_scatter.c # # drivers/char/drm/drm_agpsupport.c # 2004/10/24 11:49:02+10:00 airlied@starflyer.(none) +0 -0 # Rename: drivers/char/drm/drm_agpsupport.h -> drivers/char/drm/drm_agpsupport.c # # drivers/char/drm/drm_vm.c # 2004/10/24 11:48:49+10:00 airlied@starflyer.(none) +0 -0 # Rename: drivers/char/drm/drm_vm.h -> drivers/char/drm/drm_vm.c # # drivers/char/drm/drm_stub.c # 2004/10/24 11:48:41+10:00 airlied@starflyer.(none) +0 -0 # Rename: drivers/char/drm/drm_stub.h -> drivers/char/drm/drm_stub.c # # drivers/char/drm/drm_proc.c # 2004/10/24 11:48:34+10:00 airlied@starflyer.(none) +0 -0 # Rename: drivers/char/drm/drm_proc.h -> drivers/char/drm/drm_proc.c # # drivers/char/drm/drm_memory.c # 2004/10/24 11:48:27+10:00 airlied@starflyer.(none) +0 -0 # Rename: drivers/char/drm/drm_memory.h -> drivers/char/drm/drm_memory.c # # drivers/char/drm/drm_lock.c # 2004/10/24 11:48:21+10:00 airlied@starflyer.(none) +0 -0 # Rename: drivers/char/drm/drm_lock.h -> drivers/char/drm/drm_lock.c # # drivers/char/drm/drm_irq.c # 2004/10/24 11:48:14+10:00 airlied@starflyer.(none) +0 -0 # Rename: drivers/char/drm/drm_irq.h -> drivers/char/drm/drm_irq.c # # drivers/char/drm/drm_ioctl.c # 2004/10/24 11:48:08+10:00 airlied@starflyer.(none) +0 -0 # Rename: drivers/char/drm/drm_ioctl.h -> drivers/char/drm/drm_ioctl.c # # drivers/char/drm/drm_init.c # 2004/10/24 11:48:02+10:00 airlied@starflyer.(none) +0 -0 # Rename: drivers/char/drm/drm_init.h -> drivers/char/drm/drm_init.c # # drivers/char/drm/drm_fops.c # 2004/10/24 11:47:54+10:00 airlied@starflyer.(none) +0 -0 # Rename: drivers/char/drm/drm_fops.h -> drivers/char/drm/drm_fops.c # # drivers/char/drm/drm_drv.c # 2004/10/24 11:47:46+10:00 airlied@starflyer.(none) +0 -0 # Rename: drivers/char/drm/drm_drv.h -> drivers/char/drm/drm_drv.c # # drivers/char/drm/drm_drawable.c # 2004/10/24 11:47:39+10:00 airlied@starflyer.(none) +0 -0 # Rename: drivers/char/drm/drm_drawable.h -> drivers/char/drm/drm_drawable.c # # drivers/char/drm/drm_dma.c # 2004/10/24 11:47:32+10:00 airlied@starflyer.(none) +0 -0 # Rename: drivers/char/drm/drm_dma.h -> drivers/char/drm/drm_dma.c # # drivers/char/drm/drm_context.c # 2004/10/24 11:47:27+10:00 airlied@starflyer.(none) +0 -0 # Rename: drivers/char/drm/drm_context.h -> drivers/char/drm/drm_context.c # # drivers/char/drm/drm_bufs.c # 2004/10/24 11:47:19+10:00 airlied@starflyer.(none) +0 -0 # Rename: drivers/char/drm/drm_bufs.h -> drivers/char/drm/drm_bufs.c # # drivers/char/drm/drm_auth.c # 2004/10/24 11:46:56+10:00 airlied@starflyer.(none) +0 -0 # Rename: drivers/char/drm/drm_auth.h -> drivers/char/drm/drm_auth.c # # ChangeSet # 2004/10/21 18:41:34-04:00 viro@www.linux.org.uk # [PATCH] mace iomem annotations - trivial part # # Signed-off-by: Al Viro # # drivers/net/mace.c # 2004/10/21 10:48:48-04:00 viro@www.linux.org.uk +32 -34 # (17/18) mace iomem annotations - trivial part # # ChangeSet # 2004/10/21 18:40:03-04:00 viro@www.linux.org.uk # [PATCH] airo iomem annotations # # Signed-off-by: Al Viro # # drivers/net/wireless/airo.c # 2004/10/21 10:48:47-04:00 viro@www.linux.org.uk +21 -21 # (14/18) airo iomem annotations # # ChangeSet # 2004/10/21 18:39:52-04:00 viro@www.linux.org.uk # [PATCH] wavelan_cs iomem annotations # # Signed-off-by: Al Viro # # drivers/net/wireless/wavelan_cs.p.h # 2004/10/21 10:48:47-04:00 viro@www.linux.org.uk +1 -0 # (13/18) wavelan_cs iomem annotations # # drivers/net/wireless/wavelan_cs.c # 2004/10/21 10:48:47-04:00 viro@www.linux.org.uk +14 -11 # (13/18) wavelan_cs iomem annotations # # ChangeSet # 2004/10/21 18:28:58-04:00 viro@www.linux.org.uk # [PATCH] skfp iomem annotations, switch to io{read,write} # # Signed-off-by: Al Viro # # drivers/net/skfp/skfddi.c # 2004/10/21 10:48:45-04:00 viro@www.linux.org.uk +16 -9 # (8/18) skfp iomem annotations, switch to io{read,write} # # drivers/net/skfp/h/types.h # 2004/10/21 10:48:45-04:00 viro@www.linux.org.uk +6 -15 # (8/18) skfp iomem annotations, switch to io{read,write} # # drivers/net/skfp/h/targetos.h # 2004/10/21 10:48:45-04:00 viro@www.linux.org.uk +1 -1 # (8/18) skfp iomem annotations, switch to io{read,write} # # drivers/net/skfp/h/targethw.h # 2004/10/21 10:48:45-04:00 viro@www.linux.org.uk +1 -5 # (8/18) skfp iomem annotations, switch to io{read,write} # # drivers/net/skfp/h/fplustm.h # 2004/10/21 10:48:45-04:00 viro@www.linux.org.uk +1 -5 # (8/18) skfp iomem annotations, switch to io{read,write} # # ChangeSet # 2004/10/21 18:26:47-04:00 viro@www.linux.org.uk # [PATCH] olympic_open() cleanup and fixes # # Signed-off-by: Al Viro # # drivers/net/tokenring/olympic.c # 2004/10/21 10:48:44-04:00 viro@www.linux.org.uk +46 -48 # (6/18) olympic_open() cleanup and fixes # # ChangeSet # 2004/10/21 18:26:35-04:00 viro@www.linux.org.uk # [PATCH] sundance iomem annotations, switch to io{read,write} # # Signed-off-by: Al Viro # # drivers/net/sundance.c # 2004/10/21 10:56:28-04:00 viro@www.linux.org.uk +121 -138 # (3/18) sundance iomem annotations, switch to io{read,write} # # ChangeSet # 2004/10/21 18:25:51-04:00 viro@www.linux.org.uk # [PATCH] via-rhine iomem annotations, switch to io{read,write} # # Signed-off-by: Al Viro # # drivers/net/via-rhine.c # 2004/10/21 11:02:43-04:00 viro@www.linux.org.uk +127 -140 # (2/18) via-rhine iomem annotations, switch to io{read,write} # # ChangeSet # 2004/10/21 18:17:45-04:00 jgarzik@pobox.com # Merge pobox.com:/garz/repo/linux-2.6 # into pobox.com:/garz/repo/netdev-2.6/via-rhine # # drivers/net/via-rhine.c # 2004/10/21 18:17:40-04:00 jgarzik@pobox.com +0 -0 # Auto merged # # ChangeSet # 2004/10/21 18:14:03-04:00 jgarzik@pobox.com # Merge pobox.com:/garz/repo/linux-2.6 # into pobox.com:/garz/repo/netdev-2.6/viro-eth1 # # drivers/net/wireless/netwave_cs.c # 2004/10/21 18:14:00-04:00 jgarzik@pobox.com +0 -0 # Auto merged # # drivers/net/wireless/arlan.h # 2004/10/21 18:13:59-04:00 jgarzik@pobox.com +0 -0 # Auto merged # # drivers/net/tokenring/lanstreamer.c # 2004/10/21 18:13:59-04:00 jgarzik@pobox.com +0 -0 # Auto merged # # drivers/net/starfire.c # 2004/10/21 18:13:59-04:00 jgarzik@pobox.com +0 -0 # Auto merged # # ChangeSet # 2004/10/20 01:23:43-04:00 viro@www.linux.org.uk # [PATCH] netwave iomem annotations # # Signed-off-by: Al Viro # # drivers/net/wireless/netwave_cs.c # 2004/10/15 14:40:21-04:00 viro@www.linux.org.uk +23 -19 # (30/32) netwave iomem annotations # # ChangeSet # 2004/10/20 01:23:33-04:00 viro@www.linux.org.uk # [PATCH] arlan iomem annotations and cleanups # # iomem annotations + couple of bad implementations of offsetof() replaced with # the real thing. # # Signed-off-by: Al Viro # # drivers/net/wireless/arlan.h # 2004/10/15 14:35:50-04:00 viro@www.linux.org.uk +3 -5 # (28/32) arlan iomem annotations and cleanups # # drivers/net/wireless/arlan-proc.c # 2004/10/15 14:32:05-04:00 viro@www.linux.org.uk +5 -5 # (28/32) arlan iomem annotations and cleanups # # drivers/net/wireless/arlan-main.c # 2004/10/15 14:31:08-04:00 viro@www.linux.org.uk +21 -21 # (28/32) arlan iomem annotations and cleanups # # ChangeSet # 2004/10/20 01:23:23-04:00 viro@www.linux.org.uk # [PATCH] netdev_priv() in netwave_cs # # Signed-off-by: Al Viro # # drivers/net/wireless/netwave_cs.c # 2004/10/15 14:43:33-04:00 viro@www.linux.org.uk +18 -17 # (29/32) netdev_priv() in netwave_cs # # ChangeSet # 2004/10/20 01:23:12-04:00 viro@www.linux.org.uk # [PATCH] netdev_priv() in arlan # # Signed-off-by: Al Viro # # drivers/net/wireless/arlan.h # 2004/10/15 14:36:05-04:00 viro@www.linux.org.uk +10 -10 # (27/32) netdev_priv() in arlan # # drivers/net/wireless/arlan-proc.c # 2004/10/15 14:33:52-04:00 viro@www.linux.org.uk +10 -5 # (27/32) netdev_priv() in arlan # # drivers/net/wireless/arlan-main.c # 2004/10/15 14:26:22-04:00 viro@www.linux.org.uk +24 -24 # (27/32) netdev_priv() in arlan # # ChangeSet # 2004/10/20 01:18:24-04:00 viro@www.linux.org.uk # [PATCH] (25/32) lanstreamer iomem annotations # # Signed-off-by: Al Viro # # drivers/net/tokenring/lanstreamer.h # 2004/10/15 14:20:31-04:00 viro@www.linux.org.uk +1 -1 # (25/32) lanstreamer iomem annotations # # drivers/net/tokenring/lanstreamer.c # 2004/10/15 14:20:29-04:00 viro@www.linux.org.uk +12 -12 # (25/32) lanstreamer iomem annotations # # ChangeSet # 2004/10/20 00:51:07-04:00 viro@www.linux.org.uk # [PATCH] starfire iomem annotations # # Signed-off-by: Al Viro # # drivers/net/starfire.c # 2004/10/15 12:44:23-04:00 viro@www.linux.org.uk +40 -39 # (18/32) starfire iomem annotations # # ChangeSet # 2004/10/19 11:27:26-04:00 romieu@fr.zoreil.com # [PATCH] r8169: netconsole support # # netconsole support. # # Signed-off-by: John W. Linville # # drivers/net/r8169.c # 2004/10/18 17:56:27-04:00 romieu@fr.zoreil.com +21 -0 # r8169: netconsole support # # ChangeSet # 2004/10/19 11:27:11-04:00 romieu@fr.zoreil.com # [PATCH] r8169: unneeded synchronize_irq() # # synchronize_irq() is not needed as it is already issued by free_irq(). # # Signed-off-by: Francois Romieu # # drivers/net/r8169.c # 2004/10/18 17:37:58-04:00 romieu@fr.zoreil.com +0 -1 # r8169: unneeded synchronize_irq() # # ChangeSet # 2004/10/19 11:26:56-04:00 romieu@fr.zoreil.com # [PATCH] r8169: always clean Tx desc # # rtl8169_unmap_tx_skb() can not assume that a Tx ring descriptor belongs # to the host as it can be issued during rtl8169_tx_clear() as a part of # a recovery process (during Tx timeout for instance). # # Simple fix: always clean the relevant descriptor entry. # # Acked-by: Francois Romieu # Signed-off-by: Jon Mason # # drivers/net/r8169.c # 2004/10/18 17:31:21-04:00 romieu@fr.zoreil.com +1 -0 # r8169: always clean Tx desc # # ChangeSet # 2004/10/15 19:49:50-04:00 shemminger@osdl.org # [PATCH] via-rhine: free_ring should be static # # free_ring is a local function # # Signed-off-by: Stephen Hemminger # # drivers/net/via-rhine.c # 2004/10/15 15:45:02-04:00 shemminger@osdl.org +1 -1 # via-rhine: free_ring should be static # # ChangeSet # 2004/10/15 19:49:38-04:00 shemminger@osdl.org # [PATCH] via-rhine: use module_param # # Signed-off-by: Stephen Hemminger # # drivers/net/via-rhine.c # 2004/10/15 15:27:28-04:00 shemminger@osdl.org +4 -3 # via-rhine: use module_param # # ChangeSet # 2004/10/15 19:22:45-04:00 shemminger@osdl.org # [PATCH] r8169: use netdev_priv # # Use netdev_priv in a couple of places in realtek 8169 # # Signed-off-by: Stephen Hemminger # # drivers/net/r8169.c # 2004/10/15 18:00:43-04:00 shemminger@osdl.org +2 -2 # r8169: use netdev_priv # # ChangeSet # 2004/10/15 19:22:14-04:00 shemminger@osdl.org # [PATCH] r8169: use module_param # # Use module_param instead of deprecated MDOULE_PARM # # Signed-off-by: Stephen Hemminger # # drivers/net/r8169.c # 2004/10/15 17:56:05-04:00 shemminger@osdl.org +5 -3 # r8169: use module_param # # ChangeSet # 2004/10/15 14:56:05-04:00 viro@parcelfarce.linux.theplanet.co.uk # [PATCH] iomem annotations in r8169 # # Signed-off-by: Al Viro # # drivers/net/r8169.c # 2004/10/13 13:49:51-04:00 viro@parcelfarce.linux.theplanet.co.uk +42 -42 # annotations in r8169 # # ChangeSet # 2004/10/04 16:46:51-04:00 romieu@fr.zoreil.com # [PATCH] r8169: cleanup # # Cleanup # - timeout message is redundant with net/sched/sch_generic::dev_watchdog; # - anti-bloat in rtl8169_get_rx_csum; # - format fix. # # Signed-off-by: Francois Romieu # Signed-off-by: Jon Mason # # drivers/net/r8169.c # 2004/10/04 15:27:47-04:00 romieu@fr.zoreil.com +3 -5 # r8169: cleanup # # ChangeSet # 2004/10/04 16:46:37-04:00 romieu@fr.zoreil.com # [PATCH] r8169: rtl8169_close() races # # - close the race with rtl8169_interrupt() which appears when rtl8169_close() # uses synchronize_irq()/free_irq(); # - netif_poll_disable() allows rtl8169_close() to wait for any pending # rtl8169_poll() to complete so it can safely clear the rings. # # Signed-off-by: Francois Romieu # # drivers/net/r8169.c # 2004/10/04 15:26:01-04:00 romieu@fr.zoreil.com +6 -0 # r8169: rtl8169_close() races # # ChangeSet # 2004/10/04 16:46:24-04:00 romieu@fr.zoreil.com # [PATCH] r8169: automatic pci dac step down # # Automatic adjustement of highmem dma feature. # # The first interruption encountered on systems where the 8169 does not # perform PCI DAC correctly seems to always be a PCI error one. # When DAC is enabled, the driver tries to issue a complete down/up # sequence as an addition to the usual halt of the device. # # Signed-off-by: Francois Romieu # # drivers/net/r8169.c # 2004/10/04 15:25:07-04:00 romieu@fr.zoreil.com +70 -7 # r8169: automatic pci dac step down # # ChangeSet # 2004/10/04 16:46:10-04:00 romieu@fr.zoreil.com # [PATCH] r8169: wrong advertisement of VLAN features # # Removal of an advertisement for VLAN features which is redundant with # rtl8169_init_one(). # # Signed-off-by: Jon Mason # # drivers/net/r8169.c # 2004/10/04 15:17:44-04:00 romieu@fr.zoreil.com +0 -2 # r8169: wrong advertisement of VLAN features # # ChangeSet # 2004/10/04 16:45:56-04:00 romieu@fr.zoreil.com # [PATCH] r8169: Tx timeout rework # # Tx timeout rework: # - the ring descriptors of the chipset and the ring index of the driver # are synced during a reset of the device; # - rtl8169_interrupt: rtl8169_hw_reset() replaces the previous stop code. # An implicit reset of the device is added but it makes no noticeable # difference with the former behavior (i.e.: stop the chipset). # # Signed-off-by: Francois Romieu # # drivers/net/r8169.c # 2004/10/04 15:15:41-04:00 romieu@fr.zoreil.com +65 -24 # r8169: Tx timeout rework # # ChangeSet # 2004/09/20 18:37:18-04:00 jgarzik@pobox.com # Hand-merge upstream r8169 DAC changes. # # drivers/net/r8169.c # 2004/09/20 18:37:11-04:00 jgarzik@pobox.com +0 -14 # Hand-merge upstream r8169 DAC changes. # # drivers/net/Kconfig # 2004/09/20 18:35:32-04:00 jgarzik@pobox.com +0 -0 # Auto merged # # ChangeSet # 2004/09/20 14:06:35-04:00 romieu@fr.zoreil.com # [PATCH] r8169: default on disabling PCIDAC # # Default to disabling PCI DAC as this option appears unsafe on amd64 # (original suggestion by Hans-Frieder Vogt ). # # The driver will typically report PCI System error when something goes # wrong. The relevant interrupt is not masked any more and the driver # can thus be disabled. # # Signed-off-by: Francois Romieu # # drivers/net/r8169.c # 2004/09/19 18:16:02-04:00 romieu@fr.zoreil.com +15 -2 # r8169: default on disabling PCIDAC # # ChangeSet # 2004/09/16 20:34:40-04:00 romieu@fr.zoreil.com # [PATCH] r8169: Mac identifier extracted from Realtek's driver v2.2 # # Mac identifier extracted from Realtek's driver v2.2. # # Signed-off-by: Francois Romieu # # drivers/net/r8169.c # 2004/09/08 17:31:09-04:00 romieu@fr.zoreil.com +3 -1 # r8169: Mac identifier extracted from Realtek's driver v2.2 # # ChangeSet # 2004/09/16 20:34:28-04:00 romieu@fr.zoreil.com # [PATCH] r8169: TSO support. # # TSO support. Suggestion of Jeff Garzik. # # Signed-off-by: Francois Romieu # # drivers/net/r8169.c # 2004/09/08 16:53:47-04:00 romieu@fr.zoreil.com +14 -3 # r8169: TSO support. # # ChangeSet # 2004/09/16 20:34:16-04:00 romieu@fr.zoreil.com # [PATCH] r8169: hint for Tx flow control # # return 1 in start_xmit() when the required descriptors are not available # and wait for more room. # # Signed-off-by: Francois Romieu # # drivers/net/r8169.c # 2004/09/08 16:04:04-04:00 romieu@fr.zoreil.com +7 -5 # r8169: hint for Tx flow control # # ChangeSet # 2004/09/16 20:34:04-04:00 romieu@fr.zoreil.com # [PATCH] r8169: miscalculation of available Tx descriptors # # The count of available entries in the Tx descriptors ring is badly wrong. # # Signed-off-by: Francois Romieu # # drivers/net/r8169.c # 2004/09/08 16:02:35-04:00 romieu@fr.zoreil.com +9 -5 # r8169: miscalculation of available Tx descriptors # # ChangeSet # 2004/09/16 20:27:36-04:00 jgarzik@pobox.com # Merge pobox.com:/spare/repo/linux-2.6 # into pobox.com:/spare/repo/netdev-2.6/r8169 # # drivers/net/Kconfig # 2004/09/16 20:27:32-04:00 jgarzik@pobox.com +0 -0 # Auto merged # # ChangeSet # 2004/08/31 03:18:42-04:00 jgarzik@pobox.com # Hand-merge upstream r8169 change. # # drivers/net/r8169.c # 2004/08/31 03:18:36-04:00 jgarzik@pobox.com +1 -2 # Hand-merge upstream r8169 change. # # ChangeSet # 2004/08/28 19:20:27-04:00 romieu@fr.zoreil.com # [PATCH] r8169: vlan support # # 802.1Q support. # Mostly stolen from the 8139cp.c driver. The relevant registers and # descriptors bits are identical for both chipsets. # # Signed-off-by: Francois Romieu # # drivers/net/r8169.c # 2004/08/23 17:31:33-04:00 romieu@fr.zoreil.com +94 -2 # r8169: vlan support # # drivers/net/Kconfig # 2004/08/23 17:31:33-04:00 romieu@fr.zoreil.com +9 -0 # r8169: vlan support # # ChangeSet # 2004/08/28 19:20:17-04:00 romieu@fr.zoreil.com # [PATCH] r8169: Rx checksum support # # Rx IP checksumming support. # # Signed-off-by: Francois Romieu # # drivers/net/r8169.c # 2004/08/23 17:30:08-04:00 romieu@fr.zoreil.com +58 -1 # r8169: Rx checksum support # # ChangeSet # 2004/08/28 19:20:06-04:00 romieu@fr.zoreil.com # [PATCH] r8169: advertise DMA to high memory # # Advertise the ability to DMA to high memory. # # Signed-off-by: Francois Romieu # # drivers/net/r8169.c # 2004/08/23 17:30:06-04:00 romieu@fr.zoreil.com +3 -4 # r8169: advertise DMA to high memory # # ChangeSet # 2004/08/28 19:19:56-04:00 romieu@fr.zoreil.com # [PATCH] r8169: Tx checksum offload # # SG and IP checksumming support on output. # # Signed-off-by: Francois Romieu # # drivers/net/r8169.c # 2004/08/23 17:30:04-04:00 romieu@fr.zoreil.com +153 -58 # r8169: Tx checksum offload # # ChangeSet # 2004/08/28 19:19:45-04:00 romieu@fr.zoreil.com # [PATCH] r8169: comment a gcc 2.95.x bug # # gcc 2.95.3 bug has been experienced on gcc 2.95.4. # # Signed-off-by: Francois Romieu # # drivers/net/r8169.c # 2004/08/23 17:30:03-04:00 romieu@fr.zoreil.com +1 -1 # r8169: comment a gcc 2.95.x bug # # ChangeSet # 2004/08/28 19:19:34-04:00 romieu@fr.zoreil.com # [PATCH] r8169: sync the names of a few bits with the 8139cp driver # # Sync the names of the descriptor with these which are used in the 8139cp # driver. Though not exactly identical the descriptors are forward compatible. # # Signed-off-by: Francois Romieu # # drivers/net/r8169.c # 2004/08/23 17:30:01-04:00 romieu@fr.zoreil.com +20 -20 # r8169: sync the names of a few bits with the 8139cp driver # # ChangeSet # 2004/08/28 19:19:23-04:00 romieu@fr.zoreil.com # [PATCH] r8169: bump version number # # Help reviewers realize that the in-kernel driver has evolved lately. # # Signed-off-by: Francois Romieu # # drivers/net/r8169.c # 2004/08/23 17:30:00-04:00 romieu@fr.zoreil.com +10 -1 # r8169: bump version number # # ChangeSet # 2004/08/28 19:19:13-04:00 romieu@fr.zoreil.com # [PATCH] r8169: enable MWI # # - enable Memory Write and Invalidate (disabled after reset); # - fix wrong goto. # # Signed-off-by: Francois Romieu # # drivers/net/r8169.c # 2004/08/23 17:30:00-04:00 romieu@fr.zoreil.com +11 -6 # r8169: enable MWI # # ChangeSet # 2004/08/28 19:19:03-04:00 romieu@fr.zoreil.com # [PATCH] r8169: code cleanup # # Cleanup/code removal: # - MAX_ETH_FRAME_SIZE is not used; # - removal of assertion for impossible condition (if it happens, it will _not_ # take long to notice anyway) # - introduce rtl8169_release_board() to factor out some code; # - rtl8169_init_board: # - some variables are not really needed nor do they help read the code; # - more explicit name for label; # - tp->{Rx/Tx}DescArray: no need to zeroize coherent DMA mapping. # # Signed-off-by: Francois Romieu # # drivers/net/r8169.c # 2004/08/23 17:29:59-04:00 romieu@fr.zoreil.com +26 -38 # r8169: code cleanup # # ChangeSet # 2004/08/28 19:18:52-04:00 romieu@fr.zoreil.com # [PATCH] r8169: per device receive buffer size # # Turn the Rx receive buffer size into a per device variable. # # Signed-off-by: Francois Romieu # # drivers/net/r8169.c # 2004/08/23 17:29:59-04:00 romieu@fr.zoreil.com +28 -23 # r8169: per device receive buffer size # # ChangeSet # 2004/08/28 19:18:40-04:00 romieu@fr.zoreil.com # [PATCH] r8169: add ethtool_ops.{get_regs_len/get_regs} # # - ethtool_ops.{get_regs_len/get_regs} for r8169; # - fix a dubious check: datasheet v1.21 claims on p.44 that io/memory space # is exactly 256 bytes wide; # - use SET_ETHTOOL_OPS(). # # Signed-off-by: Francois Romieu # # drivers/net/r8169.c # 2004/08/23 17:29:58-04:00 romieu@fr.zoreil.com +23 -3 # r8169: add ethtool_ops.{get_regs_len/get_regs} # diff -Nru a/CREDITS b/CREDITS --- a/CREDITS 2005-01-02 23:03:34 -08:00 +++ b/CREDITS 2005-01-02 23:03:34 -08:00 @@ -1893,7 +1893,7 @@ D: Bug fixes N: Paul Laufer -E: pelaufer@csupomona.edu +E: paul@laufernet.com D: Soundblaster driver fixes, ISAPnP quirk S: California, USA @@ -2020,6 +2020,15 @@ N: H.J. Lu E: hjl@gnu.ai.mit.edu D: GCC + libraries hacker + +N: Michal Ludvig +E: michal@logix.cz +W: http://www.logix.cz/michal +P: 1024D/C45B2218 1162 6471 D391 76E0 9F99 29DA 0C3A 2509 C45B 2218 +D: VIA PadLock driver +D: Netfilter pkttype module +S: Prague 4 +S: Czech Republic N: Tuomas J. Lukka E: Tuomas.Lukka@Helsinki.FI diff -Nru a/Documentation/ide.txt b/Documentation/ide.txt --- a/Documentation/ide.txt 2005-01-02 23:03:34 -08:00 +++ b/Documentation/ide.txt 2005-01-02 23:03:34 -08:00 @@ -297,6 +297,8 @@ "ide=reverse" : formerly called to pci sub-system, but now local. + "ide=nodma" : disable DMA globally for the IDE subsystem. + The following are valid ONLY on ide0, which usually corresponds to the first ATA interface found on the particular host, and the defaults for the base,ctl ports must not be altered. diff -Nru a/Documentation/infiniband/ipoib.txt b/Documentation/infiniband/ipoib.txt --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/Documentation/infiniband/ipoib.txt 2005-01-02 23:03:35 -08:00 @@ -0,0 +1,56 @@ +IP OVER INFINIBAND + + The ib_ipoib driver is an implementation of the IP over InfiniBand + protocol as specified by the latest Internet-Drafts issued by the + IETF ipoib working group. It is a "native" implementation in the + sense of setting the interface type to ARPHRD_INFINIBAND and the + hardware address length to 20 (earlier proprietary implementations + masqueraded to the kernel as ethernet interfaces). + +Partitions and P_Keys + + When the IPoIB driver is loaded, it creates one interface for each + port using the P_Key at index 0. To create an interface with a + different P_Key, write the desired P_Key into the main interface's + /sys/class/net//create_child file. For example: + + echo 0x8001 > /sys/class/net/ib0/create_child + + This will create an interface named ib0.8001 with P_Key 0x8001. To + remove a subinterface, use the "delete_child" file: + + echo 0x8001 > /sys/class/net/ib0/delete_child + + The P_Key for any interface is given by the "pkey" file, and the + main interface for a subinterface is in "parent." + +Debugging Information + + By compiling the IPoIB driver with CONFIG_INFINIBAND_IPOIB_DEBUG set + to 'y', tracing messages are compiled into the driver. They are + turned on by setting the module parameters debug_level and + mcast_debug_level to 1. These parameters can be controlled at + runtime through files in /sys/module/ib_ipoib/. + + CONFIG_INFINIBAND_IPOIB_DEBUG also enables the "ipoib_debugfs" + virtual filesystem. By mounting this filesystem, for example with + + mkdir -p /ipoib_debugfs + mount -t ipoib_debugfs none /ipoib_debufs + + it is possible to get statistics about multicast groups from the + files /ipoib_debugfs/ib0_mcg and so on. + + The performance impact of this option is negligible, so it + is safe to enable this option with debug_level set to 0 for normal + operation. + + CONFIG_INFINIBAND_IPOIB_DEBUG_DATA enables even more debug output in + the data path when data_debug_level is set to 1. However, even with + the output disabled, enabling this configuration option will affect + performance, because it adds tests to the fast path. + +References + + IETF IP over InfiniBand (ipoib) Working Group + http://ietf.org/html.charters/ipoib-charter.html diff -Nru a/Documentation/infiniband/sysfs.txt b/Documentation/infiniband/sysfs.txt --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/Documentation/infiniband/sysfs.txt 2005-01-02 23:03:35 -08:00 @@ -0,0 +1,64 @@ +SYSFS FILES + + For each InfiniBand device, the InfiniBand drivers create the + following files under /sys/class/infiniband/: + + node_guid - Node GUID + sys_image_guid - System image GUID + + In addition, there is a "ports" subdirectory, with one subdirectory + for each port. For example, if mthca0 is a 2-port HCA, there will + be two directories: + + /sys/class/infiniband/mthca0/ports/1 + /sys/class/infiniband/mthca0/ports/2 + + (A switch will only have a single "0" subdirectory for switch port + 0; no subdirectory is created for normal switch ports) + + In each port subdirectory, the following files are created: + + cap_mask - Port capability mask + lid - Port LID + lid_mask_count - Port LID mask count + rate - Port data rate (active width * active speed) + sm_lid - Subnet manager LID for port's subnet + sm_sl - Subnet manager SL for port's subnet + state - Port state (DOWN, INIT, ARMED, ACTIVE or ACTIVE_DEFER) + + There is also a "counters" subdirectory, with files + + VL15_dropped + excessive_buffer_overrun_errors + link_downed + link_error_recovery + local_link_integrity_errors + port_rcv_constraint_errors + port_rcv_data + port_rcv_errors + port_rcv_packets + port_rcv_remote_physical_errors + port_rcv_switch_relay_errors + port_xmit_constraint_errors + port_xmit_data + port_xmit_discards + port_xmit_packets + symbol_error + + Each of these files contains the corresponding value from the port's + Performance Management PortCounters attribute, as described in + section 16.1.3.5 of the InfiniBand Architecture Specification. + + The "pkeys" and "gids" subdirectories contain one file for each + entry in the port's P_Key or GID table respectively. For example, + ports/1/pkeys/10 contains the value at index 10 in port 1's P_Key + table. + +MTHCA + + The Mellanox HCA driver also creates the files: + + hw_rev - Hardware revision number + fw_ver - Firmware version + hca_type - HCA type: "MT23108", "MT25208 (MT23108 compat mode)", + or "MT25208" diff -Nru a/Documentation/infiniband/user_mad.txt b/Documentation/infiniband/user_mad.txt --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/Documentation/infiniband/user_mad.txt 2005-01-02 23:03:35 -08:00 @@ -0,0 +1,81 @@ +USERSPACE MAD ACCESS + +Device files + + Each port of each InfiniBand device has a "umad" device attached. + For example, a two-port HCA will have two devices, while a switch + will have one device (for switch port 0). + +Creating MAD agents + + A MAD agent can be created by filling in a struct ib_user_mad_reg_req + and then calling the IB_USER_MAD_REGISTER_AGENT ioctl on a file + descriptor for the appropriate device file. If the registration + request succeeds, a 32-bit id will be returned in the structure. + For example: + + struct ib_user_mad_reg_req req = { /* ... */ }; + ret = ioctl(fd, IB_USER_MAD_REGISTER_AGENT, (char *) &req); + if (!ret) + my_agent = req.id; + else + perror("agent register"); + + Agents can be unregistered with the IB_USER_MAD_UNREGISTER_AGENT + ioctl. Also, all agents registered through a file descriptor will + be unregistered when the descriptor is closed. + +Receiving MADs + + MADs are received using read(). The buffer passed to read() must be + large enough to hold at least one struct ib_user_mad. For example: + + struct ib_user_mad mad; + ret = read(fd, &mad, sizeof mad); + if (ret != sizeof mad) + perror("read"); + + In addition to the actual MAD contents, the other struct ib_user_mad + fields will be filled in with information on the received MAD. For + example, the remote LID will be in mad.lid. + + If a send times out, a receive will be generated with mad.status set + to ETIMEDOUT. Otherwise when a MAD has been successfully received, + mad.status will be 0. + + poll()/select() may be used to wait until a MAD can be read. + +Sending MADs + + MADs are sent using write(). The agent ID for sending should be + filled into the id field of the MAD, the destination LID should be + filled into the lid field, and so on. For example: + + struct ib_user_mad mad; + + /* fill in mad.data */ + + mad.id = my_agent; /* req.id from agent registration */ + mad.lid = my_dest; /* in network byte order... */ + /* etc. */ + + ret = write(fd, &mad, sizeof mad); + if (ret != sizeof mad) + perror("write"); + +/dev files + + To create the appropriate character device files automatically with + udev, a rule like + + KERNEL="umad*", NAME="infiniband/%k" + + can be used. This will create a device node named + + /dev/infiniband/umad0 + + for the first port, and so on. The InfiniBand device and port + associated with this device can be determined from the files + + /sys/class/infiniband_mad/umad0/ibdev + /sys/class/infiniband_mad/umad0/port diff -Nru a/Documentation/ioctl-number.txt b/Documentation/ioctl-number.txt --- a/Documentation/ioctl-number.txt 2005-01-02 23:03:35 -08:00 +++ b/Documentation/ioctl-number.txt 2005-01-02 23:03:35 -08:00 @@ -72,6 +72,7 @@ 0x09 all linux/md.h 0x12 all linux/fs.h linux/blkpg.h +0x1b all InfiniBand Subsystem 0x20 all drivers/cdrom/cm206.h 0x22 all scsi/sg.h '#' 00-3F IEEE 1394 Subsystem Block for the entire subsystem diff -Nru a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt --- a/Documentation/kernel-parameters.txt 2005-01-02 23:03:35 -08:00 +++ b/Documentation/kernel-parameters.txt 2005-01-02 23:03:35 -08:00 @@ -150,6 +150,8 @@ debugging. After system has booted up, it can be set via /proc/acpi/debug_level. + acpi_fake_ecdt [HW,ACPI] Workaround failure due to BIOS lacking ECDT + ad1816= [HW,OSS] Format: ,,, See also Documentation/sound/oss/AD1816. diff -Nru a/Documentation/scsi/ChangeLog b/Documentation/scsi/ChangeLog --- a/Documentation/scsi/ChangeLog 2005-01-02 23:03:33 -08:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,2023 +0,0 @@ -Sat Jan 18 15:51:45 1997 Richard Henderson - - * Don't play with usage_count directly, instead hand around - the module header and use the module macros. - -Fri May 17 00:00:00 1996 Leonard N. Zubkoff - - * BusLogic Driver Version 2.0.3 Released. - -Tue Apr 16 21:00:00 1996 Leonard N. Zubkoff - - * BusLogic Driver Version 1.3.2 Released. - -Sun Dec 31 23:26:00 1995 Leonard N. Zubkoff - - * BusLogic Driver Version 1.3.1 Released. - -Fri Nov 10 15:29:49 1995 Leonard N. Zubkoff - - * Released new BusLogic driver. - -Wed Aug 9 22:37:04 1995 Andries Brouwer - - As a preparation for new device code, separated the various - functions the request->dev field had into the device proper, - request->rq_dev and a status field request->rq_status. - - The 2nd argument of bios_param is now a kdev_t. - -Wed Jul 19 10:43:15 1995 Michael Neuffer - - * scsi.c (scsi_proc_info): /proc/scsi/scsi now also lists all - attached devices. - - * scsi_proc.c (proc_print_scsidevice): Added. Used by scsi.c and - eata_dma_proc.c to produce some device info for /proc/scsi. - - * eata_dma.c (eata_queue)(eata_int_handler)(eata_scsi_done): - Changed handling of internal SCSI commands send to the HBA. - - -Wed Jul 19 10:09:17 1995 Michael Neuffer - - * Linux 1.3.11 released. - - * eata_dma.c (eata_queue)(eata_int_handler): Added code to do - command latency measurements if requested by root through - /proc/scsi interface. - Throughout Use HZ constant for time references. - - * eata_pio.c: Use HZ constant for time references. - - * aic7xxx.c, aic7xxx.h, aic7xxx_asm.c: Changed copyright from BSD - to GNU style. - - * scsi.h: Added READ_12 command opcode constant - -Wed Jul 19 09:25:30 1995 Michael Neuffer - - * Linux 1.3.10 released. - - * scsi_proc.c (dispatch_scsi_info): Removed unused variable. - -Wed Jul 19 09:25:30 1995 Michael Neuffer - - * Linux 1.3.9 released. - - * scsi.c Blacklist concept expanded to 'support' more device - deficiencies. blacklist[] renamed to device_list[] - (scan_scsis): Code cleanup. - - * scsi_debug.c (scsi_debug_proc_info): Added support to control - device lockup simulation via /proc/scsi interface. - - -Wed Jul 19 09:22:34 1995 Michael Neuffer - - * Linux 1.3.7 released. - - * scsi_proc.c: Fixed a number of bugs in directory handling - -Wed Jul 19 09:18:28 1995 Michael Neuffer - - * Linux 1.3.5 released. - - * Native wide, multichannel and /proc/scsi support now in official - kernel distribution. - - * scsi.c/h, hosts.c/h et al reindented to increase readability - (especially on 80 column wide terminals). - - * scsi.c, scsi_proc.c, ../../fs/proc/inode.c: Added - /proc/scsi/scsi which allows root to scan for hotplugged devices. - - * scsi.c (scsi_proc_info): Added, to support /proc/scsi/scsi. - (scan_scsis): Added some 'spaghetti' code to allow scanning for - single devices. - - -Thu Jun 20 15:20:27 1995 Michael Neuffer - - * proc.c: Renamed to scsi_proc.c - -Mon Jun 12 20:32:45 1995 Michael Neuffer - - * Linux 1.3.0 released. - -Mon May 15 19:33:14 1995 Michael Neuffer - - * scsi.c: Added native multichannel and wide scsi support. - - * proc.c (dispatch_scsi_info) (build_proc_dir_hba_entries): - Updated /proc/scsi interface. - -Thu May 4 17:58:48 1995 Michael Neuffer - - * sd.c (requeue_sd_request): Zero out the scatterlist only if - scsi_malloc returned memory for it. - - * eata_dma.c (register_HBA) (eata_queue): Add support for - large scatter/gather tables and set use_clustering accordingly - - * hosts.c: Make use_clustering changeable in the Scsi_Host structure. - -Wed Apr 12 15:25:52 1995 Eric Youngdale (eric@andante) - - * Linux 1.2.5 released. - - * buslogic.c: Update to version 1.15 (From Leonard N. Zubkoff). - Fixed interrupt routine to avoid races when handling multiple - complete commands per interrupt. Seems to come up with faster - cards. - - * eata_dma.c: Update to 2.3.5r. Modularize. Improved error handling - throughout and fixed bug interrupt routine which resulted in shifted - status bytes. Added blink LED state checks for ISA and EISA HBAs. - Memory management bug seems to have disappeared ==> increasing - C_P_L_CURRENT_MAX to 16 for now. Decreasing C_P_L_DIV to 3 for - performance reasons. - - * scsi.c: If we get a FMK, EOM, or ILI when attempting to scan - the bus, assume that it was just noise on the bus, and ignore - the device. - - * scsi.h: Update and add a bunch of missing commands which we - were never using. - - * sd.c: Use restore_flags in do_sd_request - this may result in - latency conditions, but it gets rid of races and crashes. - Do not save flags again when searching for a second command to - queue. - - * st.c: Use bytes, not STP->buffer->buffer_size when reading - from tape. - - -Tue Apr 4 09:42:08 1995 Eric Youngdale (eric@andante) - - * Linux 1.2.4 released. - - * st.c: Fix typo - restoring wrong flags. - -Wed Mar 29 06:55:12 1995 Eric Youngdale (eric@andante) - - * Linux 1.2.3 released. - - * st.c: Perform some waiting operations with interrupts off. - Is this correct??? - -Wed Mar 22 10:34:26 1995 Eric Youngdale (eric@andante) - - * Linux 1.2.2 released. - - * aha152x.c: Modularize. Add support for PCMCIA. - - * eata.c: Update to version 2.0. Fixed bug preventing media - detection. If scsi_register_host returns NULL, fail gracefully. - - * scsi.c: Detect as NEC (for photo-cd purposes) for the 84 - and 25 models as "NEC_OLDCDR". - - * scsi.h: Add define for NEC_OLDCDR - - * sr.c: Add handling for NEC_OLDCDR. Treat as unknown. - - * u14-34f.c: Update to version 2.0. Fixed same bug as in - eata.c. - - -Mon Mar 6 11:11:20 1995 Eric Youngdale (eric@andante) - - * Linux 1.2.0 released. Yeah!!! - - * Minor spelling/punctuation changes throughout. Nothing - substantive. - -Mon Feb 20 21:33:03 1995 Eric Youngdale (eric@andante) - - * Linux 1.1.95 released. - - * qlogic.c: Update to version 0.41. - - * seagate.c: Change some message to be more descriptive about what - we detected. - - * sr.c: spelling/whitespace changes. - -Mon Feb 20 21:33:03 1995 Eric Youngdale (eric@andante) - - * Linux 1.1.94 released. - -Mon Feb 20 08:57:17 1995 Eric Youngdale (eric@andante) - - * Linux 1.1.93 released. - - * hosts.h: Change io_port to long int from short. - - * 53c7,8xx.c: crash on AEN fixed, SCSI reset is no longer a NOP, - NULL pointer panic on odd UDCs fixed, two bugs in diagnostic output - fixed, should initialize correctly if left running, now loadable, - new memory allocation, extraneous diagnostic output suppressed, - splx() replaced with save/restore flags. [ Drew ] - - * hosts.c, hosts.h, scsi_ioctl.c, sd.c, sd_ioctl.c, sg.c, sr.c, - sr_ioctl.c: Add special junk at end that Emacs will use for - formatting the file. - - * qlogic.c: Update to v0.40a. Improve parity handling. - - * scsi.c: Add Hitachi DK312C to blacklist. Change "};" to "}" in - many places. Use scsi_init_malloc to get command block - may - need this to be dma compatible for some host adapters. - Restore interrupts after unregistering a host. - - * sd.c: Use sti instead of restore flags - causes latency problems. - - * seagate.c: Use controller_type to determine string used when - registering irq. - - * sr.c: More photo-cd hacks to make sure we get the xa stuff right. - * sr.h, sr.c: Change is_xa to xa_flags field. - - * st.c: Disable retries for write operations. - -Wed Feb 15 10:52:56 1995 Eric Youngdale (eric@andante) - - * Linux 1.1.92 released. - - * eata.c: Update to 1.17. - - * eata_dma.c: Update to 2.31a. Add more support for /proc/scsi. - Continuing modularization. Less crashes because of the bug in the - memory management ==> increase C_P_L_CURRENT_MAX to 10 - and decrease C_P_L_DIV to 4. - - * hosts.c: If we remove last host registered, reuse host number. - When freeing memory from host being deregistered, free extra_bytes - too. - - * scsi.c (scan_scsis): memset(SDpnt, 0) and set SCmd.device to SDpnt. - Change memory allocation to work around bugs in __get_dma_pages. - Do not free host if usage count is not zero (for modules). - - * sr_ioctl.c: Increase IOCTL_TIMEOUT to 3000. - - * st.c: Allow for ST_EXTRA_DEVS in st data structures. - - * u14-34f.c: Update to 1.17. - -Thu Feb 9 10:11:16 1995 Eric Youngdale (eric@andante) - - * Linux 1.1.91 released. - - * eata.c: Update to 1.16. Use wish_block instead of host->block. - - * hosts.c: Initialize wish_block to 0. - - * hosts.h: Add wish_block. - - * scsi.c: Use wish_block as indicator that the host should be added - to block list. - - * sg.c: Add SG_EXTRA_DEVS to number of slots. - - * u14-34f.c: Use wish_block. - -Tue Feb 7 11:46:04 1995 Eric Youngdale (eric@andante) - - * Linux 1.1.90 released. - - * eata.c: Change naming from eata_* to eata2x_*. Now at vers 1.15. - Update interrupt handler to take pt_regs as arg. Allow blocking - even if loaded as module. Initialize target_time_out array. - Do not put sti(); in timing loop. - - * hosts.c: Do not reuse host numbers. - Use scsi_make_blocked_list to generate blocking list. - - * script_asm.pl: Beats me. Don't know perl. Something to do with - phase index. - - * scsi.c (scsi_make_blocked_list): New function - code copied from - hosts.c. - - * scsi.c: Update code to disable photo CD for Toshiba cdroms. - Use just manufacturer name, not model number. - - * sr.c: Fix setting density for Toshiba drives. - - * u14-34f.c: Clear target_time_out array during reset. - -Wed Feb 1 09:20:45 1995 Eric Youngdale (eric@andante) - - * Linux 1.1.89 released. - - * Makefile, u14-34f.c: Modularize. - - * Makefile, eata.c: Modularize. Now version 1.14 - - * NCR5380.c: Update interrupt handler with new arglist. Minor - cleanups. - - * eata_dma.c: Begin to modularize. Add hooks for /proc/scsi. - New version 2.3.0a. Add code in interrupt handler to allow - certain CDROM drivers to be detected which return a - CHECK_CONDITION during SCSI bus scan. Add opcode check to get - all DATA IN and DATA OUT phases right. Utilize HBA_interpret flag. - Improvements in HBA identification. Various other minor stuff. - - * hosts.c: Initialize ->dma_channel and ->io_port when registering - a new host. - - * qlogic.c: Modularize and add PCMCIA support. - - * scsi.c: Add Hitachi to blacklist. - - * scsi.c: Change default to no lun scan (too many problem devices). - - * scsi.h: Define QUEUE_FULL condition. - - * sd.c: Do not check for non-existent partition until after - new media check. - - * sg.c: Undo previous change which was wrong. - - * sr_ioctl.c: Increase IOCTL_TIMEOUT to 2000. - - * st.c: Patches from Kai - improve filemark handling. - -Tue Jan 31 17:32:12 1995 Eric Youngdale (eric@andante) - - * Linux 1.1.88 released. - - * Throughout - spelling/grammar fixups. - - * scsi.c: Make sure that all buffers are 16 byte aligned - some - drivers (buslogic) need this. - - * scsi.c (scan_scsis): Remove message printed. - - * scsi.c (scsi_init): Move message here. - -Mon Jan 30 06:40:25 1995 Eric Youngdale (eric@andante) - - * Linux 1.1.87 released. - - * sr.c: Photo-cd related changes. (Gerd Knorr??). - - * st.c: Changes from Kai related to EOM detection. - -Mon Jan 23 23:53:10 1995 Eric Youngdale (eric@andante) - - * Linux 1.1.86 released. - - * 53c7,8xx.h: Change SG size to 127. - - * eata_dma: Update to version 2.10i. Remove bug in the registration - of multiple HBAs and channels. Minor other improvements and stylistic - changes. - - * scsi.c: Test for Toshiba XM-3401TA and exclude from detection - as toshiba drive - photo cd does not work with this drive. - - * sr.c: Update photocd code. - -Mon Jan 23 23:53:10 1995 Eric Youngdale (eric@andante) - - * Linux 1.1.85 released. - - * st.c, st_ioctl.c, sg.c, sd_ioctl.c, scsi_ioctl.c, hosts.c: - include linux/mm.h - - * qlogic.c, buslogic.c, aha1542.c: Include linux/module.h. - -Sun Jan 22 22:08:46 1995 Eric Youngdale (eric@andante) - - * Linux 1.1.84 released. - - * Makefile: Support for loadable QLOGIC boards. - - * aha152x.c: Update to version 1.8 from Juergen. - - * eata_dma.c: Update from Michael Neuffer. - Remove hard limit of 2 commands per lun and make it better - configurable. Improvements in HBA identification. - - * in2000.c: Fix biosparam to support large disks. - - * qlogic.c: Minor changes (change sti -> restore_flags). - -Wed Jan 18 23:33:09 1995 Eric Youngdale (eric@andante) - - * Linux 1.1.83 released. - - * aha1542.c(aha1542_intr_handle): Use arguments handed down to find - which irq. - - * buslogic.c: Likewise. - - * eata_dma.c: Use min of 2 cmd_per_lun for OCS_enabled boards. - - * scsi.c: Make RECOVERED_ERROR a SUGGEST_IS_OK. - - * sd.c: Fail if we are opening a non-existent partition. - - * sr.c: Bump SR_TIMEOUT to 15000. - Do not probe for media size at boot time(hard on changers). - Flag device as needing sector size instead. - - * sr_ioctl.c: Remove CDROMMULTISESSION_SYS ioctl. - - * ultrastor.c: Fix bug in call to ultrastor_interrupt (wrong #args). - -Mon Jan 16 07:18:23 1995 Eric Youngdale (eric@andante) - - * Linux 1.1.82 released. - - Throughout. - - Change all interrupt handlers to accept new calling convention. - In particular, we now receive the irq number as one of the arguments. - - * More minor spelling corrections in some of the new files. - - * aha1542.c, buslogic.c: Clean up interrupt handler a little now - that we receive the irq as an arg. - - * aha274x.c: s/snarf_region/request_region/ - - * eata.c: Update to version 1.12. Fix some comments and display a - message if we cannot reserve the port addresses. - - * u14-34f.c: Update to version 1.13. Fix some comments and display a - message if we cannot reserve the port addresses. - - * eata_dma.c: Define get_board_data function (send INQUIRY command). - Use to improve detection of variants of different DPT boards. Change - version subnumber to "0g". - - * fdomain.c: Update to version 5.26. Improve detection of some boards - repackaged by IBM. - - * scsi.c (scsi_register_host): Change "name" to const char *. - - * sr.c: Fix problem in set mode command for Toshiba drives. - - * sr.c: Fix typo from patch 81. - -Fri Jan 13 12:54:46 1995 Eric Youngdale (eric@andante) - - * Linux 1.1.81 released. Codefreeze for 1.2 release announced. - - Big changes here. - - * eata_dma.*: New files from Michael Neuffer. - (neuffer@goofy.zdv.uni-mainz.de). Should support - all eata/dpt cards. - - * hosts.c, Makefile: Add eata_dma. - - * README.st: Document MTEOM. - - Patches from me (ERY) to finish support for low-level loadable scsi. - It now works, and is actually useful. - - * Throughout - add new argument to scsi_init_malloc that takes an - additional parameter. This is used as a priority to kmalloc, - and you can specify the GFP_DMA flag if you need DMA-able memory. - - * Makefile: For source files that are loadable, always add name - to SCSI_SRCS. Fill in modules: target. - - * hosts.c: Change next_host to next_scsi_host, and make global. - Print hosts after we have identified all of them. Use info() - function if present, otherwise use name field. - - * hosts.h: Change attach function to return int, not void. - Define number of device slots to allow for loadable devices. - Define tags to tell scsi module code what type of module we - are loading. - - * scsi.c: Fix scan_scsis so that it can be run by a user process. - Do not use waiting loops - use up and down mechanism as long - as current != task[0]. - - * scsi.c(scan_scsis): Do not use stack variables for I/O - this - could be > 16Mb if we are loading a module at runtime (i.e. use - scsi_init_malloc to get some memory we know will be safe). - - * scsi.c: Change dma freelist to be a set of pages. This allows - us to dynamically adjust the size of the list by adding more pages - to the pagelist. Fix scsi_malloc and scsi_free accordingly. - - * scsi_module.c: Fix include. - - * sd.c: Declare detach function. Increment/decrement module usage - count as required. Fix init functions to allow loaded devices. - Revalidate all new disks so we get the partition tables. Define - detach function. - - * sr.c: Likewise. - - * sg.c: Declare detach function. Allow attachment of devices on - loaded drivers. - - * st.c: Declare detach function. Increment/decrement module usage - count as required. - -Tue Jan 10 10:09:58 1995 Eric Youngdale (eric@andante) - - * Linux 1.1.79 released. - - Patch from some undetermined individual who needs to get a life :-). - - * sr.c: Attacked by spelling bee... - - Patches from Gerd Knorr: - - * sr.c: make printk messages for photoCD a little more informative. - - * sr_ioctl.c: Fix CDROMMULTISESSION_SYS ioctl. - -Mon Jan 9 10:01:37 1995 Eric Youngdale (eric@andante) - - * Linux 1.1.78 released. - - * Makefile: Add empty modules: target. - - * Wheee. Now change register_iomem to request_region. - - * in2000.c: Bugfix - apparently this is the fix that we have - all been waiting for. It fixes a problem whereby the driver - is not stable under heavy load. Race condition and all that. - Patch from Peter Lu. - -Wed Jan 4 21:17:40 1995 Eric Youngdale (eric@andante) - - * Linux 1.1.77 released. - - * 53c7,8xx.c: Fix from Linus - emulate splx. - - Throughout: - - Change "snarf_region" with "register_iomem". - - * scsi_module.c: New file. Contains support for low-level loadable - scsi drivers. [ERY]. - - * sd.c: More s/int/long/ changes. - - * seagate.c: Explicitly include linux/config.h - - * sg.c: Increment/decrement module usage count on open/close. - - * sg.c: Be a bit more careful about the user not supplying enough - information for a valid command. Pass correct size down to - scsi_do_cmd. - - * sr.c: More changes for Photo-CD. This apparently breaks NEC drives. - - * sr_ioctl.c: Support CDROMMULTISESSION ioctl. - - -Sun Jan 1 19:55:21 1995 Eric Youngdale (eric@andante) - - * Linux 1.1.76 released. - - * constants.c: Add type cast in switch statement. - - * scsi.c (scsi_free): Change datatype of "offset" to long. - (scsi_malloc): Change a few more variables to long. Who - did this and why was it important? 64 bit machines? - - - Lots of changes to use save_state/restore_state instead of cli/sti. - Files changed include: - - * aha1542.c: - * aha1740.c: - * buslogic.c: - * in2000.c: - * scsi.c: - * scsi_debug.c: - * sd.c: - * sr.c: - * st.c: - -Wed Dec 28 16:38:29 1994 Eric Youngdale (eric@andante) - - * Linux 1.1.75 released. - - * buslogic.c: Spelling fix. - - * scsi.c: Add HP C1790A and C2500A scanjet to blacklist. - - * scsi.c: Spelling fixup. - - * sd.c: Add support for sd_hardsizes (hard sector sizes). - - * ultrastor.c: Use save_flags/restore_flags instead of cli/sti. - -Fri Dec 23 13:36:25 1994 Eric Youngdale (eric@andante) - - * Linux 1.1.74 released. - - * README.st: Update from Kai Makisara. - - * eata.c: New version from Dario - version 1.11. - use scsicam bios_param routine. Add support for 2011 - and 2021 boards. - - * hosts.c: Add support for blocking. Linked list automatically - generated when shpnt->block is set. - - * scsi.c: Add sankyo & HP scanjet to blacklist. Add support for - kicking things loose when we deadlock. - - * scsi.c: Recognize scanners and processors in scan_scsis. - - * scsi_ioctl.h: Increase timeout to 9 seconds. - - * st.c: New version from Kai - add better support for backspace. - - * u14-34f.c: New version from Dario. Supports blocking. - -Wed Dec 14 14:46:30 1994 Eric Youngdale (eric@andante) - - * Linux 1.1.73 released. - - * buslogic.c: Update from Dave Gentzel. Version 1.14. - Add module related stuff. More fault tolerant if out of - DMA memory. - - * fdomain.c: New version from Rik Faith - version 5.22. Add support - for ISA-200S SCSI adapter. - - * hosts.c: Spelling. - - * qlogic.c: Update to version 0.38a. Add more support for PCMCIA. - - * scsi.c: Mask device type with 0x1f during scan_scsis. - Add support for deadlocking, err, make that getting out of - deadlock situations that are created when we allow the user - to limit requests to one host adapter at a time. - - * scsi.c: Bugfix - pass pid, not SCpnt as second arg to - scsi_times_out. - - * scsi.c: Restore interrupt state to previous value instead of using - cli/sti pairs. - - * scsi.c: Add a bunch of module stuff (all commented out for now). - - * scsi.c: Clean up scsi_dump_status. - -Tue Dec 6 12:34:20 1994 Eric Youngdale (eric@andante) - - * Linux 1.1.72 released. - - * sg.c: Bugfix - always use sg_free, since we might have big buff. - -Fri Dec 2 11:24:53 1994 Eric Youngdale (eric@andante) - - * Linux 1.1.71 released. - - * sg.c: Clear buff field when not in use. Only call scsi_free if - non-null. - - * scsi.h: Call wake_up(&wait_for_request) when done with a - command. - - * scsi.c (scsi_times_out): Pass pid down so that we can protect - against race conditions. - - * scsi.c (scsi_abort): Zero timeout field if we get the - NOT_RUNNING message back from low-level driver. - - - * scsi.c (scsi_done): Restore cmd_len, use_sg here. - - * scsi.c (request_sense): Not here. - - * hosts.h: Add new forbidden_addr, forbidden_size fields. Who - added these and why???? - - * hosts.c (scsi_mem_init): Mark pages as reserved if they fall in - the forbidden regions. I am not sure - I think this is so that - we can deal with boards that do incomplete decoding of their - address lines for the bios chips, but I am not entirely sure. - - * buslogic.c: Set forbidden_addr stuff if using a buggy board. - - * aha1740.c: Test for NULL pointer in SCtmp. This should not - occur, but a nice message is better than a kernel segfault. - - * 53c7,8xx.c: Add new PCI chip ID for 815. - -Fri Dec 2 11:24:53 1994 Eric Youngdale (eric@andante) - - * Linux 1.1.70 released. - - * ChangeLog, st.c: Spelling. - -Tue Nov 29 18:48:42 1994 Eric Youngdale (eric@andante) - - * Linux 1.1.69 released. - - * u14-34f.h: Non-functional change. [Dario]. - - * u14-34f.c: Use block field in Scsi_Host to prevent commands from - being queued to more than one host at the same time (used when - motherboard does not deal with multiple bus-masters very well). - Only when SINGLE_HOST_OPERATIONS is defined. - Use new cmd_per_lun field. [Dario] - - * eata.c: Likewise. - - * st.c: More changes from Kai. Add ready flag to indicate drive - status. - - * README.st: Document this. - - * sr.c: Bugfix (do not subtract CD_BLOCK_OFFSET) for photo-cd - code. - - * sg.c: Bugfix - fix problem where opcode is not correctly set up. - - * seagate.[c,h]: Use #defines to set driver name. - - * scsi_ioctl.c: Zero buffer before executing command. - - * scsi.c: Use new cmd_per_lun field in Scsi_Hosts as appropriate. - Add Sony CDU55S to blacklist. - - * hosts.h: Add new cmd_per_lun field to Scsi_Hosts. - - * hosts.c: Initialize cmd_per_lun in Scsi_Hosts from template. - - * buslogic.c: Use cmd_per_lun field - initialize to different - values depending upon bus type (i.e. use 1 if ISA, so we do not - hog memory). Use other patches which got lost from 1.1.68. - - * aha1542.c: Spelling. - -Tue Nov 29 15:43:50 1994 Eric Youngdale (eric@andante.aib.com) - - * Linux 1.1.68 released. - - Add support for 12 byte vendor specific commands in scsi-generics, - more (i.e. the last mandatory) low-level changes to support - loadable modules, plus a few other changes people have requested - lately. Changes by me (ERY) unless otherwise noted. Spelling - changes appear from some unknown corner of the universe. - - * Throughout: Change COMMAND_SIZE() to use SCpnt->cmd_len. - - * Throughout: Change info() low level function to take a Scsi_Host - pointer. This way the info function can return specific - information about the host in question, if desired. - - * All low-level drivers: Add NULL in initializer for the - usage_count field added to Scsi_Host_Template. - - * aha152x.[c,h]: Remove redundant info() function. - - * aha1542.[c,h]: Likewise. - - * aha1740.[c,h]: Likewise. - - * aha274x.[c,h]: Likewise. - - * eata.[c,h]: Likewise. - - * pas16.[c,h]: Likewise. - - * scsi_debug.[c,h]: Likewise. - - * t128.[c,h]: Likewise. - - * u14-34f.[c,h]: Likewise. - - * ultrastor.[c,h]: Likewise. - - * wd7000.[c,h]: Likewise. - - * aha1542.c: Add support for command line options with lilo to set - DMA parameters, I/O port. From Matt Aarnio. - - * buslogic.[c,h]: New version (1.13) from Dave Gentzel. - - * hosts.h: Add new field to Scsi_Hosts "block" to allow blocking - all I/O to certain other cards. Helps prevent problems with some - ISA motherboards. - - * hosts.h: Add usage_count to Scsi_Host_Template. - - * hosts.h: Add n_io_port to Scsi_Host (used when releasing module). - - * hosts.c: Initialize block field. - - * in2000.c: Remove "static" declarations from exported functions. - - * in2000.h: Likewise. - - * scsi.c: Correctly set cmd_len field as required. Save and - change setting when doing a request_sense, restore when done. - Move abort timeout message. Fix panic in request_queueable to - print correct function name. - - * scsi.c: When incrementing usage count, walk block linked list - for host, and or in SCSI_HOST_BLOCK bit. When decrementing usage - count to 0, clear this bit to allow usage to continue, wake up - processes waiting. - - - * scsi_ioctl.c: If we have an info() function, call it, otherwise - if we have a "name" field, use it, else do nothing. - - * sd.c, sr.c: Clear cmd_len field prior to each command we - generate. - - * sd.h: Add "has_part_table" bit to rscsi_disks. - - * sg.[c,h]: Add support for vendor specific 12 byte commands (i.e. - override command length in COMMAND_SIZE). - - * sr.c: Bugfix from Gerd in photocd code. - - * sr.c: Bugfix in get_sectorsize - always use scsi_malloc buffer - - we cannot guarantee that the stack is < 16Mb. - -Tue Nov 22 15:40:46 1994 Eric Youngdale (eric@andante.aib.com) - - * Linux 1.1.67 released. - - * sr.c: Change spelling of manufactor to manufacturer. - - * scsi.h: Likewise. - - * scsi.c: Likewise. - - * qlogic.c: Spelling corrections. - - * in2000.h: Spelling corrections. - - * in2000.c: Update from Bill Earnest, change from - jshiffle@netcom.com. Support new bios versions. - - * README.qlogic: Spelling correction. - -Tue Nov 22 15:40:46 1994 Eric Youngdale (eric@andante.aib.com) - - * Linux 1.1.66 released. - - * u14-34f.c: Spelling corrections. - - * sr.[h,c]: Add support for multi-session CDs from Gerd Knorr. - - * scsi.h: Add manufactor field for keeping track of device - manufacturer. - - * scsi.c: More spelling corrections. - - * qlogic.h, qlogic.c, README.qlogic: New driver from Tom Zerucha. - - * in2000.c, in2000.h: New driver from Brad McLean/Bill Earnest. - - * fdomain.c: Spelling correction. - - * eata.c: Spelling correction. - -Fri Nov 18 15:22:44 1994 Eric Youngdale (eric@andante.aib.com) - - * Linux 1.1.65 released. - - * eata.h: Update version string to 1.08.00. - - * eata.c: Set sg_tablesize correctly for DPT PM2012 boards. - - * aha274x.seq: Spell checking. - - * README.st: Likewise. - - * README.aha274x: Likewise. - - * ChangeLog: Likewise. - -Tue Nov 15 15:35:08 1994 Eric Youngdale (eric@andante.aib.com) - - * Linux 1.1.64 released. - - * u14-34f.h: Update version number to 1.10.01. - - * u14-34f.c: Use Scsi_Host can_queue variable instead of one from template. - - * eata.[c,h]: New driver for DPT boards from Dario Ballabio. - - * buslogic.c: Use can_queue field. - -Wed Nov 30 12:09:09 1994 Eric Youngdale (eric@andante.aib.com) - - * Linux 1.1.63 released. - - * sd.c: Give I/O error if we attempt 512 byte I/O to a disk with - 1024 byte sectors. - - * scsicam.c: Make sure we do read from whole disk (mask off - partition). - - * scsi.c: Use can_queue in Scsi_Host structure. - Fix panic message about invalid host. - - * hosts.c: Initialize can_queue from template. - - * hosts.h: Add can_queue to Scsi_Host structure. - - * aha1740.c: Print out warning about NULL ecbptr. - -Fri Nov 4 12:40:30 1994 Eric Youngdale (eric@andante.aib.com) - - * Linux 1.1.62 released. - - * fdomain.c: Update to version 5.20. (From Rik Faith). Support - BIOS version 3.5. - - * st.h: Add ST_EOD symbol. - - * st.c: Patches from Kai Makisara - support additional densities, - add support for MTFSS, MTBSS, MTWSM commands. - - * README.st: Update to document new commands. - - * scsi.c: Add Mediavision CDR-H93MV to blacklist. - -Sat Oct 29 20:57:36 1994 Eric Youngdale (eric@andante.aib.com) - - * Linux 1.1.60 released. - - * u14-34f.[c,h]: New driver from Dario Ballabio. - - * aic7770.c, aha274x_seq.h, aha274x.seq, aha274x.h, aha274x.c, - README.aha274x: New files, new driver from John Aycock. - - -Tue Oct 11 08:47:39 1994 Eric Youngdale (eric@andante) - - * Linux 1.1.54 released. - - * Add third PCI chip id. [Drew] - - * buslogic.c: Set BUSLOGIC_CMDLUN back to 1 [Eric]. - - * ultrastor.c: Fix asm directives for new GCC. - - * sr.c, sd.c: Use new end_scsi_request function. - - * scsi.h(end_scsi_request): Return pointer to block if still - active, else return NULL if inactive. Fixes race condition. - -Sun Oct 9 20:23:14 1994 Eric Youngdale (eric@andante) - - * Linux 1.1.53 released. - - * scsi.c: Do not allocate dma bounce buffers if we have exactly - 16Mb. - -Fri Sep 9 05:35:30 1994 Eric Youngdale (eric@andante) - - * Linux 1.1.51 released. - - * aha152x.c: Add support for disabling the parity check. Update - to version 1.4. [Juergen]. - - * seagate.c: Tweak debugging message. - -Wed Aug 31 10:15:55 1994 Eric Youngdale (eric@andante) - - * Linux 1.1.50 released. - - * aha152x.c: Add eb800 for Vtech Platinum SMP boards. [Juergen]. - - * scsi.c: Add Quantum PD1225S to blacklist. - -Fri Aug 26 09:38:45 1994 Eric Youngdale (eric@andante) - - * Linux 1.1.49 released. - - * sd.c: Fix bug when we were deleting the wrong entry if we - get an unsupported sector size device. - - * sr.c: Another spelling patch. - -Thu Aug 25 09:15:27 1994 Eric Youngdale (eric@andante) - - * Linux 1.1.48 released. - - * Throughout: Use new semantics for request_dma, as appropriate. - - * sr.c: Print correct device number. - -Sun Aug 21 17:49:23 1994 Eric Youngdale (eric@andante) - - * Linux 1.1.47 released. - - * NCR5380.c: Add support for LIMIT_TRANSFERSIZE. - - * constants.h: Add prototype for print_Scsi_Cmnd. - - * pas16.c: Some more minor tweaks. Test for Mediavision board. - Allow for disks > 1Gb. [Drew??] - - * sr.c: Set SCpnt->transfersize. - -Tue Aug 16 17:29:35 1994 Eric Youngdale (eric@andante) - - * Linux 1.1.46 released. - - * Throughout: More spelling fixups. - - * buslogic.c: Add a few more fixups from Dave. Disk translation - mainly. - - * pas16.c: Add a few patches (Drew?). - - -Thu Aug 11 20:45:15 1994 Eric Youngdale (eric@andante) - - * Linux 1.1.44 released. - - * hosts.c: Add type casts for scsi_init_malloc. - - * scsicam.c: Add type cast. - -Wed Aug 10 19:23:01 1994 Eric Youngdale (eric@andante) - - * Linux 1.1.43 released. - - * Throughout: Spelling cleanups. [??] - - * aha152x.c, NCR53*.c, fdomain.c, g_NCR5380.c, pas16.c, seagate.c, - t128.c: Use request_irq, not irqaction. [??] - - * aha1542.c: Move test for shost before we start to use shost. - - * aha1542.c, aha1740.c, ultrastor.c, wd7000.c: Use new - calling sequence for request_irq. - - * buslogic.c: Update from Dave Gentzel. - -Tue Aug 9 09:32:59 1994 Eric Youngdale (eric@andante) - - * Linux 1.1.42 released. - - * NCR5380.c: Change NCR5380_print_status to static. - - * seagate.c: A few more bugfixes. Only Drew knows what they are - for. - - * ultrastor.c: Tweak some __asm__ directives so that it works - with newer compilers. [??] - -Sat Aug 6 21:29:36 1994 Eric Youngdale (eric@andante) - - * Linux 1.1.40 released. - - * NCR5380.c: Return SCSI_RESET_WAKEUP from reset function. - - * aha1542.c: Reset mailbox status after a bus device reset. - - * constants.c: Fix typo (;;). - - * g_NCR5380.c: - * pas16.c: Correct usage of NCR5380_init. - - * scsi.c: Remove redundant (and unused variables). - - * sd.c: Use memset to clear all of rscsi_disks before we use it. - - * sg.c: Ditto, except for scsi_generics. - - * sr.c: Ditto, except for scsi_CDs. - - * st.c: Initialize STp->device. - - * seagate.c: Fix bug. [Drew] - -Thu Aug 4 08:47:27 1994 Eric Youngdale (eric@andante) - - * Linux 1.1.39 released. - - * Makefile: Fix typo in NCR53C7xx. - - * st.c: Print correct number for device. - -Tue Aug 2 11:29:14 1994 Eric Youngdale (eric@esp22) - - * Linux 1.1.38 released. - - Lots of changes in 1.1.38. All from Drew unless otherwise noted. - - * 53c7,8xx.c: New file from Drew. PCI driver. - - * 53c7,8xx.h: Likewise. - - * 53c7,8xx.scr: Likewise. - - * 53c8xx_d.h, 53c8xx_u.h, script_asm.pl: Likewise. - - * scsicam.c: New file from Drew. Read block 0 on the disk and - read the partition table. Attempt to deduce the geometry from - the partition table if possible. Only used by 53c[7,8]xx right - now, but could be used by any device for which we have no way - of identifying the geometry. - - * sd.c: Use device letters instead of sd%d in a lot of messages. - - * seagate.c: Fix bug that resulted in lockups with some devices. - - * sr.c (sr_open): Return -EROFS, not -EACCES if we attempt to open - device for write. - - * hosts.c, Makefile: Update for new driver. - - * NCR5380.c, NCR5380.h, g_NCR5380.h: Update from Drew to support - 53C400 chip. - - * constants.c: Define CONST_CMND and CONST_MSG. Other minor - cleanups along the way. Improve handling of CONST_MSG. - - * fdomain.c, fdomain.h: New version from Rik Faith. Update to - 5.18. Should now support TMC-3260 PCI card with 18C30 chip. - - * pas16.c: Update with new irq initialization. - - * t128.c: Update with minor cleanups. - - * scsi.c (scsi_pid): New variable - gives each command a unique - id. Add Quantum LPS5235S to blacklist. Change in_scan to - in_scan_scsis and make global. - - * scsi.h: Add some defines for extended message handling, - INITIATE/RELEASE_RECOVERY. Add a few new fields to support sync - transfers. - - * scsi_ioctl.h: Add ioctl to request synchronous transfers. - - -Tue Jul 26 21:36:58 1994 Eric Youngdale (eric@esp22) - - * Linux 1.1.37 released. - - * aha1542.c: Always call aha1542_mbenable, use new udelay - mechanism so we do not wait a long time if the board does not - implement this command. - - * g_NCR5380.c: Remove #include and #if - defined(CONFIG_SCSI_*). - - * seagate.c: Likewise. - - Next round of changes to support loadable modules. Getting closer - now, still not possible to do anything remotely usable. - - hosts.c: Create a linked list of detected high level devices. - (scsi_register_device): New function to insert into this list. - (scsi_init): Call scsi_register_device for each of the known high - level drivers. - - hosts.h: Add prototype for linked list header. Add structure - definition for device template structure which defines the linked - list. - - scsi.c: (scan_scsis): Use linked list instead of knowledge about - existing high level device drivers. - (scsi_dev_init): Use init functions for drivers on linked list - instead of explicit list to initialize and attach devices to high - level drivers. - - scsi.h: Add new field "attached" to scsi_device - count of number - of high level devices attached. - - sd.c, sr.c, sg.c, st.c: Adjust init/attach functions to use new - scheme. - -Sat Jul 23 13:03:17 1994 Eric Youngdale (eric@esp22) - - * Linux 1.1.35 released. - - * ultrastor.c: Change constraint on asm() operand so that it works - with gcc 2.6.0. - -Thu Jul 21 10:37:39 1994 Eric Youngdale (eric@esp22) - - * Linux 1.1.33 released. - - * sr.c(sr_open): Do not allow opens with write access. - -Mon Jul 18 09:51:22 1994 1994 Eric Youngdale (eric@esp22) - - * Linux 1.1.31 released. - - * sd.c: Increase SD_TIMEOUT from 300 to 600. - - * sr.c: Remove stray task_struct* variable that was no longer - used. - - * sr_ioctl.c: Fix typo in up() call. - -Sun Jul 17 16:25:29 1994 Eric Youngdale (eric@esp22) - - * Linux 1.1.30 released. - - * scsi.c (scan_scsis): Fix detection of some Toshiba CDROM drives - that report themselves as disk drives. - - * (Throughout): Use request.sem instead of request.waiting. - Should fix swap problem with fdomain. - -Thu Jul 14 10:51:42 1994 Eric Youngdale (eric@esp22) - - * Linux 1.1.29 released. - - * scsi.c (scan_scsis): Add new devices to end of linked list, not - to the beginning. - - * scsi.h (SCSI_SLEEP): Remove brain dead hack to try to save - the task state before sleeping. - -Sat Jul 9 15:01:03 1994 Eric Youngdale (eric@esp22) - - More changes to eventually support loadable modules. Mainly - we want to use linked lists instead of arrays because it is easier - to dynamically add and remove things this way. - - Quite a bit more work is needed before loadable modules are - possible (and usable) with scsi, but this is most of the grunge - work. - - * Linux 1.1.28 released. - - * scsi.c, scsi.h (allocate_device, request_queueable): Change - argument from index into scsi_devices to a pointer to the - Scsi_Device struct. - - * Throughout: Change all calls to allocate_device, - request_queueable to use new calling sequence. - - * Throughout: Use SCpnt->device instead of - scsi_devices[SCpnt->index]. Ugh - the pointer was there all along - - much cleaner this way. - - * scsi.c (scsi_init_malloc, scsi_free_malloc): New functions - - allow us to pretend that we have a working malloc when we - initialize. Use this instead of passing memory_start, memory_end - around all over the place. - - * scsi.h, st.c, sr.c, sd.c, sg.c: Change *_init1 functions to use - scsi_init_malloc, remove all arguments, no return value. - - * scsi.h: Remove index field from Scsi_Device and Scsi_Cmnd - structs. - - * scsi.c (scsi_dev_init): Set up for scsi_init_malloc. - (scan_scsis): Get SDpnt from scsi_init_malloc, and refresh - when we discover a device. Free pointer before returning. - Change scsi_devices into a linked list. - - * scsi.c (scan_scsis): Change to only scan one host. - (scsi_dev_init): Loop over all detected hosts, and scan them. - - * hosts.c (scsi_init_free): Change so that number of extra bytes - is stored in struct, and we do not have to pass it each time. - - * hosts.h: Change Scsi_Host_Template struct to include "next" and - "release" functions. Initialize to NULL in all low level - adapters. - - * hosts.c: Rename scsi_hosts to builtin_scsi_hosts, create linked - list scsi_hosts, linked together with the new "next" field. - -Wed Jul 6 05:45:02 1994 Eric Youngdale (eric@esp22) - - * Linux 1.1.25 released. - - * aha152x.c: Changes from Juergen - cleanups and updates. - - * sd.c, sr.c: Use new check_media_change and revalidate - file_operations fields. - - * st.c, st.h: Add changes from Kai Makisara, dated Jun 22. - - * hosts.h: Change SG_ALL back to 0xff. Apparently soft error - in /dev/brain resulted in having this bumped up. - Change first parameter in bios_param function to be Disk * instead - of index into rscsi_disks. - - * sd_ioctl.c: Pass pointer to rscsi_disks element instead of index - to array. - - * sd.h: Add struct name "scsi_disk" to typedef for Scsi_Disk. - - * scsi.c: Remove redundant Maxtor XT8760S from blacklist. - In scsi_reset, add printk when DEBUG defined. - - * All low level drivers: Modify definitions of bios_param in - appropriate way. - -Thu Jun 16 10:31:59 1994 Eric Youngdale (eric@esp22) - - * Linux 1.1.20 released. - - * scsi_ioctl.c: Only pass down the actual number of characters - required to scsi_do_cmd, not the one rounded up to a even number - of sectors. - - * ultrastor.c: Changes from Caleb Epstein for 24f cards. Support - larger SG lists. - - * ultrastor.c: Changes from me - use scsi_register to register - host. Add some consistency checking, - -Wed Jun 1 21:12:13 1994 Eric Youngdale (eric@esp22) - - * Linux 1.1.19 released. - - * scsi.h: Add new return code for reset() function: - SCSI_RESET_PUNT. - - * scsi.c: Make SCSI_RESET_PUNT the same as SCSI_RESET_WAKEUP for - now. - - * aha1542.c: If the command responsible for the reset is not - pending, return SCSI_RESET_PUNT. - - * aha1740.c, buslogic.c, wd7000.c, ultrastor.c: Return - SCSI_RESET_PUNT instead of SCSI_RESET_SNOOZE. - -Tue May 31 19:36:01 1994 Eric Youngdale (eric@esp22) - - * buslogic.c: Do not print out message about "must be Adaptec" - if we have detected a buslogic card. Print out a warning message - if we are configuring for >16Mb, since the 445S at board level - D or earlier does not work right. The "D" level board can be made - to work by flipping an undocumented switch, but this is too subtle. - - Changes based upon patches in Yggdrasil distribution. - - * sg.c, sg.h: Return sense data to user. - - * aha1542.c, aha1740.c, buslogic.c: Do not panic if - sense buffer is wrong size. - - * hosts.c: Test for ultrastor card before any of the others. - - * scsi.c: Allow boot-time option for max_scsi_luns=? so that - buggy firmware has an easy work-around. - -Sun May 15 20:24:34 1994 Eric Youngdale (eric@esp22) - - * Linux 1.1.15 released. - - Post-codefreeze thaw... - - * buslogic.[c,h]: New driver from David Gentzel. - - * hosts.h: Add use_clustering field to explicitly say whether - clustering should be used for devices attached to this host - adapter. The buslogic board apparently supports large SG lists, - but it is apparently faster if sd.c condenses this into a smaller - list. - - * sd.c: Use this field instead of heuristic. - - * All host adapter include files: Add appropriate initializer for - use_clustering field. - - * scsi.h: Add #defines for return codes for the abort and reset - functions. There are now a specific set of return codes to fully - specify all of the possible things that the low-level adapter - could do. - - * scsi.c: Act based upon return codes from abort/reset functions. - - * All host adapter abort/reset functions: Return new return code. - - * Add code in scsi.c to help debug timeouts. Use #define - DEBUG_TIMEOUT to enable this. - - * scsi.c: If the host->irq field is set, use - disable_irq/enable_irq before calling queuecommand if we - are not already in an interrupt. Reduce races, and we - can be sloppier about cli/sti in the interrupt routines now - (reduce interrupt latency). - - * constants.c: Fix some things to eliminate warnings. Add some - sense descriptions that were omitted before. - - * aha1542.c: Watch for SCRD from host adapter - if we see it, set - a flag. Currently we only print out the number of pending - commands that might need to be restarted. - - * aha1542.c (aha1542_abort): Look for lost interrupts, OGMB still - full, and attempt to recover. Otherwise give up. - - * aha1542.c (aha1542_reset): Try BUS DEVICE RESET, and then pass - DID_RESET back up to the upper level code for all commands running - on this target (even on different LUNs). - -Sat May 7 14:54:01 1994 - - * Linux 1.1.12 released. - - * st.c, st.h: New version from Kai. Supports boot time - specification of number of buffers. - - * wd7000.[c,h]: Updated driver from John Boyd. Now supports - more than one wd7000 board in machine at one time, among other things. - -Wed Apr 20 22:20:35 1994 - - * Linux 1.1.8 released. - - * sd.c: Add a few type casts where scsi_malloc is called. - -Wed Apr 13 12:53:29 1994 - - * Linux 1.1.4 released. - - * scsi.c: Clean up a few printks (use %p to print pointers). - -Wed Apr 13 11:33:02 1994 - - * Linux 1.1.3 released. - - * fdomain.c: Update to version 5.16 (Handle different FIFO sizes - better). - -Fri Apr 8 08:57:19 1994 - - * Linux 1.1.2 released. - - * Throughout: SCSI portion of cluster diffs added. - -Tue Apr 5 07:41:50 1994 - - * Linux 1.1 development tree initiated. - - * The linux 1.0 development tree is now effectively frozen except - for obvious bugfixes. - -****************************************************************** -****************************************************************** -****************************************************************** -****************************************************************** - -Sun Apr 17 00:17:39 1994 - - * Linux 1.0, patchlevel 9 released. - - * fdomain.c: Update to version 5.16 (Handle different FIFO sizes - better). - -Thu Apr 7 08:36:20 1994 - - * Linux 1.0, patchlevel8 released. - - * fdomain.c: Update to version 5.15 from 5.9. Handles 3.4 bios. - -Sun Apr 3 14:43:03 1994 - - * Linux 1.0, patchlevel6 released. - - * wd7000.c: Make stab at fixing race condition. - -Sat Mar 26 14:14:50 1994 - - * Linux 1.0, patchlevel5 released. - - * aha152x.c, Makefile: Fix a few bugs (too much data message). - Add a few more bios signatures. (Patches from Juergen). - - * aha1542.c: Fix race condition in aha1542_out. - -Mon Mar 21 16:36:20 1994 - - * Linux 1.0, patchlevel3 released. - - * sd.c, st.c, sr.c, sg.c: Return -ENXIO, not -ENODEV if we attempt - to open a non-existent device. - - * scsi.c: Add Chinon cdrom to blacklist. - - * sr_ioctl.c: Check return status of verify_area. - -Sat Mar 6 16:06:19 1994 - - * Linux 1.0 released (technically a pre-release). - - * scsi.c: Add IMS CDD521, Maxtor XT-8760S to blacklist. - -Tue Feb 15 10:58:20 1994 - - * pl15e released. - - * aha1542.c: For 1542C, allow dynamic device scan with >1Gb turned - off. - - * constants.c: Fix typo in definition of CONSTANTS. - - * pl15d released. - -Fri Feb 11 10:10:16 1994 - - * pl15c released. - - * scsi.c: Add Maxtor XT-3280 and Rodime RO3000S to blacklist. - - * scsi.c: Allow tagged queueing for scsi 3 devices as well. - Some really old devices report a version number of 0. Disallow - LUN != 0 for these. - -Thu Feb 10 09:48:57 1994 - - * pl15b released. - -Sun Feb 6 12:19:46 1994 - - * pl15a released. - -Fri Feb 4 09:02:17 1994 - - * scsi.c: Add Teac cdrom to blacklist. - -Thu Feb 3 14:16:43 1994 - - * pl15 released. - -Tue Feb 1 15:47:43 1994 - - * pl14w released. - - * wd7000.c (wd_bases): Fix typo in last change. - -Mon Jan 24 17:37:23 1994 - - * pl14u released. - - * aha1542.c: Support 1542CF/extended bios. Different from 1542C - - * wd7000.c: Allow bios at 0xd8000 as well. - - * ultrastor.c: Do not truncate cylinders to 1024. - - * fdomain.c: Update to version 5.9 (add new bios signature). - - * NCR5380.c: Update from Drew - should work a lot better now. - -Sat Jan 8 15:13:10 1994 - - * pl14o released. - - * sr_ioctl.c: Zero reserved field before trying to set audio volume. - -Wed Jan 5 13:21:10 1994 - - * pl14m released. - - * fdomain.c: Update to version 5.8. No functional difference??? - -Tue Jan 4 14:26:13 1994 - - * pl14l released. - - * ultrastor.c: Remove outl, inl functions (now provided elsewhere). - -Mon Jan 3 12:27:25 1994 - - * pl14k released. - - * aha152x.c: Remove insw and outsw functions. - - * fdomain.c: Ditto. - -Wed Dec 29 09:47:20 1993 - - * pl14i released. - - * scsi.c: Support RECOVERED_ERROR for tape drives. - - * st.c: Update of tape driver from Kai. - -Tue Dec 21 09:18:30 1993 - - * pl14g released. - - * aha1542.[c,h]: Support extended BIOS stuff. - - * scsi.c: Clean up messages about disks, so they are displayed as - sda, sdb, etc instead of sd0, sd1, etc. - - * sr.c: Force reread of capacity if disk was changed. - Clear buffer before asking for capacity/sectorsize (some drives - do not report this properly). Set needs_sector_size flag if - drive did not return sensible sector size. - -Mon Dec 13 12:13:47 1993 - - * aha152x.c: Update to version .101 from Juergen. - -Mon Nov 29 03:03:00 1993 - - * linux 0.99.14 released. - - * All scsi stuff moved from kernel/blk_drv/scsi to drivers/scsi. - - * Throughout: Grammatical corrections to various comments. - - * Makefile: fix so that we do not need to compile things we are - not going to use. - - * NCR5380.c, NCR5380.h, g_NCR5380.c, g_NCR5380.h, pas16.c, - pas16.h, t128.c, t128.h: New files from Drew. - - * aha152x.c, aha152x.h: New files from Juergen Fischer. - - * aha1542.c: Support for more than one 1542 in the machine - at the same time. Make functions static that do not need - visibility. - - * aha1740.c: Set NEEDS_JUMPSTART flag in reset function, so we - know to restart the command. Change prototype of aha1740_reset - to take a command pointer. - - * constants.c: Clean up a few things. - - * fdomain.c: Update to version 5.6. Move snarf_region. Allow - board to be set at different SCSI ids. Remove support for - reselection (did not work well). Set JUMPSTART flag in reset - code. - - * hosts.c: Support new low-level adapters. Allow for more than - one adapter of a given type. - - * hosts.h: Allow for more than one adapter of a given type. - - * scsi.c: Add scsi_device_types array, if NEEDS_JUMPSTART is set - after a low-level reset, start the command again. Sort blacklist, - and add Maxtor MXT-1240S, XT-4170S, NEC CDROM 84, Seagate ST157N. - - * scsi.h: Add constants for tagged queueing. - - * Throughout: Use constants from major.h instead of hardcoded - numbers for major numbers. - - * scsi_ioctl.c: Fix bug in buffer length in ioctl_command. Use - verify_area in GET_IDLUN ioctl. Add new ioctls for - TAGGED_QUEUE_ENABLE, DISABLE. Only allow IOCTL_SEND_COMMAND by - superuser. - - * sd.c: Only pay attention to UNIT_ATTENTION for removable disks. - Fix bug where sometimes portions of blocks would get lost - resulting in processes hanging. Add messages when we spin up a - disk, and fix a bug in the timing. Increase read-ahead for disks - that are on a scatter-gather capable host adapter. - - * seagate.c: Fix so that some parameters can be set from the lilo - prompt. Supply jumpstart flag if we are resetting and need the - command restarted. Fix so that we return 1 if we detect a card - so that multiple card detection works correctly. Add yet another - signature for FD cards (950). Add another signature for ST0x. - - * sg.c, sg.h: New files from Lawrence Foard for generic scsi - access. - - * sr.c: Add type casts for (void*) so that we can do pointer - arithmetic. Works with GCC without this, but it is not strictly - correct. Same bugfix as was in sd.c. Increase read-ahead a la - disk driver. - - * sr_ioctl.c: Use scsi_malloc buffer instead of buffer from stack - since we cannot guarantee that the stack is < 16Mb. - - ultrastor.c: Update to support 24f properly (JFC's driver). - - wd7000.c: Supply jumpstart flag for reset. Do not round up - number of cylinders in biosparam function. - -Sat Sep 4 20:49:56 1993 - - * 0.99pl13 released. - - * Throughout: Use check_region/snarf_region for all low-level - drivers. - - * aha1542.c: Do hard reset instead of soft (some ethercard probes - screw us up). - - * scsi.c: Add new flag ASKED_FOR_SENSE so that we can tell if we are - in a loop whereby the device returns null sense data. - - * sd.c: Add code to spin up a drive if it is not already spinning. - Do this one at a time to make it easier on power supplies. - - * sd_ioctl.c: Use sync_dev instead of fsync_dev in BLKFLSBUF ioctl. - - * seagate.c: Switch around DATA/CONTROL lines. - - * st.c: Change sense to unsigned. - -Thu Aug 5 11:59:18 1993 - - * 0.99pl12 released. - - * constants.c, constants.h: New files with ascii descriptions of - various conditions. - - * Makefile: Do not try to count the number of low-level drivers, - just generate the list of .o files. - - * aha1542.c: Replace 16 with sizeof(SCpnt->sense_buffer). Add tests - for addresses > 16Mb, panic if we find one. - - * aha1740.c: Ditto with sizeof(). - - * fdomain.c: Update to version 3.18. Add new signature, register IRQ - with irqaction. Use ID 7 for new board. Be more intelligent about - obtaining the h/s/c numbers for biosparam. - - * hosts.c: Do not depend upon Makefile generated count of the number - of low-level host adapters. - - * scsi.c: Use array for scsi_command_size instead of a function. Add - Texel cdrom and Maxtor XT-4380S to blacklist. Allow compile time - option for no-multi lun scan. Add semaphore for possible problems - with handshaking, assume device is faulty until we know it not to be - the case. Add DEBUG_INIT symbol to dump info as we scan for devices. - Zero sense buffer so we can tell if we need to request it. When - examining sense information, request sense if buffer is all zero. - If RESET, request sense information to see what to do next. - - * scsi_debug.c: Change some constants to use symbols like INT_MAX. - - * scsi_ioctl.c (kernel_scsi_ioctl): New function -for making ioctl - calls from kernel space. - - * sd.c: Increase timeout to 300. Use functions in constants.h to - display info. Use scsi_malloc buffer for READ_CAPACITY, since - we cannot guarantee that a stack based buffer is < 16Mb. - - * sd_ioctl.c: Add BLKFLSBUF ioctl. - - * seagate.c: Add new compile time options for ARBITRATE, - SLOW_HANDSHAKE, and SLOW_RATE. Update assembly loops for transferring - data. Use kernel_scsi_ioctl to request mode page with geometry. - - * sr.c: Use functions in constants.c to display messages. - - * st.c: Support for variable block size. - - * ultrastor.c: Do not use cache for tape drives. Set - unchecked_isa_dma flag, even though this may not be needed (gets set - later). - -Sat Jul 17 18:32:44 1993 - - * 0.99pl11 released. C++ compilable. - - * Throughout: Add type casts all over the place, and use "ip" instead - of "info" in the various biosparam functions. - - * Makefile: Compile seagate.c with C++ compiler. - - * aha1542.c: Always set ccb pointer as this gets trashed somehow on - some systems. Add a few type casts. Update biosparam function a little. - - * aha1740.c: Add a few type casts. - - * fdomain.c: Update to version 3.17 from 3.6. Now works with - TMC-18C50. - - * scsi.c: Minor changes here and there with datatypes. Save use_sg - when requesting sense information so that this can properly be - restored if we retry the command. Set aside dma buffers assuming each - block is 1 page, not 1Kb minix block. - - * scsi_ioctl.c: Add a few type casts. Other minor changes. - - * sd.c: Correctly free all scsi_malloc'd memory if we run out of - dma_pool. Store blocksize information for each partition. - - * seagate.c: Minor cleanups here and there. - - * sr.c: Set up blocksize array for all discs. Fix bug in freeing - buffers if we run out of dma pool. - -Thu Jun 2 17:58:11 1993 - - * 0.99pl10 released. - - * aha1542.c: Support for BT 445S (VL-bus board with no dma channel). - - * fdomain.c: Upgrade to version 3.6. Preliminary support for TNC-18C50. - - * scsi.c: First attempt to fix problem with old_use_sg. Change - NOT_READY to a SUGGEST_ABORT. Fix timeout race where time might - get decremented past zero. - - * sd.c: Add block_fsync function to dispatch table. - - * sr.c: Increase timeout to 500 from 250. Add entry for sync in - dispatch table (supply NULL). If we do not have a sectorsize, - try to get it in the sd_open function. Add new function just to - obtain sectorsize. - - * sr.h: Add needs_sector_size semaphore. - - * st.c: Add NULL for fsync in dispatch table. - - * wd7000.c: Allow another condition for power on that are normal - and do not require a panic. - -Thu Apr 22 23:10:11 1993 - - * 0.99pl9 released. - - * aha1542.c: Use (void) instead of () in setup_mailboxes. - - * scsi.c: Initialize transfersize and underflow fields in SCmd to 0. - Do not panic for unsupported message bytes. - - * scsi.h: Allocate 12 bytes instead of 10 for commands. Add - transfersize and underflow fields. - - * scsi_ioctl.c: Further bugfix to ioctl_probe. - - * sd.c: Use long instead of int for last parameter in sd_ioctl. - Initialize transfersize and underflow fields. - - * sd_ioctl.c: Ditto for sd_ioctl(,,,,); - - * seagate.c: New version from Drew. Includes new signatures for FD - cards. Support for 0ws jumper. Correctly initialize - scsi_hosts[hostnum].this_id. Improved handing of - disconnect/reconnect, and support command linking. Use - transfersize and underflow fields. Support scatter-gather. - - * sr.c, sr_ioctl.c: Use long instead of int for last parameter in sr_ioctl. - Use buffer and buflength in do_ioctl. Patches from Chris Newbold for - scsi-2 audio commands. - - * ultrastor.c: Comment out in_byte (compiler warning). - - * wd7000.c: Change () to (void) in wd7000_enable_dma. - -Wed Mar 31 16:36:25 1993 - - * 0.99pl8 released. - - * aha1542.c: Handle mailboxes better for 1542C. - Do not truncate number of cylinders at 1024 for biosparam call. - - * aha1740.c: Fix a few minor bugs for multiple devices. - Same as above for biosparam. - - * scsi.c: Add lockable semaphore for removable devices that can have - media removal prevented. Add another signature for flopticals. - (allocate_device): Fix race condition. Allow more space in dma pool - for blocksizes of up to 4Kb. - - * scsi.h: Define COMMAND_SIZE. Define a SCSI specific version of - INIT_REQUEST that can run with interrupts off. - - * scsi_ioctl.c: Make ioctl_probe function more idiot-proof. If - a removable device says ILLEGAL REQUEST to a door-locking command, - clear lockable flag. Add SCSI_IOCTL_GET_IDLUN ioctl. Do not attempt - to lock door for devices that do not have lockable semaphore set. - - * sd.c: Fix race condition for multiple disks. Use INIT_SCSI_REQUEST - instead of INIT_REQUEST. Allow sector sizes of 1024 and 256. For - removable disks that are not ready, mark them as having a media change - (some drives do not report this later). - - * seagate.c: Use volatile keyword for memory-mapped register pointers. - - * sr.c: Fix race condition, a la sd.c. Increase the number of retries - to 1. Use INIT_SCSI_REQUEST. Allow 512 byte sector sizes. Do a - read_capacity when we init the device so we know the size and - sectorsize. - - * st.c: If ioctl not found in st.c, try scsi_ioctl for others. - - * ultrastor.c: Do not truncate number of cylinders at 1024 for - biosparam call. - - * wd7000.c: Ditto. - Throughout: Use COMMAND_SIZE macro to determine length of scsi - command. - - - -Sat Mar 13 17:31:29 1993 - - * 0.99pl7 released. - - Throughout: Improve punctuation in some messages, and use new - verify_area syntax. - - * aha1542.c: Handle unexpected interrupts better. - - * scsi.c: Ditto. Handle reset conditions a bit better, asking for - sense information and retrying if required. - - * scsi_ioctl.c: Allow for 12 byte scsi commands. - - * ultrastor.c: Update to use scatter-gather. - -Sat Feb 20 17:57:15 1993 - - * 0.99pl6 released. - - * fdomain.c: Update to version 3.5. Handle spurious interrupts - better. - - * sd.c: Use register_blkdev function. - - * sr.c: Ditto. - - * st.c: Use register_chrdev function. - - * wd7000.c: Undo previous change. - -Sat Feb 6 11:20:43 1993 - - * 0.99pl5 released. - - * scsi.c: Fix bug in testing for UNIT_ATTENTION. - - * wd7000.c: Check at more addresses for bios. Fix bug in biosparam - (heads & sectors turned around). - -Wed Jan 20 18:13:59 1993 - - * 0.99pl4 released. - - * scsi.c: Ignore leading spaces when looking for blacklisted devices. - - * seagate.c: Add a few new signatures for FD cards. Another patch - with SCint to fix race condition. Use recursion_depth to keep track - of how many times we have been recursively called, and do not start - another command unless we are on the outer level. Fixes bug - with Syquest cartridge drives (used to crash kernel), because - they do not disconnect with large data transfers. - -Tue Jan 12 14:33:36 1993 - - * 0.99pl3 released. - - * fdomain.c: Update to version 3.3 (a few new signatures). - - * scsi.c: Add CDU-541, Denon DRD-25X to blacklist. - (allocate_request, request_queueable): Init request.waiting to NULL if - non-buffer type of request. - - * seagate.c: Allow controller to be overridden with CONTROLLER symbol. - Set SCint=NULL when we are done, to remove race condition. - - * st.c: Changes from Kai. - -Wed Dec 30 20:03:47 1992 - - * 0.99pl2 released. - - * scsi.c: Blacklist back in. Remove Newbury drive as other bugfix - eliminates need for it here. - - * sd.c: Return ENODEV instead of EACCES if no such device available. - (sd_init) Init blkdev_fops earlier so that sd_open is available sooner. - - * sr.c: Same as above for sd.c. - - * st.c: Return ENODEV instead of ENXIO if no device. Init chrdev_fops - sooner, so that it is always there even if no tapes. - - * seagate.c (controller_type): New variable to keep track of ST0x or - FD. Modify signatures list to indicate controller type, and init - controller_type once we find a match. - - * wd7000.c (wd7000_set_sync): Remove redundant function. - -Sun Dec 20 16:26:24 1992 - - * 0.99pl1 released. - - * scsi_ioctl.c: Bugfix - check dev->index, not dev->id against - NR_SCSI_DEVICES. - - * sr_ioctl.c: Verify that device exists before allowing an ioctl. - - * st.c: Patches from Kai - change timeout values, improve end of tape - handling. - -Sun Dec 13 18:15:23 1992 - - * 0.99 kernel released. Baseline for this ChangeLog. diff -Nru a/Documentation/scsi/ChangeLog.1992-1997 b/Documentation/scsi/ChangeLog.1992-1997 --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/Documentation/scsi/ChangeLog.1992-1997 2005-01-02 23:03:33 -08:00 @@ -0,0 +1,2023 @@ +Sat Jan 18 15:51:45 1997 Richard Henderson + + * Don't play with usage_count directly, instead hand around + the module header and use the module macros. + +Fri May 17 00:00:00 1996 Leonard N. Zubkoff + + * BusLogic Driver Version 2.0.3 Released. + +Tue Apr 16 21:00:00 1996 Leonard N. Zubkoff + + * BusLogic Driver Version 1.3.2 Released. + +Sun Dec 31 23:26:00 1995 Leonard N. Zubkoff + + * BusLogic Driver Version 1.3.1 Released. + +Fri Nov 10 15:29:49 1995 Leonard N. Zubkoff + + * Released new BusLogic driver. + +Wed Aug 9 22:37:04 1995 Andries Brouwer + + As a preparation for new device code, separated the various + functions the request->dev field had into the device proper, + request->rq_dev and a status field request->rq_status. + + The 2nd argument of bios_param is now a kdev_t. + +Wed Jul 19 10:43:15 1995 Michael Neuffer + + * scsi.c (scsi_proc_info): /proc/scsi/scsi now also lists all + attached devices. + + * scsi_proc.c (proc_print_scsidevice): Added. Used by scsi.c and + eata_dma_proc.c to produce some device info for /proc/scsi. + + * eata_dma.c (eata_queue)(eata_int_handler)(eata_scsi_done): + Changed handling of internal SCSI commands send to the HBA. + + +Wed Jul 19 10:09:17 1995 Michael Neuffer + + * Linux 1.3.11 released. + + * eata_dma.c (eata_queue)(eata_int_handler): Added code to do + command latency measurements if requested by root through + /proc/scsi interface. + Throughout Use HZ constant for time references. + + * eata_pio.c: Use HZ constant for time references. + + * aic7xxx.c, aic7xxx.h, aic7xxx_asm.c: Changed copyright from BSD + to GNU style. + + * scsi.h: Added READ_12 command opcode constant + +Wed Jul 19 09:25:30 1995 Michael Neuffer + + * Linux 1.3.10 released. + + * scsi_proc.c (dispatch_scsi_info): Removed unused variable. + +Wed Jul 19 09:25:30 1995 Michael Neuffer + + * Linux 1.3.9 released. + + * scsi.c Blacklist concept expanded to 'support' more device + deficiencies. blacklist[] renamed to device_list[] + (scan_scsis): Code cleanup. + + * scsi_debug.c (scsi_debug_proc_info): Added support to control + device lockup simulation via /proc/scsi interface. + + +Wed Jul 19 09:22:34 1995 Michael Neuffer + + * Linux 1.3.7 released. + + * scsi_proc.c: Fixed a number of bugs in directory handling + +Wed Jul 19 09:18:28 1995 Michael Neuffer + + * Linux 1.3.5 released. + + * Native wide, multichannel and /proc/scsi support now in official + kernel distribution. + + * scsi.c/h, hosts.c/h et al reindented to increase readability + (especially on 80 column wide terminals). + + * scsi.c, scsi_proc.c, ../../fs/proc/inode.c: Added + /proc/scsi/scsi which allows root to scan for hotplugged devices. + + * scsi.c (scsi_proc_info): Added, to support /proc/scsi/scsi. + (scan_scsis): Added some 'spaghetti' code to allow scanning for + single devices. + + +Thu Jun 20 15:20:27 1995 Michael Neuffer + + * proc.c: Renamed to scsi_proc.c + +Mon Jun 12 20:32:45 1995 Michael Neuffer + + * Linux 1.3.0 released. + +Mon May 15 19:33:14 1995 Michael Neuffer + + * scsi.c: Added native multichannel and wide scsi support. + + * proc.c (dispatch_scsi_info) (build_proc_dir_hba_entries): + Updated /proc/scsi interface. + +Thu May 4 17:58:48 1995 Michael Neuffer + + * sd.c (requeue_sd_request): Zero out the scatterlist only if + scsi_malloc returned memory for it. + + * eata_dma.c (register_HBA) (eata_queue): Add support for + large scatter/gather tables and set use_clustering accordingly + + * hosts.c: Make use_clustering changeable in the Scsi_Host structure. + +Wed Apr 12 15:25:52 1995 Eric Youngdale (eric@andante) + + * Linux 1.2.5 released. + + * buslogic.c: Update to version 1.15 (From Leonard N. Zubkoff). + Fixed interrupt routine to avoid races when handling multiple + complete commands per interrupt. Seems to come up with faster + cards. + + * eata_dma.c: Update to 2.3.5r. Modularize. Improved error handling + throughout and fixed bug interrupt routine which resulted in shifted + status bytes. Added blink LED state checks for ISA and EISA HBAs. + Memory management bug seems to have disappeared ==> increasing + C_P_L_CURRENT_MAX to 16 for now. Decreasing C_P_L_DIV to 3 for + performance reasons. + + * scsi.c: If we get a FMK, EOM, or ILI when attempting to scan + the bus, assume that it was just noise on the bus, and ignore + the device. + + * scsi.h: Update and add a bunch of missing commands which we + were never using. + + * sd.c: Use restore_flags in do_sd_request - this may result in + latency conditions, but it gets rid of races and crashes. + Do not save flags again when searching for a second command to + queue. + + * st.c: Use bytes, not STP->buffer->buffer_size when reading + from tape. + + +Tue Apr 4 09:42:08 1995 Eric Youngdale (eric@andante) + + * Linux 1.2.4 released. + + * st.c: Fix typo - restoring wrong flags. + +Wed Mar 29 06:55:12 1995 Eric Youngdale (eric@andante) + + * Linux 1.2.3 released. + + * st.c: Perform some waiting operations with interrupts off. + Is this correct??? + +Wed Mar 22 10:34:26 1995 Eric Youngdale (eric@andante) + + * Linux 1.2.2 released. + + * aha152x.c: Modularize. Add support for PCMCIA. + + * eata.c: Update to version 2.0. Fixed bug preventing media + detection. If scsi_register_host returns NULL, fail gracefully. + + * scsi.c: Detect as NEC (for photo-cd purposes) for the 84 + and 25 models as "NEC_OLDCDR". + + * scsi.h: Add define for NEC_OLDCDR + + * sr.c: Add handling for NEC_OLDCDR. Treat as unknown. + + * u14-34f.c: Update to version 2.0. Fixed same bug as in + eata.c. + + +Mon Mar 6 11:11:20 1995 Eric Youngdale (eric@andante) + + * Linux 1.2.0 released. Yeah!!! + + * Minor spelling/punctuation changes throughout. Nothing + substantive. + +Mon Feb 20 21:33:03 1995 Eric Youngdale (eric@andante) + + * Linux 1.1.95 released. + + * qlogic.c: Update to version 0.41. + + * seagate.c: Change some message to be more descriptive about what + we detected. + + * sr.c: spelling/whitespace changes. + +Mon Feb 20 21:33:03 1995 Eric Youngdale (eric@andante) + + * Linux 1.1.94 released. + +Mon Feb 20 08:57:17 1995 Eric Youngdale (eric@andante) + + * Linux 1.1.93 released. + + * hosts.h: Change io_port to long int from short. + + * 53c7,8xx.c: crash on AEN fixed, SCSI reset is no longer a NOP, + NULL pointer panic on odd UDCs fixed, two bugs in diagnostic output + fixed, should initialize correctly if left running, now loadable, + new memory allocation, extraneous diagnostic output suppressed, + splx() replaced with save/restore flags. [ Drew ] + + * hosts.c, hosts.h, scsi_ioctl.c, sd.c, sd_ioctl.c, sg.c, sr.c, + sr_ioctl.c: Add special junk at end that Emacs will use for + formatting the file. + + * qlogic.c: Update to v0.40a. Improve parity handling. + + * scsi.c: Add Hitachi DK312C to blacklist. Change "};" to "}" in + many places. Use scsi_init_malloc to get command block - may + need this to be dma compatible for some host adapters. + Restore interrupts after unregistering a host. + + * sd.c: Use sti instead of restore flags - causes latency problems. + + * seagate.c: Use controller_type to determine string used when + registering irq. + + * sr.c: More photo-cd hacks to make sure we get the xa stuff right. + * sr.h, sr.c: Change is_xa to xa_flags field. + + * st.c: Disable retries for write operations. + +Wed Feb 15 10:52:56 1995 Eric Youngdale (eric@andante) + + * Linux 1.1.92 released. + + * eata.c: Update to 1.17. + + * eata_dma.c: Update to 2.31a. Add more support for /proc/scsi. + Continuing modularization. Less crashes because of the bug in the + memory management ==> increase C_P_L_CURRENT_MAX to 10 + and decrease C_P_L_DIV to 4. + + * hosts.c: If we remove last host registered, reuse host number. + When freeing memory from host being deregistered, free extra_bytes + too. + + * scsi.c (scan_scsis): memset(SDpnt, 0) and set SCmd.device to SDpnt. + Change memory allocation to work around bugs in __get_dma_pages. + Do not free host if usage count is not zero (for modules). + + * sr_ioctl.c: Increase IOCTL_TIMEOUT to 3000. + + * st.c: Allow for ST_EXTRA_DEVS in st data structures. + + * u14-34f.c: Update to 1.17. + +Thu Feb 9 10:11:16 1995 Eric Youngdale (eric@andante) + + * Linux 1.1.91 released. + + * eata.c: Update to 1.16. Use wish_block instead of host->block. + + * hosts.c: Initialize wish_block to 0. + + * hosts.h: Add wish_block. + + * scsi.c: Use wish_block as indicator that the host should be added + to block list. + + * sg.c: Add SG_EXTRA_DEVS to number of slots. + + * u14-34f.c: Use wish_block. + +Tue Feb 7 11:46:04 1995 Eric Youngdale (eric@andante) + + * Linux 1.1.90 released. + + * eata.c: Change naming from eata_* to eata2x_*. Now at vers 1.15. + Update interrupt handler to take pt_regs as arg. Allow blocking + even if loaded as module. Initialize target_time_out array. + Do not put sti(); in timing loop. + + * hosts.c: Do not reuse host numbers. + Use scsi_make_blocked_list to generate blocking list. + + * script_asm.pl: Beats me. Don't know perl. Something to do with + phase index. + + * scsi.c (scsi_make_blocked_list): New function - code copied from + hosts.c. + + * scsi.c: Update code to disable photo CD for Toshiba cdroms. + Use just manufacturer name, not model number. + + * sr.c: Fix setting density for Toshiba drives. + + * u14-34f.c: Clear target_time_out array during reset. + +Wed Feb 1 09:20:45 1995 Eric Youngdale (eric@andante) + + * Linux 1.1.89 released. + + * Makefile, u14-34f.c: Modularize. + + * Makefile, eata.c: Modularize. Now version 1.14 + + * NCR5380.c: Update interrupt handler with new arglist. Minor + cleanups. + + * eata_dma.c: Begin to modularize. Add hooks for /proc/scsi. + New version 2.3.0a. Add code in interrupt handler to allow + certain CDROM drivers to be detected which return a + CHECK_CONDITION during SCSI bus scan. Add opcode check to get + all DATA IN and DATA OUT phases right. Utilize HBA_interpret flag. + Improvements in HBA identification. Various other minor stuff. + + * hosts.c: Initialize ->dma_channel and ->io_port when registering + a new host. + + * qlogic.c: Modularize and add PCMCIA support. + + * scsi.c: Add Hitachi to blacklist. + + * scsi.c: Change default to no lun scan (too many problem devices). + + * scsi.h: Define QUEUE_FULL condition. + + * sd.c: Do not check for non-existent partition until after + new media check. + + * sg.c: Undo previous change which was wrong. + + * sr_ioctl.c: Increase IOCTL_TIMEOUT to 2000. + + * st.c: Patches from Kai - improve filemark handling. + +Tue Jan 31 17:32:12 1995 Eric Youngdale (eric@andante) + + * Linux 1.1.88 released. + + * Throughout - spelling/grammar fixups. + + * scsi.c: Make sure that all buffers are 16 byte aligned - some + drivers (buslogic) need this. + + * scsi.c (scan_scsis): Remove message printed. + + * scsi.c (scsi_init): Move message here. + +Mon Jan 30 06:40:25 1995 Eric Youngdale (eric@andante) + + * Linux 1.1.87 released. + + * sr.c: Photo-cd related changes. (Gerd Knorr??). + + * st.c: Changes from Kai related to EOM detection. + +Mon Jan 23 23:53:10 1995 Eric Youngdale (eric@andante) + + * Linux 1.1.86 released. + + * 53c7,8xx.h: Change SG size to 127. + + * eata_dma: Update to version 2.10i. Remove bug in the registration + of multiple HBAs and channels. Minor other improvements and stylistic + changes. + + * scsi.c: Test for Toshiba XM-3401TA and exclude from detection + as toshiba drive - photo cd does not work with this drive. + + * sr.c: Update photocd code. + +Mon Jan 23 23:53:10 1995 Eric Youngdale (eric@andante) + + * Linux 1.1.85 released. + + * st.c, st_ioctl.c, sg.c, sd_ioctl.c, scsi_ioctl.c, hosts.c: + include linux/mm.h + + * qlogic.c, buslogic.c, aha1542.c: Include linux/module.h. + +Sun Jan 22 22:08:46 1995 Eric Youngdale (eric@andante) + + * Linux 1.1.84 released. + + * Makefile: Support for loadable QLOGIC boards. + + * aha152x.c: Update to version 1.8 from Juergen. + + * eata_dma.c: Update from Michael Neuffer. + Remove hard limit of 2 commands per lun and make it better + configurable. Improvements in HBA identification. + + * in2000.c: Fix biosparam to support large disks. + + * qlogic.c: Minor changes (change sti -> restore_flags). + +Wed Jan 18 23:33:09 1995 Eric Youngdale (eric@andante) + + * Linux 1.1.83 released. + + * aha1542.c(aha1542_intr_handle): Use arguments handed down to find + which irq. + + * buslogic.c: Likewise. + + * eata_dma.c: Use min of 2 cmd_per_lun for OCS_enabled boards. + + * scsi.c: Make RECOVERED_ERROR a SUGGEST_IS_OK. + + * sd.c: Fail if we are opening a non-existent partition. + + * sr.c: Bump SR_TIMEOUT to 15000. + Do not probe for media size at boot time(hard on changers). + Flag device as needing sector size instead. + + * sr_ioctl.c: Remove CDROMMULTISESSION_SYS ioctl. + + * ultrastor.c: Fix bug in call to ultrastor_interrupt (wrong #args). + +Mon Jan 16 07:18:23 1995 Eric Youngdale (eric@andante) + + * Linux 1.1.82 released. + + Throughout. + - Change all interrupt handlers to accept new calling convention. + In particular, we now receive the irq number as one of the arguments. + + * More minor spelling corrections in some of the new files. + + * aha1542.c, buslogic.c: Clean up interrupt handler a little now + that we receive the irq as an arg. + + * aha274x.c: s/snarf_region/request_region/ + + * eata.c: Update to version 1.12. Fix some comments and display a + message if we cannot reserve the port addresses. + + * u14-34f.c: Update to version 1.13. Fix some comments and display a + message if we cannot reserve the port addresses. + + * eata_dma.c: Define get_board_data function (send INQUIRY command). + Use to improve detection of variants of different DPT boards. Change + version subnumber to "0g". + + * fdomain.c: Update to version 5.26. Improve detection of some boards + repackaged by IBM. + + * scsi.c (scsi_register_host): Change "name" to const char *. + + * sr.c: Fix problem in set mode command for Toshiba drives. + + * sr.c: Fix typo from patch 81. + +Fri Jan 13 12:54:46 1995 Eric Youngdale (eric@andante) + + * Linux 1.1.81 released. Codefreeze for 1.2 release announced. + + Big changes here. + + * eata_dma.*: New files from Michael Neuffer. + (neuffer@goofy.zdv.uni-mainz.de). Should support + all eata/dpt cards. + + * hosts.c, Makefile: Add eata_dma. + + * README.st: Document MTEOM. + + Patches from me (ERY) to finish support for low-level loadable scsi. + It now works, and is actually useful. + + * Throughout - add new argument to scsi_init_malloc that takes an + additional parameter. This is used as a priority to kmalloc, + and you can specify the GFP_DMA flag if you need DMA-able memory. + + * Makefile: For source files that are loadable, always add name + to SCSI_SRCS. Fill in modules: target. + + * hosts.c: Change next_host to next_scsi_host, and make global. + Print hosts after we have identified all of them. Use info() + function if present, otherwise use name field. + + * hosts.h: Change attach function to return int, not void. + Define number of device slots to allow for loadable devices. + Define tags to tell scsi module code what type of module we + are loading. + + * scsi.c: Fix scan_scsis so that it can be run by a user process. + Do not use waiting loops - use up and down mechanism as long + as current != task[0]. + + * scsi.c(scan_scsis): Do not use stack variables for I/O - this + could be > 16Mb if we are loading a module at runtime (i.e. use + scsi_init_malloc to get some memory we know will be safe). + + * scsi.c: Change dma freelist to be a set of pages. This allows + us to dynamically adjust the size of the list by adding more pages + to the pagelist. Fix scsi_malloc and scsi_free accordingly. + + * scsi_module.c: Fix include. + + * sd.c: Declare detach function. Increment/decrement module usage + count as required. Fix init functions to allow loaded devices. + Revalidate all new disks so we get the partition tables. Define + detach function. + + * sr.c: Likewise. + + * sg.c: Declare detach function. Allow attachment of devices on + loaded drivers. + + * st.c: Declare detach function. Increment/decrement module usage + count as required. + +Tue Jan 10 10:09:58 1995 Eric Youngdale (eric@andante) + + * Linux 1.1.79 released. + + Patch from some undetermined individual who needs to get a life :-). + + * sr.c: Attacked by spelling bee... + + Patches from Gerd Knorr: + + * sr.c: make printk messages for photoCD a little more informative. + + * sr_ioctl.c: Fix CDROMMULTISESSION_SYS ioctl. + +Mon Jan 9 10:01:37 1995 Eric Youngdale (eric@andante) + + * Linux 1.1.78 released. + + * Makefile: Add empty modules: target. + + * Wheee. Now change register_iomem to request_region. + + * in2000.c: Bugfix - apparently this is the fix that we have + all been waiting for. It fixes a problem whereby the driver + is not stable under heavy load. Race condition and all that. + Patch from Peter Lu. + +Wed Jan 4 21:17:40 1995 Eric Youngdale (eric@andante) + + * Linux 1.1.77 released. + + * 53c7,8xx.c: Fix from Linus - emulate splx. + + Throughout: + + Change "snarf_region" with "register_iomem". + + * scsi_module.c: New file. Contains support for low-level loadable + scsi drivers. [ERY]. + + * sd.c: More s/int/long/ changes. + + * seagate.c: Explicitly include linux/config.h + + * sg.c: Increment/decrement module usage count on open/close. + + * sg.c: Be a bit more careful about the user not supplying enough + information for a valid command. Pass correct size down to + scsi_do_cmd. + + * sr.c: More changes for Photo-CD. This apparently breaks NEC drives. + + * sr_ioctl.c: Support CDROMMULTISESSION ioctl. + + +Sun Jan 1 19:55:21 1995 Eric Youngdale (eric@andante) + + * Linux 1.1.76 released. + + * constants.c: Add type cast in switch statement. + + * scsi.c (scsi_free): Change datatype of "offset" to long. + (scsi_malloc): Change a few more variables to long. Who + did this and why was it important? 64 bit machines? + + + Lots of changes to use save_state/restore_state instead of cli/sti. + Files changed include: + + * aha1542.c: + * aha1740.c: + * buslogic.c: + * in2000.c: + * scsi.c: + * scsi_debug.c: + * sd.c: + * sr.c: + * st.c: + +Wed Dec 28 16:38:29 1994 Eric Youngdale (eric@andante) + + * Linux 1.1.75 released. + + * buslogic.c: Spelling fix. + + * scsi.c: Add HP C1790A and C2500A scanjet to blacklist. + + * scsi.c: Spelling fixup. + + * sd.c: Add support for sd_hardsizes (hard sector sizes). + + * ultrastor.c: Use save_flags/restore_flags instead of cli/sti. + +Fri Dec 23 13:36:25 1994 Eric Youngdale (eric@andante) + + * Linux 1.1.74 released. + + * README.st: Update from Kai Makisara. + + * eata.c: New version from Dario - version 1.11. + use scsicam bios_param routine. Add support for 2011 + and 2021 boards. + + * hosts.c: Add support for blocking. Linked list automatically + generated when shpnt->block is set. + + * scsi.c: Add sankyo & HP scanjet to blacklist. Add support for + kicking things loose when we deadlock. + + * scsi.c: Recognize scanners and processors in scan_scsis. + + * scsi_ioctl.h: Increase timeout to 9 seconds. + + * st.c: New version from Kai - add better support for backspace. + + * u14-34f.c: New version from Dario. Supports blocking. + +Wed Dec 14 14:46:30 1994 Eric Youngdale (eric@andante) + + * Linux 1.1.73 released. + + * buslogic.c: Update from Dave Gentzel. Version 1.14. + Add module related stuff. More fault tolerant if out of + DMA memory. + + * fdomain.c: New version from Rik Faith - version 5.22. Add support + for ISA-200S SCSI adapter. + + * hosts.c: Spelling. + + * qlogic.c: Update to version 0.38a. Add more support for PCMCIA. + + * scsi.c: Mask device type with 0x1f during scan_scsis. + Add support for deadlocking, err, make that getting out of + deadlock situations that are created when we allow the user + to limit requests to one host adapter at a time. + + * scsi.c: Bugfix - pass pid, not SCpnt as second arg to + scsi_times_out. + + * scsi.c: Restore interrupt state to previous value instead of using + cli/sti pairs. + + * scsi.c: Add a bunch of module stuff (all commented out for now). + + * scsi.c: Clean up scsi_dump_status. + +Tue Dec 6 12:34:20 1994 Eric Youngdale (eric@andante) + + * Linux 1.1.72 released. + + * sg.c: Bugfix - always use sg_free, since we might have big buff. + +Fri Dec 2 11:24:53 1994 Eric Youngdale (eric@andante) + + * Linux 1.1.71 released. + + * sg.c: Clear buff field when not in use. Only call scsi_free if + non-null. + + * scsi.h: Call wake_up(&wait_for_request) when done with a + command. + + * scsi.c (scsi_times_out): Pass pid down so that we can protect + against race conditions. + + * scsi.c (scsi_abort): Zero timeout field if we get the + NOT_RUNNING message back from low-level driver. + + + * scsi.c (scsi_done): Restore cmd_len, use_sg here. + + * scsi.c (request_sense): Not here. + + * hosts.h: Add new forbidden_addr, forbidden_size fields. Who + added these and why???? + + * hosts.c (scsi_mem_init): Mark pages as reserved if they fall in + the forbidden regions. I am not sure - I think this is so that + we can deal with boards that do incomplete decoding of their + address lines for the bios chips, but I am not entirely sure. + + * buslogic.c: Set forbidden_addr stuff if using a buggy board. + + * aha1740.c: Test for NULL pointer in SCtmp. This should not + occur, but a nice message is better than a kernel segfault. + + * 53c7,8xx.c: Add new PCI chip ID for 815. + +Fri Dec 2 11:24:53 1994 Eric Youngdale (eric@andante) + + * Linux 1.1.70 released. + + * ChangeLog, st.c: Spelling. + +Tue Nov 29 18:48:42 1994 Eric Youngdale (eric@andante) + + * Linux 1.1.69 released. + + * u14-34f.h: Non-functional change. [Dario]. + + * u14-34f.c: Use block field in Scsi_Host to prevent commands from + being queued to more than one host at the same time (used when + motherboard does not deal with multiple bus-masters very well). + Only when SINGLE_HOST_OPERATIONS is defined. + Use new cmd_per_lun field. [Dario] + + * eata.c: Likewise. + + * st.c: More changes from Kai. Add ready flag to indicate drive + status. + + * README.st: Document this. + + * sr.c: Bugfix (do not subtract CD_BLOCK_OFFSET) for photo-cd + code. + + * sg.c: Bugfix - fix problem where opcode is not correctly set up. + + * seagate.[c,h]: Use #defines to set driver name. + + * scsi_ioctl.c: Zero buffer before executing command. + + * scsi.c: Use new cmd_per_lun field in Scsi_Hosts as appropriate. + Add Sony CDU55S to blacklist. + + * hosts.h: Add new cmd_per_lun field to Scsi_Hosts. + + * hosts.c: Initialize cmd_per_lun in Scsi_Hosts from template. + + * buslogic.c: Use cmd_per_lun field - initialize to different + values depending upon bus type (i.e. use 1 if ISA, so we do not + hog memory). Use other patches which got lost from 1.1.68. + + * aha1542.c: Spelling. + +Tue Nov 29 15:43:50 1994 Eric Youngdale (eric@andante.aib.com) + + * Linux 1.1.68 released. + + Add support for 12 byte vendor specific commands in scsi-generics, + more (i.e. the last mandatory) low-level changes to support + loadable modules, plus a few other changes people have requested + lately. Changes by me (ERY) unless otherwise noted. Spelling + changes appear from some unknown corner of the universe. + + * Throughout: Change COMMAND_SIZE() to use SCpnt->cmd_len. + + * Throughout: Change info() low level function to take a Scsi_Host + pointer. This way the info function can return specific + information about the host in question, if desired. + + * All low-level drivers: Add NULL in initializer for the + usage_count field added to Scsi_Host_Template. + + * aha152x.[c,h]: Remove redundant info() function. + + * aha1542.[c,h]: Likewise. + + * aha1740.[c,h]: Likewise. + + * aha274x.[c,h]: Likewise. + + * eata.[c,h]: Likewise. + + * pas16.[c,h]: Likewise. + + * scsi_debug.[c,h]: Likewise. + + * t128.[c,h]: Likewise. + + * u14-34f.[c,h]: Likewise. + + * ultrastor.[c,h]: Likewise. + + * wd7000.[c,h]: Likewise. + + * aha1542.c: Add support for command line options with lilo to set + DMA parameters, I/O port. From Matt Aarnio. + + * buslogic.[c,h]: New version (1.13) from Dave Gentzel. + + * hosts.h: Add new field to Scsi_Hosts "block" to allow blocking + all I/O to certain other cards. Helps prevent problems with some + ISA motherboards. + + * hosts.h: Add usage_count to Scsi_Host_Template. + + * hosts.h: Add n_io_port to Scsi_Host (used when releasing module). + + * hosts.c: Initialize block field. + + * in2000.c: Remove "static" declarations from exported functions. + + * in2000.h: Likewise. + + * scsi.c: Correctly set cmd_len field as required. Save and + change setting when doing a request_sense, restore when done. + Move abort timeout message. Fix panic in request_queueable to + print correct function name. + + * scsi.c: When incrementing usage count, walk block linked list + for host, and or in SCSI_HOST_BLOCK bit. When decrementing usage + count to 0, clear this bit to allow usage to continue, wake up + processes waiting. + + + * scsi_ioctl.c: If we have an info() function, call it, otherwise + if we have a "name" field, use it, else do nothing. + + * sd.c, sr.c: Clear cmd_len field prior to each command we + generate. + + * sd.h: Add "has_part_table" bit to rscsi_disks. + + * sg.[c,h]: Add support for vendor specific 12 byte commands (i.e. + override command length in COMMAND_SIZE). + + * sr.c: Bugfix from Gerd in photocd code. + + * sr.c: Bugfix in get_sectorsize - always use scsi_malloc buffer - + we cannot guarantee that the stack is < 16Mb. + +Tue Nov 22 15:40:46 1994 Eric Youngdale (eric@andante.aib.com) + + * Linux 1.1.67 released. + + * sr.c: Change spelling of manufactor to manufacturer. + + * scsi.h: Likewise. + + * scsi.c: Likewise. + + * qlogic.c: Spelling corrections. + + * in2000.h: Spelling corrections. + + * in2000.c: Update from Bill Earnest, change from + jshiffle@netcom.com. Support new bios versions. + + * README.qlogic: Spelling correction. + +Tue Nov 22 15:40:46 1994 Eric Youngdale (eric@andante.aib.com) + + * Linux 1.1.66 released. + + * u14-34f.c: Spelling corrections. + + * sr.[h,c]: Add support for multi-session CDs from Gerd Knorr. + + * scsi.h: Add manufactor field for keeping track of device + manufacturer. + + * scsi.c: More spelling corrections. + + * qlogic.h, qlogic.c, README.qlogic: New driver from Tom Zerucha. + + * in2000.c, in2000.h: New driver from Brad McLean/Bill Earnest. + + * fdomain.c: Spelling correction. + + * eata.c: Spelling correction. + +Fri Nov 18 15:22:44 1994 Eric Youngdale (eric@andante.aib.com) + + * Linux 1.1.65 released. + + * eata.h: Update version string to 1.08.00. + + * eata.c: Set sg_tablesize correctly for DPT PM2012 boards. + + * aha274x.seq: Spell checking. + + * README.st: Likewise. + + * README.aha274x: Likewise. + + * ChangeLog: Likewise. + +Tue Nov 15 15:35:08 1994 Eric Youngdale (eric@andante.aib.com) + + * Linux 1.1.64 released. + + * u14-34f.h: Update version number to 1.10.01. + + * u14-34f.c: Use Scsi_Host can_queue variable instead of one from template. + + * eata.[c,h]: New driver for DPT boards from Dario Ballabio. + + * buslogic.c: Use can_queue field. + +Wed Nov 30 12:09:09 1994 Eric Youngdale (eric@andante.aib.com) + + * Linux 1.1.63 released. + + * sd.c: Give I/O error if we attempt 512 byte I/O to a disk with + 1024 byte sectors. + + * scsicam.c: Make sure we do read from whole disk (mask off + partition). + + * scsi.c: Use can_queue in Scsi_Host structure. + Fix panic message about invalid host. + + * hosts.c: Initialize can_queue from template. + + * hosts.h: Add can_queue to Scsi_Host structure. + + * aha1740.c: Print out warning about NULL ecbptr. + +Fri Nov 4 12:40:30 1994 Eric Youngdale (eric@andante.aib.com) + + * Linux 1.1.62 released. + + * fdomain.c: Update to version 5.20. (From Rik Faith). Support + BIOS version 3.5. + + * st.h: Add ST_EOD symbol. + + * st.c: Patches from Kai Makisara - support additional densities, + add support for MTFSS, MTBSS, MTWSM commands. + + * README.st: Update to document new commands. + + * scsi.c: Add Mediavision CDR-H93MV to blacklist. + +Sat Oct 29 20:57:36 1994 Eric Youngdale (eric@andante.aib.com) + + * Linux 1.1.60 released. + + * u14-34f.[c,h]: New driver from Dario Ballabio. + + * aic7770.c, aha274x_seq.h, aha274x.seq, aha274x.h, aha274x.c, + README.aha274x: New files, new driver from John Aycock. + + +Tue Oct 11 08:47:39 1994 Eric Youngdale (eric@andante) + + * Linux 1.1.54 released. + + * Add third PCI chip id. [Drew] + + * buslogic.c: Set BUSLOGIC_CMDLUN back to 1 [Eric]. + + * ultrastor.c: Fix asm directives for new GCC. + + * sr.c, sd.c: Use new end_scsi_request function. + + * scsi.h(end_scsi_request): Return pointer to block if still + active, else return NULL if inactive. Fixes race condition. + +Sun Oct 9 20:23:14 1994 Eric Youngdale (eric@andante) + + * Linux 1.1.53 released. + + * scsi.c: Do not allocate dma bounce buffers if we have exactly + 16Mb. + +Fri Sep 9 05:35:30 1994 Eric Youngdale (eric@andante) + + * Linux 1.1.51 released. + + * aha152x.c: Add support for disabling the parity check. Update + to version 1.4. [Juergen]. + + * seagate.c: Tweak debugging message. + +Wed Aug 31 10:15:55 1994 Eric Youngdale (eric@andante) + + * Linux 1.1.50 released. + + * aha152x.c: Add eb800 for Vtech Platinum SMP boards. [Juergen]. + + * scsi.c: Add Quantum PD1225S to blacklist. + +Fri Aug 26 09:38:45 1994 Eric Youngdale (eric@andante) + + * Linux 1.1.49 released. + + * sd.c: Fix bug when we were deleting the wrong entry if we + get an unsupported sector size device. + + * sr.c: Another spelling patch. + +Thu Aug 25 09:15:27 1994 Eric Youngdale (eric@andante) + + * Linux 1.1.48 released. + + * Throughout: Use new semantics for request_dma, as appropriate. + + * sr.c: Print correct device number. + +Sun Aug 21 17:49:23 1994 Eric Youngdale (eric@andante) + + * Linux 1.1.47 released. + + * NCR5380.c: Add support for LIMIT_TRANSFERSIZE. + + * constants.h: Add prototype for print_Scsi_Cmnd. + + * pas16.c: Some more minor tweaks. Test for Mediavision board. + Allow for disks > 1Gb. [Drew??] + + * sr.c: Set SCpnt->transfersize. + +Tue Aug 16 17:29:35 1994 Eric Youngdale (eric@andante) + + * Linux 1.1.46 released. + + * Throughout: More spelling fixups. + + * buslogic.c: Add a few more fixups from Dave. Disk translation + mainly. + + * pas16.c: Add a few patches (Drew?). + + +Thu Aug 11 20:45:15 1994 Eric Youngdale (eric@andante) + + * Linux 1.1.44 released. + + * hosts.c: Add type casts for scsi_init_malloc. + + * scsicam.c: Add type cast. + +Wed Aug 10 19:23:01 1994 Eric Youngdale (eric@andante) + + * Linux 1.1.43 released. + + * Throughout: Spelling cleanups. [??] + + * aha152x.c, NCR53*.c, fdomain.c, g_NCR5380.c, pas16.c, seagate.c, + t128.c: Use request_irq, not irqaction. [??] + + * aha1542.c: Move test for shost before we start to use shost. + + * aha1542.c, aha1740.c, ultrastor.c, wd7000.c: Use new + calling sequence for request_irq. + + * buslogic.c: Update from Dave Gentzel. + +Tue Aug 9 09:32:59 1994 Eric Youngdale (eric@andante) + + * Linux 1.1.42 released. + + * NCR5380.c: Change NCR5380_print_status to static. + + * seagate.c: A few more bugfixes. Only Drew knows what they are + for. + + * ultrastor.c: Tweak some __asm__ directives so that it works + with newer compilers. [??] + +Sat Aug 6 21:29:36 1994 Eric Youngdale (eric@andante) + + * Linux 1.1.40 released. + + * NCR5380.c: Return SCSI_RESET_WAKEUP from reset function. + + * aha1542.c: Reset mailbox status after a bus device reset. + + * constants.c: Fix typo (;;). + + * g_NCR5380.c: + * pas16.c: Correct usage of NCR5380_init. + + * scsi.c: Remove redundant (and unused variables). + + * sd.c: Use memset to clear all of rscsi_disks before we use it. + + * sg.c: Ditto, except for scsi_generics. + + * sr.c: Ditto, except for scsi_CDs. + + * st.c: Initialize STp->device. + + * seagate.c: Fix bug. [Drew] + +Thu Aug 4 08:47:27 1994 Eric Youngdale (eric@andante) + + * Linux 1.1.39 released. + + * Makefile: Fix typo in NCR53C7xx. + + * st.c: Print correct number for device. + +Tue Aug 2 11:29:14 1994 Eric Youngdale (eric@esp22) + + * Linux 1.1.38 released. + + Lots of changes in 1.1.38. All from Drew unless otherwise noted. + + * 53c7,8xx.c: New file from Drew. PCI driver. + + * 53c7,8xx.h: Likewise. + + * 53c7,8xx.scr: Likewise. + + * 53c8xx_d.h, 53c8xx_u.h, script_asm.pl: Likewise. + + * scsicam.c: New file from Drew. Read block 0 on the disk and + read the partition table. Attempt to deduce the geometry from + the partition table if possible. Only used by 53c[7,8]xx right + now, but could be used by any device for which we have no way + of identifying the geometry. + + * sd.c: Use device letters instead of sd%d in a lot of messages. + + * seagate.c: Fix bug that resulted in lockups with some devices. + + * sr.c (sr_open): Return -EROFS, not -EACCES if we attempt to open + device for write. + + * hosts.c, Makefile: Update for new driver. + + * NCR5380.c, NCR5380.h, g_NCR5380.h: Update from Drew to support + 53C400 chip. + + * constants.c: Define CONST_CMND and CONST_MSG. Other minor + cleanups along the way. Improve handling of CONST_MSG. + + * fdomain.c, fdomain.h: New version from Rik Faith. Update to + 5.18. Should now support TMC-3260 PCI card with 18C30 chip. + + * pas16.c: Update with new irq initialization. + + * t128.c: Update with minor cleanups. + + * scsi.c (scsi_pid): New variable - gives each command a unique + id. Add Quantum LPS5235S to blacklist. Change in_scan to + in_scan_scsis and make global. + + * scsi.h: Add some defines for extended message handling, + INITIATE/RELEASE_RECOVERY. Add a few new fields to support sync + transfers. + + * scsi_ioctl.h: Add ioctl to request synchronous transfers. + + +Tue Jul 26 21:36:58 1994 Eric Youngdale (eric@esp22) + + * Linux 1.1.37 released. + + * aha1542.c: Always call aha1542_mbenable, use new udelay + mechanism so we do not wait a long time if the board does not + implement this command. + + * g_NCR5380.c: Remove #include and #if + defined(CONFIG_SCSI_*). + + * seagate.c: Likewise. + + Next round of changes to support loadable modules. Getting closer + now, still not possible to do anything remotely usable. + + hosts.c: Create a linked list of detected high level devices. + (scsi_register_device): New function to insert into this list. + (scsi_init): Call scsi_register_device for each of the known high + level drivers. + + hosts.h: Add prototype for linked list header. Add structure + definition for device template structure which defines the linked + list. + + scsi.c: (scan_scsis): Use linked list instead of knowledge about + existing high level device drivers. + (scsi_dev_init): Use init functions for drivers on linked list + instead of explicit list to initialize and attach devices to high + level drivers. + + scsi.h: Add new field "attached" to scsi_device - count of number + of high level devices attached. + + sd.c, sr.c, sg.c, st.c: Adjust init/attach functions to use new + scheme. + +Sat Jul 23 13:03:17 1994 Eric Youngdale (eric@esp22) + + * Linux 1.1.35 released. + + * ultrastor.c: Change constraint on asm() operand so that it works + with gcc 2.6.0. + +Thu Jul 21 10:37:39 1994 Eric Youngdale (eric@esp22) + + * Linux 1.1.33 released. + + * sr.c(sr_open): Do not allow opens with write access. + +Mon Jul 18 09:51:22 1994 1994 Eric Youngdale (eric@esp22) + + * Linux 1.1.31 released. + + * sd.c: Increase SD_TIMEOUT from 300 to 600. + + * sr.c: Remove stray task_struct* variable that was no longer + used. + + * sr_ioctl.c: Fix typo in up() call. + +Sun Jul 17 16:25:29 1994 Eric Youngdale (eric@esp22) + + * Linux 1.1.30 released. + + * scsi.c (scan_scsis): Fix detection of some Toshiba CDROM drives + that report themselves as disk drives. + + * (Throughout): Use request.sem instead of request.waiting. + Should fix swap problem with fdomain. + +Thu Jul 14 10:51:42 1994 Eric Youngdale (eric@esp22) + + * Linux 1.1.29 released. + + * scsi.c (scan_scsis): Add new devices to end of linked list, not + to the beginning. + + * scsi.h (SCSI_SLEEP): Remove brain dead hack to try to save + the task state before sleeping. + +Sat Jul 9 15:01:03 1994 Eric Youngdale (eric@esp22) + + More changes to eventually support loadable modules. Mainly + we want to use linked lists instead of arrays because it is easier + to dynamically add and remove things this way. + + Quite a bit more work is needed before loadable modules are + possible (and usable) with scsi, but this is most of the grunge + work. + + * Linux 1.1.28 released. + + * scsi.c, scsi.h (allocate_device, request_queueable): Change + argument from index into scsi_devices to a pointer to the + Scsi_Device struct. + + * Throughout: Change all calls to allocate_device, + request_queueable to use new calling sequence. + + * Throughout: Use SCpnt->device instead of + scsi_devices[SCpnt->index]. Ugh - the pointer was there all along + - much cleaner this way. + + * scsi.c (scsi_init_malloc, scsi_free_malloc): New functions - + allow us to pretend that we have a working malloc when we + initialize. Use this instead of passing memory_start, memory_end + around all over the place. + + * scsi.h, st.c, sr.c, sd.c, sg.c: Change *_init1 functions to use + scsi_init_malloc, remove all arguments, no return value. + + * scsi.h: Remove index field from Scsi_Device and Scsi_Cmnd + structs. + + * scsi.c (scsi_dev_init): Set up for scsi_init_malloc. + (scan_scsis): Get SDpnt from scsi_init_malloc, and refresh + when we discover a device. Free pointer before returning. + Change scsi_devices into a linked list. + + * scsi.c (scan_scsis): Change to only scan one host. + (scsi_dev_init): Loop over all detected hosts, and scan them. + + * hosts.c (scsi_init_free): Change so that number of extra bytes + is stored in struct, and we do not have to pass it each time. + + * hosts.h: Change Scsi_Host_Template struct to include "next" and + "release" functions. Initialize to NULL in all low level + adapters. + + * hosts.c: Rename scsi_hosts to builtin_scsi_hosts, create linked + list scsi_hosts, linked together with the new "next" field. + +Wed Jul 6 05:45:02 1994 Eric Youngdale (eric@esp22) + + * Linux 1.1.25 released. + + * aha152x.c: Changes from Juergen - cleanups and updates. + + * sd.c, sr.c: Use new check_media_change and revalidate + file_operations fields. + + * st.c, st.h: Add changes from Kai Makisara, dated Jun 22. + + * hosts.h: Change SG_ALL back to 0xff. Apparently soft error + in /dev/brain resulted in having this bumped up. + Change first parameter in bios_param function to be Disk * instead + of index into rscsi_disks. + + * sd_ioctl.c: Pass pointer to rscsi_disks element instead of index + to array. + + * sd.h: Add struct name "scsi_disk" to typedef for Scsi_Disk. + + * scsi.c: Remove redundant Maxtor XT8760S from blacklist. + In scsi_reset, add printk when DEBUG defined. + + * All low level drivers: Modify definitions of bios_param in + appropriate way. + +Thu Jun 16 10:31:59 1994 Eric Youngdale (eric@esp22) + + * Linux 1.1.20 released. + + * scsi_ioctl.c: Only pass down the actual number of characters + required to scsi_do_cmd, not the one rounded up to a even number + of sectors. + + * ultrastor.c: Changes from Caleb Epstein for 24f cards. Support + larger SG lists. + + * ultrastor.c: Changes from me - use scsi_register to register + host. Add some consistency checking, + +Wed Jun 1 21:12:13 1994 Eric Youngdale (eric@esp22) + + * Linux 1.1.19 released. + + * scsi.h: Add new return code for reset() function: + SCSI_RESET_PUNT. + + * scsi.c: Make SCSI_RESET_PUNT the same as SCSI_RESET_WAKEUP for + now. + + * aha1542.c: If the command responsible for the reset is not + pending, return SCSI_RESET_PUNT. + + * aha1740.c, buslogic.c, wd7000.c, ultrastor.c: Return + SCSI_RESET_PUNT instead of SCSI_RESET_SNOOZE. + +Tue May 31 19:36:01 1994 Eric Youngdale (eric@esp22) + + * buslogic.c: Do not print out message about "must be Adaptec" + if we have detected a buslogic card. Print out a warning message + if we are configuring for >16Mb, since the 445S at board level + D or earlier does not work right. The "D" level board can be made + to work by flipping an undocumented switch, but this is too subtle. + + Changes based upon patches in Yggdrasil distribution. + + * sg.c, sg.h: Return sense data to user. + + * aha1542.c, aha1740.c, buslogic.c: Do not panic if + sense buffer is wrong size. + + * hosts.c: Test for ultrastor card before any of the others. + + * scsi.c: Allow boot-time option for max_scsi_luns=? so that + buggy firmware has an easy work-around. + +Sun May 15 20:24:34 1994 Eric Youngdale (eric@esp22) + + * Linux 1.1.15 released. + + Post-codefreeze thaw... + + * buslogic.[c,h]: New driver from David Gentzel. + + * hosts.h: Add use_clustering field to explicitly say whether + clustering should be used for devices attached to this host + adapter. The buslogic board apparently supports large SG lists, + but it is apparently faster if sd.c condenses this into a smaller + list. + + * sd.c: Use this field instead of heuristic. + + * All host adapter include files: Add appropriate initializer for + use_clustering field. + + * scsi.h: Add #defines for return codes for the abort and reset + functions. There are now a specific set of return codes to fully + specify all of the possible things that the low-level adapter + could do. + + * scsi.c: Act based upon return codes from abort/reset functions. + + * All host adapter abort/reset functions: Return new return code. + + * Add code in scsi.c to help debug timeouts. Use #define + DEBUG_TIMEOUT to enable this. + + * scsi.c: If the host->irq field is set, use + disable_irq/enable_irq before calling queuecommand if we + are not already in an interrupt. Reduce races, and we + can be sloppier about cli/sti in the interrupt routines now + (reduce interrupt latency). + + * constants.c: Fix some things to eliminate warnings. Add some + sense descriptions that were omitted before. + + * aha1542.c: Watch for SCRD from host adapter - if we see it, set + a flag. Currently we only print out the number of pending + commands that might need to be restarted. + + * aha1542.c (aha1542_abort): Look for lost interrupts, OGMB still + full, and attempt to recover. Otherwise give up. + + * aha1542.c (aha1542_reset): Try BUS DEVICE RESET, and then pass + DID_RESET back up to the upper level code for all commands running + on this target (even on different LUNs). + +Sat May 7 14:54:01 1994 + + * Linux 1.1.12 released. + + * st.c, st.h: New version from Kai. Supports boot time + specification of number of buffers. + + * wd7000.[c,h]: Updated driver from John Boyd. Now supports + more than one wd7000 board in machine at one time, among other things. + +Wed Apr 20 22:20:35 1994 + + * Linux 1.1.8 released. + + * sd.c: Add a few type casts where scsi_malloc is called. + +Wed Apr 13 12:53:29 1994 + + * Linux 1.1.4 released. + + * scsi.c: Clean up a few printks (use %p to print pointers). + +Wed Apr 13 11:33:02 1994 + + * Linux 1.1.3 released. + + * fdomain.c: Update to version 5.16 (Handle different FIFO sizes + better). + +Fri Apr 8 08:57:19 1994 + + * Linux 1.1.2 released. + + * Throughout: SCSI portion of cluster diffs added. + +Tue Apr 5 07:41:50 1994 + + * Linux 1.1 development tree initiated. + + * The linux 1.0 development tree is now effectively frozen except + for obvious bugfixes. + +****************************************************************** +****************************************************************** +****************************************************************** +****************************************************************** + +Sun Apr 17 00:17:39 1994 + + * Linux 1.0, patchlevel 9 released. + + * fdomain.c: Update to version 5.16 (Handle different FIFO sizes + better). + +Thu Apr 7 08:36:20 1994 + + * Linux 1.0, patchlevel8 released. + + * fdomain.c: Update to version 5.15 from 5.9. Handles 3.4 bios. + +Sun Apr 3 14:43:03 1994 + + * Linux 1.0, patchlevel6 released. + + * wd7000.c: Make stab at fixing race condition. + +Sat Mar 26 14:14:50 1994 + + * Linux 1.0, patchlevel5 released. + + * aha152x.c, Makefile: Fix a few bugs (too much data message). + Add a few more bios signatures. (Patches from Juergen). + + * aha1542.c: Fix race condition in aha1542_out. + +Mon Mar 21 16:36:20 1994 + + * Linux 1.0, patchlevel3 released. + + * sd.c, st.c, sr.c, sg.c: Return -ENXIO, not -ENODEV if we attempt + to open a non-existent device. + + * scsi.c: Add Chinon cdrom to blacklist. + + * sr_ioctl.c: Check return status of verify_area. + +Sat Mar 6 16:06:19 1994 + + * Linux 1.0 released (technically a pre-release). + + * scsi.c: Add IMS CDD521, Maxtor XT-8760S to blacklist. + +Tue Feb 15 10:58:20 1994 + + * pl15e released. + + * aha1542.c: For 1542C, allow dynamic device scan with >1Gb turned + off. + + * constants.c: Fix typo in definition of CONSTANTS. + + * pl15d released. + +Fri Feb 11 10:10:16 1994 + + * pl15c released. + + * scsi.c: Add Maxtor XT-3280 and Rodime RO3000S to blacklist. + + * scsi.c: Allow tagged queueing for scsi 3 devices as well. + Some really old devices report a version number of 0. Disallow + LUN != 0 for these. + +Thu Feb 10 09:48:57 1994 + + * pl15b released. + +Sun Feb 6 12:19:46 1994 + + * pl15a released. + +Fri Feb 4 09:02:17 1994 + + * scsi.c: Add Teac cdrom to blacklist. + +Thu Feb 3 14:16:43 1994 + + * pl15 released. + +Tue Feb 1 15:47:43 1994 + + * pl14w released. + + * wd7000.c (wd_bases): Fix typo in last change. + +Mon Jan 24 17:37:23 1994 + + * pl14u released. + + * aha1542.c: Support 1542CF/extended bios. Different from 1542C + + * wd7000.c: Allow bios at 0xd8000 as well. + + * ultrastor.c: Do not truncate cylinders to 1024. + + * fdomain.c: Update to version 5.9 (add new bios signature). + + * NCR5380.c: Update from Drew - should work a lot better now. + +Sat Jan 8 15:13:10 1994 + + * pl14o released. + + * sr_ioctl.c: Zero reserved field before trying to set audio volume. + +Wed Jan 5 13:21:10 1994 + + * pl14m released. + + * fdomain.c: Update to version 5.8. No functional difference??? + +Tue Jan 4 14:26:13 1994 + + * pl14l released. + + * ultrastor.c: Remove outl, inl functions (now provided elsewhere). + +Mon Jan 3 12:27:25 1994 + + * pl14k released. + + * aha152x.c: Remove insw and outsw functions. + + * fdomain.c: Ditto. + +Wed Dec 29 09:47:20 1993 + + * pl14i released. + + * scsi.c: Support RECOVERED_ERROR for tape drives. + + * st.c: Update of tape driver from Kai. + +Tue Dec 21 09:18:30 1993 + + * pl14g released. + + * aha1542.[c,h]: Support extended BIOS stuff. + + * scsi.c: Clean up messages about disks, so they are displayed as + sda, sdb, etc instead of sd0, sd1, etc. + + * sr.c: Force reread of capacity if disk was changed. + Clear buffer before asking for capacity/sectorsize (some drives + do not report this properly). Set needs_sector_size flag if + drive did not return sensible sector size. + +Mon Dec 13 12:13:47 1993 + + * aha152x.c: Update to version .101 from Juergen. + +Mon Nov 29 03:03:00 1993 + + * linux 0.99.14 released. + + * All scsi stuff moved from kernel/blk_drv/scsi to drivers/scsi. + + * Throughout: Grammatical corrections to various comments. + + * Makefile: fix so that we do not need to compile things we are + not going to use. + + * NCR5380.c, NCR5380.h, g_NCR5380.c, g_NCR5380.h, pas16.c, + pas16.h, t128.c, t128.h: New files from Drew. + + * aha152x.c, aha152x.h: New files from Juergen Fischer. + + * aha1542.c: Support for more than one 1542 in the machine + at the same time. Make functions static that do not need + visibility. + + * aha1740.c: Set NEEDS_JUMPSTART flag in reset function, so we + know to restart the command. Change prototype of aha1740_reset + to take a command pointer. + + * constants.c: Clean up a few things. + + * fdomain.c: Update to version 5.6. Move snarf_region. Allow + board to be set at different SCSI ids. Remove support for + reselection (did not work well). Set JUMPSTART flag in reset + code. + + * hosts.c: Support new low-level adapters. Allow for more than + one adapter of a given type. + + * hosts.h: Allow for more than one adapter of a given type. + + * scsi.c: Add scsi_device_types array, if NEEDS_JUMPSTART is set + after a low-level reset, start the command again. Sort blacklist, + and add Maxtor MXT-1240S, XT-4170S, NEC CDROM 84, Seagate ST157N. + + * scsi.h: Add constants for tagged queueing. + + * Throughout: Use constants from major.h instead of hardcoded + numbers for major numbers. + + * scsi_ioctl.c: Fix bug in buffer length in ioctl_command. Use + verify_area in GET_IDLUN ioctl. Add new ioctls for + TAGGED_QUEUE_ENABLE, DISABLE. Only allow IOCTL_SEND_COMMAND by + superuser. + + * sd.c: Only pay attention to UNIT_ATTENTION for removable disks. + Fix bug where sometimes portions of blocks would get lost + resulting in processes hanging. Add messages when we spin up a + disk, and fix a bug in the timing. Increase read-ahead for disks + that are on a scatter-gather capable host adapter. + + * seagate.c: Fix so that some parameters can be set from the lilo + prompt. Supply jumpstart flag if we are resetting and need the + command restarted. Fix so that we return 1 if we detect a card + so that multiple card detection works correctly. Add yet another + signature for FD cards (950). Add another signature for ST0x. + + * sg.c, sg.h: New files from Lawrence Foard for generic scsi + access. + + * sr.c: Add type casts for (void*) so that we can do pointer + arithmetic. Works with GCC without this, but it is not strictly + correct. Same bugfix as was in sd.c. Increase read-ahead a la + disk driver. + + * sr_ioctl.c: Use scsi_malloc buffer instead of buffer from stack + since we cannot guarantee that the stack is < 16Mb. + + ultrastor.c: Update to support 24f properly (JFC's driver). + + wd7000.c: Supply jumpstart flag for reset. Do not round up + number of cylinders in biosparam function. + +Sat Sep 4 20:49:56 1993 + + * 0.99pl13 released. + + * Throughout: Use check_region/snarf_region for all low-level + drivers. + + * aha1542.c: Do hard reset instead of soft (some ethercard probes + screw us up). + + * scsi.c: Add new flag ASKED_FOR_SENSE so that we can tell if we are + in a loop whereby the device returns null sense data. + + * sd.c: Add code to spin up a drive if it is not already spinning. + Do this one at a time to make it easier on power supplies. + + * sd_ioctl.c: Use sync_dev instead of fsync_dev in BLKFLSBUF ioctl. + + * seagate.c: Switch around DATA/CONTROL lines. + + * st.c: Change sense to unsigned. + +Thu Aug 5 11:59:18 1993 + + * 0.99pl12 released. + + * constants.c, constants.h: New files with ascii descriptions of + various conditions. + + * Makefile: Do not try to count the number of low-level drivers, + just generate the list of .o files. + + * aha1542.c: Replace 16 with sizeof(SCpnt->sense_buffer). Add tests + for addresses > 16Mb, panic if we find one. + + * aha1740.c: Ditto with sizeof(). + + * fdomain.c: Update to version 3.18. Add new signature, register IRQ + with irqaction. Use ID 7 for new board. Be more intelligent about + obtaining the h/s/c numbers for biosparam. + + * hosts.c: Do not depend upon Makefile generated count of the number + of low-level host adapters. + + * scsi.c: Use array for scsi_command_size instead of a function. Add + Texel cdrom and Maxtor XT-4380S to blacklist. Allow compile time + option for no-multi lun scan. Add semaphore for possible problems + with handshaking, assume device is faulty until we know it not to be + the case. Add DEBUG_INIT symbol to dump info as we scan for devices. + Zero sense buffer so we can tell if we need to request it. When + examining sense information, request sense if buffer is all zero. + If RESET, request sense information to see what to do next. + + * scsi_debug.c: Change some constants to use symbols like INT_MAX. + + * scsi_ioctl.c (kernel_scsi_ioctl): New function -for making ioctl + calls from kernel space. + + * sd.c: Increase timeout to 300. Use functions in constants.h to + display info. Use scsi_malloc buffer for READ_CAPACITY, since + we cannot guarantee that a stack based buffer is < 16Mb. + + * sd_ioctl.c: Add BLKFLSBUF ioctl. + + * seagate.c: Add new compile time options for ARBITRATE, + SLOW_HANDSHAKE, and SLOW_RATE. Update assembly loops for transferring + data. Use kernel_scsi_ioctl to request mode page with geometry. + + * sr.c: Use functions in constants.c to display messages. + + * st.c: Support for variable block size. + + * ultrastor.c: Do not use cache for tape drives. Set + unchecked_isa_dma flag, even though this may not be needed (gets set + later). + +Sat Jul 17 18:32:44 1993 + + * 0.99pl11 released. C++ compilable. + + * Throughout: Add type casts all over the place, and use "ip" instead + of "info" in the various biosparam functions. + + * Makefile: Compile seagate.c with C++ compiler. + + * aha1542.c: Always set ccb pointer as this gets trashed somehow on + some systems. Add a few type casts. Update biosparam function a little. + + * aha1740.c: Add a few type casts. + + * fdomain.c: Update to version 3.17 from 3.6. Now works with + TMC-18C50. + + * scsi.c: Minor changes here and there with datatypes. Save use_sg + when requesting sense information so that this can properly be + restored if we retry the command. Set aside dma buffers assuming each + block is 1 page, not 1Kb minix block. + + * scsi_ioctl.c: Add a few type casts. Other minor changes. + + * sd.c: Correctly free all scsi_malloc'd memory if we run out of + dma_pool. Store blocksize information for each partition. + + * seagate.c: Minor cleanups here and there. + + * sr.c: Set up blocksize array for all discs. Fix bug in freeing + buffers if we run out of dma pool. + +Thu Jun 2 17:58:11 1993 + + * 0.99pl10 released. + + * aha1542.c: Support for BT 445S (VL-bus board with no dma channel). + + * fdomain.c: Upgrade to version 3.6. Preliminary support for TNC-18C50. + + * scsi.c: First attempt to fix problem with old_use_sg. Change + NOT_READY to a SUGGEST_ABORT. Fix timeout race where time might + get decremented past zero. + + * sd.c: Add block_fsync function to dispatch table. + + * sr.c: Increase timeout to 500 from 250. Add entry for sync in + dispatch table (supply NULL). If we do not have a sectorsize, + try to get it in the sd_open function. Add new function just to + obtain sectorsize. + + * sr.h: Add needs_sector_size semaphore. + + * st.c: Add NULL for fsync in dispatch table. + + * wd7000.c: Allow another condition for power on that are normal + and do not require a panic. + +Thu Apr 22 23:10:11 1993 + + * 0.99pl9 released. + + * aha1542.c: Use (void) instead of () in setup_mailboxes. + + * scsi.c: Initialize transfersize and underflow fields in SCmd to 0. + Do not panic for unsupported message bytes. + + * scsi.h: Allocate 12 bytes instead of 10 for commands. Add + transfersize and underflow fields. + + * scsi_ioctl.c: Further bugfix to ioctl_probe. + + * sd.c: Use long instead of int for last parameter in sd_ioctl. + Initialize transfersize and underflow fields. + + * sd_ioctl.c: Ditto for sd_ioctl(,,,,); + + * seagate.c: New version from Drew. Includes new signatures for FD + cards. Support for 0ws jumper. Correctly initialize + scsi_hosts[hostnum].this_id. Improved handing of + disconnect/reconnect, and support command linking. Use + transfersize and underflow fields. Support scatter-gather. + + * sr.c, sr_ioctl.c: Use long instead of int for last parameter in sr_ioctl. + Use buffer and buflength in do_ioctl. Patches from Chris Newbold for + scsi-2 audio commands. + + * ultrastor.c: Comment out in_byte (compiler warning). + + * wd7000.c: Change () to (void) in wd7000_enable_dma. + +Wed Mar 31 16:36:25 1993 + + * 0.99pl8 released. + + * aha1542.c: Handle mailboxes better for 1542C. + Do not truncate number of cylinders at 1024 for biosparam call. + + * aha1740.c: Fix a few minor bugs for multiple devices. + Same as above for biosparam. + + * scsi.c: Add lockable semaphore for removable devices that can have + media removal prevented. Add another signature for flopticals. + (allocate_device): Fix race condition. Allow more space in dma pool + for blocksizes of up to 4Kb. + + * scsi.h: Define COMMAND_SIZE. Define a SCSI specific version of + INIT_REQUEST that can run with interrupts off. + + * scsi_ioctl.c: Make ioctl_probe function more idiot-proof. If + a removable device says ILLEGAL REQUEST to a door-locking command, + clear lockable flag. Add SCSI_IOCTL_GET_IDLUN ioctl. Do not attempt + to lock door for devices that do not have lockable semaphore set. + + * sd.c: Fix race condition for multiple disks. Use INIT_SCSI_REQUEST + instead of INIT_REQUEST. Allow sector sizes of 1024 and 256. For + removable disks that are not ready, mark them as having a media change + (some drives do not report this later). + + * seagate.c: Use volatile keyword for memory-mapped register pointers. + + * sr.c: Fix race condition, a la sd.c. Increase the number of retries + to 1. Use INIT_SCSI_REQUEST. Allow 512 byte sector sizes. Do a + read_capacity when we init the device so we know the size and + sectorsize. + + * st.c: If ioctl not found in st.c, try scsi_ioctl for others. + + * ultrastor.c: Do not truncate number of cylinders at 1024 for + biosparam call. + + * wd7000.c: Ditto. + Throughout: Use COMMAND_SIZE macro to determine length of scsi + command. + + + +Sat Mar 13 17:31:29 1993 + + * 0.99pl7 released. + + Throughout: Improve punctuation in some messages, and use new + verify_area syntax. + + * aha1542.c: Handle unexpected interrupts better. + + * scsi.c: Ditto. Handle reset conditions a bit better, asking for + sense information and retrying if required. + + * scsi_ioctl.c: Allow for 12 byte scsi commands. + + * ultrastor.c: Update to use scatter-gather. + +Sat Feb 20 17:57:15 1993 + + * 0.99pl6 released. + + * fdomain.c: Update to version 3.5. Handle spurious interrupts + better. + + * sd.c: Use register_blkdev function. + + * sr.c: Ditto. + + * st.c: Use register_chrdev function. + + * wd7000.c: Undo previous change. + +Sat Feb 6 11:20:43 1993 + + * 0.99pl5 released. + + * scsi.c: Fix bug in testing for UNIT_ATTENTION. + + * wd7000.c: Check at more addresses for bios. Fix bug in biosparam + (heads & sectors turned around). + +Wed Jan 20 18:13:59 1993 + + * 0.99pl4 released. + + * scsi.c: Ignore leading spaces when looking for blacklisted devices. + + * seagate.c: Add a few new signatures for FD cards. Another patch + with SCint to fix race condition. Use recursion_depth to keep track + of how many times we have been recursively called, and do not start + another command unless we are on the outer level. Fixes bug + with Syquest cartridge drives (used to crash kernel), because + they do not disconnect with large data transfers. + +Tue Jan 12 14:33:36 1993 + + * 0.99pl3 released. + + * fdomain.c: Update to version 3.3 (a few new signatures). + + * scsi.c: Add CDU-541, Denon DRD-25X to blacklist. + (allocate_request, request_queueable): Init request.waiting to NULL if + non-buffer type of request. + + * seagate.c: Allow controller to be overridden with CONTROLLER symbol. + Set SCint=NULL when we are done, to remove race condition. + + * st.c: Changes from Kai. + +Wed Dec 30 20:03:47 1992 + + * 0.99pl2 released. + + * scsi.c: Blacklist back in. Remove Newbury drive as other bugfix + eliminates need for it here. + + * sd.c: Return ENODEV instead of EACCES if no such device available. + (sd_init) Init blkdev_fops earlier so that sd_open is available sooner. + + * sr.c: Same as above for sd.c. + + * st.c: Return ENODEV instead of ENXIO if no device. Init chrdev_fops + sooner, so that it is always there even if no tapes. + + * seagate.c (controller_type): New variable to keep track of ST0x or + FD. Modify signatures list to indicate controller type, and init + controller_type once we find a match. + + * wd7000.c (wd7000_set_sync): Remove redundant function. + +Sun Dec 20 16:26:24 1992 + + * 0.99pl1 released. + + * scsi_ioctl.c: Bugfix - check dev->index, not dev->id against + NR_SCSI_DEVICES. + + * sr_ioctl.c: Verify that device exists before allowing an ioctl. + + * st.c: Patches from Kai - change timeout values, improve end of tape + handling. + +Sun Dec 13 18:15:23 1992 + + * 0.99 kernel released. Baseline for this ChangeLog. diff -Nru a/Documentation/scsi/scsi_mid_low_api.txt b/Documentation/scsi/scsi_mid_low_api.txt --- a/Documentation/scsi/scsi_mid_low_api.txt 2005-01-02 23:03:34 -08:00 +++ b/Documentation/scsi/scsi_mid_low_api.txt 2005-01-02 23:03:34 -08:00 @@ -363,8 +363,8 @@ Mid level supplied functions ============================ These functions are supplied by the SCSI mid level for use by LLDs. -The names (i.e. entry points) of these functions are exported (mainly in -scsi_syms.c) so an LLD that is a module can access them. The kernel will +The names (i.e. entry points) of these functions are exported +so an LLD that is a module can access them. The kernel will arrange for the SCSI mid level to be loaded and initialized before any LLD is initialized. The functions below are listed alphabetically and their names all start with "scsi_". diff -Nru a/Documentation/x86_64/mm.txt b/Documentation/x86_64/mm.txt --- a/Documentation/x86_64/mm.txt 2005-01-02 23:03:35 -08:00 +++ b/Documentation/x86_64/mm.txt 2005-01-02 23:03:35 -08:00 @@ -1,148 +1,24 @@ -The paging design used on the x86-64 linux kernel port in 2.4.x provides: -o per process virtual address space limit of 512 Gigabytes -o top of userspace stack located at address 0x0000007fffffffff -o PAGE_OFFSET = 0xffff800000000000 -o start of the kernel = 0xffffffff800000000 -o global RAM per system 2^64-PAGE_OFFSET-sizeof(kernel) = 128 Terabytes - 2 Gigabytes -o no need of any common code change -o no need to use highmem to handle the 128 Terabytes of RAM - -Description: - - Userspace is able to modify and it sees only the 3rd/2nd/1st level - pagetables (pgd_offset() implicitly walks the 1st slot of the 4th - level pagetable and it returns an entry into the 3rd level pagetable). - This is where the per-process 512 Gigabytes limit cames from. - - The common code pgd is the PDPE, the pmd is the PDE, the - pte is the PTE. The PML4E remains invisible to the common - code. - - The kernel uses all the first 47 bits of the negative half - of the virtual address space to build the direct mapping using - 2 Mbytes page size. The kernel virtual addresses have bit number - 47 always set to 1 (and in turn also bits 48-63 are set to 1 too, - due the sign extension). This is where the 128 Terabytes - 2 Gigabytes global - limit of RAM cames from. - - Since the per-process limit is 512 Gigabytes (due to kernel common - code 3 level pagetable limitation), the higher virtual address mapped - into userspace is 0x7fffffffff and it makes sense to use it - as the top of the userspace stack to allow the stack to grow as - much as possible. - - Setting the PAGE_OFFSET to 2^39 (after the last userspace - virtual address) wouldn't make much difference compared to - setting PAGE_OFFSET to 0xffff800000000000 because we have an - hole into the virtual address space. The last byte mapped by the - 255th slot in the 4th level pagetable is at virtual address - 0x00007fffffffffff and the first byte mapped by the 256th slot in the - 4th level pagetable is at address 0xffff800000000000. Due to this - hole we can't trivially build a direct mapping across all the - 512 slots of the 4th level pagetable, so we simply use only the - second (negative) half of the 4th level pagetable for that purpose - (that provides us 128 Terabytes of contigous virtual addresses). - Strictly speaking we could build a direct mapping also across the hole - using some DISCONTIGMEM trick, but we don't need such a large - direct mapping right now. - -Future: - - During 2.5.x we can break the 512 Gigabytes per-process limit - possibly by removing from the common code any knowledge about the - architectural dependent physical layout of the virtual to physical - mapping. - - Once the 512 Gigabytes limit will be removed the kernel stack will - be moved (most probably to virtual address 0x00007fffffffffff). - Nothing will break in userspace due that move, as nothing breaks - in IA32 compiling the kernel with CONFIG_2G. - -Linus agreed on not breaking common code and to live with the 512 Gigabytes -per-process limitation for the 2.4.x timeframe and he has given me and Andi -some very useful hints... (thanks! :) - -Thanks also to H. Peter Anvin for his interesting and useful suggestions on -the x86-64-discuss lists! - -Other memory management related issues follows: - -PAGE_SIZE: - - If somebody is wondering why these days we still have a so small - 4k pagesize (16 or 32 kbytes would be much better for performance - of course), the PAGE_SIZE have to remain 4k for 32bit apps to - provide 100% backwards compatible IA32 API (we can't allow silent - fs corruption or as best a loss of coherency with the page cache - by allocating MAP_SHARED areas in MAP_ANONYMOUS memory with a - do_mmap_fake). I think it could be possible to have a dynamic page - size between 32bit and 64bit apps but it would need extremely - intrusive changes in the common code as first for page cache and - we sure don't want to depend on them right now even if the - hardware would support that. - -PAGETABLE SIZE: - - In turn we can't afford to have pagetables larger than 4k because - we could not be able to allocate them due physical memory - fragmentation, and failing to allocate the kernel stack is a minor - issue compared to failing the allocation of a pagetable. If we - fail the allocation of a pagetable the only thing we can do is to - sched_yield polling the freelist (deadlock prone) or to segfault - the task (not even the sighandler would be sure to run). - -KERNEL STACK: - - 1st stage: - - The kernel stack will be at first allocated with an order 2 allocation - (16k) (the utilization of the stack for a 64bit platform really - isn't exactly the double of a 32bit platform because the local - variables may not be all 64bit wide, but not much less). This will - make things even worse than they are right now on IA32 with - respect of failing fork/clone due memory fragmentation. - - 2nd stage: - - We'll benchmark if reserving one register as task_struct - pointer will improve performance of the kernel (instead of - recalculating the task_struct pointer starting from the stack - pointer each time). My guess is that recalculating will be faster - but it worth a try. - - If reserving one register for the task_struct pointer - will be faster we can as well split task_struct and kernel - stack. task_struct can be a slab allocation or a - PAGE_SIZEd allocation, and the kernel stack can then be - allocated in a order 1 allocation. Really this is risky, - since 8k on a 64bit platform is going to be less than 7k - on a 32bit platform but we could try it out. This would - reduce the fragmentation problem of an order of magnitude - making it equal to the current IA32. - - We must also consider the x86-64 seems to provide in hardware a - per-irq stack that could allow us to remove the irq handler - footprint from the regular per-process-stack, so it could allow - us to live with a smaller kernel stack compared to the other - linux architectures. - - 3rd stage: - - Before going into production if we still have the order 2 - allocation we can add a sysctl that allows the kernel stack to be - allocated with vmalloc during memory fragmentation. This have to - remain turned off during benchmarks :) but it should be ok in real - life. - -Order of PAGE_CACHE_SIZE and other allocations: - - On the long run we can increase the PAGE_CACHE_SIZE to be - an order 2 allocations and also the slab/buffercache etc.ec.. - could be all done with order 2 allocations. To make the above - to work we should change lots of common code thus it can be done - only once the basic port will be in a production state. Having - a working PAGE_CACHE_SIZE would be a benefit also for - IA32 and other architectures of course. + -Andrea SuSE +Virtual memory map with 4 level page tables: + +0000000000000000 - 00007fffffffffff (=47bits) user space, different per mm +hole caused by [48:63] sign extension +ffff800000000000 - ffff80ffffffffff (=40bits) guard hole +ffff810000000000 - ffffc0ffffffffff (=46bits) direct mapping of phys. memory +ffffc10000000000 - ffffc1ffffffffff (=40bits) hole +ffffc20000000000 - ffffe1ffffffffff (=45bits) vmalloc/ioremap space +... unused hole ... +ffffffff80000000 - ffffffff82800000 (=40MB) kernel text mapping, from phys 0 +... unused hole ... +ffffffff88000000 - fffffffffff00000 (=1919MB) module mapping space + +vmalloc space is lazily synchronized into the different PML4 pages of +the processes using the page fault handler, with init_level4_pgt as +reference. + +Current X86-64 implementations only support 40 bit of address space, +but we support upto 46bits. This expands into MBZ space in the page tables. + +-Andi Kleen, Jul 2004 diff -Nru a/MAINTAINERS b/MAINTAINERS --- a/MAINTAINERS 2005-01-02 23:03:34 -08:00 +++ b/MAINTAINERS 2005-01-02 23:03:34 -08:00 @@ -1081,6 +1081,17 @@ L: linux-fbdev-devel@lists.sourceforge.net S: Maintained +INFINIBAND SUBSYSTEM +P: Roland Dreier +M: roland@topspin.com +P: Sean Hefty +M: mshefty@ichips.intel.com +P: Hal Rosenstock +M: halr@voltaire.com +L: openib-general@openib.org +W: http://www.openib.org/ +S: Supported + INPUT (KEYBOARD, MOUSE, JOYSTICK) DRIVERS P: Vojtech Pavlik M: vojtech@suse.cz @@ -1568,7 +1579,6 @@ M: wensong@linux-vs.org P: Julian Anastasov M: ja@ssi.bg -L: lvs-users@linuxvirtualserver.org S: Maintained NFS CLIENT diff -Nru a/arch/alpha/defconfig b/arch/alpha/defconfig --- a/arch/alpha/defconfig 2005-01-02 23:03:34 -08:00 +++ b/arch/alpha/defconfig 2005-01-02 23:03:34 -08:00 @@ -411,7 +411,6 @@ # CONFIG_IP_NF_TARGET_REDIRECT is not set # CONFIG_IP_NF_TARGET_NETMAP is not set # CONFIG_IP_NF_TARGET_SAME is not set -# CONFIG_IP_NF_NAT_LOCAL is not set # CONFIG_IP_NF_NAT_SNMP_BASIC is not set CONFIG_IP_NF_NAT_IRC=m CONFIG_IP_NF_NAT_FTP=m diff -Nru a/arch/arm/Kconfig b/arch/arm/Kconfig --- a/arch/arm/Kconfig 2005-01-02 23:03:34 -08:00 +++ b/arch/arm/Kconfig 2005-01-02 23:03:34 -08:00 @@ -609,7 +609,7 @@ system, but the driver will do nothing. config LEDS_TIMER - bool "Timer LED" if LEDS && (ARCH_NETWINDER || ARCH_EBSA285 || ARCH_SHARK || MACH_MAINSTONE || ARCH_CO285 || ARCH_SA1100 || ARCH_LUBBOCK || ARCH_PXA_IDP || ARCH_INTEGRATOR || ARCH_P720T || ARCH_VERSATILE || ARCH_IMX) + bool "Timer LED" if LEDS && (ARCH_NETWINDER || ARCH_EBSA285 || ARCH_SHARK || MACH_MAINSTONE || ARCH_CO285 || ARCH_SA1100 || ARCH_LUBBOCK || ARCH_PXA_IDP || ARCH_INTEGRATOR || ARCH_P720T || ARCH_VERSATILE || ARCH_IMX || MACH_OMAP_H2 || MACH_OMAP_PERSEUS2) depends on ARCH_NETWINDER || ARCH_EBSA110 || ARCH_EBSA285 || ARCH_SHARK || ARCH_CO285 || ARCH_SA1100 || ARCH_LUBBOCK || MACH_MAINSTONE || ARCH_PXA_IDP || ARCH_INTEGRATOR || ARCH_CDB89712 || ARCH_P720T || ARCH_OMAP || ARCH_VERSATILE || ARCH_IMX default y if ARCH_EBSA110 help @@ -625,7 +625,7 @@ config LEDS_CPU bool "CPU usage LED" - depends on LEDS && (ARCH_NETWINDER || ARCH_EBSA285 || ARCH_SHARK || ARCH_CO285 || ARCH_SA1100 || ARCH_LUBBOCK || MACH_MAINSTONE || ARCH_PXA_IDP || ARCH_INTEGRATOR || ARCH_P720T || ARCH_VERSATILE || ARCH_IMX) + depends on LEDS && (ARCH_NETWINDER || ARCH_EBSA285 || ARCH_SHARK || ARCH_CO285 || ARCH_SA1100 || ARCH_LUBBOCK || MACH_MAINSTONE || ARCH_PXA_IDP || ARCH_INTEGRATOR || ARCH_P720T || ARCH_VERSATILE || ARCH_IMX || MACH_OMAP_H2 || MACH_OMAP_PERSEUS2) help If you say Y here, the red LED will be used to give a good real time indication of CPU usage, by lighting whenever the idle task diff -Nru a/arch/arm/configs/ebsa110_defconfig b/arch/arm/configs/ebsa110_defconfig --- a/arch/arm/configs/ebsa110_defconfig 2005-01-02 23:03:33 -08:00 +++ b/arch/arm/configs/ebsa110_defconfig 2005-01-02 23:03:33 -08:00 @@ -239,7 +239,6 @@ CONFIG_IP_NF_TARGET_REDIRECT=y CONFIG_IP_NF_TARGET_NETMAP=y CONFIG_IP_NF_TARGET_SAME=y -# CONFIG_IP_NF_NAT_LOCAL is not set # CONFIG_IP_NF_NAT_SNMP_BASIC is not set CONFIG_IP_NF_NAT_IRC=y CONFIG_IP_NF_NAT_FTP=y diff -Nru a/arch/arm/configs/ixp4xx_defconfig b/arch/arm/configs/ixp4xx_defconfig --- a/arch/arm/configs/ixp4xx_defconfig 2005-01-02 23:03:33 -08:00 +++ b/arch/arm/configs/ixp4xx_defconfig 2005-01-02 23:03:33 -08:00 @@ -399,7 +399,6 @@ CONFIG_IP_NF_TARGET_REDIRECT=m # CONFIG_IP_NF_TARGET_NETMAP is not set # CONFIG_IP_NF_TARGET_SAME is not set -CONFIG_IP_NF_NAT_LOCAL=y CONFIG_IP_NF_NAT_SNMP_BASIC=m CONFIG_IP_NF_NAT_IRC=m CONFIG_IP_NF_NAT_FTP=m diff -Nru a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S --- a/arch/arm/kernel/entry-armv.S 2005-01-02 23:03:33 -08:00 +++ b/arch/arm/kernel/entry-armv.S 2005-01-02 23:03:33 -08:00 @@ -23,1000 +23,6 @@ #include "entry-header.S" -#ifdef IOC_BASE -/* IOC / IOMD based hardware */ -#include - - .equ ioc_base_high, IOC_BASE & 0xff000000 - .equ ioc_base_low, IOC_BASE & 0x00ff0000 - .macro disable_fiq - mov r12, #ioc_base_high - .if ioc_base_low - orr r12, r12, #ioc_base_low - .endif - strb r12, [r12, #0x38] @ Disable FIQ register - .endm - - .macro get_irqnr_and_base, irqnr, irqstat, base, tmp - mov r4, #ioc_base_high @ point at IOC - .if ioc_base_low - orr r4, r4, #ioc_base_low - .endif - ldrb \irqstat, [r4, #IOMD_IRQREQB] @ get high priority first - ldr \base, =irq_prio_h - teq \irqstat, #0 -#ifdef IOMD_BASE - ldreqb \irqstat, [r4, #IOMD_DMAREQ] @ get dma - addeq \base, \base, #256 @ irq_prio_h table size - teqeq \irqstat, #0 - bne 2406f -#endif - ldreqb \irqstat, [r4, #IOMD_IRQREQA] @ get low priority - addeq \base, \base, #256 @ irq_prio_d table size - teqeq \irqstat, #0 -#ifdef IOMD_IRQREQC - ldreqb \irqstat, [r4, #IOMD_IRQREQC] - addeq \base, \base, #256 @ irq_prio_l table size - teqeq \irqstat, #0 -#endif -#ifdef IOMD_IRQREQD - ldreqb \irqstat, [r4, #IOMD_IRQREQD] - addeq \base, \base, #256 @ irq_prio_lc table size - teqeq \irqstat, #0 -#endif -2406: ldrneb \irqnr, [\base, \irqstat] @ get IRQ number - .endm - -/* - * Interrupt table (incorporates priority). Please note that we - * rely on the order of these tables (see above code). - */ - .macro irq_prio_table -irq_prio_h: .byte 0, 8, 9, 8,10,10,10,10,11,11,11,11,10,10,10,10 - .byte 12, 8, 9, 8,10,10,10,10,11,11,11,11,10,10,10,10 - .byte 13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10 - .byte 13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10 - .byte 14,14,14,14,10,10,10,10,11,11,11,11,10,10,10,10 - .byte 14,14,14,14,10,10,10,10,11,11,11,11,10,10,10,10 - .byte 13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10 - .byte 13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10 - .byte 15,15,15,15,10,10,10,10,11,11,11,11,10,10,10,10 - .byte 15,15,15,15,10,10,10,10,11,11,11,11,10,10,10,10 - .byte 13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10 - .byte 13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10 - .byte 15,15,15,15,10,10,10,10,11,11,11,11,10,10,10,10 - .byte 15,15,15,15,10,10,10,10,11,11,11,11,10,10,10,10 - .byte 13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10 - .byte 13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10 -#ifdef IOMD_BASE -irq_prio_d: .byte 0,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16 - .byte 20,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16 - .byte 21,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16 - .byte 21,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16 - .byte 22,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16 - .byte 22,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16 - .byte 21,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16 - .byte 21,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16 - .byte 23,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16 - .byte 23,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16 - .byte 21,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16 - .byte 21,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16 - .byte 22,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16 - .byte 22,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16 - .byte 21,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16 - .byte 21,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16 -#endif -irq_prio_l: .byte 0, 0, 1, 0, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3 - .byte 4, 0, 1, 0, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3 - .byte 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 - .byte 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 - .byte 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3, 3, 3, 3 - .byte 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3, 3, 3, 3 - .byte 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 - .byte 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 - .byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 - .byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 - .byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 - .byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 - .byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 - .byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 - .byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 - .byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 -#ifdef IOMD_IRQREQC -irq_prio_lc: .byte 24,24,25,24,26,26,26,26,27,27,27,27,27,27,27,27 - .byte 28,24,25,24,26,26,26,26,27,27,27,27,27,27,27,27 - .byte 29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29 - .byte 29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29 - .byte 30,30,30,30,30,30,30,30,27,27,27,27,27,27,27,27 - .byte 30,30,30,30,30,30,30,30,27,27,27,27,27,27,27,27 - .byte 29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29 - .byte 29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29 - .byte 31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31 - .byte 31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31 - .byte 31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31 - .byte 31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31 - .byte 31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31 - .byte 31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31 - .byte 31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31 - .byte 31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31 -#endif -#ifdef IOMD_IRQREQD -irq_prio_ld: .byte 40,40,41,40,42,42,42,42,43,43,43,43,43,43,43,43 - .byte 44,40,41,40,42,42,42,42,43,43,43,43,43,43,43,43 - .byte 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45 - .byte 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45 - .byte 46,46,46,46,46,46,46,46,43,43,43,43,43,43,43,43 - .byte 46,46,46,46,46,46,46,46,43,43,43,43,43,43,43,43 - .byte 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45 - .byte 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45 - .byte 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47 - .byte 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47 - .byte 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47 - .byte 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47 - .byte 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47 - .byte 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47 - .byte 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47 - .byte 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47 -#endif - .endm - -#elif defined(CONFIG_ARCH_EBSA110) - -#define IRQ_STAT 0xff000000 /* read */ - - .macro disable_fiq - .endm - - .macro get_irqnr_and_base, irqnr, stat, base, tmp - mov \base, #IRQ_STAT - ldrb \stat, [\base] @ get interrupts - mov \irqnr, #0 - tst \stat, #15 - addeq \irqnr, \irqnr, #4 - moveq \stat, \stat, lsr #4 - tst \stat, #3 - addeq \irqnr, \irqnr, #2 - moveq \stat, \stat, lsr #2 - tst \stat, #1 - addeq \irqnr, \irqnr, #1 - moveq \stat, \stat, lsr #1 - tst \stat, #1 @ bit 0 should be set - .endm - - .macro irq_prio_table - .endm - -#elif defined(CONFIG_ARCH_SHARK) - - .macro disable_fiq - .endm - - .macro get_irqnr_and_base, irqnr, irqstat, base, tmp - mov r4, #0xe0000000 - - mov \irqstat, #0x0C - strb \irqstat, [r4, #0x20] @outb(0x0C, 0x20) /* Poll command */ - ldrb \irqnr, [r4, #0x20] @irq = inb(0x20) & 7 - and \irqstat, \irqnr, #0x80 - teq \irqstat, #0 - beq 43f - and \irqnr, \irqnr, #7 - teq \irqnr, #2 - bne 44f -43: mov \irqstat, #0x0C - strb \irqstat, [r4, #0xa0] @outb(0x0C, 0xA0) /* Poll command */ - ldrb \irqnr, [r4, #0xa0] @irq = (inb(0xA0) & 7) + 8 - and \irqstat, \irqnr, #0x80 - teq \irqstat, #0 - beq 44f - and \irqnr, \irqnr, #7 - add \irqnr, \irqnr, #8 -44: teq \irqstat, #0 - .endm - - .macro irq_prio_table - .endm - -#elif defined(CONFIG_FOOTBRIDGE) -#include - - .macro disable_fiq - .endm - - .equ dc21285_high, ARMCSR_BASE & 0xff000000 - .equ dc21285_low, ARMCSR_BASE & 0x00ffffff - - .macro get_irqnr_and_base, irqnr, irqstat, base, tmp - mov r4, #dc21285_high - .if dc21285_low - orr r4, r4, #dc21285_low - .endif - ldr \irqstat, [r4, #0x180] @ get interrupts - - mov \irqnr, #IRQ_SDRAMPARITY - tst \irqstat, #IRQ_MASK_SDRAMPARITY - bne 1001f - - tst \irqstat, #IRQ_MASK_UART_RX - movne \irqnr, #IRQ_CONRX - bne 1001f - - tst \irqstat, #IRQ_MASK_DMA1 - movne \irqnr, #IRQ_DMA1 - bne 1001f - - tst \irqstat, #IRQ_MASK_DMA2 - movne \irqnr, #IRQ_DMA2 - bne 1001f - - tst \irqstat, #IRQ_MASK_IN0 - movne \irqnr, #IRQ_IN0 - bne 1001f - - tst \irqstat, #IRQ_MASK_IN1 - movne \irqnr, #IRQ_IN1 - bne 1001f - - tst \irqstat, #IRQ_MASK_IN2 - movne \irqnr, #IRQ_IN2 - bne 1001f - - tst \irqstat, #IRQ_MASK_IN3 - movne \irqnr, #IRQ_IN3 - bne 1001f - - tst \irqstat, #IRQ_MASK_PCI - movne \irqnr, #IRQ_PCI - bne 1001f - - tst \irqstat, #IRQ_MASK_DOORBELLHOST - movne \irqnr, #IRQ_DOORBELLHOST - bne 1001f - - tst \irqstat, #IRQ_MASK_I2OINPOST - movne \irqnr, #IRQ_I2OINPOST - bne 1001f - - tst \irqstat, #IRQ_MASK_TIMER1 - movne \irqnr, #IRQ_TIMER1 - bne 1001f - - tst \irqstat, #IRQ_MASK_TIMER2 - movne \irqnr, #IRQ_TIMER2 - bne 1001f - - tst \irqstat, #IRQ_MASK_TIMER3 - movne \irqnr, #IRQ_TIMER3 - bne 1001f - - tst \irqstat, #IRQ_MASK_UART_TX - movne \irqnr, #IRQ_CONTX - bne 1001f - - tst \irqstat, #IRQ_MASK_PCI_ABORT - movne \irqnr, #IRQ_PCI_ABORT - bne 1001f - - tst \irqstat, #IRQ_MASK_PCI_SERR - movne \irqnr, #IRQ_PCI_SERR - bne 1001f - - tst \irqstat, #IRQ_MASK_DISCARD_TIMER - movne \irqnr, #IRQ_DISCARD_TIMER - bne 1001f - - tst \irqstat, #IRQ_MASK_PCI_DPERR - movne \irqnr, #IRQ_PCI_DPERR - bne 1001f - - tst \irqstat, #IRQ_MASK_PCI_PERR - movne \irqnr, #IRQ_PCI_PERR -1001: - .endm - - .macro irq_prio_table - .endm - -#elif defined(CONFIG_ARCH_NEXUSPCI) - - .macro disable_fiq - .endm - - .macro get_irqnr_and_base, irqnr, irqstat, base, tmp - ldr \irqstat, =INTCONT_BASE - ldr \base, =soft_irq_mask - ldr \irqstat, [\irqstat] @ get interrupts - ldr \base, [\base] - mov \irqnr, #0 - and \irqstat, \irqstat, \base @ mask out disabled ones -1001: tst \irqstat, #1 - addeq \irqnr, \irqnr, #1 - moveq \irqstat, \irqstat, lsr #1 - tsteq \irqnr, #32 - beq 1001b - teq \irqnr, #32 - .endm - - .macro irq_prio_table - .ltorg - .bss -ENTRY(soft_irq_mask) - .word 0 - .text - .endm - -#elif defined(CONFIG_ARCH_TBOX) - - .macro disable_fiq - .endm - - .macro get_irqnr_and_base, irqnr, irqstat, base, tmp - ldr \irqstat, =0xffff7000 - ldr \irqstat, [\irqstat] @ get interrupts - ldr \base, =soft_irq_mask - ldr \base, [\base] - mov \irqnr, #0 - and \irqstat, \irqstat, \base @ mask out disabled ones -1001: tst \irqstat, #1 - addeq \irqnr, \irqnr, #1 - moveq \irqstat, \irqstat, lsr #1 - tsteq \irqnr, #32 - beq 1001b - teq \irqnr, #32 - .endm - - .macro irq_prio_table - .ltorg - .bss -ENTRY(soft_irq_mask) - .word 0 - .text - .endm - -#elif defined(CONFIG_ARCH_SA1100) - - .macro disable_fiq - .endm - - .macro get_irqnr_and_base, irqnr, irqstat, base, tmp - mov r4, #0xfa000000 @ ICIP = 0xfa050000 - add r4, r4, #0x00050000 - ldr \irqstat, [r4] @ get irqs - ldr \irqnr, [r4, #4] @ ICMR = 0xfa050004 - ands \irqstat, \irqstat, \irqnr - mov \irqnr, #0 - beq 1001f - tst \irqstat, #0xff - moveq \irqstat, \irqstat, lsr #8 - addeq \irqnr, \irqnr, #8 - tsteq \irqstat, #0xff - moveq \irqstat, \irqstat, lsr #8 - addeq \irqnr, \irqnr, #8 - tsteq \irqstat, #0xff - moveq \irqstat, \irqstat, lsr #8 - addeq \irqnr, \irqnr, #8 - tst \irqstat, #0x0f - moveq \irqstat, \irqstat, lsr #4 - addeq \irqnr, \irqnr, #4 - tst \irqstat, #0x03 - moveq \irqstat, \irqstat, lsr #2 - addeq \irqnr, \irqnr, #2 - tst \irqstat, #0x01 - addeqs \irqnr, \irqnr, #1 -1001: - .endm - - .macro irq_prio_table - .endm - -#elif defined(CONFIG_ARCH_L7200) -#include - - .equ irq_base_addr, IO_BASE_2 - - .macro disable_fiq - .endm - - .macro get_irqnr_and_base, irqnr, irqstat, base, tmp - mov \irqstat, #irq_base_addr @ Virt addr IRQ regs - add \irqstat, \irqstat, #0x00001000 @ Status reg - ldr \irqstat, [\irqstat, #0] @ get interrupts - mov \irqnr, #0 -1001: tst \irqstat, #1 - addeq \irqnr, \irqnr, #1 - moveq \irqstat, \irqstat, lsr #1 - tsteq \irqnr, #32 - beq 1001b - teq \irqnr, #32 - .endm - - .macro irq_prio_table - .endm - -#elif defined(CONFIG_ARCH_INTEGRATOR) - - .macro disable_fiq - .endm - - .macro get_irqnr_and_base, irqnr, irqstat, base, tmp -/* FIXME: should not be using soo many LDRs here */ - ldr \base, =IO_ADDRESS(INTEGRATOR_IC_BASE) - mov \irqnr, #IRQ_PIC_START - ldr \irqstat, [\base, #IRQ_STATUS] @ get masked status - ldr \base, =IO_ADDRESS(INTEGRATOR_HDR_BASE) - teq \irqstat, #0 - ldreq \irqstat, [\base, #(INTEGRATOR_HDR_IC_OFFSET+IRQ_STATUS)] - moveq \irqnr, #IRQ_CIC_START - -1001: tst \irqstat, #15 - bne 1002f - add \irqnr, \irqnr, #4 - movs \irqstat, \irqstat, lsr #4 - bne 1001b -1002: tst \irqstat, #1 - bne 1003f - add \irqnr, \irqnr, #1 - movs \irqstat, \irqstat, lsr #1 - bne 1002b -1003: /* EQ will be set if no irqs pending */ - .endm - - .macro irq_prio_table - .endm - -#elif defined(CONFIG_ARCH_VERSATILE) - - .macro disable_fiq - .endm - - .macro get_irqnr_and_base, irqnr, irqstat, base, tmp - ldr \base, =IO_ADDRESS(VERSATILE_VIC_BASE) - ldr \irqstat, [\base, #VIC_IRQ_STATUS] @ get masked status - mov \irqnr, #0 - teq \irqstat, #0 - beq 1003f - -1001: tst \irqstat, #15 - bne 1002f - add \irqnr, \irqnr, #4 - movs \irqstat, \irqstat, lsr #4 - bne 1001b -1002: tst \irqstat, #1 - bne 1003f - add \irqnr, \irqnr, #1 - movs \irqstat, \irqstat, lsr #1 - bne 1002b -1003: /* EQ will be set if no irqs pending */ - -@ clz \irqnr, \irqstat -@1003: /* EQ will be set if we reach MAXIRQNUM */ - .endm - - .macro irq_prio_table - .endm - -#elif defined(CONFIG_ARCH_CLPS711X) - -#include - - .macro disable_fiq - .endm - -#if (INTSR2 - INTSR1) != (INTMR2 - INTMR1) -#error INTSR stride != INTMR stride -#endif - - .macro get_irqnr_and_base, irqnr, stat, base, mask - mov \base, #CLPS7111_BASE - ldr \stat, [\base, #INTSR1] - ldr \mask, [\base, #INTMR1] - mov \irqnr, #4 - mov \mask, \mask, lsl #16 - and \stat, \stat, \mask, lsr #16 - movs \stat, \stat, lsr #4 - bne 1001f - - add \base, \base, #INTSR2 - INTSR1 - ldr \stat, [\base, #INTSR1] - ldr \mask, [\base, #INTMR1] - mov \irqnr, #16 - mov \mask, \mask, lsl #16 - and \stat, \stat, \mask, lsr #16 - -1001: tst \stat, #255 - addeq \irqnr, \irqnr, #8 - moveq \stat, \stat, lsr #8 - tst \stat, #15 - addeq \irqnr, \irqnr, #4 - moveq \stat, \stat, lsr #4 - tst \stat, #3 - addeq \irqnr, \irqnr, #2 - moveq \stat, \stat, lsr #2 - tst \stat, #1 - addeq \irqnr, \irqnr, #1 - moveq \stat, \stat, lsr #1 - tst \stat, #1 @ bit 0 should be set - .endm - - .macro irq_prio_table - .endm - -#elif defined (CONFIG_ARCH_CAMELOT) -#include -#undef IRQ_MODE /* same name defined in asm/proc/ptrace.h */ -#include - - .macro disable_fiq - .endm - - .macro get_irqnr_and_base, irqnr, irqstat, base, tmp - - ldr \irqstat, =INT_ID(IO_ADDRESS(EXC_INT_CTRL00_BASE)) - ldr \irqnr,[\irqstat] - cmp \irqnr,#0 - subne \irqnr,\irqnr,#1 - - - .endm - - .macro irq_prio_table - .endm - -#elif defined(CONFIG_ARCH_IOP321) - .macro disable_fiq - .endm - - /* - * Note: only deal with normal interrupts, not FIQ - */ - .macro get_irqnr_and_base, irqnr, irqstat, base, tmp - mov \irqnr, #0 - mrc p6, 0, \irqstat, c8, c0, 0 @ Read IINTSRC - cmp \irqstat, #0 - beq 1001f - clz \irqnr, \irqstat - mov \base, #31 - subs \irqnr,\base,\irqnr - add \irqnr,\irqnr,#IRQ_IOP321_DMA0_EOT -1001: - .endm - - .macro irq_prio_table - .endm - -#elif defined(CONFIG_ARCH_IOP331) - .macro disable_fiq - .endm - - /* - * Note: only deal with normal interrupts, not FIQ - */ - .macro get_irqnr_and_base, irqnr, irqstat, base, tmp - mov \irqnr, #0 - mrc p6, 0, \irqstat, c4, c0, 0 @ Read IINTSRC0 - cmp \irqstat, #0 - bne 1002f - mrc p6, 0, \irqstat, c5, c0, 0 @ Read IINTSRC1 - cmp \irqstat, #0 - beq 1001f - clz \irqnr, \irqstat -/* - * mov \base, #31 - * subs \irqnr,\base,\irqnr - */ - rsbs \irqnr,\irqnr,#31 @ recommend by RMK - add \irqnr,\irqnr,#IRQ_IOP331_XINT8 - b 1001f -1002: clz \irqnr, \irqstat - mov \base, #31 - subs \irqnr,\base,\irqnr - add \irqnr,\irqnr,#IRQ_IOP331_DMA0_EOT -1001: - .endm - - .macro irq_prio_table - .endm - -#elif defined(CONFIG_ARCH_PXA) - - .macro disable_fiq - .endm - - .macro get_irqnr_and_base, irqnr, irqstat, base, tmp -#ifdef CONFIG_PXA27x - mrc p6, 0, \irqstat, c0, c0, 0 @ ICIP - mrc p6, 0, \irqnr, c1, c0, 0 @ ICMR -#else - mov \base, #io_p2v(0x40000000) @ IIR Ctl = 0x40d00000 - add \base, \base, #0x00d00000 - ldr \irqstat, [\base, #0] @ ICIP - ldr \irqnr, [\base, #4] @ ICMR -#endif - ands \irqnr, \irqstat, \irqnr - beq 1001f - rsb \irqstat, \irqnr, #0 - and \irqstat, \irqstat, \irqnr - clz \irqnr, \irqstat - rsb \irqnr, \irqnr, #(31 - PXA_IRQ_SKIP) -1001: - .endm - - .macro irq_prio_table - .endm - -#elif defined(CONFIG_ARCH_IXP2000) - - .macro disable_fiq - .endm - - .macro get_irqnr_and_base, irqnr, irqstat, base, tmp - - mov \irqnr, #0x0 @clear out irqnr as default - mov \base, #0xfe000000 - orr \base, \base, #0x00ff0000 - orr \base, \base, #0x0000a000 - orr \base, \base, #0x08 - ldr \irqstat, [\base] @ get interrupts - mov \tmp, #IXP2000_VALID_IRQ_MASK & 0xff000000 - orr \tmp, \tmp, #IXP2000_VALID_IRQ_MASK & 0x00ff0000 - orr \tmp, \tmp, #IXP2000_VALID_IRQ_MASK & 0x0000ff00 - orr \tmp, \tmp, #IXP2000_VALID_IRQ_MASK & 0x000000ff - and \irqstat, \irqstat, \tmp - - cmp \irqstat, #0 - beq 1001f - - clz \irqnr, \irqstat - mov \base, #31 - subs \irqnr, \base, \irqnr - - /* - * We handle PCIA and PCIB here so we don't have an - * extra layer of code just to check these two bits. - */ - cmp \irqnr, #IRQ_IXP2000_PCI - bne 1001f - - mov \base, #0xfe000000 - orr \base, \base, #0x00fd0000 - orr \base, \base, #0x0000e100 - orr \base, \base, #0x00000058 - ldr \irqstat, [\base] - - mov \tmp, #(1<<26) - tst \irqstat, \tmp - movne \irqnr, #IRQ_IXP2000_PCIA - bne 1001f - - mov \tmp, #(1<<27) - tst \irqstat, \tmp - movne \irqnr, #IRQ_IXP2000_PCIB - -1001: - .endm - - .macro irq_prio_table - .endm - -#elif defined (CONFIG_ARCH_IXP4XX) - - .macro disable_fiq - .endm - - .macro get_irqnr_and_base, irqnr, irqstat, base, tmp - ldr \irqstat, =(IXP4XX_INTC_BASE_VIRT+IXP4XX_ICIP_OFFSET) - ldr \irqstat, [\irqstat] @ get interrupts - cmp \irqstat, #0 - beq 1002f - clz \irqnr, \irqstat - mov \base, #31 - subs \irqnr, \base, \irqnr - -/* -1001: tst \irqstat, #1 - addeq \irqnr, \irqnr, #1 - moveq \irqstat, \irqstat, lsr #1 - tsteq \irqnr, #32 - beq 1001b - teq \irqnr, #32 -*/ -1002: - .endm - - .macro irq_prio_table - .endm - -#elif defined(CONFIG_ARCH_OMAP) - - .macro disable_fiq - .endm - - .macro get_irqnr_and_base, irqnr, irqstat, base, tmp - ldr \base, =IO_ADDRESS(OMAP_IH1_BASE) - ldr \irqnr, [\base, #IRQ_ITR_REG_OFFSET] - ldr \tmp, [\base, #IRQ_MIR_REG_OFFSET] - mov \irqstat, #0xffffffff - bic \tmp, \irqstat, \tmp - tst \irqnr, \tmp - beq 1510f - - ldr \irqnr, [\base, #IRQ_SIR_FIQ_REG_OFFSET] - cmp \irqnr, #0 - ldreq \irqnr, [\base, #IRQ_SIR_IRQ_REG_OFFSET] - cmpeq \irqnr, #INT_IH2_IRQ - ldreq \base, =IO_ADDRESS(OMAP_IH2_BASE) - ldreq \irqnr, [\base, #IRQ_SIR_IRQ_REG_OFFSET] - addeqs \irqnr, \irqnr, #32 -1510: - .endm - - .macro irq_prio_table - .endm - -#elif defined(CONFIG_ARCH_S3C2410) - /* S3C2410X IRQ Handler, */ - - .macro get_irqnr_and_base, irqnr, irqstat, base, tmp - -30000: - mov \tmp, #S3C2410_VA_IRQ - ldr \irqnr, [ \tmp, #0x14 ] @ get irq no - teq \irqnr, #4 - teqne \irqnr, #5 - beq 1002f @ external irq reg - teq \irqnr, #16 - beq 1003f @ lcd controller - - @ debug check to see if interrupt reported is the same - @ as the offset.... - - teq \irqnr, #0 - beq 20002f - ldr \irqstat, [ \tmp, #0x10 ] @ INTPND - mov \irqstat, \irqstat, lsr \irqnr - tst \irqstat, #1 - bne 20002f - -#if 1 - stmfd r13!, { r0 - r4 , r14 } - ldr r1, [ \tmp, #0x14 ] @ intoffset - ldr r2, [ \tmp, #0x10 ] @ INTPND - ldr r3, [ \tmp, #0x00 ] @ SRCPND - adr r0, 20003f - bl printk - b 20004f -#endif -20003: - .ascii "<7>irq: err - bad offset %d, intpnd=%08x, srcpnd=%08x\n" - .byte 0 - .align 4 -20004: - mov r1, #1 - mov \tmp, #S3C2410_VA_IRQ - ldmfd r13!, { r0 - r4 , r14 } - - @ try working out interript number for ourselves - mov \irqnr, #0 - ldr \irqstat, [ \tmp, #0x10 ] @ INTPND -10021: - movs \irqstat, \irqstat, lsr#1 - bcs 30000b @ try and re-start the proccess - add \irqnr, \irqnr, #1 - cmp \irqnr, #32 - ble 10021b - - @ found no interrupt, set Z flag and leave - movs \irqnr, #0 - b 1001f - -20005: -20002: @ exit - @ we base the s3c2410x interrupts at 16 and above to allow - @ isa peripherals to have their standard interrupts, also - @ ensure that Z flag is un-set on exit - - @ note, we cannot be sure if we get IRQ_EINT0 (0) that - @ there is simply no interrupt pending, so in all other - @ cases we jump to say we have found something, otherwise - @ we check to see if the interrupt really is assrted - adds \irqnr, \irqnr, #IRQ_EINT0 - teq \irqnr, #IRQ_EINT0 - bne 1001f @ exit - ldr \irqstat, [ \tmp, #0x10 ] @ INTPND - teq \irqstat, #0 - moveq \irqnr, #0 - b 1001f - - @ we get here from no main or external interrupts pending -1002: - add \tmp, \tmp, #S3C2410_VA_GPIO - S3C2410_VA_IRQ - ldr \irqstat, [ \tmp, # 0xa8 ] @ EXTINTPEND - ldr \irqnr, [ \tmp, # 0xa4 ] @ EXTINTMASK - - bic \irqstat, \irqstat, \irqnr @ clear masked irqs - - mov \irqnr, #IRQ_EINT4 @ start extint nos - mov \irqstat, \irqstat, lsr#4 @ ignore bottom 4 bits -10021: - movs \irqstat, \irqstat, lsr#1 - bcs 1004f - add \irqnr, \irqnr, #1 - cmp \irqnr, #IRQ_EINT23 - ble 10021b - - @ found no interrupt, set Z flag and leave - movs \irqnr, #0 - b 1001f - -1003: - @ lcd interrupt has been asserted... - add \tmp, \tmp, #S3C2410_VA_LCD - S3C2410_VA_IRQ - ldr \irqstat, [ \tmp, # 0x54 ] @ lcd int pending - - tst \irqstat, #2 - movne \irqnr, #IRQ_LCD_FRAME - tst \irqstat, #1 - movne \irqnr, #IRQ_LCD_FIFO - - @ fall through to exit with flags updated - -1004: @ ensure Z flag clear in case our MOVS shifted out the last bit - teq \irqnr, #0 -1001: - @ exit irq routine - .endm - - - /* currently don't need an disable_fiq macro */ - - .macro disable_fiq - .endm - - /* we don't have an irq priority table */ - .macro irq_prio_table - .endm - -#elif defined(CONFIG_ARCH_LH7A400) - -# if defined (CONFIG_ARCH_LH7A404) -# error "LH7A400 and LH7A404 are mutually exclusive" -# endif - .macro disable_fiq - .endm - - .macro get_irqnr_and_base, irqnr, irqstat, base, tmp - mov \irqnr, #0 - mov \base, #io_p2v(0x80000000) @ APB registers - ldr \irqstat, [\base, #0x500] @ PIC INTSR - -1001: movs \irqstat, \irqstat, lsr #1 @ Shift into carry - bcs 1008f @ Bit set; irq found - add \irqnr, \irqnr, #1 - bne 1001b @ Until no bits - b 1009f @ Nothing? Hmm. -1008: movs \irqstat, #1 @ Force !Z -1009: - .endm - - .macro irq_prio_table - .endm - -#elif defined(CONFIG_ARCH_LH7A404) - - .macro disable_fiq - .endm - - .macro get_irqnr_and_base, irqnr, irqstat, base, tmp - mov \irqnr, #0 @ VIC1 irq base - mov \base, #io_p2v(0x80000000) @ APB registers - add \base, \base, #0x8000 - ldr \tmp, [\base, #0x0030] @ VIC1_VECTADDR - tst \tmp, #VA_VECTORED @ Direct vectored - bne 1002f - tst \tmp, #VA_VIC1DEFAULT @ Default vectored VIC1 - ldrne \irqstat, [\base, #0] @ VIC1_IRQSTATUS - bne 1001f - add \base, \base, #(0xa000 - 0x8000) - ldr \tmp, [\base, #0x0030] @ VIC2_VECTADDR - tst \tmp, #VA_VECTORED @ Direct vectored - bne 1002f - ldr \irqstat, [\base, #0] @ VIC2_IRQSTATUS - mov \irqnr, #32 @ VIC2 irq base - -1001: movs \irqstat, \irqstat, lsr #1 @ Shift into carry - bcs 1008f @ Bit set; irq found - add \irqnr, \irqnr, #1 - bne 1001b @ Until no bits - b 1009f @ Nothing? Hmm. -1002: and \irqnr, \tmp, #0x3f @ Mask for valid bits -1008: movs \irqstat, #1 @ Force !Z - str \tmp, [\base, #0x0030] @ Clear vector -1009: - .endm - - .macro irq_prio_table - .endm - -#elif defined(CONFIG_ARCH_IMX) - - .macro disable_fiq - .endm -#define AITC_NIVECSR 0x40 - .macro get_irqnr_and_base, irqnr, irqstat, base, tmp - ldr \irqstat, =IO_ADDRESS(IMX_AITC_BASE) - @ Load offset & priority of the highest priority - @ interrupt pending. - ldr \irqnr, [\irqstat, #AITC_NIVECSR] - @ Shift off the priority leaving the offset or - @ "interrupt number" - mov \irqnr, \irqnr, lsr #16 - ldr \irqstat, =1 @ dummy compare - ldr \base, =0xFFFF // invalid interrupt - cmp \irqnr, \base - bne 1001f - ldr \irqstat, =0 -1001: - tst \irqstat, #1 @ to make the condition code = TRUE - .endm - - .macro irq_prio_table - .endm - -#elif defined(CONFIG_ARCH_H720X) - - .macro disable_fiq - .endm - - .macro get_irqnr_and_base, irqnr, irqstat, base, tmp -#if defined (CONFIG_CPU_H7201) || defined (CONFIG_CPU_H7202) - @ we could use the id register on H7202, but this is not - @ properly updated when we come back from asm_do_irq - @ without a previous return from interrupt - @ (see loops below in irq_svc, irq_usr) - @ We see unmasked pending ints only, as the masked pending ints - @ are not visible here - - mov \base, #0xf0000000 @ base register - orr \base, \base, #0x24000 @ irqbase - ldr \irqstat, [\base, #0x04] @ get interrupt status -#if defined (CONFIG_CPU_H7201) - ldr \tmp, =0x001fffff -#else - mvn \tmp, #0xc0000000 -#endif - and \irqstat, \irqstat, \tmp @ mask out unused ints - mov \irqnr, #0 - - mov \tmp, #0xff00 - orr \tmp, \tmp, #0xff - tst \irqstat, \tmp - addeq \irqnr, \irqnr, #16 - moveq \irqstat, \irqstat, lsr #16 - tst \irqstat, #255 - addeq \irqnr, \irqnr, #8 - moveq \irqstat, \irqstat, lsr #8 - tst \irqstat, #15 - addeq \irqnr, \irqnr, #4 - moveq \irqstat, \irqstat, lsr #4 - tst \irqstat, #3 - addeq \irqnr, \irqnr, #2 - moveq \irqstat, \irqstat, lsr #2 - tst \irqstat, #1 - addeq \irqnr, \irqnr, #1 - moveq \irqstat, \irqstat, lsr #1 - tst \irqstat, #1 @ bit 0 should be set - .endm - - .macro irq_prio_table - .endm - -#else -#error hynix processor selection missmatch -#endif -#else -#error Unknown architecture -#endif - /* * Invalid mode handlers */ @@ -1195,8 +201,6 @@ #ifdef CONFIG_PREEMPT .LCirq_stat: .word irq_stat #endif - - irq_prio_table /* * User mode handlers diff -Nru a/arch/arm/kernel/entry-header.S b/arch/arm/kernel/entry-header.S --- a/arch/arm/kernel/entry-header.S 2005-01-02 23:03:34 -08:00 +++ b/arch/arm/kernel/entry-header.S 2005-01-02 23:03:34 -08:00 @@ -6,6 +6,7 @@ #include #include #include +#include #ifndef MODE_SVC #define MODE_SVC 0x13 diff -Nru a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c --- a/arch/arm/mach-integrator/integrator_ap.c 2005-01-02 23:03:34 -08:00 +++ b/arch/arm/mach-integrator/integrator_ap.c 2005-01-02 23:03:34 -08:00 @@ -68,7 +68,6 @@ * f1200000 12000000 EBI registers * f1300000 13000000 Counter/Timer * f1400000 14000000 Interrupt controller - * f1500000 15000000 RTC * f1600000 16000000 UART 0 * f1700000 17000000 UART 1 * f1a00000 1a000000 Debug LEDs @@ -81,7 +80,6 @@ { IO_ADDRESS(INTEGRATOR_EBI_BASE), INTEGRATOR_EBI_BASE, SZ_4K, MT_DEVICE }, { IO_ADDRESS(INTEGRATOR_CT_BASE), INTEGRATOR_CT_BASE, SZ_4K, MT_DEVICE }, { IO_ADDRESS(INTEGRATOR_IC_BASE), INTEGRATOR_IC_BASE, SZ_4K, MT_DEVICE }, - { IO_ADDRESS(INTEGRATOR_RTC_BASE), INTEGRATOR_RTC_BASE, SZ_4K, MT_DEVICE }, { IO_ADDRESS(INTEGRATOR_UART0_BASE), INTEGRATOR_UART0_BASE, SZ_4K, MT_DEVICE }, { IO_ADDRESS(INTEGRATOR_UART1_BASE), INTEGRATOR_UART1_BASE, SZ_4K, MT_DEVICE }, { IO_ADDRESS(INTEGRATOR_DBG_BASE), INTEGRATOR_DBG_BASE, SZ_4K, MT_DEVICE }, diff -Nru a/arch/arm/mach-integrator/time.c b/arch/arm/mach-integrator/time.c --- a/arch/arm/mach-integrator/time.c 2005-01-02 23:03:34 -08:00 +++ b/arch/arm/mach-integrator/time.c 2005-01-02 23:03:34 -08:00 @@ -1,46 +1,211 @@ /* * linux/arch/arm/mach-integrator/time.c * - * Copyright (C) 2000-2001 Deep Blue Solutions + * Copyright (C) 2000-2001 Deep Blue Solutions Ltd. * * 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 +#include -#define RTC_DR (IO_ADDRESS(INTEGRATOR_RTC_BASE) + 0) -#define RTC_MR (IO_ADDRESS(INTEGRATOR_RTC_BASE) + 4) -#define RTC_STAT (IO_ADDRESS(INTEGRATOR_RTC_BASE) + 8) -#define RTC_EOI (IO_ADDRESS(INTEGRATOR_RTC_BASE) + 8) -#define RTC_LR (IO_ADDRESS(INTEGRATOR_RTC_BASE) + 12) -#define RTC_CR (IO_ADDRESS(INTEGRATOR_RTC_BASE) + 16) - -#define RTC_CR_MIE 0x00000001 +#define RTC_DR (0) +#define RTC_MR (4) +#define RTC_STAT (8) +#define RTC_EOI (8) +#define RTC_LR (12) +#define RTC_CR (16) +#define RTC_CR_MIE (1 << 0) extern int (*set_rtc)(void); +static void *rtc_base; static int integrator_set_rtc(void) { - __raw_writel(xtime.tv_sec, RTC_LR); + __raw_writel(xtime.tv_sec, rtc_base + RTC_LR); return 1; } -static int integrator_rtc_init(void) +static void rtc_read_alarm(struct rtc_wkalrm *alrm) +{ + rtc_time_to_tm(readl(rtc_base + RTC_MR), &alrm->time); +} + +static int rtc_set_alarm(struct rtc_wkalrm *alrm) +{ + unsigned long time; + int ret; + + ret = rtc_tm_to_time(&alrm->time, &time); + if (ret == 0) + writel(time, rtc_base + RTC_MR); + return ret; +} + +static void rtc_read_time(struct rtc_time *tm) +{ + rtc_time_to_tm(readl(rtc_base + RTC_DR), tm); +} + +/* + * Set the RTC time. Unfortunately, we can't accurately set + * the point at which the counter updates. + * + * Also, since RTC_LR is transferred to RTC_CR on next rising + * edge of the 1Hz clock, we must write the time one second + * in advance. + */ +static int rtc_set_time(struct rtc_time *tm) +{ + unsigned long time; + int ret; + + ret = rtc_tm_to_time(tm, &time); + if (ret == 0) + writel(time + 1, rtc_base + RTC_LR); + + return ret; +} + +static struct rtc_ops rtc_ops = { + .owner = THIS_MODULE, + .read_time = rtc_read_time, + .set_time = rtc_set_time, + .read_alarm = rtc_read_alarm, + .set_alarm = rtc_set_alarm, +}; + +static irqreturn_t rtc_interrupt(int irq, void *dev_id, struct pt_regs *regs) { - __raw_writel(0, RTC_CR); - __raw_writel(0, RTC_EOI); + writel(0, rtc_base + RTC_EOI); + return IRQ_HANDLED; +} - xtime.tv_sec = __raw_readl(RTC_DR); +static int rtc_probe(struct amba_device *dev, void *id) +{ + int ret; + + if (rtc_base) + return -EBUSY; + + ret = amba_request_regions(dev, NULL); + if (ret) + goto out; + + rtc_base = ioremap(dev->res.start, SZ_4K); + if (!rtc_base) { + ret = -ENOMEM; + goto res_out; + } + + __raw_writel(0, rtc_base + RTC_CR); + __raw_writel(0, rtc_base + RTC_EOI); + + xtime.tv_sec = __raw_readl(rtc_base + RTC_DR); + + ret = request_irq(dev->irq[0], rtc_interrupt, SA_INTERRUPT, + "rtc-pl030", rtc_base); + if (ret) + goto map_out; + + ret = register_rtc(&rtc_ops); + if (ret) + goto irq_out; set_rtc = integrator_set_rtc; + return 0; + + irq_out: + free_irq(dev->irq[0], rtc_base); + map_out: + iounmap(rtc_base); + rtc_base = NULL; + res_out: + amba_release_regions(dev); + out: + return ret; +} + +static int rtc_remove(struct amba_device *dev) +{ + set_rtc = NULL; + + writel(0, rtc_base + RTC_CR); + + free_irq(dev->irq[0], rtc_base); + unregister_rtc(&rtc_ops); + + iounmap(rtc_base); + rtc_base = NULL; + amba_release_regions(dev); return 0; } -__initcall(integrator_rtc_init); +static struct timespec rtc_delta; + +static int rtc_suspend(struct amba_device *dev, u32 state) +{ + struct timespec rtc; + + rtc.tv_sec = readl(rtc_base + RTC_DR); + rtc.tv_nsec = 0; + save_time_delta(&rtc_delta, &rtc); + + return 0; +} + +static int rtc_resume(struct amba_device *dev) +{ + struct timespec rtc; + + rtc.tv_sec = readl(rtc_base + RTC_DR); + rtc.tv_nsec = 0; + restore_time_delta(&rtc_delta, &rtc); + + return 0; +} + +static struct amba_id rtc_ids[] = { + { + .id = 0x00041030, + .mask = 0x000fffff, + }, + { 0, 0 }, +}; + +static struct amba_driver rtc_driver = { + .drv = { + .name = "rtc-pl030", + }, + .probe = rtc_probe, + .remove = rtc_remove, + .suspend = rtc_suspend, + .resume = rtc_resume, + .id_table = rtc_ids, +}; + +static int __init integrator_rtc_init(void) +{ + return amba_driver_register(&rtc_driver); +} + +static void __exit integrator_rtc_exit(void) +{ + amba_driver_unregister(&rtc_driver); +} + +module_init(integrator_rtc_init); +module_exit(integrator_rtc_exit); diff -Nru a/arch/arm/mach-ixp2000/core.c b/arch/arm/mach-ixp2000/core.c --- a/arch/arm/mach-ixp2000/core.c 2005-01-02 23:03:35 -08:00 +++ b/arch/arm/mach-ixp2000/core.c 2005-01-02 23:03:35 -08:00 @@ -167,15 +167,28 @@ *************************************************************************/ static unsigned ticks_per_jiffy; static unsigned ticks_per_usec; +static unsigned next_jiffy_time; unsigned long ixp2000_gettimeoffset (void) { - unsigned long elapsed; + unsigned long elapsed1, elapsed2, pending; + unsigned long offset; - /* Get ticks since last perfect jiffy */ - elapsed = ticks_per_jiffy - *IXP2000_T1_CSR; + elapsed1 = *IXP2000_T1_CSR; + pending = (*IXP2000_IRQ_STATUS & IRQ_MASK_TIMER1); + elapsed2 = *IXP2000_T1_CSR; + + offset = ticks_per_jiffy - elapsed2; + + /* + * We have two cases to cover, one where we were pending + * already, and another where it overflowed while we were + * checking the timers. + */ + if ((elapsed2 > elapsed1) || pending) + offset += ticks_per_jiffy; - return elapsed / ticks_per_usec; + return offset / ticks_per_usec; } static int ixp2000_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) @@ -185,7 +198,10 @@ /* clear timer 1 */ ixp2000_reg_write(IXP2000_T1_CLR, 1); - timer_tick(regs); + while ((next_jiffy_time - *IXP2000_T4_CSR) > ticks_per_jiffy) { + timer_tick(regs); + next_jiffy_time -= ticks_per_jiffy; + } write_sequnlock(&xtime_lock); @@ -201,13 +217,20 @@ void __init ixp2000_init_time(unsigned long tick_rate) { ixp2000_reg_write(IXP2000_T1_CLR, 0); - ixp2000_reg_write(IXP2000_T2_CLR, 0); + ixp2000_reg_write(IXP2000_T4_CLR, 0); ticks_per_jiffy = (tick_rate + HZ/2) / HZ; ticks_per_usec = tick_rate / 1000000; ixp2000_reg_write(IXP2000_T1_CLD, ticks_per_jiffy); ixp2000_reg_write(IXP2000_T1_CTL, (1 << 7)); + + /* + * We use T4 as a monotonic counter to track missed jiffies + */ + ixp2000_reg_write(IXP2000_T4_CLD, -1); + ixp2000_reg_write(IXP2000_T4_CTL, (1 << 7)); + next_jiffy_time = 0xffffffff - ticks_per_jiffy; /* register for interrupt */ setup_irq(IRQ_IXP2000_TIMER1, &ixp2000_timer_irq); diff -Nru a/arch/arm/mach-ixp4xx/Kconfig b/arch/arm/mach-ixp4xx/Kconfig --- a/arch/arm/mach-ixp4xx/Kconfig 2005-01-02 23:03:33 -08:00 +++ b/arch/arm/mach-ixp4xx/Kconfig 2005-01-02 23:03:33 -08:00 @@ -36,6 +36,14 @@ IXDPG425 Development Platform (Also known as Montajade). For more information on this platform, see Documentation/arm/IXP4xx. +config MACH_IXDP465 + bool "IXDP465" + help + Say 'Y' here if you want your kernel to support Intel's + IXDP465 Development Platform (Also known as BMP). + For more information on this platform, see Documentation/arm/IXP4xx. + + # # IXCDP1100 is the exact same HW as IXDP425, but with a different machine # number from the bootloader due to marketing monkeys, so we just enable it @@ -58,7 +66,15 @@ # config ARCH_IXDP4XX bool - depends on ARCH_IXDP425 || ARCH_AVILA + depends on ARCH_IXDP425 || ARCH_AVILA || MACH_IXDP465 + default y + +# +# Certain registers and IRQs are only enabled if supporting IXP465 CPUs +# +config CPU_IXP46X + bool + depends on MACH_IXDP465 default y comment "IXP4xx Options" diff -Nru a/arch/arm/mach-ixp4xx/common-pci.c b/arch/arm/mach-ixp4xx/common-pci.c --- a/arch/arm/mach-ixp4xx/common-pci.c 2005-01-02 23:03:34 -08:00 +++ b/arch/arm/mach-ixp4xx/common-pci.c 2005-01-02 23:03:34 -08:00 @@ -348,10 +348,11 @@ asm("mrc p15, 0, %0, cr0, cr0, 0;" : "=r"(processor_id) :); /* - * Determine which PCI read method to use + * Determine which PCI read method to use. + * Rev 0 IXP425 requires workaround. */ - if (!(processor_id & 0xf)) { - printk("PCI: IXP4xx A0 silicon detected - " + if (!(processor_id & 0xf) && !cpu_is_ixp46x()) { + printk("PCI: IXP42x A0 silicon detected - " "PCI Non-Prefetch Workaround Enabled\n"); ixp4xx_pci_read = ixp4xx_pci_read_errata; } else diff -Nru a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c --- a/arch/arm/mach-ixp4xx/common.c 2005-01-02 23:03:34 -08:00 +++ b/arch/arm/mach-ixp4xx/common.c 2005-01-02 23:03:34 -08:00 @@ -145,7 +145,10 @@ **************************************************************************/ static void ixp4xx_irq_mask(unsigned int irq) { - *IXP4XX_ICMR &= ~(1 << irq); + if (cpu_is_ixp46x() && irq >= 32) + *IXP4XX_ICMR2 &= ~(1 << (irq - 32)); + else + *IXP4XX_ICMR &= ~(1 << irq); } static void ixp4xx_irq_mask_ack(unsigned int irq) @@ -155,13 +158,13 @@ static void ixp4xx_irq_unmask(unsigned int irq) { - static int irq2gpio[NR_IRQS] = { + static int irq2gpio[32] = { -1, -1, -1, -1, -1, -1, 0, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, -1, -1, }; - int line = irq2gpio[irq]; + int line = (irq < 32) ? irq2gpio[irq] : -1; /* * This only works for LEVEL gpio IRQs as per the IXP4xx developer's @@ -171,7 +174,10 @@ if (line >= 0) gpio_line_isr_clear(line); - *IXP4XX_ICMR |= (1 << irq); + if (cpu_is_ixp46x() && irq >= 32) + *IXP4XX_ICMR2 |= (1 << (irq - 32)); + else + *IXP4XX_ICMR |= (1 << irq); } static struct irqchip ixp4xx_irq_chip = { @@ -189,6 +195,14 @@ /* Disable all interrupt */ *IXP4XX_ICMR = 0x0; + + if (cpu_is_ixp46x()) { + /* Route upper 32 sources to IRQ instead of FIQ */ + *IXP4XX_ICLR2 = 0x00; + + /* Disable upper 32 interrupts */ + *IXP4XX_ICMR2 = 0x00; + } for(i = 0; i < NR_IRQS; i++) { 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-02 23:03:34 -08:00 +++ b/arch/arm/mach-ixp4xx/ixdp425-pci.c 2005-01-02 23:03:34 -08:00 @@ -73,9 +73,8 @@ int __init ixdp425_pci_init(void) { - if (machine_is_ixdp425() || - machine_is_ixcdp1100() || - machine_is_avila()) + if (machine_is_ixdp425() || machine_is_ixcdp1100() || + machine_is_avila() || machine_is_ixdp465()) pci_common_init(&ixdp425_pci); return 0; } 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-02 23:03:34 -08:00 +++ b/arch/arm/mach-ixp4xx/ixdp425-setup.c 2005-01-02 23:03:34 -08:00 @@ -108,10 +108,28 @@ static void __init ixdp425_init(void) { + /* + * IXP465 has 32MB window + */ + if (machine_is_ixdp465()) { + ixdp425_flash_resource.end += IXDP425_FLASH_SIZE; + } + platform_add_devices(&ixdp425_devices, ARRAY_SIZE(ixdp425_devices)); } MACHINE_START(IXDP425, "Intel IXDP425 Development Platform") + MAINTAINER("MontaVista Software, Inc.") + BOOT_MEM(PHYS_OFFSET, IXP4XX_PERIPHERAL_BASE_PHYS, + IXP4XX_PERIPHERAL_BASE_VIRT) + MAPIO(ixdp425_map_io) + INITIRQ(ixp4xx_init_irq) + .timer = &ixp4xx_timer, + BOOT_PARAMS(0x0100) + INIT_MACHINE(ixdp425_init) +MACHINE_END + +MACHINE_START(IXDP465, "Intel IXDP465 Development Platform") MAINTAINER("MontaVista Software, Inc.") BOOT_MEM(PHYS_OFFSET, IXP4XX_PERIPHERAL_BASE_PHYS, IXP4XX_PERIPHERAL_BASE_VIRT) diff -Nru a/arch/arm/mach-omap/board-h2.c b/arch/arm/mach-omap/board-h2.c --- a/arch/arm/mach-omap/board-h2.c 2005-01-02 23:03:35 -08:00 +++ b/arch/arm/mach-omap/board-h2.c 2005-01-02 23:03:35 -08:00 @@ -32,10 +32,11 @@ #include #include #include -#include #include "common.h" +extern int omap_gpio_init(void); + static int __initdata h2_serial_ports[OMAP_MAX_NR_PORTS] = {1, 1, 1}; static struct resource h2_smc91x_resources[] = { @@ -45,8 +46,8 @@ .flags = IORESOURCE_MEM, }, [1] = { - .start = 0, /* Really GPIO 0 */ - .end = 0, + .start = OMAP_GPIO_IRQ(0), + .end = OMAP_GPIO_IRQ(0), .flags = IORESOURCE_IRQ, }, }; @@ -62,9 +63,20 @@ &h2_smc91x_device, }; +static void __init h2_init_smc91x(void) +{ + if ((omap_request_gpio(0)) < 0) { + printk("Error requesting gpio 0 for smc91x irq\n"); + return; + } + omap_set_gpio_edge_ctrl(0, OMAP_GPIO_FALLING_EDGE); +} + void h2_init_irq(void) { omap_init_irq(); + omap_gpio_init(); + h2_init_smc91x(); } static struct omap_usb_config h2_usb_config __initdata = { diff -Nru a/arch/arm/mach-omap/board-h3.c b/arch/arm/mach-omap/board-h3.c --- a/arch/arm/mach-omap/board-h3.c 2005-01-02 23:03:33 -08:00 +++ b/arch/arm/mach-omap/board-h3.c 2005-01-02 23:03:33 -08:00 @@ -28,16 +28,13 @@ #include #include #include +#include #include #include -#include #include "common.h" -void h3_init_irq(void) -{ - omap_init_irq(); -} +extern int omap_gpio_init(void); static int __initdata h3_serial_ports[OMAP_MAX_NR_PORTS] = {1, 1, 1}; @@ -48,8 +45,8 @@ .flags = IORESOURCE_MEM, }, [1] = { - .start = 0, - .end = 0, + .start = OMAP_GPIO_IRQ(40), + .end = OMAP_GPIO_IRQ(40), .flags = IORESOURCE_IRQ, }, }; @@ -68,6 +65,23 @@ static void __init h3_init(void) { (void) platform_add_devices(devices, ARRAY_SIZE(devices)); +} + +static void __init h3_init_smc91x(void) +{ + omap_cfg_reg(W15_1710_GPIO40); + if (omap_request_gpio(40) < 0) { + printk("Error requesting gpio 40 for smc91x irq\n"); + return; + } + omap_set_gpio_edge_ctrl(40, OMAP_GPIO_FALLING_EDGE); +} + +void h3_init_irq(void) +{ + omap_init_irq(); + omap_gpio_init(); + h3_init_smc91x(); } static void __init h3_map_io(void) diff -Nru a/arch/arm/mach-omap/board-innovator.c b/arch/arm/mach-omap/board-innovator.c --- a/arch/arm/mach-omap/board-innovator.c 2005-01-02 23:03:33 -08:00 +++ b/arch/arm/mach-omap/board-innovator.c 2005-01-02 23:03:33 -08:00 @@ -30,13 +30,12 @@ #include #include #include -#include #include "common.h" -#ifdef CONFIG_ARCH_OMAP1510 +static int __initdata innovator_serial_ports[OMAP_MAX_NR_PORTS] = {1, 1, 1}; -extern int omap_gpio_init(void); +#ifdef CONFIG_ARCH_OMAP1510 /* Only FPGA needs to be mapped here. All others are done with ioremap */ static struct map_desc innovator1510_io_desc[] __initdata = { @@ -44,8 +43,6 @@ MT_DEVICE }, }; -static int __initdata innovator_serial_ports[OMAP_MAX_NR_PORTS] = {1, 1, 1}; - static struct resource innovator1510_smc91x_resources[] = { [0] = { .start = OMAP1510_FPGA_ETHR_START, /* Physical */ @@ -81,8 +78,8 @@ .flags = IORESOURCE_MEM, }, [1] = { - .start = 0, /* Really GPIO 0 */ - .end = 0, + .start = OMAP_GPIO_IRQ(0), + .end = OMAP_GPIO_IRQ(0), .flags = IORESOURCE_IRQ, }, }; @@ -100,15 +97,31 @@ #endif /* CONFIG_ARCH_OMAP16XX */ +static void __init innovator_init_smc91x(void) +{ + if (cpu_is_omap1510()) { + fpga_write(fpga_read(OMAP1510_FPGA_RST) & ~1, + OMAP1510_FPGA_RST); + udelay(750); + } else { + if ((omap_request_gpio(0)) < 0) { + printk("Error requesting gpio 0 for smc91x irq\n"); + return; + } + omap_set_gpio_edge_ctrl(0, OMAP_GPIO_RISING_EDGE); + } +} + void innovator_init_irq(void) { omap_init_irq(); + omap_gpio_init(); #ifdef CONFIG_ARCH_OMAP1510 if (cpu_is_omap1510()) { - omap_gpio_init(); omap1510_fpga_init_irq(); } #endif + innovator_init_smc91x(); } #ifdef CONFIG_ARCH_OMAP1510 diff -Nru a/arch/arm/mach-omap/board-osk.c b/arch/arm/mach-omap/board-osk.c --- a/arch/arm/mach-omap/board-osk.c 2005-01-02 23:03:34 -08:00 +++ b/arch/arm/mach-omap/board-osk.c 2005-01-02 23:03:34 -08:00 @@ -39,7 +39,6 @@ #include #include #include -#include #include "common.h" @@ -57,8 +56,8 @@ .flags = IORESOURCE_MEM, }, [1] = { - .start = 0, /* Really GPIO 0 */ - .end = 0, + .start = OMAP_GPIO_IRQ(0), + .end = OMAP_GPIO_IRQ(0), .flags = IORESOURCE_IRQ, }, }; @@ -74,9 +73,20 @@ &osk5912_smc91x_device, }; +static void __init osk_init_smc91x(void) +{ + if ((omap_request_gpio(0)) < 0) { + printk("Error requesting gpio 0 for smc91x irq\n"); + return; + } + omap_set_gpio_edge_ctrl(0, OMAP_GPIO_RISING_EDGE); +} + void osk_init_irq(void) { omap_init_irq(); + omap_gpio_init(); + osk_init_smc91x(); } static struct omap_usb_config osk_usb_config __initdata = { diff -Nru a/arch/arm/mach-omap/board-perseus2.c b/arch/arm/mach-omap/board-perseus2.c --- a/arch/arm/mach-omap/board-perseus2.c 2005-01-02 23:03:34 -08:00 +++ b/arch/arm/mach-omap/board-perseus2.c 2005-01-02 23:03:34 -08:00 @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -28,11 +29,6 @@ #include "common.h" -void omap_perseus2_init_irq(void) -{ - omap_init_irq(); -} - static struct resource smc91x_resources[] = { [0] = { .start = H2P2_DBG_FPGA_ETHR_START, /* Physical */ @@ -62,6 +58,22 @@ static void __init omap_perseus2_init(void) { (void) platform_add_devices(devices, ARRAY_SIZE(devices)); +} + +static void __init perseus2_init_smc91x(void) +{ + fpga_write(1, H2P2_DBG_FPGA_LAN_RESET); + mdelay(50); + fpga_write(fpga_read(H2P2_DBG_FPGA_LAN_RESET) & ~1, + H2P2_DBG_FPGA_LAN_RESET); + mdelay(50); +} + +void omap_perseus2_init_irq(void) +{ + omap_init_irq(); + omap_gpio_init(); + perseus2_init_smc91x(); } /* Only FPGA needs to be mapped here. All others are done with ioremap */ diff -Nru a/arch/arm/mach-omap/common.c b/arch/arm/mach-omap/common.c --- a/arch/arm/mach-omap/common.c 2005-01-02 23:03:35 -08:00 +++ b/arch/arm/mach-omap/common.c 2005-01-02 23:03:35 -08:00 @@ -30,8 +30,6 @@ #include #include #include -#include - #include "clock.h" @@ -307,14 +305,14 @@ _omap_map_io(); } -static inline unsigned int omap_serial_in(struct plat_serial8250_port *up, +static inline unsigned int omap_serial_in(struct plat_serial8250_port *up, int offset) { offset <<= up->regshift; return (unsigned int)__raw_readb(up->membase + offset); } -static inline void omap_serial_outp(struct plat_serial8250_port *p, int offset, +static inline void omap_serial_outp(struct plat_serial8250_port *p, int offset, int value) { offset <<= p->regshift; @@ -323,12 +321,14 @@ /* * Internal UARTs need to be initialized for the 8250 autoconfig to work - * properly. + * properly. Note that the TX watermark initialization may not be needed + * once the 8250.c watermark handling code is merged. */ static void __init omap_serial_reset(struct plat_serial8250_port *p) { - omap_serial_outp(p, UART_OMAP_MDR1, 0x07); /* disable UART */ - omap_serial_outp(p, UART_OMAP_MDR1, 0x00); /* enable UART */ + omap_serial_outp(p, UART_OMAP_MDR1, 0x07); /* disable UART */ + omap_serial_outp(p, UART_OMAP_SCR, 0x08); /* TX watermark */ + omap_serial_outp(p, UART_OMAP_MDR1, 0x00); /* enable UART */ if (!cpu_is_omap1510()) { omap_serial_outp(p, UART_OMAP_SYSC, 0x01); diff -Nru a/arch/arm/mach-omap/dma.c b/arch/arm/mach-omap/dma.c --- a/arch/arm/mach-omap/dma.c 2005-01-02 23:03:35 -08:00 +++ b/arch/arm/mach-omap/dma.c 2005-01-02 23:03:35 -08:00 @@ -6,6 +6,7 @@ * DMA channel linking for 1610 by Samuel Ortiz * Graphics DMA and LCD DMA graphics tranformations * by Imre Deak + * Some functions based on earlier dma-omap.c Copyright (C) 2001 RidgeRun, Inc. * * Support functions for the OMAP internal DMA channels. * @@ -477,10 +478,6 @@ if (dev_id == 0) break; } - if (dev_id != 0 && dma_chan[ch].dev_id == dev_id) { - spin_unlock_irqrestore(&dma_chan_lock, flags); - return -EAGAIN; - } } if (free_ch == -1) { spin_unlock_irqrestore(&dma_chan_lock, flags); @@ -931,6 +928,50 @@ OMAP1610_DMA_LCD_CCR); } +/* + * Clears any DMA state so the DMA engine is ready to restart with new buffers + * through omap_start_dma(). Any buffers in flight are discarded. + */ +void omap_clear_dma(int lch) +{ + unsigned long flags; + int status; + + local_irq_save(flags); + omap_writew(omap_readw(OMAP_DMA_CCR(lch)) & ~OMAP_DMA_CCR_EN, + OMAP_DMA_CCR(lch)); + status = OMAP_DMA_CSR(lch); /* clear pending interrupts */ + local_irq_restore(flags); +} + +/* + * Returns current physical source address for the given DMA channel. + * If the channel is running the caller must disable interrupts prior calling + * this function and process the returned value before re-enabling interrupt to + * prevent races with the interrupt handler. Note that in continuous mode there + * is a chance for CSSA_L register overflow inbetween the two reads resulting + * in incorrect return value. + */ +dma_addr_t omap_get_dma_src_pos(int lch) +{ + return (dma_addr_t) (OMAP_DMA_CSSA_L(lch) | + (OMAP_DMA_CSSA_U(lch) << 16)); +} + +/* + * Returns current physical destination address for the given DMA channel. + * If the channel is running the caller must disable interrupts prior calling + * this function and process the returned value before re-enabling interrupt to + * prevent races with the interrupt handler. Note that in continuous mode there + * is a chance for CDSA_L register overflow inbetween the two reads resulting + * in incorrect return value. + */ +dma_addr_t omap_get_dma_dst_pos(int lch) +{ + return (dma_addr_t) (OMAP_DMA_CDSA_L(lch) | + (OMAP_DMA_CDSA_U(lch) << 16)); +} + static int __init omap_init_dma(void) { int ch, r; @@ -999,9 +1040,13 @@ } return 0; } + arch_initcall(omap_init_dma); +EXPORT_SYMBOL(omap_get_dma_src_pos); +EXPORT_SYMBOL(omap_get_dma_dst_pos); +EXPORT_SYMBOL(omap_clear_dma); EXPORT_SYMBOL(omap_set_dma_priority); EXPORT_SYMBOL(omap_request_dma); EXPORT_SYMBOL(omap_free_dma); diff -Nru a/arch/arm/mach-omap/pm.c b/arch/arm/mach-omap/pm.c --- a/arch/arm/mach-omap/pm.c 2005-01-02 23:03:33 -08:00 +++ b/arch/arm/mach-omap/pm.c 2005-01-02 23:03:33 -08:00 @@ -81,6 +81,12 @@ mask32 = omap_readl(ARM_SYSST); local_fiq_enable(); local_irq_enable(); + +#if defined(CONFIG_OMAP_32K_TIMER) && defined(CONFIG_NO_IDLE_HZ) + /* Override timer to use VST for the next cycle */ + omap_32k_timer_next_vst_interrupt(); +#endif + if ((mask32 & DSP_IDLE) == 0) { __asm__ volatile ("mcr p15, 0, r0, c7, c0, 4"); } else { @@ -508,7 +514,7 @@ */ //#include -static int omap_pm_prepare(u32 state) +static int omap_pm_prepare(suspend_state_t state) { int error = 0; @@ -535,7 +541,7 @@ * */ -static int omap_pm_enter(u32 state) +static int omap_pm_enter(suspend_state_t state) { switch (state) { @@ -563,7 +569,7 @@ * failed). */ -static int omap_pm_finish(u32 state) +static int omap_pm_finish(suspend_state_t state) { return 0; } diff -Nru a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig --- a/arch/arm/mm/Kconfig 2005-01-02 23:03:35 -08:00 +++ b/arch/arm/mm/Kconfig 2005-01-02 23:03:35 -08:00 @@ -82,9 +82,9 @@ # ARM922T config CPU_ARM922T - bool - depends on ARCH_CAMELOT || ARCH_LH7A40X - default y + bool "Support ARM922T processor" if ARCH_INTEGRATOR + depends on ARCH_CAMELOT || ARCH_LH7A40X || ARCH_INTEGRATOR + default y if ARCH_CAMELOT || ARCH_LH7A40X select CPU_32v4 select CPU_ABRT_EV4T select CPU_CACHE_V4WT @@ -101,9 +101,9 @@ # ARM925T config CPU_ARM925T - bool + bool "Support ARM925T processor" if ARCH_OMAP depends on ARCH_OMAP1510 - default y + default y if ARCH_OMAP1510 select CPU_32v4 select CPU_ABRT_EV4T select CPU_CACHE_V4WT @@ -121,8 +121,8 @@ # ARM926T config CPU_ARM926T bool "Support ARM926T processor" if ARCH_INTEGRATOR - depends on ARCH_INTEGRATOR || ARCH_VERSATILE_PB || MACH_VERSATILE_AB || ARCH_OMAP730 || ARCH_OMAP1610 || ARCH_OMAP5912 - default y if ARCH_VERSATILE_PB || MACH_VERSATILE_AB + depends on ARCH_INTEGRATOR || ARCH_VERSATILE_PB || MACH_VERSATILE_AB || ARCH_OMAP730 || ARCH_OMAP16XX + default y if ARCH_VERSATILE_PB || MACH_VERSATILE_AB || ARCH_OMAP730 || ARCH_OMAP16XX select CPU_32v5 select CPU_ABRT_EV5TJ select CPU_CACHE_VIVT @@ -392,6 +392,7 @@ config CPU_DCACHE_WRITETHROUGH bool "Force write through D-cache" depends on (CPU_ARM920T || CPU_ARM922T || CPU_ARM925T || CPU_ARM926T || CPU_ARM1020) && !CPU_DISABLE_DCACHE + default y if CPU_ARM925T help Say Y here to use the data cache in writethough mode. Unless you specifically require this or are unsure, say N. diff -Nru a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c --- a/arch/arm/mm/alignment.c 2005-01-02 23:03:33 -08:00 +++ b/arch/arm/mm/alignment.c 2005-01-02 23:03:33 -08:00 @@ -3,6 +3,9 @@ * * Copyright (C) 1995 Linus Torvalds * Modifications for ARM processor (c) 1995-2001 Russell King + * Thumb aligment fault fixups (c) 2004 MontaVista Software, Inc. + * - Adapted from gdb/sim/arm/thumbemu.c -- Thumb instruction emulation. + * Copyright (C) 1996, Cygnus Software Technologies Ltd. * * 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 @@ -449,16 +452,146 @@ return TYPE_ERROR; } +/* + * Convert Thumb ld/st instruction forms to equivalent ARM instructions so + * we can reuse ARM userland alignment fault fixups for Thumb. + * + * This implementation was initially based on the algorithm found in + * gdb/sim/arm/thumbemu.c. It is basically just a code reduction of same + * to convert only Thumb ld/st instruction forms to equivalent ARM forms. + * + * NOTES: + * 1. Comments below refer to ARM ARM DDI0100E Thumb Instruction sections. + * 2. If for some reason we're passed an non-ld/st Thumb instruction to + * decode, we return 0xdeadc0de. This should never happen under normal + * circumstances but if it does, we've got other problems to deal with + * elsewhere and we obviously can't fix those problems here. + */ + +static unsigned long +thumb2arm(u16 tinstr) +{ + u32 L = (tinstr & (1<<11)) >> 11; + + switch ((tinstr & 0xf800) >> 11) { + /* 6.5.1 Format 1: */ + case 0x6000 >> 11: /* 7.1.52 STR(1) */ + case 0x6800 >> 11: /* 7.1.26 LDR(1) */ + case 0x7000 >> 11: /* 7.1.55 STRB(1) */ + case 0x7800 >> 11: /* 7.1.30 LDRB(1) */ + return 0xe5800000 | + ((tinstr & (1<<12)) << (22-12)) | /* fixup */ + (L<<20) | /* L==1? */ + ((tinstr & (7<<0)) << (12-0)) | /* Rd */ + ((tinstr & (7<<3)) << (16-3)) | /* Rn */ + ((tinstr & (31<<6)) >> /* immed_5 */ + (6 - ((tinstr & (1<<12)) ? 0 : 2))); + case 0x8000 >> 11: /* 7.1.57 STRH(1) */ + case 0x8800 >> 11: /* 7.1.32 LDRH(1) */ + return 0xe1c000b0 | + (L<<20) | /* L==1? */ + ((tinstr & (7<<0)) << (12-0)) | /* Rd */ + ((tinstr & (7<<3)) << (16-3)) | /* Rn */ + ((tinstr & (7<<6)) >> (6-1)) | /* immed_5[2:0] */ + ((tinstr & (3<<9)) >> (9-8)); /* immed_5[4:3] */ + + /* 6.5.1 Format 2: */ + case 0x5000 >> 11: + case 0x5800 >> 11: + { + static const u32 subset[8] = { + 0xe7800000, /* 7.1.53 STR(2) */ + 0xe18000b0, /* 7.1.58 STRH(2) */ + 0xe7c00000, /* 7.1.56 STRB(2) */ + 0xe19000d0, /* 7.1.34 LDRSB */ + 0xe7900000, /* 7.1.27 LDR(2) */ + 0xe19000b0, /* 7.1.33 LDRH(2) */ + 0xe7d00000, /* 7.1.31 LDRB(2) */ + 0xe19000f0 /* 7.1.35 LDRSH */ + }; + return subset[(tinstr & (7<<9)) >> 9] | + ((tinstr & (7<<0)) << (12-0)) | /* Rd */ + ((tinstr & (7<<3)) << (16-3)) | /* Rn */ + ((tinstr & (7<<6)) >> (6-0)); /* Rm */ + } + + /* 6.5.1 Format 3: */ + case 0x4800 >> 11: /* 7.1.28 LDR(3) */ + /* NOTE: This case is not technically possible. We're + * loading 32-bit memory data via PC relative + * addressing mode. So we can and should eliminate + * this case. But I'll leave it here for now. + */ + return 0xe59f0000 | + ((tinstr & (7<<8)) << (12-8)) | /* Rd */ + ((tinstr & 255) << (2-0)); /* immed_8 */ + + /* 6.5.1 Format 4: */ + case 0x9000 >> 11: /* 7.1.54 STR(3) */ + case 0x9800 >> 11: /* 7.1.29 LDR(4) */ + return 0xe58d0000 | + (L<<20) | /* L==1? */ + ((tinstr & (7<<8)) << (12-8)) | /* Rd */ + ((tinstr & 255) << 2); /* immed_8 */ + + /* 6.6.1 Format 1: */ + case 0xc000 >> 11: /* 7.1.51 STMIA */ + case 0xc800 >> 11: /* 7.1.25 LDMIA */ + { + u32 Rn = (tinstr & (7<<8)) >> 8; + u32 W = ((L<> 11: /* 7.1.48 PUSH */ + case 0xb800 >> 11: /* 7.1.47 POP */ + if ((tinstr & (3 << 9)) == 0x0400) { + static const u32 subset[4] = { + 0xe92d0000, /* STMDB sp!,{registers} */ + 0xe92d4000, /* STMDB sp!,{registers,lr} */ + 0xe8bd0000, /* LDMIA sp!,{registers} */ + 0xe8bd8000 /* LDMIA sp!,{registers,pc} */ + }; + return subset[(L<<1) | ((tinstr & (1<<8)) >> 8)] | + (tinstr & 255); /* register_list */ + } + /* Else fall through for illegal instruction case */ + + default: + return 0xdeadc0de; + } +} + static int do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs) { union offset_union offset; - unsigned long instr, instrptr; + unsigned long instr = 0, instrptr; int (*handler)(unsigned long addr, unsigned long instr, struct pt_regs *regs); unsigned int type; + mm_segment_t fs; + unsigned int fault; + u16 tinstr = 0; instrptr = instruction_pointer(regs); - instr = *(unsigned long *)instrptr; + + fs = get_fs(); + set_fs(KERNEL_DS); + if thumb_mode(regs) { + fault = __get_user(tinstr, (u16 *)(instrptr & ~1)); + if (!(fault)) + instr = thumb2arm(tinstr); + } else + fault = __get_user(instr, (u32 *)instrptr); + set_fs(fs); + + if (fault) { + type = TYPE_FAULT; + goto bad_or_fault; + } if (user_mode(regs)) goto user; @@ -467,7 +600,7 @@ fixup: - regs->ARM_pc += 4; + regs->ARM_pc += thumb_mode(regs) ? 2 : 4; switch (CODING_BITS(instr)) { case 0x00000000: /* ldrh or strh */ @@ -537,7 +670,7 @@ bad_or_fault: if (type == TYPE_ERROR) goto bad; - regs->ARM_pc -= 4; + regs->ARM_pc -= thumb_mode(regs) ? 2 : 4; /* * We got a fault - fix it up, or die. */ @@ -549,7 +682,9 @@ * Oops, we didn't handle the instruction. */ printk(KERN_ERR "Alignment trap: not handling instruction " - "%08lx at [<%08lx>]\n", instr, instrptr); + "%0*lx at [<%08lx>]\n", + thumb_mode(regs) ? 4 : 8, + thumb_mode(regs) ? tinstr : instr, instrptr); ai_skipped += 1; return 1; @@ -557,9 +692,12 @@ ai_user += 1; if (ai_usermode & 1) - printk("Alignment trap: %s (%d) PC=0x%08lx Instr=0x%08lx " + printk("Alignment trap: %s (%d) PC=0x%08lx Instr=0x%0*lx " "Address=0x%08lx FSR 0x%03x\n", current->comm, - current->pid, instrptr, instr, addr, fsr); + current->pid, instrptr, + thumb_mode(regs) ? 4 : 8, + thumb_mode(regs) ? tinstr : instr, + addr, fsr); if (ai_usermode & 2) goto fixup; diff -Nru a/arch/arm/mm/proc-arm1020.S b/arch/arm/mm/proc-arm1020.S --- a/arch/arm/mm/proc-arm1020.S 2005-01-02 23:03:33 -08:00 +++ b/arch/arm/mm/proc-arm1020.S 2005-01-02 23:03:33 -08:00 @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -432,7 +433,10 @@ mcr p15, 0, r0, c7, c10, 4 @ drain write buffer on v4 mcr p15, 0, r0, c8, c7 @ invalidate I,D TLBs on v4 mcr p15, 0, r4, c2, c0 @ load page table pointer - mov r0, #0x1f @ Domains 0, 1 = client + mov r0, #(domain_val(DOMAIN_USER, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_KERNEL, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_TABLE, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_IO, DOMAIN_CLIENT)) mcr p15, 0, r0, c3, c0 @ load domain access register mrc p15, 0, r0, c1, c0 @ get control register v4 /* @@ -522,7 +526,9 @@ __arm1020_proc_info: .long 0x4104a200 @ ARM 1020T (Architecture v5T) .long 0xff0ffff0 - .long 0x00000c02 @ mmuflags + .long PMD_TYPE_SECT | \ + PMD_SECT_AP_WRITE | \ + PMD_SECT_AP_READ b __arm1020_setup .long cpu_arch_name .long cpu_elf_name diff -Nru a/arch/arm/mm/proc-arm1020e.S b/arch/arm/mm/proc-arm1020e.S --- a/arch/arm/mm/proc-arm1020e.S 2005-01-02 23:03:34 -08:00 +++ b/arch/arm/mm/proc-arm1020e.S 2005-01-02 23:03:34 -08:00 @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -414,7 +415,11 @@ mcr p15, 0, r0, c7, c10, 4 @ drain write buffer on v4 mcr p15, 0, r0, c8, c7 @ invalidate I,D TLBs on v4 mcr p15, 0, r4, c2, c0 @ load page table pointer - mov r0, #0x1f @ Domains 0, 1 = client + mov r0, #(domain_val(DOMAIN_USER, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_KERNEL, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_TABLE, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_IO, DOMAIN_CLIENT)) + mcr p15, 0, r0, c3, c0 @ load domain access register mrc p15, 0, r0, c1, c0 @ get control register v4 /* @@ -504,7 +509,10 @@ __arm1020e_proc_info: .long 0x4105a200 @ ARM 1020TE (Architecture v5TE) .long 0xff0ffff0 - .long 0x00000c12 @ mmuflags + .long PMD_TYPE_SECT | \ + PMD_BIT4 | \ + PMD_SECT_AP_WRITE | \ + PMD_SECT_AP_READ b __arm1020e_setup .long cpu_arch_name .long cpu_elf_name diff -Nru a/arch/arm/mm/proc-arm1022.S b/arch/arm/mm/proc-arm1022.S --- a/arch/arm/mm/proc-arm1022.S 2005-01-02 23:03:35 -08:00 +++ b/arch/arm/mm/proc-arm1022.S 2005-01-02 23:03:35 -08:00 @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -395,7 +396,10 @@ mcr p15, 0, r0, c7, c10, 4 @ drain write buffer on v4 mcr p15, 0, r0, c8, c7 @ invalidate I,D TLBs on v4 mcr p15, 0, r4, c2, c0 @ load page table pointer - mov r0, #0x1f @ Domains 0, 1 = client + mov r0, #(domain_val(DOMAIN_USER, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_KERNEL, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_TABLE, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_IO, DOMAIN_CLIENT)) mcr p15, 0, r0, c3, c0 @ load domain access register mrc p15, 0, r0, c1, c0 @ get control register v4 /* @@ -485,7 +489,10 @@ __arm1022_proc_info: .long 0x4105a220 @ ARM 1022E (v5TE) .long 0xff0ffff0 - .long 0x00000c12 @ mmuflags + .long PMD_TYPE_SECT | \ + PMD_BIT4 | \ + PMD_SECT_AP_WRITE | \ + PMD_SECT_AP_READ b __arm1022_setup .long cpu_arch_name .long cpu_elf_name diff -Nru a/arch/arm/mm/proc-arm1026.S b/arch/arm/mm/proc-arm1026.S --- a/arch/arm/mm/proc-arm1026.S 2005-01-02 23:03:34 -08:00 +++ b/arch/arm/mm/proc-arm1026.S 2005-01-02 23:03:34 -08:00 @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -389,7 +390,10 @@ mov r0, #4 @ explicitly disable writeback mcr p15, 7, r0, c15, c0, 0 #endif - mov r0, #0x1f @ Domains 0, 1 = client + mov r0, #(domain_val(DOMAIN_USER, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_KERNEL, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_TABLE, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_IO, DOMAIN_CLIENT)) mcr p15, 0, r0, c3, c0 @ load domain access register mrc p15, 0, r0, c1, c0 @ get control register v4 /* @@ -480,7 +484,10 @@ __arm1026_proc_info: .long 0x4106a260 @ ARM 1026EJ-S (v5TEJ) .long 0xff0ffff0 - .long 0x00000c12 @ mmuflags + .long PMD_TYPE_SECT | \ + PMD_BIT4 | \ + PMD_SECT_AP_WRITE | \ + PMD_SECT_AP_READ b __arm1026_setup .long cpu_arch_name .long cpu_elf_name diff -Nru a/arch/arm/mm/proc-arm6_7.S b/arch/arm/mm/proc-arm6_7.S --- a/arch/arm/mm/proc-arm6_7.S 2005-01-02 23:03:35 -08:00 +++ b/arch/arm/mm/proc-arm6_7.S 2005-01-02 23:03:35 -08:00 @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -254,7 +255,10 @@ mcr p15, 0, r0, c7, c0 @ flush caches on v3 mcr p15, 0, r0, c5, c0 @ flush TLBs on v3 mcr p15, 0, r4, c2, c0 @ load page table pointer - mov r0, #0x1f @ Domains 0, 1 = client + mov r0, #(domain_val(DOMAIN_USER, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_KERNEL, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_TABLE, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_IO, DOMAIN_CLIENT)) mcr p15, 0, r0, c3, c0 @ load domain access register mov r0, #0x3d @ . ..RS BLDP WCAM orr r0, r0, #0x100 @ . ..01 0011 1101 @@ -266,7 +270,10 @@ mcr p15, 0, r0, c7, c0 @ flush caches on v3 mcr p15, 0, r0, c5, c0 @ flush TLBs on v3 mcr p15, 0, r4, c2, c0 @ load page table pointer - mov r0, #0x1f @ Domains 0, 1 = client + mov r0, #(domain_val(DOMAIN_IO, DOMAIN_CLIENT) | \ + domain_val(DOMAIN_KERNEL, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_TABLE, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_USER, DOMAIN_MANAGER)) mcr p15, 0, r0, c3, c0 @ load domain access register mov r0, #0x7d @ . ..RS BLDP WCAM orr r0, r0, #0x100 @ . ..01 0111 1101 @@ -391,7 +398,12 @@ __arm710_proc_info: .long 0x41007100 .long 0xfff8ff00 - .long 0x00000c1e + .long PMD_TYPE_SECT | \ + PMD_SECT_BUFFERABLE | \ + PMD_SECT_CACHEABLE | \ + PMD_BIT4 | \ + PMD_SECT_AP_WRITE | \ + PMD_SECT_AP_READ b __arm7_setup .long cpu_arch_name .long cpu_elf_name diff -Nru a/arch/arm/mm/proc-arm720.S b/arch/arm/mm/proc-arm720.S --- a/arch/arm/mm/proc-arm720.S 2005-01-02 23:03:34 -08:00 +++ b/arch/arm/mm/proc-arm720.S 2005-01-02 23:03:34 -08:00 @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -131,7 +132,10 @@ mcr p15, 0, r0, c7, c7, 0 @ invalidate caches mcr p15, 0, r0, c8, c7, 0 @ flush TLB (v4) mcr p15, 0, r4, c2, c0 @ load page table pointer - mov r0, #0x1f @ Domains 0, 1 = client + mov r0, #(domain_val(DOMAIN_USER, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_KERNEL, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_TABLE, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_IO, DOMAIN_CLIENT)) mcr p15, 0, r0, c3, c0 @ load domain access register mrc p15, 0, r0, c1, c0 @ get control register @@ -146,7 +150,10 @@ mcr p15, 0, r0, c7, c7, 0 @ invalidate caches mcr p15, 0, r0, c8, c7, 0 @ flush TLB (v4) mcr p15, 0, r4, c2, c0 @ load page table pointer - mov r0, #0x1f @ Domains 0, 1 = client + mov r0, #(domain_val(DOMAIN_USER, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_KERNEL, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_TABLE, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_IO, DOMAIN_CLIENT)) mcr p15, 0, r0, c3, c0 @ load domain access register mrc p15, 0, r0, c1, c0 @ get control register @@ -206,7 +213,12 @@ __arm710_proc_info: .long 0x41807100 @ cpu_val .long 0xffffff00 @ cpu_mask - .long 0x00000c1e @ section_mmu_flags + .long PMD_TYPE_SECT | \ + PMD_SECT_BUFFERABLE | \ + PMD_SECT_CACHEABLE | \ + PMD_BIT4 | \ + PMD_SECT_AP_WRITE | \ + PMD_SECT_AP_READ b __arm710_setup @ cpu_flush .long cpu_arch_name @ arch_name .long cpu_elf_name @ elf_name @@ -222,7 +234,12 @@ __arm720_proc_info: .long 0x41807200 @ cpu_val .long 0xffffff00 @ cpu_mask - .long 0x00000c1e @ section_mmu_flags + .long PMD_TYPE_SECT | \ + PMD_SECT_BUFFERABLE | \ + PMD_SECT_CACHEABLE | \ + PMD_BIT4 | \ + PMD_SECT_AP_WRITE | \ + PMD_SECT_AP_READ b __arm720_setup @ cpu_flush .long cpu_arch_name @ arch_name .long cpu_elf_name @ elf_name diff -Nru a/arch/arm/mm/proc-arm920.S b/arch/arm/mm/proc-arm920.S --- a/arch/arm/mm/proc-arm920.S 2005-01-02 23:03:33 -08:00 +++ b/arch/arm/mm/proc-arm920.S 2005-01-02 23:03:33 -08:00 @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -383,7 +384,10 @@ mcr p15, 0, r0, c7, c10, 4 @ drain write buffer on v4 mcr p15, 0, r0, c8, c7 @ invalidate I,D TLBs on v4 mcr p15, 0, r4, c2, c0 @ load page table pointer - mov r0, #0x1f @ Domains 0, 1 = client + mov r0, #(domain_val(DOMAIN_USER, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_KERNEL, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_TABLE, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_IO, DOMAIN_CLIENT)) mcr p15, 0, r0, c3, c0 @ load domain access register mrc p15, 0, r0, c1, c0 @ get control register v4 /* @@ -464,7 +468,12 @@ __arm920_proc_info: .long 0x41009200 .long 0xff00fff0 - .long 0x00000c1e @ mmuflags + .long PMD_TYPE_SECT | \ + PMD_SECT_BUFFERABLE | \ + PMD_SECT_CACHEABLE | \ + PMD_BIT4 | \ + PMD_SECT_AP_WRITE | \ + PMD_SECT_AP_READ b __arm920_setup .long cpu_arch_name .long cpu_elf_name diff -Nru a/arch/arm/mm/proc-arm922.S b/arch/arm/mm/proc-arm922.S --- a/arch/arm/mm/proc-arm922.S 2005-01-02 23:03:35 -08:00 +++ b/arch/arm/mm/proc-arm922.S 2005-01-02 23:03:35 -08:00 @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -387,7 +388,10 @@ mcr p15, 0, r0, c7, c10, 4 @ drain write buffer on v4 mcr p15, 0, r0, c8, c7 @ invalidate I,D TLBs on v4 mcr p15, 0, r4, c2, c0 @ load page table pointer - mov r0, #0x1f @ Domains 0, 1 = client + mov r0, #(domain_val(DOMAIN_USER, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_KERNEL, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_TABLE, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_IO, DOMAIN_CLIENT)) mcr p15, 0, r0, c3, c0 @ load domain access register mrc p15, 0, r0, c1, c0 @ get control register v4 /* @@ -468,7 +472,12 @@ __arm922_proc_info: .long 0x41009220 .long 0xff00fff0 - .long 0x00000c1e @ mmuflags + .long PMD_TYPE_SECT | \ + PMD_SECT_BUFFERABLE | \ + PMD_SECT_CACHEABLE | \ + PMD_BIT4 | \ + PMD_SECT_AP_WRITE | \ + PMD_SECT_AP_READ b __arm922_setup .long cpu_arch_name .long cpu_elf_name diff -Nru a/arch/arm/mm/proc-arm925.S b/arch/arm/mm/proc-arm925.S --- a/arch/arm/mm/proc-arm925.S 2005-01-02 23:03:34 -08:00 +++ b/arch/arm/mm/proc-arm925.S 2005-01-02 23:03:34 -08:00 @@ -52,6 +52,7 @@ #include #include #include +#include #include #include #include @@ -446,7 +447,10 @@ mcr p15, 7, r0, c15, c0, 0 #endif - mov r0, #0x1f @ Domains 0, 1 = client + mov r0, #(domain_val(DOMAIN_USER, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_KERNEL, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_TABLE, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_IO, DOMAIN_CLIENT)) mcr p15, 0, r0, c3, c0 @ load domain access register mrc p15, 0, r0, c1, c0 @ get control register v4 /* @@ -536,7 +540,10 @@ __arm925_proc_info: .long 0x54029250 .long 0xfffffff0 - .long 0x00000c12 @ mmuflags + .long PMD_TYPE_SECT | \ + PMD_BIT4 | \ + PMD_SECT_AP_WRITE | \ + PMD_SECT_AP_READ b __arm925_setup .long cpu_arch_name .long cpu_elf_name @@ -552,7 +559,10 @@ __arm915_proc_info: .long 0x54029150 .long 0xfffffff0 - .long 0x00000c12 @ mmuflags + .long PMD_TYPE_SECT | \ + PMD_BIT4 | \ + PMD_SECT_AP_WRITE | \ + PMD_SECT_AP_READ b __arm925_setup .long cpu_arch_name .long cpu_elf_name diff -Nru a/arch/arm/mm/proc-arm926.S b/arch/arm/mm/proc-arm926.S --- a/arch/arm/mm/proc-arm926.S 2005-01-02 23:03:34 -08:00 +++ b/arch/arm/mm/proc-arm926.S 2005-01-02 23:03:34 -08:00 @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -396,7 +397,10 @@ mcr p15, 7, r0, c15, c0, 0 #endif - mov r0, #0x1f @ Domains 0, 1 = client + mov r0, #(domain_val(DOMAIN_USER, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_KERNEL, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_TABLE, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_IO, DOMAIN_CLIENT)) mcr p15, 0, r0, c3, c0 @ load domain access register mrc p15, 0, r0, c1, c0 @ get control register v4 /* @@ -483,7 +487,12 @@ __arm926_proc_info: .long 0x41069260 @ ARM926EJ-S (v5TEJ) .long 0xff0ffff0 - .long 0x00000c1e @ mmuflags + .long PMD_TYPE_SECT | \ + PMD_SECT_BUFFERABLE | \ + PMD_SECT_CACHEABLE | \ + PMD_BIT4 | \ + PMD_SECT_AP_WRITE | \ + PMD_SECT_AP_READ b __arm926_setup .long cpu_arch_name .long cpu_elf_name diff -Nru a/arch/arm/mm/proc-sa110.S b/arch/arm/mm/proc-sa110.S --- a/arch/arm/mm/proc-sa110.S 2005-01-02 23:03:34 -08:00 +++ b/arch/arm/mm/proc-sa110.S 2005-01-02 23:03:34 -08:00 @@ -19,6 +19,7 @@ #include #include #include +#include #include /* @@ -196,7 +197,10 @@ mcr p15, 0, r10, c7, c10, 4 @ drain write buffer on v4 mcr p15, 0, r10, c8, c7 @ invalidate I,D TLBs on v4 mcr p15, 0, r4, c2, c0 @ load page table pointer - mov r10, #0x1f @ Domains 0, 1 = client + mov r10, #(domain_val(DOMAIN_USER, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_KERNEL, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_TABLE, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_IO, DOMAIN_CLIENT)) mcr p15, 0, r10, c3, c0 @ load domain access register mov pc, lr .size __sa110_setup, . - __sa110_setup @@ -245,7 +249,11 @@ __sa110_proc_info: .long 0x4401a100 .long 0xfffffff0 - .long 0x00000c0e + .long PMD_TYPE_SECT | \ + PMD_SECT_BUFFERABLE | \ + PMD_SECT_CACHEABLE | \ + PMD_SECT_AP_WRITE | \ + PMD_SECT_AP_READ b __sa110_setup .long cpu_arch_name .long cpu_elf_name diff -Nru a/arch/arm/mm/proc-sa1100.S b/arch/arm/mm/proc-sa1100.S --- a/arch/arm/mm/proc-sa1100.S 2005-01-02 23:03:34 -08:00 +++ b/arch/arm/mm/proc-sa1100.S 2005-01-02 23:03:34 -08:00 @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -213,7 +214,10 @@ mcr p15, 0, r10, c7, c7 @ invalidate I,D caches on v4 mcr p15, 0, r10, c7, c10, 4 @ drain write buffer on v4 mcr p15, 0, r10, c8, c7 @ invalidate I,D TLBs on v4 - mov r0, #0x1f @ Domains 0, 1 = client + mov r0, #(domain_val(DOMAIN_USER, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_KERNEL, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_TABLE, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_IO, DOMAIN_CLIENT)) mcr p15, 0, r0, c3, c0 @ load domain access register mcr p15, 0, r4, c2, c0 @ load page table pointer mrc p15, 0, r0, c1, c0 @ get control register v4 @@ -276,7 +280,11 @@ __sa1100_proc_info: .long 0x4401a110 .long 0xfffffff0 - .long 0x00000c0e + .long PMD_TYPE_SECT | \ + PMD_SECT_BUFFERABLE | \ + PMD_SECT_CACHEABLE | \ + PMD_SECT_AP_WRITE | \ + PMD_SECT_AP_READ b __sa1100_setup .long cpu_arch_name .long cpu_elf_name @@ -292,7 +300,11 @@ __sa1110_proc_info: .long 0x6901b110 .long 0xfffffff0 - .long 0x00000c0e + .long PMD_TYPE_SECT | \ + PMD_SECT_BUFFERABLE | \ + PMD_SECT_CACHEABLE | \ + PMD_SECT_AP_WRITE | \ + PMD_SECT_AP_READ b __sa1100_setup .long cpu_arch_name .long cpu_elf_name diff -Nru a/arch/arm/mm/proc-v6.S b/arch/arm/mm/proc-v6.S --- a/arch/arm/mm/proc-v6.S 2005-01-02 23:03:32 -08:00 +++ b/arch/arm/mm/proc-v6.S 2005-01-02 23:03:32 -08:00 @@ -14,6 +14,7 @@ #include #include #include +#include #include "proc-macros.S" @@ -198,7 +199,10 @@ mcr p15, 0, r10, c2, c0, 2 @ TTB control register mcr p15, 0, r4, c2, c0, 0 @ load TTB0 mcr p15, 0, r4, c2, c0, 1 @ load TTB1 - mov r10, #0x1f @ domains 0, 1 = manager + mov r10, #(domain_val(DOMAIN_USER, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_KERNEL, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_TABLE, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_IO, DOMAIN_CLIENT)) mcr p15, 0, r10, c3, c0, 0 @ load domain access register mrc p15, 0, r0, c1, c0, 0 @ read control register #ifdef CONFIG_VFP @@ -257,7 +261,11 @@ __v6_proc_info: .long 0x0007b000 .long 0x0007f000 - .long 0x00000c0e + .long PMD_TYPE_SECT | \ + PMD_SECT_BUFFERABLE | \ + PMD_SECT_CACHEABLE | \ + PMD_SECT_AP_WRITE | \ + PMD_SECT_AP_READ b __v6_setup .long cpu_arch_name .long cpu_elf_name diff -Nru a/arch/arm/mm/proc-xscale.S b/arch/arm/mm/proc-xscale.S --- a/arch/arm/mm/proc-xscale.S 2005-01-02 23:03:34 -08:00 +++ b/arch/arm/mm/proc-xscale.S 2005-01-02 23:03:34 -08:00 @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include "proc-macros.S" @@ -600,7 +601,10 @@ mcr p15, 0, ip, c7, c10, 4 @ Drain Write (& Fill) Buffer mcr p15, 0, ip, c8, c7, 0 @ invalidate I, D TLBs mcr p15, 0, r4, c2, c0, 0 @ load page table pointer - mov r0, #0x1f @ Domains 0, 1 = client + mov r0, #(domain_val(DOMAIN_USER, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_KERNEL, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_TABLE, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_IO, DOMAIN_CLIENT)) mcr p15, 0, r0, c3, c0, 0 @ load domain access register #ifdef CONFIG_IWMMXT mov r0, #0 @ initially disallow access to CP0/CP1 @@ -712,7 +716,11 @@ __80200_proc_info: .long 0x69052000 .long 0xfffffff0 - .long 0x00000c0e + .long PMD_TYPE_SECT | \ + PMD_SECT_BUFFERABLE | \ + PMD_SECT_CACHEABLE | \ + PMD_SECT_AP_WRITE | \ + PMD_SECT_AP_READ b __xscale_setup .long cpu_arch_name .long cpu_elf_name @@ -728,7 +736,11 @@ __8032x_proc_info: .long 0x69052420 .long 0xfffff5e0 @ mask should accomodate IOP80219 also - .long 0x00000c0e + .long PMD_TYPE_SECT | \ + PMD_SECT_BUFFERABLE | \ + PMD_SECT_CACHEABLE | \ + PMD_SECT_AP_WRITE | \ + PMD_SECT_AP_READ b __xscale_setup .long cpu_arch_name .long cpu_elf_name @@ -744,7 +756,11 @@ __8033x_proc_info: .long 0x69054090 .long 0xffffffb0 - .long 0x00000c0e + .long PMD_TYPE_SECT | \ + PMD_SECT_BUFFERABLE | \ + PMD_SECT_CACHEABLE | \ + PMD_SECT_AP_WRITE | \ + PMD_SECT_AP_READ b __xscale_setup .long cpu_arch_name .long cpu_elf_name @@ -760,7 +776,11 @@ __pxa250_proc_info: .long 0x69052100 .long 0xfffff7f0 - .long 0x00000c0e + .long PMD_TYPE_SECT | \ + PMD_SECT_BUFFERABLE | \ + PMD_SECT_CACHEABLE | \ + PMD_SECT_AP_WRITE | \ + PMD_SECT_AP_READ b __xscale_setup .long cpu_arch_name .long cpu_elf_name @@ -776,7 +796,11 @@ __pxa210_proc_info: .long 0x69052120 .long 0xfffff3f0 - .long 0x00000c0e + .long PMD_TYPE_SECT | \ + PMD_SECT_BUFFERABLE | \ + PMD_SECT_CACHEABLE | \ + PMD_SECT_AP_WRITE | \ + PMD_SECT_AP_READ b __xscale_setup .long cpu_arch_name .long cpu_elf_name @@ -792,7 +816,11 @@ __ixp2400_proc_info: .long 0x69054190 .long 0xfffffff0 - .long 0x00000c0e + .long PMD_TYPE_SECT | \ + PMD_SECT_BUFFERABLE | \ + PMD_SECT_CACHEABLE | \ + PMD_SECT_AP_WRITE | \ + PMD_SECT_AP_READ b __xscale_setup .long cpu_arch_name .long cpu_elf_name @@ -808,7 +836,11 @@ __ixp2800_proc_info: .long 0x690541a0 .long 0xfffffff0 - .long 0x00000c0e + .long PMD_TYPE_SECT | \ + PMD_SECT_BUFFERABLE | \ + PMD_SECT_CACHEABLE | \ + PMD_SECT_AP_WRITE | \ + PMD_SECT_AP_READ b __xscale_setup .long cpu_arch_name .long cpu_elf_name @@ -824,7 +856,11 @@ __ixp42x_proc_info: .long 0x690541c0 .long 0xffffffc0 - .long 0x00000c0e + .long PMD_TYPE_SECT | \ + PMD_SECT_BUFFERABLE | \ + PMD_SECT_CACHEABLE | \ + PMD_SECT_AP_WRITE | \ + PMD_SECT_AP_READ b __xscale_setup .long cpu_arch_name .long cpu_elf_name @@ -856,7 +892,11 @@ __pxa255_proc_info: .long 0x69052d00 .long 0xfffffff0 - .long 0x00000c0e + .long PMD_TYPE_SECT | \ + PMD_SECT_BUFFERABLE | \ + PMD_SECT_CACHEABLE | \ + PMD_SECT_AP_WRITE | \ + PMD_SECT_AP_READ b __xscale_setup .long cpu_arch_name .long cpu_elf_name @@ -872,7 +912,11 @@ __pxa270_proc_info: .long 0x69054110 .long 0xfffffff0 - .long 0x00000c0e + .long PMD_TYPE_SECT | \ + PMD_SECT_BUFFERABLE | \ + PMD_SECT_CACHEABLE | \ + PMD_SECT_AP_WRITE | \ + PMD_SECT_AP_READ b __xscale_setup .long cpu_arch_name .long cpu_elf_name diff -Nru a/arch/i386/defconfig b/arch/i386/defconfig --- a/arch/i386/defconfig 2005-01-02 23:03:34 -08:00 +++ b/arch/i386/defconfig 2005-01-02 23:03:34 -08:00 @@ -534,7 +534,6 @@ CONFIG_IP_NF_TARGET_REDIRECT=y CONFIG_IP_NF_TARGET_NETMAP=y CONFIG_IP_NF_TARGET_SAME=y -# CONFIG_IP_NF_NAT_LOCAL is not set # CONFIG_IP_NF_NAT_SNMP_BASIC is not set CONFIG_IP_NF_MANGLE=y CONFIG_IP_NF_TARGET_TOS=y diff -Nru a/arch/i386/kernel/acpi/boot.c b/arch/i386/kernel/acpi/boot.c --- a/arch/i386/kernel/acpi/boot.c 2005-01-02 23:03:34 -08:00 +++ b/arch/i386/kernel/acpi/boot.c 2005-01-02 23:03:34 -08:00 @@ -484,6 +484,28 @@ } EXPORT_SYMBOL(acpi_register_gsi); +/* + * ACPI based hotplug support for CPU + */ +#ifdef CONFIG_ACPI_HOTPLUG_CPU +int +acpi_map_lsapic(acpi_handle handle, int *pcpu) +{ + /* TBD */ + return -EINVAL; +} +EXPORT_SYMBOL(acpi_map_lsapic); + + +int +acpi_unmap_lsapic(int cpu) +{ + /* TBD */ + return -EINVAL; +} +EXPORT_SYMBOL(acpi_unmap_lsapic); +#endif /* CONFIG_ACPI_HOTPLUG_CPU */ + static unsigned long __init acpi_scan_rsdp ( unsigned long start, diff -Nru a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c --- a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c 2005-01-02 23:03:33 -08:00 +++ b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c 2005-01-02 23:03:33 -08:00 @@ -249,7 +249,7 @@ /* Matched a non-match */ printk(KERN_INFO PFX "no table support for CPU model \"%s\": \n", cpu->x86_model_id); -#ifdef CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI +#ifndef CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI printk(KERN_INFO PFX "try compiling with CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI enabled\n"); #endif return -ENOENT; diff -Nru a/arch/i386/kernel/dmi_scan.c b/arch/i386/kernel/dmi_scan.c --- a/arch/i386/kernel/dmi_scan.c 2005-01-02 23:03:35 -08:00 +++ b/arch/i386/kernel/dmi_scan.c 2005-01-02 23:03:35 -08:00 @@ -102,11 +102,10 @@ static int __init dmi_iterate(void (*decode)(struct dmi_header *)) { u8 buf[15]; - u32 fp=0xF0000; + char __iomem *p, *q; - while (fp < 0xFFFFF) - { - isa_memcpy_fromio(buf, fp, 15); + for (p = q = ioremap(0xF0000, 0x10000); q < p + 0x10000; q += 16) { + memcpy_fromio(buf, q, 15); if(memcmp(buf, "_DMI_", 5)==0 && dmi_checksum(buf)) { u16 num=buf[13]<<8|buf[12]; @@ -126,11 +125,13 @@ num, len)); dmi_printk((KERN_INFO "DMI table at 0x%08X.\n", base)); - if(dmi_table(base,len, num, decode)==0) + if(dmi_table(base,len, num, decode)==0) { + iounmap(p); return 0; + } } - fp+=16; } + iounmap(p); return -1; } diff -Nru a/arch/i386/kernel/i386_ksyms.c b/arch/i386/kernel/i386_ksyms.c --- a/arch/i386/kernel/i386_ksyms.c 2005-01-02 23:03:35 -08:00 +++ b/arch/i386/kernel/i386_ksyms.c 2005-01-02 23:03:35 -08:00 @@ -61,7 +61,6 @@ /* platform dependent support */ EXPORT_SYMBOL(boot_cpu_data); -EXPORT_SYMBOL(MCA_bus); #ifdef CONFIG_DISCONTIGMEM EXPORT_SYMBOL(node_data); EXPORT_SYMBOL(physnode_map); diff -Nru a/arch/i386/kernel/mca.c b/arch/i386/kernel/mca.c --- a/arch/i386/kernel/mca.c 2005-01-02 23:03:34 -08:00 +++ b/arch/i386/kernel/mca.c 2005-01-02 23:03:34 -08:00 @@ -56,13 +56,16 @@ static unsigned char which_scsi = 0; +int MCA_bus = 0; +EXPORT_SYMBOL(MCA_bus); + /* * Motherboard register spinlock. Untested on SMP at the moment, but * are there any MCA SMP boxes? * * Yes - Alan */ -spinlock_t mca_lock = SPIN_LOCK_UNLOCKED; +static spinlock_t mca_lock = SPIN_LOCK_UNLOCKED; /* Build the status info for the adapter */ @@ -119,7 +122,7 @@ /*--------------------------------------------------------------------*/ -struct resource mca_standard_resources[] = { +static struct resource mca_standard_resources[] = { { "system control port B (MCA)", 0x60, 0x60 }, { "arbitration (MCA)", 0x90, 0x90 }, { "card Select Feedback (MCA)", 0x91, 0x91 }, diff -Nru a/arch/i386/kernel/microcode.c b/arch/i386/kernel/microcode.c --- a/arch/i386/kernel/microcode.c 2005-01-02 23:03:33 -08:00 +++ b/arch/i386/kernel/microcode.c 2005-01-02 23:03:33 -08:00 @@ -364,7 +364,7 @@ struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num; if (uci->mc == NULL) { - printk(KERN_INFO "microcode: No suitable data for CPU%d\n", cpu_num); + printk(KERN_INFO "microcode: No new microcode data for CPU%d\n", cpu_num); return; } diff -Nru a/arch/i386/kernel/ptrace.c b/arch/i386/kernel/ptrace.c --- a/arch/i386/kernel/ptrace.c 2005-01-02 23:03:33 -08:00 +++ b/arch/i386/kernel/ptrace.c 2005-01-02 23:03:33 -08:00 @@ -42,6 +42,12 @@ */ #define EFL_OFFSET ((EFL-2)*4-sizeof(struct pt_regs)) +static inline struct pt_regs *get_child_regs(struct task_struct *task) +{ + void *stack_top = (void *)task->thread.esp0; + return stack_top - sizeof(struct pt_regs); +} + /* * this routine will get a word off of the processes privileged stack. * the offset is how far from the base addr as stored in the TSS. @@ -138,24 +144,119 @@ return retval; } +#define LDT_SEGMENT 4 + +static unsigned long convert_eip_to_linear(struct task_struct *child, struct pt_regs *regs) +{ + unsigned long addr, seg; + + addr = regs->eip; + seg = regs->xcs & 0xffff; + if (regs->eflags & VM_MASK) { + addr = (addr & 0xffff) + (seg << 4); + return addr; + } + + /* + * We'll assume that the code segments in the GDT + * are all zero-based. That is largely true: the + * TLS segments are used for data, and the PNPBIOS + * and APM bios ones we just ignore here. + */ + if (seg & LDT_SEGMENT) { + u32 *desc; + unsigned long base; + + down(&child->mm->context.sem); + desc = child->mm->context.ldt + (seg & ~7); + base = (desc[0] >> 16) | ((desc[1] & 0xff) << 16) | (desc[1] & 0xff000000); + + /* 16-bit code segment? */ + if (!((desc[1] >> 22) & 1)) + addr &= 0xffff; + addr += base; + up(&child->mm->context.sem); + } + return addr; +} + +static inline int is_at_popf(struct task_struct *child, struct pt_regs *regs) +{ + int i, copied; + unsigned char opcode[16]; + unsigned long addr = convert_eip_to_linear(child, regs); + + copied = access_process_vm(child, addr, opcode, sizeof(opcode), 0); + for (i = 0; i < copied; i++) { + switch (opcode[i]) { + /* popf */ + case 0x9d: + return 1; + /* opcode and address size prefixes */ + case 0x66: case 0x67: + continue; + /* irrelevant prefixes (segment overrides and repeats) */ + case 0x26: case 0x2e: + case 0x36: case 0x3e: + case 0x64: case 0x65: + case 0xf0: case 0xf2: case 0xf3: + continue; + + /* + * pushf: NOTE! We should probably not let + * the user see the TF bit being set. But + * it's more pain than it's worth to avoid + * it, and a debugger could emulate this + * all in user space if it _really_ cares. + */ + case 0x9c: + default: + return 0; + } + } + return 0; +} + static void set_singlestep(struct task_struct *child) { - long eflags; + struct pt_regs *regs = get_child_regs(child); + /* + * Always set TIF_SINGLESTEP - this guarantees that + * we single-step system calls etc.. This will also + * cause us to set TF when returning to user mode. + */ set_tsk_thread_flag(child, TIF_SINGLESTEP); - eflags = get_stack_long(child, EFL_OFFSET); - put_stack_long(child, EFL_OFFSET, eflags | TRAP_FLAG); + + /* + * If TF was already set, don't do anything else + */ + if (regs->eflags & TRAP_FLAG) + return; + + /* Set TF on the kernel stack.. */ + regs->eflags |= TRAP_FLAG; + + /* + * ..but if TF is changed by the instruction we will trace, + * don't mark it as being "us" that set it, so that we + * won't clear it by hand later. + */ + if (is_at_popf(child, regs)) + return; + child->ptrace |= PT_DTRACE; } static void clear_singlestep(struct task_struct *child) { - if (child->ptrace & PT_DTRACE) { - long eflags; + /* Always clear TIF_SINGLESTEP... */ + clear_tsk_thread_flag(child, TIF_SINGLESTEP); - clear_tsk_thread_flag(child, TIF_SINGLESTEP); - eflags = get_stack_long(child, EFL_OFFSET); - put_stack_long(child, EFL_OFFSET, eflags & ~TRAP_FLAG); + /* But touch TF only if it was set by us.. */ + if (child->ptrace & PT_DTRACE) { + struct pt_regs *regs = get_child_regs(child); + regs->eflags &= ~TRAP_FLAG; child->ptrace &= ~PT_DTRACE; } } @@ -553,6 +654,24 @@ return ret; } +void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code) +{ + struct siginfo info; + + tsk->thread.trap_no = 1; + tsk->thread.error_code = error_code; + + memset(&info, 0, sizeof(info)); + info.si_signo = SIGTRAP; + info.si_code = TRAP_BRKPT; + + /* User-mode eip? */ + info.si_addr = user_mode(regs) ? (void __user *) regs->eip : NULL; + + /* Send us the fakey SIGTRAP */ + force_sig_info(SIGTRAP, &info, tsk); +} + /* notification of system call entry/exit * - triggered by current->work.syscall_trace */ @@ -568,15 +687,19 @@ audit_syscall_exit(current, regs->eax); } - if (!test_thread_flag(TIF_SYSCALL_TRACE) && - !test_thread_flag(TIF_SINGLESTEP)) - return; if (!(current->ptrace & PT_PTRACED)) return; + + /* Fake a debug trap */ + if (test_thread_flag(TIF_SINGLESTEP)) + send_sigtrap(current, regs, 0); + + if (!test_thread_flag(TIF_SYSCALL_TRACE)) + return; + /* the 0x80 provides a way for the tracing parent to distinguish between a syscall stop and SIGTRAP delivery */ - ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) && - !test_thread_flag(TIF_SINGLESTEP) ? 0x80 : 0)); + ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) ? 0x80 : 0)); /* * this isn't the same as continuing with a signal, but it will do diff -Nru a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c --- a/arch/i386/kernel/setup.c 2005-01-02 23:03:34 -08:00 +++ b/arch/i386/kernel/setup.c 2005-01-02 23:03:34 -08:00 @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -87,7 +88,6 @@ extern acpi_interrupt_flags acpi_sci_flags; #endif -int MCA_bus; /* for MCA, but anyone else can use it if they want */ unsigned int machine_id; unsigned int machine_submodel_id; @@ -1288,6 +1288,15 @@ static char * __init machine_specific_memory_setup(void); +#ifdef CONFIG_MCA +static void set_mca_bus(int x) +{ + MCA_bus = x; +} +#else +static void set_mca_bus(int x) { } +#endif + /* * Determine if we were loaded by an EFI loader. If so, then we have also been * passed the efi memmap, systab, etc., so we should use these data structures @@ -1323,7 +1332,7 @@ ist_info = IST_INFO; saved_videomode = VIDEO_MODE; if( SYS_DESC_TABLE.length != 0 ) { - MCA_bus = SYS_DESC_TABLE.table[3] &0x2; + set_mca_bus(SYS_DESC_TABLE.table[3] & 0x2); machine_id = SYS_DESC_TABLE.table[0]; machine_submodel_id = SYS_DESC_TABLE.table[1]; BIOS_revision = SYS_DESC_TABLE.table[2]; diff -Nru a/arch/i386/kernel/signal.c b/arch/i386/kernel/signal.c --- a/arch/i386/kernel/signal.c 2005-01-02 23:03:34 -08:00 +++ b/arch/i386/kernel/signal.c 2005-01-02 23:03:34 -08:00 @@ -270,7 +270,6 @@ struct pt_regs *regs, unsigned long mask) { int tmp, err = 0; - unsigned long eflags; tmp = 0; __asm__("movl %%gs,%0" : "=r"(tmp): "0"(tmp)); @@ -292,16 +291,7 @@ err |= __put_user(current->thread.error_code, &sc->err); err |= __put_user(regs->eip, &sc->eip); err |= __put_user(regs->xcs, (unsigned int __user *)&sc->cs); - - /* - * Iff TF was set because the program is being single-stepped by a - * debugger, don't save that information on the signal stack.. We - * don't want debugging to change state. - */ - eflags = regs->eflags; - if (current->ptrace & PT_DTRACE) - eflags &= ~TF_MASK; - err |= __put_user(eflags, &sc->eflags); + err |= __put_user(regs->eflags, &sc->eflags); err |= __put_user(regs->esp, &sc->esp_at_signal); err |= __put_user(regs->xss, (unsigned int __user *)&sc->ss); @@ -424,11 +414,9 @@ * The tracer may want to single-step inside the * handler too. */ - if (regs->eflags & TF_MASK) { - regs->eflags &= ~TF_MASK; - if (current->ptrace & PT_DTRACE) - ptrace_notify(SIGTRAP); - } + regs->eflags &= ~TF_MASK; + if (test_thread_flag(TIF_SINGLESTEP)) + ptrace_notify(SIGTRAP); #if DEBUG_SIG printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n", @@ -519,11 +507,9 @@ * The tracer may want to single-step inside the * handler too. */ - if (regs->eflags & TF_MASK) { - regs->eflags &= ~TF_MASK; - if (current->ptrace & PT_DTRACE) - ptrace_notify(SIGTRAP); - } + regs->eflags &= ~TF_MASK; + if (test_thread_flag(TIF_SINGLESTEP)) + ptrace_notify(SIGTRAP); #if DEBUG_SIG printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n", diff -Nru a/arch/i386/kernel/time.c b/arch/i386/kernel/time.c --- a/arch/i386/kernel/time.c 2005-01-02 23:03:34 -08:00 +++ b/arch/i386/kernel/time.c 2005-01-02 23:03:34 -08:00 @@ -45,6 +45,7 @@ #include #include #include +#include #include #include @@ -261,8 +262,7 @@ last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */ } -#ifdef CONFIG_MCA - if( MCA_bus ) { + if (MCA_bus) { /* The PS/2 uses level-triggered interrupts. You can't turn them off, nor would you want to (any attempt to enable edge-triggered interrupts usually gets intercepted by a @@ -275,7 +275,6 @@ irq = inb_p( 0x61 ); /* read the current state */ outb_p( irq|0x80, 0x61 ); /* reset the IRQ */ } -#endif } /* diff -Nru a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c --- a/arch/i386/kernel/traps.c 2005-01-02 23:03:33 -08:00 +++ b/arch/i386/kernel/traps.c 2005-01-02 23:03:33 -08:00 @@ -682,7 +682,6 @@ { unsigned int condition; struct task_struct *tsk = current; - siginfo_t info; __asm__ __volatile__("movl %%db6,%0" : "=r" (condition)); @@ -705,36 +704,29 @@ /* Save debug status register where ptrace can see it */ tsk->thread.debugreg[6] = condition; - /* Mask out spurious TF errors due to lazy TF clearing */ + /* + * Single-stepping through TF: make sure we ignore any events in + * kernel space (but re-enable TF when returning to user mode). + * And if the event was due to a debugger (PT_DTRACE), clear the + * TF flag so that register information is correct. + */ if (condition & DR_STEP) { /* - * The TF error should be masked out only if the current - * process is not traced and if the TRAP flag has been set - * previously by a tracing process (condition detected by - * the PT_DTRACE flag); remember that the i386 TRAP flag - * can be modified by the process itself in user mode, - * allowing programs to debug themselves without the ptrace() - * interface. + * We already checked v86 mode above, so we can + * check for kernel mode by just checking the CPL + * of CS. */ if ((regs->xcs & 3) == 0) goto clear_TF_reenable; - if ((tsk->ptrace & (PT_DTRACE|PT_PTRACED)) == PT_DTRACE) - goto clear_TF; + + if (likely(tsk->ptrace & PT_DTRACE)) { + tsk->ptrace &= ~PT_DTRACE; + regs->eflags &= ~TF_MASK; + } } /* Ok, finally something we can handle */ - tsk->thread.trap_no = 1; - tsk->thread.error_code = error_code; - info.si_signo = SIGTRAP; - info.si_errno = 0; - info.si_code = TRAP_BRKPT; - - /* If this is a kernel mode trap, save the user PC on entry to - * the kernel, that's what the debugger can make sense of. - */ - info.si_addr = ((regs->xcs & 3) == 0) ? (void __user *)tsk->thread.eip - : (void __user *)regs->eip; - force_sig_info(SIGTRAP, &info, tsk); + send_sigtrap(tsk, regs, error_code); /* Disable additional traps. They'll be re-enabled when * the signal is delivered. @@ -751,7 +743,6 @@ clear_TF_reenable: set_tsk_thread_flag(tsk, TIF_SINGLESTEP); -clear_TF: regs->eflags &= ~TF_MASK; return; } @@ -1004,9 +995,11 @@ void __init trap_init(void) { #ifdef CONFIG_EISA - if (isa_readl(0x0FFFD9) == 'E'+('I'<<8)+('S'<<16)+('A'<<24)) { + void __iomem *p = ioremap(0x0FFFD9, 4); + if (readl(p) == 'E'+('I'<<8)+('S'<<16)+('A'<<24)) { EISA_bus = 1; } + iounmap(p); #endif #ifdef CONFIG_X86_LOCAL_APIC diff -Nru a/arch/i386/kernel/vm86.c b/arch/i386/kernel/vm86.c --- a/arch/i386/kernel/vm86.c 2005-01-02 23:03:33 -08:00 +++ b/arch/i386/kernel/vm86.c 2005-01-02 23:03:33 -08:00 @@ -137,6 +137,7 @@ static void mark_screen_rdonly(struct task_struct * tsk) { pgd_t *pgd; + pud_t *pud; pmd_t *pmd; pte_t *pte, *mapped; int i; @@ -151,7 +152,15 @@ pgd_clear(pgd); goto out; } - pmd = pmd_offset(pgd, 0xA0000); + pud = pud_offset(pgd, 0xA0000); + if (pud_none(*pud)) + goto out; + if (pud_bad(*pud)) { + pud_ERROR(*pud); + pud_clear(pud); + goto out; + } + pmd = pmd_offset(pud, 0xA0000); if (pmd_none(*pmd)) goto out; if (pmd_bad(*pmd)) { diff -Nru a/arch/i386/mach-default/topology.c b/arch/i386/mach-default/topology.c --- a/arch/i386/mach-default/topology.c 2005-01-02 23:03:34 -08:00 +++ b/arch/i386/mach-default/topology.c 2005-01-02 23:03:34 -08:00 @@ -32,6 +32,37 @@ struct i386_cpu cpu_devices[NR_CPUS]; +int arch_register_cpu(int num){ + struct node *parent = NULL; + +#ifdef CONFIG_NUMA + int node = cpu_to_node(num); + if (node_online(node)) + parent = &node_devices[node].node; +#endif /* CONFIG_NUMA */ + + return register_cpu(&cpu_devices[num].cpu, num, parent); +} + +#ifdef CONFIG_HOTPLUG_CPU + +void arch_unregister_cpu(int num) { + struct node *parent = NULL; + +#ifdef CONFIG_NUMA + int node = cpu_to_node(num); + if (node_online(node)) + parent = &node_devices[node].node; +#endif /* CONFIG_NUMA */ + + return unregister_cpu(&cpu_devices[num].cpu, parent); +} +EXPORT_SYMBOL(arch_register_cpu); +EXPORT_SYMBOL(arch_unregister_cpu); +#endif /*CONFIG_HOTPLUG_CPU*/ + + + #ifdef CONFIG_NUMA #include #include diff -Nru a/arch/i386/mm/fault.c b/arch/i386/mm/fault.c --- a/arch/i386/mm/fault.c 2005-01-02 23:03:32 -08:00 +++ b/arch/i386/mm/fault.c 2005-01-02 23:03:32 -08:00 @@ -518,6 +518,7 @@ int index = pgd_index(address); unsigned long pgd_paddr; pgd_t *pgd, *pgd_k; + pud_t *pud, *pud_k; pmd_t *pmd, *pmd_k; pte_t *pte_k; @@ -530,11 +531,17 @@ /* * set_pgd(pgd, *pgd_k); here would be useless on PAE - * and redundant with the set_pmd() on non-PAE. + * and redundant with the set_pmd() on non-PAE. As would + * set_pud. */ - pmd = pmd_offset(pgd, address); - pmd_k = pmd_offset(pgd_k, address); + pud = pud_offset(pgd, address); + pud_k = pud_offset(pgd_k, address); + if (!pud_present(*pud_k)) + goto no_context; + + pmd = pmd_offset(pud, address); + pmd_k = pmd_offset(pud_k, address); if (!pmd_present(*pmd_k)) goto no_context; set_pmd(pmd, *pmd_k); diff -Nru a/arch/i386/mm/hugetlbpage.c b/arch/i386/mm/hugetlbpage.c --- a/arch/i386/mm/hugetlbpage.c 2005-01-02 23:03:35 -08:00 +++ b/arch/i386/mm/hugetlbpage.c 2005-01-02 23:03:35 -08:00 @@ -21,20 +21,24 @@ static pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr) { pgd_t *pgd; + pud_t *pud; pmd_t *pmd = NULL; pgd = pgd_offset(mm, addr); - pmd = pmd_alloc(mm, pgd, addr); + pud = pud_alloc(mm, pgd, addr); + pmd = pmd_alloc(mm, pud, addr); return (pte_t *) pmd; } static pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr) { pgd_t *pgd; + pud_t *pud; pmd_t *pmd = NULL; pgd = pgd_offset(mm, addr); - pmd = pmd_offset(pgd, addr); + pud = pud_offset(pgd, addr); + pmd = pmd_offset(pud, addr); return (pte_t *) pmd; } diff -Nru a/arch/i386/mm/init.c b/arch/i386/mm/init.c --- a/arch/i386/mm/init.c 2005-01-02 23:03:34 -08:00 +++ b/arch/i386/mm/init.c 2005-01-02 23:03:34 -08:00 @@ -54,15 +54,18 @@ */ static pmd_t * __init one_md_table_init(pgd_t *pgd) { + pud_t *pud; pmd_t *pmd_table; #ifdef CONFIG_X86_PAE pmd_table = (pmd_t *) alloc_bootmem_low_pages(PAGE_SIZE); set_pgd(pgd, __pgd(__pa(pmd_table) | _PAGE_PRESENT)); - if (pmd_table != pmd_offset(pgd, 0)) + pud = pud_offset(pgd, 0); + if (pmd_table != pmd_offset(pud, 0)) BUG(); #else - pmd_table = pmd_offset(pgd, 0); + pud = pud_offset(pgd, 0); + pmd_table = pmd_offset(pud, 0); #endif return pmd_table; @@ -100,6 +103,7 @@ static void __init page_table_range_init (unsigned long start, unsigned long end, pgd_t *pgd_base) { pgd_t *pgd; + pud_t *pud; pmd_t *pmd; int pgd_idx, pmd_idx; unsigned long vaddr; @@ -112,8 +116,8 @@ for ( ; (pgd_idx < PTRS_PER_PGD) && (vaddr != end); pgd++, pgd_idx++) { if (pgd_none(*pgd)) one_md_table_init(pgd); - - pmd = pmd_offset(pgd, vaddr); + pud = pud_offset(pgd, vaddr); + pmd = pmd_offset(pud, vaddr); for (; (pmd_idx < PTRS_PER_PMD) && (vaddr != end); pmd++, pmd_idx++) { if (pmd_none(*pmd)) one_page_table_init(pmd); @@ -233,7 +237,7 @@ EXPORT_SYMBOL(kmap_pte); #define kmap_get_fixmap_pte(vaddr) \ - pte_offset_kernel(pmd_offset(pgd_offset_k(vaddr), (vaddr)), (vaddr)) + pte_offset_kernel(pmd_offset(pud_offset(pgd_offset_k(vaddr), vaddr), (vaddr)), (vaddr)) void __init kmap_init(void) { @@ -249,6 +253,7 @@ void __init permanent_kmaps_init(pgd_t *pgd_base) { pgd_t *pgd; + pud_t *pud; pmd_t *pmd; pte_t *pte; unsigned long vaddr; @@ -257,7 +262,8 @@ page_table_range_init(vaddr, vaddr + PAGE_SIZE*LAST_PKMAP, pgd_base); pgd = swapper_pg_dir + pgd_index(vaddr); - pmd = pmd_offset(pgd, vaddr); + pud = pud_offset(pgd, vaddr); + pmd = pmd_offset(pud, vaddr); pte = pte_offset_kernel(pmd, vaddr); pkmap_page_table = pte; } diff -Nru a/arch/i386/mm/ioremap.c b/arch/i386/mm/ioremap.c --- a/arch/i386/mm/ioremap.c 2005-01-02 23:03:33 -08:00 +++ b/arch/i386/mm/ioremap.c 2005-01-02 23:03:33 -08:00 @@ -80,9 +80,14 @@ BUG(); spin_lock(&init_mm.page_table_lock); do { + pud_t *pud; pmd_t *pmd; - pmd = pmd_alloc(&init_mm, dir, address); + error = -ENOMEM; + pud = pud_alloc(&init_mm, dir, address); + if (!pud) + break; + pmd = pmd_alloc(&init_mm, pud, address); if (!pmd) break; if (remap_area_pmd(pmd, address, end - address, diff -Nru a/arch/i386/mm/pageattr.c b/arch/i386/mm/pageattr.c --- a/arch/i386/mm/pageattr.c 2005-01-02 23:03:33 -08:00 +++ b/arch/i386/mm/pageattr.c 2005-01-02 23:03:33 -08:00 @@ -19,11 +19,15 @@ pte_t *lookup_address(unsigned long address) { - pgd_t *pgd = pgd_offset_k(address); + pgd_t *pgd = pgd_offset_k(address); + pud_t *pud; pmd_t *pmd; if (pgd_none(*pgd)) return NULL; - pmd = pmd_offset(pgd, address); + pud = pud_offset(pgd, address); + if (pud_none(*pud)) + return NULL; + pmd = pmd_offset(pud, address); if (pmd_none(*pmd)) return NULL; if (pmd_large(*pmd)) @@ -77,9 +81,11 @@ spin_lock_irqsave(&pgd_lock, flags); for (page = pgd_list; page; page = (struct page *)page->index) { pgd_t *pgd; + pud_t *pud; pmd_t *pmd; pgd = (pgd_t *)page_address(page) + pgd_index(address); - pmd = pmd_offset(pgd, address); + pud = pud_offset(pgd, address); + pmd = pmd_offset(pud, address); set_pte_atomic((pte_t *)pmd, pte); } spin_unlock_irqrestore(&pgd_lock, flags); @@ -92,7 +98,7 @@ static inline void revert_page(struct page *kpte_page, unsigned long address) { pte_t *linear = (pte_t *) - pmd_offset(pgd_offset(&init_mm, address), address); + pmd_offset(pud_offset(pgd_offset_k(address), address), address); set_pmd_pte(linear, address, pfn_pte((__pa(address) & LARGE_PAGE_MASK) >> PAGE_SHIFT, PAGE_KERNEL_LARGE)); diff -Nru a/arch/i386/mm/pgtable.c b/arch/i386/mm/pgtable.c --- a/arch/i386/mm/pgtable.c 2005-01-02 23:03:35 -08:00 +++ b/arch/i386/mm/pgtable.c 2005-01-02 23:03:35 -08:00 @@ -62,6 +62,7 @@ static void set_pte_pfn(unsigned long vaddr, unsigned long pfn, pgprot_t flags) { pgd_t *pgd; + pud_t *pud; pmd_t *pmd; pte_t *pte; @@ -70,7 +71,12 @@ BUG(); return; } - pmd = pmd_offset(pgd, vaddr); + pud = pud_offset(pgd, vaddr); + if (pud_none(*pud)) { + BUG(); + return; + } + pmd = pmd_offset(pud, vaddr); if (pmd_none(*pmd)) { BUG(); return; @@ -95,6 +101,7 @@ void set_pmd_pfn(unsigned long vaddr, unsigned long pfn, pgprot_t flags) { pgd_t *pgd; + pud_t *pud; pmd_t *pmd; if (vaddr & (PMD_SIZE-1)) { /* vaddr is misaligned */ @@ -110,7 +117,8 @@ printk ("set_pmd_pfn: pgd_none\n"); return; /* BUG(); */ } - pmd = pmd_offset(pgd, vaddr); + pud = pud_offset(pgd, vaddr); + pmd = pmd_offset(pud, vaddr); set_pmd(pmd, pfn_pmd(pfn, flags)); /* * It's enough to flush this one mapping. @@ -252,6 +260,6 @@ if (PTRS_PER_PMD > 1) for (i = 0; i < USER_PTRS_PER_PGD; ++i) kmem_cache_free(pmd_cache, (void *)__va(pgd_val(pgd[i])-1)); - /* in the non-PAE case, clear_page_tables() clears user pgd entries */ + /* in the non-PAE case, clear_page_range() clears user pgd entries */ kmem_cache_free(pgd_cache, pgd); } diff -Nru a/arch/i386/pci/irq.c b/arch/i386/pci/irq.c --- a/arch/i386/pci/irq.c 2005-01-02 23:03:35 -08:00 +++ b/arch/i386/pci/irq.c 2005-01-02 23:03:35 -08:00 @@ -491,6 +491,8 @@ case PCI_DEVICE_ID_INTEL_ESB_1: case PCI_DEVICE_ID_INTEL_ICH6_0: case PCI_DEVICE_ID_INTEL_ICH6_1: + case PCI_DEVICE_ID_INTEL_ICH7_0: + case PCI_DEVICE_ID_INTEL_ICH7_1: r->name = "PIIX/ICH"; r->get = pirq_piix_get; r->set = pirq_piix_set; @@ -1022,7 +1024,7 @@ int pirq_enable_irq(struct pci_dev *dev) { u8 pin; - extern int interrupt_line_quirk; + extern int via_interrupt_line_quirk; struct pci_dev *temp_dev; pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin); @@ -1080,7 +1082,7 @@ } /* VIA bridges use interrupt line for apic/pci steering across the V-Link */ - else if (interrupt_line_quirk) + else if (via_interrupt_line_quirk) pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq & 15); return 0; } diff -Nru a/arch/ia64/dig/Makefile b/arch/ia64/dig/Makefile --- a/arch/ia64/dig/Makefile 2005-01-02 23:03:34 -08:00 +++ b/arch/ia64/dig/Makefile 2005-01-02 23:03:34 -08:00 @@ -6,9 +6,4 @@ # obj-y := setup.o - -ifndef CONFIG_NUMA -obj-$(CONFIG_IA64_DIG) += topology.o -endif - obj-$(CONFIG_IA64_GENERIC) += machvec.o diff -Nru a/arch/ia64/dig/topology.c b/arch/ia64/dig/topology.c --- a/arch/ia64/dig/topology.c 2005-01-02 23:03:35 -08:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,43 +0,0 @@ -/* - * arch/ia64/dig/topology.c - * Popuate driverfs with topology information. - * Derived entirely from i386/mach-default.c - * Intel Corporation - Ashok Raj - */ -#include -#include -#include -#include -#include -#include -#include - -static DEFINE_PER_CPU(struct ia64_cpu, cpu_devices); - -/* - * First Pass: simply borrowed code for now. Later should hook into - * hotplug notification for node/cpu/memory as applicable - */ - -static int arch_register_cpu(int num) -{ - struct node *parent = NULL; - -#ifdef CONFIG_NUMA - //parent = &node_devices[cpu_to_node(num)].node; -#endif - - return register_cpu(&per_cpu(cpu_devices,num).cpu, num, parent); -} - -static int __init topology_init(void) -{ - int i; - - for_each_cpu(i) { - arch_register_cpu(i); - } - return 0; -} - -subsys_initcall(topology_init); diff -Nru a/arch/ia64/kernel/Makefile b/arch/ia64/kernel/Makefile --- a/arch/ia64/kernel/Makefile 2005-01-02 23:03:35 -08:00 +++ b/arch/ia64/kernel/Makefile 2005-01-02 23:03:35 -08:00 @@ -6,7 +6,8 @@ obj-y := acpi.o entry.o efi.o efi_stub.o gate-data.o fsys.o ia64_ksyms.o irq.o irq_ia64.o \ irq_lsapic.o ivt.o machvec.o pal.o patch.o process.o perfmon.o ptrace.o sal.o \ - salinfo.o semaphore.o setup.o signal.o sys_ia64.o time.o traps.o unaligned.o unwind.o mca.o mca_asm.o + salinfo.o semaphore.o setup.o signal.o sys_ia64.o time.o traps.o unaligned.o \ + unwind.o mca.o mca_asm.o topology.o obj-$(CONFIG_IA64_BRL_EMU) += brl_emu.o obj-$(CONFIG_IA64_GENERIC) += acpi-ext.o diff -Nru a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c --- a/arch/ia64/kernel/acpi.c 2005-01-02 23:03:34 -08:00 +++ b/arch/ia64/kernel/acpi.c 2005-01-02 23:03:34 -08:00 @@ -355,11 +355,11 @@ #define PXM_FLAG_LEN ((MAX_PXM_DOMAINS + 1)/32) static int __initdata srat_num_cpus; /* number of cpus */ -static u32 __initdata pxm_flag[PXM_FLAG_LEN]; +static u32 __devinitdata pxm_flag[PXM_FLAG_LEN]; #define pxm_bit_set(bit) (set_bit(bit,(void *)pxm_flag)) #define pxm_bit_test(bit) (test_bit(bit,(void *)pxm_flag)) /* maps to convert between proximity domain and logical node ID */ -int __initdata pxm_to_nid_map[MAX_PXM_DOMAINS]; +int __devinitdata pxm_to_nid_map[MAX_PXM_DOMAINS]; int __initdata nid_to_pxm_map[MAX_NUMNODES]; static struct acpi_table_slit __initdata *slit_table; @@ -651,6 +651,110 @@ } return 0; } + +/* + * ACPI based hotplug CPU support + */ +#ifdef CONFIG_ACPI_HOTPLUG_CPU +static +int +acpi_map_cpu2node(acpi_handle handle, int cpu, long physid) +{ +#ifdef CONFIG_ACPI_NUMA + int pxm_id; + + pxm_id = acpi_get_pxm(handle); + + /* + * Assuming that the container driver would have set the proximity + * domain and would have initialized pxm_to_nid_map[pxm_id] && pxm_flag + */ + node_cpuid[cpu].nid = (pxm_id < 0) ? 0: + pxm_to_nid_map[pxm_id]; + + node_cpuid[cpu].phys_id = physid; +#endif + return(0); +} + + +int +acpi_map_lsapic(acpi_handle handle, int *pcpu) +{ + struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; + union acpi_object *obj; + struct acpi_table_lsapic *lsapic; + cpumask_t tmp_map; + long physid; + int cpu; + + if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer))) + return -EINVAL; + + if (!buffer.length || !buffer.pointer) + return -EINVAL; + + obj = buffer.pointer; + if (obj->type != ACPI_TYPE_BUFFER || + obj->buffer.length < sizeof(*lsapic)) { + acpi_os_free(buffer.pointer); + return -EINVAL; + } + + lsapic = (struct acpi_table_lsapic *)obj->buffer.pointer; + + if ((lsapic->header.type != ACPI_MADT_LSAPIC) || + (!lsapic->flags.enabled)) { + acpi_os_free(buffer.pointer); + return -EINVAL; + } + + physid = ((lsapic->id <<8) | (lsapic->eid)); + + acpi_os_free(buffer.pointer); + buffer.length = ACPI_ALLOCATE_BUFFER; + buffer.pointer = NULL; + + cpus_complement(tmp_map, cpu_present_map); + cpu = first_cpu(tmp_map); + if(cpu >= NR_CPUS) + return -EINVAL; + + acpi_map_cpu2node(handle, cpu, physid); + + cpu_set(cpu, cpu_present_map); + ia64_cpu_to_sapicid[cpu] = physid; + ia64_acpiid_to_sapicid[lsapic->acpi_id] = ia64_cpu_to_sapicid[cpu]; + + *pcpu = cpu; + return(0); +} +EXPORT_SYMBOL(acpi_map_lsapic); + + +int +acpi_unmap_lsapic(int cpu) +{ + int i; + + for (i=0; i + * Populate cpu entries in sysfs for non-numa systems as well + * Intel Corporation - Ashok Raj + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef CONFIG_NUMA +static struct node *sysfs_nodes; +#endif +static struct ia64_cpu *sysfs_cpus; + +int arch_register_cpu(int num) +{ + struct node *parent = NULL; + +#ifdef CONFIG_NUMA + parent = &sysfs_nodes[cpu_to_node(num)]; +#endif /* CONFIG_NUMA */ + + return register_cpu(&sysfs_cpus[num].cpu, num, parent); +} + +#ifdef CONFIG_HOTPLUG_CPU + +void arch_unregister_cpu(int num) +{ + struct node *parent = NULL; + +#ifdef CONFIG_NUMA + int node = cpu_to_node(num); + parent = &sysfs_nodes[node]; +#endif /* CONFIG_NUMA */ + + return unregister_cpu(&sysfs_cpus[num].cpu, parent); +} +EXPORT_SYMBOL(arch_register_cpu); +EXPORT_SYMBOL(arch_unregister_cpu); +#endif /*CONFIG_HOTPLUG_CPU*/ + + +static int __init topology_init(void) +{ + int i, err = 0; + +#ifdef CONFIG_NUMA + sysfs_nodes = kmalloc(sizeof(struct node) * MAX_NUMNODES, GFP_KERNEL); + if (!sysfs_nodes) { + err = -ENOMEM; + goto out; + } + memset(sysfs_nodes, 0, sizeof(struct node) * MAX_NUMNODES); + + for (i = 0; i < numnodes; i++) + if ((err = register_node(&sysfs_nodes[i], i, 0))) + goto out; +#endif + + sysfs_cpus = kmalloc(sizeof(struct ia64_cpu) * NR_CPUS, GFP_KERNEL); + if (!sysfs_cpus) { + err = -ENOMEM; + goto out; + } + memset(sysfs_cpus, 0, sizeof(struct ia64_cpu) * NR_CPUS); + + for_each_present_cpu(i) + if((err = arch_register_cpu(i))) + goto out; +out: + return err; +} + +__initcall(topology_init); diff -Nru a/arch/ia64/mm/fault.c b/arch/ia64/mm/fault.c --- a/arch/ia64/mm/fault.c 2005-01-02 23:03:35 -08:00 +++ b/arch/ia64/mm/fault.c 2005-01-02 23:03:35 -08:00 @@ -51,6 +51,7 @@ mapped_kernel_page_is_present (unsigned long address) { pgd_t *pgd; + pud_t *pud; pmd_t *pmd; pte_t *ptep, pte; @@ -58,7 +59,11 @@ if (pgd_none(*pgd) || pgd_bad(*pgd)) return 0; - pmd = pmd_offset(pgd, address); + pud = pud_offset(pgd, address); + if (pud_none(*pud) || pud_bad(*pud)) + return 0; + + pmd = pmd_offset(pud, address); if (pmd_none(*pmd) || pmd_bad(*pmd)) return 0; diff -Nru a/arch/ia64/mm/hugetlbpage.c b/arch/ia64/mm/hugetlbpage.c --- a/arch/ia64/mm/hugetlbpage.c 2005-01-02 23:03:34 -08:00 +++ b/arch/ia64/mm/hugetlbpage.c 2005-01-02 23:03:34 -08:00 @@ -29,13 +29,17 @@ { unsigned long taddr = htlbpage_to_page(addr); pgd_t *pgd; + pud_t *pud; pmd_t *pmd; pte_t *pte = NULL; pgd = pgd_offset(mm, taddr); - pmd = pmd_alloc(mm, pgd, taddr); - if (pmd) - pte = pte_alloc_map(mm, pmd, taddr); + pud = pud_alloc(mm, pgd, taddr); + if (pud) { + pmd = pmd_alloc(mm, pud, taddr); + if (pmd) + pte = pte_alloc_map(mm, pmd, taddr); + } return pte; } @@ -44,14 +48,18 @@ { unsigned long taddr = htlbpage_to_page(addr); pgd_t *pgd; + pud_t *pud; pmd_t *pmd; pte_t *pte = NULL; pgd = pgd_offset(mm, taddr); if (pgd_present(*pgd)) { - pmd = pmd_offset(pgd, taddr); - if (pmd_present(*pmd)) - pte = pte_offset_map(pmd, taddr); + pud = pud_offset(pgd, taddr); + if (pud_present(*pud)) { + pmd = pmd_offset(pud, taddr); + if (pmd_present(*pmd)) + pte = pte_offset_map(pmd, taddr); + } } return pte; @@ -187,7 +195,6 @@ { unsigned long first = start & HUGETLB_PGDIR_MASK; unsigned long last = end + HUGETLB_PGDIR_SIZE - 1; - unsigned long start_index, end_index; struct mm_struct *mm = tlb->mm; if (!prev) { @@ -212,23 +219,13 @@ last = next->vm_start; } if (prev->vm_end > first) - first = prev->vm_end + HUGETLB_PGDIR_SIZE - 1; + first = prev->vm_end; break; } no_mmaps: if (last < first) /* for arches with discontiguous pgd indices */ return; - /* - * If the PGD bits are not consecutive in the virtual address, the - * old method of shifting the VA >> by PGDIR_SHIFT doesn't work. - */ - - start_index = pgd_index(htlbpage_to_page(first)); - end_index = pgd_index(htlbpage_to_page(last)); - - if (end_index > start_index) { - clear_page_tables(tlb, start_index, end_index - start_index); - } + clear_page_range(tlb, first, last); } void unmap_hugepage_range(struct vm_area_struct *vma, unsigned long start, unsigned long end) diff -Nru a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c --- a/arch/ia64/mm/init.c 2005-01-02 23:03:33 -08:00 +++ b/arch/ia64/mm/init.c 2005-01-02 23:03:33 -08:00 @@ -237,6 +237,7 @@ put_kernel_page (struct page *page, unsigned long address, pgprot_t pgprot) { pgd_t *pgd; + pud_t *pud; pmd_t *pmd; pte_t *pte; @@ -248,7 +249,11 @@ spin_lock(&init_mm.page_table_lock); { - pmd = pmd_alloc(&init_mm, pgd, address); + pud = pud_alloc(&init_mm, pgd, address); + if (!pud) + goto out; + + pmd = pmd_alloc(&init_mm, pud, address); if (!pmd) goto out; pte = pte_alloc_map(&init_mm, pmd, address); @@ -381,6 +386,7 @@ struct page *map_start, *map_end; int node; pgd_t *pgd; + pud_t *pud; pmd_t *pmd; pte_t *pte; @@ -395,7 +401,11 @@ pgd = pgd_offset_k(address); if (pgd_none(*pgd)) pgd_populate(&init_mm, pgd, alloc_bootmem_pages_node(NODE_DATA(node), PAGE_SIZE)); - pmd = pmd_offset(pgd, address); + pud = pud_offset(pgd, address); + + if (pud_none(*pud)) + pud_populate(&init_mm, pud, alloc_bootmem_pages_node(NODE_DATA(node), PAGE_SIZE)); + pmd = pmd_offset(pud, address); if (pmd_none(*pmd)) pmd_populate_kernel(&init_mm, pmd, alloc_bootmem_pages_node(NODE_DATA(node), PAGE_SIZE)); diff -Nru a/arch/ia64/mm/numa.c b/arch/ia64/mm/numa.c --- a/arch/ia64/mm/numa.c 2005-01-02 23:03:33 -08:00 +++ b/arch/ia64/mm/numa.c 2005-01-02 23:03:33 -08:00 @@ -20,8 +20,6 @@ #include #include -static struct node *sysfs_nodes; -static struct cpu *sysfs_cpus; /* * The following structures are usually initialized by ACPI or @@ -49,37 +47,3 @@ return (i < num_node_memblks) ? node_memblk[i].nid : (num_node_memblks ? -1 : 0); } - -static int __init topology_init(void) -{ - int i, err = 0; - - sysfs_nodes = kmalloc(sizeof(struct node) * numnodes, GFP_KERNEL); - if (!sysfs_nodes) { - err = -ENOMEM; - goto out; - } - memset(sysfs_nodes, 0, sizeof(struct node) * numnodes); - - sysfs_cpus = kmalloc(sizeof(struct cpu) * NR_CPUS, GFP_KERNEL); - if (!sysfs_cpus) { - kfree(sysfs_nodes); - err = -ENOMEM; - goto out; - } - memset(sysfs_cpus, 0, sizeof(struct cpu) * NR_CPUS); - - for (i = 0; i < numnodes; i++) - if ((err = register_node(&sysfs_nodes[i], i, NULL))) - goto out; - - for (i = 0; i < NR_CPUS; i++) - if (cpu_online(i)) - if((err = register_cpu(&sysfs_cpus[i], i, - &sysfs_nodes[cpu_to_node(i)]))) - goto out; - out: - return err; -} - -__initcall(topology_init); diff -Nru a/arch/m68k/configs/amiga_defconfig b/arch/m68k/configs/amiga_defconfig --- a/arch/m68k/configs/amiga_defconfig 2005-01-02 23:03:34 -08:00 +++ b/arch/m68k/configs/amiga_defconfig 2005-01-02 23:03:34 -08:00 @@ -376,7 +376,6 @@ CONFIG_IP_NF_TARGET_REDIRECT=m CONFIG_IP_NF_TARGET_NETMAP=m CONFIG_IP_NF_TARGET_SAME=m -CONFIG_IP_NF_NAT_LOCAL=y CONFIG_IP_NF_NAT_SNMP_BASIC=m CONFIG_IP_NF_NAT_IRC=m CONFIG_IP_NF_NAT_FTP=m diff -Nru a/arch/m68k/configs/apollo_defconfig b/arch/m68k/configs/apollo_defconfig --- a/arch/m68k/configs/apollo_defconfig 2005-01-02 23:03:34 -08:00 +++ b/arch/m68k/configs/apollo_defconfig 2005-01-02 23:03:34 -08:00 @@ -302,7 +302,6 @@ CONFIG_IP_NF_TARGET_REDIRECT=m CONFIG_IP_NF_TARGET_NETMAP=m CONFIG_IP_NF_TARGET_SAME=m -CONFIG_IP_NF_NAT_LOCAL=y CONFIG_IP_NF_NAT_SNMP_BASIC=m CONFIG_IP_NF_NAT_IRC=m CONFIG_IP_NF_NAT_FTP=m diff -Nru a/arch/m68k/configs/atari_defconfig b/arch/m68k/configs/atari_defconfig --- a/arch/m68k/configs/atari_defconfig 2005-01-02 23:03:33 -08:00 +++ b/arch/m68k/configs/atari_defconfig 2005-01-02 23:03:33 -08:00 @@ -331,7 +331,6 @@ CONFIG_IP_NF_TARGET_REDIRECT=m CONFIG_IP_NF_TARGET_NETMAP=m CONFIG_IP_NF_TARGET_SAME=m -CONFIG_IP_NF_NAT_LOCAL=y CONFIG_IP_NF_NAT_SNMP_BASIC=m CONFIG_IP_NF_NAT_IRC=m CONFIG_IP_NF_NAT_FTP=m diff -Nru a/arch/m68k/configs/bvme6000_defconfig b/arch/m68k/configs/bvme6000_defconfig --- a/arch/m68k/configs/bvme6000_defconfig 2005-01-02 23:03:34 -08:00 +++ b/arch/m68k/configs/bvme6000_defconfig 2005-01-02 23:03:34 -08:00 @@ -302,7 +302,6 @@ CONFIG_IP_NF_TARGET_REDIRECT=m CONFIG_IP_NF_TARGET_NETMAP=m CONFIG_IP_NF_TARGET_SAME=m -CONFIG_IP_NF_NAT_LOCAL=y CONFIG_IP_NF_NAT_SNMP_BASIC=m CONFIG_IP_NF_NAT_IRC=m CONFIG_IP_NF_NAT_FTP=m diff -Nru a/arch/m68k/configs/hp300_defconfig b/arch/m68k/configs/hp300_defconfig --- a/arch/m68k/configs/hp300_defconfig 2005-01-02 23:03:34 -08:00 +++ b/arch/m68k/configs/hp300_defconfig 2005-01-02 23:03:34 -08:00 @@ -303,7 +303,6 @@ CONFIG_IP_NF_TARGET_REDIRECT=m CONFIG_IP_NF_TARGET_NETMAP=m CONFIG_IP_NF_TARGET_SAME=m -CONFIG_IP_NF_NAT_LOCAL=y CONFIG_IP_NF_NAT_SNMP_BASIC=m CONFIG_IP_NF_NAT_IRC=m CONFIG_IP_NF_NAT_FTP=m diff -Nru a/arch/m68k/configs/mac_defconfig b/arch/m68k/configs/mac_defconfig --- a/arch/m68k/configs/mac_defconfig 2005-01-02 23:03:34 -08:00 +++ b/arch/m68k/configs/mac_defconfig 2005-01-02 23:03:34 -08:00 @@ -338,7 +338,6 @@ CONFIG_IP_NF_TARGET_REDIRECT=m CONFIG_IP_NF_TARGET_NETMAP=m CONFIG_IP_NF_TARGET_SAME=m -CONFIG_IP_NF_NAT_LOCAL=y CONFIG_IP_NF_NAT_SNMP_BASIC=m CONFIG_IP_NF_NAT_IRC=m CONFIG_IP_NF_NAT_FTP=m diff -Nru a/arch/m68k/configs/mvme147_defconfig b/arch/m68k/configs/mvme147_defconfig --- a/arch/m68k/configs/mvme147_defconfig 2005-01-02 23:03:34 -08:00 +++ b/arch/m68k/configs/mvme147_defconfig 2005-01-02 23:03:34 -08:00 @@ -303,7 +303,6 @@ CONFIG_IP_NF_TARGET_REDIRECT=m CONFIG_IP_NF_TARGET_NETMAP=m CONFIG_IP_NF_TARGET_SAME=m -CONFIG_IP_NF_NAT_LOCAL=y CONFIG_IP_NF_NAT_SNMP_BASIC=m CONFIG_IP_NF_NAT_IRC=m CONFIG_IP_NF_NAT_FTP=m diff -Nru a/arch/m68k/configs/mvme16x_defconfig b/arch/m68k/configs/mvme16x_defconfig --- a/arch/m68k/configs/mvme16x_defconfig 2005-01-02 23:03:35 -08:00 +++ b/arch/m68k/configs/mvme16x_defconfig 2005-01-02 23:03:35 -08:00 @@ -302,7 +302,6 @@ CONFIG_IP_NF_TARGET_REDIRECT=m CONFIG_IP_NF_TARGET_NETMAP=m CONFIG_IP_NF_TARGET_SAME=m -CONFIG_IP_NF_NAT_LOCAL=y CONFIG_IP_NF_NAT_SNMP_BASIC=m CONFIG_IP_NF_NAT_IRC=m CONFIG_IP_NF_NAT_FTP=m diff -Nru a/arch/m68k/configs/q40_defconfig b/arch/m68k/configs/q40_defconfig --- a/arch/m68k/configs/q40_defconfig 2005-01-02 23:03:33 -08:00 +++ b/arch/m68k/configs/q40_defconfig 2005-01-02 23:03:33 -08:00 @@ -356,7 +356,6 @@ CONFIG_IP_NF_TARGET_REDIRECT=m CONFIG_IP_NF_TARGET_NETMAP=m CONFIG_IP_NF_TARGET_SAME=m -CONFIG_IP_NF_NAT_LOCAL=y CONFIG_IP_NF_NAT_SNMP_BASIC=m CONFIG_IP_NF_NAT_IRC=m CONFIG_IP_NF_NAT_FTP=m diff -Nru a/arch/m68k/configs/sun3_defconfig b/arch/m68k/configs/sun3_defconfig --- a/arch/m68k/configs/sun3_defconfig 2005-01-02 23:03:34 -08:00 +++ b/arch/m68k/configs/sun3_defconfig 2005-01-02 23:03:34 -08:00 @@ -291,7 +291,6 @@ CONFIG_IP_NF_TARGET_REDIRECT=m CONFIG_IP_NF_TARGET_NETMAP=m CONFIG_IP_NF_TARGET_SAME=m -CONFIG_IP_NF_NAT_LOCAL=y CONFIG_IP_NF_NAT_SNMP_BASIC=m CONFIG_IP_NF_NAT_IRC=m CONFIG_IP_NF_NAT_FTP=m diff -Nru a/arch/m68k/configs/sun3x_defconfig b/arch/m68k/configs/sun3x_defconfig --- a/arch/m68k/configs/sun3x_defconfig 2005-01-02 23:03:33 -08:00 +++ b/arch/m68k/configs/sun3x_defconfig 2005-01-02 23:03:33 -08:00 @@ -302,7 +302,6 @@ CONFIG_IP_NF_TARGET_REDIRECT=m CONFIG_IP_NF_TARGET_NETMAP=m CONFIG_IP_NF_TARGET_SAME=m -CONFIG_IP_NF_NAT_LOCAL=y CONFIG_IP_NF_NAT_SNMP_BASIC=m CONFIG_IP_NF_NAT_IRC=m CONFIG_IP_NF_NAT_FTP=m diff -Nru a/arch/mips/configs/ip22_defconfig b/arch/mips/configs/ip22_defconfig --- a/arch/mips/configs/ip22_defconfig 2005-01-02 23:03:33 -08:00 +++ b/arch/mips/configs/ip22_defconfig 2005-01-02 23:03:33 -08:00 @@ -372,7 +372,6 @@ CONFIG_IP_NF_TARGET_REDIRECT=m CONFIG_IP_NF_TARGET_NETMAP=m CONFIG_IP_NF_TARGET_SAME=m -CONFIG_IP_NF_NAT_LOCAL=y CONFIG_IP_NF_NAT_SNMP_BASIC=m CONFIG_IP_NF_NAT_IRC=m CONFIG_IP_NF_NAT_FTP=m diff -Nru a/arch/mips/configs/rm200_defconfig b/arch/mips/configs/rm200_defconfig --- a/arch/mips/configs/rm200_defconfig 2005-01-02 23:03:33 -08:00 +++ b/arch/mips/configs/rm200_defconfig 2005-01-02 23:03:33 -08:00 @@ -477,7 +477,6 @@ CONFIG_IP_NF_TARGET_REDIRECT=m CONFIG_IP_NF_TARGET_NETMAP=m CONFIG_IP_NF_TARGET_SAME=m -CONFIG_IP_NF_NAT_LOCAL=y CONFIG_IP_NF_NAT_SNMP_BASIC=m CONFIG_IP_NF_NAT_IRC=m CONFIG_IP_NF_NAT_FTP=m diff -Nru a/arch/mips/defconfig b/arch/mips/defconfig --- a/arch/mips/defconfig 2005-01-02 23:03:33 -08:00 +++ b/arch/mips/defconfig 2005-01-02 23:03:33 -08:00 @@ -372,7 +372,6 @@ CONFIG_IP_NF_TARGET_REDIRECT=m CONFIG_IP_NF_TARGET_NETMAP=m CONFIG_IP_NF_TARGET_SAME=m -CONFIG_IP_NF_NAT_LOCAL=y CONFIG_IP_NF_NAT_SNMP_BASIC=m CONFIG_IP_NF_NAT_IRC=m CONFIG_IP_NF_NAT_FTP=m diff -Nru a/arch/parisc/configs/a500_defconfig b/arch/parisc/configs/a500_defconfig --- a/arch/parisc/configs/a500_defconfig 2005-01-02 23:03:33 -08:00 +++ b/arch/parisc/configs/a500_defconfig 2005-01-02 23:03:33 -08:00 @@ -338,7 +338,6 @@ CONFIG_IP_NF_TARGET_REDIRECT=m CONFIG_IP_NF_TARGET_NETMAP=m CONFIG_IP_NF_TARGET_SAME=m -# CONFIG_IP_NF_NAT_LOCAL is not set CONFIG_IP_NF_NAT_SNMP_BASIC=m CONFIG_IP_NF_NAT_IRC=m CONFIG_IP_NF_NAT_FTP=m diff -Nru a/arch/parisc/configs/c3000_defconfig b/arch/parisc/configs/c3000_defconfig --- a/arch/parisc/configs/c3000_defconfig 2005-01-02 23:03:34 -08:00 +++ b/arch/parisc/configs/c3000_defconfig 2005-01-02 23:03:34 -08:00 @@ -396,7 +396,6 @@ CONFIG_IP_NF_TARGET_REDIRECT=m CONFIG_IP_NF_TARGET_NETMAP=m CONFIG_IP_NF_TARGET_SAME=m -# CONFIG_IP_NF_NAT_LOCAL is not set CONFIG_IP_NF_NAT_SNMP_BASIC=m CONFIG_IP_NF_NAT_IRC=m CONFIG_IP_NF_NAT_FTP=m diff -Nru a/arch/parisc/configs/n4000_defconfig b/arch/parisc/configs/n4000_defconfig --- a/arch/parisc/configs/n4000_defconfig 2005-01-02 23:03:33 -08:00 +++ b/arch/parisc/configs/n4000_defconfig 2005-01-02 23:03:33 -08:00 @@ -331,7 +331,6 @@ CONFIG_IP_NF_TARGET_REDIRECT=m CONFIG_IP_NF_TARGET_NETMAP=m CONFIG_IP_NF_TARGET_SAME=m -# CONFIG_IP_NF_NAT_LOCAL is not set CONFIG_IP_NF_NAT_SNMP_BASIC=m CONFIG_IP_NF_NAT_IRC=m CONFIG_IP_NF_NAT_FTP=m diff -Nru a/arch/ppc/configs/adir_defconfig b/arch/ppc/configs/adir_defconfig --- a/arch/ppc/configs/adir_defconfig 2005-01-02 23:03:34 -08:00 +++ b/arch/ppc/configs/adir_defconfig 2005-01-02 23:03:34 -08:00 @@ -302,7 +302,6 @@ CONFIG_IP_NF_NAT_NEEDED=y CONFIG_IP_NF_TARGET_MASQUERADE=m CONFIG_IP_NF_TARGET_REDIRECT=m -# CONFIG_IP_NF_NAT_LOCAL is not set CONFIG_IP_NF_NAT_SNMP_BASIC=m CONFIG_IP_NF_NAT_IRC=m CONFIG_IP_NF_NAT_FTP=m diff -Nru a/arch/ppc/configs/apus_defconfig b/arch/ppc/configs/apus_defconfig --- a/arch/ppc/configs/apus_defconfig 2005-01-02 23:03:34 -08:00 +++ b/arch/ppc/configs/apus_defconfig 2005-01-02 23:03:34 -08:00 @@ -354,7 +354,6 @@ CONFIG_IP_NF_NAT_NEEDED=y CONFIG_IP_NF_TARGET_MASQUERADE=m CONFIG_IP_NF_TARGET_REDIRECT=m -# CONFIG_IP_NF_NAT_LOCAL is not set CONFIG_IP_NF_NAT_SNMP_BASIC=m CONFIG_IP_NF_NAT_IRC=m CONFIG_IP_NF_NAT_FTP=m diff -Nru a/arch/ppc/configs/common_defconfig b/arch/ppc/configs/common_defconfig --- a/arch/ppc/configs/common_defconfig 2005-01-02 23:03:33 -08:00 +++ b/arch/ppc/configs/common_defconfig 2005-01-02 23:03:33 -08:00 @@ -457,7 +457,6 @@ CONFIG_IP_NF_TARGET_REDIRECT=m CONFIG_IP_NF_TARGET_NETMAP=m CONFIG_IP_NF_TARGET_SAME=m -# CONFIG_IP_NF_NAT_LOCAL is not set CONFIG_IP_NF_NAT_SNMP_BASIC=m CONFIG_IP_NF_NAT_IRC=m CONFIG_IP_NF_NAT_FTP=m diff -Nru a/arch/ppc/configs/ibmchrp_defconfig b/arch/ppc/configs/ibmchrp_defconfig --- a/arch/ppc/configs/ibmchrp_defconfig 2005-01-02 23:03:34 -08:00 +++ b/arch/ppc/configs/ibmchrp_defconfig 2005-01-02 23:03:34 -08:00 @@ -367,7 +367,6 @@ CONFIG_IP_NF_TARGET_REDIRECT=m CONFIG_IP_NF_TARGET_NETMAP=m CONFIG_IP_NF_TARGET_SAME=m -# CONFIG_IP_NF_NAT_LOCAL is not set CONFIG_IP_NF_NAT_SNMP_BASIC=m CONFIG_IP_NF_NAT_IRC=m CONFIG_IP_NF_NAT_FTP=m diff -Nru a/arch/ppc/configs/k2_defconfig b/arch/ppc/configs/k2_defconfig --- a/arch/ppc/configs/k2_defconfig 2005-01-02 23:03:33 -08:00 +++ b/arch/ppc/configs/k2_defconfig 2005-01-02 23:03:33 -08:00 @@ -319,7 +319,6 @@ CONFIG_IP_NF_TARGET_REDIRECT=m # CONFIG_IP_NF_TARGET_NETMAP is not set # CONFIG_IP_NF_TARGET_SAME is not set -# CONFIG_IP_NF_NAT_LOCAL is not set # CONFIG_IP_NF_NAT_SNMP_BASIC is not set CONFIG_IP_NF_NAT_FTP=m # CONFIG_IP_NF_MANGLE is not set diff -Nru a/arch/ppc/configs/menf1_defconfig b/arch/ppc/configs/menf1_defconfig --- a/arch/ppc/configs/menf1_defconfig 2005-01-02 23:03:35 -08:00 +++ b/arch/ppc/configs/menf1_defconfig 2005-01-02 23:03:35 -08:00 @@ -249,7 +249,6 @@ CONFIG_IP_NF_NAT_NEEDED=y CONFIG_IP_NF_TARGET_MASQUERADE=m CONFIG_IP_NF_TARGET_REDIRECT=m -# CONFIG_IP_NF_NAT_LOCAL is not set # CONFIG_IP_NF_NAT_SNMP_BASIC is not set CONFIG_IP_NF_NAT_IRC=m CONFIG_IP_NF_NAT_FTP=m diff -Nru a/arch/ppc/configs/pcore_defconfig b/arch/ppc/configs/pcore_defconfig --- a/arch/ppc/configs/pcore_defconfig 2005-01-02 23:03:34 -08:00 +++ b/arch/ppc/configs/pcore_defconfig 2005-01-02 23:03:34 -08:00 @@ -332,7 +332,6 @@ CONFIG_IP_NF_TARGET_REDIRECT=m # CONFIG_IP_NF_TARGET_NETMAP is not set # CONFIG_IP_NF_TARGET_SAME is not set -# CONFIG_IP_NF_NAT_LOCAL is not set # CONFIG_IP_NF_NAT_SNMP_BASIC is not set CONFIG_IP_NF_NAT_IRC=m CONFIG_IP_NF_NAT_FTP=m diff -Nru a/arch/ppc/configs/pmac_defconfig b/arch/ppc/configs/pmac_defconfig --- a/arch/ppc/configs/pmac_defconfig 2005-01-02 23:03:35 -08:00 +++ b/arch/ppc/configs/pmac_defconfig 2005-01-02 23:03:35 -08:00 @@ -479,7 +479,6 @@ CONFIG_IP_NF_TARGET_REDIRECT=m CONFIG_IP_NF_TARGET_NETMAP=m CONFIG_IP_NF_TARGET_SAME=m -# CONFIG_IP_NF_NAT_LOCAL is not set CONFIG_IP_NF_NAT_SNMP_BASIC=m CONFIG_IP_NF_NAT_IRC=m CONFIG_IP_NF_NAT_FTP=m diff -Nru a/arch/ppc/configs/pplus_defconfig b/arch/ppc/configs/pplus_defconfig --- a/arch/ppc/configs/pplus_defconfig 2005-01-02 23:03:34 -08:00 +++ b/arch/ppc/configs/pplus_defconfig 2005-01-02 23:03:34 -08:00 @@ -343,7 +343,6 @@ CONFIG_IP_NF_TARGET_REDIRECT=m # CONFIG_IP_NF_TARGET_NETMAP is not set # CONFIG_IP_NF_TARGET_SAME is not set -# CONFIG_IP_NF_NAT_LOCAL is not set # CONFIG_IP_NF_NAT_SNMP_BASIC is not set CONFIG_IP_NF_NAT_FTP=m # CONFIG_IP_NF_MANGLE is not set diff -Nru a/arch/ppc/defconfig b/arch/ppc/defconfig --- a/arch/ppc/defconfig 2005-01-02 23:03:34 -08:00 +++ b/arch/ppc/defconfig 2005-01-02 23:03:34 -08:00 @@ -464,7 +464,6 @@ CONFIG_IP_NF_TARGET_REDIRECT=m CONFIG_IP_NF_TARGET_NETMAP=m CONFIG_IP_NF_TARGET_SAME=m -# CONFIG_IP_NF_NAT_LOCAL is not set CONFIG_IP_NF_NAT_SNMP_BASIC=m CONFIG_IP_NF_NAT_IRC=m CONFIG_IP_NF_NAT_FTP=m diff -Nru a/arch/ppc/platforms/chrp_pci.c b/arch/ppc/platforms/chrp_pci.c --- a/arch/ppc/platforms/chrp_pci.c 2005-01-02 23:03:35 -08:00 +++ b/arch/ppc/platforms/chrp_pci.c 2005-01-02 23:03:35 -08:00 @@ -23,7 +23,7 @@ #include /* LongTrail */ -unsigned long gg2_pci_config_base; +void __iomem *gg2_pci_config_base; /* * The VLSI Golden Gate II has only 512K of PCI configuration space, so we @@ -33,7 +33,7 @@ int __chrp gg2_read_config(struct pci_bus *bus, unsigned int devfn, int off, int len, u32 *val) { - volatile unsigned char *cfg_data; + volatile void __iomem *cfg_data; struct pci_controller *hose = bus->sysdata; if (bus->number > 7) @@ -45,13 +45,13 @@ cfg_data = hose->cfg_data + ((bus->number<<16) | (devfn<<8) | off); switch (len) { case 1: - *val = in_8((u8 *)cfg_data); + *val = in_8(cfg_data); break; case 2: - *val = in_le16((u16 *)cfg_data); + *val = in_le16(cfg_data); break; default: - *val = in_le32((u32 *)cfg_data); + *val = in_le32(cfg_data); break; } return PCIBIOS_SUCCESSFUL; @@ -60,7 +60,7 @@ int __chrp gg2_write_config(struct pci_bus *bus, unsigned int devfn, int off, int len, u32 val) { - volatile unsigned char *cfg_data; + volatile void __iomem *cfg_data; struct pci_controller *hose = bus->sysdata; if (bus->number > 7) @@ -72,13 +72,13 @@ cfg_data = hose->cfg_data + ((bus->number<<16) | (devfn<<8) | off); switch (len) { case 1: - out_8((u8 *)cfg_data, val); + out_8(cfg_data, val); break; case 2: - out_le16((u16 *)cfg_data, val); + out_le16(cfg_data, val); break; default: - out_le32((u32 *)cfg_data, val); + out_le32(cfg_data, val); break; } return PCIBIOS_SUCCESSFUL; @@ -253,10 +253,10 @@ || strncmp(model, "Motorola, Grackle", 17) == 0) { setup_grackle(hose); } else if (is_longtrail) { + void __iomem *p = ioremap(GG2_PCI_CONFIG_BASE, 0x80000); hose->ops = &gg2_pci_ops; - hose->cfg_data = (unsigned char *) - ioremap(GG2_PCI_CONFIG_BASE, 0x80000); - gg2_pci_config_base = (unsigned long) hose->cfg_data; + hose->cfg_data = p; + gg2_pci_config_base = p; } else { printk("No methods for %s (model %s), using RTAS\n", dev->full_name, model); diff -Nru a/arch/ppc/platforms/chrp_setup.c b/arch/ppc/platforms/chrp_setup.c --- a/arch/ppc/platforms/chrp_setup.c 2005-01-02 23:03:34 -08:00 +++ b/arch/ppc/platforms/chrp_setup.c 2005-01-02 23:03:34 -08:00 @@ -118,13 +118,12 @@ if (!strncmp(model, "IBM,LongTrail", 13)) { /* VLSI VAS96011/12 `Golden Gate 2' */ /* Memory banks */ - sdramen = (in_le32((unsigned *)(gg2_pci_config_base+ - GG2_PCI_DRAM_CTRL)) + sdramen = (in_le32(gg2_pci_config_base + GG2_PCI_DRAM_CTRL) >>31) & 1; for (i = 0; i < (sdramen ? 4 : 6); i++) { - t = in_le32((unsigned *)(gg2_pci_config_base+ + t = in_le32(gg2_pci_config_base+ GG2_PCI_DRAM_BANK0+ - i*4)); + i*4); if (!(t & 1)) continue; switch ((t>>8) & 0x1f) { @@ -154,7 +153,7 @@ gg2_memtypes[sdramen ? 1 : ((t>>1) & 3)]); } /* L2 cache */ - t = in_le32((unsigned *)(gg2_pci_config_base+GG2_PCI_CC_CTRL)); + t = in_le32(gg2_pci_config_base+GG2_PCI_CC_CTRL); seq_printf(m, "board l2\t: %s %s (%s)\n", gg2_cachesizes[(t>>7) & 3], gg2_cachetypes[(t>>2) & 3], diff -Nru a/arch/ppc/platforms/pmac_pci.c b/arch/ppc/platforms/pmac_pci.c --- a/arch/ppc/platforms/pmac_pci.c 2005-01-02 23:03:34 -08:00 +++ b/arch/ppc/platforms/pmac_pci.c 2005-01-02 23:03:34 -08:00 @@ -142,14 +142,14 @@ |(((unsigned long)(off)) & 0xFCUL) \ |1UL) -static unsigned int __pmac +static void volatile __iomem * __pmac macrisc_cfg_access(struct pci_controller* hose, u8 bus, u8 dev_fn, u8 offset) { unsigned int caddr; if (bus == hose->first_busno) { if (dev_fn < (11 << 3)) - return 0; + return NULL; caddr = MACRISC_CFA0(dev_fn, offset); } else caddr = MACRISC_CFA1(bus, dev_fn, offset); @@ -160,7 +160,7 @@ } while (in_le32(hose->cfg_addr) != caddr); offset &= has_uninorth ? 0x07 : 0x03; - return (unsigned int)(hose->cfg_data) + (unsigned int)offset; + return hose->cfg_data + offset; } static int __pmac @@ -168,7 +168,7 @@ int len, u32 *val) { struct pci_controller *hose = bus->sysdata; - unsigned int addr; + void volatile __iomem *addr; addr = macrisc_cfg_access(hose, bus->number, devfn, offset); if (!addr) @@ -179,13 +179,13 @@ */ switch (len) { case 1: - *val = in_8((u8 *)addr); + *val = in_8(addr); break; case 2: - *val = in_le16((u16 *)addr); + *val = in_le16(addr); break; default: - *val = in_le32((u32 *)addr); + *val = in_le32(addr); break; } return PCIBIOS_SUCCESSFUL; @@ -196,7 +196,7 @@ int len, u32 val) { struct pci_controller *hose = bus->sysdata; - unsigned int addr; + void volatile __iomem *addr; addr = macrisc_cfg_access(hose, bus->number, devfn, offset); if (!addr) @@ -207,16 +207,16 @@ */ switch (len) { case 1: - out_8((u8 *)addr, val); - (void) in_8((u8 *)addr); + out_8(addr, val); + (void) in_8(addr); break; case 2: - out_le16((u16 *)addr, val); - (void) in_le16((u16 *)addr); + out_le16(addr, val); + (void) in_le16(addr); break; default: - out_le32((u32 *)addr, val); - (void) in_le32((u32 *)addr); + out_le32(addr, val); + (void) in_le32(addr); break; } return PCIBIOS_SUCCESSFUL; @@ -295,7 +295,7 @@ + (((unsigned long)bus) << 16) \ + 0x01000000UL) -static unsigned long __pmac +static void volatile __iomem * __pmac u3_ht_cfg_access(struct pci_controller* hose, u8 bus, u8 devfn, u8 offset) { if (bus == hose->first_busno) { @@ -303,9 +303,9 @@ if (PCI_FUNC(devfn) != 0 || PCI_SLOT(devfn) > 7 || PCI_SLOT(devfn) < 1) return 0; - return ((unsigned long)hose->cfg_data) + U3_HT_CFA0(devfn, offset); + return hose->cfg_data + U3_HT_CFA0(devfn, offset); } else - return ((unsigned long)hose->cfg_data) + U3_HT_CFA1(bus, devfn, offset); + return hose->cfg_data + U3_HT_CFA1(bus, devfn, offset); } static int __pmac @@ -313,7 +313,7 @@ int len, u32 *val) { struct pci_controller *hose = bus->sysdata; - unsigned int addr; + void volatile __iomem *addr; int i; struct device_node *np = pci_busdev_to_OF_node(bus, devfn); @@ -347,13 +347,13 @@ */ switch (len) { case 1: - *val = in_8((u8 *)addr); + *val = in_8(addr); break; case 2: - *val = in_le16((u16 *)addr); + *val = in_le16(addr); break; default: - *val = in_le32((u32 *)addr); + *val = in_le32(addr); break; } return PCIBIOS_SUCCESSFUL; @@ -364,7 +364,7 @@ int len, u32 val) { struct pci_controller *hose = bus->sysdata; - unsigned int addr; + void volatile __iomem *addr; int i; struct device_node *np = pci_busdev_to_OF_node(bus, devfn); @@ -388,16 +388,16 @@ */ switch (len) { case 1: - out_8((u8 *)addr, val); - (void) in_8((u8 *)addr); + out_8(addr, val); + (void) in_8(addr); break; case 2: - out_le16((u16 *)addr, val); - (void) in_le16((u16 *)addr); + out_le16(addr, val); + (void) in_le16(addr); break; default: - out_le32((u32 *)addr, val); - (void) in_le32((u32 *)addr); + out_le32(addr, val); + (void) in_le32(addr); break; } return PCIBIOS_SUCCESSFUL; @@ -424,7 +424,7 @@ /* read the word at offset 0 in config space for device 11 */ out_le32(bp->cfg_addr, (1UL << BANDIT_DEVNUM) + PCI_VENDOR_ID); udelay(2); - vendev = in_le32((volatile unsigned int *)bp->cfg_data); + vendev = in_le32(bp->cfg_data); if (vendev == (PCI_DEVICE_ID_APPLE_BANDIT << 16) + PCI_VENDOR_ID_APPLE) { /* read the revision id */ @@ -443,12 +443,12 @@ /* read the word at offset 0x50 */ out_le32(bp->cfg_addr, (1UL << BANDIT_DEVNUM) + BANDIT_MAGIC); udelay(2); - magic = in_le32((volatile unsigned int *)bp->cfg_data); + magic = in_le32(bp->cfg_data); if ((magic & BANDIT_COHERENT) != 0) return; magic |= BANDIT_COHERENT; udelay(2); - out_le32((volatile unsigned int *)bp->cfg_data, magic); + out_le32(bp->cfg_data, magic); printk(KERN_INFO "Cache coherency enabled for bandit/PSX\n"); } @@ -622,12 +622,12 @@ unsigned int val; out_be32(bp->cfg_addr, GRACKLE_CFA(0, 0, 0xa8)); - val = in_le32((volatile unsigned int *)bp->cfg_data); + val = in_le32(bp->cfg_data); val = enable? (val | GRACKLE_PICR1_STG) : (val & ~GRACKLE_PICR1_STG); out_be32(bp->cfg_addr, GRACKLE_CFA(0, 0, 0xa8)); - out_le32((volatile unsigned int *)bp->cfg_data, val); - (void)in_le32((volatile unsigned int *)bp->cfg_data); + out_le32(bp->cfg_data, val); + (void)in_le32(bp->cfg_data); } static inline void grackle_set_loop_snoop(struct pci_controller *bp, int enable) @@ -635,12 +635,12 @@ unsigned int val; out_be32(bp->cfg_addr, GRACKLE_CFA(0, 0, 0xa8)); - val = in_le32((volatile unsigned int *)bp->cfg_data); + val = in_le32(bp->cfg_data); val = enable? (val | GRACKLE_PICR1_LOOPSNOOP) : (val & ~GRACKLE_PICR1_LOOPSNOOP); out_be32(bp->cfg_addr, GRACKLE_CFA(0, 0, 0xa8)); - out_le32((volatile unsigned int *)bp->cfg_data, val); - (void)in_le32((volatile unsigned int *)bp->cfg_data); + out_le32(bp->cfg_data, val); + (void)in_le32(bp->cfg_data); } static int __init @@ -659,10 +659,8 @@ setup_bandit(struct pci_controller* hose, struct reg_property* addr) { hose->ops = ¯isc_pci_ops; - hose->cfg_addr = (volatile unsigned int *) - ioremap(addr->address + 0x800000, 0x1000); - hose->cfg_data = (volatile unsigned char *) - ioremap(addr->address + 0xc00000, 0x1000); + hose->cfg_addr = ioremap(addr->address + 0x800000, 0x1000); + hose->cfg_data = ioremap(addr->address + 0xc00000, 0x1000); init_bandit(hose); } @@ -671,10 +669,8 @@ { /* assume a `chaos' bridge */ hose->ops = &chaos_pci_ops; - hose->cfg_addr = (volatile unsigned int *) - ioremap(addr->address + 0x800000, 0x1000); - hose->cfg_data = (volatile unsigned char *) - ioremap(addr->address + 0xc00000, 0x1000); + hose->cfg_addr = ioremap(addr->address + 0x800000, 0x1000); + hose->cfg_data = ioremap(addr->address + 0xc00000, 0x1000); } #ifdef CONFIG_POWER4 @@ -713,7 +709,7 @@ * the reg address cell, we shall fix that by killing struct * reg_property and using some accessor functions instead */ - hose->cfg_data = (volatile unsigned char *)ioremap(0xf2000000, 0x02000000); + hose->cfg_data = ioremap(0xf2000000, 0x02000000); /* * /ht node doesn't expose a "ranges" property, so we "remove" regions that diff -Nru a/arch/ppc/platforms/prep_pci.c b/arch/ppc/platforms/prep_pci.c --- a/arch/ppc/platforms/prep_pci.c 2005-01-02 23:03:35 -08:00 +++ b/arch/ppc/platforms/prep_pci.c 2005-01-02 23:03:35 -08:00 @@ -627,7 +627,7 @@ int len, u32 *val) { struct pci_controller *hose = bus->sysdata; - volatile unsigned char *cfg_data; + volatile void __iomem *cfg_data; if (bus->number != 0 || DEVNO(devfn) < MIN_DEVNR || DEVNO(devfn) > MAX_DEVNR) @@ -640,13 +640,13 @@ cfg_data = hose->cfg_data + CFGADDR(devfn) + offset; switch (len) { case 1: - *val = in_8((u8 *)cfg_data); + *val = in_8(cfg_data); break; case 2: - *val = in_le16((u16 *)cfg_data); + *val = in_le16(cfg_data); break; default: - *val = in_le32((u32 *)cfg_data); + *val = in_le32(cfg_data); break; } return PCIBIOS_SUCCESSFUL; @@ -657,7 +657,7 @@ int len, u32 val) { struct pci_controller *hose = bus->sysdata; - volatile unsigned char *cfg_data; + volatile void __iomem *cfg_data; if (bus->number != 0 || DEVNO(devfn) < MIN_DEVNR || DEVNO(devfn) > MAX_DEVNR) @@ -670,13 +670,13 @@ cfg_data = hose->cfg_data + CFGADDR(devfn) + offset; switch (len) { case 1: - out_8((u8 *)cfg_data, val); + out_8(cfg_data, val); break; case 2: - out_le16((u16 *)cfg_data, val); + out_le16(cfg_data, val); break; default: - out_le32((u32 *)cfg_data, val); + out_le32(cfg_data, val); break; } return PCIBIOS_SUCCESSFUL; diff -Nru a/arch/ppc/syslib/indirect_pci.c b/arch/ppc/syslib/indirect_pci.c --- a/arch/ppc/syslib/indirect_pci.c 2005-01-02 23:03:33 -08:00 +++ b/arch/ppc/syslib/indirect_pci.c 2005-01-02 23:03:33 -08:00 @@ -32,7 +32,7 @@ int len, u32 *val) { struct pci_controller *hose = bus->sysdata; - volatile unsigned char *cfg_data; + volatile void __iomem *cfg_data; u8 cfg_type = 0; if (ppc_md.pci_exclude_device) @@ -54,13 +54,13 @@ cfg_data = hose->cfg_data + (offset & 3); switch (len) { case 1: - *val = in_8((u8 *)cfg_data); + *val = in_8(cfg_data); break; case 2: - *val = in_le16((u16 *)cfg_data); + *val = in_le16(cfg_data); break; default: - *val = in_le32((u32 *)cfg_data); + *val = in_le32(cfg_data); break; } return PCIBIOS_SUCCESSFUL; @@ -71,7 +71,7 @@ int len, u32 val) { struct pci_controller *hose = bus->sysdata; - volatile unsigned char *cfg_data; + volatile void __iomem *cfg_data; u8 cfg_type = 0; if (ppc_md.pci_exclude_device) @@ -93,13 +93,13 @@ cfg_data = hose->cfg_data + (offset & 3); switch (len) { case 1: - out_8((u8 *)cfg_data, val); + out_8(cfg_data, val); break; case 2: - out_le16((u16 *)cfg_data, val); + out_le16(cfg_data, val); break; default: - out_le32((u32 *)cfg_data, val); + out_le32(cfg_data, val); break; } return PCIBIOS_SUCCESSFUL; @@ -112,11 +112,11 @@ }; void __init -setup_indirect_pci_nomap(struct pci_controller* hose, u32 cfg_addr, - u32 cfg_data) +setup_indirect_pci_nomap(struct pci_controller* hose, void __iomem * cfg_addr, + void __iomem * cfg_data) { - hose->cfg_addr = (unsigned int *)cfg_addr; - hose->cfg_data = (unsigned char *)cfg_data; + hose->cfg_addr = cfg_addr; + hose->cfg_data = cfg_data; hose->ops = &indirect_pci_ops; } @@ -124,12 +124,12 @@ setup_indirect_pci(struct pci_controller* hose, u32 cfg_addr, u32 cfg_data) { unsigned long base = cfg_addr & PAGE_MASK; - char *mbase; + void __iomem *mbase, *addr, *data; mbase = ioremap(base, PAGE_SIZE); - cfg_addr = (u32)(mbase + (cfg_addr & ~PAGE_MASK)); + addr = mbase + (cfg_addr & ~PAGE_MASK); if ((cfg_data & PAGE_MASK) != base) mbase = ioremap(cfg_data & PAGE_MASK, PAGE_SIZE); - cfg_data = (u32)(mbase + (cfg_data & ~PAGE_MASK)); - setup_indirect_pci_nomap(hose, cfg_addr, cfg_data); + data = mbase + (cfg_data & ~PAGE_MASK); + setup_indirect_pci_nomap(hose, addr, data); } diff -Nru a/arch/ppc/syslib/open_pic.c b/arch/ppc/syslib/open_pic.c --- a/arch/ppc/syslib/open_pic.c 2005-01-02 23:03:34 -08:00 +++ b/arch/ppc/syslib/open_pic.c 2005-01-02 23:03:34 -08:00 @@ -32,8 +32,8 @@ #define OPENPIC_BIG_ENDIAN #endif -void* OpenPIC_Addr; -static volatile struct OpenPIC *OpenPIC = NULL; +void __iomem *OpenPIC_Addr; +static volatile struct OpenPIC __iomem *OpenPIC = NULL; /* * We define OpenPIC_InitSenses table thusly: @@ -47,7 +47,7 @@ static u_int NumProcessors; static u_int NumSources; static int open_pic_irq_offset; -static volatile OpenPIC_Source *ISR[NR_IRQS]; +static volatile OpenPIC_Source __iomem *ISR[NR_IRQS]; static int openpic_cascade_irq = -1; static int (*openpic_cascade_fn)(struct pt_regs *); @@ -163,7 +163,7 @@ #define check_arg_cpu(cpu) do {} while (0) #endif -u_int openpic_read(volatile u_int *addr) +u_int openpic_read(volatile u_int __iomem *addr) { u_int val; @@ -175,7 +175,7 @@ return val; } -static inline void openpic_write(volatile u_int *addr, u_int val) +static inline void openpic_write(volatile u_int __iomem *addr, u_int val) { #ifdef OPENPIC_BIG_ENDIAN out_be32(addr, val); @@ -184,30 +184,30 @@ #endif } -static inline u_int openpic_readfield(volatile u_int *addr, u_int mask) +static inline u_int openpic_readfield(volatile u_int __iomem *addr, u_int mask) { u_int val = openpic_read(addr); return val & mask; } -inline void openpic_writefield(volatile u_int *addr, u_int mask, +inline void openpic_writefield(volatile u_int __iomem *addr, u_int mask, u_int field) { u_int val = openpic_read(addr); openpic_write(addr, (val & ~mask) | (field & mask)); } -static inline void openpic_clearfield(volatile u_int *addr, u_int mask) +static inline void openpic_clearfield(volatile u_int __iomem *addr, u_int mask) { openpic_writefield(addr, mask, 0); } -static inline void openpic_setfield(volatile u_int *addr, u_int mask) +static inline void openpic_setfield(volatile u_int __iomem *addr, u_int mask) { openpic_writefield(addr, mask, mask); } -static void openpic_safe_writefield(volatile u_int *addr, u_int mask, +static void openpic_safe_writefield(volatile u_int __iomem *addr, u_int mask, u_int field) { openpic_setfield(addr, OPENPIC_MASK); @@ -217,7 +217,7 @@ #ifdef CONFIG_SMP /* yes this is right ... bug, feature, you decide! -- tgall */ -u_int openpic_read_IPI(volatile u_int* addr) +u_int openpic_read_IPI(volatile u_int __iomem * addr) { u_int val = 0; #if defined(OPENPIC_BIG_ENDIAN) || defined(CONFIG_POWER3) @@ -229,23 +229,23 @@ } /* because of the power3 be / le above, this is needed */ -inline void openpic_writefield_IPI(volatile u_int* addr, u_int mask, u_int field) +inline void openpic_writefield_IPI(volatile u_int __iomem * addr, u_int mask, u_int field) { u_int val = openpic_read_IPI(addr); openpic_write(addr, (val & ~mask) | (field & mask)); } -static inline void openpic_clearfield_IPI(volatile u_int *addr, u_int mask) +static inline void openpic_clearfield_IPI(volatile u_int __iomem *addr, u_int mask) { openpic_writefield_IPI(addr, mask, 0); } -static inline void openpic_setfield_IPI(volatile u_int *addr, u_int mask) +static inline void openpic_setfield_IPI(volatile u_int __iomem *addr, u_int mask) { openpic_writefield_IPI(addr, mask, mask); } -static void openpic_safe_writefield_IPI(volatile u_int *addr, u_int mask, u_int field) +static void openpic_safe_writefield_IPI(volatile u_int __iomem *addr, u_int mask, u_int field) { openpic_setfield_IPI(addr, OPENPIC_MASK); @@ -287,16 +287,16 @@ } #endif -void __init openpic_set_sources(int first_irq, int num_irqs, void *first_ISR) +void __init openpic_set_sources(int first_irq, int num_irqs, void __iomem *first_ISR) { - volatile OpenPIC_Source *src = first_ISR; + volatile OpenPIC_Source __iomem *src = first_ISR; int i, last_irq; last_irq = first_irq + num_irqs; if (last_irq > NumSources) NumSources = last_irq; if (src == 0) - src = &((struct OpenPIC *)OpenPIC_Addr)->Source[first_irq]; + src = &((struct OpenPIC __iomem *)OpenPIC_Addr)->Source[first_irq]; for (i = first_irq; i < last_irq; ++i, ++src) ISR[i] = src; } @@ -318,7 +318,7 @@ printk("No OpenPIC found !\n"); return; } - OpenPIC = (volatile struct OpenPIC *)OpenPIC_Addr; + OpenPIC = (volatile struct OpenPIC __iomem *)OpenPIC_Addr; #ifdef CONFIG_EPIC_SERIAL_MODE /* Have to start from ground zero. @@ -711,7 +711,7 @@ */ static void openpic_enable_irq(u_int irq) { - volatile u_int *vpp; + volatile u_int __iomem *vpp; check_arg_irq(irq); vpp = &ISR[irq - open_pic_irq_offset]->Vector_Priority; @@ -724,7 +724,7 @@ static void openpic_disable_irq(u_int irq) { - volatile u_int *vpp; + volatile u_int __iomem *vpp; u32 vp; check_arg_irq(irq); diff -Nru a/arch/ppc/syslib/open_pic_defs.h b/arch/ppc/syslib/open_pic_defs.h --- a/arch/ppc/syslib/open_pic_defs.h 2005-01-02 23:03:34 -08:00 +++ b/arch/ppc/syslib/open_pic_defs.h 2005-01-02 23:03:34 -08:00 @@ -172,7 +172,7 @@ OpenPIC_Processor Processor[OPENPIC_MAX_PROCESSORS]; }; -extern volatile struct OpenPIC *OpenPIC; +extern volatile struct OpenPIC __iomem *OpenPIC; /* diff -Nru a/arch/ppc64/configs/g5_defconfig b/arch/ppc64/configs/g5_defconfig --- a/arch/ppc64/configs/g5_defconfig 2005-01-02 23:03:33 -08:00 +++ b/arch/ppc64/configs/g5_defconfig 2005-01-02 23:03:33 -08:00 @@ -440,7 +440,6 @@ CONFIG_IP_NF_TARGET_REDIRECT=y CONFIG_IP_NF_TARGET_NETMAP=y CONFIG_IP_NF_TARGET_SAME=y -# CONFIG_IP_NF_NAT_LOCAL is not set # CONFIG_IP_NF_NAT_SNMP_BASIC is not set CONFIG_IP_NF_MANGLE=y CONFIG_IP_NF_TARGET_TOS=y diff -Nru a/arch/ppc64/configs/iSeries_defconfig b/arch/ppc64/configs/iSeries_defconfig --- a/arch/ppc64/configs/iSeries_defconfig 2005-01-02 23:03:35 -08:00 +++ b/arch/ppc64/configs/iSeries_defconfig 2005-01-02 23:03:35 -08:00 @@ -316,7 +316,6 @@ CONFIG_IP_NF_TARGET_REDIRECT=m CONFIG_IP_NF_TARGET_NETMAP=m CONFIG_IP_NF_TARGET_SAME=m -# CONFIG_IP_NF_NAT_LOCAL is not set CONFIG_IP_NF_NAT_SNMP_BASIC=m CONFIG_IP_NF_NAT_IRC=m CONFIG_IP_NF_NAT_FTP=m diff -Nru a/arch/ppc64/configs/pSeries_defconfig b/arch/ppc64/configs/pSeries_defconfig --- a/arch/ppc64/configs/pSeries_defconfig 2005-01-02 23:03:35 -08:00 +++ b/arch/ppc64/configs/pSeries_defconfig 2005-01-02 23:03:35 -08:00 @@ -408,7 +408,6 @@ CONFIG_IP_NF_TARGET_REDIRECT=m CONFIG_IP_NF_TARGET_NETMAP=m CONFIG_IP_NF_TARGET_SAME=m -# CONFIG_IP_NF_NAT_LOCAL is not set CONFIG_IP_NF_NAT_SNMP_BASIC=m CONFIG_IP_NF_NAT_IRC=m CONFIG_IP_NF_NAT_FTP=m diff -Nru a/arch/ppc64/defconfig b/arch/ppc64/defconfig --- a/arch/ppc64/defconfig 2005-01-02 23:03:33 -08:00 +++ b/arch/ppc64/defconfig 2005-01-02 23:03:33 -08:00 @@ -374,7 +374,6 @@ CONFIG_IP_NF_TARGET_REDIRECT=m CONFIG_IP_NF_TARGET_NETMAP=m CONFIG_IP_NF_TARGET_SAME=m -# CONFIG_IP_NF_NAT_LOCAL is not set CONFIG_IP_NF_NAT_SNMP_BASIC=m CONFIG_IP_NF_NAT_IRC=m CONFIG_IP_NF_NAT_FTP=m diff -Nru a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c --- a/arch/sparc/kernel/pcic.c 2005-01-02 23:03:34 -08:00 +++ b/arch/sparc/kernel/pcic.c 2005-01-02 23:03:34 -08:00 @@ -161,7 +161,7 @@ static int pcic0_up; static struct linux_pcic pcic0; -unsigned int pcic_regs; +void * __iomem pcic_regs; volatile int pcic_speculative; volatile int pcic_trapped; @@ -313,8 +313,7 @@ pcic0_up = 1; pcic->pcic_res_regs.name = "pcic_registers"; - pcic->pcic_regs = (unsigned long) - ioremap(regs[0].phys_addr, regs[0].reg_size); + pcic->pcic_regs = ioremap(regs[0].phys_addr, regs[0].reg_size); if (!pcic->pcic_regs) { prom_printf("PCIC: Error, cannot map PCIC registers.\n"); prom_halt(); @@ -328,7 +327,7 @@ } pcic->pcic_res_cfg_addr.name = "pcic_cfg_addr"; - if ((pcic->pcic_config_space_addr = (unsigned long) + if ((pcic->pcic_config_space_addr = ioremap(regs[2].phys_addr, regs[2].reg_size * 2)) == 0) { prom_printf("PCIC: Error, cannot map" "PCI Configuration Space Address.\n"); @@ -340,7 +339,7 @@ * must be the same. Thus, we need adjust size of data. */ pcic->pcic_res_cfg_data.name = "pcic_cfg_data"; - if ((pcic->pcic_config_space_data = (unsigned long) + if ((pcic->pcic_config_space_data = ioremap(regs[3].phys_addr, regs[3].reg_size * 2)) == 0) { prom_printf("PCIC: Error, cannot map" "PCI Configuration Space Data.\n"); @@ -976,7 +975,7 @@ * We do not use horroble macroses here because we want to * advance pointer by sizeof(size). */ -void outsb(unsigned long addr, const void *src, unsigned long count) { +void outsb(void * __iomem addr, const void *src, unsigned long count) { while (count) { count -= 1; writeb(*(const char *)src, addr); @@ -985,7 +984,7 @@ } } -void outsw(unsigned long addr, const void *src, unsigned long count) { +void outsw(void * __iomem addr, const void *src, unsigned long count) { while (count) { count -= 2; writew(*(const short *)src, addr); @@ -994,7 +993,7 @@ } } -void outsl(unsigned long addr, const void *src, unsigned long count) { +void outsl(void * __iomem addr, const void *src, unsigned long count) { while (count) { count -= 4; writel(*(const long *)src, addr); @@ -1003,7 +1002,7 @@ } } -void insb(unsigned long addr, void *dst, unsigned long count) { +void insb(void * __iomem addr, void *dst, unsigned long count) { while (count) { count -= 1; *(unsigned char *)dst = readb(addr); @@ -1012,7 +1011,7 @@ } } -void insw(unsigned long addr, void *dst, unsigned long count) { +void insw(void * __iomem addr, void *dst, unsigned long count) { while (count) { count -= 2; *(unsigned short *)dst = readw(addr); @@ -1021,7 +1020,7 @@ } } -void insl(unsigned long addr, void *dst, unsigned long count) { +void insl(void * __iomem addr, void *dst, unsigned long count) { while (count) { count -= 4; /* diff -Nru a/arch/sparc/kernel/signal.c b/arch/sparc/kernel/signal.c --- a/arch/sparc/kernel/signal.c 2005-01-02 23:03:34 -08:00 +++ b/arch/sparc/kernel/signal.c 2005-01-02 23:03:34 -08:00 @@ -1016,6 +1016,7 @@ sigsegv_and_return: force_sig(SIGSEGV, current); + return -EFAULT; } static inline void diff -Nru a/arch/sparc/kernel/sun4d_smp.c b/arch/sparc/kernel/sun4d_smp.c --- a/arch/sparc/kernel/sun4d_smp.c 2005-01-02 23:03:33 -08:00 +++ b/arch/sparc/kernel/sun4d_smp.c 2005-01-02 23:03:33 -08:00 @@ -122,8 +122,7 @@ /* Fix idle thread fields. */ __asm__ __volatile__("ld [%0], %%g6\n\t" - "sta %%g6, [%%g0] %1\n\t" - : : "r" (¤t_set[cpuid]), "i" (ASI_M_VIKING_TMP2) + : : "r" (¤t_set[cpuid]) : "memory" /* paranoid */); cpu_leds[cpuid] = 0x9; @@ -460,25 +459,18 @@ void __init smp4d_blackbox_current(unsigned *addr) { - /* We have a nice Linux current register :) */ - int rd = addr[1] & 0x3e000000; + int rd = *addr & 0x3e000000; - addr[0] = 0x10800006; /* b .+24 */ - addr[1] = 0xc0800820 | rd; /* lda [%g0] ASI_M_VIKING_TMP2, reg */ + addr[0] = 0xc0800800 | rd; /* lda [%g0] ASI_M_VIKING_TMP1, reg */ + addr[2] = 0x81282002 | rd | (rd >> 11); /* sll reg, 2, reg */ + addr[4] = 0x01000000; /* nop */ } void __init sun4d_init_smp(void) { int i; - extern unsigned int patchme_store_new_current[]; extern unsigned int t_nmi[], linux_trap_ipi15_sun4d[], linux_trap_ipi15_sun4m[]; - /* Store current into Linux current register :) */ - __asm__ __volatile__("sta %%g6, [%%g0] %0" : : "i"(ASI_M_VIKING_TMP2)); - - /* Patch switch_to */ - patchme_store_new_current[0] = (patchme_store_new_current[0] & 0x3e000000) | 0xc0a00820; - /* Patch ipi15 trap table */ t_nmi[1] = t_nmi[1] + (linux_trap_ipi15_sun4d - linux_trap_ipi15_sun4m); diff -Nru a/arch/sparc/lib/bitext.c b/arch/sparc/lib/bitext.c --- a/arch/sparc/lib/bitext.c 2005-01-02 23:03:34 -08:00 +++ b/arch/sparc/lib/bitext.c 2005-01-02 23:03:34 -08:00 @@ -29,10 +29,17 @@ int offset, count; /* siamese twins */ int off_new; int align1; - int i; + int i, color; - if (align == 0) - align = 1; + if (t->num_colors) { + /* align is overloaded to be the page color */ + color = align; + align = t->num_colors; + } else { + color = 0; + if (align == 0) + align = 1; + } align1 = align - 1; if ((align & align1) != 0) BUG(); @@ -40,6 +47,7 @@ BUG(); if (len <= 0 || len > t->size) BUG(); + color &= align1; spin_lock(&t->lock); if (len < t->last_size) @@ -49,7 +57,7 @@ count = 0; for (;;) { off_new = find_next_zero_bit(t->map, t->size, offset); - off_new = (off_new + align1) & ~align1; + off_new = ((off_new + align1) & ~align1) + color; count += off_new - offset; offset = off_new; if (offset >= t->size) @@ -121,6 +129,4 @@ spin_lock_init(&t->lock); t->map = map; t->size = size; - t->last_size = 0; - t->first_free = 0; } diff -Nru a/arch/sparc/mm/fault.c b/arch/sparc/mm/fault.c --- a/arch/sparc/mm/fault.c 2005-01-02 23:03:35 -08:00 +++ b/arch/sparc/mm/fault.c 2005-01-02 23:03:35 -08:00 @@ -294,16 +294,17 @@ * the fault. */ switch (handle_mm_fault(mm, vma, address, write)) { - case 1: - current->min_flt++; - break; - case 2: + case VM_FAULT_SIGBUS: + goto do_sigbus; + case VM_FAULT_OOM: + goto out_of_memory; + case VM_FAULT_MAJOR: current->maj_flt++; break; - case 0: - goto do_sigbus; + case VM_FAULT_MINOR: default: - goto out_of_memory; + current->min_flt++; + break; } up_read(&mm->mmap_sem); return; @@ -535,8 +536,11 @@ if(!(vma->vm_flags & (VM_READ | VM_EXEC))) goto bad_area; } - if (!handle_mm_fault(mm, vma, address, write)) + switch (handle_mm_fault(mm, vma, address, write)) { + case VM_FAULT_SIGBUS: + case VM_FAULT_OOM: goto do_sigbus; + } up_read(&mm->mmap_sem); return; bad_area: diff -Nru a/arch/sparc/mm/io-unit.c b/arch/sparc/mm/io-unit.c --- a/arch/sparc/mm/io-unit.c 2005-01-02 23:03:34 -08:00 +++ b/arch/sparc/mm/io-unit.c 2005-01-02 23:03:34 -08:00 @@ -196,7 +196,7 @@ pte_t *ptep; long i; - pgdp = pgd_offset(init_task.mm, addr); + pgdp = pgd_offset(&init_mm, addr); pmdp = pmd_offset(pgdp, addr); ptep = pte_offset_map(pmdp, addr); diff -Nru a/arch/sparc/mm/iommu.c b/arch/sparc/mm/iommu.c --- a/arch/sparc/mm/iommu.c 2005-01-02 23:03:35 -08:00 +++ b/arch/sparc/mm/iommu.c 2005-01-02 23:03:35 -08:00 @@ -119,6 +119,13 @@ prom_halt(); } bit_map_init(&iommu->usemap, bitmap, IOMMU_NPTES); + /* To be coherent on HyperSparc, the page color of DVMA + * and physical addresses must match. + */ + if (srmmu_modtype == HyperSparc) + iommu->usemap.num_colors = vac_cache_size >> PAGE_SHIFT; + else + iommu->usemap.num_colors = 1; printk("IOMMU: impl %d vers %d table 0x%p[%d B] map [%d b]\n", impl, vers, iommu->page_table, @@ -128,7 +135,9 @@ } /* This begs to be btfixup-ed by srmmu. */ -static void iommu_viking_flush_iotlb(iopte_t *iopte, unsigned int niopte) +/* Flush the iotlb entries to ram. */ +/* This could be better if we didn't have to flush whole pages. */ +static void iommu_flush_iotlb(iopte_t *iopte, unsigned int niopte) { unsigned long start; unsigned long end; @@ -145,6 +154,11 @@ viking_flush_page(start); start += PAGE_SIZE; } + } else { + while(start < end) { + __flush_page_to_ram(start); + start += PAGE_SIZE; + } } } @@ -156,7 +170,8 @@ unsigned int busa, busa0; int i; - ioptex = bit_map_string_get(&iommu->usemap, npages, 1); + /* page color = pfn of page */ + ioptex = bit_map_string_get(&iommu->usemap, npages, page_to_pfn(page)); if (ioptex < 0) panic("iommu out"); busa0 = iommu->start + (ioptex << PAGE_SHIFT); @@ -172,8 +187,7 @@ page++; } - iommu_viking_flush_iotlb(iopte0, npages); - flush_cache_all(); // hack to fix dma errors with hypersparc + iommu_flush_iotlb(iopte0, npages); return busa0; } @@ -328,7 +342,9 @@ if ((addr & ~PAGE_MASK) != 0) BUG(); if ((len & ~PAGE_MASK) != 0) BUG(); - ioptex = bit_map_string_get(&iommu->usemap, len >> PAGE_SHIFT, 1); + /* page color = physical address */ + ioptex = bit_map_string_get(&iommu->usemap, len >> PAGE_SHIFT, + addr >> PAGE_SHIFT); if (ioptex < 0) panic("iommu out"); @@ -372,7 +388,7 @@ * to handle the latter case as well. */ flush_cache_all(); - iommu_viking_flush_iotlb(first, len >> PAGE_SHIFT); + iommu_flush_iotlb(first, len >> PAGE_SHIFT); flush_tlb_all(); iommu_invalidate(iommu->regs); diff -Nru a/arch/sparc/prom/ranges.c b/arch/sparc/prom/ranges.c --- a/arch/sparc/prom/ranges.c 2005-01-02 23:03:34 -08:00 +++ b/arch/sparc/prom/ranges.c 2005-01-02 23:03:34 -08:00 @@ -34,7 +34,7 @@ } } -static void +void prom_adjust_ranges(struct linux_prom_ranges *ranges1, int nranges1, struct linux_prom_ranges *ranges2, int nranges2) { diff -Nru a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig --- a/arch/sparc64/Kconfig 2005-01-02 23:03:35 -08:00 +++ b/arch/sparc64/Kconfig 2005-01-02 23:03:35 -08:00 @@ -591,6 +591,8 @@ source "drivers/usb/Kconfig" +source "drivers/infiniband/Kconfig" + source "drivers/char/watchdog/Kconfig" source "arch/sparc64/oprofile/Kconfig" diff -Nru a/arch/sparc64/defconfig b/arch/sparc64/defconfig --- a/arch/sparc64/defconfig 2005-01-02 23:03:33 -08:00 +++ b/arch/sparc64/defconfig 2005-01-02 23:03:33 -08:00 @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit -# Linux kernel version: 2.6.10-rc3 -# Wed Dec 8 21:14:26 2004 +# Linux kernel version: 2.6.10 +# Mon Dec 27 22:36:56 2004 # CONFIG_64BIT=y CONFIG_MMU=y @@ -601,7 +601,6 @@ CONFIG_IP_NF_TARGET_REDIRECT=m CONFIG_IP_NF_TARGET_NETMAP=m CONFIG_IP_NF_TARGET_SAME=m -CONFIG_IP_NF_NAT_LOCAL=y CONFIG_IP_NF_NAT_SNMP_BASIC=m CONFIG_IP_NF_NAT_IRC=m CONFIG_IP_NF_NAT_FTP=m @@ -675,6 +674,7 @@ CONFIG_BRIDGE_EBT_REDIRECT=m CONFIG_BRIDGE_EBT_SNAT=m CONFIG_BRIDGE_EBT_LOG=m +CONFIG_BRIDGE_EBT_ULOG=m CONFIG_XFRM=y CONFIG_XFRM_USER=m @@ -741,6 +741,7 @@ CONFIG_NET_CLS_U32=m CONFIG_CLS_U32_PERF=y CONFIG_NET_CLS_IND=y +CONFIG_CLS_U32_MARK=y CONFIG_NET_CLS_RSVP=m CONFIG_NET_CLS_RSVP6=m CONFIG_NET_CLS_ACT=y @@ -926,6 +927,7 @@ CONFIG_YELLOWFIN=m CONFIG_R8169=m CONFIG_R8169_NAPI=y +CONFIG_R8169_VLAN=y CONFIG_SK98LIN=m CONFIG_VIA_VELOCITY=m CONFIG_TIGON3=m @@ -937,6 +939,7 @@ CONFIG_IXGB_NAPI=y CONFIG_S2IO=m CONFIG_S2IO_NAPI=y +CONFIG_2BUFF_MODE=y # # Token Ring devices @@ -1333,7 +1336,7 @@ CONFIG_CIFS=m # CONFIG_CIFS_STATS is not set # CONFIG_CIFS_XATTR is not set -CONFIG_CIFS_POSIX=y +# CONFIG_CIFS_EXPERIMENTAL is not set CONFIG_NCP_FS=m # CONFIG_NCPFS_PACKET_SIGNING is not set # CONFIG_NCPFS_IOCTL_LOCKING is not set @@ -1460,7 +1463,7 @@ # CONFIG_DVB_TTUSB_BUDGET is not set CONFIG_DVB_TTUSB_DEC=m CONFIG_DVB_DIBUSB=m -CONFIG_DVB_DIBUSB_MISDESIGNED_AN2235=y +# CONFIG_DVB_DIBUSB_MISDESIGNED_DEVICES is not set CONFIG_DVB_DIBCOM_DEBUG=y CONFIG_DVB_CINERGYT2=m # CONFIG_DVB_CINERGYT2_TUNING is not set @@ -1469,6 +1472,7 @@ # Supported FlexCopII (B2C2) Adapters # CONFIG_DVB_B2C2_SKYSTAR=m +CONFIG_DVB_B2C2_USB=m # # Supported BT878 Adapters @@ -1505,6 +1509,7 @@ CONFIG_DVB_NXT6000=m CONFIG_DVB_MT352=m CONFIG_DVB_DIB3000MB=m +CONFIG_DVB_DIB3000MC=m # # DVB-C (cable) frontends @@ -1636,6 +1641,7 @@ # CONFIG_USB_EHCI_ROOT_HUB_TT is not set CONFIG_USB_OHCI_HCD=y CONFIG_USB_UHCI_HCD=m +CONFIG_USB_SL811_HCD=m # # USB Device Class drivers @@ -1807,6 +1813,15 @@ # CONFIG_USB_GADGET 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 + +# # Watchdog Cards # CONFIG_WATCHDOG=y @@ -1890,6 +1905,10 @@ CONFIG_CRYPTO_MICHAEL_MIC=m CONFIG_CRYPTO_CRC32C=m CONFIG_CRYPTO_TEST=m + +# +# Hardware crypto devices +# # # Library routines diff -Nru a/arch/sparc64/solaris/ioctl.c b/arch/sparc64/solaris/ioctl.c --- a/arch/sparc64/solaris/ioctl.c 2005-01-02 23:03:34 -08:00 +++ b/arch/sparc64/solaris/ioctl.c 2005-01-02 23:03:34 -08:00 @@ -298,7 +298,7 @@ if (! current->files->fd[fd] || ! current->files->fd[fd]->f_dentry || ! (ino = current->files->fd[fd]->f_dentry->d_inode) || - ! ino->i_sock) { + ! S_ISSOCK(ino->i_mode)) { spin_unlock(¤t->files->file_lock); return TBADF; } @@ -478,7 +478,7 @@ struct module_info *mi; ino = filp->f_dentry->d_inode; - if (! ino->i_sock) + if (!S_ISSOCK(ino->i_mode)) return -EBADF; sock = filp->private_data; if (! sock) { diff -Nru a/arch/sparc64/solaris/socksys.c b/arch/sparc64/solaris/socksys.c --- a/arch/sparc64/solaris/socksys.c 2005-01-02 23:03:33 -08:00 +++ b/arch/sparc64/solaris/socksys.c 2005-01-02 23:03:33 -08:00 @@ -150,7 +150,7 @@ unsigned int mask = 0; ino=filp->f_dentry->d_inode; - if (ino && ino->i_sock) { + if (ino && S_ISSOCK(ino->i_mode)) { struct sol_socket_struct *sock; sock = (struct sol_socket_struct*)filp->private_data; if (sock && sock->pfirst) { diff -Nru a/arch/sparc64/solaris/timod.c b/arch/sparc64/solaris/timod.c --- a/arch/sparc64/solaris/timod.c 2005-01-02 23:03:33 -08:00 +++ b/arch/sparc64/solaris/timod.c 2005-01-02 23:03:33 -08:00 @@ -853,9 +853,7 @@ if(!filp) goto out; ino = filp->f_dentry->d_inode; - if (!ino) goto out; - - if (!ino->i_sock) + if (!ino || !S_ISSOCK(ino->i_mode)) goto out; ctlptr = (struct strbuf __user *)A(arg1); @@ -923,7 +921,7 @@ ino = filp->f_dentry->d_inode; if (!ino) goto out; - if (!ino->i_sock && + if (!S_ISSOCK(ino->i_mode) && (imajor(ino) != 30 || iminor(ino) != 1)) goto out; diff -Nru a/arch/x86_64/ia32/syscall32.c b/arch/x86_64/ia32/syscall32.c --- a/arch/x86_64/ia32/syscall32.c 2005-01-02 23:03:34 -08:00 +++ b/arch/x86_64/ia32/syscall32.c 2005-01-02 23:03:34 -08:00 @@ -40,23 +40,30 @@ */ int __map_syscall32(struct mm_struct *mm, unsigned long address) { + pgd_t *pgd; + pgd_t *pud; pte_t *pte; pmd_t *pmd; - int err = 0; + int err = -ENOMEM; spin_lock(&mm->page_table_lock); - pmd = pmd_alloc(mm, pgd_offset(mm, address), address); - if (pmd && (pte = pte_alloc_map(mm, pmd, address)) != NULL) { - if (pte_none(*pte)) { - set_pte(pte, - mk_pte(virt_to_page(syscall32_page), - PAGE_KERNEL_VSYSCALL)); + pgd = pgd_offset(mm, address); + pud = pud_alloc(mm, pgd, address); + if (pud) { + pmd = pmd_alloc(mm, pud, address); + if (pmd && (pte = pte_alloc_map(mm, pmd, address)) != NULL) { + if (pte_none(*pte)) { + set_pte(pte, + mk_pte(virt_to_page(syscall32_page), + PAGE_KERNEL_VSYSCALL)); + } + /* Flush only the local CPU. Other CPUs taking a fault + will just end up here again + This probably not needed and just paranoia. */ + __flush_tlb_one(address); + err = 0; } - /* Flush only the local CPU. Other CPUs taking a fault - will just end up here again */ - __flush_tlb_one(address); - } else - err = -ENOMEM; + } spin_unlock(&mm->page_table_lock); return err; } diff -Nru a/arch/x86_64/kernel/acpi/sleep.c b/arch/x86_64/kernel/acpi/sleep.c --- a/arch/x86_64/kernel/acpi/sleep.c 2005-01-02 23:03:33 -08:00 +++ b/arch/x86_64/kernel/acpi/sleep.c 2005-01-02 23:03:33 -08:00 @@ -61,9 +61,13 @@ extern unsigned long FASTCALL(acpi_copy_wakeup_routine(unsigned long)); +static pgd_t low_ptr; + static void init_low_mapping(void) { - cpu_pda[0].level4_pgt[0] = cpu_pda[0].level4_pgt[pml4_index(PAGE_OFFSET)]; + pgd_t *slot0 = pgd_offset(current->mm, 0UL); + low_ptr = *slot0; + set_pgd(slot0, *pgd_offset(current->mm, PAGE_OFFSET)); flush_tlb_all(); } @@ -97,7 +101,7 @@ */ void acpi_restore_state_mem (void) { - cpu_pda[0].level4_pgt[0] = 0; + set_pgd(pgd_offset(current->mm, 0UL), low_ptr); flush_tlb_all(); } diff -Nru a/arch/x86_64/kernel/head.S b/arch/x86_64/kernel/head.S --- a/arch/x86_64/kernel/head.S 2005-01-02 23:03:34 -08:00 +++ b/arch/x86_64/kernel/head.S 2005-01-02 23:03:34 -08:00 @@ -225,7 +225,6 @@ .quad 0x0000000000103007 /* -> level3_kernel_pgt */ .org 0x2000 -/* Kernel does not "know" about 4-th level of page tables. */ ENTRY(level3_ident_pgt) .quad 0x0000000000104007 .fill 511,8,0 diff -Nru a/arch/x86_64/kernel/init_task.c b/arch/x86_64/kernel/init_task.c --- a/arch/x86_64/kernel/init_task.c 2005-01-02 23:03:34 -08:00 +++ b/arch/x86_64/kernel/init_task.c 2005-01-02 23:03:34 -08:00 @@ -47,5 +47,3 @@ DEFINE_PER_CPU(struct tss_struct, init_tss) ____cacheline_maxaligned_in_smp; #define ALIGN_TO_4K __attribute__((section(".data.init_task"))) - -pgd_t boot_vmalloc_pgt[512] ALIGN_TO_4K; diff -Nru a/arch/x86_64/kernel/reboot.c b/arch/x86_64/kernel/reboot.c --- a/arch/x86_64/kernel/reboot.c 2005-01-02 23:03:34 -08:00 +++ b/arch/x86_64/kernel/reboot.c 2005-01-02 23:03:34 -08:00 @@ -74,7 +74,7 @@ local_irq_disable(); /* restore identity mapping */ - init_level4_pgt[0] = __pml4(__pa(level3_ident_pgt) | 7); + init_level4_pgt[0] = __pgd(__pa(level3_ident_pgt) | 7); __flush_tlb_all(); /* Move the trampoline to low memory */ diff -Nru a/arch/x86_64/kernel/setup64.c b/arch/x86_64/kernel/setup64.c --- a/arch/x86_64/kernel/setup64.c 2005-01-02 23:03:33 -08:00 +++ b/arch/x86_64/kernel/setup64.c 2005-01-02 23:03:33 -08:00 @@ -66,7 +66,7 @@ /* * Great future plan: - * Declare PDA itself and support (irqstack,tss,pml4) as per cpu data. + * Declare PDA itself and support (irqstack,tss,pgd) as per cpu data. * Always point %gs to its beginning */ void __init setup_per_cpu_areas(void) @@ -100,7 +100,6 @@ void pda_init(int cpu) { - pml4_t *level4; struct x8664_pda *pda = &cpu_pda[cpu]; /* Setup up data that may be needed in __get_free_pages early */ @@ -119,22 +118,14 @@ /* others are initialized in smpboot.c */ pda->pcurrent = &init_task; pda->irqstackptr = boot_cpu_stack; - level4 = init_level4_pgt; } else { - level4 = (pml4_t *)__get_free_pages(GFP_ATOMIC, 0); - if (!level4) - panic("Cannot allocate top level page for cpu %d", cpu); pda->irqstackptr = (char *) __get_free_pages(GFP_ATOMIC, IRQSTACK_ORDER); if (!pda->irqstackptr) panic("cannot allocate irqstack for cpu %d", cpu); } - pda->level4_pgt = (unsigned long *)level4; - if (level4 != init_level4_pgt) - memcpy(level4, &init_level4_pgt, PAGE_SIZE); - set_pml4(level4 + 510, mk_kernel_pml4(__pa_symbol(boot_vmalloc_pgt))); - asm volatile("movq %0,%%cr3" :: "r" (__pa(level4))); + asm volatile("movq %0,%%cr3" :: "r" (__pa_symbol(&init_level4_pgt))); pda->irqstackptr += IRQSTACKSIZE-64; } diff -Nru a/arch/x86_64/lib/io.c b/arch/x86_64/lib/io.c --- a/arch/x86_64/lib/io.c 2005-01-02 23:03:33 -08:00 +++ b/arch/x86_64/lib/io.c 2005-01-02 23:03:33 -08:00 @@ -2,14 +2,14 @@ #include #include -void *__memcpy_toio(unsigned long dst,const void*src,unsigned len) +void __memcpy_toio(unsigned long dst,const void*src,unsigned len) { - return __inline_memcpy((void *) dst,src,len); + __inline_memcpy((void *) dst,src,len); } EXPORT_SYMBOL(__memcpy_toio); -void *__memcpy_fromio(void *dst,unsigned long src,unsigned len) +void __memcpy_fromio(void *dst,unsigned long src,unsigned len) { - return __inline_memcpy(dst,(const void *) src,len); + __inline_memcpy(dst,(const void *) src,len); } EXPORT_SYMBOL(__memcpy_fromio); diff -Nru a/arch/x86_64/mm/fault.c b/arch/x86_64/mm/fault.c --- a/arch/x86_64/mm/fault.c 2005-01-02 23:03:33 -08:00 +++ b/arch/x86_64/mm/fault.c 2005-01-02 23:03:33 -08:00 @@ -143,25 +143,25 @@ void dump_pagetable(unsigned long address) { - pml4_t *pml4; pgd_t *pgd; + pud_t *pud; pmd_t *pmd; pte_t *pte; - asm("movq %%cr3,%0" : "=r" (pml4)); + asm("movq %%cr3,%0" : "=r" (pgd)); - pml4 = __va((unsigned long)pml4 & PHYSICAL_PAGE_MASK); - pml4 += pml4_index(address); - printk("PML4 %lx ", pml4_val(*pml4)); - if (bad_address(pml4)) goto bad; - if (!pml4_present(*pml4)) goto ret; - - pgd = __pgd_offset_k((pgd_t *)pml4_page(*pml4), address); + pgd = __va((unsigned long)pgd & PHYSICAL_PAGE_MASK); + pgd += pgd_index(address); + printk("PGD %lx ", pgd_val(*pgd)); if (bad_address(pgd)) goto bad; - printk("PGD %lx ", pgd_val(*pgd)); - if (!pgd_present(*pgd)) goto ret; + if (!pgd_present(*pgd)) goto ret; + + pud = __pud_offset_k((pud_t *)pgd_page(*pgd), address); + if (bad_address(pud)) goto bad; + printk("PUD %lx ", pud_val(*pud)); + if (!pud_present(*pud)) goto ret; - pmd = pmd_offset(pgd, address); + pmd = pmd_offset(pud, address); if (bad_address(pmd)) goto bad; printk("PMD %lx ", pmd_val(*pmd)); if (!pmd_present(*pmd)) goto ret; @@ -232,7 +232,53 @@ do_exit(SIGKILL); } -int page_fault_trace; +/* + * Handle a fault on the vmalloc or module mapping area + */ +static int vmalloc_fault(unsigned long address) +{ + pgd_t *pgd, *pgd_ref; + pud_t *pud, *pud_ref; + pmd_t *pmd, *pmd_ref; + pte_t *pte, *pte_ref; + + /* Copy kernel mappings over when needed. This can also + happen within a race in page table update. In the later + case just flush. */ + + pgd = pgd_offset(current->mm ?: &init_mm, address); + pgd_ref = pgd_offset_k(address); + if (pgd_none(*pgd_ref)) + return -1; + if (pgd_none(*pgd)) + set_pgd(pgd, *pgd_ref); + + /* Below here mismatches are bugs because these lower tables + are shared */ + + pud = pud_offset(pgd, address); + pud_ref = pud_offset(pgd_ref, address); + if (pud_none(*pud_ref)) + return -1; + if (pud_none(*pud) || pud_page(*pud) != pud_page(*pud_ref)) + BUG(); + pmd = pmd_offset(pud, address); + pmd_ref = pmd_offset(pud_ref, address); + if (pmd_none(*pmd_ref)) + return -1; + if (pmd_none(*pmd) || pmd_page(*pmd) != pmd_page(*pmd_ref)) + BUG(); + pte_ref = pte_offset_kernel(pmd_ref, address); + if (!pte_present(*pte_ref)) + return -1; + pte = pte_offset_kernel(pmd, address); + if (!pte_present(*pte) || pte_page(*pte) != pte_page(*pte_ref)) + BUG(); + __flush_tlb_all(); + return 0; +} + +int page_fault_trace = 0; int exception_trace = 1; /* @@ -300,8 +346,11 @@ * protection error (error_code & 1) == 0. */ if (unlikely(address >= TASK_SIZE)) { - if (!(error_code & 5)) - goto vmalloc_fault; + if (!(error_code & 5)) { + if (vmalloc_fault(address) < 0) + goto bad_area_nosemaphore; + return; + } /* * Don't take the mm semaphore here. If we fixup a prefetch * fault we could otherwise deadlock. @@ -310,7 +359,7 @@ } if (unlikely(error_code & (1 << 3))) - goto page_table_corruption; + pgtable_bad(address, regs, error_code); /* * If we're in an interrupt or have no user @@ -524,34 +573,4 @@ info.si_addr = (void __user *)address; force_sig_info(SIGBUS, &info, tsk); return; - -vmalloc_fault: - { - pgd_t *pgd; - pmd_t *pmd; - pte_t *pte; - - /* - * x86-64 has the same kernel 3rd level pages for all CPUs. - * But for vmalloc/modules the TLB synchronization works lazily, - * so it can happen that we get a page fault for something - * that is really already in the page table. Just check if it - * is really there and when yes flush the local TLB. - */ - pgd = pgd_offset_k(address); - if (!pgd_present(*pgd)) - goto bad_area_nosemaphore; - pmd = pmd_offset(pgd, address); - if (!pmd_present(*pmd)) - goto bad_area_nosemaphore; - pte = pte_offset_kernel(pmd, address); - if (!pte_present(*pte)) - goto bad_area_nosemaphore; - - __flush_tlb_all(); - return; - } - -page_table_corruption: - pgtable_bad(address, regs, error_code); } diff -Nru a/arch/x86_64/mm/init.c b/arch/x86_64/mm/init.c --- a/arch/x86_64/mm/init.c 2005-01-02 23:03:33 -08:00 +++ b/arch/x86_64/mm/init.c 2005-01-02 23:03:33 -08:00 @@ -108,28 +108,28 @@ static void set_pte_phys(unsigned long vaddr, unsigned long phys, pgprot_t prot) { - pml4_t *level4; pgd_t *pgd; + pud_t *pud; pmd_t *pmd; pte_t *pte, new_pte; Dprintk("set_pte_phys %lx to %lx\n", vaddr, phys); - level4 = pml4_offset_k(vaddr); - if (pml4_none(*level4)) { - printk("PML4 FIXMAP MISSING, it should be setup in head.S!\n"); + pgd = pgd_offset_k(vaddr); + if (pgd_none(*pgd)) { + printk("PGD FIXMAP MISSING, it should be setup in head.S!\n"); return; } - pgd = level3_offset_k(level4, vaddr); - if (pgd_none(*pgd)) { + pud = pud_offset(pgd, vaddr); + if (pud_none(*pud)) { pmd = (pmd_t *) spp_getpage(); - set_pgd(pgd, __pgd(__pa(pmd) | _KERNPG_TABLE | _PAGE_USER)); - if (pmd != pmd_offset(pgd, 0)) { - printk("PAGETABLE BUG #01! %p <-> %p\n", pmd, pmd_offset(pgd,0)); + set_pud(pud, __pud(__pa(pmd) | _KERNPG_TABLE | _PAGE_USER)); + if (pmd != pmd_offset(pud, 0)) { + printk("PAGETABLE BUG #01! %p <-> %p\n", pmd, pmd_offset(pud,0)); return; } } - pmd = pmd_offset(pgd, vaddr); + pmd = pmd_offset(pud, vaddr); if (pmd_none(*pmd)) { pte = (pte_t *) spp_getpage(); set_pmd(pmd, __pmd(__pa(pte) | _KERNPG_TABLE | _PAGE_USER)); @@ -210,31 +210,31 @@ ti->allocated = 0; } -static void __init phys_pgd_init(pgd_t *pgd, unsigned long address, unsigned long end) +static void __init phys_pud_init(pud_t *pud, unsigned long address, unsigned long end) { long i, j; - i = pgd_index(address); - pgd = pgd + i; - for (; i < PTRS_PER_PGD; pgd++, i++) { + i = pud_index(address); + pud = pud + i; + for (; i < PTRS_PER_PUD; pud++, i++) { int map; unsigned long paddr, pmd_phys; pmd_t *pmd; - paddr = (address & PML4_MASK) + i*PGDIR_SIZE; + paddr = address + i*PUD_SIZE; if (paddr >= end) { - for (; i < PTRS_PER_PGD; i++, pgd++) - set_pgd(pgd, __pgd(0)); + for (; i < PTRS_PER_PUD; i++, pud++) + set_pud(pud, __pud(0)); break; } - if (!e820_mapped(paddr, paddr+PGDIR_SIZE, 0)) { - set_pgd(pgd, __pgd(0)); + if (!e820_mapped(paddr, paddr+PUD_SIZE, 0)) { + set_pud(pud, __pud(0)); continue; } pmd = alloc_low_page(&map, &pmd_phys); - set_pgd(pgd, __pgd(pmd_phys | _KERNPG_TABLE)); + set_pud(pud, __pud(pmd_phys | _KERNPG_TABLE)); for (j = 0; j < PTRS_PER_PMD; pmd++, j++, paddr += PMD_SIZE) { unsigned long pe; @@ -260,7 +260,7 @@ unsigned long adr; unsigned long end; unsigned long next; - unsigned long pgds, pmds, tables; + unsigned long puds, pmds, tables; Dprintk("init_memory_mapping\n"); @@ -273,9 +273,9 @@ * discovered. */ - pgds = (end + PGDIR_SIZE - 1) >> PGDIR_SHIFT; + puds = (end + PUD_SIZE - 1) >> PUD_SHIFT; pmds = (end + PMD_SIZE - 1) >> PMD_SHIFT; - tables = round_up(pgds*8, PAGE_SIZE) + round_up(pmds * 8, PAGE_SIZE); + tables = round_up(puds*8, PAGE_SIZE) + round_up(pmds * 8, PAGE_SIZE); table_start = find_e820_area(0x8000, __pa_symbol(&_text), tables); if (table_start == -1UL) @@ -288,13 +288,13 @@ for (adr = PAGE_OFFSET; adr < end; adr = next) { int map; - unsigned long pgd_phys; - pgd_t *pgd = alloc_low_page(&map, &pgd_phys); - next = adr + PML4_SIZE; + unsigned long pud_phys; + pud_t *pud = alloc_low_page(&map, &pud_phys); + next = adr + PGDIR_SIZE; if (next > end) next = end; - phys_pgd_init(pgd, adr-PAGE_OFFSET, next-PAGE_OFFSET); - set_pml4(init_level4_pgt + pml4_index(adr), mk_kernel_pml4(pgd_phys)); + phys_pud_init(pud, adr-PAGE_OFFSET, next-PAGE_OFFSET); + set_pgd(init_level4_pgt + pgd_index(adr), mk_kernel_pgd(pud_phys)); unmap_low_page(map); } asm volatile("movq %%cr4,%0" : "=r" (mmu_cr4_features)); @@ -306,25 +306,12 @@ extern struct x8664_pda cpu_pda[NR_CPUS]; -static unsigned long low_pml4[NR_CPUS]; - -void swap_low_mappings(void) -{ - int i; - for (i = 0; i < NR_CPUS; i++) { - unsigned long t; - if (!cpu_pda[i].level4_pgt) - continue; - t = cpu_pda[i].level4_pgt[0]; - cpu_pda[i].level4_pgt[0] = low_pml4[i]; - low_pml4[i] = t; - } - flush_tlb_all(); -} - +/* Assumes all CPUs still execute in init_mm */ void zap_low_mappings(void) { - swap_low_mappings(); + pgd_t *pgd = pgd_offset_k(0UL); + pgd_clear(pgd); + flush_tlb_all(); } #ifndef CONFIG_DISCONTIGMEM @@ -361,10 +348,14 @@ for (; address < end; address += LARGE_PAGE_SIZE) { pgd_t *pgd = pgd_offset_k(address); - pmd_t *pmd; - if (!pgd || pgd_none(*pgd)) + pud_t *pud; + pmd_t *pmd; + if (pgd_none(*pgd)) + continue; + pud = pud_offset(pgd, address); + if (pud_none(*pud)) continue; - pmd = pmd_offset(pgd, address); + pmd = pmd_offset(pud, address); if (!pmd || pmd_none(*pmd)) continue; if (0 == (pmd_val(*pmd) & _PAGE_PSE)) { @@ -531,29 +522,29 @@ int kern_addr_valid(unsigned long addr) { unsigned long above = ((long)addr) >> __VIRTUAL_MASK_SHIFT; - pml4_t *pml4; pgd_t *pgd; + pud_t *pud; pmd_t *pmd; pte_t *pte; if (above != 0 && above != -1UL) return 0; - pml4 = pml4_offset_k(addr); - if (pml4_none(*pml4)) + pgd = pgd_offset_k(addr); + if (pgd_none(*pgd)) return 0; - pgd = pgd_offset_k(addr); - if (pgd_none(*pgd)) + pud = pud_offset(pgd, addr); + if (pud_none(*pud)) return 0; - pmd = pmd_offset(pgd, addr); + pmd = pmd_offset(pud, addr); if (pmd_none(*pmd)) return 0; if (pmd_large(*pmd)) return pfn_valid(pmd_pfn(*pmd)); - pte = pte_offset_kernel(pmd, addr); + pte = pte_offset_kernel(pmd, addr); if (pte_none(*pte)) return 0; return pfn_valid(pte_pfn(*pte)); diff -Nru a/arch/x86_64/mm/ioremap.c b/arch/x86_64/mm/ioremap.c --- a/arch/x86_64/mm/ioremap.c 2005-01-02 23:03:35 -08:00 +++ b/arch/x86_64/mm/ioremap.c 2005-01-02 23:03:35 -08:00 @@ -49,10 +49,10 @@ { unsigned long end; - address &= ~PGDIR_MASK; + address &= ~PUD_MASK; end = address + size; - if (end > PGDIR_SIZE) - end = PGDIR_SIZE; + if (end > PUD_SIZE) + end = PUD_SIZE; phys_addr -= address; if (address >= end) BUG(); @@ -67,31 +67,54 @@ return 0; } +static inline int remap_area_pud(pud_t * pud, unsigned long address, unsigned long size, + unsigned long phys_addr, unsigned long flags) +{ + unsigned long end; + + address &= ~PGDIR_MASK; + end = address + size; + if (end > PGDIR_SIZE) + end = PGDIR_SIZE; + phys_addr -= address; + if (address >= end) + BUG(); + do { + pmd_t * pmd = pmd_alloc(&init_mm, pud, address); + if (!pmd) + return -ENOMEM; + remap_area_pmd(pmd, address, end - address, address + phys_addr, flags); + address = (address + PUD_SIZE) & PUD_MASK; + pmd++; + } while (address && (address < end)); + return 0; +} + static int remap_area_pages(unsigned long address, unsigned long phys_addr, unsigned long size, unsigned long flags) { int error; - pgd_t * dir; + pgd_t *pgd; unsigned long end = address + size; phys_addr -= address; - dir = pgd_offset_k(address); + pgd = pgd_offset_k(address); flush_cache_all(); if (address >= end) BUG(); spin_lock(&init_mm.page_table_lock); do { - pmd_t *pmd; - pmd = pmd_alloc(&init_mm, dir, address); + pud_t *pud; + pud = pud_alloc(&init_mm, pgd, address); error = -ENOMEM; - if (!pmd) + if (!pud) break; - if (remap_area_pmd(pmd, address, end - address, + if (remap_area_pud(pud, address, end - address, phys_addr + address, flags)) break; error = 0; address = (address + PGDIR_SIZE) & PGDIR_MASK; - dir++; + pgd++; } while (address && (address < end)); spin_unlock(&init_mm.page_table_lock); flush_tlb_all(); diff -Nru a/arch/x86_64/mm/pageattr.c b/arch/x86_64/mm/pageattr.c --- a/arch/x86_64/mm/pageattr.c 2005-01-02 23:03:34 -08:00 +++ b/arch/x86_64/mm/pageattr.c 2005-01-02 23:03:34 -08:00 @@ -16,12 +16,16 @@ static inline pte_t *lookup_address(unsigned long address) { - pgd_t *pgd = pgd_offset_k(address); + pgd_t *pgd = pgd_offset_k(address); + pud_t *pud; pmd_t *pmd; pte_t *pte; - if (!pgd || !pgd_present(*pgd)) + if (pgd_none(*pgd)) + return NULL; + pud = pud_offset(pgd, address); + if (!pud_present(*pud)) return NULL; - pmd = pmd_offset(pgd, address); + pmd = pmd_offset(pud, address); if (!pmd_present(*pmd)) return NULL; if (pmd_large(*pmd)) @@ -98,16 +102,20 @@ */ static void revert_page(unsigned long address, pgprot_t ref_prot) { - pgd_t *pgd; - pmd_t *pmd; - pte_t large_pte; - - pgd = pgd_offset_k(address); - pmd = pmd_offset(pgd, address); - BUG_ON(pmd_val(*pmd) & _PAGE_PSE); - pgprot_val(ref_prot) |= _PAGE_PSE; - large_pte = mk_pte_phys(__pa(address) & LARGE_PAGE_MASK, ref_prot); - set_pte((pte_t *)pmd, large_pte); + pgd_t *pgd; + pud_t *pud; + pmd_t *pmd; + pte_t large_pte; + + pgd = pgd_offset_k(address); + BUG_ON(pgd_none(*pgd)); + pud = pud_offset(pgd,address); + BUG_ON(pud_none(*pud)); + pmd = pmd_offset(pud, address); + BUG_ON(pmd_val(*pmd) & _PAGE_PSE); + pgprot_val(ref_prot) |= _PAGE_PSE; + large_pte = mk_pte_phys(__pa(address) & LARGE_PAGE_MASK, ref_prot); + set_pte((pte_t *)pmd, large_pte); } static int diff -Nru a/crypto/Kconfig b/crypto/Kconfig --- a/crypto/Kconfig 2005-01-02 23:03:35 -08:00 +++ b/crypto/Kconfig 2005-01-02 23:03:35 -08:00 @@ -274,5 +274,6 @@ help Quick & dirty crypto test module. +source "drivers/crypto/Kconfig" endmenu diff -Nru a/crypto/sha512.c b/crypto/sha512.c --- a/crypto/sha512.c 2005-01-02 23:03:35 -08:00 +++ b/crypto/sha512.c 2005-01-02 23:03:35 -08:00 @@ -48,7 +48,7 @@ return (x >> y) | (x << (64 - y)); } -const u64 sha512_K[80] = { +static const u64 sha512_K[80] = { 0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL, 0xb5c0fbcfec4d3b2fULL, 0xe9b5dba58189dbbcULL, 0x3956c25bf348b538ULL, 0x59f111f1b605d019ULL, 0x923f82a4af194f9bULL, 0xab1c5ed5da6d8118ULL, 0xd807aa98a3030242ULL, diff -Nru a/crypto/tcrypt.c b/crypto/tcrypt.c --- a/crypto/tcrypt.c 2005-01-02 23:03:34 -08:00 +++ b/crypto/tcrypt.c 2005-01-02 23:03:34 -08:00 @@ -255,7 +255,7 @@ #endif /* CONFIG_CRYPTO_HMAC */ -void +static void test_cipher(char * algo, int mode, int enc, struct cipher_testvec * template, unsigned int tcount) { unsigned int ret, i, j, k, temp; diff -Nru a/crypto/tcrypt.h b/crypto/tcrypt.h --- a/crypto/tcrypt.h 2005-01-02 23:03:35 -08:00 +++ b/crypto/tcrypt.h 2005-01-02 23:03:35 -08:00 @@ -63,7 +63,7 @@ */ #define MD4_TEST_VECTORS 7 -struct hash_testvec md4_tv_template [] = { +static struct hash_testvec md4_tv_template [] = { { .plaintext = "", .digest = { 0x31, 0xd6, 0xcf, 0xe0, 0xd1, 0x6a, 0xe9, 0x31, @@ -109,7 +109,7 @@ */ #define MD5_TEST_VECTORS 7 -struct hash_testvec md5_tv_template[] = { +static struct hash_testvec md5_tv_template[] = { { .digest = { 0xd4, 0x1d, 0x8c, 0xd9, 0x8f, 0x00, 0xb2, 0x04, 0xe9, 0x80, 0x09, 0x98, 0xec, 0xf8, 0x42, 0x7e }, @@ -154,7 +154,7 @@ */ #define SHA1_TEST_VECTORS 2 -struct hash_testvec sha1_tv_template[] = { +static struct hash_testvec sha1_tv_template[] = { { .plaintext = "abc", .psize = 3, @@ -175,7 +175,7 @@ */ #define SHA256_TEST_VECTORS 2 -struct hash_testvec sha256_tv_template[] = { +static struct hash_testvec sha256_tv_template[] = { { .plaintext = "abc", .psize = 3, @@ -200,7 +200,7 @@ */ #define SHA384_TEST_VECTORS 4 -struct hash_testvec sha384_tv_template[] = { +static struct hash_testvec sha384_tv_template[] = { { .plaintext= "abc", .psize = 3, @@ -249,7 +249,7 @@ */ #define SHA512_TEST_VECTORS 4 -struct hash_testvec sha512_tv_template[] = { +static struct hash_testvec sha512_tv_template[] = { { .plaintext = "abc", .psize = 3, @@ -309,7 +309,7 @@ */ #define WP512_TEST_VECTORS 8 -struct hash_testvec wp512_tv_template[] = { +static struct hash_testvec wp512_tv_template[] = { { .plaintext = "", .psize = 0, @@ -407,7 +407,7 @@ #define WP384_TEST_VECTORS 8 -struct hash_testvec wp384_tv_template[] = { +static struct hash_testvec wp384_tv_template[] = { { .plaintext = "", .psize = 0, @@ -489,7 +489,7 @@ #define WP256_TEST_VECTORS 8 -struct hash_testvec wp256_tv_template[] = { +static struct hash_testvec wp256_tv_template[] = { { .plaintext = "", .psize = 0, @@ -561,7 +561,7 @@ */ #define HMAC_MD5_TEST_VECTORS 7 -struct hmac_testvec hmac_md5_tv_template[] = +static struct hmac_testvec hmac_md5_tv_template[] = { { .key = { [0 ... 15] = 0x0b }, @@ -625,7 +625,7 @@ */ #define HMAC_SHA1_TEST_VECTORS 7 -struct hmac_testvec hmac_sha1_tv_template[] = { +static struct hmac_testvec hmac_sha1_tv_template[] = { { .key = { [0 ... 19] = 0x0b }, .ksize = 20, @@ -690,7 +690,7 @@ */ #define HMAC_SHA256_TEST_VECTORS 10 -struct hmac_testvec hmac_sha256_tv_template[] = { +static struct hmac_testvec hmac_sha256_tv_template[] = { { .key = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, @@ -813,7 +813,7 @@ #define DES3_EDE_ENC_TEST_VECTORS 3 #define DES3_EDE_DEC_TEST_VECTORS 3 -struct cipher_testvec des_enc_tv_template[] = { +static struct cipher_testvec des_enc_tv_template[] = { { /* From Applied Cryptography */ .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, .klen = 8, @@ -917,7 +917,7 @@ }, }; -struct cipher_testvec des_dec_tv_template[] = { +static struct cipher_testvec des_dec_tv_template[] = { { /* From Applied Cryptography */ .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, .klen = 8, @@ -957,7 +957,7 @@ }, }; -struct cipher_testvec des_cbc_enc_tv_template[] = { +static struct cipher_testvec des_cbc_enc_tv_template[] = { { /* From OpenSSL */ .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef}, .klen = 8, @@ -1012,7 +1012,7 @@ }, }; -struct cipher_testvec des_cbc_dec_tv_template[] = { +static struct cipher_testvec des_cbc_dec_tv_template[] = { { /* FIPS Pub 81 */ .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, .klen = 8, @@ -1053,7 +1053,7 @@ /* * We really need some more test vectors, especially for DES3 CBC. */ -struct cipher_testvec des3_ede_enc_tv_template[] = { +static struct cipher_testvec des3_ede_enc_tv_template[] = { { /* These are from openssl */ .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, @@ -1084,7 +1084,7 @@ }, }; -struct cipher_testvec des3_ede_dec_tv_template[] = { +static struct cipher_testvec des3_ede_dec_tv_template[] = { { /* These are from openssl */ .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, @@ -1123,7 +1123,7 @@ #define BF_CBC_ENC_TEST_VECTORS 1 #define BF_CBC_DEC_TEST_VECTORS 1 -struct cipher_testvec bf_enc_tv_template[] = { +static struct cipher_testvec bf_enc_tv_template[] = { { /* DES test vectors from OpenSSL */ .key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, .klen = 8, @@ -1178,7 +1178,7 @@ }, }; -struct cipher_testvec bf_dec_tv_template[] = { +static struct cipher_testvec bf_dec_tv_template[] = { { /* DES test vectors from OpenSSL */ .key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, .klen = 8, @@ -1233,7 +1233,7 @@ }, }; -struct cipher_testvec bf_cbc_enc_tv_template[] = { +static struct cipher_testvec bf_cbc_enc_tv_template[] = { { /* From OpenSSL */ .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 }, @@ -1252,7 +1252,7 @@ }, }; -struct cipher_testvec bf_cbc_dec_tv_template[] = { +static struct cipher_testvec bf_cbc_dec_tv_template[] = { { /* From OpenSSL */ .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 }, @@ -1279,7 +1279,7 @@ #define TF_CBC_ENC_TEST_VECTORS 4 #define TF_CBC_DEC_TEST_VECTORS 4 -struct cipher_testvec tf_enc_tv_template[] = { +static struct cipher_testvec tf_enc_tv_template[] = { { .key = { [0 ... 15] = 0x00 }, .klen = 16, @@ -1312,7 +1312,7 @@ }, }; -struct cipher_testvec tf_dec_tv_template[] = { +static struct cipher_testvec tf_dec_tv_template[] = { { .key = { [0 ... 15] = 0x00 }, .klen = 16, @@ -1345,7 +1345,7 @@ }, }; -struct cipher_testvec tf_cbc_enc_tv_template[] = { +static struct cipher_testvec tf_cbc_enc_tv_template[] = { { /* Generated with Nettle */ .key = { [0 ... 15] = 0x00 }, .klen = 16, @@ -1391,7 +1391,7 @@ }, }; -struct cipher_testvec tf_cbc_dec_tv_template[] = { +static struct cipher_testvec tf_cbc_dec_tv_template[] = { { /* Reverse of the first four above */ .key = { [0 ... 15] = 0x00 }, .klen = 16, @@ -1447,7 +1447,7 @@ #define TNEPRES_ENC_TEST_VECTORS 4 #define TNEPRES_DEC_TEST_VECTORS 4 -struct cipher_testvec serpent_enc_tv_template[] = +static struct cipher_testvec serpent_enc_tv_template[] = { { .input = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, @@ -1489,7 +1489,7 @@ }, }; -struct cipher_testvec tnepres_enc_tv_template[] = +static struct cipher_testvec tnepres_enc_tv_template[] = { { /* KeySize=128, PT=0, I=1 */ .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -1540,7 +1540,7 @@ }; -struct cipher_testvec serpent_dec_tv_template[] = +static struct cipher_testvec serpent_dec_tv_template[] = { { .input = { 0x12, 0x07, 0xfc, 0xce, 0x9b, 0xd0, 0xd6, 0x47, @@ -1582,7 +1582,7 @@ }, }; -struct cipher_testvec tnepres_dec_tv_template[] = +static struct cipher_testvec tnepres_dec_tv_template[] = { { .input = { 0x41, 0xcc, 0x6b, 0x31, 0x59, 0x31, 0x45, 0x97, @@ -1629,7 +1629,7 @@ #define CAST6_ENC_TEST_VECTORS 3 #define CAST6_DEC_TEST_VECTORS 3 -struct cipher_testvec cast6_enc_tv_template[] = +static struct cipher_testvec cast6_enc_tv_template[] = { { .key = { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c, @@ -1664,7 +1664,7 @@ }, }; -struct cipher_testvec cast6_dec_tv_template[] = +static struct cipher_testvec cast6_dec_tv_template[] = { { .key = { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c, @@ -1706,7 +1706,7 @@ #define AES_ENC_TEST_VECTORS 3 #define AES_DEC_TEST_VECTORS 3 -struct cipher_testvec aes_enc_tv_template[] = { +static struct cipher_testvec aes_enc_tv_template[] = { { /* From FIPS-197 */ .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, @@ -1743,7 +1743,7 @@ }, }; -struct cipher_testvec aes_dec_tv_template[] = { +static struct cipher_testvec aes_dec_tv_template[] = { { /* From FIPS-197 */ .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, @@ -1784,7 +1784,7 @@ #define CAST5_ENC_TEST_VECTORS 3 #define CAST5_DEC_TEST_VECTORS 3 -struct cipher_testvec cast5_enc_tv_template[] = +static struct cipher_testvec cast5_enc_tv_template[] = { { .key = { 0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78, @@ -1812,7 +1812,7 @@ }, }; -struct cipher_testvec cast5_dec_tv_template[] = +static struct cipher_testvec cast5_dec_tv_template[] = { { .key = { 0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78, @@ -1846,7 +1846,7 @@ #define ARC4_ENC_TEST_VECTORS 7 #define ARC4_DEC_TEST_VECTORS 7 -struct cipher_testvec arc4_enc_tv_template[] = +static struct cipher_testvec arc4_enc_tv_template[] = { { .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, @@ -1913,7 +1913,7 @@ }, }; -struct cipher_testvec arc4_dec_tv_template[] = +static struct cipher_testvec arc4_dec_tv_template[] = { { .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, @@ -1986,7 +1986,7 @@ #define TEA_ENC_TEST_VECTORS 4 #define TEA_DEC_TEST_VECTORS 4 -struct cipher_testvec tea_enc_tv_template[] = +static struct cipher_testvec xtea_enc_tv_template[] = { { .key = { [0 ... 15] = 0x00 }, @@ -2030,7 +2030,7 @@ } }; -struct cipher_testvec tea_dec_tv_template[] = +static struct cipher_testvec tea_dec_tv_template[] = { { .key = { [0 ... 15] = 0x00 }, @@ -2080,7 +2080,7 @@ #define XTEA_ENC_TEST_VECTORS 4 #define XTEA_DEC_TEST_VECTORS 4 -struct cipher_testvec xtea_enc_tv_template[] = +static struct cipher_testvec tea_enc_tv_template[] = { { .key = { [0 ... 15] = 0x00 }, @@ -2124,7 +2124,7 @@ } }; -struct cipher_testvec xtea_dec_tv_template[] = +static struct cipher_testvec xtea_dec_tv_template[] = { { .key = { [0 ... 15] = 0x00 }, @@ -2174,7 +2174,7 @@ #define KHAZAD_ENC_TEST_VECTORS 5 #define KHAZAD_DEC_TEST_VECTORS 5 -struct cipher_testvec khazad_enc_tv_template[] = { +static struct cipher_testvec khazad_enc_tv_template[] = { { .key = { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, @@ -2220,7 +2220,7 @@ }, }; -struct cipher_testvec khazad_dec_tv_template[] = { +static struct cipher_testvec khazad_dec_tv_template[] = { { .key = { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, @@ -2275,7 +2275,7 @@ #define ANUBIS_CBC_ENC_TEST_VECTORS 2 #define ANUBIS_CBC_DEC_TEST_VECTORS 2 -struct cipher_testvec anubis_enc_tv_template[] = { +static struct cipher_testvec anubis_enc_tv_template[] = { { .key = { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe }, @@ -2338,7 +2338,7 @@ }, }; -struct cipher_testvec anubis_dec_tv_template[] = { +static struct cipher_testvec anubis_dec_tv_template[] = { { .key = { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe }, @@ -2401,7 +2401,7 @@ }, }; -struct cipher_testvec anubis_cbc_enc_tv_template[] = { +static struct cipher_testvec anubis_cbc_enc_tv_template[] = { { .key = { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe }, @@ -2436,7 +2436,7 @@ }, }; -struct cipher_testvec anubis_cbc_dec_tv_template[] = { +static struct cipher_testvec anubis_cbc_dec_tv_template[] = { { .key = { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe }, @@ -2489,7 +2489,7 @@ #define DEFLATE_COMP_TEST_VECTORS 2 #define DEFLATE_DECOMP_TEST_VECTORS 2 -struct comp_testvec deflate_comp_tv_template[] = { +static struct comp_testvec deflate_comp_tv_template[] = { { .inlen = 70, .outlen = 38, @@ -2525,7 +2525,7 @@ }, }; -struct comp_testvec deflate_decomp_tv_template[] = { +static struct comp_testvec deflate_decomp_tv_template[] = { { .inlen = 122, .outlen = 191, @@ -2566,7 +2566,7 @@ */ #define MICHAEL_MIC_TEST_VECTORS 6 -struct hash_testvec michael_mic_tv_template[] = +static struct hash_testvec michael_mic_tv_template[] = { { .key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, diff -Nru a/drivers/Kconfig b/drivers/Kconfig --- a/drivers/Kconfig 2005-01-02 23:03:35 -08:00 +++ b/drivers/Kconfig 2005-01-02 23:03:35 -08:00 @@ -56,4 +56,6 @@ source "drivers/mmc/Kconfig" +source "drivers/infiniband/Kconfig" + endmenu diff -Nru a/drivers/Makefile b/drivers/Makefile --- a/drivers/Makefile 2005-01-02 23:03:35 -08:00 +++ b/drivers/Makefile 2005-01-02 23:03:35 -08:00 @@ -59,4 +59,6 @@ obj-$(CONFIG_EISA) += eisa/ obj-$(CONFIG_CPU_FREQ) += cpufreq/ obj-$(CONFIG_MMC) += mmc/ +obj-$(CONFIG_INFINIBAND) += infiniband/ obj-y += firmware/ +obj-$(CONFIG_CRYPTO) += crypto/ diff -Nru a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig --- a/drivers/acpi/Kconfig 2005-01-02 23:03:35 -08:00 +++ b/drivers/acpi/Kconfig 2005-01-02 23:03:35 -08:00 @@ -144,6 +144,15 @@ ACPI C2 and C3 processor states to save power, on systems that support it. +config ACPI_HOTPLUG_CPU + bool "Processor Hotplug (EXPERIMENTAL)" + depends on ACPI_PROCESSOR && HOTPLUG_CPU && EXPERIMENTAL + depends on !IA64_SGI_SN + select ACPI_CONTAINER + default n + ---help--- + Select this option if your platform support physical CPU hotplug. + config ACPI_THERMAL tristate "Thermal Zone" depends on ACPI_PROCESSOR @@ -325,5 +334,12 @@ kernel logs, and/or you are using this on a notebook which does not yet have an HPET, you should say "Y" here. -endmenu +config ACPI_CONTAINER + tristate "ACPI0004,PNP0A05 and PNP0A06 Container Driver (EXPERIMENTAL)" + depends on ACPI && EXPERIMENTAL + default (ACPI_HOTPLUG_MEMORY || ACPI_HOTPLUG_CPU || ACPI_HOTPLUG_IO) + ---help--- + This is the ACPI generic container driver which supports + ACPI0004, PNP0A05 and PNP0A06 devices +endmenu diff -Nru a/drivers/acpi/Makefile b/drivers/acpi/Makefile --- a/drivers/acpi/Makefile 2005-01-02 23:03:35 -08:00 +++ b/drivers/acpi/Makefile 2005-01-02 23:03:35 -08:00 @@ -29,6 +29,12 @@ # # ACPI Bus and Device Drivers # +processor-objs += processor_core.o processor_throttling.o \ + processor_idle.o processor_thermal.o +ifdef CONFIG_CPU_FREQ +processor-objs += processor_perflib.o +endif + obj-$(CONFIG_ACPI_BUS) += sleep/ obj-$(CONFIG_ACPI_BUS) += bus.o obj-$(CONFIG_ACPI_AC) += ac.o @@ -40,6 +46,7 @@ obj-$(CONFIG_ACPI_PCI) += pci_root.o pci_link.o pci_irq.o pci_bind.o obj-$(CONFIG_ACPI_POWER) += power.o obj-$(CONFIG_ACPI_PROCESSOR) += processor.o +obj-$(CONFIG_ACPI_CONTAINER) += container.o obj-$(CONFIG_ACPI_THERMAL) += thermal.o obj-$(CONFIG_ACPI_SYSTEM) += system.o event.o obj-$(CONFIG_ACPI_DEBUG) += debug.o diff -Nru a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c --- a/drivers/acpi/asus_acpi.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/acpi/asus_acpi.c 2005-01-02 23:03:33 -08:00 @@ -866,7 +866,7 @@ acpi_device_dir(device) = asus_proc_dir; if (!acpi_device_dir(device)) - return(-ENODEV); + return -ENODEV; proc = create_proc_entry(PROC_INFO, mode, acpi_device_dir(device)); if (proc) { @@ -1098,16 +1098,16 @@ result = acpi_bus_get_status(hotk->device); if (result) - return(result); + return result; if (hotk->device->status.present) { result = asus_hotk_get_info(); } else { printk(KERN_ERR " Hotkey device not present, aborting\n"); - return(-EINVAL); + return -EINVAL; } - return(result); + return result; } @@ -1117,7 +1117,7 @@ int result; if (!device) - return(-EINVAL); + return -EINVAL; printk(KERN_NOTICE "Asus Laptop ACPI Extras version %s\n", ASUS_ACPI_VERSION); @@ -1125,7 +1125,7 @@ hotk = (struct asus_hotk *) kmalloc(sizeof(struct asus_hotk), GFP_KERNEL); if (!hotk) - return(-ENOMEM); + return -ENOMEM; memset(hotk, 0, sizeof(struct asus_hotk)); hotk->handle = device->handle; @@ -1173,7 +1173,7 @@ kfree(hotk); } - return(result); + return result; } @@ -1182,7 +1182,7 @@ acpi_status status = 0; if (!device || !acpi_driver_data(device)) - return(-EINVAL); + return -EINVAL; status = acpi_remove_notify_handler(hotk->handle, ACPI_SYSTEM_NOTIFY, asus_hotk_notify); @@ -1193,7 +1193,7 @@ kfree(hotk); - return(0); + return 0; } diff -Nru a/drivers/acpi/bus.c b/drivers/acpi/bus.c --- a/drivers/acpi/bus.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/acpi/bus.c 2005-01-02 23:03:34 -08:00 @@ -57,10 +57,6 @@ Device Management -------------------------------------------------------------------------- */ -extern void acpi_bus_data_handler ( - acpi_handle handle, - u32 function, - void *context); int acpi_bus_get_device ( acpi_handle handle, @@ -77,7 +73,7 @@ status = acpi_get_data(handle, acpi_bus_data_handler, (void**) device); if (ACPI_FAILURE(status) || !*device) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Error getting context for object [%p]\n", + ACPI_DEBUG_PRINT((ACPI_DB_WARN, "No context for object [%p]\n", handle)); return_VALUE(-ENODEV); } diff -Nru a/drivers/acpi/container.c b/drivers/acpi/container.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/acpi/container.c 2005-01-02 23:03:35 -08:00 @@ -0,0 +1,298 @@ +/* + * acpi_container.c - ACPI Generic Container Driver + * ($Revision: ) + * + * Copyright (C) 2004 Anil S Keshavamurthy (anil.s.keshavamurthy@intel.com) + * Copyright (C) 2004 Keiichiro Tokunaga (tokunaga.keiich@jp.fujitsu.com) + * Copyright (C) 2004 Motoyuki Ito (motoyuki@soft.fujitsu.com) + * Copyright (C) 2004 Intel Corp. + * Copyright (C) 2004 FUJITSU LIMITED + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + */ +#include +#include +#include +#include +#include +#include +#include +#include + +#define ACPI_CONTAINER_DRIVER_NAME "ACPI container driver" +#define ACPI_CONTAINER_DEVICE_NAME "ACPI container device" +#define ACPI_CONTAINER_CLASS "container" + +#define INSTALL_NOTIFY_HANDLER 1 +#define UNINSTALL_NOTIFY_HANDLER 2 + +#define ACPI_CONTAINER_COMPONENT 0x01000000 +#define _COMPONENT ACPI_CONTAINER_COMPONENT +ACPI_MODULE_NAME ("acpi_container") + +MODULE_AUTHOR("Anil S Keshavamurthy"); +MODULE_DESCRIPTION(ACPI_CONTAINER_DRIVER_NAME); +MODULE_LICENSE("GPL"); + +#define ACPI_STA_PRESENT (0x00000001) + +static int acpi_container_add(struct acpi_device *device); +static int acpi_container_remove(struct acpi_device *device, int type); + +static struct acpi_driver acpi_container_driver = { + .name = ACPI_CONTAINER_DRIVER_NAME, + .class = ACPI_CONTAINER_CLASS, + .ids = "ACPI0004,PNP0A05,PNP0A06", + .ops = { + .add = acpi_container_add, + .remove = acpi_container_remove, + }, +}; + + +/*******************************************************************/ + +static int +is_device_present(acpi_handle handle) +{ + acpi_handle temp; + acpi_status status; + unsigned long sta; + + ACPI_FUNCTION_TRACE("is_device_present"); + + status = acpi_get_handle(handle, "_STA", &temp); + if (ACPI_FAILURE(status)) + return_VALUE(1); /* _STA not found, assmue device present */ + + status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); + if (ACPI_FAILURE(status)) + return_VALUE(0); /* Firmware error */ + + return_VALUE((sta & ACPI_STA_PRESENT) == ACPI_STA_PRESENT); +} + +/*******************************************************************/ +static int +acpi_container_add(struct acpi_device *device) +{ + struct acpi_container *container; + + ACPI_FUNCTION_TRACE("acpi_container_add"); + + if (!device) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "device is NULL\n")); + return_VALUE(-EINVAL); + } + + container = kmalloc(sizeof(struct acpi_container), GFP_KERNEL); + if(!container) + return_VALUE(-ENOMEM); + + memset(container, 0, sizeof(struct acpi_container)); + container->handle = device->handle; + strcpy(acpi_device_name(device), ACPI_CONTAINER_DEVICE_NAME); + strcpy(acpi_device_class(device), ACPI_CONTAINER_CLASS); + acpi_driver_data(device) = container; + + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device <%s> bid <%s>\n", \ + acpi_device_name(device), acpi_device_bid(device))); + + + return_VALUE(0); +} + +static int +acpi_container_remove(struct acpi_device *device, int type) +{ + acpi_status status = AE_OK; + struct acpi_container *pc = NULL; + pc = (struct acpi_container*) acpi_driver_data(device); + + if (pc) + kfree(pc); + + return status; +} + + +static int +container_device_add(struct acpi_device **device, acpi_handle handle) +{ + acpi_handle phandle; + struct acpi_device *pdev; + int result; + + ACPI_FUNCTION_TRACE("container_device_add"); + + if (acpi_get_parent(handle, &phandle)) { + return_VALUE(-ENODEV); + } + + if (acpi_bus_get_device(phandle, &pdev)) { + return_VALUE(-ENODEV); + } + + if (acpi_bus_add(device, pdev, handle, ACPI_BUS_TYPE_DEVICE)) { + return_VALUE(-ENODEV); + } + + result = acpi_bus_scan(*device); + + return_VALUE(result); +} + +static void +container_notify_cb(acpi_handle handle, u32 type, void *context) +{ + struct acpi_device *device = NULL; + int result; + int present; + acpi_status status; + + ACPI_FUNCTION_TRACE("container_notify_cb"); + + present = is_device_present(handle); + + switch (type) { + case ACPI_NOTIFY_BUS_CHECK: + /* Fall through */ + case ACPI_NOTIFY_DEVICE_CHECK: + printk("Container driver received %s event\n", + (type == ACPI_NOTIFY_BUS_CHECK)? + "ACPI_NOTIFY_BUS_CHECK":"ACPI_NOTIFY_DEVICE_CHECK"); + if (present) { + status = acpi_bus_get_device(handle, &device); + if (ACPI_FAILURE(status) || !device) { + result = container_device_add(&device, handle); + if (!result) + kobject_hotplug(&device->kobj, KOBJ_ONLINE); + } else { + /* device exist and this is a remove request */ + kobject_hotplug(&device->kobj, KOBJ_OFFLINE); + } + } + break; + case ACPI_NOTIFY_EJECT_REQUEST: + if (!acpi_bus_get_device(handle, &device) && device) { + kobject_hotplug(&device->kobj, KOBJ_OFFLINE); + } + break; + default: + break; + } + return_VOID; +} + +static acpi_status +container_walk_namespace_cb(acpi_handle handle, + u32 lvl, + void *context, + void **rv) +{ + char *hid = NULL; + struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; + struct acpi_device_info *info; + acpi_status status; + int *action = context; + + ACPI_FUNCTION_TRACE("container_walk_namespace_cb"); + + status = acpi_get_object_info(handle, &buffer); + if (ACPI_FAILURE(status) || !buffer.pointer) { + return_ACPI_STATUS(AE_OK); + } + + info = buffer.pointer; + if (info->valid & ACPI_VALID_HID) + hid = info->hardware_id.value; + + if (hid == NULL) { + goto end; + } + + if (strcmp(hid, "ACPI0004") && strcmp(hid, "PNP0A05") && + strcmp(hid, "PNP0A06")) { + goto end; + } + + switch(*action) { + case INSTALL_NOTIFY_HANDLER: + acpi_install_notify_handler(handle, + ACPI_SYSTEM_NOTIFY, + container_notify_cb, + NULL); + break; + case UNINSTALL_NOTIFY_HANDLER: + acpi_remove_notify_handler(handle, + ACPI_SYSTEM_NOTIFY, + container_notify_cb); + break; + default: + break; + } + +end: + acpi_os_free(buffer.pointer); + + return_ACPI_STATUS(AE_OK); +} + + +int __init +acpi_container_init(void) +{ + int result = 0; + int action = INSTALL_NOTIFY_HANDLER; + + result = acpi_bus_register_driver(&acpi_container_driver); + if (result < 0) { + return(result); + } + + /* register notify handler to every container device */ + acpi_walk_namespace(ACPI_TYPE_DEVICE, + ACPI_ROOT_OBJECT, + ACPI_UINT32_MAX, + container_walk_namespace_cb, + &action, NULL); + + return(0); +} + +void __exit +acpi_container_exit(void) +{ + int action = UNINSTALL_NOTIFY_HANDLER; + + ACPI_FUNCTION_TRACE("acpi_container_exit"); + + acpi_walk_namespace(ACPI_TYPE_DEVICE, + ACPI_ROOT_OBJECT, + ACPI_UINT32_MAX, + container_walk_namespace_cb, + &action, NULL); + + acpi_bus_unregister_driver(&acpi_container_driver); + + return_VOID; +} + +module_init(acpi_container_init); +module_exit(acpi_container_exit); diff -Nru a/drivers/acpi/dispatcher/dsopcode.c b/drivers/acpi/dispatcher/dsopcode.c --- a/drivers/acpi/dispatcher/dsopcode.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/acpi/dispatcher/dsopcode.c 2005-01-02 23:03:34 -08:00 @@ -762,9 +762,8 @@ * * RETURN: Status * - * DESCRIPTION: Get the operands and complete the following data objec types: - * Buffer - * Package + * DESCRIPTION: Get the operands and complete the following data object types: + * Buffer, Package. * ****************************************************************************/ diff -Nru a/drivers/acpi/dispatcher/dswexec.c b/drivers/acpi/dispatcher/dswexec.c --- a/drivers/acpi/dispatcher/dswexec.c 2005-01-02 23:03:35 -08:00 +++ b/drivers/acpi/dispatcher/dswexec.c 2005-01-02 23:03:35 -08:00 @@ -399,16 +399,24 @@ goto cleanup; } - /* Resolve all operands */ + /* + * All opcodes require operand resolution, with the only exceptions + * being the object_type and size_of operators. + */ + if (!(walk_state->op_info->flags & AML_NO_OPERAND_RESOLVE)) { + /* Resolve all operands */ - status = acpi_ex_resolve_operands (walk_state->opcode, - &(walk_state->operands [walk_state->num_operands -1]), - walk_state); - if (ACPI_SUCCESS (status)) { - ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, - acpi_ps_get_opcode_name (walk_state->opcode), - walk_state->num_operands, "after ex_resolve_operands"); + status = acpi_ex_resolve_operands (walk_state->opcode, + &(walk_state->operands [walk_state->num_operands -1]), + walk_state); + if (ACPI_SUCCESS (status)) { + ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, + acpi_ps_get_opcode_name (walk_state->opcode), + walk_state->num_operands, "after ex_resolve_operands"); + } + } + if (ACPI_SUCCESS (status)) { /* * Dispatch the request to the appropriate interpreter handler * routine. There is one routine per opcode "type" based upon the diff -Nru a/drivers/acpi/ec.c b/drivers/acpi/ec.c --- a/drivers/acpi/ec.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/acpi/ec.c 2005-01-02 23:03:34 -08:00 @@ -442,6 +442,8 @@ int result = 0; struct acpi_ec *ec = NULL; u32 temp = 0; + acpi_integer f_v = 0; + int i = 0; ACPI_FUNCTION_TRACE("acpi_ec_space_handler"); @@ -456,6 +458,7 @@ ec = (struct acpi_ec *) handler_context; +next_byte: switch (function) { case ACPI_READ: result = acpi_ec_read(ec, (u8) address, &temp); @@ -466,9 +469,29 @@ break; default: result = -EINVAL; + goto out; break; } + bit_width -= 8; + if(bit_width){ + + if(function == ACPI_READ) + f_v |= (acpi_integer) (*value) << 8*i; + if(function == ACPI_WRITE) + (*value) >>=8; + i++; + goto next_byte; + } + + + if(function == ACPI_READ){ + f_v |= (acpi_integer) (*value) << 8*i; + *value = f_v; + } + + +out: switch (result) { case -EINVAL: return_VALUE(AE_BAD_PARAMETER); @@ -482,6 +505,7 @@ default: return_VALUE(AE_OK); } + } @@ -787,9 +811,81 @@ return_VALUE(0); } +static acpi_status __init +acpi_fake_ecdt_callback ( + acpi_handle handle, + u32 Level, + void *context, + void **retval) +{ + acpi_status status; -int __init -acpi_ec_ecdt_probe (void) + status = acpi_walk_resources(handle, METHOD_NAME__CRS, + acpi_ec_io_ports, ec_ecdt); + if (ACPI_FAILURE(status)) + return status; + ec_ecdt->status_addr = ec_ecdt->command_addr; + + ec_ecdt->uid = -1; + acpi_evaluate_integer(handle, "_UID", NULL, &ec_ecdt->uid); + + status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec_ecdt->gpe_bit); + if (ACPI_FAILURE(status)) + return status; + ec_ecdt->lock = SPIN_LOCK_UNLOCKED; + ec_ecdt->global_lock = TRUE; + ec_ecdt->handle = handle; + + printk(KERN_INFO PREFIX "GPE=0x%02x, ports=0x%2x, 0x%2x\n", + (u32) ec_ecdt->gpe_bit, (u32) ec_ecdt->command_addr.address, + (u32) ec_ecdt->data_addr.address); + + return AE_CTRL_TERMINATE; +} + +/* + * Some BIOS (such as some from Gateway laptops) access EC region very early + * such as in BAT0._INI or EC._INI before an EC device is found and + * do not provide an ECDT. According to ACPI spec, ECDT isn't mandatorily + * required, but if EC regison is accessed early, it is required. + * The routine tries to workaround the BIOS bug by pre-scan EC device + * It assumes that _CRS, _HID, _GPE, _UID methods of EC don't touch any + * op region (since _REG isn't invoked yet). The assumption is true for + * all systems found. + */ +static int __init +acpi_ec_fake_ecdt(void) +{ + acpi_status status; + int ret = 0; + + printk(KERN_INFO PREFIX "Try to make an fake ECDT\n"); + + ec_ecdt = kmalloc(sizeof(struct acpi_ec), GFP_KERNEL); + if (!ec_ecdt) { + ret = -ENOMEM; + goto error; + } + memset(ec_ecdt, 0, sizeof(struct acpi_ec)); + + status = acpi_get_devices (ACPI_EC_HID, + acpi_fake_ecdt_callback, + NULL, + NULL); + if (ACPI_FAILURE(status)) { + kfree(ec_ecdt); + ec_ecdt = NULL; + ret = -ENODEV; + goto error; + } + return 0; +error: + printk(KERN_ERR PREFIX "Can't make an fake ECDT\n"); + return ret; +} + +static int __init +acpi_ec_get_real_ecdt(void) { acpi_status status; struct acpi_table_ecdt *ecdt_ptr; @@ -797,11 +893,11 @@ status = acpi_get_firmware_table("ECDT", 1, ACPI_LOGICAL_ADDRESSING, (struct acpi_table_header **) &ecdt_ptr); if (ACPI_FAILURE(status)) - return 0; + return -ENODEV; printk(KERN_INFO PREFIX "Found ECDT\n"); - /* + /* * Generate a temporary ec context to use until the namespace is scanned */ ec_ecdt = kmalloc(sizeof(struct acpi_ec), GFP_KERNEL); @@ -823,6 +919,31 @@ goto error; } + return 0; +error: + printk(KERN_ERR PREFIX "Could not use ECDT\n"); + kfree(ec_ecdt); + ec_ecdt = NULL; + + return -ENODEV; +} + +static int __initdata acpi_fake_ecdt_enabled; +int __init +acpi_ec_ecdt_probe (void) +{ + acpi_status status; + int ret; + + ret = acpi_ec_get_real_ecdt(); + /* Try to make a fake ECDT */ + if (ret && acpi_fake_ecdt_enabled) { + ret = acpi_ec_fake_ecdt(); + } + + if (ret) + return 0; + /* * Install GPE handler */ @@ -895,3 +1016,9 @@ } #endif /* 0 */ +static int __init acpi_fake_ecdt_setup(char *str) +{ + acpi_fake_ecdt_enabled = 1; + return 0; +} +__setup("acpi_fake_ecdt", acpi_fake_ecdt_setup); diff -Nru a/drivers/acpi/events/evgpe.c b/drivers/acpi/events/evgpe.c --- a/drivers/acpi/events/evgpe.c 2005-01-02 23:03:35 -08:00 +++ b/drivers/acpi/events/evgpe.c 2005-01-02 23:03:35 -08:00 @@ -605,8 +605,8 @@ if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) == ACPI_GPE_EDGE_TRIGGERED) { status = acpi_hw_clear_gpe (gpe_event_info); if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (("acpi_ev_gpe_dispatch: Unable to clear GPE[%2X]\n", - gpe_number)); + ACPI_REPORT_ERROR (("acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", + acpi_format_exception (status), gpe_number)); return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); } } @@ -643,8 +643,8 @@ status = acpi_hw_clear_gpe (gpe_event_info); if (ACPI_FAILURE (status)) { ACPI_REPORT_ERROR (( - "acpi_ev_gpe_dispatch: Unable to clear GPE[%2X]\n", - gpe_number)); + "acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", + acpi_format_exception (status), gpe_number)); return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); } } @@ -659,8 +659,8 @@ status = acpi_ev_disable_gpe (gpe_event_info); if (ACPI_FAILURE (status)) { ACPI_REPORT_ERROR (( - "acpi_ev_gpe_dispatch: Unable to disable GPE[%2X]\n", - gpe_number)); + "acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n", + acpi_format_exception (status), gpe_number)); return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); } @@ -668,12 +668,12 @@ * Execute the method associated with the GPE * NOTE: Level-triggered GPEs are cleared after the method completes. */ - if (ACPI_FAILURE (acpi_os_queue_for_execution (OSD_PRIORITY_GPE, - acpi_ev_asynch_execute_gpe_method, - gpe_event_info))) { + status = acpi_os_queue_for_execution (OSD_PRIORITY_GPE, + acpi_ev_asynch_execute_gpe_method, gpe_event_info); + if (ACPI_FAILURE (status)) { ACPI_REPORT_ERROR (( - "acpi_ev_gpe_dispatch: Unable to queue handler for GPE[%2X], event is disabled\n", - gpe_number)); + "acpi_ev_gpe_dispatch: %s, Unable to queue handler for GPE[%2X] - event disabled\n", + acpi_format_exception (status), gpe_number)); } break; @@ -692,8 +692,8 @@ status = acpi_ev_disable_gpe (gpe_event_info); if (ACPI_FAILURE (status)) { ACPI_REPORT_ERROR (( - "acpi_ev_gpe_dispatch: Unable to disable GPE[%2X]\n", - gpe_number)); + "acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n", + acpi_format_exception (status), gpe_number)); return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); } break; diff -Nru a/drivers/acpi/events/evxfevnt.c b/drivers/acpi/events/evxfevnt.c --- a/drivers/acpi/events/evxfevnt.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/acpi/events/evxfevnt.c 2005-01-02 23:03:33 -08:00 @@ -435,7 +435,7 @@ * DESCRIPTION: Clear an ACPI event (fixed) * ******************************************************************************/ -#ifdef ACPI_FUTURE_USAGE + acpi_status acpi_clear_event ( u32 event) @@ -462,7 +462,6 @@ return_ACPI_STATUS (status); } EXPORT_SYMBOL(acpi_clear_event); -#endif /* ACPI_FUTURE_USAGE */ /******************************************************************************* diff -Nru a/drivers/acpi/executer/exconfig.c b/drivers/acpi/executer/exconfig.c --- a/drivers/acpi/executer/exconfig.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/acpi/executer/exconfig.c 2005-01-02 23:03:34 -08:00 @@ -95,7 +95,7 @@ ACPI_MEMSET (&table_info, 0, sizeof (struct acpi_table_desc)); - table_info.type = 5; + table_info.type = ACPI_TABLE_SSDT; table_info.pointer = table; table_info.length = (acpi_size) table->length; table_info.allocation = ACPI_MEM_ALLOCATED; diff -Nru a/drivers/acpi/executer/exconvrt.c b/drivers/acpi/executer/exconvrt.c --- a/drivers/acpi/executer/exconvrt.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/acpi/executer/exconvrt.c 2005-01-02 23:03:33 -08:00 @@ -115,12 +115,6 @@ */ result = 0; - /* Transfer no more than an integer's worth of data */ - - if (count > acpi_gbl_integer_byte_width) { - count = acpi_gbl_integer_byte_width; - } - /* * String conversion is different than Buffer conversion */ @@ -142,6 +136,12 @@ case ACPI_TYPE_BUFFER: + /* Transfer no more than an integer's worth of data */ + + if (count > acpi_gbl_integer_byte_width) { + count = acpi_gbl_integer_byte_width; + } + /* * Convert buffer to an integer - we simply grab enough raw data * from the buffer to fill an integer @@ -173,6 +173,7 @@ /* Save the Result */ return_desc->integer.value = result; + acpi_ex_truncate_for32bit_table (return_desc); *result_desc = return_desc; return_ACPI_STATUS (AE_OK); } @@ -398,9 +399,9 @@ { union acpi_operand_object *return_desc; u8 *new_buf; + u32 i; u32 string_length = 0; u16 base = 16; - u32 i; u8 separator = ','; @@ -460,6 +461,8 @@ case ACPI_TYPE_BUFFER: + /* Setup string length, base, and separator */ + switch (type) { case ACPI_EXPLICIT_CONVERT_DECIMAL: /* Used by to_decimal_string operator */ /* @@ -467,9 +470,23 @@ * decimal values separated by commas." */ base = 10; - string_length = obj_desc->buffer.length; /* 4 chars for each decimal */ - /*lint -fallthrough */ + /* + * Calculate the final string length. Individual string values + * are variable length (include separator for each) + */ + for (i = 0; i < obj_desc->buffer.length; i++) { + if (obj_desc->buffer.pointer[i] >= 100) { + string_length += 4; + } + else if (obj_desc->buffer.pointer[i] >= 10) { + string_length += 3; + } + else { + string_length += 2; + } + } + break; case ACPI_IMPLICIT_CONVERT_HEX: /* @@ -477,55 +494,56 @@ *"The entire contents of the buffer are converted to a string of * two-character hexadecimal numbers, each separated by a space." */ - if (type == ACPI_IMPLICIT_CONVERT_HEX) { - separator = ' '; - } - - /*lint -fallthrough */ + separator = ' '; + string_length = (obj_desc->buffer.length * 3); + break; case ACPI_EXPLICIT_CONVERT_HEX: /* Used by to_hex_string operator */ /* * From ACPI: "If Data is a buffer, it is converted to a string of * hexadecimal values separated by commas." */ - string_length += (obj_desc->buffer.length * 3); - if (string_length > ACPI_MAX_STRING_CONVERSION) /* ACPI limit */ { - return_ACPI_STATUS (AE_AML_STRING_LIMIT); - } - - /* Create a new string object and string buffer */ - - return_desc = acpi_ut_create_string_object ((acpi_size) string_length -1); - if (!return_desc) { - return_ACPI_STATUS (AE_NO_MEMORY); - } + string_length = (obj_desc->buffer.length * 3); + break; - new_buf = return_desc->buffer.pointer; + default: + return_ACPI_STATUS (AE_BAD_PARAMETER); + } - /* - * Convert buffer bytes to hex or decimal values - * (separated by commas) - */ - for (i = 0; i < obj_desc->buffer.length; i++) { - new_buf += acpi_ex_convert_to_ascii ( - (acpi_integer) obj_desc->buffer.pointer[i], base, - new_buf, 1); - *new_buf++ = separator; /* each separated by a comma or space */ - } + /* + * Perform the conversion. + * (-1 because of extra separator included in string_length from above) + */ + string_length--; + if (string_length > ACPI_MAX_STRING_CONVERSION) /* ACPI limit */ { + return_ACPI_STATUS (AE_AML_STRING_LIMIT); + } - /* Null terminate the string (overwrites final comma from above) */ + /* + * Create a new string object and string buffer + */ + return_desc = acpi_ut_create_string_object ((acpi_size) string_length); + if (!return_desc) { + return_ACPI_STATUS (AE_NO_MEMORY); + } - new_buf--; - *new_buf = 0; + new_buf = return_desc->buffer.pointer; - /* Recalculate length */ + /* + * Convert buffer bytes to hex or decimal values + * (separated by commas or spaces) + */ + for (i = 0; i < obj_desc->buffer.length; i++) { + new_buf += acpi_ex_convert_to_ascii ( + (acpi_integer) obj_desc->buffer.pointer[i], base, + new_buf, 1); + *new_buf++ = separator; /* each separated by a comma or space */ + } - return_desc->string.length = ACPI_STRLEN (return_desc->string.pointer); - break; + /* Null terminate the string (overwrites final comma/space from above) */ - default: - return_ACPI_STATUS (AE_BAD_PARAMETER); - } + new_buf--; + *new_buf = 0; break; default: diff -Nru a/drivers/acpi/executer/exdump.c b/drivers/acpi/executer/exdump.c --- a/drivers/acpi/executer/exdump.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/acpi/executer/exdump.c 2005-01-02 23:03:33 -08:00 @@ -110,10 +110,12 @@ /* obj_desc is a valid object */ if (depth > 0) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, "%*s[%u] ", depth, " ", depth)); + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%*s[%u] %p ", + depth, " ", depth, obj_desc)); + } + else { + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p ", obj_desc)); } - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, "%p ", obj_desc)); - switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { case ACPI_TYPE_LOCAL_REFERENCE: @@ -712,9 +714,6 @@ acpi_ex_out_integer ("bit_length", obj_desc->common_field.bit_length); acpi_ex_out_integer ("fld_bit_offset", obj_desc->common_field.start_field_bit_offset); acpi_ex_out_integer ("base_byte_offset", obj_desc->common_field.base_byte_offset); - acpi_ex_out_integer ("datum_valid_bits", obj_desc->common_field.datum_valid_bits); - acpi_ex_out_integer ("end_fld_valid_bits",obj_desc->common_field.end_field_valid_bits); - acpi_ex_out_integer ("end_buf_valid_bits",obj_desc->common_field.end_buffer_valid_bits); acpi_ex_out_pointer ("parent_node", obj_desc->common_field.node); switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { diff -Nru a/drivers/acpi/executer/exfldio.c b/drivers/acpi/executer/exfldio.c --- a/drivers/acpi/executer/exfldio.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/acpi/executer/exfldio.c 2005-01-02 23:03:33 -08:00 @@ -612,210 +612,6 @@ /******************************************************************************* * - * FUNCTION: acpi_ex_get_buffer_datum - * - * PARAMETERS: Datum - Where the Datum is returned - * Buffer - Raw field buffer - * buffer_length - Entire length (used for big-endian only) - * byte_granularity - 1/2/4/8 Granularity of the field - * (aka Datum Size) - * buffer_offset - Datum offset into the buffer - * - * RETURN: none - * - * DESCRIPTION: Get a datum from the buffer according to the buffer field - * byte granularity - * - ******************************************************************************/ - -void -acpi_ex_get_buffer_datum ( - acpi_integer *datum, - void *buffer, - u32 buffer_length, - u32 byte_granularity, - u32 buffer_offset) -{ - u32 index; - - - ACPI_FUNCTION_TRACE_U32 ("ex_get_buffer_datum", byte_granularity); - - - /* Get proper index into buffer (handles big/little endian) */ - - index = ACPI_BUFFER_INDEX (buffer_length, buffer_offset, byte_granularity); - - /* Move the requested number of bytes */ - - switch (byte_granularity) { - case ACPI_FIELD_BYTE_GRANULARITY: - - *datum = ((u8 *) buffer) [index]; - break; - - case ACPI_FIELD_WORD_GRANULARITY: - - ACPI_MOVE_16_TO_64 (datum, &(((u16 *) buffer) [index])); - break; - - case ACPI_FIELD_DWORD_GRANULARITY: - - ACPI_MOVE_32_TO_64 (datum, &(((u32 *) buffer) [index])); - break; - - case ACPI_FIELD_QWORD_GRANULARITY: - - ACPI_MOVE_64_TO_64 (datum, &(((u64 *) buffer) [index])); - break; - - default: - /* Should not get here */ - break; - } - - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: acpi_ex_set_buffer_datum - * - * PARAMETERS: merged_datum - Value to store - * Buffer - Receiving buffer - * buffer_length - Entire length (used for big-endian only) - * byte_granularity - 1/2/4/8 Granularity of the field - * (aka Datum Size) - * buffer_offset - Datum offset into the buffer - * - * RETURN: none - * - * DESCRIPTION: Store the merged datum to the buffer according to the - * byte granularity - * - ******************************************************************************/ - -void -acpi_ex_set_buffer_datum ( - acpi_integer merged_datum, - void *buffer, - u32 buffer_length, - u32 byte_granularity, - u32 buffer_offset) -{ - u32 index; - - - ACPI_FUNCTION_TRACE_U32 ("ex_set_buffer_datum", byte_granularity); - - - /* Get proper index into buffer (handles big/little endian) */ - - index = ACPI_BUFFER_INDEX (buffer_length, buffer_offset, byte_granularity); - - /* Move the requested number of bytes */ - - switch (byte_granularity) { - case ACPI_FIELD_BYTE_GRANULARITY: - - ((u8 *) buffer) [index] = (u8) merged_datum; - break; - - case ACPI_FIELD_WORD_GRANULARITY: - - ACPI_MOVE_64_TO_16 (&(((u16 *) buffer)[index]), &merged_datum); - break; - - case ACPI_FIELD_DWORD_GRANULARITY: - - ACPI_MOVE_64_TO_32 (&(((u32 *) buffer)[index]), &merged_datum); - break; - - case ACPI_FIELD_QWORD_GRANULARITY: - - ACPI_MOVE_64_TO_64 (&(((u64 *) buffer)[index]), &merged_datum); - break; - - default: - /* Should not get here */ - break; - } - - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: acpi_ex_common_buffer_setup - * - * PARAMETERS: obj_desc - Field object - * buffer_length - Length of caller's buffer - * datum_count - Where the datum_count is returned - * - * RETURN: Status, datum_count - * - * DESCRIPTION: Common code to validate the incoming buffer size and compute - * the number of field "datums" that must be read or written. - * A "datum" is the smallest unit that can be read or written - * to the field, it is either 1,2,4, or 8 bytes. - * - ******************************************************************************/ - -acpi_status -acpi_ex_common_buffer_setup ( - union acpi_operand_object *obj_desc, - u32 buffer_length, - u32 *datum_count) -{ - u32 byte_field_length; - u32 actual_byte_field_length; - - - ACPI_FUNCTION_TRACE ("ex_common_buffer_setup"); - - - /* - * Incoming buffer must be at least as long as the field, we do not - * allow "partial" field reads/writes. We do not care if the buffer is - * larger than the field, this typically happens when an integer is - * read/written to a field that is actually smaller than an integer. - */ - byte_field_length = ACPI_ROUND_BITS_UP_TO_BYTES ( - obj_desc->common_field.bit_length); - if (byte_field_length > buffer_length) { - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Field size %X (bytes) is too large for buffer (%X)\n", - byte_field_length, buffer_length)); - - return_ACPI_STATUS (AE_BUFFER_OVERFLOW); - } - - /* - * Create "actual" field byte count (minimum number of bytes that - * must be read), then convert to datum count (minimum number - * of datum-sized units that must be read) - */ - actual_byte_field_length = ACPI_ROUND_BITS_UP_TO_BYTES ( - obj_desc->common_field.start_field_bit_offset + - obj_desc->common_field.bit_length); - - - *datum_count = ACPI_ROUND_UP_TO (actual_byte_field_length, - obj_desc->common_field.access_byte_width); - - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "buffer_bytes %X, actual_bytes %X, Datums %X, byte_gran %X\n", - byte_field_length, actual_byte_field_length, - *datum_count, obj_desc->common_field.access_byte_width)); - - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * * FUNCTION: acpi_ex_extract_from_field * * PARAMETERS: obj_desc - Field to be read @@ -835,128 +631,92 @@ u32 buffer_length) { acpi_status status; - u32 field_datum_byte_offset; - u32 buffer_datum_offset; - acpi_integer previous_raw_datum = 0; - acpi_integer this_raw_datum = 0; - acpi_integer merged_datum = 0; + acpi_integer raw_datum; + acpi_integer merged_datum; + u32 field_offset = 0; + u32 buffer_offset = 0; + u32 buffer_tail_bits; u32 datum_count; + u32 field_datum_count; u32 i; ACPI_FUNCTION_TRACE ("ex_extract_from_field"); - /* Validate buffer, compute number of datums */ + /* Validate target buffer and clear it */ - status = acpi_ex_common_buffer_setup (obj_desc, buffer_length, &datum_count); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); - } + if (buffer_length < ACPI_ROUND_BITS_UP_TO_BYTES ( + obj_desc->common_field.bit_length)) { + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "Field size %X (bits) is too large for buffer (%X)\n", + obj_desc->common_field.bit_length, buffer_length)); - /* - * Clear the caller's buffer (the whole buffer length as given) - * This is very important, especially in the cases where the buffer - * is longer than the size of the field. - */ + return_ACPI_STATUS (AE_BUFFER_OVERFLOW); + } ACPI_MEMSET (buffer, 0, buffer_length); - field_datum_byte_offset = 0; - buffer_datum_offset= 0; - - /* Read the entire field */ + /* Compute the number of datums (access width data items) */ - for (i = 0; i < datum_count; i++) { - status = acpi_ex_field_datum_io (obj_desc, field_datum_byte_offset, - &this_raw_datum, ACPI_READ); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); - } + datum_count = ACPI_ROUND_UP_TO ( + obj_desc->common_field.bit_length, + obj_desc->common_field.access_bit_width); + field_datum_count = ACPI_ROUND_UP_TO ( + obj_desc->common_field.bit_length + + obj_desc->common_field.start_field_bit_offset, + obj_desc->common_field.access_bit_width); - /* We might actually be done if the request fits in one datum */ + /* Priming read from the field */ - if ((datum_count == 1) && - (obj_desc->common_field.flags & AOPOBJ_SINGLE_DATUM)) { - /* 1) Shift the valid data bits down to start at bit 0 */ + status = acpi_ex_field_datum_io (obj_desc, field_offset, &raw_datum, ACPI_READ); + if (ACPI_FAILURE (status)) { + return_ACPI_STATUS (status); + } + merged_datum = raw_datum >> obj_desc->common_field.start_field_bit_offset; - merged_datum = (this_raw_datum >> obj_desc->common_field.start_field_bit_offset); + /* Read the rest of the field */ - /* 2) Mask off any upper unused bits (bits not part of the field) */ + for (i = 1; i < field_datum_count; i++) { + /* Get next input datum from the field */ - if (obj_desc->common_field.end_buffer_valid_bits) { - merged_datum &= ACPI_MASK_BITS_ABOVE (obj_desc->common_field.end_buffer_valid_bits); - } + field_offset += obj_desc->common_field.access_byte_width; + status = acpi_ex_field_datum_io (obj_desc, field_offset, + &raw_datum, ACPI_READ); + if (ACPI_FAILURE (status)) { + return_ACPI_STATUS (status); + } - /* Store the datum to the caller buffer */ + /* Merge with previous datum if necessary */ - acpi_ex_set_buffer_datum (merged_datum, buffer, buffer_length, - obj_desc->common_field.access_byte_width, buffer_datum_offset); + merged_datum |= raw_datum << + (obj_desc->common_field.access_bit_width - obj_desc->common_field.start_field_bit_offset); - return_ACPI_STATUS (AE_OK); + if (i == datum_count) { + break; } - /* Special handling for the last datum to ignore extra bits */ + /* Write merged datum to target buffer */ - if ((i >= (datum_count -1)) && - (obj_desc->common_field.end_field_valid_bits)) { - /* - * This is the last iteration of the loop. We need to clear - * any unused bits (bits that are not part of this field) before - * we store the final merged datum into the caller buffer. - */ - this_raw_datum &= - ACPI_MASK_BITS_ABOVE (obj_desc->common_field.end_field_valid_bits); - } + ACPI_MEMCPY (((char *) buffer) + buffer_offset, &merged_datum, + ACPI_MIN(obj_desc->common_field.access_byte_width, + buffer_length - buffer_offset)); - /* - * Create the (possibly) merged datum to be stored to the caller buffer - */ - if (obj_desc->common_field.start_field_bit_offset == 0) { - /* Field is not skewed and we can just copy the datum */ - - acpi_ex_set_buffer_datum (this_raw_datum, buffer, buffer_length, - obj_desc->common_field.access_byte_width, buffer_datum_offset); - buffer_datum_offset++; - } - else { - /* Not aligned -- on the first iteration, just save the datum */ + buffer_offset += obj_desc->common_field.access_byte_width; + merged_datum = raw_datum >> obj_desc->common_field.start_field_bit_offset; + } - if (i != 0) { - /* - * Put together the appropriate bits of the two raw data to make a - * single complete field datum - * - * 1) Normalize the first datum down to bit 0 - */ - merged_datum = (previous_raw_datum >> obj_desc->common_field.start_field_bit_offset); - - /* 2) Insert the second datum "above" the first datum */ - - merged_datum |= (this_raw_datum << obj_desc->common_field.datum_valid_bits); - - acpi_ex_set_buffer_datum (merged_datum, buffer, buffer_length, - obj_desc->common_field.access_byte_width, buffer_datum_offset); - buffer_datum_offset++; - } - - /* - * Save the raw datum that was just acquired since it may contain bits - * of the *next* field datum - */ - previous_raw_datum = this_raw_datum; - } + /* Mask off any extra bits in the last datum */ - field_datum_byte_offset += obj_desc->common_field.access_byte_width; + buffer_tail_bits = obj_desc->common_field.bit_length % obj_desc->common_field.access_bit_width; + if (buffer_tail_bits) { + merged_datum &= ACPI_MASK_BITS_ABOVE (buffer_tail_bits); } - /* For non-aligned case, there is one last datum to insert */ - - if (obj_desc->common_field.start_field_bit_offset != 0) { - merged_datum = (this_raw_datum >> obj_desc->common_field.start_field_bit_offset); + /* Write the last datum to the buffer */ - acpi_ex_set_buffer_datum (merged_datum, buffer, buffer_length, - obj_desc->common_field.access_byte_width, buffer_datum_offset); - } + ACPI_MEMCPY (((char *) buffer) + buffer_offset, &merged_datum, + ACPI_MIN(obj_desc->common_field.access_byte_width, + buffer_length - buffer_offset)); return_ACPI_STATUS (AE_OK); } @@ -983,169 +743,91 @@ u32 buffer_length) { acpi_status status; - u32 field_datum_byte_offset; - u32 datum_offset; acpi_integer mask; acpi_integer merged_datum; - acpi_integer previous_raw_datum; - acpi_integer this_raw_datum; + acpi_integer raw_datum = 0; + u32 field_offset = 0; + u32 buffer_offset = 0; + u32 buffer_tail_bits; u32 datum_count; + u32 field_datum_count; + u32 i; ACPI_FUNCTION_TRACE ("ex_insert_into_field"); - /* Validate buffer, compute number of datums */ + /* Validate input buffer */ - status = acpi_ex_common_buffer_setup (obj_desc, buffer_length, &datum_count); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + if (buffer_length < ACPI_ROUND_BITS_UP_TO_BYTES ( + obj_desc->common_field.bit_length)) { + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "Field size %X (bits) is too large for buffer (%X)\n", + obj_desc->common_field.bit_length, buffer_length)); + + return_ACPI_STATUS (AE_BUFFER_OVERFLOW); } - /* - * Break the request into up to three parts (similar to an I/O request): - * 1) non-aligned part at start - * 2) aligned part in middle - * 3) non-aligned part at the end - */ - field_datum_byte_offset = 0; - datum_offset= 0; - - /* Get a single datum from the caller's buffer */ - - acpi_ex_get_buffer_datum (&previous_raw_datum, buffer, buffer_length, - obj_desc->common_field.access_byte_width, datum_offset); - - /* - * Part1: - * Write a partial field datum if field does not begin on a datum boundary - * Note: The code in this section also handles the aligned case - * - * Construct Mask with 1 bits where the field is, 0 bits elsewhere - * (Only the bottom 5 bits of bit_length are valid for a shift operation) - * - * Mask off bits that are "below" the field (if any) - */ + /* Compute the number of datums (access width data items) */ + mask = ACPI_MASK_BITS_BELOW (obj_desc->common_field.start_field_bit_offset); + datum_count = ACPI_ROUND_UP_TO (obj_desc->common_field.bit_length, + obj_desc->common_field.access_bit_width); + field_datum_count = ACPI_ROUND_UP_TO (obj_desc->common_field.bit_length + + obj_desc->common_field.start_field_bit_offset, + obj_desc->common_field.access_bit_width); - /* If the field fits in one datum, may need to mask upper bits */ + /* Get initial Datum from the input buffer */ - if ((obj_desc->common_field.flags & AOPOBJ_SINGLE_DATUM) && - obj_desc->common_field.end_field_valid_bits) { - /* There are bits above the field, mask them off also */ + ACPI_MEMCPY (&raw_datum, buffer, + ACPI_MIN(obj_desc->common_field.access_byte_width, + buffer_length - buffer_offset)); - mask &= ACPI_MASK_BITS_ABOVE (obj_desc->common_field.end_field_valid_bits); - } + merged_datum = raw_datum << obj_desc->common_field.start_field_bit_offset; - /* Shift and mask the value into the field position */ + /* Write the entire field */ - merged_datum = (previous_raw_datum << obj_desc->common_field.start_field_bit_offset); - merged_datum &= mask; + for (i = 1; i < field_datum_count; i++) { + /* Write merged datum to the target field */ - /* Apply the update rule (if necessary) and write the datum to the field */ + merged_datum &= mask; + status = acpi_ex_write_with_update_rule (obj_desc, mask, merged_datum, field_offset); + if (ACPI_FAILURE (status)) { + return_ACPI_STATUS (status); + } - status = acpi_ex_write_with_update_rule (obj_desc, mask, merged_datum, - field_datum_byte_offset); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); - } + /* Start new output datum by merging with previous input datum */ - /* We just wrote the first datum */ + field_offset += obj_desc->common_field.access_byte_width; + merged_datum = raw_datum >> + (obj_desc->common_field.access_bit_width - obj_desc->common_field.start_field_bit_offset); + mask = ACPI_INTEGER_MAX; - datum_offset++; + if (i == datum_count) { + break; + } - /* If the entire field fits within one datum, we are done. */ + /* Get the next input datum from the buffer */ - if ((datum_count == 1) && - (obj_desc->common_field.flags & AOPOBJ_SINGLE_DATUM)) { - return_ACPI_STATUS (AE_OK); + buffer_offset += obj_desc->common_field.access_byte_width; + ACPI_MEMCPY (&raw_datum, ((char *) buffer) + buffer_offset, + ACPI_MIN(obj_desc->common_field.access_byte_width, + buffer_length - buffer_offset)); + merged_datum |= raw_datum << obj_desc->common_field.start_field_bit_offset; } - /* - * Part2: - * Write the aligned data. - * - * We don't need to worry about the update rule for these data, because - * all of the bits in each datum are part of the field. - * - * The last datum must be special cased because it might contain bits - * that are not part of the field -- therefore the "update rule" must be - * applied in Part3 below. - */ - while (datum_offset < datum_count) { - field_datum_byte_offset += obj_desc->common_field.access_byte_width; - - /* - * Get the next raw buffer datum. It may contain bits of the previous - * field datum - */ - acpi_ex_get_buffer_datum (&this_raw_datum, buffer, buffer_length, - obj_desc->common_field.access_byte_width, datum_offset); - - /* Create the field datum based on the field alignment */ - - if (obj_desc->common_field.start_field_bit_offset != 0) { - /* - * Put together appropriate bits of the two raw buffer data to make - * a single complete field datum - */ - merged_datum = - (previous_raw_datum >> obj_desc->common_field.datum_valid_bits) | - (this_raw_datum << obj_desc->common_field.start_field_bit_offset); - } - else { - /* Field began aligned on datum boundary */ - - merged_datum = this_raw_datum; - } + /* Mask off any extra bits in the last datum */ - /* - * Special handling for the last datum if the field does NOT end on - * a datum boundary. Update Rule must be applied to the bits outside - * the field. - */ - datum_offset++; - if ((datum_offset == datum_count) && - (obj_desc->common_field.end_field_valid_bits)) { - /* - * If there are dangling non-aligned bits, perform one more merged write - * Else - field is aligned at the end, no need for any more writes - */ - - /* - * Part3: - * This is the last datum and the field does not end on a datum boundary. - * Build the partial datum and write with the update rule. - * - * Mask off the unused bits above (after) the end-of-field - */ - mask = ACPI_MASK_BITS_ABOVE (obj_desc->common_field.end_field_valid_bits); - merged_datum &= mask; - - /* Write the last datum with the update rule */ - - status = acpi_ex_write_with_update_rule (obj_desc, mask, merged_datum, - field_datum_byte_offset); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); - } - } - else { - /* Normal (aligned) case -- write the completed datum */ + buffer_tail_bits = (obj_desc->common_field.bit_length + + obj_desc->common_field.start_field_bit_offset) % obj_desc->common_field.access_bit_width; + if (buffer_tail_bits) { + mask &= ACPI_MASK_BITS_ABOVE (buffer_tail_bits); + } - status = acpi_ex_field_datum_io (obj_desc, field_datum_byte_offset, - &merged_datum, ACPI_WRITE); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); - } - } + /* Write the last datum to the field */ - /* - * Save the most recent datum since it may contain bits of the *next* - * field datum. Update current byte offset. - */ - previous_raw_datum = this_raw_datum; - } + merged_datum &= mask; + status = acpi_ex_write_with_update_rule (obj_desc, mask, merged_datum, field_offset); return_ACPI_STATUS (status); } diff -Nru a/drivers/acpi/executer/exmisc.c b/drivers/acpi/executer/exmisc.c --- a/drivers/acpi/executer/exmisc.c 2005-01-02 23:03:35 -08:00 +++ b/drivers/acpi/executer/exmisc.c 2005-01-02 23:03:35 -08:00 @@ -389,7 +389,7 @@ if (local_operand1 != operand1) { acpi_ut_remove_reference (local_operand1); } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS (status); } diff -Nru a/drivers/acpi/executer/exoparg1.c b/drivers/acpi/executer/exoparg1.c --- a/drivers/acpi/executer/exoparg1.c 2005-01-02 23:03:35 -08:00 +++ b/drivers/acpi/executer/exoparg1.c 2005-01-02 23:03:35 -08:00 @@ -507,6 +507,10 @@ status = acpi_ex_convert_to_string (operand[0], &return_desc, ACPI_EXPLICIT_CONVERT_DECIMAL); + if (return_desc == operand[0]) { + /* No conversion performed, add ref to handle return value */ + acpi_ut_add_reference (return_desc); + } break; @@ -514,12 +518,20 @@ status = acpi_ex_convert_to_string (operand[0], &return_desc, ACPI_EXPLICIT_CONVERT_HEX); + if (return_desc == operand[0]) { + /* No conversion performed, add ref to handle return value */ + acpi_ut_add_reference (return_desc); + } break; case AML_TO_BUFFER_OP: /* to_buffer (Data, Result) */ status = acpi_ex_convert_to_buffer (operand[0], &return_desc); + if (return_desc == operand[0]) { + /* No conversion performed, add ref to handle return value */ + acpi_ut_add_reference (return_desc); + } break; @@ -527,6 +539,10 @@ status = acpi_ex_convert_to_integer (operand[0], &return_desc, ACPI_ANY_BASE); + if (return_desc == operand[0]) { + /* No conversion performed, add ref to handle return value */ + acpi_ut_add_reference (return_desc); + } break; @@ -551,10 +567,12 @@ goto cleanup; } - /* - * Store the return value computed above into the target object - */ - status = acpi_ex_store (return_desc, operand[1], walk_state); + if (ACPI_SUCCESS (status)) { + /* + * Store the return value computed above into the target object + */ + status = acpi_ex_store (return_desc, operand[1], walk_state); + } cleanup: diff -Nru a/drivers/acpi/executer/exoparg2.c b/drivers/acpi/executer/exoparg2.c --- a/drivers/acpi/executer/exoparg2.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/acpi/executer/exoparg2.c 2005-01-02 23:03:34 -08:00 @@ -410,7 +410,7 @@ index = (u32) operand[1]->integer.value; /* - * At this point, the Source operand is either a Package or a Buffer + * At this point, the Source operand is a Package, Buffer, or String */ if (ACPI_GET_OBJECT_TYPE (operand[0]) == ACPI_TYPE_PACKAGE) { /* Object to be indexed is a Package */ @@ -428,7 +428,7 @@ return_desc->reference.where = &operand[0]->package.elements [index]; } else { - /* Object to be indexed is a Buffer */ + /* Object to be indexed is a Buffer/String */ if (index >= operand[0]->buffer.length) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, diff -Nru a/drivers/acpi/executer/exprep.c b/drivers/acpi/executer/exprep.c --- a/drivers/acpi/executer/exprep.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/acpi/executer/exprep.c 2005-01-02 23:03:33 -08:00 @@ -339,6 +339,8 @@ obj_desc->common_field.access_byte_width = (u8) ACPI_DIV_8 (access_bit_width); /* 1, 2, 4, 8 */ + obj_desc->common_field.access_bit_width = (u8) access_bit_width; + /* * base_byte_offset is the address of the start of the field within the * region. It is the byte address of the first *datum* (field-width data @@ -360,28 +362,6 @@ */ obj_desc->common_field.start_field_bit_offset = (u8) (field_bit_position - ACPI_MUL_8 (obj_desc->common_field.base_byte_offset)); - - /* - * Valid bits -- the number of bits that compose a partial datum, - * 1) At the end of the field within the region (arbitrary starting bit - * offset) - * 2) At the end of a buffer used to contain the field (starting offset - * always zero) - */ - obj_desc->common_field.end_field_valid_bits = (u8) - ((obj_desc->common_field.start_field_bit_offset + field_bit_length) % - access_bit_width); - /* start_buffer_bit_offset always = 0 */ - - obj_desc->common_field.end_buffer_valid_bits = (u8) - (field_bit_length % access_bit_width); - - /* - * datum_valid_bits is the number of valid field bits in the first - * field datum. - */ - obj_desc->common_field.datum_valid_bits = (u8) - (access_bit_width - obj_desc->common_field.start_field_bit_offset); /* * Does the entire field fit within a single field access element? (datum) diff -Nru a/drivers/acpi/executer/exstore.c b/drivers/acpi/executer/exstore.c --- a/drivers/acpi/executer/exstore.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/acpi/executer/exstore.c 2005-01-02 23:03:34 -08:00 @@ -295,56 +295,45 @@ switch (index_desc->reference.target_type) { case ACPI_TYPE_PACKAGE: /* - * Storing to a package element is not simple. The source must be - * evaluated and converted to the type of the destination and then the - * source is copied into the destination - we can't just point to the - * source object. - */ - /* + * Storing to a package element. Copy the object and replace + * any existing object with the new object. No implicit + * conversion is performed. + * * The object at *(index_desc->Reference.Where) is the * element within the package that is to be modified. * The parent package object is at index_desc->Reference.Object */ obj_desc = *(index_desc->reference.where); - /* Do the conversion/store */ - - status = acpi_ex_store_object_to_object (source_desc, obj_desc, &new_desc, - walk_state); + status = acpi_ut_copy_iobject_to_iobject (source_desc, &new_desc, walk_state); if (ACPI_FAILURE (status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Could not store object to indexed package element\n")); return_ACPI_STATUS (status); } - /* - * If a new object was created, we must install it as the new - * package element - */ - if (new_desc != obj_desc) { - acpi_ut_remove_reference (obj_desc); - *(index_desc->reference.where) = new_desc; - - /* If same as the original source, add a reference */ + if (obj_desc) { + /* Decrement reference count by the ref count of the parent package */ - if (new_desc == source_desc) { - acpi_ut_add_reference (new_desc); + for (i = 0; i < ((union acpi_operand_object *) index_desc->reference.object)->common.reference_count; i++) { + acpi_ut_remove_reference (obj_desc); } + } - /* Increment reference count by the ref count of the parent package -1 */ + *(index_desc->reference.where) = new_desc; - for (i = 1; i < ((union acpi_operand_object *) index_desc->reference.object)->common.reference_count; i++) { - acpi_ut_add_reference (new_desc); - } + /* Increment reference count by the ref count of the parent package -1 */ + + for (i = 1; i < ((union acpi_operand_object *) index_desc->reference.object)->common.reference_count; i++) { + acpi_ut_add_reference (new_desc); } + break; case ACPI_TYPE_BUFFER_FIELD: /* - * Store into a Buffer (not actually a real buffer_field) at a - * location defined by an Index. + * Store into a Buffer or String (not actually a real buffer_field) + * at a location defined by an Index. * * The first 8-bit element of the source object is written to the * 8-bit Buffer location defined by the Index destination object, @@ -352,10 +341,13 @@ */ /* - * Make sure the target is a Buffer + * Make sure the target is a Buffer or String. An error should + * not happen here, since the reference_object was constructed + * by the INDEX_OP code. */ obj_desc = index_desc->reference.object; - if (ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_BUFFER) { + if ((ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_BUFFER) && + (ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_STRING)) { return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } @@ -372,13 +364,11 @@ break; case ACPI_TYPE_BUFFER: - - value = source_desc->buffer.pointer[0]; - break; - case ACPI_TYPE_STRING: - value = (u8) source_desc->string.pointer[0]; + /* Note: Takes advantage of common string/buffer fields */ + + value = source_desc->buffer.pointer[0]; break; default: diff -Nru a/drivers/acpi/executer/exstorob.c b/drivers/acpi/executer/exstorob.c --- a/drivers/acpi/executer/exstorob.c 2005-01-02 23:03:35 -08:00 +++ b/drivers/acpi/executer/exstorob.c 2005-01-02 23:03:35 -08:00 @@ -93,34 +93,35 @@ return_ACPI_STATUS (AE_NO_MEMORY); } - target_desc->common.flags &= ~AOPOBJ_STATIC_POINTER; target_desc->buffer.length = length; } - /* - * Buffer is a static allocation, - * only place what will fit in the buffer. - */ + /* Copy source buffer to target buffer */ + if (length <= target_desc->buffer.length) { /* Clear existing buffer and copy in the new one */ ACPI_MEMSET (target_desc->buffer.pointer, 0, target_desc->buffer.length); ACPI_MEMCPY (target_desc->buffer.pointer, buffer, length); + + /* Set the new length of the target */ + + target_desc->buffer.length = length; } else { - /* - * Truncate the source, copy only what will fit - */ + /* Truncate the source, copy only what will fit */ + ACPI_MEMCPY (target_desc->buffer.pointer, buffer, target_desc->buffer.length); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Truncating src buffer from %X to %X\n", + "Truncating source buffer from %X to %X\n", length, target_desc->buffer.length)); } /* Copy flags */ target_desc->buffer.flags = source_desc->buffer.flags; + target_desc->common.flags &= ~AOPOBJ_STATIC_POINTER; return_ACPI_STATUS (AE_OK); } diff -Nru a/drivers/acpi/hardware/hwsleep.c b/drivers/acpi/hardware/hwsleep.c --- a/drivers/acpi/hardware/hwsleep.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/acpi/hardware/hwsleep.c 2005-01-02 23:03:33 -08:00 @@ -282,15 +282,6 @@ return_ACPI_STATUS (status); } - if (sleep_state != ACPI_STATE_S5) { - /* Disable BM arbitration */ - - status = acpi_set_register (ACPI_BITREG_ARB_DISABLE, 1, ACPI_MTX_DO_NOT_LOCK); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); - } - } - /* * 1) Disable/Clear all GPEs * 2) Enable all wakeup GPEs @@ -580,13 +571,6 @@ 1, ACPI_MTX_DO_NOT_LOCK); (void) acpi_set_register(acpi_gbl_fixed_event_info[ACPI_EVENT_POWER_BUTTON].status_register_id, 1, ACPI_MTX_DO_NOT_LOCK); - - /* Enable BM arbitration */ - - status = acpi_set_register (ACPI_BITREG_ARB_DISABLE, 0, ACPI_MTX_LOCK); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); - } arg.integer.value = ACPI_SST_WORKING; status = acpi_evaluate_object (NULL, METHOD_NAME__SST, &arg_list, NULL); diff -Nru a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c --- a/drivers/acpi/ibm_acpi.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/acpi/ibm_acpi.c 2005-01-02 23:03:34 -08:00 @@ -1168,7 +1168,7 @@ #define IBM_PARAM(feature) \ module_param_call(feature, set_ibm_param, NULL, NULL, 0) -static void __exit acpi_ibm_exit(void) +static void acpi_ibm_exit(void) { int i; diff -Nru a/drivers/acpi/numa.c b/drivers/acpi/numa.c --- a/drivers/acpi/numa.c 2005-01-02 23:03:35 -08:00 +++ b/drivers/acpi/numa.c 2005-01-02 23:03:35 -08:00 @@ -22,7 +22,7 @@ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * */ - +#include #include #include #include @@ -199,3 +199,22 @@ acpi_numa_arch_fixup(); return 0; } + +int +acpi_get_pxm(acpi_handle h) +{ + unsigned long pxm; + acpi_status status; + acpi_handle handle; + acpi_handle phandle = h; + + do { + handle = phandle; + status = acpi_evaluate_integer(handle, "_PXM", NULL, &pxm); + if (ACPI_SUCCESS(status)) + return (int)pxm; + status = acpi_get_parent(handle, &phandle); + } while(ACPI_SUCCESS(status)); + return -1; +} +EXPORT_SYMBOL(acpi_get_pxm); diff -Nru a/drivers/acpi/osl.c b/drivers/acpi/osl.c --- a/drivers/acpi/osl.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/acpi/osl.c 2005-01-02 23:03:34 -08:00 @@ -40,6 +40,7 @@ #include #include #include +#include #include #include @@ -356,7 +357,7 @@ if (!t) printk(KERN_ERR PREFIX "acpi_os_get_timer() TBD\n"); - return(++t); + return ++t; } acpi_status @@ -635,7 +636,7 @@ acpi_integer value, u32 width) { - return (AE_SUPPORT); + return AE_SUPPORT; } acpi_status @@ -645,7 +646,7 @@ void *value, u32 width) { - return (AE_SUPPORT); + return AE_SUPPORT; } void @@ -1155,7 +1156,7 @@ * max_cstate is defined in the base kernel so modules can * change it w/o depending on the state of the processor module. */ -unsigned int max_cstate = ACPI_C_STATES_MAX; +unsigned int max_cstate = ACPI_PROCESSOR_MAX_POWER; EXPORT_SYMBOL(max_cstate); diff -Nru a/drivers/acpi/parser/psopcode.c b/drivers/acpi/parser/psopcode.c --- a/drivers/acpi/parser/psopcode.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/acpi/parser/psopcode.c 2005-01-02 23:03:33 -08:00 @@ -318,7 +318,7 @@ #define ARGI_SHIFT_LEFT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) #define ARGI_SHIFT_RIGHT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) #define ARGI_SIGNAL_OP ARGI_LIST1 (ARGI_EVENT) -#define ARGI_SIZE_OF_OP ARGI_LIST1 (ARGI_REFERENCE) /* Force delay of operand resolution */ +#define ARGI_SIZE_OF_OP ARGI_LIST1 (ARGI_DATAOBJECT) #define ARGI_SLEEP_OP ARGI_LIST1 (ARGI_INTEGER) #define ARGI_STALL_OP ARGI_LIST1 (ARGI_INTEGER) #define ARGI_STATICSTRING_OP ARGI_INVALID_OPCODE @@ -333,7 +333,7 @@ #define ARGI_TO_HEX_STR_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET) #define ARGI_TO_INTEGER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET) #define ARGI_TO_STRING_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_FIXED_TARGET) -#define ARGI_TYPE_OP ARGI_LIST1 (ARGI_REFERENCE) /* Force delay of operand resolution */ +#define ARGI_TYPE_OP ARGI_LIST1 (ARGI_ANYTYPE) #define ARGI_UNLOAD_OP ARGI_LIST1 (ARGI_DDBHANDLE) #define ARGI_VAR_PACKAGE_OP ARGI_LIST1 (ARGI_INTEGER) #define ARGI_WAIT_OP ARGI_LIST2 (ARGI_EVENT, ARGI_INTEGER) @@ -521,14 +521,14 @@ /* 2D */ ACPI_OP ("FindSetRightBit", ARGP_FIND_SET_RIGHT_BIT_OP,ARGI_FIND_SET_RIGHT_BIT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), /* 2E */ ACPI_OP ("DerefOf", ARGP_DEREF_OF_OP, ARGI_DEREF_OF_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R), /* 2F */ ACPI_OP ("Notify", ARGP_NOTIFY_OP, ARGI_NOTIFY_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_0R, AML_FLAGS_EXEC_2A_0T_0R), -/* 30 */ ACPI_OP ("SizeOf", ARGP_SIZE_OF_OP, ARGI_SIZE_OF_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R), +/* 30 */ ACPI_OP ("SizeOf", ARGP_SIZE_OF_OP, ARGI_SIZE_OF_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R | AML_NO_OPERAND_RESOLVE), /* 31 */ ACPI_OP ("Index", ARGP_INDEX_OP, ARGI_INDEX_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT), /* 32 */ ACPI_OP ("Match", ARGP_MATCH_OP, ARGI_MATCH_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R | AML_CONSTANT), /* 33 */ ACPI_OP ("CreateDWordField", ARGP_CREATE_DWORD_FIELD_OP,ARGI_CREATE_DWORD_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE), /* 34 */ ACPI_OP ("CreateWordField", ARGP_CREATE_WORD_FIELD_OP, ARGI_CREATE_WORD_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE), /* 35 */ ACPI_OP ("CreateByteField", ARGP_CREATE_BYTE_FIELD_OP, ARGI_CREATE_BYTE_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE), /* 36 */ ACPI_OP ("CreateBitField", ARGP_CREATE_BIT_FIELD_OP, ARGI_CREATE_BIT_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE), -/* 37 */ ACPI_OP ("ObjectType", ARGP_TYPE_OP, ARGI_TYPE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R), +/* 37 */ ACPI_OP ("ObjectType", ARGP_TYPE_OP, ARGI_TYPE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R | AML_NO_OPERAND_RESOLVE), /* 38 */ ACPI_OP ("LAnd", ARGP_LAND_OP, ARGI_LAND_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL_NUMERIC | AML_CONSTANT), /* 39 */ ACPI_OP ("LOr", ARGP_LOR_OP, ARGI_LOR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL_NUMERIC | AML_CONSTANT), /* 3A */ ACPI_OP ("LNot", ARGP_LNOT_OP, ARGI_LNOT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT), diff -Nru a/drivers/acpi/pci_bind.c b/drivers/acpi/pci_bind.c --- a/drivers/acpi/pci_bind.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/acpi/pci_bind.c 2005-01-02 23:03:34 -08:00 @@ -126,8 +126,8 @@ acpi_status status = AE_OK; struct acpi_pci_data *data = NULL; struct acpi_pci_data *pdata = NULL; - char pathname[ACPI_PATHNAME_MAX] = {0}; - struct acpi_buffer buffer = {ACPI_PATHNAME_MAX, pathname}; + char *pathname = NULL; + struct acpi_buffer buffer = {0, NULL}; acpi_handle handle = NULL; ACPI_FUNCTION_TRACE("acpi_pci_bind"); @@ -135,9 +135,18 @@ if (!device || !device->parent) return_VALUE(-EINVAL); + pathname = kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL); + if(!pathname) + return_VALUE(-ENOMEM); + memset(pathname, 0, ACPI_PATHNAME_MAX); + buffer.length = ACPI_PATHNAME_MAX; + buffer.pointer = pathname; + data = kmalloc(sizeof(struct acpi_pci_data), GFP_KERNEL); - if (!data) + if (!data){ + kfree (pathname); return_VALUE(-ENOMEM); + } memset(data, 0, sizeof(struct acpi_pci_data)); acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer); @@ -216,6 +225,7 @@ data->id.device, data->id.function)); data->bus = data->dev->subordinate; device->ops.bind = acpi_pci_bind; + device->ops.unbind = acpi_pci_unbind; } /* @@ -253,12 +263,56 @@ } end: + kfree(pathname); if (result) kfree(data); return_VALUE(result); } +int acpi_pci_unbind( + struct acpi_device *device) +{ + int result = 0; + acpi_status status = AE_OK; + struct acpi_pci_data *data = NULL; + char pathname[ACPI_PATHNAME_MAX] = {0}; + struct acpi_buffer buffer = {ACPI_PATHNAME_MAX, pathname}; + + ACPI_FUNCTION_TRACE("acpi_pci_unbind"); + + if (!device || !device->parent) + return_VALUE(-EINVAL); + + acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Unbinding PCI device [%s]...\n", + pathname)); + + status = acpi_get_data(device->handle, acpi_pci_data_handler, (void**)&data); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unable to get data from device %s\n", + acpi_device_bid(device))); + result = -ENODEV; + goto end; + } + + status = acpi_detach_data(device->handle, acpi_pci_data_handler); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unable to detach data from device %s\n", + acpi_device_bid(device))); + result = -ENODEV; + goto end; + } + if (data->dev->subordinate) { + acpi_pci_irq_del_prt(data->id.segment, data->bus->number); + } + kfree(data); + +end: + return_VALUE(result); +} int acpi_pci_bind_root ( @@ -269,22 +323,35 @@ int result = 0; acpi_status status = AE_OK; struct acpi_pci_data *data = NULL; - char pathname[ACPI_PATHNAME_MAX] = {0}; - struct acpi_buffer buffer = {ACPI_PATHNAME_MAX, pathname}; + char *pathname = NULL; + struct acpi_buffer buffer = {0, NULL}; ACPI_FUNCTION_TRACE("acpi_pci_bind_root"); - if (!device || !id || !bus) + pathname = (char *)kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL); + if(!pathname) + return_VALUE(-ENOMEM); + memset(pathname, 0, ACPI_PATHNAME_MAX); + + buffer.length = ACPI_PATHNAME_MAX; + buffer.pointer = pathname; + + if (!device || !id || !bus){ + kfree(pathname); return_VALUE(-EINVAL); + } data = kmalloc(sizeof(struct acpi_pci_data), GFP_KERNEL); - if (!data) + if (!data){ + kfree(pathname); return_VALUE(-ENOMEM); + } memset(data, 0, sizeof(struct acpi_pci_data)); data->id = *id; data->bus = bus; device->ops.bind = acpi_pci_bind; + device->ops.unbind = acpi_pci_unbind; acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer); @@ -301,6 +368,7 @@ } end: + kfree(pathname); if (result != 0) kfree(data); diff -Nru a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c --- a/drivers/acpi/pci_irq.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/acpi/pci_irq.c 2005-01-02 23:03:34 -08:00 @@ -43,7 +43,7 @@ ACPI_MODULE_NAME ("pci_irq") struct acpi_prt_list acpi_prt; - +spinlock_t acpi_prt_lock = SPIN_LOCK_UNLOCKED; /* -------------------------------------------------------------------------- PCI IRQ Routing Table (PRT) Support @@ -68,18 +68,20 @@ * Parse through all PRT entries looking for a match on the specified * PCI device's segment, bus, device, and pin (don't care about func). * - * TBD: Acquire/release lock */ + spin_lock(&acpi_prt_lock); list_for_each(node, &acpi_prt.entries) { entry = list_entry(node, struct acpi_prt_entry, node); if ((segment == entry->id.segment) && (bus == entry->id.bus) && (device == entry->id.device) && (pin == entry->pin)) { + spin_unlock(&acpi_prt_lock); return_PTR(entry); } } + spin_unlock(&acpi_prt_lock); return_PTR(NULL); } @@ -141,14 +143,29 @@ entry->id.segment, entry->id.bus, entry->id.device, ('A' + entry->pin), prt->source, entry->link.index)); - /* TBD: Acquire/release lock */ + spin_lock(&acpi_prt_lock); list_add_tail(&entry->node, &acpi_prt.entries); acpi_prt.count++; + spin_unlock(&acpi_prt_lock); return_VALUE(0); } +static void +acpi_pci_irq_del_entry ( + int segment, + int bus, + struct acpi_prt_entry *entry) +{ + if (segment == entry->id.segment && bus == entry->id.bus){ + acpi_prt.count--; + list_del(&entry->node); + kfree(entry); + } +} + + int acpi_pci_irq_add_prt ( acpi_handle handle, @@ -156,7 +173,7 @@ int bus) { acpi_status status = AE_OK; - char pathname[ACPI_PATHNAME_MAX] = {0}; + char *pathname = NULL; struct acpi_buffer buffer = {0, NULL}; struct acpi_pci_routing_table *prt = NULL; struct acpi_pci_routing_table *entry = NULL; @@ -164,6 +181,11 @@ ACPI_FUNCTION_TRACE("acpi_pci_irq_add_prt"); + pathname = (char *) kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL); + if(!pathname) + return_VALUE(-ENOMEM); + memset(pathname, 0, ACPI_PATHNAME_MAX); + if (first_time) { acpi_prt.count = 0; INIT_LIST_HEAD(&acpi_prt.entries); @@ -175,7 +197,7 @@ * (either a PCI root bridge or PCI-PCI bridge). */ - buffer.length = sizeof(pathname); + buffer.length = ACPI_PATHNAME_MAX; buffer.pointer = pathname; acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer); @@ -188,6 +210,7 @@ buffer.length = 0; buffer.pointer = NULL; + kfree(pathname); status = acpi_get_irq_routing_table(handle, &buffer); if (status != AE_BUFFER_OVERFLOW) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PRT [%s]\n", @@ -196,8 +219,9 @@ } prt = kmalloc(buffer.length, GFP_KERNEL); - if (!prt) + if (!prt){ return_VALUE(-ENOMEM); + } memset(prt, 0, buffer.length); buffer.pointer = prt; @@ -222,7 +246,26 @@ return_VALUE(0); } +void +acpi_pci_irq_del_prt (int segment, int bus) +{ + struct list_head *node = NULL, *n = NULL; + struct acpi_prt_entry *entry = NULL; + + if (!acpi_prt.count) { + return; + } + + printk(KERN_DEBUG "ACPI: Delete PCI Interrupt Routing Table for %x:%x\n", + segment, bus); + spin_lock(&acpi_prt_lock); + list_for_each_safe(node, n, &acpi_prt.entries) { + entry = list_entry(node, struct acpi_prt_entry, node); + acpi_pci_irq_del_entry(segment, bus, entry); + } + spin_unlock(&acpi_prt_lock); +} /* -------------------------------------------------------------------------- PCI Interrupt Routing Support -------------------------------------------------------------------------- */ @@ -345,6 +388,7 @@ u8 pin = 0; int edge_level = ACPI_LEVEL_SENSITIVE; int active_high_low = ACPI_ACTIVE_LOW; + extern int via_interrupt_line_quirk; ACPI_FUNCTION_TRACE("acpi_pci_irq_enable"); @@ -393,6 +437,9 @@ return_VALUE(0); } } + + if (via_interrupt_line_quirk) + pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq & 15); dev->irq = acpi_register_gsi(irq, edge_level, active_high_low); diff -Nru a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c --- a/drivers/acpi/pci_link.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/acpi/pci_link.c 2005-01-02 23:03:33 -08:00 @@ -307,50 +307,57 @@ struct { struct acpi_resource res; struct acpi_resource end; - } resource; - struct acpi_buffer buffer = {sizeof(resource)+1, &resource}; + } *resource; + struct acpi_buffer buffer = {0, NULL}; ACPI_FUNCTION_TRACE("acpi_pci_link_set"); if (!link || !irq) return_VALUE(-EINVAL); - memset(&resource, 0, sizeof(resource)); + resource = kmalloc( sizeof(*resource)+1, GFP_KERNEL); + if(!resource) + return_VALUE(-ENOMEM); + + memset(resource, 0, sizeof(*resource)+1); + buffer.length = sizeof(*resource) +1; + buffer.pointer = resource; switch(link->irq.resource_type) { case ACPI_RSTYPE_IRQ: - resource.res.id = ACPI_RSTYPE_IRQ; - resource.res.length = sizeof(struct acpi_resource); - resource.res.data.irq.edge_level = link->irq.edge_level; - resource.res.data.irq.active_high_low = link->irq.active_high_low; + resource->res.id = ACPI_RSTYPE_IRQ; + resource->res.length = sizeof(struct acpi_resource); + resource->res.data.irq.edge_level = link->irq.edge_level; + resource->res.data.irq.active_high_low = link->irq.active_high_low; if (link->irq.edge_level == ACPI_EDGE_SENSITIVE) - resource.res.data.irq.shared_exclusive = ACPI_EXCLUSIVE; + resource->res.data.irq.shared_exclusive = ACPI_EXCLUSIVE; else - resource.res.data.irq.shared_exclusive = ACPI_SHARED; - resource.res.data.irq.number_of_interrupts = 1; - resource.res.data.irq.interrupts[0] = irq; + resource->res.data.irq.shared_exclusive = ACPI_SHARED; + resource->res.data.irq.number_of_interrupts = 1; + resource->res.data.irq.interrupts[0] = irq; break; case ACPI_RSTYPE_EXT_IRQ: - resource.res.id = ACPI_RSTYPE_EXT_IRQ; - resource.res.length = sizeof(struct acpi_resource); - resource.res.data.extended_irq.producer_consumer = ACPI_CONSUMER; - resource.res.data.extended_irq.edge_level = link->irq.edge_level; - resource.res.data.extended_irq.active_high_low = link->irq.active_high_low; + resource->res.id = ACPI_RSTYPE_EXT_IRQ; + resource->res.length = sizeof(struct acpi_resource); + resource->res.data.extended_irq.producer_consumer = ACPI_CONSUMER; + resource->res.data.extended_irq.edge_level = link->irq.edge_level; + resource->res.data.extended_irq.active_high_low = link->irq.active_high_low; if (link->irq.edge_level == ACPI_EDGE_SENSITIVE) - resource.res.data.irq.shared_exclusive = ACPI_EXCLUSIVE; + resource->res.data.irq.shared_exclusive = ACPI_EXCLUSIVE; else - resource.res.data.irq.shared_exclusive = ACPI_SHARED; - resource.res.data.extended_irq.number_of_interrupts = 1; - resource.res.data.extended_irq.interrupts[0] = irq; + resource->res.data.irq.shared_exclusive = ACPI_SHARED; + resource->res.data.extended_irq.number_of_interrupts = 1; + resource->res.data.extended_irq.interrupts[0] = irq; /* ignore resource_source, it's optional */ break; default: printk("ACPI BUG: resource_type %d\n", link->irq.resource_type); - return_VALUE(-EINVAL); + result = -EINVAL; + goto end; } - resource.end.id = ACPI_RSTYPE_END_TAG; + resource->end.id = ACPI_RSTYPE_END_TAG; /* Attempt to set the resource */ status = acpi_set_current_resources(link->handle, &buffer); @@ -358,14 +365,15 @@ /* check for total failure */ if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _SRS\n")); - return_VALUE(-ENODEV); + result = -ENODEV; + goto end; } /* Query _STA, set device->status */ result = acpi_bus_get_status(link->device); if (result) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to read status\n")); - return_VALUE(result); + goto end; } if (!link->device->status.enabled) { printk(KERN_WARNING PREFIX @@ -377,7 +385,7 @@ /* Query _CRS, set link->irq.active */ result = acpi_pci_link_get_current(link); if (result) { - return_VALUE(result); + goto end; } /* @@ -399,7 +407,9 @@ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Set IRQ %d\n", link->irq.active)); - return_VALUE(0); +end: + kfree(resource); + return_VALUE(result); } @@ -810,7 +820,7 @@ */ static int __init acpi_irq_isa(char *str) { - return(acpi_irq_penalty_update(str, 1)); + return acpi_irq_penalty_update(str, 1); } __setup("acpi_irq_isa=", acpi_irq_isa); @@ -821,7 +831,7 @@ */ static int __init acpi_irq_pci(char *str) { - return(acpi_irq_penalty_update(str, 0)); + return acpi_irq_penalty_update(str, 0); } __setup("acpi_irq_pci=", acpi_irq_pci); diff -Nru a/drivers/acpi/processor.c b/drivers/acpi/processor.c --- a/drivers/acpi/processor.c 2005-01-02 23:03:34 -08:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,2644 +0,0 @@ -/* - * acpi_processor.c - ACPI Processor Driver ($Revision: 71 $) - * - * Copyright (C) 2001, 2002 Andy Grover - * Copyright (C) 2001, 2002 Paul Diefenbaugh - * Copyright (C) 2004 Dominik Brodowski - * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * TBD: - * 1. Make # power states dynamic. - * 2. Support duty_cycle values that span bit 4. - * 3. Optimize by having scheduler determine business instead of - * having us try to calculate it here. - * 4. Need C1 timing -- must modify kernel (IRQ handler) to get this. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - - -#define ACPI_PROCESSOR_COMPONENT 0x01000000 -#define ACPI_PROCESSOR_CLASS "processor" -#define ACPI_PROCESSOR_DRIVER_NAME "ACPI Processor Driver" -#define ACPI_PROCESSOR_DEVICE_NAME "Processor" -#define ACPI_PROCESSOR_FILE_INFO "info" -#define ACPI_PROCESSOR_FILE_POWER "power" -#define ACPI_PROCESSOR_FILE_THROTTLING "throttling" -#define ACPI_PROCESSOR_FILE_LIMIT "limit" -#define ACPI_PROCESSOR_FILE_PERFORMANCE "performance" -#define ACPI_PROCESSOR_NOTIFY_PERFORMANCE 0x80 -#define ACPI_PROCESSOR_NOTIFY_POWER 0x81 - -#define US_TO_PM_TIMER_TICKS(t) ((t * (PM_TIMER_FREQUENCY/1000)) / 1000) -#define C2_OVERHEAD 4 /* 1us (3.579 ticks per us) */ -#define C3_OVERHEAD 4 /* 1us (3.579 ticks per us) */ - - -#define ACPI_PROCESSOR_LIMIT_USER 0 -#define ACPI_PROCESSOR_LIMIT_THERMAL 1 - -#define _COMPONENT ACPI_PROCESSOR_COMPONENT -ACPI_MODULE_NAME ("acpi_processor") - -MODULE_AUTHOR("Paul Diefenbaugh"); -MODULE_DESCRIPTION(ACPI_PROCESSOR_DRIVER_NAME); -MODULE_LICENSE("GPL"); - - -static int acpi_processor_add (struct acpi_device *device); -static int acpi_processor_remove (struct acpi_device *device, int type); -static int acpi_processor_info_open_fs(struct inode *inode, struct file *file); -static int acpi_processor_throttling_open_fs(struct inode *inode, struct file *file); -static int acpi_processor_power_open_fs(struct inode *inode, struct file *file); -static int acpi_processor_limit_open_fs(struct inode *inode, struct file *file); -static int acpi_processor_get_limit_info(struct acpi_processor *pr); - -static struct acpi_driver acpi_processor_driver = { - .name = ACPI_PROCESSOR_DRIVER_NAME, - .class = ACPI_PROCESSOR_CLASS, - .ids = ACPI_PROCESSOR_HID, - .ops = { - .add = acpi_processor_add, - .remove = acpi_processor_remove, - }, -}; - - -struct acpi_processor_errata { - u8 smp; - struct { - u8 throttle:1; - u8 fdma:1; - u8 reserved:6; - u32 bmisx; - } piix4; -}; - -static struct file_operations acpi_processor_info_fops = { - .open = acpi_processor_info_open_fs, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; - -static struct file_operations acpi_processor_power_fops = { - .open = acpi_processor_power_open_fs, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; - -static struct file_operations acpi_processor_throttling_fops = { - .open = acpi_processor_throttling_open_fs, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; - -static struct file_operations acpi_processor_limit_fops = { - .open = acpi_processor_limit_open_fs, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; - -static struct acpi_processor *processors[NR_CPUS]; -static struct acpi_processor_errata errata; -static void (*pm_idle_save)(void); - - -/* -------------------------------------------------------------------------- - Errata Handling - -------------------------------------------------------------------------- */ - -int -acpi_processor_errata_piix4 ( - struct pci_dev *dev) -{ - u8 rev = 0; - u8 value1 = 0; - u8 value2 = 0; - - ACPI_FUNCTION_TRACE("acpi_processor_errata_piix4"); - - if (!dev) - return_VALUE(-EINVAL); - - /* - * Note that 'dev' references the PIIX4 ACPI Controller. - */ - - pci_read_config_byte(dev, PCI_REVISION_ID, &rev); - - switch (rev) { - case 0: - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found PIIX4 A-step\n")); - break; - case 1: - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found PIIX4 B-step\n")); - break; - case 2: - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found PIIX4E\n")); - break; - case 3: - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found PIIX4M\n")); - break; - default: - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found unknown PIIX4\n")); - break; - } - - switch (rev) { - - case 0: /* PIIX4 A-step */ - case 1: /* PIIX4 B-step */ - /* - * See specification changes #13 ("Manual Throttle Duty Cycle") - * and #14 ("Enabling and Disabling Manual Throttle"), plus - * erratum #5 ("STPCLK# Deassertion Time") from the January - * 2002 PIIX4 specification update. Applies to only older - * PIIX4 models. - */ - errata.piix4.throttle = 1; - - case 2: /* PIIX4E */ - case 3: /* PIIX4M */ - /* - * See erratum #18 ("C3 Power State/BMIDE and Type-F DMA - * Livelock") from the January 2002 PIIX4 specification update. - * Applies to all PIIX4 models. - */ - - /* - * BM-IDE - * ------ - * Find the PIIX4 IDE Controller and get the Bus Master IDE - * Status register address. We'll use this later to read - * each IDE controller's DMA status to make sure we catch all - * DMA activity. - */ - dev = pci_get_subsys(PCI_VENDOR_ID_INTEL, - PCI_DEVICE_ID_INTEL_82371AB, - PCI_ANY_ID, PCI_ANY_ID, NULL); - if (dev) { - errata.piix4.bmisx = pci_resource_start(dev, 4); - pci_dev_put(dev); - } - - /* - * Type-F DMA - * ---------- - * Find the PIIX4 ISA Controller and read the Motherboard - * DMA controller's status to see if Type-F (Fast) DMA mode - * is enabled (bit 7) on either channel. Note that we'll - * disable C3 support if this is enabled, as some legacy - * devices won't operate well if fast DMA is disabled. - */ - dev = pci_get_subsys(PCI_VENDOR_ID_INTEL, - PCI_DEVICE_ID_INTEL_82371AB_0, - PCI_ANY_ID, PCI_ANY_ID, NULL); - if (dev) { - pci_read_config_byte(dev, 0x76, &value1); - pci_read_config_byte(dev, 0x77, &value2); - if ((value1 & 0x80) || (value2 & 0x80)) - errata.piix4.fdma = 1; - pci_dev_put(dev); - } - - break; - } - - if (errata.piix4.bmisx) - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Bus master activity detection (BM-IDE) erratum enabled\n")); - if (errata.piix4.fdma) - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Type-F DMA livelock erratum (C3 disabled)\n")); - - return_VALUE(0); -} - - -int -acpi_processor_errata ( - struct acpi_processor *pr) -{ - int result = 0; - struct pci_dev *dev = NULL; - - ACPI_FUNCTION_TRACE("acpi_processor_errata"); - - if (!pr) - return_VALUE(-EINVAL); - - /* - * PIIX4 - */ - dev = pci_get_subsys(PCI_VENDOR_ID_INTEL, - PCI_DEVICE_ID_INTEL_82371AB_3, PCI_ANY_ID, PCI_ANY_ID, NULL); - if (dev) { - result = acpi_processor_errata_piix4(dev); - pci_dev_put(dev); - } - - return_VALUE(result); -} - - -/* -------------------------------------------------------------------------- - Power Management - -------------------------------------------------------------------------- */ - -static inline u32 -ticks_elapsed ( - u32 t1, - u32 t2) -{ - if (t2 >= t1) - return (t2 - t1); - else if (!acpi_fadt.tmr_val_ext) - return (((0x00FFFFFF - t1) + t2) & 0x00FFFFFF); - else - return ((0xFFFFFFFF - t1) + t2); -} - - -static void -acpi_processor_power_activate ( - struct acpi_processor *pr, - int state) -{ - if (!pr) - return; - - pr->power.states[pr->power.state].promotion.count = 0; - pr->power.states[pr->power.state].demotion.count = 0; - - /* Cleanup from old state. */ - switch (pr->power.state) { - case ACPI_STATE_C3: - /* Disable bus master reload */ - acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 0, ACPI_MTX_DO_NOT_LOCK); - break; - } - - /* Prepare to use new state. */ - switch (state) { - case ACPI_STATE_C3: - /* Enable bus master reload */ - acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 1, ACPI_MTX_DO_NOT_LOCK); - break; - } - - pr->power.state = state; - - return; -} - - -static void -acpi_processor_idle (void) -{ - struct acpi_processor *pr = NULL; - struct acpi_processor_cx *cx = NULL; - unsigned int next_state = 0; - unsigned int sleep_ticks = 0; - u32 t1, t2 = 0; - - pr = processors[smp_processor_id()]; - if (!pr) - return; - - /* - * Interrupts must be disabled during bus mastering calculations and - * for C2/C3 transitions. - */ - local_irq_disable(); - - /* - * Check whether we truly need to go idle, or should - * reschedule: - */ - if (unlikely(need_resched())) { - local_irq_enable(); - return; - } - - cx = &(pr->power.states[pr->power.state]); - - /* - * Check BM Activity - * ----------------- - * Check for bus mastering activity (if required), record, and check - * for demotion. - */ - if (pr->flags.bm_check) { - u32 bm_status = 0; - - pr->power.bm_activity <<= 1; - - acpi_get_register(ACPI_BITREG_BUS_MASTER_STATUS, - &bm_status, ACPI_MTX_DO_NOT_LOCK); - if (bm_status) { - pr->power.bm_activity++; - acpi_set_register(ACPI_BITREG_BUS_MASTER_STATUS, - 1, ACPI_MTX_DO_NOT_LOCK); - } - /* - * PIIX4 Erratum #18: Note that BM_STS doesn't always reflect - * the true state of bus mastering activity; forcing us to - * manually check the BMIDEA bit of each IDE channel. - */ - else if (errata.piix4.bmisx) { - if ((inb_p(errata.piix4.bmisx + 0x02) & 0x01) - || (inb_p(errata.piix4.bmisx + 0x0A) & 0x01)) - pr->power.bm_activity++; - } - /* - * Apply bus mastering demotion policy. Automatically demote - * to avoid a faulty transition. Note that the processor - * won't enter a low-power state during this call (to this - * funciton) but should upon the next. - * - * TBD: A better policy might be to fallback to the demotion - * state (use it for this quantum only) istead of - * demoting -- and rely on duration as our sole demotion - * qualification. This may, however, introduce DMA - * issues (e.g. floppy DMA transfer overrun/underrun). - */ - if (pr->power.bm_activity & cx->demotion.threshold.bm) { - local_irq_enable(); - next_state = cx->demotion.state; - goto end; - } - } - - cx->usage++; - - /* - * Sleep: - * ------ - * Invoke the current Cx state to put the processor to sleep. - */ - switch (pr->power.state) { - - case ACPI_STATE_C1: - /* - * Invoke C1. - * Use the appropriate idle routine, the one that would - * be used without acpi C-states. - */ - if (pm_idle_save) - pm_idle_save(); - else - safe_halt(); - /* - * TBD: Can't get time duration while in C1, as resumes - * go to an ISR rather than here. Need to instrument - * base interrupt handler. - */ - sleep_ticks = 0xFFFFFFFF; - break; - - case ACPI_STATE_C2: - /* Get start time (ticks) */ - t1 = inl(acpi_fadt.xpm_tmr_blk.address); - /* Invoke C2 */ - inb(pr->power.states[ACPI_STATE_C2].address); - /* Dummy op - must do something useless after P_LVL2 read */ - t2 = inl(acpi_fadt.xpm_tmr_blk.address); - /* Get end time (ticks) */ - t2 = inl(acpi_fadt.xpm_tmr_blk.address); - /* Re-enable interrupts */ - local_irq_enable(); - /* Compute time (ticks) that we were actually asleep */ - sleep_ticks = ticks_elapsed(t1, t2) - cx->latency_ticks - C2_OVERHEAD; - break; - - case ACPI_STATE_C3: - /* Disable bus master arbitration */ - acpi_set_register(ACPI_BITREG_ARB_DISABLE, 1, ACPI_MTX_DO_NOT_LOCK); - /* Get start time (ticks) */ - t1 = inl(acpi_fadt.xpm_tmr_blk.address); - /* Invoke C3 */ - inb(pr->power.states[ACPI_STATE_C3].address); - /* Dummy op - must do something useless after P_LVL3 read */ - t2 = inl(acpi_fadt.xpm_tmr_blk.address); - /* Get end time (ticks) */ - t2 = inl(acpi_fadt.xpm_tmr_blk.address); - /* Enable bus master arbitration */ - acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0, ACPI_MTX_DO_NOT_LOCK); - /* Re-enable interrupts */ - local_irq_enable(); - /* Compute time (ticks) that we were actually asleep */ - sleep_ticks = ticks_elapsed(t1, t2) - cx->latency_ticks - C3_OVERHEAD; - break; - - default: - local_irq_enable(); - return; - } - - next_state = pr->power.state; - - /* - * Promotion? - * ---------- - * Track the number of longs (time asleep is greater than threshold) - * and promote when the count threshold is reached. Note that bus - * mastering activity may prevent promotions. - * Do not promote above max_cstate. - */ - if (cx->promotion.state && (cx->promotion.state <= max_cstate)) { - if (sleep_ticks > cx->promotion.threshold.ticks) { - cx->promotion.count++; - cx->demotion.count = 0; - if (cx->promotion.count >= cx->promotion.threshold.count) { - if (pr->flags.bm_check) { - if (!(pr->power.bm_activity & cx->promotion.threshold.bm)) { - next_state = cx->promotion.state; - goto end; - } - } - else { - next_state = cx->promotion.state; - goto end; - } - } - } - } - - /* - * Demotion? - * --------- - * Track the number of shorts (time asleep is less than time threshold) - * and demote when the usage threshold is reached. - */ - if (cx->demotion.state) { - if (sleep_ticks < cx->demotion.threshold.ticks) { - cx->demotion.count++; - cx->promotion.count = 0; - if (cx->demotion.count >= cx->demotion.threshold.count) { - next_state = cx->demotion.state; - goto end; - } - } - } - -end: - /* - * Demote if current state exceeds max_cstate - */ - if (pr->power.state > max_cstate) { - next_state = max_cstate; - } - - /* - * New Cx State? - * ------------- - * If we're going to start using a new Cx state we must clean up - * from the previous and prepare to use the new. - */ - if (next_state != pr->power.state) - acpi_processor_power_activate(pr, next_state); - - return; -} - - -static int -acpi_processor_set_power_policy ( - struct acpi_processor *pr) -{ - ACPI_FUNCTION_TRACE("acpi_processor_set_power_policy"); - - /* - * This function sets the default Cx state policy (OS idle handler). - * Our scheme is to promote quickly to C2 but more conservatively - * to C3. We're favoring C2 for its characteristics of low latency - * (quick response), good power savings, and ability to allow bus - * mastering activity. Note that the Cx state policy is completely - * customizable and can be altered dynamically. - */ - - if (!pr) - return_VALUE(-EINVAL); - - /* - * C0/C1 - * ----- - */ - pr->power.state = ACPI_STATE_C1; - pr->power.default_state = ACPI_STATE_C1; - - /* - * C1/C2 - * ----- - * Set the default C1 promotion and C2 demotion policies, where we - * promote from C1 to C2 after several (10) successive C1 transitions, - * as we cannot (currently) measure the time spent in C1. Demote from - * C2 to C1 anytime we experience a 'short' (time spent in C2 is less - * than the C2 transtion latency). Note the simplifying assumption - * that the 'cost' of a transition is amortized when we sleep for at - * least as long as the transition's latency (thus the total transition - * time is two times the latency). - * - * TBD: Measure C1 sleep times by instrumenting the core IRQ handler. - * TBD: Demote to default C-State after long periods of activity. - * TBD: Investigate policy's use of CPU utilization -vs- sleep duration. - */ - if (pr->power.states[ACPI_STATE_C2].valid) { - pr->power.states[ACPI_STATE_C1].promotion.threshold.count = 10; - pr->power.states[ACPI_STATE_C1].promotion.threshold.ticks = - pr->power.states[ACPI_STATE_C2].latency_ticks; - pr->power.states[ACPI_STATE_C1].promotion.state = ACPI_STATE_C2; - - pr->power.states[ACPI_STATE_C2].demotion.threshold.count = 1; - pr->power.states[ACPI_STATE_C2].demotion.threshold.ticks = - pr->power.states[ACPI_STATE_C2].latency_ticks; - pr->power.states[ACPI_STATE_C2].demotion.state = ACPI_STATE_C1; - } - - /* - * C2/C3 - * ----- - * Set default C2 promotion and C3 demotion policies, where we promote - * from C2 to C3 after several (4) cycles of no bus mastering activity - * while maintaining sleep time criteria. Demote immediately on a - * short or whenever bus mastering activity occurs. - */ - if ((pr->power.states[ACPI_STATE_C2].valid) && - (pr->power.states[ACPI_STATE_C3].valid)) { - pr->power.states[ACPI_STATE_C2].promotion.threshold.count = 4; - pr->power.states[ACPI_STATE_C2].promotion.threshold.ticks = - pr->power.states[ACPI_STATE_C3].latency_ticks; - pr->power.states[ACPI_STATE_C2].promotion.threshold.bm = 0x0F; - pr->power.states[ACPI_STATE_C2].promotion.state = ACPI_STATE_C3; - - pr->power.states[ACPI_STATE_C3].demotion.threshold.count = 1; - pr->power.states[ACPI_STATE_C3].demotion.threshold.ticks = - pr->power.states[ACPI_STATE_C3].latency_ticks; - pr->power.states[ACPI_STATE_C3].demotion.threshold.bm = 0x0F; - pr->power.states[ACPI_STATE_C3].demotion.state = ACPI_STATE_C2; - } - - return_VALUE(0); -} - - -int -acpi_processor_get_power_info ( - struct acpi_processor *pr) -{ - int result = 0; - - ACPI_FUNCTION_TRACE("acpi_processor_get_power_info"); - - if (!pr) - return_VALUE(-EINVAL); - - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "lvl2[0x%08x] lvl3[0x%08x]\n", - pr->power.states[ACPI_STATE_C2].address, - pr->power.states[ACPI_STATE_C3].address)); - - /* TBD: Support ACPI 2.0 objects */ - - /* - * C0 - * -- - * This state exists only as filler in our array. - */ - pr->power.states[ACPI_STATE_C0].valid = 1; - - /* - * C1 - * -- - * ACPI requires C1 support for all processors. - * - * TBD: What about PROC_C1? - */ - pr->power.states[ACPI_STATE_C1].valid = 1; - - /* - * C2 - * -- - * We're (currently) only supporting C2 on UP systems. - * - * TBD: Support for C2 on MP (P_LVL2_UP). - */ - if (pr->power.states[ACPI_STATE_C2].address) { - - pr->power.states[ACPI_STATE_C2].latency = acpi_fadt.plvl2_lat; - - /* - * C2 latency must be less than or equal to 100 microseconds. - */ - if (acpi_fadt.plvl2_lat > ACPI_PROCESSOR_MAX_C2_LATENCY) - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "C2 latency too large [%d]\n", - acpi_fadt.plvl2_lat)); - /* - * Only support C2 on UP systems (see TBD above). - */ - else if (errata.smp) - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "C2 not supported in SMP mode\n")); - /* - * Otherwise we've met all of our C2 requirements. - * Normalize the C2 latency to expidite policy. - */ - else { - pr->power.states[ACPI_STATE_C2].valid = 1; - pr->power.states[ACPI_STATE_C2].latency_ticks = - US_TO_PM_TIMER_TICKS(acpi_fadt.plvl2_lat); - } - } - - /* - * C3 - * -- - * TBD: Investigate use of WBINVD on UP/SMP system in absence of - * bm_control. - */ - if (pr->power.states[ACPI_STATE_C3].address) { - - pr->power.states[ACPI_STATE_C3].latency = acpi_fadt.plvl3_lat; - - /* - * C3 latency must be less than or equal to 1000 microseconds. - */ - if (acpi_fadt.plvl3_lat > ACPI_PROCESSOR_MAX_C3_LATENCY) - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "C3 latency too large [%d]\n", - acpi_fadt.plvl3_lat)); - /* - * Only support C3 when bus mastering arbitration control - * is present (able to disable bus mastering to maintain - * cache coherency while in C3). - */ - else if (!pr->flags.bm_control) - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "C3 support requires bus mastering control\n")); - /* - * Only support C3 on UP systems, as bm_control is only viable - * on a UP system and flushing caches (e.g. WBINVD) is simply - * too costly (at this time). - */ - else if (errata.smp) - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "C3 not supported in SMP mode\n")); - /* - * PIIX4 Erratum #18: We don't support C3 when Type-F (fast) - * DMA transfers are used by any ISA device to avoid livelock. - * Note that we could disable Type-F DMA (as recommended by - * the erratum), but this is known to disrupt certain ISA - * devices thus we take the conservative approach. - */ - else if (errata.piix4.fdma) { - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "C3 not supported on PIIX4 with Type-F DMA\n")); - } - /* - * Otherwise we've met all of our C3 requirements. - * Normalize the C2 latency to expidite policy. Enable - * checking of bus mastering status (bm_check) so we can - * use this in our C3 policy. - */ - else { - pr->power.states[ACPI_STATE_C3].valid = 1; - pr->power.states[ACPI_STATE_C3].latency_ticks = - US_TO_PM_TIMER_TICKS(acpi_fadt.plvl3_lat); - pr->flags.bm_check = 1; - } - } - - /* - * Set Default Policy - * ------------------ - * Now that we know which state are supported, set the default - * policy. Note that this policy can be changed dynamically - * (e.g. encourage deeper sleeps to conserve battery life when - * not on AC). - */ - result = acpi_processor_set_power_policy(pr); - if (result) - return_VALUE(result); - - /* - * If this processor supports C2 or C3 we denote it as being 'power - * manageable'. Note that there's really no policy involved for - * when only C1 is supported. - */ - if (pr->power.states[ACPI_STATE_C2].valid - || pr->power.states[ACPI_STATE_C3].valid) - pr->flags.power = 1; - - return_VALUE(0); -} - - -/* -------------------------------------------------------------------------- - Performance Management - -------------------------------------------------------------------------- */ -#ifdef CONFIG_CPU_FREQ - -static DECLARE_MUTEX(performance_sem); - -/* - * _PPC support is implemented as a CPUfreq policy notifier: - * This means each time a CPUfreq driver registered also with - * the ACPI core is asked to change the speed policy, the maximum - * value is adjusted so that it is within the platform limit. - * - * Also, when a new platform limit value is detected, the CPUfreq - * policy is adjusted accordingly. - */ - -#define PPC_REGISTERED 1 -#define PPC_IN_USE 2 - -static int acpi_processor_ppc_status = 0; - -static int acpi_processor_ppc_notifier(struct notifier_block *nb, - unsigned long event, - void *data) -{ - struct cpufreq_policy *policy = data; - struct acpi_processor *pr; - unsigned int ppc = 0; - - down(&performance_sem); - - if (event != CPUFREQ_INCOMPATIBLE) - goto out; - - pr = processors[policy->cpu]; - if (!pr || !pr->performance) - goto out; - - ppc = (unsigned int) pr->performance_platform_limit; - if (!ppc) - goto out; - - if (ppc > pr->performance->state_count) - goto out; - - cpufreq_verify_within_limits(policy, 0, - pr->performance->states[ppc].core_frequency * 1000); - - out: - up(&performance_sem); - - return 0; -} - - -static struct notifier_block acpi_ppc_notifier_block = { - .notifier_call = acpi_processor_ppc_notifier, -}; - - -static int -acpi_processor_get_platform_limit ( - struct acpi_processor* pr) -{ - acpi_status status = 0; - unsigned long ppc = 0; - - ACPI_FUNCTION_TRACE("acpi_processor_get_platform_limit"); - - if (!pr) - return_VALUE(-EINVAL); - - /* - * _PPC indicates the maximum state currently supported by the platform - * (e.g. 0 = states 0..n; 1 = states 1..n; etc. - */ - status = acpi_evaluate_integer(pr->handle, "_PPC", NULL, &ppc); - - if (status != AE_NOT_FOUND) - acpi_processor_ppc_status |= PPC_IN_USE; - - if(ACPI_FAILURE(status) && status != AE_NOT_FOUND) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PPC\n")); - return_VALUE(-ENODEV); - } - - pr->performance_platform_limit = (int) ppc; - - return_VALUE(0); -} - - -static int acpi_processor_ppc_has_changed( - struct acpi_processor *pr) -{ - int ret = acpi_processor_get_platform_limit(pr); - if (ret < 0) - return (ret); - else - return cpufreq_update_policy(pr->id); -} - - -static void acpi_processor_ppc_init(void) { - if (!cpufreq_register_notifier(&acpi_ppc_notifier_block, CPUFREQ_POLICY_NOTIFIER)) - acpi_processor_ppc_status |= PPC_REGISTERED; - else - printk(KERN_DEBUG "Warning: Processor Platform Limit not supported.\n"); -} - - -static void acpi_processor_ppc_exit(void) { - if (acpi_processor_ppc_status & PPC_REGISTERED) - cpufreq_unregister_notifier(&acpi_ppc_notifier_block, CPUFREQ_POLICY_NOTIFIER); - - acpi_processor_ppc_status &= ~PPC_REGISTERED; -} - -/* - * when registering a cpufreq driver with this ACPI processor driver, the - * _PCT and _PSS structures are read out and written into struct - * acpi_processor_performance. - */ -static int acpi_processor_set_pdc (struct acpi_processor *pr) -{ - acpi_status status = AE_OK; - u32 arg0_buf[3]; - union acpi_object arg0 = {ACPI_TYPE_BUFFER}; - struct acpi_object_list no_object = {1, &arg0}; - struct acpi_object_list *pdc; - - ACPI_FUNCTION_TRACE("acpi_processor_set_pdc"); - - arg0.buffer.length = 12; - arg0.buffer.pointer = (u8 *) arg0_buf; - arg0_buf[0] = ACPI_PDC_REVISION_ID; - arg0_buf[1] = 0; - arg0_buf[2] = 0; - - pdc = (pr->performance->pdc) ? pr->performance->pdc : &no_object; - - status = acpi_evaluate_object(pr->handle, "_PDC", pdc, NULL); - - if ((ACPI_FAILURE(status)) && (pr->performance->pdc)) - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Error evaluating _PDC, using legacy perf. control...\n")); - - return_VALUE(status); -} - - -static int -acpi_processor_get_performance_control ( - struct acpi_processor *pr) -{ - int result = 0; - acpi_status status = 0; - struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; - union acpi_object *pct = NULL; - union acpi_object obj = {0}; - - ACPI_FUNCTION_TRACE("acpi_processor_get_performance_control"); - - status = acpi_evaluate_object(pr->handle, "_PCT", NULL, &buffer); - if(ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PCT\n")); - return_VALUE(-ENODEV); - } - - pct = (union acpi_object *) buffer.pointer; - if (!pct || (pct->type != ACPI_TYPE_PACKAGE) - || (pct->package.count != 2)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _PCT data\n")); - result = -EFAULT; - goto end; - } - - /* - * control_register - */ - - obj = pct->package.elements[0]; - - if ((obj.type != ACPI_TYPE_BUFFER) - || (obj.buffer.length < sizeof(struct acpi_pct_register)) - || (obj.buffer.pointer == NULL)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid _PCT data (control_register)\n")); - result = -EFAULT; - goto end; - } - memcpy(&pr->performance->control_register, obj.buffer.pointer, sizeof(struct acpi_pct_register)); - - - /* - * status_register - */ - - obj = pct->package.elements[1]; - - if ((obj.type != ACPI_TYPE_BUFFER) - || (obj.buffer.length < sizeof(struct acpi_pct_register)) - || (obj.buffer.pointer == NULL)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid _PCT data (status_register)\n")); - result = -EFAULT; - goto end; - } - - memcpy(&pr->performance->status_register, obj.buffer.pointer, sizeof(struct acpi_pct_register)); - -end: - acpi_os_free(buffer.pointer); - - return_VALUE(result); -} - - -static int -acpi_processor_get_performance_states ( - struct acpi_processor *pr) -{ - int result = 0; - acpi_status status = AE_OK; - struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; - struct acpi_buffer format = {sizeof("NNNNNN"), "NNNNNN"}; - struct acpi_buffer state = {0, NULL}; - union acpi_object *pss = NULL; - unsigned int i; - - ACPI_FUNCTION_TRACE("acpi_processor_get_performance_states"); - - status = acpi_evaluate_object(pr->handle, "_PSS", NULL, &buffer); - if(ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PSS\n")); - return_VALUE(-ENODEV); - } - - pss = (union acpi_object *) buffer.pointer; - if (!pss || (pss->type != ACPI_TYPE_PACKAGE)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _PSS data\n")); - result = -EFAULT; - goto end; - } - - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d performance states\n", - pss->package.count)); - - pr->performance->state_count = pss->package.count; - pr->performance->states = kmalloc(sizeof(struct acpi_processor_px) * pss->package.count, GFP_KERNEL); - if (!pr->performance->states) { - result = -ENOMEM; - goto end; - } - - for (i = 0; i < pr->performance->state_count; i++) { - - struct acpi_processor_px *px = &(pr->performance->states[i]); - - state.length = sizeof(struct acpi_processor_px); - state.pointer = px; - - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Extracting state %d\n", i)); - - status = acpi_extract_package(&(pss->package.elements[i]), - &format, &state); - if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _PSS data\n")); - result = -EFAULT; - kfree(pr->performance->states); - goto end; - } - - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "State [%d]: core_frequency[%d] power[%d] transition_latency[%d] bus_master_latency[%d] control[0x%x] status[0x%x]\n", - i, - (u32) px->core_frequency, - (u32) px->power, - (u32) px->transition_latency, - (u32) px->bus_master_latency, - (u32) px->control, - (u32) px->status)); - - if (!px->core_frequency) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _PSS data: freq is zero\n")); - result = -EFAULT; - kfree(pr->performance->states); - goto end; - } - } - -end: - acpi_os_free(buffer.pointer); - - return_VALUE(result); -} - - -static int -acpi_processor_get_performance_info ( - struct acpi_processor *pr) -{ - int result = 0; - acpi_status status = AE_OK; - acpi_handle handle = NULL; - - ACPI_FUNCTION_TRACE("acpi_processor_get_performance_info"); - - if (!pr || !pr->performance || !pr->handle) - return_VALUE(-EINVAL); - - acpi_processor_set_pdc(pr); - - status = acpi_get_handle(pr->handle, "_PCT", &handle); - if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "ACPI-based processor performance control unavailable\n")); - return_VALUE(-ENODEV); - } - - result = acpi_processor_get_performance_control(pr); - if (result) - return_VALUE(result); - - result = acpi_processor_get_performance_states(pr); - if (result) - return_VALUE(result); - - result = acpi_processor_get_platform_limit(pr); - if (result) - return_VALUE(result); - - return_VALUE(0); -} - - -int acpi_processor_notify_smm(struct module *calling_module) { - acpi_status status; - static int is_done = 0; - - ACPI_FUNCTION_TRACE("acpi_processor_notify_smm"); - - if (!(acpi_processor_ppc_status & PPC_REGISTERED)) - return_VALUE(-EBUSY); - - if (!try_module_get(calling_module)) - return_VALUE(-EINVAL); - - /* is_done is set to negative if an error occured, - * and to postitive if _no_ error occured, but SMM - * was already notified. This avoids double notification - * which might lead to unexpected results... - */ - if (is_done > 0) { - module_put(calling_module); - return_VALUE(0); - } - else if (is_done < 0) { - module_put(calling_module); - return_VALUE(is_done); - } - - is_done = -EIO; - - /* Can't write pstate_cnt to smi_cmd if either value is zero */ - if ((!acpi_fadt.smi_cmd) || - (!acpi_fadt.pstate_cnt)) { - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "No SMI port or pstate_cnt\n")); - module_put(calling_module); - return_VALUE(0); - } - - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Writing pstate_cnt [0x%x] to smi_cmd [0x%x]\n", acpi_fadt.pstate_cnt, acpi_fadt.smi_cmd)); - - /* FADT v1 doesn't support pstate_cnt, many BIOS vendors use - * it anyway, so we need to support it... */ - if (acpi_fadt_is_v1) { - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Using v1.0 FADT reserved value for pstate_cnt\n")); - } - - status = acpi_os_write_port (acpi_fadt.smi_cmd, - (u32) acpi_fadt.pstate_cnt, 8); - if (ACPI_FAILURE (status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Failed to write pstate_cnt [0x%x] to " - "smi_cmd [0x%x]\n", acpi_fadt.pstate_cnt, acpi_fadt.smi_cmd)); - module_put(calling_module); - return_VALUE(status); - } - - /* Success. If there's no _PPC, we need to fear nothing, so - * we can allow the cpufreq driver to be rmmod'ed. */ - is_done = 1; - - if (!(acpi_processor_ppc_status & PPC_IN_USE)) - module_put(calling_module); - - return_VALUE(0); -} -EXPORT_SYMBOL(acpi_processor_notify_smm); - - -#ifdef CONFIG_X86_ACPI_CPUFREQ_PROC_INTF -/* /proc/acpi/processor/../performance interface (DEPRECATED) */ - -static int acpi_processor_perf_open_fs(struct inode *inode, struct file *file); -static struct file_operations acpi_processor_perf_fops = { - .open = acpi_processor_perf_open_fs, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; - -static int acpi_processor_perf_seq_show(struct seq_file *seq, void *offset) -{ - struct acpi_processor *pr = (struct acpi_processor *)seq->private; - unsigned int i; - - ACPI_FUNCTION_TRACE("acpi_processor_perf_seq_show"); - - if (!pr) - goto end; - - if (!pr->performance) { - seq_puts(seq, "\n"); - goto end; - } - - seq_printf(seq, "state count: %d\n" - "active state: P%d\n", - pr->performance->state_count, - pr->performance->state); - - seq_puts(seq, "states:\n"); - for (i = 0; i < pr->performance->state_count; i++) - seq_printf(seq, " %cP%d: %d MHz, %d mW, %d uS\n", - (i == pr->performance->state?'*':' '), i, - (u32) pr->performance->states[i].core_frequency, - (u32) pr->performance->states[i].power, - (u32) pr->performance->states[i].transition_latency); - -end: - return_VALUE(0); -} - -static int acpi_processor_perf_open_fs(struct inode *inode, struct file *file) -{ - return single_open(file, acpi_processor_perf_seq_show, - PDE(inode)->data); -} - -static ssize_t -acpi_processor_write_performance ( - struct file *file, - const char __user *buffer, - size_t count, - loff_t *data) -{ - int result = 0; - struct seq_file *m = (struct seq_file *) file->private_data; - struct acpi_processor *pr = (struct acpi_processor *) m->private; - struct acpi_processor_performance *perf; - char state_string[12] = {'\0'}; - unsigned int new_state = 0; - struct cpufreq_policy policy; - - ACPI_FUNCTION_TRACE("acpi_processor_write_performance"); - - if (!pr || (count > sizeof(state_string) - 1)) - return_VALUE(-EINVAL); - - perf = pr->performance; - if (!perf) - return_VALUE(-EINVAL); - - if (copy_from_user(state_string, buffer, count)) - return_VALUE(-EFAULT); - - state_string[count] = '\0'; - new_state = simple_strtoul(state_string, NULL, 0); - - if (new_state >= perf->state_count) - return_VALUE(-EINVAL); - - cpufreq_get_policy(&policy, pr->id); - - policy.cpu = pr->id; - policy.min = perf->states[new_state].core_frequency * 1000; - policy.max = perf->states[new_state].core_frequency * 1000; - - result = cpufreq_set_policy(&policy); - if (result) - return_VALUE(result); - - return_VALUE(count); -} - -static void -acpi_cpufreq_add_file ( - struct acpi_processor *pr) -{ - struct proc_dir_entry *entry = NULL; - struct acpi_device *device = NULL; - - ACPI_FUNCTION_TRACE("acpi_cpufreq_addfile"); - - if (acpi_bus_get_device(pr->handle, &device)) - return_VOID; - - /* add file 'performance' [R/W] */ - entry = create_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE, - S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device)); - if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_PROCESSOR_FILE_PERFORMANCE)); - else { - entry->proc_fops = &acpi_processor_perf_fops; - entry->proc_fops->write = acpi_processor_write_performance; - entry->data = acpi_driver_data(device); - entry->owner = THIS_MODULE; - } - return_VOID; -} - -static void -acpi_cpufreq_remove_file ( - struct acpi_processor *pr) -{ - struct acpi_device *device = NULL; - - ACPI_FUNCTION_TRACE("acpi_cpufreq_addfile"); - - if (acpi_bus_get_device(pr->handle, &device)) - return_VOID; - - /* remove file 'performance' */ - remove_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE, - acpi_device_dir(device)); - - return_VOID; -} - -#else -static void acpi_cpufreq_add_file (struct acpi_processor *pr) { return; } -static void acpi_cpufreq_remove_file (struct acpi_processor *pr) { return; } -#endif /* CONFIG_X86_ACPI_CPUFREQ_PROC_INTF */ - - -int -acpi_processor_register_performance ( - struct acpi_processor_performance * performance, - unsigned int cpu) -{ - struct acpi_processor *pr; - - ACPI_FUNCTION_TRACE("acpi_processor_register_performance"); - - if (!(acpi_processor_ppc_status & PPC_REGISTERED)) - return_VALUE(-EINVAL); - - down(&performance_sem); - - pr = processors[cpu]; - if (!pr) { - up(&performance_sem); - return_VALUE(-ENODEV); - } - - if (pr->performance) { - up(&performance_sem); - return_VALUE(-EBUSY); - } - - pr->performance = performance; - - if (acpi_processor_get_performance_info(pr)) { - pr->performance = NULL; - up(&performance_sem); - return_VALUE(-EIO); - } - - acpi_cpufreq_add_file(pr); - - up(&performance_sem); - return_VALUE(0); -} -EXPORT_SYMBOL(acpi_processor_register_performance); - - -void -acpi_processor_unregister_performance ( - struct acpi_processor_performance * performance, - unsigned int cpu) -{ - struct acpi_processor *pr; - - ACPI_FUNCTION_TRACE("acpi_processor_unregister_performance"); - - down(&performance_sem); - - pr = processors[cpu]; - if (!pr) { - up(&performance_sem); - return_VOID; - } - - kfree(pr->performance->states); - pr->performance = NULL; - - acpi_cpufreq_remove_file(pr); - - up(&performance_sem); - - return_VOID; -} -EXPORT_SYMBOL(acpi_processor_unregister_performance); - - -/* for the rest of it, check arch/i386/kernel/cpu/cpufreq/acpi.c */ - -#else /* !CONFIG_CPU_FREQ */ - -static void acpi_processor_ppc_init(void) { return; } -static void acpi_processor_ppc_exit(void) { return; } - -static int acpi_processor_ppc_has_changed(struct acpi_processor *pr) { - static unsigned int printout = 1; - if (printout) { - printk(KERN_WARNING "Warning: Processor Platform Limit event detected, but not handled.\n"); - printk(KERN_WARNING "Consider compiling CPUfreq support into your kernel.\n"); - printout = 0; - } - return 0; -} - -#endif /* CONFIG_CPU_FREQ */ - -/* -------------------------------------------------------------------------- - Throttling Control - -------------------------------------------------------------------------- */ - -static int -acpi_processor_get_throttling ( - struct acpi_processor *pr) -{ - int state = 0; - u32 value = 0; - u32 duty_mask = 0; - u32 duty_value = 0; - - ACPI_FUNCTION_TRACE("acpi_processor_get_throttling"); - - if (!pr) - return_VALUE(-EINVAL); - - if (!pr->flags.throttling) - return_VALUE(-ENODEV); - - pr->throttling.state = 0; - - local_irq_disable(); - - duty_mask = pr->throttling.state_count - 1; - - duty_mask <<= pr->throttling.duty_offset; - - value = inl(pr->throttling.address); - - /* - * Compute the current throttling state when throttling is enabled - * (bit 4 is on). - */ - if (value & 0x10) { - duty_value = value & duty_mask; - duty_value >>= pr->throttling.duty_offset; - - if (duty_value) - state = pr->throttling.state_count-duty_value; - } - - pr->throttling.state = state; - - local_irq_enable(); - - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Throttling state is T%d (%d%% throttling applied)\n", - state, pr->throttling.states[state].performance)); - - return_VALUE(0); -} - - -static int -acpi_processor_set_throttling ( - struct acpi_processor *pr, - int state) -{ - u32 value = 0; - u32 duty_mask = 0; - u32 duty_value = 0; - - ACPI_FUNCTION_TRACE("acpi_processor_set_throttling"); - - if (!pr) - return_VALUE(-EINVAL); - - if ((state < 0) || (state > (pr->throttling.state_count - 1))) - return_VALUE(-EINVAL); - - if (!pr->flags.throttling) - return_VALUE(-ENODEV); - - if (state == pr->throttling.state) - return_VALUE(0); - - local_irq_disable(); - - /* - * Calculate the duty_value and duty_mask. - */ - if (state) { - duty_value = pr->throttling.state_count - state; - - duty_value <<= pr->throttling.duty_offset; - - /* Used to clear all duty_value bits */ - duty_mask = pr->throttling.state_count - 1; - - duty_mask <<= acpi_fadt.duty_offset; - duty_mask = ~duty_mask; - } - - /* - * Disable throttling by writing a 0 to bit 4. Note that we must - * turn it off before you can change the duty_value. - */ - value = inl(pr->throttling.address); - if (value & 0x10) { - value &= 0xFFFFFFEF; - outl(value, pr->throttling.address); - } - - /* - * Write the new duty_value and then enable throttling. Note - * that a state value of 0 leaves throttling disabled. - */ - if (state) { - value &= duty_mask; - value |= duty_value; - outl(value, pr->throttling.address); - - value |= 0x00000010; - outl(value, pr->throttling.address); - } - - pr->throttling.state = state; - - local_irq_enable(); - - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Throttling state set to T%d (%d%%)\n", state, - (pr->throttling.states[state].performance?pr->throttling.states[state].performance/10:0))); - - return_VALUE(0); -} - - -static int -acpi_processor_get_throttling_info ( - struct acpi_processor *pr) -{ - int result = 0; - int step = 0; - int i = 0; - - ACPI_FUNCTION_TRACE("acpi_processor_get_throttling_info"); - - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "pblk_address[0x%08x] duty_offset[%d] duty_width[%d]\n", - pr->throttling.address, - pr->throttling.duty_offset, - pr->throttling.duty_width)); - - if (!pr) - return_VALUE(-EINVAL); - - /* TBD: Support ACPI 2.0 objects */ - - if (!pr->throttling.address) { - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling register\n")); - return_VALUE(0); - } - else if (!pr->throttling.duty_width) { - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling states\n")); - return_VALUE(0); - } - /* TBD: Support duty_cycle values that span bit 4. */ - else if ((pr->throttling.duty_offset - + pr->throttling.duty_width) > 4) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "duty_cycle spans bit 4\n")); - return_VALUE(0); - } - - /* - * PIIX4 Errata: We don't support throttling on the original PIIX4. - * This shouldn't be an issue as few (if any) mobile systems ever - * used this part. - */ - if (errata.piix4.throttle) { - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Throttling not supported on PIIX4 A- or B-step\n")); - return_VALUE(0); - } - - pr->throttling.state_count = 1 << acpi_fadt.duty_width; - - /* - * Compute state values. Note that throttling displays a linear power/ - * performance relationship (at 50% performance the CPU will consume - * 50% power). Values are in 1/10th of a percent to preserve accuracy. - */ - - step = (1000 / pr->throttling.state_count); - - for (i=0; ithrottling.state_count; i++) { - pr->throttling.states[i].performance = step * i; - pr->throttling.states[i].power = step * i; - } - - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d throttling states\n", - pr->throttling.state_count)); - - pr->flags.throttling = 1; - - /* - * Disable throttling (if enabled). We'll let subsequent policy (e.g. - * thermal) decide to lower performance if it so chooses, but for now - * we'll crank up the speed. - */ - - result = acpi_processor_get_throttling(pr); - if (result) - goto end; - - if (pr->throttling.state) { - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Disabling throttling (was T%d)\n", - pr->throttling.state)); - result = acpi_processor_set_throttling(pr, 0); - if (result) - goto end; - } - -end: - if (result) - pr->flags.throttling = 0; - - return_VALUE(result); -} - - -/* -------------------------------------------------------------------------- - Limit Interface - -------------------------------------------------------------------------- */ - -static int -acpi_processor_apply_limit ( - struct acpi_processor* pr) -{ - int result = 0; - u16 px = 0; - u16 tx = 0; - - ACPI_FUNCTION_TRACE("acpi_processor_apply_limit"); - - if (!pr) - return_VALUE(-EINVAL); - - if (!pr->flags.limit) - return_VALUE(-ENODEV); - - if (pr->flags.throttling) { - if (pr->limit.user.tx > tx) - tx = pr->limit.user.tx; - if (pr->limit.thermal.tx > tx) - tx = pr->limit.thermal.tx; - - result = acpi_processor_set_throttling(pr, tx); - if (result) - goto end; - } - - pr->limit.state.px = px; - pr->limit.state.tx = tx; - - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Processor [%d] limit set to (P%d:T%d)\n", - pr->id, - pr->limit.state.px, - pr->limit.state.tx)); - -end: - if (result) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to set limit\n")); - - return_VALUE(result); -} - - -#ifdef CONFIG_CPU_FREQ - -/* If a passive cooling situation is detected, primarily CPUfreq is used, as it - * offers (in most cases) voltage scaling in addition to frequency scaling, and - * thus a cubic (instead of linear) reduction of energy. Also, we allow for - * _any_ cpufreq driver and not only the acpi-cpufreq driver. - */ - -static unsigned int cpufreq_thermal_reduction_pctg[NR_CPUS]; -static unsigned int acpi_thermal_cpufreq_is_init = 0; - - -static int cpu_has_cpufreq(unsigned int cpu) -{ - struct cpufreq_policy policy; - if (!acpi_thermal_cpufreq_is_init) - return -ENODEV; - if (!cpufreq_get_policy(&policy, cpu)) - return -ENODEV; - return 0; -} - - -static int acpi_thermal_cpufreq_increase(unsigned int cpu) -{ - if (!cpu_has_cpufreq(cpu)) - return -ENODEV; - - if (cpufreq_thermal_reduction_pctg[cpu] < 60) { - cpufreq_thermal_reduction_pctg[cpu] += 20; - cpufreq_update_policy(cpu); - return 0; - } - - return -ERANGE; -} - - -static int acpi_thermal_cpufreq_decrease(unsigned int cpu) -{ - if (!cpu_has_cpufreq(cpu)) - return -ENODEV; - - if (cpufreq_thermal_reduction_pctg[cpu] >= 20) { - cpufreq_thermal_reduction_pctg[cpu] -= 20; - cpufreq_update_policy(cpu); - return 0; - } - - return -ERANGE; -} - - -static int acpi_thermal_cpufreq_notifier( - struct notifier_block *nb, - unsigned long event, - void *data) -{ - struct cpufreq_policy *policy = data; - unsigned long max_freq = 0; - - if (event != CPUFREQ_ADJUST) - goto out; - - max_freq = (policy->cpuinfo.max_freq * (100 - cpufreq_thermal_reduction_pctg[policy->cpu])) / 100; - - cpufreq_verify_within_limits(policy, 0, max_freq); - - out: - return 0; -} - - -static struct notifier_block acpi_thermal_cpufreq_notifier_block = { - .notifier_call = acpi_thermal_cpufreq_notifier, -}; - - -static void acpi_thermal_cpufreq_init(void) { - int i; - - for (i=0; i ACPI_PROCESSOR_LIMIT_DECREMENT)) - return_VALUE(-EINVAL); - - result = acpi_bus_get_device(handle, &device); - if (result) - return_VALUE(result); - - pr = (struct acpi_processor *) acpi_driver_data(device); - if (!pr) - return_VALUE(-ENODEV); - - /* Thermal limits are always relative to the current Px/Tx state. */ - if (pr->flags.throttling) - pr->limit.thermal.tx = pr->throttling.state; - - /* - * Our default policy is to only use throttling at the lowest - * performance state. - */ - - tx = pr->limit.thermal.tx; - - switch (type) { - - case ACPI_PROCESSOR_LIMIT_NONE: - do { - result = acpi_thermal_cpufreq_decrease(pr->id); - } while (!result); - tx = 0; - break; - - case ACPI_PROCESSOR_LIMIT_INCREMENT: - /* if going up: P-states first, T-states later */ - - result = acpi_thermal_cpufreq_increase(pr->id); - if (!result) - goto end; - else if (result == -ERANGE) - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "At maximum performance state\n")); - - if (pr->flags.throttling) { - if (tx == (pr->throttling.state_count - 1)) - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "At maximum throttling state\n")); - else - tx++; - } - break; - - case ACPI_PROCESSOR_LIMIT_DECREMENT: - /* if going down: T-states first, P-states later */ - - if (pr->flags.throttling) { - if (tx == 0) - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "At minimum throttling state\n")); - else { - tx--; - goto end; - } - } - - result = acpi_thermal_cpufreq_decrease(pr->id); - if (result == -ERANGE) - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "At minimum performance state\n")); - - break; - } - -end: - if (pr->flags.throttling) { - pr->limit.thermal.px = 0; - pr->limit.thermal.tx = tx; - - result = acpi_processor_apply_limit(pr); - if (result) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to set thermal limit\n")); - - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Thermal limit now (P%d:T%d)\n", - pr->limit.thermal.px, - pr->limit.thermal.tx)); - } else - result = 0; - - return_VALUE(result); -} - - -static int -acpi_processor_get_limit_info ( - struct acpi_processor *pr) -{ - ACPI_FUNCTION_TRACE("acpi_processor_get_limit_info"); - - if (!pr) - return_VALUE(-EINVAL); - - if (pr->flags.throttling) - pr->flags.limit = 1; - - return_VALUE(0); -} - - -/* -------------------------------------------------------------------------- - FS Interface (/proc) - -------------------------------------------------------------------------- */ - -struct proc_dir_entry *acpi_processor_dir = NULL; - -static int acpi_processor_info_seq_show(struct seq_file *seq, void *offset) -{ - struct acpi_processor *pr = (struct acpi_processor *)seq->private; - - ACPI_FUNCTION_TRACE("acpi_processor_info_seq_show"); - - if (!pr) - goto end; - - seq_printf(seq, "processor id: %d\n" - "acpi id: %d\n" - "bus mastering control: %s\n" - "power management: %s\n" - "throttling control: %s\n" - "limit interface: %s\n", - pr->id, - pr->acpi_id, - pr->flags.bm_control ? "yes" : "no", - pr->flags.power ? "yes" : "no", - pr->flags.throttling ? "yes" : "no", - pr->flags.limit ? "yes" : "no"); - -end: - return_VALUE(0); -} - -static int acpi_processor_info_open_fs(struct inode *inode, struct file *file) -{ - return single_open(file, acpi_processor_info_seq_show, - PDE(inode)->data); -} - -static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset) -{ - struct acpi_processor *pr = (struct acpi_processor *)seq->private; - unsigned int i; - - ACPI_FUNCTION_TRACE("acpi_processor_power_seq_show"); - - if (!pr) - goto end; - - seq_printf(seq, "active state: C%d\n" - "default state: C%d\n" - "max_cstate: C%d\n" - "bus master activity: %08x\n", - pr->power.state, - pr->power.default_state, - max_cstate, - pr->power.bm_activity); - - seq_puts(seq, "states:\n"); - - for (i = 1; i < ACPI_C_STATE_COUNT; i++) { - seq_printf(seq, " %cC%d: ", - (i == pr->power.state?'*':' '), i); - - if (!pr->power.states[i].valid) { - seq_puts(seq, "\n"); - continue; - } - - if (pr->power.states[i].promotion.state) - seq_printf(seq, "promotion[C%d] ", - pr->power.states[i].promotion.state); - else - seq_puts(seq, "promotion[--] "); - - if (pr->power.states[i].demotion.state) - seq_printf(seq, "demotion[C%d] ", - pr->power.states[i].demotion.state); - else - seq_puts(seq, "demotion[--] "); - - seq_printf(seq, "latency[%03d] usage[%08d]\n", - pr->power.states[i].latency, - pr->power.states[i].usage); - } - -end: - return_VALUE(0); -} - -static int acpi_processor_power_open_fs(struct inode *inode, struct file *file) -{ - return single_open(file, acpi_processor_power_seq_show, - PDE(inode)->data); -} - -static int acpi_processor_throttling_seq_show(struct seq_file *seq, void *offset) -{ - struct acpi_processor *pr = (struct acpi_processor *)seq->private; - int i = 0; - int result = 0; - - ACPI_FUNCTION_TRACE("acpi_processor_throttling_seq_show"); - - if (!pr) - goto end; - - if (!(pr->throttling.state_count > 0)) { - seq_puts(seq, "\n"); - goto end; - } - - result = acpi_processor_get_throttling(pr); - - if (result) { - seq_puts(seq, "Could not determine current throttling state.\n"); - goto end; - } - - seq_printf(seq, "state count: %d\n" - "active state: T%d\n", - pr->throttling.state_count, - pr->throttling.state); - - seq_puts(seq, "states:\n"); - for (i = 0; i < pr->throttling.state_count; i++) - seq_printf(seq, " %cT%d: %02d%%\n", - (i == pr->throttling.state?'*':' '), i, - (pr->throttling.states[i].performance?pr->throttling.states[i].performance/10:0)); - -end: - return_VALUE(0); -} - -static int acpi_processor_throttling_open_fs(struct inode *inode, struct file *file) -{ - return single_open(file, acpi_processor_throttling_seq_show, - PDE(inode)->data); -} - -static ssize_t -acpi_processor_write_throttling ( - struct file *file, - const char __user *buffer, - size_t count, - loff_t *data) -{ - int result = 0; - struct seq_file *m = (struct seq_file *)file->private_data; - struct acpi_processor *pr = (struct acpi_processor *)m->private; - char state_string[12] = {'\0'}; - - ACPI_FUNCTION_TRACE("acpi_processor_write_throttling"); - - if (!pr || (count > sizeof(state_string) - 1)) - return_VALUE(-EINVAL); - - if (copy_from_user(state_string, buffer, count)) - return_VALUE(-EFAULT); - - state_string[count] = '\0'; - - result = acpi_processor_set_throttling(pr, - simple_strtoul(state_string, NULL, 0)); - if (result) - return_VALUE(result); - - return_VALUE(count); -} - -static int acpi_processor_limit_seq_show(struct seq_file *seq, void *offset) -{ - struct acpi_processor *pr = (struct acpi_processor *)seq->private; - - ACPI_FUNCTION_TRACE("acpi_processor_limit_seq_show"); - - if (!pr) - goto end; - - if (!pr->flags.limit) { - seq_puts(seq, "\n"); - goto end; - } - - seq_printf(seq, "active limit: P%d:T%d\n" - "user limit: P%d:T%d\n" - "thermal limit: P%d:T%d\n", - pr->limit.state.px, pr->limit.state.tx, - pr->limit.user.px, pr->limit.user.tx, - pr->limit.thermal.px, pr->limit.thermal.tx); - -end: - return_VALUE(0); -} - -static int acpi_processor_limit_open_fs(struct inode *inode, struct file *file) -{ - return single_open(file, acpi_processor_limit_seq_show, - PDE(inode)->data); -} - -static ssize_t -acpi_processor_write_limit ( - struct file *file, - const char __user *buffer, - size_t count, - loff_t *data) -{ - int result = 0; - struct seq_file *m = (struct seq_file *)file->private_data; - struct acpi_processor *pr = (struct acpi_processor *)m->private; - char limit_string[25] = {'\0'}; - int px = 0; - int tx = 0; - - ACPI_FUNCTION_TRACE("acpi_processor_write_limit"); - - if (!pr || (count > sizeof(limit_string) - 1)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument\n")); - return_VALUE(-EINVAL); - } - - if (copy_from_user(limit_string, buffer, count)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data\n")); - return_VALUE(-EFAULT); - } - - limit_string[count] = '\0'; - - if (sscanf(limit_string, "%d:%d", &px, &tx) != 2) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data format\n")); - return_VALUE(-EINVAL); - } - - if (pr->flags.throttling) { - if ((tx < 0) || (tx > (pr->throttling.state_count - 1))) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid tx\n")); - return_VALUE(-EINVAL); - } - pr->limit.user.tx = tx; - } - - result = acpi_processor_apply_limit(pr); - - return_VALUE(count); -} - - -static int -acpi_processor_add_fs ( - struct acpi_device *device) -{ - struct proc_dir_entry *entry = NULL; - - ACPI_FUNCTION_TRACE("acpi_processor_add_fs"); - - if (!acpi_device_dir(device)) { - acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), - acpi_processor_dir); - if (!acpi_device_dir(device)) - return_VALUE(-ENODEV); - } - acpi_device_dir(device)->owner = THIS_MODULE; - - /* 'info' [R] */ - entry = create_proc_entry(ACPI_PROCESSOR_FILE_INFO, - S_IRUGO, acpi_device_dir(device)); - if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_PROCESSOR_FILE_INFO)); - else { - entry->proc_fops = &acpi_processor_info_fops; - entry->data = acpi_driver_data(device); - entry->owner = THIS_MODULE; - } - - /* 'power' [R] */ - entry = create_proc_entry(ACPI_PROCESSOR_FILE_POWER, - S_IRUGO, acpi_device_dir(device)); - if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_PROCESSOR_FILE_POWER)); - else { - entry->proc_fops = &acpi_processor_power_fops; - entry->data = acpi_driver_data(device); - entry->owner = THIS_MODULE; - } - - /* 'throttling' [R/W] */ - entry = create_proc_entry(ACPI_PROCESSOR_FILE_THROTTLING, - S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device)); - if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_PROCESSOR_FILE_THROTTLING)); - else { - entry->proc_fops = &acpi_processor_throttling_fops; - entry->proc_fops->write = acpi_processor_write_throttling; - entry->data = acpi_driver_data(device); - entry->owner = THIS_MODULE; - } - - /* 'limit' [R/W] */ - entry = create_proc_entry(ACPI_PROCESSOR_FILE_LIMIT, - S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device)); - if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_PROCESSOR_FILE_LIMIT)); - else { - entry->proc_fops = &acpi_processor_limit_fops; - entry->proc_fops->write = acpi_processor_write_limit; - entry->data = acpi_driver_data(device); - entry->owner = THIS_MODULE; - } - - return_VALUE(0); -} - - -static int -acpi_processor_remove_fs ( - struct acpi_device *device) -{ - ACPI_FUNCTION_TRACE("acpi_processor_remove_fs"); - - if (acpi_device_dir(device)) { - remove_proc_entry(ACPI_PROCESSOR_FILE_INFO,acpi_device_dir(device)); - remove_proc_entry(ACPI_PROCESSOR_FILE_POWER,acpi_device_dir(device)); - remove_proc_entry(ACPI_PROCESSOR_FILE_THROTTLING, - acpi_device_dir(device)); - remove_proc_entry(ACPI_PROCESSOR_FILE_LIMIT,acpi_device_dir(device)); - remove_proc_entry(acpi_device_bid(device), acpi_processor_dir); - acpi_device_dir(device) = NULL; - } - - return_VALUE(0); -} - -/* Use the acpiid in MADT to map cpus in case of SMP */ -#ifndef CONFIG_SMP -#define convert_acpiid_to_cpu(acpi_id) (0xff) -#else - -#ifdef CONFIG_IA64 -#define arch_acpiid_to_apicid ia64_acpiid_to_sapicid -#define arch_cpu_to_apicid ia64_cpu_to_sapicid -#define ARCH_BAD_APICID (0xffff) -#else -#define arch_acpiid_to_apicid x86_acpiid_to_apicid -#define arch_cpu_to_apicid x86_cpu_to_apicid -#define ARCH_BAD_APICID (0xff) -#endif - -static u8 convert_acpiid_to_cpu(u8 acpi_id) -{ - u16 apic_id; - int i; - - apic_id = arch_acpiid_to_apicid[acpi_id]; - if (apic_id == ARCH_BAD_APICID) - return -1; - - for (i = 0; i < NR_CPUS; i++) { - if (arch_cpu_to_apicid[i] == apic_id) - return i; - } - return -1; -} -#endif - -/* -------------------------------------------------------------------------- - Driver Interface - -------------------------------------------------------------------------- */ - -static int -acpi_processor_get_info ( - struct acpi_processor *pr) -{ - acpi_status status = 0; - union acpi_object object = {0}; - struct acpi_buffer buffer = {sizeof(union acpi_object), &object}; - u8 cpu_index; - static int cpu0_initialized; - - ACPI_FUNCTION_TRACE("acpi_processor_get_info"); - - if (!pr) - return_VALUE(-EINVAL); - - if (num_online_cpus() > 1) - errata.smp = TRUE; - - acpi_processor_errata(pr); - - /* - * Check to see if we have bus mastering arbitration control. This - * is required for proper C3 usage (to maintain cache coherency). - */ - if (acpi_fadt.V1_pm2_cnt_blk && acpi_fadt.pm2_cnt_len) { - pr->flags.bm_control = 1; - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Bus mastering arbitration control present\n")); - } - else - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "No bus mastering arbitration control\n")); - - /* - * Evalute the processor object. Note that it is common on SMP to - * have the first (boot) processor with a valid PBLK address while - * all others have a NULL address. - */ - status = acpi_evaluate_object(pr->handle, NULL, NULL, &buffer); - if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error evaluating processor object\n")); - return_VALUE(-ENODEV); - } - - /* - * TBD: Synch processor ID (via LAPIC/LSAPIC structures) on SMP. - * >>> 'acpi_get_processor_id(acpi_id, &id)' in arch/xxx/acpi.c - */ - pr->acpi_id = object.processor.proc_id; - - cpu_index = convert_acpiid_to_cpu(pr->acpi_id); - - if ( !cpu0_initialized && (cpu_index == 0xff)) { - /* Handle UP system running SMP kernel, with no LAPIC in MADT */ - cpu_index = 0; - } else if (cpu_index > num_online_cpus()) { - /* - * Extra Processor objects may be enumerated on MP systems with - * less than the max # of CPUs. They should be ignored. - */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error getting cpuindex for acpiid 0x%x\n", - pr->acpi_id)); - return_VALUE(-ENODEV); - } - cpu0_initialized = 1; - - pr->id = cpu_index; - - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Processor [%d:%d]\n", pr->id, - pr->acpi_id)); - - if (!object.processor.pblk_address) - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No PBLK (NULL address)\n")); - else if (object.processor.pblk_length != 6) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid PBLK length [%d]\n", - object.processor.pblk_length)); - else { - pr->throttling.address = object.processor.pblk_address; - pr->throttling.duty_offset = acpi_fadt.duty_offset; - pr->throttling.duty_width = acpi_fadt.duty_width; - pr->power.states[ACPI_STATE_C2].address = - object.processor.pblk_address + 4; - pr->power.states[ACPI_STATE_C3].address = - object.processor.pblk_address + 5; - - /* - * We don't care about error returns - we just try to mark - * these reserved so that nobody else is confused into thinking - * that this region might be unused.. - * - * (In particular, allocating the IO range for Cardbus) - */ - request_region(pr->throttling.address, 6, "ACPI CPU throttle"); - } - - acpi_processor_get_power_info(pr); -#ifdef CONFIG_CPU_FREQ - acpi_processor_ppc_has_changed(pr); -#endif - acpi_processor_get_throttling_info(pr); - acpi_processor_get_limit_info(pr); - - return_VALUE(0); -} - - -static void -acpi_processor_notify ( - acpi_handle handle, - u32 event, - void *data) -{ - struct acpi_processor *pr = (struct acpi_processor *) data; - struct acpi_device *device = NULL; - - ACPI_FUNCTION_TRACE("acpi_processor_notify"); - - if (!pr) - return_VOID; - - if (acpi_bus_get_device(pr->handle, &device)) - return_VOID; - - switch (event) { - case ACPI_PROCESSOR_NOTIFY_PERFORMANCE: - acpi_processor_ppc_has_changed(pr); - acpi_bus_generate_event(device, event, - pr->performance_platform_limit); - break; - case ACPI_PROCESSOR_NOTIFY_POWER: - /* TBD */ - acpi_bus_generate_event(device, event, 0); - break; - default: - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Unsupported event [0x%x]\n", event)); - break; - } - - return_VOID; -} - - -static int -acpi_processor_add ( - struct acpi_device *device) -{ - int result = 0; - acpi_status status = AE_OK; - struct acpi_processor *pr = NULL; - u32 i = 0; - - ACPI_FUNCTION_TRACE("acpi_processor_add"); - - if (!device) - return_VALUE(-EINVAL); - - pr = kmalloc(sizeof(struct acpi_processor), GFP_KERNEL); - if (!pr) - return_VALUE(-ENOMEM); - memset(pr, 0, sizeof(struct acpi_processor)); - - pr->handle = device->handle; - strcpy(acpi_device_name(device), ACPI_PROCESSOR_DEVICE_NAME); - strcpy(acpi_device_class(device), ACPI_PROCESSOR_CLASS); - acpi_driver_data(device) = pr; - - result = acpi_processor_get_info(pr); - if (result) - goto end; - - result = acpi_processor_add_fs(device); - if (result) - goto end; - - status = acpi_install_notify_handler(pr->handle, ACPI_DEVICE_NOTIFY, - acpi_processor_notify, pr); - if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error installing notify handler\n")); - result = -ENODEV; - goto end; - } - - processors[pr->id] = pr; - - /* - * Install the idle handler if processor power management is supported. - * Note that we use previously set idle handler will be used on - * platforms that only support C1. - */ - if ((pr->flags.power) && (!boot_option_idle_override)) { - printk(KERN_INFO PREFIX "%s [%s] (supports", - acpi_device_name(device), acpi_device_bid(device)); - for (i = 1; i < ACPI_C_STATE_COUNT; i++) - if (pr->power.states[i].valid) - printk(" C%d", i); - printk(")\n"); - if (pr->id == 0) { - pm_idle_save = pm_idle; - pm_idle = acpi_processor_idle; - } - } - - if (pr->flags.throttling) { - printk(KERN_INFO PREFIX "%s [%s] (supports", - acpi_device_name(device), acpi_device_bid(device)); - printk(" %d throttling states", pr->throttling.state_count); - printk(")\n"); - } - -end: - if (result) { - acpi_processor_remove_fs(device); - kfree(pr); - } - - return_VALUE(result); -} - - -static int -acpi_processor_remove ( - struct acpi_device *device, - int type) -{ - acpi_status status = AE_OK; - struct acpi_processor *pr = NULL; - - ACPI_FUNCTION_TRACE("acpi_processor_remove"); - - if (!device || !acpi_driver_data(device)) - return_VALUE(-EINVAL); - - pr = (struct acpi_processor *) acpi_driver_data(device); - - /* Unregister the idle handler when processor #0 is removed. */ - if (pr->id == 0) { - pm_idle = pm_idle_save; - /* - * We are about to unload the current idle thread pm callback - * (pm_idle), Wait for all processors to update cached/local - * copies of pm_idle before proceeding. - */ - synchronize_kernel(); - } - - status = acpi_remove_notify_handler(pr->handle, ACPI_DEVICE_NOTIFY, - acpi_processor_notify); - if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error removing notify handler\n")); - } - - acpi_processor_remove_fs(device); - - processors[pr->id] = NULL; - - kfree(pr); - - return_VALUE(0); -} - -/* - * IBM ThinkPad R40e crashes mysteriously when going into C2 or C3. - * For now disable this. Probably a bug somewhere else. - * - * To skip this limit, boot/load with a large max_cstate limit. - */ -static int no_c2c3(struct dmi_system_id *id) -{ - if (max_cstate > ACPI_C_STATES_MAX) - return 0; - - printk(KERN_NOTICE PREFIX "%s detected - C2,C3 disabled." - " Override with \"processor.max_cstate=9\"\n", id->ident); - - max_cstate = 1; - - return 0; -} - -static struct dmi_system_id __initdata processor_dmi_table[] = { - { no_c2c3, "IBM ThinkPad R40e", { - DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), - DMI_MATCH(DMI_BIOS_VERSION,"1SET60WW") }}, - { no_c2c3, "Medion 41700", { - DMI_MATCH(DMI_BIOS_VENDOR,"Phoenix Technologies LTD"), - DMI_MATCH(DMI_BIOS_VERSION,"R01-A1J") }}, - {}, -}; - -/* We keep the driver loaded even when ACPI is not running. - This is needed for the powernow-k8 driver, that works even without - ACPI, but needs symbols from this driver */ - -static int __init -acpi_processor_init (void) -{ - int result = 0; - - ACPI_FUNCTION_TRACE("acpi_processor_init"); - - memset(&processors, 0, sizeof(processors)); - memset(&errata, 0, sizeof(errata)); - - acpi_processor_dir = proc_mkdir(ACPI_PROCESSOR_CLASS, acpi_root_dir); - if (!acpi_processor_dir) - return_VALUE(0); - acpi_processor_dir->owner = THIS_MODULE; - - result = acpi_bus_register_driver(&acpi_processor_driver); - if (result < 0) { - remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir); - return_VALUE(0); - } - - acpi_thermal_cpufreq_init(); - - acpi_processor_ppc_init(); - - dmi_check_system(processor_dmi_table); - - if (max_cstate < ACPI_C_STATES_MAX) - printk(KERN_NOTICE "ACPI: processor limited to max C-state %d\n", max_cstate); - - return_VALUE(0); -} - - -static void __exit -acpi_processor_exit (void) -{ - ACPI_FUNCTION_TRACE("acpi_processor_exit"); - - acpi_processor_ppc_exit(); - - acpi_thermal_cpufreq_exit(); - - acpi_bus_unregister_driver(&acpi_processor_driver); - - remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir); - - return_VOID; -} - - -module_init(acpi_processor_init); -module_exit(acpi_processor_exit); -module_param_named(max_cstate, max_cstate, uint, 0); - -EXPORT_SYMBOL(acpi_processor_set_thermal_limit); diff -Nru a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/acpi/processor_core.c 2005-01-02 23:03:34 -08:00 @@ -0,0 +1,989 @@ +/* + * acpi_processor.c - ACPI Processor Driver ($Revision: 71 $) + * + * Copyright (C) 2001, 2002 Andy Grover + * Copyright (C) 2001, 2002 Paul Diefenbaugh + * Copyright (C) 2004 Dominik Brodowski + * Copyright (C) 2004 Anil S Keshavamurthy + * - Added processor hotplug support + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * TBD: + * 1. Make # power states dynamic. + * 2. Support duty_cycle values that span bit 4. + * 3. Optimize by having scheduler determine business instead of + * having us try to calculate it here. + * 4. Need C1 timing -- must modify kernel (IRQ handler) to get this. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + + +#define ACPI_PROCESSOR_COMPONENT 0x01000000 +#define ACPI_PROCESSOR_CLASS "processor" +#define ACPI_PROCESSOR_DRIVER_NAME "ACPI Processor Driver" +#define ACPI_PROCESSOR_DEVICE_NAME "Processor" +#define ACPI_PROCESSOR_FILE_INFO "info" +#define ACPI_PROCESSOR_FILE_THROTTLING "throttling" +#define ACPI_PROCESSOR_FILE_LIMIT "limit" +#define ACPI_PROCESSOR_NOTIFY_PERFORMANCE 0x80 +#define ACPI_PROCESSOR_NOTIFY_POWER 0x81 + +#define ACPI_PROCESSOR_LIMIT_USER 0 +#define ACPI_PROCESSOR_LIMIT_THERMAL 1 + +#define ACPI_STA_PRESENT 0x00000001 + +#define _COMPONENT ACPI_PROCESSOR_COMPONENT +ACPI_MODULE_NAME ("acpi_processor") + +MODULE_AUTHOR("Paul Diefenbaugh"); +MODULE_DESCRIPTION(ACPI_PROCESSOR_DRIVER_NAME); +MODULE_LICENSE("GPL"); + + +static int acpi_processor_add (struct acpi_device *device); +static int acpi_processor_start (struct acpi_device *device); +static int acpi_processor_remove (struct acpi_device *device, int type); +static int acpi_processor_info_open_fs(struct inode *inode, struct file *file); +static void acpi_processor_notify ( acpi_handle handle, u32 event, void *data); +static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu); +static int acpi_processor_handle_eject(struct acpi_processor *pr); + +static struct acpi_driver acpi_processor_driver = { + .name = ACPI_PROCESSOR_DRIVER_NAME, + .class = ACPI_PROCESSOR_CLASS, + .ids = ACPI_PROCESSOR_HID, + .ops = { + .add = acpi_processor_add, + .remove = acpi_processor_remove, + .start = acpi_processor_start, + }, +}; + +#define INSTALL_NOTIFY_HANDLER 1 +#define UNINSTALL_NOTIFY_HANDLER 2 + + +struct file_operations acpi_processor_info_fops = { + .open = acpi_processor_info_open_fs, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + + +struct acpi_processor *processors[NR_CPUS]; +struct acpi_processor_errata errata; + + +/* -------------------------------------------------------------------------- + Errata Handling + -------------------------------------------------------------------------- */ + +int +acpi_processor_errata_piix4 ( + struct pci_dev *dev) +{ + u8 rev = 0; + u8 value1 = 0; + u8 value2 = 0; + + ACPI_FUNCTION_TRACE("acpi_processor_errata_piix4"); + + if (!dev) + return_VALUE(-EINVAL); + + /* + * Note that 'dev' references the PIIX4 ACPI Controller. + */ + + pci_read_config_byte(dev, PCI_REVISION_ID, &rev); + + switch (rev) { + case 0: + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found PIIX4 A-step\n")); + break; + case 1: + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found PIIX4 B-step\n")); + break; + case 2: + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found PIIX4E\n")); + break; + case 3: + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found PIIX4M\n")); + break; + default: + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found unknown PIIX4\n")); + break; + } + + switch (rev) { + + case 0: /* PIIX4 A-step */ + case 1: /* PIIX4 B-step */ + /* + * See specification changes #13 ("Manual Throttle Duty Cycle") + * and #14 ("Enabling and Disabling Manual Throttle"), plus + * erratum #5 ("STPCLK# Deassertion Time") from the January + * 2002 PIIX4 specification update. Applies to only older + * PIIX4 models. + */ + errata.piix4.throttle = 1; + + case 2: /* PIIX4E */ + case 3: /* PIIX4M */ + /* + * See erratum #18 ("C3 Power State/BMIDE and Type-F DMA + * Livelock") from the January 2002 PIIX4 specification update. + * Applies to all PIIX4 models. + */ + + /* + * BM-IDE + * ------ + * Find the PIIX4 IDE Controller and get the Bus Master IDE + * Status register address. We'll use this later to read + * each IDE controller's DMA status to make sure we catch all + * DMA activity. + */ + dev = pci_get_subsys(PCI_VENDOR_ID_INTEL, + PCI_DEVICE_ID_INTEL_82371AB, + PCI_ANY_ID, PCI_ANY_ID, NULL); + if (dev) { + errata.piix4.bmisx = pci_resource_start(dev, 4); + pci_dev_put(dev); + } + + /* + * Type-F DMA + * ---------- + * Find the PIIX4 ISA Controller and read the Motherboard + * DMA controller's status to see if Type-F (Fast) DMA mode + * is enabled (bit 7) on either channel. Note that we'll + * disable C3 support if this is enabled, as some legacy + * devices won't operate well if fast DMA is disabled. + */ + dev = pci_get_subsys(PCI_VENDOR_ID_INTEL, + PCI_DEVICE_ID_INTEL_82371AB_0, + PCI_ANY_ID, PCI_ANY_ID, NULL); + if (dev) { + pci_read_config_byte(dev, 0x76, &value1); + pci_read_config_byte(dev, 0x77, &value2); + if ((value1 & 0x80) || (value2 & 0x80)) + errata.piix4.fdma = 1; + pci_dev_put(dev); + } + + break; + } + + if (errata.piix4.bmisx) + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Bus master activity detection (BM-IDE) erratum enabled\n")); + if (errata.piix4.fdma) + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Type-F DMA livelock erratum (C3 disabled)\n")); + + return_VALUE(0); +} + + +int +acpi_processor_errata ( + struct acpi_processor *pr) +{ + int result = 0; + struct pci_dev *dev = NULL; + + ACPI_FUNCTION_TRACE("acpi_processor_errata"); + + if (!pr) + return_VALUE(-EINVAL); + + /* + * PIIX4 + */ + dev = pci_get_subsys(PCI_VENDOR_ID_INTEL, + PCI_DEVICE_ID_INTEL_82371AB_3, PCI_ANY_ID, PCI_ANY_ID, NULL); + if (dev) { + result = acpi_processor_errata_piix4(dev); + pci_dev_put(dev); + } + + return_VALUE(result); +} + + +/* -------------------------------------------------------------------------- + FS Interface (/proc) + -------------------------------------------------------------------------- */ + +struct proc_dir_entry *acpi_processor_dir = NULL; + +static int acpi_processor_info_seq_show(struct seq_file *seq, void *offset) +{ + struct acpi_processor *pr = (struct acpi_processor *)seq->private; + + ACPI_FUNCTION_TRACE("acpi_processor_info_seq_show"); + + if (!pr) + goto end; + + seq_printf(seq, "processor id: %d\n" + "acpi id: %d\n" + "bus mastering control: %s\n" + "power management: %s\n" + "throttling control: %s\n" + "limit interface: %s\n", + pr->id, + pr->acpi_id, + pr->flags.bm_control ? "yes" : "no", + pr->flags.power ? "yes" : "no", + pr->flags.throttling ? "yes" : "no", + pr->flags.limit ? "yes" : "no"); + +end: + return_VALUE(0); +} + +static int acpi_processor_info_open_fs(struct inode *inode, struct file *file) +{ + return single_open(file, acpi_processor_info_seq_show, + PDE(inode)->data); +} + + +static int +acpi_processor_add_fs ( + struct acpi_device *device) +{ + struct proc_dir_entry *entry = NULL; + + ACPI_FUNCTION_TRACE("acpi_processor_add_fs"); + + if (!acpi_device_dir(device)) { + acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), + acpi_processor_dir); + if (!acpi_device_dir(device)) + return_VALUE(-ENODEV); + } + acpi_device_dir(device)->owner = THIS_MODULE; + + /* 'info' [R] */ + entry = create_proc_entry(ACPI_PROCESSOR_FILE_INFO, + S_IRUGO, acpi_device_dir(device)); + if (!entry) + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unable to create '%s' fs entry\n", + ACPI_PROCESSOR_FILE_INFO)); + else { + entry->proc_fops = &acpi_processor_info_fops; + entry->data = acpi_driver_data(device); + entry->owner = THIS_MODULE; + } + + /* 'throttling' [R/W] */ + entry = create_proc_entry(ACPI_PROCESSOR_FILE_THROTTLING, + S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device)); + if (!entry) + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unable to create '%s' fs entry\n", + ACPI_PROCESSOR_FILE_THROTTLING)); + else { + entry->proc_fops = &acpi_processor_throttling_fops; + entry->proc_fops->write = acpi_processor_write_throttling; + entry->data = acpi_driver_data(device); + entry->owner = THIS_MODULE; + } + + /* 'limit' [R/W] */ + entry = create_proc_entry(ACPI_PROCESSOR_FILE_LIMIT, + S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device)); + if (!entry) + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unable to create '%s' fs entry\n", + ACPI_PROCESSOR_FILE_LIMIT)); + else { + entry->proc_fops = &acpi_processor_limit_fops; + entry->proc_fops->write = acpi_processor_write_limit; + entry->data = acpi_driver_data(device); + entry->owner = THIS_MODULE; + } + + return_VALUE(0); +} + + +static int +acpi_processor_remove_fs ( + struct acpi_device *device) +{ + ACPI_FUNCTION_TRACE("acpi_processor_remove_fs"); + + if (acpi_device_dir(device)) { + remove_proc_entry(ACPI_PROCESSOR_FILE_INFO,acpi_device_dir(device)); + remove_proc_entry(ACPI_PROCESSOR_FILE_THROTTLING, + acpi_device_dir(device)); + remove_proc_entry(ACPI_PROCESSOR_FILE_LIMIT,acpi_device_dir(device)); + remove_proc_entry(acpi_device_bid(device), acpi_processor_dir); + acpi_device_dir(device) = NULL; + } + + return_VALUE(0); +} + +/* Use the acpiid in MADT to map cpus in case of SMP */ +#ifndef CONFIG_SMP +#define convert_acpiid_to_cpu(acpi_id) (0xff) +#else + +#ifdef CONFIG_IA64 +#define arch_acpiid_to_apicid ia64_acpiid_to_sapicid +#define arch_cpu_to_apicid ia64_cpu_to_sapicid +#define ARCH_BAD_APICID (0xffff) +#else +#define arch_acpiid_to_apicid x86_acpiid_to_apicid +#define arch_cpu_to_apicid x86_cpu_to_apicid +#define ARCH_BAD_APICID (0xff) +#endif + +static u8 convert_acpiid_to_cpu(u8 acpi_id) +{ + u16 apic_id; + int i; + + apic_id = arch_acpiid_to_apicid[acpi_id]; + if (apic_id == ARCH_BAD_APICID) + return -1; + + for (i = 0; i < NR_CPUS; i++) { + if (arch_cpu_to_apicid[i] == apic_id) + return i; + } + return -1; +} +#endif + +/* -------------------------------------------------------------------------- + Driver Interface + -------------------------------------------------------------------------- */ + +static int +acpi_processor_get_info ( + struct acpi_processor *pr) +{ + acpi_status status = 0; + union acpi_object object = {0}; + struct acpi_buffer buffer = {sizeof(union acpi_object), &object}; + u8 cpu_index; + static int cpu0_initialized; + + ACPI_FUNCTION_TRACE("acpi_processor_get_info"); + + if (!pr) + return_VALUE(-EINVAL); + + if (num_online_cpus() > 1) + errata.smp = TRUE; + + acpi_processor_errata(pr); + + /* + * Check to see if we have bus mastering arbitration control. This + * is required for proper C3 usage (to maintain cache coherency). + */ + if (acpi_fadt.V1_pm2_cnt_blk && acpi_fadt.pm2_cnt_len) { + pr->flags.bm_control = 1; + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Bus mastering arbitration control present\n")); + } + else + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "No bus mastering arbitration control\n")); + + /* + * Evalute the processor object. Note that it is common on SMP to + * have the first (boot) processor with a valid PBLK address while + * all others have a NULL address. + */ + status = acpi_evaluate_object(pr->handle, NULL, NULL, &buffer); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Error evaluating processor object\n")); + return_VALUE(-ENODEV); + } + + /* + * TBD: Synch processor ID (via LAPIC/LSAPIC structures) on SMP. + * >>> 'acpi_get_processor_id(acpi_id, &id)' in arch/xxx/acpi.c + */ + pr->acpi_id = object.processor.proc_id; + + cpu_index = convert_acpiid_to_cpu(pr->acpi_id); + + /* Handle UP system running SMP kernel, with no LAPIC in MADT */ + if ( !cpu0_initialized && (cpu_index == 0xff) && + (num_online_cpus() == 1)) { + cpu_index = 0; + } + + cpu0_initialized = 1; + + pr->id = cpu_index; + + /* + * Extra Processor objects may be enumerated on MP systems with + * less than the max # of CPUs. They should be ignored _iff + * they are physically not present. + */ + if (cpu_index >= NR_CPUS) { + if (ACPI_FAILURE(acpi_processor_hotadd_init(pr->handle, &pr->id))) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Error getting cpuindex for acpiid 0x%x\n", + pr->acpi_id)); + return_VALUE(-ENODEV); + } + } + + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Processor [%d:%d]\n", pr->id, + pr->acpi_id)); + + if (!object.processor.pblk_address) + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No PBLK (NULL address)\n")); + else if (object.processor.pblk_length != 6) + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid PBLK length [%d]\n", + object.processor.pblk_length)); + else { + pr->throttling.address = object.processor.pblk_address; + pr->throttling.duty_offset = acpi_fadt.duty_offset; + pr->throttling.duty_width = acpi_fadt.duty_width; + + pr->pblk = object.processor.pblk_address; + + /* + * We don't care about error returns - we just try to mark + * these reserved so that nobody else is confused into thinking + * that this region might be unused.. + * + * (In particular, allocating the IO range for Cardbus) + */ + request_region(pr->throttling.address, 6, "ACPI CPU throttle"); + } + +#ifdef CONFIG_CPU_FREQ + acpi_processor_ppc_has_changed(pr); +#endif + acpi_processor_get_throttling_info(pr); + acpi_processor_get_limit_info(pr); + + return_VALUE(0); +} + +static int +acpi_processor_start( + struct acpi_device *device) +{ + int result = 0; + acpi_status status = AE_OK; + struct acpi_processor *pr; + + ACPI_FUNCTION_TRACE("acpi_processor_start"); + + pr = acpi_driver_data(device); + + result = acpi_processor_get_info(pr); + if (result) { + /* Processor is physically not present */ + return_VALUE(0); + } + + BUG_ON((pr->id >= NR_CPUS) || (pr->id < 0)); + + processors[pr->id] = pr; + + result = acpi_processor_add_fs(device); + if (result) + goto end; + + status = acpi_install_notify_handler(pr->handle, ACPI_DEVICE_NOTIFY, + acpi_processor_notify, pr); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Error installing device notify handler\n")); + } + + acpi_processor_power_init(pr, device); + + if (pr->flags.throttling) { + printk(KERN_INFO PREFIX "%s [%s] (supports", + acpi_device_name(device), acpi_device_bid(device)); + printk(" %d throttling states", pr->throttling.state_count); + printk(")\n"); + } + +end: + + return_VALUE(result); +} + + + +static void +acpi_processor_notify ( + acpi_handle handle, + u32 event, + void *data) +{ + struct acpi_processor *pr = (struct acpi_processor *) data; + struct acpi_device *device = NULL; + + ACPI_FUNCTION_TRACE("acpi_processor_notify"); + + if (!pr) + return_VOID; + + if (acpi_bus_get_device(pr->handle, &device)) + return_VOID; + + switch (event) { + case ACPI_PROCESSOR_NOTIFY_PERFORMANCE: + acpi_processor_ppc_has_changed(pr); + acpi_bus_generate_event(device, event, + pr->performance_platform_limit); + break; + case ACPI_PROCESSOR_NOTIFY_POWER: + acpi_processor_cst_has_changed(pr); + acpi_bus_generate_event(device, event, 0); + break; + default: + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Unsupported event [0x%x]\n", event)); + break; + } + + return_VOID; +} + + +static int +acpi_processor_add ( + struct acpi_device *device) +{ + struct acpi_processor *pr = NULL; + + ACPI_FUNCTION_TRACE("acpi_processor_add"); + + if (!device) + return_VALUE(-EINVAL); + + pr = kmalloc(sizeof(struct acpi_processor), GFP_KERNEL); + if (!pr) + return_VALUE(-ENOMEM); + memset(pr, 0, sizeof(struct acpi_processor)); + + pr->handle = device->handle; + strcpy(acpi_device_name(device), ACPI_PROCESSOR_DEVICE_NAME); + strcpy(acpi_device_class(device), ACPI_PROCESSOR_CLASS); + acpi_driver_data(device) = pr; + + return_VALUE(0); +} + + +static int +acpi_processor_remove ( + struct acpi_device *device, + int type) +{ + acpi_status status = AE_OK; + struct acpi_processor *pr = NULL; + + ACPI_FUNCTION_TRACE("acpi_processor_remove"); + + if (!device || !acpi_driver_data(device)) + return_VALUE(-EINVAL); + + pr = (struct acpi_processor *) acpi_driver_data(device); + + if (pr->id >= NR_CPUS) { + kfree(pr); + return_VALUE(0); + } + + if (type == ACPI_BUS_REMOVAL_EJECT) { + if (acpi_processor_handle_eject(pr)) + return_VALUE(-EINVAL); + } + + acpi_processor_power_exit(pr, device); + + status = acpi_remove_notify_handler(pr->handle, ACPI_DEVICE_NOTIFY, + acpi_processor_notify); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Error removing notify handler\n")); + } + + acpi_processor_remove_fs(device); + + processors[pr->id] = NULL; + + kfree(pr); + + return_VALUE(0); +} + +#ifdef CONFIG_ACPI_HOTPLUG_CPU +/**************************************************************************** + * Acpi processor hotplug support * + ****************************************************************************/ + +static int is_processor_present(acpi_handle handle); + +static int +is_processor_present( + acpi_handle handle) +{ + acpi_status status; + unsigned long sta = 0; + + ACPI_FUNCTION_TRACE("is_processor_present"); + + status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); + if (ACPI_FAILURE(status) || !(sta & ACPI_STA_PRESENT)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Processor Device is not present\n")); + return_VALUE(0); + } + return_VALUE(1); +} + + +static +int acpi_processor_device_add( + acpi_handle handle, + struct acpi_device **device) +{ + acpi_handle phandle; + struct acpi_device *pdev; + struct acpi_processor *pr; + + ACPI_FUNCTION_TRACE("acpi_processor_device_add"); + + if (acpi_get_parent(handle, &phandle)) { + return_VALUE(-ENODEV); + } + + if (acpi_bus_get_device(phandle, &pdev)) { + return_VALUE(-ENODEV); + } + + if (acpi_bus_add(device, pdev, handle, ACPI_BUS_TYPE_PROCESSOR)) { + return_VALUE(-ENODEV); + } + + acpi_bus_scan(*device); + + pr = acpi_driver_data(*device); + if (!pr) + return_VALUE(-ENODEV); + + if ((pr->id >=0) && (pr->id < NR_CPUS)) { + kobject_hotplug(&(*device)->kobj, KOBJ_ONLINE); + } + return_VALUE(0); +} + + +static void +acpi_processor_hotplug_notify ( + acpi_handle handle, + u32 event, + void *data) +{ + struct acpi_processor *pr; + struct acpi_device *device = NULL; + int result; + + ACPI_FUNCTION_TRACE("acpi_processor_hotplug_notify"); + + switch (event) { + case ACPI_NOTIFY_BUS_CHECK: + case ACPI_NOTIFY_DEVICE_CHECK: + printk("Processor driver received %s event\n", + (event==ACPI_NOTIFY_BUS_CHECK)? + "ACPI_NOTIFY_BUS_CHECK":"ACPI_NOTIFY_DEVICE_CHECK"); + + if (!is_processor_present(handle)) + break; + + if (acpi_bus_get_device(handle, &device)) { + result = acpi_processor_device_add(handle, &device); + if (result) + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unable to add the device\n")); + break; + } + + pr = acpi_driver_data(device); + if (!pr) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Driver data is NULL\n")); + break; + } + + if (pr->id >= 0 && (pr->id < NR_CPUS)) { + kobject_hotplug(&device->kobj, KOBJ_OFFLINE); + break; + } + + result = acpi_processor_start(device); + if ((!result) && ((pr->id >=0) && (pr->id < NR_CPUS))) { + kobject_hotplug(&device->kobj, KOBJ_ONLINE); + } else { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Device [%s] failed to start\n", + acpi_device_bid(device))); + } + break; + case ACPI_NOTIFY_EJECT_REQUEST: + ACPI_DEBUG_PRINT((ACPI_DB_INFO,"received ACPI_NOTIFY_EJECT_REQUEST\n")); + + if (acpi_bus_get_device(handle, &device)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR,"Device don't exist, dropping EJECT\n")); + break; + } + pr = acpi_driver_data(device); + if (!pr) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR,"Driver data is NULL, dropping EJECT\n")); + return_VOID; + } + + if ((pr->id < NR_CPUS) && (cpu_present(pr->id))) + kobject_hotplug(&device->kobj, KOBJ_OFFLINE); + break; + default: + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Unsupported event [0x%x]\n", event)); + break; + } + + return_VOID; +} + +static acpi_status +processor_walk_namespace_cb(acpi_handle handle, + u32 lvl, + void *context, + void **rv) +{ + acpi_status status; + int *action = context; + acpi_object_type type = 0; + + status = acpi_get_type(handle, &type); + if (ACPI_FAILURE(status)) + return(AE_OK); + + if (type != ACPI_TYPE_PROCESSOR) + return(AE_OK); + + switch(*action) { + case INSTALL_NOTIFY_HANDLER: + acpi_install_notify_handler(handle, + ACPI_SYSTEM_NOTIFY, + acpi_processor_hotplug_notify, + NULL); + break; + case UNINSTALL_NOTIFY_HANDLER: + acpi_remove_notify_handler(handle, + ACPI_SYSTEM_NOTIFY, + acpi_processor_hotplug_notify); + break; + default: + break; + } + + return(AE_OK); +} + + +static acpi_status +acpi_processor_hotadd_init( + acpi_handle handle, + int *p_cpu) +{ + ACPI_FUNCTION_TRACE("acpi_processor_hotadd_init"); + + if (!is_processor_present(handle)) { + return_VALUE(AE_ERROR); + } + + if (acpi_map_lsapic(handle, p_cpu)) + return_VALUE(AE_ERROR); + + if (arch_register_cpu(*p_cpu)) { + acpi_unmap_lsapic(*p_cpu); + return_VALUE(AE_ERROR); + } + + return_VALUE(AE_OK); +} + + +static int +acpi_processor_handle_eject(struct acpi_processor *pr) +{ + if (cpu_online(pr->id)) { + return(-EINVAL); + } + arch_unregister_cpu(pr->id); + acpi_unmap_lsapic(pr->id); + return(0); +} +#else +static acpi_status +acpi_processor_hotadd_init( + acpi_handle handle, + int *p_cpu) +{ + return AE_ERROR; +} +static int +acpi_processor_handle_eject(struct acpi_processor *pr) +{ + return(-EINVAL); +} +#endif + + +static +void acpi_processor_install_hotplug_notify(void) +{ +#ifdef CONFIG_ACPI_HOTPLUG_CPU + int action = INSTALL_NOTIFY_HANDLER; + acpi_walk_namespace(ACPI_TYPE_PROCESSOR, + ACPI_ROOT_OBJECT, + ACPI_UINT32_MAX, + processor_walk_namespace_cb, + &action, NULL); +#endif +} + + +static +void acpi_processor_uninstall_hotplug_notify(void) +{ +#ifdef CONFIG_ACPI_HOTPLUG_CPU + int action = UNINSTALL_NOTIFY_HANDLER; + acpi_walk_namespace(ACPI_TYPE_PROCESSOR, + ACPI_ROOT_OBJECT, + ACPI_UINT32_MAX, + processor_walk_namespace_cb, + &action, NULL); +#endif +} + +/* + * We keep the driver loaded even when ACPI is not running. + * This is needed for the powernow-k8 driver, that works even without + * ACPI, but needs symbols from this driver + */ + +static int __init +acpi_processor_init (void) +{ + int result = 0; + + ACPI_FUNCTION_TRACE("acpi_processor_init"); + + memset(&processors, 0, sizeof(processors)); + memset(&errata, 0, sizeof(errata)); + + acpi_processor_dir = proc_mkdir(ACPI_PROCESSOR_CLASS, acpi_root_dir); + if (!acpi_processor_dir) + return_VALUE(0); + acpi_processor_dir->owner = THIS_MODULE; + + result = acpi_bus_register_driver(&acpi_processor_driver); + if (result < 0) { + remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir); + return_VALUE(0); + } + + acpi_processor_install_hotplug_notify(); + + acpi_thermal_cpufreq_init(); + + acpi_processor_ppc_init(); + + return_VALUE(0); +} + + +static void __exit +acpi_processor_exit (void) +{ + ACPI_FUNCTION_TRACE("acpi_processor_exit"); + + acpi_processor_ppc_exit(); + + acpi_thermal_cpufreq_exit(); + + acpi_processor_uninstall_hotplug_notify(); + + acpi_bus_unregister_driver(&acpi_processor_driver); + + remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir); + + return_VOID; +} + + +module_init(acpi_processor_init); +module_exit(acpi_processor_exit); + +EXPORT_SYMBOL(acpi_processor_set_thermal_limit); + +MODULE_ALIAS("processor"); diff -Nru a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/acpi/processor_idle.c 2005-01-02 23:03:35 -08:00 @@ -0,0 +1,995 @@ +/* + * processor_idle - idle state submodule to the ACPI processor driver + * + * Copyright (C) 2001, 2002 Andy Grover + * Copyright (C) 2001, 2002 Paul Diefenbaugh + * Copyright (C) 2004 Dominik Brodowski + * Copyright (C) 2004 Anil S Keshavamurthy + * - Added processor hotplug support + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#define ACPI_PROCESSOR_COMPONENT 0x01000000 +#define ACPI_PROCESSOR_CLASS "processor" +#define ACPI_PROCESSOR_DRIVER_NAME "ACPI Processor Driver" +#define _COMPONENT ACPI_PROCESSOR_COMPONENT +ACPI_MODULE_NAME ("acpi_processor") + +#define ACPI_PROCESSOR_FILE_POWER "power" + +#define US_TO_PM_TIMER_TICKS(t) ((t * (PM_TIMER_FREQUENCY/1000)) / 1000) +#define C2_OVERHEAD 4 /* 1us (3.579 ticks per us) */ +#define C3_OVERHEAD 4 /* 1us (3.579 ticks per us) */ + +static void (*pm_idle_save)(void); +module_param(max_cstate, uint, 0644); + +static unsigned int nocst = 0; +module_param(nocst, uint, 0000); + +/* -------------------------------------------------------------------------- + Power Management + -------------------------------------------------------------------------- */ + +/* + * IBM ThinkPad R40e crashes mysteriously when going into C2 or C3. + * For now disable this. Probably a bug somewhere else. + * + * To skip this limit, boot/load with a large max_cstate limit. + */ +static int no_c2c3(struct dmi_system_id *id) +{ + if (max_cstate > ACPI_PROCESSOR_MAX_POWER) + return 0; + + printk(KERN_NOTICE PREFIX "%s detected - C2,C3 disabled." + " Override with \"processor.max_cstate=%d\"\n", id->ident, + ACPI_PROCESSOR_MAX_POWER + 1); + + max_cstate = 1; + + return 0; +} + + + + +static struct dmi_system_id __initdata processor_power_dmi_table[] = { + { no_c2c3, "IBM ThinkPad R40e", { + DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), + DMI_MATCH(DMI_BIOS_VERSION,"1SET60WW") }}, + { no_c2c3, "Medion 41700", { + DMI_MATCH(DMI_BIOS_VENDOR,"Phoenix Technologies LTD"), + DMI_MATCH(DMI_BIOS_VERSION,"R01-A1J") }}, + {}, +}; + + +static inline u32 +ticks_elapsed ( + u32 t1, + u32 t2) +{ + if (t2 >= t1) + return (t2 - t1); + else if (!acpi_fadt.tmr_val_ext) + return (((0x00FFFFFF - t1) + t2) & 0x00FFFFFF); + else + return ((0xFFFFFFFF - t1) + t2); +} + + +static void +acpi_processor_power_activate ( + struct acpi_processor *pr, + struct acpi_processor_cx *new) +{ + struct acpi_processor_cx *old; + + if (!pr || !new) + return; + + old = pr->power.state; + + if (old) + old->promotion.count = 0; + new->demotion.count = 0; + + /* Cleanup from old state. */ + if (old) { + switch (old->type) { + case ACPI_STATE_C3: + /* Disable bus master reload */ + if (new->type != ACPI_STATE_C3) + acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 0, ACPI_MTX_DO_NOT_LOCK); + break; + } + } + + /* Prepare to use new state. */ + switch (new->type) { + case ACPI_STATE_C3: + /* Enable bus master reload */ + if (old->type != ACPI_STATE_C3) + acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 1, ACPI_MTX_DO_NOT_LOCK); + break; + } + + pr->power.state = new; + + return; +} + + +static void acpi_processor_idle (void) +{ + struct acpi_processor *pr = NULL; + struct acpi_processor_cx *cx = NULL; + struct acpi_processor_cx *next_state = NULL; + int sleep_ticks = 0; + u32 t1, t2 = 0; + + pr = processors[smp_processor_id()]; + if (!pr) + return; + + /* + * Interrupts must be disabled during bus mastering calculations and + * for C2/C3 transitions. + */ + local_irq_disable(); + + /* + * Check whether we truly need to go idle, or should + * reschedule: + */ + if (unlikely(need_resched())) { + local_irq_enable(); + return; + } + + cx = pr->power.state; + if (!cx) + goto easy_out; + + /* + * Check BM Activity + * ----------------- + * Check for bus mastering activity (if required), record, and check + * for demotion. + */ + if (pr->flags.bm_check) { + u32 bm_status = 0; + + pr->power.bm_activity <<= 1; + + acpi_get_register(ACPI_BITREG_BUS_MASTER_STATUS, + &bm_status, ACPI_MTX_DO_NOT_LOCK); + if (bm_status) { + pr->power.bm_activity++; + acpi_set_register(ACPI_BITREG_BUS_MASTER_STATUS, + 1, ACPI_MTX_DO_NOT_LOCK); + } + /* + * PIIX4 Erratum #18: Note that BM_STS doesn't always reflect + * the true state of bus mastering activity; forcing us to + * manually check the BMIDEA bit of each IDE channel. + */ + else if (errata.piix4.bmisx) { + if ((inb_p(errata.piix4.bmisx + 0x02) & 0x01) + || (inb_p(errata.piix4.bmisx + 0x0A) & 0x01)) + pr->power.bm_activity++; + } + /* + * Apply bus mastering demotion policy. Automatically demote + * to avoid a faulty transition. Note that the processor + * won't enter a low-power state during this call (to this + * funciton) but should upon the next. + * + * TBD: A better policy might be to fallback to the demotion + * state (use it for this quantum only) istead of + * demoting -- and rely on duration as our sole demotion + * qualification. This may, however, introduce DMA + * issues (e.g. floppy DMA transfer overrun/underrun). + */ + if (pr->power.bm_activity & cx->demotion.threshold.bm) { + local_irq_enable(); + next_state = cx->demotion.state; + goto end; + } + } + + cx->usage++; + + /* + * Sleep: + * ------ + * Invoke the current Cx state to put the processor to sleep. + */ + switch (cx->type) { + + case ACPI_STATE_C1: + /* + * Invoke C1. + * Use the appropriate idle routine, the one that would + * be used without acpi C-states. + */ + if (pm_idle_save) + pm_idle_save(); + else + safe_halt(); + /* + * TBD: Can't get time duration while in C1, as resumes + * go to an ISR rather than here. Need to instrument + * base interrupt handler. + */ + sleep_ticks = 0xFFFFFFFF; + break; + + case ACPI_STATE_C2: + /* Get start time (ticks) */ + t1 = inl(acpi_fadt.xpm_tmr_blk.address); + /* Invoke C2 */ + inb(cx->address); + /* Dummy op - must do something useless after P_LVL2 read */ + t2 = inl(acpi_fadt.xpm_tmr_blk.address); + /* Get end time (ticks) */ + t2 = inl(acpi_fadt.xpm_tmr_blk.address); + /* Re-enable interrupts */ + local_irq_enable(); + /* Compute time (ticks) that we were actually asleep */ + sleep_ticks = ticks_elapsed(t1, t2) - cx->latency_ticks - C2_OVERHEAD; + break; + + case ACPI_STATE_C3: + /* Disable bus master arbitration */ + acpi_set_register(ACPI_BITREG_ARB_DISABLE, 1, ACPI_MTX_DO_NOT_LOCK); + /* Get start time (ticks) */ + t1 = inl(acpi_fadt.xpm_tmr_blk.address); + /* Invoke C3 */ + inb(cx->address); + /* Dummy op - must do something useless after P_LVL3 read */ + t2 = inl(acpi_fadt.xpm_tmr_blk.address); + /* Get end time (ticks) */ + t2 = inl(acpi_fadt.xpm_tmr_blk.address); + /* Enable bus master arbitration */ + acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0, ACPI_MTX_DO_NOT_LOCK); + /* Re-enable interrupts */ + local_irq_enable(); + /* Compute time (ticks) that we were actually asleep */ + sleep_ticks = ticks_elapsed(t1, t2) - cx->latency_ticks - C3_OVERHEAD; + break; + + default: + local_irq_enable(); + return; + } + + next_state = pr->power.state; + + /* + * Promotion? + * ---------- + * Track the number of longs (time asleep is greater than threshold) + * and promote when the count threshold is reached. Note that bus + * mastering activity may prevent promotions. + * Do not promote above max_cstate. + */ + if (cx->promotion.state && + ((cx->promotion.state - pr->power.states) <= max_cstate)) { + if (sleep_ticks > cx->promotion.threshold.ticks) { + cx->promotion.count++; + cx->demotion.count = 0; + if (cx->promotion.count >= cx->promotion.threshold.count) { + if (pr->flags.bm_check) { + if (!(pr->power.bm_activity & cx->promotion.threshold.bm)) { + next_state = cx->promotion.state; + goto end; + } + } + else { + next_state = cx->promotion.state; + goto end; + } + } + } + } + + /* + * Demotion? + * --------- + * Track the number of shorts (time asleep is less than time threshold) + * and demote when the usage threshold is reached. + */ + if (cx->demotion.state) { + if (sleep_ticks < cx->demotion.threshold.ticks) { + cx->demotion.count++; + cx->promotion.count = 0; + if (cx->demotion.count >= cx->demotion.threshold.count) { + next_state = cx->demotion.state; + goto end; + } + } + } + +end: + /* + * Demote if current state exceeds max_cstate + */ + if ((pr->power.state - pr->power.states) > max_cstate) { + if (cx->demotion.state) + next_state = cx->demotion.state; + } + + /* + * New Cx State? + * ------------- + * If we're going to start using a new Cx state we must clean up + * from the previous and prepare to use the new. + */ + if (next_state != pr->power.state) + acpi_processor_power_activate(pr, next_state); + + return; + + easy_out: + /* do C1 instead of busy loop */ + if (pm_idle_save) + pm_idle_save(); + else + safe_halt(); + return; +} + + +static int +acpi_processor_set_power_policy ( + struct acpi_processor *pr) +{ + unsigned int i; + unsigned int state_is_set = 0; + struct acpi_processor_cx *lower = NULL; + struct acpi_processor_cx *higher = NULL; + struct acpi_processor_cx *cx; + + ACPI_FUNCTION_TRACE("acpi_processor_set_power_policy"); + + if (!pr) + return_VALUE(-EINVAL); + + /* + * This function sets the default Cx state policy (OS idle handler). + * Our scheme is to promote quickly to C2 but more conservatively + * to C3. We're favoring C2 for its characteristics of low latency + * (quick response), good power savings, and ability to allow bus + * mastering activity. Note that the Cx state policy is completely + * customizable and can be altered dynamically. + */ + + /* startup state */ + for (i=1; i < ACPI_PROCESSOR_MAX_POWER; i++) { + cx = &pr->power.states[i]; + if (!cx->valid) + continue; + + if (!state_is_set) + pr->power.state = cx; + state_is_set++; + break; + } + + if (!state_is_set) + return_VALUE(-ENODEV); + + /* demotion */ + for (i=1; i < ACPI_PROCESSOR_MAX_POWER; i++) { + cx = &pr->power.states[i]; + if (!cx->valid) + continue; + + if (lower) { + cx->demotion.state = lower; + cx->demotion.threshold.ticks = cx->latency_ticks; + cx->demotion.threshold.count = 1; + if (cx->type == ACPI_STATE_C3) + cx->demotion.threshold.bm = 0x0F; + } + + lower = cx; + } + + /* promotion */ + for (i = (ACPI_PROCESSOR_MAX_POWER - 1); i > 0; i--) { + cx = &pr->power.states[i]; + if (!cx->valid) + continue; + + if (higher) { + cx->promotion.state = higher; + cx->promotion.threshold.ticks = cx->latency_ticks; + if (cx->type >= ACPI_STATE_C2) + cx->promotion.threshold.count = 4; + else + cx->promotion.threshold.count = 10; + if (higher->type == ACPI_STATE_C3) + cx->promotion.threshold.bm = 0x0F; + } + + higher = cx; + } + + return_VALUE(0); +} + + +static int acpi_processor_get_power_info_fadt (struct acpi_processor *pr) +{ + int i; + + ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_fadt"); + + if (!pr) + return_VALUE(-EINVAL); + + if (!pr->pblk) + return_VALUE(-ENODEV); + + for (i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++) + memset(pr->power.states, 0, sizeof(struct acpi_processor_cx)); + + /* if info is obtained from pblk/fadt, type equals state */ + pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1; + pr->power.states[ACPI_STATE_C2].type = ACPI_STATE_C2; + pr->power.states[ACPI_STATE_C3].type = ACPI_STATE_C3; + + /* the C0 state only exists as a filler in our array, + * and all processors need to support C1 */ + pr->power.states[ACPI_STATE_C0].valid = 1; + pr->power.states[ACPI_STATE_C1].valid = 1; + + /* determine C2 and C3 address from pblk */ + pr->power.states[ACPI_STATE_C2].address = pr->pblk + 4; + pr->power.states[ACPI_STATE_C3].address = pr->pblk + 5; + + /* determine latencies from FADT */ + pr->power.states[ACPI_STATE_C2].latency = acpi_fadt.plvl2_lat; + pr->power.states[ACPI_STATE_C3].latency = acpi_fadt.plvl3_lat; + + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "lvl2[0x%08x] lvl3[0x%08x]\n", + pr->power.states[ACPI_STATE_C2].address, + pr->power.states[ACPI_STATE_C3].address)); + + return_VALUE(0); +} + + +static int acpi_processor_get_power_info_cst (struct acpi_processor *pr) +{ + acpi_status status = 0; + acpi_integer count; + int i; + struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; + union acpi_object *cst; + + ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_cst"); + + if (errata.smp) + return_VALUE(-ENODEV); + + if (nocst) + return_VALUE(-ENODEV); + + pr->power.count = 0; + for (i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++) + memset(pr->power.states, 0, sizeof(struct acpi_processor_cx)); + + status = acpi_evaluate_object(pr->handle, "_CST", NULL, &buffer); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No _CST, giving up\n")); + return_VALUE(-ENODEV); + } + + cst = (union acpi_object *) buffer.pointer; + + /* There must be at least 2 elements */ + if (!cst || (cst->type != ACPI_TYPE_PACKAGE) || cst->package.count < 2) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "not enough elements in _CST\n")); + status = -EFAULT; + goto end; + } + + count = cst->package.elements[0].integer.value; + + /* Validate number of power states. */ + if (count < 1 || count != cst->package.count - 1) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "count given by _CST is not valid\n")); + status = -EFAULT; + goto end; + } + + /* We support up to ACPI_PROCESSOR_MAX_POWER. */ + if (count > ACPI_PROCESSOR_MAX_POWER) { + printk(KERN_WARNING "Limiting number of power states to max (%d)\n", ACPI_PROCESSOR_MAX_POWER); + printk(KERN_WARNING "Please increase ACPI_PROCESSOR_MAX_POWER if needed.\n"); + count = ACPI_PROCESSOR_MAX_POWER; + } + + /* Tell driver that at least _CST is supported. */ + pr->flags.has_cst = 1; + + for (i = 1; i <= count; i++) { + union acpi_object *element; + union acpi_object *obj; + struct acpi_power_register *reg; + struct acpi_processor_cx cx; + + memset(&cx, 0, sizeof(cx)); + + element = (union acpi_object *) &(cst->package.elements[i]); + if (element->type != ACPI_TYPE_PACKAGE) + continue; + + if (element->package.count != 4) + continue; + + obj = (union acpi_object *) &(element->package.elements[0]); + + if (obj->type != ACPI_TYPE_BUFFER) + continue; + + reg = (struct acpi_power_register *) obj->buffer.pointer; + + if (reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO && + (reg->space_id != ACPI_ADR_SPACE_FIXED_HARDWARE)) + continue; + + cx.address = (reg->space_id == ACPI_ADR_SPACE_FIXED_HARDWARE) ? + 0 : reg->address; + + /* There should be an easy way to extract an integer... */ + obj = (union acpi_object *) &(element->package.elements[1]); + if (obj->type != ACPI_TYPE_INTEGER) + continue; + + cx.type = obj->integer.value; + + if ((cx.type != ACPI_STATE_C1) && + (reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO)) + continue; + + if ((cx.type < ACPI_STATE_C1) || + (cx.type > ACPI_STATE_C3)) + continue; + + obj = (union acpi_object *) &(element->package.elements[2]); + if (obj->type != ACPI_TYPE_INTEGER) + continue; + + cx.latency = obj->integer.value; + + obj = (union acpi_object *) &(element->package.elements[3]); + if (obj->type != ACPI_TYPE_INTEGER) + continue; + + cx.power = obj->integer.value; + + (pr->power.count)++; + memcpy(&(pr->power.states[pr->power.count]), &cx, sizeof(cx)); + } + + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d power states\n", pr->power.count)); + + /* Validate number of power states discovered */ + if (pr->power.count < 2) + status = -ENODEV; + +end: + acpi_os_free(buffer.pointer); + + return_VALUE(status); +} + + +static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx) +{ + ACPI_FUNCTION_TRACE("acpi_processor_get_power_verify_c2"); + + if (!cx->address) + return_VOID; + + /* + * C2 latency must be less than or equal to 100 + * microseconds. + */ + else if (cx->latency > ACPI_PROCESSOR_MAX_C2_LATENCY) { + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "latency too large [%d]\n", + cx->latency)); + return_VOID; + } + + /* We're (currently) only supporting C2 on UP */ + else if (errata.smp) { + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "C2 not supported in SMP mode\n")); + return_VOID; + } + + /* + * Otherwise we've met all of our C2 requirements. + * Normalize the C2 latency to expidite policy + */ + cx->valid = 1; + cx->latency_ticks = US_TO_PM_TIMER_TICKS(cx->latency); + + return_VOID; +} + + +static void acpi_processor_power_verify_c3( + struct acpi_processor *pr, + struct acpi_processor_cx *cx) +{ + ACPI_FUNCTION_TRACE("acpi_processor_get_power_verify_c3"); + + if (!cx->address) + return_VOID; + + /* + * C3 latency must be less than or equal to 1000 + * microseconds. + */ + else if (cx->latency > ACPI_PROCESSOR_MAX_C3_LATENCY) { + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "latency too large [%d]\n", + cx->latency)); + return_VOID; + } + + /* bus mastering control is necessary */ + else if (!pr->flags.bm_control) { + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "C3 support requires bus mastering control\n")); + return_VOID; + } + + /* We're (currently) only supporting C2 on UP */ + else if (errata.smp) { + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "C3 not supported in SMP mode\n")); + return_VOID; + } + + /* + * PIIX4 Erratum #18: We don't support C3 when Type-F (fast) + * DMA transfers are used by any ISA device to avoid livelock. + * Note that we could disable Type-F DMA (as recommended by + * the erratum), but this is known to disrupt certain ISA + * devices thus we take the conservative approach. + */ + else if (errata.piix4.fdma) { + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "C3 not supported on PIIX4 with Type-F DMA\n")); + return_VOID; + } + + /* + * Otherwise we've met all of our C3 requirements. + * Normalize the C3 latency to expidite policy. Enable + * checking of bus mastering status (bm_check) so we can + * use this in our C3 policy + */ + cx->valid = 1; + cx->latency_ticks = US_TO_PM_TIMER_TICKS(cx->latency); + pr->flags.bm_check = 1; + + return_VOID; +} + + +static int acpi_processor_power_verify(struct acpi_processor *pr) +{ + unsigned int i; + unsigned int working = 0; + + for (i=1; i < ACPI_PROCESSOR_MAX_POWER; i++) { + struct acpi_processor_cx *cx = &pr->power.states[i]; + + switch (cx->type) { + case ACPI_STATE_C1: + cx->valid = 1; + break; + + case ACPI_STATE_C2: + acpi_processor_power_verify_c2(cx); + break; + + case ACPI_STATE_C3: + acpi_processor_power_verify_c3(pr, cx); + break; + } + + if (cx->valid) + working++; + } + + return (working); +} + +static int acpi_processor_get_power_info ( + struct acpi_processor *pr) +{ + unsigned int i; + int result; + + ACPI_FUNCTION_TRACE("acpi_processor_get_power_info"); + + /* NOTE: the idle thread may not be running while calling + * this function */ + + result = acpi_processor_get_power_info_cst(pr); + if ((result) || (acpi_processor_power_verify(pr) < 2)) { + result = acpi_processor_get_power_info_fadt(pr); + if (result) + return_VALUE(result); + + if (acpi_processor_power_verify(pr) < 2) + return_VALUE(-ENODEV); + } + + /* + * Set Default Policy + * ------------------ + * Now that we know which states are supported, set the default + * policy. Note that this policy can be changed dynamically + * (e.g. encourage deeper sleeps to conserve battery life when + * not on AC). + */ + result = acpi_processor_set_power_policy(pr); + if (result) + return_VALUE(result); + + /* + * if one state of type C2 or C3 is available, mark this + * CPU as being "idle manageable" + */ + for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) { + if (pr->power.states[i].valid) + pr->power.count = i; + if ((pr->power.states[i].valid) && + (pr->power.states[i].type >= ACPI_STATE_C2)) + pr->flags.power = 1; + } + + return_VALUE(0); +} + +int acpi_processor_cst_has_changed (struct acpi_processor *pr) +{ + int result = 0; + + ACPI_FUNCTION_TRACE("acpi_processor_cst_has_changed"); + + if (!pr) + return_VALUE(-EINVAL); + + if (errata.smp || nocst) { + return_VALUE(-ENODEV); + } + + if (!pr->flags.power_setup_done) + return_VALUE(-ENODEV); + + /* Fall back to the default idle loop */ + pm_idle = pm_idle_save; + synchronize_kernel(); + + pr->flags.power = 0; + result = acpi_processor_get_power_info(pr); + if ((pr->flags.power == 1) && (pr->flags.power_setup_done)) + pm_idle = acpi_processor_idle; + + return_VALUE(result); +} + +/* proc interface */ + +static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset) +{ + struct acpi_processor *pr = (struct acpi_processor *)seq->private; + unsigned int i; + + ACPI_FUNCTION_TRACE("acpi_processor_power_seq_show"); + + if (!pr) + goto end; + + seq_printf(seq, "active state: C%d\n" + "max_cstate: C%d\n" + "bus master activity: %08x\n", + pr->power.state ? pr->power.state - pr->power.states : 0, + max_cstate, + pr->power.bm_activity); + + seq_puts(seq, "states:\n"); + + for (i = 1; i <= pr->power.count; i++) { + seq_printf(seq, " %cC%d: ", + (&pr->power.states[i] == pr->power.state?'*':' '), i); + + if (!pr->power.states[i].valid) { + seq_puts(seq, "\n"); + continue; + } + + switch (pr->power.states[i].type) { + case ACPI_STATE_C1: + seq_printf(seq, "type[C1] "); + break; + case ACPI_STATE_C2: + seq_printf(seq, "type[C2] "); + break; + case ACPI_STATE_C3: + seq_printf(seq, "type[C3] "); + break; + default: + seq_printf(seq, "type[--] "); + break; + } + + if (pr->power.states[i].promotion.state) + seq_printf(seq, "promotion[C%d] ", + (pr->power.states[i].promotion.state - + pr->power.states)); + else + seq_puts(seq, "promotion[--] "); + + if (pr->power.states[i].demotion.state) + seq_printf(seq, "demotion[C%d] ", + (pr->power.states[i].demotion.state - + pr->power.states)); + else + seq_puts(seq, "demotion[--] "); + + seq_printf(seq, "latency[%03d] usage[%08d]\n", + pr->power.states[i].latency, + pr->power.states[i].usage); + } + +end: + return_VALUE(0); +} + +static int acpi_processor_power_open_fs(struct inode *inode, struct file *file) +{ + return single_open(file, acpi_processor_power_seq_show, + PDE(inode)->data); +} + +static struct file_operations acpi_processor_power_fops = { + .open = acpi_processor_power_open_fs, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + + +int acpi_processor_power_init(struct acpi_processor *pr, struct acpi_device *device) +{ + acpi_status status = 0; + static int first_run = 0; + struct proc_dir_entry *entry = NULL; + unsigned int i; + + ACPI_FUNCTION_TRACE("acpi_processor_power_init"); + + if (!first_run) { + dmi_check_system(processor_power_dmi_table); + if (max_cstate < ACPI_C_STATES_MAX) + printk(KERN_NOTICE "ACPI: processor limited to max C-state %d\n", max_cstate); + first_run++; + } + + if (!errata.smp && (pr->id == 0) && acpi_fadt.cst_cnt && !nocst) { + status = acpi_os_write_port(acpi_fadt.smi_cmd, acpi_fadt.cst_cnt, 8); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Notifying BIOS of _CST ability failed\n")); + } + } + + acpi_processor_get_power_info(pr); + + /* + * Install the idle handler if processor power management is supported. + * Note that we use previously set idle handler will be used on + * platforms that only support C1. + */ + if ((pr->flags.power) && (!boot_option_idle_override)) { + printk(KERN_INFO PREFIX "CPU%d (power states:", pr->id); + for (i = 1; i <= pr->power.count; i++) + if (pr->power.states[i].valid) + printk(" C%d[C%d]", i, pr->power.states[i].type); + printk(")\n"); + + if (pr->id == 0) { + pm_idle_save = pm_idle; + pm_idle = acpi_processor_idle; + } + } + + /* 'power' [R] */ + entry = create_proc_entry(ACPI_PROCESSOR_FILE_POWER, + S_IRUGO, acpi_device_dir(device)); + if (!entry) + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unable to create '%s' fs entry\n", + ACPI_PROCESSOR_FILE_POWER)); + else { + entry->proc_fops = &acpi_processor_power_fops; + entry->data = acpi_driver_data(device); + entry->owner = THIS_MODULE; + } + + pr->flags.power_setup_done = 1; + + return_VALUE(0); +} + +int acpi_processor_power_exit(struct acpi_processor *pr, struct acpi_device *device) +{ + ACPI_FUNCTION_TRACE("acpi_processor_power_exit"); + + pr->flags.power_setup_done = 0; + + if (acpi_device_dir(device)) + remove_proc_entry(ACPI_PROCESSOR_FILE_POWER,acpi_device_dir(device)); + + /* Unregister the idle handler when processor #0 is removed. */ + if (pr->id == 0) { + pm_idle = pm_idle_save; + + /* + * We are about to unload the current idle thread pm callback + * (pm_idle), Wait for all processors to update cached/local + * copies of pm_idle before proceeding. + */ + synchronize_kernel(); + } + + return_VALUE(0); +} diff -Nru a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/acpi/processor_perflib.c 2005-01-02 23:03:35 -08:00 @@ -0,0 +1,666 @@ +/* + * processor_perflib.c - ACPI Processor P-States Library ($Revision: 71 $) + * + * Copyright (C) 2001, 2002 Andy Grover + * Copyright (C) 2001, 2002 Paul Diefenbaugh + * Copyright (C) 2004 Dominik Brodowski + * Copyright (C) 2004 Anil S Keshavamurthy + * - Added processor hotplug support + * + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + * + */ + + +#include +#include +#include +#include + +#ifdef CONFIG_X86_ACPI_CPUFREQ_PROC_INTF +#include +#include + +#include +#endif + +#include +#include + + +#define ACPI_PROCESSOR_COMPONENT 0x01000000 +#define ACPI_PROCESSOR_CLASS "processor" +#define ACPI_PROCESSOR_DRIVER_NAME "ACPI Processor Driver" +#define ACPI_PROCESSOR_FILE_PERFORMANCE "performance" +#define _COMPONENT ACPI_PROCESSOR_COMPONENT +ACPI_MODULE_NAME ("acpi_processor") + + +static DECLARE_MUTEX(performance_sem); + +/* + * _PPC support is implemented as a CPUfreq policy notifier: + * This means each time a CPUfreq driver registered also with + * the ACPI core is asked to change the speed policy, the maximum + * value is adjusted so that it is within the platform limit. + * + * Also, when a new platform limit value is detected, the CPUfreq + * policy is adjusted accordingly. + */ + +#define PPC_REGISTERED 1 +#define PPC_IN_USE 2 + +static int acpi_processor_ppc_status = 0; + +static int acpi_processor_ppc_notifier(struct notifier_block *nb, + unsigned long event, + void *data) +{ + struct cpufreq_policy *policy = data; + struct acpi_processor *pr; + unsigned int ppc = 0; + + down(&performance_sem); + + if (event != CPUFREQ_INCOMPATIBLE) + goto out; + + pr = processors[policy->cpu]; + if (!pr || !pr->performance) + goto out; + + ppc = (unsigned int) pr->performance_platform_limit; + if (!ppc) + goto out; + + if (ppc > pr->performance->state_count) + goto out; + + cpufreq_verify_within_limits(policy, 0, + pr->performance->states[ppc].core_frequency * 1000); + + out: + up(&performance_sem); + + return 0; +} + + +static struct notifier_block acpi_ppc_notifier_block = { + .notifier_call = acpi_processor_ppc_notifier, +}; + + +static int +acpi_processor_get_platform_limit ( + struct acpi_processor* pr) +{ + acpi_status status = 0; + unsigned long ppc = 0; + + ACPI_FUNCTION_TRACE("acpi_processor_get_platform_limit"); + + if (!pr) + return_VALUE(-EINVAL); + + /* + * _PPC indicates the maximum state currently supported by the platform + * (e.g. 0 = states 0..n; 1 = states 1..n; etc. + */ + status = acpi_evaluate_integer(pr->handle, "_PPC", NULL, &ppc); + + if (status != AE_NOT_FOUND) + acpi_processor_ppc_status |= PPC_IN_USE; + + if(ACPI_FAILURE(status) && status != AE_NOT_FOUND) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PPC\n")); + return_VALUE(-ENODEV); + } + + pr->performance_platform_limit = (int) ppc; + + return_VALUE(0); +} + + +int acpi_processor_ppc_has_changed( + struct acpi_processor *pr) +{ + int ret = acpi_processor_get_platform_limit(pr); + if (ret < 0) + return (ret); + else + return cpufreq_update_policy(pr->id); +} + + +void acpi_processor_ppc_init(void) { + if (!cpufreq_register_notifier(&acpi_ppc_notifier_block, CPUFREQ_POLICY_NOTIFIER)) + acpi_processor_ppc_status |= PPC_REGISTERED; + else + printk(KERN_DEBUG "Warning: Processor Platform Limit not supported.\n"); +} + + +void acpi_processor_ppc_exit(void) { + if (acpi_processor_ppc_status & PPC_REGISTERED) + cpufreq_unregister_notifier(&acpi_ppc_notifier_block, CPUFREQ_POLICY_NOTIFIER); + + acpi_processor_ppc_status &= ~PPC_REGISTERED; +} + +/* + * when registering a cpufreq driver with this ACPI processor driver, the + * _PCT and _PSS structures are read out and written into struct + * acpi_processor_performance. + */ +static int acpi_processor_set_pdc (struct acpi_processor *pr) +{ + acpi_status status = AE_OK; + u32 arg0_buf[3]; + union acpi_object arg0 = {ACPI_TYPE_BUFFER}; + struct acpi_object_list no_object = {1, &arg0}; + struct acpi_object_list *pdc; + + ACPI_FUNCTION_TRACE("acpi_processor_set_pdc"); + + arg0.buffer.length = 12; + arg0.buffer.pointer = (u8 *) arg0_buf; + arg0_buf[0] = ACPI_PDC_REVISION_ID; + arg0_buf[1] = 0; + arg0_buf[2] = 0; + + pdc = (pr->performance->pdc) ? pr->performance->pdc : &no_object; + + status = acpi_evaluate_object(pr->handle, "_PDC", pdc, NULL); + + if ((ACPI_FAILURE(status)) && (pr->performance->pdc)) + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Error evaluating _PDC, using legacy perf. control...\n")); + + return_VALUE(status); +} + + +static int +acpi_processor_get_performance_control ( + struct acpi_processor *pr) +{ + int result = 0; + acpi_status status = 0; + struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; + union acpi_object *pct = NULL; + union acpi_object obj = {0}; + + ACPI_FUNCTION_TRACE("acpi_processor_get_performance_control"); + + status = acpi_evaluate_object(pr->handle, "_PCT", NULL, &buffer); + if(ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PCT\n")); + return_VALUE(-ENODEV); + } + + pct = (union acpi_object *) buffer.pointer; + if (!pct || (pct->type != ACPI_TYPE_PACKAGE) + || (pct->package.count != 2)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _PCT data\n")); + result = -EFAULT; + goto end; + } + + /* + * control_register + */ + + obj = pct->package.elements[0]; + + if ((obj.type != ACPI_TYPE_BUFFER) + || (obj.buffer.length < sizeof(struct acpi_pct_register)) + || (obj.buffer.pointer == NULL)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Invalid _PCT data (control_register)\n")); + result = -EFAULT; + goto end; + } + memcpy(&pr->performance->control_register, obj.buffer.pointer, sizeof(struct acpi_pct_register)); + + + /* + * status_register + */ + + obj = pct->package.elements[1]; + + if ((obj.type != ACPI_TYPE_BUFFER) + || (obj.buffer.length < sizeof(struct acpi_pct_register)) + || (obj.buffer.pointer == NULL)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Invalid _PCT data (status_register)\n")); + result = -EFAULT; + goto end; + } + + memcpy(&pr->performance->status_register, obj.buffer.pointer, sizeof(struct acpi_pct_register)); + +end: + acpi_os_free(buffer.pointer); + + return_VALUE(result); +} + + +static int +acpi_processor_get_performance_states ( + struct acpi_processor *pr) +{ + int result = 0; + acpi_status status = AE_OK; + struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; + struct acpi_buffer format = {sizeof("NNNNNN"), "NNNNNN"}; + struct acpi_buffer state = {0, NULL}; + union acpi_object *pss = NULL; + int i; + + ACPI_FUNCTION_TRACE("acpi_processor_get_performance_states"); + + status = acpi_evaluate_object(pr->handle, "_PSS", NULL, &buffer); + if(ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PSS\n")); + return_VALUE(-ENODEV); + } + + pss = (union acpi_object *) buffer.pointer; + if (!pss || (pss->type != ACPI_TYPE_PACKAGE)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _PSS data\n")); + result = -EFAULT; + goto end; + } + + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d performance states\n", + pss->package.count)); + + pr->performance->state_count = pss->package.count; + pr->performance->states = kmalloc(sizeof(struct acpi_processor_px) * pss->package.count, GFP_KERNEL); + if (!pr->performance->states) { + result = -ENOMEM; + goto end; + } + + for (i = 0; i < pr->performance->state_count; i++) { + + struct acpi_processor_px *px = &(pr->performance->states[i]); + + state.length = sizeof(struct acpi_processor_px); + state.pointer = px; + + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Extracting state %d\n", i)); + + status = acpi_extract_package(&(pss->package.elements[i]), + &format, &state); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _PSS data\n")); + result = -EFAULT; + kfree(pr->performance->states); + goto end; + } + + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "State [%d]: core_frequency[%d] power[%d] transition_latency[%d] bus_master_latency[%d] control[0x%x] status[0x%x]\n", + i, + (u32) px->core_frequency, + (u32) px->power, + (u32) px->transition_latency, + (u32) px->bus_master_latency, + (u32) px->control, + (u32) px->status)); + + if (!px->core_frequency) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _PSS data: freq is zero\n")); + result = -EFAULT; + kfree(pr->performance->states); + goto end; + } + } + +end: + acpi_os_free(buffer.pointer); + + return_VALUE(result); +} + + +static int +acpi_processor_get_performance_info ( + struct acpi_processor *pr) +{ + int result = 0; + acpi_status status = AE_OK; + acpi_handle handle = NULL; + + ACPI_FUNCTION_TRACE("acpi_processor_get_performance_info"); + + if (!pr || !pr->performance || !pr->handle) + return_VALUE(-EINVAL); + + acpi_processor_set_pdc(pr); + + status = acpi_get_handle(pr->handle, "_PCT", &handle); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "ACPI-based processor performance control unavailable\n")); + return_VALUE(-ENODEV); + } + + result = acpi_processor_get_performance_control(pr); + if (result) + return_VALUE(result); + + result = acpi_processor_get_performance_states(pr); + if (result) + return_VALUE(result); + + result = acpi_processor_get_platform_limit(pr); + if (result) + return_VALUE(result); + + return_VALUE(0); +} + + +int acpi_processor_notify_smm(struct module *calling_module) { + acpi_status status; + static int is_done = 0; + + ACPI_FUNCTION_TRACE("acpi_processor_notify_smm"); + + if (!(acpi_processor_ppc_status & PPC_REGISTERED)) + return_VALUE(-EBUSY); + + if (!try_module_get(calling_module)) + return_VALUE(-EINVAL); + + /* is_done is set to negative if an error occured, + * and to postitive if _no_ error occured, but SMM + * was already notified. This avoids double notification + * which might lead to unexpected results... + */ + if (is_done > 0) { + module_put(calling_module); + return_VALUE(0); + } + else if (is_done < 0) { + module_put(calling_module); + return_VALUE(is_done); + } + + is_done = -EIO; + + /* Can't write pstate_cnt to smi_cmd if either value is zero */ + if ((!acpi_fadt.smi_cmd) || + (!acpi_fadt.pstate_cnt)) { + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "No SMI port or pstate_cnt\n")); + module_put(calling_module); + return_VALUE(0); + } + + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Writing pstate_cnt [0x%x] to smi_cmd [0x%x]\n", acpi_fadt.pstate_cnt, acpi_fadt.smi_cmd)); + + /* FADT v1 doesn't support pstate_cnt, many BIOS vendors use + * it anyway, so we need to support it... */ + if (acpi_fadt_is_v1) { + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Using v1.0 FADT reserved value for pstate_cnt\n")); + } + + status = acpi_os_write_port (acpi_fadt.smi_cmd, + (u32) acpi_fadt.pstate_cnt, 8); + if (ACPI_FAILURE (status)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Failed to write pstate_cnt [0x%x] to " + "smi_cmd [0x%x]\n", acpi_fadt.pstate_cnt, acpi_fadt.smi_cmd)); + module_put(calling_module); + return_VALUE(status); + } + + /* Success. If there's no _PPC, we need to fear nothing, so + * we can allow the cpufreq driver to be rmmod'ed. */ + is_done = 1; + + if (!(acpi_processor_ppc_status & PPC_IN_USE)) + module_put(calling_module); + + return_VALUE(0); +} +EXPORT_SYMBOL(acpi_processor_notify_smm); + + +#ifdef CONFIG_X86_ACPI_CPUFREQ_PROC_INTF +/* /proc/acpi/processor/../performance interface (DEPRECATED) */ + +static int acpi_processor_perf_open_fs(struct inode *inode, struct file *file); +static struct file_operations acpi_processor_perf_fops = { + .open = acpi_processor_perf_open_fs, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + +static int acpi_processor_perf_seq_show(struct seq_file *seq, void *offset) +{ + struct acpi_processor *pr = (struct acpi_processor *)seq->private; + int i; + + ACPI_FUNCTION_TRACE("acpi_processor_perf_seq_show"); + + if (!pr) + goto end; + + if (!pr->performance) { + seq_puts(seq, "\n"); + goto end; + } + + seq_printf(seq, "state count: %d\n" + "active state: P%d\n", + pr->performance->state_count, + pr->performance->state); + + seq_puts(seq, "states:\n"); + for (i = 0; i < pr->performance->state_count; i++) + seq_printf(seq, " %cP%d: %d MHz, %d mW, %d uS\n", + (i == pr->performance->state?'*':' '), i, + (u32) pr->performance->states[i].core_frequency, + (u32) pr->performance->states[i].power, + (u32) pr->performance->states[i].transition_latency); + +end: + return_VALUE(0); +} + +static int acpi_processor_perf_open_fs(struct inode *inode, struct file *file) +{ + return single_open(file, acpi_processor_perf_seq_show, + PDE(inode)->data); +} + +static ssize_t +acpi_processor_write_performance ( + struct file *file, + const char __user *buffer, + size_t count, + loff_t *data) +{ + int result = 0; + struct seq_file *m = (struct seq_file *) file->private_data; + struct acpi_processor *pr = (struct acpi_processor *) m->private; + struct acpi_processor_performance *perf; + char state_string[12] = {'\0'}; + unsigned int new_state = 0; + struct cpufreq_policy policy; + + ACPI_FUNCTION_TRACE("acpi_processor_write_performance"); + + if (!pr || (count > sizeof(state_string) - 1)) + return_VALUE(-EINVAL); + + perf = pr->performance; + if (!perf) + return_VALUE(-EINVAL); + + if (copy_from_user(state_string, buffer, count)) + return_VALUE(-EFAULT); + + state_string[count] = '\0'; + new_state = simple_strtoul(state_string, NULL, 0); + + if (new_state >= perf->state_count) + return_VALUE(-EINVAL); + + cpufreq_get_policy(&policy, pr->id); + + policy.cpu = pr->id; + policy.min = perf->states[new_state].core_frequency * 1000; + policy.max = perf->states[new_state].core_frequency * 1000; + + result = cpufreq_set_policy(&policy); + if (result) + return_VALUE(result); + + return_VALUE(count); +} + +static void +acpi_cpufreq_add_file ( + struct acpi_processor *pr) +{ + struct proc_dir_entry *entry = NULL; + struct acpi_device *device = NULL; + + ACPI_FUNCTION_TRACE("acpi_cpufreq_addfile"); + + if (acpi_bus_get_device(pr->handle, &device)) + return_VOID; + + /* add file 'performance' [R/W] */ + entry = create_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE, + S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device)); + if (!entry) + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unable to create '%s' fs entry\n", + ACPI_PROCESSOR_FILE_PERFORMANCE)); + else { + entry->proc_fops = &acpi_processor_perf_fops; + entry->proc_fops->write = acpi_processor_write_performance; + entry->data = acpi_driver_data(device); + entry->owner = THIS_MODULE; + } + return_VOID; +} + +static void +acpi_cpufreq_remove_file ( + struct acpi_processor *pr) +{ + struct acpi_device *device = NULL; + + ACPI_FUNCTION_TRACE("acpi_cpufreq_addfile"); + + if (acpi_bus_get_device(pr->handle, &device)) + return_VOID; + + /* remove file 'performance' */ + remove_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE, + acpi_device_dir(device)); + + return_VOID; +} + +#else +static void acpi_cpufreq_add_file (struct acpi_processor *pr) { return; } +static void acpi_cpufreq_remove_file (struct acpi_processor *pr) { return; } +#endif /* CONFIG_X86_ACPI_CPUFREQ_PROC_INTF */ + + +int +acpi_processor_register_performance ( + struct acpi_processor_performance * performance, + unsigned int cpu) +{ + struct acpi_processor *pr; + + ACPI_FUNCTION_TRACE("acpi_processor_register_performance"); + + if (!(acpi_processor_ppc_status & PPC_REGISTERED)) + return_VALUE(-EINVAL); + + down(&performance_sem); + + pr = processors[cpu]; + if (!pr) { + up(&performance_sem); + return_VALUE(-ENODEV); + } + + if (pr->performance) { + up(&performance_sem); + return_VALUE(-EBUSY); + } + + pr->performance = performance; + + if (acpi_processor_get_performance_info(pr)) { + pr->performance = NULL; + up(&performance_sem); + return_VALUE(-EIO); + } + + acpi_cpufreq_add_file(pr); + + up(&performance_sem); + return_VALUE(0); +} +EXPORT_SYMBOL(acpi_processor_register_performance); + + +void +acpi_processor_unregister_performance ( + struct acpi_processor_performance * performance, + unsigned int cpu) +{ + struct acpi_processor *pr; + + ACPI_FUNCTION_TRACE("acpi_processor_unregister_performance"); + + down(&performance_sem); + + pr = processors[cpu]; + if (!pr) { + up(&performance_sem); + return_VOID; + } + + kfree(pr->performance->states); + pr->performance = NULL; + + acpi_cpufreq_remove_file(pr); + + up(&performance_sem); + + return_VOID; +} +EXPORT_SYMBOL(acpi_processor_unregister_performance); diff -Nru a/drivers/acpi/processor_thermal.c b/drivers/acpi/processor_thermal.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/acpi/processor_thermal.c 2005-01-02 23:03:35 -08:00 @@ -0,0 +1,406 @@ +/* + * processor_thermal.c - Passive cooling submodule of the ACPI processor driver + * + * Copyright (C) 2001, 2002 Andy Grover + * Copyright (C) 2001, 2002 Paul Diefenbaugh + * Copyright (C) 2004 Dominik Brodowski + * Copyright (C) 2004 Anil S Keshavamurthy + * - Added processor hotplug support + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + */ + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#define ACPI_PROCESSOR_COMPONENT 0x01000000 +#define ACPI_PROCESSOR_CLASS "processor" +#define ACPI_PROCESSOR_DRIVER_NAME "ACPI Processor Driver" +#define _COMPONENT ACPI_PROCESSOR_COMPONENT +ACPI_MODULE_NAME ("acpi_processor") + + +/* -------------------------------------------------------------------------- + Limit Interface + -------------------------------------------------------------------------- */ + +static int +acpi_processor_apply_limit ( + struct acpi_processor* pr) +{ + int result = 0; + u16 px = 0; + u16 tx = 0; + + ACPI_FUNCTION_TRACE("acpi_processor_apply_limit"); + + if (!pr) + return_VALUE(-EINVAL); + + if (!pr->flags.limit) + return_VALUE(-ENODEV); + + if (pr->flags.throttling) { + if (pr->limit.user.tx > tx) + tx = pr->limit.user.tx; + if (pr->limit.thermal.tx > tx) + tx = pr->limit.thermal.tx; + + result = acpi_processor_set_throttling(pr, tx); + if (result) + goto end; + } + + pr->limit.state.px = px; + pr->limit.state.tx = tx; + + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Processor [%d] limit set to (P%d:T%d)\n", + pr->id, + pr->limit.state.px, + pr->limit.state.tx)); + +end: + if (result) + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to set limit\n")); + + return_VALUE(result); +} + + +#ifdef CONFIG_CPU_FREQ + +/* If a passive cooling situation is detected, primarily CPUfreq is used, as it + * offers (in most cases) voltage scaling in addition to frequency scaling, and + * thus a cubic (instead of linear) reduction of energy. Also, we allow for + * _any_ cpufreq driver and not only the acpi-cpufreq driver. + */ + +static unsigned int cpufreq_thermal_reduction_pctg[NR_CPUS]; +static unsigned int acpi_thermal_cpufreq_is_init = 0; + + +static int cpu_has_cpufreq(unsigned int cpu) +{ + struct cpufreq_policy policy; + if (!acpi_thermal_cpufreq_is_init) + return -ENODEV; + if (!cpufreq_get_policy(&policy, cpu)) + return -ENODEV; + return 0; +} + + +static int acpi_thermal_cpufreq_increase(unsigned int cpu) +{ + if (!cpu_has_cpufreq(cpu)) + return -ENODEV; + + if (cpufreq_thermal_reduction_pctg[cpu] < 60) { + cpufreq_thermal_reduction_pctg[cpu] += 20; + cpufreq_update_policy(cpu); + return 0; + } + + return -ERANGE; +} + + +static int acpi_thermal_cpufreq_decrease(unsigned int cpu) +{ + if (!cpu_has_cpufreq(cpu)) + return -ENODEV; + + if (cpufreq_thermal_reduction_pctg[cpu] >= 20) { + cpufreq_thermal_reduction_pctg[cpu] -= 20; + cpufreq_update_policy(cpu); + return 0; + } + + return -ERANGE; +} + + +static int acpi_thermal_cpufreq_notifier( + struct notifier_block *nb, + unsigned long event, + void *data) +{ + struct cpufreq_policy *policy = data; + unsigned long max_freq = 0; + + if (event != CPUFREQ_ADJUST) + goto out; + + max_freq = (policy->cpuinfo.max_freq * (100 - cpufreq_thermal_reduction_pctg[policy->cpu])) / 100; + + cpufreq_verify_within_limits(policy, 0, max_freq); + + out: + return 0; +} + + +static struct notifier_block acpi_thermal_cpufreq_notifier_block = { + .notifier_call = acpi_thermal_cpufreq_notifier, +}; + + +void acpi_thermal_cpufreq_init(void) { + int i; + + for (i=0; i ACPI_PROCESSOR_LIMIT_DECREMENT)) + return_VALUE(-EINVAL); + + result = acpi_bus_get_device(handle, &device); + if (result) + return_VALUE(result); + + pr = (struct acpi_processor *) acpi_driver_data(device); + if (!pr) + return_VALUE(-ENODEV); + + /* Thermal limits are always relative to the current Px/Tx state. */ + if (pr->flags.throttling) + pr->limit.thermal.tx = pr->throttling.state; + + /* + * Our default policy is to only use throttling at the lowest + * performance state. + */ + + tx = pr->limit.thermal.tx; + + switch (type) { + + case ACPI_PROCESSOR_LIMIT_NONE: + do { + result = acpi_thermal_cpufreq_decrease(pr->id); + } while (!result); + tx = 0; + break; + + case ACPI_PROCESSOR_LIMIT_INCREMENT: + /* if going up: P-states first, T-states later */ + + result = acpi_thermal_cpufreq_increase(pr->id); + if (!result) + goto end; + else if (result == -ERANGE) + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "At maximum performance state\n")); + + if (pr->flags.throttling) { + if (tx == (pr->throttling.state_count - 1)) + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "At maximum throttling state\n")); + else + tx++; + } + break; + + case ACPI_PROCESSOR_LIMIT_DECREMENT: + /* if going down: T-states first, P-states later */ + + if (pr->flags.throttling) { + if (tx == 0) + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "At minimum throttling state\n")); + else { + tx--; + goto end; + } + } + + result = acpi_thermal_cpufreq_decrease(pr->id); + if (result == -ERANGE) + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "At minimum performance state\n")); + + break; + } + +end: + if (pr->flags.throttling) { + pr->limit.thermal.px = 0; + pr->limit.thermal.tx = tx; + + result = acpi_processor_apply_limit(pr); + if (result) + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unable to set thermal limit\n")); + + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Thermal limit now (P%d:T%d)\n", + pr->limit.thermal.px, + pr->limit.thermal.tx)); + } else + result = 0; + + return_VALUE(result); +} + + +int +acpi_processor_get_limit_info ( + struct acpi_processor *pr) +{ + ACPI_FUNCTION_TRACE("acpi_processor_get_limit_info"); + + if (!pr) + return_VALUE(-EINVAL); + + if (pr->flags.throttling) + pr->flags.limit = 1; + + return_VALUE(0); +} + + +/* /proc interface */ + +static int acpi_processor_limit_seq_show(struct seq_file *seq, void *offset) +{ + struct acpi_processor *pr = (struct acpi_processor *)seq->private; + + ACPI_FUNCTION_TRACE("acpi_processor_limit_seq_show"); + + if (!pr) + goto end; + + if (!pr->flags.limit) { + seq_puts(seq, "\n"); + goto end; + } + + seq_printf(seq, "active limit: P%d:T%d\n" + "user limit: P%d:T%d\n" + "thermal limit: P%d:T%d\n", + pr->limit.state.px, pr->limit.state.tx, + pr->limit.user.px, pr->limit.user.tx, + pr->limit.thermal.px, pr->limit.thermal.tx); + +end: + return_VALUE(0); +} + +int acpi_processor_limit_open_fs(struct inode *inode, struct file *file) +{ + return single_open(file, acpi_processor_limit_seq_show, + PDE(inode)->data); +} + +ssize_t acpi_processor_write_limit ( + struct file *file, + const char __user *buffer, + size_t count, + loff_t *data) +{ + int result = 0; + struct seq_file *m = (struct seq_file *)file->private_data; + struct acpi_processor *pr = (struct acpi_processor *)m->private; + char limit_string[25] = {'\0'}; + int px = 0; + int tx = 0; + + ACPI_FUNCTION_TRACE("acpi_processor_write_limit"); + + if (!pr || (count > sizeof(limit_string) - 1)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument\n")); + return_VALUE(-EINVAL); + } + + if (copy_from_user(limit_string, buffer, count)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data\n")); + return_VALUE(-EFAULT); + } + + limit_string[count] = '\0'; + + if (sscanf(limit_string, "%d:%d", &px, &tx) != 2) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data format\n")); + return_VALUE(-EINVAL); + } + + if (pr->flags.throttling) { + if ((tx < 0) || (tx > (pr->throttling.state_count - 1))) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid tx\n")); + return_VALUE(-EINVAL); + } + pr->limit.user.tx = tx; + } + + result = acpi_processor_apply_limit(pr); + + return_VALUE(count); +} + + +struct file_operations acpi_processor_limit_fops = { + .open = acpi_processor_limit_open_fs, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + diff -Nru a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/acpi/processor_throttling.c 2005-01-02 23:03:35 -08:00 @@ -0,0 +1,351 @@ +/* + * processor_throttling.c - Throttling submodule of the ACPI processor driver + * + * Copyright (C) 2001, 2002 Andy Grover + * Copyright (C) 2001, 2002 Paul Diefenbaugh + * Copyright (C) 2004 Dominik Brodowski + * Copyright (C) 2004 Anil S Keshavamurthy + * - Added processor hotplug support + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + */ + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#define ACPI_PROCESSOR_COMPONENT 0x01000000 +#define ACPI_PROCESSOR_CLASS "processor" +#define ACPI_PROCESSOR_DRIVER_NAME "ACPI Processor Driver" +#define _COMPONENT ACPI_PROCESSOR_COMPONENT +ACPI_MODULE_NAME ("acpi_processor") + + +/* -------------------------------------------------------------------------- + Throttling Control + -------------------------------------------------------------------------- */ + +static int +acpi_processor_get_throttling ( + struct acpi_processor *pr) +{ + int state = 0; + u32 value = 0; + u32 duty_mask = 0; + u32 duty_value = 0; + + ACPI_FUNCTION_TRACE("acpi_processor_get_throttling"); + + if (!pr) + return_VALUE(-EINVAL); + + if (!pr->flags.throttling) + return_VALUE(-ENODEV); + + pr->throttling.state = 0; + + duty_mask = pr->throttling.state_count - 1; + + duty_mask <<= pr->throttling.duty_offset; + + local_irq_disable(); + + value = inl(pr->throttling.address); + + /* + * Compute the current throttling state when throttling is enabled + * (bit 4 is on). + */ + if (value & 0x10) { + duty_value = value & duty_mask; + duty_value >>= pr->throttling.duty_offset; + + if (duty_value) + state = pr->throttling.state_count-duty_value; + } + + pr->throttling.state = state; + + local_irq_enable(); + + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Throttling state is T%d (%d%% throttling applied)\n", + state, pr->throttling.states[state].performance)); + + return_VALUE(0); +} + + +int acpi_processor_set_throttling ( + struct acpi_processor *pr, + int state) +{ + u32 value = 0; + u32 duty_mask = 0; + u32 duty_value = 0; + + ACPI_FUNCTION_TRACE("acpi_processor_set_throttling"); + + if (!pr) + return_VALUE(-EINVAL); + + if ((state < 0) || (state > (pr->throttling.state_count - 1))) + return_VALUE(-EINVAL); + + if (!pr->flags.throttling) + return_VALUE(-ENODEV); + + if (state == pr->throttling.state) + return_VALUE(0); + + /* + * Calculate the duty_value and duty_mask. + */ + if (state) { + duty_value = pr->throttling.state_count - state; + + duty_value <<= pr->throttling.duty_offset; + + /* Used to clear all duty_value bits */ + duty_mask = pr->throttling.state_count - 1; + + duty_mask <<= acpi_fadt.duty_offset; + duty_mask = ~duty_mask; + } + + local_irq_disable(); + + /* + * Disable throttling by writing a 0 to bit 4. Note that we must + * turn it off before you can change the duty_value. + */ + value = inl(pr->throttling.address); + if (value & 0x10) { + value &= 0xFFFFFFEF; + outl(value, pr->throttling.address); + } + + /* + * Write the new duty_value and then enable throttling. Note + * that a state value of 0 leaves throttling disabled. + */ + if (state) { + value &= duty_mask; + value |= duty_value; + outl(value, pr->throttling.address); + + value |= 0x00000010; + outl(value, pr->throttling.address); + } + + pr->throttling.state = state; + + local_irq_enable(); + + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Throttling state set to T%d (%d%%)\n", state, + (pr->throttling.states[state].performance?pr->throttling.states[state].performance/10:0))); + + return_VALUE(0); +} + + +int +acpi_processor_get_throttling_info ( + struct acpi_processor *pr) +{ + int result = 0; + int step = 0; + int i = 0; + + ACPI_FUNCTION_TRACE("acpi_processor_get_throttling_info"); + + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "pblk_address[0x%08x] duty_offset[%d] duty_width[%d]\n", + pr->throttling.address, + pr->throttling.duty_offset, + pr->throttling.duty_width)); + + if (!pr) + return_VALUE(-EINVAL); + + /* TBD: Support ACPI 2.0 objects */ + + if (!pr->throttling.address) { + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling register\n")); + return_VALUE(0); + } + else if (!pr->throttling.duty_width) { + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling states\n")); + return_VALUE(0); + } + /* TBD: Support duty_cycle values that span bit 4. */ + else if ((pr->throttling.duty_offset + + pr->throttling.duty_width) > 4) { + ACPI_DEBUG_PRINT((ACPI_DB_WARN, "duty_cycle spans bit 4\n")); + return_VALUE(0); + } + + /* + * PIIX4 Errata: We don't support throttling on the original PIIX4. + * This shouldn't be an issue as few (if any) mobile systems ever + * used this part. + */ + if (errata.piix4.throttle) { + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Throttling not supported on PIIX4 A- or B-step\n")); + return_VALUE(0); + } + + pr->throttling.state_count = 1 << acpi_fadt.duty_width; + + /* + * Compute state values. Note that throttling displays a linear power/ + * performance relationship (at 50% performance the CPU will consume + * 50% power). Values are in 1/10th of a percent to preserve accuracy. + */ + + step = (1000 / pr->throttling.state_count); + + for (i=0; ithrottling.state_count; i++) { + pr->throttling.states[i].performance = step * i; + pr->throttling.states[i].power = step * i; + } + + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d throttling states\n", + pr->throttling.state_count)); + + pr->flags.throttling = 1; + + /* + * Disable throttling (if enabled). We'll let subsequent policy (e.g. + * thermal) decide to lower performance if it so chooses, but for now + * we'll crank up the speed. + */ + + result = acpi_processor_get_throttling(pr); + if (result) + goto end; + + if (pr->throttling.state) { + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Disabling throttling (was T%d)\n", + pr->throttling.state)); + result = acpi_processor_set_throttling(pr, 0); + if (result) + goto end; + } + +end: + if (result) + pr->flags.throttling = 0; + + return_VALUE(result); +} + + +/* proc interface */ + +static int acpi_processor_throttling_seq_show(struct seq_file *seq, void *offset) +{ + struct acpi_processor *pr = (struct acpi_processor *)seq->private; + int i = 0; + int result = 0; + + ACPI_FUNCTION_TRACE("acpi_processor_throttling_seq_show"); + + if (!pr) + goto end; + + if (!(pr->throttling.state_count > 0)) { + seq_puts(seq, "\n"); + goto end; + } + + result = acpi_processor_get_throttling(pr); + + if (result) { + seq_puts(seq, "Could not determine current throttling state.\n"); + goto end; + } + + seq_printf(seq, "state count: %d\n" + "active state: T%d\n", + pr->throttling.state_count, + pr->throttling.state); + + seq_puts(seq, "states:\n"); + for (i = 0; i < pr->throttling.state_count; i++) + seq_printf(seq, " %cT%d: %02d%%\n", + (i == pr->throttling.state?'*':' '), i, + (pr->throttling.states[i].performance?pr->throttling.states[i].performance/10:0)); + +end: + return_VALUE(0); +} + +int acpi_processor_throttling_open_fs(struct inode *inode, struct file *file) +{ + return single_open(file, acpi_processor_throttling_seq_show, + PDE(inode)->data); +} + +ssize_t acpi_processor_write_throttling ( + struct file *file, + const char __user *buffer, + size_t count, + loff_t *data) +{ + int result = 0; + struct seq_file *m = (struct seq_file *)file->private_data; + struct acpi_processor *pr = (struct acpi_processor *)m->private; + char state_string[12] = {'\0'}; + + ACPI_FUNCTION_TRACE("acpi_processor_write_throttling"); + + if (!pr || (count > sizeof(state_string) - 1)) + return_VALUE(-EINVAL); + + if (copy_from_user(state_string, buffer, count)) + return_VALUE(-EFAULT); + + state_string[count] = '\0'; + + result = acpi_processor_set_throttling(pr, + simple_strtoul(state_string, NULL, 0)); + if (result) + return_VALUE(result); + + return_VALUE(count); +} + +struct file_operations acpi_processor_throttling_fops = { + .open = acpi_processor_throttling_open_fs, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; diff -Nru a/drivers/acpi/scan.c b/drivers/acpi/scan.c --- a/drivers/acpi/scan.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/acpi/scan.c 2005-01-02 23:03:33 -08:00 @@ -2,9 +2,9 @@ * scan.c - support for transforming the ACPI namespace into individual objects */ +#include #include #include -#include #include #include /* for acpi_ex_eisa_id_to_string() */ @@ -35,7 +35,49 @@ kfree(dev); } +struct acpi_device_attribute { + struct attribute attr; + ssize_t (*show)(struct acpi_device *, char *); + ssize_t (*store)(struct acpi_device *, const char *, size_t); +}; + +typedef void acpi_device_sysfs_files(struct kobject *, + const struct attribute *); + +static void setup_sys_fs_device_files(struct acpi_device *dev, + acpi_device_sysfs_files *func); + +#define create_sysfs_device_files(dev) \ + setup_sys_fs_device_files(dev, (acpi_device_sysfs_files *)&sysfs_create_file) +#define remove_sysfs_device_files(dev) \ + setup_sys_fs_device_files(dev, (acpi_device_sysfs_files *)&sysfs_remove_file) + + +#define to_acpi_device(n) container_of(n, struct acpi_device, kobj) +#define to_handle_attr(n) container_of(n, struct acpi_device_attribute, attr); + +static ssize_t acpi_device_attr_show(struct kobject *kobj, + struct attribute *attr, char *buf) +{ + struct acpi_device *device = to_acpi_device(kobj); + struct acpi_device_attribute *attribute = to_handle_attr(attr); + return attribute->show ? attribute->show(device, buf) : 0; +} +static ssize_t acpi_device_attr_store(struct kobject *kobj, + struct attribute *attr, const char *buf, size_t len) +{ + struct acpi_device *device = to_acpi_device(kobj); + struct acpi_device_attribute *attribute = to_handle_attr(attr); + return attribute->store ? attribute->store(device, buf, len) : len; +} + +static struct sysfs_ops acpi_device_sysfs_ops = { + .show = acpi_device_attr_show, + .store = acpi_device_attr_store, +}; + static struct kobj_type ktype_acpi_ns = { + .sysfs_ops = &acpi_device_sysfs_ops, .release = acpi_device_release, }; @@ -58,6 +100,7 @@ INIT_LIST_HEAD(&device->children); INIT_LIST_HEAD(&device->node); INIT_LIST_HEAD(&device->g_list); + INIT_LIST_HEAD(&device->wakeup_list); spin_lock(&acpi_device_lock); if (device->parent) { @@ -65,15 +108,17 @@ list_add_tail(&device->g_list,&device->parent->g_list); } else list_add_tail(&device->g_list,&acpi_device_list); + if (device->wakeup.flags.valid) + list_add_tail(&device->wakeup_list,&acpi_wakeup_device_list); spin_unlock(&acpi_device_lock); - kobject_init(&device->kobj); strlcpy(device->kobj.name,device->pnp.bus_id,KOBJ_NAME_LEN); if (parent) device->kobj.parent = &parent->kobj; device->kobj.ktype = &ktype_acpi_ns; device->kobj.kset = &acpi_namespace_kset; - kobject_add(&device->kobj); + kobject_register(&device->kobj); + create_sysfs_device_files(device); } static int @@ -81,6 +126,19 @@ struct acpi_device *device, int type) { + spin_lock(&acpi_device_lock); + if (device->parent) { + list_del(&device->node); + list_del(&device->g_list); + } else + list_del(&device->g_list); + + list_del(&device->wakeup_list); + + spin_unlock(&acpi_device_lock); + + acpi_detach_data(device->handle, acpi_bus_data_handler); + remove_sysfs_device_files(device); kobject_unregister(&device->kobj); return 0; } @@ -272,12 +330,6 @@ if (!acpi_match_ids(device, "PNP0C0D,PNP0C0C,PNP0C0E")) device->wakeup.flags.run_wake = 1; - /* TBD: lock */ - INIT_LIST_HEAD(&device->wakeup_list); - spin_lock(&acpi_device_lock); - list_add_tail(&device->wakeup_list, &acpi_wakeup_device_list); - spin_unlock(&acpi_device_lock); - end: if (ACPI_FAILURE(status)) device->flags.wake_capable = 0; @@ -285,6 +337,114 @@ } /* -------------------------------------------------------------------------- + ACPI hotplug sysfs device file support + -------------------------------------------------------------------------- */ +static ssize_t acpi_eject_store(struct acpi_device *device, + const char *buf, size_t count); + +#define ACPI_DEVICE_ATTR(_name,_mode,_show,_store) \ +static struct acpi_device_attribute acpi_device_attr_##_name = \ + __ATTR(_name, _mode, _show, _store) + +ACPI_DEVICE_ATTR(eject, 0200, NULL, acpi_eject_store); + +/** + * setup_sys_fs_device_files - sets up the device files under device namespace + * @@dev: acpi_device object + * @@func: function pointer to create or destroy the device file + */ +static void +setup_sys_fs_device_files ( + struct acpi_device *dev, + acpi_device_sysfs_files *func) +{ + if (dev->flags.ejectable == 1) + (*(func))(&dev->kobj,&acpi_device_attr_eject.attr); +} + +static int +acpi_eject_operation(acpi_handle handle, int lockable) +{ + struct acpi_object_list arg_list; + union acpi_object arg; + acpi_status status = AE_OK; + + /* + * TBD: evaluate _PS3? + */ + + if (lockable) { + arg_list.count = 1; + arg_list.pointer = &arg; + arg.type = ACPI_TYPE_INTEGER; + arg.integer.value = 0; + acpi_evaluate_object(handle, "_LCK", &arg_list, NULL); + } + + arg_list.count = 1; + arg_list.pointer = &arg; + arg.type = ACPI_TYPE_INTEGER; + arg.integer.value = 1; + + /* + * TBD: _EJD support. + */ + + status = acpi_evaluate_object(handle, "_EJ0", &arg_list, NULL); + if (ACPI_FAILURE(status)) { + return(-ENODEV); + } + + return(0); +} + + +static ssize_t +acpi_eject_store(struct acpi_device *device, const char *buf, size_t count) +{ + int result; + int ret = count; + int islockable; + acpi_status status; + acpi_handle handle; + acpi_object_type type = 0; + + if ((!count) || (buf[0] != '1')) { + return -EINVAL; + } + +#ifndef FORCE_EJECT + if (device->driver == NULL) { + ret = -ENODEV; + goto err; + } +#endif + status = acpi_get_type(device->handle, &type); + if (ACPI_FAILURE(status) || (!device->flags.ejectable) ) { + ret = -ENODEV; + goto err; + } + + islockable = device->flags.lockable; + handle = device->handle; + + if (type == ACPI_TYPE_PROCESSOR) + result = acpi_bus_trim(device, 0); + else + result = acpi_bus_trim(device, 1); + + if (!result) + result = acpi_eject_operation(handle, islockable); + + if (result) { + ret = -EBUSY; + } +err: + return ret; +} + + +/* -------------------------------------------------------------------------- Performance Management -------------------------------------------------------------------------- */ @@ -727,7 +887,7 @@ #ifdef CONFIG_ACPI_DEBUG_OUTPUT char *type_string = NULL; char name[80] = {'?','\0'}; - acpi_buffer buffer = {sizeof(name), name}; + struct acpi_buffer buffer = {sizeof(name), name}; switch (type) { case ACPI_BUS_TYPE_DEVICE: @@ -764,7 +924,55 @@ #endif /*CONFIG_ACPI_DEBUG_OUTPUT*/ } -int + +int +acpi_bus_remove ( + struct acpi_device *dev, + int rmdevice) +{ + int result = 0; + struct acpi_driver *driver; + + ACPI_FUNCTION_TRACE("acpi_bus_remove"); + + if (!dev) + return_VALUE(-EINVAL); + + driver = dev->driver; + + if ((driver) && (driver->ops.remove)) { + + if (driver->ops.stop) { + result = driver->ops.stop(dev, ACPI_BUS_REMOVAL_EJECT); + if (result) + return_VALUE(result); + } + + result = dev->driver->ops.remove(dev, ACPI_BUS_REMOVAL_EJECT); + if (result) { + return_VALUE(result); + } + + atomic_dec(&dev->driver->references); + dev->driver = NULL; + acpi_driver_data(dev) = NULL; + } + + if (!rmdevice) + return_VALUE(0); + + if (dev->flags.bus_address) { + if ((dev->parent) && (dev->parent->ops.unbind)) + dev->parent->ops.unbind(dev); + } + + acpi_device_unregister(dev, ACPI_BUS_REMOVAL_EJECT); + + return_VALUE(0); +} + + +int acpi_bus_add ( struct acpi_device **child, struct acpi_device *parent, @@ -911,7 +1119,7 @@ EXPORT_SYMBOL(acpi_bus_add); -static int acpi_bus_scan (struct acpi_device *start) +int acpi_bus_scan (struct acpi_device *start) { acpi_status status = AE_OK; struct acpi_device *parent = NULL; @@ -1014,6 +1222,62 @@ } EXPORT_SYMBOL(acpi_bus_scan); + +int +acpi_bus_trim(struct acpi_device *start, + int rmdevice) +{ + acpi_status status; + struct acpi_device *parent, *child; + acpi_handle phandle, chandle; + acpi_object_type type; + u32 level = 1; + int err = 0; + + parent = start; + phandle = start->handle; + child = chandle = NULL; + + while ((level > 0) && parent && (!err)) { + status = acpi_get_next_object(ACPI_TYPE_ANY, phandle, + chandle, &chandle); + + /* + * If this scope is exhausted then move our way back up. + */ + if (ACPI_FAILURE(status)) { + level--; + chandle = phandle; + acpi_get_parent(phandle, &phandle); + child = parent; + parent = parent->parent; + + if (level == 0) + err = acpi_bus_remove(child, rmdevice); + else + err = acpi_bus_remove(child, 1); + + continue; + } + + status = acpi_get_type(chandle, &type); + if (ACPI_FAILURE(status)) { + continue; + } + /* + * If there is a device corresponding to chandle then + * parse it (depth-first). + */ + if (acpi_bus_get_device(chandle, &child) == 0) { + level++; + phandle = chandle; + chandle = NULL; + parent = child; + } + continue; + } + return err; +} static int acpi_bus_scan_fixed ( diff -Nru a/drivers/acpi/sleep/proc.c b/drivers/acpi/sleep/proc.c --- a/drivers/acpi/sleep/proc.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/acpi/sleep/proc.c 2005-01-02 23:03:34 -08:00 @@ -83,6 +83,7 @@ { u32 sec, min, hr; u32 day, mo, yr; + unsigned char rtc_control = 0; ACPI_FUNCTION_TRACE("acpi_system_alarm_seq_show"); @@ -91,10 +92,12 @@ sec = CMOS_READ(RTC_SECONDS_ALARM); min = CMOS_READ(RTC_MINUTES_ALARM); hr = CMOS_READ(RTC_HOURS_ALARM); + rtc_control = CMOS_READ(RTC_CONTROL); -#if 0 /* If we ever get an FACP with proper values... */ + /* If we ever get an FACP with proper values... */ if (acpi_gbl_FADT->day_alrm) - day = CMOS_READ(acpi_gbl_FADT->day_alrm); + /* ACPI spec: only low 6 its should be cared */ + day = CMOS_READ(acpi_gbl_FADT->day_alrm) & 0x3F; else day = CMOS_READ(RTC_DAY_OF_MONTH); if (acpi_gbl_FADT->mon_alrm) @@ -105,24 +108,20 @@ yr = CMOS_READ(acpi_gbl_FADT->century) * 100 + CMOS_READ(RTC_YEAR); else yr = CMOS_READ(RTC_YEAR); -#else - day = CMOS_READ(RTC_DAY_OF_MONTH); - mo = CMOS_READ(RTC_MONTH); - yr = CMOS_READ(RTC_YEAR); -#endif spin_unlock(&rtc_lock); - BCD_TO_BIN(sec); - BCD_TO_BIN(min); - BCD_TO_BIN(hr); - BCD_TO_BIN(day); - BCD_TO_BIN(mo); - BCD_TO_BIN(yr); + if (!(rtc_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { + BCD_TO_BIN(sec); + BCD_TO_BIN(min); + BCD_TO_BIN(hr); + BCD_TO_BIN(day); + BCD_TO_BIN(mo); + BCD_TO_BIN(yr); + } -#if 0 /* we're trusting the FADT (see above)*/ -#else + if (!acpi_gbl_FADT->century) /* If we're not trusting the FADT, we should at least make it * right for _this_ century... ehm, what is _this_ century? * @@ -141,8 +140,7 @@ * s/2000/2100 * */ - yr += 2000; -#endif + yr += 2000; seq_printf(seq,"%4.4u-", yr); (mo > 12) ? seq_puts(seq, "**-") : seq_printf(seq, "%2.2u-", mo); @@ -316,6 +314,13 @@ } spin_lock_irq(&rtc_lock); + /* + * Disable alarm interrupt before setting alarm timer or else + * when ACPI_EVENT_RTC is enabled, a spurious ACPI interrupt occurs + */ + rtc_control &= ~RTC_AIE; + CMOS_WRITE(rtc_control, RTC_CONTROL); + CMOS_READ(RTC_INTR_FLAGS); /* write the fields the rtc knows about */ CMOS_WRITE(hr, RTC_HOURS_ALARM); @@ -327,24 +332,21 @@ * offsets into the CMOS RAM here -- which for some reason are pointing * to the RTC area of memory. */ -#if 0 if (acpi_gbl_FADT->day_alrm) CMOS_WRITE(day, acpi_gbl_FADT->day_alrm); if (acpi_gbl_FADT->mon_alrm) CMOS_WRITE(mo, acpi_gbl_FADT->mon_alrm); if (acpi_gbl_FADT->century) CMOS_WRITE(yr/100, acpi_gbl_FADT->century); -#endif /* enable the rtc alarm interrupt */ - if (!(rtc_control & RTC_AIE)) { - rtc_control |= RTC_AIE; - CMOS_WRITE(rtc_control,RTC_CONTROL); - CMOS_READ(RTC_INTR_FLAGS); - } + rtc_control |= RTC_AIE; + CMOS_WRITE(rtc_control, RTC_CONTROL); + CMOS_READ(RTC_INTR_FLAGS); spin_unlock_irq(&rtc_lock); - acpi_set_register(ACPI_BITREG_RT_CLOCK_ENABLE, 1, ACPI_MTX_LOCK); + acpi_clear_event(ACPI_EVENT_RTC); + acpi_enable_event(ACPI_EVENT_RTC, 0); *ppos += count; @@ -395,6 +397,7 @@ char strbuf[5]; char str[5] = ""; int len = count; + struct acpi_device *found_dev = NULL; if (len > 4) len = 4; @@ -411,9 +414,25 @@ if (!strncmp(dev->pnp.bus_id, str, 4)) { dev->wakeup.state.enabled = dev->wakeup.state.enabled ? 0:1; + found_dev = dev; break; } } + if (found_dev) { + list_for_each_safe(node, next, &acpi_wakeup_device_list) { + struct acpi_device * dev = container_of(node, + struct acpi_device, wakeup_list); + + if ((dev != found_dev) && + (dev->wakeup.gpe_number == found_dev->wakeup.gpe_number) && + (dev->wakeup.gpe_device == found_dev->wakeup.gpe_device)) { + printk(KERN_WARNING "ACPI: '%s' and '%s' have the same GPE, " + "can't disable/enable one seperately\n", + dev->pnp.bus_id, found_dev->pnp.bus_id); + dev->wakeup.state.enabled = found_dev->wakeup.state.enabled; + } + } + } spin_unlock(&acpi_device_lock); return count; } @@ -449,6 +468,14 @@ }; +static u32 rtc_handler(void * context) +{ + acpi_clear_event(ACPI_EVENT_RTC); + acpi_disable_event(ACPI_EVENT_RTC, 0); + + return ACPI_INTERRUPT_HANDLED; +} + static int acpi_sleep_proc_init(void) { struct proc_dir_entry *entry = NULL; @@ -474,6 +501,7 @@ if (entry) entry->proc_fops = &acpi_system_wakeup_device_fops; + acpi_install_fixed_event_handler(ACPI_EVENT_RTC, rtc_handler, NULL); return 0; } diff -Nru a/drivers/acpi/tables/tbconvrt.c b/drivers/acpi/tables/tbconvrt.c --- a/drivers/acpi/tables/tbconvrt.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/acpi/tables/tbconvrt.c 2005-01-02 23:03:33 -08:00 @@ -190,7 +190,7 @@ new_gas_struct->address_space_id = ACPI_ADR_SPACE_SYSTEM_IO; new_gas_struct->register_bit_width = register_bit_width; new_gas_struct->register_bit_offset = 0; - new_gas_struct->reserved = 0; + new_gas_struct->access_width = 0; } @@ -510,7 +510,7 @@ * * FUNCTION: acpi_tb_convert_table_facs * - * PARAMETERS: table_info - Info for currently installad FACS + * PARAMETERS: table_info - Info for currently installed FACS * * RETURN: Status * diff -Nru a/drivers/acpi/tables/tbrsdt.c b/drivers/acpi/tables/tbrsdt.c --- a/drivers/acpi/tables/tbrsdt.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/acpi/tables/tbrsdt.c 2005-01-02 23:03:34 -08:00 @@ -277,6 +277,7 @@ acpi_tb_get_rsdt_address (&address); + table_info.type = ACPI_TABLE_XSDT; status = acpi_tb_get_table (&address, &table_info); if (ACPI_FAILURE (status)) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not get the RSDT/XSDT, %s\n", diff -Nru a/drivers/acpi/tables/tbxfroot.c b/drivers/acpi/tables/tbxfroot.c --- a/drivers/acpi/tables/tbxfroot.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/acpi/tables/tbxfroot.c 2005-01-02 23:03:34 -08:00 @@ -387,35 +387,58 @@ u8 *start_address, u32 length) { - u32 offset; u8 *mem_rover; + u8 *end_address; + u8 checksum; ACPI_FUNCTION_TRACE ("tb_scan_memory_for_rsdp"); - /* Search from given start addr for the requested length */ + end_address = start_address + length; - for (offset = 0, mem_rover = start_address; - offset < length; - offset += ACPI_RSDP_SCAN_STEP, mem_rover += ACPI_RSDP_SCAN_STEP) { + /* Search from given start address for the requested length */ + for (mem_rover = start_address; mem_rover < end_address; + mem_rover += ACPI_RSDP_SCAN_STEP) { /* The signature and checksum must both be correct */ - if (ACPI_STRNCMP ((char *) mem_rover, - RSDP_SIG, sizeof (RSDP_SIG)-1) == 0 && - acpi_tb_checksum (mem_rover, ACPI_RSDP_CHECKSUM_LENGTH) == 0) { - /* If so, we have found the RSDP */ + if (ACPI_STRNCMP ((char *) mem_rover, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0) { + /* No signature match, keep looking */ + + continue; + } + + /* Signature matches, check the appropriate checksum */ + + if (((struct rsdp_descriptor *) mem_rover)->revision < 2) { + /* ACPI version 1.0 */ + + checksum = acpi_tb_checksum (mem_rover, ACPI_RSDP_CHECKSUM_LENGTH); + } + else { + /* Post ACPI 1.0, use extended_checksum */ + + checksum = acpi_tb_checksum (mem_rover, ACPI_RSDP_XCHECKSUM_LENGTH); + } + + if (checksum == 0) { + /* Checksum valid, we have found a valid RSDP */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "RSDP located at physical address %p\n",mem_rover)); + "RSDP located at physical address %p\n", mem_rover)); return_PTR (mem_rover); } + + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, + "Found an RSDP at physical address %p, but it has a bad checksum\n", + mem_rover)); } /* Searched entire block, no RSDP was found */ - ACPI_DEBUG_PRINT ((ACPI_DB_INFO,"Searched entire block, no RSDP was found.\n")); + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, + "Searched entire block, no valid RSDP was found.\n")); return_PTR (NULL); } diff -Nru a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c --- a/drivers/acpi/thermal.c 2005-01-02 23:03:35 -08:00 +++ b/drivers/acpi/thermal.c 2005-01-02 23:03:35 -08:00 @@ -64,6 +64,7 @@ #define ACPI_THERMAL_PATH_POWEROFF "/sbin/poweroff" #define ACPI_THERMAL_MAX_ACTIVE 10 +#define ACPI_THERMAL_MAX_LIMIT_STR_LEN 65 #define KELVIN_TO_CELSIUS(t) (long)(((long)t-2732>=0) ? ((long)t-2732+5)/10 : ((long)t-2732-5)/10) #define CELSIUS_TO_KELVIN(t) ((t+273)*10) @@ -899,21 +900,33 @@ struct seq_file *m = (struct seq_file *)file->private_data; struct acpi_thermal *tz = (struct acpi_thermal *)m->private; - char limit_string[65] = {'\0'}; + char *limit_string; int num, critical, hot, passive; - int active[ACPI_THERMAL_MAX_ACTIVE]; + int *active; int i = 0; ACPI_FUNCTION_TRACE("acpi_thermal_write_trip_points"); - if (!tz || (count > sizeof(limit_string) - 1)) { + limit_string = kmalloc(ACPI_THERMAL_MAX_LIMIT_STR_LEN, GFP_KERNEL); + if(!limit_string) + return_VALUE(-ENOMEM); + + memset(limit_string, 0, ACPI_THERMAL_MAX_LIMIT_STR_LEN); + + active = kmalloc(ACPI_THERMAL_MAX_ACTIVE *sizeof(int), GFP_KERNEL); + if(!active) + return_VALUE(-ENOMEM); + + if (!tz || (count > ACPI_THERMAL_MAX_LIMIT_STR_LEN - 1)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument\n")); - return_VALUE(-EINVAL); + count = -EINVAL; + goto end; } if (copy_from_user(limit_string, buffer, count)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data\n")); - return_VALUE(-EFAULT); + count = -EFAULT; + goto end; } limit_string[count] = '\0'; @@ -924,7 +937,8 @@ &active[5], &active[6], &active[7], &active[8], &active[9]); if(!(num >=5 && num < (ACPI_THERMAL_MAX_ACTIVE + 3))) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data format\n")); - return_VALUE(-EINVAL); + count = -EINVAL; + goto end; } tz->trips.critical.temperature = CELSIUS_TO_KELVIN(critical); @@ -936,6 +950,9 @@ tz->trips.active[i].temperature = CELSIUS_TO_KELVIN(active[i]); } +end: + kfree(active); + kfree(limit_string); return_VALUE(count); } diff -Nru a/drivers/acpi/toshiba_acpi.c b/drivers/acpi/toshiba_acpi.c --- a/drivers/acpi/toshiba_acpi.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/acpi/toshiba_acpi.c 2005-01-02 23:03:33 -08:00 @@ -508,7 +508,7 @@ proc->write_proc = (write_proc_t*)dispatch_write; } - return(AE_OK); + return AE_OK; } static acpi_status __exit @@ -518,7 +518,7 @@ for (item = proc_items; item->name; ++item) remove_proc_entry(item->name, toshiba_proc_dir); - return(AE_OK); + return AE_OK; } static int __init diff -Nru a/drivers/acpi/video.c b/drivers/acpi/video.c --- a/drivers/acpi/video.c 2005-01-02 23:03:35 -08:00 +++ b/drivers/acpi/video.c 2005-01-02 23:03:35 -08:00 @@ -242,6 +242,13 @@ .release = single_release, }; +static char device_decode[][30] = { + "motherboard VGA device", + "PCI VGA device", + "AGP VGA device", + "UNKNOWN", +}; + static void acpi_video_device_notify ( acpi_handle handle, u32 event, void *data); static void acpi_video_device_rebind( struct acpi_video_bus *video); static void acpi_video_device_bind( struct acpi_video_bus *video, struct acpi_video_device *device); @@ -1117,12 +1124,6 @@ struct acpi_video_bus *video = (struct acpi_video_bus *) seq->private; int status; unsigned long id; - char device_decode[][30] = { - "motherboard VGA device", - "PCI VGA device", - "AGP VGA device", - "UNKNOWN", - }; ACPI_FUNCTION_TRACE("acpi_video_bus_POST_seq_show"); @@ -1523,7 +1524,7 @@ dod->package.count)); active_device_list= kmalloc( - dod->package.count*sizeof(struct acpi_video_enumerated_device), + (1+dod->package.count)*sizeof(struct acpi_video_enumerated_device), GFP_KERNEL); if (!active_device_list) { diff -Nru a/drivers/atm/ambassador.c b/drivers/atm/ambassador.c --- a/drivers/atm/ambassador.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/atm/ambassador.c 2005-01-02 23:03:33 -08:00 @@ -1692,7 +1692,7 @@ }; -unsigned int command_successes [] = { +static unsigned int command_successes [] = { [host_memory_test] = COMMAND_PASSED_TEST, [read_adapter_memory] = COMMAND_READ_DATA_OK, [write_adapter_memory] = COMMAND_WRITE_DATA_OK, @@ -2088,7 +2088,7 @@ } // swap bits within byte to get Ethernet ordering -u8 bit_swap (u8 byte) +static u8 bit_swap (u8 byte) { const u8 swap[] = { 0x0, 0x8, 0x4, 0xc, diff -Nru a/drivers/atm/atmtcp.c b/drivers/atm/atmtcp.c --- a/drivers/atm/atmtcp.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/atm/atmtcp.c 2005-01-02 23:03:34 -08:00 @@ -396,7 +396,7 @@ } -int atmtcp_attach(struct atm_vcc *vcc,int itf) +static int atmtcp_attach(struct atm_vcc *vcc,int itf) { struct atm_dev *dev; @@ -427,13 +427,13 @@ } -int atmtcp_create_persistent(int itf) +static int atmtcp_create_persistent(int itf) { return atmtcp_create(itf,1,NULL); } -int atmtcp_remove_persistent(int itf) +static int atmtcp_remove_persistent(int itf) { struct atm_dev *dev; struct atmtcp_dev_data *dev_data; diff -Nru a/drivers/atm/firestream.c b/drivers/atm/firestream.c --- a/drivers/atm/firestream.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/atm/firestream.c 2005-01-02 23:03:33 -08:00 @@ -82,14 +82,14 @@ * would be interpreted. -- REW */ #define NP FS_NR_FREE_POOLS -int rx_buf_sizes[NP] = {128, 256, 512, 1024, 2048, 4096, 16384, 65520}; +static int rx_buf_sizes[NP] = {128, 256, 512, 1024, 2048, 4096, 16384, 65520}; /* log2: 7 8 9 10 11 12 14 16 */ #if 0 -int rx_pool_sizes[NP] = {1024, 1024, 512, 256, 128, 64, 32, 32}; +static int rx_pool_sizes[NP] = {1024, 1024, 512, 256, 128, 64, 32, 32}; #else /* debug */ -int rx_pool_sizes[NP] = {128, 128, 128, 64, 64, 64, 32, 32}; +static int rx_pool_sizes[NP] = {128, 128, 128, 64, 64, 64, 32, 32}; #endif /* log2: 10 10 9 8 7 6 5 5 */ /* sumlog2: 17 18 18 18 18 18 19 21 */ @@ -250,7 +250,7 @@ }; -struct reginit_item PHY_NTC_INIT[] __devinitdata = { +static struct reginit_item PHY_NTC_INIT[] __devinitdata = { { PHY_CLEARALL, 0x40 }, { 0x12, 0x0001 }, { 0x13, 0x7605 }, @@ -334,7 +334,7 @@ #define func_exit() fs_dprintk (FS_DEBUG_FLOW, "fs: exit %s\n", __FUNCTION__) -struct fs_dev *fs_boards = NULL; +static struct fs_dev *fs_boards = NULL; #ifdef DEBUG @@ -1921,7 +1921,7 @@ return -ENODEV; } -void __devexit firestream_remove_one (struct pci_dev *pdev) +static void __devexit firestream_remove_one (struct pci_dev *pdev) { int i; struct fs_dev *dev, *nxtdev; diff -Nru a/drivers/atm/he.c b/drivers/atm/he.c --- a/drivers/atm/he.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/atm/he.c 2005-01-02 23:03:33 -08:00 @@ -147,13 +147,55 @@ /* globals */ -struct he_dev *he_devs = NULL; +static struct he_dev *he_devs = NULL; static int disable64 = 0; static short nvpibits = -1; static short nvcibits = -1; static short rx_skb_reserve = 16; static int irq_coalesce = 1; static int sdh = 0; + +/* Read from EEPROM = 0000 0011b */ +static unsigned int readtab[] = { + CS_HIGH | CLK_HIGH, + CS_LOW | CLK_LOW, + CLK_HIGH, /* 0 */ + CLK_LOW, + CLK_HIGH, /* 0 */ + CLK_LOW, + CLK_HIGH, /* 0 */ + CLK_LOW, + CLK_HIGH, /* 0 */ + CLK_LOW, + CLK_HIGH, /* 0 */ + CLK_LOW, + CLK_HIGH, /* 0 */ + CLK_LOW | SI_HIGH, + CLK_HIGH | SI_HIGH, /* 1 */ + CLK_LOW | SI_HIGH, + CLK_HIGH | SI_HIGH /* 1 */ +}; + +/* Clock to read from/write to the EEPROM */ +static unsigned int clocktab[] = { + CLK_LOW, + CLK_HIGH, + CLK_LOW, + CLK_HIGH, + CLK_LOW, + CLK_HIGH, + CLK_LOW, + CLK_HIGH, + CLK_LOW, + CLK_HIGH, + CLK_LOW, + CLK_HIGH, + CLK_LOW, + CLK_HIGH, + CLK_LOW, + CLK_HIGH, + CLK_LOW +}; static struct atmdev_ops he_ops = { diff -Nru a/drivers/atm/he.h b/drivers/atm/he.h --- a/drivers/atm/he.h 2005-01-02 23:03:35 -08:00 +++ b/drivers/atm/he.h 2005-01-02 23:03:35 -08:00 @@ -892,47 +892,4 @@ #define SI_HIGH ID_DIN /* HOST_CNTL_ID_PROM_DATA_IN */ #define EEPROM_DELAY 400 /* microseconds */ -/* Read from EEPROM = 0000 0011b */ -unsigned int readtab[] = { - CS_HIGH | CLK_HIGH, - CS_LOW | CLK_LOW, - CLK_HIGH, /* 0 */ - CLK_LOW, - CLK_HIGH, /* 0 */ - CLK_LOW, - CLK_HIGH, /* 0 */ - CLK_LOW, - CLK_HIGH, /* 0 */ - CLK_LOW, - CLK_HIGH, /* 0 */ - CLK_LOW, - CLK_HIGH, /* 0 */ - CLK_LOW | SI_HIGH, - CLK_HIGH | SI_HIGH, /* 1 */ - CLK_LOW | SI_HIGH, - CLK_HIGH | SI_HIGH /* 1 */ -}; - -/* Clock to read from/write to the EEPROM */ -unsigned int clocktab[] = { - CLK_LOW, - CLK_HIGH, - CLK_LOW, - CLK_HIGH, - CLK_LOW, - CLK_HIGH, - CLK_LOW, - CLK_HIGH, - CLK_LOW, - CLK_HIGH, - CLK_LOW, - CLK_HIGH, - CLK_LOW, - CLK_HIGH, - CLK_LOW, - CLK_HIGH, - CLK_LOW -}; - - #endif /* _HE_H_ */ diff -Nru a/drivers/atm/idt77105.c b/drivers/atm/idt77105.c --- a/drivers/atm/idt77105.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/atm/idt77105.c 2005-01-02 23:03:34 -08:00 @@ -323,7 +323,7 @@ } -int idt77105_stop(struct atm_dev *dev) +static int idt77105_stop(struct atm_dev *dev) { struct idt77105_priv *walk, *prev; diff -Nru a/drivers/atm/idt77105.h b/drivers/atm/idt77105.h --- a/drivers/atm/idt77105.h 2005-01-02 23:03:34 -08:00 +++ b/drivers/atm/idt77105.h 2005-01-02 23:03:34 -08:00 @@ -77,7 +77,6 @@ #ifdef __KERNEL__ int idt77105_init(struct atm_dev *dev) __init; -int idt77105_stop(struct atm_dev *dev); #endif /* diff -Nru a/drivers/atm/idt77252.h b/drivers/atm/idt77252.h --- a/drivers/atm/idt77252.h 2005-01-02 23:03:34 -08:00 +++ b/drivers/atm/idt77252.h 2005-01-02 23:03:34 -08:00 @@ -275,7 +275,7 @@ struct rsq_entry *next; struct rsq_entry *last; dma_addr_t paddr; -} rsq_info; +}; /*****************************************************************************/ diff -Nru a/drivers/atm/iphase.c b/drivers/atm/iphase.c --- a/drivers/atm/iphase.c 2005-01-02 23:03:35 -08:00 +++ b/drivers/atm/iphase.c 2005-01-02 23:03:35 -08:00 @@ -72,13 +72,13 @@ #define PRIV(dev) ((struct suni_priv *) dev->phy_data) static unsigned char ia_phy_get(struct atm_dev *dev, unsigned long addr); +static void desc_dbg(IADEV *iadev); static IADEV *ia_dev[8]; static struct atm_dev *_ia_dev[8]; static int iadev_count; static void ia_led_timer(unsigned long arg); static struct timer_list ia_timer = TIMER_INITIALIZER(ia_led_timer, 0, 0); -struct atm_vcc *vcc_close_que[100]; static int IA_TX_BUF = DFL_TX_BUFFERS, IA_TX_BUF_SZ = DFL_TX_BUF_SZ; static int IA_RX_BUF = DFL_RX_BUFFERS, IA_RX_BUF_SZ = DFL_RX_BUF_SZ; static uint IADebugFlag = /* IF_IADBG_ERR | IF_IADBG_CBR| IF_IADBG_INIT_ADAPTER @@ -147,7 +147,6 @@ u_short desc1; u_short tcq_wr; struct ia_vcc *iavcc_r = NULL; - extern void desc_dbg(IADEV *iadev); tcq_wr = readl(dev->seg_reg+TCQ_WR_PTR) & 0xffff; while (dev->host_tcq_wr != tcq_wr) { @@ -187,7 +186,6 @@ unsigned long delta; static unsigned long timer = 0; int ltimeout; - extern void desc_dbg(IADEV *iadev); ia_hack_tcq (dev); if(((jiffies - timer)>50)||((dev->ffL.tcq_rd==dev->host_tcq_wr))){ @@ -644,7 +642,7 @@ return 0; } -void ia_tx_poll (IADEV *iadev) { +static void ia_tx_poll (IADEV *iadev) { struct atm_vcc *vcc = NULL; struct sk_buff *skb = NULL, *skb1 = NULL; struct ia_vcc *iavcc; @@ -861,7 +859,7 @@ return; } -void ia_mb25_init (IADEV *iadev) +static void ia_mb25_init (IADEV *iadev) { volatile ia_mb25_t *mb25 = (ia_mb25_t*)iadev->phy; #if 0 @@ -876,7 +874,7 @@ return; } -void ia_suni_pm7345_init (IADEV *iadev) +static void ia_suni_pm7345_init (IADEV *iadev) { volatile suni_pm7345_t *suni_pm7345 = (suni_pm7345_t *)iadev->phy; if (iadev->phy_type & FE_DS3_PHY) @@ -959,9 +957,8 @@ /***************************** IA_LIB END *****************************/ -/* pwang_test debug utility */ -int tcnter = 0, rcnter = 0; -void xdump( u_char* cp, int length, char* prefix ) +static int tcnter = 0; +static void xdump( u_char* cp, int length, char* prefix ) { int col, count; u_char prntBuf[120]; @@ -1008,7 +1005,7 @@ /*-- some utilities and memory allocation stuff will come here -------------*/ -void desc_dbg(IADEV *iadev) { +static void desc_dbg(IADEV *iadev) { u_short tcq_wr_ptr, tcq_st_ptr, tcq_ed_ptr; u32 i; diff -Nru a/drivers/atm/iphase.h b/drivers/atm/iphase.h --- a/drivers/atm/iphase.h 2005-01-02 23:03:33 -08:00 +++ b/drivers/atm/iphase.h 2005-01-02 23:03:33 -08:00 @@ -1126,8 +1126,6 @@ #define FE_DS3_PHY 0x0080 /* DS3 */ #define FE_E3_PHY 0x0090 /* E3 */ -extern void ia_mb25_init (IADEV *); - /*********************** SUNI_PM7345 PHY DEFINE HERE *********************/ typedef struct _suni_pm7345_t { @@ -1325,8 +1323,6 @@ #define SUNI_DS3_COCAI 0x04 /* Corr. HCS errors detected */ #define SUNI_DS3_FOVRI 0x02 /* FIFO overrun */ #define SUNI_DS3_FUDRI 0x01 /* FIFO underrun */ - -extern void ia_suni_pm7345_init (IADEV *iadev); ///////////////////SUNI_PM7345 PHY DEFINE END ///////////////////////////// diff -Nru a/drivers/atm/nicstarmac.c b/drivers/atm/nicstarmac.c --- a/drivers/atm/nicstarmac.c 2005-01-02 23:03:35 -08:00 +++ b/drivers/atm/nicstarmac.c 2005-01-02 23:03:35 -08:00 @@ -35,6 +35,7 @@ #define SI_LOW 0x0000 /* Serial input data low */ /* Read Status Register = 0000 0101b */ +#if 0 static u_int32_t rdsrtab[] = { CS_HIGH | CLK_HIGH, @@ -55,6 +56,7 @@ CLK_LOW | SI_HIGH, CLK_HIGH | SI_HIGH /* 1 */ }; +#endif /* 0 */ /* Read from EEPROM = 0000 0011b */ @@ -117,7 +119,7 @@ * eeprom, then pull the result from bit 16 of the NicSTaR's General Purpose * register. */ - +#if 0 u_int32_t nicstar_read_eprom_status( virt_addr_t base ) { @@ -153,6 +155,7 @@ osp_MicroDelay( CYCLE_DELAY ); return rbyte; } +#endif /* 0 */ /* diff -Nru a/drivers/atm/nicstarmac.h b/drivers/atm/nicstarmac.h --- a/drivers/atm/nicstarmac.h 2005-01-02 23:03:33 -08:00 +++ b/drivers/atm/nicstarmac.h 2005-01-02 23:03:33 -08:00 @@ -9,6 +9,5 @@ typedef void __iomem *virt_addr_t; -u_int32_t nicstar_read_eprom_status( virt_addr_t base ); void nicstar_init_eprom( virt_addr_t base ); void nicstar_read_eprom( virt_addr_t, u_int8_t, u_int8_t *, u_int32_t); diff -Nru a/drivers/atm/zatm.c b/drivers/atm/zatm.c --- a/drivers/atm/zatm.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/atm/zatm.c 2005-01-02 23:03:33 -08:00 @@ -1605,7 +1605,7 @@ goto out_disable; zatm_dev->pci_dev = pci_dev; - dev = (struct atm_dev *)zatm_dev; + dev->dev_data = zatm_dev; zatm_dev->copper = (int)ent->driver_data; if ((ret = zatm_init(dev)) || (ret = zatm_start(dev))) goto out_release; diff -Nru a/drivers/base/cpu.c b/drivers/base/cpu.c --- a/drivers/base/cpu.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/base/cpu.c 2005-01-02 23:03:33 -08:00 @@ -48,10 +48,23 @@ } static SYSDEV_ATTR(online, 0600, show_online, store_online); -static void __init register_cpu_control(struct cpu *cpu) +static void __devinit register_cpu_control(struct cpu *cpu) { sysdev_create_file(&cpu->sysdev, &attr_online); } +void unregister_cpu(struct cpu *cpu, struct node *root) +{ + + if (root) + sysfs_remove_link(&root->sysdev.kobj, + kobject_name(&cpu->sysdev.kobj)); + sysdev_remove_file(&cpu->sysdev, &attr_online); + + sysdev_unregister(&cpu->sysdev); + + return; +} +EXPORT_SYMBOL(unregister_cpu); #else /* ... !CONFIG_HOTPLUG_CPU */ static inline void register_cpu_control(struct cpu *cpu) { @@ -66,7 +79,7 @@ * * Initialize and register the CPU device. */ -int __init register_cpu(struct cpu *cpu, int num, struct node *root) +int __devinit register_cpu(struct cpu *cpu, int num, struct node *root) { int error; @@ -83,6 +96,9 @@ register_cpu_control(cpu); return error; } +#ifdef CONFIG_HOTPLUG_CPU +EXPORT_SYMBOL(register_cpu); +#endif diff -Nru a/drivers/block/floppy.c b/drivers/block/floppy.c --- a/drivers/block/floppy.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/block/floppy.c 2005-01-02 23:03:33 -08:00 @@ -155,7 +155,6 @@ #include #include #include -#include #define FDPATCHES #include @@ -4596,8 +4595,6 @@ int init_module(void) { - printk(KERN_INFO "inserting floppy driver for " UTS_RELEASE "\n"); - if (floppy) parse_floppy_cfg_string(floppy); return floppy_init(); diff -Nru a/drivers/block/scsi_ioctl.c b/drivers/block/scsi_ioctl.c --- a/drivers/block/scsi_ioctl.c 2005-01-02 23:03:35 -08:00 +++ b/drivers/block/scsi_ioctl.c 2005-01-02 23:03:35 -08:00 @@ -356,7 +356,7 @@ bytes = max(in_len, out_len); if (bytes) { - buffer = kmalloc(bytes, q->bounce_gfp | GFP_USER); + buffer = kmalloc(bytes, q->bounce_gfp | GFP_USER| __GFP_NOWARN); if (!buffer) return -ENOMEM; diff -Nru a/drivers/char/agp/agp.h b/drivers/char/agp/agp.h --- a/drivers/char/agp/agp.h 2005-01-02 23:03:33 -08:00 +++ b/drivers/char/agp/agp.h 2005-01-02 23:03:33 -08:00 @@ -141,16 +141,6 @@ char minor_version; }; -#define OUTREG64(mmap, addr, val) __raw_writeq((val), (mmap)+(addr)) -#define OUTREG32(mmap, addr, val) __raw_writel((val), (mmap)+(addr)) -#define OUTREG16(mmap, addr, val) __raw_writew((val), (mmap)+(addr)) -#define OUTREG8(mmap, addr, val) __raw_writeb((val), (mmap)+(addr)) - -#define INREG64(mmap, addr) __raw_readq((mmap)+(addr)) -#define INREG32(mmap, addr) __raw_readl((mmap)+(addr)) -#define INREG16(mmap, addr) __raw_readw((mmap)+(addr)) -#define INREG8(mmap, addr) __raw_readb((mmap)+(addr)) - #define KB(x) ((x) * 1024) #define MB(x) (KB (KB (x))) #define GB(x) (MB (KB (x))) diff -Nru a/drivers/char/agp/ali-agp.c b/drivers/char/agp/ali-agp.c --- a/drivers/char/agp/ali-agp.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/char/agp/ali-agp.c 2005-01-02 23:03:34 -08:00 @@ -277,6 +277,15 @@ .device_id = PCI_DEVICE_ID_AL_M1671, .chipset_name = "M1671", }, + { + .device_id = PCI_DEVICE_ID_AL_M1681, + .chipset_name = "M1681", + }, + { + .device_id = PCI_DEVICE_ID_AL_M1683, + .chipset_name = "M1683", + }, + { }, /* dummy final entry, always present */ }; @@ -387,6 +396,8 @@ static int __init agp_ali_init(void) { + if (agp_off) + return -EINVAL; return pci_module_init(&agp_ali_pci_driver); } diff -Nru a/drivers/char/agp/alpha-agp.c b/drivers/char/agp/alpha-agp.c --- a/drivers/char/agp/alpha-agp.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/char/agp/alpha-agp.c 2005-01-02 23:03:34 -08:00 @@ -195,6 +195,8 @@ static int __init agp_alpha_core_init(void) { + if (agp_off) + return -EINVAL; if (alpha_mv.agp_info) return alpha_core_agp_setup(); return -ENODEV; diff -Nru a/drivers/char/agp/amd-k7-agp.c b/drivers/char/agp/amd-k7-agp.c --- a/drivers/char/agp/amd-k7-agp.c 2005-01-02 23:03:35 -08:00 +++ b/drivers/char/agp/amd-k7-agp.c 2005-01-02 23:03:35 -08:00 @@ -53,8 +53,10 @@ } global_cache_flush(); - for (i = 0; i < PAGE_SIZE / sizeof(unsigned long); i++) + for (i = 0; i < PAGE_SIZE / sizeof(unsigned long); i++) { writel(agp_bridge->scratch_page, page_map->remapped+i); + readl(page_map->remapped+i); /* PCI Posting. */ + } return 0; } @@ -167,6 +169,7 @@ for (i = 0; i < value->num_entries / 1024; i++, addr += 0x00400000) { writel(virt_to_phys(amd_irongate_private.gatt_pages[i]->real) | 1, page_dir.remapped+GET_PAGE_DIR_OFF(addr)); + readl(page_dir.remapped+GET_PAGE_DIR_OFF(addr)); /* PCI Posting. */ } return 0; @@ -220,8 +223,8 @@ amd_irongate_private.registers = (volatile u8 __iomem *) ioremap(temp, 4096); /* Write out the address of the gatt table */ - OUTREG32(amd_irongate_private.registers, AMD_ATTBASE, - agp_bridge->gatt_bus_addr); + writel(agp_bridge->gatt_bus_addr, amd_irongate_private.registers+AMD_ATTBASE); + readl(amd_irongate_private.registers+AMD_ATTBASE); /* PCI Posting. */ /* Write the Sync register */ pci_write_config_byte(agp_bridge->dev, AMD_MODECNTL, 0x80); @@ -230,19 +233,19 @@ pci_write_config_byte(agp_bridge->dev, AMD_MODECNTL2, 0x00); /* Write the enable register */ - enable_reg = INREG16(amd_irongate_private.registers, AMD_GARTENABLE); + enable_reg = readw(amd_irongate_private.registers+AMD_GARTENABLE); enable_reg = (enable_reg | 0x0004); - OUTREG16(amd_irongate_private.registers, AMD_GARTENABLE, enable_reg); + writew(enable_reg, amd_irongate_private.registers+AMD_GARTENABLE); + readw(amd_irongate_private.registers+AMD_GARTENABLE); /* PCI Posting. */ /* Write out the size register */ pci_read_config_dword(agp_bridge->dev, AMD_APSIZE, &temp); - temp = (((temp & ~(0x0000000e)) | current_size->size_value) - | 0x00000001); + temp = (((temp & ~(0x0000000e)) | current_size->size_value) | 1); pci_write_config_dword(agp_bridge->dev, AMD_APSIZE, temp); /* Flush the tlb */ - OUTREG32(amd_irongate_private.registers, AMD_TLBFLUSH, 0x00000001); - + writel(1, amd_irongate_private.registers+AMD_TLBFLUSH); + readl(amd_irongate_private.registers+AMD_TLBFLUSH); /* PCI Posting.*/ return 0; } @@ -254,9 +257,10 @@ previous_size = A_SIZE_LVL2(agp_bridge->previous_size); - enable_reg = INREG16(amd_irongate_private.registers, AMD_GARTENABLE); + enable_reg = readw(amd_irongate_private.registers+AMD_GARTENABLE); enable_reg = (enable_reg & ~(0x0004)); - OUTREG16(amd_irongate_private.registers, AMD_GARTENABLE, enable_reg); + writew(enable_reg, amd_irongate_private.registers+AMD_GARTENABLE); + readw(amd_irongate_private.registers+AMD_GARTENABLE); /* PCI Posting. */ /* Write back the previous size and disable gart translation */ pci_read_config_dword(agp_bridge->dev, AMD_APSIZE, &temp); @@ -275,7 +279,8 @@ static void amd_irongate_tlbflush(struct agp_memory *temp) { - OUTREG32(amd_irongate_private.registers, AMD_TLBFLUSH, 0x00000001); + writel(1, amd_irongate_private.registers+AMD_TLBFLUSH); + readl(amd_irongate_private.registers+AMD_TLBFLUSH); /* PCI Posting. */ } static int amd_insert_memory(struct agp_memory *mem, off_t pg_start, int type) @@ -310,6 +315,7 @@ addr = (j * PAGE_SIZE) + agp_bridge->gart_bus_addr; cur_gatt = GET_GATT(addr); writel(agp_generic_mask_memory(mem->memory[i], mem->type), cur_gatt+GET_GATT_OFF(addr)); + readl(cur_gatt+GET_GATT_OFF(addr)); /* PCI Posting. */ } amd_irongate_tlbflush(mem); return 0; @@ -328,6 +334,7 @@ addr = (i * PAGE_SIZE) + agp_bridge->gart_bus_addr; cur_gatt = GET_GATT(addr); writel(agp_bridge->scratch_page, cur_gatt+GET_GATT_OFF(addr)); + readl(cur_gatt+GET_GATT_OFF(addr)); /* PCI Posting. */ } amd_irongate_tlbflush(mem); @@ -471,6 +478,8 @@ static int __init agp_amdk7_init(void) { + if (agp_off) + return -EINVAL; return pci_module_init(&agp_amdk7_pci_driver); } diff -Nru a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c --- a/drivers/char/agp/amd64-agp.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/char/agp/amd64-agp.c 2005-01-02 23:03:34 -08:00 @@ -46,6 +46,11 @@ #define NVIDIA_X86_64_1_APBASE2 0xd8 #define NVIDIA_X86_64_1_APLIMIT2 0xdc +/* ULi K8 registers */ +#define ULI_X86_64_BASE_ADDR 0x10 +#define ULI_X86_64_HTT_FEA_REG 0x50 +#define ULI_X86_64_ENU_SCR_REG 0x54 + static int nr_garts; static struct pci_dev * hammers[MAX_HAMMER_GARTS]; @@ -109,6 +114,7 @@ pte |= GPTE_VALID | GPTE_COHERENT; writel(pte, agp_bridge->gatt_table+j); + readl(agp_bridge->gatt_table+j); /* PCI Posting. */ } amd64_tlbflush(mem); return 0; @@ -355,7 +361,7 @@ int i = 0; /* cache pci_devs of northbridges. */ - while ((loop_dev = pci_find_device(PCI_VENDOR_ID_AMD, 0x1103, loop_dev)) + while ((loop_dev = pci_get_device(PCI_VENDOR_ID_AMD, 0x1103, loop_dev)) != NULL) { if (i == MAX_HAMMER_GARTS) { printk(KERN_ERR PFX "Too many northbridges for AGP\n"); @@ -405,6 +411,61 @@ } } + +static struct aper_size_info_32 uli_sizes[7] = +{ + {256, 65536, 6, 10}, + {128, 32768, 5, 9}, + {64, 16384, 4, 8}, + {32, 8192, 3, 7}, + {16, 4096, 2, 6}, + {8, 2048, 1, 4}, + {4, 1024, 0, 3} +}; +static int __devinit uli_agp_init(struct pci_dev *pdev) +{ + u32 httfea,baseaddr,enuscr; + struct pci_dev *dev1; + int i; + unsigned size = amd64_fetch_size(); + printk(KERN_INFO "Setting up ULi AGP. \n"); + dev1 = pci_find_slot ((unsigned int)pdev->bus->number,PCI_DEVFN(0,0)); + if (dev1 == NULL) { + printk(KERN_INFO PFX "Detected a ULi chipset, " + "but could not fine the secondary device.\n"); + return -ENODEV; + } + + for (i = 0; i < ARRAY_SIZE(uli_sizes); i++) + if (uli_sizes[i].size == size) + break; + + if (i == ARRAY_SIZE(uli_sizes)) { + printk(KERN_INFO PFX "No ULi size found for %d\n", size); + return -ENODEV; + } + + /* shadow x86-64 registers into ULi registers */ + pci_read_config_dword (hammers[0], AMD64_GARTAPERTUREBASE, &httfea); + + /* if x86-64 aperture base is beyond 4G, exit here */ + if ((httfea & 0x7fff) >> (32 - 25)) + return -ENODEV; + + httfea = (httfea& 0x7fff) << 25; + + pci_read_config_dword(pdev, ULI_X86_64_BASE_ADDR, &baseaddr); + baseaddr&= ~PCI_BASE_ADDRESS_MEM_MASK; + baseaddr|= httfea; + pci_write_config_dword(pdev, ULI_X86_64_BASE_ADDR, baseaddr); + + enuscr= httfea+ (size * 1024 * 1024) - 1; + pci_write_config_dword(dev1, ULI_X86_64_HTT_FEA_REG, httfea); + pci_write_config_dword(dev1, ULI_X86_64_ENU_SCR_REG, enuscr); + return 0; +} + + static struct aper_size_info_32 nforce3_sizes[5] = { {512, 131072, 7, 0x00000000 }, @@ -513,6 +574,14 @@ } } + if (pdev->vendor == PCI_VENDOR_ID_AL) { + int ret = uli_agp_init(pdev); + if (ret) { + agp_put_bridge(bridge); + return ret; + } + } + pci_set_drvdata(pdev, bridge); return agp_add_bridge(bridge); } @@ -536,6 +605,15 @@ .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, }, + /* ULi M1689 */ + { + .class = (PCI_CLASS_BRIDGE_HOST << 8), + .class_mask = ~0, + .vendor = PCI_VENDOR_ID_AL, + .device = PCI_DEVICE_ID_AL_M1689, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + }, /* VIA K8T800Pro */ { .class = (PCI_CLASS_BRIDGE_HOST << 8), @@ -581,7 +659,6 @@ .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, }, - /* NForce3 */ { .class = (PCI_CLASS_BRIDGE_HOST << 8), @@ -625,6 +702,11 @@ int __init agp_amd64_init(void) { int err = 0; + static struct pci_device_id amd64nb[] = { + { PCI_DEVICE(PCI_VENDOR_ID_AMD, 0x1103) }, + { }, + }; + if (agp_off) return -EINVAL; if (pci_module_init(&agp_amd64_pci_driver) > 0) { @@ -640,13 +722,13 @@ } /* First check that we have at least one AMD64 NB */ - if (!pci_find_device(PCI_VENDOR_ID_AMD, 0x1103, NULL)) + if (!pci_dev_present(amd64nb)) return -ENODEV; /* Look for any AGP bridge */ dev = NULL; err = -ENODEV; - while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev))) { + for_each_pci_dev(dev) { if (!pci_find_capability(dev, PCI_CAP_ID_AGP)) continue; /* Only one bridge supported right now */ diff -Nru a/drivers/char/agp/ati-agp.c b/drivers/char/agp/ati-agp.c --- a/drivers/char/agp/ati-agp.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/char/agp/ati-agp.c 2005-01-02 23:03:34 -08:00 @@ -61,9 +61,6 @@ SetPageReserved(virt_to_page(page_map->real)); err = map_page_into_agp(virt_to_page(page_map->real)); - - /* CACHE_FLUSH(); */ - global_cache_flush(); page_map->remapped = ioremap_nocache(virt_to_phys(page_map->real), PAGE_SIZE); if (page_map->remapped == NULL || err) { @@ -75,8 +72,10 @@ /*CACHE_FLUSH();*/ global_cache_flush(); - for(i = 0; i < PAGE_SIZE / sizeof(unsigned long); i++) + for(i = 0; i < PAGE_SIZE / sizeof(unsigned long); i++) { writel(agp_bridge->scratch_page, page_map->remapped+i); + readl(page_map->remapped+i); /* PCI Posting. */ + } return 0; } @@ -186,7 +185,8 @@ static void ati_tlbflush(struct agp_memory * mem) { - OUTREG32(ati_generic_private.registers, ATI_GART_CACHE_CNTRL, 1); + writel(1, ati_generic_private.registers+ATI_GART_CACHE_CNTRL); + readl(ati_generic_private.registers+ATI_GART_CACHE_CNTRL); /* PCI Posting. */ } static void ati_cleanup(void) @@ -230,15 +230,16 @@ agp_bridge.gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); printk(KERN_INFO PFX "IGP320 gart_bus_addr: %x\n", agp_bridge.gart_bus_addr); */ - OUTREG32(ati_generic_private.registers, ATI_GART_FEATURE_ID, 0x60000); + writel(0x60000, ati_generic_private.registers+ATI_GART_FEATURE_ID); + readl(ati_generic_private.registers+ATI_GART_FEATURE_ID); /* PCI Posting.*/ /* SIGNALED_SYSTEM_ERROR @ NB_STATUS */ pci_read_config_dword(agp_bridge->dev, 4, &temp); pci_write_config_dword(agp_bridge->dev, 4, temp | (1<<14)); /* Write out the address of the gatt table */ - OUTREG32(ati_generic_private.registers, ATI_GART_BASE, - agp_bridge->gatt_bus_addr); + writel(agp_bridge->gatt_bus_addr, ati_generic_private.registers+ATI_GART_BASE); + readl(ati_generic_private.registers+ATI_GART_BASE); /* PCI Posting. */ return 0; } @@ -291,6 +292,7 @@ addr = (j * PAGE_SIZE) + agp_bridge->gart_bus_addr; cur_gatt = GET_GATT(addr); writel(agp_bridge->driver->mask_memory(mem->memory[i], mem->type), cur_gatt+GET_GATT_OFF(addr)); + readl(cur_gatt+GET_GATT_OFF(addr)); /* PCI Posting. */ } agp_bridge->driver->tlb_flush(mem); return 0; @@ -310,6 +312,7 @@ addr = (i * PAGE_SIZE) + agp_bridge->gart_bus_addr; cur_gatt = GET_GATT(addr); writel(agp_bridge->scratch_page, cur_gatt+GET_GATT_OFF(addr)); + readl(cur_gatt+GET_GATT_OFF(addr)); /* PCI Posting. */ } agp_bridge->driver->tlb_flush(mem); @@ -371,6 +374,7 @@ for(i = 0; i < value->num_entries / 1024; i++, addr += 0x00400000) { writel(virt_to_bus(ati_generic_private.gatt_pages[i]->real) | 1, page_dir.remapped+GET_PAGE_DIR_OFF(addr)); + readl(page_dir.remapped+GET_PAGE_DIR_OFF(addr)); /* PCI Posting. */ } return 0; @@ -525,6 +529,8 @@ static int __init agp_ati_init(void) { + if (agp_off) + return -EINVAL; return pci_module_init(&agp_ati_pci_driver); } diff -Nru a/drivers/char/agp/efficeon-agp.c b/drivers/char/agp/efficeon-agp.c --- a/drivers/char/agp/efficeon-agp.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/char/agp/efficeon-agp.c 2005-01-02 23:03:33 -08:00 @@ -375,7 +375,7 @@ if (!r->start && r->end) { if(pci_assign_resource(pdev, 0)) { printk(KERN_ERR PFX "could not assign resource 0\n"); - return (-ENODEV); + return -ENODEV; } } @@ -386,7 +386,7 @@ */ if (pci_enable_device(pdev)) { printk(KERN_ERR PFX "Unable to Enable PCI device\n"); - return (-ENODEV); + return -ENODEV; } /* Fill in the mode register */ @@ -440,6 +440,9 @@ static int __init agp_efficeon_init(void) { static int agp_initialised=0; + + if (agp_off) + return -EINVAL; if (agp_initialised == 1) return 0; diff -Nru a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c --- a/drivers/char/agp/generic.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/char/agp/generic.c 2005-01-02 23:03:33 -08:00 @@ -35,7 +35,10 @@ #include #include #include +#include #include +#include +#include #include "agp.h" __u32 *agp_gatt_table; @@ -47,6 +50,26 @@ */ EXPORT_SYMBOL_GPL(agp_memory_reserved); +#if defined(CONFIG_X86) +int map_page_into_agp(struct page *page) +{ + int i; + i = change_page_attr(page, 1, PAGE_KERNEL_NOCACHE); + global_flush_tlb(); + return i; +} +EXPORT_SYMBOL_GPL(map_page_into_agp); + +int unmap_page_from_agp(struct page *page) +{ + int i; + i = change_page_attr(page, 1, PAGE_KERNEL); + global_flush_tlb(); + return i; +} +EXPORT_SYMBOL_GPL(unmap_page_from_agp); +#endif + /* * Generic routines for handling agp_memory structures - * They use the basic page allocation routines to do the brunt of the work. @@ -181,8 +204,7 @@ agp_free_memory(new); return NULL; } - new->memory[i] = - agp_bridge->driver->mask_memory(virt_to_phys(addr), type); + new->memory[i] = virt_to_phys(addr); new->page_count++; } @@ -507,7 +529,7 @@ u32 tmp; u32 agp3; - while ((device = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, device)) != NULL) { + for_each_pci_dev(device) { cap_ptr = pci_find_capability(device, PCI_CAP_ID_AGP); if (!cap_ptr) continue; @@ -551,7 +573,7 @@ if (agp_v3) mode *= 4; - while ((device = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, device)) != NULL) { + for_each_pci_dev(device) { u8 agp = pci_find_capability(device, PCI_CAP_ID_AGP); if (!agp) continue; @@ -737,8 +759,10 @@ agp_bridge->gatt_bus_addr = virt_to_phys(agp_bridge->gatt_table_real); /* AK: bogus, should encode addresses > 4GB */ - for (i = 0; i < num_entries; i++) + for (i = 0; i < num_entries; i++) { writel(agp_bridge->scratch_page, agp_bridge->gatt_table+i); + readl(agp_bridge->gatt_table+i); /* PCI Posting. */ + } return 0; } @@ -854,8 +878,10 @@ mem->is_flushed = TRUE; } - for (i = 0, j = pg_start; i < mem->page_count; i++, j++) + for (i = 0, j = pg_start; i < mem->page_count; i++, j++) { writel(agp_bridge->driver->mask_memory(mem->memory[i], mem->type), agp_bridge->gatt_table+j); + readl(agp_bridge->gatt_table+j); /* PCI Posting. */ + } agp_bridge->driver->tlb_flush(mem); return 0; @@ -873,9 +899,12 @@ } /* AK: bogus, should encode addresses > 4GB */ - for (i = pg_start; i < (mem->page_count + pg_start); i++) + for (i = pg_start; i < (mem->page_count + pg_start); i++) { writel(agp_bridge->scratch_page, agp_bridge->gatt_table+i); + readl(agp_bridge->gatt_table+i); /* PCI Posting. */ + } + global_cache_flush(); agp_bridge->driver->tlb_flush(mem); return 0; } @@ -958,21 +987,15 @@ EXPORT_SYMBOL(agp_enable); -#ifdef CONFIG_SMP static void ipi_handler(void *null) { flush_agp_cache(); } -#endif void global_cache_flush(void) { -#ifdef CONFIG_SMP if (on_each_cpu(ipi_handler, NULL, 1, 1) != 0) panic(PFX "timed out waiting for the other CPUs!\n"); -#else - flush_agp_cache(); -#endif } EXPORT_SYMBOL(global_cache_flush); diff -Nru a/drivers/char/agp/hp-agp.c b/drivers/char/agp/hp-agp.c --- a/drivers/char/agp/hp-agp.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/char/agp/hp-agp.c 2005-01-02 23:03:34 -08:00 @@ -88,7 +88,7 @@ * - IOVA space is 1Gb in size * - first 512Mb is IOMMU, second 512Mb is GART */ - hp->io_tlb_ps = INREG64(hp->ioc_regs, HP_ZX1_TCNFG); + hp->io_tlb_ps = readq(hp->ioc_regs+HP_ZX1_TCNFG); switch (hp->io_tlb_ps) { case 0: hp->io_tlb_shift = 12; break; case 1: hp->io_tlb_shift = 13; break; @@ -104,13 +104,13 @@ hp->io_page_size = 1 << hp->io_tlb_shift; hp->io_pages_per_kpage = PAGE_SIZE / hp->io_page_size; - hp->iova_base = INREG64(hp->ioc_regs, HP_ZX1_IBASE) & ~0x1; + hp->iova_base = readq(hp->ioc_regs+HP_ZX1_IBASE) & ~0x1; hp->gart_base = hp->iova_base + HP_ZX1_IOVA_SIZE - HP_ZX1_GART_SIZE; hp->gart_size = HP_ZX1_GART_SIZE; hp->gatt_entries = hp->gart_size / hp->io_page_size; - hp->io_pdir = phys_to_virt(INREG64(hp->ioc_regs, HP_ZX1_PDIR_BASE)); + hp->io_pdir = phys_to_virt(readq(hp->ioc_regs+HP_ZX1_PDIR_BASE)); hp->gatt = &hp->io_pdir[HP_ZX1_IOVA_TO_PDIR(hp->gart_base)]; if (hp->gatt[0] != HP_ZX1_SBA_IOMMU_COOKIE) { @@ -174,7 +174,7 @@ * If the IOTLB is currently disabled, we can take it over. * Otherwise, we have to share with sba_iommu. */ - hp->io_pdir_owner = (INREG64(hp->ioc_regs, HP_ZX1_IBASE) & 0x1) == 0; + hp->io_pdir_owner = (readq(hp->ioc_regs+HP_ZX1_IBASE) & 0x1) == 0; if (hp->io_pdir_owner) return hp_zx1_ioc_owner(); @@ -189,18 +189,18 @@ u8 pos, id; int ttl = 48; - status = INREG16(hpa, PCI_STATUS); + status = readw(hpa+PCI_STATUS); if (!(status & PCI_STATUS_CAP_LIST)) return 0; - pos = INREG8(hpa, PCI_CAPABILITY_LIST); + pos = readb(hpa+PCI_CAPABILITY_LIST); while (ttl-- && pos >= 0x40) { pos &= ~3; - id = INREG8(hpa, pos + PCI_CAP_LIST_ID); + id = readb(hpa+pos+PCI_CAP_LIST_ID); if (id == 0xff) break; if (id == cap) return pos; - pos = INREG8(hpa, pos + PCI_CAP_LIST_NEXT); + pos = readb(hpa+pos+PCI_CAP_LIST_NEXT); } return 0; } @@ -217,7 +217,7 @@ hp->lba_cap_offset = hp_zx1_lba_find_capability(hp->lba_regs, PCI_CAP_ID_AGP); - cap = INREG32(hp->lba_regs, hp->lba_cap_offset) & 0xff; + cap = readl(hp->lba_regs+hp->lba_cap_offset) & 0xff; if (cap != PCI_CAP_ID_AGP) { printk(KERN_ERR PFX "Invalid capability ID 0x%02x at 0x%x\n", cap, hp->lba_cap_offset); @@ -245,15 +245,19 @@ agp_bridge->gart_bus_addr = hp->gart_base; agp_bridge->capndx = hp->lba_cap_offset; - agp_bridge->mode = INREG32(hp->lba_regs, hp->lba_cap_offset + PCI_AGP_STATUS); + agp_bridge->mode = readl(hp->lba_regs+hp->lba_cap_offset+PCI_AGP_STATUS); if (hp->io_pdir_owner) { - OUTREG64(hp->ioc_regs, HP_ZX1_PDIR_BASE, virt_to_phys(hp->io_pdir)); - OUTREG64(hp->ioc_regs, HP_ZX1_TCNFG, hp->io_tlb_ps); - OUTREG64(hp->ioc_regs, HP_ZX1_IMASK, ~(HP_ZX1_IOVA_SIZE - 1)); - OUTREG64(hp->ioc_regs, HP_ZX1_IBASE, hp->iova_base | 0x1); - OUTREG64(hp->ioc_regs, HP_ZX1_PCOM, hp->iova_base | log2(HP_ZX1_IOVA_SIZE)); - INREG64(hp->ioc_regs, HP_ZX1_PCOM); + writel(virt_to_phys(hp->io_pdir), hp->ioc_regs+HP_ZX1_PDIR_BASE); + readl(hp->ioc_regs+HP_ZX1_PDIR_BASE); + writel(hp->io_tlb_ps, hp->ioc_regs+HP_ZX1_TCNFG); + readl(hp->ioc_regs+HP_ZX1_TCNFG); + writel(~(HP_ZX1_IOVA_SIZE-1), hp->ioc_regs+HP_ZX1_IMASK); + readl(hp->ioc_regs+HP_ZX1_IMASK); + writel(hp->iova_base|1, hp->ioc_regs+HP_ZX1_IBASE); + readl(hp->ioc_regs+HP_ZX1_IBASE); + writel(hp->iova_base|log2(HP_ZX1_IOVA_SIZE), hp->ioc_regs+HP_ZX1_PCOM); + readl(hp->ioc_regs+HP_ZX1_PCOM); } return 0; @@ -265,8 +269,10 @@ struct _hp_private *hp = &hp_private; if (hp->ioc_regs) { - if (hp->io_pdir_owner) - OUTREG64(hp->ioc_regs, HP_ZX1_IBASE, 0); + if (hp->io_pdir_owner) { + writeq(0, hp->ioc_regs+HP_ZX1_IBASE); + readq(hp->ioc_regs+HP_ZX1_IBASE); + } iounmap(hp->ioc_regs); } if (hp->lba_regs) @@ -278,8 +284,8 @@ { struct _hp_private *hp = &hp_private; - OUTREG64(hp->ioc_regs, HP_ZX1_PCOM, hp->gart_base | log2(hp->gart_size)); - INREG64(hp->ioc_regs, HP_ZX1_PCOM); + writeq(hp->gart_base | log2(hp->gart_size), hp->ioc_regs+HP_ZX1_PCOM); + readq(hp->ioc_regs+HP_ZX1_PCOM); } static int @@ -401,12 +407,11 @@ struct _hp_private *hp = &hp_private; u32 command; - command = INREG32(hp->lba_regs, hp->lba_cap_offset + PCI_AGP_STATUS); - + command = readl(hp->lba_regs+hp->lba_cap_offset+PCI_AGP_STATUS); command = agp_collect_device_status(mode, command); command |= 0x00000100; - OUTREG32(hp->lba_regs, hp->lba_cap_offset + PCI_AGP_COMMAND, command); + writel(command, hp->lba_regs+hp->lba_cap_offset+PCI_AGP_COMMAND); agp_device_command(command, (mode & AGP8X_MODE) != 0); } @@ -519,6 +524,8 @@ static int __init agp_hp_init (void) { + if (agp_off) + return -EINVAL; acpi_get_devices("HWP0003", zx1_gart_probe, "HWP0003", NULL); if (hp_zx1_gart_found) diff -Nru a/drivers/char/agp/i460-agp.c b/drivers/char/agp/i460-agp.c --- a/drivers/char/agp/i460-agp.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/char/agp/i460-agp.c 2005-01-02 23:03:34 -08:00 @@ -532,8 +532,8 @@ static unsigned long i460_mask_memory (unsigned long addr, int type) { /* Make sure the returned address is a valid GATT entry */ - return (agp_bridge->driver->masks[0].mask - | (((addr & ~((1 << I460_IO_PAGE_SHIFT) - 1)) & 0xffffff000) >> 12)); + return agp_bridge->driver->masks[0].mask + | (((addr & ~((1 << I460_IO_PAGE_SHIFT) - 1)) & 0xffffff000) >> 12); } struct agp_bridge_driver intel_i460_driver = { @@ -585,6 +585,8 @@ bridge->dev = pdev; bridge->capndx = cap_ptr; + printk(KERN_INFO PFX "Detected Intel 460GX chipset\n"); + pci_set_drvdata(pdev, bridge); return agp_add_bridge(bridge); } @@ -620,6 +622,8 @@ static int __init agp_intel_i460_init(void) { + if (agp_off) + return -EINVAL; return pci_module_init(&agp_intel_i460_pci_driver); } diff -Nru a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c --- a/drivers/char/agp/intel-agp.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/char/agp/intel-agp.c 2005-01-02 23:03:34 -08:00 @@ -117,7 +117,7 @@ return -ENOMEM; } - if ((INREG32(intel_i810_private.registers, I810_DRAM_CTL) + if ((readl(intel_i810_private.registers+I810_DRAM_CTL) & I810_DRAM_ROW_0) == I810_DRAM_ROW_0_SDRAM) { /* This will need to be dynamically assigned */ printk(KERN_INFO PFX "detected 4MB dedicated video ram.\n"); @@ -125,23 +125,23 @@ } pci_read_config_dword(intel_i810_private.i810_dev, I810_GMADDR, &temp); agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); - OUTREG32(intel_i810_private.registers, I810_PGETBL_CTL, - agp_bridge->gatt_bus_addr | I810_PGETBL_ENABLED); - global_cache_flush(); + writel(agp_bridge->gatt_bus_addr | I810_PGETBL_ENABLED, intel_i810_private.registers+I810_PGETBL_CTL); + readl(intel_i810_private.registers+I810_PGETBL_CTL); /* PCI Posting. */ if (agp_bridge->driver->needs_scratch_page) { for (i = 0; i < current_size->num_entries; i++) { - OUTREG32(intel_i810_private.registers, - I810_PTE_BASE + (i * 4), - agp_bridge->scratch_page); + writel(agp_bridge->scratch_page, intel_i810_private.registers+I810_PTE_BASE+(i*4)); + readl(intel_i810_private.registers+I810_PTE_BASE+(i*4)); /* PCI posting. */ } } + global_cache_flush(); return 0; } static void intel_i810_cleanup(void) { - OUTREG32(intel_i810_private.registers, I810_PGETBL_CTL, 0); + writel(0, intel_i810_private.registers+I810_PGETBL_CTL); + readl(intel_i810_private.registers); /* PCI Posting. */ iounmap(intel_i810_private.registers); } @@ -161,13 +161,15 @@ struct page * page; page = alloc_pages(GFP_KERNEL, 2); - if (page == NULL) { + if (page == NULL) return NULL; - } + if (change_page_attr(page, 4, PAGE_KERNEL_NOCACHE) < 0) { + global_flush_tlb(); __free_page(page); return NULL; } + global_flush_tlb(); get_page(page); SetPageLocked(page); atomic_inc(&agp_bridge->current_memory_agp); @@ -183,6 +185,7 @@ page = virt_to_page(addr); change_page_attr(page, 4, PAGE_KERNEL); + global_flush_tlb(); put_page(page); unlock_page(page); free_pages((unsigned long)addr, 2); @@ -211,10 +214,8 @@ /* special insert */ global_cache_flush(); for (i = pg_start; i < (pg_start + mem->page_count); i++) { - OUTREG32(intel_i810_private.registers, - I810_PTE_BASE + (i * 4), - (i * 4096) | I810_PTE_LOCAL | - I810_PTE_VALID); + writel((i*4096)|I810_PTE_LOCAL|I810_PTE_VALID, intel_i810_private.registers+I810_PTE_BASE+(i*4)); + readl(intel_i810_private.registers+I810_PTE_BASE+(i*4)); /* PCI Posting. */ } global_cache_flush(); agp_bridge->driver->tlb_flush(mem); @@ -228,9 +229,9 @@ insert: global_cache_flush(); for (i = 0, j = pg_start; i < mem->page_count; i++, j++) { - OUTREG32(intel_i810_private.registers, - I810_PTE_BASE + (j * 4), - agp_bridge->driver->mask_memory(mem->memory[i], mem->type)); + writel(agp_bridge->driver->mask_memory(mem->memory[i], mem->type), + intel_i810_private.registers+I810_PTE_BASE+(j*4)); + readl(intel_i810_private.registers+I810_PTE_BASE+(j*4)); /* PCI Posting. */ } global_cache_flush(); @@ -244,9 +245,8 @@ int i; for (i = pg_start; i < (mem->page_count + pg_start); i++) { - OUTREG32(intel_i810_private.registers, - I810_PTE_BASE + (i * 4), - agp_bridge->scratch_page); + writel(agp_bridge->scratch_page, intel_i810_private.registers+I810_PTE_BASE+(i*4)); + readl(intel_i810_private.registers+I810_PTE_BASE+(i*4)); /* PCI Posting. */ } global_cache_flush(); @@ -318,7 +318,7 @@ return new; } if (type == AGP_PHYS_MEMORY) - return(alloc_agpphysmem_i8xx(pg_count, type)); + return alloc_agpphysmem_i8xx(pg_count, type); return NULL; } @@ -387,8 +387,7 @@ gtt_entries = MB(8) - KB(size); break; case I830_GMCH_GMS_LOCAL: - rdct = INREG8(intel_i830_private.registers, - I830_RDRAM_CHANNEL_TYPE); + rdct = readb(intel_i830_private.registers+I830_RDRAM_CHANNEL_TYPE); gtt_entries = (I830_RDRAM_ND(rdct) + 1) * MB(ddt[I830_RDRAM_DDT(rdct)]); local = 1; @@ -463,10 +462,10 @@ intel_i830_private.registers = ioremap(temp,128 * 4096); if (!intel_i830_private.registers) - return (-ENOMEM); + return -ENOMEM; - temp = INREG32(intel_i830_private.registers,I810_PGETBL_CTL) & 0xfffff000; - global_cache_flush(); + temp = readl(intel_i830_private.registers+I810_PGETBL_CTL) & 0xfffff000; + global_cache_flush(); /* FIXME: ?? */ /* we have to call this as early as possible after the MMIO base address is known */ intel_i830_init_gtt_entries(); @@ -475,7 +474,7 @@ agp_bridge->gatt_bus_addr = temp; - return(0); + return 0; } /* Return the gatt table to a sane state. Use the top of stolen @@ -483,7 +482,7 @@ */ static int intel_i830_free_gatt_table(void) { - return(0); + return 0; } static int intel_i830_fetch_size(void) @@ -498,7 +497,7 @@ /* 855GM/852GM/865G has 128MB aperture size */ agp_bridge->previous_size = agp_bridge->current_size = (void *) values; agp_bridge->aperture_size_idx = 0; - return(values[0].size); + return values[0].size; } pci_read_config_word(agp_bridge->dev,I830_GMCH_CTRL,&gmch_ctrl); @@ -506,14 +505,14 @@ if ((gmch_ctrl & I830_GMCH_MEM_MASK) == I830_GMCH_MEM_128M) { agp_bridge->previous_size = agp_bridge->current_size = (void *) values; agp_bridge->aperture_size_idx = 0; - return(values[0].size); + return values[0].size; } else { agp_bridge->previous_size = agp_bridge->current_size = (void *) (values + 1); agp_bridge->aperture_size_idx = 1; - return(values[1].size); + return values[1].size; } - return(0); + return 0; } static int intel_i830_configure(void) @@ -532,14 +531,18 @@ gmch_ctrl |= I830_GMCH_ENABLED; pci_write_config_word(agp_bridge->dev,I830_GMCH_CTRL,gmch_ctrl); - OUTREG32(intel_i830_private.registers,I810_PGETBL_CTL,agp_bridge->gatt_bus_addr | I810_PGETBL_ENABLED); - global_cache_flush(); + writel(agp_bridge->gatt_bus_addr|I810_PGETBL_ENABLED, intel_i830_private.registers+I810_PGETBL_CTL); + readl(intel_i830_private.registers+I810_PGETBL_CTL); /* PCI Posting. */ - if (agp_bridge->driver->needs_scratch_page) - for (i = intel_i830_private.gtt_entries; i < current_size->num_entries; i++) - OUTREG32(intel_i830_private.registers,I810_PTE_BASE + (i * 4),agp_bridge->scratch_page); + if (agp_bridge->driver->needs_scratch_page) { + for (i = intel_i830_private.gtt_entries; i < current_size->num_entries; i++) { + writel(agp_bridge->scratch_page, intel_i830_private.registers+I810_PTE_BASE+(i*4)); + readl(intel_i830_private.registers+I810_PTE_BASE+(i*4)); /* PCI Posting. */ + } + } - return (0); + global_cache_flush(); + return 0; } static void intel_i830_cleanup(void) @@ -547,8 +550,7 @@ iounmap(intel_i830_private.registers); } -static int intel_i830_insert_entries(struct agp_memory *mem,off_t pg_start, - int type) +static int intel_i830_insert_entries(struct agp_memory *mem,off_t pg_start, int type) { int i,j,num_entries; void *temp; @@ -561,11 +563,11 @@ pg_start,intel_i830_private.gtt_entries); printk (KERN_INFO PFX "Trying to insert into local/stolen memory\n"); - return (-EINVAL); + return -EINVAL; } if ((pg_start + mem->page_count) > num_entries) - return (-EINVAL); + return -EINVAL; /* The i830 can't check the GTT for entries since its read only, * depend on the caller to make the correct offset decisions. @@ -573,19 +575,19 @@ if ((type != 0 && type != AGP_PHYS_MEMORY) || (mem->type != 0 && mem->type != AGP_PHYS_MEMORY)) - return (-EINVAL); + return -EINVAL; - global_cache_flush(); + global_cache_flush(); /* FIXME: Necessary ?*/ - for (i = 0, j = pg_start; i < mem->page_count; i++, j++) - OUTREG32(intel_i830_private.registers,I810_PTE_BASE + (j * 4), - agp_bridge->driver->mask_memory(mem->memory[i], mem->type)); + for (i = 0, j = pg_start; i < mem->page_count; i++, j++) { + writel(agp_bridge->driver->mask_memory(mem->memory[i], mem->type), + intel_i830_private.registers+I810_PTE_BASE+(j*4)); + readl(intel_i830_private.registers+I810_PTE_BASE+(j*4)); /* PCI Posting. */ + } global_cache_flush(); - agp_bridge->driver->tlb_flush(mem); - - return(0); + return 0; } static int intel_i830_remove_entries(struct agp_memory *mem,off_t pg_start, @@ -597,26 +599,26 @@ if (pg_start < intel_i830_private.gtt_entries) { printk (KERN_INFO PFX "Trying to disable local/stolen memory\n"); - return (-EINVAL); + return -EINVAL; } - for (i = pg_start; i < (mem->page_count + pg_start); i++) - OUTREG32(intel_i830_private.registers,I810_PTE_BASE + (i * 4),agp_bridge->scratch_page); + for (i = pg_start; i < (mem->page_count + pg_start); i++) { + writel(agp_bridge->scratch_page, intel_i830_private.registers+I810_PTE_BASE+(i*4)); + readl(intel_i830_private.registers+I810_PTE_BASE+(i*4)); /* PCI Posting. */ + } global_cache_flush(); - agp_bridge->driver->tlb_flush(mem); - - return (0); + return 0; } static struct agp_memory *intel_i830_alloc_by_type(size_t pg_count,int type) { if (type == AGP_PHYS_MEMORY) - return(alloc_agpphysmem_i8xx(pg_count, type)); + return alloc_agpphysmem_i8xx(pg_count, type); /* always return NULL for other allocation types for now */ - return(NULL); + return NULL; } static int intel_i915_configure(void) @@ -636,15 +638,18 @@ gmch_ctrl |= I830_GMCH_ENABLED; pci_write_config_word(agp_bridge->dev,I830_GMCH_CTRL,gmch_ctrl); - OUTREG32(intel_i830_private.registers,I810_PGETBL_CTL,agp_bridge->gatt_bus_addr | I810_PGETBL_ENABLED); - global_cache_flush(); + writel(agp_bridge->gatt_bus_addr|I810_PGETBL_ENABLED, intel_i830_private.registers+I810_PGETBL_CTL); + readl(intel_i830_private.registers+I810_PGETBL_CTL); /* PCI Posting. */ if (agp_bridge->driver->needs_scratch_page) { - for (i = intel_i830_private.gtt_entries; i < current_size->num_entries; i++) - OUTREG32(intel_i830_private.gtt, i, agp_bridge->scratch_page); + for (i = intel_i830_private.gtt_entries; i < current_size->num_entries; i++) { + writel(agp_bridge->scratch_page, intel_i830_private.gtt+i); + readl(intel_i830_private.gtt+i); /* PCI Posting. */ + } } - return (0); + global_cache_flush(); + return 0; } static void intel_i915_cleanup(void) @@ -667,11 +672,11 @@ pg_start,intel_i830_private.gtt_entries); printk (KERN_INFO PFX "Trying to insert into local/stolen memory\n"); - return (-EINVAL); + return -EINVAL; } if ((pg_start + mem->page_count) > num_entries) - return (-EINVAL); + return -EINVAL; /* The i830 can't check the GTT for entries since its read only, * depend on the caller to make the correct offset decisions. @@ -679,18 +684,18 @@ if ((type != 0 && type != AGP_PHYS_MEMORY) || (mem->type != 0 && mem->type != AGP_PHYS_MEMORY)) - return (-EINVAL); + return -EINVAL; global_cache_flush(); - for (i = 0, j = pg_start; i < mem->page_count; i++, j++) - OUTREG32(intel_i830_private.gtt, j, agp_bridge->driver->mask_memory(mem->memory[i], mem->type)); + for (i = 0, j = pg_start; i < mem->page_count; i++, j++) { + writel(agp_bridge->driver->mask_memory(mem->memory[i], mem->type), intel_i830_private.gtt+j); + readl(intel_i830_private.gtt+j); /* PCI Posting. */ + } global_cache_flush(); - agp_bridge->driver->tlb_flush(mem); - - return(0); + return 0; } static int intel_i915_remove_entries(struct agp_memory *mem,off_t pg_start, @@ -702,17 +707,17 @@ if (pg_start < intel_i830_private.gtt_entries) { printk (KERN_INFO PFX "Trying to disable local/stolen memory\n"); - return (-EINVAL); + return -EINVAL; } - for (i = pg_start; i < (mem->page_count + pg_start); i++) - OUTREG32(intel_i830_private.gtt, i, agp_bridge->scratch_page); + for (i = pg_start; i < (mem->page_count + pg_start); i++) { + writel(agp_bridge->scratch_page, intel_i830_private.gtt+i); + readl(intel_i830_private.gtt+i); + } global_cache_flush(); - agp_bridge->driver->tlb_flush(mem); - - return (0); + return 0; } static int intel_i915_fetch_size(void) @@ -730,7 +735,7 @@ else offset = 2; /* 256MB aperture */ agp_bridge->previous_size = agp_bridge->current_size = (void *)(values + offset); - return(values[offset].size); + return values[offset].size; } /* The intel i915 automatically initializes the agp aperture during POST. @@ -753,16 +758,16 @@ intel_i830_private.gtt = ioremap(temp2, 256 * 1024); if (!intel_i830_private.gtt) - return (-ENOMEM); + return -ENOMEM; temp &= 0xfff80000; intel_i830_private.registers = ioremap(temp,128 * 4096); if (!intel_i830_private.registers) - return (-ENOMEM); + return -ENOMEM; - temp = INREG32(intel_i830_private.registers,I810_PGETBL_CTL) & 0xfffff000; - global_cache_flush(); + temp = readl(intel_i830_private.registers+I810_PGETBL_CTL) & 0xfffff000; + global_cache_flush(); /* FIXME: ? */ /* we have to call this as early as possible after the MMIO base address is known */ intel_i830_init_gtt_entries(); @@ -771,7 +776,7 @@ agp_bridge->gatt_bus_addr = temp; - return(0); + return 0; } static int intel_fetch_size(void) @@ -1493,7 +1498,7 @@ { struct pci_dev *i810_dev; - i810_dev = pci_find_device(PCI_VENDOR_ID_INTEL, device, NULL); + i810_dev = pci_get_device(PCI_VENDOR_ID_INTEL, device, NULL); if (!i810_dev) return 0; intel_i810_private.i810_dev = i810_dev; @@ -1504,9 +1509,9 @@ { struct pci_dev *i830_dev; - i830_dev = pci_find_device(PCI_VENDOR_ID_INTEL, device, NULL); + i830_dev = pci_get_device(PCI_VENDOR_ID_INTEL, device, NULL); if (i830_dev && PCI_FUNC(i830_dev->devfn) != 0) { - i830_dev = pci_find_device(PCI_VENDOR_ID_INTEL, + i830_dev = pci_get_device(PCI_VENDOR_ID_INTEL, device, i830_dev); } @@ -1715,6 +1720,7 @@ { struct agp_bridge_data *bridge = pci_get_drvdata(pdev); + pci_dev_put(pdev); agp_remove_bridge(bridge); agp_put_bridge(bridge); } diff -Nru a/drivers/char/agp/intel-mch-agp.c b/drivers/char/agp/intel-mch-agp.c --- a/drivers/char/agp/intel-mch-agp.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/char/agp/intel-mch-agp.c 2005-01-02 23:03:33 -08:00 @@ -51,7 +51,7 @@ if (new == NULL) return NULL; - new->memory[0] = agp_bridge->driver->mask_memory(virt_to_phys(addr), type); + new->memory[0] = virt_to_phys(addr); new->page_count = 1; new->num_scratch_pages = 1; new->type = AGP_PHYS_MEMORY; @@ -111,8 +111,7 @@ gtt_entries = MB(8) - KB(132); break; case I830_GMCH_GMS_LOCAL: - rdct = INREG8(intel_i830_private.registers, - I830_RDRAM_CHANNEL_TYPE); + rdct = readb(intel_i830_private.registers+I830_RDRAM_CHANNEL_TYPE); gtt_entries = (I830_RDRAM_ND(rdct) + 1) * MB(ddt[I830_RDRAM_DDT(rdct)]); local = 1; @@ -174,10 +173,10 @@ intel_i830_private.registers = (volatile u8 __iomem*) ioremap(temp,128 * 4096); if (!intel_i830_private.registers) - return (-ENOMEM); + return -ENOMEM; - temp = INREG32(intel_i830_private.registers,I810_PGETBL_CTL) & 0xfffff000; - global_cache_flush(); + temp = readl(intel_i830_private.registers+I810_PGETBL_CTL) & 0xfffff000; + global_cache_flush(); /* FIXME: ?? */ /* we have to call this as early as possible after the MMIO base address is known */ intel_i830_init_gtt_entries(); @@ -186,7 +185,7 @@ agp_bridge->gatt_bus_addr = temp; - return(0); + return 0; } /* Return the gatt table to a sane state. Use the top of stolen @@ -194,7 +193,7 @@ */ static int intel_i830_free_gatt_table(void) { - return(0); + return 0; } static int intel_i830_fetch_size(void) @@ -209,7 +208,7 @@ /* 855GM/852GM/865G has 128MB aperture size */ agp_bridge->previous_size = agp_bridge->current_size = (void *) values; agp_bridge->aperture_size_idx = 0; - return(values[0].size); + return values[0].size; } pci_read_config_word(agp_bridge->dev,I830_GMCH_CTRL,&gmch_ctrl); @@ -217,14 +216,14 @@ if ((gmch_ctrl & I830_GMCH_MEM_MASK) == I830_GMCH_MEM_128M) { agp_bridge->previous_size = agp_bridge->current_size = (void *) values; agp_bridge->aperture_size_idx = 0; - return(values[0].size); + return values[0].size; } else { agp_bridge->previous_size = agp_bridge->current_size = (void *) values; agp_bridge->aperture_size_idx = 1; - return(values[1].size); + return values[1].size; } - return(0); + return 0; } static int intel_i830_configure(void) @@ -243,14 +242,17 @@ gmch_ctrl |= I830_GMCH_ENABLED; pci_write_config_word(agp_bridge->dev,I830_GMCH_CTRL,gmch_ctrl); - OUTREG32(intel_i830_private.registers,I810_PGETBL_CTL,agp_bridge->gatt_bus_addr | I810_PGETBL_ENABLED); - global_cache_flush(); - - if (agp_bridge->driver->needs_scratch_page) - for (i = intel_i830_private.gtt_entries; i < current_size->num_entries; i++) - OUTREG32(intel_i830_private.registers,I810_PTE_BASE + (i * 4),agp_bridge->scratch_page); + writel(agp_bridge->gatt_bus_addr|I810_PGETBL_ENABLED, intel_i830_private.registers+I810_PGETBL_CTL); + readl(intel_i830_private.registers+I810_PGETBL_CTL); /* PCI Posting. */ - return (0); + if (agp_bridge->driver->needs_scratch_page) { + for (i = intel_i830_private.gtt_entries; i < current_size->num_entries; i++) { + writel(agp_bridge->scratch_page, intel_i830_private.registers+I810_PTE_BASE+(i*4)); + readl(intel_i830_private.registers+I810_PTE_BASE+(i*4)); /* PCI Posting. */ + } + } + global_cache_flush(); + return 0; } static void intel_i830_cleanup(void) @@ -272,11 +274,11 @@ pg_start,intel_i830_private.gtt_entries); printk (KERN_INFO PFX "Trying to insert into local/stolen memory\n"); - return (-EINVAL); + return -EINVAL; } if ((pg_start + mem->page_count) > num_entries) - return (-EINVAL); + return -EINVAL; /* The i830 can't check the GTT for entries since its read only, * depend on the caller to make the correct offset decisions. @@ -284,19 +286,21 @@ if ((type != 0 && type != AGP_PHYS_MEMORY) || (mem->type != 0 && mem->type != AGP_PHYS_MEMORY)) - return (-EINVAL); + return -EINVAL; - global_cache_flush(); + global_cache_flush(); /* FIXME: ?? */ - for (i = 0, j = pg_start; i < mem->page_count; i++, j++) - OUTREG32(intel_i830_private.registers,I810_PTE_BASE + (j * 4), - agp_bridge->driver->mask_memory(mem->memory[i], mem->type)); + for (i = 0, j = pg_start; i < mem->page_count; i++, j++) { + writel(agp_bridge->driver->mask_memory(mem->memory[i], mem->type), + intel_i830_private.registers+I810_PTE_BASE+(j*4)); + readl(intel_i830_private.registers+I810_PTE_BASE+(j*4)); /* PCI Posting. */ + } global_cache_flush(); agp_bridge->driver->tlb_flush(mem); - return(0); + return 0; } static int intel_i830_remove_entries(struct agp_memory *mem,off_t pg_start, @@ -308,26 +312,26 @@ if (pg_start < intel_i830_private.gtt_entries) { printk (KERN_INFO PFX "Trying to disable local/stolen memory\n"); - return (-EINVAL); + return -EINVAL; } - for (i = pg_start; i < (mem->page_count + pg_start); i++) - OUTREG32(intel_i830_private.registers,I810_PTE_BASE + (i * 4),agp_bridge->scratch_page); + for (i = pg_start; i < (mem->page_count + pg_start); i++) { + writel(agp_bridge->scratch_page, intel_i830_private.registers+I810_PTE_BASE+(i*4)); + readl(intel_i830_private.registers+I810_PTE_BASE+(i*4)); /* PCI Posting. */ + } global_cache_flush(); - agp_bridge->driver->tlb_flush(mem); - - return (0); + return 0; } static struct agp_memory *intel_i830_alloc_by_type(size_t pg_count,int type) { if (type == AGP_PHYS_MEMORY) - return(alloc_agpphysmem_i8xx(pg_count, type)); + return alloc_agpphysmem_i8xx(pg_count, type); /* always return NULL for other allocation types for now */ - return(NULL); + return NULL; } static int intel_8xx_fetch_size(void) @@ -470,9 +474,9 @@ { struct pci_dev *i830_dev; - i830_dev = pci_find_device(PCI_VENDOR_ID_INTEL, device, NULL); + i830_dev = pci_get_device(PCI_VENDOR_ID_INTEL, device, NULL); if (i830_dev && PCI_FUNC(i830_dev->devfn) != 0) { - i830_dev = pci_find_device(PCI_VENDOR_ID_INTEL, + i830_dev = pci_get_device(PCI_VENDOR_ID_INTEL, device, i830_dev); } @@ -536,7 +540,7 @@ if (!r->start && r->end) { if(pci_assign_resource(pdev, 0)) { printk(KERN_ERR PFX "could not assign resource 0\n"); - return (-ENODEV); + return -ENODEV; } } @@ -547,7 +551,7 @@ */ if (pci_enable_device(pdev)) { printk(KERN_ERR PFX "Unable to Enable PCI device\n"); - return (-ENODEV); + return -ENODEV; } /* Fill in the mode register */ @@ -565,6 +569,7 @@ { struct agp_bridge_data *bridge = pci_get_drvdata(pdev); + pci_dev_put(pdev); agp_remove_bridge(bridge); agp_put_bridge(bridge); } diff -Nru a/drivers/char/agp/isoch.c b/drivers/char/agp/isoch.c --- a/drivers/char/agp/isoch.c 2005-01-02 23:03:35 -08:00 +++ b/drivers/char/agp/isoch.c 2005-01-02 23:03:35 -08:00 @@ -347,7 +347,7 @@ INIT_LIST_HEAD(head); /* Find all AGP devices, and add them to dev_list. */ - while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { + for_each_pci_dev(dev) { mcapndx = pci_find_capability(dev, PCI_CAP_ID_AGP); if (mcapndx == 0) continue; diff -Nru a/drivers/char/agp/nvidia-agp.c b/drivers/char/agp/nvidia-agp.c --- a/drivers/char/agp/nvidia-agp.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/char/agp/nvidia-agp.c 2005-01-02 23:03:33 -08:00 @@ -214,9 +214,11 @@ global_cache_flush(); mem->is_flushed = TRUE; } - for (i = 0, j = pg_start; i < mem->page_count; i++, j++) + for (i = 0, j = pg_start; i < mem->page_count; i++, j++) { writel(agp_bridge->driver->mask_memory(mem->memory[i], mem->type), agp_bridge->gatt_table+nvidia_private.pg_offset+j); + readl(agp_bridge->gatt_table+nvidia_private.pg_offset+j); /* PCI Posting. */ + } agp_bridge->driver->tlb_flush(mem); return 0; } @@ -403,6 +405,8 @@ static int __init agp_nvidia_init(void) { + if (agp_off) + return -EINVAL; return pci_module_init(&agp_nvidia_pci_driver); } diff -Nru a/drivers/char/agp/sis-agp.c b/drivers/char/agp/sis-agp.c --- a/drivers/char/agp/sis-agp.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/char/agp/sis-agp.c 2005-01-02 23:03:33 -08:00 @@ -340,6 +340,8 @@ static int __init agp_sis_init(void) { + if (agp_off) + return -EINVAL; return pci_module_init(&agp_sis_pci_driver); } diff -Nru a/drivers/char/agp/sworks-agp.c b/drivers/char/agp/sworks-agp.c --- a/drivers/char/agp/sworks-agp.c 2005-01-02 23:03:35 -08:00 +++ b/drivers/char/agp/sworks-agp.c 2005-01-02 23:03:35 -08:00 @@ -242,12 +242,12 @@ */ static void serverworks_tlbflush(struct agp_memory *temp) { - OUTREG8(serverworks_private.registers, SVWRKS_POSTFLUSH, 1); - while(INREG8(serverworks_private.registers, SVWRKS_POSTFLUSH) == 1) + writeb(1, serverworks_private.registers+SVWRKS_POSTFLUSH); + while (readb(serverworks_private.registers+SVWRKS_POSTFLUSH) == 1) cpu_relax(); - OUTREG32(serverworks_private.registers, SVWRKS_DIRFLUSH, 1); - while(INREG32(serverworks_private.registers, SVWRKS_DIRFLUSH) == 1) + writel(1, serverworks_private.registers+SVWRKS_DIRFLUSH); + while(readl(serverworks_private.registers+SVWRKS_DIRFLUSH) == 1) cpu_relax(); } @@ -269,21 +269,21 @@ return -ENOMEM; } - OUTREG8(serverworks_private.registers, SVWRKS_GART_CACHE, 0x0a); + writeb(0xA, serverworks_private.registers+SVWRKS_GART_CACHE); + readb(serverworks_private.registers+SVWRKS_GART_CACHE); /* PCI Posting. */ - OUTREG32(serverworks_private.registers, SVWRKS_GATTBASE, - agp_bridge->gatt_bus_addr); + writel(agp_bridge->gatt_bus_addr, serverworks_private.registers+SVWRKS_GATTBASE); + readl(serverworks_private.registers+SVWRKS_GATTBASE); /* PCI Posting. */ - cap_reg = INREG16(serverworks_private.registers, SVWRKS_COMMAND); + cap_reg = readw(serverworks_private.registers+SVWRKS_COMMAND); cap_reg &= ~0x0007; cap_reg |= 0x4; - OUTREG16(serverworks_private.registers, SVWRKS_COMMAND, cap_reg); + writew(cap_reg, serverworks_private.registers+SVWRKS_COMMAND); + readw(serverworks_private.registers+SVWRKS_COMMAND); - pci_read_config_byte(serverworks_private.svrwrks_dev, - SVWRKS_AGP_ENABLE, &enable_reg); + pci_read_config_byte(serverworks_private.svrwrks_dev,SVWRKS_AGP_ENABLE, &enable_reg); enable_reg |= 0x1; /* Agp Enable bit */ - pci_write_config_byte(serverworks_private.svrwrks_dev, - SVWRKS_AGP_ENABLE, enable_reg); + pci_write_config_byte(serverworks_private.svrwrks_dev,SVWRKS_AGP_ENABLE, enable_reg); serverworks_tlbflush(NULL); agp_bridge->capndx = pci_find_capability(serverworks_private.svrwrks_dev, PCI_CAP_ID_AGP); @@ -539,6 +539,8 @@ static int __init agp_serverworks_init(void) { + if (agp_off) + return -EINVAL; return pci_module_init(&agp_serverworks_pci_driver); } diff -Nru a/drivers/char/agp/uninorth-agp.c b/drivers/char/agp/uninorth-agp.c --- a/drivers/char/agp/uninorth-agp.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/char/agp/uninorth-agp.c 2005-01-02 23:03:34 -08:00 @@ -373,6 +373,8 @@ static int __init agp_uninorth_init(void) { + if (agp_off) + return -EINVAL; return pci_module_init(&agp_uninorth_pci_driver); } diff -Nru a/drivers/char/agp/via-agp.c b/drivers/char/agp/via-agp.c --- a/drivers/char/agp/via-agp.c 2005-01-02 23:03:35 -08:00 +++ b/drivers/char/agp/via-agp.c 2005-01-02 23:03:35 -08:00 @@ -523,6 +523,8 @@ static int __init agp_via_init(void) { + if (agp_off) + return -EINVAL; return pci_module_init(&agp_via_pci_driver); } diff -Nru a/drivers/char/drm/Kconfig b/drivers/char/drm/Kconfig --- a/drivers/char/drm/Kconfig 2005-01-02 23:03:34 -08:00 +++ b/drivers/char/drm/Kconfig 2005-01-02 23:03:34 -08:00 @@ -5,7 +5,8 @@ # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. # config DRM - bool "Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)" + tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)" + depends on AGP || AGP=n help Kernel-level support for the Direct Rendering Infrastructure (DRI) introduced in XFree86 4.0. If you say Y here, you need to select diff -Nru a/drivers/char/drm/Makefile b/drivers/char/drm/Makefile --- a/drivers/char/drm/Makefile 2005-01-02 23:03:35 -08:00 +++ b/drivers/char/drm/Makefile 2005-01-02 23:03:35 -08:00 @@ -2,6 +2,11 @@ # Makefile for the drm device driver. This driver provides support for the # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. +drm-objs := drm_auth.o drm_bufs.o drm_context.o drm_dma.o drm_drawable.o \ + drm_drv.o drm_fops.o drm_init.o drm_ioctl.o drm_irq.o \ + drm_lock.o drm_memory.o drm_proc.o drm_stub.o drm_vm.o \ + drm_agpsupport.o drm_scatter.o ati_pcigart.o + gamma-objs := gamma_drv.o gamma_dma.o tdfx-objs := tdfx_drv.o r128-objs := r128_drv.o r128_cce.o r128_state.o r128_irq.o @@ -13,6 +18,7 @@ ffb-objs := ffb_drv.o ffb_context.o sis-objs := sis_drv.o sis_ds.o sis_mm.o +obj-$(CONFIG_DRM) += drm.o obj-$(CONFIG_DRM_GAMMA) += gamma.o obj-$(CONFIG_DRM_TDFX) += tdfx.o obj-$(CONFIG_DRM_R128) += r128.o diff -Nru a/drivers/char/drm/ati_pcigart.c b/drivers/char/drm/ati_pcigart.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/char/drm/ati_pcigart.c 2005-01-02 23:03:35 -08:00 @@ -0,0 +1,208 @@ +/** + * \file ati_pcigart.h + * ATI PCI GART support + * + * \author Gareth Hughes + */ + +/* + * Created: Wed Dec 13 21:52:19 2000 by gareth@valinux.com + * + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include "drmP.h" + +#if PAGE_SIZE == 65536 +# define ATI_PCIGART_TABLE_ORDER 0 +# define ATI_PCIGART_TABLE_PAGES (1 << 0) +#elif PAGE_SIZE == 16384 +# define ATI_PCIGART_TABLE_ORDER 1 +# define ATI_PCIGART_TABLE_PAGES (1 << 1) +#elif PAGE_SIZE == 8192 +# define ATI_PCIGART_TABLE_ORDER 2 +# define ATI_PCIGART_TABLE_PAGES (1 << 2) +#elif PAGE_SIZE == 4096 +# define ATI_PCIGART_TABLE_ORDER 3 +# define ATI_PCIGART_TABLE_PAGES (1 << 3) +#else +# error - PAGE_SIZE not 64K, 16K, 8K or 4K +#endif + +# define ATI_MAX_PCIGART_PAGES 8192 /**< 32 MB aperture, 4K pages */ +# define ATI_PCIGART_PAGE_SIZE 4096 /**< PCI GART page size */ + +unsigned long drm_ati_alloc_pcigart_table( void ) +{ + unsigned long address; + struct page *page; + int i; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + address = __get_free_pages( GFP_KERNEL, ATI_PCIGART_TABLE_ORDER ); + if ( address == 0UL ) { + return 0; + } + + page = virt_to_page( address ); + + for ( i = 0 ; i < ATI_PCIGART_TABLE_PAGES ; i++, page++ ) { + get_page(page); + SetPageReserved( page ); + } + + DRM_DEBUG( "%s: returning 0x%08lx\n", __FUNCTION__, address ); + return address; +} + +static void drm_ati_free_pcigart_table( unsigned long address ) +{ + struct page *page; + int i; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + page = virt_to_page( address ); + + for ( i = 0 ; i < ATI_PCIGART_TABLE_PAGES ; i++, page++ ) { + __put_page(page); + ClearPageReserved( page ); + } + + free_pages( address, ATI_PCIGART_TABLE_ORDER ); +} + +int drm_ati_pcigart_cleanup( drm_device_t *dev, + unsigned long addr, + dma_addr_t bus_addr) +{ + drm_sg_mem_t *entry = dev->sg; + unsigned long pages; + int i; + + /* we need to support large memory configurations */ + if ( !entry ) { + DRM_ERROR( "no scatter/gather memory!\n" ); + return 0; + } + + if ( bus_addr ) { + pci_unmap_single(dev->pdev, bus_addr, + ATI_PCIGART_TABLE_PAGES * PAGE_SIZE, + PCI_DMA_TODEVICE); + + pages = ( entry->pages <= ATI_MAX_PCIGART_PAGES ) + ? entry->pages : ATI_MAX_PCIGART_PAGES; + + for ( i = 0 ; i < pages ; i++ ) { + if ( !entry->busaddr[i] ) break; + pci_unmap_single(dev->pdev, entry->busaddr[i], + PAGE_SIZE, PCI_DMA_TODEVICE); + } + } + + if ( addr ) { + drm_ati_free_pcigart_table( addr ); + } + + return 1; +} +EXPORT_SYMBOL(drm_ati_pcigart_cleanup); + +int drm_ati_pcigart_init( drm_device_t *dev, + unsigned long *addr, + dma_addr_t *bus_addr) +{ + drm_sg_mem_t *entry = dev->sg; + unsigned long address = 0; + unsigned long pages; + u32 *pci_gart, page_base, bus_address = 0; + int i, j, ret = 0; + + if ( !entry ) { + DRM_ERROR( "no scatter/gather memory!\n" ); + goto done; + } + + address = drm_ati_alloc_pcigart_table(); + if ( !address ) { + DRM_ERROR( "cannot allocate PCI GART page!\n" ); + goto done; + } + + if ( !dev->pdev ) { + DRM_ERROR( "PCI device unknown!\n" ); + goto done; + } + + bus_address = pci_map_single(dev->pdev, (void *)address, + ATI_PCIGART_TABLE_PAGES * PAGE_SIZE, + PCI_DMA_TODEVICE); + if (bus_address == 0) { + DRM_ERROR( "unable to map PCIGART pages!\n" ); + drm_ati_free_pcigart_table( address ); + address = 0; + goto done; + } + + pci_gart = (u32 *)address; + + pages = ( entry->pages <= ATI_MAX_PCIGART_PAGES ) + ? entry->pages : ATI_MAX_PCIGART_PAGES; + + memset( pci_gart, 0, ATI_MAX_PCIGART_PAGES * sizeof(u32) ); + + for ( i = 0 ; i < pages ; i++ ) { + /* we need to support large memory configurations */ + entry->busaddr[i] = pci_map_single(dev->pdev, + page_address( entry->pagelist[i] ), + PAGE_SIZE, + PCI_DMA_TODEVICE); + if (entry->busaddr[i] == 0) { + DRM_ERROR( "unable to map PCIGART pages!\n" ); + drm_ati_pcigart_cleanup( dev, address, bus_address ); + address = 0; + bus_address = 0; + goto done; + } + page_base = (u32) entry->busaddr[i]; + + for (j = 0; j < (PAGE_SIZE / ATI_PCIGART_PAGE_SIZE); j++) { + *pci_gart++ = cpu_to_le32( page_base ); + page_base += ATI_PCIGART_PAGE_SIZE; + } + } + + ret = 1; + +#if defined(__i386__) || defined(__x86_64__) + wbinvd(); +#else + mb(); +#endif + +done: + *addr = address; + *bus_addr = bus_address; + return ret; +} +EXPORT_SYMBOL(drm_ati_pcigart_init); diff -Nru a/drivers/char/drm/ati_pcigart.h b/drivers/char/drm/ati_pcigart.h --- a/drivers/char/drm/ati_pcigart.h 2005-01-02 23:03:35 -08:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,206 +0,0 @@ -/** - * \file ati_pcigart.h - * ATI PCI GART support - * - * \author Gareth Hughes - */ - -/* - * Created: Wed Dec 13 21:52:19 2000 by gareth@valinux.com - * - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#include "drmP.h" - -#if PAGE_SIZE == 65536 -# define ATI_PCIGART_TABLE_ORDER 0 -# define ATI_PCIGART_TABLE_PAGES (1 << 0) -#elif PAGE_SIZE == 16384 -# define ATI_PCIGART_TABLE_ORDER 1 -# define ATI_PCIGART_TABLE_PAGES (1 << 1) -#elif PAGE_SIZE == 8192 -# define ATI_PCIGART_TABLE_ORDER 2 -# define ATI_PCIGART_TABLE_PAGES (1 << 2) -#elif PAGE_SIZE == 4096 -# define ATI_PCIGART_TABLE_ORDER 3 -# define ATI_PCIGART_TABLE_PAGES (1 << 3) -#else -# error - PAGE_SIZE not 64K, 16K, 8K or 4K -#endif - -# define ATI_MAX_PCIGART_PAGES 8192 /**< 32 MB aperture, 4K pages */ -# define ATI_PCIGART_PAGE_SIZE 4096 /**< PCI GART page size */ - -static unsigned long DRM(ati_alloc_pcigart_table)( void ) -{ - unsigned long address; - struct page *page; - int i; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - address = __get_free_pages( GFP_KERNEL, ATI_PCIGART_TABLE_ORDER ); - if ( address == 0UL ) { - return 0; - } - - page = virt_to_page( address ); - - for ( i = 0 ; i < ATI_PCIGART_TABLE_PAGES ; i++, page++ ) { - get_page(page); - SetPageReserved( page ); - } - - DRM_DEBUG( "%s: returning 0x%08lx\n", __FUNCTION__, address ); - return address; -} - -static void DRM(ati_free_pcigart_table)( unsigned long address ) -{ - struct page *page; - int i; - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - page = virt_to_page( address ); - - for ( i = 0 ; i < ATI_PCIGART_TABLE_PAGES ; i++, page++ ) { - __put_page(page); - ClearPageReserved( page ); - } - - free_pages( address, ATI_PCIGART_TABLE_ORDER ); -} - -int DRM(ati_pcigart_init)( drm_device_t *dev, - unsigned long *addr, - dma_addr_t *bus_addr) -{ - drm_sg_mem_t *entry = dev->sg; - unsigned long address = 0; - unsigned long pages; - u32 *pci_gart, page_base, bus_address = 0; - int i, j, ret = 0; - - if ( !entry ) { - DRM_ERROR( "no scatter/gather memory!\n" ); - goto done; - } - - address = DRM(ati_alloc_pcigart_table)(); - if ( !address ) { - DRM_ERROR( "cannot allocate PCI GART page!\n" ); - goto done; - } - - if ( !dev->pdev ) { - DRM_ERROR( "PCI device unknown!\n" ); - goto done; - } - - bus_address = pci_map_single(dev->pdev, (void *)address, - ATI_PCIGART_TABLE_PAGES * PAGE_SIZE, - PCI_DMA_TODEVICE); - if (bus_address == 0) { - DRM_ERROR( "unable to map PCIGART pages!\n" ); - DRM(ati_free_pcigart_table)( address ); - address = 0; - goto done; - } - - pci_gart = (u32 *)address; - - pages = ( entry->pages <= ATI_MAX_PCIGART_PAGES ) - ? entry->pages : ATI_MAX_PCIGART_PAGES; - - memset( pci_gart, 0, ATI_MAX_PCIGART_PAGES * sizeof(u32) ); - - for ( i = 0 ; i < pages ; i++ ) { - /* we need to support large memory configurations */ - entry->busaddr[i] = pci_map_single(dev->pdev, - page_address( entry->pagelist[i] ), - PAGE_SIZE, - PCI_DMA_TODEVICE); - if (entry->busaddr[i] == 0) { - DRM_ERROR( "unable to map PCIGART pages!\n" ); - DRM(ati_pcigart_cleanup)( dev, address, bus_address ); - address = 0; - bus_address = 0; - goto done; - } - page_base = (u32) entry->busaddr[i]; - - for (j = 0; j < (PAGE_SIZE / ATI_PCIGART_PAGE_SIZE); j++) { - *pci_gart++ = cpu_to_le32( page_base ); - page_base += ATI_PCIGART_PAGE_SIZE; - } - } - - ret = 1; - -#if defined(__i386__) || defined(__x86_64__) - asm volatile ( "wbinvd" ::: "memory" ); -#else - mb(); -#endif - -done: - *addr = address; - *bus_addr = bus_address; - return ret; -} - -int DRM(ati_pcigart_cleanup)( drm_device_t *dev, - unsigned long addr, - dma_addr_t bus_addr) -{ - drm_sg_mem_t *entry = dev->sg; - unsigned long pages; - int i; - - /* we need to support large memory configurations */ - if ( !entry ) { - DRM_ERROR( "no scatter/gather memory!\n" ); - return 0; - } - - if ( bus_addr ) { - pci_unmap_single(dev->pdev, bus_addr, - ATI_PCIGART_TABLE_PAGES * PAGE_SIZE, - PCI_DMA_TODEVICE); - - pages = ( entry->pages <= ATI_MAX_PCIGART_PAGES ) - ? entry->pages : ATI_MAX_PCIGART_PAGES; - - for ( i = 0 ; i < pages ; i++ ) { - if ( !entry->busaddr[i] ) break; - pci_unmap_single(dev->pdev, entry->busaddr[i], - PAGE_SIZE, PCI_DMA_TODEVICE); - } - } - - if ( addr ) { - DRM(ati_free_pcigart_table)( addr ); - } - - return 1; -} diff -Nru a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h --- a/drivers/char/drm/drmP.h 2005-01-02 23:03:34 -08:00 +++ b/drivers/char/drm/drmP.h 2005-01-02 23:03:34 -08:00 @@ -34,6 +34,8 @@ #ifndef _DRM_P_H_ #define _DRM_P_H_ +/* If you want the memory alloc debug functionality, change define below */ +/* #define DEBUG_MEMORY */ #ifdef __KERNEL__ #ifdef __alpha__ @@ -55,6 +57,7 @@ #include #include /* For (un)lock_kernel */ #include +#include #if defined(__alpha__) || defined(__powerpc__) #include /* For pte_wrprotect */ #endif @@ -215,7 +218,8 @@ */ #define DRM_MEM_ERROR(area, fmt, arg...) \ printk(KERN_ERR "[" DRM_NAME ":%s:%s] *ERROR* " fmt , __FUNCTION__, \ - DRM(mem_stats)[area].name , ##arg) + drm_mem_stats[area].name , ##arg) + #define DRM_INFO(fmt, arg...) printk(KERN_INFO "[" DRM_NAME "] " fmt , ##arg) /** @@ -227,7 +231,7 @@ #if DRM_DEBUG_CODE #define DRM_DEBUG(fmt, arg...) \ do { \ - if ( DRM(flags) & DRM_FLAG_DEBUG ) \ + if ( drm_debug ) \ printk(KERN_DEBUG \ "[" DRM_NAME ":%s] " fmt , \ __FUNCTION__ , ##arg); \ @@ -290,6 +294,18 @@ } while (0) /** + * Copy and IOCTL return string to user space + */ +#define DRM_COPY( name, value ) \ + len = strlen( value ); \ + if ( len > name##_len ) len = name##_len; \ + name##_len = strlen( value ); \ + if ( len && name ) { \ + if ( copy_to_user( name, value, len ) ) \ + return -EFAULT; \ + } + +/** * Ioctl function type. * * \param inode device inode. @@ -475,7 +491,7 @@ /** * AGP data. * - * \sa DRM(agp_init)() and drm_device::agp. + * \sa drm_agp_init() and drm_device::agp. */ typedef struct drm_agp_head { DRM_AGP_KERN agp_info; /**< AGP device information */ @@ -533,19 +549,21 @@ } drm_vbl_sig_t; -/** - * DRM device functions structure +/** + * DRM driver structure. This structure represent the common code for + * a family of cards. There will one drm_device for each card present + * in this family */ struct drm_device; -struct drm_driver_fn { +struct drm_driver { int (*preinit)(struct drm_device *); - int (*postinit)(struct drm_device *); void (*prerelease)(struct drm_device *, struct file *filp); void (*pretakedown)(struct drm_device *); int (*postcleanup)(struct drm_device *); int (*presetup)(struct drm_device *); int (*postsetup)(struct drm_device *); + int (*dma_ioctl)( DRM_IOCTL_ARGS ); int (*open_helper)(struct drm_device *, drm_file_t *); void (*free_filp_priv)(struct drm_device *, drm_file_t *); void (*release)(struct drm_device *, struct file *filp); @@ -557,20 +575,27 @@ void (*kernel_context_switch_unlock)(struct drm_device *dev, drm_lock_t *lock); int (*vblank_wait)(struct drm_device *dev, unsigned int *sequence); /* these have to be filled in */ + int (*postinit)(struct drm_device *, unsigned long flags); irqreturn_t (*irq_handler)( DRM_IRQ_ARGS ); void (*irq_preinstall)(struct drm_device *dev); void (*irq_postinstall)(struct drm_device *dev); void (*irq_uninstall)(struct drm_device *dev); - void (*reclaim_buffers)(struct file *filp); + void (*reclaim_buffers)(struct drm_device *dev, struct file *filp); unsigned long (*get_map_ofs)(drm_map_t *map); unsigned long (*get_reg_ofs)(struct drm_device *dev); void (*set_version)(struct drm_device *dev, drm_set_version_t *sv); + int (*version)(drm_version_t *version); + u32 driver_features; + int dev_priv_size; + drm_ioctl_desc_t *ioctls; + int num_ioctls; + struct file_operations fops; + struct pci_driver pci_driver; }; /** * DRM device structure. */ typedef struct drm_device { - const char *name; /**< Simple driver name */ char *unique; /**< Unique identifier: e.g., busid */ int unique_len; /**< Length of unique field */ dev_t device; /**< Device number for mknod */ @@ -693,15 +718,22 @@ drm_sigdata_t sigdata; /**< For block_all_signals */ sigset_t sigmask; - struct drm_driver_fn fn_tbl; + struct drm_driver *driver; drm_local_map_t *agp_buffer_map; - int dev_priv_size; - u32 driver_features; } drm_device_t; +typedef struct drm_minor { + enum { + DRM_MINOR_FREE = 0, + DRM_MINOR_PRIMARY, + } type; + drm_device_t *dev; + struct proc_dir_entry *dev_root; /**< proc directory entry */ +} drm_minor_t; + static __inline__ int drm_core_check_feature(struct drm_device *dev, int feature) { - return ((dev->driver_features & feature) ? 1 : 0); + return ((dev->driver->driver_features & feature) ? 1 : 0); } #if __OS_HAS_AGP @@ -722,231 +754,237 @@ #define drm_core_has_MTRR(dev) (0) #endif -extern void DRM(driver_register_fns)(struct drm_device *dev); - /******************************************************************/ /** \name Internal function definitions */ /*@{*/ /* Misc. support (drm_init.h) */ -extern int DRM(flags); -extern void DRM(parse_options)( char *s ); -extern int DRM(cpu_valid)( void ); +extern int drm_flags; +extern void drm_parse_options( char *s ); +extern int drm_cpu_valid( void ); /* Driver support (drm_drv.h) */ -extern int DRM(version)(struct inode *inode, struct file *filp, +extern int drm_init(struct drm_driver *driver); +extern void drm_exit(struct drm_driver *driver); +extern int drm_version(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int DRM(open)(struct inode *inode, struct file *filp); -extern int DRM(release)(struct inode *inode, struct file *filp); -extern int DRM(ioctl)(struct inode *inode, struct file *filp, +extern int drm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int DRM(lock)(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int DRM(unlock)(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); +extern int drm_takedown(drm_device_t * dev); /* Device support (drm_fops.h) */ -extern int DRM(open_helper)(struct inode *inode, struct file *filp, +extern int drm_open(struct inode *inode, struct file *filp); +extern int drm_stub_open(struct inode *inode, struct file *filp); +extern int drm_open_helper(struct inode *inode, struct file *filp, drm_device_t *dev); -extern int DRM(flush)(struct file *filp); -extern int DRM(fasync)(int fd, struct file *filp, int on); +extern int drm_flush(struct file *filp); +extern int drm_fasync(int fd, struct file *filp, int on); +extern int drm_release(struct inode *inode, struct file *filp); /* Mapping support (drm_vm.h) */ -extern void DRM(vm_open)(struct vm_area_struct *vma); -extern void DRM(vm_close)(struct vm_area_struct *vma); -extern void DRM(vm_shm_close)(struct vm_area_struct *vma); -extern int DRM(mmap_dma)(struct file *filp, +extern void drm_vm_open(struct vm_area_struct *vma); +extern void drm_vm_close(struct vm_area_struct *vma); +extern void drm_vm_shm_close(struct vm_area_struct *vma); +extern int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma); -extern int DRM(mmap)(struct file *filp, struct vm_area_struct *vma); -extern unsigned int DRM(poll)(struct file *filp, struct poll_table_struct *wait); -extern ssize_t DRM(read)(struct file *filp, char __user *buf, size_t count, loff_t *off); +extern int drm_mmap(struct file *filp, struct vm_area_struct *vma); +extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait); +extern ssize_t drm_read(struct file *filp, char __user *buf, size_t count, loff_t *off); /* Memory management support (drm_memory.h) */ -extern void DRM(mem_init)(void); -extern int DRM(mem_info)(char *buf, char **start, off_t offset, +#include "drm_memory.h" +extern void drm_mem_init(void); +extern int drm_mem_info(char *buf, char **start, off_t offset, int request, int *eof, void *data); -extern void *DRM(alloc)(size_t size, int area); -extern void *DRM(calloc)(size_t nmemb, size_t size, int area); -extern void *DRM(realloc)(void *oldpt, size_t oldsize, size_t size, +extern void *drm_calloc(size_t nmemb, size_t size, int area); +extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area); -extern void DRM(free)(void *pt, size_t size, int area); -extern unsigned long DRM(alloc_pages)(int order, int area); -extern void DRM(free_pages)(unsigned long address, int order, +extern unsigned long drm_alloc_pages(int order, int area); +extern void drm_free_pages(unsigned long address, int order, int area); -extern void *DRM(ioremap)(unsigned long offset, unsigned long size, drm_device_t *dev); -extern void *DRM(ioremap_nocache)(unsigned long offset, unsigned long size, +extern void *drm_ioremap(unsigned long offset, unsigned long size, drm_device_t *dev); +extern void *drm_ioremap_nocache(unsigned long offset, unsigned long size, drm_device_t *dev); -extern void DRM(ioremapfree)(void *pt, unsigned long size, drm_device_t *dev); +extern void drm_ioremapfree(void *pt, unsigned long size, drm_device_t *dev); -extern DRM_AGP_MEM *DRM(alloc_agp)(int pages, u32 type); -extern int DRM(free_agp)(DRM_AGP_MEM *handle, int pages); -extern int DRM(bind_agp)(DRM_AGP_MEM *handle, unsigned int start); -extern int DRM(unbind_agp)(DRM_AGP_MEM *handle); +extern DRM_AGP_MEM *drm_alloc_agp(int pages, u32 type); +extern int drm_free_agp(DRM_AGP_MEM *handle, int pages); +extern int drm_bind_agp(DRM_AGP_MEM *handle, unsigned int start); +extern int drm_unbind_agp(DRM_AGP_MEM *handle); /* Misc. IOCTL support (drm_ioctl.h) */ -extern int DRM(irq_by_busid)(struct inode *inode, struct file *filp, +extern int drm_irq_by_busid(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int DRM(getunique)(struct inode *inode, struct file *filp, +extern int drm_getunique(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int DRM(setunique)(struct inode *inode, struct file *filp, +extern int drm_setunique(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int DRM(getmap)(struct inode *inode, struct file *filp, +extern int drm_getmap(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int DRM(getclient)(struct inode *inode, struct file *filp, +extern int drm_getclient(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int DRM(getstats)(struct inode *inode, struct file *filp, +extern int drm_getstats(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int DRM(setversion)(struct inode *inode, struct file *filp, +extern int drm_setversion(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); /* Context IOCTL support (drm_context.h) */ -extern int DRM(resctx)( struct inode *inode, struct file *filp, +extern int drm_resctx( struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg ); -extern int DRM(addctx)( struct inode *inode, struct file *filp, +extern int drm_addctx( struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg ); -extern int DRM(modctx)( struct inode *inode, struct file *filp, +extern int drm_modctx( struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg ); -extern int DRM(getctx)( struct inode *inode, struct file *filp, +extern int drm_getctx( struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg ); -extern int DRM(switchctx)( struct inode *inode, struct file *filp, +extern int drm_switchctx( struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg ); -extern int DRM(newctx)( struct inode *inode, struct file *filp, +extern int drm_newctx( struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg ); -extern int DRM(rmctx)( struct inode *inode, struct file *filp, +extern int drm_rmctx( struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg ); -extern int DRM(context_switch)(drm_device_t *dev, int old, int new); -extern int DRM(context_switch_complete)(drm_device_t *dev, int new); +extern int drm_context_switch(drm_device_t *dev, int old, int new); +extern int drm_context_switch_complete(drm_device_t *dev, int new); -extern int DRM(ctxbitmap_init)( drm_device_t *dev ); -extern void DRM(ctxbitmap_cleanup)( drm_device_t *dev ); +extern int drm_ctxbitmap_init( drm_device_t *dev ); +extern void drm_ctxbitmap_cleanup( drm_device_t *dev ); +extern void drm_ctxbitmap_free( drm_device_t *dev, int ctx_handle ); -extern int DRM(setsareactx)( struct inode *inode, struct file *filp, +extern int drm_setsareactx( struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg ); -extern int DRM(getsareactx)( struct inode *inode, struct file *filp, +extern int drm_getsareactx( struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg ); /* Drawable IOCTL support (drm_drawable.h) */ -extern int DRM(adddraw)(struct inode *inode, struct file *filp, +extern int drm_adddraw(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int DRM(rmdraw)(struct inode *inode, struct file *filp, +extern int drm_rmdraw(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); /* Authentication IOCTL support (drm_auth.h) */ -extern int DRM(add_magic)(drm_device_t *dev, drm_file_t *priv, +extern int drm_add_magic(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic); -extern int DRM(remove_magic)(drm_device_t *dev, drm_magic_t magic); -extern int DRM(getmagic)(struct inode *inode, struct file *filp, +extern int drm_remove_magic(drm_device_t *dev, drm_magic_t magic); +extern int drm_getmagic(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int DRM(authmagic)(struct inode *inode, struct file *filp, +extern int drm_authmagic(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); /* Placeholder for ioctls past */ -extern int DRM(noop)(struct inode *inode, struct file *filp, +extern int drm_noop(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); /* Locking IOCTL support (drm_lock.h) */ -extern int DRM(lock_take)(__volatile__ unsigned int *lock, +extern int drm_lock(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int drm_unlock(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int drm_lock_take(__volatile__ unsigned int *lock, unsigned int context); -extern int DRM(lock_transfer)(drm_device_t *dev, +extern int drm_lock_transfer(drm_device_t *dev, __volatile__ unsigned int *lock, unsigned int context); -extern int DRM(lock_free)(drm_device_t *dev, +extern int drm_lock_free(drm_device_t *dev, __volatile__ unsigned int *lock, unsigned int context); -extern int DRM(notifier)(void *priv); +extern int drm_notifier(void *priv); /* Buffer management support (drm_bufs.h) */ -extern int DRM(order)( unsigned long size ); -extern int DRM(addmap)( struct inode *inode, struct file *filp, +extern int drm_order( unsigned long size ); +extern int drm_addmap( struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg ); -extern int DRM(rmmap)( struct inode *inode, struct file *filp, +extern int drm_rmmap( struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg ); -extern int DRM(addbufs)( struct inode *inode, struct file *filp, +extern int drm_addbufs( struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg ); -extern int DRM(infobufs)( struct inode *inode, struct file *filp, +extern int drm_infobufs( struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg ); -extern int DRM(markbufs)( struct inode *inode, struct file *filp, +extern int drm_markbufs( struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg ); -extern int DRM(freebufs)( struct inode *inode, struct file *filp, +extern int drm_freebufs( struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg ); -extern int DRM(mapbufs)( struct inode *inode, struct file *filp, +extern int drm_mapbufs( struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg ); /* DMA support (drm_dma.h) */ -extern int DRM(dma_setup)(drm_device_t *dev); -extern void DRM(dma_takedown)(drm_device_t *dev); -extern void DRM(free_buffer)(drm_device_t *dev, drm_buf_t *buf); -extern void DRM(reclaim_buffers)( struct file *filp ); +extern int drm_dma_setup(drm_device_t *dev); +extern void drm_dma_takedown(drm_device_t *dev); +extern void drm_free_buffer(drm_device_t *dev, drm_buf_t *buf); +extern void drm_core_reclaim_buffers(drm_device_t *dev, struct file *filp); /* IRQ support (drm_irq.h) */ -extern int DRM(control)( struct inode *inode, struct file *filp, +extern int drm_control( struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg ); -extern int DRM(irq_install)( drm_device_t *dev ); -extern int DRM(irq_uninstall)( drm_device_t *dev ); -extern irqreturn_t DRM(irq_handler)( DRM_IRQ_ARGS ); -extern void DRM(driver_irq_preinstall)( drm_device_t *dev ); -extern void DRM(driver_irq_postinstall)( drm_device_t *dev ); -extern void DRM(driver_irq_uninstall)( drm_device_t *dev ); +extern int drm_irq_install( drm_device_t *dev ); +extern int drm_irq_uninstall( drm_device_t *dev ); +extern irqreturn_t drm_irq_handler( DRM_IRQ_ARGS ); +extern void drm_driver_irq_preinstall( drm_device_t *dev ); +extern void drm_driver_irq_postinstall( drm_device_t *dev ); +extern void drm_driver_irq_uninstall( drm_device_t *dev ); -extern int DRM(wait_vblank)(struct inode *inode, struct file *filp, +extern int drm_wait_vblank(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int DRM(vblank_wait)(drm_device_t *dev, unsigned int *vbl_seq); -extern void DRM(vbl_send_signals)( drm_device_t *dev ); +extern int drm_vblank_wait(drm_device_t *dev, unsigned int *vbl_seq); +extern void drm_vbl_send_signals( drm_device_t *dev ); /* AGP/GART support (drm_agpsupport.h) */ -extern drm_agp_head_t *DRM(agp_init)(void); -extern void DRM(agp_uninit)(void); -extern int DRM(agp_acquire)(struct inode *inode, struct file *filp, +extern drm_agp_head_t *drm_agp_init(void); +extern int drm_agp_acquire(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern void DRM(agp_do_release)(void); -extern int DRM(agp_release)(struct inode *inode, struct file *filp, +extern void drm_agp_do_release(void); +extern int drm_agp_release(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int DRM(agp_enable)(struct inode *inode, struct file *filp, +extern int drm_agp_enable(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int DRM(agp_info)(struct inode *inode, struct file *filp, +extern int drm_agp_info(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int DRM(agp_alloc)(struct inode *inode, struct file *filp, +extern int drm_agp_alloc(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int DRM(agp_free)(struct inode *inode, struct file *filp, +extern int drm_agp_free(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int DRM(agp_unbind)(struct inode *inode, struct file *filp, +extern int drm_agp_unbind(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int DRM(agp_bind)(struct inode *inode, struct file *filp, +extern int drm_agp_bind(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern DRM_AGP_MEM *DRM(agp_allocate_memory)(size_t pages, u32 type); -extern int DRM(agp_free_memory)(DRM_AGP_MEM *handle); -extern int DRM(agp_bind_memory)(DRM_AGP_MEM *handle, off_t start); -extern int DRM(agp_unbind_memory)(DRM_AGP_MEM *handle); +extern DRM_AGP_MEM *drm_agp_allocate_memory(size_t pages, u32 type); +extern int drm_agp_free_memory(DRM_AGP_MEM *handle); +extern int drm_agp_bind_memory(DRM_AGP_MEM *handle, off_t start); +extern int drm_agp_unbind_memory(DRM_AGP_MEM *handle); /* Stub support (drm_stub.h) */ -int DRM(stub_register)(const char *name, - struct file_operations *fops, - drm_device_t *dev); -int DRM(stub_unregister)(int minor); +extern int drm_probe(struct pci_dev *pdev, const struct pci_device_id *ent, struct drm_driver *driver); + +extern int drm_put_minor(drm_device_t *dev); +extern unsigned int drm_debug; +extern unsigned int drm_cards_limit; +extern drm_minor_t *drm_minors; +extern struct class_simple *drm_class; +extern struct proc_dir_entry *drm_proc_root; +extern struct file_operations drm_stub_fops; /* Proc support (drm_proc.h) */ -extern struct proc_dir_entry *DRM(proc_init)(drm_device_t *dev, +extern int drm_proc_init(drm_device_t *dev, int minor, struct proc_dir_entry *root, struct proc_dir_entry **dev_root); -extern int DRM(proc_cleanup)(int minor, +extern int drm_proc_cleanup(int minor, struct proc_dir_entry *root, struct proc_dir_entry *dev_root); /* Scatter Gather Support (drm_scatter.h) */ -extern void DRM(sg_cleanup)(drm_sg_mem_t *entry); -extern int DRM(sg_alloc)(struct inode *inode, struct file *filp, +extern void drm_sg_cleanup(drm_sg_mem_t *entry); +extern int drm_sg_alloc(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int DRM(sg_free)(struct inode *inode, struct file *filp, +extern int drm_sg_free(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); /* ATI PCIGART support (ati_pcigart.h) */ -extern int DRM(ati_pcigart_init)(drm_device_t *dev, +extern int drm_ati_pcigart_init(drm_device_t *dev, unsigned long *addr, dma_addr_t *bus_addr); -extern int DRM(ati_pcigart_cleanup)(drm_device_t *dev, +extern int drm_ati_pcigart_cleanup(drm_device_t *dev, unsigned long addr, dma_addr_t bus_addr); @@ -954,18 +992,18 @@ /* Inline replacements for DRM_IOREMAP macros */ static __inline__ void drm_core_ioremap(struct drm_map *map, struct drm_device *dev) { - map->handle = DRM(ioremap)( map->offset, map->size, dev ); + map->handle = drm_ioremap( map->offset, map->size, dev ); } static __inline__ void drm_core_ioremap_nocache(struct drm_map *map, struct drm_device *dev) { - map->handle = DRM(ioremap_nocache)(map->offset, map->size, dev); + map->handle = drm_ioremap_nocache(map->offset, map->size, dev); } static __inline__ void drm_core_ioremapfree(struct drm_map *map, struct drm_device *dev) { if ( map->handle && map->size ) - DRM(ioremapfree)( map->handle, map->size, dev ); + drm_ioremapfree( map->handle, map->size, dev ); } static __inline__ struct drm_map *drm_core_findmap(struct drm_device *dev, unsigned long offset) @@ -984,10 +1022,28 @@ static __inline__ void drm_core_dropmap(struct drm_map *map) { } + +#ifndef DEBUG_MEMORY +/** Wrapper around kmalloc() */ +static __inline__ void *drm_alloc(size_t size, int area) +{ + return kmalloc(size, GFP_KERNEL); +} + +/** Wrapper around kfree() */ +static __inline__ void drm_free(void *pt, size_t size, int area) +{ + kfree(pt); +} +#else +extern void *drm_alloc(size_t size, int area); +extern void drm_free(void *pt, size_t size, int area); +#endif + /*@}*/ -extern unsigned long DRM(core_get_map_ofs)(drm_map_t *map); -extern unsigned long DRM(core_get_reg_ofs)(struct drm_device *dev); +extern unsigned long drm_core_get_map_ofs(drm_map_t *map); +extern unsigned long drm_core_get_reg_ofs(struct drm_device *dev); #endif /* __KERNEL__ */ #endif diff -Nru a/drivers/char/drm/drm_agpsupport.c b/drivers/char/drm/drm_agpsupport.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/char/drm/drm_agpsupport.c 2005-01-02 23:03:32 -08:00 @@ -0,0 +1,439 @@ +/** + * \file drm_agpsupport.h + * DRM support for AGP/GART backend + * + * \author Rickard E. (Rik) Faith + * \author Gareth Hughes + */ + +/* + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "drmP.h" +#include + +#if __OS_HAS_AGP + +/** + * AGP information ioctl. + * + * \param inode device inode. + * \param filp file pointer. + * \param cmd command. + * \param arg pointer to a (output) drm_agp_info structure. + * \return zero on success or a negative number on failure. + * + * Verifies the AGP device has been initialized and acquired and fills in the + * drm_agp_info structure with the information in drm_agp_head::agp_info. + */ +int drm_agp_info(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + DRM_AGP_KERN *kern; + drm_agp_info_t info; + + if (!dev->agp || !dev->agp->acquired) + return -EINVAL; + + kern = &dev->agp->agp_info; + info.agp_version_major = kern->version.major; + info.agp_version_minor = kern->version.minor; + info.mode = kern->mode; + info.aperture_base = kern->aper_base; + info.aperture_size = kern->aper_size * 1024 * 1024; + info.memory_allowed = kern->max_memory << PAGE_SHIFT; + info.memory_used = kern->current_memory << PAGE_SHIFT; + info.id_vendor = kern->device->vendor; + info.id_device = kern->device->device; + + if (copy_to_user((drm_agp_info_t __user *)arg, &info, sizeof(info))) + return -EFAULT; + return 0; +} + +/** + * Acquire the AGP device (ioctl). + * + * \param inode device inode. + * \param filp file pointer. + * \param cmd command. + * \param arg user argument. + * \return zero on success or a negative number on failure. + * + * Verifies the AGP device hasn't been acquired before and calls + * agp_acquire(). + */ +int drm_agp_acquire(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + int retcode; + + if (!dev->agp) + return -ENODEV; + if (dev->agp->acquired) + return -EBUSY; + if ((retcode = agp_backend_acquire())) + return retcode; + dev->agp->acquired = 1; + return 0; +} + +/** + * Release the AGP device (ioctl). + * + * \param inode device inode. + * \param filp file pointer. + * \param cmd command. + * \param arg user argument. + * \return zero on success or a negative number on failure. + * + * Verifies the AGP device has been acquired and calls agp_backend_release(). + */ +int drm_agp_release(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + + if (!dev->agp || !dev->agp->acquired) + return -EINVAL; + agp_backend_release(); + dev->agp->acquired = 0; + return 0; + +} + +/** + * Release the AGP device. + * + * Calls agp_backend_release(). + */ +void drm_agp_do_release(void) +{ + agp_backend_release(); +} + +/** + * Enable the AGP bus. + * + * \param inode device inode. + * \param filp file pointer. + * \param cmd command. + * \param arg pointer to a drm_agp_mode structure. + * \return zero on success or a negative number on failure. + * + * Verifies the AGP device has been acquired but not enabled, and calls + * agp_enable(). + */ +int drm_agp_enable(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_agp_mode_t mode; + + if (!dev->agp || !dev->agp->acquired) + return -EINVAL; + + if (copy_from_user(&mode, (drm_agp_mode_t __user *)arg, sizeof(mode))) + return -EFAULT; + + dev->agp->mode = mode.mode; + agp_enable(mode.mode); + dev->agp->base = dev->agp->agp_info.aper_base; + dev->agp->enabled = 1; + return 0; +} + +/** + * Allocate AGP memory. + * + * \param inode device inode. + * \param filp file pointer. + * \param cmd command. + * \param arg pointer to a drm_agp_buffer structure. + * \return zero on success or a negative number on failure. + * + * Verifies the AGP device is present and has been acquired, allocates the + * memory via alloc_agp() and creates a drm_agp_mem entry for it. + */ +int drm_agp_alloc(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_agp_buffer_t request; + drm_agp_mem_t *entry; + DRM_AGP_MEM *memory; + unsigned long pages; + u32 type; + drm_agp_buffer_t __user *argp = (void __user *)arg; + + if (!dev->agp || !dev->agp->acquired) + return -EINVAL; + if (copy_from_user(&request, argp, sizeof(request))) + return -EFAULT; + if (!(entry = drm_alloc(sizeof(*entry), DRM_MEM_AGPLISTS))) + return -ENOMEM; + + memset(entry, 0, sizeof(*entry)); + + pages = (request.size + PAGE_SIZE - 1) / PAGE_SIZE; + type = (u32) request.type; + + if (!(memory = drm_alloc_agp(pages, type))) { + drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS); + return -ENOMEM; + } + + entry->handle = (unsigned long)memory->key + 1; + entry->memory = memory; + entry->bound = 0; + entry->pages = pages; + entry->prev = NULL; + entry->next = dev->agp->memory; + if (dev->agp->memory) + dev->agp->memory->prev = entry; + dev->agp->memory = entry; + + request.handle = entry->handle; + request.physical = memory->physical; + + if (copy_to_user(argp, &request, sizeof(request))) { + dev->agp->memory = entry->next; + dev->agp->memory->prev = NULL; + drm_free_agp(memory, pages); + drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS); + return -EFAULT; + } + return 0; +} + +/** + * Search for the AGP memory entry associated with a handle. + * + * \param dev DRM device structure. + * \param handle AGP memory handle. + * \return pointer to the drm_agp_mem structure associated with \p handle. + * + * Walks through drm_agp_head::memory until finding a matching handle. + */ +static drm_agp_mem_t *drm_agp_lookup_entry(drm_device_t *dev, + unsigned long handle) +{ + drm_agp_mem_t *entry; + + for (entry = dev->agp->memory; entry; entry = entry->next) { + if (entry->handle == handle) + return entry; + } + return NULL; +} + +/** + * Unbind AGP memory from the GATT (ioctl). + * + * \param inode device inode. + * \param filp file pointer. + * \param cmd command. + * \param arg pointer to a drm_agp_binding structure. + * \return zero on success or a negative number on failure. + * + * Verifies the AGP device is present and acquired, looks-up the AGP memory + * entry and passes it to the unbind_agp() function. + */ +int drm_agp_unbind(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_agp_binding_t request; + drm_agp_mem_t *entry; + int ret; + + if (!dev->agp || !dev->agp->acquired) + return -EINVAL; + if (copy_from_user(&request, (drm_agp_binding_t __user *)arg, sizeof(request))) + return -EFAULT; + if (!(entry = drm_agp_lookup_entry(dev, request.handle))) + return -EINVAL; + if (!entry->bound) + return -EINVAL; + ret = drm_unbind_agp(entry->memory); + if (ret == 0) + entry->bound = 0; + return ret; +} + +/** + * Bind AGP memory into the GATT (ioctl) + * + * \param inode device inode. + * \param filp file pointer. + * \param cmd command. + * \param arg pointer to a drm_agp_binding structure. + * \return zero on success or a negative number on failure. + * + * Verifies the AGP device is present and has been acquired and that no memory + * is currently bound into the GATT. Looks-up the AGP memory entry and passes + * it to bind_agp() function. + */ +int drm_agp_bind(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_agp_binding_t request; + drm_agp_mem_t *entry; + int retcode; + int page; + + if (!dev->agp || !dev->agp->acquired) + return -EINVAL; + if (copy_from_user(&request, (drm_agp_binding_t __user *)arg, sizeof(request))) + return -EFAULT; + if (!(entry = drm_agp_lookup_entry(dev, request.handle))) + return -EINVAL; + if (entry->bound) + return -EINVAL; + page = (request.offset + PAGE_SIZE - 1) / PAGE_SIZE; + if ((retcode = drm_bind_agp(entry->memory, page))) + return retcode; + entry->bound = dev->agp->base + (page << PAGE_SHIFT); + DRM_DEBUG("base = 0x%lx entry->bound = 0x%lx\n", + dev->agp->base, entry->bound); + return 0; +} + +/** + * Free AGP memory (ioctl). + * + * \param inode device inode. + * \param filp file pointer. + * \param cmd command. + * \param arg pointer to a drm_agp_buffer structure. + * \return zero on success or a negative number on failure. + * + * Verifies the AGP device is present and has been acquired and looks up the + * AGP memory entry. If the memory it's currently bound, unbind it via + * unbind_agp(). Frees it via free_agp() as well as the entry itself + * and unlinks from the doubly linked list it's inserted in. + */ +int drm_agp_free(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_agp_buffer_t request; + drm_agp_mem_t *entry; + + if (!dev->agp || !dev->agp->acquired) + return -EINVAL; + if (copy_from_user(&request, (drm_agp_buffer_t __user *)arg, sizeof(request))) + return -EFAULT; + if (!(entry = drm_agp_lookup_entry(dev, request.handle))) + return -EINVAL; + if (entry->bound) + drm_unbind_agp(entry->memory); + + if (entry->prev) + entry->prev->next = entry->next; + else + dev->agp->memory = entry->next; + + if (entry->next) + entry->next->prev = entry->prev; + + drm_free_agp(entry->memory, entry->pages); + drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS); + return 0; +} + +/** + * Initialize the AGP resources. + * + * \return pointer to a drm_agp_head structure. + * + */ +drm_agp_head_t *drm_agp_init(void) +{ + drm_agp_head_t *head = NULL; + + if (!(head = drm_alloc(sizeof(*head), DRM_MEM_AGPLISTS))) + return NULL; + memset((void *)head, 0, sizeof(*head)); + agp_copy_info(&head->agp_info); + if (head->agp_info.chipset == NOT_SUPPORTED) { + drm_free(head, sizeof(*head), DRM_MEM_AGPLISTS); + return NULL; + } + head->memory = NULL; +#if LINUX_VERSION_CODE <= 0x020408 + head->cant_use_aperture = 0; + head->page_mask = ~(0xfff); +#else + head->cant_use_aperture = head->agp_info.cant_use_aperture; + head->page_mask = head->agp_info.page_mask; +#endif + + return head; +} + +/** Calls agp_allocate_memory() */ +DRM_AGP_MEM *drm_agp_allocate_memory(size_t pages, u32 type) +{ + return agp_allocate_memory(pages, type); +} + +/** Calls agp_free_memory() */ +int drm_agp_free_memory(DRM_AGP_MEM *handle) +{ + if (!handle) + return 0; + agp_free_memory(handle); + return 1; +} + +/** Calls agp_bind_memory() */ +int drm_agp_bind_memory(DRM_AGP_MEM *handle, off_t start) +{ + if (!handle) + return -EINVAL; + return agp_bind_memory(handle, start); +} + +/** Calls agp_unbind_memory() */ +int drm_agp_unbind_memory(DRM_AGP_MEM *handle) +{ + if (!handle) + return -EINVAL; + return agp_unbind_memory(handle); +} + +#endif /* __OS_HAS_AGP */ diff -Nru a/drivers/char/drm/drm_agpsupport.h b/drivers/char/drm/drm_agpsupport.h --- a/drivers/char/drm/drm_agpsupport.h 2005-01-02 23:03:32 -08:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,468 +0,0 @@ -/** - * \file drm_agpsupport.h - * DRM support for AGP/GART backend - * - * \author Rickard E. (Rik) Faith - * \author Gareth Hughes - */ - -/* - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -#include "drmP.h" -#include - -#if __OS_HAS_AGP - -#define DRM_AGP_GET (drm_agp_t *)inter_module_get("drm_agp") -#define DRM_AGP_PUT inter_module_put("drm_agp") - -/** - * Pointer to the drm_agp_t structure made available by the agpgart module. - */ -static const drm_agp_t *drm_agp = NULL; - -/** - * AGP information ioctl. - * - * \param inode device inode. - * \param filp file pointer. - * \param cmd command. - * \param arg pointer to a (output) drm_agp_info structure. - * \return zero on success or a negative number on failure. - * - * Verifies the AGP device has been initialized and acquired and fills in the - * drm_agp_info structure with the information in drm_agp_head::agp_info. - */ -int DRM(agp_info)(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - DRM_AGP_KERN *kern; - drm_agp_info_t info; - - if (!dev->agp || !dev->agp->acquired || !drm_agp->copy_info) - return -EINVAL; - - kern = &dev->agp->agp_info; - info.agp_version_major = kern->version.major; - info.agp_version_minor = kern->version.minor; - info.mode = kern->mode; - info.aperture_base = kern->aper_base; - info.aperture_size = kern->aper_size * 1024 * 1024; - info.memory_allowed = kern->max_memory << PAGE_SHIFT; - info.memory_used = kern->current_memory << PAGE_SHIFT; - info.id_vendor = kern->device->vendor; - info.id_device = kern->device->device; - - if (copy_to_user((drm_agp_info_t __user *)arg, &info, sizeof(info))) - return -EFAULT; - return 0; -} - -/** - * Acquire the AGP device (ioctl). - * - * \param inode device inode. - * \param filp file pointer. - * \param cmd command. - * \param arg user argument. - * \return zero on success or a negative number on failure. - * - * Verifies the AGP device hasn't been acquired before and calls - * drm_agp->acquire(). - */ -int DRM(agp_acquire)(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - int retcode; - - if (!dev->agp) - return -ENODEV; - if (dev->agp->acquired) - return -EBUSY; - if (!drm_agp->acquire) - return -EINVAL; - if ((retcode = drm_agp->acquire())) - return retcode; - dev->agp->acquired = 1; - return 0; -} - -/** - * Release the AGP device (ioctl). - * - * \param inode device inode. - * \param filp file pointer. - * \param cmd command. - * \param arg user argument. - * \return zero on success or a negative number on failure. - * - * Verifies the AGP device has been acquired and calls drm_agp->release(). - */ -int DRM(agp_release)(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - - if (!dev->agp || !dev->agp->acquired || !drm_agp->release) - return -EINVAL; - drm_agp->release(); - dev->agp->acquired = 0; - return 0; - -} - -/** - * Release the AGP device. - * - * Calls drm_agp->release(). - */ -void DRM(agp_do_release)(void) -{ - if (drm_agp->release) - drm_agp->release(); -} - -/** - * Enable the AGP bus. - * - * \param inode device inode. - * \param filp file pointer. - * \param cmd command. - * \param arg pointer to a drm_agp_mode structure. - * \return zero on success or a negative number on failure. - * - * Verifies the AGP device has been acquired but not enabled, and calls - * drm_agp->enable(). - */ -int DRM(agp_enable)(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_agp_mode_t mode; - - if (!dev->agp || !dev->agp->acquired || !drm_agp->enable) - return -EINVAL; - - if (copy_from_user(&mode, (drm_agp_mode_t __user *)arg, sizeof(mode))) - return -EFAULT; - - dev->agp->mode = mode.mode; - drm_agp->enable(mode.mode); - dev->agp->base = dev->agp->agp_info.aper_base; - dev->agp->enabled = 1; - return 0; -} - -/** - * Allocate AGP memory. - * - * \param inode device inode. - * \param filp file pointer. - * \param cmd command. - * \param arg pointer to a drm_agp_buffer structure. - * \return zero on success or a negative number on failure. - * - * Verifies the AGP device is present and has been acquired, allocates the - * memory via alloc_agp() and creates a drm_agp_mem entry for it. - */ -int DRM(agp_alloc)(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_agp_buffer_t request; - drm_agp_mem_t *entry; - DRM_AGP_MEM *memory; - unsigned long pages; - u32 type; - drm_agp_buffer_t __user *argp = (void __user *)arg; - - if (!dev->agp || !dev->agp->acquired) - return -EINVAL; - if (copy_from_user(&request, argp, sizeof(request))) - return -EFAULT; - if (!(entry = DRM(alloc)(sizeof(*entry), DRM_MEM_AGPLISTS))) - return -ENOMEM; - - memset(entry, 0, sizeof(*entry)); - - pages = (request.size + PAGE_SIZE - 1) / PAGE_SIZE; - type = (u32) request.type; - - if (!(memory = DRM(alloc_agp)(pages, type))) { - DRM(free)(entry, sizeof(*entry), DRM_MEM_AGPLISTS); - return -ENOMEM; - } - - entry->handle = (unsigned long)memory->key + 1; - entry->memory = memory; - entry->bound = 0; - entry->pages = pages; - entry->prev = NULL; - entry->next = dev->agp->memory; - if (dev->agp->memory) - dev->agp->memory->prev = entry; - dev->agp->memory = entry; - - request.handle = entry->handle; - request.physical = memory->physical; - - if (copy_to_user(argp, &request, sizeof(request))) { - dev->agp->memory = entry->next; - dev->agp->memory->prev = NULL; - DRM(free_agp)(memory, pages); - DRM(free)(entry, sizeof(*entry), DRM_MEM_AGPLISTS); - return -EFAULT; - } - return 0; -} - -/** - * Search for the AGP memory entry associated with a handle. - * - * \param dev DRM device structure. - * \param handle AGP memory handle. - * \return pointer to the drm_agp_mem structure associated with \p handle. - * - * Walks through drm_agp_head::memory until finding a matching handle. - */ -static drm_agp_mem_t *DRM(agp_lookup_entry)(drm_device_t *dev, - unsigned long handle) -{ - drm_agp_mem_t *entry; - - for (entry = dev->agp->memory; entry; entry = entry->next) { - if (entry->handle == handle) - return entry; - } - return NULL; -} - -/** - * Unbind AGP memory from the GATT (ioctl). - * - * \param inode device inode. - * \param filp file pointer. - * \param cmd command. - * \param arg pointer to a drm_agp_binding structure. - * \return zero on success or a negative number on failure. - * - * Verifies the AGP device is present and acquired, looks-up the AGP memory - * entry and passes it to the unbind_agp() function. - */ -int DRM(agp_unbind)(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_agp_binding_t request; - drm_agp_mem_t *entry; - int ret; - - if (!dev->agp || !dev->agp->acquired) - return -EINVAL; - if (copy_from_user(&request, (drm_agp_binding_t __user *)arg, sizeof(request))) - return -EFAULT; - if (!(entry = DRM(agp_lookup_entry)(dev, request.handle))) - return -EINVAL; - if (!entry->bound) - return -EINVAL; - ret = DRM(unbind_agp)(entry->memory); - if (ret == 0) - entry->bound = 0; - return ret; -} - -/** - * Bind AGP memory into the GATT (ioctl) - * - * \param inode device inode. - * \param filp file pointer. - * \param cmd command. - * \param arg pointer to a drm_agp_binding structure. - * \return zero on success or a negative number on failure. - * - * Verifies the AGP device is present and has been acquired and that no memory - * is currently bound into the GATT. Looks-up the AGP memory entry and passes - * it to bind_agp() function. - */ -int DRM(agp_bind)(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_agp_binding_t request; - drm_agp_mem_t *entry; - int retcode; - int page; - - if (!dev->agp || !dev->agp->acquired || !drm_agp->bind_memory) - return -EINVAL; - if (copy_from_user(&request, (drm_agp_binding_t __user *)arg, sizeof(request))) - return -EFAULT; - if (!(entry = DRM(agp_lookup_entry)(dev, request.handle))) - return -EINVAL; - if (entry->bound) - return -EINVAL; - page = (request.offset + PAGE_SIZE - 1) / PAGE_SIZE; - if ((retcode = DRM(bind_agp)(entry->memory, page))) - return retcode; - entry->bound = dev->agp->base + (page << PAGE_SHIFT); - DRM_DEBUG("base = 0x%lx entry->bound = 0x%lx\n", - dev->agp->base, entry->bound); - return 0; -} - -/** - * Free AGP memory (ioctl). - * - * \param inode device inode. - * \param filp file pointer. - * \param cmd command. - * \param arg pointer to a drm_agp_buffer structure. - * \return zero on success or a negative number on failure. - * - * Verifies the AGP device is present and has been acquired and looks up the - * AGP memory entry. If the memory it's currently bound, unbind it via - * unbind_agp(). Frees it via free_agp() as well as the entry itself - * and unlinks from the doubly linked list it's inserted in. - */ -int DRM(agp_free)(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_agp_buffer_t request; - drm_agp_mem_t *entry; - - if (!dev->agp || !dev->agp->acquired) - return -EINVAL; - if (copy_from_user(&request, (drm_agp_buffer_t __user *)arg, sizeof(request))) - return -EFAULT; - if (!(entry = DRM(agp_lookup_entry)(dev, request.handle))) - return -EINVAL; - if (entry->bound) - DRM(unbind_agp)(entry->memory); - - if (entry->prev) - entry->prev->next = entry->next; - else - dev->agp->memory = entry->next; - - if (entry->next) - entry->next->prev = entry->prev; - - DRM(free_agp)(entry->memory, entry->pages); - DRM(free)(entry, sizeof(*entry), DRM_MEM_AGPLISTS); - return 0; -} - -/** - * Initialize the AGP resources. - * - * \return pointer to a drm_agp_head structure. - * - * Gets the drm_agp_t structure which is made available by the agpgart module - * via the inter_module_* functions. Creates and initializes a drm_agp_head - * structure. - */ -drm_agp_head_t *DRM(agp_init)(void) -{ - drm_agp_head_t *head = NULL; - - drm_agp = DRM_AGP_GET; - if (drm_agp) { - if (!(head = DRM(alloc)(sizeof(*head), DRM_MEM_AGPLISTS))) - return NULL; - memset((void *)head, 0, sizeof(*head)); - drm_agp->copy_info(&head->agp_info); - if (head->agp_info.chipset == NOT_SUPPORTED) { - DRM(free)(head, sizeof(*head), DRM_MEM_AGPLISTS); - return NULL; - } - head->memory = NULL; -#if LINUX_VERSION_CODE <= 0x020408 - head->cant_use_aperture = 0; - head->page_mask = ~(0xfff); -#else - head->cant_use_aperture = head->agp_info.cant_use_aperture; - head->page_mask = head->agp_info.page_mask; -#endif - } - return head; -} - -/** - * Free the AGP resources. - * - * Releases the pointer in ::drm_agp. - */ -void DRM(agp_uninit)(void) -{ - DRM_AGP_PUT; - drm_agp = NULL; -} - -/** Calls drm_agp->allocate_memory() */ -DRM_AGP_MEM *DRM(agp_allocate_memory)(size_t pages, u32 type) -{ - if (!drm_agp->allocate_memory) - return NULL; - return drm_agp->allocate_memory(pages, type); -} - -/** Calls drm_agp->free_memory() */ -int DRM(agp_free_memory)(DRM_AGP_MEM *handle) -{ - if (!handle || !drm_agp->free_memory) - return 0; - drm_agp->free_memory(handle); - return 1; -} - -/** Calls drm_agp->bind_memory() */ -int DRM(agp_bind_memory)(DRM_AGP_MEM *handle, off_t start) -{ - if (!handle || !drm_agp->bind_memory) - return -EINVAL; - return drm_agp->bind_memory(handle, start); -} - -/** Calls drm_agp->unbind_memory() */ -int DRM(agp_unbind_memory)(DRM_AGP_MEM *handle) -{ - if (!handle || !drm_agp->unbind_memory) - return -EINVAL; - return drm_agp->unbind_memory(handle); -} - -#endif /* __OS_HAS_AGP */ diff -Nru a/drivers/char/drm/drm_auth.c b/drivers/char/drm/drm_auth.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/char/drm/drm_auth.c 2005-01-02 23:03:35 -08:00 @@ -0,0 +1,230 @@ +/** + * \file drm_auth.h + * IOCTLs for authentication + * + * \author Rickard E. (Rik) Faith + * \author Gareth Hughes + */ + +/* + * Created: Tue Feb 2 08:37:54 1999 by faith@valinux.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "drmP.h" + +/** + * Generate a hash key from a magic. + * + * \param magic magic. + * \return hash key. + * + * The key is the modulus of the hash table size, #DRM_HASH_SIZE, which must be + * a power of 2. + */ +static int drm_hash_magic(drm_magic_t magic) +{ + return magic & (DRM_HASH_SIZE-1); +} + +/** + * Find the file with the given magic number. + * + * \param dev DRM device. + * \param magic magic number. + * + * Searches in drm_device::magiclist within all files with the same hash key + * the one with matching magic number, while holding the drm_device::struct_sem + * lock. + */ +static drm_file_t *drm_find_file(drm_device_t *dev, drm_magic_t magic) +{ + drm_file_t *retval = NULL; + drm_magic_entry_t *pt; + int hash = drm_hash_magic(magic); + + down(&dev->struct_sem); + for (pt = dev->magiclist[hash].head; pt; pt = pt->next) { + if (pt->magic == magic) { + retval = pt->priv; + break; + } + } + up(&dev->struct_sem); + return retval; +} + +/** + * Adds a magic number. + * + * \param dev DRM device. + * \param priv file private data. + * \param magic magic number. + * + * Creates a drm_magic_entry structure and appends to the linked list + * associated the magic number hash key in drm_device::magiclist, while holding + * the drm_device::struct_sem lock. + */ +int drm_add_magic(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic) +{ + int hash; + drm_magic_entry_t *entry; + + DRM_DEBUG("%d\n", magic); + + hash = drm_hash_magic(magic); + entry = drm_alloc(sizeof(*entry), DRM_MEM_MAGIC); + if (!entry) return -ENOMEM; + memset(entry, 0, sizeof(*entry)); + entry->magic = magic; + entry->priv = priv; + entry->next = NULL; + + down(&dev->struct_sem); + if (dev->magiclist[hash].tail) { + dev->magiclist[hash].tail->next = entry; + dev->magiclist[hash].tail = entry; + } else { + dev->magiclist[hash].head = entry; + dev->magiclist[hash].tail = entry; + } + up(&dev->struct_sem); + + return 0; +} + +/** + * Remove a magic number. + * + * \param dev DRM device. + * \param magic magic number. + * + * Searches and unlinks the entry in drm_device::magiclist with the magic + * number hash key, while holding the drm_device::struct_sem lock. + */ +int drm_remove_magic(drm_device_t *dev, drm_magic_t magic) +{ + drm_magic_entry_t *prev = NULL; + drm_magic_entry_t *pt; + int hash; + + + DRM_DEBUG("%d\n", magic); + hash = drm_hash_magic(magic); + + down(&dev->struct_sem); + for (pt = dev->magiclist[hash].head; pt; prev = pt, pt = pt->next) { + if (pt->magic == magic) { + if (dev->magiclist[hash].head == pt) { + dev->magiclist[hash].head = pt->next; + } + if (dev->magiclist[hash].tail == pt) { + dev->magiclist[hash].tail = prev; + } + if (prev) { + prev->next = pt->next; + } + up(&dev->struct_sem); + return 0; + } + } + up(&dev->struct_sem); + + drm_free(pt, sizeof(*pt), DRM_MEM_MAGIC); + + return -EINVAL; +} + +/** + * Get a unique magic number (ioctl). + * + * \param inode device inode. + * \param filp file pointer. + * \param cmd command. + * \param arg pointer to a resulting drm_auth structure. + * \return zero on success, or a negative number on failure. + * + * If there is a magic number in drm_file::magic then use it, otherwise + * searches an unique non-zero magic number and add it associating it with \p + * filp. + */ +int drm_getmagic(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + static drm_magic_t sequence = 0; + static spinlock_t lock = SPIN_LOCK_UNLOCKED; + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_auth_t auth; + + /* Find unique magic */ + if (priv->magic) { + auth.magic = priv->magic; + } else { + do { + spin_lock(&lock); + if (!sequence) ++sequence; /* reserve 0 */ + auth.magic = sequence++; + spin_unlock(&lock); + } while (drm_find_file(dev, auth.magic)); + priv->magic = auth.magic; + drm_add_magic(dev, priv, auth.magic); + } + + DRM_DEBUG("%u\n", auth.magic); + if (copy_to_user((drm_auth_t __user *)arg, &auth, sizeof(auth))) + return -EFAULT; + return 0; +} + +/** + * Authenticate with a magic. + * + * \param inode device inode. + * \param filp file pointer. + * \param cmd command. + * \param arg pointer to a drm_auth structure. + * \return zero if authentication successed, or a negative number otherwise. + * + * Checks if \p filp is associated with the magic number passed in \arg. + */ +int drm_authmagic(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_auth_t auth; + drm_file_t *file; + + if (copy_from_user(&auth, (drm_auth_t __user *)arg, sizeof(auth))) + return -EFAULT; + DRM_DEBUG("%u\n", auth.magic); + if ((file = drm_find_file(dev, auth.magic))) { + file->authenticated = 1; + drm_remove_magic(dev, auth.magic); + return 0; + } + return -EINVAL; +} diff -Nru a/drivers/char/drm/drm_auth.h b/drivers/char/drm/drm_auth.h --- a/drivers/char/drm/drm_auth.h 2005-01-02 23:03:35 -08:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,230 +0,0 @@ -/** - * \file drm_auth.h - * IOCTLs for authentication - * - * \author Rickard E. (Rik) Faith - * \author Gareth Hughes - */ - -/* - * Created: Tue Feb 2 08:37:54 1999 by faith@valinux.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -#include "drmP.h" - -/** - * Generate a hash key from a magic. - * - * \param magic magic. - * \return hash key. - * - * The key is the modulus of the hash table size, #DRM_HASH_SIZE, which must be - * a power of 2. - */ -static int DRM(hash_magic)(drm_magic_t magic) -{ - return magic & (DRM_HASH_SIZE-1); -} - -/** - * Find the file with the given magic number. - * - * \param dev DRM device. - * \param magic magic number. - * - * Searches in drm_device::magiclist within all files with the same hash key - * the one with matching magic number, while holding the drm_device::struct_sem - * lock. - */ -static drm_file_t *DRM(find_file)(drm_device_t *dev, drm_magic_t magic) -{ - drm_file_t *retval = NULL; - drm_magic_entry_t *pt; - int hash = DRM(hash_magic)(magic); - - down(&dev->struct_sem); - for (pt = dev->magiclist[hash].head; pt; pt = pt->next) { - if (pt->magic == magic) { - retval = pt->priv; - break; - } - } - up(&dev->struct_sem); - return retval; -} - -/** - * Adds a magic number. - * - * \param dev DRM device. - * \param priv file private data. - * \param magic magic number. - * - * Creates a drm_magic_entry structure and appends to the linked list - * associated the magic number hash key in drm_device::magiclist, while holding - * the drm_device::struct_sem lock. - */ -int DRM(add_magic)(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic) -{ - int hash; - drm_magic_entry_t *entry; - - DRM_DEBUG("%d\n", magic); - - hash = DRM(hash_magic)(magic); - entry = DRM(alloc)(sizeof(*entry), DRM_MEM_MAGIC); - if (!entry) return -ENOMEM; - memset(entry, 0, sizeof(*entry)); - entry->magic = magic; - entry->priv = priv; - entry->next = NULL; - - down(&dev->struct_sem); - if (dev->magiclist[hash].tail) { - dev->magiclist[hash].tail->next = entry; - dev->magiclist[hash].tail = entry; - } else { - dev->magiclist[hash].head = entry; - dev->magiclist[hash].tail = entry; - } - up(&dev->struct_sem); - - return 0; -} - -/** - * Remove a magic number. - * - * \param dev DRM device. - * \param magic magic number. - * - * Searches and unlinks the entry in drm_device::magiclist with the magic - * number hash key, while holding the drm_device::struct_sem lock. - */ -int DRM(remove_magic)(drm_device_t *dev, drm_magic_t magic) -{ - drm_magic_entry_t *prev = NULL; - drm_magic_entry_t *pt; - int hash; - - - DRM_DEBUG("%d\n", magic); - hash = DRM(hash_magic)(magic); - - down(&dev->struct_sem); - for (pt = dev->magiclist[hash].head; pt; prev = pt, pt = pt->next) { - if (pt->magic == magic) { - if (dev->magiclist[hash].head == pt) { - dev->magiclist[hash].head = pt->next; - } - if (dev->magiclist[hash].tail == pt) { - dev->magiclist[hash].tail = prev; - } - if (prev) { - prev->next = pt->next; - } - up(&dev->struct_sem); - return 0; - } - } - up(&dev->struct_sem); - - DRM(free)(pt, sizeof(*pt), DRM_MEM_MAGIC); - - return -EINVAL; -} - -/** - * Get a unique magic number (ioctl). - * - * \param inode device inode. - * \param filp file pointer. - * \param cmd command. - * \param arg pointer to a resulting drm_auth structure. - * \return zero on success, or a negative number on failure. - * - * If there is a magic number in drm_file::magic then use it, otherwise - * searches an unique non-zero magic number and add it associating it with \p - * filp. - */ -int DRM(getmagic)(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) -{ - static drm_magic_t sequence = 0; - static spinlock_t lock = SPIN_LOCK_UNLOCKED; - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_auth_t auth; - - /* Find unique magic */ - if (priv->magic) { - auth.magic = priv->magic; - } else { - do { - spin_lock(&lock); - if (!sequence) ++sequence; /* reserve 0 */ - auth.magic = sequence++; - spin_unlock(&lock); - } while (DRM(find_file)(dev, auth.magic)); - priv->magic = auth.magic; - DRM(add_magic)(dev, priv, auth.magic); - } - - DRM_DEBUG("%u\n", auth.magic); - if (copy_to_user((drm_auth_t __user *)arg, &auth, sizeof(auth))) - return -EFAULT; - return 0; -} - -/** - * Authenticate with a magic. - * - * \param inode device inode. - * \param filp file pointer. - * \param cmd command. - * \param arg pointer to a drm_auth structure. - * \return zero if authentication successed, or a negative number otherwise. - * - * Checks if \p filp is associated with the magic number passed in \arg. - */ -int DRM(authmagic)(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_auth_t auth; - drm_file_t *file; - - if (copy_from_user(&auth, (drm_auth_t __user *)arg, sizeof(auth))) - return -EFAULT; - DRM_DEBUG("%u\n", auth.magic); - if ((file = DRM(find_file)(dev, auth.magic))) { - file->authenticated = 1; - DRM(remove_magic)(dev, auth.magic); - return 0; - } - return -EINVAL; -} diff -Nru a/drivers/char/drm/drm_bufs.c b/drivers/char/drm/drm_bufs.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/char/drm/drm_bufs.c 2005-01-02 23:03:33 -08:00 @@ -0,0 +1,1270 @@ +/** + * \file drm_bufs.h + * Generic buffer template + * + * \author Rickard E. (Rik) Faith + * \author Gareth Hughes + */ + +/* + * Created: Thu Nov 23 03:10:50 2000 by gareth@valinux.com + * + * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include +#include "drmP.h" + +/** + * Compute size order. Returns the exponent of the smaller power of two which + * is greater or equal to given number. + * + * \param size size. + * \return order. + * + * \todo Can be made faster. + */ +int drm_order( unsigned long size ) +{ + int order; + unsigned long tmp; + + for (order = 0, tmp = size >> 1; tmp; tmp >>= 1, order++) + ; + + if (size & (size - 1)) + ++order; + + return order; +} +EXPORT_SYMBOL(drm_order); + +/** + * Ioctl to specify a range of memory that is available for mapping by a non-root process. + * + * \param inode device inode. + * \param filp file pointer. + * \param cmd command. + * \param arg pointer to a drm_map structure. + * \return zero on success or a negative value on error. + * + * Adjusts the memory offset to its absolute value according to the mapping + * type. Adds the map to the map list drm_device::maplist. Adds MTRR's where + * applicable and if supported by the kernel. + */ +int drm_addmap( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_map_t *map; + drm_map_t __user *argp = (void __user *)arg; + drm_map_list_t *list; + + if ( !(filp->f_mode & 3) ) return -EACCES; /* Require read/write */ + + map = drm_alloc( sizeof(*map), DRM_MEM_MAPS ); + if ( !map ) + return -ENOMEM; + + if ( copy_from_user( map, argp, sizeof(*map) ) ) { + drm_free( map, sizeof(*map), DRM_MEM_MAPS ); + return -EFAULT; + } + + /* Only allow shared memory to be removable since we only keep enough + * book keeping information about shared memory to allow for removal + * when processes fork. + */ + if ( (map->flags & _DRM_REMOVABLE) && map->type != _DRM_SHM ) { + drm_free( map, sizeof(*map), DRM_MEM_MAPS ); + return -EINVAL; + } + DRM_DEBUG( "offset = 0x%08lx, size = 0x%08lx, type = %d\n", + map->offset, map->size, map->type ); + if ( (map->offset & (~PAGE_MASK)) || (map->size & (~PAGE_MASK)) ) { + drm_free( map, sizeof(*map), DRM_MEM_MAPS ); + return -EINVAL; + } + map->mtrr = -1; + map->handle = NULL; + + switch ( map->type ) { + case _DRM_REGISTERS: + case _DRM_FRAME_BUFFER: +#if !defined(__sparc__) && !defined(__alpha__) && !defined(__ia64__) + if ( map->offset + map->size < map->offset || + map->offset < virt_to_phys(high_memory) ) { + drm_free( map, sizeof(*map), DRM_MEM_MAPS ); + return -EINVAL; + } +#endif +#ifdef __alpha__ + map->offset += dev->hose->mem_space->start; +#endif + if (drm_core_has_MTRR(dev)) { + if ( map->type == _DRM_FRAME_BUFFER || + (map->flags & _DRM_WRITE_COMBINING) ) { + map->mtrr = mtrr_add( map->offset, map->size, + MTRR_TYPE_WRCOMB, 1 ); + } + } + if (map->type == _DRM_REGISTERS) + map->handle = drm_ioremap( map->offset, map->size, + dev ); + break; + + case _DRM_SHM: + map->handle = vmalloc_32(map->size); + DRM_DEBUG( "%lu %d %p\n", + map->size, drm_order( map->size ), map->handle ); + if ( !map->handle ) { + drm_free( map, sizeof(*map), DRM_MEM_MAPS ); + return -ENOMEM; + } + map->offset = (unsigned long)map->handle; + if ( map->flags & _DRM_CONTAINS_LOCK ) { + /* Prevent a 2nd X Server from creating a 2nd lock */ + if (dev->lock.hw_lock != NULL) { + vfree( map->handle ); + drm_free( map, sizeof(*map), DRM_MEM_MAPS ); + return -EBUSY; + } + dev->sigdata.lock = + dev->lock.hw_lock = map->handle; /* Pointer to lock */ + } + break; + case _DRM_AGP: + if (drm_core_has_AGP(dev)) { +#ifdef __alpha__ + map->offset += dev->hose->mem_space->start; +#endif + map->offset += dev->agp->base; + map->mtrr = dev->agp->agp_mtrr; /* for getmap */ + } + break; + case _DRM_SCATTER_GATHER: + if (!dev->sg) { + drm_free(map, sizeof(*map), DRM_MEM_MAPS); + return -EINVAL; + } + map->offset += dev->sg->handle; + break; + + default: + drm_free( map, sizeof(*map), DRM_MEM_MAPS ); + return -EINVAL; + } + + list = drm_alloc(sizeof(*list), DRM_MEM_MAPS); + if(!list) { + drm_free(map, sizeof(*map), DRM_MEM_MAPS); + return -EINVAL; + } + memset(list, 0, sizeof(*list)); + list->map = map; + + down(&dev->struct_sem); + list_add(&list->head, &dev->maplist->head); + up(&dev->struct_sem); + + if ( copy_to_user( argp, map, sizeof(*map) ) ) + return -EFAULT; + if ( map->type != _DRM_SHM ) { + if ( copy_to_user( &argp->handle, + &map->offset, + sizeof(map->offset) ) ) + return -EFAULT; + } + return 0; +} + + +/** + * Remove a map private from list and deallocate resources if the mapping + * isn't in use. + * + * \param inode device inode. + * \param filp file pointer. + * \param cmd command. + * \param arg pointer to a drm_map_t structure. + * \return zero on success or a negative value on error. + * + * Searches the map on drm_device::maplist, removes it from the list, see if + * its being used, and free any associate resource (such as MTRR's) if it's not + * being on use. + * + * \sa addmap(). + */ +int drm_rmmap(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + struct list_head *list; + drm_map_list_t *r_list = NULL; + drm_vma_entry_t *pt, *prev; + drm_map_t *map; + drm_map_t request; + int found_maps = 0; + + if (copy_from_user(&request, (drm_map_t __user *)arg, + sizeof(request))) { + return -EFAULT; + } + + down(&dev->struct_sem); + list = &dev->maplist->head; + list_for_each(list, &dev->maplist->head) { + r_list = list_entry(list, drm_map_list_t, head); + + if(r_list->map && + r_list->map->handle == request.handle && + r_list->map->flags & _DRM_REMOVABLE) break; + } + + /* List has wrapped around to the head pointer, or its empty we didn't + * find anything. + */ + if(list == (&dev->maplist->head)) { + up(&dev->struct_sem); + return -EINVAL; + } + map = r_list->map; + list_del(list); + drm_free(list, sizeof(*list), DRM_MEM_MAPS); + + for (pt = dev->vmalist, prev = NULL; pt; prev = pt, pt = pt->next) { + if (pt->vma->vm_private_data == map) found_maps++; + } + + if(!found_maps) { + switch (map->type) { + case _DRM_REGISTERS: + case _DRM_FRAME_BUFFER: + if (drm_core_has_MTRR(dev)) { + if (map->mtrr >= 0) { + int retcode; + retcode = mtrr_del(map->mtrr, + map->offset, + map->size); + DRM_DEBUG("mtrr_del = %d\n", retcode); + } + } + drm_ioremapfree(map->handle, map->size, dev); + break; + case _DRM_SHM: + vfree(map->handle); + break; + case _DRM_AGP: + case _DRM_SCATTER_GATHER: + break; + } + drm_free(map, sizeof(*map), DRM_MEM_MAPS); + } + up(&dev->struct_sem); + return 0; +} + +/** + * Cleanup after an error on one of the addbufs() functions. + * + * \param entry buffer entry where the error occurred. + * + * Frees any pages and buffers associated with the given entry. + */ +static void drm_cleanup_buf_error(drm_device_t *dev, drm_buf_entry_t *entry) +{ + int i; + + if (entry->seg_count) { + for (i = 0; i < entry->seg_count; i++) { + if (entry->seglist[i]) { + drm_free_pages(entry->seglist[i], + entry->page_order, + DRM_MEM_DMA); + } + } + drm_free(entry->seglist, + entry->seg_count * + sizeof(*entry->seglist), + DRM_MEM_SEGS); + + entry->seg_count = 0; + } + + if (entry->buf_count) { + for (i = 0; i < entry->buf_count; i++) { + if (entry->buflist[i].dev_private) { + drm_free(entry->buflist[i].dev_private, + entry->buflist[i].dev_priv_size, + DRM_MEM_BUFS); + } + } + drm_free(entry->buflist, + entry->buf_count * + sizeof(*entry->buflist), + DRM_MEM_BUFS); + + entry->buf_count = 0; + } +} + +#if __OS_HAS_AGP +/** + * Add AGP buffers for DMA transfers (ioctl). + * + * \param inode device inode. + * \param filp file pointer. + * \param cmd command. + * \param arg pointer to a drm_buf_desc_t request. + * \return zero on success or a negative number on failure. + * + * After some sanity checks creates a drm_buf structure for each buffer and + * reallocates the buffer list of the same size order to accommodate the new + * buffers. + */ +int drm_addbufs_agp( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_device_dma_t *dma = dev->dma; + drm_buf_desc_t request; + drm_buf_entry_t *entry; + drm_buf_t *buf; + unsigned long offset; + unsigned long agp_offset; + int count; + int order; + int size; + int alignment; + int page_order; + int total; + int byte_count; + int i; + drm_buf_t **temp_buflist; + drm_buf_desc_t __user *argp = (void __user *)arg; + + if ( !dma ) return -EINVAL; + + if ( copy_from_user( &request, argp, + sizeof(request) ) ) + return -EFAULT; + + count = request.count; + order = drm_order( request.size ); + size = 1 << order; + + alignment = (request.flags & _DRM_PAGE_ALIGN) + ? PAGE_ALIGN(size) : size; + page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0; + total = PAGE_SIZE << page_order; + + byte_count = 0; + agp_offset = dev->agp->base + request.agp_start; + + DRM_DEBUG( "count: %d\n", count ); + DRM_DEBUG( "order: %d\n", order ); + DRM_DEBUG( "size: %d\n", size ); + DRM_DEBUG( "agp_offset: %lu\n", agp_offset ); + DRM_DEBUG( "alignment: %d\n", alignment ); + DRM_DEBUG( "page_order: %d\n", page_order ); + DRM_DEBUG( "total: %d\n", total ); + + if ( order < DRM_MIN_ORDER || order > DRM_MAX_ORDER ) return -EINVAL; + if ( dev->queue_count ) return -EBUSY; /* Not while in use */ + + spin_lock( &dev->count_lock ); + if ( dev->buf_use ) { + spin_unlock( &dev->count_lock ); + return -EBUSY; + } + atomic_inc( &dev->buf_alloc ); + spin_unlock( &dev->count_lock ); + + down( &dev->struct_sem ); + entry = &dma->bufs[order]; + if ( entry->buf_count ) { + up( &dev->struct_sem ); + atomic_dec( &dev->buf_alloc ); + return -ENOMEM; /* May only call once for each order */ + } + + if (count < 0 || count > 4096) { + up( &dev->struct_sem ); + atomic_dec( &dev->buf_alloc ); + return -EINVAL; + } + + entry->buflist = drm_alloc( count * sizeof(*entry->buflist), + DRM_MEM_BUFS ); + if ( !entry->buflist ) { + up( &dev->struct_sem ); + atomic_dec( &dev->buf_alloc ); + return -ENOMEM; + } + memset( entry->buflist, 0, count * sizeof(*entry->buflist) ); + + entry->buf_size = size; + entry->page_order = page_order; + + offset = 0; + + while ( entry->buf_count < count ) { + buf = &entry->buflist[entry->buf_count]; + buf->idx = dma->buf_count + entry->buf_count; + buf->total = alignment; + buf->order = order; + buf->used = 0; + + buf->offset = (dma->byte_count + offset); + buf->bus_address = agp_offset + offset; + buf->address = (void *)(agp_offset + offset); + buf->next = NULL; + buf->waiting = 0; + buf->pending = 0; + init_waitqueue_head( &buf->dma_wait ); + buf->filp = NULL; + + buf->dev_priv_size = dev->driver->dev_priv_size; + buf->dev_private = drm_alloc( buf->dev_priv_size, + DRM_MEM_BUFS ); + if(!buf->dev_private) { + /* Set count correctly so we free the proper amount. */ + entry->buf_count = count; + drm_cleanup_buf_error(dev,entry); + up( &dev->struct_sem ); + atomic_dec( &dev->buf_alloc ); + return -ENOMEM; + } + memset( buf->dev_private, 0, buf->dev_priv_size ); + + DRM_DEBUG( "buffer %d @ %p\n", + entry->buf_count, buf->address ); + + offset += alignment; + entry->buf_count++; + byte_count += PAGE_SIZE << page_order; + } + + DRM_DEBUG( "byte_count: %d\n", byte_count ); + + temp_buflist = drm_realloc( dma->buflist, + dma->buf_count * sizeof(*dma->buflist), + (dma->buf_count + entry->buf_count) + * sizeof(*dma->buflist), + DRM_MEM_BUFS ); + if(!temp_buflist) { + /* Free the entry because it isn't valid */ + drm_cleanup_buf_error(dev,entry); + up( &dev->struct_sem ); + atomic_dec( &dev->buf_alloc ); + return -ENOMEM; + } + dma->buflist = temp_buflist; + + for ( i = 0 ; i < entry->buf_count ; i++ ) { + dma->buflist[i + dma->buf_count] = &entry->buflist[i]; + } + + dma->buf_count += entry->buf_count; + dma->byte_count += byte_count; + + DRM_DEBUG( "dma->buf_count : %d\n", dma->buf_count ); + DRM_DEBUG( "entry->buf_count : %d\n", entry->buf_count ); + + up( &dev->struct_sem ); + + request.count = entry->buf_count; + request.size = size; + + if ( copy_to_user( argp, &request, sizeof(request) ) ) + return -EFAULT; + + dma->flags = _DRM_DMA_USE_AGP; + + atomic_dec( &dev->buf_alloc ); + return 0; +} +#endif /* __OS_HAS_AGP */ + +int drm_addbufs_pci( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_device_dma_t *dma = dev->dma; + drm_buf_desc_t request; + int count; + int order; + int size; + int total; + int page_order; + drm_buf_entry_t *entry; + unsigned long page; + drm_buf_t *buf; + int alignment; + unsigned long offset; + int i; + int byte_count; + int page_count; + unsigned long *temp_pagelist; + drm_buf_t **temp_buflist; + drm_buf_desc_t __user *argp = (void __user *)arg; + + if (!drm_core_check_feature(dev, DRIVER_PCI_DMA)) return -EINVAL; + if ( !dma ) return -EINVAL; + + if ( copy_from_user( &request, argp, sizeof(request) ) ) + return -EFAULT; + + count = request.count; + order = drm_order( request.size ); + size = 1 << order; + + DRM_DEBUG( "count=%d, size=%d (%d), order=%d, queue_count=%d\n", + request.count, request.size, size, + order, dev->queue_count ); + + if ( order < DRM_MIN_ORDER || order > DRM_MAX_ORDER ) return -EINVAL; + if ( dev->queue_count ) return -EBUSY; /* Not while in use */ + + alignment = (request.flags & _DRM_PAGE_ALIGN) + ? PAGE_ALIGN(size) : size; + page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0; + total = PAGE_SIZE << page_order; + + spin_lock( &dev->count_lock ); + if ( dev->buf_use ) { + spin_unlock( &dev->count_lock ); + return -EBUSY; + } + atomic_inc( &dev->buf_alloc ); + spin_unlock( &dev->count_lock ); + + down( &dev->struct_sem ); + entry = &dma->bufs[order]; + if ( entry->buf_count ) { + up( &dev->struct_sem ); + atomic_dec( &dev->buf_alloc ); + return -ENOMEM; /* May only call once for each order */ + } + + if (count < 0 || count > 4096) { + up( &dev->struct_sem ); + atomic_dec( &dev->buf_alloc ); + return -EINVAL; + } + + entry->buflist = drm_alloc( count * sizeof(*entry->buflist), + DRM_MEM_BUFS ); + if ( !entry->buflist ) { + up( &dev->struct_sem ); + atomic_dec( &dev->buf_alloc ); + return -ENOMEM; + } + memset( entry->buflist, 0, count * sizeof(*entry->buflist) ); + + entry->seglist = drm_alloc( count * sizeof(*entry->seglist), + DRM_MEM_SEGS ); + if ( !entry->seglist ) { + drm_free( entry->buflist, + count * sizeof(*entry->buflist), + DRM_MEM_BUFS ); + up( &dev->struct_sem ); + atomic_dec( &dev->buf_alloc ); + return -ENOMEM; + } + memset( entry->seglist, 0, count * sizeof(*entry->seglist) ); + + /* Keep the original pagelist until we know all the allocations + * have succeeded + */ + temp_pagelist = drm_alloc( (dma->page_count + (count << page_order)) + * sizeof(*dma->pagelist), + DRM_MEM_PAGES ); + if (!temp_pagelist) { + drm_free( entry->buflist, + count * sizeof(*entry->buflist), + DRM_MEM_BUFS ); + drm_free( entry->seglist, + count * sizeof(*entry->seglist), + DRM_MEM_SEGS ); + up( &dev->struct_sem ); + atomic_dec( &dev->buf_alloc ); + return -ENOMEM; + } + memcpy(temp_pagelist, + dma->pagelist, + dma->page_count * sizeof(*dma->pagelist)); + DRM_DEBUG( "pagelist: %d entries\n", + dma->page_count + (count << page_order) ); + + entry->buf_size = size; + entry->page_order = page_order; + byte_count = 0; + page_count = 0; + + while ( entry->buf_count < count ) { + page = drm_alloc_pages( page_order, DRM_MEM_DMA ); + if ( !page ) { + /* Set count correctly so we free the proper amount. */ + entry->buf_count = count; + entry->seg_count = count; + drm_cleanup_buf_error(dev, entry); + drm_free( temp_pagelist, + (dma->page_count + (count << page_order)) + * sizeof(*dma->pagelist), + DRM_MEM_PAGES ); + up( &dev->struct_sem ); + atomic_dec( &dev->buf_alloc ); + return -ENOMEM; + } + entry->seglist[entry->seg_count++] = page; + for ( i = 0 ; i < (1 << page_order) ; i++ ) { + DRM_DEBUG( "page %d @ 0x%08lx\n", + dma->page_count + page_count, + page + PAGE_SIZE * i ); + temp_pagelist[dma->page_count + page_count++] + = page + PAGE_SIZE * i; + } + for ( offset = 0 ; + offset + size <= total && entry->buf_count < count ; + offset += alignment, ++entry->buf_count ) { + buf = &entry->buflist[entry->buf_count]; + buf->idx = dma->buf_count + entry->buf_count; + buf->total = alignment; + buf->order = order; + buf->used = 0; + buf->offset = (dma->byte_count + byte_count + offset); + buf->address = (void *)(page + offset); + buf->next = NULL; + buf->waiting = 0; + buf->pending = 0; + init_waitqueue_head( &buf->dma_wait ); + buf->filp = NULL; + + buf->dev_priv_size = dev->driver->dev_priv_size; + buf->dev_private = drm_alloc( buf->dev_priv_size, + DRM_MEM_BUFS ); + if(!buf->dev_private) { + /* Set count correctly so we free the proper amount. */ + entry->buf_count = count; + entry->seg_count = count; + drm_cleanup_buf_error(dev,entry); + drm_free( temp_pagelist, + (dma->page_count + (count << page_order)) + * sizeof(*dma->pagelist), + DRM_MEM_PAGES ); + up( &dev->struct_sem ); + atomic_dec( &dev->buf_alloc ); + return -ENOMEM; + } + memset( buf->dev_private, 0, buf->dev_priv_size ); + + DRM_DEBUG( "buffer %d @ %p\n", + entry->buf_count, buf->address ); + } + byte_count += PAGE_SIZE << page_order; + } + + temp_buflist = drm_realloc( dma->buflist, + dma->buf_count * sizeof(*dma->buflist), + (dma->buf_count + entry->buf_count) + * sizeof(*dma->buflist), + DRM_MEM_BUFS ); + if (!temp_buflist) { + /* Free the entry because it isn't valid */ + drm_cleanup_buf_error(dev,entry); + drm_free( temp_pagelist, + (dma->page_count + (count << page_order)) + * sizeof(*dma->pagelist), + DRM_MEM_PAGES ); + up( &dev->struct_sem ); + atomic_dec( &dev->buf_alloc ); + return -ENOMEM; + } + dma->buflist = temp_buflist; + + for ( i = 0 ; i < entry->buf_count ; i++ ) { + dma->buflist[i + dma->buf_count] = &entry->buflist[i]; + } + + /* No allocations failed, so now we can replace the orginal pagelist + * with the new one. + */ + if (dma->page_count) { + drm_free(dma->pagelist, + dma->page_count * sizeof(*dma->pagelist), + DRM_MEM_PAGES); + } + dma->pagelist = temp_pagelist; + + dma->buf_count += entry->buf_count; + dma->seg_count += entry->seg_count; + dma->page_count += entry->seg_count << page_order; + dma->byte_count += PAGE_SIZE * (entry->seg_count << page_order); + + up( &dev->struct_sem ); + + request.count = entry->buf_count; + request.size = size; + + if ( copy_to_user( argp, &request, sizeof(request) ) ) + return -EFAULT; + + atomic_dec( &dev->buf_alloc ); + return 0; + +} + +int drm_addbufs_sg( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_device_dma_t *dma = dev->dma; + drm_buf_desc_t __user *argp = (void __user *)arg; + drm_buf_desc_t request; + drm_buf_entry_t *entry; + drm_buf_t *buf; + unsigned long offset; + unsigned long agp_offset; + int count; + int order; + int size; + int alignment; + int page_order; + int total; + int byte_count; + int i; + drm_buf_t **temp_buflist; + + if (!drm_core_check_feature(dev, DRIVER_SG)) return -EINVAL; + + if ( !dma ) return -EINVAL; + + if ( copy_from_user( &request, argp, sizeof(request) ) ) + return -EFAULT; + + count = request.count; + order = drm_order( request.size ); + size = 1 << order; + + alignment = (request.flags & _DRM_PAGE_ALIGN) + ? PAGE_ALIGN(size) : size; + page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0; + total = PAGE_SIZE << page_order; + + byte_count = 0; + agp_offset = request.agp_start; + + DRM_DEBUG( "count: %d\n", count ); + DRM_DEBUG( "order: %d\n", order ); + DRM_DEBUG( "size: %d\n", size ); + DRM_DEBUG( "agp_offset: %lu\n", agp_offset ); + DRM_DEBUG( "alignment: %d\n", alignment ); + DRM_DEBUG( "page_order: %d\n", page_order ); + DRM_DEBUG( "total: %d\n", total ); + + if ( order < DRM_MIN_ORDER || order > DRM_MAX_ORDER ) return -EINVAL; + if ( dev->queue_count ) return -EBUSY; /* Not while in use */ + + spin_lock( &dev->count_lock ); + if ( dev->buf_use ) { + spin_unlock( &dev->count_lock ); + return -EBUSY; + } + atomic_inc( &dev->buf_alloc ); + spin_unlock( &dev->count_lock ); + + down( &dev->struct_sem ); + entry = &dma->bufs[order]; + if ( entry->buf_count ) { + up( &dev->struct_sem ); + atomic_dec( &dev->buf_alloc ); + return -ENOMEM; /* May only call once for each order */ + } + + if (count < 0 || count > 4096) { + up( &dev->struct_sem ); + atomic_dec( &dev->buf_alloc ); + return -EINVAL; + } + + entry->buflist = drm_alloc( count * sizeof(*entry->buflist), + DRM_MEM_BUFS ); + if ( !entry->buflist ) { + up( &dev->struct_sem ); + atomic_dec( &dev->buf_alloc ); + return -ENOMEM; + } + memset( entry->buflist, 0, count * sizeof(*entry->buflist) ); + + entry->buf_size = size; + entry->page_order = page_order; + + offset = 0; + + while ( entry->buf_count < count ) { + buf = &entry->buflist[entry->buf_count]; + buf->idx = dma->buf_count + entry->buf_count; + buf->total = alignment; + buf->order = order; + buf->used = 0; + + buf->offset = (dma->byte_count + offset); + buf->bus_address = agp_offset + offset; + buf->address = (void *)(agp_offset + offset + dev->sg->handle); + buf->next = NULL; + buf->waiting = 0; + buf->pending = 0; + init_waitqueue_head( &buf->dma_wait ); + buf->filp = NULL; + + buf->dev_priv_size = dev->driver->dev_priv_size; + buf->dev_private = drm_alloc( buf->dev_priv_size, + DRM_MEM_BUFS ); + if(!buf->dev_private) { + /* Set count correctly so we free the proper amount. */ + entry->buf_count = count; + drm_cleanup_buf_error(dev,entry); + up( &dev->struct_sem ); + atomic_dec( &dev->buf_alloc ); + return -ENOMEM; + } + + memset( buf->dev_private, 0, buf->dev_priv_size ); + + DRM_DEBUG( "buffer %d @ %p\n", + entry->buf_count, buf->address ); + + offset += alignment; + entry->buf_count++; + byte_count += PAGE_SIZE << page_order; + } + + DRM_DEBUG( "byte_count: %d\n", byte_count ); + + temp_buflist = drm_realloc( dma->buflist, + dma->buf_count * sizeof(*dma->buflist), + (dma->buf_count + entry->buf_count) + * sizeof(*dma->buflist), + DRM_MEM_BUFS ); + if(!temp_buflist) { + /* Free the entry because it isn't valid */ + drm_cleanup_buf_error(dev,entry); + up( &dev->struct_sem ); + atomic_dec( &dev->buf_alloc ); + return -ENOMEM; + } + dma->buflist = temp_buflist; + + for ( i = 0 ; i < entry->buf_count ; i++ ) { + dma->buflist[i + dma->buf_count] = &entry->buflist[i]; + } + + dma->buf_count += entry->buf_count; + dma->byte_count += byte_count; + + DRM_DEBUG( "dma->buf_count : %d\n", dma->buf_count ); + DRM_DEBUG( "entry->buf_count : %d\n", entry->buf_count ); + + up( &dev->struct_sem ); + + request.count = entry->buf_count; + request.size = size; + + if ( copy_to_user( argp, &request, sizeof(request) ) ) + return -EFAULT; + + dma->flags = _DRM_DMA_USE_SG; + + atomic_dec( &dev->buf_alloc ); + return 0; +} + +/** + * Add buffers for DMA transfers (ioctl). + * + * \param inode device inode. + * \param filp file pointer. + * \param cmd command. + * \param arg pointer to a drm_buf_desc_t request. + * \return zero on success or a negative number on failure. + * + * According with the memory type specified in drm_buf_desc::flags and the + * build options, it dispatches the call either to addbufs_agp(), + * addbufs_sg() or addbufs_pci() for AGP, scatter-gather or consistent + * PCI memory respectively. + */ +int drm_addbufs( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_buf_desc_t request; + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + + if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA)) + return -EINVAL; + + if ( copy_from_user( &request, (drm_buf_desc_t __user *)arg, + sizeof(request) ) ) + return -EFAULT; + +#if __OS_HAS_AGP + if ( request.flags & _DRM_AGP_BUFFER ) + return drm_addbufs_agp( inode, filp, cmd, arg ); + else +#endif + if ( request.flags & _DRM_SG_BUFFER ) + return drm_addbufs_sg( inode, filp, cmd, arg ); + else + return drm_addbufs_pci( inode, filp, cmd, arg ); +} + + +/** + * Get information about the buffer mappings. + * + * This was originally mean for debugging purposes, or by a sophisticated + * client library to determine how best to use the available buffers (e.g., + * large buffers can be used for image transfer). + * + * \param inode device inode. + * \param filp file pointer. + * \param cmd command. + * \param arg pointer to a drm_buf_info structure. + * \return zero on success or a negative number on failure. + * + * Increments drm_device::buf_use while holding the drm_device::count_lock + * lock, preventing of allocating more buffers after this call. Information + * about each requested buffer is then copied into user space. + */ +int drm_infobufs( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_device_dma_t *dma = dev->dma; + drm_buf_info_t request; + drm_buf_info_t __user *argp = (void __user *)arg; + int i; + int count; + + if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA)) + return -EINVAL; + + if ( !dma ) return -EINVAL; + + spin_lock( &dev->count_lock ); + if ( atomic_read( &dev->buf_alloc ) ) { + spin_unlock( &dev->count_lock ); + return -EBUSY; + } + ++dev->buf_use; /* Can't allocate more after this call */ + spin_unlock( &dev->count_lock ); + + if ( copy_from_user( &request, argp, sizeof(request) ) ) + return -EFAULT; + + for ( i = 0, count = 0 ; i < DRM_MAX_ORDER + 1 ; i++ ) { + if ( dma->bufs[i].buf_count ) ++count; + } + + DRM_DEBUG( "count = %d\n", count ); + + if ( request.count >= count ) { + for ( i = 0, count = 0 ; i < DRM_MAX_ORDER + 1 ; i++ ) { + if ( dma->bufs[i].buf_count ) { + drm_buf_desc_t __user *to = &request.list[count]; + drm_buf_entry_t *from = &dma->bufs[i]; + drm_freelist_t *list = &dma->bufs[i].freelist; + if ( copy_to_user( &to->count, + &from->buf_count, + sizeof(from->buf_count) ) || + copy_to_user( &to->size, + &from->buf_size, + sizeof(from->buf_size) ) || + copy_to_user( &to->low_mark, + &list->low_mark, + sizeof(list->low_mark) ) || + copy_to_user( &to->high_mark, + &list->high_mark, + sizeof(list->high_mark) ) ) + return -EFAULT; + + DRM_DEBUG( "%d %d %d %d %d\n", + i, + dma->bufs[i].buf_count, + dma->bufs[i].buf_size, + dma->bufs[i].freelist.low_mark, + dma->bufs[i].freelist.high_mark ); + ++count; + } + } + } + request.count = count; + + if ( copy_to_user( argp, &request, sizeof(request) ) ) + return -EFAULT; + + return 0; +} + +/** + * Specifies a low and high water mark for buffer allocation + * + * \param inode device inode. + * \param filp file pointer. + * \param cmd command. + * \param arg a pointer to a drm_buf_desc structure. + * \return zero on success or a negative number on failure. + * + * Verifies that the size order is bounded between the admissible orders and + * updates the respective drm_device_dma::bufs entry low and high water mark. + * + * \note This ioctl is deprecated and mostly never used. + */ +int drm_markbufs( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_device_dma_t *dma = dev->dma; + drm_buf_desc_t request; + int order; + drm_buf_entry_t *entry; + + if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA)) + return -EINVAL; + + if ( !dma ) return -EINVAL; + + if ( copy_from_user( &request, + (drm_buf_desc_t __user *)arg, + sizeof(request) ) ) + return -EFAULT; + + DRM_DEBUG( "%d, %d, %d\n", + request.size, request.low_mark, request.high_mark ); + order = drm_order( request.size ); + if ( order < DRM_MIN_ORDER || order > DRM_MAX_ORDER ) return -EINVAL; + entry = &dma->bufs[order]; + + if ( request.low_mark < 0 || request.low_mark > entry->buf_count ) + return -EINVAL; + if ( request.high_mark < 0 || request.high_mark > entry->buf_count ) + return -EINVAL; + + entry->freelist.low_mark = request.low_mark; + entry->freelist.high_mark = request.high_mark; + + return 0; +} + +/** + * Unreserve the buffers in list, previously reserved using drmDMA. + * + * \param inode device inode. + * \param filp file pointer. + * \param cmd command. + * \param arg pointer to a drm_buf_free structure. + * \return zero on success or a negative number on failure. + * + * Calls free_buffer() for each used buffer. + * This function is primarily used for debugging. + */ +int drm_freebufs( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_device_dma_t *dma = dev->dma; + drm_buf_free_t request; + int i; + int idx; + drm_buf_t *buf; + + if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA)) + return -EINVAL; + + if ( !dma ) return -EINVAL; + + if ( copy_from_user( &request, + (drm_buf_free_t __user *)arg, + sizeof(request) ) ) + return -EFAULT; + + DRM_DEBUG( "%d\n", request.count ); + for ( i = 0 ; i < request.count ; i++ ) { + if ( copy_from_user( &idx, + &request.list[i], + sizeof(idx) ) ) + return -EFAULT; + if ( idx < 0 || idx >= dma->buf_count ) { + DRM_ERROR( "Index %d (of %d max)\n", + idx, dma->buf_count - 1 ); + return -EINVAL; + } + buf = dma->buflist[idx]; + if ( buf->filp != filp ) { + DRM_ERROR( "Process %d freeing buffer not owned\n", + current->pid ); + return -EINVAL; + } + drm_free_buffer( dev, buf ); + } + + return 0; +} + +/** + * Maps all of the DMA buffers into client-virtual space (ioctl). + * + * \param inode device inode. + * \param filp file pointer. + * \param cmd command. + * \param arg pointer to a drm_buf_map structure. + * \return zero on success or a negative number on failure. + * + * Maps the AGP or SG buffer region with do_mmap(), and copies information + * about each buffer into user space. The PCI buffers are already mapped on the + * addbufs_pci() call. + */ +int drm_mapbufs( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_device_dma_t *dma = dev->dma; + drm_buf_map_t __user *argp = (void __user *)arg; + int retcode = 0; + const int zero = 0; + unsigned long virtual; + unsigned long address; + drm_buf_map_t request; + int i; + + if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA)) + return -EINVAL; + + if ( !dma ) return -EINVAL; + + spin_lock( &dev->count_lock ); + if ( atomic_read( &dev->buf_alloc ) ) { + spin_unlock( &dev->count_lock ); + return -EBUSY; + } + dev->buf_use++; /* Can't allocate more after this call */ + spin_unlock( &dev->count_lock ); + + if ( copy_from_user( &request, argp, sizeof(request) ) ) + return -EFAULT; + + if ( request.count >= dma->buf_count ) { + if ((drm_core_has_AGP(dev) && (dma->flags & _DRM_DMA_USE_AGP)) || + (drm_core_check_feature(dev, DRIVER_SG) && (dma->flags & _DRM_DMA_USE_SG)) ) { + drm_map_t *map = dev->agp_buffer_map; + + if ( !map ) { + retcode = -EINVAL; + goto done; + } + +#if LINUX_VERSION_CODE <= 0x020402 + down( ¤t->mm->mmap_sem ); +#else + down_write( ¤t->mm->mmap_sem ); +#endif + virtual = do_mmap( filp, 0, map->size, + PROT_READ | PROT_WRITE, + MAP_SHARED, + (unsigned long)map->offset ); +#if LINUX_VERSION_CODE <= 0x020402 + up( ¤t->mm->mmap_sem ); +#else + up_write( ¤t->mm->mmap_sem ); +#endif + } else { +#if LINUX_VERSION_CODE <= 0x020402 + down( ¤t->mm->mmap_sem ); +#else + down_write( ¤t->mm->mmap_sem ); +#endif + virtual = do_mmap( filp, 0, dma->byte_count, + PROT_READ | PROT_WRITE, + MAP_SHARED, 0 ); +#if LINUX_VERSION_CODE <= 0x020402 + up( ¤t->mm->mmap_sem ); +#else + up_write( ¤t->mm->mmap_sem ); +#endif + } + if ( virtual > -1024UL ) { + /* Real error */ + retcode = (signed long)virtual; + goto done; + } + request.virtual = (void __user *)virtual; + + for ( i = 0 ; i < dma->buf_count ; i++ ) { + if ( copy_to_user( &request.list[i].idx, + &dma->buflist[i]->idx, + sizeof(request.list[0].idx) ) ) { + retcode = -EFAULT; + goto done; + } + if ( copy_to_user( &request.list[i].total, + &dma->buflist[i]->total, + sizeof(request.list[0].total) ) ) { + retcode = -EFAULT; + goto done; + } + if ( copy_to_user( &request.list[i].used, + &zero, + sizeof(zero) ) ) { + retcode = -EFAULT; + goto done; + } + address = virtual + dma->buflist[i]->offset; /* *** */ + if ( copy_to_user( &request.list[i].address, + &address, + sizeof(address) ) ) { + retcode = -EFAULT; + goto done; + } + } + } + done: + request.count = dma->buf_count; + DRM_DEBUG( "%d buffers, retcode = %d\n", request.count, retcode ); + + if ( copy_to_user( argp, &request, sizeof(request) ) ) + return -EFAULT; + + return retcode; +} + diff -Nru a/drivers/char/drm/drm_bufs.h b/drivers/char/drm/drm_bufs.h --- a/drivers/char/drm/drm_bufs.h 2005-01-02 23:03:33 -08:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,1269 +0,0 @@ -/** - * \file drm_bufs.h - * Generic buffer template - * - * \author Rickard E. (Rik) Faith - * \author Gareth Hughes - */ - -/* - * Created: Thu Nov 23 03:10:50 2000 by gareth@valinux.com - * - * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -#include -#include "drmP.h" - -/** - * Compute size order. Returns the exponent of the smaller power of two which - * is greater or equal to given number. - * - * \param size size. - * \return order. - * - * \todo Can be made faster. - */ -int DRM(order)( unsigned long size ) -{ - int order; - unsigned long tmp; - - for (order = 0, tmp = size >> 1; tmp; tmp >>= 1, order++) - ; - - if (size & (size - 1)) - ++order; - - return order; -} - -/** - * Ioctl to specify a range of memory that is available for mapping by a non-root process. - * - * \param inode device inode. - * \param filp file pointer. - * \param cmd command. - * \param arg pointer to a drm_map structure. - * \return zero on success or a negative value on error. - * - * Adjusts the memory offset to its absolute value according to the mapping - * type. Adds the map to the map list drm_device::maplist. Adds MTRR's where - * applicable and if supported by the kernel. - */ -int DRM(addmap)( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_map_t *map; - drm_map_t __user *argp = (void __user *)arg; - drm_map_list_t *list; - - if ( !(filp->f_mode & 3) ) return -EACCES; /* Require read/write */ - - map = DRM(alloc)( sizeof(*map), DRM_MEM_MAPS ); - if ( !map ) - return -ENOMEM; - - if ( copy_from_user( map, argp, sizeof(*map) ) ) { - DRM(free)( map, sizeof(*map), DRM_MEM_MAPS ); - return -EFAULT; - } - - /* Only allow shared memory to be removable since we only keep enough - * book keeping information about shared memory to allow for removal - * when processes fork. - */ - if ( (map->flags & _DRM_REMOVABLE) && map->type != _DRM_SHM ) { - DRM(free)( map, sizeof(*map), DRM_MEM_MAPS ); - return -EINVAL; - } - DRM_DEBUG( "offset = 0x%08lx, size = 0x%08lx, type = %d\n", - map->offset, map->size, map->type ); - if ( (map->offset & (~PAGE_MASK)) || (map->size & (~PAGE_MASK)) ) { - DRM(free)( map, sizeof(*map), DRM_MEM_MAPS ); - return -EINVAL; - } - map->mtrr = -1; - map->handle = NULL; - - switch ( map->type ) { - case _DRM_REGISTERS: - case _DRM_FRAME_BUFFER: -#if !defined(__sparc__) && !defined(__alpha__) && !defined(__ia64__) - if ( map->offset + map->size < map->offset || - map->offset < virt_to_phys(high_memory) ) { - DRM(free)( map, sizeof(*map), DRM_MEM_MAPS ); - return -EINVAL; - } -#endif -#ifdef __alpha__ - map->offset += dev->hose->mem_space->start; -#endif - if (drm_core_has_MTRR(dev)) { - if ( map->type == _DRM_FRAME_BUFFER || - (map->flags & _DRM_WRITE_COMBINING) ) { - map->mtrr = mtrr_add( map->offset, map->size, - MTRR_TYPE_WRCOMB, 1 ); - } - } - if (map->type == _DRM_REGISTERS) - map->handle = DRM(ioremap)( map->offset, map->size, - dev ); - break; - - case _DRM_SHM: - map->handle = vmalloc_32(map->size); - DRM_DEBUG( "%lu %d %p\n", - map->size, DRM(order)( map->size ), map->handle ); - if ( !map->handle ) { - DRM(free)( map, sizeof(*map), DRM_MEM_MAPS ); - return -ENOMEM; - } - map->offset = (unsigned long)map->handle; - if ( map->flags & _DRM_CONTAINS_LOCK ) { - /* Prevent a 2nd X Server from creating a 2nd lock */ - if (dev->lock.hw_lock != NULL) { - vfree( map->handle ); - DRM(free)( map, sizeof(*map), DRM_MEM_MAPS ); - return -EBUSY; - } - dev->sigdata.lock = - dev->lock.hw_lock = map->handle; /* Pointer to lock */ - } - break; - case _DRM_AGP: - if (drm_core_has_AGP(dev)) { -#ifdef __alpha__ - map->offset += dev->hose->mem_space->start; -#endif - map->offset += dev->agp->base; - map->mtrr = dev->agp->agp_mtrr; /* for getmap */ - } - break; - case _DRM_SCATTER_GATHER: - if (!dev->sg) { - DRM(free)(map, sizeof(*map), DRM_MEM_MAPS); - return -EINVAL; - } - map->offset += dev->sg->handle; - break; - - default: - DRM(free)( map, sizeof(*map), DRM_MEM_MAPS ); - return -EINVAL; - } - - list = DRM(alloc)(sizeof(*list), DRM_MEM_MAPS); - if(!list) { - DRM(free)(map, sizeof(*map), DRM_MEM_MAPS); - return -EINVAL; - } - memset(list, 0, sizeof(*list)); - list->map = map; - - down(&dev->struct_sem); - list_add(&list->head, &dev->maplist->head); - up(&dev->struct_sem); - - if ( copy_to_user( argp, map, sizeof(*map) ) ) - return -EFAULT; - if ( map->type != _DRM_SHM ) { - if ( copy_to_user( &argp->handle, - &map->offset, - sizeof(map->offset) ) ) - return -EFAULT; - } - return 0; -} - - -/** - * Remove a map private from list and deallocate resources if the mapping - * isn't in use. - * - * \param inode device inode. - * \param filp file pointer. - * \param cmd command. - * \param arg pointer to a drm_map_t structure. - * \return zero on success or a negative value on error. - * - * Searches the map on drm_device::maplist, removes it from the list, see if - * its being used, and free any associate resource (such as MTRR's) if it's not - * being on use. - * - * \sa addmap(). - */ -int DRM(rmmap)(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - struct list_head *list; - drm_map_list_t *r_list = NULL; - drm_vma_entry_t *pt, *prev; - drm_map_t *map; - drm_map_t request; - int found_maps = 0; - - if (copy_from_user(&request, (drm_map_t __user *)arg, - sizeof(request))) { - return -EFAULT; - } - - down(&dev->struct_sem); - list = &dev->maplist->head; - list_for_each(list, &dev->maplist->head) { - r_list = list_entry(list, drm_map_list_t, head); - - if(r_list->map && - r_list->map->handle == request.handle && - r_list->map->flags & _DRM_REMOVABLE) break; - } - - /* List has wrapped around to the head pointer, or its empty we didn't - * find anything. - */ - if(list == (&dev->maplist->head)) { - up(&dev->struct_sem); - return -EINVAL; - } - map = r_list->map; - list_del(list); - DRM(free)(list, sizeof(*list), DRM_MEM_MAPS); - - for (pt = dev->vmalist, prev = NULL; pt; prev = pt, pt = pt->next) { - if (pt->vma->vm_private_data == map) found_maps++; - } - - if(!found_maps) { - switch (map->type) { - case _DRM_REGISTERS: - case _DRM_FRAME_BUFFER: - if (drm_core_has_MTRR(dev)) { - if (map->mtrr >= 0) { - int retcode; - retcode = mtrr_del(map->mtrr, - map->offset, - map->size); - DRM_DEBUG("mtrr_del = %d\n", retcode); - } - } - DRM(ioremapfree)(map->handle, map->size, dev); - break; - case _DRM_SHM: - vfree(map->handle); - break; - case _DRM_AGP: - case _DRM_SCATTER_GATHER: - break; - } - DRM(free)(map, sizeof(*map), DRM_MEM_MAPS); - } - up(&dev->struct_sem); - return 0; -} - -/** - * Cleanup after an error on one of the addbufs() functions. - * - * \param entry buffer entry where the error occurred. - * - * Frees any pages and buffers associated with the given entry. - */ -static void DRM(cleanup_buf_error)(drm_buf_entry_t *entry) -{ - int i; - - if (entry->seg_count) { - for (i = 0; i < entry->seg_count; i++) { - if (entry->seglist[i]) { - DRM(free_pages)(entry->seglist[i], - entry->page_order, - DRM_MEM_DMA); - } - } - DRM(free)(entry->seglist, - entry->seg_count * - sizeof(*entry->seglist), - DRM_MEM_SEGS); - - entry->seg_count = 0; - } - - if (entry->buf_count) { - for (i = 0; i < entry->buf_count; i++) { - if (entry->buflist[i].dev_private) { - DRM(free)(entry->buflist[i].dev_private, - entry->buflist[i].dev_priv_size, - DRM_MEM_BUFS); - } - } - DRM(free)(entry->buflist, - entry->buf_count * - sizeof(*entry->buflist), - DRM_MEM_BUFS); - - entry->buf_count = 0; - } -} - -#if __OS_HAS_AGP -/** - * Add AGP buffers for DMA transfers (ioctl). - * - * \param inode device inode. - * \param filp file pointer. - * \param cmd command. - * \param arg pointer to a drm_buf_desc_t request. - * \return zero on success or a negative number on failure. - * - * After some sanity checks creates a drm_buf structure for each buffer and - * reallocates the buffer list of the same size order to accommodate the new - * buffers. - */ -int DRM(addbufs_agp)( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_device_dma_t *dma = dev->dma; - drm_buf_desc_t request; - drm_buf_entry_t *entry; - drm_buf_t *buf; - unsigned long offset; - unsigned long agp_offset; - int count; - int order; - int size; - int alignment; - int page_order; - int total; - int byte_count; - int i; - drm_buf_t **temp_buflist; - drm_buf_desc_t __user *argp = (void __user *)arg; - - if ( !dma ) return -EINVAL; - - if ( copy_from_user( &request, argp, - sizeof(request) ) ) - return -EFAULT; - - count = request.count; - order = DRM(order)( request.size ); - size = 1 << order; - - alignment = (request.flags & _DRM_PAGE_ALIGN) - ? PAGE_ALIGN(size) : size; - page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0; - total = PAGE_SIZE << page_order; - - byte_count = 0; - agp_offset = dev->agp->base + request.agp_start; - - DRM_DEBUG( "count: %d\n", count ); - DRM_DEBUG( "order: %d\n", order ); - DRM_DEBUG( "size: %d\n", size ); - DRM_DEBUG( "agp_offset: %lu\n", agp_offset ); - DRM_DEBUG( "alignment: %d\n", alignment ); - DRM_DEBUG( "page_order: %d\n", page_order ); - DRM_DEBUG( "total: %d\n", total ); - - if ( order < DRM_MIN_ORDER || order > DRM_MAX_ORDER ) return -EINVAL; - if ( dev->queue_count ) return -EBUSY; /* Not while in use */ - - spin_lock( &dev->count_lock ); - if ( dev->buf_use ) { - spin_unlock( &dev->count_lock ); - return -EBUSY; - } - atomic_inc( &dev->buf_alloc ); - spin_unlock( &dev->count_lock ); - - down( &dev->struct_sem ); - entry = &dma->bufs[order]; - if ( entry->buf_count ) { - up( &dev->struct_sem ); - atomic_dec( &dev->buf_alloc ); - return -ENOMEM; /* May only call once for each order */ - } - - if (count < 0 || count > 4096) { - up( &dev->struct_sem ); - atomic_dec( &dev->buf_alloc ); - return -EINVAL; - } - - entry->buflist = DRM(alloc)( count * sizeof(*entry->buflist), - DRM_MEM_BUFS ); - if ( !entry->buflist ) { - up( &dev->struct_sem ); - atomic_dec( &dev->buf_alloc ); - return -ENOMEM; - } - memset( entry->buflist, 0, count * sizeof(*entry->buflist) ); - - entry->buf_size = size; - entry->page_order = page_order; - - offset = 0; - - while ( entry->buf_count < count ) { - buf = &entry->buflist[entry->buf_count]; - buf->idx = dma->buf_count + entry->buf_count; - buf->total = alignment; - buf->order = order; - buf->used = 0; - - buf->offset = (dma->byte_count + offset); - buf->bus_address = agp_offset + offset; - buf->address = (void *)(agp_offset + offset); - buf->next = NULL; - buf->waiting = 0; - buf->pending = 0; - init_waitqueue_head( &buf->dma_wait ); - buf->filp = NULL; - - buf->dev_priv_size = dev->dev_priv_size; - buf->dev_private = DRM(alloc)( buf->dev_priv_size, - DRM_MEM_BUFS ); - if(!buf->dev_private) { - /* Set count correctly so we free the proper amount. */ - entry->buf_count = count; - DRM(cleanup_buf_error)(entry); - up( &dev->struct_sem ); - atomic_dec( &dev->buf_alloc ); - return -ENOMEM; - } - memset( buf->dev_private, 0, buf->dev_priv_size ); - - DRM_DEBUG( "buffer %d @ %p\n", - entry->buf_count, buf->address ); - - offset += alignment; - entry->buf_count++; - byte_count += PAGE_SIZE << page_order; - } - - DRM_DEBUG( "byte_count: %d\n", byte_count ); - - temp_buflist = DRM(realloc)( dma->buflist, - dma->buf_count * sizeof(*dma->buflist), - (dma->buf_count + entry->buf_count) - * sizeof(*dma->buflist), - DRM_MEM_BUFS ); - if(!temp_buflist) { - /* Free the entry because it isn't valid */ - DRM(cleanup_buf_error)(entry); - up( &dev->struct_sem ); - atomic_dec( &dev->buf_alloc ); - return -ENOMEM; - } - dma->buflist = temp_buflist; - - for ( i = 0 ; i < entry->buf_count ; i++ ) { - dma->buflist[i + dma->buf_count] = &entry->buflist[i]; - } - - dma->buf_count += entry->buf_count; - dma->byte_count += byte_count; - - DRM_DEBUG( "dma->buf_count : %d\n", dma->buf_count ); - DRM_DEBUG( "entry->buf_count : %d\n", entry->buf_count ); - - up( &dev->struct_sem ); - - request.count = entry->buf_count; - request.size = size; - - if ( copy_to_user( argp, &request, sizeof(request) ) ) - return -EFAULT; - - dma->flags = _DRM_DMA_USE_AGP; - - atomic_dec( &dev->buf_alloc ); - return 0; -} -#endif /* __OS_HAS_AGP */ - -int DRM(addbufs_pci)( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_device_dma_t *dma = dev->dma; - drm_buf_desc_t request; - int count; - int order; - int size; - int total; - int page_order; - drm_buf_entry_t *entry; - unsigned long page; - drm_buf_t *buf; - int alignment; - unsigned long offset; - int i; - int byte_count; - int page_count; - unsigned long *temp_pagelist; - drm_buf_t **temp_buflist; - drm_buf_desc_t __user *argp = (void __user *)arg; - - if (!drm_core_check_feature(dev, DRIVER_PCI_DMA)) return -EINVAL; - if ( !dma ) return -EINVAL; - - if ( copy_from_user( &request, argp, sizeof(request) ) ) - return -EFAULT; - - count = request.count; - order = DRM(order)( request.size ); - size = 1 << order; - - DRM_DEBUG( "count=%d, size=%d (%d), order=%d, queue_count=%d\n", - request.count, request.size, size, - order, dev->queue_count ); - - if ( order < DRM_MIN_ORDER || order > DRM_MAX_ORDER ) return -EINVAL; - if ( dev->queue_count ) return -EBUSY; /* Not while in use */ - - alignment = (request.flags & _DRM_PAGE_ALIGN) - ? PAGE_ALIGN(size) : size; - page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0; - total = PAGE_SIZE << page_order; - - spin_lock( &dev->count_lock ); - if ( dev->buf_use ) { - spin_unlock( &dev->count_lock ); - return -EBUSY; - } - atomic_inc( &dev->buf_alloc ); - spin_unlock( &dev->count_lock ); - - down( &dev->struct_sem ); - entry = &dma->bufs[order]; - if ( entry->buf_count ) { - up( &dev->struct_sem ); - atomic_dec( &dev->buf_alloc ); - return -ENOMEM; /* May only call once for each order */ - } - - if (count < 0 || count > 4096) { - up( &dev->struct_sem ); - atomic_dec( &dev->buf_alloc ); - return -EINVAL; - } - - entry->buflist = DRM(alloc)( count * sizeof(*entry->buflist), - DRM_MEM_BUFS ); - if ( !entry->buflist ) { - up( &dev->struct_sem ); - atomic_dec( &dev->buf_alloc ); - return -ENOMEM; - } - memset( entry->buflist, 0, count * sizeof(*entry->buflist) ); - - entry->seglist = DRM(alloc)( count * sizeof(*entry->seglist), - DRM_MEM_SEGS ); - if ( !entry->seglist ) { - DRM(free)( entry->buflist, - count * sizeof(*entry->buflist), - DRM_MEM_BUFS ); - up( &dev->struct_sem ); - atomic_dec( &dev->buf_alloc ); - return -ENOMEM; - } - memset( entry->seglist, 0, count * sizeof(*entry->seglist) ); - - /* Keep the original pagelist until we know all the allocations - * have succeeded - */ - temp_pagelist = DRM(alloc)( (dma->page_count + (count << page_order)) - * sizeof(*dma->pagelist), - DRM_MEM_PAGES ); - if (!temp_pagelist) { - DRM(free)( entry->buflist, - count * sizeof(*entry->buflist), - DRM_MEM_BUFS ); - DRM(free)( entry->seglist, - count * sizeof(*entry->seglist), - DRM_MEM_SEGS ); - up( &dev->struct_sem ); - atomic_dec( &dev->buf_alloc ); - return -ENOMEM; - } - memcpy(temp_pagelist, - dma->pagelist, - dma->page_count * sizeof(*dma->pagelist)); - DRM_DEBUG( "pagelist: %d entries\n", - dma->page_count + (count << page_order) ); - - entry->buf_size = size; - entry->page_order = page_order; - byte_count = 0; - page_count = 0; - - while ( entry->buf_count < count ) { - page = DRM(alloc_pages)( page_order, DRM_MEM_DMA ); - if ( !page ) { - /* Set count correctly so we free the proper amount. */ - entry->buf_count = count; - entry->seg_count = count; - DRM(cleanup_buf_error)(entry); - DRM(free)( temp_pagelist, - (dma->page_count + (count << page_order)) - * sizeof(*dma->pagelist), - DRM_MEM_PAGES ); - up( &dev->struct_sem ); - atomic_dec( &dev->buf_alloc ); - return -ENOMEM; - } - entry->seglist[entry->seg_count++] = page; - for ( i = 0 ; i < (1 << page_order) ; i++ ) { - DRM_DEBUG( "page %d @ 0x%08lx\n", - dma->page_count + page_count, - page + PAGE_SIZE * i ); - temp_pagelist[dma->page_count + page_count++] - = page + PAGE_SIZE * i; - } - for ( offset = 0 ; - offset + size <= total && entry->buf_count < count ; - offset += alignment, ++entry->buf_count ) { - buf = &entry->buflist[entry->buf_count]; - buf->idx = dma->buf_count + entry->buf_count; - buf->total = alignment; - buf->order = order; - buf->used = 0; - buf->offset = (dma->byte_count + byte_count + offset); - buf->address = (void *)(page + offset); - buf->next = NULL; - buf->waiting = 0; - buf->pending = 0; - init_waitqueue_head( &buf->dma_wait ); - buf->filp = NULL; - - buf->dev_priv_size = dev->dev_priv_size; - buf->dev_private = DRM(alloc)( dev->dev_priv_size, - DRM_MEM_BUFS ); - if(!buf->dev_private) { - /* Set count correctly so we free the proper amount. */ - entry->buf_count = count; - entry->seg_count = count; - DRM(cleanup_buf_error)(entry); - DRM(free)( temp_pagelist, - (dma->page_count + (count << page_order)) - * sizeof(*dma->pagelist), - DRM_MEM_PAGES ); - up( &dev->struct_sem ); - atomic_dec( &dev->buf_alloc ); - return -ENOMEM; - } - memset( buf->dev_private, 0, buf->dev_priv_size ); - - DRM_DEBUG( "buffer %d @ %p\n", - entry->buf_count, buf->address ); - } - byte_count += PAGE_SIZE << page_order; - } - - temp_buflist = DRM(realloc)( dma->buflist, - dma->buf_count * sizeof(*dma->buflist), - (dma->buf_count + entry->buf_count) - * sizeof(*dma->buflist), - DRM_MEM_BUFS ); - if (!temp_buflist) { - /* Free the entry because it isn't valid */ - DRM(cleanup_buf_error)(entry); - DRM(free)( temp_pagelist, - (dma->page_count + (count << page_order)) - * sizeof(*dma->pagelist), - DRM_MEM_PAGES ); - up( &dev->struct_sem ); - atomic_dec( &dev->buf_alloc ); - return -ENOMEM; - } - dma->buflist = temp_buflist; - - for ( i = 0 ; i < entry->buf_count ; i++ ) { - dma->buflist[i + dma->buf_count] = &entry->buflist[i]; - } - - /* No allocations failed, so now we can replace the orginal pagelist - * with the new one. - */ - if (dma->page_count) { - DRM(free)(dma->pagelist, - dma->page_count * sizeof(*dma->pagelist), - DRM_MEM_PAGES); - } - dma->pagelist = temp_pagelist; - - dma->buf_count += entry->buf_count; - dma->seg_count += entry->seg_count; - dma->page_count += entry->seg_count << page_order; - dma->byte_count += PAGE_SIZE * (entry->seg_count << page_order); - - up( &dev->struct_sem ); - - request.count = entry->buf_count; - request.size = size; - - if ( copy_to_user( argp, &request, sizeof(request) ) ) - return -EFAULT; - - atomic_dec( &dev->buf_alloc ); - return 0; - -} - -int DRM(addbufs_sg)( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_device_dma_t *dma = dev->dma; - drm_buf_desc_t __user *argp = (void __user *)arg; - drm_buf_desc_t request; - drm_buf_entry_t *entry; - drm_buf_t *buf; - unsigned long offset; - unsigned long agp_offset; - int count; - int order; - int size; - int alignment; - int page_order; - int total; - int byte_count; - int i; - drm_buf_t **temp_buflist; - - if (!drm_core_check_feature(dev, DRIVER_SG)) return -EINVAL; - - if ( !dma ) return -EINVAL; - - if ( copy_from_user( &request, argp, sizeof(request) ) ) - return -EFAULT; - - count = request.count; - order = DRM(order)( request.size ); - size = 1 << order; - - alignment = (request.flags & _DRM_PAGE_ALIGN) - ? PAGE_ALIGN(size) : size; - page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0; - total = PAGE_SIZE << page_order; - - byte_count = 0; - agp_offset = request.agp_start; - - DRM_DEBUG( "count: %d\n", count ); - DRM_DEBUG( "order: %d\n", order ); - DRM_DEBUG( "size: %d\n", size ); - DRM_DEBUG( "agp_offset: %lu\n", agp_offset ); - DRM_DEBUG( "alignment: %d\n", alignment ); - DRM_DEBUG( "page_order: %d\n", page_order ); - DRM_DEBUG( "total: %d\n", total ); - - if ( order < DRM_MIN_ORDER || order > DRM_MAX_ORDER ) return -EINVAL; - if ( dev->queue_count ) return -EBUSY; /* Not while in use */ - - spin_lock( &dev->count_lock ); - if ( dev->buf_use ) { - spin_unlock( &dev->count_lock ); - return -EBUSY; - } - atomic_inc( &dev->buf_alloc ); - spin_unlock( &dev->count_lock ); - - down( &dev->struct_sem ); - entry = &dma->bufs[order]; - if ( entry->buf_count ) { - up( &dev->struct_sem ); - atomic_dec( &dev->buf_alloc ); - return -ENOMEM; /* May only call once for each order */ - } - - if (count < 0 || count > 4096) { - up( &dev->struct_sem ); - atomic_dec( &dev->buf_alloc ); - return -EINVAL; - } - - entry->buflist = DRM(alloc)( count * sizeof(*entry->buflist), - DRM_MEM_BUFS ); - if ( !entry->buflist ) { - up( &dev->struct_sem ); - atomic_dec( &dev->buf_alloc ); - return -ENOMEM; - } - memset( entry->buflist, 0, count * sizeof(*entry->buflist) ); - - entry->buf_size = size; - entry->page_order = page_order; - - offset = 0; - - while ( entry->buf_count < count ) { - buf = &entry->buflist[entry->buf_count]; - buf->idx = dma->buf_count + entry->buf_count; - buf->total = alignment; - buf->order = order; - buf->used = 0; - - buf->offset = (dma->byte_count + offset); - buf->bus_address = agp_offset + offset; - buf->address = (void *)(agp_offset + offset + dev->sg->handle); - buf->next = NULL; - buf->waiting = 0; - buf->pending = 0; - init_waitqueue_head( &buf->dma_wait ); - buf->filp = NULL; - - buf->dev_priv_size = dev->dev_priv_size; - buf->dev_private = DRM(alloc)( dev->dev_priv_size, - DRM_MEM_BUFS ); - if(!buf->dev_private) { - /* Set count correctly so we free the proper amount. */ - entry->buf_count = count; - DRM(cleanup_buf_error)(entry); - up( &dev->struct_sem ); - atomic_dec( &dev->buf_alloc ); - return -ENOMEM; - } - - memset( buf->dev_private, 0, buf->dev_priv_size ); - - DRM_DEBUG( "buffer %d @ %p\n", - entry->buf_count, buf->address ); - - offset += alignment; - entry->buf_count++; - byte_count += PAGE_SIZE << page_order; - } - - DRM_DEBUG( "byte_count: %d\n", byte_count ); - - temp_buflist = DRM(realloc)( dma->buflist, - dma->buf_count * sizeof(*dma->buflist), - (dma->buf_count + entry->buf_count) - * sizeof(*dma->buflist), - DRM_MEM_BUFS ); - if(!temp_buflist) { - /* Free the entry because it isn't valid */ - DRM(cleanup_buf_error)(entry); - up( &dev->struct_sem ); - atomic_dec( &dev->buf_alloc ); - return -ENOMEM; - } - dma->buflist = temp_buflist; - - for ( i = 0 ; i < entry->buf_count ; i++ ) { - dma->buflist[i + dma->buf_count] = &entry->buflist[i]; - } - - dma->buf_count += entry->buf_count; - dma->byte_count += byte_count; - - DRM_DEBUG( "dma->buf_count : %d\n", dma->buf_count ); - DRM_DEBUG( "entry->buf_count : %d\n", entry->buf_count ); - - up( &dev->struct_sem ); - - request.count = entry->buf_count; - request.size = size; - - if ( copy_to_user( argp, &request, sizeof(request) ) ) - return -EFAULT; - - dma->flags = _DRM_DMA_USE_SG; - - atomic_dec( &dev->buf_alloc ); - return 0; -} - -/** - * Add buffers for DMA transfers (ioctl). - * - * \param inode device inode. - * \param filp file pointer. - * \param cmd command. - * \param arg pointer to a drm_buf_desc_t request. - * \return zero on success or a negative number on failure. - * - * According with the memory type specified in drm_buf_desc::flags and the - * build options, it dispatches the call either to addbufs_agp(), - * addbufs_sg() or addbufs_pci() for AGP, scatter-gather or consistent - * PCI memory respectively. - */ -int DRM(addbufs)( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_buf_desc_t request; - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - - if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA)) - return -EINVAL; - - if ( copy_from_user( &request, (drm_buf_desc_t __user *)arg, - sizeof(request) ) ) - return -EFAULT; - -#if __OS_HAS_AGP - if ( request.flags & _DRM_AGP_BUFFER ) - return DRM(addbufs_agp)( inode, filp, cmd, arg ); - else -#endif - if ( request.flags & _DRM_SG_BUFFER ) - return DRM(addbufs_sg)( inode, filp, cmd, arg ); - else - return DRM(addbufs_pci)( inode, filp, cmd, arg ); -} - - -/** - * Get information about the buffer mappings. - * - * This was originally mean for debugging purposes, or by a sophisticated - * client library to determine how best to use the available buffers (e.g., - * large buffers can be used for image transfer). - * - * \param inode device inode. - * \param filp file pointer. - * \param cmd command. - * \param arg pointer to a drm_buf_info structure. - * \return zero on success or a negative number on failure. - * - * Increments drm_device::buf_use while holding the drm_device::count_lock - * lock, preventing of allocating more buffers after this call. Information - * about each requested buffer is then copied into user space. - */ -int DRM(infobufs)( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_device_dma_t *dma = dev->dma; - drm_buf_info_t request; - drm_buf_info_t __user *argp = (void __user *)arg; - int i; - int count; - - if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA)) - return -EINVAL; - - if ( !dma ) return -EINVAL; - - spin_lock( &dev->count_lock ); - if ( atomic_read( &dev->buf_alloc ) ) { - spin_unlock( &dev->count_lock ); - return -EBUSY; - } - ++dev->buf_use; /* Can't allocate more after this call */ - spin_unlock( &dev->count_lock ); - - if ( copy_from_user( &request, argp, sizeof(request) ) ) - return -EFAULT; - - for ( i = 0, count = 0 ; i < DRM_MAX_ORDER + 1 ; i++ ) { - if ( dma->bufs[i].buf_count ) ++count; - } - - DRM_DEBUG( "count = %d\n", count ); - - if ( request.count >= count ) { - for ( i = 0, count = 0 ; i < DRM_MAX_ORDER + 1 ; i++ ) { - if ( dma->bufs[i].buf_count ) { - drm_buf_desc_t __user *to = &request.list[count]; - drm_buf_entry_t *from = &dma->bufs[i]; - drm_freelist_t *list = &dma->bufs[i].freelist; - if ( copy_to_user( &to->count, - &from->buf_count, - sizeof(from->buf_count) ) || - copy_to_user( &to->size, - &from->buf_size, - sizeof(from->buf_size) ) || - copy_to_user( &to->low_mark, - &list->low_mark, - sizeof(list->low_mark) ) || - copy_to_user( &to->high_mark, - &list->high_mark, - sizeof(list->high_mark) ) ) - return -EFAULT; - - DRM_DEBUG( "%d %d %d %d %d\n", - i, - dma->bufs[i].buf_count, - dma->bufs[i].buf_size, - dma->bufs[i].freelist.low_mark, - dma->bufs[i].freelist.high_mark ); - ++count; - } - } - } - request.count = count; - - if ( copy_to_user( argp, &request, sizeof(request) ) ) - return -EFAULT; - - return 0; -} - -/** - * Specifies a low and high water mark for buffer allocation - * - * \param inode device inode. - * \param filp file pointer. - * \param cmd command. - * \param arg a pointer to a drm_buf_desc structure. - * \return zero on success or a negative number on failure. - * - * Verifies that the size order is bounded between the admissible orders and - * updates the respective drm_device_dma::bufs entry low and high water mark. - * - * \note This ioctl is deprecated and mostly never used. - */ -int DRM(markbufs)( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_device_dma_t *dma = dev->dma; - drm_buf_desc_t request; - int order; - drm_buf_entry_t *entry; - - if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA)) - return -EINVAL; - - if ( !dma ) return -EINVAL; - - if ( copy_from_user( &request, - (drm_buf_desc_t __user *)arg, - sizeof(request) ) ) - return -EFAULT; - - DRM_DEBUG( "%d, %d, %d\n", - request.size, request.low_mark, request.high_mark ); - order = DRM(order)( request.size ); - if ( order < DRM_MIN_ORDER || order > DRM_MAX_ORDER ) return -EINVAL; - entry = &dma->bufs[order]; - - if ( request.low_mark < 0 || request.low_mark > entry->buf_count ) - return -EINVAL; - if ( request.high_mark < 0 || request.high_mark > entry->buf_count ) - return -EINVAL; - - entry->freelist.low_mark = request.low_mark; - entry->freelist.high_mark = request.high_mark; - - return 0; -} - -/** - * Unreserve the buffers in list, previously reserved using drmDMA. - * - * \param inode device inode. - * \param filp file pointer. - * \param cmd command. - * \param arg pointer to a drm_buf_free structure. - * \return zero on success or a negative number on failure. - * - * Calls free_buffer() for each used buffer. - * This function is primarily used for debugging. - */ -int DRM(freebufs)( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_device_dma_t *dma = dev->dma; - drm_buf_free_t request; - int i; - int idx; - drm_buf_t *buf; - - if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA)) - return -EINVAL; - - if ( !dma ) return -EINVAL; - - if ( copy_from_user( &request, - (drm_buf_free_t __user *)arg, - sizeof(request) ) ) - return -EFAULT; - - DRM_DEBUG( "%d\n", request.count ); - for ( i = 0 ; i < request.count ; i++ ) { - if ( copy_from_user( &idx, - &request.list[i], - sizeof(idx) ) ) - return -EFAULT; - if ( idx < 0 || idx >= dma->buf_count ) { - DRM_ERROR( "Index %d (of %d max)\n", - idx, dma->buf_count - 1 ); - return -EINVAL; - } - buf = dma->buflist[idx]; - if ( buf->filp != filp ) { - DRM_ERROR( "Process %d freeing buffer not owned\n", - current->pid ); - return -EINVAL; - } - DRM(free_buffer)( dev, buf ); - } - - return 0; -} - -/** - * Maps all of the DMA buffers into client-virtual space (ioctl). - * - * \param inode device inode. - * \param filp file pointer. - * \param cmd command. - * \param arg pointer to a drm_buf_map structure. - * \return zero on success or a negative number on failure. - * - * Maps the AGP or SG buffer region with do_mmap(), and copies information - * about each buffer into user space. The PCI buffers are already mapped on the - * addbufs_pci() call. - */ -int DRM(mapbufs)( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_device_dma_t *dma = dev->dma; - drm_buf_map_t __user *argp = (void __user *)arg; - int retcode = 0; - const int zero = 0; - unsigned long virtual; - unsigned long address; - drm_buf_map_t request; - int i; - - if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA)) - return -EINVAL; - - if ( !dma ) return -EINVAL; - - spin_lock( &dev->count_lock ); - if ( atomic_read( &dev->buf_alloc ) ) { - spin_unlock( &dev->count_lock ); - return -EBUSY; - } - dev->buf_use++; /* Can't allocate more after this call */ - spin_unlock( &dev->count_lock ); - - if ( copy_from_user( &request, argp, sizeof(request) ) ) - return -EFAULT; - - if ( request.count >= dma->buf_count ) { - if ((drm_core_has_AGP(dev) && (dma->flags & _DRM_DMA_USE_AGP)) || - (drm_core_check_feature(dev, DRIVER_SG) && (dma->flags & _DRM_DMA_USE_SG)) ) { - drm_map_t *map = dev->agp_buffer_map; - - if ( !map ) { - retcode = -EINVAL; - goto done; - } - -#if LINUX_VERSION_CODE <= 0x020402 - down( ¤t->mm->mmap_sem ); -#else - down_write( ¤t->mm->mmap_sem ); -#endif - virtual = do_mmap( filp, 0, map->size, - PROT_READ | PROT_WRITE, - MAP_SHARED, - (unsigned long)map->offset ); -#if LINUX_VERSION_CODE <= 0x020402 - up( ¤t->mm->mmap_sem ); -#else - up_write( ¤t->mm->mmap_sem ); -#endif - } else { -#if LINUX_VERSION_CODE <= 0x020402 - down( ¤t->mm->mmap_sem ); -#else - down_write( ¤t->mm->mmap_sem ); -#endif - virtual = do_mmap( filp, 0, dma->byte_count, - PROT_READ | PROT_WRITE, - MAP_SHARED, 0 ); -#if LINUX_VERSION_CODE <= 0x020402 - up( ¤t->mm->mmap_sem ); -#else - up_write( ¤t->mm->mmap_sem ); -#endif - } - if ( virtual > -1024UL ) { - /* Real error */ - retcode = (signed long)virtual; - goto done; - } - request.virtual = (void __user *)virtual; - - for ( i = 0 ; i < dma->buf_count ; i++ ) { - if ( copy_to_user( &request.list[i].idx, - &dma->buflist[i]->idx, - sizeof(request.list[0].idx) ) ) { - retcode = -EFAULT; - goto done; - } - if ( copy_to_user( &request.list[i].total, - &dma->buflist[i]->total, - sizeof(request.list[0].total) ) ) { - retcode = -EFAULT; - goto done; - } - if ( copy_to_user( &request.list[i].used, - &zero, - sizeof(zero) ) ) { - retcode = -EFAULT; - goto done; - } - address = virtual + dma->buflist[i]->offset; /* *** */ - if ( copy_to_user( &request.list[i].address, - &address, - sizeof(address) ) ) { - retcode = -EFAULT; - goto done; - } - } - } - done: - request.count = dma->buf_count; - DRM_DEBUG( "%d buffers, retcode = %d\n", request.count, retcode ); - - if ( copy_to_user( argp, &request, sizeof(request) ) ) - return -EFAULT; - - return retcode; -} - diff -Nru a/drivers/char/drm/drm_context.c b/drivers/char/drm/drm_context.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/char/drm/drm_context.c 2005-01-02 23:03:32 -08:00 @@ -0,0 +1,578 @@ +/** + * \file drm_context.h + * IOCTLs for generic contexts + * + * \author Rickard E. (Rik) Faith + * \author Gareth Hughes + */ + +/* + * Created: Fri Nov 24 18:31:37 2000 by gareth@valinux.com + * + * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/* + * ChangeLog: + * 2001-11-16 Torsten Duwe + * added context constructor/destructor hooks, + * needed by SiS driver's memory management. + */ + +#include "drmP.h" + +/******************************************************************/ +/** \name Context bitmap support */ +/*@{*/ + +/** + * Free a handle from the context bitmap. + * + * \param dev DRM device. + * \param ctx_handle context handle. + * + * Clears the bit specified by \p ctx_handle in drm_device::ctx_bitmap and the entry + * in drm_device::context_sareas, while holding the drm_device::struct_sem + * lock. + */ +void drm_ctxbitmap_free( drm_device_t *dev, int ctx_handle ) +{ + if ( ctx_handle < 0 ) goto failed; + if ( !dev->ctx_bitmap ) goto failed; + + if ( ctx_handle < DRM_MAX_CTXBITMAP ) { + down(&dev->struct_sem); + clear_bit( ctx_handle, dev->ctx_bitmap ); + dev->context_sareas[ctx_handle] = NULL; + up(&dev->struct_sem); + return; + } +failed: + DRM_ERROR( "Attempt to free invalid context handle: %d\n", + ctx_handle ); + return; +} + +/** + * Context bitmap allocation. + * + * \param dev DRM device. + * \return (non-negative) context handle on success or a negative number on failure. + * + * Find the first zero bit in drm_device::ctx_bitmap and (re)allocates + * drm_device::context_sareas to accommodate the new entry while holding the + * drm_device::struct_sem lock. + */ +int drm_ctxbitmap_next( drm_device_t *dev ) +{ + int bit; + + if(!dev->ctx_bitmap) return -1; + + down(&dev->struct_sem); + bit = find_first_zero_bit( dev->ctx_bitmap, DRM_MAX_CTXBITMAP ); + if ( bit < DRM_MAX_CTXBITMAP ) { + set_bit( bit, dev->ctx_bitmap ); + DRM_DEBUG( "drm_ctxbitmap_next bit : %d\n", bit ); + if((bit+1) > dev->max_context) { + dev->max_context = (bit+1); + if(dev->context_sareas) { + drm_map_t **ctx_sareas; + + ctx_sareas = drm_realloc(dev->context_sareas, + (dev->max_context - 1) * + sizeof(*dev->context_sareas), + dev->max_context * + sizeof(*dev->context_sareas), + DRM_MEM_MAPS); + if(!ctx_sareas) { + clear_bit(bit, dev->ctx_bitmap); + up(&dev->struct_sem); + return -1; + } + dev->context_sareas = ctx_sareas; + dev->context_sareas[bit] = NULL; + } else { + /* max_context == 1 at this point */ + dev->context_sareas = drm_alloc( + dev->max_context * + sizeof(*dev->context_sareas), + DRM_MEM_MAPS); + if(!dev->context_sareas) { + clear_bit(bit, dev->ctx_bitmap); + up(&dev->struct_sem); + return -1; + } + dev->context_sareas[bit] = NULL; + } + } + up(&dev->struct_sem); + return bit; + } + up(&dev->struct_sem); + return -1; +} + +/** + * Context bitmap initialization. + * + * \param dev DRM device. + * + * Allocates and initialize drm_device::ctx_bitmap and drm_device::context_sareas, while holding + * the drm_device::struct_sem lock. + */ +int drm_ctxbitmap_init( drm_device_t *dev ) +{ + int i; + int temp; + + down(&dev->struct_sem); + dev->ctx_bitmap = (unsigned long *) drm_alloc( PAGE_SIZE, + DRM_MEM_CTXBITMAP ); + if ( dev->ctx_bitmap == NULL ) { + up(&dev->struct_sem); + return -ENOMEM; + } + memset( (void *)dev->ctx_bitmap, 0, PAGE_SIZE ); + dev->context_sareas = NULL; + dev->max_context = -1; + up(&dev->struct_sem); + + for ( i = 0 ; i < DRM_RESERVED_CONTEXTS ; i++ ) { + temp = drm_ctxbitmap_next( dev ); + DRM_DEBUG( "drm_ctxbitmap_init : %d\n", temp ); + } + + return 0; +} + +/** + * Context bitmap cleanup. + * + * \param dev DRM device. + * + * Frees drm_device::ctx_bitmap and drm_device::context_sareas, while holding + * the drm_device::struct_sem lock. + */ +void drm_ctxbitmap_cleanup( drm_device_t *dev ) +{ + down(&dev->struct_sem); + if( dev->context_sareas ) drm_free( dev->context_sareas, + sizeof(*dev->context_sareas) * + dev->max_context, + DRM_MEM_MAPS ); + drm_free( (void *)dev->ctx_bitmap, PAGE_SIZE, DRM_MEM_CTXBITMAP ); + up(&dev->struct_sem); +} + +/*@}*/ + +/******************************************************************/ +/** \name Per Context SAREA Support */ +/*@{*/ + +/** + * Get per-context SAREA. + * + * \param inode device inode. + * \param filp file pointer. + * \param cmd command. + * \param arg user argument pointing to a drm_ctx_priv_map structure. + * \return zero on success or a negative number on failure. + * + * Gets the map from drm_device::context_sareas with the handle specified and + * returns its handle. + */ +int drm_getsareactx(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_ctx_priv_map_t __user *argp = (void __user *)arg; + drm_ctx_priv_map_t request; + drm_map_t *map; + + if (copy_from_user(&request, argp, sizeof(request))) + return -EFAULT; + + down(&dev->struct_sem); + if (dev->max_context < 0 || request.ctx_id >= (unsigned) dev->max_context) { + up(&dev->struct_sem); + return -EINVAL; + } + + map = dev->context_sareas[request.ctx_id]; + up(&dev->struct_sem); + + request.handle = map->handle; + if (copy_to_user(argp, &request, sizeof(request))) + return -EFAULT; + return 0; +} + +/** + * Set per-context SAREA. + * + * \param inode device inode. + * \param filp file pointer. + * \param cmd command. + * \param arg user argument pointing to a drm_ctx_priv_map structure. + * \return zero on success or a negative number on failure. + * + * Searches the mapping specified in \p arg and update the entry in + * drm_device::context_sareas with it. + */ +int drm_setsareactx(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_ctx_priv_map_t request; + drm_map_t *map = NULL; + drm_map_list_t *r_list = NULL; + struct list_head *list; + + if (copy_from_user(&request, + (drm_ctx_priv_map_t __user *)arg, + sizeof(request))) + return -EFAULT; + + down(&dev->struct_sem); + list_for_each(list, &dev->maplist->head) { + r_list = list_entry(list, drm_map_list_t, head); + if(r_list->map && + r_list->map->handle == request.handle) + goto found; + } +bad: + up(&dev->struct_sem); + return -EINVAL; + +found: + map = r_list->map; + if (!map) goto bad; + if (dev->max_context < 0) + goto bad; + if (request.ctx_id >= (unsigned) dev->max_context) + goto bad; + dev->context_sareas[request.ctx_id] = map; + up(&dev->struct_sem); + return 0; +} + +/*@}*/ + +/******************************************************************/ +/** \name The actual DRM context handling routines */ +/*@{*/ + +/** + * Switch context. + * + * \param dev DRM device. + * \param old old context handle. + * \param new new context handle. + * \return zero on success or a negative number on failure. + * + * Attempt to set drm_device::context_flag. + */ +int drm_context_switch( drm_device_t *dev, int old, int new ) +{ + if ( test_and_set_bit( 0, &dev->context_flag ) ) { + DRM_ERROR( "Reentering -- FIXME\n" ); + return -EBUSY; + } + + + DRM_DEBUG( "Context switch from %d to %d\n", old, new ); + + if ( new == dev->last_context ) { + clear_bit( 0, &dev->context_flag ); + return 0; + } + + return 0; +} + +/** + * Complete context switch. + * + * \param dev DRM device. + * \param new new context handle. + * \return zero on success or a negative number on failure. + * + * Updates drm_device::last_context and drm_device::last_switch. Verifies the + * hardware lock is held, clears the drm_device::context_flag and wakes up + * drm_device::context_wait. + */ +int drm_context_switch_complete( drm_device_t *dev, int new ) +{ + dev->last_context = new; /* PRE/POST: This is the _only_ writer. */ + dev->last_switch = jiffies; + + if ( !_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock) ) { + DRM_ERROR( "Lock isn't held after context switch\n" ); + } + + /* If a context switch is ever initiated + when the kernel holds the lock, release + that lock here. */ + clear_bit( 0, &dev->context_flag ); + wake_up( &dev->context_wait ); + + return 0; +} + +/** + * Reserve contexts. + * + * \param inode device inode. + * \param filp file pointer. + * \param cmd command. + * \param arg user argument pointing to a drm_ctx_res structure. + * \return zero on success or a negative number on failure. + */ +int drm_resctx( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_ctx_res_t res; + drm_ctx_t __user *argp = (void __user *)arg; + drm_ctx_t ctx; + int i; + + if ( copy_from_user( &res, argp, sizeof(res) ) ) + return -EFAULT; + + if ( res.count >= DRM_RESERVED_CONTEXTS ) { + memset( &ctx, 0, sizeof(ctx) ); + for ( i = 0 ; i < DRM_RESERVED_CONTEXTS ; i++ ) { + ctx.handle = i; + if ( copy_to_user( &res.contexts[i], + &i, sizeof(i) ) ) + return -EFAULT; + } + } + res.count = DRM_RESERVED_CONTEXTS; + + if ( copy_to_user( argp, &res, sizeof(res) ) ) + return -EFAULT; + return 0; +} + +/** + * Add context. + * + * \param inode device inode. + * \param filp file pointer. + * \param cmd command. + * \param arg user argument pointing to a drm_ctx structure. + * \return zero on success or a negative number on failure. + * + * Get a new handle for the context and copy to userspace. + */ +int drm_addctx( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_ctx_list_t * ctx_entry; + drm_ctx_t __user *argp = (void __user *)arg; + drm_ctx_t ctx; + + if ( copy_from_user( &ctx, argp, sizeof(ctx) ) ) + return -EFAULT; + + ctx.handle = drm_ctxbitmap_next( dev ); + if ( ctx.handle == DRM_KERNEL_CONTEXT ) { + /* Skip kernel's context and get a new one. */ + ctx.handle = drm_ctxbitmap_next( dev ); + } + DRM_DEBUG( "%d\n", ctx.handle ); + if ( ctx.handle == -1 ) { + DRM_DEBUG( "Not enough free contexts.\n" ); + /* Should this return -EBUSY instead? */ + return -ENOMEM; + } + + if ( ctx.handle != DRM_KERNEL_CONTEXT ) + { + if (dev->driver->context_ctor) + dev->driver->context_ctor(dev, ctx.handle); + } + + ctx_entry = drm_alloc( sizeof(*ctx_entry), DRM_MEM_CTXLIST ); + if ( !ctx_entry ) { + DRM_DEBUG("out of memory\n"); + return -ENOMEM; + } + + INIT_LIST_HEAD( &ctx_entry->head ); + ctx_entry->handle = ctx.handle; + ctx_entry->tag = priv; + + down( &dev->ctxlist_sem ); + list_add( &ctx_entry->head, &dev->ctxlist->head ); + ++dev->ctx_count; + up( &dev->ctxlist_sem ); + + if ( copy_to_user( argp, &ctx, sizeof(ctx) ) ) + return -EFAULT; + return 0; +} + +int drm_modctx( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + /* This does nothing */ + return 0; +} + +/** + * Get context. + * + * \param inode device inode. + * \param filp file pointer. + * \param cmd command. + * \param arg user argument pointing to a drm_ctx structure. + * \return zero on success or a negative number on failure. + */ +int drm_getctx( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_ctx_t __user *argp = (void __user *)arg; + drm_ctx_t ctx; + + if ( copy_from_user( &ctx, argp, sizeof(ctx) ) ) + return -EFAULT; + + /* This is 0, because we don't handle any context flags */ + ctx.flags = 0; + + if ( copy_to_user( argp, &ctx, sizeof(ctx) ) ) + return -EFAULT; + return 0; +} + +/** + * Switch context. + * + * \param inode device inode. + * \param filp file pointer. + * \param cmd command. + * \param arg user argument pointing to a drm_ctx structure. + * \return zero on success or a negative number on failure. + * + * Calls context_switch(). + */ +int drm_switchctx( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_ctx_t ctx; + + if ( copy_from_user( &ctx, (drm_ctx_t __user *)arg, sizeof(ctx) ) ) + return -EFAULT; + + DRM_DEBUG( "%d\n", ctx.handle ); + return drm_context_switch( dev, dev->last_context, ctx.handle ); +} + +/** + * New context. + * + * \param inode device inode. + * \param filp file pointer. + * \param cmd command. + * \param arg user argument pointing to a drm_ctx structure. + * \return zero on success or a negative number on failure. + * + * Calls context_switch_complete(). + */ +int drm_newctx( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_ctx_t ctx; + + if ( copy_from_user( &ctx, (drm_ctx_t __user *)arg, sizeof(ctx) ) ) + return -EFAULT; + + DRM_DEBUG( "%d\n", ctx.handle ); + drm_context_switch_complete( dev, ctx.handle ); + + return 0; +} + +/** + * Remove context. + * + * \param inode device inode. + * \param filp file pointer. + * \param cmd command. + * \param arg user argument pointing to a drm_ctx structure. + * \return zero on success or a negative number on failure. + * + * If not the special kernel context, calls ctxbitmap_free() to free the specified context. + */ +int drm_rmctx( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_ctx_t ctx; + + if ( copy_from_user( &ctx, (drm_ctx_t __user *)arg, sizeof(ctx) ) ) + return -EFAULT; + + DRM_DEBUG( "%d\n", ctx.handle ); + if ( ctx.handle == DRM_KERNEL_CONTEXT + 1 ) { + priv->remove_auth_on_close = 1; + } + if ( ctx.handle != DRM_KERNEL_CONTEXT ) { + if (dev->driver->context_dtor) + dev->driver->context_dtor(dev, ctx.handle); + drm_ctxbitmap_free( dev, ctx.handle ); + } + + down( &dev->ctxlist_sem ); + if ( !list_empty( &dev->ctxlist->head ) ) { + drm_ctx_list_t *pos, *n; + + list_for_each_entry_safe( pos, n, &dev->ctxlist->head, head ) { + if ( pos->handle == ctx.handle ) { + list_del( &pos->head ); + drm_free( pos, sizeof(*pos), DRM_MEM_CTXLIST ); + --dev->ctx_count; + } + } + } + up( &dev->ctxlist_sem ); + + return 0; +} + +/*@}*/ + diff -Nru a/drivers/char/drm/drm_context.h b/drivers/char/drm/drm_context.h --- a/drivers/char/drm/drm_context.h 2005-01-02 23:03:32 -08:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,578 +0,0 @@ -/** - * \file drm_context.h - * IOCTLs for generic contexts - * - * \author Rickard E. (Rik) Faith - * \author Gareth Hughes - */ - -/* - * Created: Fri Nov 24 18:31:37 2000 by gareth@valinux.com - * - * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -/* - * ChangeLog: - * 2001-11-16 Torsten Duwe - * added context constructor/destructor hooks, - * needed by SiS driver's memory management. - */ - -#include "drmP.h" - -/******************************************************************/ -/** \name Context bitmap support */ -/*@{*/ - -/** - * Free a handle from the context bitmap. - * - * \param dev DRM device. - * \param ctx_handle context handle. - * - * Clears the bit specified by \p ctx_handle in drm_device::ctx_bitmap and the entry - * in drm_device::context_sareas, while holding the drm_device::struct_sem - * lock. - */ -void DRM(ctxbitmap_free)( drm_device_t *dev, int ctx_handle ) -{ - if ( ctx_handle < 0 ) goto failed; - if ( !dev->ctx_bitmap ) goto failed; - - if ( ctx_handle < DRM_MAX_CTXBITMAP ) { - down(&dev->struct_sem); - clear_bit( ctx_handle, dev->ctx_bitmap ); - dev->context_sareas[ctx_handle] = NULL; - up(&dev->struct_sem); - return; - } -failed: - DRM_ERROR( "Attempt to free invalid context handle: %d\n", - ctx_handle ); - return; -} - -/** - * Context bitmap allocation. - * - * \param dev DRM device. - * \return (non-negative) context handle on success or a negative number on failure. - * - * Find the first zero bit in drm_device::ctx_bitmap and (re)allocates - * drm_device::context_sareas to accommodate the new entry while holding the - * drm_device::struct_sem lock. - */ -int DRM(ctxbitmap_next)( drm_device_t *dev ) -{ - int bit; - - if(!dev->ctx_bitmap) return -1; - - down(&dev->struct_sem); - bit = find_first_zero_bit( dev->ctx_bitmap, DRM_MAX_CTXBITMAP ); - if ( bit < DRM_MAX_CTXBITMAP ) { - set_bit( bit, dev->ctx_bitmap ); - DRM_DEBUG( "drm_ctxbitmap_next bit : %d\n", bit ); - if((bit+1) > dev->max_context) { - dev->max_context = (bit+1); - if(dev->context_sareas) { - drm_map_t **ctx_sareas; - - ctx_sareas = DRM(realloc)(dev->context_sareas, - (dev->max_context - 1) * - sizeof(*dev->context_sareas), - dev->max_context * - sizeof(*dev->context_sareas), - DRM_MEM_MAPS); - if(!ctx_sareas) { - clear_bit(bit, dev->ctx_bitmap); - up(&dev->struct_sem); - return -1; - } - dev->context_sareas = ctx_sareas; - dev->context_sareas[bit] = NULL; - } else { - /* max_context == 1 at this point */ - dev->context_sareas = DRM(alloc)( - dev->max_context * - sizeof(*dev->context_sareas), - DRM_MEM_MAPS); - if(!dev->context_sareas) { - clear_bit(bit, dev->ctx_bitmap); - up(&dev->struct_sem); - return -1; - } - dev->context_sareas[bit] = NULL; - } - } - up(&dev->struct_sem); - return bit; - } - up(&dev->struct_sem); - return -1; -} - -/** - * Context bitmap initialization. - * - * \param dev DRM device. - * - * Allocates and initialize drm_device::ctx_bitmap and drm_device::context_sareas, while holding - * the drm_device::struct_sem lock. - */ -int DRM(ctxbitmap_init)( drm_device_t *dev ) -{ - int i; - int temp; - - down(&dev->struct_sem); - dev->ctx_bitmap = (unsigned long *) DRM(alloc)( PAGE_SIZE, - DRM_MEM_CTXBITMAP ); - if ( dev->ctx_bitmap == NULL ) { - up(&dev->struct_sem); - return -ENOMEM; - } - memset( (void *)dev->ctx_bitmap, 0, PAGE_SIZE ); - dev->context_sareas = NULL; - dev->max_context = -1; - up(&dev->struct_sem); - - for ( i = 0 ; i < DRM_RESERVED_CONTEXTS ; i++ ) { - temp = DRM(ctxbitmap_next)( dev ); - DRM_DEBUG( "drm_ctxbitmap_init : %d\n", temp ); - } - - return 0; -} - -/** - * Context bitmap cleanup. - * - * \param dev DRM device. - * - * Frees drm_device::ctx_bitmap and drm_device::context_sareas, while holding - * the drm_device::struct_sem lock. - */ -void DRM(ctxbitmap_cleanup)( drm_device_t *dev ) -{ - down(&dev->struct_sem); - if( dev->context_sareas ) DRM(free)( dev->context_sareas, - sizeof(*dev->context_sareas) * - dev->max_context, - DRM_MEM_MAPS ); - DRM(free)( (void *)dev->ctx_bitmap, PAGE_SIZE, DRM_MEM_CTXBITMAP ); - up(&dev->struct_sem); -} - -/*@}*/ - -/******************************************************************/ -/** \name Per Context SAREA Support */ -/*@{*/ - -/** - * Get per-context SAREA. - * - * \param inode device inode. - * \param filp file pointer. - * \param cmd command. - * \param arg user argument pointing to a drm_ctx_priv_map structure. - * \return zero on success or a negative number on failure. - * - * Gets the map from drm_device::context_sareas with the handle specified and - * returns its handle. - */ -int DRM(getsareactx)(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_ctx_priv_map_t __user *argp = (void __user *)arg; - drm_ctx_priv_map_t request; - drm_map_t *map; - - if (copy_from_user(&request, argp, sizeof(request))) - return -EFAULT; - - down(&dev->struct_sem); - if (dev->max_context < 0 || request.ctx_id >= (unsigned) dev->max_context) { - up(&dev->struct_sem); - return -EINVAL; - } - - map = dev->context_sareas[request.ctx_id]; - up(&dev->struct_sem); - - request.handle = map->handle; - if (copy_to_user(argp, &request, sizeof(request))) - return -EFAULT; - return 0; -} - -/** - * Set per-context SAREA. - * - * \param inode device inode. - * \param filp file pointer. - * \param cmd command. - * \param arg user argument pointing to a drm_ctx_priv_map structure. - * \return zero on success or a negative number on failure. - * - * Searches the mapping specified in \p arg and update the entry in - * drm_device::context_sareas with it. - */ -int DRM(setsareactx)(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_ctx_priv_map_t request; - drm_map_t *map = NULL; - drm_map_list_t *r_list = NULL; - struct list_head *list; - - if (copy_from_user(&request, - (drm_ctx_priv_map_t __user *)arg, - sizeof(request))) - return -EFAULT; - - down(&dev->struct_sem); - list_for_each(list, &dev->maplist->head) { - r_list = list_entry(list, drm_map_list_t, head); - if(r_list->map && - r_list->map->handle == request.handle) - goto found; - } -bad: - up(&dev->struct_sem); - return -EINVAL; - -found: - map = r_list->map; - if (!map) goto bad; - if (dev->max_context < 0) - goto bad; - if (request.ctx_id >= (unsigned) dev->max_context) - goto bad; - dev->context_sareas[request.ctx_id] = map; - up(&dev->struct_sem); - return 0; -} - -/*@}*/ - -/******************************************************************/ -/** \name The actual DRM context handling routines */ -/*@{*/ - -/** - * Switch context. - * - * \param dev DRM device. - * \param old old context handle. - * \param new new context handle. - * \return zero on success or a negative number on failure. - * - * Attempt to set drm_device::context_flag. - */ -int DRM(context_switch)( drm_device_t *dev, int old, int new ) -{ - if ( test_and_set_bit( 0, &dev->context_flag ) ) { - DRM_ERROR( "Reentering -- FIXME\n" ); - return -EBUSY; - } - - - DRM_DEBUG( "Context switch from %d to %d\n", old, new ); - - if ( new == dev->last_context ) { - clear_bit( 0, &dev->context_flag ); - return 0; - } - - return 0; -} - -/** - * Complete context switch. - * - * \param dev DRM device. - * \param new new context handle. - * \return zero on success or a negative number on failure. - * - * Updates drm_device::last_context and drm_device::last_switch. Verifies the - * hardware lock is held, clears the drm_device::context_flag and wakes up - * drm_device::context_wait. - */ -int DRM(context_switch_complete)( drm_device_t *dev, int new ) -{ - dev->last_context = new; /* PRE/POST: This is the _only_ writer. */ - dev->last_switch = jiffies; - - if ( !_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock) ) { - DRM_ERROR( "Lock isn't held after context switch\n" ); - } - - /* If a context switch is ever initiated - when the kernel holds the lock, release - that lock here. */ - clear_bit( 0, &dev->context_flag ); - wake_up( &dev->context_wait ); - - return 0; -} - -/** - * Reserve contexts. - * - * \param inode device inode. - * \param filp file pointer. - * \param cmd command. - * \param arg user argument pointing to a drm_ctx_res structure. - * \return zero on success or a negative number on failure. - */ -int DRM(resctx)( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_ctx_res_t res; - drm_ctx_t __user *argp = (void __user *)arg; - drm_ctx_t ctx; - int i; - - if ( copy_from_user( &res, argp, sizeof(res) ) ) - return -EFAULT; - - if ( res.count >= DRM_RESERVED_CONTEXTS ) { - memset( &ctx, 0, sizeof(ctx) ); - for ( i = 0 ; i < DRM_RESERVED_CONTEXTS ; i++ ) { - ctx.handle = i; - if ( copy_to_user( &res.contexts[i], - &i, sizeof(i) ) ) - return -EFAULT; - } - } - res.count = DRM_RESERVED_CONTEXTS; - - if ( copy_to_user( argp, &res, sizeof(res) ) ) - return -EFAULT; - return 0; -} - -/** - * Add context. - * - * \param inode device inode. - * \param filp file pointer. - * \param cmd command. - * \param arg user argument pointing to a drm_ctx structure. - * \return zero on success or a negative number on failure. - * - * Get a new handle for the context and copy to userspace. - */ -int DRM(addctx)( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_ctx_list_t * ctx_entry; - drm_ctx_t __user *argp = (void __user *)arg; - drm_ctx_t ctx; - - if ( copy_from_user( &ctx, argp, sizeof(ctx) ) ) - return -EFAULT; - - ctx.handle = DRM(ctxbitmap_next)( dev ); - if ( ctx.handle == DRM_KERNEL_CONTEXT ) { - /* Skip kernel's context and get a new one. */ - ctx.handle = DRM(ctxbitmap_next)( dev ); - } - DRM_DEBUG( "%d\n", ctx.handle ); - if ( ctx.handle == -1 ) { - DRM_DEBUG( "Not enough free contexts.\n" ); - /* Should this return -EBUSY instead? */ - return -ENOMEM; - } - - if ( ctx.handle != DRM_KERNEL_CONTEXT ) - { - if (dev->fn_tbl.context_ctor) - dev->fn_tbl.context_ctor(dev, ctx.handle); - } - - ctx_entry = DRM(alloc)( sizeof(*ctx_entry), DRM_MEM_CTXLIST ); - if ( !ctx_entry ) { - DRM_DEBUG("out of memory\n"); - return -ENOMEM; - } - - INIT_LIST_HEAD( &ctx_entry->head ); - ctx_entry->handle = ctx.handle; - ctx_entry->tag = priv; - - down( &dev->ctxlist_sem ); - list_add( &ctx_entry->head, &dev->ctxlist->head ); - ++dev->ctx_count; - up( &dev->ctxlist_sem ); - - if ( copy_to_user( argp, &ctx, sizeof(ctx) ) ) - return -EFAULT; - return 0; -} - -int DRM(modctx)( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - /* This does nothing */ - return 0; -} - -/** - * Get context. - * - * \param inode device inode. - * \param filp file pointer. - * \param cmd command. - * \param arg user argument pointing to a drm_ctx structure. - * \return zero on success or a negative number on failure. - */ -int DRM(getctx)( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_ctx_t __user *argp = (void __user *)arg; - drm_ctx_t ctx; - - if ( copy_from_user( &ctx, argp, sizeof(ctx) ) ) - return -EFAULT; - - /* This is 0, because we don't handle any context flags */ - ctx.flags = 0; - - if ( copy_to_user( argp, &ctx, sizeof(ctx) ) ) - return -EFAULT; - return 0; -} - -/** - * Switch context. - * - * \param inode device inode. - * \param filp file pointer. - * \param cmd command. - * \param arg user argument pointing to a drm_ctx structure. - * \return zero on success or a negative number on failure. - * - * Calls context_switch(). - */ -int DRM(switchctx)( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_ctx_t ctx; - - if ( copy_from_user( &ctx, (drm_ctx_t __user *)arg, sizeof(ctx) ) ) - return -EFAULT; - - DRM_DEBUG( "%d\n", ctx.handle ); - return DRM(context_switch)( dev, dev->last_context, ctx.handle ); -} - -/** - * New context. - * - * \param inode device inode. - * \param filp file pointer. - * \param cmd command. - * \param arg user argument pointing to a drm_ctx structure. - * \return zero on success or a negative number on failure. - * - * Calls context_switch_complete(). - */ -int DRM(newctx)( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_ctx_t ctx; - - if ( copy_from_user( &ctx, (drm_ctx_t __user *)arg, sizeof(ctx) ) ) - return -EFAULT; - - DRM_DEBUG( "%d\n", ctx.handle ); - DRM(context_switch_complete)( dev, ctx.handle ); - - return 0; -} - -/** - * Remove context. - * - * \param inode device inode. - * \param filp file pointer. - * \param cmd command. - * \param arg user argument pointing to a drm_ctx structure. - * \return zero on success or a negative number on failure. - * - * If not the special kernel context, calls ctxbitmap_free() to free the specified context. - */ -int DRM(rmctx)( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_ctx_t ctx; - - if ( copy_from_user( &ctx, (drm_ctx_t __user *)arg, sizeof(ctx) ) ) - return -EFAULT; - - DRM_DEBUG( "%d\n", ctx.handle ); - if ( ctx.handle == DRM_KERNEL_CONTEXT + 1 ) { - priv->remove_auth_on_close = 1; - } - if ( ctx.handle != DRM_KERNEL_CONTEXT ) { - if (dev->fn_tbl.context_dtor) - dev->fn_tbl.context_dtor(dev, ctx.handle); - DRM(ctxbitmap_free)( dev, ctx.handle ); - } - - down( &dev->ctxlist_sem ); - if ( !list_empty( &dev->ctxlist->head ) ) { - drm_ctx_list_t *pos, *n; - - list_for_each_entry_safe( pos, n, &dev->ctxlist->head, head ) { - if ( pos->handle == ctx.handle ) { - list_del( &pos->head ); - DRM(free)( pos, sizeof(*pos), DRM_MEM_CTXLIST ); - --dev->ctx_count; - } - } - } - up( &dev->ctxlist_sem ); - - return 0; -} - -/*@}*/ - diff -Nru a/drivers/char/drm/drm_core.h b/drivers/char/drm/drm_core.h --- a/drivers/char/drm/drm_core.h 2005-01-02 23:03:33 -08:00 +++ b/drivers/char/drm/drm_core.h 2005-01-02 23:03:33 -08:00 @@ -20,21 +20,15 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ +#define DRIVER_AUTHOR "Gareth Hughes, Leif Delgass, José Fonseca, Jon Smirl" -#include "drm_auth.h" -#include "drm_agpsupport.h" -#include "drm_bufs.h" -#include "drm_context.h" -#include "drm_dma.h" -#include "drm_irq.h" -#include "drm_drawable.h" -#include "drm_drv.h" -#include "drm_fops.h" -#include "drm_init.h" -#include "drm_ioctl.h" -#include "drm_lock.h" -#include "drm_memory.h" -#include "drm_proc.h" -#include "drm_vm.h" -#include "drm_stub.h" -#include "drm_scatter.h" +#define DRIVER_NAME "drm" +#define DRIVER_DESC "DRM shared core routines" +#define DRIVER_DATE "20040925" + +#define DRM_IF_MAJOR 1 +#define DRM_IF_MINOR 2 + +#define DRIVER_MAJOR 1 +#define DRIVER_MINOR 0 +#define DRIVER_PATCHLEVEL 0 diff -Nru a/drivers/char/drm/drm_dma.c b/drivers/char/drm/drm_dma.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/char/drm/drm_dma.c 2005-01-02 23:03:34 -08:00 @@ -0,0 +1,180 @@ +/** + * \file drm_dma.h + * DMA IOCTL and function support + * + * \author Rickard E. (Rik) Faith + * \author Gareth Hughes + */ + +/* + * Created: Fri Mar 19 14:30:16 1999 by faith@valinux.com + * + * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "drmP.h" + +/** + * Initialize the DMA data. + * + * \param dev DRM device. + * \return zero on success or a negative value on failure. + * + * Allocate and initialize a drm_device_dma structure. + */ +int drm_dma_setup( drm_device_t *dev ) +{ + int i; + + dev->dma = drm_alloc( sizeof(*dev->dma), DRM_MEM_DRIVER ); + if ( !dev->dma ) + return -ENOMEM; + + memset( dev->dma, 0, sizeof(*dev->dma) ); + + for ( i = 0 ; i <= DRM_MAX_ORDER ; i++ ) + memset(&dev->dma->bufs[i], 0, sizeof(dev->dma->bufs[0])); + + return 0; +} + +/** + * Cleanup the DMA resources. + * + * \param dev DRM device. + * + * Free all pages associated with DMA buffers, the buffers and pages lists, and + * finally the the drm_device::dma structure itself. + */ +void drm_dma_takedown(drm_device_t *dev) +{ + drm_device_dma_t *dma = dev->dma; + int i, j; + + if (!dma) return; + + /* Clear dma buffers */ + for (i = 0; i <= DRM_MAX_ORDER; i++) { + if (dma->bufs[i].seg_count) { + DRM_DEBUG("order %d: buf_count = %d," + " seg_count = %d\n", + i, + dma->bufs[i].buf_count, + dma->bufs[i].seg_count); + for (j = 0; j < dma->bufs[i].seg_count; j++) { + if (dma->bufs[i].seglist[j]) { + drm_free_pages(dma->bufs[i].seglist[j], + dma->bufs[i].page_order, + DRM_MEM_DMA); + } + } + drm_free(dma->bufs[i].seglist, + dma->bufs[i].seg_count + * sizeof(*dma->bufs[0].seglist), + DRM_MEM_SEGS); + } + if (dma->bufs[i].buf_count) { + for (j = 0; j < dma->bufs[i].buf_count; j++) { + if (dma->bufs[i].buflist[j].dev_private) { + drm_free(dma->bufs[i].buflist[j].dev_private, + dma->bufs[i].buflist[j].dev_priv_size, + DRM_MEM_BUFS); + } + } + drm_free(dma->bufs[i].buflist, + dma->bufs[i].buf_count * + sizeof(*dma->bufs[0].buflist), + DRM_MEM_BUFS); + } + } + + if (dma->buflist) { + drm_free(dma->buflist, + dma->buf_count * sizeof(*dma->buflist), + DRM_MEM_BUFS); + } + + if (dma->pagelist) { + drm_free(dma->pagelist, + dma->page_count * sizeof(*dma->pagelist), + DRM_MEM_PAGES); + } + drm_free(dev->dma, sizeof(*dev->dma), DRM_MEM_DRIVER); + dev->dma = NULL; +} + + +/** + * Free a buffer. + * + * \param dev DRM device. + * \param buf buffer to free. + * + * Resets the fields of \p buf. + */ +void drm_free_buffer(drm_device_t *dev, drm_buf_t *buf) +{ + if (!buf) return; + + buf->waiting = 0; + buf->pending = 0; + buf->filp = NULL; + buf->used = 0; + + if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE) && waitqueue_active(&buf->dma_wait)) { + wake_up_interruptible(&buf->dma_wait); + } +} + +/** + * Reclaim the buffers. + * + * \param filp file pointer. + * + * Frees each buffer associated with \p filp not already on the hardware. + */ +void drm_core_reclaim_buffers(drm_device_t *dev, struct file *filp) +{ + drm_device_dma_t *dma = dev->dma; + int i; + + if (!dma) return; + for (i = 0; i < dma->buf_count; i++) { + if (dma->buflist[i]->filp == filp) { + switch (dma->buflist[i]->list) { + case DRM_LIST_NONE: + drm_free_buffer(dev, dma->buflist[i]); + break; + case DRM_LIST_WAIT: + dma->buflist[i]->list = DRM_LIST_RECLAIM; + break; + default: + /* Buffer already on hardware. */ + break; + } + } + } +} +EXPORT_SYMBOL(drm_core_reclaim_buffers); + diff -Nru a/drivers/char/drm/drm_dma.h b/drivers/char/drm/drm_dma.h --- a/drivers/char/drm/drm_dma.h 2005-01-02 23:03:34 -08:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,181 +0,0 @@ -/** - * \file drm_dma.h - * DMA IOCTL and function support - * - * \author Rickard E. (Rik) Faith - * \author Gareth Hughes - */ - -/* - * Created: Fri Mar 19 14:30:16 1999 by faith@valinux.com - * - * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -#include "drmP.h" - -/** - * Initialize the DMA data. - * - * \param dev DRM device. - * \return zero on success or a negative value on failure. - * - * Allocate and initialize a drm_device_dma structure. - */ -int DRM(dma_setup)( drm_device_t *dev ) -{ - int i; - - dev->dma = DRM(alloc)( sizeof(*dev->dma), DRM_MEM_DRIVER ); - if ( !dev->dma ) - return -ENOMEM; - - memset( dev->dma, 0, sizeof(*dev->dma) ); - - for ( i = 0 ; i <= DRM_MAX_ORDER ; i++ ) - memset(&dev->dma->bufs[i], 0, sizeof(dev->dma->bufs[0])); - - return 0; -} - -/** - * Cleanup the DMA resources. - * - * \param dev DRM device. - * - * Free all pages associated with DMA buffers, the buffers and pages lists, and - * finally the the drm_device::dma structure itself. - */ -void DRM(dma_takedown)(drm_device_t *dev) -{ - drm_device_dma_t *dma = dev->dma; - int i, j; - - if (!dma) return; - - /* Clear dma buffers */ - for (i = 0; i <= DRM_MAX_ORDER; i++) { - if (dma->bufs[i].seg_count) { - DRM_DEBUG("order %d: buf_count = %d," - " seg_count = %d\n", - i, - dma->bufs[i].buf_count, - dma->bufs[i].seg_count); - for (j = 0; j < dma->bufs[i].seg_count; j++) { - if (dma->bufs[i].seglist[j]) { - DRM(free_pages)(dma->bufs[i].seglist[j], - dma->bufs[i].page_order, - DRM_MEM_DMA); - } - } - DRM(free)(dma->bufs[i].seglist, - dma->bufs[i].seg_count - * sizeof(*dma->bufs[0].seglist), - DRM_MEM_SEGS); - } - if (dma->bufs[i].buf_count) { - for (j = 0; j < dma->bufs[i].buf_count; j++) { - if (dma->bufs[i].buflist[j].dev_private) { - DRM(free)(dma->bufs[i].buflist[j].dev_private, - dma->bufs[i].buflist[j].dev_priv_size, - DRM_MEM_BUFS); - } - } - DRM(free)(dma->bufs[i].buflist, - dma->bufs[i].buf_count * - sizeof(*dma->bufs[0].buflist), - DRM_MEM_BUFS); - } - } - - if (dma->buflist) { - DRM(free)(dma->buflist, - dma->buf_count * sizeof(*dma->buflist), - DRM_MEM_BUFS); - } - - if (dma->pagelist) { - DRM(free)(dma->pagelist, - dma->page_count * sizeof(*dma->pagelist), - DRM_MEM_PAGES); - } - DRM(free)(dev->dma, sizeof(*dev->dma), DRM_MEM_DRIVER); - dev->dma = NULL; -} - - -/** - * Free a buffer. - * - * \param dev DRM device. - * \param buf buffer to free. - * - * Resets the fields of \p buf. - */ -void DRM(free_buffer)(drm_device_t *dev, drm_buf_t *buf) -{ - if (!buf) return; - - buf->waiting = 0; - buf->pending = 0; - buf->filp = NULL; - buf->used = 0; - - if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE) && waitqueue_active(&buf->dma_wait)) { - wake_up_interruptible(&buf->dma_wait); - } -} - -/** - * Reclaim the buffers. - * - * \param filp file pointer. - * - * Frees each buffer associated with \p filp not already on the hardware. - */ -void DRM(core_reclaim_buffers)( struct file *filp ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_device_dma_t *dma = dev->dma; - int i; - - if (!dma) return; - for (i = 0; i < dma->buf_count; i++) { - if (dma->buflist[i]->filp == filp) { - switch (dma->buflist[i]->list) { - case DRM_LIST_NONE: - DRM(free_buffer)(dev, dma->buflist[i]); - break; - case DRM_LIST_WAIT: - dma->buflist[i]->list = DRM_LIST_RECLAIM; - break; - default: - /* Buffer already on hardware. */ - break; - } - } - } -} - diff -Nru a/drivers/char/drm/drm_drawable.c b/drivers/char/drm/drm_drawable.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/char/drm/drm_drawable.c 2005-01-02 23:03:35 -08:00 @@ -0,0 +1,56 @@ +/** + * \file drm_drawable.h + * IOCTLs for drawables + * + * \author Rickard E. (Rik) Faith + * \author Gareth Hughes + */ + +/* + * Created: Tue Feb 2 08:37:54 1999 by faith@valinux.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "drmP.h" + +/** No-op. */ +int drm_adddraw(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_draw_t draw; + + draw.handle = 0; /* NOOP */ + DRM_DEBUG("%d\n", draw.handle); + if (copy_to_user((drm_draw_t __user *)arg, &draw, sizeof(draw))) + return -EFAULT; + return 0; +} + +/** No-op. */ +int drm_rmdraw(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + return 0; /* NOOP */ +} diff -Nru a/drivers/char/drm/drm_drawable.h b/drivers/char/drm/drm_drawable.h --- a/drivers/char/drm/drm_drawable.h 2005-01-02 23:03:35 -08:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,56 +0,0 @@ -/** - * \file drm_drawable.h - * IOCTLs for drawables - * - * \author Rickard E. (Rik) Faith - * \author Gareth Hughes - */ - -/* - * Created: Tue Feb 2 08:37:54 1999 by faith@valinux.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -#include "drmP.h" - -/** No-op. */ -int DRM(adddraw)(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) -{ - drm_draw_t draw; - - draw.handle = 0; /* NOOP */ - DRM_DEBUG("%d\n", draw.handle); - if (copy_to_user((drm_draw_t __user *)arg, &draw, sizeof(draw))) - return -EFAULT; - return 0; -} - -/** No-op. */ -int DRM(rmdraw)(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) -{ - return 0; /* NOOP */ -} diff -Nru a/drivers/char/drm/drm_drv.c b/drivers/char/drm/drm_drv.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/char/drm/drm_drv.c 2005-01-02 23:03:34 -08:00 @@ -0,0 +1,545 @@ +/** + * \file drm_drv.h + * Generic driver template + * + * \author Rickard E. (Rik) Faith + * \author Gareth Hughes + * + * To use this template, you must at least define the following (samples + * given for the MGA driver): + * + * \code + * #define DRIVER_AUTHOR "VA Linux Systems, Inc." + * + * #define DRIVER_NAME "mga" + * #define DRIVER_DESC "Matrox G200/G400" + * #define DRIVER_DATE "20001127" + * + * #define DRIVER_MAJOR 2 + * #define DRIVER_MINOR 0 + * #define DRIVER_PATCHLEVEL 2 + * + * #define DRIVER_IOCTL_COUNT DRM_ARRAY_SIZE( mga_ioctls ) + * + * #define drm_x mga_##x + * \endcode + */ + +/* + * Created: Thu Nov 23 03:10:50 2000 by gareth@valinux.com + * + * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "drmP.h" +#include "drm_core.h" + +/** Ioctl table */ +drm_ioctl_desc_t drm_ioctls[] = { + [DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = { drm_version, 0, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_GET_UNIQUE)] = { drm_getunique, 0, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_GET_MAGIC)] = { drm_getmagic, 0, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_IRQ_BUSID)] = { drm_irq_by_busid, 0, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_GET_MAP)] = { drm_getmap, 0, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_GET_CLIENT)] = { drm_getclient, 0, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_GET_STATS)] = { drm_getstats, 0, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_SET_VERSION)] = { drm_setversion, 0, 1 }, + + [DRM_IOCTL_NR(DRM_IOCTL_SET_UNIQUE)] = { drm_setunique, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_BLOCK)] = { drm_noop, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_UNBLOCK)] = { drm_noop, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_AUTH_MAGIC)] = { drm_authmagic, 1, 1 }, + + [DRM_IOCTL_NR(DRM_IOCTL_ADD_MAP)] = { drm_addmap, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_RM_MAP)] = { drm_rmmap, 1, 0 }, + + [DRM_IOCTL_NR(DRM_IOCTL_SET_SAREA_CTX)] = { drm_setsareactx, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_GET_SAREA_CTX)] = { drm_getsareactx, 1, 0 }, + + [DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)] = { drm_addctx, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)] = { drm_rmctx, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)] = { drm_modctx, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)] = { drm_getctx, 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_SWITCH_CTX)] = { drm_switchctx, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_NEW_CTX)] = { drm_newctx, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_RES_CTX)] = { drm_resctx, 1, 0 }, + + [DRM_IOCTL_NR(DRM_IOCTL_ADD_DRAW)] = { drm_adddraw, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_RM_DRAW)] = { drm_rmdraw, 1, 1 }, + + [DRM_IOCTL_NR(DRM_IOCTL_LOCK)] = { drm_lock, 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { drm_unlock, 1, 0 }, + + [DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { drm_noop, 1, 0 }, + + [DRM_IOCTL_NR(DRM_IOCTL_ADD_BUFS)] = { drm_addbufs, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_MARK_BUFS)] = { drm_markbufs, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_INFO_BUFS)] = { drm_infobufs, 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_MAP_BUFS)] = { drm_mapbufs, 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_FREE_BUFS)] = { drm_freebufs, 1, 0 }, + /* The DRM_IOCTL_DMA ioctl should be defined by the driver. */ + + [DRM_IOCTL_NR(DRM_IOCTL_CONTROL)] = { drm_control, 1, 1 }, + +#if __OS_HAS_AGP + [DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = { drm_agp_acquire, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_RELEASE)] = { drm_agp_release, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)] = { drm_agp_enable, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_INFO)] = { drm_agp_info, 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_ALLOC)] = { drm_agp_alloc, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_FREE)] = { drm_agp_free, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_BIND)] = { drm_agp_bind, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_UNBIND)] = { drm_agp_unbind, 1, 1 }, +#endif + + [DRM_IOCTL_NR(DRM_IOCTL_SG_ALLOC)] = { drm_sg_alloc, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_SG_FREE)] = { drm_sg_free, 1, 1 }, + + [DRM_IOCTL_NR(DRM_IOCTL_WAIT_VBLANK)] = { drm_wait_vblank, 0, 0 }, +}; + +#define DRIVER_IOCTL_COUNT DRM_ARRAY_SIZE( drm_ioctls ) + +/** + * Take down the DRM device. + * + * \param dev DRM device structure. + * + * Frees every resource in \p dev. + * + * \sa drm_device and setup(). + */ +int drm_takedown( drm_device_t *dev ) +{ + drm_magic_entry_t *pt, *next; + drm_map_t *map; + drm_map_list_t *r_list; + struct list_head *list, *list_next; + drm_vma_entry_t *vma, *vma_next; + int i; + + DRM_DEBUG( "\n" ); + + if (dev->driver->pretakedown) + dev->driver->pretakedown(dev); + + if ( dev->irq_enabled ) drm_irq_uninstall( dev ); + + down( &dev->struct_sem ); + del_timer( &dev->timer ); + + if ( dev->devname ) { + drm_free( dev->devname, strlen( dev->devname ) + 1, + DRM_MEM_DRIVER ); + dev->devname = NULL; + } + + if ( dev->unique ) { + drm_free( dev->unique, strlen( dev->unique ) + 1, + DRM_MEM_DRIVER ); + dev->unique = NULL; + dev->unique_len = 0; + } + /* Clear pid list */ + for ( i = 0 ; i < DRM_HASH_SIZE ; i++ ) { + for ( pt = dev->magiclist[i].head ; pt ; pt = next ) { + next = pt->next; + drm_free( pt, sizeof(*pt), DRM_MEM_MAGIC ); + } + dev->magiclist[i].head = dev->magiclist[i].tail = NULL; + } + + /* Clear AGP information */ + if (drm_core_has_AGP(dev) && dev->agp) { + drm_agp_mem_t *entry; + drm_agp_mem_t *nexte; + + /* Remove AGP resources, but leave dev->agp + intact until drv_cleanup is called. */ + for ( entry = dev->agp->memory ; entry ; entry = nexte ) { + nexte = entry->next; + if ( entry->bound ) drm_unbind_agp( entry->memory ); + drm_free_agp( entry->memory, entry->pages ); + drm_free( entry, sizeof(*entry), DRM_MEM_AGPLISTS ); + } + dev->agp->memory = NULL; + + if ( dev->agp->acquired ) drm_agp_do_release(); + + dev->agp->acquired = 0; + dev->agp->enabled = 0; + } + + /* Clear vma list (only built for debugging) */ + if ( dev->vmalist ) { + for ( vma = dev->vmalist ; vma ; vma = vma_next ) { + vma_next = vma->next; + drm_free( vma, sizeof(*vma), DRM_MEM_VMAS ); + } + dev->vmalist = NULL; + } + + if( dev->maplist ) { + list_for_each_safe( list, list_next, &dev->maplist->head ) { + r_list = (drm_map_list_t *)list; + + if ( ( map = r_list->map ) ) { + switch ( map->type ) { + case _DRM_REGISTERS: + case _DRM_FRAME_BUFFER: + if (drm_core_has_MTRR(dev)) { + if ( map->mtrr >= 0 ) { + int retcode; + retcode = mtrr_del( map->mtrr, + map->offset, + map->size ); + DRM_DEBUG( "mtrr_del=%d\n", retcode ); + } + } + drm_ioremapfree( map->handle, map->size, dev ); + break; + case _DRM_SHM: + vfree(map->handle); + break; + + case _DRM_AGP: + /* Do nothing here, because this is all + * handled in the AGP/GART driver. + */ + break; + case _DRM_SCATTER_GATHER: + /* Handle it */ + if (drm_core_check_feature(dev, DRIVER_SG) && dev->sg) { + drm_sg_cleanup(dev->sg); + dev->sg = NULL; + } + break; + } + drm_free(map, sizeof(*map), DRM_MEM_MAPS); + } + list_del( list ); + drm_free(r_list, sizeof(*r_list), DRM_MEM_MAPS); + } + drm_free(dev->maplist, sizeof(*dev->maplist), DRM_MEM_MAPS); + dev->maplist = NULL; + } + + if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE) && dev->queuelist ) { + for ( i = 0 ; i < dev->queue_count ; i++ ) { + if ( dev->queuelist[i] ) { + drm_free( dev->queuelist[i], + sizeof(*dev->queuelist[0]), + DRM_MEM_QUEUES ); + dev->queuelist[i] = NULL; + } + } + drm_free( dev->queuelist, + dev->queue_slots * sizeof(*dev->queuelist), + DRM_MEM_QUEUES ); + dev->queuelist = NULL; + } + dev->queue_count = 0; + + if (drm_core_check_feature(dev, DRIVER_HAVE_DMA)) + drm_dma_takedown( dev ); + + if ( dev->lock.hw_lock ) { + dev->sigdata.lock = dev->lock.hw_lock = NULL; /* SHM removed */ + dev->lock.filp = NULL; + wake_up_interruptible( &dev->lock.lock_queue ); + } + up( &dev->struct_sem ); + + return 0; +} + + + +/** + * Module initialization. Called via init_module at module load time, or via + * linux/init/main.c (this is not currently supported). + * + * \return zero on success or a negative number on failure. + * + * Initializes an array of drm_device structures, and attempts to + * initialize all available devices, using consecutive minors, registering the + * stubs and initializing the AGP device. + * + * Expands the \c DRIVER_PREINIT and \c DRIVER_POST_INIT macros before and + * after the initialization for driver customization. + */ +int drm_init( struct drm_driver *driver ) +{ + struct pci_dev *pdev = NULL; + struct pci_device_id *pid; + int i; + + DRM_DEBUG( "\n" ); + + drm_mem_init(); + + for (i=0; driver->pci_driver.id_table[i].vendor != 0; i++) { + pid = (struct pci_device_id *)&driver->pci_driver.id_table[i]; + + pdev=NULL; + /* pass back in pdev to account for multiple identical cards */ + while ((pdev = pci_get_subsys(pid->vendor, pid->device, pid->subvendor, pid->subdevice, pdev)) != NULL) { + /* stealth mode requires a manual probe */ + pci_dev_get(pdev); + drm_probe(pdev, pid, driver); + } + } + return 0; +} +EXPORT_SYMBOL(drm_init); + +/** + * Called via cleanup_module() at module unload time. + * + * Cleans up all DRM device, calling takedown(). + * + * \sa drm_init(). + */ +static void drm_cleanup( drm_device_t *dev ) +{ + DRM_DEBUG( "\n" ); + + if (!dev) { + DRM_ERROR("cleanup called no dev\n"); + return; + } + + drm_takedown( dev ); + + drm_ctxbitmap_cleanup( dev ); + + if (drm_core_has_MTRR(dev) && drm_core_has_AGP(dev) && + dev->agp && dev->agp->agp_mtrr >= 0) { + int retval; + retval = mtrr_del( dev->agp->agp_mtrr, + dev->agp->agp_info.aper_base, + dev->agp->agp_info.aper_size*1024*1024 ); + DRM_DEBUG( "mtrr_del=%d\n", retval ); + } + + if (drm_core_has_AGP(dev) && dev->agp ) { + drm_free( dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS ); + dev->agp = NULL; + } + + if (dev->driver->postcleanup) + dev->driver->postcleanup(dev); + + if ( drm_put_minor(dev) ) + DRM_ERROR( "Cannot unload module\n" ); +} + +void drm_exit (struct drm_driver *driver) +{ + int i; + drm_device_t *dev = NULL; + drm_minor_t *minor; + + DRM_DEBUG( "\n" ); + + for (i = 0; i < drm_cards_limit; i++) { + minor = &drm_minors[i]; + if (!minor->dev) + continue; + if (minor->dev->driver!=driver) + continue; + + dev = minor->dev; + + } + if (dev) { + /* release the pci driver */ + if (dev->pdev) + pci_dev_put(dev->pdev); + drm_cleanup(dev); + } + + DRM_INFO( "Module unloaded\n" ); +} +EXPORT_SYMBOL(drm_exit); + +/** File operations structure */ +static struct file_operations drm_stub_fops = { + .owner = THIS_MODULE, + .open = drm_stub_open +}; + +static int __init drm_core_init(void) +{ + int ret = -ENOMEM; + + drm_cards_limit = (drm_cards_limit < DRM_MAX_MINOR + 1 ? drm_cards_limit : DRM_MAX_MINOR + 1); + drm_minors = drm_calloc(drm_cards_limit, + sizeof(*drm_minors), DRM_MEM_STUB); + if(!drm_minors) + goto err_p1; + + if (register_chrdev(DRM_MAJOR, "drm", &drm_stub_fops)) + goto err_p1; + + drm_class = class_simple_create(THIS_MODULE, "drm"); + if (IS_ERR(drm_class)) { + printk (KERN_ERR "DRM: Error creating drm class.\n"); + ret = PTR_ERR(drm_class); + goto err_p2; + } + + drm_proc_root = create_proc_entry("dri", S_IFDIR, NULL); + if (!drm_proc_root) { + DRM_ERROR("Cannot create /proc/dri\n"); + ret = -1; + goto err_p3; + } + + DRM_INFO( "Initialized %s %d.%d.%d %s\n", + DRIVER_NAME, + DRIVER_MAJOR, + DRIVER_MINOR, + DRIVER_PATCHLEVEL, + DRIVER_DATE + ); + return 0; +err_p3: + class_simple_destroy(drm_class); +err_p2: + unregister_chrdev(DRM_MAJOR, "drm"); + drm_free(drm_minors, sizeof(*drm_minors) * drm_cards_limit, DRM_MEM_STUB); +err_p1: + return ret; +} + +static void __exit drm_core_exit (void) +{ + remove_proc_entry("dri", NULL); + class_simple_destroy(drm_class); + + unregister_chrdev(DRM_MAJOR, "drm"); + + drm_free(drm_minors, sizeof(*drm_minors) * + drm_cards_limit, DRM_MEM_STUB); +} + + +module_init( drm_core_init ); +module_exit( drm_core_exit ); + + +/** + * Get version information + * + * \param inode device inode. + * \param filp file pointer. + * \param cmd command. + * \param arg user argument, pointing to a drm_version structure. + * \return zero on success or negative number on failure. + * + * Fills in the version information in \p arg. + */ +int drm_version( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_version_t __user *argp = (void __user *)arg; + drm_version_t version; + int ret; + + if ( copy_from_user( &version, argp, sizeof(version) ) ) + return -EFAULT; + + /* version is a required function to return the personality module version */ + if ((ret = dev->driver->version(&version))) + return ret; + + if ( copy_to_user( argp, &version, sizeof(version) ) ) + return -EFAULT; + return 0; +} + + + +/** + * Called whenever a process performs an ioctl on /dev/drm. + * + * \param inode device inode. + * \param filp file pointer. + * \param cmd command. + * \param arg user argument. + * \return zero on success or negative number on failure. + * + * Looks up the ioctl function in the ::ioctls table, checking for root + * previleges if so required, and dispatches to the respective function. + */ +int drm_ioctl( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_ioctl_desc_t *ioctl; + drm_ioctl_t *func; + unsigned int nr = DRM_IOCTL_NR(cmd); + int retcode = -EINVAL; + + atomic_inc( &dev->ioctl_count ); + atomic_inc( &dev->counts[_DRM_STAT_IOCTLS] ); + ++priv->ioctl_count; + + DRM_DEBUG( "pid=%d, cmd=0x%02x, nr=0x%02x, dev 0x%lx, auth=%d\n", + current->pid, cmd, nr, (long)old_encode_dev(dev->device), + priv->authenticated ); + + if (nr < DRIVER_IOCTL_COUNT) + ioctl = &drm_ioctls[nr]; + else if ((nr >= DRM_COMMAND_BASE) || (nr < DRM_COMMAND_BASE + dev->driver->num_ioctls)) + ioctl = &dev->driver->ioctls[nr - DRM_COMMAND_BASE]; + else + goto err_i1; + + func = ioctl->func; + /* is there a local override? */ + if ((nr == DRM_IOCTL_NR(DRM_IOCTL_DMA)) && dev->driver->dma_ioctl) + func = dev->driver->dma_ioctl; + + if ( !func ) { + DRM_DEBUG( "no function\n" ); + retcode = -EINVAL; + } else if ( ( ioctl->root_only && !capable( CAP_SYS_ADMIN ) )|| + ( ioctl->auth_needed && !priv->authenticated ) ) { + retcode = -EACCES; + } else { + retcode = func( inode, filp, cmd, arg ); + } + +err_i1: + atomic_dec( &dev->ioctl_count ); + if (retcode) DRM_DEBUG( "ret = %x\n", retcode); + return retcode; +} +EXPORT_SYMBOL(drm_ioctl); + diff -Nru a/drivers/char/drm/drm_drv.h b/drivers/char/drm/drm_drv.h --- a/drivers/char/drm/drm_drv.h 2005-01-02 23:03:34 -08:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,1060 +0,0 @@ -/** - * \file drm_drv.h - * Generic driver template - * - * \author Rickard E. (Rik) Faith - * \author Gareth Hughes - * - * To use this template, you must at least define the following (samples - * given for the MGA driver): - * - * \code - * #define DRIVER_AUTHOR "VA Linux Systems, Inc." - * - * #define DRIVER_NAME "mga" - * #define DRIVER_DESC "Matrox G200/G400" - * #define DRIVER_DATE "20001127" - * - * #define DRIVER_MAJOR 2 - * #define DRIVER_MINOR 0 - * #define DRIVER_PATCHLEVEL 2 - * - * #define DRIVER_IOCTL_COUNT DRM_ARRAY_SIZE( mga_ioctls ) - * - * #define DRM(x) mga_##x - * \endcode - */ - -/* - * Created: Thu Nov 23 03:10:50 2000 by gareth@valinux.com - * - * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef DRIVER_IOCTLS -#define DRIVER_IOCTLS -#endif - -#ifndef MODULE -/** Use an additional macro to avoid preprocessor troubles */ -#define DRM_OPTIONS_FUNC DRM(options) -/** - * Called by the kernel to parse command-line options passed via the - * boot-loader (e.g., LILO). It calls the insmod option routine, - * parse_options(). - */ -static int __init DRM(options)( char *str ) -{ - DRM(parse_options)( str ); - return 1; -} - -__setup( DRIVER_NAME "=", DRM_OPTIONS_FUNC ); -#undef DRM_OPTIONS_FUNC -#endif - -#define MAX_DEVICES 4 -static drm_device_t DRM(device)[MAX_DEVICES]; -static int DRM(numdevs) = 0; - -struct file_operations DRM(fops) = { - .owner = THIS_MODULE, - .open = DRM(open), - .flush = DRM(flush), - .release = DRM(release), - .ioctl = DRM(ioctl), - .mmap = DRM(mmap), - .fasync = DRM(fasync), - .poll = DRM(poll), - .read = DRM(read), -}; - -/** Ioctl table */ -drm_ioctl_desc_t DRM(ioctls)[] = { - [DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = { DRM(version), 0, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_GET_UNIQUE)] = { DRM(getunique), 0, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_GET_MAGIC)] = { DRM(getmagic), 0, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_IRQ_BUSID)] = { DRM(irq_by_busid), 0, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_GET_MAP)] = { DRM(getmap), 0, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_GET_CLIENT)] = { DRM(getclient), 0, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_GET_STATS)] = { DRM(getstats), 0, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_SET_VERSION)] = { DRM(setversion), 0, 1 }, - - [DRM_IOCTL_NR(DRM_IOCTL_SET_UNIQUE)] = { DRM(setunique), 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_BLOCK)] = { DRM(noop), 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_UNBLOCK)] = { DRM(noop), 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AUTH_MAGIC)] = { DRM(authmagic), 1, 1 }, - - [DRM_IOCTL_NR(DRM_IOCTL_ADD_MAP)] = { DRM(addmap), 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RM_MAP)] = { DRM(rmmap), 1, 0 }, - - [DRM_IOCTL_NR(DRM_IOCTL_SET_SAREA_CTX)] = { DRM(setsareactx), 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_GET_SAREA_CTX)] = { DRM(getsareactx), 1, 0 }, - - [DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)] = { DRM(addctx), 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)] = { DRM(rmctx), 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)] = { DRM(modctx), 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)] = { DRM(getctx), 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_SWITCH_CTX)] = { DRM(switchctx), 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_NEW_CTX)] = { DRM(newctx), 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RES_CTX)] = { DRM(resctx), 1, 0 }, - - [DRM_IOCTL_NR(DRM_IOCTL_ADD_DRAW)] = { DRM(adddraw), 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RM_DRAW)] = { DRM(rmdraw), 1, 1 }, - - [DRM_IOCTL_NR(DRM_IOCTL_LOCK)] = { DRM(lock), 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { DRM(unlock), 1, 0 }, - - [DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { DRM(noop), 1, 0 }, - - [DRM_IOCTL_NR(DRM_IOCTL_ADD_BUFS)] = { DRM(addbufs), 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_MARK_BUFS)] = { DRM(markbufs), 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_INFO_BUFS)] = { DRM(infobufs), 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_MAP_BUFS)] = { DRM(mapbufs), 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_FREE_BUFS)] = { DRM(freebufs), 1, 0 }, - /* The DRM_IOCTL_DMA ioctl should be defined by the driver. */ - - [DRM_IOCTL_NR(DRM_IOCTL_CONTROL)] = { DRM(control), 1, 1 }, - -#if __OS_HAS_AGP - [DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = { DRM(agp_acquire), 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_RELEASE)] = { DRM(agp_release), 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)] = { DRM(agp_enable), 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_INFO)] = { DRM(agp_info), 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_ALLOC)] = { DRM(agp_alloc), 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_FREE)] = { DRM(agp_free), 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_BIND)] = { DRM(agp_bind), 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_UNBIND)] = { DRM(agp_unbind), 1, 1 }, -#endif - - [DRM_IOCTL_NR(DRM_IOCTL_SG_ALLOC)] = { DRM(sg_alloc), 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_SG_FREE)] = { DRM(sg_free), 1, 1 }, - - [DRM_IOCTL_NR(DRM_IOCTL_WAIT_VBLANK)] = { DRM(wait_vblank), 0, 0 }, - - DRIVER_IOCTLS -}; - -#define DRIVER_IOCTL_COUNT DRM_ARRAY_SIZE( DRM(ioctls) ) - -#ifdef MODULE -static char *drm_opts = NULL; -#endif - -MODULE_AUTHOR( DRIVER_AUTHOR ); -MODULE_DESCRIPTION( DRIVER_DESC ); -MODULE_PARM( drm_opts, "s" ); -MODULE_LICENSE("GPL and additional rights"); - -static int DRM(setup)( drm_device_t *dev ) -{ - int i; - int ret; - - if (dev->fn_tbl.presetup) - { - ret=dev->fn_tbl.presetup(dev); - if (ret!=0) - return ret; - } - - atomic_set( &dev->ioctl_count, 0 ); - atomic_set( &dev->vma_count, 0 ); - dev->buf_use = 0; - atomic_set( &dev->buf_alloc, 0 ); - - if (drm_core_check_feature(dev, DRIVER_HAVE_DMA)) - { - i = DRM(dma_setup)( dev ); - if ( i < 0 ) - return i; - } - - for ( i = 0 ; i < DRM_ARRAY_SIZE(dev->counts) ; i++ ) - atomic_set( &dev->counts[i], 0 ); - - for ( i = 0 ; i < DRM_HASH_SIZE ; i++ ) { - dev->magiclist[i].head = NULL; - dev->magiclist[i].tail = NULL; - } - - dev->maplist = DRM(alloc)(sizeof(*dev->maplist), - DRM_MEM_MAPS); - if(dev->maplist == NULL) return -ENOMEM; - memset(dev->maplist, 0, sizeof(*dev->maplist)); - INIT_LIST_HEAD(&dev->maplist->head); - - dev->ctxlist = DRM(alloc)(sizeof(*dev->ctxlist), - DRM_MEM_CTXLIST); - if(dev->ctxlist == NULL) return -ENOMEM; - memset(dev->ctxlist, 0, sizeof(*dev->ctxlist)); - INIT_LIST_HEAD(&dev->ctxlist->head); - - dev->vmalist = NULL; - dev->sigdata.lock = dev->lock.hw_lock = NULL; - init_waitqueue_head( &dev->lock.lock_queue ); - dev->queue_count = 0; - dev->queue_reserved = 0; - dev->queue_slots = 0; - dev->queuelist = NULL; - dev->irq_enabled = 0; - dev->context_flag = 0; - dev->interrupt_flag = 0; - dev->dma_flag = 0; - dev->last_context = 0; - dev->last_switch = 0; - dev->last_checked = 0; - init_waitqueue_head( &dev->context_wait ); - dev->if_version = 0; - - dev->ctx_start = 0; - dev->lck_start = 0; - - dev->buf_rp = dev->buf; - dev->buf_wp = dev->buf; - dev->buf_end = dev->buf + DRM_BSZ; - dev->buf_async = NULL; - init_waitqueue_head( &dev->buf_readers ); - init_waitqueue_head( &dev->buf_writers ); - - DRM_DEBUG( "\n" ); - - /* - * The kernel's context could be created here, but is now created - * in drm_dma_enqueue. This is more resource-efficient for - * hardware that does not do DMA, but may mean that - * drm_select_queue fails between the time the interrupt is - * initialized and the time the queues are initialized. - */ - if (dev->fn_tbl.postsetup) - dev->fn_tbl.postsetup(dev); - - return 0; -} - - -/** - * Take down the DRM device. - * - * \param dev DRM device structure. - * - * Frees every resource in \p dev. - * - * \sa drm_device and setup(). - */ -static int DRM(takedown)( drm_device_t *dev ) -{ - drm_magic_entry_t *pt, *next; - drm_map_t *map; - drm_map_list_t *r_list; - struct list_head *list, *list_next; - drm_vma_entry_t *vma, *vma_next; - int i; - - DRM_DEBUG( "\n" ); - - if (dev->fn_tbl.pretakedown) - dev->fn_tbl.pretakedown(dev); - - if ( dev->irq_enabled ) DRM(irq_uninstall)( dev ); - - down( &dev->struct_sem ); - del_timer( &dev->timer ); - - if ( dev->devname ) { - DRM(free)( dev->devname, strlen( dev->devname ) + 1, - DRM_MEM_DRIVER ); - dev->devname = NULL; - } - - if ( dev->unique ) { - DRM(free)( dev->unique, strlen( dev->unique ) + 1, - DRM_MEM_DRIVER ); - dev->unique = NULL; - dev->unique_len = 0; - } - /* Clear pid list */ - for ( i = 0 ; i < DRM_HASH_SIZE ; i++ ) { - for ( pt = dev->magiclist[i].head ; pt ; pt = next ) { - next = pt->next; - DRM(free)( pt, sizeof(*pt), DRM_MEM_MAGIC ); - } - dev->magiclist[i].head = dev->magiclist[i].tail = NULL; - } - - /* Clear AGP information */ - if (drm_core_has_AGP(dev) && dev->agp) { - drm_agp_mem_t *entry; - drm_agp_mem_t *nexte; - - /* Remove AGP resources, but leave dev->agp - intact until drv_cleanup is called. */ - for ( entry = dev->agp->memory ; entry ; entry = nexte ) { - nexte = entry->next; - if ( entry->bound ) DRM(unbind_agp)( entry->memory ); - DRM(free_agp)( entry->memory, entry->pages ); - DRM(free)( entry, sizeof(*entry), DRM_MEM_AGPLISTS ); - } - dev->agp->memory = NULL; - - if ( dev->agp->acquired ) DRM(agp_do_release)(); - - dev->agp->acquired = 0; - dev->agp->enabled = 0; - } - - /* Clear vma list (only built for debugging) */ - if ( dev->vmalist ) { - for ( vma = dev->vmalist ; vma ; vma = vma_next ) { - vma_next = vma->next; - DRM(free)( vma, sizeof(*vma), DRM_MEM_VMAS ); - } - dev->vmalist = NULL; - } - - if( dev->maplist ) { - list_for_each_safe( list, list_next, &dev->maplist->head ) { - r_list = (drm_map_list_t *)list; - - if ( ( map = r_list->map ) ) { - switch ( map->type ) { - case _DRM_REGISTERS: - case _DRM_FRAME_BUFFER: - if (drm_core_has_MTRR(dev)) { - if ( map->mtrr >= 0 ) { - int retcode; - retcode = mtrr_del( map->mtrr, - map->offset, - map->size ); - DRM_DEBUG( "mtrr_del=%d\n", retcode ); - } - } - DRM(ioremapfree)( map->handle, map->size, dev ); - break; - case _DRM_SHM: - vfree(map->handle); - break; - - case _DRM_AGP: - /* Do nothing here, because this is all - * handled in the AGP/GART driver. - */ - break; - case _DRM_SCATTER_GATHER: - /* Handle it */ - if (drm_core_check_feature(dev, DRIVER_SG) && dev->sg) { - DRM(sg_cleanup)(dev->sg); - dev->sg = NULL; - } - break; - } - DRM(free)(map, sizeof(*map), DRM_MEM_MAPS); - } - list_del( list ); - DRM(free)(r_list, sizeof(*r_list), DRM_MEM_MAPS); - } - DRM(free)(dev->maplist, sizeof(*dev->maplist), DRM_MEM_MAPS); - dev->maplist = NULL; - } - - if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE) && dev->queuelist ) { - for ( i = 0 ; i < dev->queue_count ; i++ ) { - if ( dev->queuelist[i] ) { - DRM(free)( dev->queuelist[i], - sizeof(*dev->queuelist[0]), - DRM_MEM_QUEUES ); - dev->queuelist[i] = NULL; - } - } - DRM(free)( dev->queuelist, - dev->queue_slots * sizeof(*dev->queuelist), - DRM_MEM_QUEUES ); - dev->queuelist = NULL; - } - dev->queue_count = 0; - - if (drm_core_check_feature(dev, DRIVER_HAVE_DMA)) - DRM(dma_takedown)( dev ); - - if ( dev->lock.hw_lock ) { - dev->sigdata.lock = dev->lock.hw_lock = NULL; /* SHM removed */ - dev->lock.filp = NULL; - wake_up_interruptible( &dev->lock.lock_queue ); - } - up( &dev->struct_sem ); - - return 0; -} - -static void DRM(init_fn_table)(struct drm_device *dev) -{ - dev->fn_tbl.reclaim_buffers = DRM(core_reclaim_buffers); - dev->fn_tbl.get_map_ofs = DRM(core_get_map_ofs); - dev->fn_tbl.get_reg_ofs = DRM(core_get_reg_ofs); -} - -#include "drm_pciids.h" - -static struct pci_device_id DRM(pciidlist)[] = { - DRM(PCI_IDS) -}; - -static int DRM(probe)(struct pci_dev *pdev) -{ - drm_device_t *dev; - int retcode; - int i; - int is_compat = 0; - - DRM_DEBUG( "\n" ); - - for (i = 0; DRM(pciidlist)[i].vendor != 0; i++) { - if ((DRM(pciidlist)[i].vendor == pdev->vendor) && - (DRM(pciidlist)[i].device == pdev->device)) { - is_compat = 1; - } - } - if (is_compat == 0) - return -ENODEV; - - if (DRM(numdevs) >= MAX_DEVICES) - return -ENODEV; - - if ((retcode=pci_enable_device(pdev))) - return retcode; - - dev = &(DRM(device)[DRM(numdevs)]); - - memset( (void *)dev, 0, sizeof(*dev) ); - dev->count_lock = SPIN_LOCK_UNLOCKED; - init_timer( &dev->timer ); - sema_init( &dev->struct_sem, 1 ); - sema_init( &dev->ctxlist_sem, 1 ); - - if ((dev->minor = DRM(stub_register)(DRIVER_NAME, &DRM(fops),dev)) < 0) - return -EPERM; - dev->device = MKDEV(DRM_MAJOR, dev->minor ); - dev->name = DRIVER_NAME; - - dev->pdev = pdev; -#ifdef __alpha__ - dev->hose = pdev->sysdata; - dev->pci_domain = dev->hose->bus->number; -#else - dev->pci_domain = 0; -#endif - dev->pci_bus = pdev->bus->number; - dev->pci_slot = PCI_SLOT(pdev->devfn); - dev->pci_func = PCI_FUNC(pdev->devfn); - dev->irq = pdev->irq; - - /* dev_priv_size can be changed by a driver in driver_register_fns */ - dev->dev_priv_size = sizeof(u32); - - /* the DRM has 6 basic counters - drivers add theirs in register_fns */ - dev->counters = 6; - dev->types[0] = _DRM_STAT_LOCK; - dev->types[1] = _DRM_STAT_OPENS; - dev->types[2] = _DRM_STAT_CLOSES; - dev->types[3] = _DRM_STAT_IOCTLS; - dev->types[4] = _DRM_STAT_LOCKS; - dev->types[5] = _DRM_STAT_UNLOCKS; - - DRM(init_fn_table)(dev); - - DRM(driver_register_fns)(dev); - - if (dev->fn_tbl.preinit) - dev->fn_tbl.preinit(dev); - - if (drm_core_has_AGP(dev)) - { - dev->agp = DRM(agp_init)(); - if (drm_core_check_feature(dev, DRIVER_REQUIRE_AGP) && (dev->agp == NULL)) { - DRM_ERROR( "Cannot initialize the agpgart module.\n" ); - DRM(stub_unregister)(dev->minor); - DRM(takedown)( dev ); - return -EINVAL; - } - if (drm_core_has_MTRR(dev)) { - if (dev->agp) - dev->agp->agp_mtrr = mtrr_add( dev->agp->agp_info.aper_base, - dev->agp->agp_info.aper_size*1024*1024, - MTRR_TYPE_WRCOMB, - 1 ); - } - } - - retcode = DRM(ctxbitmap_init)( dev ); - if( retcode ) { - DRM_ERROR( "Cannot allocate memory for context bitmap.\n" ); - DRM(stub_unregister)(dev->minor); - DRM(takedown)( dev ); - return retcode; - } - - DRM(numdevs)++; /* no errors, mark it reserved */ - - DRM_INFO( "Initialized %s %d.%d.%d %s on minor %d: %s\n", - DRIVER_NAME, - DRIVER_MAJOR, - DRIVER_MINOR, - DRIVER_PATCHLEVEL, - DRIVER_DATE, - dev->minor, - pci_pretty_name(pdev)); - - if (dev->fn_tbl.postinit) - dev->fn_tbl.postinit(dev); - - return 0; -} - -/** - * Module initialization. Called via init_module at module load time, or via - * linux/init/main.c (this is not currently supported). - * - * \return zero on success or a negative number on failure. - * - * Initializes an array of drm_device structures, and attempts to - * initialize all available devices, using consecutive minors, registering the - * stubs and initializing the AGP device. - * - * Expands the \c DRIVER_PREINIT and \c DRIVER_POST_INIT macros before and - * after the initialization for driver customization. - */ -static int __init drm_init( void ) -{ - struct pci_dev *pdev = NULL; - - DRM_DEBUG( "\n" ); - -#ifdef MODULE - DRM(parse_options)( drm_opts ); -#endif - - DRM(mem_init)(); - - for_each_pci_dev(pdev) - DRM(probe)(pdev); - return 0; -} - -/** - * Called via cleanup_module() at module unload time. - * - * Cleans up all DRM device, calling takedown(). - * - * \sa drm_init(). - */ -static void __exit drm_cleanup( void ) -{ - drm_device_t *dev; - int i; - - DRM_DEBUG( "\n" ); - - for (i = DRM(numdevs) - 1; i >= 0; i--) { - dev = &(DRM(device)[i]); - if ( DRM(stub_unregister)(dev->minor) ) { - DRM_ERROR( "Cannot unload module\n" ); - } else { - DRM_DEBUG("minor %d unregistered\n", dev->minor); - if (i == 0) { - DRM_INFO( "Module unloaded\n" ); - } - } - - DRM(ctxbitmap_cleanup)( dev ); - - if (drm_core_has_MTRR(dev) && drm_core_has_AGP(dev) && - dev->agp && dev->agp->agp_mtrr >= 0) { - int retval; - retval = mtrr_del( dev->agp->agp_mtrr, - dev->agp->agp_info.aper_base, - dev->agp->agp_info.aper_size*1024*1024 ); - DRM_DEBUG( "mtrr_del=%d\n", retval ); - } - - DRM(takedown)( dev ); - - if (drm_core_has_AGP(dev) && dev->agp ) { - DRM(agp_uninit)(); - DRM(free)( dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS ); - dev->agp = NULL; - } - - if (dev->fn_tbl.postcleanup) - dev->fn_tbl.postcleanup(dev); - - } - DRM(numdevs) = 0; -} - -module_init( drm_init ); -module_exit( drm_cleanup ); - - -/** - * Get version information - * - * \param inode device inode. - * \param filp file pointer. - * \param cmd command. - * \param arg user argument, pointing to a drm_version structure. - * \return zero on success or negative number on failure. - * - * Fills in the version information in \p arg. - */ -int DRM(version)( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_version_t __user *argp = (void __user *)arg; - drm_version_t version; - int len; - - if ( copy_from_user( &version, argp, sizeof(version) ) ) - return -EFAULT; - -#define DRM_COPY( name, value ) \ - len = strlen( value ); \ - if ( len > name##_len ) len = name##_len; \ - name##_len = strlen( value ); \ - if ( len && name ) { \ - if ( copy_to_user( name, value, len ) ) \ - return -EFAULT; \ - } - - version.version_major = DRIVER_MAJOR; - version.version_minor = DRIVER_MINOR; - version.version_patchlevel = DRIVER_PATCHLEVEL; - - DRM_COPY( version.name, DRIVER_NAME ); - DRM_COPY( version.date, DRIVER_DATE ); - DRM_COPY( version.desc, DRIVER_DESC ); - - if ( copy_to_user( argp, &version, sizeof(version) ) ) - return -EFAULT; - return 0; -} - -/** - * Open file. - * - * \param inode device inode - * \param filp file pointer. - * \return zero on success or a negative number on failure. - * - * Searches the DRM device with the same minor number, calls open_helper(), and - * increments the device open count. If the open count was previous at zero, - * i.e., it's the first that the device is open, then calls setup(). - */ -int DRM(open)( struct inode *inode, struct file *filp ) -{ - drm_device_t *dev = NULL; - int retcode = 0; - int i; - - for (i = 0; i < DRM(numdevs); i++) { - if (iminor(inode) == DRM(device)[i].minor) { - dev = &(DRM(device)[i]); - break; - } - } - if (!dev) { - return -ENODEV; - } - - retcode = DRM(open_helper)( inode, filp, dev ); - if ( !retcode ) { - atomic_inc( &dev->counts[_DRM_STAT_OPENS] ); - spin_lock( &dev->count_lock ); - if ( !dev->open_count++ ) { - spin_unlock( &dev->count_lock ); - return DRM(setup)( dev ); - } - spin_unlock( &dev->count_lock ); - } - - return retcode; -} - -/** - * Release file. - * - * \param inode device inode - * \param filp file pointer. - * \return zero on success or a negative number on failure. - * - * If the hardware lock is held then free it, and take it again for the kernel - * context since it's necessary to reclaim buffers. Unlink the file private - * data from its list and free it. Decreases the open count and if it reaches - * zero calls takedown(). - */ -int DRM(release)( struct inode *inode, struct file *filp ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev; - int retcode = 0; - - lock_kernel(); - dev = priv->dev; - - DRM_DEBUG( "open_count = %d\n", dev->open_count ); - - if (dev->fn_tbl.prerelease) - dev->fn_tbl.prerelease(dev, filp); - - /* ======================================================== - * Begin inline drm_release - */ - - DRM_DEBUG( "pid = %d, device = 0x%lx, open_count = %d\n", - current->pid, (long)old_encode_dev(dev->device), dev->open_count ); - - if ( priv->lock_count && dev->lock.hw_lock && - _DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock) && - dev->lock.filp == filp ) { - DRM_DEBUG( "File %p released, freeing lock for context %d\n", - filp, - _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock) ); - - if (dev->fn_tbl.release) - dev->fn_tbl.release(dev, filp); - - DRM(lock_free)( dev, &dev->lock.hw_lock->lock, - _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock) ); - - /* FIXME: may require heavy-handed reset of - hardware at this point, possibly - processed via a callback to the X - server. */ - } - else if ( dev->fn_tbl.release && priv->lock_count && dev->lock.hw_lock ) { - /* The lock is required to reclaim buffers */ - DECLARE_WAITQUEUE( entry, current ); - - add_wait_queue( &dev->lock.lock_queue, &entry ); - for (;;) { - __set_current_state(TASK_INTERRUPTIBLE); - if ( !dev->lock.hw_lock ) { - /* Device has been unregistered */ - retcode = -EINTR; - break; - } - if ( DRM(lock_take)( &dev->lock.hw_lock->lock, - DRM_KERNEL_CONTEXT ) ) { - dev->lock.filp = filp; - dev->lock.lock_time = jiffies; - atomic_inc( &dev->counts[_DRM_STAT_LOCKS] ); - break; /* Got lock */ - } - /* Contention */ - schedule(); - if ( signal_pending( current ) ) { - retcode = -ERESTARTSYS; - break; - } - } - __set_current_state(TASK_RUNNING); - remove_wait_queue( &dev->lock.lock_queue, &entry ); - if( !retcode ) { - if (dev->fn_tbl.release) - dev->fn_tbl.release(dev, filp); - DRM(lock_free)( dev, &dev->lock.hw_lock->lock, - DRM_KERNEL_CONTEXT ); - } - } - - if (drm_core_check_feature(dev, DRIVER_HAVE_DMA)) - { - dev->fn_tbl.reclaim_buffers(filp); - } - - DRM(fasync)( -1, filp, 0 ); - - down( &dev->ctxlist_sem ); - if ( !list_empty( &dev->ctxlist->head ) ) { - drm_ctx_list_t *pos, *n; - - list_for_each_entry_safe( pos, n, &dev->ctxlist->head, head ) { - if ( pos->tag == priv && - pos->handle != DRM_KERNEL_CONTEXT ) { - if (dev->fn_tbl.context_dtor) - dev->fn_tbl.context_dtor(dev, pos->handle); - - DRM(ctxbitmap_free)( dev, pos->handle ); - - list_del( &pos->head ); - DRM(free)( pos, sizeof(*pos), DRM_MEM_CTXLIST ); - --dev->ctx_count; - } - } - } - up( &dev->ctxlist_sem ); - - down( &dev->struct_sem ); - if ( priv->remove_auth_on_close == 1 ) { - drm_file_t *temp = dev->file_first; - while ( temp ) { - temp->authenticated = 0; - temp = temp->next; - } - } - if ( priv->prev ) { - priv->prev->next = priv->next; - } else { - dev->file_first = priv->next; - } - if ( priv->next ) { - priv->next->prev = priv->prev; - } else { - dev->file_last = priv->prev; - } - up( &dev->struct_sem ); - - if (dev->fn_tbl.free_filp_priv) - dev->fn_tbl.free_filp_priv(dev, priv); - - DRM(free)( priv, sizeof(*priv), DRM_MEM_FILES ); - - /* ======================================================== - * End inline drm_release - */ - - atomic_inc( &dev->counts[_DRM_STAT_CLOSES] ); - spin_lock( &dev->count_lock ); - if ( !--dev->open_count ) { - if ( atomic_read( &dev->ioctl_count ) || dev->blocked ) { - DRM_ERROR( "Device busy: %d %d\n", - atomic_read( &dev->ioctl_count ), - dev->blocked ); - spin_unlock( &dev->count_lock ); - unlock_kernel(); - return -EBUSY; - } - spin_unlock( &dev->count_lock ); - unlock_kernel(); - return DRM(takedown)( dev ); - } - spin_unlock( &dev->count_lock ); - - unlock_kernel(); - - return retcode; -} - -/** - * Called whenever a process performs an ioctl on /dev/drm. - * - * \param inode device inode. - * \param filp file pointer. - * \param cmd command. - * \param arg user argument. - * \return zero on success or negative number on failure. - * - * Looks up the ioctl function in the ::ioctls table, checking for root - * previleges if so required, and dispatches to the respective function. - */ -int DRM(ioctl)( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_ioctl_desc_t *ioctl; - drm_ioctl_t *func; - int nr = DRM_IOCTL_NR(cmd); - int retcode = 0; - - atomic_inc( &dev->ioctl_count ); - atomic_inc( &dev->counts[_DRM_STAT_IOCTLS] ); - ++priv->ioctl_count; - - DRM_DEBUG( "pid=%d, cmd=0x%02x, nr=0x%02x, dev 0x%lx, auth=%d\n", - current->pid, cmd, nr, (long)old_encode_dev(dev->device), - priv->authenticated ); - - if ( nr >= DRIVER_IOCTL_COUNT ) { - retcode = -EINVAL; - } else { - ioctl = &DRM(ioctls)[nr]; - func = ioctl->func; - - if ( !func ) { - DRM_DEBUG( "no function\n" ); - retcode = -EINVAL; - } else if ( ( ioctl->root_only && !capable( CAP_SYS_ADMIN ) )|| - ( ioctl->auth_needed && !priv->authenticated ) ) { - retcode = -EACCES; - } else { - retcode = func( inode, filp, cmd, arg ); - } - } - - atomic_dec( &dev->ioctl_count ); - return retcode; -} - -/** - * Lock ioctl. - * - * \param inode device inode. - * \param filp file pointer. - * \param cmd command. - * \param arg user argument, pointing to a drm_lock structure. - * \return zero on success or negative number on failure. - * - * Add the current task to the lock wait queue, and attempt to take to lock. - */ -int DRM(lock)( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - DECLARE_WAITQUEUE( entry, current ); - drm_lock_t lock; - int ret = 0; - - ++priv->lock_count; - - if ( copy_from_user( &lock, (drm_lock_t __user *)arg, sizeof(lock) ) ) - return -EFAULT; - - if ( lock.context == DRM_KERNEL_CONTEXT ) { - DRM_ERROR( "Process %d using kernel context %d\n", - current->pid, lock.context ); - return -EINVAL; - } - - DRM_DEBUG( "%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n", - lock.context, current->pid, - dev->lock.hw_lock->lock, lock.flags ); - - if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE)) - if ( lock.context < 0 ) - return -EINVAL; - - add_wait_queue( &dev->lock.lock_queue, &entry ); - for (;;) { - __set_current_state(TASK_INTERRUPTIBLE); - if ( !dev->lock.hw_lock ) { - /* Device has been unregistered */ - ret = -EINTR; - break; - } - if ( DRM(lock_take)( &dev->lock.hw_lock->lock, - lock.context ) ) { - dev->lock.filp = filp; - dev->lock.lock_time = jiffies; - atomic_inc( &dev->counts[_DRM_STAT_LOCKS] ); - break; /* Got lock */ - } - - /* Contention */ - schedule(); - if ( signal_pending( current ) ) { - ret = -ERESTARTSYS; - break; - } - } - __set_current_state(TASK_RUNNING); - remove_wait_queue( &dev->lock.lock_queue, &entry ); - - sigemptyset( &dev->sigmask ); - sigaddset( &dev->sigmask, SIGSTOP ); - sigaddset( &dev->sigmask, SIGTSTP ); - sigaddset( &dev->sigmask, SIGTTIN ); - sigaddset( &dev->sigmask, SIGTTOU ); - dev->sigdata.context = lock.context; - dev->sigdata.lock = dev->lock.hw_lock; - block_all_signals( DRM(notifier), - &dev->sigdata, &dev->sigmask ); - - if (dev->fn_tbl.dma_ready && (lock.flags & _DRM_LOCK_READY)) - dev->fn_tbl.dma_ready(dev); - - if ( dev->fn_tbl.dma_quiescent && (lock.flags & _DRM_LOCK_QUIESCENT )) - return dev->fn_tbl.dma_quiescent(dev); - - /* dev->fn_tbl.kernel_context_switch isn't used by any of the x86 - * drivers but is used by the Sparc driver. - */ - - if (dev->fn_tbl.kernel_context_switch && - dev->last_context != lock.context) { - dev->fn_tbl.kernel_context_switch(dev, dev->last_context, - lock.context); - } - DRM_DEBUG( "%d %s\n", lock.context, ret ? "interrupted" : "has lock" ); - - return ret; -} - -/** - * Unlock ioctl. - * - * \param inode device inode. - * \param filp file pointer. - * \param cmd command. - * \param arg user argument, pointing to a drm_lock structure. - * \return zero on success or negative number on failure. - * - * Transfer and free the lock. - */ -int DRM(unlock)( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_lock_t lock; - - if ( copy_from_user( &lock, (drm_lock_t __user *)arg, sizeof(lock) ) ) - return -EFAULT; - - if ( lock.context == DRM_KERNEL_CONTEXT ) { - DRM_ERROR( "Process %d using kernel context %d\n", - current->pid, lock.context ); - return -EINVAL; - } - - atomic_inc( &dev->counts[_DRM_STAT_UNLOCKS] ); - - /* kernel_context_switch isn't used by any of the x86 drm - * modules but is required by the Sparc driver. - */ - if (dev->fn_tbl.kernel_context_switch_unlock) - dev->fn_tbl.kernel_context_switch_unlock(dev, &lock); - else { - DRM(lock_transfer)( dev, &dev->lock.hw_lock->lock, - DRM_KERNEL_CONTEXT ); - - if ( DRM(lock_free)( dev, &dev->lock.hw_lock->lock, - DRM_KERNEL_CONTEXT ) ) { - DRM_ERROR( "\n" ); - } - } - - unblock_all_signals(); - return 0; -} diff -Nru a/drivers/char/drm/drm_fops.c b/drivers/char/drm/drm_fops.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/char/drm/drm_fops.c 2005-01-02 23:03:34 -08:00 @@ -0,0 +1,449 @@ +/** + * \file drm_fops.h + * File operations for DRM + * + * \author Rickard E. (Rik) Faith + * \author Daryll Strauss + * \author Gareth Hughes + */ + +/* + * Created: Mon Jan 4 08:58:31 1999 by faith@valinux.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "drmP.h" +#include + +static int drm_setup( drm_device_t *dev ) +{ + int i; + int ret; + + if (dev->driver->presetup) + { + ret=dev->driver->presetup(dev); + if (ret!=0) + return ret; + } + + atomic_set( &dev->ioctl_count, 0 ); + atomic_set( &dev->vma_count, 0 ); + dev->buf_use = 0; + atomic_set( &dev->buf_alloc, 0 ); + + if (drm_core_check_feature(dev, DRIVER_HAVE_DMA)) + { + i = drm_dma_setup( dev ); + if ( i < 0 ) + return i; + } + + for ( i = 0 ; i < DRM_ARRAY_SIZE(dev->counts) ; i++ ) + atomic_set( &dev->counts[i], 0 ); + + for ( i = 0 ; i < DRM_HASH_SIZE ; i++ ) { + dev->magiclist[i].head = NULL; + dev->magiclist[i].tail = NULL; + } + + dev->maplist = drm_alloc(sizeof(*dev->maplist), + DRM_MEM_MAPS); + if(dev->maplist == NULL) return -ENOMEM; + memset(dev->maplist, 0, sizeof(*dev->maplist)); + INIT_LIST_HEAD(&dev->maplist->head); + + dev->ctxlist = drm_alloc(sizeof(*dev->ctxlist), + DRM_MEM_CTXLIST); + if(dev->ctxlist == NULL) return -ENOMEM; + memset(dev->ctxlist, 0, sizeof(*dev->ctxlist)); + INIT_LIST_HEAD(&dev->ctxlist->head); + + dev->vmalist = NULL; + dev->sigdata.lock = dev->lock.hw_lock = NULL; + init_waitqueue_head( &dev->lock.lock_queue ); + dev->queue_count = 0; + dev->queue_reserved = 0; + dev->queue_slots = 0; + dev->queuelist = NULL; + dev->irq_enabled = 0; + dev->context_flag = 0; + dev->interrupt_flag = 0; + dev->dma_flag = 0; + dev->last_context = 0; + dev->last_switch = 0; + dev->last_checked = 0; + init_waitqueue_head( &dev->context_wait ); + dev->if_version = 0; + + dev->ctx_start = 0; + dev->lck_start = 0; + + dev->buf_rp = dev->buf; + dev->buf_wp = dev->buf; + dev->buf_end = dev->buf + DRM_BSZ; + dev->buf_async = NULL; + init_waitqueue_head( &dev->buf_readers ); + init_waitqueue_head( &dev->buf_writers ); + + DRM_DEBUG( "\n" ); + + /* + * The kernel's context could be created here, but is now created + * in drm_dma_enqueue. This is more resource-efficient for + * hardware that does not do DMA, but may mean that + * drm_select_queue fails between the time the interrupt is + * initialized and the time the queues are initialized. + */ + if (dev->driver->postsetup) + dev->driver->postsetup(dev); + + return 0; +} + +/** + * Open file. + * + * \param inode device inode + * \param filp file pointer. + * \return zero on success or a negative number on failure. + * + * Searches the DRM device with the same minor number, calls open_helper(), and + * increments the device open count. If the open count was previous at zero, + * i.e., it's the first that the device is open, then calls setup(). + */ +int drm_open( struct inode *inode, struct file *filp ) +{ + drm_device_t *dev = NULL; + int minor = iminor(inode); + int retcode = 0; + + if (!((minor >= 0) && (minor < drm_cards_limit))) + return -ENODEV; + + dev = drm_minors[minor].dev; + if (!dev) + return -ENODEV; + + retcode = drm_open_helper( inode, filp, dev ); + if ( !retcode ) { + atomic_inc( &dev->counts[_DRM_STAT_OPENS] ); + spin_lock( &dev->count_lock ); + if ( !dev->open_count++ ) { + spin_unlock( &dev->count_lock ); + return drm_setup( dev ); + } + spin_unlock( &dev->count_lock ); + } + + return retcode; +} +EXPORT_SYMBOL(drm_open); + +/** + * Release file. + * + * \param inode device inode + * \param filp file pointer. + * \return zero on success or a negative number on failure. + * + * If the hardware lock is held then free it, and take it again for the kernel + * context since it's necessary to reclaim buffers. Unlink the file private + * data from its list and free it. Decreases the open count and if it reaches + * zero calls takedown(). + */ +int drm_release( struct inode *inode, struct file *filp ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev; + int retcode = 0; + + lock_kernel(); + dev = priv->dev; + + DRM_DEBUG( "open_count = %d\n", dev->open_count ); + + if (dev->driver->prerelease) + dev->driver->prerelease(dev, filp); + + /* ======================================================== + * Begin inline drm_release + */ + + DRM_DEBUG( "pid = %d, device = 0x%lx, open_count = %d\n", + current->pid, (long)old_encode_dev(dev->device), dev->open_count ); + + if ( priv->lock_count && dev->lock.hw_lock && + _DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock) && + dev->lock.filp == filp ) { + DRM_DEBUG( "File %p released, freeing lock for context %d\n", + filp, + _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock) ); + + if (dev->driver->release) + dev->driver->release(dev, filp); + + drm_lock_free( dev, &dev->lock.hw_lock->lock, + _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock) ); + + /* FIXME: may require heavy-handed reset of + hardware at this point, possibly + processed via a callback to the X + server. */ + } + else if ( dev->driver->release && priv->lock_count && dev->lock.hw_lock ) { + /* The lock is required to reclaim buffers */ + DECLARE_WAITQUEUE( entry, current ); + + add_wait_queue( &dev->lock.lock_queue, &entry ); + for (;;) { + __set_current_state(TASK_INTERRUPTIBLE); + if ( !dev->lock.hw_lock ) { + /* Device has been unregistered */ + retcode = -EINTR; + break; + } + if ( drm_lock_take( &dev->lock.hw_lock->lock, + DRM_KERNEL_CONTEXT ) ) { + dev->lock.filp = filp; + dev->lock.lock_time = jiffies; + atomic_inc( &dev->counts[_DRM_STAT_LOCKS] ); + break; /* Got lock */ + } + /* Contention */ + schedule(); + if ( signal_pending( current ) ) { + retcode = -ERESTARTSYS; + break; + } + } + __set_current_state(TASK_RUNNING); + remove_wait_queue( &dev->lock.lock_queue, &entry ); + if( !retcode ) { + if (dev->driver->release) + dev->driver->release(dev, filp); + drm_lock_free( dev, &dev->lock.hw_lock->lock, + DRM_KERNEL_CONTEXT ); + } + } + + if (drm_core_check_feature(dev, DRIVER_HAVE_DMA)) + { + dev->driver->reclaim_buffers(dev, filp); + } + + drm_fasync( -1, filp, 0 ); + + down( &dev->ctxlist_sem ); + if ( !list_empty( &dev->ctxlist->head ) ) { + drm_ctx_list_t *pos, *n; + + list_for_each_entry_safe( pos, n, &dev->ctxlist->head, head ) { + if ( pos->tag == priv && + pos->handle != DRM_KERNEL_CONTEXT ) { + if (dev->driver->context_dtor) + dev->driver->context_dtor(dev, pos->handle); + + drm_ctxbitmap_free( dev, pos->handle ); + + list_del( &pos->head ); + drm_free( pos, sizeof(*pos), DRM_MEM_CTXLIST ); + --dev->ctx_count; + } + } + } + up( &dev->ctxlist_sem ); + + down( &dev->struct_sem ); + if ( priv->remove_auth_on_close == 1 ) { + drm_file_t *temp = dev->file_first; + while ( temp ) { + temp->authenticated = 0; + temp = temp->next; + } + } + if ( priv->prev ) { + priv->prev->next = priv->next; + } else { + dev->file_first = priv->next; + } + if ( priv->next ) { + priv->next->prev = priv->prev; + } else { + dev->file_last = priv->prev; + } + up( &dev->struct_sem ); + + if (dev->driver->free_filp_priv) + dev->driver->free_filp_priv(dev, priv); + + drm_free( priv, sizeof(*priv), DRM_MEM_FILES ); + + /* ======================================================== + * End inline drm_release + */ + + atomic_inc( &dev->counts[_DRM_STAT_CLOSES] ); + spin_lock( &dev->count_lock ); + if ( !--dev->open_count ) { + if ( atomic_read( &dev->ioctl_count ) || dev->blocked ) { + DRM_ERROR( "Device busy: %d %d\n", + atomic_read( &dev->ioctl_count ), + dev->blocked ); + spin_unlock( &dev->count_lock ); + unlock_kernel(); + return -EBUSY; + } + spin_unlock( &dev->count_lock ); + unlock_kernel(); + return drm_takedown( dev ); + } + spin_unlock( &dev->count_lock ); + + unlock_kernel(); + + return retcode; +} +EXPORT_SYMBOL(drm_release); + +/** + * Called whenever a process opens /dev/drm. + * + * \param inode device inode. + * \param filp file pointer. + * \param dev device. + * \return zero on success or a negative number on failure. + * + * Creates and initializes a drm_file structure for the file private data in \p + * filp and add it into the double linked list in \p dev. + */ +int drm_open_helper(struct inode *inode, struct file *filp, drm_device_t *dev) +{ + int minor = iminor(inode); + drm_file_t *priv; + int ret; + + if (filp->f_flags & O_EXCL) return -EBUSY; /* No exclusive opens */ + if (!drm_cpu_valid()) return -EINVAL; + + DRM_DEBUG("pid = %d, minor = %d\n", current->pid, minor); + + priv = drm_alloc(sizeof(*priv), DRM_MEM_FILES); + if(!priv) return -ENOMEM; + + memset(priv, 0, sizeof(*priv)); + filp->private_data = priv; + priv->uid = current->euid; + priv->pid = current->pid; + priv->minor = minor; + priv->dev = dev; + priv->ioctl_count = 0; + priv->authenticated = capable(CAP_SYS_ADMIN); + priv->lock_count = 0; + + if (dev->driver->open_helper) { + ret=dev->driver->open_helper(dev, priv); + if (ret < 0) + goto out_free; + } + + down(&dev->struct_sem); + if (!dev->file_last) { + priv->next = NULL; + priv->prev = NULL; + dev->file_first = priv; + dev->file_last = priv; + } else { + priv->next = NULL; + priv->prev = dev->file_last; + dev->file_last->next = priv; + dev->file_last = priv; + } + up(&dev->struct_sem); + +#ifdef __alpha__ + /* + * Default the hose + */ + if (!dev->hose) { + struct pci_dev *pci_dev; + pci_dev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, NULL); + if (pci_dev) { + dev->hose = pci_dev->sysdata; + pci_dev_put(pci_dev); + } + if (!dev->hose) { + struct pci_bus *b = pci_bus_b(pci_root_buses.next); + if (b) dev->hose = b->sysdata; + } + } +#endif + + return 0; +out_free: + drm_free(priv, sizeof(*priv), DRM_MEM_FILES); + filp->private_data=NULL; + return ret; +} + +/** No-op. */ +int drm_flush(struct file *filp) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + + DRM_DEBUG("pid = %d, device = 0x%lx, open_count = %d\n", + current->pid, (long)old_encode_dev(dev->device), dev->open_count); + return 0; +} +EXPORT_SYMBOL(drm_flush); + +/** No-op. */ +int drm_fasync(int fd, struct file *filp, int on) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + int retcode; + + DRM_DEBUG("fd = %d, device = 0x%lx\n", fd, (long)old_encode_dev(dev->device)); + retcode = fasync_helper(fd, filp, on, &dev->buf_async); + if (retcode < 0) return retcode; + return 0; +} +EXPORT_SYMBOL(drm_fasync); + +/** No-op. */ +unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait) +{ + return 0; +} +EXPORT_SYMBOL(drm_poll); + + +/** No-op. */ +ssize_t drm_read(struct file *filp, char __user *buf, size_t count, loff_t *off) +{ + return 0; +} diff -Nru a/drivers/char/drm/drm_fops.h b/drivers/char/drm/drm_fops.h --- a/drivers/char/drm/drm_fops.h 2005-01-02 23:03:34 -08:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,156 +0,0 @@ -/** - * \file drm_fops.h - * File operations for DRM - * - * \author Rickard E. (Rik) Faith - * \author Daryll Strauss - * \author Gareth Hughes - */ - -/* - * Created: Mon Jan 4 08:58:31 1999 by faith@valinux.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -#include "drmP.h" -#include - - -/** - * Called whenever a process opens /dev/drm. - * - * \param inode device inode. - * \param filp file pointer. - * \param dev device. - * \return zero on success or a negative number on failure. - * - * Creates and initializes a drm_file structure for the file private data in \p - * filp and add it into the double linked list in \p dev. - */ -int DRM(open_helper)(struct inode *inode, struct file *filp, drm_device_t *dev) -{ - int minor = iminor(inode); - drm_file_t *priv; - int ret; - - if (filp->f_flags & O_EXCL) return -EBUSY; /* No exclusive opens */ - if (!DRM(cpu_valid)()) return -EINVAL; - - DRM_DEBUG("pid = %d, minor = %d\n", current->pid, minor); - - priv = DRM(alloc)(sizeof(*priv), DRM_MEM_FILES); - if(!priv) return -ENOMEM; - - memset(priv, 0, sizeof(*priv)); - filp->private_data = priv; - priv->uid = current->euid; - priv->pid = current->pid; - priv->minor = minor; - priv->dev = dev; - priv->ioctl_count = 0; - priv->authenticated = capable(CAP_SYS_ADMIN); - priv->lock_count = 0; - - if (dev->fn_tbl.open_helper) { - ret=dev->fn_tbl.open_helper(dev, priv); - if (ret < 0) - goto out_free; - } - - down(&dev->struct_sem); - if (!dev->file_last) { - priv->next = NULL; - priv->prev = NULL; - dev->file_first = priv; - dev->file_last = priv; - } else { - priv->next = NULL; - priv->prev = dev->file_last; - dev->file_last->next = priv; - dev->file_last = priv; - } - up(&dev->struct_sem); - -#ifdef __alpha__ - /* - * Default the hose - */ - if (!dev->hose) { - struct pci_dev *pci_dev; - pci_dev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, NULL); - if (pci_dev) { - dev->hose = pci_dev->sysdata; - pci_dev_put(pci_dev); - } - if (!dev->hose) { - struct pci_bus *b = pci_bus_b(pci_root_buses.next); - if (b) dev->hose = b->sysdata; - } - } -#endif - - return 0; -out_free: - DRM(free)(priv, sizeof(*priv), DRM_MEM_FILES); - filp->private_data=NULL; - return ret; -} - -/** No-op. */ -int DRM(flush)(struct file *filp) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - - DRM_DEBUG("pid = %d, device = 0x%lx, open_count = %d\n", - current->pid, (long)old_encode_dev(dev->device), dev->open_count); - return 0; -} - -/** No-op. */ -int DRM(fasync)(int fd, struct file *filp, int on) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - int retcode; - - DRM_DEBUG("fd = %d, device = 0x%lx\n", fd, (long)old_encode_dev(dev->device)); - retcode = fasync_helper(fd, filp, on, &dev->buf_async); - if (retcode < 0) return retcode; - return 0; -} - -/** No-op. */ -unsigned int DRM(poll)(struct file *filp, struct poll_table_struct *wait) -{ - return 0; -} - - -/** No-op. */ -ssize_t DRM(read)(struct file *filp, char __user *buf, size_t count, loff_t *off) -{ - return 0; -} diff -Nru a/drivers/char/drm/drm_init.c b/drivers/char/drm/drm_init.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/char/drm/drm_init.c 2005-01-02 23:03:34 -08:00 @@ -0,0 +1,52 @@ +/** + * \file drm_init.h + * Setup/Cleanup for DRM + * + * \author Rickard E. (Rik) Faith + * \author Gareth Hughes + */ + +/* + * Created: Mon Jan 4 08:58:31 1999 by faith@valinux.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "drmP.h" + +/** + * Check whether DRI will run on this CPU. + * + * \return non-zero if the DRI will run on this CPU, or zero otherwise. + */ +int drm_cpu_valid(void) +{ +#if defined(__i386__) + if (boot_cpu_data.x86 == 3) return 0; /* No cmpxchg on a 386 */ +#endif +#if defined(__sparc__) && !defined(__sparc_v9__) + return 0; /* No cmpxchg before v9 sparc. */ +#endif + return 1; +} diff -Nru a/drivers/char/drm/drm_init.h b/drivers/char/drm/drm_init.h --- a/drivers/char/drm/drm_init.h 2005-01-02 23:03:34 -08:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,128 +0,0 @@ -/** - * \file drm_init.h - * Setup/Cleanup for DRM - * - * \author Rickard E. (Rik) Faith - * \author Gareth Hughes - */ - -/* - * Created: Mon Jan 4 08:58:31 1999 by faith@valinux.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -#include "drmP.h" - -/** Debug flags. Set by parse_option(). */ -#if 0 -int DRM(flags) = DRM_FLAG_DEBUG; -#else -int DRM(flags) = 0; -#endif - -/** - * Parse a single option. - * - * \param s option string. - * - * \sa See parse_options() for details. - */ -static void DRM(parse_option)(char *s) -{ - char *c, *r; - - DRM_DEBUG("\"%s\"\n", s); - if (!s || !*s) return; - for (c = s; *c && *c != ':'; c++); /* find : or \0 */ - if (*c) r = c + 1; else r = NULL; /* remember remainder */ - *c = '\0'; /* terminate */ - if (!strcmp(s, "debug")) { - DRM(flags) |= DRM_FLAG_DEBUG; - DRM_INFO("Debug messages ON\n"); - return; - } - DRM_ERROR("\"%s\" is not a valid option\n", s); - return; -} - -/** - * Parse the insmod "drm_opts=" options, or the command-line - * options passed to the kernel via LILO. - * - * \param s contains option_list without the 'drm_opts=' part. - * - * The grammar of the format is as - * follows: - * - * \code - * drm ::= 'drm_opts=' option_list - * option_list ::= option [ ';' option_list ] - * option ::= 'device:' major - * | 'debug' - * | 'noctx' - * major ::= INTEGER - * \endcode - * - * - device=major,minor specifies the device number used for /dev/drm - * - if major == 0 then the misc device is used - * - if major == 0 and minor == 0 then dynamic misc allocation is used - * - debug=on specifies that debugging messages will be printk'd - * - debug=trace specifies that each function call will be logged via printk - * - debug=off turns off all debugging options - * - * \todo Actually only the \e presence of the 'debug' option is currently - * checked. - */ - -void DRM(parse_options)(char *s) -{ - char *h, *t, *n; - - DRM_DEBUG("\"%s\"\n", s ?: ""); - if (!s || !*s) return; - - for (h = t = n = s; h && *h; h = n) { - for (; *t && *t != ';'; t++); /* find ; or \0 */ - if (*t) n = t + 1; else n = NULL; /* remember next */ - *t = '\0'; /* terminate */ - DRM(parse_option)(h); /* parse */ - } -} - -/** - * Check whether DRI will run on this CPU. - * - * \return non-zero if the DRI will run on this CPU, or zero otherwise. - */ -int DRM(cpu_valid)(void) -{ -#if defined(__i386__) - if (boot_cpu_data.x86 == 3) return 0; /* No cmpxchg on a 386 */ -#endif -#if defined(__sparc__) && !defined(__sparc_v9__) - return 0; /* No cmpxchg before v9 sparc. */ -#endif - return 1; -} diff -Nru a/drivers/char/drm/drm_ioctl.c b/drivers/char/drm/drm_ioctl.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/char/drm/drm_ioctl.c 2005-01-02 23:03:33 -08:00 @@ -0,0 +1,355 @@ +/** + * \file drm_ioctl.h + * IOCTL processing for DRM + * + * \author Rickard E. (Rik) Faith + * \author Gareth Hughes + */ + +/* + * Created: Fri Jan 8 09:01:26 1999 by faith@valinux.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "drmP.h" +#include "drm_core.h" + +#include "linux/pci.h" + +/** + * Get the bus id. + * + * \param inode device inode. + * \param filp file pointer. + * \param cmd command. + * \param arg user argument, pointing to a drm_unique structure. + * \return zero on success or a negative number on failure. + * + * Copies the bus id from drm_device::unique into user space. + */ +int drm_getunique(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_unique_t __user *argp = (void __user *)arg; + drm_unique_t u; + + if (copy_from_user(&u, argp, sizeof(u))) + return -EFAULT; + if (u.unique_len >= dev->unique_len) { + if (copy_to_user(u.unique, dev->unique, dev->unique_len)) + return -EFAULT; + } + u.unique_len = dev->unique_len; + if (copy_to_user(argp, &u, sizeof(u))) + return -EFAULT; + return 0; +} + +/** + * Set the bus id. + * + * \param inode device inode. + * \param filp file pointer. + * \param cmd command. + * \param arg user argument, pointing to a drm_unique structure. + * \return zero on success or a negative number on failure. + * + * Copies the bus id from userspace into drm_device::unique, and verifies that + * it matches the device this DRM is attached to (EINVAL otherwise). Deprecated + * in interface version 1.1 and will return EBUSY when setversion has requested + * version 1.1 or greater. + */ +int drm_setunique(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_unique_t u; + int domain, bus, slot, func, ret; + + if (dev->unique_len || dev->unique) return -EBUSY; + + if (copy_from_user(&u, (drm_unique_t __user *)arg, sizeof(u))) + return -EFAULT; + + if (!u.unique_len || u.unique_len > 1024) return -EINVAL; + + dev->unique_len = u.unique_len; + dev->unique = drm_alloc(u.unique_len + 1, DRM_MEM_DRIVER); + if(!dev->unique) return -ENOMEM; + if (copy_from_user(dev->unique, u.unique, dev->unique_len)) + return -EFAULT; + + dev->unique[dev->unique_len] = '\0'; + + dev->devname = drm_alloc(strlen(dev->driver->pci_driver.name) + strlen(dev->unique) + 2, + DRM_MEM_DRIVER); + if (!dev->devname) + return -ENOMEM; + + sprintf(dev->devname, "%s@%s", dev->driver->pci_driver.name, dev->unique); + + /* Return error if the busid submitted doesn't match the device's actual + * busid. + */ + ret = sscanf(dev->unique, "PCI:%d:%d:%d", &bus, &slot, &func); + if (ret != 3) + return DRM_ERR(EINVAL); + domain = bus >> 8; + bus &= 0xff; + + if ((domain != dev->pci_domain) || + (bus != dev->pci_bus) || + (slot != dev->pci_slot) || + (func != dev->pci_func)) + return -EINVAL; + + return 0; +} + +static int +drm_set_busid(drm_device_t *dev) +{ + if (dev->unique != NULL) + return EBUSY; + + dev->unique_len = 20; + dev->unique = drm_alloc(dev->unique_len + 1, DRM_MEM_DRIVER); + if (dev->unique == NULL) + return ENOMEM; + + snprintf(dev->unique, dev->unique_len, "pci:%04x:%02x:%02x.%d", + dev->pci_domain, dev->pci_bus, dev->pci_slot, dev->pci_func); + + dev->devname = drm_alloc(strlen(dev->driver->pci_driver.name) + dev->unique_len + 2, + DRM_MEM_DRIVER); + if (dev->devname == NULL) + return ENOMEM; + + sprintf(dev->devname, "%s@%s", dev->driver->pci_driver.name, dev->unique); + + return 0; +} + + +/** + * Get a mapping information. + * + * \param inode device inode. + * \param filp file pointer. + * \param cmd command. + * \param arg user argument, pointing to a drm_map structure. + * + * \return zero on success or a negative number on failure. + * + * Searches for the mapping with the specified offset and copies its information + * into userspace + */ +int drm_getmap( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_map_t __user *argp = (void __user *)arg; + drm_map_t map; + drm_map_list_t *r_list = NULL; + struct list_head *list; + int idx; + int i; + + if (copy_from_user(&map, argp, sizeof(map))) + return -EFAULT; + idx = map.offset; + + down(&dev->struct_sem); + if (idx < 0) { + up(&dev->struct_sem); + return -EINVAL; + } + + i = 0; + list_for_each(list, &dev->maplist->head) { + if(i == idx) { + r_list = list_entry(list, drm_map_list_t, head); + break; + } + i++; + } + if(!r_list || !r_list->map) { + up(&dev->struct_sem); + return -EINVAL; + } + + map.offset = r_list->map->offset; + map.size = r_list->map->size; + map.type = r_list->map->type; + map.flags = r_list->map->flags; + map.handle = r_list->map->handle; + map.mtrr = r_list->map->mtrr; + up(&dev->struct_sem); + + if (copy_to_user(argp, &map, sizeof(map))) return -EFAULT; + return 0; +} + +/** + * Get client information. + * + * \param inode device inode. + * \param filp file pointer. + * \param cmd command. + * \param arg user argument, pointing to a drm_client structure. + * + * \return zero on success or a negative number on failure. + * + * Searches for the client with the specified index and copies its information + * into userspace + */ +int drm_getclient( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_client_t __user *argp = (void __user *)arg; + drm_client_t client; + drm_file_t *pt; + int idx; + int i; + + if (copy_from_user(&client, argp, sizeof(client))) + return -EFAULT; + idx = client.idx; + down(&dev->struct_sem); + for (i = 0, pt = dev->file_first; i < idx && pt; i++, pt = pt->next) + ; + + if (!pt) { + up(&dev->struct_sem); + return -EINVAL; + } + client.auth = pt->authenticated; + client.pid = pt->pid; + client.uid = pt->uid; + client.magic = pt->magic; + client.iocs = pt->ioctl_count; + up(&dev->struct_sem); + + if (copy_to_user((drm_client_t __user *)arg, &client, sizeof(client))) + return -EFAULT; + return 0; +} + +/** + * Get statistics information. + * + * \param inode device inode. + * \param filp file pointer. + * \param cmd command. + * \param arg user argument, pointing to a drm_stats structure. + * + * \return zero on success or a negative number on failure. + */ +int drm_getstats( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_stats_t stats; + int i; + + memset(&stats, 0, sizeof(stats)); + + down(&dev->struct_sem); + + for (i = 0; i < dev->counters; i++) { + if (dev->types[i] == _DRM_STAT_LOCK) + stats.data[i].value + = (dev->lock.hw_lock + ? dev->lock.hw_lock->lock : 0); + else + stats.data[i].value = atomic_read(&dev->counts[i]); + stats.data[i].type = dev->types[i]; + } + + stats.count = dev->counters; + + up(&dev->struct_sem); + + if (copy_to_user((drm_stats_t __user *)arg, &stats, sizeof(stats))) + return -EFAULT; + return 0; +} + +int drm_setversion(DRM_IOCTL_ARGS) +{ + DRM_DEVICE; + drm_set_version_t sv; + drm_set_version_t retv; + int if_version; + drm_set_version_t __user *argp = (void __user *)data; + + DRM_COPY_FROM_USER_IOCTL(sv, argp, sizeof(sv)); + + retv.drm_di_major = DRM_IF_MAJOR; + retv.drm_di_minor = DRM_IF_MINOR; + retv.drm_dd_major = DRIVER_MAJOR; + retv.drm_dd_minor = DRIVER_MINOR; + + DRM_COPY_TO_USER_IOCTL(argp, retv, sizeof(sv)); + + if (sv.drm_di_major != -1) { + if (sv.drm_di_major != DRM_IF_MAJOR || + sv.drm_di_minor < 0 || sv.drm_di_minor > DRM_IF_MINOR) + return EINVAL; + if_version = DRM_IF_VERSION(sv.drm_di_major, sv.drm_dd_minor); + dev->if_version = DRM_MAX(if_version, dev->if_version); + if (sv.drm_di_minor >= 1) { + /* + * Version 1.1 includes tying of DRM to specific device + */ + drm_set_busid(dev); + } + } + + if (sv.drm_dd_major != -1) { + if (sv.drm_dd_major != DRIVER_MAJOR || + sv.drm_dd_minor < 0 || sv.drm_dd_minor > DRIVER_MINOR) + return EINVAL; + + if (dev->driver->set_version) + dev->driver->set_version(dev, &sv); + } + return 0; +} + +/** No-op ioctl. */ +int drm_noop(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + DRM_DEBUG("\n"); + return 0; +} diff -Nru a/drivers/char/drm/drm_ioctl.h b/drivers/char/drm/drm_ioctl.h --- a/drivers/char/drm/drm_ioctl.h 2005-01-02 23:03:33 -08:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,349 +0,0 @@ -/** - * \file drm_ioctl.h - * IOCTL processing for DRM - * - * \author Rickard E. (Rik) Faith - * \author Gareth Hughes - */ - -/* - * Created: Fri Jan 8 09:01:26 1999 by faith@valinux.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -#include "drmP.h" - -#include "linux/pci.h" - -/** - * Get the bus id. - * - * \param inode device inode. - * \param filp file pointer. - * \param cmd command. - * \param arg user argument, pointing to a drm_unique structure. - * \return zero on success or a negative number on failure. - * - * Copies the bus id from drm_device::unique into user space. - */ -int DRM(getunique)(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_unique_t __user *argp = (void __user *)arg; - drm_unique_t u; - - if (copy_from_user(&u, argp, sizeof(u))) - return -EFAULT; - if (u.unique_len >= dev->unique_len) { - if (copy_to_user(u.unique, dev->unique, dev->unique_len)) - return -EFAULT; - } - u.unique_len = dev->unique_len; - if (copy_to_user(argp, &u, sizeof(u))) - return -EFAULT; - return 0; -} - -/** - * Set the bus id. - * - * \param inode device inode. - * \param filp file pointer. - * \param cmd command. - * \param arg user argument, pointing to a drm_unique structure. - * \return zero on success or a negative number on failure. - * - * Copies the bus id from userspace into drm_device::unique, and verifies that - * it matches the device this DRM is attached to (EINVAL otherwise). Deprecated - * in interface version 1.1 and will return EBUSY when setversion has requested - * version 1.1 or greater. - */ -int DRM(setunique)(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_unique_t u; - int domain, bus, slot, func, ret; - - if (dev->unique_len || dev->unique) return -EBUSY; - - if (copy_from_user(&u, (drm_unique_t __user *)arg, sizeof(u))) - return -EFAULT; - - if (!u.unique_len || u.unique_len > 1024) return -EINVAL; - - dev->unique_len = u.unique_len; - dev->unique = DRM(alloc)(u.unique_len + 1, DRM_MEM_DRIVER); - if(!dev->unique) return -ENOMEM; - if (copy_from_user(dev->unique, u.unique, dev->unique_len)) - return -EFAULT; - - dev->unique[dev->unique_len] = '\0'; - - dev->devname = DRM(alloc)(strlen(dev->name) + strlen(dev->unique) + 2, - DRM_MEM_DRIVER); - if (!dev->devname) - return -ENOMEM; - - sprintf(dev->devname, "%s@%s", dev->name, dev->unique); - - /* Return error if the busid submitted doesn't match the device's actual - * busid. - */ - ret = sscanf(dev->unique, "PCI:%d:%d:%d", &bus, &slot, &func); - if (ret != 3) - return DRM_ERR(EINVAL); - domain = bus >> 8; - bus &= 0xff; - - if ((domain != dev->pci_domain) || - (bus != dev->pci_bus) || - (slot != dev->pci_slot) || - (func != dev->pci_func)) - return -EINVAL; - - return 0; -} - -static int -DRM(set_busid)(drm_device_t *dev) -{ - if (dev->unique != NULL) - return EBUSY; - - dev->unique_len = 20; - dev->unique = DRM(alloc)(dev->unique_len + 1, DRM_MEM_DRIVER); - if (dev->unique == NULL) - return ENOMEM; - - snprintf(dev->unique, dev->unique_len, "pci:%04x:%02x:%02x.%d", - dev->pci_domain, dev->pci_bus, dev->pci_slot, dev->pci_func); - - dev->devname = DRM(alloc)(strlen(dev->name) + dev->unique_len + 2, - DRM_MEM_DRIVER); - if (dev->devname == NULL) - return ENOMEM; - - sprintf(dev->devname, "%s@%s", dev->name, dev->unique); - - return 0; -} - - -/** - * Get a mapping information. - * - * \param inode device inode. - * \param filp file pointer. - * \param cmd command. - * \param arg user argument, pointing to a drm_map structure. - * - * \return zero on success or a negative number on failure. - * - * Searches for the mapping with the specified offset and copies its information - * into userspace - */ -int DRM(getmap)( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_map_t __user *argp = (void __user *)arg; - drm_map_t map; - drm_map_list_t *r_list = NULL; - struct list_head *list; - int idx; - int i; - - if (copy_from_user(&map, argp, sizeof(map))) - return -EFAULT; - idx = map.offset; - - down(&dev->struct_sem); - if (idx < 0) { - up(&dev->struct_sem); - return -EINVAL; - } - - i = 0; - list_for_each(list, &dev->maplist->head) { - if(i == idx) { - r_list = list_entry(list, drm_map_list_t, head); - break; - } - i++; - } - if(!r_list || !r_list->map) { - up(&dev->struct_sem); - return -EINVAL; - } - - map.offset = r_list->map->offset; - map.size = r_list->map->size; - map.type = r_list->map->type; - map.flags = r_list->map->flags; - map.handle = r_list->map->handle; - map.mtrr = r_list->map->mtrr; - up(&dev->struct_sem); - - if (copy_to_user(argp, &map, sizeof(map))) return -EFAULT; - return 0; -} - -/** - * Get client information. - * - * \param inode device inode. - * \param filp file pointer. - * \param cmd command. - * \param arg user argument, pointing to a drm_client structure. - * - * \return zero on success or a negative number on failure. - * - * Searches for the client with the specified index and copies its information - * into userspace - */ -int DRM(getclient)( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_client_t __user *argp = (void __user *)arg; - drm_client_t client; - drm_file_t *pt; - int idx; - int i; - - if (copy_from_user(&client, argp, sizeof(client))) - return -EFAULT; - idx = client.idx; - down(&dev->struct_sem); - for (i = 0, pt = dev->file_first; i < idx && pt; i++, pt = pt->next) - ; - - if (!pt) { - up(&dev->struct_sem); - return -EINVAL; - } - client.auth = pt->authenticated; - client.pid = pt->pid; - client.uid = pt->uid; - client.magic = pt->magic; - client.iocs = pt->ioctl_count; - up(&dev->struct_sem); - - if (copy_to_user((drm_client_t __user *)arg, &client, sizeof(client))) - return -EFAULT; - return 0; -} - -/** - * Get statistics information. - * - * \param inode device inode. - * \param filp file pointer. - * \param cmd command. - * \param arg user argument, pointing to a drm_stats structure. - * - * \return zero on success or a negative number on failure. - */ -int DRM(getstats)( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_stats_t stats; - int i; - - memset(&stats, 0, sizeof(stats)); - - down(&dev->struct_sem); - - for (i = 0; i < dev->counters; i++) { - if (dev->types[i] == _DRM_STAT_LOCK) - stats.data[i].value - = (dev->lock.hw_lock - ? dev->lock.hw_lock->lock : 0); - else - stats.data[i].value = atomic_read(&dev->counts[i]); - stats.data[i].type = dev->types[i]; - } - - stats.count = dev->counters; - - up(&dev->struct_sem); - - if (copy_to_user((drm_stats_t __user *)arg, &stats, sizeof(stats))) - return -EFAULT; - return 0; -} - -#define DRM_IF_MAJOR 1 -#define DRM_IF_MINOR 2 - -int DRM(setversion)(DRM_IOCTL_ARGS) -{ - DRM_DEVICE; - drm_set_version_t sv; - drm_set_version_t retv; - int if_version; - drm_set_version_t __user *argp = (void __user *)data; - - DRM_COPY_FROM_USER_IOCTL(sv, argp, sizeof(sv)); - - retv.drm_di_major = DRM_IF_MAJOR; - retv.drm_di_minor = DRM_IF_MINOR; - retv.drm_dd_major = DRIVER_MAJOR; - retv.drm_dd_minor = DRIVER_MINOR; - - DRM_COPY_TO_USER_IOCTL(argp, retv, sizeof(sv)); - - if (sv.drm_di_major != -1) { - if (sv.drm_di_major != DRM_IF_MAJOR || - sv.drm_di_minor < 0 || sv.drm_di_minor > DRM_IF_MINOR) - return EINVAL; - if_version = DRM_IF_VERSION(sv.drm_di_major, sv.drm_dd_minor); - dev->if_version = DRM_MAX(if_version, dev->if_version); - if (sv.drm_di_minor >= 1) { - /* - * Version 1.1 includes tying of DRM to specific device - */ - DRM(set_busid)(dev); - } - } - - if (sv.drm_dd_major != -1) { - if (sv.drm_dd_major != DRIVER_MAJOR || - sv.drm_dd_minor < 0 || sv.drm_dd_minor > DRIVER_MINOR) - return EINVAL; - - if (dev->fn_tbl.set_version) - dev->fn_tbl.set_version(dev, &sv); - } - return 0; -} diff -Nru a/drivers/char/drm/drm_irq.c b/drivers/char/drm/drm_irq.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/char/drm/drm_irq.c 2005-01-02 23:03:34 -08:00 @@ -0,0 +1,370 @@ +/** + * \file drm_irq.h + * IRQ support + * + * \author Rickard E. (Rik) Faith + * \author Gareth Hughes + */ + +/* + * Created: Fri Mar 19 14:30:16 1999 by faith@valinux.com + * + * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "drmP.h" + +#include /* For task queue support */ + +/** + * Get interrupt from bus id. + * + * \param inode device inode. + * \param filp file pointer. + * \param cmd command. + * \param arg user argument, pointing to a drm_irq_busid structure. + * \return zero on success or a negative number on failure. + * + * Finds the PCI device with the specified bus id and gets its IRQ number. + * This IOCTL is deprecated, and will now return EINVAL for any busid not equal + * to that of the device that this DRM instance attached to. + */ +int drm_irq_by_busid(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_irq_busid_t __user *argp = (void __user *)arg; + drm_irq_busid_t p; + + if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) + return -EINVAL; + + if (copy_from_user(&p, argp, sizeof(p))) + return -EFAULT; + + if ((p.busnum >> 8) != dev->pci_domain || + (p.busnum & 0xff) != dev->pci_bus || + p.devnum != dev->pci_slot || + p.funcnum != dev->pci_func) + return -EINVAL; + + p.irq = dev->irq; + + DRM_DEBUG("%d:%d:%d => IRQ %d\n", + p.busnum, p.devnum, p.funcnum, p.irq); + if (copy_to_user(argp, &p, sizeof(p))) + return -EFAULT; + return 0; +} + +/** + * Install IRQ handler. + * + * \param dev DRM device. + * \param irq IRQ number. + * + * Initializes the IRQ related data, and setups drm_device::vbl_queue. Installs the handler, calling the driver + * \c drm_driver_irq_preinstall() and \c drm_driver_irq_postinstall() functions + * before and after the installation. + */ +int drm_irq_install( drm_device_t *dev ) +{ + int ret; + unsigned long sh_flags=0; + + if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) + return -EINVAL; + + if ( dev->irq == 0 ) + return -EINVAL; + + down( &dev->struct_sem ); + + /* Driver must have been initialized */ + if ( !dev->dev_private ) { + up( &dev->struct_sem ); + return -EINVAL; + } + + if ( dev->irq_enabled ) { + up( &dev->struct_sem ); + return -EBUSY; + } + dev->irq_enabled = 1; + up( &dev->struct_sem ); + + DRM_DEBUG( "%s: irq=%d\n", __FUNCTION__, dev->irq ); + + if (drm_core_check_feature(dev, DRIVER_IRQ_VBL)) { + init_waitqueue_head(&dev->vbl_queue); + + spin_lock_init( &dev->vbl_lock ); + + INIT_LIST_HEAD( &dev->vbl_sigs.head ); + + dev->vbl_pending = 0; + } + + /* Before installing handler */ + dev->driver->irq_preinstall(dev); + + /* Install handler */ + if (drm_core_check_feature(dev, DRIVER_IRQ_SHARED)) + sh_flags = SA_SHIRQ; + + ret = request_irq( dev->irq, dev->driver->irq_handler, + sh_flags, dev->devname, dev ); + if ( ret < 0 ) { + down( &dev->struct_sem ); + dev->irq_enabled = 0; + up( &dev->struct_sem ); + return ret; + } + + /* After installing handler */ + dev->driver->irq_postinstall(dev); + + return 0; +} + +/** + * Uninstall the IRQ handler. + * + * \param dev DRM device. + * + * Calls the driver's \c drm_driver_irq_uninstall() function, and stops the irq. + */ +int drm_irq_uninstall( drm_device_t *dev ) +{ + int irq_enabled; + + if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) + return -EINVAL; + + down( &dev->struct_sem ); + irq_enabled = dev->irq_enabled; + dev->irq_enabled = 0; + up( &dev->struct_sem ); + + if ( !irq_enabled ) + return -EINVAL; + + DRM_DEBUG( "%s: irq=%d\n", __FUNCTION__, dev->irq ); + + dev->driver->irq_uninstall(dev); + + free_irq( dev->irq, dev ); + + return 0; +} +EXPORT_SYMBOL(drm_irq_uninstall); + +/** + * IRQ control ioctl. + * + * \param inode device inode. + * \param filp file pointer. + * \param cmd command. + * \param arg user argument, pointing to a drm_control structure. + * \return zero on success or a negative number on failure. + * + * Calls irq_install() or irq_uninstall() according to \p arg. + */ +int drm_control( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_control_t ctl; + + /* if we haven't irq we fallback for compatibility reasons - this used to be a separate function in drm_dma.h */ + + if ( copy_from_user( &ctl, (drm_control_t __user *)arg, sizeof(ctl) ) ) + return -EFAULT; + + switch ( ctl.func ) { + case DRM_INST_HANDLER: + if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) + return 0; + if (dev->if_version < DRM_IF_VERSION(1, 2) && + ctl.irq != dev->irq) + return -EINVAL; + return drm_irq_install( dev ); + case DRM_UNINST_HANDLER: + if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) + return 0; + return drm_irq_uninstall( dev ); + default: + return -EINVAL; + } +} + +/** + * Wait for VBLANK. + * + * \param inode device inode. + * \param filp file pointer. + * \param cmd command. + * \param data user argument, pointing to a drm_wait_vblank structure. + * \return zero on success or a negative number on failure. + * + * Verifies the IRQ is installed. + * + * If a signal is requested checks if this task has already scheduled the same signal + * for the same vblank sequence number - nothing to be done in + * that case. If the number of tasks waiting for the interrupt exceeds 100 the + * function fails. Otherwise adds a new entry to drm_device::vbl_sigs for this + * task. + * + * If a signal is not requested, then calls vblank_wait(). + */ +int drm_wait_vblank( DRM_IOCTL_ARGS ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_wait_vblank_t __user *argp = (void __user *)data; + drm_wait_vblank_t vblwait; + struct timeval now; + int ret = 0; + unsigned int flags; + + if (!drm_core_check_feature(dev, DRIVER_IRQ_VBL)) + return -EINVAL; + + if (!dev->irq) + return -EINVAL; + + DRM_COPY_FROM_USER_IOCTL( vblwait, argp, sizeof(vblwait) ); + + switch ( vblwait.request.type & ~_DRM_VBLANK_FLAGS_MASK ) { + case _DRM_VBLANK_RELATIVE: + vblwait.request.sequence += atomic_read( &dev->vbl_received ); + vblwait.request.type &= ~_DRM_VBLANK_RELATIVE; + case _DRM_VBLANK_ABSOLUTE: + break; + default: + return -EINVAL; + } + + flags = vblwait.request.type & _DRM_VBLANK_FLAGS_MASK; + + if ( flags & _DRM_VBLANK_SIGNAL ) { + unsigned long irqflags; + drm_vbl_sig_t *vbl_sig; + + vblwait.reply.sequence = atomic_read( &dev->vbl_received ); + + spin_lock_irqsave( &dev->vbl_lock, irqflags ); + + /* Check if this task has already scheduled the same signal + * for the same vblank sequence number; nothing to be done in + * that case + */ + list_for_each_entry( vbl_sig, &dev->vbl_sigs.head, head ) { + if (vbl_sig->sequence == vblwait.request.sequence + && vbl_sig->info.si_signo == vblwait.request.signal + && vbl_sig->task == current) + { + spin_unlock_irqrestore( &dev->vbl_lock, irqflags ); + goto done; + } + } + + if ( dev->vbl_pending >= 100 ) { + spin_unlock_irqrestore( &dev->vbl_lock, irqflags ); + return -EBUSY; + } + + dev->vbl_pending++; + + spin_unlock_irqrestore( &dev->vbl_lock, irqflags ); + + if ( !( vbl_sig = drm_alloc( sizeof( drm_vbl_sig_t ), DRM_MEM_DRIVER ) ) ) { + return -ENOMEM; + } + + memset( (void *)vbl_sig, 0, sizeof(*vbl_sig) ); + + vbl_sig->sequence = vblwait.request.sequence; + vbl_sig->info.si_signo = vblwait.request.signal; + vbl_sig->task = current; + + spin_lock_irqsave( &dev->vbl_lock, irqflags ); + + list_add_tail( (struct list_head *) vbl_sig, &dev->vbl_sigs.head ); + + spin_unlock_irqrestore( &dev->vbl_lock, irqflags ); + } else { + if (dev->driver->vblank_wait) + ret = dev->driver->vblank_wait( dev, &vblwait.request.sequence ); + + do_gettimeofday( &now ); + vblwait.reply.tval_sec = now.tv_sec; + vblwait.reply.tval_usec = now.tv_usec; + } + +done: + DRM_COPY_TO_USER_IOCTL( argp, vblwait, sizeof(vblwait) ); + + return ret; +} + +/** + * Send the VBLANK signals. + * + * \param dev DRM device. + * + * Sends a signal for each task in drm_device::vbl_sigs and empties the list. + * + * If a signal is not requested, then calls vblank_wait(). + */ +void drm_vbl_send_signals( drm_device_t *dev ) +{ + struct list_head *list, *tmp; + drm_vbl_sig_t *vbl_sig; + unsigned int vbl_seq = atomic_read( &dev->vbl_received ); + unsigned long flags; + + spin_lock_irqsave( &dev->vbl_lock, flags ); + + list_for_each_safe( list, tmp, &dev->vbl_sigs.head ) { + vbl_sig = list_entry( list, drm_vbl_sig_t, head ); + if ( ( vbl_seq - vbl_sig->sequence ) <= (1<<23) ) { + vbl_sig->info.si_code = vbl_seq; + send_sig_info( vbl_sig->info.si_signo, &vbl_sig->info, vbl_sig->task ); + + list_del( list ); + + drm_free( vbl_sig, sizeof(*vbl_sig), DRM_MEM_DRIVER ); + + dev->vbl_pending--; + } + } + + spin_unlock_irqrestore( &dev->vbl_lock, flags ); +} +EXPORT_SYMBOL(drm_vbl_send_signals); + + diff -Nru a/drivers/char/drm/drm_irq.h b/drivers/char/drm/drm_irq.h --- a/drivers/char/drm/drm_irq.h 2005-01-02 23:03:34 -08:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,368 +0,0 @@ -/** - * \file drm_irq.h - * IRQ support - * - * \author Rickard E. (Rik) Faith - * \author Gareth Hughes - */ - -/* - * Created: Fri Mar 19 14:30:16 1999 by faith@valinux.com - * - * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -#include "drmP.h" - -#include /* For task queue support */ - -/** - * Get interrupt from bus id. - * - * \param inode device inode. - * \param filp file pointer. - * \param cmd command. - * \param arg user argument, pointing to a drm_irq_busid structure. - * \return zero on success or a negative number on failure. - * - * Finds the PCI device with the specified bus id and gets its IRQ number. - * This IOCTL is deprecated, and will now return EINVAL for any busid not equal - * to that of the device that this DRM instance attached to. - */ -int DRM(irq_by_busid)(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_irq_busid_t __user *argp = (void __user *)arg; - drm_irq_busid_t p; - - if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) - return -EINVAL; - - if (copy_from_user(&p, argp, sizeof(p))) - return -EFAULT; - - if ((p.busnum >> 8) != dev->pci_domain || - (p.busnum & 0xff) != dev->pci_bus || - p.devnum != dev->pci_slot || - p.funcnum != dev->pci_func) - return -EINVAL; - - p.irq = dev->irq; - - DRM_DEBUG("%d:%d:%d => IRQ %d\n", - p.busnum, p.devnum, p.funcnum, p.irq); - if (copy_to_user(argp, &p, sizeof(p))) - return -EFAULT; - return 0; -} - -/** - * Install IRQ handler. - * - * \param dev DRM device. - * \param irq IRQ number. - * - * Initializes the IRQ related data, and setups drm_device::vbl_queue. Installs the handler, calling the driver - * \c DRM(driver_irq_preinstall)() and \c DRM(driver_irq_postinstall)() functions - * before and after the installation. - */ -int DRM(irq_install)( drm_device_t *dev ) -{ - int ret; - unsigned long sh_flags=0; - - if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) - return -EINVAL; - - if ( dev->irq == 0 ) - return -EINVAL; - - down( &dev->struct_sem ); - - /* Driver must have been initialized */ - if ( !dev->dev_private ) { - up( &dev->struct_sem ); - return -EINVAL; - } - - if ( dev->irq_enabled ) { - up( &dev->struct_sem ); - return -EBUSY; - } - dev->irq_enabled = 1; - up( &dev->struct_sem ); - - DRM_DEBUG( "%s: irq=%d\n", __FUNCTION__, dev->irq ); - - if (drm_core_check_feature(dev, DRIVER_IRQ_VBL)) { - init_waitqueue_head(&dev->vbl_queue); - - spin_lock_init( &dev->vbl_lock ); - - INIT_LIST_HEAD( &dev->vbl_sigs.head ); - - dev->vbl_pending = 0; - } - - /* Before installing handler */ - dev->fn_tbl.irq_preinstall(dev); - - /* Install handler */ - if (drm_core_check_feature(dev, DRIVER_IRQ_SHARED)) - sh_flags = SA_SHIRQ; - - ret = request_irq( dev->irq, dev->fn_tbl.irq_handler, - sh_flags, dev->devname, dev ); - if ( ret < 0 ) { - down( &dev->struct_sem ); - dev->irq_enabled = 0; - up( &dev->struct_sem ); - return ret; - } - - /* After installing handler */ - dev->fn_tbl.irq_postinstall(dev); - - return 0; -} - -/** - * Uninstall the IRQ handler. - * - * \param dev DRM device. - * - * Calls the driver's \c DRM(driver_irq_uninstall)() function, and stops the irq. - */ -int DRM(irq_uninstall)( drm_device_t *dev ) -{ - int irq_enabled; - - if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) - return -EINVAL; - - down( &dev->struct_sem ); - irq_enabled = dev->irq_enabled; - dev->irq_enabled = 0; - up( &dev->struct_sem ); - - if ( !irq_enabled ) - return -EINVAL; - - DRM_DEBUG( "%s: irq=%d\n", __FUNCTION__, dev->irq ); - - dev->fn_tbl.irq_uninstall(dev); - - free_irq( dev->irq, dev ); - - return 0; -} - -/** - * IRQ control ioctl. - * - * \param inode device inode. - * \param filp file pointer. - * \param cmd command. - * \param arg user argument, pointing to a drm_control structure. - * \return zero on success or a negative number on failure. - * - * Calls irq_install() or irq_uninstall() according to \p arg. - */ -int DRM(control)( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_control_t ctl; - - /* if we haven't irq we fallback for compatibility reasons - this used to be a separate function in drm_dma.h */ - - if ( copy_from_user( &ctl, (drm_control_t __user *)arg, sizeof(ctl) ) ) - return -EFAULT; - - switch ( ctl.func ) { - case DRM_INST_HANDLER: - if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) - return 0; - if (dev->if_version < DRM_IF_VERSION(1, 2) && - ctl.irq != dev->irq) - return -EINVAL; - return DRM(irq_install)( dev ); - case DRM_UNINST_HANDLER: - if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) - return 0; - return DRM(irq_uninstall)( dev ); - default: - return -EINVAL; - } -} - -/** - * Wait for VBLANK. - * - * \param inode device inode. - * \param filp file pointer. - * \param cmd command. - * \param data user argument, pointing to a drm_wait_vblank structure. - * \return zero on success or a negative number on failure. - * - * Verifies the IRQ is installed. - * - * If a signal is requested checks if this task has already scheduled the same signal - * for the same vblank sequence number - nothing to be done in - * that case. If the number of tasks waiting for the interrupt exceeds 100 the - * function fails. Otherwise adds a new entry to drm_device::vbl_sigs for this - * task. - * - * If a signal is not requested, then calls vblank_wait(). - */ -int DRM(wait_vblank)( DRM_IOCTL_ARGS ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_wait_vblank_t __user *argp = (void __user *)data; - drm_wait_vblank_t vblwait; - struct timeval now; - int ret = 0; - unsigned int flags; - - if (!drm_core_check_feature(dev, DRIVER_IRQ_VBL)) - return -EINVAL; - - if (!dev->irq) - return -EINVAL; - - DRM_COPY_FROM_USER_IOCTL( vblwait, argp, sizeof(vblwait) ); - - switch ( vblwait.request.type & ~_DRM_VBLANK_FLAGS_MASK ) { - case _DRM_VBLANK_RELATIVE: - vblwait.request.sequence += atomic_read( &dev->vbl_received ); - vblwait.request.type &= ~_DRM_VBLANK_RELATIVE; - case _DRM_VBLANK_ABSOLUTE: - break; - default: - return -EINVAL; - } - - flags = vblwait.request.type & _DRM_VBLANK_FLAGS_MASK; - - if ( flags & _DRM_VBLANK_SIGNAL ) { - unsigned long irqflags; - drm_vbl_sig_t *vbl_sig; - - vblwait.reply.sequence = atomic_read( &dev->vbl_received ); - - spin_lock_irqsave( &dev->vbl_lock, irqflags ); - - /* Check if this task has already scheduled the same signal - * for the same vblank sequence number; nothing to be done in - * that case - */ - list_for_each_entry( vbl_sig, &dev->vbl_sigs.head, head ) { - if (vbl_sig->sequence == vblwait.request.sequence - && vbl_sig->info.si_signo == vblwait.request.signal - && vbl_sig->task == current) - { - spin_unlock_irqrestore( &dev->vbl_lock, irqflags ); - goto done; - } - } - - if ( dev->vbl_pending >= 100 ) { - spin_unlock_irqrestore( &dev->vbl_lock, irqflags ); - return -EBUSY; - } - - dev->vbl_pending++; - - spin_unlock_irqrestore( &dev->vbl_lock, irqflags ); - - if ( !( vbl_sig = DRM_MALLOC( sizeof( drm_vbl_sig_t ) ) ) ) { - return -ENOMEM; - } - - memset( (void *)vbl_sig, 0, sizeof(*vbl_sig) ); - - vbl_sig->sequence = vblwait.request.sequence; - vbl_sig->info.si_signo = vblwait.request.signal; - vbl_sig->task = current; - - spin_lock_irqsave( &dev->vbl_lock, irqflags ); - - list_add_tail( (struct list_head *) vbl_sig, &dev->vbl_sigs.head ); - - spin_unlock_irqrestore( &dev->vbl_lock, irqflags ); - } else { - if (dev->fn_tbl.vblank_wait) - ret = dev->fn_tbl.vblank_wait( dev, &vblwait.request.sequence ); - - do_gettimeofday( &now ); - vblwait.reply.tval_sec = now.tv_sec; - vblwait.reply.tval_usec = now.tv_usec; - } - -done: - DRM_COPY_TO_USER_IOCTL( argp, vblwait, sizeof(vblwait) ); - - return ret; -} - -/** - * Send the VBLANK signals. - * - * \param dev DRM device. - * - * Sends a signal for each task in drm_device::vbl_sigs and empties the list. - * - * If a signal is not requested, then calls vblank_wait(). - */ -void DRM(vbl_send_signals)( drm_device_t *dev ) -{ - struct list_head *list, *tmp; - drm_vbl_sig_t *vbl_sig; - unsigned int vbl_seq = atomic_read( &dev->vbl_received ); - unsigned long flags; - - spin_lock_irqsave( &dev->vbl_lock, flags ); - - list_for_each_safe( list, tmp, &dev->vbl_sigs.head ) { - vbl_sig = list_entry( list, drm_vbl_sig_t, head ); - if ( ( vbl_seq - vbl_sig->sequence ) <= (1<<23) ) { - vbl_sig->info.si_code = vbl_seq; - send_sig_info( vbl_sig->info.si_signo, &vbl_sig->info, vbl_sig->task ); - - list_del( list ); - - DRM_FREE( vbl_sig, sizeof(*vbl_sig) ); - - dev->vbl_pending--; - } - } - - spin_unlock_irqrestore( &dev->vbl_lock, flags ); -} - - diff -Nru a/drivers/char/drm/drm_lock.c b/drivers/char/drm/drm_lock.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/char/drm/drm_lock.c 2005-01-02 23:03:34 -08:00 @@ -0,0 +1,303 @@ +/** + * \file drm_lock.h + * IOCTLs for locking + * + * \author Rickard E. (Rik) Faith + * \author Gareth Hughes + */ + +/* + * Created: Tue Feb 2 08:37:54 1999 by faith@valinux.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "drmP.h" + +/** + * Lock ioctl. + * + * \param inode device inode. + * \param filp file pointer. + * \param cmd command. + * \param arg user argument, pointing to a drm_lock structure. + * \return zero on success or negative number on failure. + * + * Add the current task to the lock wait queue, and attempt to take to lock. + */ +int drm_lock( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + DECLARE_WAITQUEUE( entry, current ); + drm_lock_t lock; + int ret = 0; + + ++priv->lock_count; + + if ( copy_from_user( &lock, (drm_lock_t __user *)arg, sizeof(lock) ) ) + return -EFAULT; + + if ( lock.context == DRM_KERNEL_CONTEXT ) { + DRM_ERROR( "Process %d using kernel context %d\n", + current->pid, lock.context ); + return -EINVAL; + } + + DRM_DEBUG( "%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n", + lock.context, current->pid, + dev->lock.hw_lock->lock, lock.flags ); + + if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE)) + if ( lock.context < 0 ) + return -EINVAL; + + add_wait_queue( &dev->lock.lock_queue, &entry ); + for (;;) { + __set_current_state(TASK_INTERRUPTIBLE); + if ( !dev->lock.hw_lock ) { + /* Device has been unregistered */ + ret = -EINTR; + break; + } + if ( drm_lock_take( &dev->lock.hw_lock->lock, + lock.context ) ) { + dev->lock.filp = filp; + dev->lock.lock_time = jiffies; + atomic_inc( &dev->counts[_DRM_STAT_LOCKS] ); + break; /* Got lock */ + } + + /* Contention */ + schedule(); + if ( signal_pending( current ) ) { + ret = -ERESTARTSYS; + break; + } + } + __set_current_state(TASK_RUNNING); + remove_wait_queue( &dev->lock.lock_queue, &entry ); + + sigemptyset( &dev->sigmask ); + sigaddset( &dev->sigmask, SIGSTOP ); + sigaddset( &dev->sigmask, SIGTSTP ); + sigaddset( &dev->sigmask, SIGTTIN ); + sigaddset( &dev->sigmask, SIGTTOU ); + dev->sigdata.context = lock.context; + dev->sigdata.lock = dev->lock.hw_lock; + block_all_signals( drm_notifier, + &dev->sigdata, &dev->sigmask ); + + if (dev->driver->dma_ready && (lock.flags & _DRM_LOCK_READY)) + dev->driver->dma_ready(dev); + + if ( dev->driver->dma_quiescent && (lock.flags & _DRM_LOCK_QUIESCENT )) + return dev->driver->dma_quiescent(dev); + + /* dev->driver->kernel_context_switch isn't used by any of the x86 + * drivers but is used by the Sparc driver. + */ + + if (dev->driver->kernel_context_switch && + dev->last_context != lock.context) { + dev->driver->kernel_context_switch(dev, dev->last_context, + lock.context); + } + DRM_DEBUG( "%d %s\n", lock.context, ret ? "interrupted" : "has lock" ); + + return ret; +} + +/** + * Unlock ioctl. + * + * \param inode device inode. + * \param filp file pointer. + * \param cmd command. + * \param arg user argument, pointing to a drm_lock structure. + * \return zero on success or negative number on failure. + * + * Transfer and free the lock. + */ +int drm_unlock( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_lock_t lock; + + if ( copy_from_user( &lock, (drm_lock_t __user *)arg, sizeof(lock) ) ) + return -EFAULT; + + if ( lock.context == DRM_KERNEL_CONTEXT ) { + DRM_ERROR( "Process %d using kernel context %d\n", + current->pid, lock.context ); + return -EINVAL; + } + + atomic_inc( &dev->counts[_DRM_STAT_UNLOCKS] ); + + /* kernel_context_switch isn't used by any of the x86 drm + * modules but is required by the Sparc driver. + */ + if (dev->driver->kernel_context_switch_unlock) + dev->driver->kernel_context_switch_unlock(dev, &lock); + else { + drm_lock_transfer( dev, &dev->lock.hw_lock->lock, + DRM_KERNEL_CONTEXT ); + + if ( drm_lock_free( dev, &dev->lock.hw_lock->lock, + DRM_KERNEL_CONTEXT ) ) { + DRM_ERROR( "\n" ); + } + } + + unblock_all_signals(); + return 0; +} + +/** + * Take the heavyweight lock. + * + * \param lock lock pointer. + * \param context locking context. + * \return one if the lock is held, or zero otherwise. + * + * Attempt to mark the lock as held by the given context, via the \p cmpxchg instruction. + */ +int drm_lock_take(__volatile__ unsigned int *lock, unsigned int context) +{ + unsigned int old, new, prev; + + do { + old = *lock; + if (old & _DRM_LOCK_HELD) new = old | _DRM_LOCK_CONT; + else new = context | _DRM_LOCK_HELD; + prev = cmpxchg(lock, old, new); + } while (prev != old); + if (_DRM_LOCKING_CONTEXT(old) == context) { + if (old & _DRM_LOCK_HELD) { + if (context != DRM_KERNEL_CONTEXT) { + DRM_ERROR("%d holds heavyweight lock\n", + context); + } + return 0; + } + } + if (new == (context | _DRM_LOCK_HELD)) { + /* Have lock */ + return 1; + } + return 0; +} + +/** + * This takes a lock forcibly and hands it to context. Should ONLY be used + * inside *_unlock to give lock to kernel before calling *_dma_schedule. + * + * \param dev DRM device. + * \param lock lock pointer. + * \param context locking context. + * \return always one. + * + * Resets the lock file pointer. + * Marks the lock as held by the given context, via the \p cmpxchg instruction. + */ +int drm_lock_transfer(drm_device_t *dev, + __volatile__ unsigned int *lock, unsigned int context) +{ + unsigned int old, new, prev; + + dev->lock.filp = NULL; + do { + old = *lock; + new = context | _DRM_LOCK_HELD; + prev = cmpxchg(lock, old, new); + } while (prev != old); + return 1; +} + +/** + * Free lock. + * + * \param dev DRM device. + * \param lock lock. + * \param context context. + * + * Resets the lock file pointer. + * Marks the lock as not held, via the \p cmpxchg instruction. Wakes any task + * waiting on the lock queue. + */ +int drm_lock_free(drm_device_t *dev, + __volatile__ unsigned int *lock, unsigned int context) +{ + unsigned int old, new, prev; + + dev->lock.filp = NULL; + do { + old = *lock; + new = 0; + prev = cmpxchg(lock, old, new); + } while (prev != old); + if (_DRM_LOCK_IS_HELD(old) && _DRM_LOCKING_CONTEXT(old) != context) { + DRM_ERROR("%d freed heavyweight lock held by %d\n", + context, + _DRM_LOCKING_CONTEXT(old)); + return 1; + } + wake_up_interruptible(&dev->lock.lock_queue); + return 0; +} + +/** + * If we get here, it means that the process has called DRM_IOCTL_LOCK + * without calling DRM_IOCTL_UNLOCK. + * + * If the lock is not held, then let the signal proceed as usual. If the lock + * is held, then set the contended flag and keep the signal blocked. + * + * \param priv pointer to a drm_sigdata structure. + * \return one if the signal should be delivered normally, or zero if the + * signal should be blocked. + */ +int drm_notifier(void *priv) +{ + drm_sigdata_t *s = (drm_sigdata_t *)priv; + unsigned int old, new, prev; + + + /* Allow signal delivery if lock isn't held */ + if (!s->lock || !_DRM_LOCK_IS_HELD(s->lock->lock) + || _DRM_LOCKING_CONTEXT(s->lock->lock) != s->context) return 1; + + /* Otherwise, set flag to force call to + drmUnlock */ + do { + old = s->lock->lock; + new = old | _DRM_LOCK_CONT; + prev = cmpxchg(&s->lock->lock, old, new); + } while (prev != old); + return 0; +} diff -Nru a/drivers/char/drm/drm_lock.h b/drivers/char/drm/drm_lock.h --- a/drivers/char/drm/drm_lock.h 2005-01-02 23:03:34 -08:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,168 +0,0 @@ -/** - * \file drm_lock.h - * IOCTLs for locking - * - * \author Rickard E. (Rik) Faith - * \author Gareth Hughes - */ - -/* - * Created: Tue Feb 2 08:37:54 1999 by faith@valinux.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -#include "drmP.h" - -/** No-op ioctl. */ -int DRM(noop)(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - DRM_DEBUG("\n"); - return 0; -} - -/** - * Take the heavyweight lock. - * - * \param lock lock pointer. - * \param context locking context. - * \return one if the lock is held, or zero otherwise. - * - * Attempt to mark the lock as held by the given context, via the \p cmpxchg instruction. - */ -int DRM(lock_take)(__volatile__ unsigned int *lock, unsigned int context) -{ - unsigned int old, new, prev; - - do { - old = *lock; - if (old & _DRM_LOCK_HELD) new = old | _DRM_LOCK_CONT; - else new = context | _DRM_LOCK_HELD; - prev = cmpxchg(lock, old, new); - } while (prev != old); - if (_DRM_LOCKING_CONTEXT(old) == context) { - if (old & _DRM_LOCK_HELD) { - if (context != DRM_KERNEL_CONTEXT) { - DRM_ERROR("%d holds heavyweight lock\n", - context); - } - return 0; - } - } - if (new == (context | _DRM_LOCK_HELD)) { - /* Have lock */ - return 1; - } - return 0; -} - -/** - * This takes a lock forcibly and hands it to context. Should ONLY be used - * inside *_unlock to give lock to kernel before calling *_dma_schedule. - * - * \param dev DRM device. - * \param lock lock pointer. - * \param context locking context. - * \return always one. - * - * Resets the lock file pointer. - * Marks the lock as held by the given context, via the \p cmpxchg instruction. - */ -int DRM(lock_transfer)(drm_device_t *dev, - __volatile__ unsigned int *lock, unsigned int context) -{ - unsigned int old, new, prev; - - dev->lock.filp = NULL; - do { - old = *lock; - new = context | _DRM_LOCK_HELD; - prev = cmpxchg(lock, old, new); - } while (prev != old); - return 1; -} - -/** - * Free lock. - * - * \param dev DRM device. - * \param lock lock. - * \param context context. - * - * Resets the lock file pointer. - * Marks the lock as not held, via the \p cmpxchg instruction. Wakes any task - * waiting on the lock queue. - */ -int DRM(lock_free)(drm_device_t *dev, - __volatile__ unsigned int *lock, unsigned int context) -{ - unsigned int old, new, prev; - - dev->lock.filp = NULL; - do { - old = *lock; - new = 0; - prev = cmpxchg(lock, old, new); - } while (prev != old); - if (_DRM_LOCK_IS_HELD(old) && _DRM_LOCKING_CONTEXT(old) != context) { - DRM_ERROR("%d freed heavyweight lock held by %d\n", - context, - _DRM_LOCKING_CONTEXT(old)); - return 1; - } - wake_up_interruptible(&dev->lock.lock_queue); - return 0; -} - -/** - * If we get here, it means that the process has called DRM_IOCTL_LOCK - * without calling DRM_IOCTL_UNLOCK. - * - * If the lock is not held, then let the signal proceed as usual. If the lock - * is held, then set the contended flag and keep the signal blocked. - * - * \param priv pointer to a drm_sigdata structure. - * \return one if the signal should be delivered normally, or zero if the - * signal should be blocked. - */ -int DRM(notifier)(void *priv) -{ - drm_sigdata_t *s = (drm_sigdata_t *)priv; - unsigned int old, new, prev; - - - /* Allow signal delivery if lock isn't held */ - if (!s->lock || !_DRM_LOCK_IS_HELD(s->lock->lock) - || _DRM_LOCKING_CONTEXT(s->lock->lock) != s->context) return 1; - - /* Otherwise, set flag to force call to - drmUnlock */ - do { - old = s->lock->lock; - new = old | _DRM_LOCK_CONT; - prev = cmpxchg(&s->lock->lock, old, new); - } while (prev != old); - return 0; -} diff -Nru a/drivers/char/drm/drm_memory.c b/drivers/char/drm/drm_memory.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/char/drm/drm_memory.c 2005-01-02 23:03:35 -08:00 @@ -0,0 +1,181 @@ +/** + * \file drm_memory.h + * Memory management wrappers for DRM + * + * \author Rickard E. (Rik) Faith + * \author Gareth Hughes + */ + +/* + * Created: Thu Feb 4 14:00:34 1999 by faith@valinux.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include +#include +#include "drmP.h" + +#ifdef DEBUG_MEMORY +#include "drm_memory_debug.h" +#else + +/** No-op. */ +void drm_mem_init(void) +{ +} + +/** + * Called when "/proc/dri/%dev%/mem" is read. + * + * \param buf output buffer. + * \param start start of output data. + * \param offset requested start offset. + * \param len requested number of bytes. + * \param eof whether there is no more data to return. + * \param data private data. + * \return number of written bytes. + * + * No-op. + */ +int drm_mem_info(char *buf, char **start, off_t offset, + int len, int *eof, void *data) +{ + return 0; +} + +/** Wrapper around kmalloc() */ +void *drm_calloc(size_t nmemb, size_t size, int area) +{ + void *addr; + + addr = kmalloc(size * nmemb, GFP_KERNEL); + if (addr != NULL) + memset((void *)addr, 0, size * nmemb); + + return addr; +} +EXPORT_SYMBOL(drm_calloc); + +/** Wrapper around kmalloc() and kfree() */ +void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area) +{ + void *pt; + + if (!(pt = kmalloc(size, GFP_KERNEL))) return NULL; + if (oldpt && oldsize) { + memcpy(pt, oldpt, oldsize); + kfree(oldpt); + } + return pt; +} + +/** + * Allocate pages. + * + * \param order size order. + * \param area memory area. (Not used.) + * \return page address on success, or zero on failure. + * + * Allocate and reserve free pages. + */ +unsigned long drm_alloc_pages(int order, int area) +{ + unsigned long address; + unsigned long bytes = PAGE_SIZE << order; + unsigned long addr; + unsigned int sz; + + address = __get_free_pages(GFP_KERNEL, order); + if (!address) + return 0; + + /* Zero */ + memset((void *)address, 0, bytes); + + /* Reserve */ + for (addr = address, sz = bytes; + sz > 0; + addr += PAGE_SIZE, sz -= PAGE_SIZE) { + SetPageReserved(virt_to_page(addr)); + } + + return address; +} + +/** + * Free pages. + * + * \param address address of the pages to free. + * \param order size order. + * \param area memory area. (Not used.) + * + * Unreserve and free pages allocated by alloc_pages(). + */ +void drm_free_pages(unsigned long address, int order, int area) +{ + unsigned long bytes = PAGE_SIZE << order; + unsigned long addr; + unsigned int sz; + + if (!address) + return; + + /* Unreserve */ + for (addr = address, sz = bytes; + sz > 0; + addr += PAGE_SIZE, sz -= PAGE_SIZE) { + ClearPageReserved(virt_to_page(addr)); + } + + free_pages(address, order); +} + + +#if __OS_HAS_AGP +/** Wrapper around agp_allocate_memory() */ +DRM_AGP_MEM *drm_alloc_agp(int pages, u32 type) +{ + return drm_agp_allocate_memory(pages, type); +} + +/** Wrapper around agp_free_memory() */ +int drm_free_agp(DRM_AGP_MEM *handle, int pages) +{ + return drm_agp_free_memory(handle) ? 0 : -EINVAL; +} + +/** Wrapper around agp_bind_memory() */ +int drm_bind_agp(DRM_AGP_MEM *handle, unsigned int start) +{ + return drm_agp_bind_memory(handle, start); +} + +/** Wrapper around agp_unbind_memory() */ +int drm_unbind_agp(DRM_AGP_MEM *handle) +{ + return drm_agp_unbind_memory(handle); +} +#endif /* agp */ +#endif /* debug_memory */ diff -Nru a/drivers/char/drm/drm_memory.h b/drivers/char/drm/drm_memory.h --- a/drivers/char/drm/drm_memory.h 2005-01-02 23:03:33 -08:00 +++ b/drivers/char/drm/drm_memory.h 2005-01-02 23:03:33 -08:00 @@ -35,14 +35,13 @@ #include #include +#include #include "drmP.h" /** * Cut down version of drm_memory_debug.h, which used to be called - * drm_memory.h. If you want the debug functionality, change 0 to 1 - * below. + * drm_memory.h. */ -#define DEBUG_MEMORY 0 #if __OS_HAS_AGP @@ -125,7 +124,8 @@ drm_follow_page (void *vaddr) { pgd_t *pgd = pgd_offset_k((unsigned long) vaddr); - pmd_t *pmd = pmd_offset(pgd, (unsigned long) vaddr); + pud_t *pud = pud_offset(pgd, (unsigned long) vaddr); + pmd_t *pmd = pmd_offset(pud, (unsigned long) vaddr); pte_t *ptep = pte_offset_kernel(pmd, (unsigned long) vaddr); return pte_pfn(*ptep) << PAGE_SHIFT; } @@ -197,173 +197,3 @@ } -#if DEBUG_MEMORY -#include "drm_memory_debug.h" -#else - -/** No-op. */ -void DRM(mem_init)(void) -{ -} - -/** - * Called when "/proc/dri/%dev%/mem" is read. - * - * \param buf output buffer. - * \param start start of output data. - * \param offset requested start offset. - * \param len requested number of bytes. - * \param eof whether there is no more data to return. - * \param data private data. - * \return number of written bytes. - * - * No-op. - */ -int DRM(mem_info)(char *buf, char **start, off_t offset, - int len, int *eof, void *data) -{ - return 0; -} - -/** Wrapper around kmalloc() */ -void *DRM(alloc)(size_t size, int area) -{ - return kmalloc(size, GFP_KERNEL); -} - -/** Wrapper around kmalloc() */ -void *DRM(calloc)(size_t size, size_t nmemb, int area) -{ - void *addr; - - addr = kmalloc(size * nmemb, GFP_KERNEL); - if (addr != NULL) - memset((void *)addr, 0, size * nmemb); - - return addr; -} - -/** Wrapper around kmalloc() and kfree() */ -void *DRM(realloc)(void *oldpt, size_t oldsize, size_t size, int area) -{ - void *pt; - - if (!(pt = kmalloc(size, GFP_KERNEL))) return NULL; - if (oldpt && oldsize) { - memcpy(pt, oldpt, oldsize); - kfree(oldpt); - } - return pt; -} - -/** Wrapper around kfree() */ -void DRM(free)(void *pt, size_t size, int area) -{ - kfree(pt); -} - -/** - * Allocate pages. - * - * \param order size order. - * \param area memory area. (Not used.) - * \return page address on success, or zero on failure. - * - * Allocate and reserve free pages. - */ -unsigned long DRM(alloc_pages)(int order, int area) -{ - unsigned long address; - unsigned long bytes = PAGE_SIZE << order; - unsigned long addr; - unsigned int sz; - - address = __get_free_pages(GFP_KERNEL, order); - if (!address) - return 0; - - /* Zero */ - memset((void *)address, 0, bytes); - - /* Reserve */ - for (addr = address, sz = bytes; - sz > 0; - addr += PAGE_SIZE, sz -= PAGE_SIZE) { - SetPageReserved(virt_to_page(addr)); - } - - return address; -} - -/** - * Free pages. - * - * \param address address of the pages to free. - * \param order size order. - * \param area memory area. (Not used.) - * - * Unreserve and free pages allocated by alloc_pages(). - */ -void DRM(free_pages)(unsigned long address, int order, int area) -{ - unsigned long bytes = PAGE_SIZE << order; - unsigned long addr; - unsigned int sz; - - if (!address) - return; - - /* Unreserve */ - for (addr = address, sz = bytes; - sz > 0; - addr += PAGE_SIZE, sz -= PAGE_SIZE) { - ClearPageReserved(virt_to_page(addr)); - } - - free_pages(address, order); -} - -/** Wrapper around drm_ioremap() */ -void *DRM(ioremap)(unsigned long offset, unsigned long size, drm_device_t *dev) -{ - return drm_ioremap(offset, size, dev); -} - -/** Wrapper around drm_ioremap_nocache() */ -void *DRM(ioremap_nocache)(unsigned long offset, unsigned long size, drm_device_t *dev) -{ - return drm_ioremap_nocache(offset, size, dev); -} - -/** Wrapper around drm_iounmap() */ -void DRM(ioremapfree)(void *pt, unsigned long size, drm_device_t *dev) -{ - drm_ioremapfree(pt, size, dev); -} - -#if __OS_HAS_AGP -/** Wrapper around agp_allocate_memory() */ -DRM_AGP_MEM *DRM(alloc_agp)(int pages, u32 type) -{ - return DRM(agp_allocate_memory)(pages, type); -} - -/** Wrapper around agp_free_memory() */ -int DRM(free_agp)(DRM_AGP_MEM *handle, int pages) -{ - return DRM(agp_free_memory)(handle) ? 0 : -EINVAL; -} - -/** Wrapper around agp_bind_memory() */ -int DRM(bind_agp)(DRM_AGP_MEM *handle, unsigned int start) -{ - return DRM(agp_bind_memory)(handle, start); -} - -/** Wrapper around agp_unbind_memory() */ -int DRM(unbind_agp)(DRM_AGP_MEM *handle) -{ - return DRM(agp_unbind_memory)(handle); -} -#endif /* agp */ -#endif /* debug_memory */ diff -Nru a/drivers/char/drm/drm_memory_debug.h b/drivers/char/drm/drm_memory_debug.h --- a/drivers/char/drm/drm_memory_debug.h 2005-01-02 23:03:33 -08:00 +++ b/drivers/char/drm/drm_memory_debug.h 2005-01-02 23:03:33 -08:00 @@ -167,7 +167,7 @@ return pt; } -void *DRM(calloc)(size_t size, size_t nmemb, int area) +void *DRM(calloc)(size_t nmemb, size_t size, int area) { void *addr; diff -Nru a/drivers/char/drm/drm_os_linux.h b/drivers/char/drm/drm_os_linux.h --- a/drivers/char/drm/drm_os_linux.h 2005-01-02 23:03:35 -08:00 +++ b/drivers/char/drm/drm_os_linux.h 2005-01-02 23:03:35 -08:00 @@ -100,11 +100,6 @@ __put_user(val, uaddr) -/** 'malloc' without the overhead of DRM(alloc)() */ -#define DRM_MALLOC(x) kmalloc(x, GFP_KERNEL) -/** 'free' without the overhead of DRM(free)() */ -#define DRM_FREE(x,size) kfree(x) - #define DRM_GET_PRIV_WITH_RETURN(_priv, _filp) _priv = _filp->private_data /** diff -Nru a/drivers/char/drm/drm_proc.c b/drivers/char/drm/drm_proc.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/char/drm/drm_proc.c 2005-01-02 23:03:33 -08:00 @@ -0,0 +1,539 @@ +/** + * \file drm_proc.h + * /proc support for DRM + * + * \author Rickard E. (Rik) Faith + * \author Gareth Hughes + * + * \par Acknowledgements: + * Matthew J Sottek sent in a patch to fix + * the problem with the proc files not outputting all their information. + */ + +/* + * Created: Mon Jan 11 09:48:47 1999 by faith@valinux.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "drmP.h" + +static int drm_name_info(char *buf, char **start, off_t offset, + int request, int *eof, void *data); +static int drm_vm_info(char *buf, char **start, off_t offset, + int request, int *eof, void *data); +static int drm_clients_info(char *buf, char **start, off_t offset, + int request, int *eof, void *data); +static int drm_queues_info(char *buf, char **start, off_t offset, + int request, int *eof, void *data); +static int drm_bufs_info(char *buf, char **start, off_t offset, + int request, int *eof, void *data); +#if DRM_DEBUG_CODE +static int drm_vma_info(char *buf, char **start, off_t offset, + int request, int *eof, void *data); +#endif + +/** + * Proc file list. + */ +struct drm_proc_list { + const char *name; /**< file name */ + int (*f)(char *, char **, off_t, int, int *, void *); /**< proc callback*/ +} drm_proc_list[] = { + { "name", drm_name_info }, + { "mem", drm_mem_info }, + { "vm", drm_vm_info }, + { "clients", drm_clients_info }, + { "queues", drm_queues_info }, + { "bufs", drm_bufs_info }, +#if DRM_DEBUG_CODE + { "vma", drm_vma_info }, +#endif +}; +#define DRM_PROC_ENTRIES (sizeof(drm_proc_list)/sizeof(drm_proc_list[0])) + +/** + * Initialize the DRI proc filesystem for a device. + * + * \param dev DRM device. + * \param minor device minor number. + * \param root DRI proc dir entry. + * \param dev_root resulting DRI device proc dir entry. + * \return root entry pointer on success, or NULL on failure. + * + * Create the DRI proc root entry "/proc/dri", the device proc root entry + * "/proc/dri/%minor%/", and each entry in proc_list as + * "/proc/dri/%minor%/%name%". + */ +int drm_proc_init(drm_device_t *dev, int minor, + struct proc_dir_entry *root, + struct proc_dir_entry **dev_root) +{ + struct proc_dir_entry *ent; + int i, j; + char name[64]; + + sprintf(name, "%d", minor); + *dev_root = create_proc_entry(name, S_IFDIR, root); + if (!*dev_root) { + DRM_ERROR("Cannot create /proc/dri/%s\n", name); + return -1; + } + + for (i = 0; i < DRM_PROC_ENTRIES; i++) { + ent = create_proc_entry(drm_proc_list[i].name, + S_IFREG|S_IRUGO, *dev_root); + if (!ent) { + DRM_ERROR("Cannot create /proc/dri/%s/%s\n", + name, drm_proc_list[i].name); + for (j = 0; j < i; j++) + remove_proc_entry(drm_proc_list[i].name, + *dev_root); + remove_proc_entry(name, root); + return -1; + } + ent->read_proc = drm_proc_list[i].f; + ent->data = dev; + } + + return 0; +} + + +/** + * Cleanup the proc filesystem resources. + * + * \param minor device minor number. + * \param root DRI proc dir entry. + * \param dev_root DRI device proc dir entry. + * \return always zero. + * + * Remove all proc entries created by proc_init(). + */ +int drm_proc_cleanup(int minor, struct proc_dir_entry *root, + struct proc_dir_entry *dev_root) +{ + int i; + char name[64]; + + if (!root || !dev_root) return 0; + + for (i = 0; i < DRM_PROC_ENTRIES; i++) + remove_proc_entry(drm_proc_list[i].name, dev_root); + sprintf(name, "%d", minor); + remove_proc_entry(name, root); + + return 0; +} + +/** + * Called when "/proc/dri/.../name" is read. + * + * \param buf output buffer. + * \param start start of output data. + * \param offset requested start offset. + * \param request requested number of bytes. + * \param eof whether there is no more data to return. + * \param data private data. + * \return number of written bytes. + * + * Prints the device name together with the bus id if available. + */ +static int drm_name_info(char *buf, char **start, off_t offset, int request, + int *eof, void *data) +{ + drm_device_t *dev = (drm_device_t *)data; + int len = 0; + + if (offset > DRM_PROC_LIMIT) { + *eof = 1; + return 0; + } + + *start = &buf[offset]; + *eof = 0; + + if (dev->unique) { + DRM_PROC_PRINT("%s 0x%lx %s\n", + dev->driver->pci_driver.name, (long)old_encode_dev(dev->device), dev->unique); + } else { + DRM_PROC_PRINT("%s 0x%lx\n", dev->driver->pci_driver.name, (long)old_encode_dev(dev->device)); + } + + if (len > request + offset) return request; + *eof = 1; + return len - offset; +} + +/** + * Called when "/proc/dri/.../vm" is read. + * + * \param buf output buffer. + * \param start start of output data. + * \param offset requested start offset. + * \param request requested number of bytes. + * \param eof whether there is no more data to return. + * \param data private data. + * \return number of written bytes. + * + * Prints information about all mappings in drm_device::maplist. + */ +static int drm__vm_info(char *buf, char **start, off_t offset, int request, + int *eof, void *data) +{ + drm_device_t *dev = (drm_device_t *)data; + int len = 0; + drm_map_t *map; + drm_map_list_t *r_list; + struct list_head *list; + + /* Hardcoded from _DRM_FRAME_BUFFER, + _DRM_REGISTERS, _DRM_SHM, _DRM_AGP, and + _DRM_SCATTER_GATHER. */ + const char *types[] = { "FB", "REG", "SHM", "AGP", "SG" }; + const char *type; + int i; + + if (offset > DRM_PROC_LIMIT) { + *eof = 1; + return 0; + } + + *start = &buf[offset]; + *eof = 0; + + DRM_PROC_PRINT("slot offset size type flags " + "address mtrr\n\n"); + i = 0; + if (dev->maplist != NULL) list_for_each(list, &dev->maplist->head) { + r_list = list_entry(list, drm_map_list_t, head); + map = r_list->map; + if(!map) continue; + if (map->type < 0 || map->type > 4) type = "??"; + else type = types[map->type]; + DRM_PROC_PRINT("%4d 0x%08lx 0x%08lx %4.4s 0x%02x 0x%08lx ", + i, + map->offset, + map->size, + type, + map->flags, + (unsigned long)map->handle); + if (map->mtrr < 0) { + DRM_PROC_PRINT("none\n"); + } else { + DRM_PROC_PRINT("%4d\n", map->mtrr); + } + i++; + } + + if (len > request + offset) return request; + *eof = 1; + return len - offset; +} + +/** + * Simply calls _vm_info() while holding the drm_device::struct_sem lock. + */ +static int drm_vm_info(char *buf, char **start, off_t offset, int request, + int *eof, void *data) +{ + drm_device_t *dev = (drm_device_t *)data; + int ret; + + down(&dev->struct_sem); + ret = drm__vm_info(buf, start, offset, request, eof, data); + up(&dev->struct_sem); + return ret; +} + +/** + * Called when "/proc/dri/.../queues" is read. + * + * \param buf output buffer. + * \param start start of output data. + * \param offset requested start offset. + * \param request requested number of bytes. + * \param eof whether there is no more data to return. + * \param data private data. + * \return number of written bytes. + */ +static int drm__queues_info(char *buf, char **start, off_t offset, + int request, int *eof, void *data) +{ + drm_device_t *dev = (drm_device_t *)data; + int len = 0; + int i; + drm_queue_t *q; + + if (offset > DRM_PROC_LIMIT) { + *eof = 1; + return 0; + } + + *start = &buf[offset]; + *eof = 0; + + DRM_PROC_PRINT(" ctx/flags use fin" + " blk/rw/rwf wait flushed queued" + " locks\n\n"); + for (i = 0; i < dev->queue_count; i++) { + q = dev->queuelist[i]; + atomic_inc(&q->use_count); + DRM_PROC_PRINT_RET(atomic_dec(&q->use_count), + "%5d/0x%03x %5d %5d" + " %5d/%c%c/%c%c%c %5Zd\n", + i, + q->flags, + atomic_read(&q->use_count), + atomic_read(&q->finalization), + atomic_read(&q->block_count), + atomic_read(&q->block_read) ? 'r' : '-', + atomic_read(&q->block_write) ? 'w' : '-', + waitqueue_active(&q->read_queue) ? 'r':'-', + waitqueue_active(&q->write_queue) ? 'w':'-', + waitqueue_active(&q->flush_queue) ? 'f':'-', + DRM_BUFCOUNT(&q->waitlist)); + atomic_dec(&q->use_count); + } + + if (len > request + offset) return request; + *eof = 1; + return len - offset; +} + +/** + * Simply calls _queues_info() while holding the drm_device::struct_sem lock. + */ +static int drm_queues_info(char *buf, char **start, off_t offset, int request, + int *eof, void *data) +{ + drm_device_t *dev = (drm_device_t *)data; + int ret; + + down(&dev->struct_sem); + ret = drm__queues_info(buf, start, offset, request, eof, data); + up(&dev->struct_sem); + return ret; +} + +/** + * Called when "/proc/dri/.../bufs" is read. + * + * \param buf output buffer. + * \param start start of output data. + * \param offset requested start offset. + * \param request requested number of bytes. + * \param eof whether there is no more data to return. + * \param data private data. + * \return number of written bytes. + */ +static int drm__bufs_info(char *buf, char **start, off_t offset, int request, + int *eof, void *data) +{ + drm_device_t *dev = (drm_device_t *)data; + int len = 0; + drm_device_dma_t *dma = dev->dma; + int i; + + if (!dma || offset > DRM_PROC_LIMIT) { + *eof = 1; + return 0; + } + + *start = &buf[offset]; + *eof = 0; + + DRM_PROC_PRINT(" o size count free segs pages kB\n\n"); + for (i = 0; i <= DRM_MAX_ORDER; i++) { + if (dma->bufs[i].buf_count) + DRM_PROC_PRINT("%2d %8d %5d %5d %5d %5d %5ld\n", + i, + dma->bufs[i].buf_size, + dma->bufs[i].buf_count, + atomic_read(&dma->bufs[i] + .freelist.count), + dma->bufs[i].seg_count, + dma->bufs[i].seg_count + *(1 << dma->bufs[i].page_order), + (dma->bufs[i].seg_count + * (1 << dma->bufs[i].page_order)) + * PAGE_SIZE / 1024); + } + DRM_PROC_PRINT("\n"); + for (i = 0; i < dma->buf_count; i++) { + if (i && !(i%32)) DRM_PROC_PRINT("\n"); + DRM_PROC_PRINT(" %d", dma->buflist[i]->list); + } + DRM_PROC_PRINT("\n"); + + if (len > request + offset) return request; + *eof = 1; + return len - offset; +} + +/** + * Simply calls _bufs_info() while holding the drm_device::struct_sem lock. + */ +static int drm_bufs_info(char *buf, char **start, off_t offset, int request, + int *eof, void *data) +{ + drm_device_t *dev = (drm_device_t *)data; + int ret; + + down(&dev->struct_sem); + ret = drm__bufs_info(buf, start, offset, request, eof, data); + up(&dev->struct_sem); + return ret; +} + +/** + * Called when "/proc/dri/.../clients" is read. + * + * \param buf output buffer. + * \param start start of output data. + * \param offset requested start offset. + * \param request requested number of bytes. + * \param eof whether there is no more data to return. + * \param data private data. + * \return number of written bytes. + */ +static int drm__clients_info(char *buf, char **start, off_t offset, + int request, int *eof, void *data) +{ + drm_device_t *dev = (drm_device_t *)data; + int len = 0; + drm_file_t *priv; + + if (offset > DRM_PROC_LIMIT) { + *eof = 1; + return 0; + } + + *start = &buf[offset]; + *eof = 0; + + DRM_PROC_PRINT("a dev pid uid magic ioctls\n\n"); + for (priv = dev->file_first; priv; priv = priv->next) { + DRM_PROC_PRINT("%c %3d %5d %5d %10u %10lu\n", + priv->authenticated ? 'y' : 'n', + priv->minor, + priv->pid, + priv->uid, + priv->magic, + priv->ioctl_count); + } + + if (len > request + offset) return request; + *eof = 1; + return len - offset; +} + +/** + * Simply calls _clients_info() while holding the drm_device::struct_sem lock. + */ +static int drm_clients_info(char *buf, char **start, off_t offset, + int request, int *eof, void *data) +{ + drm_device_t *dev = (drm_device_t *)data; + int ret; + + down(&dev->struct_sem); + ret = drm__clients_info(buf, start, offset, request, eof, data); + up(&dev->struct_sem); + return ret; +} + +#if DRM_DEBUG_CODE + +static int drm__vma_info(char *buf, char **start, off_t offset, int request, + int *eof, void *data) +{ + drm_device_t *dev = (drm_device_t *)data; + int len = 0; + drm_vma_entry_t *pt; + struct vm_area_struct *vma; +#if defined(__i386__) + unsigned int pgprot; +#endif + + if (offset > DRM_PROC_LIMIT) { + *eof = 1; + return 0; + } + + *start = &buf[offset]; + *eof = 0; + + DRM_PROC_PRINT("vma use count: %d, high_memory = %p, 0x%08lx\n", + atomic_read(&dev->vma_count), + high_memory, virt_to_phys(high_memory)); + for (pt = dev->vmalist; pt; pt = pt->next) { + if (!(vma = pt->vma)) continue; + DRM_PROC_PRINT("\n%5d 0x%08lx-0x%08lx %c%c%c%c%c%c 0x%08lx", + pt->pid, + vma->vm_start, + vma->vm_end, + vma->vm_flags & VM_READ ? 'r' : '-', + vma->vm_flags & VM_WRITE ? 'w' : '-', + vma->vm_flags & VM_EXEC ? 'x' : '-', + vma->vm_flags & VM_MAYSHARE ? 's' : 'p', + vma->vm_flags & VM_LOCKED ? 'l' : '-', + vma->vm_flags & VM_IO ? 'i' : '-', + VM_OFFSET(vma)); + +#if defined(__i386__) + pgprot = pgprot_val(vma->vm_page_prot); + DRM_PROC_PRINT(" %c%c%c%c%c%c%c%c%c", + pgprot & _PAGE_PRESENT ? 'p' : '-', + pgprot & _PAGE_RW ? 'w' : 'r', + pgprot & _PAGE_USER ? 'u' : 's', + pgprot & _PAGE_PWT ? 't' : 'b', + pgprot & _PAGE_PCD ? 'u' : 'c', + pgprot & _PAGE_ACCESSED ? 'a' : '-', + pgprot & _PAGE_DIRTY ? 'd' : '-', + pgprot & _PAGE_PSE ? 'm' : 'k', + pgprot & _PAGE_GLOBAL ? 'g' : 'l' ); +#endif + DRM_PROC_PRINT("\n"); + } + + if (len > request + offset) return request; + *eof = 1; + return len - offset; +} + +static int drm_vma_info(char *buf, char **start, off_t offset, int request, + int *eof, void *data) +{ + drm_device_t *dev = (drm_device_t *)data; + int ret; + + down(&dev->struct_sem); + ret = drm__vma_info(buf, start, offset, request, eof, data); + up(&dev->struct_sem); + return ret; +} +#endif + + diff -Nru a/drivers/char/drm/drm_proc.h b/drivers/char/drm/drm_proc.h --- a/drivers/char/drm/drm_proc.h 2005-01-02 23:03:33 -08:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,547 +0,0 @@ -/** - * \file drm_proc.h - * /proc support for DRM - * - * \author Rickard E. (Rik) Faith - * \author Gareth Hughes - * - * \par Acknowledgements: - * Matthew J Sottek sent in a patch to fix - * the problem with the proc files not outputting all their information. - */ - -/* - * Created: Mon Jan 11 09:48:47 1999 by faith@valinux.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -#include "drmP.h" - -static int DRM(name_info)(char *buf, char **start, off_t offset, - int request, int *eof, void *data); -static int DRM(vm_info)(char *buf, char **start, off_t offset, - int request, int *eof, void *data); -static int DRM(clients_info)(char *buf, char **start, off_t offset, - int request, int *eof, void *data); -static int DRM(queues_info)(char *buf, char **start, off_t offset, - int request, int *eof, void *data); -static int DRM(bufs_info)(char *buf, char **start, off_t offset, - int request, int *eof, void *data); -#if DRM_DEBUG_CODE -static int DRM(vma_info)(char *buf, char **start, off_t offset, - int request, int *eof, void *data); -#endif - -/** - * Proc file list. - */ -struct drm_proc_list { - const char *name; /**< file name */ - int (*f)(char *, char **, off_t, int, int *, void *); /**< proc callback*/ -} DRM(proc_list)[] = { - { "name", DRM(name_info) }, - { "mem", DRM(mem_info) }, - { "vm", DRM(vm_info) }, - { "clients", DRM(clients_info) }, - { "queues", DRM(queues_info) }, - { "bufs", DRM(bufs_info) }, -#if DRM_DEBUG_CODE - { "vma", DRM(vma_info) }, -#endif -}; -#define DRM_PROC_ENTRIES (sizeof(DRM(proc_list))/sizeof(DRM(proc_list)[0])) - -/** - * Initialize the DRI proc filesystem for a device. - * - * \param dev DRM device. - * \param minor device minor number. - * \param root DRI proc dir entry. - * \param dev_root resulting DRI device proc dir entry. - * \return root entry pointer on success, or NULL on failure. - * - * Create the DRI proc root entry "/proc/dri", the device proc root entry - * "/proc/dri/%minor%/", and each entry in proc_list as - * "/proc/dri/%minor%/%name%". - */ -struct proc_dir_entry *DRM(proc_init)(drm_device_t *dev, int minor, - struct proc_dir_entry *root, - struct proc_dir_entry **dev_root) -{ - struct proc_dir_entry *ent; - int i, j; - char name[64]; - - if (!minor) root = create_proc_entry("dri", S_IFDIR, NULL); - if (!root) { - DRM_ERROR("Cannot create /proc/dri\n"); - return NULL; - } - - sprintf(name, "%d", minor); - *dev_root = create_proc_entry(name, S_IFDIR, root); - if (!*dev_root) { - DRM_ERROR("Cannot create /proc/dri/%s\n", name); - return NULL; - } - - for (i = 0; i < DRM_PROC_ENTRIES; i++) { - ent = create_proc_entry(DRM(proc_list)[i].name, - S_IFREG|S_IRUGO, *dev_root); - if (!ent) { - DRM_ERROR("Cannot create /proc/dri/%s/%s\n", - name, DRM(proc_list)[i].name); - for (j = 0; j < i; j++) - remove_proc_entry(DRM(proc_list)[i].name, - *dev_root); - remove_proc_entry(name, root); - if (!minor) remove_proc_entry("dri", NULL); - return NULL; - } - ent->read_proc = DRM(proc_list)[i].f; - ent->data = dev; - } - - return root; -} - - -/** - * Cleanup the proc filesystem resources. - * - * \param minor device minor number. - * \param root DRI proc dir entry. - * \param dev_root DRI device proc dir entry. - * \return always zero. - * - * Remove all proc entries created by proc_init(). - */ -int DRM(proc_cleanup)(int minor, struct proc_dir_entry *root, - struct proc_dir_entry *dev_root) -{ - int i; - char name[64]; - - if (!root || !dev_root) return 0; - - for (i = 0; i < DRM_PROC_ENTRIES; i++) - remove_proc_entry(DRM(proc_list)[i].name, dev_root); - sprintf(name, "%d", minor); - remove_proc_entry(name, root); - if (!minor) remove_proc_entry("dri", NULL); - - return 0; -} - -/** - * Called when "/proc/dri/.../name" is read. - * - * \param buf output buffer. - * \param start start of output data. - * \param offset requested start offset. - * \param request requested number of bytes. - * \param eof whether there is no more data to return. - * \param data private data. - * \return number of written bytes. - * - * Prints the device name together with the bus id if available. - */ -static int DRM(name_info)(char *buf, char **start, off_t offset, int request, - int *eof, void *data) -{ - drm_device_t *dev = (drm_device_t *)data; - int len = 0; - - if (offset > DRM_PROC_LIMIT) { - *eof = 1; - return 0; - } - - *start = &buf[offset]; - *eof = 0; - - if (dev->unique) { - DRM_PROC_PRINT("%s 0x%lx %s\n", - dev->name, (long)old_encode_dev(dev->device), dev->unique); - } else { - DRM_PROC_PRINT("%s 0x%lx\n", dev->name, (long)old_encode_dev(dev->device)); - } - - if (len > request + offset) return request; - *eof = 1; - return len - offset; -} - -/** - * Called when "/proc/dri/.../vm" is read. - * - * \param buf output buffer. - * \param start start of output data. - * \param offset requested start offset. - * \param request requested number of bytes. - * \param eof whether there is no more data to return. - * \param data private data. - * \return number of written bytes. - * - * Prints information about all mappings in drm_device::maplist. - */ -static int DRM(_vm_info)(char *buf, char **start, off_t offset, int request, - int *eof, void *data) -{ - drm_device_t *dev = (drm_device_t *)data; - int len = 0; - drm_map_t *map; - drm_map_list_t *r_list; - struct list_head *list; - - /* Hardcoded from _DRM_FRAME_BUFFER, - _DRM_REGISTERS, _DRM_SHM, _DRM_AGP, and - _DRM_SCATTER_GATHER. */ - const char *types[] = { "FB", "REG", "SHM", "AGP", "SG" }; - const char *type; - int i; - - if (offset > DRM_PROC_LIMIT) { - *eof = 1; - return 0; - } - - *start = &buf[offset]; - *eof = 0; - - DRM_PROC_PRINT("slot offset size type flags " - "address mtrr\n\n"); - i = 0; - if (dev->maplist != NULL) list_for_each(list, &dev->maplist->head) { - r_list = list_entry(list, drm_map_list_t, head); - map = r_list->map; - if(!map) continue; - if (map->type < 0 || map->type > 4) type = "??"; - else type = types[map->type]; - DRM_PROC_PRINT("%4d 0x%08lx 0x%08lx %4.4s 0x%02x 0x%08lx ", - i, - map->offset, - map->size, - type, - map->flags, - (unsigned long)map->handle); - if (map->mtrr < 0) { - DRM_PROC_PRINT("none\n"); - } else { - DRM_PROC_PRINT("%4d\n", map->mtrr); - } - i++; - } - - if (len > request + offset) return request; - *eof = 1; - return len - offset; -} - -/** - * Simply calls _vm_info() while holding the drm_device::struct_sem lock. - */ -static int DRM(vm_info)(char *buf, char **start, off_t offset, int request, - int *eof, void *data) -{ - drm_device_t *dev = (drm_device_t *)data; - int ret; - - down(&dev->struct_sem); - ret = DRM(_vm_info)(buf, start, offset, request, eof, data); - up(&dev->struct_sem); - return ret; -} - -/** - * Called when "/proc/dri/.../queues" is read. - * - * \param buf output buffer. - * \param start start of output data. - * \param offset requested start offset. - * \param request requested number of bytes. - * \param eof whether there is no more data to return. - * \param data private data. - * \return number of written bytes. - */ -static int DRM(_queues_info)(char *buf, char **start, off_t offset, - int request, int *eof, void *data) -{ - drm_device_t *dev = (drm_device_t *)data; - int len = 0; - int i; - drm_queue_t *q; - - if (offset > DRM_PROC_LIMIT) { - *eof = 1; - return 0; - } - - *start = &buf[offset]; - *eof = 0; - - DRM_PROC_PRINT(" ctx/flags use fin" - " blk/rw/rwf wait flushed queued" - " locks\n\n"); - for (i = 0; i < dev->queue_count; i++) { - q = dev->queuelist[i]; - atomic_inc(&q->use_count); - DRM_PROC_PRINT_RET(atomic_dec(&q->use_count), - "%5d/0x%03x %5d %5d" - " %5d/%c%c/%c%c%c %5Zd\n", - i, - q->flags, - atomic_read(&q->use_count), - atomic_read(&q->finalization), - atomic_read(&q->block_count), - atomic_read(&q->block_read) ? 'r' : '-', - atomic_read(&q->block_write) ? 'w' : '-', - waitqueue_active(&q->read_queue) ? 'r':'-', - waitqueue_active(&q->write_queue) ? 'w':'-', - waitqueue_active(&q->flush_queue) ? 'f':'-', - DRM_BUFCOUNT(&q->waitlist)); - atomic_dec(&q->use_count); - } - - if (len > request + offset) return request; - *eof = 1; - return len - offset; -} - -/** - * Simply calls _queues_info() while holding the drm_device::struct_sem lock. - */ -static int DRM(queues_info)(char *buf, char **start, off_t offset, int request, - int *eof, void *data) -{ - drm_device_t *dev = (drm_device_t *)data; - int ret; - - down(&dev->struct_sem); - ret = DRM(_queues_info)(buf, start, offset, request, eof, data); - up(&dev->struct_sem); - return ret; -} - -/** - * Called when "/proc/dri/.../bufs" is read. - * - * \param buf output buffer. - * \param start start of output data. - * \param offset requested start offset. - * \param request requested number of bytes. - * \param eof whether there is no more data to return. - * \param data private data. - * \return number of written bytes. - */ -static int DRM(_bufs_info)(char *buf, char **start, off_t offset, int request, - int *eof, void *data) -{ - drm_device_t *dev = (drm_device_t *)data; - int len = 0; - drm_device_dma_t *dma = dev->dma; - int i; - - if (!dma || offset > DRM_PROC_LIMIT) { - *eof = 1; - return 0; - } - - *start = &buf[offset]; - *eof = 0; - - DRM_PROC_PRINT(" o size count free segs pages kB\n\n"); - for (i = 0; i <= DRM_MAX_ORDER; i++) { - if (dma->bufs[i].buf_count) - DRM_PROC_PRINT("%2d %8d %5d %5d %5d %5d %5ld\n", - i, - dma->bufs[i].buf_size, - dma->bufs[i].buf_count, - atomic_read(&dma->bufs[i] - .freelist.count), - dma->bufs[i].seg_count, - dma->bufs[i].seg_count - *(1 << dma->bufs[i].page_order), - (dma->bufs[i].seg_count - * (1 << dma->bufs[i].page_order)) - * PAGE_SIZE / 1024); - } - DRM_PROC_PRINT("\n"); - for (i = 0; i < dma->buf_count; i++) { - if (i && !(i%32)) DRM_PROC_PRINT("\n"); - DRM_PROC_PRINT(" %d", dma->buflist[i]->list); - } - DRM_PROC_PRINT("\n"); - - if (len > request + offset) return request; - *eof = 1; - return len - offset; -} - -/** - * Simply calls _bufs_info() while holding the drm_device::struct_sem lock. - */ -static int DRM(bufs_info)(char *buf, char **start, off_t offset, int request, - int *eof, void *data) -{ - drm_device_t *dev = (drm_device_t *)data; - int ret; - - down(&dev->struct_sem); - ret = DRM(_bufs_info)(buf, start, offset, request, eof, data); - up(&dev->struct_sem); - return ret; -} - -/** - * Called when "/proc/dri/.../clients" is read. - * - * \param buf output buffer. - * \param start start of output data. - * \param offset requested start offset. - * \param request requested number of bytes. - * \param eof whether there is no more data to return. - * \param data private data. - * \return number of written bytes. - */ -static int DRM(_clients_info)(char *buf, char **start, off_t offset, - int request, int *eof, void *data) -{ - drm_device_t *dev = (drm_device_t *)data; - int len = 0; - drm_file_t *priv; - - if (offset > DRM_PROC_LIMIT) { - *eof = 1; - return 0; - } - - *start = &buf[offset]; - *eof = 0; - - DRM_PROC_PRINT("a dev pid uid magic ioctls\n\n"); - for (priv = dev->file_first; priv; priv = priv->next) { - DRM_PROC_PRINT("%c %3d %5d %5d %10u %10lu\n", - priv->authenticated ? 'y' : 'n', - priv->minor, - priv->pid, - priv->uid, - priv->magic, - priv->ioctl_count); - } - - if (len > request + offset) return request; - *eof = 1; - return len - offset; -} - -/** - * Simply calls _clients_info() while holding the drm_device::struct_sem lock. - */ -static int DRM(clients_info)(char *buf, char **start, off_t offset, - int request, int *eof, void *data) -{ - drm_device_t *dev = (drm_device_t *)data; - int ret; - - down(&dev->struct_sem); - ret = DRM(_clients_info)(buf, start, offset, request, eof, data); - up(&dev->struct_sem); - return ret; -} - -#if DRM_DEBUG_CODE - -static int DRM(_vma_info)(char *buf, char **start, off_t offset, int request, - int *eof, void *data) -{ - drm_device_t *dev = (drm_device_t *)data; - int len = 0; - drm_vma_entry_t *pt; - struct vm_area_struct *vma; -#if defined(__i386__) - unsigned int pgprot; -#endif - - if (offset > DRM_PROC_LIMIT) { - *eof = 1; - return 0; - } - - *start = &buf[offset]; - *eof = 0; - - DRM_PROC_PRINT("vma use count: %d, high_memory = %p, 0x%08lx\n", - atomic_read(&dev->vma_count), - high_memory, virt_to_phys(high_memory)); - for (pt = dev->vmalist; pt; pt = pt->next) { - if (!(vma = pt->vma)) continue; - DRM_PROC_PRINT("\n%5d 0x%08lx-0x%08lx %c%c%c%c%c%c 0x%08lx", - pt->pid, - vma->vm_start, - vma->vm_end, - vma->vm_flags & VM_READ ? 'r' : '-', - vma->vm_flags & VM_WRITE ? 'w' : '-', - vma->vm_flags & VM_EXEC ? 'x' : '-', - vma->vm_flags & VM_MAYSHARE ? 's' : 'p', - vma->vm_flags & VM_LOCKED ? 'l' : '-', - vma->vm_flags & VM_IO ? 'i' : '-', - VM_OFFSET(vma)); - -#if defined(__i386__) - pgprot = pgprot_val(vma->vm_page_prot); - DRM_PROC_PRINT(" %c%c%c%c%c%c%c%c%c", - pgprot & _PAGE_PRESENT ? 'p' : '-', - pgprot & _PAGE_RW ? 'w' : 'r', - pgprot & _PAGE_USER ? 'u' : 's', - pgprot & _PAGE_PWT ? 't' : 'b', - pgprot & _PAGE_PCD ? 'u' : 'c', - pgprot & _PAGE_ACCESSED ? 'a' : '-', - pgprot & _PAGE_DIRTY ? 'd' : '-', - pgprot & _PAGE_PSE ? 'm' : 'k', - pgprot & _PAGE_GLOBAL ? 'g' : 'l' ); -#endif - DRM_PROC_PRINT("\n"); - } - - if (len > request + offset) return request; - *eof = 1; - return len - offset; -} - -static int DRM(vma_info)(char *buf, char **start, off_t offset, int request, - int *eof, void *data) -{ - drm_device_t *dev = (drm_device_t *)data; - int ret; - - down(&dev->struct_sem); - ret = DRM(_vma_info)(buf, start, offset, request, eof, data); - up(&dev->struct_sem); - return ret; -} -#endif - - diff -Nru a/drivers/char/drm/drm_scatter.c b/drivers/char/drm/drm_scatter.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/char/drm/drm_scatter.c 2005-01-02 23:03:34 -08:00 @@ -0,0 +1,231 @@ +/** + * \file drm_scatter.h + * IOCTLs to manage scatter/gather memory + * + * \author Gareth Hughes + */ + +/* + * Created: Mon Dec 18 23:20:54 2000 by gareth@valinux.com + * + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include +#include +#include "drmP.h" + +#define DEBUG_SCATTER 0 + +void drm_sg_cleanup( drm_sg_mem_t *entry ) +{ + struct page *page; + int i; + + for ( i = 0 ; i < entry->pages ; i++ ) { + page = entry->pagelist[i]; + if ( page ) + ClearPageReserved( page ); + } + + vfree( entry->virtual ); + + drm_free( entry->busaddr, + entry->pages * sizeof(*entry->busaddr), + DRM_MEM_PAGES ); + drm_free( entry->pagelist, + entry->pages * sizeof(*entry->pagelist), + DRM_MEM_PAGES ); + drm_free( entry, + sizeof(*entry), + DRM_MEM_SGLISTS ); +} + +int drm_sg_alloc( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_scatter_gather_t __user *argp = (void __user *)arg; + drm_scatter_gather_t request; + drm_sg_mem_t *entry; + unsigned long pages, i, j; + + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + if (!drm_core_check_feature(dev, DRIVER_SG)) + return -EINVAL; + + if ( dev->sg ) + return -EINVAL; + + if ( copy_from_user( &request, argp, sizeof(request) ) ) + return -EFAULT; + + entry = drm_alloc( sizeof(*entry), DRM_MEM_SGLISTS ); + if ( !entry ) + return -ENOMEM; + + memset( entry, 0, sizeof(*entry) ); + + pages = (request.size + PAGE_SIZE - 1) / PAGE_SIZE; + DRM_DEBUG( "sg size=%ld pages=%ld\n", request.size, pages ); + + entry->pages = pages; + entry->pagelist = drm_alloc( pages * sizeof(*entry->pagelist), + DRM_MEM_PAGES ); + if ( !entry->pagelist ) { + drm_free( entry, sizeof(*entry), DRM_MEM_SGLISTS ); + return -ENOMEM; + } + + memset(entry->pagelist, 0, pages * sizeof(*entry->pagelist)); + + entry->busaddr = drm_alloc( pages * sizeof(*entry->busaddr), + DRM_MEM_PAGES ); + if ( !entry->busaddr ) { + drm_free( entry->pagelist, + entry->pages * sizeof(*entry->pagelist), + DRM_MEM_PAGES ); + drm_free( entry, + sizeof(*entry), + DRM_MEM_SGLISTS ); + return -ENOMEM; + } + memset( (void *)entry->busaddr, 0, pages * sizeof(*entry->busaddr) ); + + entry->virtual = vmalloc_32( pages << PAGE_SHIFT ); + if ( !entry->virtual ) { + drm_free( entry->busaddr, + entry->pages * sizeof(*entry->busaddr), + DRM_MEM_PAGES ); + drm_free( entry->pagelist, + entry->pages * sizeof(*entry->pagelist), + DRM_MEM_PAGES ); + drm_free( entry, + sizeof(*entry), + DRM_MEM_SGLISTS ); + return -ENOMEM; + } + + /* This also forces the mapping of COW pages, so our page list + * will be valid. Please don't remove it... + */ + memset( entry->virtual, 0, pages << PAGE_SHIFT ); + + entry->handle = (unsigned long)entry->virtual; + + DRM_DEBUG( "sg alloc handle = %08lx\n", entry->handle ); + DRM_DEBUG( "sg alloc virtual = %p\n", entry->virtual ); + + for ( i = entry->handle, j = 0 ; j < pages ; i += PAGE_SIZE, j++ ) { + entry->pagelist[j] = vmalloc_to_page((void *)i); + if (!entry->pagelist[j]) + goto failed; + SetPageReserved(entry->pagelist[j]); + } + + request.handle = entry->handle; + + if ( copy_to_user( argp, &request, sizeof(request) ) ) { + drm_sg_cleanup( entry ); + return -EFAULT; + } + + dev->sg = entry; + +#if DEBUG_SCATTER + /* Verify that each page points to its virtual address, and vice + * versa. + */ + { + int error = 0; + + for ( i = 0 ; i < pages ; i++ ) { + unsigned long *tmp; + + tmp = page_address( entry->pagelist[i] ); + for ( j = 0 ; + j < PAGE_SIZE / sizeof(unsigned long) ; + j++, tmp++ ) { + *tmp = 0xcafebabe; + } + tmp = (unsigned long *)((u8 *)entry->virtual + + (PAGE_SIZE * i)); + for( j = 0 ; + j < PAGE_SIZE / sizeof(unsigned long) ; + j++, tmp++ ) { + if ( *tmp != 0xcafebabe && error == 0 ) { + error = 1; + DRM_ERROR( "Scatter allocation error, " + "pagelist does not match " + "virtual mapping\n" ); + } + } + tmp = page_address( entry->pagelist[i] ); + for(j = 0 ; + j < PAGE_SIZE / sizeof(unsigned long) ; + j++, tmp++) { + *tmp = 0; + } + } + if (error == 0) + DRM_ERROR( "Scatter allocation matches pagelist\n" ); + } +#endif + + return 0; + + failed: + drm_sg_cleanup( entry ); + return -ENOMEM; +} + +int drm_sg_free( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_scatter_gather_t request; + drm_sg_mem_t *entry; + + if (!drm_core_check_feature(dev, DRIVER_SG)) + return -EINVAL; + + if ( copy_from_user( &request, + (drm_scatter_gather_t __user *)arg, + sizeof(request) ) ) + return -EFAULT; + + entry = dev->sg; + dev->sg = NULL; + + if ( !entry || entry->handle != request.handle ) + return -EINVAL; + + DRM_DEBUG( "sg free virtual = %p\n", entry->virtual ); + + drm_sg_cleanup( entry ); + + return 0; +} diff -Nru a/drivers/char/drm/drm_scatter.h b/drivers/char/drm/drm_scatter.h --- a/drivers/char/drm/drm_scatter.h 2005-01-02 23:03:34 -08:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,231 +0,0 @@ -/** - * \file drm_scatter.h - * IOCTLs to manage scatter/gather memory - * - * \author Gareth Hughes - */ - -/* - * Created: Mon Dec 18 23:20:54 2000 by gareth@valinux.com - * - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#include -#include -#include "drmP.h" - -#define DEBUG_SCATTER 0 - -void DRM(sg_cleanup)( drm_sg_mem_t *entry ) -{ - struct page *page; - int i; - - for ( i = 0 ; i < entry->pages ; i++ ) { - page = entry->pagelist[i]; - if ( page ) - ClearPageReserved( page ); - } - - vfree( entry->virtual ); - - DRM(free)( entry->busaddr, - entry->pages * sizeof(*entry->busaddr), - DRM_MEM_PAGES ); - DRM(free)( entry->pagelist, - entry->pages * sizeof(*entry->pagelist), - DRM_MEM_PAGES ); - DRM(free)( entry, - sizeof(*entry), - DRM_MEM_SGLISTS ); -} - -int DRM(sg_alloc)( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_scatter_gather_t __user *argp = (void __user *)arg; - drm_scatter_gather_t request; - drm_sg_mem_t *entry; - unsigned long pages, i, j; - - DRM_DEBUG( "%s\n", __FUNCTION__ ); - - if (!drm_core_check_feature(dev, DRIVER_SG)) - return -EINVAL; - - if ( dev->sg ) - return -EINVAL; - - if ( copy_from_user( &request, argp, sizeof(request) ) ) - return -EFAULT; - - entry = DRM(alloc)( sizeof(*entry), DRM_MEM_SGLISTS ); - if ( !entry ) - return -ENOMEM; - - memset( entry, 0, sizeof(*entry) ); - - pages = (request.size + PAGE_SIZE - 1) / PAGE_SIZE; - DRM_DEBUG( "sg size=%ld pages=%ld\n", request.size, pages ); - - entry->pages = pages; - entry->pagelist = DRM(alloc)( pages * sizeof(*entry->pagelist), - DRM_MEM_PAGES ); - if ( !entry->pagelist ) { - DRM(free)( entry, sizeof(*entry), DRM_MEM_SGLISTS ); - return -ENOMEM; - } - - memset(entry->pagelist, 0, pages * sizeof(*entry->pagelist)); - - entry->busaddr = DRM(alloc)( pages * sizeof(*entry->busaddr), - DRM_MEM_PAGES ); - if ( !entry->busaddr ) { - DRM(free)( entry->pagelist, - entry->pages * sizeof(*entry->pagelist), - DRM_MEM_PAGES ); - DRM(free)( entry, - sizeof(*entry), - DRM_MEM_SGLISTS ); - return -ENOMEM; - } - memset( (void *)entry->busaddr, 0, pages * sizeof(*entry->busaddr) ); - - entry->virtual = vmalloc_32( pages << PAGE_SHIFT ); - if ( !entry->virtual ) { - DRM(free)( entry->busaddr, - entry->pages * sizeof(*entry->busaddr), - DRM_MEM_PAGES ); - DRM(free)( entry->pagelist, - entry->pages * sizeof(*entry->pagelist), - DRM_MEM_PAGES ); - DRM(free)( entry, - sizeof(*entry), - DRM_MEM_SGLISTS ); - return -ENOMEM; - } - - /* This also forces the mapping of COW pages, so our page list - * will be valid. Please don't remove it... - */ - memset( entry->virtual, 0, pages << PAGE_SHIFT ); - - entry->handle = (unsigned long)entry->virtual; - - DRM_DEBUG( "sg alloc handle = %08lx\n", entry->handle ); - DRM_DEBUG( "sg alloc virtual = %p\n", entry->virtual ); - - for ( i = entry->handle, j = 0 ; j < pages ; i += PAGE_SIZE, j++ ) { - entry->pagelist[j] = vmalloc_to_page((void *)i); - if (!entry->pagelist[j]) - goto failed; - SetPageReserved(entry->pagelist[j]); - } - - request.handle = entry->handle; - - if ( copy_to_user( argp, &request, sizeof(request) ) ) { - DRM(sg_cleanup)( entry ); - return -EFAULT; - } - - dev->sg = entry; - -#if DEBUG_SCATTER - /* Verify that each page points to its virtual address, and vice - * versa. - */ - { - int error = 0; - - for ( i = 0 ; i < pages ; i++ ) { - unsigned long *tmp; - - tmp = page_address( entry->pagelist[i] ); - for ( j = 0 ; - j < PAGE_SIZE / sizeof(unsigned long) ; - j++, tmp++ ) { - *tmp = 0xcafebabe; - } - tmp = (unsigned long *)((u8 *)entry->virtual + - (PAGE_SIZE * i)); - for( j = 0 ; - j < PAGE_SIZE / sizeof(unsigned long) ; - j++, tmp++ ) { - if ( *tmp != 0xcafebabe && error == 0 ) { - error = 1; - DRM_ERROR( "Scatter allocation error, " - "pagelist does not match " - "virtual mapping\n" ); - } - } - tmp = page_address( entry->pagelist[i] ); - for(j = 0 ; - j < PAGE_SIZE / sizeof(unsigned long) ; - j++, tmp++) { - *tmp = 0; - } - } - if (error == 0) - DRM_ERROR( "Scatter allocation matches pagelist\n" ); - } -#endif - - return 0; - - failed: - DRM(sg_cleanup)( entry ); - return -ENOMEM; -} - -int DRM(sg_free)( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_scatter_gather_t request; - drm_sg_mem_t *entry; - - if (!drm_core_check_feature(dev, DRIVER_SG)) - return -EINVAL; - - if ( copy_from_user( &request, - (drm_scatter_gather_t __user *)arg, - sizeof(request) ) ) - return -EFAULT; - - entry = dev->sg; - dev->sg = NULL; - - if ( !entry || entry->handle != request.handle ) - return -EINVAL; - - DRM_DEBUG( "sg free virtual = %p\n", entry->virtual ); - - DRM(sg_cleanup)( entry ); - - return 0; -} diff -Nru a/drivers/char/drm/drm_stub.c b/drivers/char/drm/drm_stub.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/char/drm/drm_stub.c 2005-01-02 23:03:34 -08:00 @@ -0,0 +1,256 @@ +/** + * \file drm_stub.h + * Stub support + * + * \author Rickard E. (Rik) Faith + */ + +/* + * Created: Fri Jan 19 10:48:35 2001 by faith@acm.org + * + * Copyright 2001 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include +#include +#include "drmP.h" +#include "drm_core.h" + +unsigned int drm_cards_limit = 16; /* Enough for one machine */ +unsigned int drm_debug = 0; /* 1 to enable debug output */ +EXPORT_SYMBOL(drm_debug); + +MODULE_AUTHOR( DRIVER_AUTHOR ); +MODULE_DESCRIPTION( DRIVER_DESC ); +MODULE_LICENSE("GPL and additional rights"); +MODULE_PARM_DESC(drm_cards_limit, "Maximum number of graphics cards"); +MODULE_PARM_DESC(drm_debug, "Enable debug output"); + +module_param_named(cards_limit, drm_cards_limit, int, 0444); +module_param_named(debug, drm_debug, int, 0666); + +drm_minor_t *drm_minors; +struct class_simple *drm_class; +struct proc_dir_entry *drm_proc_root; + +static int drm_fill_in_dev(drm_device_t *dev, struct pci_dev *pdev, const struct pci_device_id *ent, struct drm_driver *driver) +{ + int retcode; + + spin_lock_init(&dev->count_lock); + init_timer( &dev->timer ); + sema_init( &dev->struct_sem, 1 ); + sema_init( &dev->ctxlist_sem, 1 ); + + dev->pdev = pdev; + +#ifdef __alpha__ + dev->hose = pdev->sysdata; + dev->pci_domain = dev->hose->bus->number; +#else + dev->pci_domain = 0; +#endif + dev->pci_bus = pdev->bus->number; + dev->pci_slot = PCI_SLOT(pdev->devfn); + dev->pci_func = PCI_FUNC(pdev->devfn); + dev->irq = pdev->irq; + + /* the DRM has 6 basic counters */ + dev->counters = 6; + dev->types[0] = _DRM_STAT_LOCK; + dev->types[1] = _DRM_STAT_OPENS; + dev->types[2] = _DRM_STAT_CLOSES; + dev->types[3] = _DRM_STAT_IOCTLS; + dev->types[4] = _DRM_STAT_LOCKS; + dev->types[5] = _DRM_STAT_UNLOCKS; + + dev->driver = driver; + + if (dev->driver->preinit) + if ((retcode = dev->driver->preinit(dev))) + goto error_out_unreg; + + if (drm_core_has_AGP(dev)) { + dev->agp = drm_agp_init(); + if (drm_core_check_feature(dev, DRIVER_REQUIRE_AGP) && (dev->agp == NULL)) { + DRM_ERROR( "Cannot initialize the agpgart module.\n" ); + retcode = -EINVAL; + goto error_out_unreg; + } + if (drm_core_has_MTRR(dev)) { + if (dev->agp) + dev->agp->agp_mtrr = mtrr_add( dev->agp->agp_info.aper_base, + dev->agp->agp_info.aper_size*1024*1024, + MTRR_TYPE_WRCOMB, + 1 ); + } + } + + retcode = drm_ctxbitmap_init( dev ); + if( retcode ) { + DRM_ERROR( "Cannot allocate memory for context bitmap.\n" ); + goto error_out_unreg; + } + + dev->device = MKDEV(DRM_MAJOR, dev->minor ); + + /* postinit is a required function to display the signon banner */ + if ((retcode = dev->driver->postinit(dev, ent->driver_data))) + goto error_out_unreg; + + return 0; + +error_out_unreg: + drm_takedown(dev); + return retcode; +} + +/** + * File \c open operation. + * + * \param inode device inode. + * \param filp file pointer. + * + * Puts the dev->fops corresponding to the device minor number into + * \p filp, call the \c open method, and restore the file operations. + */ +int drm_stub_open(struct inode *inode, struct file *filp) +{ + drm_device_t *dev = NULL; + int minor = iminor(inode); + int err = -ENODEV; + struct file_operations *old_fops; + + DRM_DEBUG("\n"); + + if (!((minor >= 0) && (minor < drm_cards_limit))) + return -ENODEV; + + dev = drm_minors[minor].dev; + if (!dev) + return -ENODEV; + + old_fops = filp->f_op; + filp->f_op = fops_get(&dev->driver->fops); + if (filp->f_op->open && (err = filp->f_op->open(inode, filp))) { + fops_put(filp->f_op); + filp->f_op = fops_get(old_fops); + } + fops_put(old_fops); + + return err; +} + +/** + * Get a device minor number. + * + * \param pdev PCI device structure + * \param ent entry from the PCI ID table with device type flags + * \return zero on success or a negative number on failure. + * + * Attempt to gets inter module "drm" information. If we are first + * then register the character device and inter module information. + * Try and register, if we fail to register, backout previous work. + */ +int drm_probe(struct pci_dev *pdev, const struct pci_device_id *ent, struct drm_driver *driver) +{ + struct class_device *dev_class; + drm_device_t *dev; + int ret; + int minor; + drm_minor_t *minors = &drm_minors[0]; + + DRM_DEBUG("\n"); + + for (minor = 0; minor < drm_cards_limit; minor++, minors++) { + if (minors->type == DRM_MINOR_FREE) { + + DRM_DEBUG("assigning minor %d\n", minor); + dev = drm_calloc(1, sizeof(*dev), DRM_MEM_STUB); + if (!dev) + return -ENOMEM; + + *minors = (drm_minor_t){.dev = dev, .type=DRM_MINOR_PRIMARY}; + dev->minor = minor; + + pci_enable_device(pdev); + + if ((ret=drm_fill_in_dev(dev, pdev, ent, driver))) { + printk(KERN_ERR "DRM: Fill_in_dev failed.\n"); + goto err_g1; + } + if ((ret = drm_proc_init(dev, minor, drm_proc_root, &minors->dev_root))) { + printk (KERN_ERR "DRM: Failed to initialize /proc/dri.\n"); + goto err_g1; + } + + + dev_class = class_simple_device_add(drm_class, + MKDEV(DRM_MAJOR, minor), &pdev->dev, "card%d", minor); + if (IS_ERR(dev_class)) { + printk(KERN_ERR "DRM: Error class_simple_device_add.\n"); + ret = PTR_ERR(dev_class); + goto err_g2; + } + + DRM_DEBUG("new minor assigned %d\n", minor); + return 0; + } + } + DRM_ERROR("out of minors\n"); + return -ENOMEM; +err_g2: + drm_proc_cleanup(minor, drm_proc_root, minors->dev_root); +err_g1: + *minors = (drm_minor_t){.dev = NULL, .type = DRM_MINOR_FREE}; + drm_free(dev, sizeof(*dev), DRM_MEM_STUB); + return ret; +} +EXPORT_SYMBOL(drm_probe); + + +/** + * Put a device minor number. + * + * \param minor minor number. + * \return always zero. + * + * Cleans up the proc resources. If a minor is zero then release the foreign + * "drm" data, otherwise unregisters the "drm" data, frees the stub list and + * unregisters the character device. + */ +int drm_put_minor(drm_device_t *dev) +{ + drm_minor_t *minors = &drm_minors[dev->minor]; + + DRM_DEBUG("release minor %d\n", dev->minor); + + drm_proc_cleanup(dev->minor, drm_proc_root, minors->dev_root); + class_simple_device_remove(MKDEV(DRM_MAJOR, dev->minor)); + + *minors = (drm_minor_t){.dev = NULL, .type = DRM_MINOR_FREE}; + drm_free(dev, sizeof(*dev), DRM_MEM_STUB); + + return 0; +} + diff -Nru a/drivers/char/drm/drm_stub.h b/drivers/char/drm/drm_stub.h --- a/drivers/char/drm/drm_stub.h 2005-01-02 23:03:34 -08:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,236 +0,0 @@ -/** - * \file drm_stub.h - * Stub support - * - * \author Rickard E. (Rik) Faith - */ - -/* - * Created: Fri Jan 19 10:48:35 2001 by faith@acm.org - * - * Copyright 2001 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#include "drmP.h" - -#define DRM_STUB_MAXCARDS 16 /* Enough for one machine */ - -static struct class_simple *drm_class; - -/** Stub list. One for each minor. */ -static struct drm_stub_list { - const char *name; - struct file_operations *fops; /**< file operations */ - struct proc_dir_entry *dev_root; /**< proc directory entry */ -} *DRM(stub_list); - -static struct proc_dir_entry *DRM(stub_root); - -/** Stub information */ -static struct drm_stub_info { - int (*info_register)(const char *name, struct file_operations *fops, - drm_device_t *dev); - int (*info_unregister)(int minor); -} DRM(stub_info); - -/** - * File \c open operation. - * - * \param inode device inode. - * \param filp file pointer. - * - * Puts the drm_stub_list::fops corresponding to the device minor number into - * \p filp, call the \c open method, and restore the file operations. - */ -static int DRM(stub_open)(struct inode *inode, struct file *filp) -{ - int minor = iminor(inode); - int err = -ENODEV; - struct file_operations *old_fops; - - if (!DRM(stub_list) || !DRM(stub_list)[minor].fops) return -ENODEV; - old_fops = filp->f_op; - filp->f_op = fops_get(DRM(stub_list)[minor].fops); - if (filp->f_op->open && (err = filp->f_op->open(inode, filp))) { - fops_put(filp->f_op); - filp->f_op = fops_get(old_fops); - } - fops_put(old_fops); - - return err; -} - -/** File operations structure */ -static struct file_operations DRM(stub_fops) = { - .owner = THIS_MODULE, - .open = DRM(stub_open) -}; - -/** - * Get a device minor number. - * - * \param name driver name. - * \param fops file operations. - * \param dev DRM device. - * \return minor number on success, or a negative number on failure. - * - * Allocate and initialize ::stub_list if one doesn't exist already. Search an - * empty entry and initialize it to the given parameters, and create the proc - * init entry via proc_init(). - */ -static int DRM(stub_getminor)(const char *name, struct file_operations *fops, - drm_device_t *dev) -{ - int i; - - if (!DRM(stub_list)) { - DRM(stub_list) = DRM(alloc)(sizeof(*DRM(stub_list)) - * DRM_STUB_MAXCARDS, DRM_MEM_STUB); - if(!DRM(stub_list)) return -1; - for (i = 0; i < DRM_STUB_MAXCARDS; i++) { - DRM(stub_list)[i].name = NULL; - DRM(stub_list)[i].fops = NULL; - } - } - for (i = 0; i < DRM_STUB_MAXCARDS; i++) { - if (!DRM(stub_list)[i].fops) { - DRM(stub_list)[i].name = name; - DRM(stub_list)[i].fops = fops; - DRM(stub_root) = DRM(proc_init)(dev, i, DRM(stub_root), - &DRM(stub_list)[i] - .dev_root); - class_simple_device_add(drm_class, MKDEV(DRM_MAJOR, i), NULL, name); - return i; - } - } - return -1; -} - -/** - * Put a device minor number. - * - * \param minor minor number. - * \return always zero. - * - * Cleans up the proc resources. If a minor is zero then release the foreign - * "drm" data, otherwise unregisters the "drm" data, frees the stub list and - * unregisters the character device. - */ -static int DRM(stub_putminor)(int minor) -{ - if (minor < 0 || minor >= DRM_STUB_MAXCARDS) return -1; - DRM(stub_list)[minor].name = NULL; - DRM(stub_list)[minor].fops = NULL; - DRM(proc_cleanup)(minor, DRM(stub_root), - DRM(stub_list)[minor].dev_root); - if (minor) { - class_simple_device_remove(MKDEV(DRM_MAJOR, minor)); - inter_module_put("drm"); - } else { - inter_module_unregister("drm"); - DRM(free)(DRM(stub_list), - sizeof(*DRM(stub_list)) * DRM_STUB_MAXCARDS, - DRM_MEM_STUB); - unregister_chrdev(DRM_MAJOR, "drm"); - class_simple_device_remove(MKDEV(DRM_MAJOR, minor)); - class_simple_destroy(drm_class); - } - return 0; -} - -/** - * Register. - * - * \param name driver name. - * \param fops file operations - * \param dev DRM device. - * \return zero on success or a negative number on failure. - * - * Attempt to register the char device and get the foreign "drm" data. If - * successful then another module already registered so gets the stub info, - * otherwise use this module stub info and make it available for other modules. - * - * Finally calls stub_info::info_register. - */ -int DRM(stub_register)(const char *name, struct file_operations *fops, - drm_device_t *dev) -{ - struct drm_stub_info *i = NULL; - int ret1; - int ret2; - - DRM_DEBUG("\n"); - ret1 = register_chrdev(DRM_MAJOR, "drm", &DRM(stub_fops)); - if (!ret1) { - drm_class = class_simple_create(THIS_MODULE, "drm"); - if (IS_ERR(drm_class)) { - printk (KERN_ERR "Error creating drm class.\n"); - unregister_chrdev(DRM_MAJOR, "drm"); - return PTR_ERR(drm_class); - } - } - else if (ret1 == -EBUSY) - i = (struct drm_stub_info *)inter_module_get("drm"); - else - return -1; - - if (i) { - /* Already registered */ - DRM(stub_info).info_register = i->info_register; - DRM(stub_info).info_unregister = i->info_unregister; - DRM_DEBUG("already registered\n"); - } else if (DRM(stub_info).info_register != DRM(stub_getminor)) { - DRM(stub_info).info_register = DRM(stub_getminor); - DRM(stub_info).info_unregister = DRM(stub_putminor); - DRM_DEBUG("calling inter_module_register\n"); - inter_module_register("drm", THIS_MODULE, &DRM(stub_info)); - } - if (DRM(stub_info).info_register) { - ret2 = DRM(stub_info).info_register(name, fops, dev); - if (ret2) { - if (!ret1) { - unregister_chrdev(DRM_MAJOR, "drm"); - class_simple_destroy(drm_class); - } - if (!i) - inter_module_unregister("drm"); - } - return ret2; - } - return -1; -} - -/** - * Unregister. - * - * \param minor - * - * Calls drm_stub_info::unregister. - */ -int DRM(stub_unregister)(int minor) -{ - DRM_DEBUG("%d\n", minor); - if (DRM(stub_info).info_unregister) - return DRM(stub_info).info_unregister(minor); - return -1; -} diff -Nru a/drivers/char/drm/drm_vm.c b/drivers/char/drm/drm_vm.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/char/drm/drm_vm.c 2005-01-02 23:03:35 -08:00 @@ -0,0 +1,670 @@ +/** + * \file drm_vm.h + * Memory mapping for DRM + * + * \author Rickard E. (Rik) Faith + * \author Gareth Hughes + */ + +/* + * Created: Mon Jan 4 08:58:31 1999 by faith@valinux.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "drmP.h" + + +/** + * \c nopage method for AGP virtual memory. + * + * \param vma virtual memory area. + * \param address access address. + * \return pointer to the page structure. + * + * Find the right map and if it's AGP memory find the real physical page to + * map, get the page, increment the use count and return it. + */ +#if __OS_HAS_AGP +static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma, + unsigned long address) +{ + drm_file_t *priv = vma->vm_file->private_data; + drm_device_t *dev = priv->dev; + drm_map_t *map = NULL; + drm_map_list_t *r_list; + struct list_head *list; + + /* + * Find the right map + */ + if (!drm_core_has_AGP(dev)) + goto vm_nopage_error; + + if(!dev->agp || !dev->agp->cant_use_aperture) goto vm_nopage_error; + + list_for_each(list, &dev->maplist->head) { + r_list = list_entry(list, drm_map_list_t, head); + map = r_list->map; + if (!map) continue; + if (map->offset == VM_OFFSET(vma)) break; + } + + if (map && map->type == _DRM_AGP) { + unsigned long offset = address - vma->vm_start; + unsigned long baddr = VM_OFFSET(vma) + offset; + struct drm_agp_mem *agpmem; + struct page *page; + +#ifdef __alpha__ + /* + * Adjust to a bus-relative address + */ + baddr -= dev->hose->mem_space->start; +#endif + + /* + * It's AGP memory - find the real physical page to map + */ + for(agpmem = dev->agp->memory; agpmem; agpmem = agpmem->next) { + if (agpmem->bound <= baddr && + agpmem->bound + agpmem->pages * PAGE_SIZE > baddr) + break; + } + + if (!agpmem) goto vm_nopage_error; + + /* + * Get the page, inc the use count, and return it + */ + offset = (baddr - agpmem->bound) >> PAGE_SHIFT; + page = virt_to_page(__va(agpmem->memory->memory[offset])); + get_page(page); + + DRM_DEBUG("baddr = 0x%lx page = 0x%p, offset = 0x%lx, count=%d\n", + baddr, __va(agpmem->memory->memory[offset]), offset, + page_count(page)); + + return page; + } +vm_nopage_error: + return NOPAGE_SIGBUS; /* Disallow mremap */ +} +#else /* __OS_HAS_AGP */ +static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma, + unsigned long address) +{ + return NOPAGE_SIGBUS; +} +#endif /* __OS_HAS_AGP */ + +/** + * \c nopage method for shared virtual memory. + * + * \param vma virtual memory area. + * \param address access address. + * \return pointer to the page structure. + * + * Get the the mapping, find the real physical page to map, get the page, and + * return it. + */ +static __inline__ struct page *drm_do_vm_shm_nopage(struct vm_area_struct *vma, + unsigned long address) +{ + drm_map_t *map = (drm_map_t *)vma->vm_private_data; + unsigned long offset; + unsigned long i; + struct page *page; + + if (address > vma->vm_end) return NOPAGE_SIGBUS; /* Disallow mremap */ + if (!map) return NOPAGE_OOM; /* Nothing allocated */ + + offset = address - vma->vm_start; + i = (unsigned long)map->handle + offset; + page = vmalloc_to_page((void *)i); + if (!page) + return NOPAGE_OOM; + get_page(page); + + DRM_DEBUG("shm_nopage 0x%lx\n", address); + return page; +} + + +/** + * \c close method for shared virtual memory. + * + * \param vma virtual memory area. + * + * Deletes map information if we are the last + * person to close a mapping and it's not in the global maplist. + */ +void drm_vm_shm_close(struct vm_area_struct *vma) +{ + drm_file_t *priv = vma->vm_file->private_data; + drm_device_t *dev = priv->dev; + drm_vma_entry_t *pt, *prev, *next; + drm_map_t *map; + drm_map_list_t *r_list; + struct list_head *list; + int found_maps = 0; + + DRM_DEBUG("0x%08lx,0x%08lx\n", + vma->vm_start, vma->vm_end - vma->vm_start); + atomic_dec(&dev->vma_count); + + map = vma->vm_private_data; + + down(&dev->struct_sem); + for (pt = dev->vmalist, prev = NULL; pt; pt = next) { + next = pt->next; + if (pt->vma->vm_private_data == map) found_maps++; + if (pt->vma == vma) { + if (prev) { + prev->next = pt->next; + } else { + dev->vmalist = pt->next; + } + drm_free(pt, sizeof(*pt), DRM_MEM_VMAS); + } else { + prev = pt; + } + } + /* We were the only map that was found */ + if(found_maps == 1 && + map->flags & _DRM_REMOVABLE) { + /* Check to see if we are in the maplist, if we are not, then + * we delete this mappings information. + */ + found_maps = 0; + list = &dev->maplist->head; + list_for_each(list, &dev->maplist->head) { + r_list = list_entry(list, drm_map_list_t, head); + if (r_list->map == map) found_maps++; + } + + if(!found_maps) { + switch (map->type) { + case _DRM_REGISTERS: + case _DRM_FRAME_BUFFER: + if (drm_core_has_MTRR(dev) && map->mtrr >= 0) { + int retcode; + retcode = mtrr_del(map->mtrr, + map->offset, + map->size); + DRM_DEBUG("mtrr_del = %d\n", retcode); + } + drm_ioremapfree(map->handle, map->size, dev); + break; + case _DRM_SHM: + vfree(map->handle); + break; + case _DRM_AGP: + case _DRM_SCATTER_GATHER: + break; + } + drm_free(map, sizeof(*map), DRM_MEM_MAPS); + } + } + up(&dev->struct_sem); +} + +/** + * \c nopage method for DMA virtual memory. + * + * \param vma virtual memory area. + * \param address access address. + * \return pointer to the page structure. + * + * Determine the page number from the page offset and get it from drm_device_dma::pagelist. + */ +static __inline__ struct page *drm_do_vm_dma_nopage(struct vm_area_struct *vma, + unsigned long address) +{ + drm_file_t *priv = vma->vm_file->private_data; + drm_device_t *dev = priv->dev; + drm_device_dma_t *dma = dev->dma; + unsigned long offset; + unsigned long page_nr; + struct page *page; + + if (!dma) return NOPAGE_SIGBUS; /* Error */ + if (address > vma->vm_end) return NOPAGE_SIGBUS; /* Disallow mremap */ + if (!dma->pagelist) return NOPAGE_OOM ; /* Nothing allocated */ + + offset = address - vma->vm_start; /* vm_[pg]off[set] should be 0 */ + page_nr = offset >> PAGE_SHIFT; + page = virt_to_page((dma->pagelist[page_nr] + + (offset & (~PAGE_MASK)))); + + get_page(page); + + DRM_DEBUG("dma_nopage 0x%lx (page %lu)\n", address, page_nr); + return page; +} + +/** + * \c nopage method for scatter-gather virtual memory. + * + * \param vma virtual memory area. + * \param address access address. + * \return pointer to the page structure. + * + * Determine the map offset from the page offset and get it from drm_sg_mem::pagelist. + */ +static __inline__ struct page *drm_do_vm_sg_nopage(struct vm_area_struct *vma, + unsigned long address) +{ + drm_map_t *map = (drm_map_t *)vma->vm_private_data; + drm_file_t *priv = vma->vm_file->private_data; + drm_device_t *dev = priv->dev; + drm_sg_mem_t *entry = dev->sg; + unsigned long offset; + unsigned long map_offset; + unsigned long page_offset; + struct page *page; + + if (!entry) return NOPAGE_SIGBUS; /* Error */ + if (address > vma->vm_end) return NOPAGE_SIGBUS; /* Disallow mremap */ + if (!entry->pagelist) return NOPAGE_OOM ; /* Nothing allocated */ + + + offset = address - vma->vm_start; + map_offset = map->offset - dev->sg->handle; + page_offset = (offset >> PAGE_SHIFT) + (map_offset >> PAGE_SHIFT); + page = entry->pagelist[page_offset]; + get_page(page); + + return page; +} + + +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) + +static struct page *drm_vm_nopage(struct vm_area_struct *vma, + unsigned long address, + int *type) { + if (type) *type = VM_FAULT_MINOR; + return drm_do_vm_nopage(vma, address); +} + +static struct page *drm_vm_shm_nopage(struct vm_area_struct *vma, + unsigned long address, + int *type) { + if (type) *type = VM_FAULT_MINOR; + return drm_do_vm_shm_nopage(vma, address); +} + +static struct page *drm_vm_dma_nopage(struct vm_area_struct *vma, + unsigned long address, + int *type) { + if (type) *type = VM_FAULT_MINOR; + return drm_do_vm_dma_nopage(vma, address); +} + +static struct page *drm_vm_sg_nopage(struct vm_area_struct *vma, + unsigned long address, + int *type) { + if (type) *type = VM_FAULT_MINOR; + return drm_do_vm_sg_nopage(vma, address); +} + +#else /* LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,0) */ + +static struct page *drm_vm_nopage(struct vm_area_struct *vma, + unsigned long address, + int unused) { + return drm_do_vm_nopage(vma, address); +} + +static struct page *drm_vm_shm_nopage(struct vm_area_struct *vma, + unsigned long address, + int unused) { + return drm_do_vm_shm_nopage(vma, address); +} + +static struct page *drm_vm_dma_nopage(struct vm_area_struct *vma, + unsigned long address, + int unused) { + return drm_do_vm_dma_nopage(vma, address); +} + +static struct page *drm_vm_sg_nopage(struct vm_area_struct *vma, + unsigned long address, + int unused) { + return drm_do_vm_sg_nopage(vma, address); +} + +#endif + + +/** AGP virtual memory operations */ +static struct vm_operations_struct drm_vm_ops = { + .nopage = drm_vm_nopage, + .open = drm_vm_open, + .close = drm_vm_close, +}; + +/** Shared virtual memory operations */ +static struct vm_operations_struct drm_vm_shm_ops = { + .nopage = drm_vm_shm_nopage, + .open = drm_vm_open, + .close = drm_vm_shm_close, +}; + +/** DMA virtual memory operations */ +static struct vm_operations_struct drm_vm_dma_ops = { + .nopage = drm_vm_dma_nopage, + .open = drm_vm_open, + .close = drm_vm_close, +}; + +/** Scatter-gather virtual memory operations */ +static struct vm_operations_struct drm_vm_sg_ops = { + .nopage = drm_vm_sg_nopage, + .open = drm_vm_open, + .close = drm_vm_close, +}; + + +/** + * \c open method for shared virtual memory. + * + * \param vma virtual memory area. + * + * Create a new drm_vma_entry structure as the \p vma private data entry and + * add it to drm_device::vmalist. + */ +void drm_vm_open(struct vm_area_struct *vma) +{ + drm_file_t *priv = vma->vm_file->private_data; + drm_device_t *dev = priv->dev; + drm_vma_entry_t *vma_entry; + + DRM_DEBUG("0x%08lx,0x%08lx\n", + vma->vm_start, vma->vm_end - vma->vm_start); + atomic_inc(&dev->vma_count); + + vma_entry = drm_alloc(sizeof(*vma_entry), DRM_MEM_VMAS); + if (vma_entry) { + down(&dev->struct_sem); + vma_entry->vma = vma; + vma_entry->next = dev->vmalist; + vma_entry->pid = current->pid; + dev->vmalist = vma_entry; + up(&dev->struct_sem); + } +} + +/** + * \c close method for all virtual memory types. + * + * \param vma virtual memory area. + * + * Search the \p vma private data entry in drm_device::vmalist, unlink it, and + * free it. + */ +void drm_vm_close(struct vm_area_struct *vma) +{ + drm_file_t *priv = vma->vm_file->private_data; + drm_device_t *dev = priv->dev; + drm_vma_entry_t *pt, *prev; + + DRM_DEBUG("0x%08lx,0x%08lx\n", + vma->vm_start, vma->vm_end - vma->vm_start); + atomic_dec(&dev->vma_count); + + down(&dev->struct_sem); + for (pt = dev->vmalist, prev = NULL; pt; prev = pt, pt = pt->next) { + if (pt->vma == vma) { + if (prev) { + prev->next = pt->next; + } else { + dev->vmalist = pt->next; + } + drm_free(pt, sizeof(*pt), DRM_MEM_VMAS); + break; + } + } + up(&dev->struct_sem); +} + +/** + * mmap DMA memory. + * + * \param filp file pointer. + * \param vma virtual memory area. + * \return zero on success or a negative number on failure. + * + * Sets the virtual memory area operations structure to vm_dma_ops, the file + * pointer, and calls vm_open(). + */ +int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev; + drm_device_dma_t *dma; + unsigned long length = vma->vm_end - vma->vm_start; + + lock_kernel(); + dev = priv->dev; + dma = dev->dma; + DRM_DEBUG("start = 0x%lx, end = 0x%lx, offset = 0x%lx\n", + vma->vm_start, vma->vm_end, VM_OFFSET(vma)); + + /* Length must match exact page count */ + if (!dma || (length >> PAGE_SHIFT) != dma->page_count) { + unlock_kernel(); + return -EINVAL; + } + unlock_kernel(); + + vma->vm_ops = &drm_vm_dma_ops; + +#if LINUX_VERSION_CODE <= 0x02040e /* KERNEL_VERSION(2,4,14) */ + vma->vm_flags |= VM_LOCKED | VM_SHM; /* Don't swap */ +#else + vma->vm_flags |= VM_RESERVED; /* Don't swap */ +#endif + + vma->vm_file = filp; /* Needed for drm_vm_open() */ + drm_vm_open(vma); + return 0; +} + +unsigned long drm_core_get_map_ofs(drm_map_t *map) +{ + return map->offset; +} +EXPORT_SYMBOL(drm_core_get_map_ofs); + +unsigned long drm_core_get_reg_ofs(struct drm_device *dev) +{ +#ifdef __alpha__ + return dev->hose->dense_mem_base - dev->hose->mem_space->start; +#else + return 0; +#endif +} +EXPORT_SYMBOL(drm_core_get_reg_ofs); + +/** + * mmap DMA memory. + * + * \param filp file pointer. + * \param vma virtual memory area. + * \return zero on success or a negative number on failure. + * + * If the virtual memory area has no offset associated with it then it's a DMA + * area, so calls mmap_dma(). Otherwise searches the map in drm_device::maplist, + * checks that the restricted flag is not set, sets the virtual memory operations + * according to the mapping type and remaps the pages. Finally sets the file + * pointer and calls vm_open(). + */ +int drm_mmap(struct file *filp, struct vm_area_struct *vma) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_map_t *map = NULL; + drm_map_list_t *r_list; + unsigned long offset = 0; + struct list_head *list; + + DRM_DEBUG("start = 0x%lx, end = 0x%lx, offset = 0x%lx\n", + vma->vm_start, vma->vm_end, VM_OFFSET(vma)); + + if ( !priv->authenticated ) return -EACCES; + + /* We check for "dma". On Apple's UniNorth, it's valid to have + * the AGP mapped at physical address 0 + * --BenH. + */ + if (!VM_OFFSET(vma) +#if __OS_HAS_AGP + && (!dev->agp || dev->agp->agp_info.device->vendor != PCI_VENDOR_ID_APPLE) +#endif + ) + return drm_mmap_dma(filp, vma); + + /* A sequential search of a linked list is + fine here because: 1) there will only be + about 5-10 entries in the list and, 2) a + DRI client only has to do this mapping + once, so it doesn't have to be optimized + for performance, even if the list was a + bit longer. */ + list_for_each(list, &dev->maplist->head) { + unsigned long off; + + r_list = list_entry(list, drm_map_list_t, head); + map = r_list->map; + if (!map) continue; + off = dev->driver->get_map_ofs(map); + if (off == VM_OFFSET(vma)) break; + } + + if (!map || ((map->flags&_DRM_RESTRICTED) && !capable(CAP_SYS_ADMIN))) + return -EPERM; + + /* Check for valid size. */ + if (map->size != vma->vm_end - vma->vm_start) return -EINVAL; + + if (!capable(CAP_SYS_ADMIN) && (map->flags & _DRM_READ_ONLY)) { + vma->vm_flags &= ~(VM_WRITE | VM_MAYWRITE); +#if defined(__i386__) || defined(__x86_64__) + pgprot_val(vma->vm_page_prot) &= ~_PAGE_RW; +#else + /* Ye gads this is ugly. With more thought + we could move this up higher and use + `protection_map' instead. */ + vma->vm_page_prot = __pgprot(pte_val(pte_wrprotect( + __pte(pgprot_val(vma->vm_page_prot))))); +#endif + } + + switch (map->type) { + case _DRM_AGP: + if (drm_core_has_AGP(dev) && dev->agp->cant_use_aperture) { + /* + * On some platforms we can't talk to bus dma address from the CPU, so for + * memory of type DRM_AGP, we'll deal with sorting out the real physical + * pages and mappings in nopage() + */ +#if defined(__powerpc__) + pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE; +#endif + vma->vm_ops = &drm_vm_ops; + break; + } + /* fall through to _DRM_FRAME_BUFFER... */ + case _DRM_FRAME_BUFFER: + case _DRM_REGISTERS: + if (VM_OFFSET(vma) >= __pa(high_memory)) { +#if defined(__i386__) || defined(__x86_64__) + if (boot_cpu_data.x86 > 3 && map->type != _DRM_AGP) { + pgprot_val(vma->vm_page_prot) |= _PAGE_PCD; + pgprot_val(vma->vm_page_prot) &= ~_PAGE_PWT; + } +#elif defined(__powerpc__) + pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE | _PAGE_GUARDED; +#endif + vma->vm_flags |= VM_IO; /* not in core dump */ + } +#if defined(__ia64__) + if (map->type != _DRM_AGP) + vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); +#endif + offset = dev->driver->get_reg_ofs(dev); +#ifdef __sparc__ + if (io_remap_page_range(DRM_RPR_ARG(vma) vma->vm_start, + VM_OFFSET(vma) + offset, + vma->vm_end - vma->vm_start, + vma->vm_page_prot, 0)) +#else + if (remap_pfn_range(DRM_RPR_ARG(vma) vma->vm_start, + (VM_OFFSET(vma) + offset) >> PAGE_SHIFT, + vma->vm_end - vma->vm_start, + vma->vm_page_prot)) +#endif + return -EAGAIN; + DRM_DEBUG(" Type = %d; start = 0x%lx, end = 0x%lx," + " offset = 0x%lx\n", + map->type, + vma->vm_start, vma->vm_end, VM_OFFSET(vma) + offset); + vma->vm_ops = &drm_vm_ops; + break; + case _DRM_SHM: + vma->vm_ops = &drm_vm_shm_ops; + vma->vm_private_data = (void *)map; + /* Don't let this area swap. Change when + DRM_KERNEL advisory is supported. */ +#if LINUX_VERSION_CODE <= 0x02040e /* KERNEL_VERSION(2,4,14) */ + vma->vm_flags |= VM_LOCKED; +#else + vma->vm_flags |= VM_RESERVED; +#endif + break; + case _DRM_SCATTER_GATHER: + vma->vm_ops = &drm_vm_sg_ops; + vma->vm_private_data = (void *)map; +#if LINUX_VERSION_CODE <= 0x02040e /* KERNEL_VERSION(2,4,14) */ + vma->vm_flags |= VM_LOCKED; +#else + vma->vm_flags |= VM_RESERVED; +#endif + break; + default: + return -EINVAL; /* This should never happen. */ + } +#if LINUX_VERSION_CODE <= 0x02040e /* KERNEL_VERSION(2,4,14) */ + vma->vm_flags |= VM_LOCKED | VM_SHM; /* Don't swap */ +#else + vma->vm_flags |= VM_RESERVED; /* Don't swap */ +#endif + + vma->vm_file = filp; /* Needed for drm_vm_open() */ + drm_vm_open(vma); + return 0; +} +EXPORT_SYMBOL(drm_mmap); diff -Nru a/drivers/char/drm/drm_vm.h b/drivers/char/drm/drm_vm.h --- a/drivers/char/drm/drm_vm.h 2005-01-02 23:03:35 -08:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,667 +0,0 @@ -/** - * \file drm_vm.h - * Memory mapping for DRM - * - * \author Rickard E. (Rik) Faith - * \author Gareth Hughes - */ - -/* - * Created: Mon Jan 4 08:58:31 1999 by faith@valinux.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -#include "drmP.h" - - -/** - * \c nopage method for AGP virtual memory. - * - * \param vma virtual memory area. - * \param address access address. - * \return pointer to the page structure. - * - * Find the right map and if it's AGP memory find the real physical page to - * map, get the page, increment the use count and return it. - */ -#if __OS_HAS_AGP -static __inline__ struct page *DRM(do_vm_nopage)(struct vm_area_struct *vma, - unsigned long address) -{ - drm_file_t *priv = vma->vm_file->private_data; - drm_device_t *dev = priv->dev; - drm_map_t *map = NULL; - drm_map_list_t *r_list; - struct list_head *list; - - /* - * Find the right map - */ - if (!drm_core_has_AGP(dev)) - goto vm_nopage_error; - - if(!dev->agp || !dev->agp->cant_use_aperture) goto vm_nopage_error; - - list_for_each(list, &dev->maplist->head) { - r_list = list_entry(list, drm_map_list_t, head); - map = r_list->map; - if (!map) continue; - if (map->offset == VM_OFFSET(vma)) break; - } - - if (map && map->type == _DRM_AGP) { - unsigned long offset = address - vma->vm_start; - unsigned long baddr = VM_OFFSET(vma) + offset; - struct drm_agp_mem *agpmem; - struct page *page; - -#ifdef __alpha__ - /* - * Adjust to a bus-relative address - */ - baddr -= dev->hose->mem_space->start; -#endif - - /* - * It's AGP memory - find the real physical page to map - */ - for(agpmem = dev->agp->memory; agpmem; agpmem = agpmem->next) { - if (agpmem->bound <= baddr && - agpmem->bound + agpmem->pages * PAGE_SIZE > baddr) - break; - } - - if (!agpmem) goto vm_nopage_error; - - /* - * Get the page, inc the use count, and return it - */ - offset = (baddr - agpmem->bound) >> PAGE_SHIFT; - page = virt_to_page(__va(agpmem->memory->memory[offset])); - get_page(page); - - DRM_DEBUG("baddr = 0x%lx page = 0x%p, offset = 0x%lx, count=%d\n", - baddr, __va(agpmem->memory->memory[offset]), offset, - page_count(page)); - - return page; - } -vm_nopage_error: - return NOPAGE_SIGBUS; /* Disallow mremap */ -} -#else /* __OS_HAS_AGP */ -static __inline__ struct page *DRM(do_vm_nopage)(struct vm_area_struct *vma, - unsigned long address) -{ - return NOPAGE_SIGBUS; -} -#endif /* __OS_HAS_AGP */ - -/** - * \c nopage method for shared virtual memory. - * - * \param vma virtual memory area. - * \param address access address. - * \return pointer to the page structure. - * - * Get the the mapping, find the real physical page to map, get the page, and - * return it. - */ -static __inline__ struct page *DRM(do_vm_shm_nopage)(struct vm_area_struct *vma, - unsigned long address) -{ - drm_map_t *map = (drm_map_t *)vma->vm_private_data; - unsigned long offset; - unsigned long i; - struct page *page; - - if (address > vma->vm_end) return NOPAGE_SIGBUS; /* Disallow mremap */ - if (!map) return NOPAGE_OOM; /* Nothing allocated */ - - offset = address - vma->vm_start; - i = (unsigned long)map->handle + offset; - page = vmalloc_to_page((void *)i); - if (!page) - return NOPAGE_OOM; - get_page(page); - - DRM_DEBUG("shm_nopage 0x%lx\n", address); - return page; -} - - -/** - * \c close method for shared virtual memory. - * - * \param vma virtual memory area. - * - * Deletes map information if we are the last - * person to close a mapping and it's not in the global maplist. - */ -void DRM(vm_shm_close)(struct vm_area_struct *vma) -{ - drm_file_t *priv = vma->vm_file->private_data; - drm_device_t *dev = priv->dev; - drm_vma_entry_t *pt, *prev, *next; - drm_map_t *map; - drm_map_list_t *r_list; - struct list_head *list; - int found_maps = 0; - - DRM_DEBUG("0x%08lx,0x%08lx\n", - vma->vm_start, vma->vm_end - vma->vm_start); - atomic_dec(&dev->vma_count); - - map = vma->vm_private_data; - - down(&dev->struct_sem); - for (pt = dev->vmalist, prev = NULL; pt; pt = next) { - next = pt->next; - if (pt->vma->vm_private_data == map) found_maps++; - if (pt->vma == vma) { - if (prev) { - prev->next = pt->next; - } else { - dev->vmalist = pt->next; - } - DRM(free)(pt, sizeof(*pt), DRM_MEM_VMAS); - } else { - prev = pt; - } - } - /* We were the only map that was found */ - if(found_maps == 1 && - map->flags & _DRM_REMOVABLE) { - /* Check to see if we are in the maplist, if we are not, then - * we delete this mappings information. - */ - found_maps = 0; - list = &dev->maplist->head; - list_for_each(list, &dev->maplist->head) { - r_list = list_entry(list, drm_map_list_t, head); - if (r_list->map == map) found_maps++; - } - - if(!found_maps) { - switch (map->type) { - case _DRM_REGISTERS: - case _DRM_FRAME_BUFFER: - if (drm_core_has_MTRR(dev) && map->mtrr >= 0) { - int retcode; - retcode = mtrr_del(map->mtrr, - map->offset, - map->size); - DRM_DEBUG("mtrr_del = %d\n", retcode); - } - DRM(ioremapfree)(map->handle, map->size, dev); - break; - case _DRM_SHM: - vfree(map->handle); - break; - case _DRM_AGP: - case _DRM_SCATTER_GATHER: - break; - } - DRM(free)(map, sizeof(*map), DRM_MEM_MAPS); - } - } - up(&dev->struct_sem); -} - -/** - * \c nopage method for DMA virtual memory. - * - * \param vma virtual memory area. - * \param address access address. - * \return pointer to the page structure. - * - * Determine the page number from the page offset and get it from drm_device_dma::pagelist. - */ -static __inline__ struct page *DRM(do_vm_dma_nopage)(struct vm_area_struct *vma, - unsigned long address) -{ - drm_file_t *priv = vma->vm_file->private_data; - drm_device_t *dev = priv->dev; - drm_device_dma_t *dma = dev->dma; - unsigned long offset; - unsigned long page_nr; - struct page *page; - - if (!dma) return NOPAGE_SIGBUS; /* Error */ - if (address > vma->vm_end) return NOPAGE_SIGBUS; /* Disallow mremap */ - if (!dma->pagelist) return NOPAGE_OOM ; /* Nothing allocated */ - - offset = address - vma->vm_start; /* vm_[pg]off[set] should be 0 */ - page_nr = offset >> PAGE_SHIFT; - page = virt_to_page((dma->pagelist[page_nr] + - (offset & (~PAGE_MASK)))); - - get_page(page); - - DRM_DEBUG("dma_nopage 0x%lx (page %lu)\n", address, page_nr); - return page; -} - -/** - * \c nopage method for scatter-gather virtual memory. - * - * \param vma virtual memory area. - * \param address access address. - * \return pointer to the page structure. - * - * Determine the map offset from the page offset and get it from drm_sg_mem::pagelist. - */ -static __inline__ struct page *DRM(do_vm_sg_nopage)(struct vm_area_struct *vma, - unsigned long address) -{ - drm_map_t *map = (drm_map_t *)vma->vm_private_data; - drm_file_t *priv = vma->vm_file->private_data; - drm_device_t *dev = priv->dev; - drm_sg_mem_t *entry = dev->sg; - unsigned long offset; - unsigned long map_offset; - unsigned long page_offset; - struct page *page; - - if (!entry) return NOPAGE_SIGBUS; /* Error */ - if (address > vma->vm_end) return NOPAGE_SIGBUS; /* Disallow mremap */ - if (!entry->pagelist) return NOPAGE_OOM ; /* Nothing allocated */ - - - offset = address - vma->vm_start; - map_offset = map->offset - dev->sg->handle; - page_offset = (offset >> PAGE_SHIFT) + (map_offset >> PAGE_SHIFT); - page = entry->pagelist[page_offset]; - get_page(page); - - return page; -} - - -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - -static struct page *DRM(vm_nopage)(struct vm_area_struct *vma, - unsigned long address, - int *type) { - if (type) *type = VM_FAULT_MINOR; - return DRM(do_vm_nopage)(vma, address); -} - -static struct page *DRM(vm_shm_nopage)(struct vm_area_struct *vma, - unsigned long address, - int *type) { - if (type) *type = VM_FAULT_MINOR; - return DRM(do_vm_shm_nopage)(vma, address); -} - -static struct page *DRM(vm_dma_nopage)(struct vm_area_struct *vma, - unsigned long address, - int *type) { - if (type) *type = VM_FAULT_MINOR; - return DRM(do_vm_dma_nopage)(vma, address); -} - -static struct page *DRM(vm_sg_nopage)(struct vm_area_struct *vma, - unsigned long address, - int *type) { - if (type) *type = VM_FAULT_MINOR; - return DRM(do_vm_sg_nopage)(vma, address); -} - -#else /* LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,0) */ - -static struct page *DRM(vm_nopage)(struct vm_area_struct *vma, - unsigned long address, - int unused) { - return DRM(do_vm_nopage)(vma, address); -} - -static struct page *DRM(vm_shm_nopage)(struct vm_area_struct *vma, - unsigned long address, - int unused) { - return DRM(do_vm_shm_nopage)(vma, address); -} - -static struct page *DRM(vm_dma_nopage)(struct vm_area_struct *vma, - unsigned long address, - int unused) { - return DRM(do_vm_dma_nopage)(vma, address); -} - -static struct page *DRM(vm_sg_nopage)(struct vm_area_struct *vma, - unsigned long address, - int unused) { - return DRM(do_vm_sg_nopage)(vma, address); -} - -#endif - - -/** AGP virtual memory operations */ -static struct vm_operations_struct DRM(vm_ops) = { - .nopage = DRM(vm_nopage), - .open = DRM(vm_open), - .close = DRM(vm_close), -}; - -/** Shared virtual memory operations */ -static struct vm_operations_struct DRM(vm_shm_ops) = { - .nopage = DRM(vm_shm_nopage), - .open = DRM(vm_open), - .close = DRM(vm_shm_close), -}; - -/** DMA virtual memory operations */ -static struct vm_operations_struct DRM(vm_dma_ops) = { - .nopage = DRM(vm_dma_nopage), - .open = DRM(vm_open), - .close = DRM(vm_close), -}; - -/** Scatter-gather virtual memory operations */ -static struct vm_operations_struct DRM(vm_sg_ops) = { - .nopage = DRM(vm_sg_nopage), - .open = DRM(vm_open), - .close = DRM(vm_close), -}; - - -/** - * \c open method for shared virtual memory. - * - * \param vma virtual memory area. - * - * Create a new drm_vma_entry structure as the \p vma private data entry and - * add it to drm_device::vmalist. - */ -void DRM(vm_open)(struct vm_area_struct *vma) -{ - drm_file_t *priv = vma->vm_file->private_data; - drm_device_t *dev = priv->dev; - drm_vma_entry_t *vma_entry; - - DRM_DEBUG("0x%08lx,0x%08lx\n", - vma->vm_start, vma->vm_end - vma->vm_start); - atomic_inc(&dev->vma_count); - - vma_entry = DRM(alloc)(sizeof(*vma_entry), DRM_MEM_VMAS); - if (vma_entry) { - down(&dev->struct_sem); - vma_entry->vma = vma; - vma_entry->next = dev->vmalist; - vma_entry->pid = current->pid; - dev->vmalist = vma_entry; - up(&dev->struct_sem); - } -} - -/** - * \c close method for all virtual memory types. - * - * \param vma virtual memory area. - * - * Search the \p vma private data entry in drm_device::vmalist, unlink it, and - * free it. - */ -void DRM(vm_close)(struct vm_area_struct *vma) -{ - drm_file_t *priv = vma->vm_file->private_data; - drm_device_t *dev = priv->dev; - drm_vma_entry_t *pt, *prev; - - DRM_DEBUG("0x%08lx,0x%08lx\n", - vma->vm_start, vma->vm_end - vma->vm_start); - atomic_dec(&dev->vma_count); - - down(&dev->struct_sem); - for (pt = dev->vmalist, prev = NULL; pt; prev = pt, pt = pt->next) { - if (pt->vma == vma) { - if (prev) { - prev->next = pt->next; - } else { - dev->vmalist = pt->next; - } - DRM(free)(pt, sizeof(*pt), DRM_MEM_VMAS); - break; - } - } - up(&dev->struct_sem); -} - -/** - * mmap DMA memory. - * - * \param filp file pointer. - * \param vma virtual memory area. - * \return zero on success or a negative number on failure. - * - * Sets the virtual memory area operations structure to vm_dma_ops, the file - * pointer, and calls vm_open(). - */ -int DRM(mmap_dma)(struct file *filp, struct vm_area_struct *vma) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev; - drm_device_dma_t *dma; - unsigned long length = vma->vm_end - vma->vm_start; - - lock_kernel(); - dev = priv->dev; - dma = dev->dma; - DRM_DEBUG("start = 0x%lx, end = 0x%lx, offset = 0x%lx\n", - vma->vm_start, vma->vm_end, VM_OFFSET(vma)); - - /* Length must match exact page count */ - if (!dma || (length >> PAGE_SHIFT) != dma->page_count) { - unlock_kernel(); - return -EINVAL; - } - unlock_kernel(); - - vma->vm_ops = &DRM(vm_dma_ops); - -#if LINUX_VERSION_CODE <= 0x02040e /* KERNEL_VERSION(2,4,14) */ - vma->vm_flags |= VM_LOCKED | VM_SHM; /* Don't swap */ -#else - vma->vm_flags |= VM_RESERVED; /* Don't swap */ -#endif - - vma->vm_file = filp; /* Needed for drm_vm_open() */ - DRM(vm_open)(vma); - return 0; -} - -unsigned long DRM(core_get_map_ofs)(drm_map_t *map) -{ - return map->offset; -} - -unsigned long DRM(core_get_reg_ofs)(struct drm_device *dev) -{ -#ifdef __alpha__ - return dev->hose->dense_mem_base - dev->hose->mem_space->start; -#else - return 0; -#endif -} - -/** - * mmap DMA memory. - * - * \param filp file pointer. - * \param vma virtual memory area. - * \return zero on success or a negative number on failure. - * - * If the virtual memory area has no offset associated with it then it's a DMA - * area, so calls mmap_dma(). Otherwise searches the map in drm_device::maplist, - * checks that the restricted flag is not set, sets the virtual memory operations - * according to the mapping type and remaps the pages. Finally sets the file - * pointer and calls vm_open(). - */ -int DRM(mmap)(struct file *filp, struct vm_area_struct *vma) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_map_t *map = NULL; - drm_map_list_t *r_list; - unsigned long offset = 0; - struct list_head *list; - - DRM_DEBUG("start = 0x%lx, end = 0x%lx, offset = 0x%lx\n", - vma->vm_start, vma->vm_end, VM_OFFSET(vma)); - - if ( !priv->authenticated ) return -EACCES; - - /* We check for "dma". On Apple's UniNorth, it's valid to have - * the AGP mapped at physical address 0 - * --BenH. - */ - if (!VM_OFFSET(vma) -#if __OS_HAS_AGP - && (!dev->agp || dev->agp->agp_info.device->vendor != PCI_VENDOR_ID_APPLE) -#endif - ) - return DRM(mmap_dma)(filp, vma); - - /* A sequential search of a linked list is - fine here because: 1) there will only be - about 5-10 entries in the list and, 2) a - DRI client only has to do this mapping - once, so it doesn't have to be optimized - for performance, even if the list was a - bit longer. */ - list_for_each(list, &dev->maplist->head) { - unsigned long off; - - r_list = list_entry(list, drm_map_list_t, head); - map = r_list->map; - if (!map) continue; - off = dev->fn_tbl.get_map_ofs(map); - if (off == VM_OFFSET(vma)) break; - } - - if (!map || ((map->flags&_DRM_RESTRICTED) && !capable(CAP_SYS_ADMIN))) - return -EPERM; - - /* Check for valid size. */ - if (map->size != vma->vm_end - vma->vm_start) return -EINVAL; - - if (!capable(CAP_SYS_ADMIN) && (map->flags & _DRM_READ_ONLY)) { - vma->vm_flags &= ~(VM_WRITE | VM_MAYWRITE); -#if defined(__i386__) || defined(__x86_64__) - pgprot_val(vma->vm_page_prot) &= ~_PAGE_RW; -#else - /* Ye gads this is ugly. With more thought - we could move this up higher and use - `protection_map' instead. */ - vma->vm_page_prot = __pgprot(pte_val(pte_wrprotect( - __pte(pgprot_val(vma->vm_page_prot))))); -#endif - } - - switch (map->type) { - case _DRM_AGP: - if (drm_core_has_AGP(dev) && dev->agp->cant_use_aperture) { - /* - * On some platforms we can't talk to bus dma address from the CPU, so for - * memory of type DRM_AGP, we'll deal with sorting out the real physical - * pages and mappings in nopage() - */ -#if defined(__powerpc__) - pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE; -#endif - vma->vm_ops = &DRM(vm_ops); - break; - } - /* fall through to _DRM_FRAME_BUFFER... */ - case _DRM_FRAME_BUFFER: - case _DRM_REGISTERS: - if (VM_OFFSET(vma) >= __pa(high_memory)) { -#if defined(__i386__) || defined(__x86_64__) - if (boot_cpu_data.x86 > 3 && map->type != _DRM_AGP) { - pgprot_val(vma->vm_page_prot) |= _PAGE_PCD; - pgprot_val(vma->vm_page_prot) &= ~_PAGE_PWT; - } -#elif defined(__powerpc__) - pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE | _PAGE_GUARDED; -#endif - vma->vm_flags |= VM_IO; /* not in core dump */ - } -#if defined(__ia64__) - if (map->type != _DRM_AGP) - vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); -#endif - offset = dev->fn_tbl.get_reg_ofs(dev); -#ifdef __sparc__ - if (io_remap_page_range(DRM_RPR_ARG(vma) vma->vm_start, - VM_OFFSET(vma) + offset, - vma->vm_end - vma->vm_start, - vma->vm_page_prot, 0)) -#else - if (remap_pfn_range(DRM_RPR_ARG(vma) vma->vm_start, - (VM_OFFSET(vma) + offset) >> PAGE_SHIFT, - vma->vm_end - vma->vm_start, - vma->vm_page_prot)) -#endif - return -EAGAIN; - DRM_DEBUG(" Type = %d; start = 0x%lx, end = 0x%lx," - " offset = 0x%lx\n", - map->type, - vma->vm_start, vma->vm_end, VM_OFFSET(vma) + offset); - vma->vm_ops = &DRM(vm_ops); - break; - case _DRM_SHM: - vma->vm_ops = &DRM(vm_shm_ops); - vma->vm_private_data = (void *)map; - /* Don't let this area swap. Change when - DRM_KERNEL advisory is supported. */ -#if LINUX_VERSION_CODE <= 0x02040e /* KERNEL_VERSION(2,4,14) */ - vma->vm_flags |= VM_LOCKED; -#else - vma->vm_flags |= VM_RESERVED; -#endif - break; - case _DRM_SCATTER_GATHER: - vma->vm_ops = &DRM(vm_sg_ops); - vma->vm_private_data = (void *)map; -#if LINUX_VERSION_CODE <= 0x02040e /* KERNEL_VERSION(2,4,14) */ - vma->vm_flags |= VM_LOCKED; -#else - vma->vm_flags |= VM_RESERVED; -#endif - break; - default: - return -EINVAL; /* This should never happen. */ - } -#if LINUX_VERSION_CODE <= 0x02040e /* KERNEL_VERSION(2,4,14) */ - vma->vm_flags |= VM_LOCKED | VM_SHM; /* Don't swap */ -#else - vma->vm_flags |= VM_RESERVED; /* Don't swap */ -#endif - - vma->vm_file = filp; /* Needed for drm_vm_open() */ - DRM(vm_open)(vma); - return 0; -} diff -Nru a/drivers/char/drm/ffb_drv.c b/drivers/char/drm/ffb_drv.c --- a/drivers/char/drm/ffb_drv.c 2005-01-02 23:03:35 -08:00 +++ b/drivers/char/drm/ffb_drv.c 2005-01-02 23:03:35 -08:00 @@ -210,9 +210,7 @@ return addr; } -#include "drm_core.h" - -/* This functions must be here since it references DRM(numdevs) +/* This functions must be here since it references drm_numdevs) * which drm_drv.h declares. */ static int ffb_presetup(drm_device_t *dev) @@ -227,13 +225,13 @@ return -ENODEV; /* Find our instance number by finding our device in dev structure */ - for (i = 0; i < DRM(numdevs); i++) { - temp_dev = &(DRM(device)[i]); + for (i = 0; i < drm_numdevs; i++) { + temp_dev = &(drm_device[i]); if(temp_dev == dev) break; } - if (i == DRM(numdevs)) + if (i == drm_numdevs) return -ENODEV; ffb_priv = kmalloc(sizeof(ffb_dev_priv_t), GFP_KERNEL); @@ -311,12 +309,12 @@ { ffb_set_context_ioctls(); DRM(fops).get_unmapped_area = ffb_get_unmapped_area; - dev->fn_tbl.release = ffb_driver_release; - dev->fn_tbl.presetup = ffb_presetup; - dev->fn_tbl.pretakedown = ffb_driver_pretakedown; - dev->fn_tbl.postcleanup = ffb_driver_postcleanup; - dev->fn_tbl.kernel_context_switch = ffb_context_switch; - dev->fn_tbl.kernel_context_switch_unlock = ffb_driver_kernel_context_switch_unlock; - dev->fn_tbl.get_map_ofs = ffb_driver_get_map_ofs; - dev->fn_tbl.get_reg_ofs = ffb_driver_get_reg_ofs; + dev->driver.release = ffb_driver_release; + dev->driver.presetup = ffb_presetup; + dev->driver.pretakedown = ffb_driver_pretakedown; + dev->driver.postcleanup = ffb_driver_postcleanup; + dev->driver.kernel_context_switch = ffb_context_switch; + dev->driver.kernel_context_switch_unlock = ffb_driver_kernel_context_switch_unlock; + dev->driver.get_map_ofs = ffb_driver_get_map_ofs; + dev->driver.get_reg_ofs = ffb_driver_get_reg_ofs; } diff -Nru a/drivers/char/drm/gamma_dma.c b/drivers/char/drm/gamma_dma.c --- a/drivers/char/drm/gamma_dma.c 2005-01-02 23:03:35 -08:00 +++ b/drivers/char/drm/gamma_dma.c 2005-01-02 23:03:35 -08:00 @@ -937,10 +937,10 @@ dev->driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ; DRM(fops).read = gamma_fops_read; DRM(fops).poll = gamma_fops_poll; - dev->fn_tbl.preinit = gamma_driver_preinit; - dev->fn_tbl.pretakedown = gamma_driver_pretakedown; - dev->fn_tbl.dma_ready = gamma_driver_dma_ready; - dev->fn_tbl.dma_quiescent = gamma_driver_dma_quiescent; - dev->fn_tbl.dma_flush_block_and_flush = gamma_flush_block_and_flush; - dev->fn_tbl.dma_flush_unblock = gamma_flush_unblock; + dev->driver.preinit = gamma_driver_preinit; + dev->driver.pretakedown = gamma_driver_pretakedown; + dev->driver.dma_ready = gamma_driver_dma_ready; + dev->driver.dma_quiescent = gamma_driver_dma_quiescent; + dev->driver.dma_flush_block_and_flush = gamma_flush_block_and_flush; + dev->driver.dma_flush_unblock = gamma_flush_unblock; } diff -Nru a/drivers/char/drm/i810_dma.c b/drivers/char/drm/i810_dma.c --- a/drivers/char/drm/i810_dma.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/char/drm/i810_dma.c 2005-01-02 23:03:33 -08:00 @@ -30,7 +30,6 @@ * */ -#include "i810.h" #include "drmP.h" #include "drm.h" #include "i810_drm.h" @@ -110,12 +109,12 @@ } static struct file_operations i810_buffer_fops = { - .open = DRM(open), - .flush = DRM(flush), - .release = DRM(release), - .ioctl = DRM(ioctl), + .open = drm_open, + .flush = drm_flush, + .release = drm_release, + .ioctl = drm_ioctl, .mmap = i810_mmap_buffers, - .fasync = DRM(fasync), + .fasync = drm_fasync, }; int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma) @@ -237,7 +236,7 @@ * is freed, it's too late. */ if (drm_core_check_feature(dev, DRIVER_HAVE_IRQ) && dev->irq_enabled) - DRM(irq_uninstall)(dev); + drm_irq_uninstall(dev); if (dev->dev_private) { int i; @@ -245,7 +244,7 @@ (drm_i810_private_t *) dev->dev_private; if (dev_priv->ring.virtual_start) { - DRM(ioremapfree)((void *) dev_priv->ring.virtual_start, + drm_ioremapfree((void *) dev_priv->ring.virtual_start, dev_priv->ring.Size, dev); } if (dev_priv->hw_status_page) { @@ -255,7 +254,7 @@ /* Need to rewrite hardware status page */ I810_WRITE(0x02080, 0x1ffff000); } - DRM(free)(dev->dev_private, sizeof(drm_i810_private_t), + drm_free(dev->dev_private, sizeof(drm_i810_private_t), DRM_MEM_DRIVER); dev->dev_private = NULL; @@ -263,7 +262,7 @@ drm_buf_t *buf = dma->buflist[ i ]; drm_i810_buf_priv_t *buf_priv = buf->dev_private; if ( buf_priv->kernel_virtual && buf->total ) - DRM(ioremapfree)(buf_priv->kernel_virtual, buf->total, dev); + drm_ioremapfree(buf_priv->kernel_virtual, buf->total, dev); } } return 0; @@ -334,7 +333,7 @@ *buf_priv->in_use = I810_BUF_FREE; - buf_priv->kernel_virtual = DRM(ioremap)(buf->bus_address, + buf_priv->kernel_virtual = drm_ioremap(buf->bus_address, buf->total, dev); } return 0; @@ -386,7 +385,7 @@ dev_priv->ring.End = init->ring_end; dev_priv->ring.Size = init->ring_size; - dev_priv->ring.virtual_start = DRM(ioremap)(dev->agp->base + + dev_priv->ring.virtual_start = drm_ioremap(dev->agp->base + init->ring_start, init->ring_size, dev); @@ -510,7 +509,7 @@ if (retcode) return retcode; - dev_priv = DRM(alloc)(sizeof(drm_i810_private_t), + dev_priv = drm_alloc(sizeof(drm_i810_private_t), DRM_MEM_DRIVER); if (dev_priv == NULL) return -ENOMEM; @@ -524,7 +523,7 @@ sizeof(drm_i810_init_t))) { return -EFAULT; } - dev_priv = DRM(alloc)(sizeof(drm_i810_private_t), + dev_priv = drm_alloc(sizeof(drm_i810_private_t), DRM_MEM_DRIVER); if (dev_priv == NULL) return -ENOMEM; @@ -995,10 +994,8 @@ } /* Must be called with the lock held */ -void i810_reclaim_buffers(struct file *filp) +void i810_reclaim_buffers(drm_device_t *dev, struct file *filp) { - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; drm_device_dma_t *dma = dev->dma; int i; @@ -1030,10 +1027,7 @@ drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i810_flush_ioctl called without lock held\n"); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN(dev, filp); i810_flush_queue(dev); return 0; @@ -1055,10 +1049,7 @@ if (copy_from_user(&vertex, (drm_i810_vertex_t __user *)arg, sizeof(vertex))) return -EFAULT; - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i810_dma_vertex called without lock held\n"); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN(dev, filp); DRM_DEBUG("i810 dma vertex, idx %d used %d discard %d\n", vertex.idx, vertex.used, vertex.discard); @@ -1090,10 +1081,7 @@ if (copy_from_user(&clear, (drm_i810_clear_t __user *)arg, sizeof(clear))) return -EFAULT; - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i810_clear_bufs called without lock held\n"); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN(dev, filp); /* GH: Someone's doing nasty things... */ if (!dev->dev_private) { @@ -1114,10 +1102,7 @@ DRM_DEBUG("i810_swap_bufs\n"); - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i810_swap_buf called without lock held\n"); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN(dev, filp); i810_dma_dispatch_swap( dev ); return 0; @@ -1152,10 +1137,7 @@ if (copy_from_user(&d, (drm_i810_dma_t __user *)arg, sizeof(d))) return -EFAULT; - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i810_dma called without lock held\n"); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN(dev, filp); d.granted = 0; @@ -1265,11 +1247,7 @@ if (copy_from_user(&mc, (drm_i810_mc_t __user *)arg, sizeof(mc))) return -EFAULT; - - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i810_dma_mc called without lock held\n"); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN(dev, filp); if (mc.idx >= dma->buf_count || mc.idx < 0) return -EINVAL; @@ -1317,10 +1295,8 @@ drm_device_t *dev = priv->dev; drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i810_fstatus called without lock held\n"); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN(dev, filp); + return I810_READ(0x30008); } @@ -1331,10 +1307,7 @@ drm_device_t *dev = priv->dev; drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i810_ov0_flip called without lock held\n"); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN(dev, filp); //Tell the overlay to update I810_WRITE(0x30000,dev_priv->overlay_physical | 0x80000000); @@ -1376,10 +1349,7 @@ DRM_DEBUG("%s\n", __FUNCTION__); - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i810_flip_buf called without lock held\n"); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN(dev, filp); if (!dev_priv->page_flipping) i810_do_init_pageflip( dev ); @@ -1388,35 +1358,20 @@ return 0; } -static void i810_driver_pretakedown(drm_device_t *dev) +void i810_driver_pretakedown(drm_device_t *dev) { i810_dma_cleanup( dev ); } -static void i810_driver_release(drm_device_t *dev, struct file *filp) +void i810_driver_release(drm_device_t *dev, struct file *filp) { - i810_reclaim_buffers(filp); + i810_reclaim_buffers(dev, filp); } -static int i810_driver_dma_quiescent(drm_device_t *dev) +int i810_driver_dma_quiescent(drm_device_t *dev) { i810_dma_quiescent( dev ); return 0; } -void i810_driver_register_fns(drm_device_t *dev) -{ - dev->driver_features = DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR | DRIVER_HAVE_DMA | DRIVER_DMA_QUEUE; - dev->dev_priv_size = sizeof(drm_i810_buf_priv_t); - dev->fn_tbl.pretakedown = i810_driver_pretakedown; - dev->fn_tbl.release = i810_driver_release; - dev->fn_tbl.dma_quiescent = i810_driver_dma_quiescent; - dev->fn_tbl.reclaim_buffers = i810_reclaim_buffers; - - dev->counters += 4; - dev->types[6] = _DRM_STAT_IRQ; - dev->types[7] = _DRM_STAT_PRIMARY; - dev->types[8] = _DRM_STAT_SECONDARY; - dev->types[9] = _DRM_STAT_DMA; -} diff -Nru a/drivers/char/drm/i810_drm.h b/drivers/char/drm/i810_drm.h --- a/drivers/char/drm/i810_drm.h 2005-01-02 23:03:35 -08:00 +++ b/drivers/char/drm/i810_drm.h 2005-01-02 23:03:35 -08:00 @@ -199,21 +199,37 @@ /* i810 specific ioctls * The device specific ioctl range is 0x40 to 0x79. */ -#define DRM_IOCTL_I810_INIT DRM_IOW( 0x40, drm_i810_init_t) -#define DRM_IOCTL_I810_VERTEX DRM_IOW( 0x41, drm_i810_vertex_t) -#define DRM_IOCTL_I810_CLEAR DRM_IOW( 0x42, drm_i810_clear_t) -#define DRM_IOCTL_I810_FLUSH DRM_IO( 0x43) -#define DRM_IOCTL_I810_GETAGE DRM_IO( 0x44) -#define DRM_IOCTL_I810_GETBUF DRM_IOWR(0x45, drm_i810_dma_t) -#define DRM_IOCTL_I810_SWAP DRM_IO( 0x46) -#define DRM_IOCTL_I810_COPY DRM_IOW( 0x47, drm_i810_copy_t) -#define DRM_IOCTL_I810_DOCOPY DRM_IO( 0x48) -#define DRM_IOCTL_I810_OV0INFO DRM_IOR( 0x49, drm_i810_overlay_t) -#define DRM_IOCTL_I810_FSTATUS DRM_IO ( 0x4a) -#define DRM_IOCTL_I810_OV0FLIP DRM_IO ( 0x4b) -#define DRM_IOCTL_I810_MC DRM_IOW( 0x4c, drm_i810_mc_t) -#define DRM_IOCTL_I810_RSTATUS DRM_IO ( 0x4d ) -#define DRM_IOCTL_I810_FLIP DRM_IO ( 0x4e ) +#define DRM_I810_INIT 0x00 +#define DRM_I810_VERTEX 0x01 +#define DRM_I810_CLEAR 0x02 +#define DRM_I810_FLUSH 0x03 +#define DRM_I810_GETAGE 0x04 +#define DRM_I810_GETBUF 0x05 +#define DRM_I810_SWAP 0x06 +#define DRM_I810_COPY 0x07 +#define DRM_I810_DOCOPY 0x08 +#define DRM_I810_OV0INFO 0x09 +#define DRM_I810_FSTATUS 0x0a +#define DRM_I810_OV0FLIP 0x0b +#define DRM_I810_MC 0x0c +#define DRM_I810_RSTATUS 0x0d +#define DRM_I810_FLIP 0x0e + +#define DRM_IOCTL_I810_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I810_INIT, drm_i810_init_t) +#define DRM_IOCTL_I810_VERTEX DRM_IOW( DRM_COMMAND_BASE + DRM_I810_VERTEX, drm_i810_vertex_t) +#define DRM_IOCTL_I810_CLEAR DRM_IOW( DRM_COMMAND_BASE + DRM_I810_CLEAR, drm_i810_clear_t) +#define DRM_IOCTL_I810_FLUSH DRM_IO( DRM_COMMAND_BASE + DRM_I810_FLUSH) +#define DRM_IOCTL_I810_GETAGE DRM_IO( DRM_COMMAND_BASE + DRM_I810_GETAGE) +#define DRM_IOCTL_I810_GETBUF DRM_IOWR(DRM_COMMAND_BASE + DRM_I810_GETBUF, drm_i810_dma_t) +#define DRM_IOCTL_I810_SWAP DRM_IO( DRM_COMMAND_BASE + DRM_I810_SWAP) +#define DRM_IOCTL_I810_COPY DRM_IOW( DRM_COMMAND_BASE + DRM_I810_COPY, drm_i810_copy_t) +#define DRM_IOCTL_I810_DOCOPY DRM_IO( DRM_COMMAND_BASE + DRM_I810_DOCOPY) +#define DRM_IOCTL_I810_OV0INFO DRM_IOR( DRM_COMMAND_BASE + DRM_I810_OV0INFO, drm_i810_overlay_t) +#define DRM_IOCTL_I810_FSTATUS DRM_IO ( DRM_COMMAND_BASE + DRM_I810_FSTATUS) +#define DRM_IOCTL_I810_OV0FLIP DRM_IO ( DRM_COMMAND_BASE + DRM_I810_OV0FLIP) +#define DRM_IOCTL_I810_MC DRM_IOW( DRM_COMMAND_BASE + DRM_I810_MC, drm_i810_mc_t) +#define DRM_IOCTL_I810_RSTATUS DRM_IO ( DRM_COMMAND_BASE + DRM_I810_RSTATUS) +#define DRM_IOCTL_I810_FLIP DRM_IO ( DRM_COMMAND_BASE + DRM_I810_FLIP) typedef struct _drm_i810_clear { int clear_color; diff -Nru a/drivers/char/drm/i810_drv.c b/drivers/char/drm/i810_drv.c --- a/drivers/char/drm/i810_drv.c 2005-01-02 23:03:35 -08:00 +++ b/drivers/char/drm/i810_drv.c 2005-01-02 23:03:35 -08:00 @@ -31,10 +31,110 @@ */ #include -#include "i810.h" #include "drmP.h" #include "drm.h" #include "i810_drm.h" #include "i810_drv.h" -#include "drm_core.h" +#include "drm_pciids.h" + +static int postinit( struct drm_device *dev, unsigned long flags ) +{ + /* i810 has 4 more counters */ + dev->counters += 4; + dev->types[6] = _DRM_STAT_IRQ; + dev->types[7] = _DRM_STAT_PRIMARY; + dev->types[8] = _DRM_STAT_SECONDARY; + dev->types[9] = _DRM_STAT_DMA; + + DRM_INFO( "Initialized %s %d.%d.%d %s on minor %d: %s\n", + DRIVER_NAME, + DRIVER_MAJOR, + DRIVER_MINOR, + DRIVER_PATCHLEVEL, + DRIVER_DATE, + dev->minor, + pci_pretty_name(dev->pdev) + ); + return 0; +} + +static int version( drm_version_t *version ) +{ + int len; + + version->version_major = DRIVER_MAJOR; + version->version_minor = DRIVER_MINOR; + version->version_patchlevel = DRIVER_PATCHLEVEL; + DRM_COPY( version->name, DRIVER_NAME ); + DRM_COPY( version->date, DRIVER_DATE ); + DRM_COPY( version->desc, DRIVER_DESC ); + return 0; +} + +static struct pci_device_id pciidlist[] = { + i810_PCI_IDS +}; + +static drm_ioctl_desc_t ioctls[] = { + [DRM_IOCTL_NR(DRM_I810_INIT)] = { i810_dma_init, 1, 1 }, + [DRM_IOCTL_NR(DRM_I810_VERTEX)] = { i810_dma_vertex, 1, 0 }, + [DRM_IOCTL_NR(DRM_I810_CLEAR)] = { i810_clear_bufs, 1, 0 }, + [DRM_IOCTL_NR(DRM_I810_FLUSH)] = { i810_flush_ioctl, 1, 0 }, + [DRM_IOCTL_NR(DRM_I810_GETAGE)] = { i810_getage, 1, 0 }, + [DRM_IOCTL_NR(DRM_I810_GETBUF)] = { i810_getbuf, 1, 0 }, + [DRM_IOCTL_NR(DRM_I810_SWAP)] = { i810_swap_bufs, 1, 0 }, + [DRM_IOCTL_NR(DRM_I810_COPY)] = { i810_copybuf, 1, 0 }, + [DRM_IOCTL_NR(DRM_I810_DOCOPY)] = { i810_docopy, 1, 0 }, + [DRM_IOCTL_NR(DRM_I810_OV0INFO)] = { i810_ov0_info, 1, 0 }, + [DRM_IOCTL_NR(DRM_I810_FSTATUS)] = { i810_fstatus, 1, 0 }, + [DRM_IOCTL_NR(DRM_I810_OV0FLIP)] = { i810_ov0_flip, 1, 0 }, + [DRM_IOCTL_NR(DRM_I810_MC)] = { i810_dma_mc, 1, 1 }, + [DRM_IOCTL_NR(DRM_I810_RSTATUS)] = { i810_rstatus, 1, 0 }, + [DRM_IOCTL_NR(DRM_I810_FLIP)] = { i810_flip_bufs, 1, 0 } +}; + +static struct drm_driver driver = { + .driver_features = DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR | DRIVER_HAVE_DMA | DRIVER_DMA_QUEUE, + .dev_priv_size = sizeof(drm_i810_buf_priv_t), + .pretakedown = i810_driver_pretakedown, + .release = i810_driver_release, + .dma_quiescent = i810_driver_dma_quiescent, + .reclaim_buffers = i810_reclaim_buffers, + .get_map_ofs = drm_core_get_map_ofs, + .get_reg_ofs = drm_core_get_reg_ofs, + .postinit = postinit, + .version = version, + .ioctls = ioctls, + .num_ioctls = DRM_ARRAY_SIZE(ioctls), + .fops = { + .owner = THIS_MODULE, + .open = drm_open, + .release = drm_release, + .ioctl = drm_ioctl, + .mmap = drm_mmap, + .poll = drm_poll, + .fasync = drm_fasync, + }, + .pci_driver = { + .name = DRIVER_NAME, + .id_table = pciidlist, + }, +}; + +static int __init i810_init(void) +{ + return drm_init(&driver); +} + +static void __exit i810_exit(void) +{ + drm_exit(&driver); +} + +module_init(i810_init); +module_exit(i810_exit); + +MODULE_AUTHOR( DRIVER_AUTHOR ); +MODULE_DESCRIPTION( DRIVER_DESC ); +MODULE_LICENSE("GPL and additional rights"); diff -Nru a/drivers/char/drm/i810_drv.h b/drivers/char/drm/i810_drv.h --- a/drivers/char/drm/i810_drv.h 2005-01-02 23:03:35 -08:00 +++ b/drivers/char/drm/i810_drv.h 2005-01-02 23:03:35 -08:00 @@ -32,6 +32,29 @@ #ifndef _I810_DRV_H_ #define _I810_DRV_H_ +/* General customization: + */ + +#define DRIVER_AUTHOR "VA Linux Systems Inc." + +#define DRIVER_NAME "i810" +#define DRIVER_DESC "Intel i810" +#define DRIVER_DATE "20030605" + +/* Interface history + * + * 1.1 - XFree86 4.1 + * 1.2 - XvMC interfaces + * - XFree86 4.2 + * 1.2.1 - Disable copying code (leave stub ioctls for backwards compatibility) + * - Remove requirement for interrupt (leave stubs again) + * 1.3 - Add page flipping. + * 1.4 - fix DRM interface + */ +#define DRIVER_MAJOR 1 +#define DRIVER_MINOR 4 +#define DRIVER_PATCHLEVEL 0 + typedef struct drm_i810_buf_priv { u32 *in_use; int my_use_idx; @@ -99,7 +122,7 @@ extern int i810_dma_cleanup(drm_device_t *dev); extern int i810_flush_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern void i810_reclaim_buffers(struct file *filp); +extern void i810_reclaim_buffers(drm_device_t *dev, struct file *filp); extern int i810_getage(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); extern int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma); @@ -127,17 +150,21 @@ extern void i810_dma_quiescent(drm_device_t *dev); -int i810_dma_vertex(struct inode *inode, struct file *filp, +extern int i810_dma_vertex(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -int i810_swap_bufs(struct inode *inode, struct file *filp, +extern int i810_swap_bufs(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -int i810_clear_bufs(struct inode *inode, struct file *filp, +extern int i810_clear_bufs(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -int i810_flip_bufs(struct inode *inode, struct file *filp, +extern int i810_flip_bufs(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); + +extern int i810_driver_dma_quiescent(drm_device_t *dev); +extern void i810_driver_release(drm_device_t *dev, struct file *filp); +extern void i810_driver_pretakedown(drm_device_t *dev); #define I810_BASE(reg) ((unsigned long) \ dev_priv->mmio_map->handle) diff -Nru a/drivers/char/drm/i830_dma.c b/drivers/char/drm/i830_dma.c --- a/drivers/char/drm/i830_dma.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/char/drm/i830_dma.c 2005-01-02 23:03:33 -08:00 @@ -31,7 +31,6 @@ * */ -#include "i830.h" #include "drmP.h" #include "drm.h" #include "i830_drm.h" @@ -111,12 +110,12 @@ } static struct file_operations i830_buffer_fops = { - .open = DRM(open), - .flush = DRM(flush), - .release = DRM(release), - .ioctl = DRM(ioctl), + .open = drm_open, + .flush = drm_flush, + .release = drm_release, + .ioctl = drm_ioctl, .mmap = i830_mmap_buffers, - .fasync = DRM(fasync), + .fasync = drm_fasync, }; int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma) @@ -237,7 +236,7 @@ * may not have been called from userspace and after dev_private * is freed, it's too late. */ - if ( dev->irq_enabled ) DRM(irq_uninstall)(dev); + if ( dev->irq_enabled ) drm_irq_uninstall(dev); if (dev->dev_private) { int i; @@ -245,7 +244,7 @@ (drm_i830_private_t *) dev->dev_private; if (dev_priv->ring.virtual_start) { - DRM(ioremapfree)((void *) dev_priv->ring.virtual_start, + drm_ioremapfree((void *) dev_priv->ring.virtual_start, dev_priv->ring.Size, dev); } if (dev_priv->hw_status_page) { @@ -256,7 +255,7 @@ I830_WRITE(0x02080, 0x1ffff000); } - DRM(free)(dev->dev_private, sizeof(drm_i830_private_t), + drm_free(dev->dev_private, sizeof(drm_i830_private_t), DRM_MEM_DRIVER); dev->dev_private = NULL; @@ -264,7 +263,7 @@ drm_buf_t *buf = dma->buflist[ i ]; drm_i830_buf_priv_t *buf_priv = buf->dev_private; if ( buf_priv->kernel_virtual && buf->total ) - DRM(ioremapfree)(buf_priv->kernel_virtual, buf->total, dev); + drm_ioremapfree(buf_priv->kernel_virtual, buf->total, dev); } } return 0; @@ -339,7 +338,7 @@ *buf_priv->in_use = I830_BUF_FREE; - buf_priv->kernel_virtual = DRM(ioremap)(buf->bus_address, + buf_priv->kernel_virtual = drm_ioremap(buf->bus_address, buf->total, dev); } return 0; @@ -392,7 +391,7 @@ dev_priv->ring.End = init->ring_end; dev_priv->ring.Size = init->ring_size; - dev_priv->ring.virtual_start = DRM(ioremap)(dev->agp->base + + dev_priv->ring.virtual_start = drm_ioremap(dev->agp->base + init->ring_start, init->ring_size, dev); @@ -475,7 +474,7 @@ switch(init.func) { case I830_INIT_DMA: - dev_priv = DRM(alloc)(sizeof(drm_i830_private_t), + dev_priv = drm_alloc(sizeof(drm_i830_private_t), DRM_MEM_DRIVER); if(dev_priv == NULL) return -ENOMEM; retcode = i830_dma_initialize(dev, dev_priv, &init); @@ -1284,10 +1283,8 @@ } /* Must be called with the lock held */ -void i830_reclaim_buffers( struct file *filp ) +void i830_reclaim_buffers(drm_device_t *dev, struct file *filp) { - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; drm_device_dma_t *dma = dev->dma; int i; @@ -1319,10 +1316,7 @@ drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; - if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i830_flush_ioctl called without lock held\n"); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN(dev, filp); i830_flush_queue(dev); return 0; @@ -1343,10 +1337,7 @@ if (copy_from_user(&vertex, (drm_i830_vertex_t __user *)arg, sizeof(vertex))) return -EFAULT; - if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i830_dma_vertex called without lock held\n"); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN(dev, filp); DRM_DEBUG("i830 dma vertex, idx %d used %d discard %d\n", vertex.idx, vertex.used, vertex.discard); @@ -1373,10 +1364,7 @@ if (copy_from_user(&clear, (drm_i830_clear_t __user *)arg, sizeof(clear))) return -EFAULT; - if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i830_clear_bufs called without lock held\n"); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN(dev, filp); /* GH: Someone's doing nasty things... */ if (!dev->dev_private) { @@ -1398,10 +1386,7 @@ DRM_DEBUG("i830_swap_bufs\n"); - if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i830_swap_buf called without lock held\n"); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN(dev, filp); i830_dma_dispatch_swap( dev ); return 0; @@ -1442,10 +1427,7 @@ DRM_DEBUG("%s\n", __FUNCTION__); - if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i830_flip_buf called without lock held\n"); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN(dev, filp); if (!dev_priv->page_flipping) i830_do_init_pageflip( dev ); @@ -1484,10 +1466,7 @@ if (copy_from_user(&d, (drm_i830_dma_t __user *)arg, sizeof(d))) return -EFAULT; - if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i830_dma called without lock held\n"); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN(dev, filp); d.granted = 0; @@ -1582,43 +1561,19 @@ } -static void i830_driver_pretakedown(drm_device_t *dev) +void i830_driver_pretakedown(drm_device_t *dev) { i830_dma_cleanup( dev ); } -static void i830_driver_release(drm_device_t *dev, struct file *filp) +void i830_driver_release(drm_device_t *dev, struct file *filp) { - i830_reclaim_buffers(filp); + i830_reclaim_buffers(dev, filp); } -static int i830_driver_dma_quiescent(drm_device_t *dev) +int i830_driver_dma_quiescent(drm_device_t *dev) { i830_dma_quiescent( dev ); return 0; -} - -void i830_driver_register_fns(drm_device_t *dev) -{ - dev->driver_features = DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR | DRIVER_HAVE_DMA | DRIVER_DMA_QUEUE; -#if USE_IRQS - dev->driver_features |= DRIVER_HAVE_IRQ | DRIVER_SHARED_IRQ; -#endif - dev->dev_priv_size = sizeof(drm_i830_buf_priv_t); - dev->fn_tbl.pretakedown = i830_driver_pretakedown; - dev->fn_tbl.release = i830_driver_release; - dev->fn_tbl.dma_quiescent = i830_driver_dma_quiescent; - dev->fn_tbl.reclaim_buffers = i830_reclaim_buffers; -#if USE_IRQS - dev->fn_tbl.irq_preinstall = i830_driver_irq_preinstall; - dev->fn_tbl.irq_postinstall = i830_driver_irq_postinstall; - dev->fn_tbl.irq_uninstall = i830_driver_irq_uninstall; - dev->fn_tbl.irq_handler = i830_driver_irq_handler; -#endif - dev->counters += 4; - dev->types[6] = _DRM_STAT_IRQ; - dev->types[7] = _DRM_STAT_PRIMARY; - dev->types[8] = _DRM_STAT_SECONDARY; - dev->types[9] = _DRM_STAT_DMA; } diff -Nru a/drivers/char/drm/i830_drm.h b/drivers/char/drm/i830_drm.h --- a/drivers/char/drm/i830_drm.h 2005-01-02 23:03:33 -08:00 +++ b/drivers/char/drm/i830_drm.h 2005-01-02 23:03:33 -08:00 @@ -251,20 +251,35 @@ /* I830 specific ioctls * The device specific ioctl range is 0x40 to 0x79. */ -#define DRM_IOCTL_I830_INIT DRM_IOW( 0x40, drm_i830_init_t) -#define DRM_IOCTL_I830_VERTEX DRM_IOW( 0x41, drm_i830_vertex_t) -#define DRM_IOCTL_I830_CLEAR DRM_IOW( 0x42, drm_i830_clear_t) -#define DRM_IOCTL_I830_FLUSH DRM_IO ( 0x43) -#define DRM_IOCTL_I830_GETAGE DRM_IO ( 0x44) -#define DRM_IOCTL_I830_GETBUF DRM_IOWR(0x45, drm_i830_dma_t) -#define DRM_IOCTL_I830_SWAP DRM_IO ( 0x46) -#define DRM_IOCTL_I830_COPY DRM_IOW( 0x47, drm_i830_copy_t) -#define DRM_IOCTL_I830_DOCOPY DRM_IO ( 0x48) -#define DRM_IOCTL_I830_FLIP DRM_IO ( 0x49) -#define DRM_IOCTL_I830_IRQ_EMIT DRM_IOWR(0x4a, drm_i830_irq_emit_t) -#define DRM_IOCTL_I830_IRQ_WAIT DRM_IOW( 0x4b, drm_i830_irq_wait_t) -#define DRM_IOCTL_I830_GETPARAM DRM_IOWR(0x4c, drm_i830_getparam_t) -#define DRM_IOCTL_I830_SETPARAM DRM_IOWR(0x4d, drm_i830_setparam_t) +#define DRM_I830_INIT 0x00 +#define DRM_I830_VERTEX 0x01 +#define DRM_I830_CLEAR 0x02 +#define DRM_I830_FLUSH 0x03 +#define DRM_I830_GETAGE 0x04 +#define DRM_I830_GETBUF 0x05 +#define DRM_I830_SWAP 0x06 +#define DRM_I830_COPY 0x07 +#define DRM_I830_DOCOPY 0x08 +#define DRM_I830_FLIP 0x09 +#define DRM_I830_IRQ_EMIT 0x0a +#define DRM_I830_IRQ_WAIT 0x0b +#define DRM_I830_GETPARAM 0x0c +#define DRM_I830_SETPARAM 0x0d + +#define DRM_IOCTL_I830_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_IOCTL_I830_INIT, drm_i830_init_t) +#define DRM_IOCTL_I830_VERTEX DRM_IOW( DRM_COMMAND_BASE + DRM_IOCTL_I830_VERTEX, drm_i830_vertex_t) +#define DRM_IOCTL_I830_CLEAR DRM_IOW( DRM_COMMAND_BASE + DRM_IOCTL_I830_CLEAR, drm_i830_clear_t) +#define DRM_IOCTL_I830_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_IOCTL_I830_FLUSH) +#define DRM_IOCTL_I830_GETAGE DRM_IO ( DRM_COMMAND_BASE + DRM_IOCTL_I830_GETAGE) +#define DRM_IOCTL_I830_GETBUF DRM_IOWR(DRM_COMMAND_BASE + DRM_IOCTL_I830_GETBUF, drm_i830_dma_t) +#define DRM_IOCTL_I830_SWAP DRM_IO ( DRM_COMMAND_BASE + DRM_IOCTL_I830_SWAP) +#define DRM_IOCTL_I830_COPY DRM_IOW( DRM_COMMAND_BASE + DRM_IOCTL_I830_COPY, drm_i830_copy_t) +#define DRM_IOCTL_I830_DOCOPY DRM_IO ( DRM_COMMAND_BASE + DRM_IOCTL_I830_DOCOPY) +#define DRM_IOCTL_I830_FLIP DRM_IO ( DRM_COMMAND_BASE + DRM_IOCTL_I830_FLIP) +#define DRM_IOCTL_I830_IRQ_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_IOCTL_I830_IRQ_EMIT, drm_i830_irq_emit_t) +#define DRM_IOCTL_I830_IRQ_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_IOCTL_I830_IRQ_WAIT, drm_i830_irq_wait_t) +#define DRM_IOCTL_I830_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_IOCTL_I830_GETPARAM, drm_i830_getparam_t) +#define DRM_IOCTL_I830_SETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_IOCTL_I830_SETPARAM, drm_i830_setparam_t) typedef struct _drm_i830_clear { int clear_color; diff -Nru a/drivers/char/drm/i830_drv.c b/drivers/char/drm/i830_drv.c --- a/drivers/char/drm/i830_drv.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/char/drm/i830_drv.c 2005-01-02 23:03:33 -08:00 @@ -33,10 +33,118 @@ */ #include -#include "i830.h" #include "drmP.h" #include "drm.h" #include "i830_drm.h" #include "i830_drv.h" -#include "drm_core.h" +#include "drm_pciids.h" + +int postinit( struct drm_device *dev, unsigned long flags ) +{ + dev->counters += 4; + dev->types[6] = _DRM_STAT_IRQ; + dev->types[7] = _DRM_STAT_PRIMARY; + dev->types[8] = _DRM_STAT_SECONDARY; + dev->types[9] = _DRM_STAT_DMA; + + DRM_INFO( "Initialized %s %d.%d.%d %s on minor %d: %s\n", + DRIVER_NAME, + DRIVER_MAJOR, + DRIVER_MINOR, + DRIVER_PATCHLEVEL, + DRIVER_DATE, + dev->minor, + pci_pretty_name(dev->pdev) + ); + return 0; +} + +static int version( drm_version_t *version ) +{ + int len; + + version->version_major = DRIVER_MAJOR; + version->version_minor = DRIVER_MINOR; + version->version_patchlevel = DRIVER_PATCHLEVEL; + DRM_COPY( version->name, DRIVER_NAME ); + DRM_COPY( version->date, DRIVER_DATE ); + DRM_COPY( version->desc, DRIVER_DESC ); + return 0; +} + +static struct pci_device_id pciidlist[] = { + i830_PCI_IDS +}; + +static drm_ioctl_desc_t ioctls[] = { + [DRM_IOCTL_NR(DRM_I830_INIT)] = { i830_dma_init, 1, 1 }, + [DRM_IOCTL_NR(DRM_I830_VERTEX)] = { i830_dma_vertex, 1, 0 }, + [DRM_IOCTL_NR(DRM_I830_CLEAR)] = { i830_clear_bufs, 1, 0 }, + [DRM_IOCTL_NR(DRM_I830_FLUSH)] = { i830_flush_ioctl, 1, 0 }, + [DRM_IOCTL_NR(DRM_I830_GETAGE)] = { i830_getage, 1, 0 }, + [DRM_IOCTL_NR(DRM_I830_GETBUF)] = { i830_getbuf, 1, 0 }, + [DRM_IOCTL_NR(DRM_I830_SWAP)] = { i830_swap_bufs, 1, 0 }, + [DRM_IOCTL_NR(DRM_I830_COPY)] = { i830_copybuf, 1, 0 }, + [DRM_IOCTL_NR(DRM_I830_DOCOPY)] = { i830_docopy, 1, 0 }, + [DRM_IOCTL_NR(DRM_I830_FLIP)] = { i830_flip_bufs, 1, 0 }, + [DRM_IOCTL_NR(DRM_I830_IRQ_EMIT)] = { i830_irq_emit, 1, 0 }, + [DRM_IOCTL_NR(DRM_I830_IRQ_WAIT)] = { i830_irq_wait, 1, 0 }, + [DRM_IOCTL_NR(DRM_I830_GETPARAM)] = { i830_getparam, 1, 0 }, + [DRM_IOCTL_NR(DRM_I830_SETPARAM)] = { i830_setparam, 1, 0 } +}; + +static struct drm_driver driver = { + .driver_features = DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR | DRIVER_HAVE_DMA | DRIVER_DMA_QUEUE, +#if USE_IRQS + .driver_features |= DRIVER_HAVE_IRQ | DRIVER_SHARED_IRQ, +#endif + .dev_priv_size = sizeof(drm_i830_buf_priv_t), + .pretakedown = i830_driver_pretakedown, + .release = i830_driver_release, + .dma_quiescent = i830_driver_dma_quiescent, + .reclaim_buffers = i830_reclaim_buffers, + .get_map_ofs = drm_core_get_map_ofs, + .get_reg_ofs = drm_core_get_reg_ofs, +#if USE_IRQS + .irq_preinstall = i830_driver_irq_preinstall, + .irq_postinstall = i830_driver_irq_postinstall, + .irq_uninstall = i830_driver_irq_uninstall, + .irq_handler = i830_driver_irq_handler, +#endif + .postinit = postinit, + .version = version, + .ioctls = ioctls, + .num_ioctls = DRM_ARRAY_SIZE(ioctls), + .fops = { + .owner = THIS_MODULE, + .open = drm_open, + .release = drm_release, + .ioctl = drm_ioctl, + .mmap = drm_mmap, + .poll = drm_poll, + .fasync = drm_fasync, + }, + .pci_driver = { + .name = DRIVER_NAME, + .id_table = pciidlist, + } + +}; + +static int __init i830_init(void) +{ + return drm_init(&driver); +} + +static void __exit i830_exit(void) +{ + drm_exit(&driver); +} + +module_init(i830_init); +module_exit(i830_exit); + +MODULE_AUTHOR( DRIVER_AUTHOR ); +MODULE_DESCRIPTION( DRIVER_DESC ); +MODULE_LICENSE("GPL and additional rights"); diff -Nru a/drivers/char/drm/i830_drv.h b/drivers/char/drm/i830_drv.h --- a/drivers/char/drm/i830_drv.h 2005-01-02 23:03:34 -08:00 +++ b/drivers/char/drm/i830_drv.h 2005-01-02 23:03:34 -08:00 @@ -32,6 +32,36 @@ #ifndef _I830_DRV_H_ #define _I830_DRV_H_ +/* General customization: + */ + +#define DRIVER_AUTHOR "VA Linux Systems Inc." + +#define DRIVER_NAME "i830" +#define DRIVER_DESC "Intel 830M" +#define DRIVER_DATE "20021108" + +/* Interface history: + * + * 1.1: Original. + * 1.2: ? + * 1.3: New irq emit/wait ioctls. + * New pageflip ioctl. + * New getparam ioctl. + * State for texunits 3&4 in sarea. + * New (alternative) layout for texture state. + */ +#define DRIVER_MAJOR 1 +#define DRIVER_MINOR 3 +#define DRIVER_PATCHLEVEL 2 + +/* Driver will work either way: IRQ's save cpu time when waiting for + * the card, but are subject to subtle interactions between bios, + * hardware and the driver. + */ +/* XXX: Add vblank support? */ +#define USE_IRQS 0 + typedef struct drm_i830_buf_priv { u32 *in_use; int my_use_idx; @@ -99,7 +129,7 @@ extern int i830_dma_cleanup(drm_device_t *dev); extern int i830_flush_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern void i830_reclaim_buffers(struct file *filp); +extern void i830_reclaim_buffers(drm_device_t *dev, struct file *filp); extern int i830_getage(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); extern int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma); @@ -140,6 +170,9 @@ extern void i830_driver_irq_preinstall( drm_device_t *dev ); extern void i830_driver_irq_postinstall( drm_device_t *dev ); extern void i830_driver_irq_uninstall( drm_device_t *dev ); +extern void i830_driver_pretakedown(drm_device_t *dev); +extern void i830_driver_release(drm_device_t *dev, struct file *filp); +extern int i830_driver_dma_quiescent(drm_device_t *dev); #define I830_BASE(reg) ((unsigned long) \ dev_priv->mmio_map->handle) diff -Nru a/drivers/char/drm/i830_irq.c b/drivers/char/drm/i830_irq.c --- a/drivers/char/drm/i830_irq.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/char/drm/i830_irq.c 2005-01-02 23:03:34 -08:00 @@ -26,7 +26,6 @@ * */ -#include "i830.h" #include "drmP.h" #include "drm.h" #include "i830_drm.h" @@ -129,10 +128,7 @@ drm_i830_irq_emit_t emit; int result; - if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i830_irq_emit called without lock held\n"); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN(dev, filp); if ( !dev_priv ) { DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); diff -Nru a/drivers/char/drm/i915_dma.c b/drivers/char/drm/i915_dma.c --- a/drivers/char/drm/i915_dma.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/char/drm/i915_dma.c 2005-01-02 23:03:33 -08:00 @@ -7,7 +7,6 @@ * **************************************************************************/ -#include "i915.h" #include "drmP.h" #include "drm.h" #include "i915_drm.h" @@ -84,7 +83,7 @@ * is freed, it's too late. */ if (dev->irq) - DRM(irq_uninstall) (dev); + drm_irq_uninstall (dev); if (dev->dev_private) { drm_i915_private_t *dev_priv = @@ -102,7 +101,7 @@ I915_WRITE(0x02080, 0x1ffff000); } - DRM(free) (dev->dev_private, sizeof(drm_i915_private_t), + drm_free (dev->dev_private, sizeof(drm_i915_private_t), DRM_MEM_DRIVER); dev->dev_private = NULL; @@ -242,7 +241,7 @@ switch (init.func) { case I915_INIT_DMA: - dev_priv = DRM(alloc) (sizeof(drm_i915_private_t), + dev_priv = drm_alloc (sizeof(drm_i915_private_t), DRM_MEM_DRIVER); if (dev_priv == NULL) return DRM_ERR(ENOMEM); @@ -545,10 +544,7 @@ { DRM_DEVICE; - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i915_flush_ioctl called without lock held\n"); - return DRM_ERR(EINVAL); - } + LOCK_TEST_WITH_RETURN(dev, filp); return i915_quiescent(dev); } @@ -574,10 +570,7 @@ DRM_DEBUG("i915 batchbuffer, start %x used %d cliprects %d\n", batch.start, batch.used, batch.num_cliprects); - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i915_batchbuffer called without lock held\n"); - return DRM_ERR(EINVAL); - } + LOCK_TEST_WITH_RETURN(dev, filp); if (batch.num_cliprects && DRM_VERIFYAREA_READ(batch.cliprects, batch.num_cliprects * @@ -606,10 +599,7 @@ DRM_DEBUG("i915 cmdbuffer, buf %p sz %d cliprects %d\n", cmdbuf.buf, cmdbuf.sz, cmdbuf.num_cliprects); - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i915_cmdbuffer called without lock held\n"); - return DRM_ERR(EINVAL); - } + LOCK_TEST_WITH_RETURN(dev, filp); if (cmdbuf.num_cliprects && DRM_VERIFYAREA_READ(cmdbuf.cliprects, @@ -645,10 +635,8 @@ DRM_DEVICE; DRM_DEBUG("%s\n", __FUNCTION__); - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i915_flip_buf called without lock held\n"); - return DRM_ERR(EINVAL); - } + + LOCK_TEST_WITH_RETURN(dev, filp); return i915_dispatch_flip(dev); } @@ -720,7 +708,7 @@ return 0; } -static void i915_driver_pretakedown(drm_device_t *dev) +void i915_driver_pretakedown(drm_device_t *dev) { if ( dev->dev_private ) { drm_i915_private_t *dev_priv = dev->dev_private; @@ -729,7 +717,7 @@ i915_dma_cleanup( dev ); } -static void i915_driver_prerelease(drm_device_t *dev, DRMFILE filp) +void i915_driver_prerelease(drm_device_t *dev, DRMFILE filp) { if ( dev->dev_private ) { drm_i915_private_t *dev_priv = dev->dev_private; @@ -737,19 +725,3 @@ } } -void i915_driver_register_fns(drm_device_t *dev) -{ - dev->driver_features = DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED; - dev->fn_tbl.pretakedown = i915_driver_pretakedown; - dev->fn_tbl.prerelease = i915_driver_prerelease; - dev->fn_tbl.irq_preinstall = i915_driver_irq_preinstall; - dev->fn_tbl.irq_postinstall = i915_driver_irq_postinstall; - dev->fn_tbl.irq_uninstall = i915_driver_irq_uninstall; - dev->fn_tbl.irq_handler = i915_driver_irq_handler; - - dev->counters += 4; - dev->types[6] = _DRM_STAT_IRQ; - dev->types[7] = _DRM_STAT_PRIMARY; - dev->types[8] = _DRM_STAT_SECONDARY; - dev->types[9] = _DRM_STAT_DMA; -} diff -Nru a/drivers/char/drm/i915_drm.h b/drivers/char/drm/i915_drm.h --- a/drivers/char/drm/i915_drm.h 2005-01-02 23:03:35 -08:00 +++ b/drivers/char/drm/i915_drm.h 2005-01-02 23:03:35 -08:00 @@ -61,18 +61,31 @@ /* I915 specific ioctls * The device specific ioctl range is 0x40 to 0x79. */ -#define DRM_IOCTL_I915_INIT DRM_IOW( 0x40, drm_i915_init_t) -#define DRM_IOCTL_I915_FLUSH DRM_IO ( 0x41) -#define DRM_IOCTL_I915_FLIP DRM_IO ( 0x42) -#define DRM_IOCTL_I915_BATCHBUFFER DRM_IOW( 0x43, drm_i915_batchbuffer_t) -#define DRM_IOCTL_I915_IRQ_EMIT DRM_IOWR(0x44, drm_i915_irq_emit_t) -#define DRM_IOCTL_I915_IRQ_WAIT DRM_IOW( 0x45, drm_i915_irq_wait_t) -#define DRM_IOCTL_I915_GETPARAM DRM_IOWR(0x46, drm_i915_getparam_t) -#define DRM_IOCTL_I915_SETPARAM DRM_IOW( 0x47, drm_i915_setparam_t) -#define DRM_IOCTL_I915_ALLOC DRM_IOWR(0x48, drm_i915_mem_alloc_t) -#define DRM_IOCTL_I915_FREE DRM_IOW( 0x49, drm_i915_mem_free_t) -#define DRM_IOCTL_I915_INIT_HEAP DRM_IOW( 0x4a, drm_i915_mem_init_heap_t) -#define DRM_IOCTL_I915_CMDBUFFER DRM_IOW( 0x4b, drm_i915_cmdbuffer_t) +#define DRM_I915_INIT 0x00 +#define DRM_I915_FLUSH 0x01 +#define DRM_I915_FLIP 0x02 +#define DRM_I915_BATCHBUFFER 0x03 +#define DRM_I915_IRQ_EMIT 0x04 +#define DRM_I915_IRQ_WAIT 0x05 +#define DRM_I915_GETPARAM 0x06 +#define DRM_I915_SETPARAM 0x07 +#define DRM_I915_ALLOC 0x08 +#define DRM_I915_FREE 0x09 +#define DRM_I915_INIT_HEAP 0x0a +#define DRM_I915_CMDBUFFER 0x0b + +#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) +#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) +#define DRM_IOCTL_I915_FLIP DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLIP) +#define DRM_IOCTL_I915_BATCHBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_BATCHBUFFER, drm_i915_batchbuffer_t) +#define DRM_IOCTL_I915_IRQ_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_IRQ_EMIT, drm_i915_irq_emit_t) +#define DRM_IOCTL_I915_IRQ_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_IRQ_WAIT, drm_i915_irq_wait_t) +#define DRM_IOCTL_I915_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GETPARAM, drm_i915_getparam_t) +#define DRM_IOCTL_I915_SETPARAM DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SETPARAM, drm_i915_setparam_t) +#define DRM_IOCTL_I915_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_ALLOC, drm_i915_mem_alloc_t) +#define DRM_IOCTL_I915_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_FREE, drm_i915_mem_free_t) +#define DRM_IOCTL_I915_INIT_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT_HEAP, drm_i915_mem_init_heap_t) +#define DRM_IOCTL_I915_CMDBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_CMDBUFFER, drm_i915_cmdbuffer_t) /* Allow drivers to submit batchbuffers directly to hardware, relying * on the security mechanisms provided by hardware. diff -Nru a/drivers/char/drm/i915_drv.c b/drivers/char/drm/i915_drv.c --- a/drivers/char/drm/i915_drv.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/char/drm/i915_drv.c 2005-01-02 23:03:33 -08:00 @@ -8,10 +8,109 @@ * **************************************************************************/ -#include "i915.h" #include "drmP.h" #include "drm.h" #include "i915_drm.h" #include "i915_drv.h" -#include "drm_core.h" +#include "drm_pciids.h" + +int postinit( struct drm_device *dev, unsigned long flags ) +{ + dev->counters += 4; + dev->types[6] = _DRM_STAT_IRQ; + dev->types[7] = _DRM_STAT_PRIMARY; + dev->types[8] = _DRM_STAT_SECONDARY; + dev->types[9] = _DRM_STAT_DMA; + + DRM_INFO( "Initialized %s %d.%d.%d %s on minor %d: %s\n", + DRIVER_NAME, + DRIVER_MAJOR, + DRIVER_MINOR, + DRIVER_PATCHLEVEL, + DRIVER_DATE, + dev->minor, + pci_pretty_name(dev->pdev) + ); + return 0; +} + +static int version( drm_version_t *version ) +{ + int len; + + version->version_major = DRIVER_MAJOR; + version->version_minor = DRIVER_MINOR; + version->version_patchlevel = DRIVER_PATCHLEVEL; + DRM_COPY( version->name, DRIVER_NAME ); + DRM_COPY( version->date, DRIVER_DATE ); + DRM_COPY( version->desc, DRIVER_DESC ); + return 0; +} + +static struct pci_device_id pciidlist[] = { + i915_PCI_IDS +}; + +static drm_ioctl_desc_t ioctls[] = { + [DRM_IOCTL_NR(DRM_I915_INIT)] = { i915_dma_init, 1, 1 }, + [DRM_IOCTL_NR(DRM_I915_FLUSH)] = { i915_flush_ioctl, 1, 0 }, + [DRM_IOCTL_NR(DRM_I915_FLIP)] = { i915_flip_bufs, 1, 0 }, + [DRM_IOCTL_NR(DRM_I915_BATCHBUFFER)] = { i915_batchbuffer, 1, 0 }, + [DRM_IOCTL_NR(DRM_I915_IRQ_EMIT)] = { i915_irq_emit, 1, 0 }, + [DRM_IOCTL_NR(DRM_I915_IRQ_WAIT)] = { i915_irq_wait, 1, 0 }, + [DRM_IOCTL_NR(DRM_I915_GETPARAM)] = { i915_getparam, 1, 0 }, + [DRM_IOCTL_NR(DRM_I915_SETPARAM)] = { i915_setparam, 1, 1 }, + [DRM_IOCTL_NR(DRM_I915_ALLOC)] = { i915_mem_alloc, 1, 0 }, + [DRM_IOCTL_NR(DRM_I915_FREE)] = { i915_mem_free, 1, 0 }, + [DRM_IOCTL_NR(DRM_I915_INIT_HEAP)] = { i915_mem_init_heap, 1, 1 }, + [DRM_IOCTL_NR(DRM_I915_CMDBUFFER)] = { i915_cmdbuffer, 1, 0 } +}; + +static struct drm_driver driver = { + .driver_features = DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR | + DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED, + .pretakedown = i915_driver_pretakedown, + .prerelease = i915_driver_prerelease, + .irq_preinstall = i915_driver_irq_preinstall, + .irq_postinstall = i915_driver_irq_postinstall, + .irq_uninstall = i915_driver_irq_uninstall, + .irq_handler = i915_driver_irq_handler, + .reclaim_buffers = drm_core_reclaim_buffers, + .get_map_ofs = drm_core_get_map_ofs, + .get_reg_ofs = drm_core_get_reg_ofs, + .postinit = postinit, + .version = version, + .ioctls = ioctls, + .num_ioctls = DRM_ARRAY_SIZE(ioctls), + .fops = { + .owner = THIS_MODULE, + .open = drm_open, + .release = drm_release, + .ioctl = drm_ioctl, + .mmap = drm_mmap, + .poll = drm_poll, + .fasync = drm_fasync, + }, + .pci_driver = { + .name = DRIVER_NAME, + .id_table = pciidlist, + } +}; + +static int __init i915_init(void) +{ + return drm_init(&driver); +} + +static void __exit i915_exit(void) +{ + drm_exit(&driver); +} + +module_init(i915_init); +module_exit(i915_exit); + +MODULE_AUTHOR( DRIVER_AUTHOR ); +MODULE_DESCRIPTION( DRIVER_DESC ); +MODULE_LICENSE("GPL and additional rights"); diff -Nru a/drivers/char/drm/i915_drv.h b/drivers/char/drm/i915_drv.h --- a/drivers/char/drm/i915_drv.h 2005-01-02 23:03:35 -08:00 +++ b/drivers/char/drm/i915_drv.h 2005-01-02 23:03:35 -08:00 @@ -10,6 +10,28 @@ #ifndef _I915_DRV_H_ #define _I915_DRV_H_ +/* General customization: + */ + +#define DRIVER_AUTHOR "Tungsten Graphics, Inc." + +#define DRIVER_NAME "i915" +#define DRIVER_DESC "Intel Graphics" +#define DRIVER_DATE "20040405" + +/* Interface history: + * + * 1.1: Original. + */ +#define DRIVER_MAJOR 1 +#define DRIVER_MINOR 1 +#define DRIVER_PATCHLEVEL 0 + +/* We use our own dma mechanisms, not the drm template code. However, + * the shared IRQ code is useful to us: + */ +#define __HAVE_PM 1 + typedef struct _drm_i915_ring_buffer { int tail_mask; unsigned long Start; @@ -66,6 +88,8 @@ extern int i915_setparam(DRM_IOCTL_ARGS); extern int i915_cmdbuffer(DRM_IOCTL_ARGS); extern void i915_kernel_lost_context(drm_device_t * dev); +extern void i915_driver_pretakedown(drm_device_t *dev); +extern void i915_driver_prerelease(drm_device_t *dev, DRMFILE filp); /* i915_irq.c */ extern int i915_irq_emit(DRM_IOCTL_ARGS); diff -Nru a/drivers/char/drm/i915_irq.c b/drivers/char/drm/i915_irq.c --- a/drivers/char/drm/i915_irq.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/char/drm/i915_irq.c 2005-01-02 23:03:33 -08:00 @@ -7,7 +7,6 @@ * **************************************************************************/ -#include "i915.h" #include "drmP.h" #include "drm.h" #include "i915_drm.h" @@ -92,10 +91,7 @@ drm_i915_irq_emit_t emit; int result; - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i915_irq_emit called without lock held\n"); - return DRM_ERR(EINVAL); - } + LOCK_TEST_WITH_RETURN(dev, filp); if (!dev_priv) { DRM_ERROR("%s called with no initialization\n", __FUNCTION__); diff -Nru a/drivers/char/drm/i915_mem.c b/drivers/char/drm/i915_mem.c --- a/drivers/char/drm/i915_mem.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/char/drm/i915_mem.c 2005-01-02 23:03:34 -08:00 @@ -7,7 +7,6 @@ * **************************************************************************/ -#include "i915.h" #include "drmP.h" #include "drm.h" #include "i915_drm.h" @@ -75,7 +74,7 @@ { /* Maybe cut off the start of an existing block */ if (start > p->start) { - struct mem_block *newblock = DRM_MALLOC(sizeof(*newblock)); + struct mem_block *newblock = drm_alloc(sizeof(*newblock), DRM_MEM_BUFLISTS); if (!newblock) goto out; newblock->start = start; @@ -91,7 +90,7 @@ /* Maybe cut off the end of an existing block */ if (size < p->size) { - struct mem_block *newblock = DRM_MALLOC(sizeof(*newblock)); + struct mem_block *newblock = drm_alloc(sizeof(*newblock), DRM_MEM_BUFLISTS); if (!newblock) goto out; newblock->start = start + size; @@ -148,7 +147,7 @@ p->size += q->size; p->next = q->next; p->next->prev = p; - DRM_FREE(q, sizeof(*q)); + drm_free(q, sizeof(*q), DRM_MEM_BUFLISTS); } if (p->prev->filp == NULL) { @@ -156,7 +155,7 @@ q->size += p->size; q->next = p->next; q->next->prev = q; - DRM_FREE(p, sizeof(*q)); + drm_free(p, sizeof(*q), DRM_MEM_BUFLISTS); } } @@ -164,14 +163,14 @@ */ static int init_heap(struct mem_block **heap, int start, int size) { - struct mem_block *blocks = DRM_MALLOC(sizeof(*blocks)); + struct mem_block *blocks = drm_alloc(sizeof(*blocks), DRM_MEM_BUFLISTS); if (!blocks) return -ENOMEM; - *heap = DRM_MALLOC(sizeof(**heap)); + *heap = drm_alloc(sizeof(**heap), DRM_MEM_BUFLISTS); if (!*heap) { - DRM_FREE(blocks, sizeof(*blocks)); + drm_free(blocks, sizeof(*blocks), DRM_MEM_BUFLISTS); return -ENOMEM; } @@ -211,7 +210,7 @@ p->size += q->size; p->next = q->next; p->next->prev = p; - DRM_FREE(q, sizeof(*q)); + drm_free(q, sizeof(*q), DRM_MEM_BUFLISTS); } } } @@ -228,10 +227,10 @@ for (p = (*heap)->next; p != *heap;) { struct mem_block *q = p; p = p->next; - DRM_FREE(q, sizeof(*q)); + drm_free(q, sizeof(*q), DRM_MEM_BUFLISTS); } - DRM_FREE(*heap, sizeof(**heap)); + drm_free(*heap, sizeof(**heap), DRM_MEM_BUFLISTS); *heap = NULL; } diff -Nru a/drivers/char/drm/mga_dma.c b/drivers/char/drm/mga_dma.c --- a/drivers/char/drm/mga_dma.c 2005-01-02 23:03:35 -08:00 +++ b/drivers/char/drm/mga_dma.c 2005-01-02 23:03:35 -08:00 @@ -33,7 +33,6 @@ * Gareth Hughes */ -#include "mga.h" #include "drmP.h" #include "drm.h" #include "mga_drm.h" @@ -308,7 +307,7 @@ int i; DRM_DEBUG( "count=%d\n", dma->buf_count ); - dev_priv->head = DRM(alloc)( sizeof(drm_mga_freelist_t), + dev_priv->head = drm_alloc( sizeof(drm_mga_freelist_t), DRM_MEM_DRIVER ); if ( dev_priv->head == NULL ) return DRM_ERR(ENOMEM); @@ -320,7 +319,7 @@ buf = dma->buflist[i]; buf_priv = buf->dev_private; - entry = DRM(alloc)( sizeof(drm_mga_freelist_t), + entry = drm_alloc( sizeof(drm_mga_freelist_t), DRM_MEM_DRIVER ); if ( entry == NULL ) return DRM_ERR(ENOMEM); @@ -357,7 +356,7 @@ entry = dev_priv->head; while ( entry ) { next = entry->next; - DRM(free)( entry, sizeof(drm_mga_freelist_t), DRM_MEM_DRIVER ); + drm_free( entry, sizeof(drm_mga_freelist_t), DRM_MEM_DRIVER ); entry = next; } @@ -458,7 +457,7 @@ int ret; DRM_DEBUG( "\n" ); - dev_priv = DRM(alloc)( sizeof(drm_mga_private_t), DRM_MEM_DRIVER ); + dev_priv = drm_alloc( sizeof(drm_mga_private_t), DRM_MEM_DRIVER ); if ( !dev_priv ) return DRM_ERR(ENOMEM); @@ -634,7 +633,7 @@ * may not have been called from userspace and after dev_private * is freed, it's too late. */ - if ( dev->irq_enabled ) DRM(irq_uninstall)(dev); + if ( dev->irq_enabled ) drm_irq_uninstall(dev); if ( dev->dev_private ) { drm_mga_private_t *dev_priv = dev->dev_private; @@ -650,7 +649,7 @@ mga_freelist_cleanup( dev ); } - DRM(free)( dev->dev_private, sizeof(drm_mga_private_t), + drm_free( dev->dev_private, sizeof(drm_mga_private_t), DRM_MEM_DRIVER ); dev->dev_private = NULL; } @@ -798,30 +797,13 @@ return ret; } -static void mga_driver_pretakedown(drm_device_t *dev) +void mga_driver_pretakedown(drm_device_t *dev) { mga_do_cleanup_dma( dev ); } -static int mga_driver_dma_quiescent(drm_device_t *dev) +int mga_driver_dma_quiescent(drm_device_t *dev) { drm_mga_private_t *dev_priv = dev->dev_private; return mga_do_wait_for_idle( dev_priv ); -} - -void mga_driver_register_fns(drm_device_t *dev) -{ - dev->driver_features = DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR | DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_IRQ_VBL; - dev->fn_tbl.pretakedown = mga_driver_pretakedown; - dev->fn_tbl.dma_quiescent = mga_driver_dma_quiescent; - dev->fn_tbl.vblank_wait = mga_driver_vblank_wait; - dev->fn_tbl.irq_preinstall = mga_driver_irq_preinstall; - dev->fn_tbl.irq_postinstall = mga_driver_irq_postinstall; - dev->fn_tbl.irq_uninstall = mga_driver_irq_uninstall; - dev->fn_tbl.irq_handler = mga_driver_irq_handler; - - dev->counters += 3; - dev->types[6] = _DRM_STAT_IRQ; - dev->types[7] = _DRM_STAT_PRIMARY; - dev->types[8] = _DRM_STAT_SECONDARY; } diff -Nru a/drivers/char/drm/mga_drv.c b/drivers/char/drm/mga_drv.c --- a/drivers/char/drm/mga_drv.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/char/drm/mga_drv.c 2005-01-02 23:03:34 -08:00 @@ -30,9 +30,108 @@ */ #include -#include "mga.h" #include "drmP.h" #include "drm.h" #include "mga_drm.h" #include "mga_drv.h" -#include "drm_core.h" + + +#include "drm_pciids.h" + +static int postinit( struct drm_device *dev, unsigned long flags ) +{ + dev->counters += 3; + dev->types[6] = _DRM_STAT_IRQ; + dev->types[7] = _DRM_STAT_PRIMARY; + dev->types[8] = _DRM_STAT_SECONDARY; + + DRM_INFO( "Initialized %s %d.%d.%d %s on minor %d: %s\n", + DRIVER_NAME, + DRIVER_MAJOR, + DRIVER_MINOR, + DRIVER_PATCHLEVEL, + DRIVER_DATE, + dev->minor, + pci_pretty_name(dev->pdev) + ); + return 0; +} + +static int version( drm_version_t *version ) +{ + int len; + + version->version_major = DRIVER_MAJOR; + version->version_minor = DRIVER_MINOR; + version->version_patchlevel = DRIVER_PATCHLEVEL; + DRM_COPY( version->name, DRIVER_NAME ); + DRM_COPY( version->date, DRIVER_DATE ); + DRM_COPY( version->desc, DRIVER_DESC ); + return 0; +} + +static struct pci_device_id pciidlist[] = { + mga_PCI_IDS +}; + +static drm_ioctl_desc_t ioctls[] = { + [DRM_IOCTL_NR(DRM_MGA_INIT)] = { mga_dma_init, 1, 1 }, + [DRM_IOCTL_NR(DRM_MGA_FLUSH)] = { mga_dma_flush, 1, 0 }, + [DRM_IOCTL_NR(DRM_MGA_RESET)] = { mga_dma_reset, 1, 0 }, + [DRM_IOCTL_NR(DRM_MGA_SWAP)] = { mga_dma_swap, 1, 0 }, + [DRM_IOCTL_NR(DRM_MGA_CLEAR)] = { mga_dma_clear, 1, 0 }, + [DRM_IOCTL_NR(DRM_MGA_VERTEX)] = { mga_dma_vertex, 1, 0 }, + [DRM_IOCTL_NR(DRM_MGA_INDICES)] = { mga_dma_indices, 1, 0 }, + [DRM_IOCTL_NR(DRM_MGA_ILOAD)] = { mga_dma_iload, 1, 0 }, + [DRM_IOCTL_NR(DRM_MGA_BLIT)] = { mga_dma_blit, 1, 0 }, + [DRM_IOCTL_NR(DRM_MGA_GETPARAM)]= { mga_getparam, 1, 0 }, +}; + +static struct drm_driver driver = { + .driver_features = DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR | DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_IRQ_VBL, + .pretakedown = mga_driver_pretakedown, + .dma_quiescent = mga_driver_dma_quiescent, + .vblank_wait = mga_driver_vblank_wait, + .irq_preinstall = mga_driver_irq_preinstall, + .irq_postinstall = mga_driver_irq_postinstall, + .irq_uninstall = mga_driver_irq_uninstall, + .irq_handler = mga_driver_irq_handler, + .reclaim_buffers = drm_core_reclaim_buffers, + .get_map_ofs = drm_core_get_map_ofs, + .get_reg_ofs = drm_core_get_reg_ofs, + .postinit = postinit, + .version = version, + .ioctls = ioctls, + .num_ioctls = DRM_ARRAY_SIZE(ioctls), + .dma_ioctl = mga_dma_buffers, + .fops = { + .owner = THIS_MODULE, + .open = drm_open, + .release = drm_release, + .ioctl = drm_ioctl, + .mmap = drm_mmap, + .poll = drm_poll, + .fasync = drm_fasync, + }, + .pci_driver = { + .name = DRIVER_NAME, + .id_table = pciidlist, + } +}; + +static int __init mga_init(void) +{ + return drm_init(&driver); +} + +static void __exit mga_exit(void) +{ + drm_exit(&driver); +} + +module_init(mga_init); +module_exit(mga_exit); + +MODULE_AUTHOR( DRIVER_AUTHOR ); +MODULE_DESCRIPTION( DRIVER_DESC ); +MODULE_LICENSE("GPL and additional rights"); diff -Nru a/drivers/char/drm/mga_drv.h b/drivers/char/drm/mga_drv.h --- a/drivers/char/drm/mga_drv.h 2005-01-02 23:03:35 -08:00 +++ b/drivers/char/drm/mga_drv.h 2005-01-02 23:03:35 -08:00 @@ -31,6 +31,19 @@ #ifndef __MGA_DRV_H__ #define __MGA_DRV_H__ +/* General customization: + */ + +#define DRIVER_AUTHOR "Gareth Hughes, VA Linux Systems Inc." + +#define DRIVER_NAME "mga" +#define DRIVER_DESC "Matrox G200/G400" +#define DRIVER_DATE "20021029" + +#define DRIVER_MAJOR 3 +#define DRIVER_MINOR 1 +#define DRIVER_PATCHLEVEL 0 + typedef struct drm_mga_primary_buffer { u8 *start; u8 *end; @@ -104,6 +117,8 @@ extern int mga_dma_flush( DRM_IOCTL_ARGS ); extern int mga_dma_reset( DRM_IOCTL_ARGS ); extern int mga_dma_buffers( DRM_IOCTL_ARGS ); +extern void mga_driver_pretakedown(drm_device_t *dev); +extern int mga_driver_dma_quiescent(drm_device_t *dev); extern int mga_do_wait_for_idle( drm_mga_private_t *dev_priv ); extern int mga_do_dma_idle( drm_mga_private_t *dev_priv ); diff -Nru a/drivers/char/drm/mga_irq.c b/drivers/char/drm/mga_irq.c --- a/drivers/char/drm/mga_irq.c 2005-01-02 23:03:32 -08:00 +++ b/drivers/char/drm/mga_irq.c 2005-01-02 23:03:32 -08:00 @@ -30,7 +30,6 @@ * Eric Anholt */ -#include "mga.h" #include "drmP.h" #include "drm.h" #include "mga_drm.h" @@ -50,7 +49,7 @@ MGA_WRITE( MGA_ICLEAR, MGA_VLINEICLR ); atomic_inc(&dev->vbl_received); DRM_WAKEUP(&dev->vbl_queue); - DRM(vbl_send_signals)( dev ); + drm_vbl_send_signals( dev ); return IRQ_HANDLED; } return IRQ_NONE; diff -Nru a/drivers/char/drm/mga_state.c b/drivers/char/drm/mga_state.c --- a/drivers/char/drm/mga_state.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/char/drm/mga_state.c 2005-01-02 23:03:33 -08:00 @@ -32,7 +32,6 @@ * Gareth Hughes */ -#include "mga.h" #include "drmP.h" #include "drm.h" #include "mga_drm.h" diff -Nru a/drivers/char/drm/mga_warp.c b/drivers/char/drm/mga_warp.c --- a/drivers/char/drm/mga_warp.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/char/drm/mga_warp.c 2005-01-02 23:03:34 -08:00 @@ -27,7 +27,6 @@ * Gareth Hughes */ -#include "mga.h" #include "drmP.h" #include "drm.h" #include "mga_drm.h" diff -Nru a/drivers/char/drm/r128_cce.c b/drivers/char/drm/r128_cce.c --- a/drivers/char/drm/r128_cce.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/char/drm/r128_cce.c 2005-01-02 23:03:33 -08:00 @@ -28,7 +28,6 @@ * Gareth Hughes */ -#include "r128.h" #include "drmP.h" #include "drm.h" #include "r128_drm.h" @@ -355,7 +354,7 @@ DRM_DEBUG( "\n" ); - dev_priv = DRM(alloc)( sizeof(drm_r128_private_t), DRM_MEM_DRIVER ); + dev_priv = drm_alloc( sizeof(drm_r128_private_t), DRM_MEM_DRIVER ); if ( dev_priv == NULL ) return DRM_ERR(ENOMEM); @@ -544,7 +543,7 @@ dev_priv->ring.end = ((u32 *)dev_priv->cce_ring->handle + init->ring_size / sizeof(u32)); dev_priv->ring.size = init->ring_size; - dev_priv->ring.size_l2qw = DRM(order)( init->ring_size / 8 ); + dev_priv->ring.size_l2qw = drm_order( init->ring_size / 8 ); dev_priv->ring.tail_mask = (dev_priv->ring.size / sizeof(u32)) - 1; @@ -561,7 +560,7 @@ #if __OS_HAS_AGP if ( dev_priv->is_pci ) { #endif - if (!DRM(ati_pcigart_init)( dev, &dev_priv->phys_pci_gart, + if (!drm_ati_pcigart_init( dev, &dev_priv->phys_pci_gart, &dev_priv->bus_pci_gart) ) { DRM_ERROR( "failed to init PCI GART!\n" ); dev->dev_private = (void *)dev_priv; @@ -590,7 +589,7 @@ * may not have been called from userspace and after dev_private * is freed, it's too late. */ - if ( dev->irq_enabled ) DRM(irq_uninstall)(dev); + if ( dev->irq_enabled ) drm_irq_uninstall(dev); if ( dev->dev_private ) { drm_r128_private_t *dev_priv = dev->dev_private; @@ -606,13 +605,13 @@ } else #endif { - if (!DRM(ati_pcigart_cleanup)( dev, + if (!drm_ati_pcigart_cleanup( dev, dev_priv->phys_pci_gart, dev_priv->bus_pci_gart )) DRM_ERROR( "failed to cleanup PCI GART!\n" ); } - DRM(free)( dev->dev_private, sizeof(drm_r128_private_t), + drm_free( dev->dev_private, sizeof(drm_r128_private_t), DRM_MEM_DRIVER ); dev->dev_private = NULL; } @@ -771,7 +770,7 @@ drm_r128_freelist_t *entry; int i; - dev_priv->head = DRM(alloc)( sizeof(drm_r128_freelist_t), + dev_priv->head = drm_alloc( sizeof(drm_r128_freelist_t), DRM_MEM_DRIVER ); if ( dev_priv->head == NULL ) return DRM_ERR(ENOMEM); @@ -783,7 +782,7 @@ buf = dma->buflist[i]; buf_priv = buf->dev_private; - entry = DRM(alloc)( sizeof(drm_r128_freelist_t), + entry = drm_alloc( sizeof(drm_r128_freelist_t), DRM_MEM_DRIVER ); if ( !entry ) return DRM_ERR(ENOMEM); diff -Nru a/drivers/char/drm/r128_drv.c b/drivers/char/drm/r128_drv.c --- a/drivers/char/drm/r128_drv.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/char/drm/r128_drv.c 2005-01-02 23:03:33 -08:00 @@ -30,11 +30,116 @@ */ #include -#include "r128.h" #include "drmP.h" #include "drm.h" #include "r128_drm.h" #include "r128_drv.h" -#include "ati_pcigart.h" -#include "drm_core.h" +#include "drm_pciids.h" + +static int postinit( struct drm_device *dev, unsigned long flags ) +{ + DRM_INFO( "Initialized %s %d.%d.%d %s on minor %d: %s\n", + DRIVER_NAME, + DRIVER_MAJOR, + DRIVER_MINOR, + DRIVER_PATCHLEVEL, + DRIVER_DATE, + dev->minor, + pci_pretty_name(dev->pdev) + ); + return 0; +} + +static int version( drm_version_t *version ) +{ + int len; + + version->version_major = DRIVER_MAJOR; + version->version_minor = DRIVER_MINOR; + version->version_patchlevel = DRIVER_PATCHLEVEL; + DRM_COPY( version->name, DRIVER_NAME ); + DRM_COPY( version->date, DRIVER_DATE ); + DRM_COPY( version->desc, DRIVER_DESC ); + return 0; +} + +static struct pci_device_id pciidlist[] = { + r128_PCI_IDS +}; + +/* Interface history: + * + * ?? - ?? + * 2.4 - Add support for ycbcr textures (no new ioctls) + * 2.5 - Add FLIP ioctl, disable FULLSCREEN. + */ +static drm_ioctl_desc_t ioctls[] = { + [DRM_IOCTL_NR(DRM_R128_INIT)] = { r128_cce_init, 1, 1 }, + [DRM_IOCTL_NR(DRM_R128_CCE_START)] = { r128_cce_start, 1, 1 }, + [DRM_IOCTL_NR(DRM_R128_CCE_STOP)] = { r128_cce_stop, 1, 1 }, + [DRM_IOCTL_NR(DRM_R128_CCE_RESET)] = { r128_cce_reset, 1, 1 }, + [DRM_IOCTL_NR(DRM_R128_CCE_IDLE)] = { r128_cce_idle, 1, 0 }, + [DRM_IOCTL_NR(DRM_R128_RESET)] = { r128_engine_reset, 1, 0 }, + [DRM_IOCTL_NR(DRM_R128_FULLSCREEN)] = { r128_fullscreen, 1, 0 }, + [DRM_IOCTL_NR(DRM_R128_SWAP)] = { r128_cce_swap, 1, 0 }, + [DRM_IOCTL_NR(DRM_R128_FLIP)] = { r128_cce_flip, 1, 0 }, + [DRM_IOCTL_NR(DRM_R128_CLEAR)] = { r128_cce_clear, 1, 0 }, + [DRM_IOCTL_NR(DRM_R128_VERTEX)] = { r128_cce_vertex, 1, 0 }, + [DRM_IOCTL_NR(DRM_R128_INDICES)] = { r128_cce_indices, 1, 0 }, + [DRM_IOCTL_NR(DRM_R128_BLIT)] = { r128_cce_blit, 1, 0 }, + [DRM_IOCTL_NR(DRM_R128_DEPTH)] = { r128_cce_depth, 1, 0 }, + [DRM_IOCTL_NR(DRM_R128_STIPPLE)] = { r128_cce_stipple, 1, 0 }, + [DRM_IOCTL_NR(DRM_R128_INDIRECT)] = { r128_cce_indirect, 1, 1 }, + [DRM_IOCTL_NR(DRM_R128_GETPARAM)] = { r128_getparam, 1, 0 }, +}; + +static struct drm_driver driver = { + .driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG | DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_IRQ_VBL, + .dev_priv_size = sizeof(drm_r128_buf_priv_t), + .prerelease = r128_driver_prerelease, + .pretakedown = r128_driver_pretakedown, + .vblank_wait = r128_driver_vblank_wait, + .irq_preinstall = r128_driver_irq_preinstall, + .irq_postinstall = r128_driver_irq_postinstall, + .irq_uninstall = r128_driver_irq_uninstall, + .irq_handler = r128_driver_irq_handler, + .reclaim_buffers = drm_core_reclaim_buffers, + .get_map_ofs = drm_core_get_map_ofs, + .get_reg_ofs = drm_core_get_reg_ofs, + .postinit = postinit, + .version = version, + .ioctls = ioctls, + .num_ioctls = DRM_ARRAY_SIZE(ioctls), + .dma_ioctl = r128_cce_buffers, + .fops = { + .owner = THIS_MODULE, + .open = drm_open, + .release = drm_release, + .ioctl = drm_ioctl, + .mmap = drm_mmap, + .poll = drm_poll, + .fasync = drm_fasync, + }, + .pci_driver = { + .name = DRIVER_NAME, + .id_table = pciidlist, + } +}; + +static int __init r128_init(void) +{ + return drm_init(&driver); +} + +static void __exit r128_exit(void) +{ + drm_exit(&driver); +} + +module_init(r128_init); +module_exit(r128_exit); + +MODULE_AUTHOR( DRIVER_AUTHOR ); +MODULE_DESCRIPTION( DRIVER_DESC ); +MODULE_LICENSE("GPL and additional rights"); diff -Nru a/drivers/char/drm/r128_drv.h b/drivers/char/drm/r128_drv.h --- a/drivers/char/drm/r128_drv.h 2005-01-02 23:03:35 -08:00 +++ b/drivers/char/drm/r128_drv.h 2005-01-02 23:03:35 -08:00 @@ -28,12 +28,25 @@ * Rickard E. (Rik) Faith * Kevin E. Martin * Gareth Hughes - * Michel Dänzer + * Michel D�zer */ #ifndef __R128_DRV_H__ #define __R128_DRV_H__ +/* General customization: + */ +#define DRIVER_AUTHOR "Gareth Hughes, VA Linux Systems Inc." + +#define DRIVER_NAME "r128" +#define DRIVER_DESC "ATI Rage 128" +#define DRIVER_DATE "20030725" + +#define DRIVER_MAJOR 2 +#define DRIVER_MINOR 5 +#define DRIVER_PATCHLEVEL 0 + + #define GET_RING_HEAD(dev_priv) R128_READ( R128_PM4_BUFFER_DL_RPTR ) typedef struct drm_r128_freelist { @@ -148,6 +161,8 @@ extern void r128_driver_irq_preinstall( drm_device_t *dev ); extern void r128_driver_irq_postinstall( drm_device_t *dev ); extern void r128_driver_irq_uninstall( drm_device_t *dev ); +extern void r128_driver_pretakedown(drm_device_t *dev); +extern void r128_driver_prerelease(drm_device_t *dev, DRMFILE filp); /* Register definitions, register access macros and drmAddMap constants * for Rage 128 kernel driver. diff -Nru a/drivers/char/drm/r128_irq.c b/drivers/char/drm/r128_irq.c --- a/drivers/char/drm/r128_irq.c 2005-01-02 23:03:35 -08:00 +++ b/drivers/char/drm/r128_irq.c 2005-01-02 23:03:35 -08:00 @@ -30,7 +30,6 @@ * Eric Anholt */ -#include "r128.h" #include "drmP.h" #include "drm.h" #include "r128_drm.h" @@ -50,7 +49,7 @@ R128_WRITE( R128_GEN_INT_STATUS, R128_CRTC_VBLANK_INT_AK ); atomic_inc(&dev->vbl_received); DRM_WAKEUP(&dev->vbl_queue); - DRM(vbl_send_signals)( dev ); + drm_vbl_send_signals( dev ); return IRQ_HANDLED; } return IRQ_NONE; diff -Nru a/drivers/char/drm/r128_state.c b/drivers/char/drm/r128_state.c --- a/drivers/char/drm/r128_state.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/char/drm/r128_state.c 2005-01-02 23:03:33 -08:00 @@ -27,7 +27,6 @@ * Gareth Hughes */ -#include "r128.h" #include "drmP.h" #include "drm.h" #include "r128_drm.h" @@ -926,24 +925,24 @@ } buffer_size = depth->n * sizeof(u32); - buffer = DRM_MALLOC( buffer_size ); + buffer = drm_alloc( buffer_size, DRM_MEM_BUFS ); if ( buffer == NULL ) return DRM_ERR(ENOMEM); if ( DRM_COPY_FROM_USER( buffer, depth->buffer, buffer_size ) ) { - DRM_FREE( buffer, buffer_size); + drm_free( buffer, buffer_size, DRM_MEM_BUFS); return DRM_ERR(EFAULT); } mask_size = depth->n * sizeof(u8); if ( depth->mask ) { - mask = DRM_MALLOC( mask_size ); + mask = drm_alloc( mask_size, DRM_MEM_BUFS ); if ( mask == NULL ) { - DRM_FREE( buffer, buffer_size ); + drm_free( buffer, buffer_size, DRM_MEM_BUFS ); return DRM_ERR(ENOMEM); } if ( DRM_COPY_FROM_USER( mask, depth->mask, mask_size ) ) { - DRM_FREE( buffer, buffer_size ); - DRM_FREE( mask, mask_size ); + drm_free( buffer, buffer_size, DRM_MEM_BUFS ); + drm_free( mask, mask_size, DRM_MEM_BUFS ); return DRM_ERR(EFAULT); } @@ -970,7 +969,7 @@ } } - DRM_FREE( mask, mask_size ); + drm_free( mask, mask_size, DRM_MEM_BUFS ); } else { for ( i = 0 ; i < count ; i++, x++ ) { BEGIN_RING( 6 ); @@ -994,7 +993,7 @@ } } - DRM_FREE( buffer, buffer_size ); + drm_free( buffer, buffer_size, DRM_MEM_BUFS ); return 0; } @@ -1016,54 +1015,54 @@ xbuf_size = count * sizeof(*x); ybuf_size = count * sizeof(*y); - x = DRM_MALLOC( xbuf_size ); + x = drm_alloc( xbuf_size, DRM_MEM_BUFS ); if ( x == NULL ) { return DRM_ERR(ENOMEM); } - y = DRM_MALLOC( ybuf_size ); + y = drm_alloc( ybuf_size, DRM_MEM_BUFS ); if ( y == NULL ) { - DRM_FREE( x, xbuf_size ); + drm_free( x, xbuf_size, DRM_MEM_BUFS ); return DRM_ERR(ENOMEM); } if ( DRM_COPY_FROM_USER( x, depth->x, xbuf_size ) ) { - DRM_FREE( x, xbuf_size ); - DRM_FREE( y, ybuf_size ); + drm_free( x, xbuf_size, DRM_MEM_BUFS ); + drm_free( y, ybuf_size, DRM_MEM_BUFS ); return DRM_ERR(EFAULT); } if ( DRM_COPY_FROM_USER( y, depth->y, xbuf_size ) ) { - DRM_FREE( x, xbuf_size ); - DRM_FREE( y, ybuf_size ); + drm_free( x, xbuf_size, DRM_MEM_BUFS ); + drm_free( y, ybuf_size, DRM_MEM_BUFS ); return DRM_ERR(EFAULT); } buffer_size = depth->n * sizeof(u32); - buffer = DRM_MALLOC( buffer_size ); + buffer = drm_alloc( buffer_size, DRM_MEM_BUFS ); if ( buffer == NULL ) { - DRM_FREE( x, xbuf_size ); - DRM_FREE( y, ybuf_size ); + drm_free( x, xbuf_size, DRM_MEM_BUFS ); + drm_free( y, ybuf_size, DRM_MEM_BUFS ); return DRM_ERR(ENOMEM); } if ( DRM_COPY_FROM_USER( buffer, depth->buffer, buffer_size ) ) { - DRM_FREE( x, xbuf_size ); - DRM_FREE( y, ybuf_size ); - DRM_FREE( buffer, buffer_size ); + drm_free( x, xbuf_size, DRM_MEM_BUFS ); + drm_free( y, ybuf_size, DRM_MEM_BUFS ); + drm_free( buffer, buffer_size, DRM_MEM_BUFS ); return DRM_ERR(EFAULT); } if ( depth->mask ) { mask_size = depth->n * sizeof(u8); - mask = DRM_MALLOC( mask_size ); + mask = drm_alloc( mask_size, DRM_MEM_BUFS ); if ( mask == NULL ) { - DRM_FREE( x, xbuf_size ); - DRM_FREE( y, ybuf_size ); - DRM_FREE( buffer, buffer_size ); + drm_free( x, xbuf_size, DRM_MEM_BUFS ); + drm_free( y, ybuf_size, DRM_MEM_BUFS ); + drm_free( buffer, buffer_size, DRM_MEM_BUFS ); return DRM_ERR(ENOMEM); } if ( DRM_COPY_FROM_USER( mask, depth->mask, mask_size ) ) { - DRM_FREE( x, xbuf_size ); - DRM_FREE( y, ybuf_size ); - DRM_FREE( buffer, buffer_size ); - DRM_FREE( mask, mask_size ); + drm_free( x, xbuf_size, DRM_MEM_BUFS ); + drm_free( y, ybuf_size, DRM_MEM_BUFS ); + drm_free( buffer, buffer_size, DRM_MEM_BUFS ); + drm_free( mask, mask_size, DRM_MEM_BUFS ); return DRM_ERR(EFAULT); } @@ -1090,7 +1089,7 @@ } } - DRM_FREE( mask, mask_size ); + drm_free( mask, mask_size, DRM_MEM_BUFS ); } else { for ( i = 0 ; i < count ; i++ ) { BEGIN_RING( 6 ); @@ -1114,9 +1113,9 @@ } } - DRM_FREE( x, xbuf_size ); - DRM_FREE( y, ybuf_size ); - DRM_FREE( buffer, buffer_size ); + drm_free( x, xbuf_size, DRM_MEM_BUFS ); + drm_free( y, ybuf_size, DRM_MEM_BUFS ); + drm_free( buffer, buffer_size, DRM_MEM_BUFS ); return 0; } @@ -1184,23 +1183,23 @@ xbuf_size = count * sizeof(*x); ybuf_size = count * sizeof(*y); - x = DRM_MALLOC( xbuf_size ); + x = drm_alloc( xbuf_size, DRM_MEM_BUFS ); if ( x == NULL ) { return DRM_ERR(ENOMEM); } - y = DRM_MALLOC( ybuf_size ); + y = drm_alloc( ybuf_size, DRM_MEM_BUFS ); if ( y == NULL ) { - DRM_FREE( x, xbuf_size ); + drm_free( x, xbuf_size, DRM_MEM_BUFS ); return DRM_ERR(ENOMEM); } if ( DRM_COPY_FROM_USER( x, depth->x, xbuf_size ) ) { - DRM_FREE( x, xbuf_size ); - DRM_FREE( y, ybuf_size ); + drm_free( x, xbuf_size, DRM_MEM_BUFS ); + drm_free( y, ybuf_size, DRM_MEM_BUFS ); return DRM_ERR(EFAULT); } if ( DRM_COPY_FROM_USER( y, depth->y, ybuf_size ) ) { - DRM_FREE( x, xbuf_size ); - DRM_FREE( y, ybuf_size ); + drm_free( x, xbuf_size, DRM_MEM_BUFS ); + drm_free( y, ybuf_size, DRM_MEM_BUFS ); return DRM_ERR(EFAULT); } @@ -1228,8 +1227,8 @@ ADVANCE_RING(); } - DRM_FREE( x, xbuf_size ); - DRM_FREE( y, ybuf_size ); + drm_free( x, xbuf_size, DRM_MEM_BUFS ); + drm_free( y, ybuf_size, DRM_MEM_BUFS ); return 0; } @@ -1695,7 +1694,7 @@ return 0; } -static void r128_driver_prerelease(drm_device_t *dev, DRMFILE filp) +void r128_driver_prerelease(drm_device_t *dev, DRMFILE filp) { if ( dev->dev_private ) { drm_r128_private_t *dev_priv = dev->dev_private; @@ -1705,20 +1704,8 @@ } } -static void r128_driver_pretakedown(drm_device_t *dev) +void r128_driver_pretakedown(drm_device_t *dev) { r128_do_cleanup_cce( dev ); } -void r128_driver_register_fns(drm_device_t *dev) -{ - dev->driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG | DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_IRQ_VBL; - dev->dev_priv_size = sizeof(drm_r128_buf_priv_t); - dev->fn_tbl.prerelease = r128_driver_prerelease; - dev->fn_tbl.pretakedown = r128_driver_pretakedown; - dev->fn_tbl.vblank_wait = r128_driver_vblank_wait; - dev->fn_tbl.irq_preinstall = r128_driver_irq_preinstall; - dev->fn_tbl.irq_postinstall = r128_driver_irq_postinstall; - dev->fn_tbl.irq_uninstall = r128_driver_irq_uninstall; - dev->fn_tbl.irq_handler = r128_driver_irq_handler; -} diff -Nru a/drivers/char/drm/radeon_cp.c b/drivers/char/drm/radeon_cp.c --- a/drivers/char/drm/radeon_cp.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/char/drm/radeon_cp.c 2005-01-02 23:03:33 -08:00 @@ -28,7 +28,6 @@ * Gareth Hughes */ -#include "radeon.h" #include "drmP.h" #include "drm.h" #include "radeon_drm.h" @@ -1006,7 +1005,7 @@ drm_radeon_private_t *dev_priv; DRM_DEBUG( "\n" ); - dev_priv = DRM(alloc)( sizeof(drm_radeon_private_t), DRM_MEM_DRIVER ); + dev_priv = drm_alloc( sizeof(drm_radeon_private_t), DRM_MEM_DRIVER ); if ( dev_priv == NULL ) return DRM_ERR(ENOMEM); @@ -1233,7 +1232,7 @@ dev_priv->ring.end = ((u32 *)dev_priv->cp_ring->handle + init->ring_size / sizeof(u32)); dev_priv->ring.size = init->ring_size; - dev_priv->ring.size_l2qw = DRM(order)( init->ring_size / 8 ); + dev_priv->ring.size_l2qw = drm_order( init->ring_size / 8 ); dev_priv->ring.tail_mask = (dev_priv->ring.size / sizeof(u32)) - 1; @@ -1247,7 +1246,7 @@ } else #endif { - if (!DRM(ati_pcigart_init)( dev, &dev_priv->phys_pci_gart, + if (!drm_ati_pcigart_init( dev, &dev_priv->phys_pci_gart, &dev_priv->bus_pci_gart)) { DRM_ERROR( "failed to init PCI GART!\n" ); dev->dev_private = (void *)dev_priv; @@ -1279,7 +1278,7 @@ * may not have been called from userspace and after dev_private * is freed, it's too late. */ - if ( dev->irq_enabled ) DRM(irq_uninstall)(dev); + if ( dev->irq_enabled ) drm_irq_uninstall(dev); if ( dev->dev_private ) { drm_radeon_private_t *dev_priv = dev->dev_private; @@ -1295,13 +1294,13 @@ } else #endif { - if (!DRM(ati_pcigart_cleanup)( dev, + if (!drm_ati_pcigart_cleanup( dev, dev_priv->phys_pci_gart, dev_priv->bus_pci_gart )) DRM_ERROR( "failed to cleanup PCI GART!\n" ); } - DRM(free)( dev->dev_private, sizeof(drm_radeon_private_t), + drm_free( dev->dev_private, sizeof(drm_radeon_private_t), DRM_MEM_DRIVER ); dev->dev_private = NULL; } diff -Nru a/drivers/char/drm/radeon_drv.c b/drivers/char/drm/radeon_drv.c --- a/drivers/char/drm/radeon_drv.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/char/drm/radeon_drv.c 2005-01-02 23:03:34 -08:00 @@ -31,11 +31,153 @@ #include -#include "radeon.h" #include "drmP.h" #include "drm.h" #include "radeon_drm.h" #include "radeon_drv.h" -#include "ati_pcigart.h" -#include "drm_core.h" +#include "drm_pciids.h" + +static int postinit( struct drm_device *dev, unsigned long flags ) +{ + DRM_INFO( "Initialized %s %d.%d.%d %s on minor %d: %s\n", + DRIVER_NAME, + DRIVER_MAJOR, + DRIVER_MINOR, + DRIVER_PATCHLEVEL, + DRIVER_DATE, + dev->minor, + pci_pretty_name(dev->pdev) + ); + return 0; +} + +static int version( drm_version_t *version ) +{ + int len; + + version->version_major = DRIVER_MAJOR; + version->version_minor = DRIVER_MINOR; + version->version_patchlevel = DRIVER_PATCHLEVEL; + DRM_COPY( version->name, DRIVER_NAME ); + DRM_COPY( version->date, DRIVER_DATE ); + DRM_COPY( version->desc, DRIVER_DESC ); + return 0; +} + +static struct pci_device_id pciidlist[] = { + radeon_PCI_IDS +}; + +/* Interface history: + * + * 1.1 - ?? + * 1.2 - Add vertex2 ioctl (keith) + * - Add stencil capability to clear ioctl (gareth, keith) + * - Increase MAX_TEXTURE_LEVELS (brian) + * 1.3 - Add cmdbuf ioctl (keith) + * - Add support for new radeon packets (keith) + * - Add getparam ioctl (keith) + * - Add flip-buffers ioctl, deprecate fullscreen foo (keith). + * 1.4 - Add scratch registers to get_param ioctl. + * 1.5 - Add r200 packets to cmdbuf ioctl + * - Add r200 function to init ioctl + * - Add 'scalar2' instruction to cmdbuf + * 1.6 - Add static GART memory manager + * Add irq handler (won't be turned on unless X server knows to) + * Add irq ioctls and irq_active getparam. + * Add wait command for cmdbuf ioctl + * Add GART offset query for getparam + * 1.7 - Add support for cube map registers: R200_PP_CUBIC_FACES_[0..5] + * and R200_PP_CUBIC_OFFSET_F1_[0..5]. + * Added packets R200_EMIT_PP_CUBIC_FACES_[0..5] and + * R200_EMIT_PP_CUBIC_OFFSETS_[0..5]. (brian) + * 1.8 - Remove need to call cleanup ioctls on last client exit (keith) + * Add 'GET' queries for starting additional clients on different VT's. + * 1.9 - Add DRM_IOCTL_RADEON_CP_RESUME ioctl. + * Add texture rectangle support for r100. + * 1.10- Add SETPARAM ioctl; first parameter to set is FB_LOCATION, which + * clients use to tell the DRM where they think the framebuffer is + * located in the card's address space + * 1.11- Add packet R200_EMIT_RB3D_BLENDCOLOR to support GL_EXT_blend_color + * and GL_EXT_blend_[func|equation]_separate on r200 + */ +static drm_ioctl_desc_t ioctls[] = { + [DRM_IOCTL_NR(DRM_RADEON_CP_INIT)] = { radeon_cp_init, 1, 1 }, + [DRM_IOCTL_NR(DRM_RADEON_CP_START)] = { radeon_cp_start, 1, 1 }, + [DRM_IOCTL_NR(DRM_RADEON_CP_STOP)] = { radeon_cp_stop, 1, 1 }, + [DRM_IOCTL_NR(DRM_RADEON_CP_RESET)] = { radeon_cp_reset, 1, 1 }, + [DRM_IOCTL_NR(DRM_RADEON_CP_IDLE)] = { radeon_cp_idle, 1, 0 }, + [DRM_IOCTL_NR(DRM_RADEON_CP_RESUME)] = { radeon_cp_resume, 1, 0 }, + [DRM_IOCTL_NR(DRM_RADEON_RESET)] = { radeon_engine_reset, 1, 0 }, + [DRM_IOCTL_NR(DRM_RADEON_FULLSCREEN)] = { radeon_fullscreen, 1, 0 }, + [DRM_IOCTL_NR(DRM_RADEON_SWAP)] = { radeon_cp_swap, 1, 0 }, + [DRM_IOCTL_NR(DRM_RADEON_CLEAR)] = { radeon_cp_clear, 1, 0 }, + [DRM_IOCTL_NR(DRM_RADEON_VERTEX)] = { radeon_cp_vertex, 1, 0 }, + [DRM_IOCTL_NR(DRM_RADEON_INDICES)] = { radeon_cp_indices, 1, 0 }, + [DRM_IOCTL_NR(DRM_RADEON_TEXTURE)] = { radeon_cp_texture, 1, 0 }, + [DRM_IOCTL_NR(DRM_RADEON_STIPPLE)] = { radeon_cp_stipple, 1, 0 }, + [DRM_IOCTL_NR(DRM_RADEON_INDIRECT)] = { radeon_cp_indirect, 1, 1 }, + [DRM_IOCTL_NR(DRM_RADEON_VERTEX2)] = { radeon_cp_vertex2, 1, 0 }, + [DRM_IOCTL_NR(DRM_RADEON_CMDBUF)] = { radeon_cp_cmdbuf, 1, 0 }, + [DRM_IOCTL_NR(DRM_RADEON_GETPARAM)] = { radeon_cp_getparam, 1, 0 }, + [DRM_IOCTL_NR(DRM_RADEON_FLIP)] = { radeon_cp_flip, 1, 0 }, + [DRM_IOCTL_NR(DRM_RADEON_ALLOC)] = { radeon_mem_alloc, 1, 0 }, + [DRM_IOCTL_NR(DRM_RADEON_FREE)] = { radeon_mem_free, 1, 0 }, + [DRM_IOCTL_NR(DRM_RADEON_INIT_HEAP)] = { radeon_mem_init_heap,1, 1 }, + [DRM_IOCTL_NR(DRM_RADEON_IRQ_EMIT)] = { radeon_irq_emit, 1, 0 }, + [DRM_IOCTL_NR(DRM_RADEON_IRQ_WAIT)] = { radeon_irq_wait, 1, 0 }, + [DRM_IOCTL_NR(DRM_RADEON_SETPARAM)] = { radeon_cp_setparam, 1, 0 }, +}; + +static struct drm_driver driver = { + .driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG | DRIVER_HAVE_IRQ | DRIVER_HAVE_DMA | DRIVER_IRQ_SHARED | DRIVER_IRQ_VBL, + .dev_priv_size = sizeof(drm_radeon_buf_priv_t), + .prerelease = radeon_driver_prerelease, + .pretakedown = radeon_driver_pretakedown, + .open_helper = radeon_driver_open_helper, + .vblank_wait = radeon_driver_vblank_wait, + .irq_preinstall = radeon_driver_irq_preinstall, + .irq_postinstall = radeon_driver_irq_postinstall, + .irq_uninstall = radeon_driver_irq_uninstall, + .irq_handler = radeon_driver_irq_handler, + .free_filp_priv = radeon_driver_free_filp_priv, + .reclaim_buffers = drm_core_reclaim_buffers, + .get_map_ofs = drm_core_get_map_ofs, + .get_reg_ofs = drm_core_get_reg_ofs, + .postinit = postinit, + .version = version, + .ioctls = ioctls, + .num_ioctls = DRM_ARRAY_SIZE(ioctls), + .dma_ioctl = radeon_cp_buffers, + .fops = { + .owner = THIS_MODULE, + .open = drm_open, + .release = drm_release, + .ioctl = drm_ioctl, + .mmap = drm_mmap, + .poll = drm_poll, + .fasync = drm_fasync, + }, + .pci_driver = { + .name = DRIVER_NAME, + .id_table = pciidlist, + } +}; + +static int __init radeon_init(void) +{ + return drm_init(&driver); +} + +static void __exit radeon_exit(void) +{ + drm_exit(&driver); +} + +module_init(radeon_init); +module_exit(radeon_exit); + +MODULE_AUTHOR( DRIVER_AUTHOR ); +MODULE_DESCRIPTION( DRIVER_DESC ); +MODULE_LICENSE("GPL and additional rights"); diff -Nru a/drivers/char/drm/radeon_drv.h b/drivers/char/drm/radeon_drv.h --- a/drivers/char/drm/radeon_drv.h 2005-01-02 23:03:34 -08:00 +++ b/drivers/char/drm/radeon_drv.h 2005-01-02 23:03:34 -08:00 @@ -31,6 +31,19 @@ #ifndef __RADEON_DRV_H__ #define __RADEON_DRV_H__ +/* General customization: + */ + +#define DRIVER_AUTHOR "Gareth Hughes, Keith Whitwell, others." + +#define DRIVER_NAME "radeon" +#define DRIVER_DESC "ATI Radeon" +#define DRIVER_DATE "20020828" + +#define DRIVER_MAJOR 1 +#define DRIVER_MINOR 11 +#define DRIVER_PATCHLEVEL 0 + #define GET_RING_HEAD(dev_priv) DRM_READ32( (dev_priv)->ring_rptr, 0 ) #define SET_RING_HEAD(dev_priv,val) DRM_WRITE32( (dev_priv)->ring_rptr, 0, (val) ) @@ -210,6 +223,14 @@ extern void radeon_driver_irq_preinstall( drm_device_t *dev ); extern void radeon_driver_irq_postinstall( drm_device_t *dev ); extern void radeon_driver_irq_uninstall( drm_device_t *dev ); +extern void radeon_driver_prerelease(drm_device_t *dev, DRMFILE filp); +extern void radeon_driver_pretakedown(drm_device_t *dev); +extern int radeon_driver_open_helper(drm_device_t *dev, drm_file_t *filp_priv); +extern void radeon_driver_free_filp_priv(drm_device_t *dev, drm_file_t *filp_priv); + +extern int radeon_preinit( struct drm_device *dev, unsigned long flags ); +extern int radeon_postinit( struct drm_device *dev, unsigned long flags ); +extern int radeon_postcleanup( struct drm_device *dev ); /* Flags for stats.boxes */ diff -Nru a/drivers/char/drm/radeon_irq.c b/drivers/char/drm/radeon_irq.c --- a/drivers/char/drm/radeon_irq.c 2005-01-02 23:03:35 -08:00 +++ b/drivers/char/drm/radeon_irq.c 2005-01-02 23:03:35 -08:00 @@ -27,10 +27,9 @@ * * Authors: * Keith Whitwell - * Michel Dänzer + * Michel D�zer */ -#include "radeon.h" #include "drmP.h" #include "drm.h" #include "radeon_drm.h" @@ -78,7 +77,7 @@ if (stat & RADEON_CRTC_VBLANK_STAT) { atomic_inc(&dev->vbl_received); DRM_WAKEUP(&dev->vbl_queue); - DRM(vbl_send_signals)( dev ); + drm_vbl_send_signals( dev ); } /* Acknowledge interrupts we handle */ @@ -223,7 +222,7 @@ /* drm_dma.h hooks */ -void DRM(driver_irq_preinstall)( drm_device_t *dev ) { +void radeon_driver_irq_preinstall( drm_device_t *dev ) { drm_radeon_private_t *dev_priv = (drm_radeon_private_t *)dev->dev_private; @@ -234,7 +233,7 @@ radeon_acknowledge_irqs( dev_priv ); } -void DRM(driver_irq_postinstall)( drm_device_t *dev ) { +void radeon_driver_irq_postinstall( drm_device_t *dev ) { drm_radeon_private_t *dev_priv = (drm_radeon_private_t *)dev->dev_private; @@ -247,7 +246,7 @@ RADEON_SW_INT_ENABLE ); } -void DRM(driver_irq_uninstall)( drm_device_t *dev ) { +void radeon_driver_irq_uninstall( drm_device_t *dev ) { drm_radeon_private_t *dev_priv = (drm_radeon_private_t *)dev->dev_private; if (!dev_priv) diff -Nru a/drivers/char/drm/radeon_mem.c b/drivers/char/drm/radeon_mem.c --- a/drivers/char/drm/radeon_mem.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/char/drm/radeon_mem.c 2005-01-02 23:03:34 -08:00 @@ -29,7 +29,6 @@ * Keith Whitwell */ -#include "radeon.h" #include "drmP.h" #include "drm.h" #include "radeon_drm.h" @@ -44,7 +43,7 @@ { /* Maybe cut off the start of an existing block */ if (start > p->start) { - struct mem_block *newblock = DRM_MALLOC(sizeof(*newblock)); + struct mem_block *newblock = drm_alloc(sizeof(*newblock), DRM_MEM_BUFS ); if (!newblock) goto out; newblock->start = start; @@ -60,7 +59,7 @@ /* Maybe cut off the end of an existing block */ if (size < p->size) { - struct mem_block *newblock = DRM_MALLOC(sizeof(*newblock)); + struct mem_block *newblock = drm_alloc(sizeof(*newblock), DRM_MEM_BUFS ); if (!newblock) goto out; newblock->start = start + size; @@ -118,7 +117,7 @@ p->size += q->size; p->next = q->next; p->next->prev = p; - DRM_FREE(q, sizeof(*q)); + drm_free(q, sizeof(*q), DRM_MEM_BUFS ); } if (p->prev->filp == 0) { @@ -126,7 +125,7 @@ q->size += p->size; q->next = p->next; q->next->prev = q; - DRM_FREE(p, sizeof(*q)); + drm_free(p, sizeof(*q), DRM_MEM_BUFS ); } } @@ -134,14 +133,14 @@ */ static int init_heap(struct mem_block **heap, int start, int size) { - struct mem_block *blocks = DRM_MALLOC(sizeof(*blocks)); + struct mem_block *blocks = drm_alloc(sizeof(*blocks), DRM_MEM_BUFS ); if (!blocks) return DRM_ERR(ENOMEM); - *heap = DRM_MALLOC(sizeof(**heap)); + *heap = drm_alloc(sizeof(**heap), DRM_MEM_BUFS ); if (!*heap) { - DRM_FREE( blocks, sizeof(*blocks) ); + drm_free( blocks, sizeof(*blocks), DRM_MEM_BUFS ); return DRM_ERR(ENOMEM); } @@ -180,7 +179,7 @@ p->size += q->size; p->next = q->next; p->next->prev = p; - DRM_FREE(q, sizeof(*q)); + drm_free(q, sizeof(*q),DRM_MEM_DRIVER); } } } @@ -197,10 +196,10 @@ for (p = (*heap)->next ; p != *heap ; ) { struct mem_block *q = p; p = p->next; - DRM_FREE(q, sizeof(*q)); + drm_free(q, sizeof(*q),DRM_MEM_DRIVER); } - DRM_FREE( *heap, sizeof(**heap) ); + drm_free( *heap, sizeof(**heap),DRM_MEM_DRIVER ); *heap = NULL; } diff -Nru a/drivers/char/drm/radeon_state.c b/drivers/char/drm/radeon_state.c --- a/drivers/char/drm/radeon_state.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/char/drm/radeon_state.c 2005-01-02 23:03:34 -08:00 @@ -27,7 +27,6 @@ * Kevin E. Martin */ -#include "radeon.h" #include "drmP.h" #include "drm.h" #include "drm_sarea.h" @@ -1440,7 +1439,8 @@ } if ( !buf ) { DRM_DEBUG("radeon_cp_dispatch_texture: EAGAIN\n"); - DRM_COPY_TO_USER( tex->image, image, sizeof(*image) ); + if (DRM_COPY_TO_USER( tex->image, image, sizeof(*image) )) + return DRM_ERR(EFAULT); return DRM_ERR(EAGAIN); } @@ -1596,7 +1596,7 @@ return 0; } -/* Called whenever a client dies, from DRM(release). +/* Called whenever a client dies, from drm_release. * NOTE: Lock isn't necessarily held when this is called! */ int radeon_do_cleanup_pageflip( drm_device_t *dev ) @@ -2553,7 +2553,7 @@ * * DRM infrastructure takes care of reclaiming dma buffers. */ -static void radeon_driver_prerelease(drm_device_t *dev, DRMFILE filp) +void radeon_driver_prerelease(drm_device_t *dev, DRMFILE filp) { if ( dev->dev_private ) { drm_radeon_private_t *dev_priv = dev->dev_private; @@ -2565,17 +2565,17 @@ } } -static void radeon_driver_pretakedown(drm_device_t *dev) +void radeon_driver_pretakedown(drm_device_t *dev) { radeon_do_release(dev); } -static int radeon_driver_open_helper(drm_device_t *dev, drm_file_t *filp_priv) +int radeon_driver_open_helper(drm_device_t *dev, drm_file_t *filp_priv) { drm_radeon_private_t *dev_priv = dev->dev_private; struct drm_radeon_driver_file_fields *radeon_priv; - radeon_priv = (struct drm_radeon_driver_file_fields *)DRM(alloc)(sizeof(*radeon_priv), DRM_MEM_FILES); + radeon_priv = (struct drm_radeon_driver_file_fields *)drm_alloc(sizeof(*radeon_priv), DRM_MEM_FILES); if (!radeon_priv) return -ENOMEM; @@ -2589,24 +2589,9 @@ } -static void radeon_driver_free_filp_priv(drm_device_t *dev, drm_file_t *filp_priv) +void radeon_driver_free_filp_priv(drm_device_t *dev, drm_file_t *filp_priv) { struct drm_radeon_driver_file_fields *radeon_priv = filp_priv->driver_priv; - DRM(free)(radeon_priv, sizeof(*radeon_priv), DRM_MEM_FILES); -} - -void radeon_driver_register_fns(struct drm_device *dev) -{ - dev->driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG | DRIVER_HAVE_IRQ | DRIVER_HAVE_DMA | DRIVER_IRQ_SHARED | DRIVER_IRQ_VBL; - dev->dev_priv_size = sizeof(drm_radeon_buf_priv_t); - dev->fn_tbl.prerelease = radeon_driver_prerelease; - dev->fn_tbl.pretakedown = radeon_driver_pretakedown; - dev->fn_tbl.open_helper = radeon_driver_open_helper; - dev->fn_tbl.free_filp_priv = radeon_driver_free_filp_priv; - dev->fn_tbl.vblank_wait = radeon_driver_vblank_wait; - dev->fn_tbl.irq_preinstall = radeon_driver_irq_preinstall; - dev->fn_tbl.irq_postinstall = radeon_driver_irq_postinstall; - dev->fn_tbl.irq_uninstall = radeon_driver_irq_uninstall; - dev->fn_tbl.irq_handler = radeon_driver_irq_handler; + drm_free(radeon_priv, sizeof(*radeon_priv), DRM_MEM_FILES); } diff -Nru a/drivers/char/drm/sis_drm.h b/drivers/char/drm/sis_drm.h --- a/drivers/char/drm/sis_drm.h 2005-01-02 23:03:35 -08:00 +++ b/drivers/char/drm/sis_drm.h 2005-01-02 23:03:35 -08:00 @@ -3,12 +3,21 @@ #define __SIS_DRM_H__ /* SiS specific ioctls */ -#define DRM_IOCTL_SIS_FB_ALLOC DRM_IOWR(0x44, drm_sis_mem_t) -#define DRM_IOCTL_SIS_FB_FREE DRM_IOW( 0x45, drm_sis_mem_t) -#define DRM_IOCTL_SIS_AGP_INIT DRM_IOWR(0x53, drm_sis_agp_t) -#define DRM_IOCTL_SIS_AGP_ALLOC DRM_IOWR(0x54, drm_sis_mem_t) -#define DRM_IOCTL_SIS_AGP_FREE DRM_IOW( 0x55, drm_sis_mem_t) -#define DRM_IOCTL_SIS_FB_INIT DRM_IOW( 0x56, drm_sis_fb_t) +#define NOT_USED_0_3 +#define DRM_SIS_FB_ALLOC 0x04 +#define DRM_SIS_FB_FREE 0x05 +#define NOT_USED_6_12 +#define DRM_SIS_AGP_INIT 0x13 +#define DRM_SIS_AGP_ALLOC 0x14 +#define DRM_SIS_AGP_FREE 0x15 +#define DRM_SIS_FB_INIT 0x16 + +#define DRM_IOCTL_SIS_FB_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_SIS_FB_ALLOC, drm_sis_mem_t) +#define DRM_IOCTL_SIS_FB_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_SIS_FB_FREE, drm_sis_mem_t) +#define DRM_IOCTL_SIS_AGP_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_SIS_AGP_INIT, drm_sis_agp_t) +#define DRM_IOCTL_SIS_AGP_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_SIS_AGP_ALLOC, drm_sis_mem_t) +#define DRM_IOCTL_SIS_AGP_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_SIS_AGP_FREE, drm_sis_mem_t) +#define DRM_IOCTL_SIS_FB_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_SIS_FB_INIT, drm_sis_fb_t) /* #define DRM_IOCTL_SIS_FLIP DRM_IOW( 0x48, drm_sis_flip_t) #define DRM_IOCTL_SIS_FLIP_INIT DRM_IO( 0x49) diff -Nru a/drivers/char/drm/sis_drv.c b/drivers/char/drm/sis_drv.c --- a/drivers/char/drm/sis_drv.c 2005-01-02 23:03:32 -08:00 +++ b/drivers/char/drm/sis_drv.c 2005-01-02 23:03:32 -08:00 @@ -26,9 +26,91 @@ */ #include -#include "sis.h" #include "drmP.h" #include "sis_drm.h" #include "sis_drv.h" -#include "drm_core.h" +#include "drm_pciids.h" + +static int postinit( struct drm_device *dev, unsigned long flags ) +{ + DRM_INFO( "Initialized %s %d.%d.%d %s on minor %d: %s\n", + DRIVER_NAME, + DRIVER_MAJOR, + DRIVER_MINOR, + DRIVER_PATCHLEVEL, + DRIVER_DATE, + dev->minor, + pci_pretty_name(dev->pdev) + ); + return 0; +} + +static int version( drm_version_t *version ) +{ + int len; + + version->version_major = DRIVER_MAJOR; + version->version_minor = DRIVER_MINOR; + version->version_patchlevel = DRIVER_PATCHLEVEL; + DRM_COPY( version->name, DRIVER_NAME ); + DRM_COPY( version->date, DRIVER_DATE ); + DRM_COPY( version->desc, DRIVER_DESC ); + return 0; +} + +static struct pci_device_id pciidlist[] = { + sisdrv_PCI_IDS +}; + +static drm_ioctl_desc_t ioctls[] = { + [DRM_IOCTL_NR(DRM_SIS_FB_ALLOC)] = { sis_fb_alloc, 1, 0 }, + [DRM_IOCTL_NR(DRM_SIS_FB_FREE)] = { sis_fb_free, 1, 0 }, + [DRM_IOCTL_NR(DRM_SIS_AGP_INIT)] = { sis_ioctl_agp_init, 1, 1 }, + [DRM_IOCTL_NR(DRM_SIS_AGP_ALLOC)] = { sis_ioctl_agp_alloc, 1, 0 }, + [DRM_IOCTL_NR(DRM_SIS_AGP_FREE)] = { sis_ioctl_agp_free, 1, 0 }, + [DRM_IOCTL_NR(DRM_SIS_FB_INIT)] = { sis_fb_init, 1, 1 } +}; + +static struct drm_driver driver = { + .driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR, + .context_ctor = sis_init_context, + .context_dtor = sis_final_context, + .reclaim_buffers = drm_core_reclaim_buffers, + .get_map_ofs = drm_core_get_map_ofs, + .get_reg_ofs = drm_core_get_reg_ofs, + .postinit = postinit, + .version = version, + .ioctls = ioctls, + .num_ioctls = DRM_ARRAY_SIZE(ioctls), + .fops = { + .owner = THIS_MODULE, + .open = drm_open, + .release = drm_release, + .ioctl = drm_ioctl, + .mmap = drm_mmap, + .poll = drm_poll, + .fasync = drm_fasync, + }, + .pci_driver = { + .name = DRIVER_NAME, + .id_table = pciidlist, + } +}; + +static int __init sis_init(void) +{ + return drm_init(&driver); +} + +static void __exit sis_exit(void) +{ + drm_exit(&driver); +} + +module_init(sis_init); +module_exit(sis_exit); + +MODULE_AUTHOR( DRIVER_AUTHOR ); +MODULE_DESCRIPTION( DRIVER_DESC ); +MODULE_LICENSE("GPL and additional rights"); diff -Nru a/drivers/char/drm/sis_drv.h b/drivers/char/drm/sis_drv.h --- a/drivers/char/drm/sis_drv.h 2005-01-02 23:03:33 -08:00 +++ b/drivers/char/drm/sis_drv.h 2005-01-02 23:03:33 -08:00 @@ -28,6 +28,17 @@ #ifndef _SIS_DRV_H_ #define _SIS_DRV_H_ +/* General customization: + */ + +#define DRIVER_AUTHOR "SIS" +#define DRIVER_NAME "sis" +#define DRIVER_DESC "SIS 300/630/540" +#define DRIVER_DATE "20030826" +#define DRIVER_MAJOR 1 +#define DRIVER_MINOR 1 +#define DRIVER_PATCHLEVEL 0 + #include "sis_ds.h" typedef struct drm_sis_private { @@ -41,5 +52,8 @@ extern int sis_ioctl_agp_alloc( DRM_IOCTL_ARGS ); extern int sis_ioctl_agp_free( DRM_IOCTL_ARGS ); extern int sis_fb_init( DRM_IOCTL_ARGS ); + +extern int sis_init_context(drm_device_t *dev, int context); +extern int sis_final_context(drm_device_t *dev, int context); #endif diff -Nru a/drivers/char/drm/sis_ds.c b/drivers/char/drm/sis_ds.c --- a/drivers/char/drm/sis_ds.c 2005-01-02 23:03:35 -08:00 +++ b/drivers/char/drm/sis_ds.c 2005-01-02 23:03:35 -08:00 @@ -28,7 +28,6 @@ * */ -#include "sis.h" #include "drmP.h" #include "drm.h" #include "sis_ds.h" @@ -42,7 +41,7 @@ int i; set_t *set; - set = (set_t *)DRM(alloc)(sizeof(set_t), DRM_MEM_DRIVER); + set = (set_t *)drm_alloc(sizeof(set_t), DRM_MEM_DRIVER); if (set != NULL) { for (i = 0; i < SET_SIZE; i++) { set->list[i].free_next = i + 1; @@ -128,14 +127,14 @@ int setDestroy(set_t *set) { - DRM(free)(set, sizeof(set_t), DRM_MEM_DRIVER); + drm_free(set, sizeof(set_t), DRM_MEM_DRIVER); return 1; } /* * GLX Hardware Device Driver common code - * Copyright (C) 1999 Keith Whitwell + * Copyright (C) 1999 Wittawat Yamwong * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -150,7 +149,7 @@ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, + * WITTAWAT YAMWONG, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -167,7 +166,7 @@ if (size <= 0) return NULL; - blocks = (TMemBlock *)DRM(calloc)(1, sizeof(TMemBlock), DRM_MEM_DRIVER); + blocks = (TMemBlock *)drm_calloc(1, sizeof(TMemBlock), DRM_MEM_DRIVER); if (blocks != NULL) { blocks->ofs = ofs; blocks->size = size; @@ -202,7 +201,7 @@ int size ) { PMemBlock blocks; - blocks = (TMemBlock *)DRM(calloc)(2, sizeof(TMemBlock), DRM_MEM_DRIVER); + blocks = (TMemBlock *)drm_calloc(2, sizeof(TMemBlock), DRM_MEM_DRIVER); if (blocks != NULL) { blocks[0].size = size; blocks[0].free = 1; @@ -229,7 +228,7 @@ /* break left */ if (startofs > p->ofs) { - newblock = (TMemBlock*) DRM(calloc)(1, sizeof(TMemBlock), + newblock = (TMemBlock*) drm_calloc(1, sizeof(TMemBlock), DRM_MEM_DRIVER); newblock->ofs = startofs; newblock->size = p->size - (startofs - p->ofs); @@ -242,7 +241,7 @@ /* break right */ if (size < p->size) { - newblock = (TMemBlock*) DRM(calloc)(1, sizeof(TMemBlock), + newblock = (TMemBlock*) drm_calloc(1, sizeof(TMemBlock), DRM_MEM_DRIVER); newblock->ofs = startofs + size; newblock->size = p->size - size; @@ -295,7 +294,7 @@ TMemBlock *q = p->next; p->size += q->size; p->next = q->next; - DRM(free)(q, sizeof(TMemBlock), DRM_MEM_DRIVER); + drm_free(q, sizeof(TMemBlock), DRM_MEM_DRIVER); return 1; } return 0; @@ -380,7 +379,7 @@ p = (TMemBlock *)heap; while (p != NULL) { q = p->next; - DRM(free)(p, sizeof(TMemBlock), DRM_MEM_DRIVER); + drm_free(p, sizeof(TMemBlock), DRM_MEM_DRIVER); p = q; } } diff -Nru a/drivers/char/drm/sis_ds.h b/drivers/char/drm/sis_ds.h --- a/drivers/char/drm/sis_ds.h 2005-01-02 23:03:34 -08:00 +++ b/drivers/char/drm/sis_ds.h 2005-01-02 23:03:34 -08:00 @@ -58,7 +58,7 @@ /* * GLX Hardware Device Driver common code - * Copyright (C) 1999 Keith Whitwell + * Copyright (C) 1999 Wittawat Yamwong * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -73,7 +73,7 @@ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, + * WITTAWAT YAMWONG, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -85,8 +85,8 @@ struct mem_block_t *heap; int ofs,size; int align; - int free:1; - int reserved:1; + unsigned int free:1; + unsigned int reserved:1; }; typedef struct mem_block_t TMemBlock; typedef struct mem_block_t *PMemBlock; diff -Nru a/drivers/char/drm/sis_mm.c b/drivers/char/drm/sis_mm.c --- a/drivers/char/drm/sis_mm.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/char/drm/sis_mm.c 2005-01-02 23:03:34 -08:00 @@ -28,7 +28,6 @@ * */ -#include "sis.h" #include "drmP.h" #include "sis_drm.h" #include "sis_drv.h" @@ -159,7 +158,7 @@ DRM_COPY_FROM_USER_IOCTL(fb, (drm_sis_fb_t __user *)data, sizeof(fb)); if (dev_priv == NULL) { - dev->dev_private = DRM(calloc)(1, sizeof(drm_sis_private_t), + dev->dev_private = drm_calloc(1, sizeof(drm_sis_private_t), DRM_MEM_DRIVER); dev_priv = dev->dev_private; if (dev_priv == NULL) @@ -247,7 +246,7 @@ drm_sis_agp_t agp; if (dev_priv == NULL) { - dev->dev_private = DRM(calloc)(1, sizeof(drm_sis_private_t), + dev->dev_private = drm_calloc(1, sizeof(drm_sis_private_t), DRM_MEM_DRIVER); dev_priv = dev->dev_private; if (dev_priv == NULL) @@ -403,11 +402,4 @@ } return 1; -} - -void DRM(driver_register_fns)(drm_device_t *dev) -{ - dev->driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR; - dev->fn_tbl.context_ctor = sis_init_context; - dev->fn_tbl.context_dtor = sis_final_context; } diff -Nru a/drivers/char/drm/tdfx.h b/drivers/char/drm/tdfx.h --- a/drivers/char/drm/tdfx.h 2005-01-02 23:03:34 -08:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,50 +0,0 @@ -/* tdfx.h -- 3dfx DRM template customization -*- linux-c -*- - * Created: Wed Feb 14 12:32:32 2001 by gareth@valinux.com - * - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Authors: - * Gareth Hughes - */ - -#ifndef __TDFX_H__ -#define __TDFX_H__ - -/* This remains constant for all DRM template files. - */ -#define DRM(x) tdfx_##x - -/* General customization: - */ - -#define DRIVER_AUTHOR "VA Linux Systems Inc." - -#define DRIVER_NAME "tdfx" -#define DRIVER_DESC "3dfx Banshee/Voodoo3+" -#define DRIVER_DATE "20010216" - -#define DRIVER_MAJOR 1 -#define DRIVER_MINOR 0 -#define DRIVER_PATCHLEVEL 0 - -#endif diff -Nru a/drivers/char/drm/tdfx_drv.c b/drivers/char/drm/tdfx_drv.c --- a/drivers/char/drm/tdfx_drv.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/char/drm/tdfx_drv.c 2005-01-02 23:03:34 -08:00 @@ -31,13 +31,77 @@ */ #include -#include "tdfx.h" #include "drmP.h" +#include "tdfx_drv.h" -#include "drm_core.h" +#include "drm_pciids.h" -void DRM(driver_register_fns)(drm_device_t *dev) +static int postinit( struct drm_device *dev, unsigned long flags ) { - dev->driver_features = DRIVER_USE_MTRR; + DRM_INFO( "Initialized %s %d.%d.%d %s on minor %d: %s\n", + DRIVER_NAME, + DRIVER_MAJOR, + DRIVER_MINOR, + DRIVER_PATCHLEVEL, + DRIVER_DATE, + dev->minor, + pci_pretty_name(dev->pdev) + ); + return 0; } +static int version( drm_version_t *version ) +{ + int len; + + version->version_major = DRIVER_MAJOR; + version->version_minor = DRIVER_MINOR; + version->version_patchlevel = DRIVER_PATCHLEVEL; + DRM_COPY( version->name, DRIVER_NAME ); + DRM_COPY( version->date, DRIVER_DATE ); + DRM_COPY( version->desc, DRIVER_DESC ); + return 0; +} + +static struct pci_device_id pciidlist[] = { + tdfx_PCI_IDS +}; + +static struct drm_driver driver = { + .driver_features = DRIVER_USE_MTRR, + .reclaim_buffers = drm_core_reclaim_buffers, + .get_map_ofs = drm_core_get_map_ofs, + .get_reg_ofs = drm_core_get_reg_ofs, + .postinit = postinit, + .version = version, + .fops = { + .owner = THIS_MODULE, + .open = drm_open, + .release = drm_release, + .ioctl = drm_ioctl, + .mmap = drm_mmap, + .poll = drm_poll, + .fasync = drm_fasync, + }, + .pci_driver = { + .name = DRIVER_NAME, + .id_table = pciidlist, + } +}; + +static int __init tdfx_init(void) +{ + return drm_init(&driver); +} + +static void __exit tdfx_exit(void) +{ + drm_exit(&driver); +} + +module_init(tdfx_init); +module_exit(tdfx_exit); + +MODULE_AUTHOR( DRIVER_AUTHOR ); +MODULE_DESCRIPTION( DRIVER_DESC ); +MODULE_LICENSE("GPL and additional rights"); diff -Nru a/drivers/char/drm/tdfx_drv.h b/drivers/char/drm/tdfx_drv.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/char/drm/tdfx_drv.h 2005-01-02 23:03:34 -08:00 @@ -0,0 +1,50 @@ +/* tdfx.h -- 3dfx DRM template customization -*- linux-c -*- + * Created: Wed Feb 14 12:32:32 2001 by gareth@valinux.com + * + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Gareth Hughes + */ + +#ifndef __TDFX_H__ +#define __TDFX_H__ + +/* This remains constant for all DRM template files. + */ +#define DRM(x) tdfx_##x + +/* General customization: + */ + +#define DRIVER_AUTHOR "VA Linux Systems Inc." + +#define DRIVER_NAME "tdfx" +#define DRIVER_DESC "3dfx Banshee/Voodoo3+" +#define DRIVER_DATE "20010216" + +#define DRIVER_MAJOR 1 +#define DRIVER_MINOR 0 +#define DRIVER_PATCHLEVEL 0 + +#endif diff -Nru a/drivers/char/hw_random.c b/drivers/char/hw_random.c --- a/drivers/char/hw_random.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/char/hw_random.c 2005-01-02 23:03:33 -08:00 @@ -56,31 +56,27 @@ /* * debugging macros */ -#undef RNG_DEBUG /* define to enable copious debugging info */ -#ifdef RNG_DEBUG -/* note: prints function name for you */ -#define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args) -#else -#define DPRINTK(fmt, args...) -#endif +/* pr_debug() collapses to a no-op if DEBUG is not defined */ +#define DPRINTK(fmt, args...) pr_debug(PFX "%s: " fmt, __FUNCTION__ , ## args) + -#define RNG_NDEBUG /* define to disable lightweight runtime checks */ +#undef RNG_NDEBUG /* define to enable lightweight runtime checks */ #ifdef RNG_NDEBUG -#define assert(expr) +#define assert(expr) \ + if(!(expr)) { \ + printk(KERN_DEBUG PFX "Assertion failed! %s,%s,%s," \ + "line=%d\n", #expr, __FILE__, __FUNCTION__, __LINE__); \ + } #else -#define assert(expr) \ - if(!(expr)) { \ - printk( "Assertion failed! %s,%s,%s,line=%d\n", \ - #expr,__FILE__,__FUNCTION__,__LINE__); \ - } +#define assert(expr) #endif #define RNG_MISCDEV_MINOR 183 /* official */ static int rng_dev_open (struct inode *inode, struct file *filp); static ssize_t rng_dev_read (struct file *filp, char __user *buf, size_t size, - loff_t * offp); + loff_t * offp); static int __init intel_init (struct pci_dev *dev); static void intel_cleanup(void); @@ -322,7 +318,8 @@ rnen |= (1 << 7); /* PMIO enable */ pci_write_config_byte(dev, 0x41, rnen); - printk(KERN_INFO PFX "AMD768 system management I/O registers at 0x%X.\n", pmbase); + pr_info( PFX "AMD768 system management I/O registers at 0x%X.\n", + pmbase); amd_dev = dev; @@ -369,7 +366,7 @@ VIA_RNG_CHUNK_1_MASK = 0xFF, }; -u32 via_rng_datum; +static u32 via_rng_datum; /* * Investigate using the 'rep' prefix to obtain 32 bits of random data @@ -483,7 +480,7 @@ static ssize_t rng_dev_read (struct file *filp, char __user *buf, size_t size, - loff_t * offp) + loff_t * offp) { static spinlock_t rng_lock = SPIN_LOCK_UNLOCKED; unsigned int have_data; @@ -606,7 +603,7 @@ if (rc) return rc; - printk (KERN_INFO RNG_DRIVER_NAME " loaded\n"); + pr_info( RNG_DRIVER_NAME " loaded\n"); DPRINTK ("EXIT, returning 0\n"); return 0; diff -Nru a/drivers/char/i8k.c b/drivers/char/i8k.c --- a/drivers/char/i8k.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/char/i8k.c 2005-01-02 23:03:33 -08:00 @@ -621,32 +621,35 @@ static int __init dmi_iterate(void (*decode)(DMIHeader *)) { - unsigned char buf[20]; - long fp = 0x000e0000L; - fp -= 16; + unsigned char buf[20]; + void __iomem *p = ioremap(0xe0000, 0x20000), *q; - while (fp < 0x000fffffL) { - fp += 16; - isa_memcpy_fromio(buf, fp, 20); - if (memcmp(buf, "_DMI_", 5)==0) { - u16 num = buf[13]<<8 | buf[12]; - u16 len = buf [7]<<8 | buf [6]; - u32 base = buf[11]<<24 | buf[10]<<16 | buf[9]<<8 | buf[8]; + if (!p) + return -1; + + for (q = p; q < p + 0x20000; q += 16) { + memcpy_fromio(buf, q, 20); + if (memcmp(buf, "_DMI_", 5)==0) { + u16 num = buf[13]<<8 | buf[12]; + u16 len = buf [7]<<8 | buf [6]; + u32 base = buf[11]<<24 | buf[10]<<16 | buf[9]<<8 | buf[8]; #ifdef I8K_DEBUG - printk(KERN_INFO "DMI %d.%d present.\n", - buf[14]>>4, buf[14]&0x0F); - printk(KERN_INFO "%d structures occupying %d bytes.\n", - buf[13]<<8 | buf[12], - buf [7]<<8 | buf[6]); - printk(KERN_INFO "DMI table at 0x%08X.\n", - buf[11]<<24 | buf[10]<<16 | buf[9]<<8 | buf[8]); + printk(KERN_INFO "DMI %d.%d present.\n", + buf[14]>>4, buf[14]&0x0F); + printk(KERN_INFO "%d structures occupying %d bytes.\n", + buf[13]<<8 | buf[12], + buf [7]<<8 | buf[6]); + printk(KERN_INFO "DMI table at 0x%08X.\n", + buf[11]<<24 | buf[10]<<16 | buf[9]<<8 | buf[8]); #endif - if (dmi_table(base, len, num, decode)==0) { - return 0; - } + if (dmi_table(base, len, num, decode)==0) { + iounmap(p); + return 0; + } + } } - } - return -1; + iounmap(p); + return -1; } /* end of DMI code */ diff -Nru a/drivers/char/mxser.c b/drivers/char/mxser.c --- a/drivers/char/mxser.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/char/mxser.c 2005-01-02 23:03:34 -08:00 @@ -401,7 +401,7 @@ static void mxser_flush_chars(struct tty_struct *); static void mxser_put_char(struct tty_struct *, unsigned char); static int mxser_ioctl(struct tty_struct *, struct file *, uint, ulong); -static int mxser_ioctl_special(unsigned int, unsigned long); +static int mxser_ioctl_special(unsigned int, void __user *); static void mxser_throttle(struct tty_struct *); static void mxser_unthrottle(struct tty_struct *); static void mxser_set_termios(struct tty_struct *, struct termios *); @@ -417,9 +417,9 @@ static int mxser_startup(struct mxser_struct *); static void mxser_shutdown(struct mxser_struct *); static int mxser_change_speed(struct mxser_struct *, struct termios *old_termios); -static int mxser_get_serial_info(struct mxser_struct *, struct serial_struct *); -static int mxser_set_serial_info(struct mxser_struct *, struct serial_struct *); -static int mxser_get_lsr_info(struct mxser_struct *, unsigned int *); +static int mxser_get_serial_info(struct mxser_struct *, struct serial_struct __user *); +static int mxser_set_serial_info(struct mxser_struct *, struct serial_struct __user *); +static int mxser_get_lsr_info(struct mxser_struct *, unsigned int __user *); static void mxser_send_break(struct mxser_struct *, int); static int mxser_tiocmget(struct tty_struct *, struct file *); static int mxser_tiocmset(struct tty_struct *, struct file *, unsigned int, unsigned int); @@ -834,6 +834,7 @@ } /* start finding PCI board here */ +#ifdef CONFIG_PCI n = (sizeof(mxser_pcibrds) / sizeof(mxser_pcibrds[0])) - 1; index = 0; b = 0; @@ -875,6 +876,7 @@ m++; } } +#endif ret1 = 0; if (!(ret1 = tty_register_driver(mxvar_sdriver))) { @@ -968,7 +970,7 @@ *tty->termios = info->normal_termios; else *tty->termios = info->callout_termios; - mxser_change_speed(info, 0); + mxser_change_speed(info, NULL); } info->session = current->signal->session; @@ -1084,7 +1086,7 @@ tty->closing = 0; info->event = 0; - info->tty = 0; + info->tty = NULL; if (info->blocked_open) { if (info->close_delay) { set_current_state(TASK_INTERRUPTIBLE); @@ -1223,12 +1225,13 @@ struct mxser_struct *info = (struct mxser_struct *) tty->driver_data; int retval; struct async_icount cprev, cnow; /* kernel counter temps */ - struct serial_icounter_struct *p_cuser; /* user space */ + struct serial_icounter_struct __user *p_cuser; unsigned long templ; unsigned long flags; + void __user *argp = (void __user *)arg; if (tty->index == MXSER_PORTS) - return (mxser_ioctl_special(cmd, arg)); + return (mxser_ioctl_special(cmd, argp)); // following add by Victor Yu. 01-05-2004 if (cmd == MOXA_SET_OP_MODE || cmd == MOXA_GET_OP_MODE) { @@ -1239,7 +1242,7 @@ p = info->port % 4; if (cmd == MOXA_SET_OP_MODE) { - if (get_user(opmode, (int *) arg)) + if (get_user(opmode, (int __user *) argp)) return -EFAULT; if (opmode != RS232_MODE && opmode != RS485_2WIRE_MODE && opmode != RS422_MODE && opmode != RS485_4WIRE_MODE) return -EFAULT; @@ -1253,7 +1256,7 @@ shiftbit = p * 2; opmode = inb(info->opmode_ioaddr) >> shiftbit; opmode &= OP_MODE_MASK; - if (copy_to_user((int *) arg, &opmode, sizeof(int))) + if (copy_to_user(argp, &opmode, sizeof(int))) return -EFAULT; } return 0; @@ -1281,19 +1284,19 @@ mxser_send_break(info, arg ? arg * (HZ / 10) : HZ / 4); return (0); case TIOCGSOFTCAR: - return put_user(C_CLOCAL(tty) ? 1 : 0, (unsigned long *) arg); + return put_user(C_CLOCAL(tty) ? 1 : 0, (unsigned long __user *) argp); case TIOCSSOFTCAR: - if (get_user(templ, (unsigned long *) arg)) + if (get_user(templ, (unsigned long __user *) argp)) return -EFAULT; arg = templ; tty->termios->c_cflag = ((tty->termios->c_cflag & ~CLOCAL) | (arg ? CLOCAL : 0)); return (0); case TIOCGSERIAL: - return (mxser_get_serial_info(info, (struct serial_struct *) arg)); + return mxser_get_serial_info(info, argp); case TIOCSSERIAL: - return (mxser_set_serial_info(info, (struct serial_struct *) arg)); + return mxser_set_serial_info(info, argp); case TIOCSERGETLSR: /* Get line status register */ - return (mxser_get_lsr_info(info, (unsigned int *) arg)); + return mxser_get_lsr_info(info, argp); /* * Wait for any of the 4 modem inputs (DCD,RI,DSR,CTS) to change * - mask passed in arg for lines of interest @@ -1340,7 +1343,7 @@ spin_lock_irqsave(&info->slock, flags); cnow = info->icount; spin_unlock_irqrestore(&info->slock, flags); - p_cuser = (struct serial_icounter_struct *) arg; + p_cuser = argp; /* modified by casper 1/11/2000 */ if (put_user(cnow.frame, &p_cuser->frame)) return -EFAULT; @@ -1364,7 +1367,7 @@ /* */ return 0; case MOXA_HighSpeedOn: - return put_user(info->baud_base != 115200 ? 1 : 0, (int *) arg); + return put_user(info->baud_base != 115200 ? 1 : 0, (int __user *) argp); case MOXA_SDS_RSTICOUNTER:{ info->mon_data.rxcnt = 0; @@ -1374,13 +1377,13 @@ // (above) added by James. case MOXA_ASPP_SETBAUD:{ long baud; - if (get_user(baud, (long *) arg)) + if (get_user(baud, (long __user *) argp)) return -EFAULT; mxser_set_baud(info, baud); return 0; } case MOXA_ASPP_GETBAUD: - if (copy_to_user((long *) arg, &info->realbaud, sizeof(long))) + if (copy_to_user(argp, &info->realbaud, sizeof(long))) return -EFAULT; return 0; @@ -1394,7 +1397,7 @@ len += (lsr ? 0 : 1); - if (copy_to_user((int *) arg, &len, sizeof(int))) + if (copy_to_user(argp, &len, sizeof(int))) return -EFAULT; return 0; @@ -1423,7 +1426,7 @@ info->mon_data.hold_reason &= ~NPPI_NOTIFY_CTSHOLD; - if (copy_to_user((struct mxser_mon *) arg, &(info->mon_data), sizeof(struct mxser_mon))) + if (copy_to_user(argp, &info->mon_data, sizeof(struct mxser_mon))) return -EFAULT; return 0; @@ -1431,7 +1434,7 @@ } case MOXA_ASPP_LSTATUS:{ - if (copy_to_user((struct mxser_mon *) arg, &(info->err_shadow), sizeof(unsigned char))) + if (copy_to_user(argp, &info->err_shadow, sizeof(unsigned char))) return -EFAULT; info->err_shadow = 0; @@ -1440,10 +1443,10 @@ } case MOXA_SET_BAUD_METHOD:{ int method; - if (get_user(method, (int *) arg)) + if (get_user(method, (int __user *) argp)) return -EFAULT; mxser_set_baud_method[info->port] = method; - if (copy_to_user((int *) arg, &method, sizeof(int))) + if (copy_to_user(argp, &method, sizeof(int))) return -EFAULT; return 0; @@ -1454,22 +1457,26 @@ return 0; } -static int mxser_ioctl_special(unsigned int cmd, unsigned long arg) +#ifndef CMSPAR +#define CMSPAR 010000000000 +#endif + +static int mxser_ioctl_special(unsigned int cmd, void __user *argp) { int i, result, status; switch (cmd) { case MOXA_GET_CONF: - if (copy_to_user((struct mxser_hwconf *) arg, mxsercfg, sizeof(struct mxser_hwconf) * 4)) + if (copy_to_user(argp, mxsercfg, sizeof(struct mxser_hwconf) * 4)) return -EFAULT; return 0; case MOXA_GET_MAJOR: - if (copy_to_user((int *) arg, &ttymajor, sizeof(int))) + if (copy_to_user(argp, &ttymajor, sizeof(int))) return -EFAULT; return 0; case MOXA_GET_CUMAJOR: - if (copy_to_user((int *) arg, &calloutmajor, sizeof(int))) + if (copy_to_user(argp, &calloutmajor, sizeof(int))) return -EFAULT; return 0; @@ -1479,9 +1486,9 @@ if (mxvar_table[i].base) result |= (1 << i); } - return put_user(result, (unsigned long *) arg); + return put_user(result, (unsigned long __user *) argp); case MOXA_GETDATACOUNT: - if (copy_to_user((struct mxser_log *) arg, &mxvar_log, sizeof(mxvar_log))) + if (copy_to_user(argp, &mxvar_log, sizeof(mxvar_log))) return -EFAULT; return (0); case MOXA_GETMSTATUS: @@ -1516,7 +1523,7 @@ else GMStatus[i].cts = 0; } - if (copy_to_user((struct mxser_mstatus *) arg, GMStatus, sizeof(struct mxser_mstatus) * MXSER_PORTS)) + if (copy_to_user(argp, GMStatus, sizeof(struct mxser_mstatus) * MXSER_PORTS)) return -EFAULT; return 0; case MOXA_ASPP_MON_EXT:{ @@ -1584,7 +1591,7 @@ mon_data_ext.iftype[i] = opmode; } - if (copy_to_user((struct mxser_mon_ext *) arg, &mon_data_ext, sizeof(struct mxser_mon_ext))) + if (copy_to_user(argp, &mon_data_ext, sizeof(struct mxser_mon_ext))) return -EFAULT; return 0; @@ -1829,7 +1836,7 @@ info->event = 0; info->count = 0; info->flags &= ~ASYNC_NORMAL_ACTIVE; - info->tty = 0; + info->tty = NULL; wake_up_interruptible(&info->open_wait); } @@ -1866,7 +1873,7 @@ int pass_counter = 0; int handled = IRQ_NONE; - port = 0; + port = NULL; //spin_lock(&gm_lock); for (i = 0; i < MXSER_BOARDS; i++) { @@ -2412,7 +2419,7 @@ * and set the speed of the serial port */ spin_unlock_irqrestore(&info->slock, flags); - mxser_change_speed(info, 0); + mxser_change_speed(info, NULL); info->flags |= ASYNC_INITIALIZED; return (0); @@ -2442,7 +2449,7 @@ */ if (info->xmit_buf) { free_page((unsigned long) info->xmit_buf); - info->xmit_buf = 0; + info->xmit_buf = NULL; } info->IER = 0; @@ -2591,9 +2598,6 @@ cval |= 0x04; if (cflag & PARENB) cval |= UART_LCR_PARITY; -#ifndef CMSPAR -#define CMSPAR 010000000000 -#endif if (!(cflag & PARODD)) { cval |= UART_LCR_EPAR; } @@ -2807,7 +2811,7 @@ * friends of mxser_ioctl() * ------------------------------------------------------------ */ -static int mxser_get_serial_info(struct mxser_struct *info, struct serial_struct *retinfo) +static int mxser_get_serial_info(struct mxser_struct *info, struct serial_struct __user *retinfo) { struct serial_struct tmp; @@ -2829,7 +2833,7 @@ return (0); } -static int mxser_set_serial_info(struct mxser_struct *info, struct serial_struct *new_info) +static int mxser_set_serial_info(struct mxser_struct *info, struct serial_struct __user *new_info) { struct serial_struct new_serial; unsigned int flags; @@ -2869,7 +2873,7 @@ /* */ if (info->flags & ASYNC_INITIALIZED) { if (flags != (info->flags & ASYNC_SPD_MASK)) { - mxser_change_speed(info, 0); + mxser_change_speed(info, NULL); } } else { retval = mxser_startup(info); @@ -2887,7 +2891,7 @@ * transmit holding register is empty. This functionality * allows an RS485 driver to be written in user space. */ -static int mxser_get_lsr_info(struct mxser_struct *info, unsigned int *value) +static int mxser_get_lsr_info(struct mxser_struct *info, unsigned int __user *value) { unsigned char status; unsigned int result; diff -Nru a/drivers/char/random.c b/drivers/char/random.c --- a/drivers/char/random.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/char/random.c 2005-01-02 23:03:33 -08:00 @@ -2369,6 +2369,24 @@ return halfMD4Transform(hash, keyptr->secret); } +/* Generate secure starting point for ephemeral TCP port search */ +u32 secure_tcp_port_ephemeral(__u32 saddr, __u32 daddr, __u16 dport) +{ + struct keydata *keyptr = get_keyptr(); + u32 hash[4]; + + /* + * Pick a unique starting offset for each ephemeral port search + * (saddr, daddr, dport) and 48bits of random data. + */ + hash[0] = saddr; + hash[1] = daddr; + hash[2] = dport ^ keyptr->secret[10]; + hash[3] = keyptr->secret[11]; + + return halfMD4Transform(hash, keyptr->secret); +} + #ifdef CONFIG_SYN_COOKIES /* * Secure SYN cookie computation. This is the algorithm worked out by diff -Nru a/drivers/char/rtc.c b/drivers/char/rtc.c --- a/drivers/char/rtc.c 2005-01-02 23:03:35 -08:00 +++ b/drivers/char/rtc.c 2005-01-02 23:03:35 -08:00 @@ -878,7 +878,7 @@ &rtc_fops }; -#ifdef RTC_IRQ +#if defined(RTC_IRQ) && !defined(__sparc__) static irqreturn_t (*rtc_int_handler_ptr)(int irq, void *dev_id, struct pt_regs *regs); #endif diff -Nru a/drivers/char/watchdog/Kconfig b/drivers/char/watchdog/Kconfig --- a/drivers/char/watchdog/Kconfig 2005-01-02 23:03:34 -08:00 +++ b/drivers/char/watchdog/Kconfig 2005-01-02 23:03:34 -08:00 @@ -93,6 +93,11 @@ be built as a module by choosing M. The module will be called ixp4xx_wdt. + Note: The internal IXP4xx watchdog does a soft CPU reset + which doesn't reset any peripherals. There are circumstances + where the watchdog will fail to reset the board correctly + (e.g., if the boot ROM is in an unreadable state). + Say N if you are unsure. config IXP2000_WATCHDOG diff -Nru a/drivers/char/watchdog/alim7101_wdt.c b/drivers/char/watchdog/alim7101_wdt.c --- a/drivers/char/watchdog/alim7101_wdt.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/char/watchdog/alim7101_wdt.c 2005-01-02 23:03:34 -08:00 @@ -12,6 +12,11 @@ * because this particular WDT has a very short timeout (1.6 * seconds) and it would be insane to count on any userspace * daemon always getting scheduled within that time frame. + * + * Additions: + * Aug 23, 2004 - Added use_gpio module parameter for use on revision a1d PMUs + * found on very old cobalt hardware. + * -- Mike Waychison */ #include @@ -38,6 +43,8 @@ #define WDT_DISABLE 0x8C #define ALI_7101_WDT 0x92 +#define ALI_7101_GPIO 0x7D +#define ALI_7101_GPIO_O 0x7E #define ALI_WDT_ARM 0x01 /* @@ -57,6 +64,10 @@ module_param(timeout, int, 0); MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. (1<=timeout<=3600, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ")"); +static int use_gpio = 0; /* Use the pic (for a1d revision alim7101) */ +module_param(use_gpio, int, 0); +MODULE_PARM_DESC(use_gpio, "Use the gpio watchdog. (required by old cobalt boards)"); + static void wdt_timer_ping(unsigned long); static struct timer_list timer; static unsigned long next_heartbeat; @@ -90,6 +101,13 @@ pci_read_config_byte(alim7101_pmu, 0x92, &tmp); pci_write_config_byte(alim7101_pmu, ALI_7101_WDT, (tmp & ~ALI_WDT_ARM)); pci_write_config_byte(alim7101_pmu, ALI_7101_WDT, (tmp | ALI_WDT_ARM)); + if (use_gpio) { + pci_read_config_byte(alim7101_pmu, ALI_7101_GPIO_O, &tmp); + pci_write_config_byte(alim7101_pmu, ALI_7101_GPIO_O, tmp + | 0x20); + pci_write_config_byte(alim7101_pmu, ALI_7101_GPIO_O, tmp + & ~0x20); + } } else { printk(KERN_WARNING PFX "Heartbeat lost! Will not ping the watchdog\n"); } @@ -106,11 +124,21 @@ { char tmp; - pci_read_config_byte(alim7101_pmu, 0x92, &tmp); - if (writeval == WDT_ENABLE) + pci_read_config_byte(alim7101_pmu, ALI_7101_WDT, &tmp); + if (writeval == WDT_ENABLE) { pci_write_config_byte(alim7101_pmu, ALI_7101_WDT, (tmp | ALI_WDT_ARM)); - else + if (use_gpio) { + pci_read_config_byte(alim7101_pmu, ALI_7101_GPIO_O, &tmp); + pci_write_config_byte(alim7101_pmu, ALI_7101_GPIO_O, tmp & ~0x20); + } + + } else { pci_write_config_byte(alim7101_pmu, ALI_7101_WDT, (tmp & ~ALI_WDT_ARM)); + if (use_gpio) { + pci_read_config_byte(alim7101_pmu, ALI_7101_GPIO_O, &tmp); + pci_write_config_byte(alim7101_pmu, ALI_7101_GPIO_O, tmp | 0x20); + } + } } static void wdt_startup(void) @@ -334,7 +362,13 @@ return -EBUSY; } pci_read_config_byte(ali1543_south, 0x5e, &tmp); - if ((tmp & 0x1e) != 0x12) { + if ((tmp & 0x1e) == 0x00) { + if (!use_gpio) { + printk(KERN_INFO PFX "Detected old alim7101 revision 'a1d'. If this is a cobalt board, set the 'use_gpio' module parameter.\n"); + return -EBUSY; + } + nowayout = 1; + } else if ((tmp & 0x1e) != 0x12 && (tmp & 0x1e) != 0x00) { printk(KERN_INFO PFX "ALi 1543 South-Bridge does not have the correct revision number (???1001?) - WDT not set\n"); return -EBUSY; } @@ -362,6 +396,10 @@ printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n", rc); goto err_out_miscdev; + } + + if (nowayout) { + __module_get(THIS_MODULE); } printk(KERN_INFO PFX "WDT driver for ALi M7101 initialised. timeout=%d sec (nowayout=%d)\n", diff -Nru a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/crypto/Kconfig 2005-01-02 23:03:35 -08:00 @@ -0,0 +1,23 @@ +menu "Hardware crypto devices" + +config CRYPTO_DEV_PADLOCK + tristate "Support for VIA PadLock ACE" + depends on CRYPTO && X86 && !X86_64 + help + Some VIA processors come with an integrated crypto engine + (so called VIA PadLock ACE, Advanced Cryptography Engine) + that provides instructions for very fast {en,de}cryption + with some algorithms. + + The instructions are used only when the CPU supports them. + Otherwise software encryption is used. If you are unsure, + say Y. + +config CRYPTO_DEV_PADLOCK_AES + bool "Support for AES in VIA PadLock" + depends on CRYPTO_DEV_PADLOCK + default y + help + Use VIA PadLock for AES algorithm. + +endmenu diff -Nru a/drivers/crypto/Makefile b/drivers/crypto/Makefile --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/crypto/Makefile 2005-01-02 23:03:35 -08:00 @@ -0,0 +1,7 @@ + +obj-$(CONFIG_CRYPTO_DEV_PADLOCK) += padlock.o + +padlock-objs-$(CONFIG_CRYPTO_DEV_PADLOCK_AES) += padlock-aes.o + +padlock-objs := padlock-generic.o $(padlock-objs-y) + diff -Nru a/drivers/crypto/padlock-aes.c b/drivers/crypto/padlock-aes.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/crypto/padlock-aes.c 2005-01-02 23:03:35 -08:00 @@ -0,0 +1,468 @@ +/* + * Cryptographic API. + * + * Support for VIA PadLock hardware crypto engine. + * + * Copyright (c) 2004 Michal Ludvig + * + * Key expansion routine taken from crypto/aes.c + * + * 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. + * + * --------------------------------------------------------------------------- + * Copyright (c) 2002, Dr Brian Gladman , Worcester, UK. + * All rights reserved. + * + * LICENSE TERMS + * + * The free distribution and use of this software in both source and binary + * form is allowed (with or without changes) provided that: + * + * 1. distributions of this source code include the above copyright + * notice, this list of conditions and the following disclaimer; + * + * 2. distributions in binary form include the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other associated materials; + * + * 3. the copyright holder's name is not used to endorse products + * built using this software without specific written permission. + * + * ALTERNATIVELY, provided that this notice is retained in full, this product + * may be distributed under the terms of the GNU General Public License (GPL), + * in which case the provisions of the GPL apply INSTEAD OF those given above. + * + * DISCLAIMER + * + * This software is provided 'as is' with no explicit or implied warranties + * in respect of its properties, including, but not limited to, correctness + * and/or fitness for purpose. + * --------------------------------------------------------------------------- + */ + +#include +#include +#include +#include +#include +#include +#include +#include "padlock.h" + +#define AES_MIN_KEY_SIZE 16 /* in uint8_t units */ +#define AES_MAX_KEY_SIZE 32 /* ditto */ +#define AES_BLOCK_SIZE 16 /* ditto */ +#define AES_EXTENDED_KEY_SIZE 64 /* in uint32_t units */ +#define AES_EXTENDED_KEY_SIZE_B (AES_EXTENDED_KEY_SIZE * sizeof(uint32_t)) + +struct aes_ctx { + uint32_t e_data[AES_EXTENDED_KEY_SIZE+4]; + uint32_t d_data[AES_EXTENDED_KEY_SIZE+4]; + uint32_t *E; + uint32_t *D; + int key_length; +}; + +/* ====== Key management routines ====== */ + +static inline uint32_t +generic_rotr32 (const uint32_t x, const unsigned bits) +{ + const unsigned n = bits % 32; + return (x >> n) | (x << (32 - n)); +} + +static inline uint32_t +generic_rotl32 (const uint32_t x, const unsigned bits) +{ + const unsigned n = bits % 32; + return (x << n) | (x >> (32 - n)); +} + +#define rotl generic_rotl32 +#define rotr generic_rotr32 + +/* + * #define byte(x, nr) ((unsigned char)((x) >> (nr*8))) + */ +static inline uint8_t +byte(const uint32_t x, const unsigned n) +{ + return x >> (n << 3); +} + +#define uint32_t_in(x) le32_to_cpu(*(const uint32_t *)(x)) +#define uint32_t_out(to, from) (*(uint32_t *)(to) = cpu_to_le32(from)) + +#define E_KEY ctx->E +#define D_KEY ctx->D + +static uint8_t pow_tab[256]; +static uint8_t log_tab[256]; +static uint8_t sbx_tab[256]; +static uint8_t isb_tab[256]; +static uint32_t rco_tab[10]; +static uint32_t ft_tab[4][256]; +static uint32_t it_tab[4][256]; + +static uint32_t fl_tab[4][256]; +static uint32_t il_tab[4][256]; + +static inline uint8_t +f_mult (uint8_t a, uint8_t b) +{ + uint8_t aa = log_tab[a], cc = aa + log_tab[b]; + + return pow_tab[cc + (cc < aa ? 1 : 0)]; +} + +#define ff_mult(a,b) (a && b ? f_mult(a, b) : 0) + +#define f_rn(bo, bi, n, k) \ + bo[n] = ft_tab[0][byte(bi[n],0)] ^ \ + ft_tab[1][byte(bi[(n + 1) & 3],1)] ^ \ + ft_tab[2][byte(bi[(n + 2) & 3],2)] ^ \ + ft_tab[3][byte(bi[(n + 3) & 3],3)] ^ *(k + n) + +#define i_rn(bo, bi, n, k) \ + bo[n] = it_tab[0][byte(bi[n],0)] ^ \ + it_tab[1][byte(bi[(n + 3) & 3],1)] ^ \ + it_tab[2][byte(bi[(n + 2) & 3],2)] ^ \ + it_tab[3][byte(bi[(n + 1) & 3],3)] ^ *(k + n) + +#define ls_box(x) \ + ( fl_tab[0][byte(x, 0)] ^ \ + fl_tab[1][byte(x, 1)] ^ \ + fl_tab[2][byte(x, 2)] ^ \ + fl_tab[3][byte(x, 3)] ) + +#define f_rl(bo, bi, n, k) \ + bo[n] = fl_tab[0][byte(bi[n],0)] ^ \ + fl_tab[1][byte(bi[(n + 1) & 3],1)] ^ \ + fl_tab[2][byte(bi[(n + 2) & 3],2)] ^ \ + fl_tab[3][byte(bi[(n + 3) & 3],3)] ^ *(k + n) + +#define i_rl(bo, bi, n, k) \ + bo[n] = il_tab[0][byte(bi[n],0)] ^ \ + il_tab[1][byte(bi[(n + 3) & 3],1)] ^ \ + il_tab[2][byte(bi[(n + 2) & 3],2)] ^ \ + il_tab[3][byte(bi[(n + 1) & 3],3)] ^ *(k + n) + +static void +gen_tabs (void) +{ + uint32_t i, t; + uint8_t p, q; + + /* log and power tables for GF(2**8) finite field with + 0x011b as modular polynomial - the simplest prmitive + root is 0x03, used here to generate the tables */ + + for (i = 0, p = 1; i < 256; ++i) { + pow_tab[i] = (uint8_t) p; + log_tab[p] = (uint8_t) i; + + p ^= (p << 1) ^ (p & 0x80 ? 0x01b : 0); + } + + log_tab[1] = 0; + + for (i = 0, p = 1; i < 10; ++i) { + rco_tab[i] = p; + + p = (p << 1) ^ (p & 0x80 ? 0x01b : 0); + } + + for (i = 0; i < 256; ++i) { + p = (i ? pow_tab[255 - log_tab[i]] : 0); + q = ((p >> 7) | (p << 1)) ^ ((p >> 6) | (p << 2)); + p ^= 0x63 ^ q ^ ((q >> 6) | (q << 2)); + sbx_tab[i] = p; + isb_tab[p] = (uint8_t) i; + } + + for (i = 0; i < 256; ++i) { + p = sbx_tab[i]; + + t = p; + fl_tab[0][i] = t; + fl_tab[1][i] = rotl (t, 8); + fl_tab[2][i] = rotl (t, 16); + fl_tab[3][i] = rotl (t, 24); + + t = ((uint32_t) ff_mult (2, p)) | + ((uint32_t) p << 8) | + ((uint32_t) p << 16) | ((uint32_t) ff_mult (3, p) << 24); + + ft_tab[0][i] = t; + ft_tab[1][i] = rotl (t, 8); + ft_tab[2][i] = rotl (t, 16); + ft_tab[3][i] = rotl (t, 24); + + p = isb_tab[i]; + + t = p; + il_tab[0][i] = t; + il_tab[1][i] = rotl (t, 8); + il_tab[2][i] = rotl (t, 16); + il_tab[3][i] = rotl (t, 24); + + t = ((uint32_t) ff_mult (14, p)) | + ((uint32_t) ff_mult (9, p) << 8) | + ((uint32_t) ff_mult (13, p) << 16) | + ((uint32_t) ff_mult (11, p) << 24); + + it_tab[0][i] = t; + it_tab[1][i] = rotl (t, 8); + it_tab[2][i] = rotl (t, 16); + it_tab[3][i] = rotl (t, 24); + } +} + +#define star_x(x) (((x) & 0x7f7f7f7f) << 1) ^ ((((x) & 0x80808080) >> 7) * 0x1b) + +#define imix_col(y,x) \ + u = star_x(x); \ + v = star_x(u); \ + w = star_x(v); \ + t = w ^ (x); \ + (y) = u ^ v ^ w; \ + (y) ^= rotr(u ^ t, 8) ^ \ + rotr(v ^ t, 16) ^ \ + rotr(t,24) + +/* initialise the key schedule from the user supplied key */ + +#define loop4(i) \ +{ t = rotr(t, 8); t = ls_box(t) ^ rco_tab[i]; \ + t ^= E_KEY[4 * i]; E_KEY[4 * i + 4] = t; \ + t ^= E_KEY[4 * i + 1]; E_KEY[4 * i + 5] = t; \ + t ^= E_KEY[4 * i + 2]; E_KEY[4 * i + 6] = t; \ + t ^= E_KEY[4 * i + 3]; E_KEY[4 * i + 7] = t; \ +} + +#define loop6(i) \ +{ t = rotr(t, 8); t = ls_box(t) ^ rco_tab[i]; \ + t ^= E_KEY[6 * i]; E_KEY[6 * i + 6] = t; \ + t ^= E_KEY[6 * i + 1]; E_KEY[6 * i + 7] = t; \ + t ^= E_KEY[6 * i + 2]; E_KEY[6 * i + 8] = t; \ + t ^= E_KEY[6 * i + 3]; E_KEY[6 * i + 9] = t; \ + t ^= E_KEY[6 * i + 4]; E_KEY[6 * i + 10] = t; \ + t ^= E_KEY[6 * i + 5]; E_KEY[6 * i + 11] = t; \ +} + +#define loop8(i) \ +{ t = rotr(t, 8); ; t = ls_box(t) ^ rco_tab[i]; \ + t ^= E_KEY[8 * i]; E_KEY[8 * i + 8] = t; \ + t ^= E_KEY[8 * i + 1]; E_KEY[8 * i + 9] = t; \ + t ^= E_KEY[8 * i + 2]; E_KEY[8 * i + 10] = t; \ + t ^= E_KEY[8 * i + 3]; E_KEY[8 * i + 11] = t; \ + t = E_KEY[8 * i + 4] ^ ls_box(t); \ + E_KEY[8 * i + 12] = t; \ + t ^= E_KEY[8 * i + 5]; E_KEY[8 * i + 13] = t; \ + t ^= E_KEY[8 * i + 6]; E_KEY[8 * i + 14] = t; \ + t ^= E_KEY[8 * i + 7]; E_KEY[8 * i + 15] = t; \ +} + +/* Tells whether the ACE is capable to generate + the extended key for a given key_len. */ +static inline int +aes_hw_extkey_available(uint8_t key_len) +{ + /* TODO: We should check the actual CPU model/stepping + as it's possible that the capability will be + added in the next CPU revisions. */ + if (key_len == 16) + return 1; + return 0; +} + +static int +aes_set_key(void *ctx_arg, const uint8_t *in_key, unsigned int key_len, uint32_t *flags) +{ + struct aes_ctx *ctx = ctx_arg; + uint32_t i, t, u, v, w; + uint32_t P[AES_EXTENDED_KEY_SIZE]; + uint32_t rounds; + + if (key_len != 16 && key_len != 24 && key_len != 32) { + *flags |= CRYPTO_TFM_RES_BAD_KEY_LEN; + return -EINVAL; + } + + ctx->key_length = key_len; + + ctx->E = ctx->e_data; + ctx->D = ctx->d_data; + + /* Ensure 16-Bytes alignmentation of keys for VIA PadLock. */ + if ((int)(ctx->e_data) & 0x0F) + ctx->E += 4 - (((int)(ctx->e_data) & 0x0F) / sizeof (ctx->e_data[0])); + + if ((int)(ctx->d_data) & 0x0F) + ctx->D += 4 - (((int)(ctx->d_data) & 0x0F) / sizeof (ctx->d_data[0])); + + E_KEY[0] = uint32_t_in (in_key); + E_KEY[1] = uint32_t_in (in_key + 4); + E_KEY[2] = uint32_t_in (in_key + 8); + E_KEY[3] = uint32_t_in (in_key + 12); + + /* Don't generate extended keys if the hardware can do it. */ + if (aes_hw_extkey_available(key_len)) + return 0; + + switch (key_len) { + case 16: + t = E_KEY[3]; + for (i = 0; i < 10; ++i) + loop4 (i); + break; + + case 24: + E_KEY[4] = uint32_t_in (in_key + 16); + t = E_KEY[5] = uint32_t_in (in_key + 20); + for (i = 0; i < 8; ++i) + loop6 (i); + break; + + case 32: + E_KEY[4] = uint32_t_in (in_key + 16); + E_KEY[5] = uint32_t_in (in_key + 20); + E_KEY[6] = uint32_t_in (in_key + 24); + t = E_KEY[7] = uint32_t_in (in_key + 28); + for (i = 0; i < 7; ++i) + loop8 (i); + break; + } + + D_KEY[0] = E_KEY[0]; + D_KEY[1] = E_KEY[1]; + D_KEY[2] = E_KEY[2]; + D_KEY[3] = E_KEY[3]; + + for (i = 4; i < key_len + 24; ++i) { + imix_col (D_KEY[i], E_KEY[i]); + } + + /* PadLock needs a different format of the decryption key. */ + rounds = 10 + (key_len - 16) / 4; + + for (i = 0; i < rounds; i++) { + P[((i + 1) * 4) + 0] = D_KEY[((rounds - i - 1) * 4) + 0]; + P[((i + 1) * 4) + 1] = D_KEY[((rounds - i - 1) * 4) + 1]; + P[((i + 1) * 4) + 2] = D_KEY[((rounds - i - 1) * 4) + 2]; + P[((i + 1) * 4) + 3] = D_KEY[((rounds - i - 1) * 4) + 3]; + } + + P[0] = E_KEY[(rounds * 4) + 0]; + P[1] = E_KEY[(rounds * 4) + 1]; + P[2] = E_KEY[(rounds * 4) + 2]; + P[3] = E_KEY[(rounds * 4) + 3]; + + memcpy(D_KEY, P, AES_EXTENDED_KEY_SIZE_B); + + return 0; +} + +/* ====== Encryption/decryption routines ====== */ + +/* This is the real call to PadLock. */ +static inline void +padlock_xcrypt_ecb(uint8_t *input, uint8_t *output, uint8_t *key, + void *control_word, uint32_t count) +{ + asm volatile ("pushfl; popfl"); /* enforce key reload. */ + asm volatile (".byte 0xf3,0x0f,0xa7,0xc8" /* rep xcryptecb */ + : "+S"(input), "+D"(output) + : "d"(control_word), "b"(key), "c"(count)); +} + +static void +aes_padlock(void *ctx_arg, uint8_t *out_arg, const uint8_t *in_arg, int encdec) +{ + /* Don't blindly modify this structure - the items must + fit on 16-Bytes boundaries! */ + struct padlock_xcrypt_data { + uint8_t buf[AES_BLOCK_SIZE]; + union cword cword; + }; + + struct aes_ctx *ctx = ctx_arg; + char bigbuf[sizeof(struct padlock_xcrypt_data) + 16]; + struct padlock_xcrypt_data *data; + void *key; + + /* Place 'data' at the first 16-Bytes aligned address in 'bigbuf'. */ + if (((long)bigbuf) & 0x0F) + data = (void*)(bigbuf + 16 - ((long)bigbuf & 0x0F)); + else + data = (void*)bigbuf; + + /* Prepare Control word. */ + memset (data, 0, sizeof(struct padlock_xcrypt_data)); + data->cword.b.encdec = !encdec; /* in the rest of cryptoapi ENC=1/DEC=0 */ + data->cword.b.rounds = 10 + (ctx->key_length - 16) / 4; + data->cword.b.ksize = (ctx->key_length - 16) / 8; + + /* Is the hardware capable to generate the extended key? */ + if (!aes_hw_extkey_available(ctx->key_length)) + data->cword.b.keygen = 1; + + /* ctx->E starts with a plain key - if the hardware is capable + to generate the extended key itself we must supply + the plain key for both Encryption and Decryption. */ + if (encdec == CRYPTO_DIR_ENCRYPT || data->cword.b.keygen == 0) + key = ctx->E; + else + key = ctx->D; + + memcpy(data->buf, in_arg, AES_BLOCK_SIZE); + padlock_xcrypt_ecb(data->buf, data->buf, key, &data->cword, 1); + memcpy(out_arg, data->buf, AES_BLOCK_SIZE); +} + +static void +aes_encrypt(void *ctx_arg, uint8_t *out, const uint8_t *in) +{ + aes_padlock(ctx_arg, out, in, CRYPTO_DIR_ENCRYPT); +} + +static void +aes_decrypt(void *ctx_arg, uint8_t *out, const uint8_t *in) +{ + aes_padlock(ctx_arg, out, in, CRYPTO_DIR_DECRYPT); +} + +static struct crypto_alg aes_alg = { + .cra_name = "aes", + .cra_flags = CRYPTO_ALG_TYPE_CIPHER, + .cra_blocksize = AES_BLOCK_SIZE, + .cra_ctxsize = sizeof(struct aes_ctx), + .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(aes_alg.cra_list), + .cra_u = { + .cipher = { + .cia_min_keysize = AES_MIN_KEY_SIZE, + .cia_max_keysize = AES_MAX_KEY_SIZE, + .cia_setkey = aes_set_key, + .cia_encrypt = aes_encrypt, + .cia_decrypt = aes_decrypt + } + } +}; + +int __init padlock_init_aes(void) +{ + printk(KERN_NOTICE PFX "Using VIA PadLock ACE for AES algorithm.\n"); + + gen_tabs(); + return crypto_register_alg(&aes_alg); +} + +void __exit padlock_fini_aes(void) +{ + crypto_unregister_alg(&aes_alg); +} diff -Nru a/drivers/crypto/padlock-generic.c b/drivers/crypto/padlock-generic.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/crypto/padlock-generic.c 2005-01-02 23:03:35 -08:00 @@ -0,0 +1,63 @@ +/* + * Cryptographic API. + * + * Support for VIA PadLock hardware crypto engine. + * + * Copyright (c) 2004 Michal Ludvig + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include +#include "padlock.h" + +static int __init +padlock_init(void) +{ + int ret = -ENOSYS; + + if (!cpu_has_xcrypt) { + printk(KERN_ERR PFX "VIA PadLock not detected.\n"); + return -ENODEV; + } + + if (!cpu_has_xcrypt_enabled) { + printk(KERN_ERR PFX "VIA PadLock detected, but not enabled. Hmm, strange...\n"); + return -ENODEV; + } + +#ifdef CONFIG_CRYPTO_DEV_PADLOCK_AES + if ((ret = padlock_init_aes())) { + printk(KERN_ERR PFX "VIA PadLock AES initialization failed.\n"); + return ret; + } +#endif + + if (ret == -ENOSYS) + printk(KERN_ERR PFX "Hmm, VIA PadLock was compiled without any algorithm.\n"); + + return ret; +} + +static void __exit +padlock_fini(void) +{ +#ifdef CONFIG_CRYPTO_DEV_PADLOCK_AES + padlock_fini_aes(); +#endif +} + +module_init(padlock_init); +module_exit(padlock_fini); + +MODULE_DESCRIPTION("VIA PadLock crypto engine support."); +MODULE_LICENSE("Dual BSD/GPL"); +MODULE_AUTHOR("Michal Ludvig"); diff -Nru a/drivers/crypto/padlock.h b/drivers/crypto/padlock.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/crypto/padlock.h 2005-01-02 23:03:35 -08:00 @@ -0,0 +1,36 @@ +/* + * Driver for VIA PadLock + * + * Copyright (c) 2004 Michal Ludvig + * + * 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. + * + */ + +#ifndef _CRYPTO_PADLOCK_H +#define _CRYPTO_PADLOCK_H + +/* Control word. */ +union cword { + uint32_t cword[4]; + struct { + int rounds:4; + int algo:3; + int keygen:1; + int interm:1; + int encdec:1; + int ksize:2; + } b; +}; + +#define PFX "padlock: " + +#ifdef CONFIG_CRYPTO_DEV_PADLOCK_AES +int padlock_init_aes(void); +void padlock_fini_aes(void); +#endif + +#endif /* _CRYPTO_PADLOCK_H */ diff -Nru a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c --- a/drivers/ide/ide-proc.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/ide/ide-proc.c 2005-01-02 23:03:34 -08:00 @@ -492,20 +492,6 @@ } } -static void destroy_proc_ide_interfaces(void) -{ - int h; - - for (h = 0; h < MAX_HWIFS; h++) { - ide_hwif_t *hwif = &ide_hwifs[h]; -#if 0 - if (!hwif->present) - continue; -#endif - destroy_proc_ide_interface(hwif); - } -} - extern struct seq_operations ide_drivers_op; static int ide_drivers_open(struct inode *inode, struct file *file) { @@ -535,6 +521,5 @@ void proc_ide_destroy(void) { remove_proc_entry("ide/drivers", proc_ide_root); - destroy_proc_ide_interfaces(); remove_proc_entry("ide", NULL); } diff -Nru a/drivers/ide/ide.c b/drivers/ide/ide.c --- a/drivers/ide/ide.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/ide/ide.c 2005-01-02 23:03:33 -08:00 @@ -2501,11 +2501,8 @@ { int index; - for (index = 0; index < MAX_HWIFS; ++index) { + for (index = 0; index < MAX_HWIFS; ++index) ide_unregister(index); - if (ide_hwifs[index].dma_base) - (void) ide_release_dma(&ide_hwifs[index]); - } #ifdef CONFIG_PROC_FS proc_ide_destroy(); diff -Nru a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c --- a/drivers/ide/pci/aec62xx.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/ide/pci/aec62xx.c 2005-01-02 23:03:34 -08:00 @@ -321,12 +321,12 @@ ide_setup_dma(hwif, dmabase, 8); } -static void __devinit init_setup_aec62xx(struct pci_dev *dev, ide_pci_device_t *d) +static int __devinit init_setup_aec62xx(struct pci_dev *dev, ide_pci_device_t *d) { - ide_setup_pci_device(dev, d); + return ide_setup_pci_device(dev, d); } -static void __devinit init_setup_aec6x80(struct pci_dev *dev, ide_pci_device_t *d) +static int __devinit init_setup_aec6x80(struct pci_dev *dev, ide_pci_device_t *d) { unsigned long bar4reg = pci_resource_start(dev, 4); @@ -340,7 +340,7 @@ strcpy(d->name, "AEC6280R"); } - ide_setup_pci_device(dev, d); + return ide_setup_pci_device(dev, d); } /** @@ -356,8 +356,7 @@ { ide_pci_device_t *d = &aec62xx_chipsets[id->driver_data]; - d->init_setup(dev, d); - return 0; + return d->init_setup(dev, d); } static struct pci_device_id aec62xx_pci_tbl[] = { diff -Nru a/drivers/ide/pci/aec62xx.h b/drivers/ide/pci/aec62xx.h --- a/drivers/ide/pci/aec62xx.h 2005-01-02 23:03:34 -08:00 +++ b/drivers/ide/pci/aec62xx.h 2005-01-02 23:03:34 -08:00 @@ -61,8 +61,8 @@ #define BUSCLOCK(D) \ ((struct chipset_bus_clock_list_entry *) pci_get_drvdata((D))) -static void init_setup_aec6x80(struct pci_dev *, ide_pci_device_t *); -static void init_setup_aec62xx(struct pci_dev *, ide_pci_device_t *); +static int init_setup_aec6x80(struct pci_dev *, ide_pci_device_t *); +static int init_setup_aec62xx(struct pci_dev *, ide_pci_device_t *); static unsigned int init_chipset_aec62xx(struct pci_dev *, const char *); static void init_hwif_aec62xx(ide_hwif_t *); static void init_dma_aec62xx(ide_hwif_t *, unsigned long); diff -Nru a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c --- a/drivers/ide/pci/alim15x3.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/ide/pci/alim15x3.c 2005-01-02 23:03:33 -08:00 @@ -884,8 +884,7 @@ #if defined(CONFIG_SPARC64) d->init_hwif = init_hwif_common_ali15x3; #endif /* CONFIG_SPARC64 */ - ide_setup_pci_device(dev, d); - return 0; + return ide_setup_pci_device(dev, d); } diff -Nru a/drivers/ide/pci/amd74xx.c b/drivers/ide/pci/amd74xx.c --- a/drivers/ide/pci/amd74xx.c 2005-01-02 23:03:35 -08:00 +++ b/drivers/ide/pci/amd74xx.c 2005-01-02 23:03:35 -08:00 @@ -493,9 +493,12 @@ { amd_chipset = amd74xx_chipsets + id->driver_data; amd_config = amd_ide_chips + id->driver_data; - if (dev->device != amd_config->id) BUG(); - ide_setup_pci_device(dev, amd_chipset); - return 0; + if (dev->device != amd_config->id) { + printk(KERN_ERR "%s: assertion 0x%02x == 0x%02x failed !\n", + pci_name(dev), dev->device, amd_config->id); + return -ENODEV; + } + return ide_setup_pci_device(dev, amd_chipset); } static struct pci_device_id amd74xx_pci_tbl[] = { diff -Nru a/drivers/ide/pci/atiixp.c b/drivers/ide/pci/atiixp.c --- a/drivers/ide/pci/atiixp.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/ide/pci/atiixp.c 2005-01-02 23:03:34 -08:00 @@ -341,8 +341,7 @@ static int __devinit atiixp_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_setup_pci_device(dev, &atiixp_pci_info[id->driver_data]); - return 0; + return ide_setup_pci_device(dev, &atiixp_pci_info[id->driver_data]); } static struct pci_device_id atiixp_pci_tbl[] = { diff -Nru a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c --- a/drivers/ide/pci/cmd64x.c 2005-01-02 23:03:35 -08:00 +++ b/drivers/ide/pci/cmd64x.c 2005-01-02 23:03:35 -08:00 @@ -709,8 +709,7 @@ static int __devinit cmd64x_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_setup_pci_device(dev, &cmd64x_chipsets[id->driver_data]); - return 0; + return ide_setup_pci_device(dev, &cmd64x_chipsets[id->driver_data]); } static struct pci_device_id cmd64x_pci_tbl[] = { diff -Nru a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c --- a/drivers/ide/pci/cs5530.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/ide/pci/cs5530.c 2005-01-02 23:03:33 -08:00 @@ -357,8 +357,7 @@ static int __devinit cs5530_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_setup_pci_device(dev, &cs5530_chipset); - return 0; + return ide_setup_pci_device(dev, &cs5530_chipset); } static struct pci_device_id cs5530_pci_tbl[] = { diff -Nru a/drivers/ide/pci/cy82c693.c b/drivers/ide/pci/cy82c693.c --- a/drivers/ide/pci/cy82c693.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/ide/pci/cy82c693.c 2005-01-02 23:03:33 -08:00 @@ -426,15 +426,16 @@ { ide_pci_device_t *d = &cy82c693_chipsets[id->driver_data]; struct pci_dev *dev2; + int ret = -ENODEV; /* CY82C693 is more than only a IDE controller. Function 1 is primary IDE channel, function 2 - secondary. */ if ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE && PCI_FUNC(dev->devfn) == 1) { dev2 = pci_find_slot(dev->bus->number, dev->devfn + 1); - ide_setup_pci_devices(dev, dev2, d); + ret = ide_setup_pci_devices(dev, dev2, d); } - return 0; + return ret; } static struct pci_device_id cy82c693_pci_tbl[] = { diff -Nru a/drivers/ide/pci/generic.c b/drivers/ide/pci/generic.c --- a/drivers/ide/pci/generic.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/ide/pci/generic.c 2005-01-02 23:03:34 -08:00 @@ -96,25 +96,26 @@ { ide_pci_device_t *d = &generic_chipsets[id->driver_data]; u16 command; + int ret = -ENODEV; if (dev->vendor == PCI_VENDOR_ID_UMC && dev->device == PCI_DEVICE_ID_UMC_UM8886A && (!(PCI_FUNC(dev->devfn) & 1))) - return 1; /* UM8886A/BF pair */ + goto out; /* UM8886A/BF pair */ if (dev->vendor == PCI_VENDOR_ID_OPTI && dev->device == PCI_DEVICE_ID_OPTI_82C558 && (!(PCI_FUNC(dev->devfn) & 1))) - return 1; + goto out; pci_read_config_word(dev, PCI_COMMAND, &command); - if(!(command & PCI_COMMAND_IO)) - { + if (!(command & PCI_COMMAND_IO)) { printk(KERN_INFO "Skipping disabled %s IDE controller.\n", d->name); - return 1; + goto out; } - ide_setup_pci_device(dev, d); - return 0; + ret = ide_setup_pci_device(dev, d); +out: + return ret; } static struct pci_device_id generic_pci_tbl[] = { diff -Nru a/drivers/ide/pci/hpt34x.c b/drivers/ide/pci/hpt34x.c --- a/drivers/ide/pci/hpt34x.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/ide/pci/hpt34x.c 2005-01-02 23:03:33 -08:00 @@ -251,8 +251,7 @@ d->name = chipset_names[(pcicmd & PCI_COMMAND_MEMORY) ? 1 : 0]; d->bootable = (pcicmd & PCI_COMMAND_MEMORY) ? OFF_BOARD : NEVER_BOARD; - ide_setup_pci_device(dev, d); - return 0; + return ide_setup_pci_device(dev, d); } static struct pci_device_id hpt34x_pci_tbl[] = { diff -Nru a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c --- a/drivers/ide/pci/hpt366.c 2005-01-02 23:03:35 -08:00 +++ b/drivers/ide/pci/hpt366.c 2005-01-02 23:03:35 -08:00 @@ -1191,12 +1191,12 @@ ide_setup_dma(hwif, dmabase, 8); } -static void __devinit init_setup_hpt374(struct pci_dev *dev, ide_pci_device_t *d) +static int __devinit init_setup_hpt374(struct pci_dev *dev, ide_pci_device_t *d) { struct pci_dev *findev = NULL; if (PCI_FUNC(dev->devfn) & 1) - return; + return -ENODEV; while ((findev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, findev)) != NULL) { if ((findev->vendor == dev->vendor) && @@ -1209,19 +1209,18 @@ printk(KERN_WARNING "%s: pci-config space interrupt " "fixed.\n", d->name); } - ide_setup_pci_devices(dev, findev, d); - return; + return ide_setup_pci_devices(dev, findev, d); } } - ide_setup_pci_device(dev, d); + return ide_setup_pci_device(dev, d); } -static void __devinit init_setup_hpt37x(struct pci_dev *dev, ide_pci_device_t *d) +static int __devinit init_setup_hpt37x(struct pci_dev *dev, ide_pci_device_t *d) { - ide_setup_pci_device(dev, d); + return ide_setup_pci_device(dev, d); } -static void __devinit init_setup_hpt366(struct pci_dev *dev, ide_pci_device_t *d) +static int __devinit init_setup_hpt366(struct pci_dev *dev, ide_pci_device_t *d) { struct pci_dev *findev = NULL; u8 pin1 = 0, pin2 = 0; @@ -1231,7 +1230,7 @@ "HPT372N" }; if (PCI_FUNC(dev->devfn) & 1) - return; + return -ENODEV; pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev); class_rev &= 0xff; @@ -1246,9 +1245,10 @@ case 6: case 5: case 4: - case 3: ide_setup_pci_device(dev, d); - return; - default: break; + case 3: + goto init_single; + default: + break; } d->channels = 1; @@ -1266,11 +1266,11 @@ "pin1=%d pin2=%d\n", d->name, pin1, pin2); } - ide_setup_pci_devices(dev, findev, d); - return; + return ide_setup_pci_devices(dev, findev, d); } } - ide_setup_pci_device(dev, d); +init_single: + return ide_setup_pci_device(dev, d); } @@ -1287,8 +1287,7 @@ { ide_pci_device_t *d = &hpt366_chipsets[id->driver_data]; - d->init_setup(dev, d); - return 0; + return d->init_setup(dev, d); } static struct pci_device_id hpt366_pci_tbl[] = { diff -Nru a/drivers/ide/pci/hpt366.h b/drivers/ide/pci/hpt366.h --- a/drivers/ide/pci/hpt366.h 2005-01-02 23:03:34 -08:00 +++ b/drivers/ide/pci/hpt366.h 2005-01-02 23:03:34 -08:00 @@ -414,9 +414,9 @@ #define F_LOW_PCI_50 0x2d #define F_LOW_PCI_66 0x42 -static void init_setup_hpt366(struct pci_dev *, ide_pci_device_t *); -static void init_setup_hpt37x(struct pci_dev *, ide_pci_device_t *); -static void init_setup_hpt374(struct pci_dev *, ide_pci_device_t *); +static int init_setup_hpt366(struct pci_dev *, ide_pci_device_t *); +static int init_setup_hpt37x(struct pci_dev *, ide_pci_device_t *); +static int init_setup_hpt374(struct pci_dev *, ide_pci_device_t *); static unsigned int init_chipset_hpt366(struct pci_dev *, const char *); static void init_hwif_hpt366(ide_hwif_t *); static void init_dma_hpt366(ide_hwif_t *, unsigned long); diff -Nru a/drivers/ide/pci/it8172.c b/drivers/ide/pci/it8172.c --- a/drivers/ide/pci/it8172.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/ide/pci/it8172.c 2005-01-02 23:03:34 -08:00 @@ -270,9 +270,8 @@ { if ((!(PCI_FUNC(dev->devfn) & 1) || (!((dev->class >> 8) == PCI_CLASS_STORAGE_IDE)))) - return 1; /* IT8172 is more than only a IDE controller */ - ide_setup_pci_device(dev, &it8172_chipsets[id->driver_data]); - return 0; + return -ENODEV; /* IT8172 is more than an IDE controller */ + return ide_setup_pci_device(dev, &it8172_chipsets[id->driver_data]); } static struct pci_device_id it8172_pci_tbl[] = { diff -Nru a/drivers/ide/pci/ns87415.c b/drivers/ide/pci/ns87415.c --- a/drivers/ide/pci/ns87415.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/ide/pci/ns87415.c 2005-01-02 23:03:34 -08:00 @@ -288,8 +288,7 @@ static int __devinit ns87415_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_setup_pci_device(dev, &ns87415_chipset); - return 0; + return ide_setup_pci_device(dev, &ns87415_chipset); } static struct pci_device_id ns87415_pci_tbl[] = { diff -Nru a/drivers/ide/pci/opti621.c b/drivers/ide/pci/opti621.c --- a/drivers/ide/pci/opti621.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/ide/pci/opti621.c 2005-01-02 23:03:33 -08:00 @@ -348,15 +348,14 @@ hwif->drives[1].autodma = hwif->autodma; } -static void __init init_setup_opti621 (struct pci_dev *dev, ide_pci_device_t *d) +static int __init init_setup_opti621 (struct pci_dev *dev, ide_pci_device_t *d) { - ide_setup_pci_device(dev, d); + return ide_setup_pci_device(dev, d); } static int __devinit opti621_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_setup_pci_device(dev, &opti621_chipsets[id->driver_data]); - return 0; + return ide_setup_pci_device(dev, &opti621_chipsets[id->driver_data]); } static struct pci_device_id opti621_pci_tbl[] = { diff -Nru a/drivers/ide/pci/opti621.h b/drivers/ide/pci/opti621.h --- a/drivers/ide/pci/opti621.h 2005-01-02 23:03:35 -08:00 +++ b/drivers/ide/pci/opti621.h 2005-01-02 23:03:35 -08:00 @@ -5,7 +5,7 @@ #include #include -static void init_setup_opti621(struct pci_dev *, ide_pci_device_t *); +static int init_setup_opti621(struct pci_dev *, ide_pci_device_t *); static void init_hwif_opti621(ide_hwif_t *); static ide_pci_device_t opti621_chipsets[] __devinitdata = { diff -Nru a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c --- a/drivers/ide/pci/pdc202xx_new.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/ide/pci/pdc202xx_new.c 2005-01-02 23:03:34 -08:00 @@ -316,21 +316,21 @@ #endif /* PDC202_DEBUG_CABLE */ } -static void __devinit init_setup_pdcnew(struct pci_dev *dev, ide_pci_device_t *d) +static int __devinit init_setup_pdcnew(struct pci_dev *dev, ide_pci_device_t *d) { - ide_setup_pci_device(dev, d); + return ide_setup_pci_device(dev, d); } -static void __devinit init_setup_pdc20270(struct pci_dev *dev, ide_pci_device_t *d) +static int __devinit init_setup_pdc20270(struct pci_dev *dev, + ide_pci_device_t *d) { struct pci_dev *findev = NULL; if ((dev->bus->self && dev->bus->self->vendor == PCI_VENDOR_ID_DEC) && (dev->bus->self->device == PCI_DEVICE_ID_DEC_21150)) { - if (PCI_SLOT(dev->devfn) & 2) { - return; - } + if (PCI_SLOT(dev->devfn) & 2) + return -ENODEV; d->extra = 0; while ((findev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, findev)) != NULL) { if ((findev->vendor == dev->vendor) && @@ -339,15 +339,15 @@ if (findev->irq != dev->irq) { findev->irq = dev->irq; } - ide_setup_pci_devices(dev, findev, d); - return; + return ide_setup_pci_devices(dev, findev, d); } } } - ide_setup_pci_device(dev, d); + return ide_setup_pci_device(dev, d); } -static void __devinit init_setup_pdc20276(struct pci_dev *dev, ide_pci_device_t *d) +static int __devinit init_setup_pdc20276(struct pci_dev *dev, + ide_pci_device_t *d) { if ((dev->bus->self) && (dev->bus->self->vendor == PCI_VENDOR_ID_INTEL) && @@ -355,9 +355,9 @@ (dev->bus->self->device == PCI_DEVICE_ID_INTEL_I960RM))) { printk(KERN_INFO "ide: Skipping Promise PDC20276 " "attached to I2O RAID controller.\n"); - return; + return -ENODEV; } - ide_setup_pci_device(dev, d); + return ide_setup_pci_device(dev, d); } /** @@ -373,8 +373,7 @@ { ide_pci_device_t *d = &pdcnew_chipsets[id->driver_data]; - d->init_setup(dev, d); - return 0; + return d->init_setup(dev, d); } static struct pci_device_id pdc202new_pci_tbl[] = { diff -Nru a/drivers/ide/pci/pdc202xx_new.h b/drivers/ide/pci/pdc202xx_new.h --- a/drivers/ide/pci/pdc202xx_new.h 2005-01-02 23:03:33 -08:00 +++ b/drivers/ide/pci/pdc202xx_new.h 2005-01-02 23:03:33 -08:00 @@ -43,9 +43,9 @@ set_2regs(0x13,(c)); \ } while(0) -static void init_setup_pdcnew(struct pci_dev *, ide_pci_device_t *); -static void init_setup_pdc20270(struct pci_dev *, ide_pci_device_t *); -static void init_setup_pdc20276(struct pci_dev *dev, ide_pci_device_t *d); +static int init_setup_pdcnew(struct pci_dev *, ide_pci_device_t *); +static int init_setup_pdc20270(struct pci_dev *, ide_pci_device_t *); +static int init_setup_pdc20276(struct pci_dev *dev, ide_pci_device_t *d); static unsigned int init_chipset_pdcnew(struct pci_dev *, const char *); static void init_hwif_pdc202new(ide_hwif_t *); diff -Nru a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c --- a/drivers/ide/pci/pdc202xx_old.c 2005-01-02 23:03:35 -08:00 +++ b/drivers/ide/pci/pdc202xx_old.c 2005-01-02 23:03:35 -08:00 @@ -658,7 +658,8 @@ ide_setup_dma(hwif, dmabase, 8); } -static void __devinit init_setup_pdc202ata4(struct pci_dev *dev, ide_pci_device_t *d) +static int __devinit init_setup_pdc202ata4(struct pci_dev *dev, + ide_pci_device_t *d) { if ((dev->class >> 8) != PCI_CLASS_STORAGE_IDE) { u8 irq = 0, irq2 = 0; @@ -685,10 +686,11 @@ } #endif - ide_setup_pci_device(dev, d); + return ide_setup_pci_device(dev, d); } -static void __devinit init_setup_pdc20265(struct pci_dev *dev, ide_pci_device_t *d) +static int __devinit init_setup_pdc20265(struct pci_dev *dev, + ide_pci_device_t *d) { if ((dev->bus->self) && (dev->bus->self->vendor == PCI_VENDOR_ID_INTEL) && @@ -696,7 +698,7 @@ (dev->bus->self->device == PCI_DEVICE_ID_INTEL_I960RM))) { printk(KERN_INFO "ide: Skipping Promise PDC20265 " "attached to I2O RAID controller.\n"); - return; + return -ENODEV; } #if 0 @@ -714,12 +716,13 @@ } #endif - ide_setup_pci_device(dev, d); + return ide_setup_pci_device(dev, d); } -static void __devinit init_setup_pdc202xx(struct pci_dev *dev, ide_pci_device_t *d) +static int __devinit init_setup_pdc202xx(struct pci_dev *dev, + ide_pci_device_t *d) { - ide_setup_pci_device(dev, d); + return ide_setup_pci_device(dev, d); } /** @@ -735,8 +738,7 @@ { ide_pci_device_t *d = &pdc202xx_chipsets[id->driver_data]; - d->init_setup(dev, d); - return 0; + return d->init_setup(dev, d); } static struct pci_device_id pdc202xx_pci_tbl[] = { diff -Nru a/drivers/ide/pci/pdc202xx_old.h b/drivers/ide/pci/pdc202xx_old.h --- a/drivers/ide/pci/pdc202xx_old.h 2005-01-02 23:03:32 -08:00 +++ b/drivers/ide/pci/pdc202xx_old.h 2005-01-02 23:03:32 -08:00 @@ -63,9 +63,9 @@ #define MC1 0x02 /* DMA"C" timing */ #define MC0 0x01 /* DMA"C" timing */ -static void init_setup_pdc202ata4(struct pci_dev *dev, ide_pci_device_t *d); -static void init_setup_pdc20265(struct pci_dev *, ide_pci_device_t *); -static void init_setup_pdc202xx(struct pci_dev *, ide_pci_device_t *); +static int init_setup_pdc202ata4(struct pci_dev *dev, ide_pci_device_t *d); +static int init_setup_pdc20265(struct pci_dev *, ide_pci_device_t *); +static int init_setup_pdc202xx(struct pci_dev *, ide_pci_device_t *); static unsigned int init_chipset_pdc202xx(struct pci_dev *, const char *); static void init_hwif_pdc202xx(ide_hwif_t *); static void init_dma_pdc202xx(ide_hwif_t *, unsigned long); diff -Nru a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c --- a/drivers/ide/pci/piix.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/ide/pci/piix.c 2005-01-02 23:03:33 -08:00 @@ -134,6 +134,7 @@ case PCI_DEVICE_ID_INTEL_82801EB_11: case PCI_DEVICE_ID_INTEL_ESB_2: case PCI_DEVICE_ID_INTEL_ICH6_19: + case PCI_DEVICE_ID_INTEL_ICH7_21: mode = 3; break; /* UDMA 66 capable */ @@ -445,6 +446,7 @@ case PCI_DEVICE_ID_INTEL_82801E_11: case PCI_DEVICE_ID_INTEL_ESB_2: case PCI_DEVICE_ID_INTEL_ICH6_19: + case PCI_DEVICE_ID_INTEL_ICH7_21: { unsigned int extra = 0; pci_read_config_dword(dev, 0x54, &extra); @@ -535,9 +537,9 @@ * a standard ide PCI setup */ -static void __devinit init_setup_piix(struct pci_dev *dev, ide_pci_device_t *d) +static int __devinit init_setup_piix(struct pci_dev *dev, ide_pci_device_t *d) { - ide_setup_pci_device(dev, d); + return ide_setup_pci_device(dev, d); } /** @@ -553,8 +555,7 @@ { ide_pci_device_t *d = &piix_pci_info[id->driver_data]; - d->init_setup(dev, d); - return 0; + return d->init_setup(dev, d); } /** @@ -612,6 +613,7 @@ #endif { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 19}, { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_19, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 20}, + { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_21, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 21}, { 0, }, }; MODULE_DEVICE_TABLE(pci, piix_pci_tbl); diff -Nru a/drivers/ide/pci/piix.h b/drivers/ide/pci/piix.h --- a/drivers/ide/pci/piix.h 2005-01-02 23:03:33 -08:00 +++ b/drivers/ide/pci/piix.h 2005-01-02 23:03:33 -08:00 @@ -5,7 +5,7 @@ #include #include -static void init_setup_piix(struct pci_dev *, ide_pci_device_t *); +static int init_setup_piix(struct pci_dev *, ide_pci_device_t *); static unsigned int __devinit init_chipset_piix(struct pci_dev *, const char *); static void init_hwif_piix(ide_hwif_t *); @@ -57,7 +57,8 @@ /* 17 */ DECLARE_PIIX_DEV("ICH4"), /* 18 */ DECLARE_PIIX_DEV("ICH5-SATA"), /* 19 */ DECLARE_PIIX_DEV("ICH5"), - /* 20 */ DECLARE_PIIX_DEV("ICH6") + /* 20 */ DECLARE_PIIX_DEV("ICH6"), + /* 21 */ DECLARE_PIIX_DEV("ICH7"), }; #endif /* PIIX_H */ diff -Nru a/drivers/ide/pci/rz1000.c b/drivers/ide/pci/rz1000.c --- a/drivers/ide/pci/rz1000.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/ide/pci/rz1000.c 2005-01-02 23:03:33 -08:00 @@ -62,8 +62,7 @@ static int __devinit rz1000_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_setup_pci_device(dev, &rz1000_chipset); - return 0; + return ide_setup_pci_device(dev, &rz1000_chipset); } static struct pci_device_id rz1000_pci_tbl[] = { diff -Nru a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c --- a/drivers/ide/pci/sc1200.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/ide/pci/sc1200.c 2005-01-02 23:03:34 -08:00 @@ -489,8 +489,7 @@ static int __devinit sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_setup_pci_device(dev, &sc1200_chipset); - return 0; + return ide_setup_pci_device(dev, &sc1200_chipset); } static struct pci_device_id sc1200_pci_tbl[] = { diff -Nru a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c --- a/drivers/ide/pci/serverworks.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/ide/pci/serverworks.c 2005-01-02 23:03:33 -08:00 @@ -359,11 +359,9 @@ else if ((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) || (dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE) || (dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2)) { -// u32 pioreg = 0, dmareg = 0; /* Third Channel Test */ if (!(PCI_FUNC(dev->devfn) & 1)) { -#if 1 struct pci_dev * findev = NULL; u32 reg4c = 0; findev = pci_find_device(PCI_VENDOR_ID_SERVERWORKS, @@ -375,19 +373,11 @@ reg4c |= 0x00000020; pci_write_config_dword(findev, 0x4C, reg4c); } -#endif outb_p(0x06, 0x0c00); dev->irq = inb_p(0x0c01); #if 0 - /* WE need to figure out how to get the correct one */ - printk("%s: interrupt %d\n", name, dev->irq); - if (dev->irq != 0x0B) - dev->irq = 0x0B; -#endif -#if 0 printk("%s: device class (0x%04x)\n", name, dev->class); -#else if ((dev->class >> 8) != PCI_CLASS_STORAGE_IDE) { dev->class &= ~0x000F0F00; // dev->class |= ~0x00000400; @@ -413,7 +403,8 @@ * interrupt pin to be set, and it is a compatibility * mode issue. */ - dev->irq = 0; + if ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE) + dev->irq = 0; } // pci_read_config_dword(dev, 0x40, &pioreg) // pci_write_config_dword(dev, 0x40, 0x99999999); @@ -566,20 +557,17 @@ ide_setup_dma(hwif, dmabase, 8); } -static void __init init_setup_svwks (struct pci_dev *dev, ide_pci_device_t *d) +static int __init init_setup_svwks (struct pci_dev *dev, ide_pci_device_t *d) { - ide_setup_pci_device(dev, d); + return ide_setup_pci_device(dev, d); } -static void __init init_setup_csb6 (struct pci_dev *dev, ide_pci_device_t *d) +static int __init init_setup_csb6 (struct pci_dev *dev, ide_pci_device_t *d) { if (!(PCI_FUNC(dev->devfn) & 1)) { d->bootable = NEVER_BOARD; if (dev->resource[0].start == 0x01f1) d->bootable = ON_BOARD; - } else { - if ((dev->class >> 8) != PCI_CLASS_STORAGE_IDE) - return; } #if 0 if ((IDE_PCI_DEVID_EQ(d->devid, DEVID_CSB6) && @@ -591,7 +579,7 @@ dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2) && (!(PCI_FUNC(dev->devfn) & 1))) ? 1 : 2; - ide_setup_pci_device(dev, d); + return ide_setup_pci_device(dev, d); } @@ -608,8 +596,7 @@ { ide_pci_device_t *d = &serverworks_chipsets[id->driver_data]; - d->init_setup(dev, d); - return 0; + return d->init_setup(dev, d); } static struct pci_device_id svwks_pci_tbl[] = { @@ -625,10 +612,6 @@ .name = "Serverworks_IDE", .id_table = svwks_pci_tbl, .probe = svwks_init_one, -#if 0 /* FIXME: implement */ - .suspend = , - .resume = , -#endif }; static int svwks_ide_init(void) diff -Nru a/drivers/ide/pci/serverworks.h b/drivers/ide/pci/serverworks.h --- a/drivers/ide/pci/serverworks.h 2005-01-02 23:03:33 -08:00 +++ b/drivers/ide/pci/serverworks.h 2005-01-02 23:03:33 -08:00 @@ -21,8 +21,8 @@ NULL }; -static void init_setup_svwks(struct pci_dev *, ide_pci_device_t *); -static void init_setup_csb6(struct pci_dev *, ide_pci_device_t *); +static int init_setup_svwks(struct pci_dev *, ide_pci_device_t *); +static int init_setup_csb6(struct pci_dev *, ide_pci_device_t *); static unsigned int init_chipset_svwks(struct pci_dev *, const char *); static void init_hwif_svwks(ide_hwif_t *); static void init_dma_svwks(ide_hwif_t *, unsigned long); diff -Nru a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c --- a/drivers/ide/pci/sgiioc4.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/ide/pci/sgiioc4.c 2005-01-02 23:03:34 -08:00 @@ -681,12 +681,14 @@ pci_init_sgiioc4(struct pci_dev *dev, ide_pci_device_t * d) { unsigned int class_rev; + int ret; - if (pci_enable_device(dev)) { + ret = pci_enable_device(dev); + if (ret < 0) { printk(KERN_ERR "Failed to enable device %s at slot %s\n", d->name, dev->slot_name); - return -ENODEV; + goto out; } pci_set_master(dev); @@ -698,9 +700,18 @@ printk(KERN_ERR "Skipping %s IDE controller in slot %s: " "firmware is obsolete - please upgrade to revision" "46 or higher\n", d->name, dev->slot_name); - return -ENODEV; + ret = -EAGAIN; + goto err_disable; } - return sgiioc4_ide_setup_pci_device(dev, d); + ret = sgiioc4_ide_setup_pci_device(dev, d); + if (ret < 0) + goto err_disable; +out: + return ret; + +err_disable: + pci_disable_device(dev); + goto out; } static ide_pci_device_t sgiioc4_chipsets[] __devinitdata = { diff -Nru a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c --- a/drivers/ide/pci/siimage.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/ide/pci/siimage.c 2005-01-02 23:03:33 -08:00 @@ -1102,8 +1102,7 @@ static int __devinit siimage_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_setup_pci_device(dev, &siimage_chipsets[id->driver_data]); - return 0; + return ide_setup_pci_device(dev, &siimage_chipsets[id->driver_data]); } static struct pci_device_id siimage_pci_tbl[] = { diff -Nru a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c --- a/drivers/ide/pci/sis5513.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/ide/pci/sis5513.c 2005-01-02 23:03:34 -08:00 @@ -946,8 +946,7 @@ static int __devinit sis5513_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_setup_pci_device(dev, &sis5513_chipset); - return 0; + return ide_setup_pci_device(dev, &sis5513_chipset); } static struct pci_device_id sis5513_pci_tbl[] = { diff -Nru a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c --- a/drivers/ide/pci/sl82c105.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/ide/pci/sl82c105.c 2005-01-02 23:03:33 -08:00 @@ -490,8 +490,7 @@ static int __devinit sl82c105_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_setup_pci_device(dev, &sl82c105_chipset); - return 0; + return ide_setup_pci_device(dev, &sl82c105_chipset); } static struct pci_device_id sl82c105_pci_tbl[] = { diff -Nru a/drivers/ide/pci/slc90e66.c b/drivers/ide/pci/slc90e66.c --- a/drivers/ide/pci/slc90e66.c 2005-01-02 23:03:34 -08:00 +++ b/drivers/ide/pci/slc90e66.c 2005-01-02 23:03:34 -08:00 @@ -246,8 +246,7 @@ static int __devinit slc90e66_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_setup_pci_device(dev, &slc90e66_chipset); - return 0; + return ide_setup_pci_device(dev, &slc90e66_chipset); } static struct pci_device_id slc90e66_pci_tbl[] = { diff -Nru a/drivers/ide/pci/triflex.c b/drivers/ide/pci/triflex.c --- a/drivers/ide/pci/triflex.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/ide/pci/triflex.c 2005-01-02 23:03:33 -08:00 @@ -158,9 +158,7 @@ static int __devinit triflex_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_setup_pci_device(dev, &triflex_device); - - return 0; + return ide_setup_pci_device(dev, &triflex_device); } static struct pci_device_id triflex_pci_tbl[] = { diff -Nru a/drivers/ide/pci/trm290.c b/drivers/ide/pci/trm290.c --- a/drivers/ide/pci/trm290.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/ide/pci/trm290.c 2005-01-02 23:03:33 -08:00 @@ -342,8 +342,7 @@ static int __devinit trm290_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_setup_pci_device(dev, &trm290_chipset); - return 0; + return ide_setup_pci_device(dev, &trm290_chipset); } static struct pci_device_id trm290_pci_tbl[] = { diff -Nru a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c --- a/drivers/ide/pci/via82cxxx.c 2005-01-02 23:03:35 -08:00 +++ b/drivers/ide/pci/via82cxxx.c 2005-01-02 23:03:35 -08:00 @@ -620,8 +620,7 @@ static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_setup_pci_device(dev, &via82cxxx_chipset); - return 0; + return ide_setup_pci_device(dev, &via82cxxx_chipset); } static struct pci_device_id via_pci_tbl[] = { diff -Nru a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c --- a/drivers/ide/setup-pci.c 2005-01-02 23:03:33 -08:00 +++ b/drivers/ide/setup-pci.c 2005-01-02 23:03:33 -08:00 @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -290,14 +291,16 @@ static int ide_pci_enable(struct pci_dev *dev, ide_pci_device_t *d) { - + int ret; + if (pci_enable_device(dev)) { - if (pci_enable_device_bars(dev, 1 << 4)) { + ret = pci_enable_device_bars(dev, 1 << 4); + if (ret < 0) { printk(KERN_WARNING "%s: (ide_setup_pci_device:) " "Could not enable device.\n", d->name); - return -EBUSY; - } else - printk(KERN_WARNING "%s: BIOS configuration fixed.\n", d->name); + goto out; + } + printk(KERN_WARNING "%s: BIOS configuration fixed.\n", d->name); } /* @@ -305,18 +308,23 @@ * dma mask field to the ide_pci_device_t if we need it (or let * lower level driver set the dma mask) */ - if (pci_set_dma_mask(dev, 0xffffffff)) { + ret = pci_set_dma_mask(dev, DMA_32BIT_MASK); + if (ret < 0) { printk(KERN_ERR "%s: can't set dma mask\n", d->name); - return -EBUSY; + pci_disable_device(dev); + goto out; } - + /* FIXME: Temporary - until we put in the hotplug interface logic - Check that the bits we want are not in use by someone else */ - if (pci_request_region(dev, 4, "ide_tmp")) - return -EBUSY; + Check that the bits we want are not in use by someone else. + As someone else uses it, we do not (yuck) disable the device */ + ret = pci_request_region(dev, 4, "ide_tmp"); + if (ret < 0) + goto out; + pci_release_region(dev, 4); - - return 0; +out: + return ret; } /** @@ -515,22 +523,26 @@ static int ide_setup_pci_controller(struct pci_dev *dev, ide_pci_device_t *d, int noisy, int *config) { + int ret; u32 class_rev; u16 pcicmd; if (noisy) ide_setup_pci_noise(dev, d); - if (ide_pci_enable(dev, d)) - return -EBUSY; - - if (pci_read_config_word(dev, PCI_COMMAND, &pcicmd)) { + ret = ide_pci_enable(dev, d); + if (ret < 0) + goto out; + + ret = pci_read_config_word(dev, PCI_COMMAND, &pcicmd); + if (ret < 0) { printk(KERN_ERR "%s: error accessing PCI regs\n", d->name); - return -EIO; + goto err_disable; } if (!(pcicmd & PCI_COMMAND_IO)) { /* is device disabled? */ - if (ide_pci_configure(dev, d)) - return -ENODEV; + ret = ide_pci_configure(dev, d); + if (ret < 0) + goto err_disable; *config = 1; printk(KERN_INFO "%s: device enabled (Linux)\n", d->name); } @@ -539,7 +551,19 @@ class_rev &= 0xff; if (noisy) printk(KERN_INFO "%s: chipset revision %d\n", d->name, class_rev); - return 0; +out: + return ret; + +err_disable: + pci_disable_device(dev); + goto out; +} + +static void ide_release_pci_controller(struct pci_dev *dev, ide_pci_device_t *d, + int noisy) +{ + /* Balance ide_pci_enable() */ + pci_disable_device(dev); } /** @@ -643,14 +667,16 @@ * we "know" about, this information is in the ide_pci_device_t struct; * for all other chipsets, we just assume both interfaces are enabled. */ -static ata_index_t do_ide_setup_pci_device (struct pci_dev *dev, ide_pci_device_t *d, u8 noisy) +static int do_ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d, + ata_index_t *index, u8 noisy) { - int pciirq = 0; + static ata_index_t ata_index = { .b = { .low = 0xff, .high = 0xff } }; int tried_config = 0; - ata_index_t index = { .b = { .low = 0xff, .high = 0xff } }; + int pciirq, ret; - if (ide_setup_pci_controller(dev, d, noisy, &tried_config) < 0) - return index; + ret = ide_setup_pci_controller(dev, d, noisy, &tried_config); + if (ret < 0) + goto out; /* * Can we trust the reported IRQ? @@ -668,7 +694,10 @@ * space, place chipset into init-mode, and/or preserve * an interrupt if the card is not native ide support. */ - pciirq = (d->init_chipset) ? d->init_chipset(dev, d->name) : 0; + ret = d->init_chipset ? d->init_chipset(dev, d->name) : 0; + if (ret < 0) + goto err_release_pci_controller; + pciirq = ret; } else if (tried_config) { if (noisy) printk(KERN_INFO "%s: will probe irqs later\n", d->name); @@ -679,10 +708,10 @@ d->name, pciirq); pciirq = 0; } else { - if (d->init_chipset) - { - if(d->init_chipset(dev, d->name) < 0) - return index; + if (d->init_chipset) { + ret = d->init_chipset(dev, d->name); + if (ret < 0) + goto err_release_pci_controller; } if (noisy) #ifdef __sparc__ @@ -693,18 +722,27 @@ d->name, pciirq); #endif } - - if(pciirq < 0) /* Error not an IRQ */ - return index; - ide_pci_setup_ports(dev, d, pciirq, &index); + /* FIXME: silent failure can happen */ + + *index = ata_index; + ide_pci_setup_ports(dev, d, pciirq, index); +out: + return ret; - return index; +err_release_pci_controller: + ide_release_pci_controller(dev, d, noisy); + goto out; } -void ide_setup_pci_device (struct pci_dev *dev, ide_pci_device_t *d) +int ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d) { - ata_index_t index_list = do_ide_setup_pci_device(dev, d, 1); + ata_index_t index_list; + int ret; + + ret = do_ide_setup_pci_device(dev, d, &index_list, 1); + if (ret < 0) + goto out; if ((index_list.b.low & 0xf0) != 0xf0) probe_hwif_init_with_fixup(&ide_hwifs[index_list.b.low], d->fixup); @@ -712,25 +750,42 @@ probe_hwif_init_with_fixup(&ide_hwifs[index_list.b.high], d->fixup); create_proc_ide_interfaces(); +out: + return ret; } EXPORT_SYMBOL_GPL(ide_setup_pci_device); -void ide_setup_pci_devices (struct pci_dev *dev, struct pci_dev *dev2, ide_pci_device_t *d) +int ide_setup_pci_devices(struct pci_dev *dev1, struct pci_dev *dev2, + ide_pci_device_t *d) { - ata_index_t index_list = do_ide_setup_pci_device(dev, d, 1); - ata_index_t index_list2 = do_ide_setup_pci_device(dev2, d, 0); + struct pci_dev *pdev[] = { dev1, dev2 }; + ata_index_t index_list[2]; + int ret, i; - if ((index_list.b.low & 0xf0) != 0xf0) - probe_hwif_init(&ide_hwifs[index_list.b.low]); - if ((index_list.b.high & 0xf0) != 0xf0) - probe_hwif_init(&ide_hwifs[index_list.b.high]); - if ((index_list2.b.low & 0xf0) != 0xf0) - probe_hwif_init(&ide_hwifs[index_list2.b.low]); - if ((index_list2.b.high & 0xf0) != 0xf0) - probe_hwif_init(&ide_hwifs[index_list2.b.high]); + for (i = 0; i < 2; i++) { + ret = do_ide_setup_pci_device(pdev[i], d, index_list + i, !i); + /* + * FIXME: Mom, mom, they stole me the helper function to undo + * do_ide_setup_pci_device() on the first device! + */ + if (ret < 0) + goto out; + } + + for (i = 0; i < 2; i++) { + u8 idx[2] = { index_list[i].b.low, index_list[i].b.high }; + int j; + + for (j = 0; j < 2; j++) { + if ((idx[j] & 0xf0) != 0xf0) + probe_hwif_init(ide_hwifs + idx[j]); + } + } create_proc_ide_interfaces(); +out: + return ret; } EXPORT_SYMBOL_GPL(ide_setup_pci_devices); diff -Nru a/drivers/infiniband/Kconfig b/drivers/infiniband/Kconfig --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/infiniband/Kconfig 2005-01-02 23:03:35 -08:00 @@ -0,0 +1,14 @@ +menu "InfiniBand support" + +config INFINIBAND + tristate "InfiniBand support" + ---help--- + Core support for InfiniBand (IB). Make sure to also select + any protocols you wish to use as well as drivers for your + InfiniBand hardware. + +source "drivers/infiniband/hw/mthca/Kconfig" + +source "drivers/infiniband/ulp/ipoib/Kconfig" + +endmenu diff -Nru a/drivers/infiniband/Makefile b/drivers/infiniband/Makefile --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/infiniband/Makefile 2005-01-02 23:03:35 -08:00 @@ -0,0 +1,3 @@ +obj-$(CONFIG_INFINIBAND) += core/ +obj-$(CONFIG_INFINIBAND_MTHCA) += hw/mthca/ +obj-$(CONFIG_INFINIBAND_IPOIB) += ulp/ipoib/ diff -Nru a/drivers/infiniband/core/Makefile b/drivers/infiniband/core/Makefile --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/infiniband/core/Makefile 2005-01-02 23:03:35 -08:00 @@ -0,0 +1,12 @@ +EXTRA_CFLAGS += -Idrivers/infiniband/include + +obj-$(CONFIG_INFINIBAND) += ib_core.o ib_mad.o ib_sa.o ib_umad.o + +ib_core-y := packer.o ud_header.o verbs.o sysfs.o \ + device.o fmr_pool.o cache.o + +ib_mad-y := mad.o smi.o agent.o + +ib_sa-y := sa_query.o + +ib_umad-y := user_mad.o diff -Nru a/drivers/infiniband/core/agent.c b/drivers/infiniband/core/agent.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/infiniband/core/agent.c 2005-01-02 23:03:35 -08:00 @@ -0,0 +1,399 @@ +/* + * Copyright (c) 2004 Mellanox Technologies Ltd. All rights reserved. + * Copyright (c) 2004 Infinicon Corporation. All rights reserved. + * Copyright (c) 2004 Intel Corporation. All rights reserved. + * Copyright (c) 2004 Topspin Corporation. All rights reserved. + * Copyright (c) 2004 Voltaire Corporation. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * $Id: agent.c 1389 2004-12-27 22:56:47Z roland $ + */ + +#include + +#include + +#include + +#include "smi.h" +#include "agent_priv.h" +#include "mad_priv.h" + + +spinlock_t ib_agent_port_list_lock; +static LIST_HEAD(ib_agent_port_list); + +extern kmem_cache_t *ib_mad_cache; + + +/* + * Caller must hold ib_agent_port_list_lock + */ +static inline struct ib_agent_port_private * +__ib_get_agent_port(struct ib_device *device, int port_num, + struct ib_mad_agent *mad_agent) +{ + struct ib_agent_port_private *entry; + + BUG_ON(!(!!device ^ !!mad_agent)); /* Exactly one MUST be (!NULL) */ + + if (device) { + list_for_each_entry(entry, &ib_agent_port_list, port_list) { + if (entry->dr_smp_agent->device == device && + entry->port_num == port_num) + return entry; + } + } else { + list_for_each_entry(entry, &ib_agent_port_list, port_list) { + if ((entry->dr_smp_agent == mad_agent) || + (entry->lr_smp_agent == mad_agent) || + (entry->perf_mgmt_agent == mad_agent)) + return entry; + } + } + return NULL; +} + +static inline struct ib_agent_port_private * +ib_get_agent_port(struct ib_device *device, int port_num, + struct ib_mad_agent *mad_agent) +{ + struct ib_agent_port_private *entry; + unsigned long flags; + + spin_lock_irqsave(&ib_agent_port_list_lock, flags); + entry = __ib_get_agent_port(device, port_num, mad_agent); + spin_unlock_irqrestore(&ib_agent_port_list_lock, flags); + + return entry; +} + +int smi_check_local_dr_smp(struct ib_smp *smp, + struct ib_device *device, + int port_num) +{ + struct ib_agent_port_private *port_priv; + + if (smp->mgmt_class != IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE) + return 1; + port_priv = ib_get_agent_port(device, port_num, NULL); + if (!port_priv) { + printk(KERN_DEBUG SPFX "smi_check_local_dr_smp %s port %d " + "not open\n", + device->name, port_num); + return 1; + } + + return smi_check_local_smp(port_priv->dr_smp_agent, smp); +} + +static int agent_mad_send(struct ib_mad_agent *mad_agent, + struct ib_agent_port_private *port_priv, + struct ib_mad_private *mad_priv, + struct ib_grh *grh, + struct ib_wc *wc) +{ + struct ib_agent_send_wr *agent_send_wr; + struct ib_sge gather_list; + struct ib_send_wr send_wr; + struct ib_send_wr *bad_send_wr; + struct ib_ah_attr ah_attr; + unsigned long flags; + int ret = 1; + + agent_send_wr = kmalloc(sizeof(*agent_send_wr), GFP_KERNEL); + if (!agent_send_wr) + goto out; + agent_send_wr->mad = mad_priv; + + /* PCI mapping */ + gather_list.addr = dma_map_single(mad_agent->device->dma_device, + &mad_priv->mad, + sizeof(mad_priv->mad), + DMA_TO_DEVICE); + gather_list.length = sizeof(mad_priv->mad); + gather_list.lkey = (*port_priv->mr).lkey; + + send_wr.next = NULL; + send_wr.opcode = IB_WR_SEND; + send_wr.sg_list = &gather_list; + send_wr.num_sge = 1; + send_wr.wr.ud.remote_qpn = wc->src_qp; /* DQPN */ + send_wr.wr.ud.timeout_ms = 0; + send_wr.send_flags = IB_SEND_SIGNALED | IB_SEND_SOLICITED; + + ah_attr.dlid = wc->slid; + ah_attr.port_num = mad_agent->port_num; + ah_attr.src_path_bits = wc->dlid_path_bits; + ah_attr.sl = wc->sl; + ah_attr.static_rate = 0; + ah_attr.ah_flags = 0; /* No GRH */ + if (mad_priv->mad.mad.mad_hdr.mgmt_class == IB_MGMT_CLASS_PERF_MGMT) { + if (wc->wc_flags & IB_WC_GRH) { + ah_attr.ah_flags = IB_AH_GRH; + /* Should sgid be looked up ? */ + ah_attr.grh.sgid_index = 0; + ah_attr.grh.hop_limit = grh->hop_limit; + ah_attr.grh.flow_label = be32_to_cpup( + &grh->version_tclass_flow) & 0xfffff; + ah_attr.grh.traffic_class = (be32_to_cpup( + &grh->version_tclass_flow) >> 20) & 0xff; + memcpy(ah_attr.grh.dgid.raw, + grh->sgid.raw, + sizeof(ah_attr.grh.dgid)); + } + } + + agent_send_wr->ah = ib_create_ah(mad_agent->qp->pd, &ah_attr); + if (IS_ERR(agent_send_wr->ah)) { + printk(KERN_ERR SPFX "No memory for address handle\n"); + kfree(agent_send_wr); + goto out; + } + + send_wr.wr.ud.ah = agent_send_wr->ah; + if (mad_priv->mad.mad.mad_hdr.mgmt_class == IB_MGMT_CLASS_PERF_MGMT) { + send_wr.wr.ud.pkey_index = wc->pkey_index; + send_wr.wr.ud.remote_qkey = IB_QP1_QKEY; + } else { /* for SMPs */ + send_wr.wr.ud.pkey_index = 0; + send_wr.wr.ud.remote_qkey = 0; + } + send_wr.wr.ud.mad_hdr = &mad_priv->mad.mad.mad_hdr; + send_wr.wr_id = (unsigned long)agent_send_wr; + + pci_unmap_addr_set(agent_send_wr, mapping, gather_list.addr); + + /* Send */ + spin_lock_irqsave(&port_priv->send_list_lock, flags); + if (ib_post_send_mad(mad_agent, &send_wr, &bad_send_wr)) { + spin_unlock_irqrestore(&port_priv->send_list_lock, flags); + dma_unmap_single(mad_agent->device->dma_device, + pci_unmap_addr(agent_send_wr, mapping), + sizeof(mad_priv->mad), + DMA_TO_DEVICE); + ib_destroy_ah(agent_send_wr->ah); + kfree(agent_send_wr); + } else { + list_add_tail(&agent_send_wr->send_list, + &port_priv->send_posted_list); + spin_unlock_irqrestore(&port_priv->send_list_lock, flags); + ret = 0; + } + +out: + return ret; +} + +int agent_send(struct ib_mad_private *mad, + struct ib_grh *grh, + struct ib_wc *wc, + struct ib_device *device, + int port_num) +{ + struct ib_agent_port_private *port_priv; + struct ib_mad_agent *mad_agent; + + port_priv = ib_get_agent_port(device, port_num, NULL); + if (!port_priv) { + printk(KERN_DEBUG SPFX "agent_send %s port %d not open\n", + device->name, port_num); + return 1; + } + + /* Get mad agent based on mgmt_class in MAD */ + switch (mad->mad.mad.mad_hdr.mgmt_class) { + case IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE: + mad_agent = port_priv->dr_smp_agent; + break; + case IB_MGMT_CLASS_SUBN_LID_ROUTED: + mad_agent = port_priv->lr_smp_agent; + break; + case IB_MGMT_CLASS_PERF_MGMT: + mad_agent = port_priv->perf_mgmt_agent; + break; + default: + return 1; + } + + return agent_mad_send(mad_agent, port_priv, mad, grh, wc); +} + +static void agent_send_handler(struct ib_mad_agent *mad_agent, + struct ib_mad_send_wc *mad_send_wc) +{ + struct ib_agent_port_private *port_priv; + struct ib_agent_send_wr *agent_send_wr; + unsigned long flags; + + /* Find matching MAD agent */ + port_priv = ib_get_agent_port(NULL, 0, mad_agent); + if (!port_priv) { + printk(KERN_ERR SPFX "agent_send_handler: no matching MAD " + "agent %p\n", mad_agent); + return; + } + + agent_send_wr = (struct ib_agent_send_wr *)(unsigned long)mad_send_wc->wr_id; + spin_lock_irqsave(&port_priv->send_list_lock, flags); + /* Remove completed send from posted send MAD list */ + list_del(&agent_send_wr->send_list); + spin_unlock_irqrestore(&port_priv->send_list_lock, flags); + + /* Unmap PCI */ + dma_unmap_single(mad_agent->device->dma_device, + pci_unmap_addr(agent_send_wr, mapping), + sizeof(agent_send_wr->mad->mad), + DMA_TO_DEVICE); + + ib_destroy_ah(agent_send_wr->ah); + + /* Release allocated memory */ + kmem_cache_free(ib_mad_cache, agent_send_wr->mad); + kfree(agent_send_wr); +} + +int ib_agent_port_open(struct ib_device *device, int port_num) +{ + int ret; + struct ib_agent_port_private *port_priv; + struct ib_mad_reg_req reg_req; + unsigned long flags; + + /* First, check if port already open for SMI */ + port_priv = ib_get_agent_port(device, port_num, NULL); + if (port_priv) { + printk(KERN_DEBUG SPFX "%s port %d already open\n", + device->name, port_num); + return 0; + } + + /* Create new device info */ + port_priv = kmalloc(sizeof *port_priv, GFP_KERNEL); + if (!port_priv) { + printk(KERN_ERR SPFX "No memory for ib_agent_port_private\n"); + ret = -ENOMEM; + goto error1; + } + + memset(port_priv, 0, sizeof *port_priv); + port_priv->port_num = port_num; + spin_lock_init(&port_priv->send_list_lock); + INIT_LIST_HEAD(&port_priv->send_posted_list); + + /* Obtain MAD agent for directed route SM class */ + reg_req.mgmt_class = IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE; + reg_req.mgmt_class_version = 1; + + port_priv->dr_smp_agent = ib_register_mad_agent(device, port_num, + IB_QPT_SMI, + NULL, 0, + &agent_send_handler, + NULL, NULL); + + if (IS_ERR(port_priv->dr_smp_agent)) { + ret = PTR_ERR(port_priv->dr_smp_agent); + goto error2; + } + + /* Obtain MAD agent for LID routed SM class */ + reg_req.mgmt_class = IB_MGMT_CLASS_SUBN_LID_ROUTED; + port_priv->lr_smp_agent = ib_register_mad_agent(device, port_num, + IB_QPT_SMI, + NULL, 0, + &agent_send_handler, + NULL, NULL); + if (IS_ERR(port_priv->lr_smp_agent)) { + ret = PTR_ERR(port_priv->lr_smp_agent); + goto error3; + } + + /* Obtain MAD agent for PerfMgmt class */ + reg_req.mgmt_class = IB_MGMT_CLASS_PERF_MGMT; + port_priv->perf_mgmt_agent = ib_register_mad_agent(device, port_num, + IB_QPT_GSI, + NULL, 0, + &agent_send_handler, + NULL, NULL); + if (IS_ERR(port_priv->perf_mgmt_agent)) { + ret = PTR_ERR(port_priv->perf_mgmt_agent); + goto error4; + } + + port_priv->mr = ib_get_dma_mr(port_priv->dr_smp_agent->qp->pd, + IB_ACCESS_LOCAL_WRITE); + if (IS_ERR(port_priv->mr)) { + printk(KERN_ERR SPFX "Couldn't get DMA MR\n"); + ret = PTR_ERR(port_priv->mr); + goto error5; + } + + spin_lock_irqsave(&ib_agent_port_list_lock, flags); + list_add_tail(&port_priv->port_list, &ib_agent_port_list); + spin_unlock_irqrestore(&ib_agent_port_list_lock, flags); + + return 0; + +error5: + ib_unregister_mad_agent(port_priv->perf_mgmt_agent); +error4: + ib_unregister_mad_agent(port_priv->lr_smp_agent); +error3: + ib_unregister_mad_agent(port_priv->dr_smp_agent); +error2: + kfree(port_priv); +error1: + return ret; +} + +int ib_agent_port_close(struct ib_device *device, int port_num) +{ + struct ib_agent_port_private *port_priv; + unsigned long flags; + + spin_lock_irqsave(&ib_agent_port_list_lock, flags); + port_priv = __ib_get_agent_port(device, port_num, NULL); + if (port_priv == NULL) { + spin_unlock_irqrestore(&ib_agent_port_list_lock, flags); + printk(KERN_ERR SPFX "Port %d not found\n", port_num); + return -ENODEV; + } + list_del(&port_priv->port_list); + spin_unlock_irqrestore(&ib_agent_port_list_lock, flags); + + ib_dereg_mr(port_priv->mr); + + ib_unregister_mad_agent(port_priv->perf_mgmt_agent); + ib_unregister_mad_agent(port_priv->lr_smp_agent); + ib_unregister_mad_agent(port_priv->dr_smp_agent); + kfree(port_priv); + + return 0; +} diff -Nru a/drivers/infiniband/core/agent.h b/drivers/infiniband/core/agent.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/infiniband/core/agent.h 2005-01-02 23:03:35 -08:00 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2004 Mellanox Technologies Ltd. All rights reserved. + * Copyright (c) 2004 Infinicon Corporation. All rights reserved. + * Copyright (c) 2004 Intel Corporation. All rights reserved. + * Copyright (c) 2004 Topspin Corporation. All rights reserved. + * Copyright (c) 2004 Voltaire Corporation. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * $Id: agent.h 1389 2004-12-27 22:56:47Z roland $ + */ + +#ifndef __AGENT_H_ +#define __AGENT_H_ + +extern spinlock_t ib_agent_port_list_lock; + +extern int ib_agent_port_open(struct ib_device *device, + int port_num); + +extern int ib_agent_port_close(struct ib_device *device, int port_num); + +extern int agent_send(struct ib_mad_private *mad, + struct ib_grh *grh, + struct ib_wc *wc, + struct ib_device *device, + int port_num); + +#endif /* __AGENT_H_ */ diff -Nru a/drivers/infiniband/core/agent_priv.h b/drivers/infiniband/core/agent_priv.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/infiniband/core/agent_priv.h 2005-01-02 23:03:35 -08:00 @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2004 Mellanox Technologies Ltd. All rights reserved. + * Copyright (c) 2004 Infinicon Corporation. All rights reserved. + * Copyright (c) 2004 Intel Corporation. All rights reserved. + * Copyright (c) 2004 Topspin Corporation. All rights reserved. + * Copyright (c) 2004 Voltaire Corporation. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * $Id: agent_priv.h 1389 2004-12-27 22:56:47Z roland $ + */ + +#ifndef __IB_AGENT_PRIV_H__ +#define __IB_AGENT_PRIV_H__ + +#include + +#define SPFX "ib_agent: " + +struct ib_agent_send_wr { + struct list_head send_list; + struct ib_ah *ah; + struct ib_mad_private *mad; + DECLARE_PCI_UNMAP_ADDR(mapping) +}; + +struct ib_agent_port_private { + struct list_head port_list; + struct list_head send_posted_list; + spinlock_t send_list_lock; + int port_num; + struct ib_mad_agent *dr_smp_agent; /* DR SM class */ + struct ib_mad_agent *lr_smp_agent; /* LR SM class */ + struct ib_mad_agent *perf_mgmt_agent; /* PerfMgmt class */ + struct ib_mr *mr; +}; + +#endif /* __IB_AGENT_PRIV_H__ */ diff -Nru a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/infiniband/core/cache.c 2005-01-02 23:03:35 -08:00 @@ -0,0 +1,328 @@ +/* + * Copyright (c) 2004 Topspin Communications. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * $Id: cache.c 1349 2004-12-16 21:09:43Z roland $ + */ + +#include +#include +#include +#include + +#include "core_priv.h" + +struct ib_pkey_cache { + int table_len; + u16 table[0]; +}; + +struct ib_gid_cache { + int table_len; + union ib_gid table[0]; +}; + +struct ib_update_work { + struct work_struct work; + struct ib_device *device; + u8 port_num; +}; + +static inline int start_port(struct ib_device *device) +{ + return device->node_type == IB_NODE_SWITCH ? 0 : 1; +} + +static inline int end_port(struct ib_device *device) +{ + return device->node_type == IB_NODE_SWITCH ? 0 : device->phys_port_cnt; +} + +int ib_cached_gid_get(struct ib_device *device, + u8 port, + int index, + union ib_gid *gid) +{ + struct ib_gid_cache *cache; + unsigned long flags; + int ret = 0; + + if (port < start_port(device) || port > end_port(device)) + return -EINVAL; + + read_lock_irqsave(&device->cache.lock, flags); + + cache = device->cache.gid_cache[port - start_port(device)]; + + if (index < 0 || index >= cache->table_len) + ret = -EINVAL; + else + *gid = cache->table[index]; + + read_unlock_irqrestore(&device->cache.lock, flags); + + return ret; +} +EXPORT_SYMBOL(ib_cached_gid_get); + +int ib_cached_pkey_get(struct ib_device *device, + u8 port, + int index, + u16 *pkey) +{ + struct ib_pkey_cache *cache; + unsigned long flags; + int ret = 0; + + if (port < start_port(device) || port > end_port(device)) + return -EINVAL; + + read_lock_irqsave(&device->cache.lock, flags); + + cache = device->cache.pkey_cache[port - start_port(device)]; + + if (index < 0 || index >= cache->table_len) + ret = -EINVAL; + else + *pkey = cache->table[index]; + + read_unlock_irqrestore(&device->cache.lock, flags); + + return ret; +} +EXPORT_SYMBOL(ib_cached_pkey_get); + +int ib_cached_pkey_find(struct ib_device *device, + u8 port, + u16 pkey, + u16 *index) +{ + struct ib_pkey_cache *cache; + unsigned long flags; + int i; + int ret = -ENOENT; + + if (port < start_port(device) || port > end_port(device)) + return -EINVAL; + + read_lock_irqsave(&device->cache.lock, flags); + + cache = device->cache.pkey_cache[port - start_port(device)]; + + *index = -1; + + for (i = 0; i < cache->table_len; ++i) + if ((cache->table[i] & 0x7fff) == (pkey & 0x7fff)) { + *index = i; + ret = 0; + break; + } + + read_unlock_irqrestore(&device->cache.lock, flags); + + return ret; +} +EXPORT_SYMBOL(ib_cached_pkey_find); + +static void ib_cache_update(struct ib_device *device, + u8 port) +{ + struct ib_port_attr *tprops = NULL; + struct ib_pkey_cache *pkey_cache = NULL, *old_pkey_cache; + struct ib_gid_cache *gid_cache = NULL, *old_gid_cache; + int i; + int ret; + + tprops = kmalloc(sizeof *tprops, GFP_KERNEL); + if (!tprops) + return; + + ret = ib_query_port(device, port, tprops); + if (ret) { + printk(KERN_WARNING "ib_query_port failed (%d) for %s\n", + ret, device->name); + goto err; + } + + pkey_cache = kmalloc(sizeof *pkey_cache + tprops->pkey_tbl_len * + sizeof *pkey_cache->table, GFP_KERNEL); + if (!pkey_cache) + goto err; + + pkey_cache->table_len = tprops->pkey_tbl_len; + + gid_cache = kmalloc(sizeof *gid_cache + tprops->gid_tbl_len * + sizeof *gid_cache->table, GFP_KERNEL); + if (!gid_cache) + goto err; + + gid_cache->table_len = tprops->gid_tbl_len; + + for (i = 0; i < pkey_cache->table_len; ++i) { + ret = ib_query_pkey(device, port, i, pkey_cache->table + i); + if (ret) { + printk(KERN_WARNING "ib_query_pkey failed (%d) for %s (index %d)\n", + ret, device->name, i); + goto err; + } + } + + for (i = 0; i < gid_cache->table_len; ++i) { + ret = ib_query_gid(device, port, i, gid_cache->table + i); + if (ret) { + printk(KERN_WARNING "ib_query_gid failed (%d) for %s (index %d)\n", + ret, device->name, i); + goto err; + } + } + + write_lock_irq(&device->cache.lock); + + old_pkey_cache = device->cache.pkey_cache[port - start_port(device)]; + old_gid_cache = device->cache.gid_cache [port - start_port(device)]; + + device->cache.pkey_cache[port - start_port(device)] = pkey_cache; + device->cache.gid_cache [port - start_port(device)] = gid_cache; + + write_unlock_irq(&device->cache.lock); + + kfree(old_pkey_cache); + kfree(old_gid_cache); + kfree(tprops); + return; + +err: + kfree(pkey_cache); + kfree(gid_cache); + kfree(tprops); +} + +static void ib_cache_task(void *work_ptr) +{ + struct ib_update_work *work = work_ptr; + + ib_cache_update(work->device, work->port_num); + kfree(work); +} + +static void ib_cache_event(struct ib_event_handler *handler, + struct ib_event *event) +{ + struct ib_update_work *work; + + if (event->event == IB_EVENT_PORT_ERR || + event->event == IB_EVENT_PORT_ACTIVE || + event->event == IB_EVENT_LID_CHANGE || + event->event == IB_EVENT_PKEY_CHANGE || + event->event == IB_EVENT_SM_CHANGE) { + work = kmalloc(sizeof *work, GFP_ATOMIC); + if (work) { + INIT_WORK(&work->work, ib_cache_task, work); + work->device = event->device; + work->port_num = event->element.port_num; + schedule_work(&work->work); + } + } +} + +void ib_cache_setup_one(struct ib_device *device) +{ + int p; + + rwlock_init(&device->cache.lock); + + device->cache.pkey_cache = + kmalloc(sizeof *device->cache.pkey_cache * + (end_port(device) - start_port(device) + 1), GFP_KERNEL); + device->cache.gid_cache = + kmalloc(sizeof *device->cache.pkey_cache * + (end_port(device) - start_port(device) + 1), GFP_KERNEL); + + if (!device->cache.pkey_cache || !device->cache.gid_cache) { + printk(KERN_WARNING "Couldn't allocate cache " + "for %s\n", device->name); + goto err; + } + + for (p = 0; p <= end_port(device) - start_port(device); ++p) { + device->cache.pkey_cache[p] = NULL; + device->cache.gid_cache [p] = NULL; + ib_cache_update(device, p + start_port(device)); + } + + INIT_IB_EVENT_HANDLER(&device->cache.event_handler, + device, ib_cache_event); + if (ib_register_event_handler(&device->cache.event_handler)) + goto err_cache; + + return; + +err_cache: + for (p = 0; p <= end_port(device) - start_port(device); ++p) { + kfree(device->cache.pkey_cache[p]); + kfree(device->cache.gid_cache[p]); + } + +err: + kfree(device->cache.pkey_cache); + kfree(device->cache.gid_cache); +} + +void ib_cache_cleanup_one(struct ib_device *device) +{ + int p; + + ib_unregister_event_handler(&device->cache.event_handler); + flush_scheduled_work(); + + for (p = 0; p <= end_port(device) - start_port(device); ++p) { + kfree(device->cache.pkey_cache[p]); + kfree(device->cache.gid_cache[p]); + } + + kfree(device->cache.pkey_cache); + kfree(device->cache.gid_cache); +} + +struct ib_client cache_client = { + .name = "cache", + .add = ib_cache_setup_one, + .remove = ib_cache_cleanup_one +}; + +int __init ib_cache_setup(void) +{ + return ib_register_client(&cache_client); +} + +void __exit ib_cache_cleanup(void) +{ + ib_unregister_client(&cache_client); +} diff -Nru a/drivers/infiniband/core/core_priv.h b/drivers/infiniband/core/core_priv.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/infiniband/core/core_priv.h 2005-01-02 23:03:35 -08:00 @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2004 Topspin Communications. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * $Id: core_priv.h 1349 2004-12-16 21:09:43Z roland $ + */ + +#ifndef _CORE_PRIV_H +#define _CORE_PRIV_H + +#include +#include + +#include + +int ib_device_register_sysfs(struct ib_device *device); +void ib_device_unregister_sysfs(struct ib_device *device); + +int ib_sysfs_setup(void); +void ib_sysfs_cleanup(void); + +int ib_cache_setup(void); +void ib_cache_cleanup(void); + +#endif /* _CORE_PRIV_H */ diff -Nru a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/infiniband/core/device.c 2005-01-02 23:03:35 -08:00 @@ -0,0 +1,614 @@ +/* + * Copyright (c) 2004 Topspin Communications. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * $Id: device.c 1349 2004-12-16 21:09:43Z roland $ + */ + +#include +#include +#include +#include +#include + +#include + +#include "core_priv.h" + +MODULE_AUTHOR("Roland Dreier"); +MODULE_DESCRIPTION("core kernel InfiniBand API"); +MODULE_LICENSE("Dual BSD/GPL"); + +struct ib_client_data { + struct list_head list; + struct ib_client *client; + void * data; +}; + +static LIST_HEAD(device_list); +static LIST_HEAD(client_list); + +/* + * device_sem protects access to both device_list and client_list. + * There's no real point to using multiple locks or something fancier + * like an rwsem: we always access both lists, and we're always + * modifying one list or the other list. In any case this is not a + * hot path so there's no point in trying to optimize. + */ +static DECLARE_MUTEX(device_sem); + +static int ib_device_check_mandatory(struct ib_device *device) +{ +#define IB_MANDATORY_FUNC(x) { offsetof(struct ib_device, x), #x } + static const struct { + size_t offset; + char *name; + } mandatory_table[] = { + IB_MANDATORY_FUNC(query_device), + IB_MANDATORY_FUNC(query_port), + IB_MANDATORY_FUNC(query_pkey), + IB_MANDATORY_FUNC(query_gid), + IB_MANDATORY_FUNC(alloc_pd), + IB_MANDATORY_FUNC(dealloc_pd), + IB_MANDATORY_FUNC(create_ah), + IB_MANDATORY_FUNC(destroy_ah), + IB_MANDATORY_FUNC(create_qp), + IB_MANDATORY_FUNC(modify_qp), + IB_MANDATORY_FUNC(destroy_qp), + IB_MANDATORY_FUNC(post_send), + IB_MANDATORY_FUNC(post_recv), + IB_MANDATORY_FUNC(create_cq), + IB_MANDATORY_FUNC(destroy_cq), + IB_MANDATORY_FUNC(poll_cq), + IB_MANDATORY_FUNC(req_notify_cq), + IB_MANDATORY_FUNC(get_dma_mr), + IB_MANDATORY_FUNC(dereg_mr) + }; + int i; + + for (i = 0; i < sizeof mandatory_table / sizeof mandatory_table[0]; ++i) { + if (!*(void **) ((void *) device + mandatory_table[i].offset)) { + printk(KERN_WARNING "Device %s is missing mandatory function %s\n", + device->name, mandatory_table[i].name); + return -EINVAL; + } + } + + return 0; +} + +static struct ib_device *__ib_device_get_by_name(const char *name) +{ + struct ib_device *device; + + list_for_each_entry(device, &device_list, core_list) + if (!strncmp(name, device->name, IB_DEVICE_NAME_MAX)) + return device; + + return NULL; +} + + +static int alloc_name(char *name) +{ + long *inuse; + char buf[IB_DEVICE_NAME_MAX]; + struct ib_device *device; + int i; + + inuse = (long *) get_zeroed_page(GFP_KERNEL); + if (!inuse) + return -ENOMEM; + + list_for_each_entry(device, &device_list, core_list) { + if (!sscanf(device->name, name, &i)) + continue; + if (i < 0 || i >= PAGE_SIZE * 8) + continue; + snprintf(buf, sizeof buf, name, i); + if (!strncmp(buf, device->name, IB_DEVICE_NAME_MAX)) + set_bit(i, inuse); + } + + i = find_first_zero_bit(inuse, PAGE_SIZE * 8); + free_page((unsigned long) inuse); + snprintf(buf, sizeof buf, name, i); + + if (__ib_device_get_by_name(buf)) + return -ENFILE; + + strlcpy(name, buf, IB_DEVICE_NAME_MAX); + return 0; +} + +/** + * ib_alloc_device - allocate an IB device struct + * @size:size of structure to allocate + * + * Low-level drivers should use ib_alloc_device() to allocate &struct + * ib_device. @size is the size of the structure to be allocated, + * including any private data used by the low-level driver. + * ib_dealloc_device() must be used to free structures allocated with + * ib_alloc_device(). + */ +struct ib_device *ib_alloc_device(size_t size) +{ + void *dev; + + BUG_ON(size < sizeof (struct ib_device)); + + dev = kmalloc(size, GFP_KERNEL); + if (!dev) + return NULL; + + memset(dev, 0, size); + + return dev; +} +EXPORT_SYMBOL(ib_alloc_device); + +/** + * ib_dealloc_device - free an IB device struct + * @device:structure to free + * + * Free a structure allocated with ib_alloc_device(). + */ +void ib_dealloc_device(struct ib_device *device) +{ + if (device->reg_state == IB_DEV_UNINITIALIZED) { + kfree(device); + return; + } + + BUG_ON(device->reg_state != IB_DEV_UNREGISTERED); + + ib_device_unregister_sysfs(device); +} +EXPORT_SYMBOL(ib_dealloc_device); + +static int add_client_context(struct ib_device *device, struct ib_client *client) +{ + struct ib_client_data *context; + unsigned long flags; + + context = kmalloc(sizeof *context, GFP_KERNEL); + if (!context) { + printk(KERN_WARNING "Couldn't allocate client context for %s/%s\n", + device->name, client->name); + return -ENOMEM; + } + + context->client = client; + context->data = NULL; + + spin_lock_irqsave(&device->client_data_lock, flags); + list_add(&context->list, &device->client_data_list); + spin_unlock_irqrestore(&device->client_data_lock, flags); + + return 0; +} + +/** + * ib_register_device - Register an IB device with IB core + * @device:Device to register + * + * Low-level drivers use ib_register_device() to register their + * devices with the IB core. All registered clients will receive a + * callback for each device that is added. @device must be allocated + * with ib_alloc_device(). + */ +int ib_register_device(struct ib_device *device) +{ + int ret; + + down(&device_sem); + + if (strchr(device->name, '%')) { + ret = alloc_name(device->name); + if (ret) + goto out; + } + + if (ib_device_check_mandatory(device)) { + ret = -EINVAL; + goto out; + } + + INIT_LIST_HEAD(&device->event_handler_list); + INIT_LIST_HEAD(&device->client_data_list); + spin_lock_init(&device->event_handler_lock); + spin_lock_init(&device->client_data_lock); + + ret = ib_device_register_sysfs(device); + if (ret) { + printk(KERN_WARNING "Couldn't register device %s with driver model\n", + device->name); + goto out; + } + + list_add_tail(&device->core_list, &device_list); + + device->reg_state = IB_DEV_REGISTERED; + + { + struct ib_client *client; + + list_for_each_entry(client, &client_list, list) + if (client->add && !add_client_context(device, client)) + client->add(device); + } + + out: + up(&device_sem); + return ret; +} +EXPORT_SYMBOL(ib_register_device); + +/** + * ib_unregister_device - Unregister an IB device + * @device:Device to unregister + * + * Unregister an IB device. All clients will receive a remove callback. + */ +void ib_unregister_device(struct ib_device *device) +{ + struct ib_client *client; + struct ib_client_data *context, *tmp; + unsigned long flags; + + down(&device_sem); + + list_for_each_entry_reverse(client, &client_list, list) + if (client->remove) + client->remove(device); + + list_del(&device->core_list); + + up(&device_sem); + + spin_lock_irqsave(&device->client_data_lock, flags); + list_for_each_entry_safe(context, tmp, &device->client_data_list, list) + kfree(context); + spin_unlock_irqrestore(&device->client_data_lock, flags); + + device->reg_state = IB_DEV_UNREGISTERED; +} +EXPORT_SYMBOL(ib_unregister_device); + +/** + * ib_register_client - Register an IB client + * @client:Client to register + * + * Upper level users of the IB drivers can use ib_register_client() to + * register callbacks for IB device addition and removal. When an IB + * device is added, each registered client's add method will be called + * (in the order the clients were registered), and when a device is + * removed, each client's remove method will be called (in the reverse + * order that clients were registered). In addition, when + * ib_register_client() is called, the client will receive an add + * callback for all devices already registered. + */ +int ib_register_client(struct ib_client *client) +{ + struct ib_device *device; + + down(&device_sem); + + list_add_tail(&client->list, &client_list); + list_for_each_entry(device, &device_list, core_list) + if (client->add && !add_client_context(device, client)) + client->add(device); + + up(&device_sem); + + return 0; +} +EXPORT_SYMBOL(ib_register_client); + +/** + * ib_unregister_client - Unregister an IB client + * @client:Client to unregister + * + * Upper level users use ib_unregister_client() to remove their client + * registration. When ib_unregister_client() is called, the client + * will receive a remove callback for each IB device still registered. + */ +void ib_unregister_client(struct ib_client *client) +{ + struct ib_client_data *context, *tmp; + struct ib_device *device; + unsigned long flags; + + down(&device_sem); + + list_for_each_entry(device, &device_list, core_list) { + if (client->remove) + client->remove(device); + + spin_lock_irqsave(&device->client_data_lock, flags); + list_for_each_entry_safe(context, tmp, &device->client_data_list, list) + if (context->client == client) { + list_del(&context->list); + kfree(context); + } + spin_unlock_irqrestore(&device->client_data_lock, flags); + } + list_del(&client->list); + + up(&device_sem); +} +EXPORT_SYMBOL(ib_unregister_client); + +/** + * ib_get_client_data - Get IB client context + * @device:Device to get context for + * @client:Client to get context for + * + * ib_get_client_data() returns client context set with + * ib_set_client_data(). + */ +void *ib_get_client_data(struct ib_device *device, struct ib_client *client) +{ + struct ib_client_data *context; + void *ret = NULL; + unsigned long flags; + + spin_lock_irqsave(&device->client_data_lock, flags); + list_for_each_entry(context, &device->client_data_list, list) + if (context->client == client) { + ret = context->data; + break; + } + spin_unlock_irqrestore(&device->client_data_lock, flags); + + return ret; +} +EXPORT_SYMBOL(ib_get_client_data); + +/** + * ib_set_client_data - Get IB client context + * @device:Device to set context for + * @client:Client to set context for + * @data:Context to set + * + * ib_set_client_data() sets client context that can be retrieved with + * ib_get_client_data(). + */ +void ib_set_client_data(struct ib_device *device, struct ib_client *client, + void *data) +{ + struct ib_client_data *context; + unsigned long flags; + + spin_lock_irqsave(&device->client_data_lock, flags); + list_for_each_entry(context, &device->client_data_list, list) + if (context->client == client) { + context->data = data; + goto out; + } + + printk(KERN_WARNING "No client context found for %s/%s\n", + device->name, client->name); + +out: + spin_unlock_irqrestore(&device->client_data_lock, flags); +} +EXPORT_SYMBOL(ib_set_client_data); + +/** + * ib_register_event_handler - Register an IB event handler + * @event_handler:Handler to register + * + * ib_register_event_handler() registers an event handler that will be + * called back when asynchronous IB events occur (as defined in + * chapter 11 of the InfiniBand Architecture Specification). This + * callback may occur in interrupt context. + */ +int ib_register_event_handler (struct ib_event_handler *event_handler) +{ + unsigned long flags; + + spin_lock_irqsave(&event_handler->device->event_handler_lock, flags); + list_add_tail(&event_handler->list, + &event_handler->device->event_handler_list); + spin_unlock_irqrestore(&event_handler->device->event_handler_lock, flags); + + return 0; +} +EXPORT_SYMBOL(ib_register_event_handler); + +/** + * ib_unregister_event_handler - Unregister an event handler + * @event_handler:Handler to unregister + * + * Unregister an event handler registered with + * ib_register_event_handler(). + */ +int ib_unregister_event_handler(struct ib_event_handler *event_handler) +{ + unsigned long flags; + + spin_lock_irqsave(&event_handler->device->event_handler_lock, flags); + list_del(&event_handler->list); + spin_unlock_irqrestore(&event_handler->device->event_handler_lock, flags); + + return 0; +} +EXPORT_SYMBOL(ib_unregister_event_handler); + +/** + * ib_dispatch_event - Dispatch an asynchronous event + * @event:Event to dispatch + * + * Low-level drivers must call ib_dispatch_event() to dispatch the + * event to all registered event handlers when an asynchronous event + * occurs. + */ +void ib_dispatch_event(struct ib_event *event) +{ + unsigned long flags; + struct ib_event_handler *handler; + + spin_lock_irqsave(&event->device->event_handler_lock, flags); + + list_for_each_entry(handler, &event->device->event_handler_list, list) + handler->handler(handler, event); + + spin_unlock_irqrestore(&event->device->event_handler_lock, flags); +} +EXPORT_SYMBOL(ib_dispatch_event); + +/** + * ib_query_device - Query IB device attributes + * @device:Device to query + * @device_attr:Device attributes + * + * ib_query_device() returns the attributes of a device through the + * @device_attr pointer. + */ +int ib_query_device(struct ib_device *device, + struct ib_device_attr *device_attr) +{ + return device->query_device(device, device_attr); +} +EXPORT_SYMBOL(ib_query_device); + +/** + * ib_query_port - Query IB port attributes + * @device:Device to query + * @port_num:Port number to query + * @port_attr:Port attributes + * + * ib_query_port() returns the attributes of a port through the + * @port_attr pointer. + */ +int ib_query_port(struct ib_device *device, + u8 port_num, + struct ib_port_attr *port_attr) +{ + return device->query_port(device, port_num, port_attr); +} +EXPORT_SYMBOL(ib_query_port); + +/** + * ib_query_gid - Get GID table entry + * @device:Device to query + * @port_num:Port number to query + * @index:GID table index to query + * @gid:Returned GID + * + * ib_query_gid() fetches the specified GID table entry. + */ +int ib_query_gid(struct ib_device *device, + u8 port_num, int index, union ib_gid *gid) +{ + return device->query_gid(device, port_num, index, gid); +} +EXPORT_SYMBOL(ib_query_gid); + +/** + * ib_query_pkey - Get P_Key table entry + * @device:Device to query + * @port_num:Port number to query + * @index:P_Key table index to query + * @pkey:Returned P_Key + * + * ib_query_pkey() fetches the specified P_Key table entry. + */ +int ib_query_pkey(struct ib_device *device, + u8 port_num, u16 index, u16 *pkey) +{ + return device->query_pkey(device, port_num, index, pkey); +} +EXPORT_SYMBOL(ib_query_pkey); + +/** + * ib_modify_device - Change IB device attributes + * @device:Device to modify + * @device_modify_mask:Mask of attributes to change + * @device_modify:New attribute values + * + * ib_modify_device() changes a device's attributes as specified by + * the @device_modify_mask and @device_modify structure. + */ +int ib_modify_device(struct ib_device *device, + int device_modify_mask, + struct ib_device_modify *device_modify) +{ + return device->modify_device(device, device_modify_mask, + device_modify); +} +EXPORT_SYMBOL(ib_modify_device); + +/** + * ib_modify_port - Modifies the attributes for the specified port. + * @device: The device to modify. + * @port_num: The number of the port to modify. + * @port_modify_mask: Mask used to specify which attributes of the port + * to change. + * @port_modify: New attribute values for the port. + * + * ib_modify_port() changes a port's attributes as specified by the + * @port_modify_mask and @port_modify structure. + */ +int ib_modify_port(struct ib_device *device, + u8 port_num, int port_modify_mask, + struct ib_port_modify *port_modify) +{ + return device->modify_port(device, port_num, port_modify_mask, + port_modify); +} +EXPORT_SYMBOL(ib_modify_port); + +static int __init ib_core_init(void) +{ + int ret; + + ret = ib_sysfs_setup(); + if (ret) + printk(KERN_WARNING "Couldn't create InfiniBand device class\n"); + + ret = ib_cache_setup(); + if (ret) { + printk(KERN_WARNING "Couldn't set up InfiniBand P_Key/GID cache\n"); + ib_sysfs_cleanup(); + } + + return ret; +} + +static void __exit ib_core_cleanup(void) +{ + ib_cache_cleanup(); + ib_sysfs_cleanup(); +} + +module_init(ib_core_init); +module_exit(ib_core_cleanup); diff -Nru a/drivers/infiniband/core/fmr_pool.c b/drivers/infiniband/core/fmr_pool.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/infiniband/core/fmr_pool.c 2005-01-02 23:03:35 -08:00 @@ -0,0 +1,507 @@ +/* + * Copyright (c) 2004 Topspin Communications. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * $Id: fmr_pool.c 1349 2004-12-16 21:09:43Z roland $ + */ + +#include +#include +#include +#include +#include + +#include + +#include "core_priv.h" + +enum { + IB_FMR_MAX_REMAPS = 32, + + IB_FMR_HASH_BITS = 8, + IB_FMR_HASH_SIZE = 1 << IB_FMR_HASH_BITS, + IB_FMR_HASH_MASK = IB_FMR_HASH_SIZE - 1 +}; + +/* + * If an FMR is not in use, then the list member will point to either + * its pool's free_list (if the FMR can be mapped again; that is, + * remap_count < IB_FMR_MAX_REMAPS) or its pool's dirty_list (if the + * FMR needs to be unmapped before being remapped). In either of + * these cases it is a bug if the ref_count is not 0. In other words, + * if ref_count is > 0, then the list member must not be linked into + * either free_list or dirty_list. + * + * The cache_node member is used to link the FMR into a cache bucket + * (if caching is enabled). This is independent of the reference + * count of the FMR. When a valid FMR is released, its ref_count is + * decremented, and if ref_count reaches 0, the FMR is placed in + * either free_list or dirty_list as appropriate. However, it is not + * removed from the cache and may be "revived" if a call to + * ib_fmr_register_physical() occurs before the FMR is remapped. In + * this case we just increment the ref_count and remove the FMR from + * free_list/dirty_list. + * + * Before we remap an FMR from free_list, we remove it from the cache + * (to prevent another user from obtaining a stale FMR). When an FMR + * is released, we add it to the tail of the free list, so that our + * cache eviction policy is "least recently used." + * + * All manipulation of ref_count, list and cache_node is protected by + * pool_lock to maintain consistency. + */ + +struct ib_fmr_pool { + spinlock_t pool_lock; + + int pool_size; + int max_pages; + int dirty_watermark; + int dirty_len; + struct list_head free_list; + struct list_head dirty_list; + struct hlist_head *cache_bucket; + + void (*flush_function)(struct ib_fmr_pool *pool, + void * arg); + void *flush_arg; + + struct task_struct *thread; + + atomic_t req_ser; + atomic_t flush_ser; + + wait_queue_head_t force_wait; +}; + +static inline u32 ib_fmr_hash(u64 first_page) +{ + return jhash_2words((u32) first_page, + (u32) (first_page >> 32), + 0); +} + +/* Caller must hold pool_lock */ +static inline struct ib_pool_fmr *ib_fmr_cache_lookup(struct ib_fmr_pool *pool, + u64 *page_list, + int page_list_len, + u64 io_virtual_address) +{ + struct hlist_head *bucket; + struct ib_pool_fmr *fmr; + struct hlist_node *pos; + + if (!pool->cache_bucket) + return NULL; + + bucket = pool->cache_bucket + ib_fmr_hash(*page_list); + + hlist_for_each_entry(fmr, pos, bucket, cache_node) + if (io_virtual_address == fmr->io_virtual_address && + page_list_len == fmr->page_list_len && + !memcmp(page_list, fmr->page_list, + page_list_len * sizeof *page_list)) + return fmr; + + return NULL; +} + +static void ib_fmr_batch_release(struct ib_fmr_pool *pool) +{ + int ret; + struct ib_pool_fmr *fmr; + LIST_HEAD(unmap_list); + LIST_HEAD(fmr_list); + + spin_lock_irq(&pool->pool_lock); + + list_for_each_entry(fmr, &pool->dirty_list, list) { + hlist_del_init(&fmr->cache_node); + fmr->remap_count = 0; + list_add_tail(&fmr->fmr->list, &fmr_list); + +#ifdef DEBUG + if (fmr->ref_count !=0) { + printk(KERN_WARNING "Unmapping FMR 0x%08x with ref count %d", + fmr, fmr->ref_count); + } +#endif + } + + list_splice(&pool->dirty_list, &unmap_list); + INIT_LIST_HEAD(&pool->dirty_list); + pool->dirty_len = 0; + + spin_unlock_irq(&pool->pool_lock); + + if (list_empty(&unmap_list)) { + return; + } + + ret = ib_unmap_fmr(&fmr_list); + if (ret) + printk(KERN_WARNING "ib_unmap_fmr returned %d", ret); + + spin_lock_irq(&pool->pool_lock); + list_splice(&unmap_list, &pool->free_list); + spin_unlock_irq(&pool->pool_lock); +} + +static int ib_fmr_cleanup_thread(void *pool_ptr) +{ + struct ib_fmr_pool *pool = pool_ptr; + + do { + if (pool->dirty_len >= pool->dirty_watermark || + atomic_read(&pool->flush_ser) - atomic_read(&pool->req_ser) < 0) { + ib_fmr_batch_release(pool); + + atomic_inc(&pool->flush_ser); + wake_up_interruptible(&pool->force_wait); + + if (pool->flush_function) + pool->flush_function(pool, pool->flush_arg); + } + + set_current_state(TASK_INTERRUPTIBLE); + if (pool->dirty_len < pool->dirty_watermark && + atomic_read(&pool->flush_ser) - atomic_read(&pool->req_ser) >= 0 && + !kthread_should_stop()) + schedule(); + __set_current_state(TASK_RUNNING); + } while (!kthread_should_stop()); + + return 0; +} + +/** + * ib_create_fmr_pool - Create an FMR pool + * @pd:Protection domain for FMRs + * @params:FMR pool parameters + * + * Create a pool of FMRs. Return value is pointer to new pool or + * error code if creation failed. + */ +struct ib_fmr_pool *ib_create_fmr_pool(struct ib_pd *pd, + struct ib_fmr_pool_param *params) +{ + struct ib_device *device; + struct ib_fmr_pool *pool; + int i; + int ret; + + if (!params) + return ERR_PTR(-EINVAL); + + device = pd->device; + if (!device->alloc_fmr || !device->dealloc_fmr || + !device->map_phys_fmr || !device->unmap_fmr) { + printk(KERN_WARNING "Device %s does not support fast memory regions", + device->name); + return ERR_PTR(-ENOSYS); + } + + pool = kmalloc(sizeof *pool, GFP_KERNEL); + if (!pool) { + printk(KERN_WARNING "couldn't allocate pool struct"); + return ERR_PTR(-ENOMEM); + } + + pool->cache_bucket = NULL; + + pool->flush_function = params->flush_function; + pool->flush_arg = params->flush_arg; + + INIT_LIST_HEAD(&pool->free_list); + INIT_LIST_HEAD(&pool->dirty_list); + + if (params->cache) { + pool->cache_bucket = + kmalloc(IB_FMR_HASH_SIZE * sizeof *pool->cache_bucket, + GFP_KERNEL); + if (!pool->cache_bucket) { + printk(KERN_WARNING "Failed to allocate cache in pool"); + ret = -ENOMEM; + goto out_free_pool; + } + + for (i = 0; i < IB_FMR_HASH_SIZE; ++i) + INIT_HLIST_HEAD(pool->cache_bucket + i); + } + + pool->pool_size = 0; + pool->max_pages = params->max_pages_per_fmr; + pool->dirty_watermark = params->dirty_watermark; + pool->dirty_len = 0; + spin_lock_init(&pool->pool_lock); + atomic_set(&pool->req_ser, 0); + atomic_set(&pool->flush_ser, 0); + init_waitqueue_head(&pool->force_wait); + + pool->thread = kthread_create(ib_fmr_cleanup_thread, + pool, + "ib_fmr(%s)", + device->name); + if (IS_ERR(pool->thread)) { + printk(KERN_WARNING "couldn't start cleanup thread"); + ret = PTR_ERR(pool->thread); + goto out_free_pool; + } + + { + struct ib_pool_fmr *fmr; + struct ib_fmr_attr attr = { + .max_pages = params->max_pages_per_fmr, + .max_maps = IB_FMR_MAX_REMAPS, + .page_size = PAGE_SHIFT + }; + + for (i = 0; i < params->pool_size; ++i) { + fmr = kmalloc(sizeof *fmr + params->max_pages_per_fmr * sizeof (u64), + GFP_KERNEL); + if (!fmr) { + printk(KERN_WARNING "failed to allocate fmr struct " + "for FMR %d", i); + goto out_fail; + } + + fmr->pool = pool; + fmr->remap_count = 0; + fmr->ref_count = 0; + INIT_HLIST_NODE(&fmr->cache_node); + + fmr->fmr = ib_alloc_fmr(pd, params->access, &attr); + if (IS_ERR(fmr->fmr)) { + printk(KERN_WARNING "fmr_create failed for FMR %d", i); + kfree(fmr); + goto out_fail; + } + + list_add_tail(&fmr->list, &pool->free_list); + ++pool->pool_size; + } + } + + return pool; + + out_free_pool: + kfree(pool->cache_bucket); + kfree(pool); + + return ERR_PTR(ret); + + out_fail: + ib_destroy_fmr_pool(pool); + + return ERR_PTR(-ENOMEM); +} +EXPORT_SYMBOL(ib_create_fmr_pool); + +/** + * ib_destroy_fmr_pool - Free FMR pool + * @pool:FMR pool to free + * + * Destroy an FMR pool and free all associated resources. + */ +int ib_destroy_fmr_pool(struct ib_fmr_pool *pool) +{ + struct ib_pool_fmr *fmr; + struct ib_pool_fmr *tmp; + int i; + + kthread_stop(pool->thread); + ib_fmr_batch_release(pool); + + i = 0; + list_for_each_entry_safe(fmr, tmp, &pool->free_list, list) { + ib_dealloc_fmr(fmr->fmr); + list_del(&fmr->list); + kfree(fmr); + ++i; + } + + if (i < pool->pool_size) + printk(KERN_WARNING "pool still has %d regions registered", + pool->pool_size - i); + + kfree(pool->cache_bucket); + kfree(pool); + + return 0; +} +EXPORT_SYMBOL(ib_destroy_fmr_pool); + +/** + * ib_flush_fmr_pool - Invalidate all unmapped FMRs + * @pool:FMR pool to flush + * + * Ensure that all unmapped FMRs are fully invalidated. + */ +int ib_flush_fmr_pool(struct ib_fmr_pool *pool) +{ + int serial; + + atomic_inc(&pool->req_ser); + /* + * It's OK if someone else bumps req_ser again here -- we'll + * just wait a little longer. + */ + serial = atomic_read(&pool->req_ser); + + wake_up_process(pool->thread); + + if (wait_event_interruptible(pool->force_wait, + atomic_read(&pool->flush_ser) - + atomic_read(&pool->req_ser) >= 0)) + return -EINTR; + + return 0; +} +EXPORT_SYMBOL(ib_flush_fmr_pool); + +/** + * ib_fmr_pool_map_phys - + * @pool:FMR pool to allocate FMR from + * @page_list:List of pages to map + * @list_len:Number of pages in @page_list + * @io_virtual_address:I/O virtual address for new FMR + * + * Map an FMR from an FMR pool. + */ +struct ib_pool_fmr *ib_fmr_pool_map_phys(struct ib_fmr_pool *pool_handle, + u64 *page_list, + int list_len, + u64 *io_virtual_address) +{ + struct ib_fmr_pool *pool = pool_handle; + struct ib_pool_fmr *fmr; + unsigned long flags; + int result; + + if (list_len < 1 || list_len > pool->max_pages) + return ERR_PTR(-EINVAL); + + spin_lock_irqsave(&pool->pool_lock, flags); + fmr = ib_fmr_cache_lookup(pool, + page_list, + list_len, + *io_virtual_address); + if (fmr) { + /* found in cache */ + ++fmr->ref_count; + if (fmr->ref_count == 1) { + list_del(&fmr->list); + } + + spin_unlock_irqrestore(&pool->pool_lock, flags); + + return fmr; + } + + if (list_empty(&pool->free_list)) { + spin_unlock_irqrestore(&pool->pool_lock, flags); + return ERR_PTR(-EAGAIN); + } + + fmr = list_entry(pool->free_list.next, struct ib_pool_fmr, list); + list_del(&fmr->list); + hlist_del_init(&fmr->cache_node); + spin_unlock_irqrestore(&pool->pool_lock, flags); + + result = ib_map_phys_fmr(fmr->fmr, page_list, list_len, + *io_virtual_address); + + if (result) { + spin_lock_irqsave(&pool->pool_lock, flags); + list_add(&fmr->list, &pool->free_list); + spin_unlock_irqrestore(&pool->pool_lock, flags); + + printk(KERN_WARNING "fmr_map returns %d", + result); + + return ERR_PTR(result); + } + + ++fmr->remap_count; + fmr->ref_count = 1; + + if (pool->cache_bucket) { + fmr->io_virtual_address = *io_virtual_address; + fmr->page_list_len = list_len; + memcpy(fmr->page_list, page_list, list_len * sizeof(*page_list)); + + spin_lock_irqsave(&pool->pool_lock, flags); + hlist_add_head(&fmr->cache_node, + pool->cache_bucket + ib_fmr_hash(fmr->page_list[0])); + spin_unlock_irqrestore(&pool->pool_lock, flags); + } + + return fmr; +} +EXPORT_SYMBOL(ib_fmr_pool_map_phys); + +/** + * ib_fmr_pool_unmap - Unmap FMR + * @fmr:FMR to unmap + * + * Unmap an FMR. The FMR mapping may remain valid until the FMR is + * reused (or until ib_flush_fmr_pool() is called). + */ +int ib_fmr_pool_unmap(struct ib_pool_fmr *fmr) +{ + struct ib_fmr_pool *pool; + unsigned long flags; + + pool = fmr->pool; + + spin_lock_irqsave(&pool->pool_lock, flags); + + --fmr->ref_count; + if (!fmr->ref_count) { + if (fmr->remap_count < IB_FMR_MAX_REMAPS) { + list_add_tail(&fmr->list, &pool->free_list); + } else { + list_add_tail(&fmr->list, &pool->dirty_list); + ++pool->dirty_len; + wake_up_process(pool->thread); + } + } + +#ifdef DEBUG + if (fmr->ref_count < 0) + printk(KERN_WARNING "FMR %p has ref count %d < 0", + fmr, fmr->ref_count); +#endif + + spin_unlock_irqrestore(&pool->pool_lock, flags); + + return 0; +} +EXPORT_SYMBOL(ib_fmr_pool_unmap); diff -Nru a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/infiniband/core/mad.c 2005-01-02 23:03:35 -08:00 @@ -0,0 +1,2632 @@ +/* + * Copyright (c) 2004, Voltaire, Inc. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * $Id: mad.c 1389 2004-12-27 22:56:47Z roland $ + */ + +#include +#include + +#include + +#include "mad_priv.h" +#include "smi.h" +#include "agent.h" + + +MODULE_LICENSE("Dual BSD/GPL"); +MODULE_DESCRIPTION("kernel IB MAD API"); +MODULE_AUTHOR("Hal Rosenstock"); +MODULE_AUTHOR("Sean Hefty"); + + +kmem_cache_t *ib_mad_cache; +static struct list_head ib_mad_port_list; +static u32 ib_mad_client_id = 0; + +/* Port list lock */ +static spinlock_t ib_mad_port_list_lock; + + +/* Forward declarations */ +static int method_in_use(struct ib_mad_mgmt_method_table **method, + struct ib_mad_reg_req *mad_reg_req); +static void remove_mad_reg_req(struct ib_mad_agent_private *priv); +static int ib_mad_post_receive_mads(struct ib_mad_qp_info *qp_info, + struct ib_mad_private *mad); +static void cancel_mads(struct ib_mad_agent_private *mad_agent_priv); +static void ib_mad_complete_send_wr(struct ib_mad_send_wr_private *mad_send_wr, + struct ib_mad_send_wc *mad_send_wc); +static void timeout_sends(void *data); +static void local_completions(void *data); +static int solicited_mad(struct ib_mad *mad); +static int add_nonoui_reg_req(struct ib_mad_reg_req *mad_reg_req, + struct ib_mad_agent_private *agent_priv, + u8 mgmt_class); +static int add_oui_reg_req(struct ib_mad_reg_req *mad_reg_req, + struct ib_mad_agent_private *agent_priv); + +/* + * Returns a ib_mad_port_private structure or NULL for a device/port + * Assumes ib_mad_port_list_lock is being held + */ +static inline struct ib_mad_port_private * +__ib_get_mad_port(struct ib_device *device, int port_num) +{ + struct ib_mad_port_private *entry; + + list_for_each_entry(entry, &ib_mad_port_list, port_list) { + if (entry->device == device && entry->port_num == port_num) + return entry; + } + return NULL; +} + +/* + * Wrapper function to return a ib_mad_port_private structure or NULL + * for a device/port + */ +static inline struct ib_mad_port_private * +ib_get_mad_port(struct ib_device *device, int port_num) +{ + struct ib_mad_port_private *entry; + unsigned long flags; + + spin_lock_irqsave(&ib_mad_port_list_lock, flags); + entry = __ib_get_mad_port(device, port_num); + spin_unlock_irqrestore(&ib_mad_port_list_lock, flags); + + return entry; +} + +static inline u8 convert_mgmt_class(u8 mgmt_class) +{ + /* Alias IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE to 0 */ + return mgmt_class == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE ? + 0 : mgmt_class; +} + +static int get_spl_qp_index(enum ib_qp_type qp_type) +{ + switch (qp_type) + { + case IB_QPT_SMI: + return 0; + case IB_QPT_GSI: + return 1; + default: + return -1; + } +} + +static int vendor_class_index(u8 mgmt_class) +{ + return mgmt_class - IB_MGMT_CLASS_VENDOR_RANGE2_START; +} + +static int is_vendor_class(u8 mgmt_class) +{ + if ((mgmt_class < IB_MGMT_CLASS_VENDOR_RANGE2_START) || + (mgmt_class > IB_MGMT_CLASS_VENDOR_RANGE2_END)) + return 0; + return 1; +} + +static int is_vendor_oui(char *oui) +{ + if (oui[0] || oui[1] || oui[2]) + return 1; + return 0; +} + +static int is_vendor_method_in_use( + struct ib_mad_mgmt_vendor_class *vendor_class, + struct ib_mad_reg_req *mad_reg_req) +{ + struct ib_mad_mgmt_method_table *method; + int i; + + for (i = 0; i < MAX_MGMT_OUI; i++) { + if (!memcmp(vendor_class->oui[i], mad_reg_req->oui, 3)) { + method = vendor_class->method_table[i]; + if (method) { + if (method_in_use(&method, mad_reg_req)) + return 1; + else + break; + } + } + } + return 0; +} + +/* + * ib_register_mad_agent - Register to send/receive MADs + */ +struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device, + u8 port_num, + enum ib_qp_type qp_type, + struct ib_mad_reg_req *mad_reg_req, + u8 rmpp_version, + ib_mad_send_handler send_handler, + ib_mad_recv_handler recv_handler, + void *context) +{ + struct ib_mad_port_private *port_priv; + struct ib_mad_agent *ret = ERR_PTR(-EINVAL); + struct ib_mad_agent_private *mad_agent_priv; + struct ib_mad_reg_req *reg_req = NULL; + struct ib_mad_mgmt_class_table *class; + struct ib_mad_mgmt_vendor_class_table *vendor; + struct ib_mad_mgmt_vendor_class *vendor_class; + struct ib_mad_mgmt_method_table *method; + int ret2, qpn; + unsigned long flags; + u8 mgmt_class, vclass; + + /* Validate parameters */ + qpn = get_spl_qp_index(qp_type); + if (qpn == -1) + goto error1; + + if (rmpp_version) + goto error1; /* XXX: until RMPP implemented */ + + /* Validate MAD registration request if supplied */ + if (mad_reg_req) { + if (mad_reg_req->mgmt_class_version >= MAX_MGMT_VERSION) + goto error1; + if (!recv_handler) + goto error1; + if (mad_reg_req->mgmt_class >= MAX_MGMT_CLASS) { + /* + * IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE is the only + * one in this range currently allowed + */ + if (mad_reg_req->mgmt_class != + IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE) + goto error1; + } else if (mad_reg_req->mgmt_class == 0) { + /* + * Class 0 is reserved in IBA and is used for + * aliasing of IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE + */ + goto error1; + } else if (is_vendor_class(mad_reg_req->mgmt_class)) { + /* + * If class is in "new" vendor range, + * ensure supplied OUI is not zero + */ + if (!is_vendor_oui(mad_reg_req->oui)) + goto error1; + } + /* Make sure class supplied is consistent with QP type */ + if (qp_type == IB_QPT_SMI) { + if ((mad_reg_req->mgmt_class != + IB_MGMT_CLASS_SUBN_LID_ROUTED) && + (mad_reg_req->mgmt_class != + IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE)) + goto error1; + } else { + if ((mad_reg_req->mgmt_class == + IB_MGMT_CLASS_SUBN_LID_ROUTED) || + (mad_reg_req->mgmt_class == + IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE)) + goto error1; + } + } else { + /* No registration request supplied */ + if (!send_handler) + goto error1; + } + + /* Validate device and port */ + port_priv = ib_get_mad_port(device, port_num); + if (!port_priv) { + ret = ERR_PTR(-ENODEV); + goto error1; + } + + /* Allocate structures */ + mad_agent_priv = kmalloc(sizeof *mad_agent_priv, GFP_KERNEL); + if (!mad_agent_priv) { + ret = ERR_PTR(-ENOMEM); + goto error1; + } + + if (mad_reg_req) { + reg_req = kmalloc(sizeof *reg_req, GFP_KERNEL); + if (!reg_req) { + ret = ERR_PTR(-ENOMEM); + goto error2; + } + /* Make a copy of the MAD registration request */ + memcpy(reg_req, mad_reg_req, sizeof *reg_req); + } + + /* Now, fill in the various structures */ + memset(mad_agent_priv, 0, sizeof *mad_agent_priv); + mad_agent_priv->qp_info = &port_priv->qp_info[qpn]; + mad_agent_priv->reg_req = reg_req; + mad_agent_priv->rmpp_version = rmpp_version; + mad_agent_priv->agent.device = device; + mad_agent_priv->agent.recv_handler = recv_handler; + mad_agent_priv->agent.send_handler = send_handler; + mad_agent_priv->agent.context = context; + mad_agent_priv->agent.qp = port_priv->qp_info[qpn].qp; + mad_agent_priv->agent.port_num = port_num; + + spin_lock_irqsave(&port_priv->reg_lock, flags); + mad_agent_priv->agent.hi_tid = ++ib_mad_client_id; + + /* + * Make sure MAD registration (if supplied) + * is non overlapping with any existing ones + */ + if (mad_reg_req) { + mgmt_class = convert_mgmt_class(mad_reg_req->mgmt_class); + if (!is_vendor_class(mgmt_class)) { + class = port_priv->version[mad_reg_req-> + mgmt_class_version].class; + if (class) { + method = class->method_table[mgmt_class]; + if (method) { + if (method_in_use(&method, + mad_reg_req)) + goto error3; + } + } + ret2 = add_nonoui_reg_req(mad_reg_req, mad_agent_priv, + mgmt_class); + } else { + /* "New" vendor class range */ + vendor = port_priv->version[mad_reg_req-> + mgmt_class_version].vendor; + if (vendor) { + vclass = vendor_class_index(mgmt_class); + vendor_class = vendor->vendor_class[vclass]; + if (vendor_class) { + if (is_vendor_method_in_use( + vendor_class, + mad_reg_req)) + goto error3; + } + } + ret2 = add_oui_reg_req(mad_reg_req, mad_agent_priv); + } + if (ret2) { + ret = ERR_PTR(ret2); + goto error3; + } + } + + /* Add mad agent into port's agent list */ + list_add_tail(&mad_agent_priv->agent_list, &port_priv->agent_list); + spin_unlock_irqrestore(&port_priv->reg_lock, flags); + + spin_lock_init(&mad_agent_priv->lock); + INIT_LIST_HEAD(&mad_agent_priv->send_list); + INIT_LIST_HEAD(&mad_agent_priv->wait_list); + INIT_WORK(&mad_agent_priv->timed_work, timeout_sends, mad_agent_priv); + INIT_LIST_HEAD(&mad_agent_priv->local_list); + INIT_WORK(&mad_agent_priv->local_work, local_completions, + mad_agent_priv); + atomic_set(&mad_agent_priv->refcount, 1); + init_waitqueue_head(&mad_agent_priv->wait); + + return &mad_agent_priv->agent; + +error3: + spin_unlock_irqrestore(&port_priv->reg_lock, flags); + kfree(reg_req); +error2: + kfree(mad_agent_priv); +error1: + return ret; +} +EXPORT_SYMBOL(ib_register_mad_agent); + +static inline int is_snooping_sends(int mad_snoop_flags) +{ + return (mad_snoop_flags & + (/*IB_MAD_SNOOP_POSTED_SENDS | + IB_MAD_SNOOP_RMPP_SENDS |*/ + IB_MAD_SNOOP_SEND_COMPLETIONS /*| + IB_MAD_SNOOP_RMPP_SEND_COMPLETIONS*/)); +} + +static inline int is_snooping_recvs(int mad_snoop_flags) +{ + return (mad_snoop_flags & + (IB_MAD_SNOOP_RECVS /*| + IB_MAD_SNOOP_RMPP_RECVS*/)); +} + +static int register_snoop_agent(struct ib_mad_qp_info *qp_info, + struct ib_mad_snoop_private *mad_snoop_priv) +{ + struct ib_mad_snoop_private **new_snoop_table; + unsigned long flags; + int i; + + spin_lock_irqsave(&qp_info->snoop_lock, flags); + /* Check for empty slot in array. */ + for (i = 0; i < qp_info->snoop_table_size; i++) + if (!qp_info->snoop_table[i]) + break; + + if (i == qp_info->snoop_table_size) { + /* Grow table. */ + new_snoop_table = kmalloc(sizeof mad_snoop_priv * + qp_info->snoop_table_size + 1, + GFP_ATOMIC); + if (!new_snoop_table) { + i = -ENOMEM; + goto out; + } + if (qp_info->snoop_table) { + memcpy(new_snoop_table, qp_info->snoop_table, + sizeof mad_snoop_priv * + qp_info->snoop_table_size); + kfree(qp_info->snoop_table); + } + qp_info->snoop_table = new_snoop_table; + qp_info->snoop_table_size++; + } + qp_info->snoop_table[i] = mad_snoop_priv; + atomic_inc(&qp_info->snoop_count); +out: + spin_unlock_irqrestore(&qp_info->snoop_lock, flags); + return i; +} + +struct ib_mad_agent *ib_register_mad_snoop(struct ib_device *device, + u8 port_num, + enum ib_qp_type qp_type, + int mad_snoop_flags, + ib_mad_snoop_handler snoop_handler, + ib_mad_recv_handler recv_handler, + void *context) +{ + struct ib_mad_port_private *port_priv; + struct ib_mad_agent *ret; + struct ib_mad_snoop_private *mad_snoop_priv; + int qpn; + + /* Validate parameters */ + if ((is_snooping_sends(mad_snoop_flags) && !snoop_handler) || + (is_snooping_recvs(mad_snoop_flags) && !recv_handler)) { + ret = ERR_PTR(-EINVAL); + goto error1; + } + qpn = get_spl_qp_index(qp_type); + if (qpn == -1) { + ret = ERR_PTR(-EINVAL); + goto error1; + } + port_priv = ib_get_mad_port(device, port_num); + if (!port_priv) { + ret = ERR_PTR(-ENODEV); + goto error1; + } + /* Allocate structures */ + mad_snoop_priv = kmalloc(sizeof *mad_snoop_priv, GFP_KERNEL); + if (!mad_snoop_priv) { + ret = ERR_PTR(-ENOMEM); + goto error1; + } + + /* Now, fill in the various structures */ + memset(mad_snoop_priv, 0, sizeof *mad_snoop_priv); + mad_snoop_priv->qp_info = &port_priv->qp_info[qpn]; + mad_snoop_priv->agent.device = device; + mad_snoop_priv->agent.recv_handler = recv_handler; + mad_snoop_priv->agent.snoop_handler = snoop_handler; + mad_snoop_priv->agent.context = context; + mad_snoop_priv->agent.qp = port_priv->qp_info[qpn].qp; + mad_snoop_priv->agent.port_num = port_num; + mad_snoop_priv->mad_snoop_flags = mad_snoop_flags; + init_waitqueue_head(&mad_snoop_priv->wait); + mad_snoop_priv->snoop_index = register_snoop_agent( + &port_priv->qp_info[qpn], + mad_snoop_priv); + if (mad_snoop_priv->snoop_index < 0) { + ret = ERR_PTR(mad_snoop_priv->snoop_index); + goto error2; + } + + atomic_set(&mad_snoop_priv->refcount, 1); + return &mad_snoop_priv->agent; + +error2: + kfree(mad_snoop_priv); +error1: + return ret; +} +EXPORT_SYMBOL(ib_register_mad_snoop); + +static void unregister_mad_agent(struct ib_mad_agent_private *mad_agent_priv) +{ + struct ib_mad_port_private *port_priv; + unsigned long flags; + + /* Note that we could still be handling received MADs */ + + /* + * Canceling all sends results in dropping received response + * MADs, preventing us from queuing additional work + */ + cancel_mads(mad_agent_priv); + + port_priv = mad_agent_priv->qp_info->port_priv; + cancel_delayed_work(&mad_agent_priv->timed_work); + flush_workqueue(port_priv->wq); + + spin_lock_irqsave(&port_priv->reg_lock, flags); + remove_mad_reg_req(mad_agent_priv); + list_del(&mad_agent_priv->agent_list); + spin_unlock_irqrestore(&port_priv->reg_lock, flags); + + /* XXX: Cleanup pending RMPP receives for this agent */ + + atomic_dec(&mad_agent_priv->refcount); + wait_event(mad_agent_priv->wait, + !atomic_read(&mad_agent_priv->refcount)); + + if (mad_agent_priv->reg_req) + kfree(mad_agent_priv->reg_req); + kfree(mad_agent_priv); +} + +static void unregister_mad_snoop(struct ib_mad_snoop_private *mad_snoop_priv) +{ + struct ib_mad_qp_info *qp_info; + unsigned long flags; + + qp_info = mad_snoop_priv->qp_info; + spin_lock_irqsave(&qp_info->snoop_lock, flags); + qp_info->snoop_table[mad_snoop_priv->snoop_index] = NULL; + atomic_dec(&qp_info->snoop_count); + spin_unlock_irqrestore(&qp_info->snoop_lock, flags); + + atomic_dec(&mad_snoop_priv->refcount); + wait_event(mad_snoop_priv->wait, + !atomic_read(&mad_snoop_priv->refcount)); + + kfree(mad_snoop_priv); +} + +/* + * ib_unregister_mad_agent - Unregisters a client from using MAD services + */ +int ib_unregister_mad_agent(struct ib_mad_agent *mad_agent) +{ + struct ib_mad_agent_private *mad_agent_priv; + struct ib_mad_snoop_private *mad_snoop_priv; + + /* If the TID is zero, the agent can only snoop. */ + if (mad_agent->hi_tid) { + mad_agent_priv = container_of(mad_agent, + struct ib_mad_agent_private, + agent); + unregister_mad_agent(mad_agent_priv); + } else { + mad_snoop_priv = container_of(mad_agent, + struct ib_mad_snoop_private, + agent); + unregister_mad_snoop(mad_snoop_priv); + } + return 0; +} +EXPORT_SYMBOL(ib_unregister_mad_agent); + +static void dequeue_mad(struct ib_mad_list_head *mad_list) +{ + struct ib_mad_queue *mad_queue; + unsigned long flags; + + BUG_ON(!mad_list->mad_queue); + mad_queue = mad_list->mad_queue; + spin_lock_irqsave(&mad_queue->lock, flags); + list_del(&mad_list->list); + mad_queue->count--; + spin_unlock_irqrestore(&mad_queue->lock, flags); +} + +static void snoop_send(struct ib_mad_qp_info *qp_info, + struct ib_send_wr *send_wr, + struct ib_mad_send_wc *mad_send_wc, + int mad_snoop_flags) +{ + struct ib_mad_snoop_private *mad_snoop_priv; + unsigned long flags; + int i; + + spin_lock_irqsave(&qp_info->snoop_lock, flags); + for (i = 0; i < qp_info->snoop_table_size; i++) { + mad_snoop_priv = qp_info->snoop_table[i]; + if (!mad_snoop_priv || + !(mad_snoop_priv->mad_snoop_flags & mad_snoop_flags)) + continue; + + atomic_inc(&mad_snoop_priv->refcount); + spin_unlock_irqrestore(&qp_info->snoop_lock, flags); + mad_snoop_priv->agent.snoop_handler(&mad_snoop_priv->agent, + send_wr, mad_send_wc); + if (atomic_dec_and_test(&mad_snoop_priv->refcount)) + wake_up(&mad_snoop_priv->wait); + spin_lock_irqsave(&qp_info->snoop_lock, flags); + } + spin_unlock_irqrestore(&qp_info->snoop_lock, flags); +} + +static void snoop_recv(struct ib_mad_qp_info *qp_info, + struct ib_mad_recv_wc *mad_recv_wc, + int mad_snoop_flags) +{ + struct ib_mad_snoop_private *mad_snoop_priv; + unsigned long flags; + int i; + + spin_lock_irqsave(&qp_info->snoop_lock, flags); + for (i = 0; i < qp_info->snoop_table_size; i++) { + mad_snoop_priv = qp_info->snoop_table[i]; + if (!mad_snoop_priv || + !(mad_snoop_priv->mad_snoop_flags & mad_snoop_flags)) + continue; + + atomic_inc(&mad_snoop_priv->refcount); + spin_unlock_irqrestore(&qp_info->snoop_lock, flags); + mad_snoop_priv->agent.recv_handler(&mad_snoop_priv->agent, + mad_recv_wc); + if (atomic_dec_and_test(&mad_snoop_priv->refcount)) + wake_up(&mad_snoop_priv->wait); + spin_lock_irqsave(&qp_info->snoop_lock, flags); + } + spin_unlock_irqrestore(&qp_info->snoop_lock, flags); +} + +/* + * Return 0 if SMP is to be sent + * Return 1 if SMP was consumed locally (whether or not solicited) + * Return < 0 if error + */ +static int handle_outgoing_smp(struct ib_mad_agent_private *mad_agent_priv, + struct ib_smp *smp, + struct ib_send_wr *send_wr) +{ + int ret, alloc_flags; + unsigned long flags; + struct ib_mad_local_private *local; + struct ib_mad_private *mad_priv; + struct ib_device *device = mad_agent_priv->agent.device; + u8 port_num = mad_agent_priv->agent.port_num; + + if (!smi_handle_dr_smp_send(smp, device->node_type, port_num)) { + ret = -EINVAL; + printk(KERN_ERR PFX "Invalid directed route\n"); + goto out; + } + /* Check to post send on QP or process locally */ + ret = smi_check_local_dr_smp(smp, device, port_num); + if (!ret || !device->process_mad) + goto out; + + if (in_atomic() || irqs_disabled()) + alloc_flags = GFP_ATOMIC; + else + alloc_flags = GFP_KERNEL; + local = kmalloc(sizeof *local, alloc_flags); + if (!local) { + ret = -ENOMEM; + printk(KERN_ERR PFX "No memory for ib_mad_local_private\n"); + goto out; + } + local->mad_priv = NULL; + mad_priv = kmem_cache_alloc(ib_mad_cache, alloc_flags); + if (!mad_priv) { + ret = -ENOMEM; + printk(KERN_ERR PFX "No memory for local response MAD\n"); + kfree(local); + goto out; + } + ret = device->process_mad(device, 0, port_num, smp->dr_slid, + (struct ib_mad *)smp, + (struct ib_mad *)&mad_priv->mad); + switch (ret) + { + case IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_REPLY: + /* + * See if response is solicited and + * there is a recv handler + */ + if (solicited_mad(&mad_priv->mad.mad) && + mad_agent_priv->agent.recv_handler) + local->mad_priv = mad_priv; + else + kmem_cache_free(ib_mad_cache, mad_priv); + break; + case IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_CONSUMED: + kmem_cache_free(ib_mad_cache, mad_priv); + break; + case IB_MAD_RESULT_SUCCESS: + kmem_cache_free(ib_mad_cache, mad_priv); + kfree(local); + ret = 0; + goto out; + default: + kmem_cache_free(ib_mad_cache, mad_priv); + kfree(local); + ret = -EINVAL; + goto out; + } + + local->send_wr = *send_wr; + local->send_wr.sg_list = local->sg_list; + memcpy(local->sg_list, send_wr->sg_list, + sizeof *send_wr->sg_list * send_wr->num_sge); + local->send_wr.next = NULL; + local->tid = send_wr->wr.ud.mad_hdr->tid; + local->wr_id = send_wr->wr_id; + /* Reference MAD agent until local completion handled */ + atomic_inc(&mad_agent_priv->refcount); + /* Queue local completion to local list */ + spin_lock_irqsave(&mad_agent_priv->lock, flags); + list_add_tail(&local->completion_list, &mad_agent_priv->local_list); + spin_unlock_irqrestore(&mad_agent_priv->lock, flags); + queue_work(mad_agent_priv->qp_info->port_priv->wq, + &mad_agent_priv->local_work); + ret = 1; +out: + return ret; +} + +static int ib_send_mad(struct ib_mad_agent_private *mad_agent_priv, + struct ib_mad_send_wr_private *mad_send_wr) +{ + struct ib_mad_qp_info *qp_info; + struct ib_send_wr *bad_send_wr; + unsigned long flags; + int ret; + + /* Replace user's WR ID with our own to find WR upon completion */ + qp_info = mad_agent_priv->qp_info; + mad_send_wr->wr_id = mad_send_wr->send_wr.wr_id; + mad_send_wr->send_wr.wr_id = (unsigned long)&mad_send_wr->mad_list; + mad_send_wr->mad_list.mad_queue = &qp_info->send_queue; + + spin_lock_irqsave(&qp_info->send_queue.lock, flags); + if (qp_info->send_queue.count++ < qp_info->send_queue.max_active) { + list_add_tail(&mad_send_wr->mad_list.list, + &qp_info->send_queue.list); + spin_unlock_irqrestore(&qp_info->send_queue.lock, flags); + ret = ib_post_send(mad_agent_priv->agent.qp, + &mad_send_wr->send_wr, &bad_send_wr); + if (ret) { + printk(KERN_ERR PFX "ib_post_send failed: %d\n", ret); + dequeue_mad(&mad_send_wr->mad_list); + } + } else { + list_add_tail(&mad_send_wr->mad_list.list, + &qp_info->overflow_list); + spin_unlock_irqrestore(&qp_info->send_queue.lock, flags); + ret = 0; + } + return ret; +} + +/* + * ib_post_send_mad - Posts MAD(s) to the send queue of the QP associated + * with the registered client + */ +int ib_post_send_mad(struct ib_mad_agent *mad_agent, + struct ib_send_wr *send_wr, + struct ib_send_wr **bad_send_wr) +{ + int ret = -EINVAL; + struct ib_mad_agent_private *mad_agent_priv; + + /* Validate supplied parameters */ + if (!bad_send_wr) + goto error1; + + if (!mad_agent || !send_wr) + goto error2; + + if (!mad_agent->send_handler) + goto error2; + + mad_agent_priv = container_of(mad_agent, + struct ib_mad_agent_private, + agent); + + /* Walk list of send WRs and post each on send list */ + while (send_wr) { + unsigned long flags; + struct ib_send_wr *next_send_wr; + struct ib_mad_send_wr_private *mad_send_wr; + struct ib_smp *smp; + + /* Validate more parameters */ + if (send_wr->num_sge > IB_MAD_SEND_REQ_MAX_SG) + goto error2; + + if (send_wr->wr.ud.timeout_ms && !mad_agent->recv_handler) + goto error2; + + if (!send_wr->wr.ud.mad_hdr) { + printk(KERN_ERR PFX "MAD header must be supplied " + "in WR %p\n", send_wr); + goto error2; + } + + /* + * Save pointer to next work request to post in case the + * current one completes, and the user modifies the work + * request associated with the completion + */ + next_send_wr = (struct ib_send_wr *)send_wr->next; + + smp = (struct ib_smp *)send_wr->wr.ud.mad_hdr; + if (smp->mgmt_class == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE) { + ret = handle_outgoing_smp(mad_agent_priv, smp, send_wr); + if (ret < 0) /* error */ + goto error2; + else if (ret == 1) /* locally consumed */ + goto next; + } + + /* Allocate MAD send WR tracking structure */ + mad_send_wr = kmalloc(sizeof *mad_send_wr, + (in_atomic() || irqs_disabled()) ? + GFP_ATOMIC : GFP_KERNEL); + if (!mad_send_wr) { + printk(KERN_ERR PFX "No memory for " + "ib_mad_send_wr_private\n"); + ret = -ENOMEM; + goto error2; + } + + mad_send_wr->send_wr = *send_wr; + mad_send_wr->send_wr.sg_list = mad_send_wr->sg_list; + memcpy(mad_send_wr->sg_list, send_wr->sg_list, + sizeof *send_wr->sg_list * send_wr->num_sge); + mad_send_wr->send_wr.next = NULL; + mad_send_wr->tid = send_wr->wr.ud.mad_hdr->tid; + mad_send_wr->agent = mad_agent; + /* Timeout will be updated after send completes */ + mad_send_wr->timeout = msecs_to_jiffies(send_wr->wr. + ud.timeout_ms); + mad_send_wr->retry = 0; + /* One reference for each work request to QP + response */ + mad_send_wr->refcount = 1 + (mad_send_wr->timeout > 0); + mad_send_wr->status = IB_WC_SUCCESS; + + /* Reference MAD agent until send completes */ + atomic_inc(&mad_agent_priv->refcount); + spin_lock_irqsave(&mad_agent_priv->lock, flags); + list_add_tail(&mad_send_wr->agent_list, + &mad_agent_priv->send_list); + spin_unlock_irqrestore(&mad_agent_priv->lock, flags); + + ret = ib_send_mad(mad_agent_priv, mad_send_wr); + if (ret) { + /* Fail send request */ + spin_lock_irqsave(&mad_agent_priv->lock, flags); + list_del(&mad_send_wr->agent_list); + spin_unlock_irqrestore(&mad_agent_priv->lock, flags); + atomic_dec(&mad_agent_priv->refcount); + goto error2; + } +next: + send_wr = next_send_wr; + } + return 0; + +error2: + *bad_send_wr = send_wr; +error1: + return ret; +} +EXPORT_SYMBOL(ib_post_send_mad); + +/* + * ib_free_recv_mad - Returns data buffers used to receive + * a MAD to the access layer + */ +void ib_free_recv_mad(struct ib_mad_recv_wc *mad_recv_wc) +{ + struct ib_mad_recv_buf *entry; + struct ib_mad_private_header *mad_priv_hdr; + struct ib_mad_private *priv; + + mad_priv_hdr = container_of(mad_recv_wc, + struct ib_mad_private_header, + recv_wc); + priv = container_of(mad_priv_hdr, struct ib_mad_private, header); + + /* + * Walk receive buffer list associated with this WC + * No need to remove them from list of receive buffers + */ + list_for_each_entry(entry, &mad_recv_wc->recv_buf.list, list) { + /* Free previous receive buffer */ + kmem_cache_free(ib_mad_cache, priv); + mad_priv_hdr = container_of(mad_recv_wc, + struct ib_mad_private_header, + recv_wc); + priv = container_of(mad_priv_hdr, struct ib_mad_private, + header); + } + + /* Free last buffer */ + kmem_cache_free(ib_mad_cache, priv); +} +EXPORT_SYMBOL(ib_free_recv_mad); + +void ib_coalesce_recv_mad(struct ib_mad_recv_wc *mad_recv_wc, + void *buf) +{ + printk(KERN_ERR PFX "ib_coalesce_recv_mad() not implemented yet\n"); +} +EXPORT_SYMBOL(ib_coalesce_recv_mad); + +struct ib_mad_agent *ib_redirect_mad_qp(struct ib_qp *qp, + u8 rmpp_version, + ib_mad_send_handler send_handler, + ib_mad_recv_handler recv_handler, + void *context) +{ + return ERR_PTR(-EINVAL); /* XXX: for now */ +} +EXPORT_SYMBOL(ib_redirect_mad_qp); + +int ib_process_mad_wc(struct ib_mad_agent *mad_agent, + struct ib_wc *wc) +{ + printk(KERN_ERR PFX "ib_process_mad_wc() not implemented yet\n"); + return 0; +} +EXPORT_SYMBOL(ib_process_mad_wc); + +static int method_in_use(struct ib_mad_mgmt_method_table **method, + struct ib_mad_reg_req *mad_reg_req) +{ + int i; + + for (i = find_first_bit(mad_reg_req->method_mask, IB_MGMT_MAX_METHODS); + i < IB_MGMT_MAX_METHODS; + i = find_next_bit(mad_reg_req->method_mask, IB_MGMT_MAX_METHODS, + 1+i)) { + if ((*method)->agent[i]) { + printk(KERN_ERR PFX "Method %d already in use\n", i); + return -EINVAL; + } + } + return 0; +} + +static int allocate_method_table(struct ib_mad_mgmt_method_table **method) +{ + /* Allocate management method table */ + *method = kmalloc(sizeof **method, GFP_ATOMIC); + if (!*method) { + printk(KERN_ERR PFX "No memory for " + "ib_mad_mgmt_method_table\n"); + return -ENOMEM; + } + /* Clear management method table */ + memset(*method, 0, sizeof **method); + + return 0; +} + +/* + * Check to see if there are any methods still in use + */ +static int check_method_table(struct ib_mad_mgmt_method_table *method) +{ + int i; + + for (i = 0; i < IB_MGMT_MAX_METHODS; i++) + if (method->agent[i]) + return 1; + return 0; +} + +/* + * Check to see if there are any method tables for this class still in use + */ +static int check_class_table(struct ib_mad_mgmt_class_table *class) +{ + int i; + + for (i = 0; i < MAX_MGMT_CLASS; i++) + if (class->method_table[i]) + return 1; + return 0; +} + +static int check_vendor_class(struct ib_mad_mgmt_vendor_class *vendor_class) +{ + int i; + + for (i = 0; i < MAX_MGMT_OUI; i++) + if (vendor_class->method_table[i]) + return 1; + return 0; +} + +static int find_vendor_oui(struct ib_mad_mgmt_vendor_class *vendor_class, + char *oui) +{ + int i; + + for (i = 0; i < MAX_MGMT_OUI; i++) + /* Is there matching OUI for this vendor class ? */ + if (!memcmp(vendor_class->oui[i], oui, 3)) + return i; + + return -1; +} + +static int check_vendor_table(struct ib_mad_mgmt_vendor_class_table *vendor) +{ + int i; + + for (i = 0; i < MAX_MGMT_VENDOR_RANGE2; i++) + if (vendor->vendor_class[i]) + return 1; + + return 0; +} + +static void remove_methods_mad_agent(struct ib_mad_mgmt_method_table *method, + struct ib_mad_agent_private *agent) +{ + int i; + + /* Remove any methods for this mad agent */ + for (i = 0; i < IB_MGMT_MAX_METHODS; i++) { + if (method->agent[i] == agent) { + method->agent[i] = NULL; + } + } +} + +static int add_nonoui_reg_req(struct ib_mad_reg_req *mad_reg_req, + struct ib_mad_agent_private *agent_priv, + u8 mgmt_class) +{ + struct ib_mad_port_private *port_priv; + struct ib_mad_mgmt_class_table **class; + struct ib_mad_mgmt_method_table **method; + int i, ret; + + port_priv = agent_priv->qp_info->port_priv; + class = &port_priv->version[mad_reg_req->mgmt_class_version].class; + if (!*class) { + /* Allocate management class table for "new" class version */ + *class = kmalloc(sizeof **class, GFP_ATOMIC); + if (!*class) { + printk(KERN_ERR PFX "No memory for " + "ib_mad_mgmt_class_table\n"); + ret = -ENOMEM; + goto error1; + } + /* Clear management class table */ + memset(*class, 0, sizeof(**class)); + /* Allocate method table for this management class */ + method = &(*class)->method_table[mgmt_class]; + if ((ret = allocate_method_table(method))) + goto error2; + } else { + method = &(*class)->method_table[mgmt_class]; + if (!*method) { + /* Allocate method table for this management class */ + if ((ret = allocate_method_table(method))) + goto error1; + } + } + + /* Now, make sure methods are not already in use */ + if (method_in_use(method, mad_reg_req)) + goto error3; + + /* Finally, add in methods being registered */ + for (i = find_first_bit(mad_reg_req->method_mask, + IB_MGMT_MAX_METHODS); + i < IB_MGMT_MAX_METHODS; + i = find_next_bit(mad_reg_req->method_mask, IB_MGMT_MAX_METHODS, + 1+i)) { + (*method)->agent[i] = agent_priv; + } + return 0; + +error3: + /* Remove any methods for this mad agent */ + remove_methods_mad_agent(*method, agent_priv); + /* Now, check to see if there are any methods in use */ + if (!check_method_table(*method)) { + /* If not, release management method table */ + kfree(*method); + *method = NULL; + } + ret = -EINVAL; + goto error1; +error2: + kfree(*class); + *class = NULL; +error1: + return ret; +} + +static int add_oui_reg_req(struct ib_mad_reg_req *mad_reg_req, + struct ib_mad_agent_private *agent_priv) +{ + struct ib_mad_port_private *port_priv; + struct ib_mad_mgmt_vendor_class_table **vendor_table; + struct ib_mad_mgmt_vendor_class_table *vendor = NULL; + struct ib_mad_mgmt_vendor_class *vendor_class = NULL; + struct ib_mad_mgmt_method_table **method; + int i, ret = -ENOMEM; + u8 vclass; + + /* "New" vendor (with OUI) class */ + vclass = vendor_class_index(mad_reg_req->mgmt_class); + port_priv = agent_priv->qp_info->port_priv; + vendor_table = &port_priv->version[ + mad_reg_req->mgmt_class_version].vendor; + if (!*vendor_table) { + /* Allocate mgmt vendor class table for "new" class version */ + vendor = kmalloc(sizeof *vendor, GFP_ATOMIC); + if (!vendor) { + printk(KERN_ERR PFX "No memory for " + "ib_mad_mgmt_vendor_class_table\n"); + goto error1; + } + /* Clear management vendor class table */ + memset(vendor, 0, sizeof(*vendor)); + *vendor_table = vendor; + } + if (!(*vendor_table)->vendor_class[vclass]) { + /* Allocate table for this management vendor class */ + vendor_class = kmalloc(sizeof *vendor_class, GFP_ATOMIC); + if (!vendor_class) { + printk(KERN_ERR PFX "No memory for " + "ib_mad_mgmt_vendor_class\n"); + goto error2; + } + memset(vendor_class, 0, sizeof(*vendor_class)); + (*vendor_table)->vendor_class[vclass] = vendor_class; + } + for (i = 0; i < MAX_MGMT_OUI; i++) { + /* Is there matching OUI for this vendor class ? */ + if (!memcmp((*vendor_table)->vendor_class[vclass]->oui[i], + mad_reg_req->oui, 3)) { + method = &(*vendor_table)->vendor_class[ + vclass]->method_table[i]; + BUG_ON(!*method); + goto check_in_use; + } + } + for (i = 0; i < MAX_MGMT_OUI; i++) { + /* OUI slot available ? */ + if (!is_vendor_oui((*vendor_table)->vendor_class[ + vclass]->oui[i])) { + method = &(*vendor_table)->vendor_class[ + vclass]->method_table[i]; + BUG_ON(*method); + /* Allocate method table for this OUI */ + if ((ret = allocate_method_table(method))) + goto error3; + memcpy((*vendor_table)->vendor_class[vclass]->oui[i], + mad_reg_req->oui, 3); + goto check_in_use; + } + } + printk(KERN_ERR PFX "All OUI slots in use\n"); + goto error3; + +check_in_use: + /* Now, make sure methods are not already in use */ + if (method_in_use(method, mad_reg_req)) + goto error4; + + /* Finally, add in methods being registered */ + for (i = find_first_bit(mad_reg_req->method_mask, + IB_MGMT_MAX_METHODS); + i < IB_MGMT_MAX_METHODS; + i = find_next_bit(mad_reg_req->method_mask, IB_MGMT_MAX_METHODS, + 1+i)) { + (*method)->agent[i] = agent_priv; + } + return 0; + +error4: + /* Remove any methods for this mad agent */ + remove_methods_mad_agent(*method, agent_priv); + /* Now, check to see if there are any methods in use */ + if (!check_method_table(*method)) { + /* If not, release management method table */ + kfree(*method); + *method = NULL; + } + ret = -EINVAL; +error3: + if (vendor_class) { + (*vendor_table)->vendor_class[vclass] = NULL; + kfree(vendor_class); + } +error2: + if (vendor) { + *vendor_table = NULL; + kfree(vendor); + } +error1: + return ret; +} + +static void remove_mad_reg_req(struct ib_mad_agent_private *agent_priv) +{ + struct ib_mad_port_private *port_priv; + struct ib_mad_mgmt_class_table *class; + struct ib_mad_mgmt_method_table *method; + struct ib_mad_mgmt_vendor_class_table *vendor; + struct ib_mad_mgmt_vendor_class *vendor_class; + int index; + u8 mgmt_class; + + /* + * Was MAD registration request supplied + * with original registration ? + */ + if (!agent_priv->reg_req) { + goto out; + } + + port_priv = agent_priv->qp_info->port_priv; + class = port_priv->version[ + agent_priv->reg_req->mgmt_class_version].class; + if (!class) + goto vendor_check; + + mgmt_class = convert_mgmt_class(agent_priv->reg_req->mgmt_class); + method = class->method_table[mgmt_class]; + if (method) { + /* Remove any methods for this mad agent */ + remove_methods_mad_agent(method, agent_priv); + /* Now, check to see if there are any methods still in use */ + if (!check_method_table(method)) { + /* If not, release management method table */ + kfree(method); + class->method_table[mgmt_class] = NULL; + /* Any management classes left ? */ + if (!check_class_table(class)) { + /* If not, release management class table */ + kfree(class); + port_priv->version[ + agent_priv->reg_req-> + mgmt_class_version].class = NULL; + } + } + } + +vendor_check: + vendor = port_priv->version[ + agent_priv->reg_req->mgmt_class_version].vendor; + if (!vendor) + goto out; + + mgmt_class = vendor_class_index(agent_priv->reg_req->mgmt_class); + vendor_class = vendor->vendor_class[mgmt_class]; + if (vendor_class) { + index = find_vendor_oui(vendor_class, agent_priv->reg_req->oui); + if (index == -1) + goto out; + method = vendor_class->method_table[index]; + if (method) { + /* Remove any methods for this mad agent */ + remove_methods_mad_agent(method, agent_priv); + /* + * Now, check to see if there are + * any methods still in use + */ + if (!check_method_table(method)) { + /* If not, release management method table */ + kfree(method); + vendor_class->method_table[index] = NULL; + memset(vendor_class->oui[index], 0, 3); + /* Any OUIs left ? */ + if (!check_vendor_class(vendor_class)) { + /* If not, release vendor class table */ + kfree(vendor_class); + vendor->vendor_class[mgmt_class] = NULL; + /* Any other vendor classes left ? */ + if (!check_vendor_table(vendor)) { + kfree(vendor); + port_priv->version[ + agent_priv->reg_req-> + mgmt_class_version]. + vendor = NULL; + } + } + } + } + } + +out: + return; +} + +static int response_mad(struct ib_mad *mad) +{ + /* Trap represses are responses although response bit is reset */ + return ((mad->mad_hdr.method == IB_MGMT_METHOD_TRAP_REPRESS) || + (mad->mad_hdr.method & IB_MGMT_METHOD_RESP)); +} + +static int solicited_mad(struct ib_mad *mad) +{ + /* CM MADs are never solicited */ + if (mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_CM) { + return 0; + } + + /* XXX: Determine whether MAD is using RMPP */ + + /* Not using RMPP */ + /* Is this MAD a response to a previous MAD ? */ + return response_mad(mad); +} + +static struct ib_mad_agent_private * +find_mad_agent(struct ib_mad_port_private *port_priv, + struct ib_mad *mad, + int solicited) +{ + struct ib_mad_agent_private *mad_agent = NULL; + unsigned long flags; + + spin_lock_irqsave(&port_priv->reg_lock, flags); + + /* + * Whether MAD was solicited determines type of routing to + * MAD client. + */ + if (solicited) { + u32 hi_tid; + struct ib_mad_agent_private *entry; + + /* + * Routing is based on high 32 bits of transaction ID + * of MAD. + */ + hi_tid = be64_to_cpu(mad->mad_hdr.tid) >> 32; + list_for_each_entry(entry, &port_priv->agent_list, + agent_list) { + if (entry->agent.hi_tid == hi_tid) { + mad_agent = entry; + break; + } + } + } else { + struct ib_mad_mgmt_class_table *class; + struct ib_mad_mgmt_method_table *method; + struct ib_mad_mgmt_vendor_class_table *vendor; + struct ib_mad_mgmt_vendor_class *vendor_class; + struct ib_vendor_mad *vendor_mad; + int index; + + /* + * Routing is based on version, class, and method + * For "newer" vendor MADs, also based on OUI + */ + if (mad->mad_hdr.class_version >= MAX_MGMT_VERSION) + goto out; + if (!is_vendor_class(mad->mad_hdr.mgmt_class)) { + class = port_priv->version[ + mad->mad_hdr.class_version].class; + if (!class) + goto out; + method = class->method_table[convert_mgmt_class( + mad->mad_hdr.mgmt_class)]; + if (method) + mad_agent = method->agent[mad->mad_hdr.method & + ~IB_MGMT_METHOD_RESP]; + } else { + vendor = port_priv->version[ + mad->mad_hdr.class_version].vendor; + if (!vendor) + goto out; + vendor_class = vendor->vendor_class[vendor_class_index( + mad->mad_hdr.mgmt_class)]; + if (!vendor_class) + goto out; + /* Find matching OUI */ + vendor_mad = (struct ib_vendor_mad *)mad; + index = find_vendor_oui(vendor_class, vendor_mad->oui); + if (index == -1) + goto out; + method = vendor_class->method_table[index]; + if (method) { + mad_agent = method->agent[mad->mad_hdr.method & + ~IB_MGMT_METHOD_RESP]; + } + } + } + + if (mad_agent) { + if (mad_agent->agent.recv_handler) + atomic_inc(&mad_agent->refcount); + else { + printk(KERN_NOTICE PFX "No receive handler for client " + "%p on port %d\n", + &mad_agent->agent, port_priv->port_num); + mad_agent = NULL; + } + } +out: + spin_unlock_irqrestore(&port_priv->reg_lock, flags); + + return mad_agent; +} + +static int validate_mad(struct ib_mad *mad, u32 qp_num) +{ + int valid = 0; + + /* Make sure MAD base version is understood */ + if (mad->mad_hdr.base_version != IB_MGMT_BASE_VERSION) { + printk(KERN_ERR PFX "MAD received with unsupported base " + "version %d\n", mad->mad_hdr.base_version); + goto out; + } + + /* Filter SMI packets sent to other than QP0 */ + if ((mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_SUBN_LID_ROUTED) || + (mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE)) { + if (qp_num == 0) + valid = 1; + } else { + /* Filter GSI packets sent to QP0 */ + if (qp_num != 0) + valid = 1; + } + +out: + return valid; +} + +/* + * Return start of fully reassembled MAD, or NULL, if MAD isn't assembled yet + */ +static struct ib_mad_private * +reassemble_recv(struct ib_mad_agent_private *mad_agent_priv, + struct ib_mad_private *recv) +{ + /* Until we have RMPP, all receives are reassembled!... */ + INIT_LIST_HEAD(&recv->header.recv_wc.recv_buf.list); + return recv; +} + +static struct ib_mad_send_wr_private* +find_send_req(struct ib_mad_agent_private *mad_agent_priv, + u64 tid) +{ + struct ib_mad_send_wr_private *mad_send_wr; + + list_for_each_entry(mad_send_wr, &mad_agent_priv->wait_list, + agent_list) { + if (mad_send_wr->tid == tid) + return mad_send_wr; + } + + /* + * It's possible to receive the response before we've + * been notified that the send has completed + */ + list_for_each_entry(mad_send_wr, &mad_agent_priv->send_list, + agent_list) { + if (mad_send_wr->tid == tid && mad_send_wr->timeout) { + /* Verify request has not been canceled */ + return (mad_send_wr->status == IB_WC_SUCCESS) ? + mad_send_wr : NULL; + } + } + return NULL; +} + +static void ib_mad_complete_recv(struct ib_mad_agent_private *mad_agent_priv, + struct ib_mad_private *recv, + int solicited) +{ + struct ib_mad_send_wr_private *mad_send_wr; + struct ib_mad_send_wc mad_send_wc; + unsigned long flags; + + /* Fully reassemble receive before processing */ + recv = reassemble_recv(mad_agent_priv, recv); + if (!recv) { + if (atomic_dec_and_test(&mad_agent_priv->refcount)) + wake_up(&mad_agent_priv->wait); + return; + } + + /* Complete corresponding request */ + if (solicited) { + spin_lock_irqsave(&mad_agent_priv->lock, flags); + mad_send_wr = find_send_req(mad_agent_priv, + recv->mad.mad.mad_hdr.tid); + if (!mad_send_wr) { + spin_unlock_irqrestore(&mad_agent_priv->lock, flags); + ib_free_recv_mad(&recv->header.recv_wc); + if (atomic_dec_and_test(&mad_agent_priv->refcount)) + wake_up(&mad_agent_priv->wait); + return; + } + /* Timeout = 0 means that we won't wait for a response */ + mad_send_wr->timeout = 0; + spin_unlock_irqrestore(&mad_agent_priv->lock, flags); + + /* Defined behavior is to complete response before request */ + recv->header.recv_wc.wc->wr_id = mad_send_wr->wr_id; + mad_agent_priv->agent.recv_handler( + &mad_agent_priv->agent, + &recv->header.recv_wc); + atomic_dec(&mad_agent_priv->refcount); + + mad_send_wc.status = IB_WC_SUCCESS; + mad_send_wc.vendor_err = 0; + mad_send_wc.wr_id = mad_send_wr->wr_id; + ib_mad_complete_send_wr(mad_send_wr, &mad_send_wc); + } else { + mad_agent_priv->agent.recv_handler( + &mad_agent_priv->agent, + &recv->header.recv_wc); + if (atomic_dec_and_test(&mad_agent_priv->refcount)) + wake_up(&mad_agent_priv->wait); + } +} + +static void ib_mad_recv_done_handler(struct ib_mad_port_private *port_priv, + struct ib_wc *wc) +{ + struct ib_mad_qp_info *qp_info; + struct ib_mad_private_header *mad_priv_hdr; + struct ib_mad_private *recv, *response; + struct ib_mad_list_head *mad_list; + struct ib_mad_agent_private *mad_agent; + int solicited; + + response = kmem_cache_alloc(ib_mad_cache, GFP_KERNEL); + if (!response) + printk(KERN_ERR PFX "ib_mad_recv_done_handler no memory " + "for response buffer\n"); + + mad_list = (struct ib_mad_list_head *)(unsigned long)wc->wr_id; + qp_info = mad_list->mad_queue->qp_info; + dequeue_mad(mad_list); + + mad_priv_hdr = container_of(mad_list, struct ib_mad_private_header, + mad_list); + recv = container_of(mad_priv_hdr, struct ib_mad_private, header); + dma_unmap_single(port_priv->device->dma_device, + pci_unmap_addr(&recv->header, mapping), + sizeof(struct ib_mad_private) - + sizeof(struct ib_mad_private_header), + DMA_FROM_DEVICE); + + /* Setup MAD receive work completion from "normal" work completion */ + recv->header.recv_wc.wc = wc; + recv->header.recv_wc.mad_len = sizeof(struct ib_mad); + recv->header.recv_wc.recv_buf.mad = &recv->mad.mad; + recv->header.recv_wc.recv_buf.grh = &recv->grh; + + if (atomic_read(&qp_info->snoop_count)) + snoop_recv(qp_info, &recv->header.recv_wc, IB_MAD_SNOOP_RECVS); + + /* Validate MAD */ + if (!validate_mad(&recv->mad.mad, qp_info->qp->qp_num)) + goto out; + + if (recv->mad.mad.mad_hdr.mgmt_class == + IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE) { + if (!smi_handle_dr_smp_recv(&recv->mad.smp, + port_priv->device->node_type, + port_priv->port_num, + port_priv->device->phys_port_cnt)) + goto out; + if (!smi_check_forward_dr_smp(&recv->mad.smp)) + goto local; + if (!smi_handle_dr_smp_send(&recv->mad.smp, + port_priv->device->node_type, + port_priv->port_num)) + goto out; + if (!smi_check_local_dr_smp(&recv->mad.smp, + port_priv->device, + port_priv->port_num)) + goto out; + } + +local: + /* Give driver "right of first refusal" on incoming MAD */ + if (port_priv->device->process_mad) { + int ret; + + if (!response) { + printk(KERN_ERR PFX "No memory for response MAD\n"); + /* + * Is it better to assume that + * it wouldn't be processed ? + */ + goto out; + } + + ret = port_priv->device->process_mad(port_priv->device, 0, + port_priv->port_num, + wc->slid, + &recv->mad.mad, + &response->mad.mad); + if (ret & IB_MAD_RESULT_SUCCESS) { + if (ret & IB_MAD_RESULT_CONSUMED) + goto out; + if (ret & IB_MAD_RESULT_REPLY) { + /* Send response */ + if (!agent_send(response, &recv->grh, wc, + port_priv->device, + port_priv->port_num)) + response = NULL; + goto out; + } + } + } + + /* Determine corresponding MAD agent for incoming receive MAD */ + solicited = solicited_mad(&recv->mad.mad); + mad_agent = find_mad_agent(port_priv, &recv->mad.mad, solicited); + if (mad_agent) { + ib_mad_complete_recv(mad_agent, recv, solicited); + /* + * recv is freed up in error cases in ib_mad_complete_recv + * or via recv_handler in ib_mad_complete_recv() + */ + recv = NULL; + } + +out: + /* Post another receive request for this QP */ + if (response) { + ib_mad_post_receive_mads(qp_info, response); + if (recv) + kmem_cache_free(ib_mad_cache, recv); + } else + ib_mad_post_receive_mads(qp_info, recv); +} + +static void adjust_timeout(struct ib_mad_agent_private *mad_agent_priv) +{ + struct ib_mad_send_wr_private *mad_send_wr; + unsigned long delay; + + if (list_empty(&mad_agent_priv->wait_list)) { + cancel_delayed_work(&mad_agent_priv->timed_work); + } else { + mad_send_wr = list_entry(mad_agent_priv->wait_list.next, + struct ib_mad_send_wr_private, + agent_list); + + if (time_after(mad_agent_priv->timeout, + mad_send_wr->timeout)) { + mad_agent_priv->timeout = mad_send_wr->timeout; + cancel_delayed_work(&mad_agent_priv->timed_work); + delay = mad_send_wr->timeout - jiffies; + if ((long)delay <= 0) + delay = 1; + queue_delayed_work(mad_agent_priv->qp_info-> + port_priv->wq, + &mad_agent_priv->timed_work, delay); + } + } +} + +static void wait_for_response(struct ib_mad_agent_private *mad_agent_priv, + struct ib_mad_send_wr_private *mad_send_wr ) +{ + struct ib_mad_send_wr_private *temp_mad_send_wr; + struct list_head *list_item; + unsigned long delay; + + list_del(&mad_send_wr->agent_list); + + delay = mad_send_wr->timeout; + mad_send_wr->timeout += jiffies; + + list_for_each_prev(list_item, &mad_agent_priv->wait_list) { + temp_mad_send_wr = list_entry(list_item, + struct ib_mad_send_wr_private, + agent_list); + if (time_after(mad_send_wr->timeout, + temp_mad_send_wr->timeout)) + break; + } + list_add(&mad_send_wr->agent_list, list_item); + + /* Reschedule a work item if we have a shorter timeout */ + if (mad_agent_priv->wait_list.next == &mad_send_wr->agent_list) { + cancel_delayed_work(&mad_agent_priv->timed_work); + queue_delayed_work(mad_agent_priv->qp_info->port_priv->wq, + &mad_agent_priv->timed_work, delay); + } +} + +/* + * Process a send work completion + */ +static void ib_mad_complete_send_wr(struct ib_mad_send_wr_private *mad_send_wr, + struct ib_mad_send_wc *mad_send_wc) +{ + struct ib_mad_agent_private *mad_agent_priv; + unsigned long flags; + + mad_agent_priv = container_of(mad_send_wr->agent, + struct ib_mad_agent_private, agent); + + spin_lock_irqsave(&mad_agent_priv->lock, flags); + if (mad_send_wc->status != IB_WC_SUCCESS && + mad_send_wr->status == IB_WC_SUCCESS) { + mad_send_wr->status = mad_send_wc->status; + mad_send_wr->refcount -= (mad_send_wr->timeout > 0); + } + + if (--mad_send_wr->refcount > 0) { + if (mad_send_wr->refcount == 1 && mad_send_wr->timeout && + mad_send_wr->status == IB_WC_SUCCESS) { + wait_for_response(mad_agent_priv, mad_send_wr); + } + spin_unlock_irqrestore(&mad_agent_priv->lock, flags); + return; + } + + /* Remove send from MAD agent and notify client of completion */ + list_del(&mad_send_wr->agent_list); + adjust_timeout(mad_agent_priv); + spin_unlock_irqrestore(&mad_agent_priv->lock, flags); + + if (mad_send_wr->status != IB_WC_SUCCESS ) + mad_send_wc->status = mad_send_wr->status; + mad_agent_priv->agent.send_handler(&mad_agent_priv->agent, + mad_send_wc); + + /* Release reference on agent taken when sending */ + if (atomic_dec_and_test(&mad_agent_priv->refcount)) + wake_up(&mad_agent_priv->wait); + + kfree(mad_send_wr); +} + +static void ib_mad_send_done_handler(struct ib_mad_port_private *port_priv, + struct ib_wc *wc) +{ + struct ib_mad_send_wr_private *mad_send_wr, *queued_send_wr; + struct ib_mad_list_head *mad_list; + struct ib_mad_qp_info *qp_info; + struct ib_mad_queue *send_queue; + struct ib_send_wr *bad_send_wr; + unsigned long flags; + int ret; + + mad_list = (struct ib_mad_list_head *)(unsigned long)wc->wr_id; + mad_send_wr = container_of(mad_list, struct ib_mad_send_wr_private, + mad_list); + send_queue = mad_list->mad_queue; + qp_info = send_queue->qp_info; + +retry: + queued_send_wr = NULL; + spin_lock_irqsave(&send_queue->lock, flags); + list_del(&mad_list->list); + + /* Move queued send to the send queue */ + if (send_queue->count-- > send_queue->max_active) { + mad_list = container_of(qp_info->overflow_list.next, + struct ib_mad_list_head, list); + queued_send_wr = container_of(mad_list, + struct ib_mad_send_wr_private, + mad_list); + list_del(&mad_list->list); + list_add_tail(&mad_list->list, &send_queue->list); + } + spin_unlock_irqrestore(&send_queue->lock, flags); + + /* Restore client wr_id in WC and complete send */ + wc->wr_id = mad_send_wr->wr_id; + if (atomic_read(&qp_info->snoop_count)) + snoop_send(qp_info, &mad_send_wr->send_wr, + (struct ib_mad_send_wc *)wc, + IB_MAD_SNOOP_SEND_COMPLETIONS); + ib_mad_complete_send_wr(mad_send_wr, (struct ib_mad_send_wc *)wc); + + if (queued_send_wr) { + ret = ib_post_send(qp_info->qp, &queued_send_wr->send_wr, + &bad_send_wr); + if (ret) { + printk(KERN_ERR PFX "ib_post_send failed: %d\n", ret); + mad_send_wr = queued_send_wr; + wc->status = IB_WC_LOC_QP_OP_ERR; + goto retry; + } + } +} + +static void mark_sends_for_retry(struct ib_mad_qp_info *qp_info) +{ + struct ib_mad_send_wr_private *mad_send_wr; + struct ib_mad_list_head *mad_list; + unsigned long flags; + + spin_lock_irqsave(&qp_info->send_queue.lock, flags); + list_for_each_entry(mad_list, &qp_info->send_queue.list, list) { + mad_send_wr = container_of(mad_list, + struct ib_mad_send_wr_private, + mad_list); + mad_send_wr->retry = 1; + } + spin_unlock_irqrestore(&qp_info->send_queue.lock, flags); +} + +static void mad_error_handler(struct ib_mad_port_private *port_priv, + struct ib_wc *wc) +{ + struct ib_mad_list_head *mad_list; + struct ib_mad_qp_info *qp_info; + struct ib_mad_send_wr_private *mad_send_wr; + int ret; + + /* Determine if failure was a send or receive */ + mad_list = (struct ib_mad_list_head *)(unsigned long)wc->wr_id; + qp_info = mad_list->mad_queue->qp_info; + if (mad_list->mad_queue == &qp_info->recv_queue) + /* + * Receive errors indicate that the QP has entered the error + * state - error handling/shutdown code will cleanup + */ + return; + + /* + * Send errors will transition the QP to SQE - move + * QP to RTS and repost flushed work requests + */ + mad_send_wr = container_of(mad_list, struct ib_mad_send_wr_private, + mad_list); + if (wc->status == IB_WC_WR_FLUSH_ERR) { + if (mad_send_wr->retry) { + /* Repost send */ + struct ib_send_wr *bad_send_wr; + + mad_send_wr->retry = 0; + ret = ib_post_send(qp_info->qp, &mad_send_wr->send_wr, + &bad_send_wr); + if (ret) + ib_mad_send_done_handler(port_priv, wc); + } else + ib_mad_send_done_handler(port_priv, wc); + } else { + struct ib_qp_attr *attr; + + /* Transition QP to RTS and fail offending send */ + attr = kmalloc(sizeof *attr, GFP_KERNEL); + if (attr) { + attr->qp_state = IB_QPS_RTS; + attr->cur_qp_state = IB_QPS_SQE; + ret = ib_modify_qp(qp_info->qp, attr, + IB_QP_STATE | IB_QP_CUR_STATE); + kfree(attr); + if (ret) + printk(KERN_ERR PFX "mad_error_handler - " + "ib_modify_qp to RTS : %d\n", ret); + else + mark_sends_for_retry(qp_info); + } + ib_mad_send_done_handler(port_priv, wc); + } +} + +/* + * IB MAD completion callback + */ +static void ib_mad_completion_handler(void *data) +{ + struct ib_mad_port_private *port_priv; + struct ib_wc wc; + + port_priv = (struct ib_mad_port_private *)data; + ib_req_notify_cq(port_priv->cq, IB_CQ_NEXT_COMP); + + while (ib_poll_cq(port_priv->cq, 1, &wc) == 1) { + if (wc.status == IB_WC_SUCCESS) { + switch (wc.opcode) { + case IB_WC_SEND: + ib_mad_send_done_handler(port_priv, &wc); + break; + case IB_WC_RECV: + ib_mad_recv_done_handler(port_priv, &wc); + break; + default: + BUG_ON(1); + break; + } + } else + mad_error_handler(port_priv, &wc); + } +} + +static void cancel_mads(struct ib_mad_agent_private *mad_agent_priv) +{ + unsigned long flags; + struct ib_mad_send_wr_private *mad_send_wr, *temp_mad_send_wr; + struct ib_mad_send_wc mad_send_wc; + struct list_head cancel_list; + + INIT_LIST_HEAD(&cancel_list); + + spin_lock_irqsave(&mad_agent_priv->lock, flags); + list_for_each_entry_safe(mad_send_wr, temp_mad_send_wr, + &mad_agent_priv->send_list, agent_list) { + if (mad_send_wr->status == IB_WC_SUCCESS) { + mad_send_wr->status = IB_WC_WR_FLUSH_ERR; + mad_send_wr->refcount -= (mad_send_wr->timeout > 0); + } + } + + /* Empty wait list to prevent receives from finding a request */ + list_splice_init(&mad_agent_priv->wait_list, &cancel_list); + spin_unlock_irqrestore(&mad_agent_priv->lock, flags); + + /* Report all cancelled requests */ + mad_send_wc.status = IB_WC_WR_FLUSH_ERR; + mad_send_wc.vendor_err = 0; + + list_for_each_entry_safe(mad_send_wr, temp_mad_send_wr, + &cancel_list, agent_list) { + mad_send_wc.wr_id = mad_send_wr->wr_id; + mad_agent_priv->agent.send_handler(&mad_agent_priv->agent, + &mad_send_wc); + + list_del(&mad_send_wr->agent_list); + kfree(mad_send_wr); + atomic_dec(&mad_agent_priv->refcount); + } +} + +static struct ib_mad_send_wr_private* +find_send_by_wr_id(struct ib_mad_agent_private *mad_agent_priv, + u64 wr_id) +{ + struct ib_mad_send_wr_private *mad_send_wr; + + list_for_each_entry(mad_send_wr, &mad_agent_priv->wait_list, + agent_list) { + if (mad_send_wr->wr_id == wr_id) + return mad_send_wr; + } + + list_for_each_entry(mad_send_wr, &mad_agent_priv->send_list, + agent_list) { + if (mad_send_wr->wr_id == wr_id) + return mad_send_wr; + } + return NULL; +} + +void ib_cancel_mad(struct ib_mad_agent *mad_agent, + u64 wr_id) +{ + struct ib_mad_agent_private *mad_agent_priv; + struct ib_mad_send_wr_private *mad_send_wr; + struct ib_mad_send_wc mad_send_wc; + unsigned long flags; + + mad_agent_priv = container_of(mad_agent, struct ib_mad_agent_private, + agent); + spin_lock_irqsave(&mad_agent_priv->lock, flags); + mad_send_wr = find_send_by_wr_id(mad_agent_priv, wr_id); + if (!mad_send_wr) { + spin_unlock_irqrestore(&mad_agent_priv->lock, flags); + goto out; + } + + if (mad_send_wr->status == IB_WC_SUCCESS) + mad_send_wr->refcount -= (mad_send_wr->timeout > 0); + + if (mad_send_wr->refcount != 0) { + mad_send_wr->status = IB_WC_WR_FLUSH_ERR; + spin_unlock_irqrestore(&mad_agent_priv->lock, flags); + goto out; + } + + list_del(&mad_send_wr->agent_list); + adjust_timeout(mad_agent_priv); + spin_unlock_irqrestore(&mad_agent_priv->lock, flags); + + mad_send_wc.status = IB_WC_WR_FLUSH_ERR; + mad_send_wc.vendor_err = 0; + mad_send_wc.wr_id = mad_send_wr->wr_id; + mad_agent_priv->agent.send_handler(&mad_agent_priv->agent, + &mad_send_wc); + + kfree(mad_send_wr); + if (atomic_dec_and_test(&mad_agent_priv->refcount)) + wake_up(&mad_agent_priv->wait); + +out: + return; +} +EXPORT_SYMBOL(ib_cancel_mad); + +static void local_completions(void *data) +{ + struct ib_mad_agent_private *mad_agent_priv; + struct ib_mad_local_private *local; + unsigned long flags; + struct ib_wc wc; + struct ib_mad_send_wc mad_send_wc; + + mad_agent_priv = (struct ib_mad_agent_private *)data; + + spin_lock_irqsave(&mad_agent_priv->lock, flags); + while (!list_empty(&mad_agent_priv->local_list)) { + local = list_entry(mad_agent_priv->local_list.next, + struct ib_mad_local_private, + completion_list); + spin_unlock_irqrestore(&mad_agent_priv->lock, flags); + if (local->mad_priv) { + /* + * Defined behavior is to complete response + * before request + */ + wc.wr_id = local->wr_id; + wc.status = IB_WC_SUCCESS; + wc.opcode = IB_WC_RECV; + wc.vendor_err = 0; + wc.byte_len = sizeof(struct ib_mad); + wc.src_qp = IB_QP0; + wc.wc_flags = 0; + wc.pkey_index = 0; + wc.slid = IB_LID_PERMISSIVE; + wc.sl = 0; + wc.dlid_path_bits = 0; + local->mad_priv->header.recv_wc.wc = &wc; + local->mad_priv->header.recv_wc.mad_len = + sizeof(struct ib_mad); + INIT_LIST_HEAD(&local->mad_priv->header.recv_wc.recv_buf.list); + local->mad_priv->header.recv_wc.recv_buf.grh = NULL; + local->mad_priv->header.recv_wc.recv_buf.mad = + &local->mad_priv->mad.mad; + if (atomic_read(&mad_agent_priv->qp_info->snoop_count)) + snoop_recv(mad_agent_priv->qp_info, + &local->mad_priv->header.recv_wc, + IB_MAD_SNOOP_RECVS); + mad_agent_priv->agent.recv_handler( + &mad_agent_priv->agent, + &local->mad_priv->header.recv_wc); + } + + /* Complete send */ + mad_send_wc.status = IB_WC_SUCCESS; + mad_send_wc.vendor_err = 0; + mad_send_wc.wr_id = local->wr_id; + if (atomic_read(&mad_agent_priv->qp_info->snoop_count)) + snoop_send(mad_agent_priv->qp_info, &local->send_wr, + &mad_send_wc, + IB_MAD_SNOOP_SEND_COMPLETIONS); + mad_agent_priv->agent.send_handler(&mad_agent_priv->agent, + &mad_send_wc); + + spin_lock_irqsave(&mad_agent_priv->lock, flags); + list_del(&local->completion_list); + atomic_dec(&mad_agent_priv->refcount); + kfree(local); + } + spin_unlock_irqrestore(&mad_agent_priv->lock, flags); +} + +static void timeout_sends(void *data) +{ + struct ib_mad_agent_private *mad_agent_priv; + struct ib_mad_send_wr_private *mad_send_wr; + struct ib_mad_send_wc mad_send_wc; + unsigned long flags, delay; + + mad_agent_priv = (struct ib_mad_agent_private *)data; + + mad_send_wc.status = IB_WC_RESP_TIMEOUT_ERR; + mad_send_wc.vendor_err = 0; + + spin_lock_irqsave(&mad_agent_priv->lock, flags); + while (!list_empty(&mad_agent_priv->wait_list)) { + mad_send_wr = list_entry(mad_agent_priv->wait_list.next, + struct ib_mad_send_wr_private, + agent_list); + + if (time_after(mad_send_wr->timeout, jiffies)) { + delay = mad_send_wr->timeout - jiffies; + if ((long)delay <= 0) + delay = 1; + queue_delayed_work(mad_agent_priv->qp_info-> + port_priv->wq, + &mad_agent_priv->timed_work, delay); + break; + } + + list_del(&mad_send_wr->agent_list); + spin_unlock_irqrestore(&mad_agent_priv->lock, flags); + + mad_send_wc.wr_id = mad_send_wr->wr_id; + mad_agent_priv->agent.send_handler(&mad_agent_priv->agent, + &mad_send_wc); + + kfree(mad_send_wr); + atomic_dec(&mad_agent_priv->refcount); + spin_lock_irqsave(&mad_agent_priv->lock, flags); + } + spin_unlock_irqrestore(&mad_agent_priv->lock, flags); +} + +static void ib_mad_thread_completion_handler(struct ib_cq *cq) +{ + struct ib_mad_port_private *port_priv = cq->cq_context; + + queue_work(port_priv->wq, &port_priv->work); +} + +/* + * Allocate receive MADs and post receive WRs for them + */ +static int ib_mad_post_receive_mads(struct ib_mad_qp_info *qp_info, + struct ib_mad_private *mad) +{ + unsigned long flags; + int post, ret; + struct ib_mad_private *mad_priv; + struct ib_sge sg_list; + struct ib_recv_wr recv_wr, *bad_recv_wr; + struct ib_mad_queue *recv_queue = &qp_info->recv_queue; + + /* Initialize common scatter list fields */ + sg_list.length = sizeof *mad_priv - sizeof mad_priv->header; + sg_list.lkey = (*qp_info->port_priv->mr).lkey; + + /* Initialize common receive WR fields */ + recv_wr.next = NULL; + recv_wr.sg_list = &sg_list; + recv_wr.num_sge = 1; + recv_wr.recv_flags = IB_RECV_SIGNALED; + + do { + /* Allocate and map receive buffer */ + if (mad) { + mad_priv = mad; + mad = NULL; + } else { + mad_priv = kmem_cache_alloc(ib_mad_cache, GFP_KERNEL); + if (!mad_priv) { + printk(KERN_ERR PFX "No memory for receive buffer\n"); + ret = -ENOMEM; + break; + } + } + sg_list.addr = dma_map_single(qp_info->port_priv-> + device->dma_device, + &mad_priv->grh, + sizeof *mad_priv - + sizeof mad_priv->header, + DMA_FROM_DEVICE); + pci_unmap_addr_set(&mad_priv->header, mapping, sg_list.addr); + recv_wr.wr_id = (unsigned long)&mad_priv->header.mad_list; + mad_priv->header.mad_list.mad_queue = recv_queue; + + /* Post receive WR */ + spin_lock_irqsave(&recv_queue->lock, flags); + post = (++recv_queue->count < recv_queue->max_active); + list_add_tail(&mad_priv->header.mad_list.list, &recv_queue->list); + spin_unlock_irqrestore(&recv_queue->lock, flags); + ret = ib_post_recv(qp_info->qp, &recv_wr, &bad_recv_wr); + if (ret) { + spin_lock_irqsave(&recv_queue->lock, flags); + list_del(&mad_priv->header.mad_list.list); + recv_queue->count--; + spin_unlock_irqrestore(&recv_queue->lock, flags); + dma_unmap_single(qp_info->port_priv->device->dma_device, + pci_unmap_addr(&mad_priv->header, + mapping), + sizeof *mad_priv - + sizeof mad_priv->header, + DMA_FROM_DEVICE); + kmem_cache_free(ib_mad_cache, mad_priv); + printk(KERN_ERR PFX "ib_post_recv failed: %d\n", ret); + break; + } + } while (post); + + return ret; +} + +/* + * Return all the posted receive MADs + */ +static void cleanup_recv_queue(struct ib_mad_qp_info *qp_info) +{ + struct ib_mad_private_header *mad_priv_hdr; + struct ib_mad_private *recv; + struct ib_mad_list_head *mad_list; + + while (!list_empty(&qp_info->recv_queue.list)) { + + mad_list = list_entry(qp_info->recv_queue.list.next, + struct ib_mad_list_head, list); + mad_priv_hdr = container_of(mad_list, + struct ib_mad_private_header, + mad_list); + recv = container_of(mad_priv_hdr, struct ib_mad_private, + header); + + /* Remove from posted receive MAD list */ + list_del(&mad_list->list); + + /* Undo PCI mapping */ + dma_unmap_single(qp_info->port_priv->device->dma_device, + pci_unmap_addr(&recv->header, mapping), + sizeof(struct ib_mad_private) - + sizeof(struct ib_mad_private_header), + DMA_FROM_DEVICE); + kmem_cache_free(ib_mad_cache, recv); + } + + qp_info->recv_queue.count = 0; +} + +/* + * Start the port + */ +static int ib_mad_port_start(struct ib_mad_port_private *port_priv) +{ + int ret, i; + struct ib_qp_attr *attr; + struct ib_qp *qp; + + attr = kmalloc(sizeof *attr, GFP_KERNEL); + if (!attr) { + printk(KERN_ERR PFX "Couldn't kmalloc ib_qp_attr\n"); + return -ENOMEM; + } + + for (i = 0; i < IB_MAD_QPS_CORE; i++) { + qp = port_priv->qp_info[i].qp; + /* + * PKey index for QP1 is irrelevant but + * one is needed for the Reset to Init transition + */ + attr->qp_state = IB_QPS_INIT; + attr->pkey_index = 0; + attr->qkey = (qp->qp_num == 0) ? 0 : IB_QP1_QKEY; + ret = ib_modify_qp(qp, attr, IB_QP_STATE | + IB_QP_PKEY_INDEX | IB_QP_QKEY); + if (ret) { + printk(KERN_ERR PFX "Couldn't change QP%d state to " + "INIT: %d\n", i, ret); + goto out; + } + + attr->qp_state = IB_QPS_RTR; + ret = ib_modify_qp(qp, attr, IB_QP_STATE); + if (ret) { + printk(KERN_ERR PFX "Couldn't change QP%d state to " + "RTR: %d\n", i, ret); + goto out; + } + + attr->qp_state = IB_QPS_RTS; + attr->sq_psn = IB_MAD_SEND_Q_PSN; + ret = ib_modify_qp(qp, attr, IB_QP_STATE | IB_QP_SQ_PSN); + if (ret) { + printk(KERN_ERR PFX "Couldn't change QP%d state to " + "RTS: %d\n", i, ret); + goto out; + } + } + + ret = ib_req_notify_cq(port_priv->cq, IB_CQ_NEXT_COMP); + if (ret) { + printk(KERN_ERR PFX "Failed to request completion " + "notification: %d\n", ret); + goto out; + } + + for (i = 0; i < IB_MAD_QPS_CORE; i++) { + ret = ib_mad_post_receive_mads(&port_priv->qp_info[i], NULL); + if (ret) { + printk(KERN_ERR PFX "Couldn't post receive WRs\n"); + goto out; + } + } +out: + kfree(attr); + return ret; +} + +static void qp_event_handler(struct ib_event *event, void *qp_context) +{ + struct ib_mad_qp_info *qp_info = qp_context; + + /* It's worse than that! He's dead, Jim! */ + printk(KERN_ERR PFX "Fatal error (%d) on MAD QP (%d)\n", + event->event, qp_info->qp->qp_num); +} + +static void init_mad_queue(struct ib_mad_qp_info *qp_info, + struct ib_mad_queue *mad_queue) +{ + mad_queue->qp_info = qp_info; + mad_queue->count = 0; + spin_lock_init(&mad_queue->lock); + INIT_LIST_HEAD(&mad_queue->list); +} + +static void init_mad_qp(struct ib_mad_port_private *port_priv, + struct ib_mad_qp_info *qp_info) +{ + qp_info->port_priv = port_priv; + init_mad_queue(qp_info, &qp_info->send_queue); + init_mad_queue(qp_info, &qp_info->recv_queue); + INIT_LIST_HEAD(&qp_info->overflow_list); + spin_lock_init(&qp_info->snoop_lock); + qp_info->snoop_table = NULL; + qp_info->snoop_table_size = 0; + atomic_set(&qp_info->snoop_count, 0); +} + +static int create_mad_qp(struct ib_mad_qp_info *qp_info, + enum ib_qp_type qp_type) +{ + struct ib_qp_init_attr qp_init_attr; + int ret; + + memset(&qp_init_attr, 0, sizeof qp_init_attr); + qp_init_attr.send_cq = qp_info->port_priv->cq; + qp_init_attr.recv_cq = qp_info->port_priv->cq; + qp_init_attr.sq_sig_type = IB_SIGNAL_ALL_WR; + qp_init_attr.rq_sig_type = IB_SIGNAL_ALL_WR; + qp_init_attr.cap.max_send_wr = IB_MAD_QP_SEND_SIZE; + qp_init_attr.cap.max_recv_wr = IB_MAD_QP_RECV_SIZE; + qp_init_attr.cap.max_send_sge = IB_MAD_SEND_REQ_MAX_SG; + qp_init_attr.cap.max_recv_sge = IB_MAD_RECV_REQ_MAX_SG; + qp_init_attr.qp_type = qp_type; + qp_init_attr.port_num = qp_info->port_priv->port_num; + qp_init_attr.qp_context = qp_info; + qp_init_attr.event_handler = qp_event_handler; + qp_info->qp = ib_create_qp(qp_info->port_priv->pd, &qp_init_attr); + if (IS_ERR(qp_info->qp)) { + printk(KERN_ERR PFX "Couldn't create ib_mad QP%d\n", + get_spl_qp_index(qp_type)); + ret = PTR_ERR(qp_info->qp); + goto error; + } + /* Use minimum queue sizes unless the CQ is resized */ + qp_info->send_queue.max_active = IB_MAD_QP_SEND_SIZE; + qp_info->recv_queue.max_active = IB_MAD_QP_RECV_SIZE; + return 0; + +error: + return ret; +} + +static void destroy_mad_qp(struct ib_mad_qp_info *qp_info) +{ + ib_destroy_qp(qp_info->qp); + if (qp_info->snoop_table) + kfree(qp_info->snoop_table); +} + +/* + * Open the port + * Create the QP, PD, MR, and CQ if needed + */ +static int ib_mad_port_open(struct ib_device *device, + int port_num) +{ + int ret, cq_size; + struct ib_mad_port_private *port_priv; + unsigned long flags; + char name[sizeof "ib_mad123"]; + + /* First, check if port already open at MAD layer */ + port_priv = ib_get_mad_port(device, port_num); + if (port_priv) { + printk(KERN_DEBUG PFX "%s port %d already open\n", + device->name, port_num); + return 0; + } + + /* Create new device info */ + port_priv = kmalloc(sizeof *port_priv, GFP_KERNEL); + if (!port_priv) { + printk(KERN_ERR PFX "No memory for ib_mad_port_private\n"); + return -ENOMEM; + } + memset(port_priv, 0, sizeof *port_priv); + port_priv->device = device; + port_priv->port_num = port_num; + spin_lock_init(&port_priv->reg_lock); + INIT_LIST_HEAD(&port_priv->agent_list); + init_mad_qp(port_priv, &port_priv->qp_info[0]); + init_mad_qp(port_priv, &port_priv->qp_info[1]); + + cq_size = (IB_MAD_QP_SEND_SIZE + IB_MAD_QP_RECV_SIZE) * 2; + port_priv->cq = ib_create_cq(port_priv->device, + (ib_comp_handler) + ib_mad_thread_completion_handler, + NULL, port_priv, cq_size); + if (IS_ERR(port_priv->cq)) { + printk(KERN_ERR PFX "Couldn't create ib_mad CQ\n"); + ret = PTR_ERR(port_priv->cq); + goto error3; + } + + port_priv->pd = ib_alloc_pd(device); + if (IS_ERR(port_priv->pd)) { + printk(KERN_ERR PFX "Couldn't create ib_mad PD\n"); + ret = PTR_ERR(port_priv->pd); + goto error4; + } + + port_priv->mr = ib_get_dma_mr(port_priv->pd, IB_ACCESS_LOCAL_WRITE); + if (IS_ERR(port_priv->mr)) { + printk(KERN_ERR PFX "Couldn't get ib_mad DMA MR\n"); + ret = PTR_ERR(port_priv->mr); + goto error5; + } + + ret = create_mad_qp(&port_priv->qp_info[0], IB_QPT_SMI); + if (ret) + goto error6; + ret = create_mad_qp(&port_priv->qp_info[1], IB_QPT_GSI); + if (ret) + goto error7; + + snprintf(name, sizeof name, "ib_mad%d", port_num); + port_priv->wq = create_singlethread_workqueue(name); + if (!port_priv->wq) { + ret = -ENOMEM; + goto error8; + } + INIT_WORK(&port_priv->work, ib_mad_completion_handler, port_priv); + + ret = ib_mad_port_start(port_priv); + if (ret) { + printk(KERN_ERR PFX "Couldn't start port\n"); + goto error9; + } + + spin_lock_irqsave(&ib_mad_port_list_lock, flags); + list_add_tail(&port_priv->port_list, &ib_mad_port_list); + spin_unlock_irqrestore(&ib_mad_port_list_lock, flags); + return 0; + +error9: + destroy_workqueue(port_priv->wq); +error8: + destroy_mad_qp(&port_priv->qp_info[1]); +error7: + destroy_mad_qp(&port_priv->qp_info[0]); +error6: + ib_dereg_mr(port_priv->mr); +error5: + ib_dealloc_pd(port_priv->pd); +error4: + ib_destroy_cq(port_priv->cq); + cleanup_recv_queue(&port_priv->qp_info[1]); + cleanup_recv_queue(&port_priv->qp_info[0]); +error3: + kfree(port_priv); + + return ret; +} + +/* + * Close the port + * If there are no classes using the port, free the port + * resources (CQ, MR, PD, QP) and remove the port's info structure + */ +static int ib_mad_port_close(struct ib_device *device, int port_num) +{ + struct ib_mad_port_private *port_priv; + unsigned long flags; + + spin_lock_irqsave(&ib_mad_port_list_lock, flags); + port_priv = __ib_get_mad_port(device, port_num); + if (port_priv == NULL) { + spin_unlock_irqrestore(&ib_mad_port_list_lock, flags); + printk(KERN_ERR PFX "Port %d not found\n", port_num); + return -ENODEV; + } + list_del(&port_priv->port_list); + spin_unlock_irqrestore(&ib_mad_port_list_lock, flags); + + /* Stop processing completions. */ + flush_workqueue(port_priv->wq); + destroy_workqueue(port_priv->wq); + destroy_mad_qp(&port_priv->qp_info[1]); + destroy_mad_qp(&port_priv->qp_info[0]); + ib_dereg_mr(port_priv->mr); + ib_dealloc_pd(port_priv->pd); + ib_destroy_cq(port_priv->cq); + cleanup_recv_queue(&port_priv->qp_info[1]); + cleanup_recv_queue(&port_priv->qp_info[0]); + /* XXX: Handle deallocation of MAD registration tables */ + + kfree(port_priv); + + return 0; +} + +static void ib_mad_init_device(struct ib_device *device) +{ + int ret, num_ports, cur_port, i, ret2; + + if (device->node_type == IB_NODE_SWITCH) { + num_ports = 1; + cur_port = 0; + } else { + num_ports = device->phys_port_cnt; + cur_port = 1; + } + for (i = 0; i < num_ports; i++, cur_port++) { + ret = ib_mad_port_open(device, cur_port); + if (ret) { + printk(KERN_ERR PFX "Couldn't open %s port %d\n", + device->name, cur_port); + goto error_device_open; + } + ret = ib_agent_port_open(device, cur_port); + if (ret) { + printk(KERN_ERR PFX "Couldn't open %s port %d " + "for agents\n", + device->name, cur_port); + goto error_device_open; + } + } + + goto error_device_query; + +error_device_open: + while (i > 0) { + cur_port--; + ret2 = ib_agent_port_close(device, cur_port); + if (ret2) { + printk(KERN_ERR PFX "Couldn't close %s port %d " + "for agents\n", + device->name, cur_port); + } + ret2 = ib_mad_port_close(device, cur_port); + if (ret2) { + printk(KERN_ERR PFX "Couldn't close %s port %d\n", + device->name, cur_port); + } + i--; + } + +error_device_query: + return; +} + +static void ib_mad_remove_device(struct ib_device *device) +{ + int ret = 0, i, num_ports, cur_port, ret2; + + if (device->node_type == IB_NODE_SWITCH) { + num_ports = 1; + cur_port = 0; + } else { + num_ports = device->phys_port_cnt; + cur_port = 1; + } + for (i = 0; i < num_ports; i++, cur_port++) { + ret2 = ib_agent_port_close(device, cur_port); + if (ret2) { + printk(KERN_ERR PFX "Couldn't close %s port %d " + "for agents\n", + device->name, cur_port); + if (!ret) + ret = ret2; + } + ret2 = ib_mad_port_close(device, cur_port); + if (ret2) { + printk(KERN_ERR PFX "Couldn't close %s port %d\n", + device->name, cur_port); + if (!ret) + ret = ret2; + } + } +} + +static struct ib_client mad_client = { + .name = "mad", + .add = ib_mad_init_device, + .remove = ib_mad_remove_device +}; + +static int __init ib_mad_init_module(void) +{ + int ret; + + spin_lock_init(&ib_mad_port_list_lock); + spin_lock_init(&ib_agent_port_list_lock); + + ib_mad_cache = kmem_cache_create("ib_mad", + sizeof(struct ib_mad_private), + 0, + SLAB_HWCACHE_ALIGN, + NULL, + NULL); + if (!ib_mad_cache) { + printk(KERN_ERR PFX "Couldn't create ib_mad cache\n"); + ret = -ENOMEM; + goto error1; + } + + INIT_LIST_HEAD(&ib_mad_port_list); + + if (ib_register_client(&mad_client)) { + printk(KERN_ERR PFX "Couldn't register ib_mad client\n"); + ret = -EINVAL; + goto error2; + } + + return 0; + +error2: + kmem_cache_destroy(ib_mad_cache); +error1: + return ret; +} + +static void __exit ib_mad_cleanup_module(void) +{ + ib_unregister_client(&mad_client); + + if (kmem_cache_destroy(ib_mad_cache)) { + printk(KERN_DEBUG PFX "Failed to destroy ib_mad cache\n"); + } +} + +module_init(ib_mad_init_module); +module_exit(ib_mad_cleanup_module); diff -Nru a/drivers/infiniband/core/mad_priv.h b/drivers/infiniband/core/mad_priv.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/infiniband/core/mad_priv.h 2005-01-02 23:03:35 -08:00 @@ -0,0 +1,194 @@ +/* + * Copyright (c) 2004, Voltaire, Inc. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * $Id: mad_priv.h 1389 2004-12-27 22:56:47Z roland $ + */ + +#ifndef __IB_MAD_PRIV_H__ +#define __IB_MAD_PRIV_H__ + +#include +#include +#include +#include +#include + + +#define PFX "ib_mad: " + +#define IB_MAD_QPS_CORE 2 /* Always QP0 and QP1 as a minimum */ + +/* QP and CQ parameters */ +#define IB_MAD_QP_SEND_SIZE 128 +#define IB_MAD_QP_RECV_SIZE 512 +#define IB_MAD_SEND_REQ_MAX_SG 2 +#define IB_MAD_RECV_REQ_MAX_SG 1 + +#define IB_MAD_SEND_Q_PSN 0 + +/* Registration table sizes */ +#define MAX_MGMT_CLASS 80 +#define MAX_MGMT_VERSION 8 +#define MAX_MGMT_OUI 8 +#define MAX_MGMT_VENDOR_RANGE2 IB_MGMT_CLASS_VENDOR_RANGE2_END - \ + IB_MGMT_CLASS_VENDOR_RANGE2_START + 1 + +struct ib_mad_list_head { + struct list_head list; + struct ib_mad_queue *mad_queue; +}; + +struct ib_mad_private_header { + struct ib_mad_list_head mad_list; + struct ib_mad_recv_wc recv_wc; + DECLARE_PCI_UNMAP_ADDR(mapping) +} __attribute__ ((packed)); + +struct ib_mad_private { + struct ib_mad_private_header header; + struct ib_grh grh; + union { + struct ib_mad mad; + struct ib_rmpp_mad rmpp_mad; + struct ib_smp smp; + } mad; +} __attribute__ ((packed)); + +struct ib_mad_agent_private { + struct list_head agent_list; + struct ib_mad_agent agent; + struct ib_mad_reg_req *reg_req; + struct ib_mad_qp_info *qp_info; + + spinlock_t lock; + struct list_head send_list; + struct list_head wait_list; + struct work_struct timed_work; + unsigned long timeout; + struct list_head local_list; + struct work_struct local_work; + + atomic_t refcount; + wait_queue_head_t wait; + u8 rmpp_version; +}; + +struct ib_mad_snoop_private { + struct ib_mad_agent agent; + struct ib_mad_qp_info *qp_info; + int snoop_index; + int mad_snoop_flags; + atomic_t refcount; + wait_queue_head_t wait; +}; + +struct ib_mad_send_wr_private { + struct ib_mad_list_head mad_list; + struct list_head agent_list; + struct ib_mad_agent *agent; + struct ib_send_wr send_wr; + struct ib_sge sg_list[IB_MAD_SEND_REQ_MAX_SG]; + u64 wr_id; /* client WR ID */ + u64 tid; + unsigned long timeout; + int retry; + int refcount; + enum ib_wc_status status; +}; + +struct ib_mad_local_private { + struct list_head completion_list; + struct ib_mad_private *mad_priv; + struct ib_send_wr send_wr; + struct ib_sge sg_list[IB_MAD_SEND_REQ_MAX_SG]; + u64 wr_id; /* client WR ID */ + u64 tid; +}; + +struct ib_mad_mgmt_method_table { + struct ib_mad_agent_private *agent[IB_MGMT_MAX_METHODS]; +}; + +struct ib_mad_mgmt_class_table { + struct ib_mad_mgmt_method_table *method_table[MAX_MGMT_CLASS]; +}; + +struct ib_mad_mgmt_vendor_class { + u8 oui[MAX_MGMT_OUI][3]; + struct ib_mad_mgmt_method_table *method_table[MAX_MGMT_OUI]; +}; + +struct ib_mad_mgmt_vendor_class_table { + struct ib_mad_mgmt_vendor_class *vendor_class[MAX_MGMT_VENDOR_RANGE2]; +}; + +struct ib_mad_mgmt_version_table { + struct ib_mad_mgmt_class_table *class; + struct ib_mad_mgmt_vendor_class_table *vendor; +}; + +struct ib_mad_queue { + spinlock_t lock; + struct list_head list; + int count; + int max_active; + struct ib_mad_qp_info *qp_info; +}; + +struct ib_mad_qp_info { + struct ib_mad_port_private *port_priv; + struct ib_qp *qp; + struct ib_mad_queue send_queue; + struct ib_mad_queue recv_queue; + struct list_head overflow_list; + spinlock_t snoop_lock; + struct ib_mad_snoop_private **snoop_table; + int snoop_table_size; + atomic_t snoop_count; +}; + +struct ib_mad_port_private { + struct list_head port_list; + struct ib_device *device; + int port_num; + struct ib_cq *cq; + struct ib_pd *pd; + struct ib_mr *mr; + + spinlock_t reg_lock; + struct ib_mad_mgmt_version_table version[MAX_MGMT_VERSION]; + struct list_head agent_list; + struct workqueue_struct *wq; + struct work_struct work; + struct ib_mad_qp_info qp_info[IB_MAD_QPS_CORE]; +}; + +#endif /* __IB_MAD_PRIV_H__ */ diff -Nru a/drivers/infiniband/core/packer.c b/drivers/infiniband/core/packer.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/infiniband/core/packer.c 2005-01-02 23:03:35 -08:00 @@ -0,0 +1,201 @@ +/* + * Copyright (c) 2004 Topspin Corporation. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * $Id: packer.c 1349 2004-12-16 21:09:43Z roland $ + */ + +#include + +static u64 value_read(int offset, int size, void *structure) +{ + switch (size) { + case 1: return *(u8 *) (structure + offset); + case 2: return be16_to_cpup((__be16 *) (structure + offset)); + case 4: return be32_to_cpup((__be32 *) (structure + offset)); + case 8: return be64_to_cpup((__be64 *) (structure + offset)); + default: + printk(KERN_WARNING "Field size %d bits not handled\n", size * 8); + return 0; + } +} + +/** + * ib_pack - Pack a structure into a buffer + * @desc:Array of structure field descriptions + * @desc_len:Number of entries in @desc + * @structure:Structure to pack from + * @buf:Buffer to pack into + * + * ib_pack() packs a list of structure fields into a buffer, + * controlled by the array of fields in @desc. + */ +void ib_pack(const struct ib_field *desc, + int desc_len, + void *structure, + void *buf) +{ + int i; + + for (i = 0; i < desc_len; ++i) { + if (desc[i].size_bits <= 32) { + int shift; + u32 val; + __be32 mask; + __be32 *addr; + + shift = 32 - desc[i].offset_bits - desc[i].size_bits; + if (desc[i].struct_size_bytes) + val = value_read(desc[i].struct_offset_bytes, + desc[i].struct_size_bytes, + structure) << shift; + else + val = 0; + + mask = cpu_to_be32(((1ull << desc[i].size_bits) - 1) << shift); + addr = (__be32 *) buf + desc[i].offset_words; + *addr = (*addr & ~mask) | (cpu_to_be32(val) & mask); + } else if (desc[i].size_bits <= 64) { + int shift; + u64 val; + __be64 mask; + __be64 *addr; + + shift = 64 - desc[i].offset_bits - desc[i].size_bits; + if (desc[i].struct_size_bytes) + val = value_read(desc[i].struct_offset_bytes, + desc[i].struct_size_bytes, + structure) << shift; + else + val = 0; + + mask = cpu_to_be64(((1ull << desc[i].size_bits) - 1) << shift); + addr = (__be64 *) ((__be32 *) buf + desc[i].offset_words); + *addr = (*addr & ~mask) | (cpu_to_be64(val) & mask); + } else { + if (desc[i].offset_bits % 8 || + desc[i].size_bits % 8) { + printk(KERN_WARNING "Structure field %s of size %d " + "bits is not byte-aligned\n", + desc[i].field_name, desc[i].size_bits); + } + + if (desc[i].struct_size_bytes) + memcpy(buf + desc[i].offset_words * 4 + + desc[i].offset_bits / 8, + structure + desc[i].struct_offset_bytes, + desc[i].size_bits / 8); + else + memset(buf + desc[i].offset_words * 4 + + desc[i].offset_bits / 8, + 0, + desc[i].size_bits / 8); + } + } +} +EXPORT_SYMBOL(ib_pack); + +static void value_write(int offset, int size, u64 val, void *structure) +{ + switch (size * 8) { + case 8: *( u8 *) (structure + offset) = val; break; + case 16: *(__be16 *) (structure + offset) = cpu_to_be16(val); break; + case 32: *(__be32 *) (structure + offset) = cpu_to_be32(val); break; + case 64: *(__be64 *) (structure + offset) = cpu_to_be64(val); break; + default: + printk(KERN_WARNING "Field size %d bits not handled\n", size * 8); + } +} + +/** + * ib_unpack - Unpack a buffer into a structure + * @desc:Array of structure field descriptions + * @desc_len:Number of entries in @desc + * @buf:Buffer to unpack from + * @structure:Structure to unpack into + * + * ib_pack() unpacks a list of structure fields from a buffer, + * controlled by the array of fields in @desc. + */ +void ib_unpack(const struct ib_field *desc, + int desc_len, + void *buf, + void *structure) +{ + int i; + + for (i = 0; i < desc_len; ++i) { + if (!desc[i].struct_size_bytes) + continue; + + if (desc[i].size_bits <= 32) { + int shift; + u32 val; + u32 mask; + __be32 *addr; + + shift = 32 - desc[i].offset_bits - desc[i].size_bits; + mask = ((1ull << desc[i].size_bits) - 1) << shift; + addr = (__be32 *) buf + desc[i].offset_words; + val = (be32_to_cpup(addr) & mask) >> shift; + value_write(desc[i].struct_offset_bytes, + desc[i].struct_size_bytes, + val, + structure); + } else if (desc[i].size_bits <= 64) { + int shift; + u64 val; + u64 mask; + __be64 *addr; + + shift = 64 - desc[i].offset_bits - desc[i].size_bits; + mask = ((1ull << desc[i].size_bits) - 1) << shift; + addr = (__be64 *) buf + desc[i].offset_words; + val = (be64_to_cpup(addr) & mask) >> shift; + value_write(desc[i].struct_offset_bytes, + desc[i].struct_size_bytes, + val, + structure); + } else { + if (desc[i].offset_bits % 8 || + desc[i].size_bits % 8) { + printk(KERN_WARNING "Structure field %s of size %d " + "bits is not byte-aligned\n", + desc[i].field_name, desc[i].size_bits); + } + + memcpy(structure + desc[i].struct_offset_bytes, + buf + desc[i].offset_words * 4 + + desc[i].offset_bits / 8, + desc[i].size_bits / 8); + } + } +} +EXPORT_SYMBOL(ib_unpack); diff -Nru a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/infiniband/core/sa_query.c 2005-01-02 23:03:35 -08:00 @@ -0,0 +1,866 @@ +/* + * Copyright (c) 2004 Topspin Communications. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * $Id: sa_query.c 1389 2004-12-27 22:56:47Z roland $ + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +MODULE_AUTHOR("Roland Dreier"); +MODULE_DESCRIPTION("InfiniBand subnet administration query support"); +MODULE_LICENSE("Dual BSD/GPL"); + +/* + * These two structures must be packed because they have 64-bit fields + * that are only 32-bit aligned. 64-bit architectures will lay them + * out wrong otherwise. (And unfortunately they are sent on the wire + * so we can't change the layout) + */ +struct ib_sa_hdr { + u64 sm_key; + u16 attr_offset; + u16 reserved; + ib_sa_comp_mask comp_mask; +} __attribute__ ((packed)); + +struct ib_sa_mad { + struct ib_mad_hdr mad_hdr; + struct ib_rmpp_hdr rmpp_hdr; + struct ib_sa_hdr sa_hdr; + u8 data[200]; +} __attribute__ ((packed)); + +struct ib_sa_sm_ah { + struct ib_ah *ah; + struct kref ref; +}; + +struct ib_sa_port { + struct ib_mad_agent *agent; + struct ib_mr *mr; + struct ib_sa_sm_ah *sm_ah; + struct work_struct update_task; + spinlock_t ah_lock; + u8 port_num; +}; + +struct ib_sa_device { + int start_port, end_port; + struct ib_event_handler event_handler; + struct ib_sa_port port[0]; +}; + +struct ib_sa_query { + void (*callback)(struct ib_sa_query *, int, struct ib_sa_mad *); + void (*release)(struct ib_sa_query *); + struct ib_sa_port *port; + struct ib_sa_mad *mad; + struct ib_sa_sm_ah *sm_ah; + DECLARE_PCI_UNMAP_ADDR(mapping) + int id; +}; + +struct ib_sa_path_query { + void (*callback)(int, struct ib_sa_path_rec *, void *); + void *context; + struct ib_sa_query sa_query; +}; + +struct ib_sa_mcmember_query { + void (*callback)(int, struct ib_sa_mcmember_rec *, void *); + void *context; + struct ib_sa_query sa_query; +}; + +static void ib_sa_add_one(struct ib_device *device); +static void ib_sa_remove_one(struct ib_device *device); + +static struct ib_client sa_client = { + .name = "sa", + .add = ib_sa_add_one, + .remove = ib_sa_remove_one +}; + +static spinlock_t idr_lock; +static DEFINE_IDR(query_idr); + +static spinlock_t tid_lock; +static u32 tid; + +enum { + IB_SA_ATTR_CLASS_PORTINFO = 0x01, + IB_SA_ATTR_NOTICE = 0x02, + IB_SA_ATTR_INFORM_INFO = 0x03, + IB_SA_ATTR_NODE_REC = 0x11, + IB_SA_ATTR_PORT_INFO_REC = 0x12, + IB_SA_ATTR_SL2VL_REC = 0x13, + IB_SA_ATTR_SWITCH_REC = 0x14, + IB_SA_ATTR_LINEAR_FDB_REC = 0x15, + IB_SA_ATTR_RANDOM_FDB_REC = 0x16, + IB_SA_ATTR_MCAST_FDB_REC = 0x17, + IB_SA_ATTR_SM_INFO_REC = 0x18, + IB_SA_ATTR_LINK_REC = 0x20, + IB_SA_ATTR_GUID_INFO_REC = 0x30, + IB_SA_ATTR_SERVICE_REC = 0x31, + IB_SA_ATTR_PARTITION_REC = 0x33, + IB_SA_ATTR_RANGE_REC = 0x34, + IB_SA_ATTR_PATH_REC = 0x35, + IB_SA_ATTR_VL_ARB_REC = 0x36, + IB_SA_ATTR_MC_GROUP_REC = 0x37, + IB_SA_ATTR_MC_MEMBER_REC = 0x38, + IB_SA_ATTR_TRACE_REC = 0x39, + IB_SA_ATTR_MULTI_PATH_REC = 0x3a, + IB_SA_ATTR_SERVICE_ASSOC_REC = 0x3b +}; + +#define PATH_REC_FIELD(field) \ + .struct_offset_bytes = offsetof(struct ib_sa_path_rec, field), \ + .struct_size_bytes = sizeof ((struct ib_sa_path_rec *) 0)->field, \ + .field_name = "sa_path_rec:" #field + +static const struct ib_field path_rec_table[] = { + { RESERVED, + .offset_words = 0, + .offset_bits = 0, + .size_bits = 32 }, + { RESERVED, + .offset_words = 1, + .offset_bits = 0, + .size_bits = 32 }, + { PATH_REC_FIELD(dgid), + .offset_words = 2, + .offset_bits = 0, + .size_bits = 128 }, + { PATH_REC_FIELD(sgid), + .offset_words = 6, + .offset_bits = 0, + .size_bits = 128 }, + { PATH_REC_FIELD(dlid), + .offset_words = 10, + .offset_bits = 0, + .size_bits = 16 }, + { PATH_REC_FIELD(slid), + .offset_words = 10, + .offset_bits = 16, + .size_bits = 16 }, + { PATH_REC_FIELD(raw_traffic), + .offset_words = 11, + .offset_bits = 0, + .size_bits = 1 }, + { RESERVED, + .offset_words = 11, + .offset_bits = 1, + .size_bits = 3 }, + { PATH_REC_FIELD(flow_label), + .offset_words = 11, + .offset_bits = 4, + .size_bits = 20 }, + { PATH_REC_FIELD(hop_limit), + .offset_words = 11, + .offset_bits = 24, + .size_bits = 8 }, + { PATH_REC_FIELD(traffic_class), + .offset_words = 12, + .offset_bits = 0, + .size_bits = 8 }, + { PATH_REC_FIELD(reversible), + .offset_words = 12, + .offset_bits = 8, + .size_bits = 1 }, + { PATH_REC_FIELD(numb_path), + .offset_words = 12, + .offset_bits = 9, + .size_bits = 7 }, + { PATH_REC_FIELD(pkey), + .offset_words = 12, + .offset_bits = 16, + .size_bits = 16 }, + { RESERVED, + .offset_words = 13, + .offset_bits = 0, + .size_bits = 12 }, + { PATH_REC_FIELD(sl), + .offset_words = 13, + .offset_bits = 12, + .size_bits = 4 }, + { PATH_REC_FIELD(mtu_selector), + .offset_words = 13, + .offset_bits = 16, + .size_bits = 2 }, + { PATH_REC_FIELD(mtu), + .offset_words = 13, + .offset_bits = 18, + .size_bits = 6 }, + { PATH_REC_FIELD(rate_selector), + .offset_words = 13, + .offset_bits = 24, + .size_bits = 2 }, + { PATH_REC_FIELD(rate), + .offset_words = 13, + .offset_bits = 26, + .size_bits = 6 }, + { PATH_REC_FIELD(packet_life_time_selector), + .offset_words = 14, + .offset_bits = 0, + .size_bits = 2 }, + { PATH_REC_FIELD(packet_life_time), + .offset_words = 14, + .offset_bits = 2, + .size_bits = 6 }, + { PATH_REC_FIELD(preference), + .offset_words = 14, + .offset_bits = 8, + .size_bits = 8 }, + { RESERVED, + .offset_words = 14, + .offset_bits = 16, + .size_bits = 48 }, +}; + +#define MCMEMBER_REC_FIELD(field) \ + .struct_offset_bytes = offsetof(struct ib_sa_mcmember_rec, field), \ + .struct_size_bytes = sizeof ((struct ib_sa_mcmember_rec *) 0)->field, \ + .field_name = "sa_mcmember_rec:" #field + +static const struct ib_field mcmember_rec_table[] = { + { MCMEMBER_REC_FIELD(mgid), + .offset_words = 0, + .offset_bits = 0, + .size_bits = 128 }, + { MCMEMBER_REC_FIELD(port_gid), + .offset_words = 4, + .offset_bits = 0, + .size_bits = 128 }, + { MCMEMBER_REC_FIELD(qkey), + .offset_words = 8, + .offset_bits = 0, + .size_bits = 32 }, + { MCMEMBER_REC_FIELD(mlid), + .offset_words = 9, + .offset_bits = 0, + .size_bits = 16 }, + { MCMEMBER_REC_FIELD(mtu_selector), + .offset_words = 9, + .offset_bits = 16, + .size_bits = 2 }, + { MCMEMBER_REC_FIELD(mtu), + .offset_words = 9, + .offset_bits = 18, + .size_bits = 6 }, + { MCMEMBER_REC_FIELD(traffic_class), + .offset_words = 9, + .offset_bits = 24, + .size_bits = 8 }, + { MCMEMBER_REC_FIELD(pkey), + .offset_words = 10, + .offset_bits = 0, + .size_bits = 16 }, + { MCMEMBER_REC_FIELD(rate_selector), + .offset_words = 10, + .offset_bits = 16, + .size_bits = 2 }, + { MCMEMBER_REC_FIELD(rate), + .offset_words = 10, + .offset_bits = 18, + .size_bits = 6 }, + { MCMEMBER_REC_FIELD(packet_life_time_selector), + .offset_words = 10, + .offset_bits = 24, + .size_bits = 2 }, + { MCMEMBER_REC_FIELD(packet_life_time), + .offset_words = 10, + .offset_bits = 26, + .size_bits = 6 }, + { MCMEMBER_REC_FIELD(sl), + .offset_words = 11, + .offset_bits = 0, + .size_bits = 4 }, + { MCMEMBER_REC_FIELD(flow_label), + .offset_words = 11, + .offset_bits = 4, + .size_bits = 20 }, + { MCMEMBER_REC_FIELD(hop_limit), + .offset_words = 11, + .offset_bits = 24, + .size_bits = 8 }, + { MCMEMBER_REC_FIELD(scope), + .offset_words = 12, + .offset_bits = 0, + .size_bits = 4 }, + { MCMEMBER_REC_FIELD(join_state), + .offset_words = 12, + .offset_bits = 4, + .size_bits = 4 }, + { MCMEMBER_REC_FIELD(proxy_join), + .offset_words = 12, + .offset_bits = 8, + .size_bits = 1 }, + { RESERVED, + .offset_words = 12, + .offset_bits = 9, + .size_bits = 23 }, +}; + +static void free_sm_ah(struct kref *kref) +{ + struct ib_sa_sm_ah *sm_ah = container_of(kref, struct ib_sa_sm_ah, ref); + + ib_destroy_ah(sm_ah->ah); + kfree(sm_ah); +} + +static void update_sm_ah(void *port_ptr) +{ + struct ib_sa_port *port = port_ptr; + struct ib_sa_sm_ah *new_ah, *old_ah; + struct ib_port_attr port_attr; + struct ib_ah_attr ah_attr; + + if (ib_query_port(port->agent->device, port->port_num, &port_attr)) { + printk(KERN_WARNING "Couldn't query port\n"); + return; + } + + new_ah = kmalloc(sizeof *new_ah, GFP_KERNEL); + if (!new_ah) { + printk(KERN_WARNING "Couldn't allocate new SM AH\n"); + return; + } + + kref_init(&new_ah->ref); + + memset(&ah_attr, 0, sizeof ah_attr); + ah_attr.dlid = port_attr.sm_lid; + ah_attr.sl = port_attr.sm_sl; + ah_attr.port_num = port->port_num; + + new_ah->ah = ib_create_ah(port->agent->qp->pd, &ah_attr); + if (IS_ERR(new_ah->ah)) { + printk(KERN_WARNING "Couldn't create new SM AH\n"); + kfree(new_ah); + return; + } + + spin_lock_irq(&port->ah_lock); + old_ah = port->sm_ah; + port->sm_ah = new_ah; + spin_unlock_irq(&port->ah_lock); + + if (old_ah) + kref_put(&old_ah->ref, free_sm_ah); +} + +static void ib_sa_event(struct ib_event_handler *handler, struct ib_event *event) +{ + if (event->event == IB_EVENT_PORT_ERR || + event->event == IB_EVENT_PORT_ACTIVE || + event->event == IB_EVENT_LID_CHANGE || + event->event == IB_EVENT_PKEY_CHANGE || + event->event == IB_EVENT_SM_CHANGE) { + struct ib_sa_device *sa_dev = + ib_get_client_data(event->device, &sa_client); + + schedule_work(&sa_dev->port[event->element.port_num - + sa_dev->start_port].update_task); + } +} + +/** + * ib_sa_cancel_query - try to cancel an SA query + * @id:ID of query to cancel + * @query:query pointer to cancel + * + * Try to cancel an SA query. If the id and query don't match up or + * the query has already completed, nothing is done. Otherwise the + * query is canceled and will complete with a status of -EINTR. + */ +void ib_sa_cancel_query(int id, struct ib_sa_query *query) +{ + unsigned long flags; + struct ib_mad_agent *agent; + + spin_lock_irqsave(&idr_lock, flags); + if (idr_find(&query_idr, id) != query) { + spin_unlock_irqrestore(&idr_lock, flags); + return; + } + agent = query->port->agent; + spin_unlock_irqrestore(&idr_lock, flags); + + ib_cancel_mad(agent, id); +} +EXPORT_SYMBOL(ib_sa_cancel_query); + +static void init_mad(struct ib_sa_mad *mad, struct ib_mad_agent *agent) +{ + unsigned long flags; + + memset(mad, 0, sizeof *mad); + + mad->mad_hdr.base_version = IB_MGMT_BASE_VERSION; + mad->mad_hdr.mgmt_class = IB_MGMT_CLASS_SUBN_ADM; + mad->mad_hdr.class_version = IB_SA_CLASS_VERSION; + + spin_lock_irqsave(&tid_lock, flags); + mad->mad_hdr.tid = + cpu_to_be64(((u64) agent->hi_tid) << 32 | tid++); + spin_unlock_irqrestore(&tid_lock, flags); +} + +static int send_mad(struct ib_sa_query *query, int timeout_ms) +{ + struct ib_sa_port *port = query->port; + unsigned long flags; + int ret; + struct ib_sge gather_list; + struct ib_send_wr *bad_wr, wr = { + .opcode = IB_WR_SEND, + .sg_list = &gather_list, + .num_sge = 1, + .send_flags = IB_SEND_SIGNALED, + .wr = { + .ud = { + .mad_hdr = &query->mad->mad_hdr, + .remote_qpn = 1, + .remote_qkey = IB_QP1_QKEY, + .timeout_ms = timeout_ms + } + } + }; + +retry: + if (!idr_pre_get(&query_idr, GFP_ATOMIC)) + return -ENOMEM; + spin_lock_irqsave(&idr_lock, flags); + ret = idr_get_new(&query_idr, query, &query->id); + spin_unlock_irqrestore(&idr_lock, flags); + if (ret == -EAGAIN) + goto retry; + if (ret) + return ret; + + wr.wr_id = query->id; + + spin_lock_irqsave(&port->ah_lock, flags); + kref_get(&port->sm_ah->ref); + query->sm_ah = port->sm_ah; + wr.wr.ud.ah = port->sm_ah->ah; + spin_unlock_irqrestore(&port->ah_lock, flags); + + gather_list.addr = dma_map_single(port->agent->device->dma_device, + query->mad, + sizeof (struct ib_sa_mad), + DMA_TO_DEVICE); + gather_list.length = sizeof (struct ib_sa_mad); + gather_list.lkey = port->mr->lkey; + pci_unmap_addr_set(query, mapping, gather_list.addr); + + ret = ib_post_send_mad(port->agent, &wr, &bad_wr); + if (ret) { + dma_unmap_single(port->agent->device->dma_device, + pci_unmap_addr(query, mapping), + sizeof (struct ib_sa_mad), + DMA_TO_DEVICE); + kref_put(&query->sm_ah->ref, free_sm_ah); + spin_lock_irqsave(&idr_lock, flags); + idr_remove(&query_idr, query->id); + spin_unlock_irqrestore(&idr_lock, flags); + } + + return ret; +} + +static void ib_sa_path_rec_callback(struct ib_sa_query *sa_query, + int status, + struct ib_sa_mad *mad) +{ + struct ib_sa_path_query *query = + container_of(sa_query, struct ib_sa_path_query, sa_query); + + if (mad) { + struct ib_sa_path_rec rec; + + ib_unpack(path_rec_table, ARRAY_SIZE(path_rec_table), + mad->data, &rec); + query->callback(status, &rec, query->context); + } else + query->callback(status, NULL, query->context); +} + +static void ib_sa_path_rec_release(struct ib_sa_query *sa_query) +{ + kfree(sa_query->mad); + kfree(container_of(sa_query, struct ib_sa_path_query, sa_query)); +} + +/** + * ib_sa_path_rec_get - Start a Path get query + * @device:device to send query on + * @port_num: port number to send query on + * @rec:Path Record to send in query + * @comp_mask:component mask to send in query + * @timeout_ms:time to wait for response + * @gfp_mask:GFP mask to use for internal allocations + * @callback:function called when query completes, times out or is + * canceled + * @context:opaque user context passed to callback + * @sa_query:query context, used to cancel query + * + * Send a Path Record Get query to the SA to look up a path. The + * callback function will be called when the query completes (or + * fails); status is 0 for a successful response, -EINTR if the query + * is canceled, -ETIMEDOUT is the query timed out, or -EIO if an error + * occurred sending the query. The resp parameter of the callback is + * only valid if status is 0. + * + * If the return value of ib_sa_path_rec_get() is negative, it is an + * error code. Otherwise it is a query ID that can be used to cancel + * the query. + */ +int ib_sa_path_rec_get(struct ib_device *device, u8 port_num, + struct ib_sa_path_rec *rec, + ib_sa_comp_mask comp_mask, + int timeout_ms, int gfp_mask, + void (*callback)(int status, + struct ib_sa_path_rec *resp, + void *context), + void *context, + struct ib_sa_query **sa_query) +{ + struct ib_sa_path_query *query; + struct ib_sa_device *sa_dev = ib_get_client_data(device, &sa_client); + struct ib_sa_port *port = &sa_dev->port[port_num - sa_dev->start_port]; + struct ib_mad_agent *agent = port->agent; + int ret; + + query = kmalloc(sizeof *query, gfp_mask); + if (!query) + return -ENOMEM; + query->sa_query.mad = kmalloc(sizeof *query->sa_query.mad, gfp_mask); + if (!query->sa_query.mad) { + kfree(query); + return -ENOMEM; + } + + query->callback = callback; + query->context = context; + + init_mad(query->sa_query.mad, agent); + + query->sa_query.callback = ib_sa_path_rec_callback; + query->sa_query.release = ib_sa_path_rec_release; + query->sa_query.port = port; + query->sa_query.mad->mad_hdr.method = IB_MGMT_METHOD_GET; + query->sa_query.mad->mad_hdr.attr_id = cpu_to_be16(IB_SA_ATTR_PATH_REC); + query->sa_query.mad->sa_hdr.comp_mask = comp_mask; + + ib_pack(path_rec_table, ARRAY_SIZE(path_rec_table), + rec, query->sa_query.mad->data); + + *sa_query = &query->sa_query; + ret = send_mad(&query->sa_query, timeout_ms); + if (ret) { + *sa_query = NULL; + kfree(query->sa_query.mad); + kfree(query); + } + + return ret ? ret : query->sa_query.id; +} +EXPORT_SYMBOL(ib_sa_path_rec_get); + +static void ib_sa_mcmember_rec_callback(struct ib_sa_query *sa_query, + int status, + struct ib_sa_mad *mad) +{ + struct ib_sa_mcmember_query *query = + container_of(sa_query, struct ib_sa_mcmember_query, sa_query); + + if (mad) { + struct ib_sa_mcmember_rec rec; + + ib_unpack(mcmember_rec_table, ARRAY_SIZE(mcmember_rec_table), + mad->data, &rec); + query->callback(status, &rec, query->context); + } else + query->callback(status, NULL, query->context); +} + +static void ib_sa_mcmember_rec_release(struct ib_sa_query *sa_query) +{ + kfree(sa_query->mad); + kfree(container_of(sa_query, struct ib_sa_mcmember_query, sa_query)); +} + +int ib_sa_mcmember_rec_query(struct ib_device *device, u8 port_num, + u8 method, + struct ib_sa_mcmember_rec *rec, + ib_sa_comp_mask comp_mask, + int timeout_ms, int gfp_mask, + void (*callback)(int status, + struct ib_sa_mcmember_rec *resp, + void *context), + void *context, + struct ib_sa_query **sa_query) +{ + struct ib_sa_mcmember_query *query; + struct ib_sa_device *sa_dev = ib_get_client_data(device, &sa_client); + struct ib_sa_port *port = &sa_dev->port[port_num - sa_dev->start_port]; + struct ib_mad_agent *agent = port->agent; + int ret; + + query = kmalloc(sizeof *query, gfp_mask); + if (!query) + return -ENOMEM; + query->sa_query.mad = kmalloc(sizeof *query->sa_query.mad, gfp_mask); + if (!query->sa_query.mad) { + kfree(query); + return -ENOMEM; + } + + query->callback = callback; + query->context = context; + + init_mad(query->sa_query.mad, agent); + + query->sa_query.callback = ib_sa_mcmember_rec_callback; + query->sa_query.release = ib_sa_mcmember_rec_release; + query->sa_query.port = port; + query->sa_query.mad->mad_hdr.method = method; + query->sa_query.mad->mad_hdr.attr_id = cpu_to_be16(IB_SA_ATTR_MC_MEMBER_REC); + query->sa_query.mad->sa_hdr.comp_mask = comp_mask; + + ib_pack(mcmember_rec_table, ARRAY_SIZE(mcmember_rec_table), + rec, query->sa_query.mad->data); + + *sa_query = &query->sa_query; + ret = send_mad(&query->sa_query, timeout_ms); + if (ret) { + *sa_query = NULL; + kfree(query->sa_query.mad); + kfree(query); + } + + return ret ? ret : query->sa_query.id; +} +EXPORT_SYMBOL(ib_sa_mcmember_rec_query); + +static void send_handler(struct ib_mad_agent *agent, + struct ib_mad_send_wc *mad_send_wc) +{ + struct ib_sa_query *query; + unsigned long flags; + + spin_lock_irqsave(&idr_lock, flags); + query = idr_find(&query_idr, mad_send_wc->wr_id); + spin_unlock_irqrestore(&idr_lock, flags); + + if (!query) + return; + + switch (mad_send_wc->status) { + case IB_WC_SUCCESS: + /* No callback -- already got recv */ + break; + case IB_WC_RESP_TIMEOUT_ERR: + query->callback(query, -ETIMEDOUT, NULL); + break; + case IB_WC_WR_FLUSH_ERR: + query->callback(query, -EINTR, NULL); + break; + default: + query->callback(query, -EIO, NULL); + break; + } + + dma_unmap_single(agent->device->dma_device, + pci_unmap_addr(query, mapping), + sizeof (struct ib_sa_mad), + DMA_TO_DEVICE); + kref_put(&query->sm_ah->ref, free_sm_ah); + + query->release(query); + + spin_lock_irqsave(&idr_lock, flags); + idr_remove(&query_idr, mad_send_wc->wr_id); + spin_unlock_irqrestore(&idr_lock, flags); +} + +static void recv_handler(struct ib_mad_agent *mad_agent, + struct ib_mad_recv_wc *mad_recv_wc) +{ + struct ib_sa_query *query; + unsigned long flags; + + spin_lock_irqsave(&idr_lock, flags); + query = idr_find(&query_idr, mad_recv_wc->wc->wr_id); + spin_unlock_irqrestore(&idr_lock, flags); + + if (query) { + if (mad_recv_wc->wc->status == IB_WC_SUCCESS) + query->callback(query, + mad_recv_wc->recv_buf.mad->mad_hdr.status ? + -EINVAL : 0, + (struct ib_sa_mad *) mad_recv_wc->recv_buf.mad); + else + query->callback(query, -EIO, NULL); + } + + ib_free_recv_mad(mad_recv_wc); +} + +static void ib_sa_add_one(struct ib_device *device) +{ + struct ib_sa_device *sa_dev; + int s, e, i; + + if (device->node_type == IB_NODE_SWITCH) + s = e = 0; + else { + s = 1; + e = device->phys_port_cnt; + } + + sa_dev = kmalloc(sizeof *sa_dev + + (e - s + 1) * sizeof (struct ib_sa_port), + GFP_KERNEL); + if (!sa_dev) + return; + + sa_dev->start_port = s; + sa_dev->end_port = e; + + for (i = 0; i <= e - s; ++i) { + sa_dev->port[i].mr = NULL; + sa_dev->port[i].sm_ah = NULL; + sa_dev->port[i].port_num = i + s; + spin_lock_init(&sa_dev->port[i].ah_lock); + + sa_dev->port[i].agent = + ib_register_mad_agent(device, i + s, IB_QPT_GSI, + NULL, 0, send_handler, + recv_handler, sa_dev); + if (IS_ERR(sa_dev->port[i].agent)) + goto err; + + sa_dev->port[i].mr = ib_get_dma_mr(sa_dev->port[i].agent->qp->pd, + IB_ACCESS_LOCAL_WRITE); + if (IS_ERR(sa_dev->port[i].mr)) { + ib_unregister_mad_agent(sa_dev->port[i].agent); + goto err; + } + + INIT_WORK(&sa_dev->port[i].update_task, + update_sm_ah, &sa_dev->port[i]); + } + + ib_set_client_data(device, &sa_client, sa_dev); + + /* + * We register our event handler after everything is set up, + * and then update our cached info after the event handler is + * registered to avoid any problems if a port changes state + * during our initialization. + */ + + INIT_IB_EVENT_HANDLER(&sa_dev->event_handler, device, ib_sa_event); + if (ib_register_event_handler(&sa_dev->event_handler)) + goto err; + + for (i = 0; i <= e - s; ++i) + update_sm_ah(&sa_dev->port[i]); + + return; + +err: + while (--i >= 0) { + ib_dereg_mr(sa_dev->port[i].mr); + ib_unregister_mad_agent(sa_dev->port[i].agent); + } + + kfree(sa_dev); + + return; +} + +static void ib_sa_remove_one(struct ib_device *device) +{ + struct ib_sa_device *sa_dev = ib_get_client_data(device, &sa_client); + int i; + + if (!sa_dev) + return; + + ib_unregister_event_handler(&sa_dev->event_handler); + + for (i = 0; i <= sa_dev->end_port - sa_dev->start_port; ++i) { + ib_unregister_mad_agent(sa_dev->port[i].agent); + kref_put(&sa_dev->port[i].sm_ah->ref, free_sm_ah); + } + + kfree(sa_dev); +} + +static int __init ib_sa_init(void) +{ + int ret; + + spin_lock_init(&idr_lock); + spin_lock_init(&tid_lock); + + get_random_bytes(&tid, sizeof tid); + + ret = ib_register_client(&sa_client); + if (ret) + printk(KERN_ERR "Couldn't register ib_sa client\n"); + + return ret; +} + +static void __exit ib_sa_cleanup(void) +{ + ib_unregister_client(&sa_client); +} + +module_init(ib_sa_init); +module_exit(ib_sa_cleanup); diff -Nru a/drivers/infiniband/core/smi.c b/drivers/infiniband/core/smi.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/infiniband/core/smi.c 2005-01-02 23:03:35 -08:00 @@ -0,0 +1,234 @@ +/* + * Copyright (c) 2004 Mellanox Technologies Ltd. All rights reserved. + * Copyright (c) 2004 Infinicon Corporation. All rights reserved. + * Copyright (c) 2004 Intel Corporation. All rights reserved. + * Copyright (c) 2004 Topspin Corporation. All rights reserved. + * Copyright (c) 2004 Voltaire Corporation. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * $Id: smi.c 1389 2004-12-27 22:56:47Z roland $ + */ + +#include + + +/* + * Fixup a directed route SMP for sending + * Return 0 if the SMP should be discarded + */ +int smi_handle_dr_smp_send(struct ib_smp *smp, + u8 node_type, + int port_num) +{ + u8 hop_ptr, hop_cnt; + + hop_ptr = smp->hop_ptr; + hop_cnt = smp->hop_cnt; + + /* See section 14.2.2.2, Vol 1 IB spec */ + if (!ib_get_smp_direction(smp)) { + /* C14-9:1 */ + if (hop_cnt && hop_ptr == 0) { + smp->hop_ptr++; + return (smp->initial_path[smp->hop_ptr] == + port_num); + } + + /* C14-9:2 */ + if (hop_ptr && hop_ptr < hop_cnt) { + if (node_type != IB_NODE_SWITCH) + return 0; + + /* smp->return_path set when received */ + smp->hop_ptr++; + return (smp->initial_path[smp->hop_ptr] == + port_num); + } + + /* C14-9:3 -- We're at the end of the DR segment of path */ + if (hop_ptr == hop_cnt) { + /* smp->return_path set when received */ + smp->hop_ptr++; + return (node_type == IB_NODE_SWITCH || + smp->dr_dlid == IB_LID_PERMISSIVE); + } + + /* C14-9:4 -- hop_ptr = hop_cnt + 1 -> give to SMA/SM */ + /* C14-9:5 -- Fail unreasonable hop pointer */ + return (hop_ptr == hop_cnt + 1); + + } else { + /* C14-13:1 */ + if (hop_cnt && hop_ptr == hop_cnt + 1) { + smp->hop_ptr--; + return (smp->return_path[smp->hop_ptr] == + port_num); + } + + /* C14-13:2 */ + if (2 <= hop_ptr && hop_ptr <= hop_cnt) { + if (node_type != IB_NODE_SWITCH) + return 0; + + smp->hop_ptr--; + return (smp->return_path[smp->hop_ptr] == + port_num); + } + + /* C14-13:3 -- at the end of the DR segment of path */ + if (hop_ptr == 1) { + smp->hop_ptr--; + /* C14-13:3 -- SMPs destined for SM shouldn't be here */ + return (node_type == IB_NODE_SWITCH || + smp->dr_slid == IB_LID_PERMISSIVE); + } + + /* C14-13:4 -- hop_ptr = 0 -> should have gone to SM */ + if (hop_ptr == 0) + return 1; + + /* C14-13:5 -- Check for unreasonable hop pointer */ + return 0; + } +} + +/* + * Adjust information for a received SMP + * Return 0 if the SMP should be dropped + */ +int smi_handle_dr_smp_recv(struct ib_smp *smp, + u8 node_type, + int port_num, + int phys_port_cnt) +{ + u8 hop_ptr, hop_cnt; + + hop_ptr = smp->hop_ptr; + hop_cnt = smp->hop_cnt; + + /* See section 14.2.2.2, Vol 1 IB spec */ + if (!ib_get_smp_direction(smp)) { + /* C14-9:1 -- sender should have incremented hop_ptr */ + if (hop_cnt && hop_ptr == 0) + return 0; + + /* C14-9:2 -- intermediate hop */ + if (hop_ptr && hop_ptr < hop_cnt) { + if (node_type != IB_NODE_SWITCH) + return 0; + + smp->return_path[hop_ptr] = port_num; + /* smp->hop_ptr updated when sending */ + return (smp->initial_path[hop_ptr+1] <= phys_port_cnt); + } + + /* C14-9:3 -- We're at the end of the DR segment of path */ + if (hop_ptr == hop_cnt) { + if (hop_cnt) + smp->return_path[hop_ptr] = port_num; + /* smp->hop_ptr updated when sending */ + + return (node_type == IB_NODE_SWITCH || + smp->dr_dlid == IB_LID_PERMISSIVE); + } + + /* C14-9:4 -- hop_ptr = hop_cnt + 1 -> give to SMA/SM */ + /* C14-9:5 -- fail unreasonable hop pointer */ + return (hop_ptr == hop_cnt + 1); + + } else { + + /* C14-13:1 */ + if (hop_cnt && hop_ptr == hop_cnt + 1) { + smp->hop_ptr--; + return (smp->return_path[smp->hop_ptr] == + port_num); + } + + /* C14-13:2 */ + if (2 <= hop_ptr && hop_ptr <= hop_cnt) { + if (node_type != IB_NODE_SWITCH) + return 0; + + /* smp->hop_ptr updated when sending */ + return (smp->return_path[hop_ptr-1] <= phys_port_cnt); + } + + /* C14-13:3 -- We're at the end of the DR segment of path */ + if (hop_ptr == 1) { + if (smp->dr_slid == IB_LID_PERMISSIVE) { + /* giving SMP to SM - update hop_ptr */ + smp->hop_ptr--; + return 1; + } + /* smp->hop_ptr updated when sending */ + return (node_type == IB_NODE_SWITCH); + } + + /* C14-13:4 -- hop_ptr = 0 -> give to SM */ + /* C14-13:5 -- Check for unreasonable hop pointer */ + return (hop_ptr == 0); + } +} + +/* + * Return 1 if the received DR SMP should be forwarded to the send queue + * Return 0 if the SMP should be completed up the stack + */ +int smi_check_forward_dr_smp(struct ib_smp *smp) +{ + u8 hop_ptr, hop_cnt; + + hop_ptr = smp->hop_ptr; + hop_cnt = smp->hop_cnt; + + if (!ib_get_smp_direction(smp)) { + /* C14-9:2 -- intermediate hop */ + if (hop_ptr && hop_ptr < hop_cnt) + return 1; + + /* C14-9:3 -- at the end of the DR segment of path */ + if (hop_ptr == hop_cnt) + return (smp->dr_dlid == IB_LID_PERMISSIVE); + + /* C14-9:4 -- hop_ptr = hop_cnt + 1 -> give to SMA/SM */ + if (hop_ptr == hop_cnt + 1) + return 1; + } else { + /* C14-13:2 */ + if (2 <= hop_ptr && hop_ptr <= hop_cnt) + return 1; + + /* C14-13:3 -- at the end of the DR segment of path */ + if (hop_ptr == 1) + return (smp->dr_slid != IB_LID_PERMISSIVE); + } + return 0; +} diff -Nru a/drivers/infiniband/core/smi.h b/drivers/infiniband/core/smi.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/infiniband/core/smi.h 2005-01-02 23:03:35 -08:00 @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2004 Mellanox Technologies Ltd. All rights reserved. + * Copyright (c) 2004 Infinicon Corporation. All rights reserved. + * Copyright (c) 2004 Intel Corporation. All rights reserved. + * Copyright (c) 2004 Topspin Corporation. All rights reserved. + * Copyright (c) 2004 Voltaire Corporation. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * $Id: smi.h 1389 2004-12-27 22:56:47Z roland $ + */ + +#ifndef __SMI_H_ +#define __SMI_H_ + +int smi_handle_dr_smp_recv(struct ib_smp *smp, + u8 node_type, + int port_num, + int phys_port_cnt); +extern int smi_check_forward_dr_smp(struct ib_smp *smp); +extern int smi_handle_dr_smp_send(struct ib_smp *smp, + u8 node_type, + int port_num); +extern int smi_check_local_dr_smp(struct ib_smp *smp, + struct ib_device *device, + int port_num); + +/* + * Return 1 if the SMP should be handled by the local SMA/SM via process_mad + */ +static inline int smi_check_local_smp(struct ib_mad_agent *mad_agent, + struct ib_smp *smp) +{ + /* C14-9:3 -- We're at the end of the DR segment of path */ + /* C14-9:4 -- Hop Pointer = Hop Count + 1 -> give to SMA/SM */ + return ((mad_agent->device->process_mad && + !ib_get_smp_direction(smp) && + (smp->hop_ptr == smp->hop_cnt + 1))); +} + +#endif /* __SMI_H_ */ diff -Nru a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/infiniband/core/sysfs.c 2005-01-02 23:03:35 -08:00 @@ -0,0 +1,725 @@ +/* + * Copyright (c) 2004 Topspin Communications. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * $Id: sysfs.c 1349 2004-12-16 21:09:43Z roland $ + */ + +#include "core_priv.h" + +#include + +struct ib_port { + struct kobject kobj; + struct ib_device *ibdev; + struct attribute_group gid_group; + struct attribute **gid_attr; + struct attribute_group pkey_group; + struct attribute **pkey_attr; + u8 port_num; +}; + +struct port_attribute { + struct attribute attr; + ssize_t (*show)(struct ib_port *, struct port_attribute *, char *buf); + ssize_t (*store)(struct ib_port *, struct port_attribute *, + const char *buf, size_t count); +}; + +#define PORT_ATTR(_name, _mode, _show, _store) \ +struct port_attribute port_attr_##_name = __ATTR(_name, _mode, _show, _store) + +#define PORT_ATTR_RO(_name) \ +struct port_attribute port_attr_##_name = __ATTR_RO(_name) + +struct port_table_attribute { + struct port_attribute attr; + int index; +}; + +static ssize_t port_attr_show(struct kobject *kobj, + struct attribute *attr, char *buf) +{ + struct port_attribute *port_attr = + container_of(attr, struct port_attribute, attr); + struct ib_port *p = container_of(kobj, struct ib_port, kobj); + + if (!port_attr->show) + return 0; + + return port_attr->show(p, port_attr, buf); +} + +static struct sysfs_ops port_sysfs_ops = { + .show = port_attr_show +}; + +static ssize_t state_show(struct ib_port *p, struct port_attribute *unused, + char *buf) +{ + struct ib_port_attr attr; + ssize_t ret; + + static const char *state_name[] = { + [IB_PORT_NOP] = "NOP", + [IB_PORT_DOWN] = "DOWN", + [IB_PORT_INIT] = "INIT", + [IB_PORT_ARMED] = "ARMED", + [IB_PORT_ACTIVE] = "ACTIVE", + [IB_PORT_ACTIVE_DEFER] = "ACTIVE_DEFER" + }; + + ret = ib_query_port(p->ibdev, p->port_num, &attr); + if (ret) + return ret; + + return sprintf(buf, "%d: %s\n", attr.state, + attr.state >= 0 && attr.state <= ARRAY_SIZE(state_name) ? + state_name[attr.state] : "UNKNOWN"); +} + +static ssize_t lid_show(struct ib_port *p, struct port_attribute *unused, + char *buf) +{ + struct ib_port_attr attr; + ssize_t ret; + + ret = ib_query_port(p->ibdev, p->port_num, &attr); + if (ret) + return ret; + + return sprintf(buf, "0x%x\n", attr.lid); +} + +static ssize_t lid_mask_count_show(struct ib_port *p, + struct port_attribute *unused, + char *buf) +{ + struct ib_port_attr attr; + ssize_t ret; + + ret = ib_query_port(p->ibdev, p->port_num, &attr); + if (ret) + return ret; + + return sprintf(buf, "%d\n", attr.lmc); +} + +static ssize_t sm_lid_show(struct ib_port *p, struct port_attribute *unused, + char *buf) +{ + struct ib_port_attr attr; + ssize_t ret; + + ret = ib_query_port(p->ibdev, p->port_num, &attr); + if (ret) + return ret; + + return sprintf(buf, "0x%x\n", attr.sm_lid); +} + +static ssize_t sm_sl_show(struct ib_port *p, struct port_attribute *unused, + char *buf) +{ + struct ib_port_attr attr; + ssize_t ret; + + ret = ib_query_port(p->ibdev, p->port_num, &attr); + if (ret) + return ret; + + return sprintf(buf, "%d\n", attr.sm_sl); +} + +static ssize_t cap_mask_show(struct ib_port *p, struct port_attribute *unused, + char *buf) +{ + struct ib_port_attr attr; + ssize_t ret; + + ret = ib_query_port(p->ibdev, p->port_num, &attr); + if (ret) + return ret; + + return sprintf(buf, "0x%08x\n", attr.port_cap_flags); +} + +static ssize_t rate_show(struct ib_port *p, struct port_attribute *unused, + char *buf) +{ + struct ib_port_attr attr; + char *speed = ""; + int rate; + ssize_t ret; + + ret = ib_query_port(p->ibdev, p->port_num, &attr); + if (ret) + return ret; + + switch (attr.active_speed) { + case 2: speed = " DDR"; break; + case 4: speed = " QDR"; break; + } + + printk(KERN_ERR "width %d speed %d\n", attr.active_width, attr.active_speed); + + rate = 25 * ib_width_enum_to_int(attr.active_width) * attr.active_speed; + if (rate < 0) + return -EINVAL; + + return sprintf(buf, "%d%s Gb/sec (%dX%s)\n", + rate / 10, rate % 10 ? ".5" : "", + ib_width_enum_to_int(attr.active_width), speed); +} + +static PORT_ATTR_RO(state); +static PORT_ATTR_RO(lid); +static PORT_ATTR_RO(lid_mask_count); +static PORT_ATTR_RO(sm_lid); +static PORT_ATTR_RO(sm_sl); +static PORT_ATTR_RO(cap_mask); +static PORT_ATTR_RO(rate); + +static struct attribute *port_default_attrs[] = { + &port_attr_state.attr, + &port_attr_lid.attr, + &port_attr_lid_mask_count.attr, + &port_attr_sm_lid.attr, + &port_attr_sm_sl.attr, + &port_attr_cap_mask.attr, + &port_attr_rate.attr, + NULL +}; + +static ssize_t show_port_gid(struct ib_port *p, struct port_attribute *attr, + char *buf) +{ + struct port_table_attribute *tab_attr = + container_of(attr, struct port_table_attribute, attr); + union ib_gid gid; + ssize_t ret; + + ret = ib_query_gid(p->ibdev, p->port_num, tab_attr->index, &gid); + if (ret) + return ret; + + return sprintf(buf, "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n", + be16_to_cpu(((u16 *) gid.raw)[0]), + be16_to_cpu(((u16 *) gid.raw)[1]), + be16_to_cpu(((u16 *) gid.raw)[2]), + be16_to_cpu(((u16 *) gid.raw)[3]), + be16_to_cpu(((u16 *) gid.raw)[4]), + be16_to_cpu(((u16 *) gid.raw)[5]), + be16_to_cpu(((u16 *) gid.raw)[6]), + be16_to_cpu(((u16 *) gid.raw)[7])); +} + +static ssize_t show_port_pkey(struct ib_port *p, struct port_attribute *attr, + char *buf) +{ + struct port_table_attribute *tab_attr = + container_of(attr, struct port_table_attribute, attr); + u16 pkey; + ssize_t ret; + + ret = ib_query_pkey(p->ibdev, p->port_num, tab_attr->index, &pkey); + if (ret) + return ret; + + return sprintf(buf, "0x%04x\n", pkey); +} + +#define PORT_PMA_ATTR(_name, _counter, _width, _offset) \ +struct port_table_attribute port_pma_attr_##_name = { \ + .attr = __ATTR(_name, S_IRUGO, show_pma_counter, NULL), \ + .index = (_offset) | ((_width) << 16) | ((_counter) << 24) \ +} + +static ssize_t show_pma_counter(struct ib_port *p, struct port_attribute *attr, + char *buf) +{ + struct port_table_attribute *tab_attr = + container_of(attr, struct port_table_attribute, attr); + int offset = tab_attr->index & 0xffff; + int width = (tab_attr->index >> 16) & 0xff; + struct ib_mad *in_mad = NULL; + struct ib_mad *out_mad = NULL; + ssize_t ret; + + if (!p->ibdev->process_mad) + return sprintf(buf, "N/A (no PMA)\n"); + + in_mad = kmalloc(sizeof *in_mad, GFP_KERNEL); + out_mad = kmalloc(sizeof *in_mad, GFP_KERNEL); + if (!in_mad || !out_mad) { + ret = -ENOMEM; + goto out; + } + + memset(in_mad, 0, sizeof *in_mad); + in_mad->mad_hdr.base_version = 1; + in_mad->mad_hdr.mgmt_class = IB_MGMT_CLASS_PERF_MGMT; + in_mad->mad_hdr.class_version = 1; + in_mad->mad_hdr.method = IB_MGMT_METHOD_GET; + in_mad->mad_hdr.attr_id = cpu_to_be16(0x12); /* PortCounters */ + + in_mad->data[41] = p->port_num; /* PortSelect field */ + + if ((p->ibdev->process_mad(p->ibdev, IB_MAD_IGNORE_MKEY, p->port_num, 0xffff, + in_mad, out_mad) & + (IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_REPLY)) != + (IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_REPLY)) { + ret = -EINVAL; + goto out; + } + + switch (width) { + case 4: + ret = sprintf(buf, "%u\n", (out_mad->data[40 + offset / 8] >> + (offset % 4)) & 0xf); + break; + case 8: + ret = sprintf(buf, "%u\n", out_mad->data[40 + offset / 8]); + break; + case 16: + ret = sprintf(buf, "%u\n", + be16_to_cpup((u16 *)(out_mad->data + 40 + offset / 8))); + break; + case 32: + ret = sprintf(buf, "%u\n", + be32_to_cpup((u32 *)(out_mad->data + 40 + offset / 8))); + break; + default: + ret = 0; + } + +out: + kfree(in_mad); + kfree(out_mad); + + return ret; +} + +static PORT_PMA_ATTR(symbol_error , 0, 16, 32); +static PORT_PMA_ATTR(link_error_recovery , 1, 8, 48); +static PORT_PMA_ATTR(link_downed , 2, 8, 56); +static PORT_PMA_ATTR(port_rcv_errors , 3, 16, 64); +static PORT_PMA_ATTR(port_rcv_remote_physical_errors, 4, 16, 80); +static PORT_PMA_ATTR(port_rcv_switch_relay_errors , 5, 16, 96); +static PORT_PMA_ATTR(port_xmit_discards , 6, 16, 112); +static PORT_PMA_ATTR(port_xmit_constraint_errors , 7, 8, 128); +static PORT_PMA_ATTR(port_rcv_constraint_errors , 8, 8, 136); +static PORT_PMA_ATTR(local_link_integrity_errors , 9, 4, 152); +static PORT_PMA_ATTR(excessive_buffer_overrun_errors, 10, 4, 156); +static PORT_PMA_ATTR(VL15_dropped , 11, 16, 176); +static PORT_PMA_ATTR(port_xmit_data , 12, 32, 192); +static PORT_PMA_ATTR(port_rcv_data , 13, 32, 224); +static PORT_PMA_ATTR(port_xmit_packets , 14, 32, 256); +static PORT_PMA_ATTR(port_rcv_packets , 15, 32, 288); + +static struct attribute *pma_attrs[] = { + &port_pma_attr_symbol_error.attr.attr, + &port_pma_attr_link_error_recovery.attr.attr, + &port_pma_attr_link_downed.attr.attr, + &port_pma_attr_port_rcv_errors.attr.attr, + &port_pma_attr_port_rcv_remote_physical_errors.attr.attr, + &port_pma_attr_port_rcv_switch_relay_errors.attr.attr, + &port_pma_attr_port_xmit_discards.attr.attr, + &port_pma_attr_port_xmit_constraint_errors.attr.attr, + &port_pma_attr_port_rcv_constraint_errors.attr.attr, + &port_pma_attr_local_link_integrity_errors.attr.attr, + &port_pma_attr_excessive_buffer_overrun_errors.attr.attr, + &port_pma_attr_VL15_dropped.attr.attr, + &port_pma_attr_port_xmit_data.attr.attr, + &port_pma_attr_port_rcv_data.attr.attr, + &port_pma_attr_port_xmit_packets.attr.attr, + &port_pma_attr_port_rcv_packets.attr.attr, + NULL +}; + +static struct attribute_group pma_group = { + .name = "counters", + .attrs = pma_attrs +}; + +static void ib_port_release(struct kobject *kobj) +{ + struct ib_port *p = container_of(kobj, struct ib_port, kobj); + struct attribute *a; + int i; + + for (i = 0; (a = p->gid_attr[i]); ++i) { + kfree(a->name); + kfree(a); + } + + for (i = 0; (a = p->pkey_attr[i]); ++i) { + kfree(a->name); + kfree(a); + } + + kfree(p->gid_attr); + kfree(p); +} + +static struct kobj_type port_type = { + .release = ib_port_release, + .sysfs_ops = &port_sysfs_ops, + .default_attrs = port_default_attrs +}; + +static void ib_device_release(struct class_device *cdev) +{ + struct ib_device *dev = container_of(cdev, struct ib_device, class_dev); + + kfree(dev); +} + +static int ib_device_hotplug(struct class_device *cdev, char **envp, + int num_envp, char *buf, int size) +{ + struct ib_device *dev = container_of(cdev, struct ib_device, class_dev); + int i = 0, len = 0; + + if (add_hotplug_env_var(envp, num_envp, &i, buf, size, &len, + "NAME=%s", dev->name)) + return -ENOMEM; + + /* + * It might be nice to pass the node GUID to hotplug, but + * right now the only way to get it is to query the device + * provider, and this can crash during device removal because + * we are will be running after driver removal has started. + * We could add a node_guid field to struct ib_device, or we + * could just let the hotplug script read the node GUID from + * sysfs when devices are added. + */ + + envp[i] = NULL; + return 0; +} + +static int alloc_group(struct attribute ***attr, + ssize_t (*show)(struct ib_port *, + struct port_attribute *, char *buf), + int len) +{ + struct port_table_attribute ***tab_attr = + (struct port_table_attribute ***) attr; + int i; + int ret; + + *tab_attr = kmalloc((1 + len) * sizeof *tab_attr, GFP_KERNEL); + if (!*tab_attr) + return -ENOMEM; + + memset(*tab_attr, 0, (1 + len) * sizeof *tab_attr); + + for (i = 0; i < len; ++i) { + (*tab_attr)[i] = kmalloc(sizeof *(*tab_attr)[i], GFP_KERNEL); + if (!(*tab_attr)[i]) { + ret = -ENOMEM; + goto err; + } + memset((*tab_attr)[i], 0, sizeof *(*tab_attr)[i]); + (*tab_attr)[i]->attr.attr.name = kmalloc(8, GFP_KERNEL); + if (!(*tab_attr)[i]->attr.attr.name) { + ret = -ENOMEM; + goto err; + } + + if (snprintf((*tab_attr)[i]->attr.attr.name, 8, "%d", i) >= 8) { + ret = -ENOMEM; + goto err; + } + + (*tab_attr)[i]->attr.attr.mode = S_IRUGO; + (*tab_attr)[i]->attr.attr.owner = THIS_MODULE; + (*tab_attr)[i]->attr.show = show; + (*tab_attr)[i]->index = i; + } + + return 0; + +err: + for (i = 0; i < len; ++i) { + if ((*tab_attr)[i]) + kfree((*tab_attr)[i]->attr.attr.name); + kfree((*tab_attr)[i]); + } + + kfree(*tab_attr); + + return ret; +} + +static int add_port(struct ib_device *device, int port_num) +{ + struct ib_port *p; + struct ib_port_attr attr; + int i; + int ret; + + ret = ib_query_port(device, port_num, &attr); + if (ret) + return ret; + + p = kmalloc(sizeof *p, GFP_KERNEL); + if (!p) + return -ENOMEM; + memset(p, 0, sizeof *p); + + p->ibdev = device; + p->port_num = port_num; + p->kobj.ktype = &port_type; + + p->kobj.parent = kobject_get(&device->ports_parent); + if (!p->kobj.parent) { + ret = -EBUSY; + goto err; + } + + ret = kobject_set_name(&p->kobj, "%d", port_num); + if (ret) + goto err_put; + + ret = kobject_register(&p->kobj); + if (ret) + goto err_put; + + ret = sysfs_create_group(&p->kobj, &pma_group); + if (ret) + goto err_put; + + ret = alloc_group(&p->gid_attr, show_port_gid, attr.gid_tbl_len); + if (ret) + goto err_remove_pma; + + p->gid_group.name = "gids"; + p->gid_group.attrs = p->gid_attr; + + ret = sysfs_create_group(&p->kobj, &p->gid_group); + if (ret) + goto err_free_gid; + + ret = alloc_group(&p->pkey_attr, show_port_pkey, attr.pkey_tbl_len); + if (ret) + goto err_remove_gid; + + p->pkey_group.name = "pkeys"; + p->pkey_group.attrs = p->pkey_attr; + + ret = sysfs_create_group(&p->kobj, &p->pkey_group); + if (ret) + goto err_free_pkey; + + list_add_tail(&p->kobj.entry, &device->port_list); + + return 0; + +err_free_pkey: + for (i = 0; i < attr.pkey_tbl_len; ++i) { + kfree(p->pkey_attr[i]->name); + kfree(p->pkey_attr[i]); + } + + kfree(p->pkey_attr); + +err_remove_gid: + sysfs_remove_group(&p->kobj, &p->gid_group); + +err_free_gid: + for (i = 0; i < attr.gid_tbl_len; ++i) { + kfree(p->gid_attr[i]->name); + kfree(p->gid_attr[i]); + } + + kfree(p->gid_attr); + +err_remove_pma: + sysfs_remove_group(&p->kobj, &pma_group); + +err_put: + kobject_put(&device->ports_parent); + +err: + kfree(p); + return ret; +} + +static ssize_t show_sys_image_guid(struct class_device *cdev, char *buf) +{ + struct ib_device *dev = container_of(cdev, struct ib_device, class_dev); + struct ib_device_attr attr; + ssize_t ret; + + ret = ib_query_device(dev, &attr); + if (ret) + return ret; + + return sprintf(buf, "%04x:%04x:%04x:%04x\n", + be16_to_cpu(((u16 *) &attr.sys_image_guid)[0]), + be16_to_cpu(((u16 *) &attr.sys_image_guid)[1]), + be16_to_cpu(((u16 *) &attr.sys_image_guid)[2]), + be16_to_cpu(((u16 *) &attr.sys_image_guid)[3])); +} + +static ssize_t show_node_guid(struct class_device *cdev, char *buf) +{ + struct ib_device *dev = container_of(cdev, struct ib_device, class_dev); + struct ib_device_attr attr; + ssize_t ret; + + ret = ib_query_device(dev, &attr); + if (ret) + return ret; + + return sprintf(buf, "%04x:%04x:%04x:%04x\n", + be16_to_cpu(((u16 *) &attr.node_guid)[0]), + be16_to_cpu(((u16 *) &attr.node_guid)[1]), + be16_to_cpu(((u16 *) &attr.node_guid)[2]), + be16_to_cpu(((u16 *) &attr.node_guid)[3])); +} + +static CLASS_DEVICE_ATTR(sys_image_guid, S_IRUGO, show_sys_image_guid, NULL); +static CLASS_DEVICE_ATTR(node_guid, S_IRUGO, show_node_guid, NULL); + +static struct class_device_attribute *ib_class_attributes[] = { + &class_device_attr_sys_image_guid, + &class_device_attr_node_guid +}; + +static struct class ib_class = { + .name = "infiniband", + .release = ib_device_release, + .hotplug = ib_device_hotplug, +}; + +int ib_device_register_sysfs(struct ib_device *device) +{ + struct class_device *class_dev = &device->class_dev; + int ret; + int i; + + class_dev->class = &ib_class; + class_dev->class_data = device; + strlcpy(class_dev->class_id, device->name, BUS_ID_SIZE); + + INIT_LIST_HEAD(&device->port_list); + + ret = class_device_register(class_dev); + if (ret) + goto err; + + for (i = 0; i < ARRAY_SIZE(ib_class_attributes); ++i) { + ret = class_device_create_file(class_dev, ib_class_attributes[i]); + if (ret) + goto err_unregister; + } + + device->ports_parent.parent = kobject_get(&class_dev->kobj); + if (!device->ports_parent.parent) { + ret = -EBUSY; + goto err_unregister; + } + ret = kobject_set_name(&device->ports_parent, "ports"); + if (ret) + goto err_put; + ret = kobject_register(&device->ports_parent); + if (ret) + goto err_put; + + if (device->node_type == IB_NODE_SWITCH) { + ret = add_port(device, 0); + if (ret) + goto err_put; + } else { + int i; + + for (i = 1; i <= device->phys_port_cnt; ++i) { + ret = add_port(device, i); + if (ret) + goto err_put; + } + } + + return 0; + +err_put: + { + struct kobject *p, *t; + struct ib_port *port; + + list_for_each_entry_safe(p, t, &device->port_list, entry) { + list_del(&p->entry); + port = container_of(p, struct ib_port, kobj); + sysfs_remove_group(p, &pma_group); + sysfs_remove_group(p, &port->pkey_group); + sysfs_remove_group(p, &port->gid_group); + kobject_unregister(p); + } + } + + kobject_put(&class_dev->kobj); + +err_unregister: + class_device_unregister(class_dev); + +err: + return ret; +} + +void ib_device_unregister_sysfs(struct ib_device *device) +{ + struct kobject *p, *t; + struct ib_port *port; + + list_for_each_entry_safe(p, t, &device->port_list, entry) { + list_del(&p->entry); + port = container_of(p, struct ib_port, kobj); + sysfs_remove_group(p, &pma_group); + sysfs_remove_group(p, &port->pkey_group); + sysfs_remove_group(p, &port->gid_group); + kobject_unregister(p); + } + + kobject_unregister(&device->ports_parent); + class_device_unregister(&device->class_dev); +} + +int ib_sysfs_setup(void) +{ + return class_register(&ib_class); +} + +void ib_sysfs_cleanup(void) +{ + class_unregister(&ib_class); +} diff -Nru a/drivers/infiniband/core/ud_header.c b/drivers/infiniband/core/ud_header.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/infiniband/core/ud_header.c 2005-01-02 23:03:35 -08:00 @@ -0,0 +1,365 @@ +/* + * Copyright (c) 2004 Topspin Corporation. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * $Id: ud_header.c 1349 2004-12-16 21:09:43Z roland $ + */ + +#include + +#include + +#define STRUCT_FIELD(header, field) \ + .struct_offset_bytes = offsetof(struct ib_unpacked_ ## header, field), \ + .struct_size_bytes = sizeof ((struct ib_unpacked_ ## header *) 0)->field, \ + .field_name = #header ":" #field + +static const struct ib_field lrh_table[] = { + { STRUCT_FIELD(lrh, virtual_lane), + .offset_words = 0, + .offset_bits = 0, + .size_bits = 4 }, + { STRUCT_FIELD(lrh, link_version), + .offset_words = 0, + .offset_bits = 4, + .size_bits = 4 }, + { STRUCT_FIELD(lrh, service_level), + .offset_words = 0, + .offset_bits = 8, + .size_bits = 4 }, + { RESERVED, + .offset_words = 0, + .offset_bits = 12, + .size_bits = 2 }, + { STRUCT_FIELD(lrh, link_next_header), + .offset_words = 0, + .offset_bits = 14, + .size_bits = 2 }, + { STRUCT_FIELD(lrh, destination_lid), + .offset_words = 0, + .offset_bits = 16, + .size_bits = 16 }, + { RESERVED, + .offset_words = 1, + .offset_bits = 0, + .size_bits = 5 }, + { STRUCT_FIELD(lrh, packet_length), + .offset_words = 1, + .offset_bits = 5, + .size_bits = 11 }, + { STRUCT_FIELD(lrh, source_lid), + .offset_words = 1, + .offset_bits = 16, + .size_bits = 16 } +}; + +static const struct ib_field grh_table[] = { + { STRUCT_FIELD(grh, ip_version), + .offset_words = 0, + .offset_bits = 0, + .size_bits = 4 }, + { STRUCT_FIELD(grh, traffic_class), + .offset_words = 0, + .offset_bits = 4, + .size_bits = 8 }, + { STRUCT_FIELD(grh, flow_label), + .offset_words = 0, + .offset_bits = 12, + .size_bits = 20 }, + { STRUCT_FIELD(grh, payload_length), + .offset_words = 1, + .offset_bits = 0, + .size_bits = 16 }, + { STRUCT_FIELD(grh, next_header), + .offset_words = 1, + .offset_bits = 16, + .size_bits = 8 }, + { STRUCT_FIELD(grh, hop_limit), + .offset_words = 1, + .offset_bits = 24, + .size_bits = 8 }, + { STRUCT_FIELD(grh, source_gid), + .offset_words = 2, + .offset_bits = 0, + .size_bits = 128 }, + { STRUCT_FIELD(grh, destination_gid), + .offset_words = 6, + .offset_bits = 0, + .size_bits = 128 } +}; + +static const struct ib_field bth_table[] = { + { STRUCT_FIELD(bth, opcode), + .offset_words = 0, + .offset_bits = 0, + .size_bits = 8 }, + { STRUCT_FIELD(bth, solicited_event), + .offset_words = 0, + .offset_bits = 8, + .size_bits = 1 }, + { STRUCT_FIELD(bth, mig_req), + .offset_words = 0, + .offset_bits = 9, + .size_bits = 1 }, + { STRUCT_FIELD(bth, pad_count), + .offset_words = 0, + .offset_bits = 10, + .size_bits = 2 }, + { STRUCT_FIELD(bth, transport_header_version), + .offset_words = 0, + .offset_bits = 12, + .size_bits = 4 }, + { STRUCT_FIELD(bth, pkey), + .offset_words = 0, + .offset_bits = 16, + .size_bits = 16 }, + { RESERVED, + .offset_words = 1, + .offset_bits = 0, + .size_bits = 8 }, + { STRUCT_FIELD(bth, destination_qpn), + .offset_words = 1, + .offset_bits = 8, + .size_bits = 24 }, + { STRUCT_FIELD(bth, ack_req), + .offset_words = 2, + .offset_bits = 0, + .size_bits = 1 }, + { RESERVED, + .offset_words = 2, + .offset_bits = 1, + .size_bits = 7 }, + { STRUCT_FIELD(bth, psn), + .offset_words = 2, + .offset_bits = 8, + .size_bits = 24 } +}; + +static const struct ib_field deth_table[] = { + { STRUCT_FIELD(deth, qkey), + .offset_words = 0, + .offset_bits = 0, + .size_bits = 32 }, + { RESERVED, + .offset_words = 1, + .offset_bits = 0, + .size_bits = 8 }, + { STRUCT_FIELD(deth, source_qpn), + .offset_words = 1, + .offset_bits = 8, + .size_bits = 24 } +}; + +/** + * ib_ud_header_init - Initialize UD header structure + * @payload_bytes:Length of packet payload + * @grh_present:GRH flag (if non-zero, GRH will be included) + * @header:Structure to initialize + * + * ib_ud_header_init() initializes the lrh.link_version, lrh.link_next_header, + * lrh.packet_length, grh.ip_version, grh.payload_length, + * grh.next_header, bth.opcode, bth.pad_count and + * bth.transport_header_version fields of a &struct ib_ud_header given + * the payload length and whether a GRH will be included. + */ +void ib_ud_header_init(int payload_bytes, + int grh_present, + struct ib_ud_header *header) +{ + int header_len; + + memset(header, 0, sizeof *header); + + header_len = + IB_LRH_BYTES + + IB_BTH_BYTES + + IB_DETH_BYTES; + if (grh_present) { + header_len += IB_GRH_BYTES; + } + + header->lrh.link_version = 0; + header->lrh.link_next_header = + grh_present ? IB_LNH_IBA_GLOBAL : IB_LNH_IBA_LOCAL; + header->lrh.packet_length = (IB_LRH_BYTES + + IB_BTH_BYTES + + IB_DETH_BYTES + + payload_bytes + + 4 + /* ICRC */ + 3) / 4; /* round up */ + + header->grh_present = grh_present; + if (grh_present) { + header->lrh.packet_length += IB_GRH_BYTES / 4; + + header->grh.ip_version = 6; + header->grh.payload_length = + cpu_to_be16((IB_BTH_BYTES + + IB_DETH_BYTES + + payload_bytes + + 4 + /* ICRC */ + 3) & ~3); /* round up */ + header->grh.next_header = 0x1b; + } + + cpu_to_be16s(&header->lrh.packet_length); + + if (header->immediate_present) + header->bth.opcode = IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE; + else + header->bth.opcode = IB_OPCODE_UD_SEND_ONLY; + header->bth.pad_count = (4 - payload_bytes) & 3; + header->bth.transport_header_version = 0; +} +EXPORT_SYMBOL(ib_ud_header_init); + +/** + * ib_ud_header_pack - Pack UD header struct into wire format + * @header:UD header struct + * @buf:Buffer to pack into + * + * ib_ud_header_pack() packs the UD header structure @header into wire + * format in the buffer @buf. + */ +int ib_ud_header_pack(struct ib_ud_header *header, + void *buf) +{ + int len = 0; + + ib_pack(lrh_table, ARRAY_SIZE(lrh_table), + &header->lrh, buf); + len += IB_LRH_BYTES; + + if (header->grh_present) { + ib_pack(grh_table, ARRAY_SIZE(grh_table), + &header->grh, buf + len); + len += IB_GRH_BYTES; + } + + ib_pack(bth_table, ARRAY_SIZE(bth_table), + &header->bth, buf + len); + len += IB_BTH_BYTES; + + ib_pack(deth_table, ARRAY_SIZE(deth_table), + &header->deth, buf + len); + len += IB_DETH_BYTES; + + if (header->immediate_present) { + memcpy(buf + len, &header->immediate_data, sizeof header->immediate_data); + len += sizeof header->immediate_data; + } + + return len; +} +EXPORT_SYMBOL(ib_ud_header_pack); + +/** + * ib_ud_header_unpack - Unpack UD header struct from wire format + * @header:UD header struct + * @buf:Buffer to pack into + * + * ib_ud_header_pack() unpacks the UD header structure @header from wire + * format in the buffer @buf. + */ +int ib_ud_header_unpack(void *buf, + struct ib_ud_header *header) +{ + ib_unpack(lrh_table, ARRAY_SIZE(lrh_table), + buf, &header->lrh); + buf += IB_LRH_BYTES; + + if (header->lrh.link_version != 0) { + printk(KERN_WARNING "Invalid LRH.link_version %d\n", + header->lrh.link_version); + return -EINVAL; + } + + switch (header->lrh.link_next_header) { + case IB_LNH_IBA_LOCAL: + header->grh_present = 0; + break; + + case IB_LNH_IBA_GLOBAL: + header->grh_present = 1; + ib_unpack(grh_table, ARRAY_SIZE(grh_table), + buf, &header->grh); + buf += IB_GRH_BYTES; + + if (header->grh.ip_version != 6) { + printk(KERN_WARNING "Invalid GRH.ip_version %d\n", + header->grh.ip_version); + return -EINVAL; + } + if (header->grh.next_header != 0x1b) { + printk(KERN_WARNING "Invalid GRH.next_header 0x%02x\n", + header->grh.next_header); + return -EINVAL; + } + break; + + default: + printk(KERN_WARNING "Invalid LRH.link_next_header %d\n", + header->lrh.link_next_header); + return -EINVAL; + } + + ib_unpack(bth_table, ARRAY_SIZE(bth_table), + buf, &header->bth); + buf += IB_BTH_BYTES; + + switch (header->bth.opcode) { + case IB_OPCODE_UD_SEND_ONLY: + header->immediate_present = 0; + break; + case IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE: + header->immediate_present = 1; + break; + default: + printk(KERN_WARNING "Invalid BTH.opcode 0x%02x\n", + header->bth.opcode); + return -EINVAL; + } + + if (header->bth.transport_header_version != 0) { + printk(KERN_WARNING "Invalid BTH.transport_header_version %d\n", + header->bth.transport_header_version); + return -EINVAL; + } + + ib_unpack(deth_table, ARRAY_SIZE(deth_table), + buf, &header->deth); + buf += IB_DETH_BYTES; + + if (header->immediate_present) + memcpy(&header->immediate_data, buf, sizeof header->immediate_data); + + return 0; +} +EXPORT_SYMBOL(ib_ud_header_unpack); diff -Nru a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/infiniband/core/user_mad.c 2005-01-02 23:03:35 -08:00 @@ -0,0 +1,738 @@ +/* + * Copyright (c) 2004 Topspin Communications. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * $Id: user_mad.c 1389 2004-12-27 22:56:47Z roland $ + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +MODULE_AUTHOR("Roland Dreier"); +MODULE_DESCRIPTION("InfiniBand userspace MAD packet access"); +MODULE_LICENSE("Dual BSD/GPL"); + +enum { + IB_UMAD_MAX_PORTS = 256, + IB_UMAD_MAX_AGENTS = 32 +}; + +struct ib_umad_port { + int devnum; + struct cdev dev; + struct class_device class_dev; + struct ib_device *ib_dev; + struct ib_umad_device *umad_dev; + u8 port_num; +}; + +struct ib_umad_device { + int start_port, end_port; + struct kref ref; + struct ib_umad_port port[0]; +}; + +struct ib_umad_file { + struct ib_umad_port *port; + spinlock_t recv_lock; + struct list_head recv_list; + wait_queue_head_t recv_wait; + struct rw_semaphore agent_mutex; + struct ib_mad_agent *agent[IB_UMAD_MAX_AGENTS]; + struct ib_mr *mr[IB_UMAD_MAX_AGENTS]; +}; + +struct ib_umad_packet { + struct ib_user_mad mad; + struct ib_ah *ah; + struct list_head list; + DECLARE_PCI_UNMAP_ADDR(mapping) +}; + +static dev_t base_dev; +static spinlock_t map_lock; +static DECLARE_BITMAP(dev_map, IB_UMAD_MAX_PORTS); + +static void ib_umad_add_one(struct ib_device *device); +static void ib_umad_remove_one(struct ib_device *device); + +static int queue_packet(struct ib_umad_file *file, + struct ib_mad_agent *agent, + struct ib_umad_packet *packet) +{ + int ret = 1; + + down_read(&file->agent_mutex); + for (packet->mad.id = 0; + packet->mad.id < IB_UMAD_MAX_AGENTS; + packet->mad.id++) + if (agent == file->agent[packet->mad.id]) { + spin_lock_irq(&file->recv_lock); + list_add_tail(&packet->list, &file->recv_list); + spin_unlock_irq(&file->recv_lock); + wake_up_interruptible(&file->recv_wait); + ret = 0; + break; + } + + up_read(&file->agent_mutex); + + return ret; +} + +static void send_handler(struct ib_mad_agent *agent, + struct ib_mad_send_wc *send_wc) +{ + struct ib_umad_file *file = agent->context; + struct ib_umad_packet *packet = + (void *) (unsigned long) send_wc->wr_id; + + dma_unmap_single(agent->device->dma_device, + pci_unmap_addr(packet, mapping), + sizeof packet->mad.data, + DMA_TO_DEVICE); + ib_destroy_ah(packet->ah); + + if (send_wc->status == IB_WC_RESP_TIMEOUT_ERR) { + packet->mad.status = ETIMEDOUT; + + if (!queue_packet(file, agent, packet)) + return; + } + + kfree(packet); +} + +static void recv_handler(struct ib_mad_agent *agent, + struct ib_mad_recv_wc *mad_recv_wc) +{ + struct ib_umad_file *file = agent->context; + struct ib_umad_packet *packet; + + if (mad_recv_wc->wc->status != IB_WC_SUCCESS) + goto out; + + packet = kmalloc(sizeof *packet, GFP_KERNEL); + if (!packet) + goto out; + + memset(packet, 0, sizeof *packet); + + memcpy(packet->mad.data, mad_recv_wc->recv_buf.mad, sizeof packet->mad.data); + packet->mad.status = 0; + packet->mad.qpn = cpu_to_be32(mad_recv_wc->wc->src_qp); + packet->mad.lid = cpu_to_be16(mad_recv_wc->wc->slid); + packet->mad.sl = mad_recv_wc->wc->sl; + packet->mad.path_bits = mad_recv_wc->wc->dlid_path_bits; + packet->mad.grh_present = !!(mad_recv_wc->wc->wc_flags & IB_WC_GRH); + if (packet->mad.grh_present) { + /* XXX parse GRH */ + packet->mad.gid_index = 0; + packet->mad.hop_limit = 0; + packet->mad.traffic_class = 0; + memset(packet->mad.gid, 0, 16); + packet->mad.flow_label = 0; + } + + if (queue_packet(file, agent, packet)) + kfree(packet); + +out: + ib_free_recv_mad(mad_recv_wc); +} + +static ssize_t ib_umad_read(struct file *filp, char __user *buf, + size_t count, loff_t *pos) +{ + struct ib_umad_file *file = filp->private_data; + struct ib_umad_packet *packet; + ssize_t ret; + + if (count < sizeof (struct ib_user_mad)) + return -EINVAL; + + spin_lock_irq(&file->recv_lock); + + while (list_empty(&file->recv_list)) { + spin_unlock_irq(&file->recv_lock); + + if (filp->f_flags & O_NONBLOCK) + return -EAGAIN; + + if (wait_event_interruptible(file->recv_wait, + !list_empty(&file->recv_list))) + return -ERESTARTSYS; + + spin_lock_irq(&file->recv_lock); + } + + packet = list_entry(file->recv_list.next, struct ib_umad_packet, list); + list_del(&packet->list); + + spin_unlock_irq(&file->recv_lock); + + if (copy_to_user(buf, &packet->mad, sizeof packet->mad)) + ret = -EFAULT; + else + ret = sizeof packet->mad; + + kfree(packet); + return ret; +} + +static ssize_t ib_umad_write(struct file *filp, const char __user *buf, + size_t count, loff_t *pos) +{ + struct ib_umad_file *file = filp->private_data; + struct ib_umad_packet *packet; + struct ib_mad_agent *agent; + struct ib_ah_attr ah_attr; + struct ib_sge gather_list; + struct ib_send_wr *bad_wr, wr = { + .opcode = IB_WR_SEND, + .sg_list = &gather_list, + .num_sge = 1, + .send_flags = IB_SEND_SIGNALED, + }; + u8 method; + u64 *tid; + int ret; + + if (count < sizeof (struct ib_user_mad)) + return -EINVAL; + + packet = kmalloc(sizeof *packet, GFP_KERNEL); + if (!packet) + return -ENOMEM; + + if (copy_from_user(&packet->mad, buf, sizeof packet->mad)) { + kfree(packet); + return -EFAULT; + } + + if (packet->mad.id < 0 || packet->mad.id >= IB_UMAD_MAX_AGENTS) { + ret = -EINVAL; + goto err; + } + + down_read(&file->agent_mutex); + + agent = file->agent[packet->mad.id]; + if (!agent) { + ret = -EINVAL; + goto err_up; + } + + /* + * If userspace is generating a request that will generate a + * response, we need to make sure the high-order part of the + * transaction ID matches the agent being used to send the + * MAD. + */ + method = ((struct ib_mad_hdr *) packet->mad.data)->method; + + if (!(method & IB_MGMT_METHOD_RESP) && + method != IB_MGMT_METHOD_TRAP_REPRESS && + method != IB_MGMT_METHOD_SEND) { + tid = &((struct ib_mad_hdr *) packet->mad.data)->tid; + *tid = cpu_to_be64(((u64) agent->hi_tid) << 32 | + (be64_to_cpup(tid) & 0xffffffff)); + } + + memset(&ah_attr, 0, sizeof ah_attr); + ah_attr.dlid = be16_to_cpu(packet->mad.lid); + ah_attr.sl = packet->mad.sl; + ah_attr.src_path_bits = packet->mad.path_bits; + ah_attr.port_num = file->port->port_num; + if (packet->mad.grh_present) { + ah_attr.ah_flags = IB_AH_GRH; + memcpy(ah_attr.grh.dgid.raw, packet->mad.gid, 16); + ah_attr.grh.flow_label = packet->mad.flow_label; + ah_attr.grh.hop_limit = packet->mad.hop_limit; + ah_attr.grh.traffic_class = packet->mad.traffic_class; + } + + packet->ah = ib_create_ah(agent->qp->pd, &ah_attr); + if (IS_ERR(packet->ah)) { + ret = PTR_ERR(packet->ah); + goto err_up; + } + + gather_list.addr = dma_map_single(agent->device->dma_device, + packet->mad.data, + sizeof packet->mad.data, + DMA_TO_DEVICE); + gather_list.length = sizeof packet->mad.data; + gather_list.lkey = file->mr[packet->mad.id]->lkey; + pci_unmap_addr_set(packet, mapping, gather_list.addr); + + wr.wr.ud.mad_hdr = (struct ib_mad_hdr *) packet->mad.data; + wr.wr.ud.ah = packet->ah; + wr.wr.ud.remote_qpn = be32_to_cpu(packet->mad.qpn); + wr.wr.ud.remote_qkey = be32_to_cpu(packet->mad.qkey); + wr.wr.ud.timeout_ms = packet->mad.timeout_ms; + + wr.wr_id = (unsigned long) packet; + + ret = ib_post_send_mad(agent, &wr, &bad_wr); + if (ret) { + dma_unmap_single(agent->device->dma_device, + pci_unmap_addr(packet, mapping), + sizeof packet->mad.data, + DMA_TO_DEVICE); + goto err_up; + } + + up_read(&file->agent_mutex); + + return sizeof packet->mad; + +err_up: + up_read(&file->agent_mutex); + +err: + kfree(packet); + return ret; +} + +static unsigned int ib_umad_poll(struct file *filp, struct poll_table_struct *wait) +{ + struct ib_umad_file *file = filp->private_data; + + /* we will always be able to post a MAD send */ + unsigned int mask = POLLOUT | POLLWRNORM; + + poll_wait(filp, &file->recv_wait, wait); + + if (!list_empty(&file->recv_list)) + mask |= POLLIN | POLLRDNORM; + + return mask; +} + +static int ib_umad_reg_agent(struct ib_umad_file *file, unsigned long arg) +{ + struct ib_user_mad_reg_req ureq; + struct ib_mad_reg_req req; + struct ib_mad_agent *agent; + int agent_id; + int ret; + + down_write(&file->agent_mutex); + + if (copy_from_user(&ureq, (void __user *) arg, sizeof ureq)) { + ret = -EFAULT; + goto out; + } + + if (ureq.qpn != 0 && ureq.qpn != 1) { + ret = -EINVAL; + goto out; + } + + for (agent_id = 0; agent_id < IB_UMAD_MAX_AGENTS; ++agent_id) + if (!file->agent[agent_id]) + goto found; + + ret = -ENOMEM; + goto out; + +found: + req.mgmt_class = ureq.mgmt_class; + req.mgmt_class_version = ureq.mgmt_class_version; + memcpy(req.method_mask, ureq.method_mask, sizeof req.method_mask); + memcpy(req.oui, ureq.oui, sizeof req.oui); + + agent = ib_register_mad_agent(file->port->ib_dev, file->port->port_num, + ureq.qpn ? IB_QPT_GSI : IB_QPT_SMI, + &req, 0, send_handler, recv_handler, + file); + if (IS_ERR(agent)) { + ret = PTR_ERR(agent); + goto out; + } + + file->agent[agent_id] = agent; + + file->mr[agent_id] = ib_get_dma_mr(agent->qp->pd, IB_ACCESS_LOCAL_WRITE); + if (IS_ERR(file->mr[agent_id])) { + ret = -ENOMEM; + goto err; + } + + if (put_user(agent_id, + (u32 __user *) (arg + offsetof(struct ib_user_mad_reg_req, id)))) { + ret = -EFAULT; + goto err_mr; + } + + ret = 0; + goto out; + +err_mr: + ib_dereg_mr(file->mr[agent_id]); + +err: + file->agent[agent_id] = NULL; + ib_unregister_mad_agent(agent); + +out: + up_write(&file->agent_mutex); + return ret; +} + +static int ib_umad_unreg_agent(struct ib_umad_file *file, unsigned long arg) +{ + u32 id; + int ret = 0; + + down_write(&file->agent_mutex); + + if (get_user(id, (u32 __user *) arg)) { + ret = -EFAULT; + goto out; + } + + if (id < 0 || id >= IB_UMAD_MAX_AGENTS || !file->agent[id]) { + ret = -EINVAL; + goto out; + } + + ib_dereg_mr(file->mr[id]); + ib_unregister_mad_agent(file->agent[id]); + file->agent[id] = NULL; + +out: + up_write(&file->agent_mutex); + return ret; +} + +static int ib_umad_ioctl(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + switch (cmd) { + case IB_USER_MAD_REGISTER_AGENT: + return ib_umad_reg_agent(filp->private_data, arg); + case IB_USER_MAD_UNREGISTER_AGENT: + return ib_umad_unreg_agent(filp->private_data, arg); + default: + return -ENOIOCTLCMD; + } +} + +static int ib_umad_open(struct inode *inode, struct file *filp) +{ + struct ib_umad_port *port = + container_of(inode->i_cdev, struct ib_umad_port, dev); + struct ib_umad_file *file; + + file = kmalloc(sizeof *file, GFP_KERNEL); + if (!file) + return -ENOMEM; + + memset(file, 0, sizeof *file); + + spin_lock_init(&file->recv_lock); + init_rwsem(&file->agent_mutex); + INIT_LIST_HEAD(&file->recv_list); + init_waitqueue_head(&file->recv_wait); + + file->port = port; + filp->private_data = file; + + return 0; +} + +static int ib_umad_close(struct inode *inode, struct file *filp) +{ + struct ib_umad_file *file = filp->private_data; + int i; + + for (i = 0; i < IB_UMAD_MAX_AGENTS; ++i) + if (file->agent[i]) { + ib_dereg_mr(file->mr[i]); + ib_unregister_mad_agent(file->agent[i]); + } + + kfree(file); + + return 0; +} + +static struct file_operations umad_fops = { + .owner = THIS_MODULE, + .read = ib_umad_read, + .write = ib_umad_write, + .poll = ib_umad_poll, + .ioctl = ib_umad_ioctl, + .open = ib_umad_open, + .release = ib_umad_close +}; + +static struct ib_client umad_client = { + .name = "umad", + .add = ib_umad_add_one, + .remove = ib_umad_remove_one +}; + +static ssize_t show_dev(struct class_device *class_dev, char *buf) +{ + struct ib_umad_port *port = + container_of(class_dev, struct ib_umad_port, class_dev); + + return print_dev_t(buf, port->dev.dev); +} +static CLASS_DEVICE_ATTR(dev, S_IRUGO, show_dev, NULL); + +static ssize_t show_ibdev(struct class_device *class_dev, char *buf) +{ + struct ib_umad_port *port = + container_of(class_dev, struct ib_umad_port, class_dev); + + return sprintf(buf, "%s\n", port->ib_dev->name); +} +static CLASS_DEVICE_ATTR(ibdev, S_IRUGO, show_ibdev, NULL); + +static ssize_t show_port(struct class_device *class_dev, char *buf) +{ + struct ib_umad_port *port = + container_of(class_dev, struct ib_umad_port, class_dev); + + return sprintf(buf, "%d\n", port->port_num); +} +static CLASS_DEVICE_ATTR(port, S_IRUGO, show_port, NULL); + +static void ib_umad_release_dev(struct kref *ref) +{ + struct ib_umad_device *dev = + container_of(ref, struct ib_umad_device, ref); + + kfree(dev); +} + +static void ib_umad_release_port(struct class_device *class_dev) +{ + struct ib_umad_port *port = + container_of(class_dev, struct ib_umad_port, class_dev); + + cdev_del(&port->dev); + clear_bit(port->devnum, dev_map); + kref_put(&port->umad_dev->ref, ib_umad_release_dev); +} + +static struct class umad_class = { + .name = "infiniband_mad", + .release = ib_umad_release_port +}; + +static ssize_t show_abi_version(struct class *class, char *buf) +{ + return sprintf(buf, "%d\n", IB_USER_MAD_ABI_VERSION); +} +static CLASS_ATTR(abi_version, S_IRUGO, show_abi_version, NULL); + +static void ib_umad_add_one(struct ib_device *device) +{ + struct ib_umad_device *umad_dev; + int s, e, i; + + if (device->node_type == IB_NODE_SWITCH) + s = e = 0; + else { + s = 1; + e = device->phys_port_cnt; + } + + umad_dev = kmalloc(sizeof *umad_dev + + (e - s + 1) * sizeof (struct ib_umad_port), + GFP_KERNEL); + if (!umad_dev) + return; + + memset(umad_dev, 0, sizeof *umad_dev + + (e - s + 1) * sizeof (struct ib_umad_port)); + + kref_init(&umad_dev->ref); + + umad_dev->start_port = s; + umad_dev->end_port = e; + + for (i = s; i <= e; ++i) { + umad_dev->port[i - s].umad_dev = umad_dev; + kref_get(&umad_dev->ref); + + spin_lock(&map_lock); + umad_dev->port[i - s].devnum = + find_first_zero_bit(dev_map, IB_UMAD_MAX_PORTS); + if (umad_dev->port[i - s].devnum >= IB_UMAD_MAX_PORTS) { + spin_unlock(&map_lock); + goto err; + } + set_bit(umad_dev->port[i - s].devnum, dev_map); + spin_unlock(&map_lock); + + umad_dev->port[i - s].ib_dev = device; + umad_dev->port[i - s].port_num = i; + + cdev_init(&umad_dev->port[i - s].dev, &umad_fops); + umad_dev->port[i - s].dev.owner = THIS_MODULE; + kobject_set_name(&umad_dev->port[i - s].dev.kobj, + "umad%d", umad_dev->port[i - s].devnum); + if (cdev_add(&umad_dev->port[i - s].dev, base_dev + + umad_dev->port[i - s].devnum, 1)) + goto err; + + umad_dev->port[i - s].class_dev.class = &umad_class; + umad_dev->port[i - s].class_dev.dev = device->dma_device; + snprintf(umad_dev->port[i - s].class_dev.class_id, + BUS_ID_SIZE, "umad%d", umad_dev->port[i - s].devnum); + if (class_device_register(&umad_dev->port[i - s].class_dev)) + goto err_class; + + if (class_device_create_file(&umad_dev->port[i - s].class_dev, + &class_device_attr_dev)) + goto err_class; + if (class_device_create_file(&umad_dev->port[i - s].class_dev, + &class_device_attr_ibdev)) + goto err_class; + if (class_device_create_file(&umad_dev->port[i - s].class_dev, + &class_device_attr_port)) + goto err_class; + } + + ib_set_client_data(device, &umad_client, umad_dev); + + return; + +err_class: + cdev_del(&umad_dev->port[i - s].dev); + clear_bit(umad_dev->port[i - s].devnum, dev_map); + +err: + while (--i >= s) + class_device_unregister(&umad_dev->port[i - s].class_dev); + + kref_put(&umad_dev->ref, ib_umad_release_dev); +} + +static void ib_umad_remove_one(struct ib_device *device) +{ + struct ib_umad_device *umad_dev = ib_get_client_data(device, &umad_client); + int i; + + if (!umad_dev) + return; + + for (i = 0; i <= umad_dev->end_port - umad_dev->start_port; ++i) + class_device_unregister(&umad_dev->port[i].class_dev); + + kref_put(&umad_dev->ref, ib_umad_release_dev); +} + +static int __init ib_umad_init(void) +{ + int ret; + + spin_lock_init(&map_lock); + + ret = alloc_chrdev_region(&base_dev, 0, IB_UMAD_MAX_PORTS, + "infiniband_mad"); + if (ret) { + printk(KERN_ERR "user_mad: couldn't get device number\n"); + goto out; + } + + ret = class_register(&umad_class); + if (ret) { + printk(KERN_ERR "user_mad: couldn't create class infiniband_mad\n"); + goto out_chrdev; + } + + ret = class_create_file(&umad_class, &class_attr_abi_version); + if (ret) { + printk(KERN_ERR "user_mad: couldn't create abi_version attribute\n"); + goto out_class; + } + + ret = ib_register_client(&umad_client); + if (ret) { + printk(KERN_ERR "user_mad: couldn't register ib_umad client\n"); + goto out_class; + } + + /* Our ioctls are 32/64 clean */ + ret = register_ioctl32_conversion(IB_USER_MAD_REGISTER_AGENT, NULL); + ret |= register_ioctl32_conversion(IB_USER_MAD_UNREGISTER_AGENT, NULL); + if (ret) { + printk(KERN_ERR "user_mad: couldn't register ioctl32 conversions\n"); + goto out_client; + } + + return 0; + +out_client: + ib_unregister_client(&umad_client); + +out_class: + class_unregister(&umad_class); + +out_chrdev: + unregister_chrdev_region(base_dev, IB_UMAD_MAX_PORTS); + +out: + return ret; +} + +static void __exit ib_umad_cleanup(void) +{ + unregister_ioctl32_conversion(IB_USER_MAD_REGISTER_AGENT); + unregister_ioctl32_conversion(IB_USER_MAD_UNREGISTER_AGENT); + ib_unregister_client(&umad_client); + class_unregister(&umad_class); + unregister_chrdev_region(base_dev, IB_UMAD_MAX_PORTS); +} + +module_init(ib_umad_init); +module_exit(ib_umad_cleanup); diff -Nru a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/infiniband/core/verbs.c 2005-01-02 23:03:35 -08:00 @@ -0,0 +1,433 @@ +/* + * Copyright (c) 2004 Mellanox Technologies Ltd. All rights reserved. + * Copyright (c) 2004 Infinicon Corporation. All rights reserved. + * Copyright (c) 2004 Intel Corporation. All rights reserved. + * Copyright (c) 2004 Topspin Corporation. All rights reserved. + * Copyright (c) 2004 Voltaire Corporation. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * $Id: verbs.c 1349 2004-12-16 21:09:43Z roland $ + */ + +#include +#include + +#include + +/* Protection domains */ + +struct ib_pd *ib_alloc_pd(struct ib_device *device) +{ + struct ib_pd *pd; + + pd = device->alloc_pd(device); + + if (!IS_ERR(pd)) { + pd->device = device; + atomic_set(&pd->usecnt, 0); + } + + return pd; +} +EXPORT_SYMBOL(ib_alloc_pd); + +int ib_dealloc_pd(struct ib_pd *pd) +{ + if (atomic_read(&pd->usecnt)) + return -EBUSY; + + return pd->device->dealloc_pd(pd); +} +EXPORT_SYMBOL(ib_dealloc_pd); + +/* Address handles */ + +struct ib_ah *ib_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr) +{ + struct ib_ah *ah; + + ah = pd->device->create_ah(pd, ah_attr); + + if (!IS_ERR(ah)) { + ah->device = pd->device; + ah->pd = pd; + atomic_inc(&pd->usecnt); + } + + return ah; +} +EXPORT_SYMBOL(ib_create_ah); + +int ib_modify_ah(struct ib_ah *ah, struct ib_ah_attr *ah_attr) +{ + return ah->device->modify_ah ? + ah->device->modify_ah(ah, ah_attr) : + -ENOSYS; +} +EXPORT_SYMBOL(ib_modify_ah); + +int ib_query_ah(struct ib_ah *ah, struct ib_ah_attr *ah_attr) +{ + return ah->device->query_ah ? + ah->device->query_ah(ah, ah_attr) : + -ENOSYS; +} +EXPORT_SYMBOL(ib_query_ah); + +int ib_destroy_ah(struct ib_ah *ah) +{ + struct ib_pd *pd; + int ret; + + pd = ah->pd; + ret = ah->device->destroy_ah(ah); + if (!ret) + atomic_dec(&pd->usecnt); + + return ret; +} +EXPORT_SYMBOL(ib_destroy_ah); + +/* Queue pairs */ + +struct ib_qp *ib_create_qp(struct ib_pd *pd, + struct ib_qp_init_attr *qp_init_attr) +{ + struct ib_qp *qp; + + qp = pd->device->create_qp(pd, qp_init_attr); + + if (!IS_ERR(qp)) { + qp->device = pd->device; + qp->pd = pd; + qp->send_cq = qp_init_attr->send_cq; + qp->recv_cq = qp_init_attr->recv_cq; + qp->srq = qp_init_attr->srq; + qp->event_handler = qp_init_attr->event_handler; + qp->qp_context = qp_init_attr->qp_context; + atomic_inc(&pd->usecnt); + atomic_inc(&qp_init_attr->send_cq->usecnt); + atomic_inc(&qp_init_attr->recv_cq->usecnt); + if (qp_init_attr->srq) + atomic_inc(&qp_init_attr->srq->usecnt); + } + + return qp; +} +EXPORT_SYMBOL(ib_create_qp); + +int ib_modify_qp(struct ib_qp *qp, + struct ib_qp_attr *qp_attr, + int qp_attr_mask) +{ + return qp->device->modify_qp(qp, qp_attr, qp_attr_mask); +} +EXPORT_SYMBOL(ib_modify_qp); + +int ib_query_qp(struct ib_qp *qp, + struct ib_qp_attr *qp_attr, + int qp_attr_mask, + struct ib_qp_init_attr *qp_init_attr) +{ + return qp->device->query_qp ? + qp->device->query_qp(qp, qp_attr, qp_attr_mask, qp_init_attr) : + -ENOSYS; +} +EXPORT_SYMBOL(ib_query_qp); + +int ib_destroy_qp(struct ib_qp *qp) +{ + struct ib_pd *pd; + struct ib_cq *scq, *rcq; + struct ib_srq *srq; + int ret; + + pd = qp->pd; + scq = qp->send_cq; + rcq = qp->recv_cq; + srq = qp->srq; + + ret = qp->device->destroy_qp(qp); + if (!ret) { + atomic_dec(&pd->usecnt); + atomic_dec(&scq->usecnt); + atomic_dec(&rcq->usecnt); + if (srq) + atomic_dec(&srq->usecnt); + } + + return ret; +} +EXPORT_SYMBOL(ib_destroy_qp); + +/* Completion queues */ + +struct ib_cq *ib_create_cq(struct ib_device *device, + ib_comp_handler comp_handler, + void (*event_handler)(struct ib_event *, void *), + void *cq_context, int cqe) +{ + struct ib_cq *cq; + + cq = device->create_cq(device, cqe); + + if (!IS_ERR(cq)) { + cq->device = device; + cq->comp_handler = comp_handler; + cq->event_handler = event_handler; + cq->cq_context = cq_context; + atomic_set(&cq->usecnt, 0); + } + + return cq; +} +EXPORT_SYMBOL(ib_create_cq); + +int ib_destroy_cq(struct ib_cq *cq) +{ + if (atomic_read(&cq->usecnt)) + return -EBUSY; + + return cq->device->destroy_cq(cq); +} +EXPORT_SYMBOL(ib_destroy_cq); + +int ib_resize_cq(struct ib_cq *cq, + int cqe) +{ + int ret; + + if (!cq->device->resize_cq) + return -ENOSYS; + + ret = cq->device->resize_cq(cq, &cqe); + if (!ret) + cq->cqe = cqe; + + return ret; +} +EXPORT_SYMBOL(ib_resize_cq); + +/* Memory regions */ + +struct ib_mr *ib_get_dma_mr(struct ib_pd *pd, int mr_access_flags) +{ + struct ib_mr *mr; + + mr = pd->device->get_dma_mr(pd, mr_access_flags); + + if (!IS_ERR(mr)) { + mr->device = pd->device; + mr->pd = pd; + atomic_inc(&pd->usecnt); + atomic_set(&mr->usecnt, 0); + } + + return mr; +} +EXPORT_SYMBOL(ib_get_dma_mr); + +struct ib_mr *ib_reg_phys_mr(struct ib_pd *pd, + struct ib_phys_buf *phys_buf_array, + int num_phys_buf, + int mr_access_flags, + u64 *iova_start) +{ + struct ib_mr *mr; + + mr = pd->device->reg_phys_mr(pd, phys_buf_array, num_phys_buf, + mr_access_flags, iova_start); + + if (!IS_ERR(mr)) { + mr->device = pd->device; + mr->pd = pd; + atomic_inc(&pd->usecnt); + atomic_set(&mr->usecnt, 0); + } + + return mr; +} +EXPORT_SYMBOL(ib_reg_phys_mr); + +int ib_rereg_phys_mr(struct ib_mr *mr, + int mr_rereg_mask, + struct ib_pd *pd, + struct ib_phys_buf *phys_buf_array, + int num_phys_buf, + int mr_access_flags, + u64 *iova_start) +{ + struct ib_pd *old_pd; + int ret; + + if (!mr->device->rereg_phys_mr) + return -ENOSYS; + + if (atomic_read(&mr->usecnt)) + return -EBUSY; + + old_pd = mr->pd; + + ret = mr->device->rereg_phys_mr(mr, mr_rereg_mask, pd, + phys_buf_array, num_phys_buf, + mr_access_flags, iova_start); + + if (!ret && (mr_rereg_mask & IB_MR_REREG_PD)) { + atomic_dec(&old_pd->usecnt); + atomic_inc(&pd->usecnt); + } + + return ret; +} +EXPORT_SYMBOL(ib_rereg_phys_mr); + +int ib_query_mr(struct ib_mr *mr, struct ib_mr_attr *mr_attr) +{ + return mr->device->query_mr ? + mr->device->query_mr(mr, mr_attr) : -ENOSYS; +} +EXPORT_SYMBOL(ib_query_mr); + +int ib_dereg_mr(struct ib_mr *mr) +{ + struct ib_pd *pd; + int ret; + + if (atomic_read(&mr->usecnt)) + return -EBUSY; + + pd = mr->pd; + ret = mr->device->dereg_mr(mr); + if (!ret) + atomic_dec(&pd->usecnt); + + return ret; +} +EXPORT_SYMBOL(ib_dereg_mr); + +/* Memory windows */ + +struct ib_mw *ib_alloc_mw(struct ib_pd *pd) +{ + struct ib_mw *mw; + + if (!pd->device->alloc_mw) + return ERR_PTR(-ENOSYS); + + mw = pd->device->alloc_mw(pd); + if (!IS_ERR(mw)) { + mw->device = pd->device; + mw->pd = pd; + atomic_inc(&pd->usecnt); + } + + return mw; +} +EXPORT_SYMBOL(ib_alloc_mw); + +int ib_dealloc_mw(struct ib_mw *mw) +{ + struct ib_pd *pd; + int ret; + + pd = mw->pd; + ret = mw->device->dealloc_mw(mw); + if (!ret) + atomic_dec(&pd->usecnt); + + return ret; +} +EXPORT_SYMBOL(ib_dealloc_mw); + +/* "Fast" memory regions */ + +struct ib_fmr *ib_alloc_fmr(struct ib_pd *pd, + int mr_access_flags, + struct ib_fmr_attr *fmr_attr) +{ + struct ib_fmr *fmr; + + if (!pd->device->alloc_fmr) + return ERR_PTR(-ENOSYS); + + fmr = pd->device->alloc_fmr(pd, mr_access_flags, fmr_attr); + if (!IS_ERR(fmr)) { + fmr->device = pd->device; + fmr->pd = pd; + atomic_inc(&pd->usecnt); + } + + return fmr; +} +EXPORT_SYMBOL(ib_alloc_fmr); + +int ib_unmap_fmr(struct list_head *fmr_list) +{ + struct ib_fmr *fmr; + + if (list_empty(fmr_list)) + return 0; + + fmr = list_entry(fmr_list->next, struct ib_fmr, list); + return fmr->device->unmap_fmr(fmr_list); +} +EXPORT_SYMBOL(ib_unmap_fmr); + +int ib_dealloc_fmr(struct ib_fmr *fmr) +{ + struct ib_pd *pd; + int ret; + + pd = fmr->pd; + ret = fmr->device->dealloc_fmr(fmr); + if (!ret) + atomic_dec(&pd->usecnt); + + return ret; +} +EXPORT_SYMBOL(ib_dealloc_fmr); + +/* Multicast groups */ + +int ib_attach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid) +{ + return qp->device->attach_mcast ? + qp->device->attach_mcast(qp, gid, lid) : + -ENOSYS; +} +EXPORT_SYMBOL(ib_attach_mcast); + +int ib_detach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid) +{ + return qp->device->detach_mcast ? + qp->device->detach_mcast(qp, gid, lid) : + -ENOSYS; +} +EXPORT_SYMBOL(ib_detach_mcast); diff -Nru a/drivers/infiniband/hw/mthca/Kconfig b/drivers/infiniband/hw/mthca/Kconfig --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/infiniband/hw/mthca/Kconfig 2005-01-02 23:03:35 -08:00 @@ -0,0 +1,26 @@ +config INFINIBAND_MTHCA + tristate "Mellanox HCA support" + depends on PCI && INFINIBAND + ---help--- + This is a low-level driver for Mellanox InfiniHost host + channel adapters (HCAs), including the MT23108 PCI-X HCA + ("Tavor") and the MT25208 PCI Express HCA ("Arbel"). + +config INFINIBAND_MTHCA_DEBUG + bool "Verbose debugging output" + depends on INFINIBAND_MTHCA + default n + ---help--- + This option causes the mthca driver produce a bunch of debug + messages. Select this is you are developing the driver or + trying to diagnose a problem. + +config INFINIBAND_MTHCA_SSE_DOORBELL + bool "SSE doorbell code" + depends on INFINIBAND_MTHCA && X86 && !X86_64 + default n + ---help--- + This option will have the mthca driver use SSE instructions + to ring hardware doorbell registers. This may improve + performance for some workloads, but the driver will not run + on processors without SSE instructions. diff -Nru a/drivers/infiniband/hw/mthca/Makefile b/drivers/infiniband/hw/mthca/Makefile --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/infiniband/hw/mthca/Makefile 2005-01-02 23:03:35 -08:00 @@ -0,0 +1,12 @@ +EXTRA_CFLAGS += -Idrivers/infiniband/include + +ifdef CONFIG_INFINIBAND_MTHCA_DEBUG +EXTRA_CFLAGS += -DDEBUG +endif + +obj-$(CONFIG_INFINIBAND_MTHCA) += ib_mthca.o + +ib_mthca-y := mthca_main.o mthca_cmd.o mthca_profile.o mthca_reset.o \ + mthca_allocator.o mthca_eq.o mthca_pd.o mthca_cq.o \ + mthca_mr.o mthca_qp.o mthca_av.o mthca_mcg.o mthca_mad.o \ + mthca_provider.o diff -Nru a/drivers/infiniband/hw/mthca/mthca_allocator.c b/drivers/infiniband/hw/mthca/mthca_allocator.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/infiniband/hw/mthca/mthca_allocator.c 2005-01-02 23:03:35 -08:00 @@ -0,0 +1,179 @@ +/* + * Copyright (c) 2004 Topspin Communications. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * $Id: mthca_allocator.c 1349 2004-12-16 21:09:43Z roland $ + */ + +#include +#include +#include + +#include "mthca_dev.h" + +/* Trivial bitmap-based allocator */ +u32 mthca_alloc(struct mthca_alloc *alloc) +{ + u32 obj; + + spin_lock(&alloc->lock); + obj = find_next_zero_bit(alloc->table, alloc->max, alloc->last); + if (obj >= alloc->max) { + alloc->top = (alloc->top + alloc->max) & alloc->mask; + obj = find_first_zero_bit(alloc->table, alloc->max); + } + + if (obj < alloc->max) { + set_bit(obj, alloc->table); + obj |= alloc->top; + } else + obj = -1; + + spin_unlock(&alloc->lock); + + return obj; +} + +void mthca_free(struct mthca_alloc *alloc, u32 obj) +{ + obj &= alloc->max - 1; + spin_lock(&alloc->lock); + clear_bit(obj, alloc->table); + alloc->last = min(alloc->last, obj); + alloc->top = (alloc->top + alloc->max) & alloc->mask; + spin_unlock(&alloc->lock); +} + +int mthca_alloc_init(struct mthca_alloc *alloc, u32 num, u32 mask, + u32 reserved) +{ + int i; + + /* num must be a power of 2 */ + if (num != 1 << (ffs(num) - 1)) + return -EINVAL; + + alloc->last = 0; + alloc->top = 0; + alloc->max = num; + alloc->mask = mask; + spin_lock_init(&alloc->lock); + alloc->table = kmalloc(BITS_TO_LONGS(num) * sizeof (long), + GFP_KERNEL); + if (!alloc->table) + return -ENOMEM; + + bitmap_zero(alloc->table, num); + for (i = 0; i < reserved; ++i) + set_bit(i, alloc->table); + + return 0; +} + +void mthca_alloc_cleanup(struct mthca_alloc *alloc) +{ + kfree(alloc->table); +} + +/* + * Array of pointers with lazy allocation of leaf pages. Callers of + * _get, _set and _clear methods must use a lock or otherwise + * serialize access to the array. + */ + +void *mthca_array_get(struct mthca_array *array, int index) +{ + int p = (index * sizeof (void *)) >> PAGE_SHIFT; + + if (array->page_list[p].page) { + int i = index & (PAGE_SIZE / sizeof (void *) - 1); + return array->page_list[p].page[i]; + } else + return NULL; +} + +int mthca_array_set(struct mthca_array *array, int index, void *value) +{ + int p = (index * sizeof (void *)) >> PAGE_SHIFT; + + /* Allocate with GFP_ATOMIC because we'll be called with locks held. */ + if (!array->page_list[p].page) + array->page_list[p].page = (void **) get_zeroed_page(GFP_ATOMIC); + + if (!array->page_list[p].page) + return -ENOMEM; + + array->page_list[p].page[index & (PAGE_SIZE / sizeof (void *) - 1)] = + value; + ++array->page_list[p].used; + + return 0; +} + +void mthca_array_clear(struct mthca_array *array, int index) +{ + int p = (index * sizeof (void *)) >> PAGE_SHIFT; + + if (--array->page_list[p].used == 0) { + free_page((unsigned long) array->page_list[p].page); + array->page_list[p].page = NULL; + } + + if (array->page_list[p].used < 0) + pr_debug("Array %p index %d page %d with ref count %d < 0\n", + array, index, p, array->page_list[p].used); +} + +int mthca_array_init(struct mthca_array *array, int nent) +{ + int npage = (nent * sizeof (void *) + PAGE_SIZE - 1) / PAGE_SIZE; + int i; + + array->page_list = kmalloc(npage * sizeof *array->page_list, GFP_KERNEL); + if (!array->page_list) + return -ENOMEM; + + for (i = 0; i < npage; ++i) { + array->page_list[i].page = NULL; + array->page_list[i].used = 0; + } + + return 0; +} + +void mthca_array_cleanup(struct mthca_array *array, int nent) +{ + int i; + + for (i = 0; i < (nent * sizeof (void *) + PAGE_SIZE - 1) / PAGE_SIZE; ++i) + free_page((unsigned long) array->page_list[i].page); + + kfree(array->page_list); +} diff -Nru a/drivers/infiniband/hw/mthca/mthca_av.c b/drivers/infiniband/hw/mthca/mthca_av.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/infiniband/hw/mthca/mthca_av.c 2005-01-02 23:03:35 -08:00 @@ -0,0 +1,219 @@ +/* + * Copyright (c) 2004 Topspin Communications. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * $Id: mthca_av.c 1349 2004-12-16 21:09:43Z roland $ + */ + +#include + +#include +#include + +#include "mthca_dev.h" + +struct mthca_av { + u32 port_pd; + u8 reserved1; + u8 g_slid; + u16 dlid; + u8 reserved2; + u8 gid_index; + u8 msg_sr; + u8 hop_limit; + u32 sl_tclass_flowlabel; + u32 dgid[4]; +}; + +int mthca_create_ah(struct mthca_dev *dev, + struct mthca_pd *pd, + struct ib_ah_attr *ah_attr, + struct mthca_ah *ah) +{ + u32 index = -1; + struct mthca_av *av = NULL; + + ah->on_hca = 0; + + if (!atomic_read(&pd->sqp_count) && + !(dev->mthca_flags & MTHCA_FLAG_DDR_HIDDEN)) { + index = mthca_alloc(&dev->av_table.alloc); + + /* fall back to allocate in host memory */ + if (index == -1) + goto host_alloc; + + av = kmalloc(sizeof *av, GFP_KERNEL); + if (!av) + goto host_alloc; + + ah->on_hca = 1; + ah->avdma = dev->av_table.ddr_av_base + + index * MTHCA_AV_SIZE; + } + + host_alloc: + if (!ah->on_hca) { + ah->av = pci_pool_alloc(dev->av_table.pool, + SLAB_KERNEL, &ah->avdma); + if (!ah->av) + return -ENOMEM; + + av = ah->av; + } + + ah->key = pd->ntmr.ibmr.lkey; + + memset(av, 0, MTHCA_AV_SIZE); + + av->port_pd = cpu_to_be32(pd->pd_num | (ah_attr->port_num << 24)); + av->g_slid = ah_attr->src_path_bits; + av->dlid = cpu_to_be16(ah_attr->dlid); + av->msg_sr = (3 << 4) | /* 2K message */ + ah_attr->static_rate; + av->sl_tclass_flowlabel = cpu_to_be32(ah_attr->sl << 28); + if (ah_attr->ah_flags & IB_AH_GRH) { + av->g_slid |= 0x80; + av->gid_index = (ah_attr->port_num - 1) * dev->limits.gid_table_len + + ah_attr->grh.sgid_index; + av->hop_limit = ah_attr->grh.hop_limit; + av->sl_tclass_flowlabel |= + cpu_to_be32((ah_attr->grh.traffic_class << 20) | + ah_attr->grh.flow_label); + memcpy(av->dgid, ah_attr->grh.dgid.raw, 16); + } else { + /* Arbel workaround -- low byte of GID must be 2 */ + av->dgid[3] = cpu_to_be32(2); + } + + if (0) { + int j; + + mthca_dbg(dev, "Created UDAV at %p/%08lx:\n", + av, (unsigned long) ah->avdma); + for (j = 0; j < 8; ++j) + printk(KERN_DEBUG " [%2x] %08x\n", + j * 4, be32_to_cpu(((u32 *) av)[j])); + } + + if (ah->on_hca) { + memcpy_toio(dev->av_table.av_map + index * MTHCA_AV_SIZE, + av, MTHCA_AV_SIZE); + kfree(av); + } + + return 0; +} + +int mthca_destroy_ah(struct mthca_dev *dev, struct mthca_ah *ah) +{ + if (ah->on_hca) + mthca_free(&dev->av_table.alloc, + (ah->avdma - dev->av_table.ddr_av_base) / + MTHCA_AV_SIZE); + else + pci_pool_free(dev->av_table.pool, ah->av, ah->avdma); + + return 0; +} + +int mthca_read_ah(struct mthca_dev *dev, struct mthca_ah *ah, + struct ib_ud_header *header) +{ + if (ah->on_hca) + return -EINVAL; + + header->lrh.service_level = be32_to_cpu(ah->av->sl_tclass_flowlabel) >> 28; + header->lrh.destination_lid = ah->av->dlid; + header->lrh.source_lid = ah->av->g_slid & 0x7f; + if (ah->av->g_slid & 0x80) { + header->grh_present = 1; + header->grh.traffic_class = + (be32_to_cpu(ah->av->sl_tclass_flowlabel) >> 20) & 0xff; + header->grh.flow_label = + ah->av->sl_tclass_flowlabel & cpu_to_be32(0xfffff); + ib_cached_gid_get(&dev->ib_dev, + be32_to_cpu(ah->av->port_pd) >> 24, + ah->av->gid_index, + &header->grh.source_gid); + memcpy(header->grh.destination_gid.raw, + ah->av->dgid, 16); + } else { + header->grh_present = 0; + } + + return 0; +} + +int __devinit mthca_init_av_table(struct mthca_dev *dev) +{ + int err; + + err = mthca_alloc_init(&dev->av_table.alloc, + dev->av_table.num_ddr_avs, + dev->av_table.num_ddr_avs - 1, + 0); + if (err) + return err; + + dev->av_table.pool = pci_pool_create("mthca_av", dev->pdev, + MTHCA_AV_SIZE, + MTHCA_AV_SIZE, 0); + if (!dev->av_table.pool) + goto out_free_alloc; + + if (!(dev->mthca_flags & MTHCA_FLAG_DDR_HIDDEN)) { + dev->av_table.av_map = ioremap(pci_resource_start(dev->pdev, 4) + + dev->av_table.ddr_av_base - + dev->ddr_start, + dev->av_table.num_ddr_avs * + MTHCA_AV_SIZE); + if (!dev->av_table.av_map) + goto out_free_pool; + } else + dev->av_table.av_map = NULL; + + return 0; + + out_free_pool: + pci_pool_destroy(dev->av_table.pool); + + out_free_alloc: + mthca_alloc_cleanup(&dev->av_table.alloc); + return -ENOMEM; +} + +void __devexit mthca_cleanup_av_table(struct mthca_dev *dev) +{ + if (dev->av_table.av_map) + iounmap(dev->av_table.av_map); + pci_pool_destroy(dev->av_table.pool); + mthca_alloc_cleanup(&dev->av_table.alloc); +} diff -Nru a/drivers/infiniband/hw/mthca/mthca_cmd.c b/drivers/infiniband/hw/mthca/mthca_cmd.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/infiniband/hw/mthca/mthca_cmd.c 2005-01-02 23:03:35 -08:00 @@ -0,0 +1,1573 @@ +/* + * Copyright (c) 2004 Topspin Communications. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * $Id: mthca_cmd.c 1349 2004-12-16 21:09:43Z roland $ + */ + +#include +#include +#include +#include + +#include "mthca_dev.h" +#include "mthca_config_reg.h" +#include "mthca_cmd.h" + +#define CMD_POLL_TOKEN 0xffff + +enum { + HCR_IN_PARAM_OFFSET = 0x00, + HCR_IN_MODIFIER_OFFSET = 0x08, + HCR_OUT_PARAM_OFFSET = 0x0c, + HCR_TOKEN_OFFSET = 0x14, + HCR_STATUS_OFFSET = 0x18, + + HCR_OPMOD_SHIFT = 12, + HCA_E_BIT = 22, + HCR_GO_BIT = 23 +}; + +enum { + /* initialization and general commands */ + CMD_SYS_EN = 0x1, + CMD_SYS_DIS = 0x2, + CMD_MAP_FA = 0xfff, + CMD_UNMAP_FA = 0xffe, + CMD_RUN_FW = 0xff6, + CMD_MOD_STAT_CFG = 0x34, + CMD_QUERY_DEV_LIM = 0x3, + CMD_QUERY_FW = 0x4, + CMD_ENABLE_LAM = 0xff8, + CMD_DISABLE_LAM = 0xff7, + CMD_QUERY_DDR = 0x5, + CMD_QUERY_ADAPTER = 0x6, + CMD_INIT_HCA = 0x7, + CMD_CLOSE_HCA = 0x8, + CMD_INIT_IB = 0x9, + CMD_CLOSE_IB = 0xa, + CMD_QUERY_HCA = 0xb, + CMD_SET_IB = 0xc, + CMD_ACCESS_DDR = 0x2e, + CMD_MAP_ICM = 0xffa, + CMD_UNMAP_ICM = 0xff9, + CMD_MAP_ICM_AUX = 0xffc, + CMD_UNMAP_ICM_AUX = 0xffb, + CMD_SET_ICM_SIZE = 0xffd, + + /* TPT commands */ + CMD_SW2HW_MPT = 0xd, + CMD_QUERY_MPT = 0xe, + CMD_HW2SW_MPT = 0xf, + CMD_READ_MTT = 0x10, + CMD_WRITE_MTT = 0x11, + CMD_SYNC_TPT = 0x2f, + + /* EQ commands */ + CMD_MAP_EQ = 0x12, + CMD_SW2HW_EQ = 0x13, + CMD_HW2SW_EQ = 0x14, + CMD_QUERY_EQ = 0x15, + + /* CQ commands */ + CMD_SW2HW_CQ = 0x16, + CMD_HW2SW_CQ = 0x17, + CMD_QUERY_CQ = 0x18, + CMD_RESIZE_CQ = 0x2c, + + /* SRQ commands */ + CMD_SW2HW_SRQ = 0x35, + CMD_HW2SW_SRQ = 0x36, + CMD_QUERY_SRQ = 0x37, + + /* QP/EE commands */ + CMD_RST2INIT_QPEE = 0x19, + CMD_INIT2RTR_QPEE = 0x1a, + CMD_RTR2RTS_QPEE = 0x1b, + CMD_RTS2RTS_QPEE = 0x1c, + CMD_SQERR2RTS_QPEE = 0x1d, + CMD_2ERR_QPEE = 0x1e, + CMD_RTS2SQD_QPEE = 0x1f, + CMD_SQD2SQD_QPEE = 0x38, + CMD_SQD2RTS_QPEE = 0x20, + CMD_ERR2RST_QPEE = 0x21, + CMD_QUERY_QPEE = 0x22, + CMD_INIT2INIT_QPEE = 0x2d, + CMD_SUSPEND_QPEE = 0x32, + CMD_UNSUSPEND_QPEE = 0x33, + /* special QPs and management commands */ + CMD_CONF_SPECIAL_QP = 0x23, + CMD_MAD_IFC = 0x24, + + /* multicast commands */ + CMD_READ_MGM = 0x25, + CMD_WRITE_MGM = 0x26, + CMD_MGID_HASH = 0x27, + + /* miscellaneous commands */ + CMD_DIAG_RPRT = 0x30, + CMD_NOP = 0x31, + + /* debug commands */ + CMD_QUERY_DEBUG_MSG = 0x2a, + CMD_SET_DEBUG_MSG = 0x2b, +}; + +/* + * According to Mellanox code, FW may be starved and never complete + * commands. So we can't use strict timeouts described in PRM -- we + * just arbitrarily select 60 seconds for now. + */ +#if 0 +/* + * Round up and add 1 to make sure we get the full wait time (since we + * will be starting in the middle of a jiffy) + */ +enum { + CMD_TIME_CLASS_A = (HZ + 999) / 1000 + 1, + CMD_TIME_CLASS_B = (HZ + 99) / 100 + 1, + CMD_TIME_CLASS_C = (HZ + 9) / 10 + 1 +}; +#else +enum { + CMD_TIME_CLASS_A = 60 * HZ, + CMD_TIME_CLASS_B = 60 * HZ, + CMD_TIME_CLASS_C = 60 * HZ +}; +#endif + +enum { + GO_BIT_TIMEOUT = HZ * 10 +}; + +struct mthca_cmd_context { + struct completion done; + struct timer_list timer; + int result; + int next; + u64 out_param; + u16 token; + u8 status; +}; + +static inline int go_bit(struct mthca_dev *dev) +{ + return readl(dev->hcr + HCR_STATUS_OFFSET) & + swab32(1 << HCR_GO_BIT); +} + +static int mthca_cmd_post(struct mthca_dev *dev, + u64 in_param, + u64 out_param, + u32 in_modifier, + u8 op_modifier, + u16 op, + u16 token, + int event) +{ + int err = 0; + + if (down_interruptible(&dev->cmd.hcr_sem)) + return -EINTR; + + if (event) { + unsigned long end = jiffies + GO_BIT_TIMEOUT; + + while (go_bit(dev) && time_before(jiffies, end)) { + set_current_state(TASK_RUNNING); + schedule(); + } + } + + if (go_bit(dev)) { + err = -EAGAIN; + goto out; + } + + /* + * We use writel (instead of something like memcpy_toio) + * because writes of less than 32 bits to the HCR don't work + * (and some architectures such as ia64 implement memcpy_toio + * in terms of writeb). + */ + __raw_writel(cpu_to_be32(in_param >> 32), dev->hcr + 0 * 4); + __raw_writel(cpu_to_be32(in_param & 0xfffffffful), dev->hcr + 1 * 4); + __raw_writel(cpu_to_be32(in_modifier), dev->hcr + 2 * 4); + __raw_writel(cpu_to_be32(out_param >> 32), dev->hcr + 3 * 4); + __raw_writel(cpu_to_be32(out_param & 0xfffffffful), dev->hcr + 4 * 4); + __raw_writel(cpu_to_be32(token << 16), dev->hcr + 5 * 4); + + /* __raw_writel may not order writes. */ + wmb(); + + __raw_writel(cpu_to_be32((1 << HCR_GO_BIT) | + (event ? (1 << HCA_E_BIT) : 0) | + (op_modifier << HCR_OPMOD_SHIFT) | + op), dev->hcr + 6 * 4); + +out: + up(&dev->cmd.hcr_sem); + return err; +} + +static int mthca_cmd_poll(struct mthca_dev *dev, + u64 in_param, + u64 *out_param, + int out_is_imm, + u32 in_modifier, + u8 op_modifier, + u16 op, + unsigned long timeout, + u8 *status) +{ + int err = 0; + unsigned long end; + + if (down_interruptible(&dev->cmd.poll_sem)) + return -EINTR; + + err = mthca_cmd_post(dev, in_param, + out_param ? *out_param : 0, + in_modifier, op_modifier, + op, CMD_POLL_TOKEN, 0); + if (err) + goto out; + + end = timeout + jiffies; + while (go_bit(dev) && time_before(jiffies, end)) { + set_current_state(TASK_RUNNING); + schedule(); + } + + if (go_bit(dev)) { + err = -EBUSY; + goto out; + } + + if (out_is_imm) { + memcpy_fromio(out_param, dev->hcr + HCR_OUT_PARAM_OFFSET, sizeof (u64)); + be64_to_cpus(out_param); + } + + *status = be32_to_cpu(__raw_readl(dev->hcr + HCR_STATUS_OFFSET)) >> 24; + +out: + up(&dev->cmd.poll_sem); + return err; +} + +void mthca_cmd_event(struct mthca_dev *dev, + u16 token, + u8 status, + u64 out_param) +{ + struct mthca_cmd_context *context = + &dev->cmd.context[token & dev->cmd.token_mask]; + + /* previously timed out command completing at long last */ + if (token != context->token) + return; + + context->result = 0; + context->status = status; + context->out_param = out_param; + + context->token += dev->cmd.token_mask + 1; + + complete(&context->done); +} + +static void event_timeout(unsigned long context_ptr) +{ + struct mthca_cmd_context *context = + (struct mthca_cmd_context *) context_ptr; + + context->result = -EBUSY; + complete(&context->done); +} + +static int mthca_cmd_wait(struct mthca_dev *dev, + u64 in_param, + u64 *out_param, + int out_is_imm, + u32 in_modifier, + u8 op_modifier, + u16 op, + unsigned long timeout, + u8 *status) +{ + int err = 0; + struct mthca_cmd_context *context; + + if (down_interruptible(&dev->cmd.event_sem)) + return -EINTR; + + spin_lock(&dev->cmd.context_lock); + BUG_ON(dev->cmd.free_head < 0); + context = &dev->cmd.context[dev->cmd.free_head]; + dev->cmd.free_head = context->next; + spin_unlock(&dev->cmd.context_lock); + + init_completion(&context->done); + + err = mthca_cmd_post(dev, in_param, + out_param ? *out_param : 0, + in_modifier, op_modifier, + op, context->token, 1); + if (err) + goto out; + + context->timer.expires = jiffies + timeout; + add_timer(&context->timer); + + wait_for_completion(&context->done); + del_timer_sync(&context->timer); + + err = context->result; + if (err) + goto out; + + *status = context->status; + if (*status) + mthca_dbg(dev, "Command %02x completed with status %02x\n", + op, *status); + + if (out_is_imm) + *out_param = context->out_param; + +out: + spin_lock(&dev->cmd.context_lock); + context->next = dev->cmd.free_head; + dev->cmd.free_head = context - dev->cmd.context; + spin_unlock(&dev->cmd.context_lock); + + up(&dev->cmd.event_sem); + return err; +} + +/* Invoke a command with an output mailbox */ +static int mthca_cmd_box(struct mthca_dev *dev, + u64 in_param, + u64 out_param, + u32 in_modifier, + u8 op_modifier, + u16 op, + unsigned long timeout, + u8 *status) +{ + if (dev->cmd.use_events) + return mthca_cmd_wait(dev, in_param, &out_param, 0, + in_modifier, op_modifier, op, + timeout, status); + else + return mthca_cmd_poll(dev, in_param, &out_param, 0, + in_modifier, op_modifier, op, + timeout, status); +} + +/* Invoke a command with no output parameter */ +static int mthca_cmd(struct mthca_dev *dev, + u64 in_param, + u32 in_modifier, + u8 op_modifier, + u16 op, + unsigned long timeout, + u8 *status) +{ + return mthca_cmd_box(dev, in_param, 0, in_modifier, + op_modifier, op, timeout, status); +} + +/* + * Invoke a command with an immediate output parameter (and copy the + * output into the caller's out_param pointer after the command + * executes). + */ +static int mthca_cmd_imm(struct mthca_dev *dev, + u64 in_param, + u64 *out_param, + u32 in_modifier, + u8 op_modifier, + u16 op, + unsigned long timeout, + u8 *status) +{ + if (dev->cmd.use_events) + return mthca_cmd_wait(dev, in_param, out_param, 1, + in_modifier, op_modifier, op, + timeout, status); + else + return mthca_cmd_poll(dev, in_param, out_param, 1, + in_modifier, op_modifier, op, + timeout, status); +} + +/* + * Switch to using events to issue FW commands (should be called after + * event queue to command events has been initialized). + */ +int mthca_cmd_use_events(struct mthca_dev *dev) +{ + int i; + + dev->cmd.context = kmalloc(dev->cmd.max_cmds * + sizeof (struct mthca_cmd_context), + GFP_KERNEL); + if (!dev->cmd.context) + return -ENOMEM; + + for (i = 0; i < dev->cmd.max_cmds; ++i) { + dev->cmd.context[i].token = i; + dev->cmd.context[i].next = i + 1; + init_timer(&dev->cmd.context[i].timer); + dev->cmd.context[i].timer.data = + (unsigned long) &dev->cmd.context[i]; + dev->cmd.context[i].timer.function = event_timeout; + } + + dev->cmd.context[dev->cmd.max_cmds - 1].next = -1; + dev->cmd.free_head = 0; + + sema_init(&dev->cmd.event_sem, dev->cmd.max_cmds); + spin_lock_init(&dev->cmd.context_lock); + + for (dev->cmd.token_mask = 1; + dev->cmd.token_mask < dev->cmd.max_cmds; + dev->cmd.token_mask <<= 1) + ; /* nothing */ + --dev->cmd.token_mask; + + dev->cmd.use_events = 1; + down(&dev->cmd.poll_sem); + + return 0; +} + +/* + * Switch back to polling (used when shutting down the device) + */ +void mthca_cmd_use_polling(struct mthca_dev *dev) +{ + int i; + + dev->cmd.use_events = 0; + + for (i = 0; i < dev->cmd.max_cmds; ++i) + down(&dev->cmd.event_sem); + + kfree(dev->cmd.context); + + up(&dev->cmd.poll_sem); +} + +int mthca_SYS_EN(struct mthca_dev *dev, u8 *status) +{ + u64 out; + int ret; + + ret = mthca_cmd_imm(dev, 0, &out, 0, 0, CMD_SYS_EN, HZ, status); + + if (*status == MTHCA_CMD_STAT_DDR_MEM_ERR) + mthca_warn(dev, "SYS_EN DDR error: syn=%x, sock=%d, " + "sladdr=%d, SPD source=%s\n", + (int) (out >> 6) & 0xf, (int) (out >> 4) & 3, + (int) (out >> 1) & 7, (int) out & 1 ? "NVMEM" : "DIMM"); + + return ret; +} + +int mthca_SYS_DIS(struct mthca_dev *dev, u8 *status) +{ + return mthca_cmd(dev, 0, 0, 0, CMD_SYS_DIS, HZ, status); +} + +int mthca_MAP_FA(struct mthca_dev *dev, int count, + struct scatterlist *sglist, u8 *status) +{ + u32 *inbox; + dma_addr_t indma; + int lg; + int nent = 0; + int i, j; + int err = 0; + int ts = 0; + + inbox = pci_alloc_consistent(dev->pdev, PAGE_SIZE, &indma); + memset(inbox, 0, PAGE_SIZE); + + for (i = 0; i < count; ++i) { + /* + * We have to pass pages that are aligned to their + * size, so find the least significant 1 in the + * address or size and use that as our log2 size. + */ + lg = ffs(sg_dma_address(sglist + i) | sg_dma_len(sglist + i)) - 1; + if (lg < 12) { + mthca_warn(dev, "Got FW area not aligned to 4K (%llx/%x).\n", + (unsigned long long) sg_dma_address(sglist + i), + sg_dma_len(sglist + i)); + err = -EINVAL; + goto out; + } + for (j = 0; j < sg_dma_len(sglist + i) / (1 << lg); ++j, ++nent) { + *((__be64 *) (inbox + nent * 4 + 2)) = + cpu_to_be64((sg_dma_address(sglist + i) + + (j << lg)) | + (lg - 12)); + ts += 1 << (lg - 10); + if (nent == PAGE_SIZE / 16) { + err = mthca_cmd(dev, indma, nent, 0, CMD_MAP_FA, + CMD_TIME_CLASS_B, status); + if (err || *status) + goto out; + nent = 0; + } + } + } + + if (nent) { + err = mthca_cmd(dev, indma, nent, 0, CMD_MAP_FA, + CMD_TIME_CLASS_B, status); + } + + mthca_dbg(dev, "Mapped %d KB of host memory for FW.\n", ts); + +out: + pci_free_consistent(dev->pdev, PAGE_SIZE, inbox, indma); + return err; +} + +int mthca_UNMAP_FA(struct mthca_dev *dev, u8 *status) +{ + return mthca_cmd(dev, 0, 0, 0, CMD_UNMAP_FA, CMD_TIME_CLASS_B, status); +} + +int mthca_RUN_FW(struct mthca_dev *dev, u8 *status) +{ + return mthca_cmd(dev, 0, 0, 0, CMD_RUN_FW, CMD_TIME_CLASS_A, status); +} + +int mthca_QUERY_FW(struct mthca_dev *dev, u8 *status) +{ + u32 *outbox; + dma_addr_t outdma; + int err = 0; + u8 lg; + +#define QUERY_FW_OUT_SIZE 0x100 +#define QUERY_FW_VER_OFFSET 0x00 +#define QUERY_FW_MAX_CMD_OFFSET 0x0f +#define QUERY_FW_ERR_START_OFFSET 0x30 +#define QUERY_FW_ERR_SIZE_OFFSET 0x38 + +#define QUERY_FW_START_OFFSET 0x20 +#define QUERY_FW_END_OFFSET 0x28 + +#define QUERY_FW_SIZE_OFFSET 0x00 +#define QUERY_FW_CLR_INT_BASE_OFFSET 0x20 +#define QUERY_FW_EQ_ARM_BASE_OFFSET 0x40 +#define QUERY_FW_EQ_SET_CI_BASE_OFFSET 0x48 + + outbox = pci_alloc_consistent(dev->pdev, QUERY_FW_OUT_SIZE, &outdma); + if (!outbox) { + return -ENOMEM; + } + + err = mthca_cmd_box(dev, 0, outdma, 0, 0, CMD_QUERY_FW, + CMD_TIME_CLASS_A, status); + + if (err) + goto out; + + MTHCA_GET(dev->fw_ver, outbox, QUERY_FW_VER_OFFSET); + /* + * FW subminor version is at more signifant bits than minor + * version, so swap here. + */ + dev->fw_ver = (dev->fw_ver & 0xffff00000000ull) | + ((dev->fw_ver & 0xffff0000ull) >> 16) | + ((dev->fw_ver & 0x0000ffffull) << 16); + + MTHCA_GET(lg, outbox, QUERY_FW_MAX_CMD_OFFSET); + dev->cmd.max_cmds = 1 << lg; + + mthca_dbg(dev, "FW version %012llx, max commands %d\n", + (unsigned long long) dev->fw_ver, dev->cmd.max_cmds); + + if (dev->hca_type == ARBEL_NATIVE) { + MTHCA_GET(dev->fw.arbel.fw_pages, outbox, QUERY_FW_SIZE_OFFSET); + MTHCA_GET(dev->fw.arbel.clr_int_base, outbox, QUERY_FW_CLR_INT_BASE_OFFSET); + MTHCA_GET(dev->fw.arbel.eq_arm_base, outbox, QUERY_FW_EQ_ARM_BASE_OFFSET); + MTHCA_GET(dev->fw.arbel.eq_set_ci_base, outbox, QUERY_FW_EQ_SET_CI_BASE_OFFSET); + mthca_dbg(dev, "FW size %d KB\n", dev->fw.arbel.fw_pages << 2); + + /* + * Arbel page size is always 4 KB; round up number of + * system pages needed. + */ + dev->fw.arbel.fw_pages = + (dev->fw.arbel.fw_pages + (1 << (PAGE_SHIFT - 12)) - 1) >> + (PAGE_SHIFT - 12); + + mthca_dbg(dev, "Clear int @ %llx, EQ arm @ %llx, EQ set CI @ %llx\n", + (unsigned long long) dev->fw.arbel.clr_int_base, + (unsigned long long) dev->fw.arbel.eq_arm_base, + (unsigned long long) dev->fw.arbel.eq_set_ci_base); + } else { + MTHCA_GET(dev->fw.tavor.fw_start, outbox, QUERY_FW_START_OFFSET); + MTHCA_GET(dev->fw.tavor.fw_end, outbox, QUERY_FW_END_OFFSET); + + mthca_dbg(dev, "FW size %d KB (start %llx, end %llx)\n", + (int) ((dev->fw.tavor.fw_end - dev->fw.tavor.fw_start) >> 10), + (unsigned long long) dev->fw.tavor.fw_start, + (unsigned long long) dev->fw.tavor.fw_end); + } + +out: + pci_free_consistent(dev->pdev, QUERY_FW_OUT_SIZE, outbox, outdma); + return err; +} + +int mthca_ENABLE_LAM(struct mthca_dev *dev, u8 *status) +{ + u8 info; + u32 *outbox; + dma_addr_t outdma; + int err = 0; + +#define ENABLE_LAM_OUT_SIZE 0x100 +#define ENABLE_LAM_START_OFFSET 0x00 +#define ENABLE_LAM_END_OFFSET 0x08 +#define ENABLE_LAM_INFO_OFFSET 0x13 + +#define ENABLE_LAM_INFO_HIDDEN_FLAG (1 << 4) +#define ENABLE_LAM_INFO_ECC_MASK 0x3 + + outbox = pci_alloc_consistent(dev->pdev, ENABLE_LAM_OUT_SIZE, &outdma); + if (!outbox) + return -ENOMEM; + + err = mthca_cmd_box(dev, 0, outdma, 0, 0, CMD_ENABLE_LAM, + CMD_TIME_CLASS_C, status); + + if (err) + goto out; + + if (*status == MTHCA_CMD_STAT_LAM_NOT_PRE) + goto out; + + MTHCA_GET(dev->ddr_start, outbox, ENABLE_LAM_START_OFFSET); + MTHCA_GET(dev->ddr_end, outbox, ENABLE_LAM_END_OFFSET); + MTHCA_GET(info, outbox, ENABLE_LAM_INFO_OFFSET); + + if (!!(info & ENABLE_LAM_INFO_HIDDEN_FLAG) != + !!(dev->mthca_flags & MTHCA_FLAG_DDR_HIDDEN)) { + mthca_info(dev, "FW reports that HCA-attached memory " + "is %s hidden; does not match PCI config\n", + (info & ENABLE_LAM_INFO_HIDDEN_FLAG) ? + "" : "not"); + } + if (info & ENABLE_LAM_INFO_HIDDEN_FLAG) + mthca_dbg(dev, "HCA-attached memory is hidden.\n"); + + mthca_dbg(dev, "HCA memory size %d KB (start %llx, end %llx)\n", + (int) ((dev->ddr_end - dev->ddr_start) >> 10), + (unsigned long long) dev->ddr_start, + (unsigned long long) dev->ddr_end); + +out: + pci_free_consistent(dev->pdev, ENABLE_LAM_OUT_SIZE, outbox, outdma); + return err; +} + +int mthca_DISABLE_LAM(struct mthca_dev *dev, u8 *status) +{ + return mthca_cmd(dev, 0, 0, 0, CMD_SYS_DIS, CMD_TIME_CLASS_C, status); +} + +int mthca_QUERY_DDR(struct mthca_dev *dev, u8 *status) +{ + u8 info; + u32 *outbox; + dma_addr_t outdma; + int err = 0; + +#define QUERY_DDR_OUT_SIZE 0x100 +#define QUERY_DDR_START_OFFSET 0x00 +#define QUERY_DDR_END_OFFSET 0x08 +#define QUERY_DDR_INFO_OFFSET 0x13 + +#define QUERY_DDR_INFO_HIDDEN_FLAG (1 << 4) +#define QUERY_DDR_INFO_ECC_MASK 0x3 + + outbox = pci_alloc_consistent(dev->pdev, QUERY_DDR_OUT_SIZE, &outdma); + if (!outbox) + return -ENOMEM; + + err = mthca_cmd_box(dev, 0, outdma, 0, 0, CMD_QUERY_DDR, + CMD_TIME_CLASS_A, status); + + if (err) + goto out; + + MTHCA_GET(dev->ddr_start, outbox, QUERY_DDR_START_OFFSET); + MTHCA_GET(dev->ddr_end, outbox, QUERY_DDR_END_OFFSET); + MTHCA_GET(info, outbox, QUERY_DDR_INFO_OFFSET); + + if (!!(info & QUERY_DDR_INFO_HIDDEN_FLAG) != + !!(dev->mthca_flags & MTHCA_FLAG_DDR_HIDDEN)) { + mthca_info(dev, "FW reports that HCA-attached memory " + "is %s hidden; does not match PCI config\n", + (info & QUERY_DDR_INFO_HIDDEN_FLAG) ? + "" : "not"); + } + if (info & QUERY_DDR_INFO_HIDDEN_FLAG) + mthca_dbg(dev, "HCA-attached memory is hidden.\n"); + + mthca_dbg(dev, "HCA memory size %d KB (start %llx, end %llx)\n", + (int) ((dev->ddr_end - dev->ddr_start) >> 10), + (unsigned long long) dev->ddr_start, + (unsigned long long) dev->ddr_end); + +out: + pci_free_consistent(dev->pdev, QUERY_DDR_OUT_SIZE, outbox, outdma); + return err; +} + +int mthca_QUERY_DEV_LIM(struct mthca_dev *dev, + struct mthca_dev_lim *dev_lim, u8 *status) +{ + u32 *outbox; + dma_addr_t outdma; + u8 field; + u16 size; + int err; + +#define QUERY_DEV_LIM_OUT_SIZE 0x100 +#define QUERY_DEV_LIM_MAX_SRQ_SZ_OFFSET 0x10 +#define QUERY_DEV_LIM_MAX_QP_SZ_OFFSET 0x11 +#define QUERY_DEV_LIM_RSVD_QP_OFFSET 0x12 +#define QUERY_DEV_LIM_MAX_QP_OFFSET 0x13 +#define QUERY_DEV_LIM_RSVD_SRQ_OFFSET 0x14 +#define QUERY_DEV_LIM_MAX_SRQ_OFFSET 0x15 +#define QUERY_DEV_LIM_RSVD_EEC_OFFSET 0x16 +#define QUERY_DEV_LIM_MAX_EEC_OFFSET 0x17 +#define QUERY_DEV_LIM_MAX_CQ_SZ_OFFSET 0x19 +#define QUERY_DEV_LIM_RSVD_CQ_OFFSET 0x1a +#define QUERY_DEV_LIM_MAX_CQ_OFFSET 0x1b +#define QUERY_DEV_LIM_MAX_MPT_OFFSET 0x1d +#define QUERY_DEV_LIM_RSVD_EQ_OFFSET 0x1e +#define QUERY_DEV_LIM_MAX_EQ_OFFSET 0x1f +#define QUERY_DEV_LIM_RSVD_MTT_OFFSET 0x20 +#define QUERY_DEV_LIM_MAX_MRW_SZ_OFFSET 0x21 +#define QUERY_DEV_LIM_RSVD_MRW_OFFSET 0x22 +#define QUERY_DEV_LIM_MAX_MTT_SEG_OFFSET 0x23 +#define QUERY_DEV_LIM_MAX_AV_OFFSET 0x27 +#define QUERY_DEV_LIM_MAX_REQ_QP_OFFSET 0x29 +#define QUERY_DEV_LIM_MAX_RES_QP_OFFSET 0x2b +#define QUERY_DEV_LIM_MAX_RDMA_OFFSET 0x2f +#define QUERY_DEV_LIM_RSZ_SRQ_OFFSET 0x33 +#define QUERY_DEV_LIM_ACK_DELAY_OFFSET 0x35 +#define QUERY_DEV_LIM_MTU_WIDTH_OFFSET 0x36 +#define QUERY_DEV_LIM_VL_PORT_OFFSET 0x37 +#define QUERY_DEV_LIM_MAX_GID_OFFSET 0x3b +#define QUERY_DEV_LIM_MAX_PKEY_OFFSET 0x3f +#define QUERY_DEV_LIM_FLAGS_OFFSET 0x44 +#define QUERY_DEV_LIM_RSVD_UAR_OFFSET 0x48 +#define QUERY_DEV_LIM_UAR_SZ_OFFSET 0x49 +#define QUERY_DEV_LIM_PAGE_SZ_OFFSET 0x4b +#define QUERY_DEV_LIM_MAX_SG_OFFSET 0x51 +#define QUERY_DEV_LIM_MAX_DESC_SZ_OFFSET 0x52 +#define QUERY_DEV_LIM_MAX_SG_RQ_OFFSET 0x55 +#define QUERY_DEV_LIM_MAX_DESC_SZ_RQ_OFFSET 0x56 +#define QUERY_DEV_LIM_MAX_QP_MCG_OFFSET 0x61 +#define QUERY_DEV_LIM_RSVD_MCG_OFFSET 0x62 +#define QUERY_DEV_LIM_MAX_MCG_OFFSET 0x63 +#define QUERY_DEV_LIM_RSVD_PD_OFFSET 0x64 +#define QUERY_DEV_LIM_MAX_PD_OFFSET 0x65 +#define QUERY_DEV_LIM_RSVD_RDD_OFFSET 0x66 +#define QUERY_DEV_LIM_MAX_RDD_OFFSET 0x67 +#define QUERY_DEV_LIM_EEC_ENTRY_SZ_OFFSET 0x80 +#define QUERY_DEV_LIM_QPC_ENTRY_SZ_OFFSET 0x82 +#define QUERY_DEV_LIM_EEEC_ENTRY_SZ_OFFSET 0x84 +#define QUERY_DEV_LIM_EQPC_ENTRY_SZ_OFFSET 0x86 +#define QUERY_DEV_LIM_EQC_ENTRY_SZ_OFFSET 0x88 +#define QUERY_DEV_LIM_CQC_ENTRY_SZ_OFFSET 0x8a +#define QUERY_DEV_LIM_SRQ_ENTRY_SZ_OFFSET 0x8c +#define QUERY_DEV_LIM_UAR_ENTRY_SZ_OFFSET 0x8e +#define QUERY_DEV_LIM_MTT_ENTRY_SZ_OFFSET 0x90 +#define QUERY_DEV_LIM_MPT_ENTRY_SZ_OFFSET 0x92 +#define QUERY_DEV_LIM_PBL_SZ_OFFSET 0x96 +#define QUERY_DEV_LIM_BMME_FLAGS_OFFSET 0x97 +#define QUERY_DEV_LIM_RSVD_LKEY_OFFSET 0x98 +#define QUERY_DEV_LIM_LAMR_OFFSET 0x9f +#define QUERY_DEV_LIM_MAX_ICM_SZ_OFFSET 0xa0 + + outbox = pci_alloc_consistent(dev->pdev, QUERY_DEV_LIM_OUT_SIZE, &outdma); + if (!outbox) + return -ENOMEM; + + err = mthca_cmd_box(dev, 0, outdma, 0, 0, CMD_QUERY_DEV_LIM, + CMD_TIME_CLASS_A, status); + + if (err) + goto out; + + MTHCA_GET(field, outbox, QUERY_DEV_LIM_MAX_SRQ_SZ_OFFSET); + dev_lim->max_srq_sz = 1 << field; + MTHCA_GET(field, outbox, QUERY_DEV_LIM_MAX_QP_SZ_OFFSET); + dev_lim->max_qp_sz = 1 << field; + MTHCA_GET(field, outbox, QUERY_DEV_LIM_RSVD_QP_OFFSET); + dev_lim->reserved_qps = 1 << (field & 0xf); + MTHCA_GET(field, outbox, QUERY_DEV_LIM_MAX_QP_OFFSET); + dev_lim->max_qps = 1 << (field & 0x1f); + MTHCA_GET(field, outbox, QUERY_DEV_LIM_RSVD_SRQ_OFFSET); + dev_lim->reserved_srqs = 1 << (field >> 4); + MTHCA_GET(field, outbox, QUERY_DEV_LIM_MAX_SRQ_OFFSET); + dev_lim->max_srqs = 1 << (field & 0x1f); + MTHCA_GET(field, outbox, QUERY_DEV_LIM_RSVD_EEC_OFFSET); + dev_lim->reserved_eecs = 1 << (field & 0xf); + MTHCA_GET(field, outbox, QUERY_DEV_LIM_MAX_EEC_OFFSET); + dev_lim->max_eecs = 1 << (field & 0x1f); + MTHCA_GET(field, outbox, QUERY_DEV_LIM_MAX_CQ_SZ_OFFSET); + dev_lim->max_cq_sz = 1 << field; + MTHCA_GET(field, outbox, QUERY_DEV_LIM_RSVD_CQ_OFFSET); + dev_lim->reserved_cqs = 1 << (field & 0xf); + MTHCA_GET(field, outbox, QUERY_DEV_LIM_MAX_CQ_OFFSET); + dev_lim->max_cqs = 1 << (field & 0x1f); + MTHCA_GET(field, outbox, QUERY_DEV_LIM_MAX_MPT_OFFSET); + dev_lim->max_mpts = 1 << (field & 0x3f); + MTHCA_GET(field, outbox, QUERY_DEV_LIM_RSVD_EQ_OFFSET); + dev_lim->reserved_eqs = 1 << (field & 0xf); + MTHCA_GET(field, outbox, QUERY_DEV_LIM_MAX_EQ_OFFSET); + dev_lim->max_eqs = 1 << (field & 0x7); + MTHCA_GET(field, outbox, QUERY_DEV_LIM_RSVD_MTT_OFFSET); + dev_lim->reserved_mtts = 1 << (field >> 4); + MTHCA_GET(field, outbox, QUERY_DEV_LIM_MAX_MRW_SZ_OFFSET); + dev_lim->max_mrw_sz = 1 << field; + MTHCA_GET(field, outbox, QUERY_DEV_LIM_RSVD_MRW_OFFSET); + dev_lim->reserved_mrws = 1 << (field & 0xf); + MTHCA_GET(field, outbox, QUERY_DEV_LIM_MAX_MTT_SEG_OFFSET); + dev_lim->max_mtt_seg = 1 << (field & 0x3f); + MTHCA_GET(field, outbox, QUERY_DEV_LIM_MAX_REQ_QP_OFFSET); + dev_lim->max_requester_per_qp = 1 << (field & 0x3f); + MTHCA_GET(field, outbox, QUERY_DEV_LIM_MAX_RES_QP_OFFSET); + dev_lim->max_responder_per_qp = 1 << (field & 0x3f); + MTHCA_GET(field, outbox, QUERY_DEV_LIM_MAX_RDMA_OFFSET); + dev_lim->max_rdma_global = 1 << (field & 0x3f); + MTHCA_GET(field, outbox, QUERY_DEV_LIM_ACK_DELAY_OFFSET); + dev_lim->local_ca_ack_delay = field & 0x1f; + MTHCA_GET(field, outbox, QUERY_DEV_LIM_MTU_WIDTH_OFFSET); + dev_lim->max_mtu = field >> 4; + dev_lim->max_port_width = field & 0xf; + MTHCA_GET(field, outbox, QUERY_DEV_LIM_VL_PORT_OFFSET); + dev_lim->max_vl = field >> 4; + dev_lim->num_ports = field & 0xf; + MTHCA_GET(field, outbox, QUERY_DEV_LIM_MAX_GID_OFFSET); + dev_lim->max_gids = 1 << (field & 0xf); + MTHCA_GET(field, outbox, QUERY_DEV_LIM_MAX_PKEY_OFFSET); + dev_lim->max_pkeys = 1 << (field & 0xf); + MTHCA_GET(dev_lim->flags, outbox, QUERY_DEV_LIM_FLAGS_OFFSET); + MTHCA_GET(field, outbox, QUERY_DEV_LIM_RSVD_UAR_OFFSET); + dev_lim->reserved_uars = field >> 4; + MTHCA_GET(field, outbox, QUERY_DEV_LIM_UAR_SZ_OFFSET); + dev_lim->uar_size = 1 << ((field & 0x3f) + 20); + MTHCA_GET(field, outbox, QUERY_DEV_LIM_PAGE_SZ_OFFSET); + dev_lim->min_page_sz = 1 << field; + MTHCA_GET(field, outbox, QUERY_DEV_LIM_MAX_SG_OFFSET); + dev_lim->max_sg = field; + + MTHCA_GET(size, outbox, QUERY_DEV_LIM_MAX_DESC_SZ_OFFSET); + dev_lim->max_desc_sz = size; + + MTHCA_GET(field, outbox, QUERY_DEV_LIM_MAX_QP_MCG_OFFSET); + dev_lim->max_qp_per_mcg = 1 << field; + MTHCA_GET(field, outbox, QUERY_DEV_LIM_RSVD_MCG_OFFSET); + dev_lim->reserved_mgms = field & 0xf; + MTHCA_GET(field, outbox, QUERY_DEV_LIM_MAX_MCG_OFFSET); + dev_lim->max_mcgs = 1 << field; + MTHCA_GET(field, outbox, QUERY_DEV_LIM_RSVD_PD_OFFSET); + dev_lim->reserved_pds = field >> 4; + MTHCA_GET(field, outbox, QUERY_DEV_LIM_MAX_PD_OFFSET); + dev_lim->max_pds = 1 << (field & 0x3f); + MTHCA_GET(field, outbox, QUERY_DEV_LIM_RSVD_RDD_OFFSET); + dev_lim->reserved_rdds = field >> 4; + MTHCA_GET(field, outbox, QUERY_DEV_LIM_MAX_RDD_OFFSET); + dev_lim->max_rdds = 1 << (field & 0x3f); + + MTHCA_GET(size, outbox, QUERY_DEV_LIM_EEC_ENTRY_SZ_OFFSET); + dev_lim->eec_entry_sz = size; + MTHCA_GET(size, outbox, QUERY_DEV_LIM_QPC_ENTRY_SZ_OFFSET); + dev_lim->qpc_entry_sz = size; + MTHCA_GET(size, outbox, QUERY_DEV_LIM_EEEC_ENTRY_SZ_OFFSET); + dev_lim->eeec_entry_sz = size; + MTHCA_GET(size, outbox, QUERY_DEV_LIM_EQPC_ENTRY_SZ_OFFSET); + dev_lim->eqpc_entry_sz = size; + MTHCA_GET(size, outbox, QUERY_DEV_LIM_EQC_ENTRY_SZ_OFFSET); + dev_lim->eqc_entry_sz = size; + MTHCA_GET(size, outbox, QUERY_DEV_LIM_CQC_ENTRY_SZ_OFFSET); + dev_lim->cqc_entry_sz = size; + MTHCA_GET(size, outbox, QUERY_DEV_LIM_SRQ_ENTRY_SZ_OFFSET); + dev_lim->srq_entry_sz = size; + MTHCA_GET(size, outbox, QUERY_DEV_LIM_UAR_ENTRY_SZ_OFFSET); + dev_lim->uar_scratch_entry_sz = size; + + mthca_dbg(dev, "Max QPs: %d, reserved QPs: %d, entry size: %d\n", + dev_lim->max_qps, dev_lim->reserved_qps, dev_lim->qpc_entry_sz); + mthca_dbg(dev, "Max CQs: %d, reserved CQs: %d, entry size: %d\n", + dev_lim->max_cqs, dev_lim->reserved_cqs, dev_lim->cqc_entry_sz); + mthca_dbg(dev, "Max EQs: %d, reserved EQs: %d, entry size: %d\n", + dev_lim->max_eqs, dev_lim->reserved_eqs, dev_lim->eqc_entry_sz); + mthca_dbg(dev, "reserved MPTs: %d, reserved MTTs: %d\n", + dev_lim->reserved_mrws, dev_lim->reserved_mtts); + mthca_dbg(dev, "Max PDs: %d, reserved PDs: %d, reserved UARs: %d\n", + dev_lim->max_pds, dev_lim->reserved_pds, dev_lim->reserved_uars); + mthca_dbg(dev, "Max QP/MCG: %d, reserved MGMs: %d\n", + dev_lim->max_pds, dev_lim->reserved_mgms); + + mthca_dbg(dev, "Flags: %08x\n", dev_lim->flags); + + if (dev->hca_type == ARBEL_NATIVE) { + MTHCA_GET(field, outbox, QUERY_DEV_LIM_RSZ_SRQ_OFFSET); + dev_lim->hca.arbel.resize_srq = field & 1; + MTHCA_GET(size, outbox, QUERY_DEV_LIM_MTT_ENTRY_SZ_OFFSET); + dev_lim->hca.arbel.mtt_entry_sz = size; + MTHCA_GET(size, outbox, QUERY_DEV_LIM_MPT_ENTRY_SZ_OFFSET); + dev_lim->hca.arbel.mpt_entry_s