aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2006-06-26 11:35:44 -0400
committerDavid Woodhouse <dwmw2@infradead.org>2006-06-26 11:35:44 -0400
commit62ed948cb1405fe95d61d8c6445c102e0c9da0a6 (patch)
treef139adcc861a05e7cc09cdb387a271a652fc2d07 /include
parent17ffc7ba6d7ea68b8d5f55a5ca1b87163e69720d (diff)
parentfcc18e83e1f6fd9fa6b333735bf0fcd530655511 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acconfig.h18
-rw-r--r--include/acpi/acdisasm.h173
-rw-r--r--include/acpi/acdispat.h6
-rw-r--r--include/acpi/acevents.h4
-rw-r--r--include/acpi/acexcep.h6
-rw-r--r--include/acpi/acglobal.h29
-rw-r--r--include/acpi/aclocal.h284
-rw-r--r--include/acpi/acmacros.h81
-rw-r--r--include/acpi/acnamesp.h28
-rw-r--r--include/acpi/acobject.h188
-rw-r--r--include/acpi/acopcode.h2
-rw-r--r--include/acpi/acoutput.h10
-rw-r--r--include/acpi/acparser.h4
-rw-r--r--include/acpi/acpi_bus.h10
-rw-r--r--include/acpi/acpi_numa.h23
-rw-r--r--include/acpi/acpiosxf.h35
-rw-r--r--include/acpi/acpixf.h4
-rw-r--r--include/acpi/acresrc.h20
-rw-r--r--include/acpi/acstruct.h121
-rw-r--r--include/acpi/actables.h6
-rw-r--r--include/acpi/actbl.h400
-rw-r--r--include/acpi/actbl1.h639
-rw-r--r--include/acpi/actbl2.h230
-rw-r--r--include/acpi/actypes.h88
-rw-r--r--include/acpi/acutils.h95
-rw-r--r--include/acpi/amlcode.h6
-rw-r--r--include/acpi/amlresrc.h85
-rw-r--r--include/acpi/pdc_intel.h5
-rw-r--r--include/acpi/platform/acenv.h47
-rw-r--r--include/acpi/platform/aclinux.h23
-rw-r--r--include/acpi/processor.h27
-rw-r--r--include/asm-alpha/floppy.h5
-rw-r--r--include/asm-alpha/irq.h4
-rw-r--r--include/asm-alpha/vga.h2
-rw-r--r--include/asm-arm/arch-aaec2000/io.h1
-rw-r--r--include/asm-arm/arch-clps711x/io.h1
-rw-r--r--include/asm-arm/arch-ebsa285/io.h8
-rw-r--r--include/asm-arm/arch-ep93xx/ep93xx-regs.h2
-rw-r--r--include/asm-arm/arch-ep93xx/platform.h1
-rw-r--r--include/asm-arm/arch-imx/imx-dma.h8
-rw-r--r--include/asm-arm/arch-integrator/io.h1
-rw-r--r--include/asm-arm/arch-iop3xx/io.h1
-rw-r--r--include/asm-arm/arch-ixp23xx/ixp23xx.h3
-rw-r--r--include/asm-arm/arch-ixp23xx/platform.h15
-rw-r--r--include/asm-arm/arch-l7200/io.h1
-rw-r--r--include/asm-arm/arch-lh7a40x/io.h1
-rw-r--r--include/asm-arm/arch-netx/eth.h27
-rw-r--r--include/asm-arm/arch-netx/io.h1
-rw-r--r--include/asm-arm/arch-omap/io.h1
-rw-r--r--include/asm-arm/arch-pnx4008/debug-macro.S4
-rw-r--r--include/asm-arm/arch-pnx4008/gpio.h102
-rw-r--r--include/asm-arm/arch-pnx4008/pm.h29
-rw-r--r--include/asm-arm/arch-pxa/io.h1
-rw-r--r--include/asm-arm/arch-realview/io.h1
-rw-r--r--include/asm-arm/arch-s3c2410/debug-macro.S10
-rw-r--r--include/asm-arm/arch-s3c2410/entry-macro.S30
-rw-r--r--include/asm-arm/arch-s3c2410/map.h16
-rw-r--r--include/asm-arm/arch-s3c2410/regs-clock.h63
-rw-r--r--include/asm-arm/arch-s3c2410/regs-dsc.h5
-rw-r--r--include/asm-arm/arch-s3c2410/regs-gpio.h63
-rw-r--r--include/asm-arm/arch-s3c2410/regs-gpioj.h5
-rw-r--r--include/asm-arm/arch-s3c2410/regs-irq.h6
-rw-r--r--include/asm-arm/arch-s3c2410/regs-serial.h15
-rw-r--r--include/asm-arm/arch-sa1100/io.h1
-rw-r--r--include/asm-arm/arch-versatile/io.h1
-rw-r--r--include/asm-arm/floppy.h2
-rw-r--r--include/asm-arm/irq.h4
-rw-r--r--include/asm-arm/thread_notify.h48
-rw-r--r--include/asm-arm/ucontext.h79
-rw-r--r--include/asm-arm/vga.h2
-rw-r--r--include/asm-arm26/floppy.h2
-rw-r--r--include/asm-arm26/irq.h4
-rw-r--r--include/asm-frv/atomic.h4
-rw-r--r--include/asm-frv/checksum.h2
-rw-r--r--include/asm-frv/highmem.h2
-rw-r--r--include/asm-frv/io.h40
-rw-r--r--include/asm-frv/mb-regs.h27
-rw-r--r--include/asm-frv/signal.h6
-rw-r--r--include/asm-frv/uaccess.h64
-rw-r--r--include/asm-frv/unistd.h19
-rw-r--r--include/asm-generic/bug.h13
-rw-r--r--include/asm-generic/memory_model.h27
-rw-r--r--include/asm-generic/percpu.h2
-rw-r--r--include/asm-generic/rtc.h7
-rw-r--r--include/asm-h8300/irq.h4
-rw-r--r--include/asm-i386/alternative.h2
-rw-r--r--include/asm-i386/apic.h2
-rw-r--r--include/asm-i386/apicdef.h1
-rw-r--r--include/asm-i386/cpufeature.h12
-rw-r--r--include/asm-i386/floppy.h5
-rw-r--r--include/asm-i386/mach-default/setup_arch.h (renamed from include/asm-i386/mach-default/setup_arch_pre.h)0
-rw-r--r--include/asm-i386/mach-default/setup_arch_post.h40
-rw-r--r--include/asm-i386/mach-visws/setup_arch.h (renamed from include/asm-i386/mach-visws/setup_arch_pre.h)0
-rw-r--r--include/asm-i386/mach-visws/setup_arch_post.h49
-rw-r--r--include/asm-i386/mach-voyager/setup_arch.h (renamed from include/asm-i386/mach-voyager/setup_arch_pre.h)2
-rw-r--r--include/asm-i386/mach-voyager/setup_arch_post.h73
-rw-r--r--include/asm-i386/mce.h5
-rw-r--r--include/asm-i386/msi.h10
-rw-r--r--include/asm-i386/mtrr.h4
-rw-r--r--include/asm-i386/processor.h14
-rw-r--r--include/asm-i386/setup.h15
-rw-r--r--include/asm-i386/uaccess.h69
-rw-r--r--include/asm-i386/unistd.h3
-rw-r--r--include/asm-i386/vga.h2
-rw-r--r--include/asm-ia64/hw_irq.h15
-rw-r--r--include/asm-ia64/io.h1
-rw-r--r--include/asm-ia64/machvec.h7
-rw-r--r--include/asm-ia64/machvec_sn2.h7
-rw-r--r--include/asm-ia64/mca.h9
-rw-r--r--include/asm-ia64/msi.h12
-rw-r--r--include/asm-ia64/percpu.h2
-rw-r--r--include/asm-ia64/pgtable.h22
-rw-r--r--include/asm-ia64/sn/intr.h8
-rw-r--r--include/asm-ia64/sn/pcibr_provider.h5
-rw-r--r--include/asm-ia64/sn/pcibus_provider_defs.h17
-rw-r--r--include/asm-ia64/sn/sn_sal.h2
-rw-r--r--include/asm-ia64/sn/tiocp.h3
-rw-r--r--include/asm-ia64/unistd.h2
-rw-r--r--include/asm-ia64/vga.h2
-rw-r--r--include/asm-m32r/vga.h2
-rw-r--r--include/asm-m68k/amigaints.h96
-rw-r--r--include/asm-m68k/apollohw.h4
-rw-r--r--include/asm-m68k/atari_stdma.h2
-rw-r--r--include/asm-m68k/atariints.h11
-rw-r--r--include/asm-m68k/bvme6000hw.h30
-rw-r--r--include/asm-m68k/cacheflush.h40
-rw-r--r--include/asm-m68k/dma-mapping.h90
-rw-r--r--include/asm-m68k/irq.h108
-rw-r--r--include/asm-m68k/mac_oss.h10
-rw-r--r--include/asm-m68k/machdep.h6
-rw-r--r--include/asm-m68k/macintosh.h10
-rw-r--r--include/asm-m68k/macints.h14
-rw-r--r--include/asm-m68k/mvme147hw.h44
-rw-r--r--include/asm-m68k/mvme16xhw.h40
-rw-r--r--include/asm-m68k/processor.h8
-rw-r--r--include/asm-m68k/scatterlist.h9
-rw-r--r--include/asm-m68k/signal.h19
-rw-r--r--include/asm-m68k/sun3ints.h22
-rw-r--r--include/asm-m68k/traps.h7
-rw-r--r--include/asm-m68k/uaccess.h1100
-rw-r--r--include/asm-m68k/unistd.h39
-rw-r--r--include/asm-m68knommu/cacheflush.h13
-rw-r--r--include/asm-m68knommu/coldfire.h76
-rw-r--r--include/asm-m68knommu/irq.h6
-rw-r--r--include/asm-m68knommu/m5249sim.h2
-rw-r--r--include/asm-m68knommu/m532xsim.h2238
-rw-r--r--include/asm-m68knommu/mcfcache.h15
-rw-r--r--include/asm-m68knommu/mcfpit.h8
-rw-r--r--include/asm-m68knommu/mcfsim.h3
-rw-r--r--include/asm-m68knommu/mcftimer.h30
-rw-r--r--include/asm-m68knommu/mcfuart.h4
-rw-r--r--include/asm-m68knommu/processor.h28
-rw-r--r--include/asm-m68knommu/ptrace.h2
-rw-r--r--include/asm-mips/compat.h3
-rw-r--r--include/asm-mips/mach-au1x00/au1xxx_psc.h9
-rw-r--r--include/asm-mips/mach-db1x00/db1x00.h12
-rw-r--r--include/asm-mips/mach-generic/floppy.h2
-rw-r--r--include/asm-mips/mach-jazz/floppy.h2
-rw-r--r--include/asm-mips/mmzone.h1
-rw-r--r--include/asm-mips/vga.h2
-rw-r--r--include/asm-parisc/floppy.h6
-rw-r--r--include/asm-parisc/mmzone.h5
-rw-r--r--include/asm-powerpc/backlight.h30
-rw-r--r--include/asm-powerpc/bitops.h6
-rw-r--r--include/asm-powerpc/cputable.h82
-rw-r--r--include/asm-powerpc/delay.h13
-rw-r--r--include/asm-powerpc/eeh.h15
-rw-r--r--include/asm-powerpc/eeh_event.h10
-rw-r--r--include/asm-powerpc/elf.h2
-rw-r--r--include/asm-powerpc/floppy.h3
-rw-r--r--include/asm-powerpc/hvcall.h10
-rw-r--r--include/asm-powerpc/immap_86xx.h199
-rw-r--r--include/asm-powerpc/io.h6
-rw-r--r--include/asm-powerpc/iommu.h6
-rw-r--r--include/asm-powerpc/irq.h86
-rw-r--r--include/asm-powerpc/iseries/iommu.h35
-rw-r--r--include/asm-powerpc/kdump.h29
-rw-r--r--include/asm-powerpc/kexec.h16
-rw-r--r--include/asm-powerpc/machdep.h5
-rw-r--r--include/asm-powerpc/mmu.h16
-rw-r--r--include/asm-powerpc/mmu_context.h12
-rw-r--r--include/asm-powerpc/mpc86xx.h47
-rw-r--r--include/asm-powerpc/mpic.h10
-rw-r--r--include/asm-powerpc/paca.h4
-rw-r--r--include/asm-powerpc/page.h11
-rw-r--r--include/asm-powerpc/pci-bridge.h14
-rw-r--r--include/asm-powerpc/percpu.h2
-rw-r--r--include/asm-powerpc/pgtable-4k.h2
-rw-r--r--include/asm-powerpc/pgtable-64k.h2
-rw-r--r--include/asm-powerpc/pgtable.h10
-rw-r--r--include/asm-powerpc/processor.h16
-rw-r--r--include/asm-powerpc/prom.h9
-rw-r--r--include/asm-powerpc/ptrace.h2
-rw-r--r--include/asm-powerpc/reg.h69
-rw-r--r--include/asm-powerpc/rtas.h9
-rw-r--r--include/asm-powerpc/spu.h29
-rw-r--r--include/asm-powerpc/spu_csa.h13
-rw-r--r--include/asm-powerpc/spu_priv1.h182
-rw-r--r--include/asm-powerpc/systbl.h306
-rw-r--r--include/asm-powerpc/tce.h35
-rw-r--r--include/asm-powerpc/topology.h9
-rw-r--r--include/asm-powerpc/udbg.h3
-rw-r--r--include/asm-powerpc/vga.h4
-rw-r--r--include/asm-powerpc/vio.h16
-rw-r--r--include/asm-ppc/floppy.h6
-rw-r--r--include/asm-ppc/mmu.h23
-rw-r--r--include/asm-ppc/mmu_context.h27
-rw-r--r--include/asm-ppc/mpc85xx.h3
-rw-r--r--include/asm-ppc/pgtable.h2
-rw-r--r--include/asm-s390/irq.h4
-rw-r--r--include/asm-s390/percpu.h2
-rw-r--r--include/asm-sh/floppy.h7
-rw-r--r--include/asm-sparc/ebus.h17
-rw-r--r--include/asm-sparc/irq.h4
-rw-r--r--include/asm-sparc/of_device.h63
-rw-r--r--include/asm-sparc/pbm.h3
-rw-r--r--include/asm-sparc/prom.h98
-rw-r--r--include/asm-sparc/sbus.h28
-rw-r--r--include/asm-sparc64/ebus.h20
-rw-r--r--include/asm-sparc64/fhc.h7
-rw-r--r--include/asm-sparc64/floppy.h27
-rw-r--r--include/asm-sparc64/isa.h21
-rw-r--r--include/asm-sparc64/of_device.h64
-rw-r--r--include/asm-sparc64/oplib.h5
-rw-r--r--include/asm-sparc64/parport.h25
-rw-r--r--include/asm-sparc64/pbm.h15
-rw-r--r--include/asm-sparc64/percpu.h2
-rw-r--r--include/asm-sparc64/pgtable.h2
-rw-r--r--include/asm-sparc64/prom.h98
-rw-r--r--include/asm-sparc64/sbus.h29
-rw-r--r--include/asm-sparc64/vdev.h5
-rw-r--r--include/asm-sparc64/vga.h2
-rw-r--r--include/asm-v850/irq.h2
-rw-r--r--include/asm-x86_64/acpi.h2
-rw-r--r--include/asm-x86_64/apicdef.h2
-rw-r--r--include/asm-x86_64/floppy.h6
-rw-r--r--include/asm-x86_64/mmzone.h1
-rw-r--r--include/asm-x86_64/msi.h10
-rw-r--r--include/asm-x86_64/numa.h1
-rw-r--r--include/asm-x86_64/percpu.h2
-rw-r--r--include/asm-x86_64/unistd.h4
-rw-r--r--include/asm-x86_64/vga.h2
-rw-r--r--include/asm-xtensa/checksum.h3
-rw-r--r--include/asm-xtensa/rwsem.h7
-rw-r--r--include/asm-xtensa/uaccess.h34
-rw-r--r--include/asm-xtensa/vga.h2
-rw-r--r--include/linux/acct.h8
-rw-r--r--include/linux/acpi.h9
-rw-r--r--include/linux/ata.h37
-rw-r--r--include/linux/bio.h2
-rw-r--r--include/linux/blkdev.h21
-rw-r--r--include/linux/blktrace_api.h6
-rw-r--r--include/linux/bootmem.h4
-rw-r--r--include/linux/cn_proc.h21
-rw-r--r--include/linux/coda_linux.h2
-rw-r--r--include/linux/coda_psdev.h2
-rw-r--r--include/linux/connector.h5
-rw-r--r--include/linux/console.h1
-rw-r--r--include/linux/cpufreq.h4
-rw-r--r--include/linux/cpumask.h4
-rw-r--r--include/linux/dcache.h1
-rw-r--r--include/linux/delay.h5
-rw-r--r--include/linux/device.h25
-rw-r--r--include/linux/dvb/dmx.h26
-rw-r--r--include/linux/efi.h1
-rw-r--r--include/linux/ethtool.h2
-rw-r--r--include/linux/eventpoll.h2
-rw-r--r--include/linux/ext3_fs.h31
-rw-r--r--include/linux/ext3_fs_i.h16
-rw-r--r--include/linux/fb.h23
-rw-r--r--include/linux/fcntl.h1
-rw-r--r--include/linux/fs.h46
-rw-r--r--include/linux/fuse.h36
-rw-r--r--include/linux/genalloc.h35
-rw-r--r--include/linux/hdlc.h2
-rw-r--r--include/linux/hrtimer.h3
-rw-r--r--include/linux/hugetlb.h8
-rw-r--r--include/linux/i2c-id.h3
-rw-r--r--include/linux/i2c-ocores.h19
-rw-r--r--include/linux/i2c.h4
-rw-r--r--include/linux/ide.h3
-rw-r--r--include/linux/interrupt.h21
-rw-r--r--include/linux/ioc4.h5
-rw-r--r--include/linux/irq.h11
-rw-r--r--include/linux/irqreturn.h25
-rw-r--r--include/linux/isa.h28
-rw-r--r--include/linux/jbd.h8
-rw-r--r--include/linux/kernel.h7
-rw-r--r--include/linux/kexec.h1
-rw-r--r--include/linux/key.h23
-rw-r--r--include/linux/kobject.h2
-rw-r--r--include/linux/kthread.h65
-rw-r--r--include/linux/ktime.h8
-rw-r--r--include/linux/libata.h473
-rw-r--r--include/linux/list.h157
-rw-r--r--include/linux/lockd/lockd.h4
-rw-r--r--include/linux/loop.h2
-rw-r--r--include/linux/m41t00.h50
-rw-r--r--include/linux/migrate.h31
-rw-r--r--include/linux/mm.h14
-rw-r--r--include/linux/mmzone.h12
-rw-r--r--include/linux/module.h2
-rw-r--r--include/linux/mount.h13
-rw-r--r--include/linux/nbd.h12
-rw-r--r--include/linux/netdevice.h23
-rw-r--r--include/linux/netlink.h2
-rw-r--r--include/linux/nfs4.h1
-rw-r--r--include/linux/nfs_fs.h62
-rw-r--r--include/linux/nfs_fs_sb.h1
-rw-r--r--include/linux/nfs_page.h5
-rw-r--r--include/linux/nfs_xdr.h61
-rw-r--r--include/linux/page-flags.h14
-rw-r--r--include/linux/pagemap.h7
-rw-r--r--include/linux/parport.h5
-rw-r--r--include/linux/pci.h4
-rw-r--r--include/linux/pci_ids.h25
-rw-r--r--include/linux/pci_regs.h1
-rw-r--r--include/linux/percpu_counter.h38
-rw-r--r--include/linux/pmu.h4
-rw-r--r--include/linux/prctl.h7
-rw-r--r--include/linux/ptrace.h4
-rw-r--r--include/linux/radix-tree.h5
-rw-r--r--include/linux/ramfs.h4
-rw-r--r--include/linux/rbtree.h4
-rw-r--r--include/linux/rcupdate.h3
-rw-r--r--include/linux/reboot.h4
-rw-r--r--include/linux/resource.h4
-rw-r--r--include/linux/resume-trace.h30
-rw-r--r--include/linux/rmap.h1
-rw-r--r--include/linux/rtc-v3020.h35
-rw-r--r--include/linux/rtc.h12
-rw-r--r--include/linux/sched.h24
-rw-r--r--include/linux/security.h55
-rw-r--r--include/linux/serial_core.h3
-rw-r--r--include/linux/skbuff.h26
-rw-r--r--include/linux/slab.h50
-rw-r--r--include/linux/string.h1
-rw-r--r--include/linux/sunrpc/xdr.h1
-rw-r--r--include/linux/swap.h101
-rw-r--r--include/linux/swapops.h53
-rw-r--r--include/linux/synclink.h5
-rw-r--r--include/linux/syscalls.h10
-rw-r--r--include/linux/sysctl.h5
-rw-r--r--include/linux/sysdev.h18
-rw-r--r--include/linux/tcp.h2
-rw-r--r--include/linux/tty.h4
-rw-r--r--include/linux/uaccess.h22
-rw-r--r--include/linux/ufs_fs.h104
-rw-r--r--include/linux/ufs_fs_i.h1
-rw-r--r--include/linux/usb.h22
-rw-r--r--include/linux/usb/cdc.h (renamed from include/linux/usb_cdc.h)0
-rw-r--r--include/linux/usb/input.h (renamed from include/linux/usb_input.h)0
-rw-r--r--include/linux/usb/isp116x.h (renamed from include/linux/usb_isp116x.h)0
-rw-r--r--include/linux/usb/sl811.h (renamed from include/linux/usb_sl811.h)8
-rw-r--r--include/linux/videodev.h51
-rw-r--r--include/linux/videodev2.h392
-rw-r--r--include/linux/vmalloc.h8
-rw-r--r--include/linux/writeback.h5
-rw-r--r--include/linux/zconf.h12
-rw-r--r--include/linux/zlib.h209
-rw-r--r--include/linux/zorro.h42
-rw-r--r--include/linux/zutil.h12
-rw-r--r--include/media/cx2341x.h189
-rw-r--r--include/media/ir-common.h5
-rw-r--r--include/media/ir-kbd-i2c.h3
-rw-r--r--include/media/ovcamchip.h1
-rw-r--r--include/media/pwc-ioctl.h325
-rw-r--r--include/media/saa7115.h11
-rw-r--r--include/media/saa7146_vv.h2
-rw-r--r--include/media/tuner.h13
-rw-r--r--include/media/tvp5150.h34
-rw-r--r--include/media/v4l2-common.h32
-rw-r--r--include/media/v4l2-dev.h375
-rw-r--r--include/media/video-buf-dvb.h3
-rw-r--r--include/media/video-buf.h1
-rw-r--r--include/net/ieee80211.h5
-rw-r--r--include/net/protocol.h1
-rw-r--r--include/net/sock.h5
-rw-r--r--include/net/tcp.h6
-rw-r--r--include/scsi/iscsi_if.h127
-rw-r--r--include/scsi/iscsi_proto.h2
-rw-r--r--include/scsi/libiscsi.h282
-rw-r--r--include/scsi/scsi_cmnd.h11
-rw-r--r--include/scsi/scsi_dbg.h2
-rw-r--r--include/scsi/scsi_devinfo.h1
-rw-r--r--include/scsi/scsi_eh.h3
-rw-r--r--include/scsi/scsi_host.h1
-rw-r--r--include/scsi/scsi_request.h54
-rw-r--r--include/scsi/scsi_transport_iscsi.h119
-rw-r--r--include/scsi/sg_request.h26
-rw-r--r--include/sound/ac97_codec.h1
-rw-r--r--include/sound/asequencer.h4
-rw-r--r--include/sound/asound.h2
-rw-r--r--include/sound/core.h3
-rw-r--r--include/sound/emu10k1.h2
-rw-r--r--include/sound/info.h11
-rw-r--r--include/sound/mpu401.h14
-rw-r--r--include/sound/pcm.h19
-rw-r--r--include/sound/pcm_params.h125
-rw-r--r--include/sound/rawmidi.h3
-rw-r--r--include/sound/tea575x-tuner.h3
-rw-r--r--include/sound/version.h4
402 files changed, 10682 insertions, 4314 deletions
diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h
index e27dc8f29972..b9beceb33141 100644
--- a/include/acpi/acconfig.h
+++ b/include/acpi/acconfig.h
@@ -63,7 +63,7 @@
63 63
64/* Current ACPICA subsystem version in YYYYMMDD format */ 64/* Current ACPICA subsystem version in YYYYMMDD format */
65 65
66#define ACPI_CA_VERSION 0x20060127 66#define ACPI_CA_VERSION 0x20060608
67 67
68/* 68/*
69 * OS name, used for the _OS object. The _OS object is essentially obsolete, 69 * OS name, used for the _OS object. The _OS object is essentially obsolete,
@@ -81,6 +81,7 @@
81#define ACPI_MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */ 81#define ACPI_MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */
82#define ACPI_MAX_EXTPARSE_CACHE_DEPTH 96 /* Parse tree objects */ 82#define ACPI_MAX_EXTPARSE_CACHE_DEPTH 96 /* Parse tree objects */
83#define ACPI_MAX_OBJECT_CACHE_DEPTH 96 /* Interpreter operand objects */ 83#define ACPI_MAX_OBJECT_CACHE_DEPTH 96 /* Interpreter operand objects */
84#define ACPI_MAX_NAMESPACE_CACHE_DEPTH 96 /* Namespace objects */
84 85
85/* 86/*
86 * Should the subsystem abort the loading of an ACPI table if the 87 * Should the subsystem abort the loading of an ACPI table if the
@@ -102,9 +103,9 @@
102 103
103#define ACPI_MAX_SEMAPHORE_COUNT 256 104#define ACPI_MAX_SEMAPHORE_COUNT 256
104 105
105/* Max reference count (for debug only) */ 106/* Maximum object reference count (detects object deletion issues) */
106 107
107#define ACPI_MAX_REFERENCE_COUNT 0x400 108#define ACPI_MAX_REFERENCE_COUNT 0x800
108 109
109/* Size of cached memory mapping for system memory operation region */ 110/* Size of cached memory mapping for system memory operation region */
110 111
@@ -171,12 +172,7 @@
171 172
172/* Array sizes. Used for range checking also */ 173/* Array sizes. Used for range checking also */
173 174
174#define ACPI_NUM_ACCESS_TYPES 6 175#define ACPI_MAX_MATCH_OPCODE 5
175#define ACPI_NUM_UPDATE_RULES 3
176#define ACPI_NUM_LOCK_RULES 2
177#define ACPI_NUM_MATCH_OPS 6
178#define ACPI_NUM_OPCODES 256
179#define ACPI_NUM_FIELD_NAMES 2
180 176
181/* RSDP checksums */ 177/* RSDP checksums */
182 178
@@ -187,10 +183,6 @@
187 183
188#define ACPI_SMBUS_BUFFER_SIZE 34 184#define ACPI_SMBUS_BUFFER_SIZE 34
189 185
190/* Number of strings associated with the _OSI reserved method */
191
192#define ACPI_NUM_OSI_STRINGS 10
193
194/****************************************************************************** 186/******************************************************************************
195 * 187 *
196 * ACPI AML Debugger 188 * ACPI AML Debugger
diff --git a/include/acpi/acdisasm.h b/include/acpi/acdisasm.h
index 11a8fe39cb04..9a7d6921f534 100644
--- a/include/acpi/acdisasm.h
+++ b/include/acpi/acdisasm.h
@@ -50,26 +50,72 @@
50#define BLOCK_PAREN 1 50#define BLOCK_PAREN 1
51#define BLOCK_BRACE 2 51#define BLOCK_BRACE 2
52#define BLOCK_COMMA_LIST 4 52#define BLOCK_COMMA_LIST 4
53#define ACPI_DEFAULT_RESNAME *(u32 *) "__RD"
53 54
54struct acpi_external_list { 55struct acpi_external_list {
55 char *path; 56 char *path;
57 char *internal_path;
56 struct acpi_external_list *next; 58 struct acpi_external_list *next;
59 u32 value;
60 u16 length;
61 u8 type;
57}; 62};
58 63
59extern struct acpi_external_list *acpi_gbl_external_list; 64extern struct acpi_external_list *acpi_gbl_external_list;
60 65
61/* Strings used for decoding flags to ASL keywords */ 66typedef const struct acpi_dmtable_info {
67 u8 opcode;
68 u8 offset;
69 char *name;
70
71} acpi_dmtable_info;
72
73/*
74 * Values for Opcode above.
75 * Note: 0-7 must not change, used as a flag shift value
76 */
77#define ACPI_DMT_FLAG0 0
78#define ACPI_DMT_FLAG1 1
79#define ACPI_DMT_FLAG2 2
80#define ACPI_DMT_FLAG3 3
81#define ACPI_DMT_FLAG4 4
82#define ACPI_DMT_FLAG5 5
83#define ACPI_DMT_FLAG6 6
84#define ACPI_DMT_FLAG7 7
85#define ACPI_DMT_FLAGS0 8
86#define ACPI_DMT_FLAGS2 9
87#define ACPI_DMT_UINT8 10
88#define ACPI_DMT_UINT16 11
89#define ACPI_DMT_UINT24 12
90#define ACPI_DMT_UINT32 13
91#define ACPI_DMT_UINT56 14
92#define ACPI_DMT_UINT64 15
93#define ACPI_DMT_STRING 16
94#define ACPI_DMT_NAME4 17
95#define ACPI_DMT_NAME6 18
96#define ACPI_DMT_NAME8 19
97#define ACPI_DMT_CHKSUM 20
98#define ACPI_DMT_SPACEID 21
99#define ACPI_DMT_GAS 22
100#define ACPI_DMT_MADT 23
101#define ACPI_DMT_SRAT 24
102#define ACPI_DMT_EXIT 25
62 103
63extern const char *acpi_gbl_word_decode[4]; 104typedef
64extern const char *acpi_gbl_irq_decode[2]; 105void (*ACPI_TABLE_HANDLER) (struct acpi_table_header * table);
65extern const char *acpi_gbl_lock_rule[ACPI_NUM_LOCK_RULES]; 106
66extern const char *acpi_gbl_access_types[ACPI_NUM_ACCESS_TYPES]; 107struct acpi_dmtable_data {
67extern const char *acpi_gbl_update_rules[ACPI_NUM_UPDATE_RULES]; 108 char *signature;
68extern const char *acpi_gbl_match_ops[ACPI_NUM_MATCH_OPS]; 109 struct acpi_dmtable_info *table_info;
110 ACPI_TABLE_HANDLER table_handler;
111};
69 112
70struct acpi_op_walk_info { 113struct acpi_op_walk_info {
71 u32 level; 114 u32 level;
115 u32 last_level;
116 u32 count;
72 u32 bit_offset; 117 u32 bit_offset;
118 u32 flags;
73 struct acpi_walk_state *walk_state; 119 struct acpi_walk_state *walk_state;
74}; 120};
75 121
@@ -77,6 +123,100 @@ typedef
77acpi_status(*asl_walk_callback) (union acpi_parse_object * op, 123acpi_status(*asl_walk_callback) (union acpi_parse_object * op,
78 u32 level, void *context); 124 u32 level, void *context);
79 125
126struct acpi_resource_tag {
127 u32 bit_index;
128 char *tag;
129};
130
131/* Strings used for decoding flags to ASL keywords */
132
133extern const char *acpi_gbl_word_decode[];
134extern const char *acpi_gbl_irq_decode[];
135extern const char *acpi_gbl_lock_rule[];
136extern const char *acpi_gbl_access_types[];
137extern const char *acpi_gbl_update_rules[];
138extern const char *acpi_gbl_match_ops[];
139
140extern struct acpi_dmtable_info acpi_dm_table_info_asf0[];
141extern struct acpi_dmtable_info acpi_dm_table_info_asf1[];
142extern struct acpi_dmtable_info acpi_dm_table_info_asf2[];
143extern struct acpi_dmtable_info acpi_dm_table_info_asf3[];
144extern struct acpi_dmtable_info acpi_dm_table_info_asf4[];
145extern struct acpi_dmtable_info acpi_dm_table_info_asf_hdr[];
146extern struct acpi_dmtable_info acpi_dm_table_info_boot[];
147extern struct acpi_dmtable_info acpi_dm_table_info_cpep[];
148extern struct acpi_dmtable_info acpi_dm_table_info_cpep0[];
149extern struct acpi_dmtable_info acpi_dm_table_info_dbgp[];
150extern struct acpi_dmtable_info acpi_dm_table_info_ecdt[];
151extern struct acpi_dmtable_info acpi_dm_table_info_facs[];
152extern struct acpi_dmtable_info acpi_dm_table_info_fadt1[];
153extern struct acpi_dmtable_info acpi_dm_table_info_fadt2[];
154extern struct acpi_dmtable_info acpi_dm_table_info_gas[];
155extern struct acpi_dmtable_info acpi_dm_table_info_header[];
156extern struct acpi_dmtable_info acpi_dm_table_info_hpet[];
157extern struct acpi_dmtable_info acpi_dm_table_info_madt[];
158extern struct acpi_dmtable_info acpi_dm_table_info_madt0[];
159extern struct acpi_dmtable_info acpi_dm_table_info_madt1[];
160extern struct acpi_dmtable_info acpi_dm_table_info_madt2[];
161extern struct acpi_dmtable_info acpi_dm_table_info_madt3[];
162extern struct acpi_dmtable_info acpi_dm_table_info_madt4[];
163extern struct acpi_dmtable_info acpi_dm_table_info_madt5[];
164extern struct acpi_dmtable_info acpi_dm_table_info_madt6[];
165extern struct acpi_dmtable_info acpi_dm_table_info_madt7[];
166extern struct acpi_dmtable_info acpi_dm_table_info_madt8[];
167extern struct acpi_dmtable_info acpi_dm_table_info_madt_hdr[];
168extern struct acpi_dmtable_info acpi_dm_table_info_mcfg[];
169extern struct acpi_dmtable_info acpi_dm_table_info_mcfg0[];
170extern struct acpi_dmtable_info acpi_dm_table_info_rsdp1[];
171extern struct acpi_dmtable_info acpi_dm_table_info_rsdp2[];
172extern struct acpi_dmtable_info acpi_dm_table_info_sbst[];
173extern struct acpi_dmtable_info acpi_dm_table_info_slit[];
174extern struct acpi_dmtable_info acpi_dm_table_info_spcr[];
175extern struct acpi_dmtable_info acpi_dm_table_info_spmi[];
176extern struct acpi_dmtable_info acpi_dm_table_info_srat[];
177extern struct acpi_dmtable_info acpi_dm_table_info_srat0[];
178extern struct acpi_dmtable_info acpi_dm_table_info_srat1[];
179extern struct acpi_dmtable_info acpi_dm_table_info_tcpa[];
180extern struct acpi_dmtable_info acpi_dm_table_info_wdrt[];
181
182/*
183 * dmtable
184 */
185void acpi_dm_dump_data_table(struct acpi_table_header *table);
186
187void
188acpi_dm_dump_table(u32 table_length,
189 u32 table_offset,
190 void *table,
191 u32 sub_table_length, struct acpi_dmtable_info *info);
192
193void acpi_dm_line_header(u32 offset, u32 byte_length, char *name);
194
195void acpi_dm_line_header2(u32 offset, u32 byte_length, char *name, u32 value);
196
197/*
198 * dmtbdump
199 */
200void acpi_dm_dump_asf(struct acpi_table_header *table);
201
202void acpi_dm_dump_cpep(struct acpi_table_header *table);
203
204void acpi_dm_dump_fadt(struct acpi_table_header *table);
205
206void acpi_dm_dump_srat(struct acpi_table_header *table);
207
208void acpi_dm_dump_mcfg(struct acpi_table_header *table);
209
210void acpi_dm_dump_madt(struct acpi_table_header *table);
211
212u32 acpi_dm_dump_rsdp(struct acpi_table_header *table);
213
214void acpi_dm_dump_rsdt(struct acpi_table_header *table);
215
216void acpi_dm_dump_slit(struct acpi_table_header *table);
217
218void acpi_dm_dump_xsdt(struct acpi_table_header *table);
219
80/* 220/*
81 * dmwalk 221 * dmwalk
82 */ 222 */
@@ -84,6 +224,11 @@ void
84acpi_dm_disassemble(struct acpi_walk_state *walk_state, 224acpi_dm_disassemble(struct acpi_walk_state *walk_state,
85 union acpi_parse_object *origin, u32 num_opcodes); 225 union acpi_parse_object *origin, u32 num_opcodes);
86 226
227void
228acpi_dm_walk_parse_tree(union acpi_parse_object *op,
229 asl_walk_callback descending_callback,
230 asl_walk_callback ascending_callback, void *context);
231
87/* 232/*
88 * dmopcode 233 * dmopcode
89 */ 234 */
@@ -166,6 +311,7 @@ void acpi_dm_dump_integer64(u64 value, char *name);
166 311
167void 312void
168acpi_dm_resource_template(struct acpi_op_walk_info *info, 313acpi_dm_resource_template(struct acpi_op_walk_info *info,
314 union acpi_parse_object *op,
169 u8 * byte_data, u32 byte_count); 315 u8 * byte_data, u32 byte_count);
170 316
171u8 acpi_dm_is_resource_template(union acpi_parse_object *op); 317u8 acpi_dm_is_resource_template(union acpi_parse_object *op);
@@ -176,6 +322,8 @@ void acpi_dm_bit_list(u16 mask);
176 322
177void acpi_dm_decode_attribute(u8 attribute); 323void acpi_dm_decode_attribute(u8 attribute);
178 324
325void acpi_dm_descriptor_name(void);
326
179/* 327/*
180 * dmresrcl 328 * dmresrcl
181 */ 329 */
@@ -248,6 +396,15 @@ acpi_dm_vendor_small_descriptor(union aml_resource *resource,
248/* 396/*
249 * dmutils 397 * dmutils
250 */ 398 */
251void acpi_dm_add_to_external_list(char *path); 399void acpi_dm_add_to_external_list(char *path, u8 type, u32 value);
400
401/*
402 * dmrestag
403 */
404void acpi_dm_find_resources(union acpi_parse_object *root);
405
406void
407acpi_dm_check_resource_reference(union acpi_parse_object *op,
408 struct acpi_walk_state *walk_state);
252 409
253#endif /* __ACDISASM_H__ */ 410#endif /* __ACDISASM_H__ */
diff --git a/include/acpi/acdispat.h b/include/acpi/acdispat.h
index c41a926ff317..288f84903af7 100644
--- a/include/acpi/acdispat.h
+++ b/include/acpi/acdispat.h
@@ -194,7 +194,9 @@ acpi_status
194acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, 194acpi_ds_restart_control_method(struct acpi_walk_state *walk_state,
195 union acpi_operand_object *return_desc); 195 union acpi_operand_object *return_desc);
196 196
197void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state); 197void
198acpi_ds_terminate_control_method(union acpi_operand_object *method_desc,
199 struct acpi_walk_state *walk_state);
198 200
199acpi_status 201acpi_status
200acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, 202acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node,
@@ -302,7 +304,7 @@ acpi_ds_init_aml_walk(struct acpi_walk_state *walk_state,
302 struct acpi_namespace_node *method_node, 304 struct acpi_namespace_node *method_node,
303 u8 * aml_start, 305 u8 * aml_start,
304 u32 aml_length, 306 u32 aml_length,
305 struct acpi_parameter_info *info, u8 pass_number); 307 struct acpi_evaluate_info *info, u8 pass_number);
306 308
307acpi_status 309acpi_status
308acpi_ds_obj_stack_pop_and_delete(u32 pop_count, 310acpi_ds_obj_stack_pop_and_delete(u32 pop_count,
diff --git a/include/acpi/acevents.h b/include/acpi/acevents.h
index f2717be4fe0d..234142828e1a 100644
--- a/include/acpi/acevents.h
+++ b/include/acpi/acevents.h
@@ -93,7 +93,7 @@ struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device,
93 */ 93 */
94u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info); 94u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info);
95 95
96acpi_status acpi_ev_walk_gpe_list(ACPI_GPE_CALLBACK gpe_walk_callback); 96acpi_status acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback);
97 97
98acpi_status 98acpi_status
99acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info, 99acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
@@ -138,7 +138,7 @@ acpi_status
138acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, 138acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
139 u32 function, 139 u32 function,
140 acpi_physical_address address, 140 acpi_physical_address address,
141 u32 bit_width, void *value); 141 u32 bit_width, acpi_integer * value);
142 142
143acpi_status 143acpi_status
144acpi_ev_attach_region(union acpi_operand_object *handler_obj, 144acpi_ev_attach_region(union acpi_operand_object *handler_obj,
diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h
index dc768aa580e4..797ca1ea5214 100644
--- a/include/acpi/acexcep.h
+++ b/include/acpi/acexcep.h
@@ -160,8 +160,9 @@
160#define AE_AML_BAD_RESOURCE_VALUE (acpi_status) (0x001F | AE_CODE_AML) 160#define AE_AML_BAD_RESOURCE_VALUE (acpi_status) (0x001F | AE_CODE_AML)
161#define AE_AML_CIRCULAR_REFERENCE (acpi_status) (0x0020 | AE_CODE_AML) 161#define AE_AML_CIRCULAR_REFERENCE (acpi_status) (0x0020 | AE_CODE_AML)
162#define AE_AML_BAD_RESOURCE_LENGTH (acpi_status) (0x0021 | AE_CODE_AML) 162#define AE_AML_BAD_RESOURCE_LENGTH (acpi_status) (0x0021 | AE_CODE_AML)
163#define AE_AML_ILLEGAL_ADDRESS (acpi_status) (0x0022 | AE_CODE_AML)
163 164
164#define AE_CODE_AML_MAX 0x0021 165#define AE_CODE_AML_MAX 0x0022
165 166
166/* 167/*
167 * Internal exceptions used for control 168 * Internal exceptions used for control
@@ -275,7 +276,8 @@ char const *acpi_gbl_exception_names_aml[] = {
275 "AE_AML_NO_RESOURCE_END_TAG", 276 "AE_AML_NO_RESOURCE_END_TAG",
276 "AE_AML_BAD_RESOURCE_VALUE", 277 "AE_AML_BAD_RESOURCE_VALUE",
277 "AE_AML_CIRCULAR_REFERENCE", 278 "AE_AML_CIRCULAR_REFERENCE",
278 "AE_AML_BAD_RESOURCE_LENGTH" 279 "AE_AML_BAD_RESOURCE_LENGTH",
280 "AE_AML_ILLEGAL_ADDRESS"
279}; 281};
280 282
281char const *acpi_gbl_exception_names_ctrl[] = { 283char const *acpi_gbl_exception_names_ctrl[] = {
diff --git a/include/acpi/acglobal.h b/include/acpi/acglobal.h
index 734cc77bf2c7..14531d48f6b6 100644
--- a/include/acpi/acglobal.h
+++ b/include/acpi/acglobal.h
@@ -107,6 +107,7 @@ ACPI_EXTERN u32 acpi_gbl_trace_flags;
107 * 3) Allow access to uninitialized locals/args (auto-init to integer 0) 107 * 3) Allow access to uninitialized locals/args (auto-init to integer 0)
108 * 4) Allow ANY object type to be a source operand for the Store() operator 108 * 4) Allow ANY object type to be a source operand for the Store() operator
109 * 5) Allow unresolved references (invalid target name) in package objects 109 * 5) Allow unresolved references (invalid target name) in package objects
110 * 6) Enable warning messages for behavior that is not ACPI spec compliant
110 */ 111 */
111ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_interpreter_slack, FALSE); 112ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_interpreter_slack, FALSE);
112 113
@@ -114,7 +115,7 @@ ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_interpreter_slack, FALSE);
114 * Automatically serialize ALL control methods? Default is FALSE, meaning 115 * Automatically serialize ALL control methods? Default is FALSE, meaning
115 * to use the Serialized/not_serialized method flags on a per method basis. 116 * to use the Serialized/not_serialized method flags on a per method basis.
116 * Only change this if the ASL code is poorly written and cannot handle 117 * Only change this if the ASL code is poorly written and cannot handle
117 * reentrancy even though methods are marked "not_serialized". 118 * reentrancy even though methods are marked "NotSerialized".
118 */ 119 */
119ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_all_methods_serialized, FALSE); 120ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_all_methods_serialized, FALSE);
120 121
@@ -149,10 +150,10 @@ ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_leave_wake_gpes_disabled, TRUE);
149ACPI_EXTERN u32 acpi_gbl_table_flags; 150ACPI_EXTERN u32 acpi_gbl_table_flags;
150ACPI_EXTERN u32 acpi_gbl_rsdt_table_count; 151ACPI_EXTERN u32 acpi_gbl_rsdt_table_count;
151ACPI_EXTERN struct rsdp_descriptor *acpi_gbl_RSDP; 152ACPI_EXTERN struct rsdp_descriptor *acpi_gbl_RSDP;
152ACPI_EXTERN XSDT_DESCRIPTOR *acpi_gbl_XSDT; 153ACPI_EXTERN struct xsdt_descriptor *acpi_gbl_XSDT;
153ACPI_EXTERN FADT_DESCRIPTOR *acpi_gbl_FADT; 154ACPI_EXTERN struct fadt_descriptor *acpi_gbl_FADT;
154ACPI_EXTERN struct acpi_table_header *acpi_gbl_DSDT; 155ACPI_EXTERN struct acpi_table_header *acpi_gbl_DSDT;
155ACPI_EXTERN FACS_DESCRIPTOR *acpi_gbl_FACS; 156ACPI_EXTERN struct facs_descriptor *acpi_gbl_FACS;
156ACPI_EXTERN struct acpi_common_facs acpi_gbl_common_fACS; 157ACPI_EXTERN struct acpi_common_facs acpi_gbl_common_fACS;
157/* 158/*
158 * Since there may be multiple SSDTs and PSDTs, a single pointer is not 159 * Since there may be multiple SSDTs and PSDTs, a single pointer is not
@@ -177,15 +178,15 @@ ACPI_EXTERN u8 acpi_gbl_integer_nybble_width;
177/* 178/*
178 * ACPI Table info arrays 179 * ACPI Table info arrays
179 */ 180 */
180extern struct acpi_table_list acpi_gbl_table_lists[NUM_ACPI_TABLE_TYPES]; 181extern struct acpi_table_list acpi_gbl_table_lists[ACPI_TABLE_ID_MAX + 1];
181extern struct acpi_table_support acpi_gbl_table_data[NUM_ACPI_TABLE_TYPES]; 182extern struct acpi_table_support acpi_gbl_table_data[ACPI_TABLE_ID_MAX + 1];
182 183
183/* 184/*
184 * Predefined mutex objects. This array contains the 185 * Predefined mutex objects. This array contains the
185 * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs. 186 * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs.
186 * (The table maps local handles to the real OS handles) 187 * (The table maps local handles to the real OS handles)
187 */ 188 */
188ACPI_EXTERN struct acpi_mutex_info acpi_gbl_mutex_info[NUM_MUTEX]; 189ACPI_EXTERN struct acpi_mutex_info acpi_gbl_mutex_info[ACPI_NUM_MUTEX];
189 190
190/***************************************************************************** 191/*****************************************************************************
191 * 192 *
@@ -203,6 +204,7 @@ ACPI_EXTERN struct acpi_memory_list *acpi_gbl_ns_node_list;
203 204
204/* Object caches */ 205/* Object caches */
205 206
207ACPI_EXTERN acpi_cache_t *acpi_gbl_namespace_cache;
206ACPI_EXTERN acpi_cache_t *acpi_gbl_state_cache; 208ACPI_EXTERN acpi_cache_t *acpi_gbl_state_cache;
207ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_cache; 209ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_cache;
208ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_ext_cache; 210ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_ext_cache;
@@ -244,7 +246,6 @@ extern const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT];
244extern const char *acpi_gbl_highest_dstate_names[4]; 246extern const char *acpi_gbl_highest_dstate_names[4];
245extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES]; 247extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES];
246extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS]; 248extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS];
247extern const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STRINGS];
248 249
249/***************************************************************************** 250/*****************************************************************************
250 * 251 *
@@ -291,14 +292,6 @@ ACPI_EXTERN u8 acpi_gbl_cm_single_step;
291 292
292/***************************************************************************** 293/*****************************************************************************
293 * 294 *
294 * Parser globals
295 *
296 ****************************************************************************/
297
298ACPI_EXTERN union acpi_parse_object *acpi_gbl_parsed_namespace_root;
299
300/*****************************************************************************
301 *
302 * Hardware globals 295 * Hardware globals
303 * 296 *
304 ****************************************************************************/ 297 ****************************************************************************/
@@ -321,7 +314,11 @@ ACPI_EXTERN struct acpi_fixed_event_handler
321ACPI_EXTERN struct acpi_gpe_xrupt_info *acpi_gbl_gpe_xrupt_list_head; 314ACPI_EXTERN struct acpi_gpe_xrupt_info *acpi_gbl_gpe_xrupt_list_head;
322ACPI_EXTERN struct acpi_gpe_block_info 315ACPI_EXTERN struct acpi_gpe_block_info
323 *acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS]; 316 *acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS];
317
318/* Spinlocks */
319
324ACPI_EXTERN acpi_handle acpi_gbl_gpe_lock; 320ACPI_EXTERN acpi_handle acpi_gbl_gpe_lock;
321ACPI_EXTERN acpi_handle acpi_gbl_hardware_lock;
325 322
326/***************************************************************************** 323/*****************************************************************************
327 * 324 *
diff --git a/include/acpi/aclocal.h b/include/acpi/aclocal.h
index 8361820d2970..1eeca7adca95 100644
--- a/include/acpi/aclocal.h
+++ b/include/acpi/aclocal.h
@@ -44,7 +44,10 @@
44#ifndef __ACLOCAL_H__ 44#ifndef __ACLOCAL_H__
45#define __ACLOCAL_H__ 45#define __ACLOCAL_H__
46 46
47/* acpisrc:struct_defs -- for acpisrc conversion */
48
47#define ACPI_WAIT_FOREVER 0xFFFF /* u16, as per ACPI spec */ 49#define ACPI_WAIT_FOREVER 0xFFFF /* u16, as per ACPI spec */
50#define ACPI_INFINITE_CONCURRENCY 0xFF
48 51
49typedef void *acpi_mutex; 52typedef void *acpi_mutex;
50typedef u32 acpi_mutex_handle; 53typedef u32 acpi_mutex_handle;
@@ -69,52 +72,55 @@ union acpi_parse_object;
69 * Predefined handles for the mutex objects used within the subsystem 72 * Predefined handles for the mutex objects used within the subsystem
70 * All mutex objects are automatically created by acpi_ut_mutex_initialize. 73 * All mutex objects are automatically created by acpi_ut_mutex_initialize.
71 * 74 *
72 * The acquire/release ordering protocol is implied via this list. Mutexes 75 * The acquire/release ordering protocol is implied via this list. Mutexes
73 * with a lower value must be acquired before mutexes with a higher value. 76 * with a lower value must be acquired before mutexes with a higher value.
74 * 77 *
75 * NOTE: any changes here must be reflected in the acpi_gbl_mutex_names table also! 78 * NOTE: any changes here must be reflected in the acpi_gbl_mutex_names
79 * table below also!
76 */ 80 */
77#define ACPI_MTX_EXECUTE 0 81#define ACPI_MTX_INTERPRETER 0 /* AML Interpreter, main lock */
78#define ACPI_MTX_INTERPRETER 1 82#define ACPI_MTX_CONTROL_METHOD 1 /* Control method termination [TBD: may no longer be necessary] */
79#define ACPI_MTX_PARSER 2 83#define ACPI_MTX_TABLES 2 /* Data for ACPI tables */
80#define ACPI_MTX_DISPATCHER 3 84#define ACPI_MTX_NAMESPACE 3 /* ACPI Namespace */
81#define ACPI_MTX_TABLES 4 85#define ACPI_MTX_EVENTS 4 /* Data for ACPI events */
82#define ACPI_MTX_OP_REGIONS 5 86#define ACPI_MTX_CACHES 5 /* Internal caches, general purposes */
83#define ACPI_MTX_NAMESPACE 6 87#define ACPI_MTX_MEMORY 6 /* Debug memory tracking lists */
84#define ACPI_MTX_EVENTS 7 88#define ACPI_MTX_DEBUG_CMD_COMPLETE 7 /* AML debugger */
85#define ACPI_MTX_HARDWARE 8 89#define ACPI_MTX_DEBUG_CMD_READY 8 /* AML debugger */
86#define ACPI_MTX_CACHES 9 90
87#define ACPI_MTX_MEMORY 10 91#define ACPI_MAX_MUTEX 8
88#define ACPI_MTX_DEBUG_CMD_COMPLETE 11 92#define ACPI_NUM_MUTEX ACPI_MAX_MUTEX+1
89#define ACPI_MTX_DEBUG_CMD_READY 12
90
91#define MAX_MUTEX 12
92#define NUM_MUTEX MAX_MUTEX+1
93 93
94#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) 94#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
95#ifdef DEFINE_ACPI_GLOBALS 95#ifdef DEFINE_ACPI_GLOBALS
96 96
97/* Names for the mutexes used in the subsystem */ 97/* Debug names for the mutexes above */
98 98
99static char *acpi_gbl_mutex_names[] = { 99static char *acpi_gbl_mutex_names[ACPI_NUM_MUTEX] = {
100 "ACPI_MTX_Execute",
101 "ACPI_MTX_Interpreter", 100 "ACPI_MTX_Interpreter",
102 "ACPI_MTX_Parser", 101 "ACPI_MTX_Method",
103 "ACPI_MTX_Dispatcher",
104 "ACPI_MTX_Tables", 102 "ACPI_MTX_Tables",
105 "ACPI_MTX_op_regions",
106 "ACPI_MTX_Namespace", 103 "ACPI_MTX_Namespace",
107 "ACPI_MTX_Events", 104 "ACPI_MTX_Events",
108 "ACPI_MTX_Hardware",
109 "ACPI_MTX_Caches", 105 "ACPI_MTX_Caches",
110 "ACPI_MTX_Memory", 106 "ACPI_MTX_Memory",
111 "ACPI_MTX_debug_cmd_complete", 107 "ACPI_MTX_DebugCmdComplete",
112 "ACPI_MTX_debug_cmd_ready", 108 "ACPI_MTX_DebugCmdReady"
113}; 109};
114 110
115#endif 111#endif
116#endif 112#endif
117 113
114/*
115 * Predefined handles for spinlocks used within the subsystem.
116 * These spinlocks are created by acpi_ut_mutex_initialize
117 */
118#define ACPI_LOCK_GPES 0
119#define ACPI_LOCK_HARDWARE 1
120
121#define ACPI_MAX_LOCK 1
122#define ACPI_NUM_LOCK ACPI_MAX_LOCK+1
123
118/* Owner IDs are used to track namespace nodes for selective deletion */ 124/* Owner IDs are used to track namespace nodes for selective deletion */
119 125
120typedef u8 acpi_owner_id; 126typedef u8 acpi_owner_id;
@@ -129,7 +135,7 @@ typedef u8 acpi_owner_id;
129struct acpi_mutex_info { 135struct acpi_mutex_info {
130 acpi_mutex mutex; 136 acpi_mutex mutex;
131 u32 use_count; 137 u32 use_count;
132 u32 thread_id; 138 acpi_thread_id thread_id;
133}; 139};
134 140
135/* Lock flag parameter for various interfaces */ 141/* Lock flag parameter for various interfaces */
@@ -144,6 +150,8 @@ struct acpi_mutex_info {
144#define ACPI_FIELD_DWORD_GRANULARITY 4 150#define ACPI_FIELD_DWORD_GRANULARITY 4
145#define ACPI_FIELD_QWORD_GRANULARITY 8 151#define ACPI_FIELD_QWORD_GRANULARITY 8
146 152
153#define ACPI_ENTRY_NOT_FOUND NULL
154
147/***************************************************************************** 155/*****************************************************************************
148 * 156 *
149 * Namespace typedefs and structs 157 * Namespace typedefs and structs
@@ -158,49 +166,55 @@ typedef enum {
158 ACPI_IMODE_EXECUTE = 0x0E 166 ACPI_IMODE_EXECUTE = 0x0E
159} acpi_interpreter_mode; 167} acpi_interpreter_mode;
160 168
161/*
162 * The Node describes a named object that appears in the AML
163 * An acpi_node is used to store Nodes.
164 *
165 * data_type is used to differentiate between internal descriptors, and MUST
166 * be the first byte in this structure.
167 */
168union acpi_name_union { 169union acpi_name_union {
169 u32 integer; 170 u32 integer;
170 char ascii[4]; 171 char ascii[4];
171}; 172};
172 173
174/*
175 * The Namespace Node describes a named object that appears in the AML.
176 * descriptor_type is used to differentiate between internal descriptors.
177 *
178 * The node is optimized for both 32-bit and 64-bit platforms:
179 * 20 bytes for the 32-bit case, 32 bytes for the 64-bit case.
180 *
181 * Note: The descriptor_type and Type fields must appear in the identical
182 * position in both the struct acpi_namespace_node and union acpi_operand_object
183 * structures.
184 */
173struct acpi_namespace_node { 185struct acpi_namespace_node {
174 u8 descriptor; /* Used to differentiate object descriptor types */ 186 union acpi_operand_object *object; /* Interpreter object */
175 u8 type; /* Type associated with this name */ 187 u8 descriptor_type; /* Differentiate object descriptor types */
176 u16 reference_count; /* Current count of references and children */ 188 u8 type; /* ACPI Type associated with this name */
189 u8 flags; /* Miscellaneous flags */
190 acpi_owner_id owner_id; /* Node creator */
177 union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */ 191 union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */
178 union acpi_operand_object *object; /* Pointer to attached ACPI object (optional) */
179 struct acpi_namespace_node *child; /* First child */ 192 struct acpi_namespace_node *child; /* First child */
180 struct acpi_namespace_node *peer; /* Next peer */ 193 struct acpi_namespace_node *peer; /* Peer. Parent if ANOBJ_END_OF_PEER_LIST set */
181 u8 owner_id; /* Who created this node */
182 u8 flags;
183
184 /* Fields used by the ASL compiler only */
185 194
186#ifdef ACPI_ASL_COMPILER 195 /*
187 u32 value; 196 * The following fields are used by the ASL compiler and disassembler only
197 */
198#ifdef ACPI_LARGE_NAMESPACE_NODE
188 union acpi_parse_object *op; 199 union acpi_parse_object *op;
200 u32 value;
201 u32 length;
189#endif 202#endif
190}; 203};
191 204
192#define ACPI_ENTRY_NOT_FOUND NULL 205/* Namespace Node flags */
193 206
194/* Node flags */ 207#define ANOBJ_END_OF_PEER_LIST 0x01 /* End-of-list, Peer field points to parent */
208#define ANOBJ_DATA_WIDTH_32 0x02 /* Parent table uses 32-bit math */
209#define ANOBJ_METHOD_ARG 0x04 /* Node is a method argument */
210#define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */
211#define ANOBJ_SUBTREE_HAS_INI 0x10 /* Used to optimize device initialization */
195 212
196#define ANOBJ_RESERVED 0x01 213#define ANOBJ_IS_EXTERNAL 0x08 /* i_aSL only: This object created via External() */
197#define ANOBJ_END_OF_PEER_LIST 0x02 214#define ANOBJ_METHOD_NO_RETVAL 0x10 /* i_aSL only: Method has no return value */
198#define ANOBJ_DATA_WIDTH_32 0x04 /* Parent table is 64-bits */ 215#define ANOBJ_METHOD_SOME_NO_RETVAL 0x20 /* i_aSL only: Method has at least one return value */
199#define ANOBJ_METHOD_ARG 0x08 216#define ANOBJ_IS_BIT_OFFSET 0x40 /* i_aSL only: Reference is a bit offset */
200#define ANOBJ_METHOD_LOCAL 0x10 217#define ANOBJ_IS_REFERENCED 0x80 /* i_aSL only: Object was referenced */
201#define ANOBJ_METHOD_NO_RETVAL 0x20
202#define ANOBJ_METHOD_SOME_NO_RETVAL 0x40
203#define ANOBJ_IS_BIT_OFFSET 0x80
204 218
205/* 219/*
206 * ACPI Table Descriptor. One per ACPI table 220 * ACPI Table Descriptor. One per ACPI table
@@ -212,8 +226,8 @@ struct acpi_table_desc {
212 struct acpi_table_header *pointer; 226 struct acpi_table_header *pointer;
213 u8 *aml_start; 227 u8 *aml_start;
214 u64 physical_address; 228 u64 physical_address;
215 u32 aml_length;
216 acpi_size length; 229 acpi_size length;
230 u32 aml_length;
217 acpi_owner_id owner_id; 231 acpi_owner_id owner_id;
218 u8 type; 232 u8 type;
219 u8 allocation; 233 u8 allocation;
@@ -276,6 +290,9 @@ struct acpi_create_field_info {
276 u8 field_type; 290 u8 field_type;
277}; 291};
278 292
293typedef
294acpi_status(*ACPI_INTERNAL_METHOD) (struct acpi_walk_state * walk_state);
295
279/* 296/*
280 * Bitmapped ACPI types. Used internally only 297 * Bitmapped ACPI types. Used internally only
281 */ 298 */
@@ -377,7 +394,7 @@ struct acpi_gpe_walk_info {
377 struct acpi_gpe_block_info *gpe_block; 394 struct acpi_gpe_block_info *gpe_block;
378}; 395};
379 396
380typedef acpi_status(*ACPI_GPE_CALLBACK) (struct acpi_gpe_xrupt_info * 397typedef acpi_status(*acpi_gpe_callback) (struct acpi_gpe_xrupt_info *
381 gpe_xrupt_info, 398 gpe_xrupt_info,
382 struct acpi_gpe_block_info * 399 struct acpi_gpe_block_info *
383 gpe_block); 400 gpe_block);
@@ -416,13 +433,14 @@ struct acpi_field_info {
416#define ACPI_CONTROL_PREDICATE_FALSE 0xC3 433#define ACPI_CONTROL_PREDICATE_FALSE 0xC3
417#define ACPI_CONTROL_PREDICATE_TRUE 0xC4 434#define ACPI_CONTROL_PREDICATE_TRUE 0xC4
418 435
419#define ACPI_STATE_COMMON /* Two 32-bit fields and a pointer */\ 436#define ACPI_STATE_COMMON \
420 u8 data_type; /* To differentiate various internal objs */\ 437 void *next; \
421 u8 flags; \ 438 u8 descriptor_type; /* To differentiate various internal objs */\
422 u16 value; \ 439 u8 flags; \
423 u16 state; \ 440 u16 value; \
424 u16 reserved; \ 441 u16 state;
425 void *next; 442
443 /* There are 2 bytes available here until the next natural alignment boundary */
426 444
427struct acpi_common_state { 445struct acpi_common_state {
428ACPI_STATE_COMMON}; 446ACPI_STATE_COMMON};
@@ -438,12 +456,12 @@ struct acpi_update_state {
438 * Pkg state - used to traverse nested package structures 456 * Pkg state - used to traverse nested package structures
439 */ 457 */
440struct acpi_pkg_state { 458struct acpi_pkg_state {
441 ACPI_STATE_COMMON union acpi_operand_object *source_object; 459 ACPI_STATE_COMMON u16 index;
460 union acpi_operand_object *source_object;
442 union acpi_operand_object *dest_object; 461 union acpi_operand_object *dest_object;
443 struct acpi_walk_state *walk_state; 462 struct acpi_walk_state *walk_state;
444 void *this_target_obj; 463 void *this_target_obj;
445 u32 num_packages; 464 u32 num_packages;
446 u16 index;
447}; 465};
448 466
449/* 467/*
@@ -451,10 +469,10 @@ struct acpi_pkg_state {
451 * Allows nesting of these constructs 469 * Allows nesting of these constructs
452 */ 470 */
453struct acpi_control_state { 471struct acpi_control_state {
454 ACPI_STATE_COMMON union acpi_parse_object *predicate_op; 472 ACPI_STATE_COMMON u16 opcode;
473 union acpi_parse_object *predicate_op;
455 u8 *aml_predicate_start; /* Start of if/while predicate */ 474 u8 *aml_predicate_start; /* Start of if/while predicate */
456 u8 *package_end; /* End of if/while block */ 475 u8 *package_end; /* End of if/while block */
457 u16 opcode;
458}; 476};
459 477
460/* 478/*
@@ -465,11 +483,11 @@ struct acpi_scope_state {
465}; 483};
466 484
467struct acpi_pscope_state { 485struct acpi_pscope_state {
468 ACPI_STATE_COMMON union acpi_parse_object *op; /* Current op being parsed */ 486 ACPI_STATE_COMMON u32 arg_count; /* Number of fixed arguments */
487 union acpi_parse_object *op; /* Current op being parsed */
469 u8 *arg_end; /* Current argument end */ 488 u8 *arg_end; /* Current argument end */
470 u8 *pkg_end; /* Current package end */ 489 u8 *pkg_end; /* Current package end */
471 u32 arg_list; /* Next argument to parse */ 490 u32 arg_list; /* Next argument to parse */
472 u32 arg_count; /* Number of fixed arguments */
473}; 491};
474 492
475/* 493/*
@@ -477,10 +495,10 @@ struct acpi_pscope_state {
477 * states are created when there are nested control methods executing. 495 * states are created when there are nested control methods executing.
478 */ 496 */
479struct acpi_thread_state { 497struct acpi_thread_state {
480 ACPI_STATE_COMMON struct acpi_walk_state *walk_state_list; /* Head of list of walk_states for this thread */ 498 ACPI_STATE_COMMON u8 current_sync_level; /* Mutex Sync (nested acquire) level */
499 struct acpi_walk_state *walk_state_list; /* Head of list of walk_states for this thread */
481 union acpi_operand_object *acquired_mutex_list; /* List of all currently acquired mutexes */ 500 union acpi_operand_object *acquired_mutex_list; /* List of all currently acquired mutexes */
482 u32 thread_id; /* Running thread ID */ 501 acpi_thread_id thread_id; /* Running thread ID */
483 u8 current_sync_level; /* Mutex Sync (nested acquire) level */
484}; 502};
485 503
486/* 504/*
@@ -488,10 +506,9 @@ struct acpi_thread_state {
488 * AML arguments 506 * AML arguments
489 */ 507 */
490struct acpi_result_values { 508struct acpi_result_values {
491 ACPI_STATE_COMMON 509 ACPI_STATE_COMMON u8 num_results;
492 union acpi_operand_object *obj_desc[ACPI_OBJ_NUM_OPERANDS];
493 u8 num_results;
494 u8 last_insert; 510 u8 last_insert;
511 union acpi_operand_object *obj_desc[ACPI_OBJ_NUM_OPERANDS];
495}; 512};
496 513
497typedef 514typedef
@@ -546,7 +563,7 @@ struct acpi_opcode_info {
546#endif 563#endif
547 u32 parse_args; /* Grammar/Parse time arguments */ 564 u32 parse_args; /* Grammar/Parse time arguments */
548 u32 runtime_args; /* Interpret time arguments */ 565 u32 runtime_args; /* Interpret time arguments */
549 u32 flags; /* Misc flags */ 566 u16 flags; /* Misc flags */
550 u8 object_type; /* Corresponding internal object type */ 567 u8 object_type; /* Corresponding internal object type */
551 u8 class; /* Opcode class */ 568 u8 class; /* Opcode class */
552 u8 type; /* Opcode type */ 569 u8 type; /* Opcode type */
@@ -563,29 +580,31 @@ union acpi_parse_value {
563}; 580};
564 581
565#define ACPI_PARSE_COMMON \ 582#define ACPI_PARSE_COMMON \
566 u8 data_type; /* To differentiate various internal objs */\ 583 union acpi_parse_object *parent; /* Parent op */\
567 u8 flags; /* Type of Op */\ 584 u8 descriptor_type; /* To differentiate various internal objs */\
568 u16 aml_opcode; /* AML opcode */\ 585 u8 flags; /* Type of Op */\
569 u32 aml_offset; /* Offset of declaration in AML */\ 586 u16 aml_opcode; /* AML opcode */\
570 union acpi_parse_object *parent; /* Parent op */\ 587 u32 aml_offset; /* Offset of declaration in AML */\
571 union acpi_parse_object *next; /* Next op */\ 588 union acpi_parse_object *next; /* Next op */\
589 struct acpi_namespace_node *node; /* For use by interpreter */\
590 union acpi_parse_value value; /* Value or args associated with the opcode */\
572 ACPI_DISASM_ONLY_MEMBERS (\ 591 ACPI_DISASM_ONLY_MEMBERS (\
573 u8 disasm_flags; /* Used during AML disassembly */\ 592 u8 disasm_flags; /* Used during AML disassembly */\
574 u8 disasm_opcode; /* Subtype used for disassembly */\ 593 u8 disasm_opcode; /* Subtype used for disassembly */\
575 char aml_op_name[16]) /* Op name (debug only) */\ 594 char aml_op_name[16]) /* Op name (debug only) */
576 /* NON-DEBUG members below: */\ 595
577 struct acpi_namespace_node *node; /* For use by interpreter */\ 596#define ACPI_DASM_BUFFER 0x00
578 union acpi_parse_value value; /* Value or args associated with the opcode */ 597#define ACPI_DASM_RESOURCE 0x01
579 598#define ACPI_DASM_STRING 0x02
580#define ACPI_DASM_BUFFER 0x00 599#define ACPI_DASM_UNICODE 0x03
581#define ACPI_DASM_RESOURCE 0x01 600#define ACPI_DASM_EISAID 0x04
582#define ACPI_DASM_STRING 0x02 601#define ACPI_DASM_MATCHOP 0x05
583#define ACPI_DASM_UNICODE 0x03 602#define ACPI_DASM_LNOT_PREFIX 0x06
584#define ACPI_DASM_EISAID 0x04 603#define ACPI_DASM_LNOT_SUFFIX 0x07
585#define ACPI_DASM_MATCHOP 0x05 604#define ACPI_DASM_IGNORE 0x08
586 605
587/* 606/*
588 * generic operation (for example: If, While, Store) 607 * Generic operation (for example: If, While, Store)
589 */ 608 */
590struct acpi_parse_obj_common { 609struct acpi_parse_obj_common {
591ACPI_PARSE_COMMON}; 610ACPI_PARSE_COMMON};
@@ -601,7 +620,7 @@ struct acpi_parse_obj_named {
601 u32 name; /* 4-byte name or zero if no name */ 620 u32 name; /* 4-byte name or zero if no name */
602}; 621};
603 622
604/* The parse node is the fundamental element of the parse tree */ 623/* This version is used by the i_aSL compiler only */
605 624
606#define ACPI_MAX_PARSEOP_NAME 20 625#define ACPI_MAX_PARSEOP_NAME 20
607 626
@@ -643,7 +662,6 @@ union acpi_parse_object {
643 * method. 662 * method.
644 */ 663 */
645struct acpi_parse_state { 664struct acpi_parse_state {
646 u32 aml_size;
647 u8 *aml_start; /* First AML byte */ 665 u8 *aml_start; /* First AML byte */
648 u8 *aml; /* Next AML byte */ 666 u8 *aml; /* Next AML byte */
649 u8 *aml_end; /* (last + 1) AML byte */ 667 u8 *aml_end; /* (last + 1) AML byte */
@@ -653,22 +671,23 @@ struct acpi_parse_state {
653 struct acpi_namespace_node *start_node; 671 struct acpi_namespace_node *start_node;
654 union acpi_generic_state *scope; /* Current scope */ 672 union acpi_generic_state *scope; /* Current scope */
655 union acpi_parse_object *start_scope; 673 union acpi_parse_object *start_scope;
674 u32 aml_size;
656}; 675};
657 676
658/* Parse object flags */ 677/* Parse object flags */
659 678
660#define ACPI_PARSEOP_GENERIC 0x01 679#define ACPI_PARSEOP_GENERIC 0x01
661#define ACPI_PARSEOP_NAMED 0x02 680#define ACPI_PARSEOP_NAMED 0x02
662#define ACPI_PARSEOP_DEFERRED 0x04 681#define ACPI_PARSEOP_DEFERRED 0x04
663#define ACPI_PARSEOP_BYTELIST 0x08 682#define ACPI_PARSEOP_BYTELIST 0x08
664#define ACPI_PARSEOP_IN_CACHE 0x80 683#define ACPI_PARSEOP_IN_CACHE 0x80
665 684
666/* Parse object disasm_flags */ 685/* Parse object disasm_flags */
667 686
668#define ACPI_PARSEOP_IGNORE 0x01 687#define ACPI_PARSEOP_IGNORE 0x01
669#define ACPI_PARSEOP_PARAMLIST 0x02 688#define ACPI_PARSEOP_PARAMLIST 0x02
670#define ACPI_PARSEOP_EMPTY_TERMLIST 0x04 689#define ACPI_PARSEOP_EMPTY_TERMLIST 0x04
671#define ACPI_PARSEOP_SPECIAL 0x10 690#define ACPI_PARSEOP_SPECIAL 0x10
672 691
673/***************************************************************************** 692/*****************************************************************************
674 * 693 *
@@ -676,8 +695,8 @@ struct acpi_parse_state {
676 * 695 *
677 ****************************************************************************/ 696 ****************************************************************************/
678 697
679#define PCI_ROOT_HID_STRING "PNP0A03" 698#define PCI_ROOT_HID_STRING "PNP0A03"
680#define PCI_EXPRESS_ROOT_HID_STRING "PNP0A08" 699#define PCI_EXPRESS_ROOT_HID_STRING "PNP0A08"
681 700
682struct acpi_bit_register_info { 701struct acpi_bit_register_info {
683 u8 parent_register; 702 u8 parent_register;
@@ -710,13 +729,14 @@ struct acpi_bit_register_info {
710#define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */ 729#define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */
711#define ACPI_BITMASK_WAKE_STATUS 0x8000 730#define ACPI_BITMASK_WAKE_STATUS 0x8000
712 731
713#define ACPI_BITMASK_ALL_FIXED_STATUS (ACPI_BITMASK_TIMER_STATUS | \ 732#define ACPI_BITMASK_ALL_FIXED_STATUS (\
714 ACPI_BITMASK_BUS_MASTER_STATUS | \ 733 ACPI_BITMASK_TIMER_STATUS | \
715 ACPI_BITMASK_GLOBAL_LOCK_STATUS | \ 734 ACPI_BITMASK_BUS_MASTER_STATUS | \
716 ACPI_BITMASK_POWER_BUTTON_STATUS | \ 735 ACPI_BITMASK_GLOBAL_LOCK_STATUS | \
717 ACPI_BITMASK_SLEEP_BUTTON_STATUS | \ 736 ACPI_BITMASK_POWER_BUTTON_STATUS | \
718 ACPI_BITMASK_RT_CLOCK_STATUS | \ 737 ACPI_BITMASK_SLEEP_BUTTON_STATUS | \
719 ACPI_BITMASK_WAKE_STATUS) 738 ACPI_BITMASK_RT_CLOCK_STATUS | \
739 ACPI_BITMASK_WAKE_STATUS)
720 740
721#define ACPI_BITMASK_TIMER_ENABLE 0x0001 741#define ACPI_BITMASK_TIMER_ENABLE 0x0001
722#define ACPI_BITMASK_GLOBAL_LOCK_ENABLE 0x0020 742#define ACPI_BITMASK_GLOBAL_LOCK_ENABLE 0x0020
@@ -820,7 +840,7 @@ struct acpi_bit_register_info {
820 * 840 *
821 ****************************************************************************/ 841 ****************************************************************************/
822 842
823#define ACPI_ASCII_ZERO 0x30 843#define ACPI_ASCII_ZERO 0x30
824 844
825/***************************************************************************** 845/*****************************************************************************
826 * 846 *
@@ -842,9 +862,9 @@ struct acpi_integrity_info {
842 u32 objects; 862 u32 objects;
843}; 863};
844 864
845#define ACPI_DB_REDIRECTABLE_OUTPUT 0x01 865#define ACPI_DB_REDIRECTABLE_OUTPUT 0x01
846#define ACPI_DB_CONSOLE_OUTPUT 0x02 866#define ACPI_DB_CONSOLE_OUTPUT 0x02
847#define ACPI_DB_DUPLICATE_OUTPUT 0x03 867#define ACPI_DB_DUPLICATE_OUTPUT 0x03
848 868
849/***************************************************************************** 869/*****************************************************************************
850 * 870 *
@@ -854,18 +874,18 @@ struct acpi_integrity_info {
854 874
855/* Entry for a memory allocation (debug only) */ 875/* Entry for a memory allocation (debug only) */
856 876
857#define ACPI_MEM_MALLOC 0 877#define ACPI_MEM_MALLOC 0
858#define ACPI_MEM_CALLOC 1 878#define ACPI_MEM_CALLOC 1
859#define ACPI_MAX_MODULE_NAME 16 879#define ACPI_MAX_MODULE_NAME 16
860 880
861#define ACPI_COMMON_DEBUG_MEM_HEADER \ 881#define ACPI_COMMON_DEBUG_MEM_HEADER \
862 struct acpi_debug_mem_block *previous; \ 882 struct acpi_debug_mem_block *previous; \
863 struct acpi_debug_mem_block *next; \ 883 struct acpi_debug_mem_block *next; \
864 u32 size; \ 884 u32 size; \
865 u32 component; \ 885 u32 component; \
866 u32 line; \ 886 u32 line; \
867 char module[ACPI_MAX_MODULE_NAME]; \ 887 char module[ACPI_MAX_MODULE_NAME]; \
868 u8 alloc_type; 888 u8 alloc_type;
869 889
870struct acpi_debug_mem_header { 890struct acpi_debug_mem_header {
871ACPI_COMMON_DEBUG_MEM_HEADER}; 891ACPI_COMMON_DEBUG_MEM_HEADER};
diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h
index f2be2a881730..38f9aa4bef00 100644
--- a/include/acpi/acmacros.h
+++ b/include/acpi/acmacros.h
@@ -56,6 +56,10 @@
56#define ACPI_CLEAR_BIT(target,bit) ((target) &= ~(bit)) 56#define ACPI_CLEAR_BIT(target,bit) ((target) &= ~(bit))
57#define ACPI_MIN(a,b) (((a)<(b))?(a):(b)) 57#define ACPI_MIN(a,b) (((a)<(b))?(a):(b))
58 58
59/* Size calculation */
60
61#define ACPI_ARRAY_LENGTH(x) (sizeof(x) / sizeof((x)[0]))
62
59#if ACPI_MACHINE_WIDTH == 16 63#if ACPI_MACHINE_WIDTH == 16
60 64
61/* 65/*
@@ -99,7 +103,7 @@
99 * printf() format helpers 103 * printf() format helpers
100 */ 104 */
101 105
102/* Split 64-bit integer into two 32-bit values. Use with %8.8X%8.8X */ 106/* Split 64-bit integer into two 32-bit values. Use with %8.8_x%8.8_x */
103 107
104#define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i),ACPI_LODWORD(i) 108#define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i),ACPI_LODWORD(i)
105 109
@@ -130,7 +134,6 @@
130#define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void,(void *) NULL,(acpi_native_uint) i) 134#define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void,(void *) NULL,(acpi_native_uint) i)
131#define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p,(void *) NULL) 135#define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p,(void *) NULL)
132#define ACPI_OFFSET(d,f) (acpi_size) ACPI_PTR_DIFF (&(((d *)0)->f),(void *) NULL) 136#define ACPI_OFFSET(d,f) (acpi_size) ACPI_PTR_DIFF (&(((d *)0)->f),(void *) NULL)
133#define ACPI_FADT_OFFSET(f) ACPI_OFFSET (FADT_DESCRIPTOR, f)
134 137
135#if ACPI_MACHINE_WIDTH == 16 138#if ACPI_MACHINE_WIDTH == 16
136#define ACPI_STORE_POINTER(d,s) ACPI_MOVE_32_TO_32(d,s) 139#define ACPI_STORE_POINTER(d,s) ACPI_MOVE_32_TO_32(d,s)
@@ -141,6 +144,12 @@
141#define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i) 144#define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i)
142#endif 145#endif
143 146
147#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
148#define ACPI_COMPARE_NAME(a,b) (*ACPI_CAST_PTR (u32,(a)) == *ACPI_CAST_PTR (u32,(b)))
149#else
150#define ACPI_COMPARE_NAME(a,b) (!ACPI_STRNCMP (ACPI_CAST_PTR (char,(a)), ACPI_CAST_PTR (char,(b)), ACPI_NAME_SIZE))
151#endif
152
144/* 153/*
145 * Macros for moving data around to/from buffers that are possibly unaligned. 154 * Macros for moving data around to/from buffers that are possibly unaligned.
146 * If the hardware supports the transfer of unaligned data, just do the store. 155 * If the hardware supports the transfer of unaligned data, just do the store.
@@ -341,29 +350,33 @@
341/* 350/*
342 * Rounding macros (Power of two boundaries only) 351 * Rounding macros (Power of two boundaries only)
343 */ 352 */
344#define ACPI_ROUND_DOWN(value,boundary) (((acpi_native_uint)(value)) & \ 353#define ACPI_ROUND_DOWN(value,boundary) (((acpi_native_uint)(value)) & \
345 (~(((acpi_native_uint) boundary)-1))) 354 (~(((acpi_native_uint) boundary)-1)))
346 355
347#define ACPI_ROUND_UP(value,boundary) ((((acpi_native_uint)(value)) + \ 356#define ACPI_ROUND_UP(value,boundary) ((((acpi_native_uint)(value)) + \
348 (((acpi_native_uint) boundary)-1)) & \ 357 (((acpi_native_uint) boundary)-1)) & \
349 (~(((acpi_native_uint) boundary)-1))) 358 (~(((acpi_native_uint) boundary)-1)))
350 359
351#define ACPI_ROUND_DOWN_TO_32_BITS(a) ACPI_ROUND_DOWN(a,4) 360/* Note: sizeof(acpi_native_uint) evaluates to either 2, 4, or 8 */
352#define ACPI_ROUND_DOWN_TO_64_BITS(a) ACPI_ROUND_DOWN(a,8) 361
353#define ACPI_ROUND_DOWN_TO_NATIVE_WORD(a) ACPI_ROUND_DOWN(a,ALIGNED_ADDRESS_BOUNDARY) 362#define ACPI_ROUND_DOWN_TO_32BIT(a) ACPI_ROUND_DOWN(a,4)
363#define ACPI_ROUND_DOWN_TO_64BIT(a) ACPI_ROUND_DOWN(a,8)
364#define ACPI_ROUND_DOWN_TO_NATIVE_WORD(a) ACPI_ROUND_DOWN(a,sizeof(acpi_native_uint))
354 365
355#define ACPI_ROUND_UP_to_32_bITS(a) ACPI_ROUND_UP(a,4) 366#define ACPI_ROUND_UP_TO_32BIT(a) ACPI_ROUND_UP(a,4)
356#define ACPI_ROUND_UP_to_64_bITS(a) ACPI_ROUND_UP(a,8) 367#define ACPI_ROUND_UP_TO_64BIT(a) ACPI_ROUND_UP(a,8)
357#define ACPI_ROUND_UP_TO_NATIVE_WORD(a) ACPI_ROUND_UP(a,ALIGNED_ADDRESS_BOUNDARY) 368#define ACPI_ROUND_UP_TO_NATIVE_WORD(a) ACPI_ROUND_UP(a,sizeof(acpi_native_uint))
358 369
359#define ACPI_ROUND_BITS_UP_TO_BYTES(a) ACPI_DIV_8((a) + 7) 370#define ACPI_ROUND_BITS_UP_TO_BYTES(a) ACPI_DIV_8((a) + 7)
360#define ACPI_ROUND_BITS_DOWN_TO_BYTES(a) ACPI_DIV_8((a)) 371#define ACPI_ROUND_BITS_DOWN_TO_BYTES(a) ACPI_DIV_8((a))
361 372
362#define ACPI_ROUND_UP_TO_1K(a) (((a) + 1023) >> 10) 373#define ACPI_ROUND_UP_TO_1K(a) (((a) + 1023) >> 10)
363 374
364/* Generic (non-power-of-two) rounding */ 375/* Generic (non-power-of-two) rounding */
365 376
366#define ACPI_ROUND_UP_TO(value,boundary) (((value) + ((boundary)-1)) / (boundary)) 377#define ACPI_ROUND_UP_TO(value,boundary) (((value) + ((boundary)-1)) / (boundary))
378
379#define ACPI_IS_MISALIGNED(value) (((acpi_native_uint)value) & (sizeof(acpi_native_uint)-1))
367 380
368/* 381/*
369 * Bitmask creation 382 * Bitmask creation
@@ -371,10 +384,10 @@
371 * MASK_BITS_ABOVE creates a mask starting AT the position and above 384 * MASK_BITS_ABOVE creates a mask starting AT the position and above
372 * MASK_BITS_BELOW creates a mask starting one bit BELOW the position 385 * MASK_BITS_BELOW creates a mask starting one bit BELOW the position
373 */ 386 */
374#define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_INTEGER_MAX) << ((u32) (position)))) 387#define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_INTEGER_MAX) << ((u32) (position))))
375#define ACPI_MASK_BITS_BELOW(position) ((ACPI_INTEGER_MAX) << ((u32) (position))) 388#define ACPI_MASK_BITS_BELOW(position) ((ACPI_INTEGER_MAX) << ((u32) (position)))
376 389
377#define ACPI_IS_OCTAL_DIGIT(d) (((char)(d) >= '0') && ((char)(d) <= '7')) 390#define ACPI_IS_OCTAL_DIGIT(d) (((char)(d) >= '0') && ((char)(d) <= '7'))
378 391
379/* Bitfields within ACPI registers */ 392/* Bitfields within ACPI registers */
380 393
@@ -396,8 +409,8 @@
396 * 409 *
397 * The "Descriptor" field is the first field in both structures. 410 * The "Descriptor" field is the first field in both structures.
398 */ 411 */
399#define ACPI_GET_DESCRIPTOR_TYPE(d) (((union acpi_descriptor *)(void *)(d))->descriptor_id) 412#define ACPI_GET_DESCRIPTOR_TYPE(d) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type)
400#define ACPI_SET_DESCRIPTOR_TYPE(d,t) (((union acpi_descriptor *)(void *)(d))->descriptor_id = t) 413#define ACPI_SET_DESCRIPTOR_TYPE(d,t) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type = t)
401 414
402/* Macro to test the object type */ 415/* Macro to test the object type */
403 416
@@ -486,7 +499,6 @@
486#define ACPI_ERROR(plist) 499#define ACPI_ERROR(plist)
487#define ACPI_ERROR_NAMESPACE(s,e) 500#define ACPI_ERROR_NAMESPACE(s,e)
488#define ACPI_ERROR_METHOD(s,n,p,e) 501#define ACPI_ERROR_METHOD(s,n,p,e)
489
490#endif 502#endif
491 503
492/* 504/*
@@ -514,12 +526,12 @@
514#define ACPI_GET_FUNCTION_NAME _acpi_function_name 526#define ACPI_GET_FUNCTION_NAME _acpi_function_name
515/* 527/*
516 * The Name parameter should be the procedure name as a quoted string. 528 * The Name parameter should be the procedure name as a quoted string.
517 * This is declared as a local string ("my_function_name") so that it can 529 * This is declared as a local string ("MyFunctionName") so that it can
518 * be also used by the function exit macros below. 530 * be also used by the function exit macros below.
519 * Note: (const char) is used to be compatible with the debug interfaces 531 * Note: (const char) is used to be compatible with the debug interfaces
520 * and macros such as __FUNCTION__. 532 * and macros such as __FUNCTION__.
521 */ 533 */
522#define ACPI_FUNCTION_NAME(name) const char *_acpi_function_name = name; 534#define ACPI_FUNCTION_NAME(name) const char *_acpi_function_name = #name;
523 535
524#else 536#else
525/* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */ 537/* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */
@@ -528,13 +540,13 @@
528#endif 540#endif
529 541
530#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \ 542#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \
531 acpi_ut_trace(ACPI_DEBUG_PARAMETERS) 543 acpi_ut_trace(ACPI_DEBUG_PARAMETERS)
532#define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \ 544#define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \
533 acpi_ut_trace_ptr(ACPI_DEBUG_PARAMETERS,(void *)b) 545 acpi_ut_trace_ptr(ACPI_DEBUG_PARAMETERS,(void *)b)
534#define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a) \ 546#define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a) \
535 acpi_ut_trace_u32(ACPI_DEBUG_PARAMETERS,(u32)b) 547 acpi_ut_trace_u32(ACPI_DEBUG_PARAMETERS,(u32)b)
536#define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a) \ 548#define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a) \
537 acpi_ut_trace_str(ACPI_DEBUG_PARAMETERS,(char *)b) 549 acpi_ut_trace_str(ACPI_DEBUG_PARAMETERS,(char *)b)
538 550
539#define ACPI_FUNCTION_ENTRY() acpi_ut_track_stack_ptr() 551#define ACPI_FUNCTION_ENTRY() acpi_ut_track_stack_ptr()
540 552
@@ -543,7 +555,7 @@
543 * WARNING: These macros include a return statement. This is usually considered 555 * WARNING: These macros include a return statement. This is usually considered
544 * bad form, but having a separate exit macro is very ugly and difficult to maintain. 556 * bad form, but having a separate exit macro is very ugly and difficult to maintain.
545 * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros 557 * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros
546 * so that "_acpi_function_name" is defined. 558 * so that "_AcpiFunctionName" is defined.
547 * 559 *
548 * Note: the DO_WHILE0 macro is used to prevent some compilers from complaining 560 * Note: the DO_WHILE0 macro is used to prevent some compilers from complaining
549 * about these constructs. 561 * about these constructs.
@@ -654,6 +666,7 @@
654#define ACPI_DUMP_STACK_ENTRY(a) 666#define ACPI_DUMP_STACK_ENTRY(a)
655#define ACPI_DUMP_OPERANDS(a,b,c,d,e) 667#define ACPI_DUMP_OPERANDS(a,b,c,d,e)
656#define ACPI_DUMP_ENTRY(a,b) 668#define ACPI_DUMP_ENTRY(a,b)
669#define ACPI_DUMP_TABLES(a,b)
657#define ACPI_DUMP_PATHNAME(a,b,c,d) 670#define ACPI_DUMP_PATHNAME(a,b,c,d)
658#define ACPI_DUMP_RESOURCE_LIST(a) 671#define ACPI_DUMP_RESOURCE_LIST(a)
659#define ACPI_DUMP_BUFFER(a,b) 672#define ACPI_DUMP_BUFFER(a,b)
@@ -709,19 +722,19 @@
709 722
710/* Memory allocation */ 723/* Memory allocation */
711 724
712#define ACPI_MEM_ALLOCATE(a) acpi_ut_allocate((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__) 725#define ACPI_ALLOCATE(a) acpi_ut_allocate((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__)
713#define ACPI_MEM_CALLOCATE(a) acpi_ut_callocate((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__) 726#define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__)
714#define ACPI_MEM_FREE(a) acpi_os_free(a) 727#define ACPI_FREE(a) acpi_os_free(a)
715#define ACPI_MEM_TRACKING(a) 728#define ACPI_MEM_TRACKING(a)
716 729
717#else 730#else
718 731
719/* Memory allocation */ 732/* Memory allocation */
720 733
721#define ACPI_MEM_ALLOCATE(a) acpi_ut_allocate_and_track((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__) 734#define ACPI_ALLOCATE(a) acpi_ut_allocate_and_track((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__)
722#define ACPI_MEM_CALLOCATE(a) acpi_ut_callocate_and_track((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__) 735#define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed_and_track((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__)
723#define ACPI_MEM_FREE(a) acpi_ut_free_and_track(a,_COMPONENT,_acpi_module_name,__LINE__) 736#define ACPI_FREE(a) acpi_ut_free_and_track(a,_COMPONENT,_acpi_module_name,__LINE__)
724#define ACPI_MEM_TRACKING(a) a 737#define ACPI_MEM_TRACKING(a) a
725 738
726#endif /* ACPI_DBG_TRACK_ALLOCATIONS */ 739#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
727 740
diff --git a/include/acpi/acnamesp.h b/include/acpi/acnamesp.h
index b667a804fc8a..83b52f9f899a 100644
--- a/include/acpi/acnamesp.h
+++ b/include/acpi/acnamesp.h
@@ -63,6 +63,8 @@
63#define ACPI_NS_DONT_OPEN_SCOPE 0x02 63#define ACPI_NS_DONT_OPEN_SCOPE 0x02
64#define ACPI_NS_NO_PEER_SEARCH 0x04 64#define ACPI_NS_NO_PEER_SEARCH 0x04
65#define ACPI_NS_ERROR_IF_FOUND 0x08 65#define ACPI_NS_ERROR_IF_FOUND 0x08
66#define ACPI_NS_PREFIX_IS_SCOPE 0x10
67#define ACPI_NS_EXTERNAL 0x20
66 68
67#define ACPI_NS_WALK_UNLOCK TRUE 69#define ACPI_NS_WALK_UNLOCK TRUE
68#define ACPI_NS_WALK_NO_UNLOCK FALSE 70#define ACPI_NS_WALK_NO_UNLOCK FALSE
@@ -171,19 +173,17 @@ acpi_ns_dump_objects(acpi_object_type type,
171/* 173/*
172 * nseval - Namespace evaluation functions 174 * nseval - Namespace evaluation functions
173 */ 175 */
174acpi_status acpi_ns_evaluate_by_handle(struct acpi_parameter_info *info); 176acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info);
175
176acpi_status
177acpi_ns_evaluate_by_name(char *pathname, struct acpi_parameter_info *info);
178
179acpi_status
180acpi_ns_evaluate_relative(char *pathname, struct acpi_parameter_info *info);
181 177
182/* 178/*
183 * nsnames - Name and Scope manipulation 179 * nsnames - Name and Scope manipulation
184 */ 180 */
185u32 acpi_ns_opens_scope(acpi_object_type type); 181u32 acpi_ns_opens_scope(acpi_object_type type);
186 182
183void
184acpi_ns_build_external_path(struct acpi_namespace_node *node,
185 acpi_size size, char *name_buffer);
186
187char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node); 187char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node);
188 188
189char *acpi_ns_name_of_current_scope(struct acpi_walk_state *walk_state); 189char *acpi_ns_name_of_current_scope(struct acpi_walk_state *walk_state);
@@ -196,9 +196,9 @@ u8
196acpi_ns_pattern_match(struct acpi_namespace_node *obj_node, char *search_for); 196acpi_ns_pattern_match(struct acpi_namespace_node *obj_node, char *search_for);
197 197
198acpi_status 198acpi_status
199acpi_ns_get_node_by_path(char *external_pathname, 199acpi_ns_get_node(struct acpi_namespace_node *prefix_node,
200 struct acpi_namespace_node *in_prefix_node, 200 char *external_pathname,
201 u32 flags, struct acpi_namespace_node **out_node); 201 u32 flags, struct acpi_namespace_node **out_node);
202 202
203acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node); 203acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node);
204 204
@@ -241,10 +241,10 @@ acpi_ns_search_and_enter(u32 entry_name,
241 u32 flags, struct acpi_namespace_node **ret_node); 241 u32 flags, struct acpi_namespace_node **ret_node);
242 242
243acpi_status 243acpi_status
244acpi_ns_search_node(u32 entry_name, 244acpi_ns_search_one_scope(u32 entry_name,
245 struct acpi_namespace_node *node, 245 struct acpi_namespace_node *node,
246 acpi_object_type type, 246 acpi_object_type type,
247 struct acpi_namespace_node **ret_node); 247 struct acpi_namespace_node **ret_node);
248 248
249void 249void
250acpi_ns_install_node(struct acpi_walk_state *walk_state, 250acpi_ns_install_node(struct acpi_walk_state *walk_state,
diff --git a/include/acpi/acobject.h b/include/acpi/acobject.h
index d130cfed8d55..1747d94084d8 100644
--- a/include/acpi/acobject.h
+++ b/include/acpi/acobject.h
@@ -1,7 +1,7 @@
1 1
2/****************************************************************************** 2/******************************************************************************
3 * 3 *
4 * Name: acobject.h - Definition of union acpi_operand_object (Internal object only) 4 * Name: acobject.h - Definition of union acpi_operand_object (Internal object only)
5 * 5 *
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
@@ -45,10 +45,12 @@
45#ifndef _ACOBJECT_H 45#ifndef _ACOBJECT_H
46#define _ACOBJECT_H 46#define _ACOBJECT_H
47 47
48/* acpisrc:struct_defs -- for acpisrc conversion */
49
48/* 50/*
49 * The union acpi_operand_object is used to pass AML operands from the dispatcher 51 * The union acpi_operand_object is used to pass AML operands from the dispatcher
50 * to the interpreter, and to keep track of the various handlers such as 52 * to the interpreter, and to keep track of the various handlers such as
51 * address space handlers and notify handlers. The object is a constant 53 * address space handlers and notify handlers. The object is a constant
52 * size in order to allow it to be cached and reused. 54 * size in order to allow it to be cached and reused.
53 */ 55 */
54 56
@@ -61,17 +63,25 @@
61/* 63/*
62 * Common area for all objects. 64 * Common area for all objects.
63 * 65 *
64 * data_type is used to differentiate between internal descriptors, and MUST 66 * descriptor_type is used to differentiate between internal descriptors, and
65 * be the first byte in this structure. 67 * must be in the same place across all descriptors
68 *
69 * Note: The descriptor_type and Type fields must appear in the identical
70 * position in both the struct acpi_namespace_node and union acpi_operand_object
71 * structures.
66 */ 72 */
67#define ACPI_OBJECT_COMMON_HEADER /* SIZE/ALIGNMENT: 32 bits, one ptr plus trailing 8-bit flag */\ 73#define ACPI_OBJECT_COMMON_HEADER \
68 u8 descriptor; /* To differentiate various internal objs */\ 74 union acpi_operand_object *next_object; /* Objects linked to parent NS node */\
69 u8 type; /* acpi_object_type */\ 75 u8 descriptor_type; /* To differentiate various internal objs */\
70 u16 reference_count; /* For object deletion management */\ 76 u8 type; /* acpi_object_type */\
71 union acpi_operand_object *next_object; /* Objects linked to parent NS node */\ 77 u16 reference_count; /* For object deletion management */\
72 u8 flags; 78 u8 flags;
73 79 /*
74/* Values for flag byte above */ 80 * Note: There are 3 bytes available here before the
81 * next natural alignment boundary (for both 32/64 cases)
82 */
83
84/* Values for Flag byte above */
75 85
76#define AOPOBJ_AML_CONSTANT 0x01 86#define AOPOBJ_AML_CONSTANT 0x01
77#define AOPOBJ_STATIC_POINTER 0x02 87#define AOPOBJ_STATIC_POINTER 0x02
@@ -79,36 +89,7 @@
79#define AOPOBJ_OBJECT_INITIALIZED 0x08 89#define AOPOBJ_OBJECT_INITIALIZED 0x08
80#define AOPOBJ_SETUP_COMPLETE 0x10 90#define AOPOBJ_SETUP_COMPLETE 0x10
81#define AOPOBJ_SINGLE_DATUM 0x20 91#define AOPOBJ_SINGLE_DATUM 0x20
82 92#define AOPOBJ_INVALID 0x40 /* Used if host OS won't allow an op_region address */
83/*
84 * Common bitfield for the field objects
85 * "Field Datum" -- a datum from the actual field object
86 * "Buffer Datum" -- a datum from a user buffer, read from or to be written to the field
87 */
88#define ACPI_COMMON_FIELD_INFO /* SIZE/ALIGNMENT: 24 bits + three 32-bit values */\
89 u8 field_flags; /* Access, update, and lock bits */\
90 u8 attribute; /* From access_as keyword */\
91 u8 access_byte_width; /* Read/Write size in bytes */\
92 u32 bit_length; /* Length of field in bits */\
93 u32 base_byte_offset; /* Byte offset within containing object */\
94 u8 start_field_bit_offset;/* Bit offset within first field datum (0-63) */\
95 u8 access_bit_width; /* Read/Write size in bits (8-64) */\
96 u32 value; /* Value to store into the Bank or Index register */\
97 struct acpi_namespace_node *node; /* Link back to parent node */
98
99/*
100 * Fields common to both Strings and Buffers
101 */
102#define ACPI_COMMON_BUFFER_INFO \
103 u32 length;
104
105/*
106 * Common fields for objects that support ASL notifications
107 */
108#define ACPI_COMMON_NOTIFY_INFO \
109 union acpi_operand_object *system_notify; /* Handler for system notifies */\
110 union acpi_operand_object *device_notify; /* Handler for driver notifies */\
111 union acpi_operand_object *handler; /* Handler for Address space */
112 93
113/****************************************************************************** 94/******************************************************************************
114 * 95 *
@@ -125,25 +106,31 @@ struct acpi_object_integer {
125 106
126/* 107/*
127 * Note: The String and Buffer object must be identical through the Pointer 108 * Note: The String and Buffer object must be identical through the Pointer
128 * element. There is code that depends on this. 109 * and length elements. There is code that depends on this.
110 *
111 * Fields common to both Strings and Buffers
129 */ 112 */
113#define ACPI_COMMON_BUFFER_INFO(_type) \
114 _type *pointer; \
115 u32 length;
116
130struct acpi_object_string { /* Null terminated, ASCII characters only */ 117struct acpi_object_string { /* Null terminated, ASCII characters only */
131 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO char *pointer; /* String in AML stream or allocated string */ 118 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO(char) /* String in AML stream or allocated string */
132}; 119};
133 120
134struct acpi_object_buffer { 121struct acpi_object_buffer {
135 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO u8 * pointer; /* Buffer in AML stream or allocated buffer */ 122 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO(u8) /* Buffer in AML stream or allocated buffer */
136 struct acpi_namespace_node *node; /* Link back to parent node */
137 u8 *aml_start;
138 u32 aml_length; 123 u32 aml_length;
124 u8 *aml_start;
125 struct acpi_namespace_node *node; /* Link back to parent node */
139}; 126};
140 127
141struct acpi_object_package { 128struct acpi_object_package {
142 ACPI_OBJECT_COMMON_HEADER u32 count; /* # of elements in package */ 129 ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *node; /* Link back to parent node */
143 u32 aml_length;
144 u8 *aml_start;
145 struct acpi_namespace_node *node; /* Link back to parent node */
146 union acpi_operand_object **elements; /* Array of pointers to acpi_objects */ 130 union acpi_operand_object **elements; /* Array of pointers to acpi_objects */
131 u8 *aml_start;
132 u32 aml_length;
133 u32 count; /* # of elements in package */
147}; 134};
148 135
149/****************************************************************************** 136/******************************************************************************
@@ -156,23 +143,6 @@ struct acpi_object_event {
156 ACPI_OBJECT_COMMON_HEADER void *semaphore; 143 ACPI_OBJECT_COMMON_HEADER void *semaphore;
157}; 144};
158 145
159#define ACPI_INFINITE_CONCURRENCY 0xFF
160
161typedef
162acpi_status(*ACPI_INTERNAL_METHOD) (struct acpi_walk_state * walk_state);
163
164struct acpi_object_method {
165 ACPI_OBJECT_COMMON_HEADER u8 method_flags;
166 u8 param_count;
167 u32 aml_length;
168 void *semaphore;
169 u8 *aml_start;
170 ACPI_INTERNAL_METHOD implementation;
171 u8 concurrency;
172 u8 thread_count;
173 acpi_owner_id owner_id;
174};
175
176struct acpi_object_mutex { 146struct acpi_object_mutex {
177 ACPI_OBJECT_COMMON_HEADER u8 sync_level; /* 0-15, specified in Mutex() call */ 147 ACPI_OBJECT_COMMON_HEADER u8 sync_level; /* 0-15, specified in Mutex() call */
178 u16 acquisition_depth; /* Allow multiple Acquires, same thread */ 148 u16 acquisition_depth; /* Allow multiple Acquires, same thread */
@@ -186,11 +156,23 @@ struct acpi_object_mutex {
186 156
187struct acpi_object_region { 157struct acpi_object_region {
188 ACPI_OBJECT_COMMON_HEADER u8 space_id; 158 ACPI_OBJECT_COMMON_HEADER u8 space_id;
189 union acpi_operand_object *handler; /* Handler for region access */
190 struct acpi_namespace_node *node; /* Containing namespace node */ 159 struct acpi_namespace_node *node; /* Containing namespace node */
160 union acpi_operand_object *handler; /* Handler for region access */
191 union acpi_operand_object *next; 161 union acpi_operand_object *next;
192 u32 length;
193 acpi_physical_address address; 162 acpi_physical_address address;
163 u32 length;
164};
165
166struct acpi_object_method {
167 ACPI_OBJECT_COMMON_HEADER u8 method_flags;
168 u8 param_count;
169 u8 concurrency;
170 void *semaphore;
171 u8 *aml_start;
172 ACPI_INTERNAL_METHOD implementation;
173 u32 aml_length;
174 u8 thread_count;
175 acpi_owner_id owner_id;
194}; 176};
195 177
196/****************************************************************************** 178/******************************************************************************
@@ -199,6 +181,14 @@ struct acpi_object_region {
199 * 181 *
200 *****************************************************************************/ 182 *****************************************************************************/
201 183
184/*
185 * Common fields for objects that support ASL notifications
186 */
187#define ACPI_COMMON_NOTIFY_INFO \
188 union acpi_operand_object *system_notify; /* Handler for system notifies */\
189 union acpi_operand_object *device_notify; /* Handler for driver notifies */\
190 union acpi_operand_object *handler; /* Handler for Address space */
191
202struct acpi_object_notify_common { /* COMMON NOTIFY for POWER, PROCESSOR, DEVICE, and THERMAL */ 192struct acpi_object_notify_common { /* COMMON NOTIFY for POWER, PROCESSOR, DEVICE, and THERMAL */
203ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO}; 193ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO};
204 194
@@ -213,9 +203,9 @@ struct acpi_object_power_resource {
213}; 203};
214 204
215struct acpi_object_processor { 205struct acpi_object_processor {
216 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO u32 proc_id; 206 ACPI_OBJECT_COMMON_HEADER u8 proc_id;
217 u32 length; 207 u8 length;
218 acpi_io_address address; 208 ACPI_COMMON_NOTIFY_INFO acpi_io_address address;
219}; 209};
220 210
221struct acpi_object_thermal_zone { 211struct acpi_object_thermal_zone {
@@ -227,9 +217,24 @@ ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO};
227 * 217 *
228 *****************************************************************************/ 218 *****************************************************************************/
229 219
220/*
221 * Common bitfield for the field objects
222 * "Field Datum" -- a datum from the actual field object
223 * "Buffer Datum" -- a datum from a user buffer, read from or to be written to the field
224 */
225#define ACPI_COMMON_FIELD_INFO \
226 u8 field_flags; /* Access, update, and lock bits */\
227 u8 attribute; /* From access_as keyword */\
228 u8 access_byte_width; /* Read/Write size in bytes */\
229 struct acpi_namespace_node *node; /* Link back to parent node */\
230 u32 bit_length; /* Length of field in bits */\
231 u32 base_byte_offset; /* Byte offset within containing object */\
232 u32 value; /* Value to store into the Bank or Index register */\
233 u8 start_field_bit_offset;/* Bit offset within first field datum (0-63) */\
234 u8 access_bit_width; /* Read/Write size in bits (8-64) */
235
230struct acpi_object_field_common { /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */ 236struct acpi_object_field_common { /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */
231 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Containing Operation Region object */ 237 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Parent Operation Region object (REGION/BANK fields only) */
232 /* (REGION/BANK fields only) */
233}; 238};
234 239
235struct acpi_object_region_field { 240struct acpi_object_region_field {
@@ -244,7 +249,7 @@ struct acpi_object_bank_field {
244struct acpi_object_index_field { 249struct acpi_object_index_field {
245 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO 250 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO
246 /* 251 /*
247 * No "region_obj" pointer needed since the Index and Data registers 252 * No "RegionObj" pointer needed since the Index and Data registers
248 * are each field definitions unto themselves. 253 * are each field definitions unto themselves.
249 */ 254 */
250 union acpi_operand_object *index_obj; /* Index register */ 255 union acpi_operand_object *index_obj; /* Index register */
@@ -269,13 +274,9 @@ struct acpi_object_notify_handler {
269 void *context; 274 void *context;
270}; 275};
271 276
272/* Flags for address handler */
273
274#define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED 0x1
275
276struct acpi_object_addr_handler { 277struct acpi_object_addr_handler {
277 ACPI_OBJECT_COMMON_HEADER u8 space_id; 278 ACPI_OBJECT_COMMON_HEADER u8 space_id;
278 u16 hflags; 279 u8 handler_flags;
279 acpi_adr_space_handler handler; 280 acpi_adr_space_handler handler;
280 struct acpi_namespace_node *node; /* Parent device */ 281 struct acpi_namespace_node *node; /* Parent device */
281 void *context; 282 void *context;
@@ -284,6 +285,10 @@ struct acpi_object_addr_handler {
284 union acpi_operand_object *next; 285 union acpi_operand_object *next;
285}; 286};
286 287
288/* Flags for address handler (handler_flags) */
289
290#define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED 0x01
291
287/****************************************************************************** 292/******************************************************************************
288 * 293 *
289 * Special internal objects 294 * Special internal objects
@@ -297,10 +302,10 @@ struct acpi_object_addr_handler {
297struct acpi_object_reference { 302struct acpi_object_reference {
298 ACPI_OBJECT_COMMON_HEADER u8 target_type; /* Used for index_op */ 303 ACPI_OBJECT_COMMON_HEADER u8 target_type; /* Used for index_op */
299 u16 opcode; 304 u16 opcode;
300 u32 offset; /* Used for arg_op, local_op, and index_op */ 305 void *object; /* name_op=>HANDLE to obj, index_op=>union acpi_operand_object */
301 void *object; /* name_op=>HANDLE to obj, index_op=>union acpi_operand_object */
302 struct acpi_namespace_node *node; 306 struct acpi_namespace_node *node;
303 union acpi_operand_object **where; 307 union acpi_operand_object **where;
308 u32 offset; /* Used for arg_op, local_op, and index_op */
304}; 309};
305 310
306/* 311/*
@@ -311,12 +316,10 @@ struct acpi_object_reference {
311 * Currently: Region and field_unit types 316 * Currently: Region and field_unit types
312 */ 317 */
313struct acpi_object_extra { 318struct acpi_object_extra {
314 ACPI_OBJECT_COMMON_HEADER u8 byte_fill1; 319 ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *method_REG; /* _REG method for this region (if any) */
315 u16 word_fill1;
316 u32 aml_length;
317 u8 *aml_start;
318 struct acpi_namespace_node *method_REG; /* _REG method for this region (if any) */
319 void *region_context; /* Region-specific data */ 320 void *region_context; /* Region-specific data */
321 u8 *aml_start;
322 u32 aml_length;
320}; 323};
321 324
322/* Additional data that can be attached to namespace nodes */ 325/* Additional data that can be attached to namespace nodes */
@@ -391,8 +394,13 @@ union acpi_operand_object {
391#define ACPI_DESC_TYPE_NAMED 0x0F 394#define ACPI_DESC_TYPE_NAMED 0x0F
392#define ACPI_DESC_TYPE_MAX 0x0F 395#define ACPI_DESC_TYPE_MAX 0x0F
393 396
397struct acpi_common_descriptor {
398 void *common_pointer;
399 u8 descriptor_type; /* To differentiate various internal objs */
400};
401
394union acpi_descriptor { 402union acpi_descriptor {
395 u8 descriptor_id; /* To differentiate various internal objs */ 403 struct acpi_common_descriptor common;
396 union acpi_operand_object object; 404 union acpi_operand_object object;
397 struct acpi_namespace_node node; 405 struct acpi_namespace_node node;
398 union acpi_parse_object op; 406 union acpi_parse_object op;
diff --git a/include/acpi/acopcode.h b/include/acpi/acopcode.h
index e6d78bd9e90a..7659a46bc432 100644
--- a/include/acpi/acopcode.h
+++ b/include/acpi/acopcode.h
@@ -94,7 +94,7 @@
94#define ARGP_CONCAT_RES_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) 94#define ARGP_CONCAT_RES_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
95#define ARGP_COND_REF_OF_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SUPERNAME) 95#define ARGP_COND_REF_OF_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SUPERNAME)
96#define ARGP_CONTINUE_OP ARG_NONE 96#define ARGP_CONTINUE_OP ARG_NONE
97#define ARGP_COPY_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SIMPLENAME) 97#define ARGP_COPY_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_SIMPLENAME)
98#define ARGP_CREATE_BIT_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) 98#define ARGP_CREATE_BIT_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
99#define ARGP_CREATE_BYTE_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) 99#define ARGP_CREATE_BYTE_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
100#define ARGP_CREATE_DWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) 100#define ARGP_CREATE_DWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h
index 7785d481dc3e..8d5039d0b430 100644
--- a/include/acpi/acoutput.h
+++ b/include/acpi/acoutput.h
@@ -50,7 +50,7 @@
50 * component basis and a per-exception-type basis. 50 * component basis and a per-exception-type basis.
51 */ 51 */
52 52
53/* Component IDs are used in the global "debug_layer" */ 53/* Component IDs are used in the global "DebugLayer" */
54 54
55#define ACPI_UTILITIES 0x00000001 55#define ACPI_UTILITIES 0x00000001
56#define ACPI_HARDWARE 0x00000002 56#define ACPI_HARDWARE 0x00000002
@@ -121,7 +121,7 @@
121#define ACPI_LV_INTERRUPTS 0x08000000 121#define ACPI_LV_INTERRUPTS 0x08000000
122#define ACPI_LV_VERBOSITY3 0x0F000000 | ACPI_LV_VERBOSITY2 122#define ACPI_LV_VERBOSITY3 0x0F000000 | ACPI_LV_VERBOSITY2
123 123
124/* Exceptionally verbose output -- also used in the global "debug_level" */ 124/* Exceptionally verbose output -- also used in the global "DebugLevel" */
125 125
126#define ACPI_LV_AML_DISASSEMBLE 0x10000000 126#define ACPI_LV_AML_DISASSEMBLE 0x10000000
127#define ACPI_LV_VERBOSE_INFO 0x20000000 127#define ACPI_LV_VERBOSE_INFO 0x20000000
@@ -135,7 +135,7 @@
135 */ 135 */
136#define ACPI_DEBUG_LEVEL(dl) (u32) dl,ACPI_DEBUG_PARAMETERS 136#define ACPI_DEBUG_LEVEL(dl) (u32) dl,ACPI_DEBUG_PARAMETERS
137 137
138/* Exception level -- used in the global "debug_level" */ 138/* Exception level -- used in the global "DebugLevel" */
139 139
140#define ACPI_DB_INIT ACPI_DEBUG_LEVEL (ACPI_LV_INIT) 140#define ACPI_DB_INIT ACPI_DEBUG_LEVEL (ACPI_LV_INIT)
141#define ACPI_DB_DEBUG_OBJECT ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT) 141#define ACPI_DB_DEBUG_OBJECT ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT)
@@ -144,13 +144,13 @@
144 144
145/* 145/*
146 * These two levels are essentially obsolete, all instances in the 146 * These two levels are essentially obsolete, all instances in the
147 * ACPICA core code have been replaced by REPORT_ERROR and REPORT_WARNING 147 * ACPICA core code have been replaced by ACPI_ERROR and ACPI_WARNING
148 * (Kept here because some drivers may still use them) 148 * (Kept here because some drivers may still use them)
149 */ 149 */
150#define ACPI_DB_ERROR ACPI_DEBUG_LEVEL (ACPI_LV_ERROR) 150#define ACPI_DB_ERROR ACPI_DEBUG_LEVEL (ACPI_LV_ERROR)
151#define ACPI_DB_WARN ACPI_DEBUG_LEVEL (ACPI_LV_WARN) 151#define ACPI_DB_WARN ACPI_DEBUG_LEVEL (ACPI_LV_WARN)
152 152
153/* Trace level -- also used in the global "debug_level" */ 153/* Trace level -- also used in the global "DebugLevel" */
154 154
155#define ACPI_DB_INIT_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_INIT_NAMES) 155#define ACPI_DB_INIT_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_INIT_NAMES)
156#define ACPI_DB_THREADS ACPI_DEBUG_LEVEL (ACPI_LV_THREADS) 156#define ACPI_DB_THREADS ACPI_DEBUG_LEVEL (ACPI_LV_THREADS)
diff --git a/include/acpi/acparser.h b/include/acpi/acparser.h
index 5a1ff484af33..9d49d3c41cd9 100644
--- a/include/acpi/acparser.h
+++ b/include/acpi/acparser.h
@@ -46,7 +46,7 @@
46 46
47#define OP_HAS_RETURN_VALUE 1 47#define OP_HAS_RETURN_VALUE 1
48 48
49/* variable # arguments */ 49/* Variable number of arguments. This field must be 32 bits */
50 50
51#define ACPI_VAR_ARGS ACPI_UINT32_MAX 51#define ACPI_VAR_ARGS ACPI_UINT32_MAX
52 52
@@ -71,7 +71,7 @@
71/* 71/*
72 * psxface - Parser external interfaces 72 * psxface - Parser external interfaces
73 */ 73 */
74acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info); 74acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info);
75 75
76/* 76/*
77 * psargs - Parse AML opcode arguments 77 * psargs - Parse AML opcode arguments
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 6dca3d542080..a2b3e390a503 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -26,7 +26,7 @@
26#ifndef __ACPI_BUS_H__ 26#ifndef __ACPI_BUS_H__
27#define __ACPI_BUS_H__ 27#define __ACPI_BUS_H__
28 28
29#include <linux/kobject.h> 29#include <linux/device.h>
30 30
31#include <acpi/acpi.h> 31#include <acpi/acpi.h>
32 32
@@ -59,7 +59,7 @@ acpi_evaluate_reference(acpi_handle handle,
59 59
60#define ACPI_BUS_FILE_ROOT "acpi" 60#define ACPI_BUS_FILE_ROOT "acpi"
61extern struct proc_dir_entry *acpi_root_dir; 61extern struct proc_dir_entry *acpi_root_dir;
62extern FADT_DESCRIPTOR acpi_fadt; 62extern struct fadt_descriptor acpi_fadt;
63 63
64enum acpi_bus_removal_type { 64enum acpi_bus_removal_type {
65 ACPI_BUS_REMOVAL_NORMAL = 0, 65 ACPI_BUS_REMOVAL_NORMAL = 0,
@@ -169,7 +169,8 @@ struct acpi_device_flags {
169 u32 power_manageable:1; 169 u32 power_manageable:1;
170 u32 performance_manageable:1; 170 u32 performance_manageable:1;
171 u32 wake_capable:1; /* Wakeup(_PRW) supported? */ 171 u32 wake_capable:1; /* Wakeup(_PRW) supported? */
172 u32 reserved:20; 172 u32 force_power_state:1;
173 u32 reserved:19;
173}; 174};
174 175
175/* File System */ 176/* File System */
@@ -296,6 +297,7 @@ struct acpi_device {
296 struct acpi_driver *driver; 297 struct acpi_driver *driver;
297 void *driver_data; 298 void *driver_data;
298 struct kobject kobj; 299 struct kobject kobj;
300 struct device dev;
299}; 301};
300 302
301#define acpi_driver_data(d) ((d)->driver_data) 303#define acpi_driver_data(d) ((d)->driver_data)
@@ -327,7 +329,7 @@ int acpi_bus_set_power(acpi_handle handle, int state);
327int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data); 329int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data);
328int acpi_bus_receive_event(struct acpi_bus_event *event); 330int acpi_bus_receive_event(struct acpi_bus_event *event);
329int acpi_bus_register_driver(struct acpi_driver *driver); 331int acpi_bus_register_driver(struct acpi_driver *driver);
330int acpi_bus_unregister_driver(struct acpi_driver *driver); 332void acpi_bus_unregister_driver(struct acpi_driver *driver);
331int acpi_bus_add(struct acpi_device **child, struct acpi_device *parent, 333int acpi_bus_add(struct acpi_device **child, struct acpi_device *parent,
332 acpi_handle handle, int type); 334 acpi_handle handle, int type);
333int acpi_bus_trim(struct acpi_device *start, int rmdevice); 335int acpi_bus_trim(struct acpi_device *start, int rmdevice);
diff --git a/include/acpi/acpi_numa.h b/include/acpi/acpi_numa.h
new file mode 100644
index 000000000000..1049f2a0a6db
--- /dev/null
+++ b/include/acpi/acpi_numa.h
@@ -0,0 +1,23 @@
1#ifndef __ACPI_NUMA_H
2#define __ACPI_NUMA_H
3
4#ifdef CONFIG_ACPI_NUMA
5#include <linux/kernel.h>
6
7/* Proximity bitmap length */
8#if MAX_NUMNODES > 256
9#define MAX_PXM_DOMAINS MAX_NUMNODES
10#else
11#define MAX_PXM_DOMAINS (256) /* Old pxm spec is defined 8 bit */
12#endif
13
14extern int __cpuinitdata pxm_to_node_map[MAX_PXM_DOMAINS];
15extern int __cpuinitdata node_to_pxm_map[MAX_NUMNODES];
16
17extern int __cpuinit pxm_to_node(int);
18extern int __cpuinit node_to_pxm(int);
19extern int __cpuinit acpi_map_pxm_to_node(int);
20extern void __cpuinit acpi_unmap_pxm_to_node(int);
21
22#endif /* CONFIG_ACPI_NUMA */
23#endif /* __ACP_NUMA_H */
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index 970e9a6372c3..8f473c83b7c4 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -50,12 +50,16 @@
50#include "platform/acenv.h" 50#include "platform/acenv.h"
51#include "actypes.h" 51#include "actypes.h"
52 52
53/* Priorities for acpi_os_queue_for_execution */ 53/* Types for acpi_os_execute */
54 54
55#define OSD_PRIORITY_GPE 1 55typedef enum {
56#define OSD_PRIORITY_HIGH 2 56 OSL_GLOBAL_LOCK_HANDLER,
57#define OSD_PRIORITY_MED 3 57 OSL_NOTIFY_HANDLER,
58#define OSD_PRIORITY_LO 4 58 OSL_GPE_HANDLER,
59 OSL_DEBUGGER_THREAD,
60 OSL_EC_POLL_HANDLER,
61 OSL_EC_BURST_HANDLER
62} acpi_execute_type;
59 63
60#define ACPI_NO_UNIT_LIMIT ((u32) -1) 64#define ACPI_NO_UNIT_LIMIT ((u32) -1)
61#define ACPI_MUTEX_SEM 1 65#define ACPI_MUTEX_SEM 1
@@ -161,13 +165,11 @@ acpi_os_remove_interrupt_handler(u32 gsi, acpi_osd_handler service_routine);
161/* 165/*
162 * Threads and Scheduling 166 * Threads and Scheduling
163 */ 167 */
164u32 acpi_os_get_thread_id(void); 168acpi_thread_id acpi_os_get_thread_id(void);
165 169
166acpi_status 170acpi_status
167acpi_os_queue_for_execution(u32 priority, 171acpi_os_execute(acpi_execute_type type,
168 acpi_osd_exec_callback function, void *context); 172 acpi_osd_exec_callback function, void *context);
169
170void acpi_os_wait_events_complete(void *context);
171 173
172void acpi_os_wait_events_complete(void *context); 174void acpi_os_wait_events_complete(void *context);
173 175
@@ -214,6 +216,12 @@ acpi_os_derive_pci_id(acpi_handle rhandle,
214/* 216/*
215 * Miscellaneous 217 * Miscellaneous
216 */ 218 */
219acpi_status acpi_os_validate_interface(char *interface);
220
221acpi_status
222acpi_os_validate_address(u8 space_id,
223 acpi_physical_address address, acpi_size length);
224
217u8 acpi_os_readable(void *pointer, acpi_size length); 225u8 acpi_os_readable(void *pointer, acpi_size length);
218 226
219#ifdef ACPI_FUTURE_USAGE 227#ifdef ACPI_FUTURE_USAGE
@@ -255,11 +263,4 @@ char *acpi_os_get_next_filename(void *dir_handle);
255 263
256void acpi_os_close_directory(void *dir_handle); 264void acpi_os_close_directory(void *dir_handle);
257 265
258/*
259 * Debug
260 */
261void
262acpi_os_dbg_assert(void *failed_assertion,
263 void *file_name, u32 line_number, char *message);
264
265#endif /* __ACPIOSXF_H__ */ 266#endif /* __ACPIOSXF_H__ */
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 66cf2ecef57a..049e9aa1b867 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -268,7 +268,7 @@ acpi_status acpi_remove_gpe_block(acpi_handle gpe_device);
268 * Resource interfaces 268 * Resource interfaces
269 */ 269 */
270typedef 270typedef
271acpi_status(*ACPI_WALK_RESOURCE_CALLBACK) (struct acpi_resource * resource, 271acpi_status(*acpi_walk_resource_callback) (struct acpi_resource * resource,
272 void *context); 272 void *context);
273 273
274acpi_status 274acpi_status
@@ -290,7 +290,7 @@ acpi_get_possible_resources(acpi_handle device_handle,
290acpi_status 290acpi_status
291acpi_walk_resources(acpi_handle device_handle, 291acpi_walk_resources(acpi_handle device_handle,
292 char *name, 292 char *name,
293 ACPI_WALK_RESOURCE_CALLBACK user_function, void *context); 293 acpi_walk_resource_callback user_function, void *context);
294 294
295acpi_status 295acpi_status
296acpi_set_current_resources(acpi_handle device_handle, 296acpi_set_current_resources(acpi_handle device_handle,
diff --git a/include/acpi/acresrc.h b/include/acpi/acresrc.h
index fa02e8083381..ad11fc13fbef 100644
--- a/include/acpi/acresrc.h
+++ b/include/acpi/acresrc.h
@@ -164,23 +164,26 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
164/* 164/*
165 * rsutils 165 * rsutils
166 */ 166 */
167
167acpi_status 168acpi_status
168acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); 169acpi_rs_get_prt_method_data(struct acpi_namespace_node *node,
170 struct acpi_buffer *ret_buffer);
169 171
170acpi_status 172acpi_status
171acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); 173acpi_rs_get_crs_method_data(struct acpi_namespace_node *node,
174 struct acpi_buffer *ret_buffer);
172 175
173#ifdef ACPI_FUTURE_USAGE
174acpi_status 176acpi_status
175acpi_rs_get_prs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); 177acpi_rs_get_prs_method_data(struct acpi_namespace_node *node,
176#endif /* ACPI_FUTURE_USAGE */ 178 struct acpi_buffer *ret_buffer);
177 179
178acpi_status 180acpi_status
179acpi_rs_get_method_data(acpi_handle handle, 181acpi_rs_get_method_data(acpi_handle handle,
180 char *path, struct acpi_buffer *ret_buffer); 182 char *path, struct acpi_buffer *ret_buffer);
181 183
182acpi_status 184acpi_status
183acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); 185acpi_rs_set_srs_method_data(struct acpi_namespace_node *node,
186 struct acpi_buffer *ret_buffer);
184 187
185/* 188/*
186 * rscalc 189 * rscalc
@@ -198,8 +201,9 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
198 acpi_size * buffer_size_needed); 201 acpi_size * buffer_size_needed);
199 202
200acpi_status 203acpi_status
201acpi_rs_convert_aml_to_resources(u8 * aml_buffer, 204acpi_rs_convert_aml_to_resources(u8 * aml,
202 u32 aml_buffer_length, u8 * output_buffer); 205 u32 length,
206 u32 offset, u8 resource_index, void **context);
203 207
204acpi_status 208acpi_status
205acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, 209acpi_rs_convert_resources_to_aml(struct acpi_resource *resource,
diff --git a/include/acpi/acstruct.h b/include/acpi/acstruct.h
index d8c1c2cdac0c..5e8095f0f78f 100644
--- a/include/acpi/acstruct.h
+++ b/include/acpi/acstruct.h
@@ -44,6 +44,8 @@
44#ifndef __ACSTRUCT_H__ 44#ifndef __ACSTRUCT_H__
45#define __ACSTRUCT_H__ 45#define __ACSTRUCT_H__
46 46
47/* acpisrc:struct_defs -- for acpisrc conversion */
48
47/***************************************************************************** 49/*****************************************************************************
48 * 50 *
49 * Tree walking typedefs and structs 51 * Tree walking typedefs and structs
@@ -51,67 +53,76 @@
51 ****************************************************************************/ 53 ****************************************************************************/
52 54
53/* 55/*
54 * Walk state - current state of a parse tree walk. Used for both a leisurely stroll through 56 * Walk state - current state of a parse tree walk. Used for both a leisurely
55 * the tree (for whatever reason), and for control method execution. 57 * stroll through the tree (for whatever reason), and for control method
58 * execution.
56 */ 59 */
57#define ACPI_NEXT_OP_DOWNWARD 1 60#define ACPI_NEXT_OP_DOWNWARD 1
58#define ACPI_NEXT_OP_UPWARD 2 61#define ACPI_NEXT_OP_UPWARD 2
59 62
63/*
64 * Groups of definitions for walk_type used for different implementations of
65 * walkers (never simultaneously) - flags for interpreter:
66 */
60#define ACPI_WALK_NON_METHOD 0 67#define ACPI_WALK_NON_METHOD 0
61#define ACPI_WALK_METHOD 1 68#define ACPI_WALK_METHOD 0x01
62#define ACPI_WALK_METHOD_RESTART 2 69#define ACPI_WALK_METHOD_RESTART 0x02
63#define ACPI_WALK_CONST_REQUIRED 3 70
64#define ACPI_WALK_CONST_OPTIONAL 4 71/* Flags for i_aSL compiler only */
72
73#define ACPI_WALK_CONST_REQUIRED 0x10
74#define ACPI_WALK_CONST_OPTIONAL 0x20
65 75
66struct acpi_walk_state { 76struct acpi_walk_state {
67 u8 data_type; /* To differentiate various internal objs MUST BE FIRST! */ 77 struct acpi_walk_state *next; /* Next walk_state in list */
78 u8 descriptor_type; /* To differentiate various internal objs */
68 u8 walk_type; 79 u8 walk_type;
69 acpi_owner_id owner_id; /* Owner of objects created during the walk */ 80 u16 opcode; /* Current AML opcode */
70 u8 last_predicate; /* Result of last predicate */
71 u8 current_result; /* */
72 u8 next_op_info; /* Info about next_op */ 81 u8 next_op_info; /* Info about next_op */
73 u8 num_operands; /* Stack pointer for Operands[] array */ 82 u8 num_operands; /* Stack pointer for Operands[] array */
83 acpi_owner_id owner_id; /* Owner of objects created during the walk */
84 u8 last_predicate; /* Result of last predicate */
85 u8 current_result;
74 u8 return_used; 86 u8 return_used;
75 u16 opcode; /* Current AML opcode */
76 u8 scope_depth; 87 u8 scope_depth;
77 u8 pass_number; /* Parse pass during table load */ 88 u8 pass_number; /* Parse pass during table load */
78 u32 arg_count; /* push for fixed or var args */
79 u32 aml_offset; 89 u32 aml_offset;
80 u32 arg_types; 90 u32 arg_types;
81 u32 method_breakpoint; /* For single stepping */ 91 u32 method_breakpoint; /* For single stepping */
82 u32 user_breakpoint; /* User AML breakpoint */ 92 u32 user_breakpoint; /* User AML breakpoint */
83 u32 parse_flags; 93 u32 parse_flags;
94
95 struct acpi_parse_state parser_state; /* Current state of parser */
84 u32 prev_arg_types; 96 u32 prev_arg_types;
97 u32 arg_count; /* push for fixed or var args */
85 98
86 u8 *aml_last_while;
87 struct acpi_namespace_node arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */ 99 struct acpi_namespace_node arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */
100 struct acpi_namespace_node local_variables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */
101 union acpi_operand_object *operands[ACPI_OBJ_NUM_OPERANDS + 1]; /* Operands passed to the interpreter (+1 for NULL terminator) */
102 union acpi_operand_object **params;
103
104 u8 *aml_last_while;
88 union acpi_operand_object **caller_return_desc; 105 union acpi_operand_object **caller_return_desc;
89 union acpi_generic_state *control_state; /* List of control states (nested IFs) */ 106 union acpi_generic_state *control_state; /* List of control states (nested IFs) */
90 struct acpi_namespace_node *deferred_node; /* Used when executing deferred opcodes */ 107 struct acpi_namespace_node *deferred_node; /* Used when executing deferred opcodes */
91 struct acpi_gpe_event_info *gpe_event_info; /* Info for GPE (_Lxx/_Exx methods only */ 108 struct acpi_gpe_event_info *gpe_event_info; /* Info for GPE (_Lxx/_Exx methods only */
92 union acpi_operand_object *implicit_return_obj; 109 union acpi_operand_object *implicit_return_obj;
93 struct acpi_namespace_node local_variables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */
94 struct acpi_namespace_node *method_call_node; /* Called method Node */ 110 struct acpi_namespace_node *method_call_node; /* Called method Node */
95 union acpi_parse_object *method_call_op; /* method_call Op if running a method */ 111 union acpi_parse_object *method_call_op; /* method_call Op if running a method */
96 union acpi_operand_object *method_desc; /* Method descriptor if running a method */ 112 union acpi_operand_object *method_desc; /* Method descriptor if running a method */
97 struct acpi_namespace_node *method_node; /* Method node if running a method. */ 113 struct acpi_namespace_node *method_node; /* Method node if running a method. */
98 union acpi_parse_object *op; /* Current parser op */ 114 union acpi_parse_object *op; /* Current parser op */
99 union acpi_operand_object *operands[ACPI_OBJ_NUM_OPERANDS + 1]; /* Operands passed to the interpreter (+1 for NULL terminator) */
100 const struct acpi_opcode_info *op_info; /* Info on current opcode */ 115 const struct acpi_opcode_info *op_info; /* Info on current opcode */
101 union acpi_parse_object *origin; /* Start of walk [Obsolete] */ 116 union acpi_parse_object *origin; /* Start of walk [Obsolete] */
102 union acpi_operand_object **params;
103 struct acpi_parse_state parser_state; /* Current state of parser */
104 union acpi_operand_object *result_obj; 117 union acpi_operand_object *result_obj;
105 union acpi_generic_state *results; /* Stack of accumulated results */ 118 union acpi_generic_state *results; /* Stack of accumulated results */
106 union acpi_operand_object *return_desc; /* Return object, if any */ 119 union acpi_operand_object *return_desc; /* Return object, if any */
107 union acpi_generic_state *scope_info; /* Stack of nested scopes */ 120 union acpi_generic_state *scope_info; /* Stack of nested scopes */
108
109 union acpi_parse_object *prev_op; /* Last op that was processed */ 121 union acpi_parse_object *prev_op; /* Last op that was processed */
110 union acpi_parse_object *next_op; /* next op to be processed */ 122 union acpi_parse_object *next_op; /* next op to be processed */
123 struct acpi_thread_state *thread;
111 acpi_parse_downwards descending_callback; 124 acpi_parse_downwards descending_callback;
112 acpi_parse_upwards ascending_callback; 125 acpi_parse_upwards ascending_callback;
113 struct acpi_thread_state *thread;
114 struct acpi_walk_state *next; /* Next walk_state in list */
115}; 126};
116 127
117/* Info used by acpi_ps_init_objects */ 128/* Info used by acpi_ps_init_objects */
@@ -131,32 +142,6 @@ struct acpi_init_walk_info {
131 struct acpi_table_desc *table_desc; 142 struct acpi_table_desc *table_desc;
132}; 143};
133 144
134/* Info used by acpi_ns_initialize_devices */
135
136struct acpi_device_walk_info {
137 u16 device_count;
138 u16 num_STA;
139 u16 num_INI;
140 struct acpi_table_desc *table_desc;
141};
142
143/* TBD: [Restructure] Merge with struct above */
144
145struct acpi_walk_info {
146 u32 debug_level;
147 u32 count;
148 acpi_owner_id owner_id;
149 u8 display_type;
150};
151
152/* Display Types */
153
154#define ACPI_DISPLAY_SUMMARY (u8) 0
155#define ACPI_DISPLAY_OBJECTS (u8) 1
156#define ACPI_DISPLAY_MASK (u8) 1
157
158#define ACPI_DISPLAY_SHORT (u8) 2
159
160struct acpi_get_devices_info { 145struct acpi_get_devices_info {
161 acpi_walk_callback user_function; 146 acpi_walk_callback user_function;
162 void *context; 147 void *context;
@@ -189,16 +174,21 @@ union acpi_aml_operands {
189 } mid; 174 } mid;
190}; 175};
191 176
192/* Internal method parameter list */ 177/*
193 178 * Structure used to pass object evaluation parameters.
194struct acpi_parameter_info { 179 * Purpose is to reduce CPU stack use.
195 struct acpi_namespace_node *node; 180 */
181struct acpi_evaluate_info {
182 struct acpi_namespace_node *prefix_node;
183 char *pathname;
196 union acpi_operand_object *obj_desc; 184 union acpi_operand_object *obj_desc;
197 union acpi_operand_object **parameters; 185 union acpi_operand_object **parameters;
186 struct acpi_namespace_node *resolved_node;
198 union acpi_operand_object *return_object; 187 union acpi_operand_object *return_object;
199 u8 pass_number; 188 u8 pass_number;
200 u8 parameter_type; 189 u8 parameter_type;
201 u8 return_object_type; 190 u8 return_object_type;
191 u8 flags;
202}; 192};
203 193
204/* Types for parameter_type above */ 194/* Types for parameter_type above */
@@ -206,4 +196,35 @@ struct acpi_parameter_info {
206#define ACPI_PARAM_ARGS 0 196#define ACPI_PARAM_ARGS 0
207#define ACPI_PARAM_GPE 1 197#define ACPI_PARAM_GPE 1
208 198
199/* Values for Flags above */
200
201#define ACPI_IGNORE_RETURN_VALUE 1
202
203/* Info used by acpi_ns_initialize_devices */
204
205struct acpi_device_walk_info {
206 u16 device_count;
207 u16 num_STA;
208 u16 num_INI;
209 struct acpi_table_desc *table_desc;
210 struct acpi_evaluate_info *evaluate_info;
211};
212
213/* TBD: [Restructure] Merge with struct above */
214
215struct acpi_walk_info {
216 u32 debug_level;
217 u32 count;
218 acpi_owner_id owner_id;
219 u8 display_type;
220};
221
222/* Display Types */
223
224#define ACPI_DISPLAY_SUMMARY (u8) 0
225#define ACPI_DISPLAY_OBJECTS (u8) 1
226#define ACPI_DISPLAY_MASK (u8) 1
227
228#define ACPI_DISPLAY_SHORT (u8) 2
229
209#endif 230#endif
diff --git a/include/acpi/actables.h b/include/acpi/actables.h
index 30a47542e1c8..4dbaf02fe526 100644
--- a/include/acpi/actables.h
+++ b/include/acpi/actables.h
@@ -136,7 +136,11 @@ acpi_status acpi_tb_is_table_installed(struct acpi_table_desc *new_table_desc);
136acpi_status 136acpi_status
137acpi_tb_verify_table_checksum(struct acpi_table_header *table_header); 137acpi_tb_verify_table_checksum(struct acpi_table_header *table_header);
138 138
139u8 acpi_tb_generate_checksum(void *buffer, u32 length); 139u8 acpi_tb_sum_table(void *buffer, u32 length);
140
141u8 acpi_tb_generate_checksum(struct acpi_table_header *table);
142
143void acpi_tb_set_checksum(struct acpi_table_header *table);
140 144
141acpi_status 145acpi_status
142acpi_tb_validate_table_header(struct acpi_table_header *table_header); 146acpi_tb_validate_table_header(struct acpi_table_header *table_header);
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index ed53f842dad4..b125ceed9cb7 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Name: actbl.h - Table data structures defined in ACPI specification 3 * Name: actbl.h - Basic ACPI Table Definitions
4 * 4 *
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
@@ -45,66 +45,45 @@
45#define __ACTBL_H__ 45#define __ACTBL_H__
46 46
47/* 47/*
48 * Note about bitfields: The u8 type is used for bitfields in ACPI tables. 48 * Values for description table header signatures. Useful because they make
49 * This is the only type that is even remotely portable. Anything else is not 49 * it more difficult to inadvertently type in the wrong signature.
50 * portable, so do not use any other bitfield types.
51 */
52
53/*
54 * Values for description table header signatures
55 */ 50 */
56#define RSDP_NAME "RSDP"
57#define RSDP_SIG "RSD PTR " /* RSDT Pointer signature */
58#define APIC_SIG "APIC" /* Multiple APIC Description Table */
59#define DSDT_SIG "DSDT" /* Differentiated System Description Table */ 51#define DSDT_SIG "DSDT" /* Differentiated System Description Table */
60#define FADT_SIG "FACP" /* Fixed ACPI Description Table */ 52#define FADT_SIG "FACP" /* Fixed ACPI Description Table */
61#define FACS_SIG "FACS" /* Firmware ACPI Control Structure */ 53#define FACS_SIG "FACS" /* Firmware ACPI Control Structure */
62#define PSDT_SIG "PSDT" /* Persistent System Description Table */ 54#define PSDT_SIG "PSDT" /* Persistent System Description Table */
55#define RSDP_SIG "RSD PTR " /* Root System Description Pointer */
63#define RSDT_SIG "RSDT" /* Root System Description Table */ 56#define RSDT_SIG "RSDT" /* Root System Description Table */
64#define XSDT_SIG "XSDT" /* Extended System Description Table */ 57#define XSDT_SIG "XSDT" /* Extended System Description Table */
65#define SSDT_SIG "SSDT" /* Secondary System Description Table */ 58#define SSDT_SIG "SSDT" /* Secondary System Description Table */
66#define SBST_SIG "SBST" /* Smart Battery Specification Table */ 59#define RSDP_NAME "RSDP"
67#define SPIC_SIG "SPIC" /* IOSAPIC table */
68#define BOOT_SIG "BOOT" /* Boot table */
69
70#define GL_OWNED 0x02 /* Ownership of global lock is bit 1 */
71 60
72/* 61/*
73 * Common table types. The base code can remain 62 * All tables and structures must be byte-packed to match the ACPI
74 * constant if the underlying tables are changed 63 * specification, since the tables are provided by the system BIOS
75 */ 64 */
76#define RSDT_DESCRIPTOR struct rsdt_descriptor_rev2
77#define XSDT_DESCRIPTOR struct xsdt_descriptor_rev2
78#define FACS_DESCRIPTOR struct facs_descriptor_rev2
79#define FADT_DESCRIPTOR struct fadt_descriptor_rev2
80
81#pragma pack(1) 65#pragma pack(1)
82 66
83/* 67/*
84 * ACPI Version-independent tables 68 * These are the ACPI tables that are directly consumed by the subsystem.
69 *
70 * The RSDP and FACS do not use the common ACPI table header. All other ACPI
71 * tables use the header.
85 * 72 *
86 * NOTE: The tables that are specific to ACPI versions (1.0, 2.0, etc.) 73 * Note about bitfields: The u8 type is used for bitfields in ACPI tables.
87 * are in separate files. 74 * This is the only type that is even remotely portable. Anything else is not
75 * portable, so do not use any other bitfield types.
88 */ 76 */
89struct rsdp_descriptor { /* Root System Descriptor Pointer */
90 char signature[8]; /* ACPI signature, contains "RSD PTR " */
91 u8 checksum; /* ACPI 1.0 checksum */
92 char oem_id[6]; /* OEM identification */
93 u8 revision; /* Must be (0) for ACPI 1.0 or (2) for ACPI 2.0+ */
94 u32 rsdt_physical_address; /* 32-bit physical address of the RSDT */
95 u32 length; /* XSDT Length in bytes, including header */
96 u64 xsdt_physical_address; /* 64-bit physical address of the XSDT */
97 u8 extended_checksum; /* Checksum of entire table (ACPI 2.0) */
98 char reserved[3]; /* Reserved, must be zero */
99};
100 77
101struct acpi_common_facs { /* Common FACS for internal use */ 78/*******************************************************************************
102 u32 *global_lock; 79 *
103 u64 *firmware_waking_vector; 80 * ACPI Table Header. This common header is used by all tables except the
104 u8 vector_width; 81 * RSDP and FACS. The define is used for direct inclusion of header into
105}; 82 * other ACPI tables
83 *
84 ******************************************************************************/
106 85
107#define ACPI_TABLE_HEADER_DEF /* ACPI common table header */ \ 86#define ACPI_TABLE_HEADER_DEF \
108 char signature[4]; /* ASCII table signature */\ 87 char signature[4]; /* ASCII table signature */\
109 u32 length; /* Length of table in bytes, including this header */\ 88 u32 length; /* Length of table in bytes, including this header */\
110 u8 revision; /* ACPI Specification minor version # */\ 89 u8 revision; /* ACPI Specification minor version # */\
@@ -112,154 +91,239 @@ struct acpi_common_facs { /* Common FACS for internal use */
112 char oem_id[6]; /* ASCII OEM identification */\ 91 char oem_id[6]; /* ASCII OEM identification */\
113 char oem_table_id[8]; /* ASCII OEM table identification */\ 92 char oem_table_id[8]; /* ASCII OEM table identification */\
114 u32 oem_revision; /* OEM revision number */\ 93 u32 oem_revision; /* OEM revision number */\
115 char asl_compiler_id [4]; /* ASCII ASL compiler vendor ID */\ 94 char asl_compiler_id[4]; /* ASCII ASL compiler vendor ID */\
116 u32 asl_compiler_revision; /* ASL compiler version */ 95 u32 asl_compiler_revision; /* ASL compiler version */
117 96
118struct acpi_table_header { /* ACPI common table header */ 97struct acpi_table_header {
119ACPI_TABLE_HEADER_DEF}; 98ACPI_TABLE_HEADER_DEF};
120 99
121/* 100/*
122 * MADT values and structures 101 * GAS - Generic Address Structure (ACPI 2.0+)
123 */ 102 */
103struct acpi_generic_address {
104 u8 address_space_id; /* Address space where struct or register exists */
105 u8 register_bit_width; /* Size in bits of given register */
106 u8 register_bit_offset; /* Bit offset within the register */
107 u8 access_width; /* Minimum Access size (ACPI 3.0) */
108 u64 address; /* 64-bit address of struct or register */
109};
124 110
125/* Values for MADT PCATCompat */ 111/*******************************************************************************
112 *
113 * RSDP - Root System Description Pointer (Signature is "RSD PTR ")
114 *
115 ******************************************************************************/
116
117struct rsdp_descriptor {
118 char signature[8]; /* ACPI signature, contains "RSD PTR " */
119 u8 checksum; /* ACPI 1.0 checksum */
120 char oem_id[6]; /* OEM identification */
121 u8 revision; /* Must be (0) for ACPI 1.0 or (2) for ACPI 2.0+ */
122 u32 rsdt_physical_address; /* 32-bit physical address of the RSDT */
123 u32 length; /* Table length in bytes, including header (ACPI 2.0+) */
124 u64 xsdt_physical_address; /* 64-bit physical address of the XSDT (ACPI 2.0+) */
125 u8 extended_checksum; /* Checksum of entire table (ACPI 2.0+) */
126 u8 reserved[3]; /* Reserved, must be zero */
127};
126 128
127#define DUAL_PIC 0 129#define ACPI_RSDP_REV0_SIZE 20 /* Size of original ACPI 1.0 RSDP */
128#define MULTIPLE_APIC 1
129 130
130/* Master MADT */ 131/*******************************************************************************
132 *
133 * RSDT/XSDT - Root System Description Tables
134 *
135 ******************************************************************************/
131 136
132struct multiple_apic_table { 137struct rsdt_descriptor {
133 ACPI_TABLE_HEADER_DEF /* ACPI common table header */ 138 ACPI_TABLE_HEADER_DEF u32 table_offset_entry[1]; /* Array of pointers to ACPI tables */
134 u32 local_apic_address; /* Physical address of local APIC */ 139};
140
141struct xsdt_descriptor {
142 ACPI_TABLE_HEADER_DEF u64 table_offset_entry[1]; /* Array of pointers to ACPI tables */
143};
144
145/*******************************************************************************
146 *
147 * FACS - Firmware ACPI Control Structure (FACS)
148 *
149 ******************************************************************************/
150
151struct facs_descriptor {
152 char signature[4]; /* ASCII table signature */
153 u32 length; /* Length of structure, in bytes */
154 u32 hardware_signature; /* Hardware configuration signature */
155 u32 firmware_waking_vector; /* 32-bit physical address of the Firmware Waking Vector */
156 u32 global_lock; /* Global Lock for shared hardware resources */
135 157
136 /* Flags (32 bits) */ 158 /* Flags (32 bits) */
137 159
138 u8 PCATcompat:1; /* 00: System also has dual 8259s */ 160 u8 S4bios_f:1; /* 00: S4BIOS support is present */
139 u8:7; /* 01-07: Reserved, must be zero */ 161 u8:7; /* 01-07: Reserved, must be zero */
140 u8 reserved1[3]; /* 08-31: Reserved, must be zero */ 162 u8 reserved1[3]; /* 08-31: Reserved, must be zero */
141};
142 163
143/* Values for Type in APIC_HEADER_DEF */ 164 u64 xfirmware_waking_vector; /* 64-bit version of the Firmware Waking Vector (ACPI 2.0+) */
165 u8 version; /* Version of this table (ACPI 2.0+) */
166 u8 reserved[31]; /* Reserved, must be zero */
167};
144 168
145#define APIC_PROCESSOR 0 169#define ACPI_GLOCK_PENDING 0x01 /* 00: Pending global lock ownership */
146#define APIC_IO 1 170#define ACPI_GLOCK_OWNED 0x02 /* 01: Global lock is owned */
147#define APIC_XRUPT_OVERRIDE 2
148#define APIC_NMI 3
149#define APIC_LOCAL_NMI 4
150#define APIC_ADDRESS_OVERRIDE 5
151#define APIC_IO_SAPIC 6
152#define APIC_LOCAL_SAPIC 7
153#define APIC_XRUPT_SOURCE 8
154#define APIC_RESERVED 9 /* 9 and greater are reserved */
155 171
156/* 172/*
157 * MADT sub-structures (Follow MULTIPLE_APIC_DESCRIPTION_TABLE) 173 * Common FACS - This is a version-independent FACS structure used for internal use only
158 */ 174 */
159#define APIC_HEADER_DEF /* Common APIC sub-structure header */\ 175struct acpi_common_facs {
160 u8 type; \ 176 u32 *global_lock;
161 u8 length; 177 u64 *firmware_waking_vector;
162 178 u8 vector_width;
163struct apic_header {
164APIC_HEADER_DEF};
165
166/* Values for MPS INTI flags */
167
168#define POLARITY_CONFORMS 0
169#define POLARITY_ACTIVE_HIGH 1
170#define POLARITY_RESERVED 2
171#define POLARITY_ACTIVE_LOW 3
172
173#define TRIGGER_CONFORMS 0
174#define TRIGGER_EDGE 1
175#define TRIGGER_RESERVED 2
176#define TRIGGER_LEVEL 3
177
178/* Common flag definitions (16 bits each) */
179
180#define MPS_INTI_FLAGS \
181 u8 polarity : 2; /* 00-01: Polarity of APIC I/O input signals */\
182 u8 trigger_mode : 2; /* 02-03: Trigger mode of APIC input signals */\
183 u8 : 4; /* 04-07: Reserved, must be zero */\
184 u8 reserved1; /* 08-15: Reserved, must be zero */
185
186#define LOCAL_APIC_FLAGS \
187 u8 processor_enabled: 1; /* 00: Processor is usable if set */\
188 u8 : 7; /* 01-07: Reserved, must be zero */\
189 u8 reserved2; /* 08-15: Reserved, must be zero */
190
191/* Sub-structures for MADT */
192
193struct madt_processor_apic {
194 APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */
195 u8 local_apic_id; /* Processor's local APIC id */
196 LOCAL_APIC_FLAGS};
197
198struct madt_io_apic {
199 APIC_HEADER_DEF u8 io_apic_id; /* I/O APIC ID */
200 u8 reserved; /* Reserved - must be zero */
201 u32 address; /* APIC physical address */
202 u32 interrupt; /* Global system interrupt where INTI
203 * lines start */
204}; 179};
205 180
206struct madt_interrupt_override { 181/*******************************************************************************
207 APIC_HEADER_DEF u8 bus; /* 0 - ISA */ 182 *
208 u8 source; /* Interrupt source (IRQ) */ 183 * FADT - Fixed ACPI Description Table (Signature "FACP")
209 u32 interrupt; /* Global system interrupt */ 184 *
210 MPS_INTI_FLAGS}; 185 ******************************************************************************/
186
187/* Fields common to all versions of the FADT */
188
189#define ACPI_FADT_COMMON \
190 ACPI_TABLE_HEADER_DEF \
191 u32 V1_firmware_ctrl; /* 32-bit physical address of FACS */ \
192 u32 V1_dsdt; /* 32-bit physical address of DSDT */ \
193 u8 reserved1; /* System Interrupt Model isn't used in ACPI 2.0*/ \
194 u8 prefer_PM_profile; /* Conveys preferred power management profile to OSPM. */ \
195 u16 sci_int; /* System vector of SCI interrupt */ \
196 u32 smi_cmd; /* Port address of SMI command port */ \
197 u8 acpi_enable; /* Value to write to smi_cmd to enable ACPI */ \
198 u8 acpi_disable; /* Value to write to smi_cmd to disable ACPI */ \
199 u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */ \
200 u8 pstate_cnt; /* Processor performance state control*/ \
201 u32 V1_pm1a_evt_blk; /* Port address of Power Mgt 1a Event Reg Blk */ \
202 u32 V1_pm1b_evt_blk; /* Port address of Power Mgt 1b Event Reg Blk */ \
203 u32 V1_pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */ \
204 u32 V1_pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */ \
205 u32 V1_pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */ \
206 u32 V1_pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ \
207 u32 V1_gpe0_blk; /* Port addr of General Purpose acpi_event 0 Reg Blk */ \
208 u32 V1_gpe1_blk; /* Port addr of General Purpose acpi_event 1 Reg Blk */ \
209 u8 pm1_evt_len; /* Byte Length of ports at pm1_x_evt_blk */ \
210 u8 pm1_cnt_len; /* Byte Length of ports at pm1_x_cnt_blk */ \
211 u8 pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */ \
212 u8 pm_tm_len; /* Byte Length of ports at pm_tm_blk */ \
213 u8 gpe0_blk_len; /* Byte Length of ports at gpe0_blk */ \
214 u8 gpe1_blk_len; /* Byte Length of ports at gpe1_blk */ \
215 u8 gpe1_base; /* Offset in gpe model where gpe1 events start */ \
216 u8 cst_cnt; /* Support for the _CST object and C States change notification.*/ \
217 u16 plvl2_lat; /* Worst case HW latency to enter/exit C2 state */ \
218 u16 plvl3_lat; /* Worst case HW latency to enter/exit C3 state */ \
219 u16 flush_size; /* Processor's memory cache line width, in bytes */ \
220 u16 flush_stride; /* Number of flush strides that need to be read */ \
221 u8 duty_offset; /* Processor's duty cycle index in processor's P_CNT reg*/ \
222 u8 duty_width; /* Processor's duty cycle value bit width in P_CNT register.*/ \
223 u8 day_alrm; /* Index to day-of-month alarm in RTC CMOS RAM */ \
224 u8 mon_alrm; /* Index to month-of-year alarm in RTC CMOS RAM */ \
225 u8 century; /* Index to century in RTC CMOS RAM */ \
226 u16 iapc_boot_arch; /* IA-PC Boot Architecture Flags. See Table 5-10 for description*/ \
227 u8 reserved2; /* Reserved, must be zero */
211 228
212struct madt_nmi_source { 229/*
213 APIC_HEADER_DEF MPS_INTI_FLAGS u32 interrupt; /* Global system interrupt */ 230 * ACPI 2.0+ FADT
231 */
232struct fadt_descriptor {
233 ACPI_FADT_COMMON
234 /* Flags (32 bits) */
235 u8 wb_invd:1; /* 00: The wbinvd instruction works properly */
236 u8 wb_invd_flush:1; /* 01: The wbinvd flushes but does not invalidate */
237 u8 proc_c1:1; /* 02: All processors support C1 state */
238 u8 plvl2_up:1; /* 03: C2 state works on MP system */
239 u8 pwr_button:1; /* 04: Power button is handled as a generic feature */
240 u8 sleep_button:1; /* 05: Sleep button is handled as a generic feature, or not present */
241 u8 fixed_rTC:1; /* 06: RTC wakeup stat not in fixed register space */
242 u8 rtcs4:1; /* 07: RTC wakeup stat not possible from S4 */
243 u8 tmr_val_ext:1; /* 08: tmr_val is 32 bits 0=24-bits */
244 u8 dock_cap:1; /* 09: Docking supported */
245 u8 reset_reg_sup:1; /* 10: System reset via the FADT RESET_REG supported */
246 u8 sealed_case:1; /* 11: No internal expansion capabilities and case is sealed */
247 u8 headless:1; /* 12: No local video capabilities or local input devices */
248 u8 cpu_sw_sleep:1; /* 13: Must execute native instruction after writing SLP_TYPx register */
249
250 u8 pci_exp_wak:1; /* 14: System supports PCIEXP_WAKE (STS/EN) bits (ACPI 3.0) */
251 u8 use_platform_clock:1; /* 15: OSPM should use platform-provided timer (ACPI 3.0) */
252 u8 S4rtc_sts_valid:1; /* 16: Contents of RTC_STS valid after S4 wake (ACPI 3.0) */
253 u8 remote_power_on_capable:1; /* 17: System is compatible with remote power on (ACPI 3.0) */
254 u8 force_apic_cluster_model:1; /* 18: All local APICs must use cluster model (ACPI 3.0) */
255 u8 force_apic_physical_destination_mode:1; /* 19: All local x_aPICs must use physical dest mode (ACPI 3.0) */
256 u8:4; /* 20-23: Reserved, must be zero */
257 u8 reserved3; /* 24-31: Reserved, must be zero */
258
259 struct acpi_generic_address reset_register; /* Reset register address in GAS format */
260 u8 reset_value; /* Value to write to the reset_register port to reset the system */
261 u8 reserved4[3]; /* These three bytes must be zero */
262 u64 xfirmware_ctrl; /* 64-bit physical address of FACS */
263 u64 Xdsdt; /* 64-bit physical address of DSDT */
264 struct acpi_generic_address xpm1a_evt_blk; /* Extended Power Mgt 1a acpi_event Reg Blk address */
265 struct acpi_generic_address xpm1b_evt_blk; /* Extended Power Mgt 1b acpi_event Reg Blk address */
266 struct acpi_generic_address xpm1a_cnt_blk; /* Extended Power Mgt 1a Control Reg Blk address */
267 struct acpi_generic_address xpm1b_cnt_blk; /* Extended Power Mgt 1b Control Reg Blk address */
268 struct acpi_generic_address xpm2_cnt_blk; /* Extended Power Mgt 2 Control Reg Blk address */
269 struct acpi_generic_address xpm_tmr_blk; /* Extended Power Mgt Timer Ctrl Reg Blk address */
270 struct acpi_generic_address xgpe0_blk; /* Extended General Purpose acpi_event 0 Reg Blk address */
271 struct acpi_generic_address xgpe1_blk; /* Extended General Purpose acpi_event 1 Reg Blk address */
214}; 272};
215 273
216struct madt_local_apic_nmi { 274/*
217 APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */ 275 * "Down-revved" ACPI 2.0 FADT descriptor
218 MPS_INTI_FLAGS u8 lint; /* LINTn to which NMI is connected */ 276 * Defined here to allow compiler to generate the length of the struct
277 */
278struct fadt_descriptor_rev2_minus {
279 ACPI_FADT_COMMON u32 flags;
280 struct acpi_generic_address reset_register; /* Reset register address in GAS format */
281 u8 reset_value; /* Value to write to the reset_register port to reset the system. */
282 u8 reserved7[3]; /* Reserved, must be zero */
219}; 283};
220 284
221struct madt_address_override { 285/*
222 APIC_HEADER_DEF u16 reserved; /* Reserved, must be zero */ 286 * ACPI 1.0 FADT
223 u64 address; /* APIC physical address */ 287 * Defined here to allow compiler to generate the length of the struct
288 */
289struct fadt_descriptor_rev1 {
290 ACPI_FADT_COMMON u32 flags;
224}; 291};
225 292
226struct madt_io_sapic { 293/* FADT: Prefered Power Management Profiles */
227 APIC_HEADER_DEF u8 io_sapic_id; /* I/O SAPIC ID */
228 u8 reserved; /* Reserved, must be zero */
229 u32 interrupt_base; /* Glocal interrupt for SAPIC start */
230 u64 address; /* SAPIC physical address */
231};
232 294
233struct madt_local_sapic { 295#define PM_UNSPECIFIED 0
234 APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */ 296#define PM_DESKTOP 1
235 u8 local_sapic_id; /* SAPIC ID */ 297#define PM_MOBILE 2
236 u8 local_sapic_eid; /* SAPIC EID */ 298#define PM_WORKSTATION 3
237 u8 reserved[3]; /* Reserved, must be zero */ 299#define PM_ENTERPRISE_SERVER 4
238 LOCAL_APIC_FLAGS u32 processor_uID; /* Numeric UID - ACPI 3.0 */ 300#define PM_SOHO_SERVER 5
239 char processor_uIDstring[1]; /* String UID - ACPI 3.0 */ 301#define PM_APPLIANCE_PC 6
240};
241 302
242struct madt_interrupt_source { 303/* FADT: Boot Arch Flags */
243 APIC_HEADER_DEF MPS_INTI_FLAGS u8 interrupt_type; /* 1=PMI, 2=INIT, 3=corrected */
244 u8 processor_id; /* Processor ID */
245 u8 processor_eid; /* Processor EID */
246 u8 io_sapic_vector; /* Vector value for PMI interrupts */
247 u32 interrupt; /* Global system interrupt */
248 u32 flags; /* Interrupt Source Flags */
249};
250 304
251/* 305#define BAF_LEGACY_DEVICES 0x0001
252 * Smart Battery 306#define BAF_8042_KEYBOARD_CONTROLLER 0x0002
253 */ 307
254struct smart_battery_table { 308#define FADT2_REVISION_ID 3
255 ACPI_TABLE_HEADER_DEF u32 warning_level; 309#define FADT2_MINUS_REVISION_ID 2
256 u32 low_level; 310
257 u32 critical_level; 311/* Reset to default packing */
258};
259 312
260#pragma pack() 313#pragma pack()
261 314
262/* 315/*
316 * This macro is temporary until the table bitfield flag definitions
317 * are removed and replaced by a Flags field.
318 */
319#define ACPI_FLAG_OFFSET(d,f,o) (u8) (ACPI_OFFSET (d,f) + \
320 sizeof(((d *)0)->f) + o)
321/*
322 * Get the remaining ACPI tables
323 */
324#include "actbl1.h"
325
326/*
263 * ACPI Table information. We save the table address, length, 327 * ACPI Table information. We save the table address, length,
264 * and type of memory allocation (mapped or allocated) for each 328 * and type of memory allocation (mapped or allocated) for each
265 * table for 1) when we exit, and 2) if a new table is installed 329 * table for 1) when we exit, and 2) if a new table is installed
@@ -290,27 +354,17 @@ struct acpi_table_support {
290 u8 flags; 354 u8 flags;
291}; 355};
292 356
293/*
294 * Get the ACPI version-specific tables
295 */
296#include "actbl1.h" /* Acpi 1.0 table definitions */
297#include "actbl2.h" /* Acpi 2.0 table definitions */
298
299extern u8 acpi_fadt_is_v1; /* is set to 1 if FADT is revision 1, 357extern u8 acpi_fadt_is_v1; /* is set to 1 if FADT is revision 1,
300 * needed for certain workarounds */ 358 * needed for certain workarounds */
359/* Macros used to generate offsets to specific table fields */
301 360
302#pragma pack(1) 361#define ACPI_FACS_OFFSET(f) (u8) ACPI_OFFSET (struct facs_descriptor,f)
303/* 362#define ACPI_FADT_OFFSET(f) (u8) ACPI_OFFSET (struct fadt_descriptor, f)
304 * High performance timer 363#define ACPI_GAS_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_generic_address,f)
305 */ 364#define ACPI_HDR_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_header,f)
306struct hpet_table { 365#define ACPI_RSDP_OFFSET(f) (u8) ACPI_OFFSET (struct rsdp_descriptor,f)
307 ACPI_TABLE_HEADER_DEF u32 hardware_id;
308 struct acpi_generic_address base_address;
309 u8 hpet_number;
310 u16 clock_tick;
311 u8 attributes;
312};
313 366
314#pragma pack() 367#define ACPI_FADT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct fadt_descriptor,f,o)
368#define ACPI_FACS_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct facs_descriptor,f,o)
315 369
316#endif /* __ACTBL_H__ */ 370#endif /* __ACTBL_H__ */
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
index cd428d57add0..745a6445a4f9 100644
--- a/include/acpi/actbl1.h
+++ b/include/acpi/actbl1.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Name: actbl1.h - ACPI 1.0 tables 3 * Name: actbl1.h - Additional ACPI table definitions
4 * 4 *
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
@@ -44,92 +44,599 @@
44#ifndef __ACTBL1_H__ 44#ifndef __ACTBL1_H__
45#define __ACTBL1_H__ 45#define __ACTBL1_H__
46 46
47/*******************************************************************************
48 *
49 * Additional ACPI Tables
50 *
51 * These tables are not consumed directly by the ACPICA subsystem, but are
52 * included here to support device drivers and the AML disassembler.
53 *
54 ******************************************************************************/
55
56/*
57 * Values for description table header signatures. Useful because they make
58 * it more difficult to inadvertently type in the wrong signature.
59 */
60#define ACPI_SIG_ASF "ASF!" /* Alert Standard Format table */
61#define ACPI_SIG_BOOT "BOOT" /* Simple Boot Flag Table */
62#define ACPI_SIG_CPEP "CPEP" /* Corrected Platform Error Polling table */
63#define ACPI_SIG_DBGP "DBGP" /* Debug Port table */
64#define ACPI_SIG_ECDT "ECDT" /* Embedded Controller Boot Resources Table */
65#define ACPI_SIG_HPET "HPET" /* High Precision Event Timer table */
66#define ACPI_SIG_MADT "APIC" /* Multiple APIC Description Table */
67#define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */
68#define ACPI_SIG_SBST "SBST" /* Smart Battery Specification Table */
69#define ACPI_SIG_SLIT "SLIT" /* System Locality Distance Information Table */
70#define ACPI_SIG_SPCR "SPCR" /* Serial Port Console Redirection table */
71#define ACPI_SIG_SPMI "SPMI" /* Server Platform Management Interface table */
72#define ACPI_SIG_SRAT "SRAT" /* System Resource Affinity Table */
73#define ACPI_SIG_TCPA "TCPA" /* Trusted Computing Platform Alliance table */
74#define ACPI_SIG_WDRT "WDRT" /* Watchdog Resource Table */
75
76/* Legacy names */
77
78#define APIC_SIG "APIC" /* Multiple APIC Description Table */
79#define BOOT_SIG "BOOT" /* Simple Boot Flag Table */
80#define SBST_SIG "SBST" /* Smart Battery Specification Table */
81
82/*
83 * All tables must be byte-packed to match the ACPI specification, since
84 * the tables are provided by the system BIOS.
85 */
47#pragma pack(1) 86#pragma pack(1)
48 87
49/* 88/*
50 * ACPI 1.0 Root System Description Table (RSDT) 89 * Note about bitfields: The u8 type is used for bitfields in ACPI tables.
90 * This is the only type that is even remotely portable. Anything else is not
91 * portable, so do not use any other bitfield types.
51 */ 92 */
52struct rsdt_descriptor_rev1 { 93
53 ACPI_TABLE_HEADER_DEF /* ACPI common table header */ 94/*******************************************************************************
54 u32 table_offset_entry[1]; /* Array of pointers to ACPI tables */ 95 *
55}; 96 * ASF - Alert Standard Format table (Signature "ASF!")
97 *
98 ******************************************************************************/
99
100struct acpi_table_asf {
101ACPI_TABLE_HEADER_DEF};
102
103#define ACPI_ASF_HEADER_DEF \
104 u8 type; \
105 u8 reserved; \
106 u16 length;
107
108struct acpi_asf_header {
109ACPI_ASF_HEADER_DEF};
110
111/* Values for Type field */
112
113#define ASF_INFO 0
114#define ASF_ALERT 1
115#define ASF_CONTROL 2
116#define ASF_BOOT 3
117#define ASF_ADDRESS 4
118#define ASF_RESERVED 5
56 119
57/* 120/*
58 * ACPI 1.0 Firmware ACPI Control Structure (FACS) 121 * ASF subtables
59 */ 122 */
60struct facs_descriptor_rev1 { 123
61 char signature[4]; /* ASCII table signature */ 124/* 0: ASF Information */
62 u32 length; /* Length of structure in bytes */ 125
63 u32 hardware_signature; /* Hardware configuration signature */ 126struct acpi_asf_info {
64 u32 firmware_waking_vector; /* ACPI OS waking vector */ 127 ACPI_ASF_HEADER_DEF u8 min_reset_value;
65 u32 global_lock; /* Global Lock */ 128 u8 min_poll_interval;
129 u16 system_id;
130 u32 mfg_id;
131 u8 flags;
132 u8 reserved2[3];
133};
134
135/* 1: ASF Alerts */
136
137struct acpi_asf_alert {
138 ACPI_ASF_HEADER_DEF u8 assert_mask;
139 u8 deassert_mask;
140 u8 alerts;
141 u8 data_length;
142 u8 array[1];
143};
144
145/* 2: ASF Remote Control */
146
147struct acpi_asf_remote {
148 ACPI_ASF_HEADER_DEF u8 controls;
149 u8 data_length;
150 u16 reserved2;
151 u8 array[1];
152};
153
154/* 3: ASF RMCP Boot Options */
155
156struct acpi_asf_rmcp {
157 ACPI_ASF_HEADER_DEF u8 capabilities[7];
158 u8 completion_code;
159 u32 enterprise_id;
160 u8 command;
161 u16 parameter;
162 u16 boot_options;
163 u16 oem_parameters;
164};
165
166/* 4: ASF Address */
167
168struct acpi_asf_address {
169 ACPI_ASF_HEADER_DEF u8 eprom_address;
170 u8 devices;
171 u8 smbus_addresses[1];
172};
173
174/*******************************************************************************
175 *
176 * BOOT - Simple Boot Flag Table
177 *
178 ******************************************************************************/
179
180struct acpi_table_boot {
181 ACPI_TABLE_HEADER_DEF u8 cmos_index; /* Index in CMOS RAM for the boot register */
182 u8 reserved[3];
183};
184
185/*******************************************************************************
186 *
187 * CPEP - Corrected Platform Error Polling table
188 *
189 ******************************************************************************/
190
191struct acpi_table_cpep {
192 ACPI_TABLE_HEADER_DEF u64 reserved;
193};
194
195/* Subtable */
196
197struct acpi_cpep_polling {
198 u8 type;
199 u8 length;
200 u8 processor_id; /* Processor ID */
201 u8 processor_eid; /* Processor EID */
202 u32 polling_interval; /* Polling interval (msec) */
203};
204
205/*******************************************************************************
206 *
207 * DBGP - Debug Port table
208 *
209 ******************************************************************************/
210
211struct acpi_table_dbgp {
212 ACPI_TABLE_HEADER_DEF u8 interface_type; /* 0=full 16550, 1=subset of 16550 */
213 u8 reserved[3];
214 struct acpi_generic_address debug_port;
215};
216
217/*******************************************************************************
218 *
219 * ECDT - Embedded Controller Boot Resources Table
220 *
221 ******************************************************************************/
222
223struct ec_boot_resources {
224 ACPI_TABLE_HEADER_DEF struct acpi_generic_address ec_control; /* Address of EC command/status register */
225 struct acpi_generic_address ec_data; /* Address of EC data register */
226 u32 uid; /* Unique ID - must be same as the EC _UID method */
227 u8 gpe_bit; /* The GPE for the EC */
228 u8 ec_id[1]; /* Full namepath of the EC in the ACPI namespace */
229};
230
231/*******************************************************************************
232 *
233 * HPET - High Precision Event Timer table
234 *
235 ******************************************************************************/
236
237struct acpi_hpet_table {
238 ACPI_TABLE_HEADER_DEF u32 hardware_id; /* Hardware ID of event timer block */
239 struct acpi_generic_address base_address; /* Address of event timer block */
240 u8 hpet_number; /* HPET sequence number */
241 u16 clock_tick; /* Main counter min tick, periodic mode */
242 u8 attributes;
243};
244
245#if 0 /* HPET flags to be converted to macros */
246struct { /* Flags (8 bits) */
247 u8 page_protect:1; /* 00: No page protection */
248 u8 page_protect4:1; /* 01: 4_kB page protected */
249 u8 page_protect64:1; /* 02: 64_kB page protected */
250 u8:5; /* 03-07: Reserved, must be zero */
251} flags;
252#endif
253
254/*******************************************************************************
255 *
256 * MADT - Multiple APIC Description Table
257 *
258 ******************************************************************************/
259
260struct multiple_apic_table {
261 ACPI_TABLE_HEADER_DEF u32 local_apic_address; /* Physical address of local APIC */
66 262
67 /* Flags (32 bits) */ 263 /* Flags (32 bits) */
68 264
69 u8 S4bios_f:1; /* 00: S4BIOS support is present */ 265 u8 PCATcompat:1; /* 00: System also has dual 8259s */
70 u8:7; /* 01-07: Reserved, must be zero */ 266 u8:7; /* 01-07: Reserved, must be zero */
71 u8 reserved1[3]; /* 08-31: Reserved, must be zero */ 267 u8 reserved1[3]; /* 08-31: Reserved, must be zero */
72
73 u8 reserved2[40]; /* Reserved, must be zero */
74}; 268};
75 269
270/* Values for MADT PCATCompat */
271
272#define DUAL_PIC 0
273#define MULTIPLE_APIC 1
274
275/* Common MADT Sub-table header */
276
277#define APIC_HEADER_DEF \
278 u8 type; \
279 u8 length;
280
281struct apic_header {
282APIC_HEADER_DEF};
283
284/* Values for Type in struct apic_header */
285
286#define APIC_PROCESSOR 0
287#define APIC_IO 1
288#define APIC_XRUPT_OVERRIDE 2
289#define APIC_NMI 3
290#define APIC_LOCAL_NMI 4
291#define APIC_ADDRESS_OVERRIDE 5
292#define APIC_IO_SAPIC 6
293#define APIC_LOCAL_SAPIC 7
294#define APIC_XRUPT_SOURCE 8
295#define APIC_RESERVED 9 /* 9 and greater are reserved */
296
297/* Flag definitions for MADT sub-tables */
298
299#define ACPI_MADT_IFLAGS /* INTI flags (16 bits) */ \
300 u8 polarity : 2; /* 00-01: Polarity of APIC I/O input signals */\
301 u8 trigger_mode : 2; /* 02-03: Trigger mode of APIC input signals */\
302 u8 : 4; /* 04-07: Reserved, must be zero */\
303 u8 reserved1; /* 08-15: Reserved, must be zero */
304
305#define ACPI_MADT_LFLAGS /* Local Sapic flags (32 bits) */ \
306 u8 processor_enabled: 1; /* 00: Processor is usable if set */\
307 u8 : 7; /* 01-07: Reserved, must be zero */\
308 u8 reserved2[3]; /* 08-31: Reserved, must be zero */
309
310/* Values for MPS INTI flags */
311
312#define POLARITY_CONFORMS 0
313#define POLARITY_ACTIVE_HIGH 1
314#define POLARITY_RESERVED 2
315#define POLARITY_ACTIVE_LOW 3
316
317#define TRIGGER_CONFORMS 0
318#define TRIGGER_EDGE 1
319#define TRIGGER_RESERVED 2
320#define TRIGGER_LEVEL 3
321
76/* 322/*
77 * ACPI 1.0 Fixed ACPI Description Table (FADT) 323 * MADT Sub-tables, correspond to Type in struct apic_header
78 */ 324 */
79struct fadt_descriptor_rev1 { 325
80 ACPI_TABLE_HEADER_DEF /* ACPI common table header */ 326/* 0: processor APIC */
81 u32 firmware_ctrl; /* Physical address of FACS */ 327
82 u32 dsdt; /* Physical address of DSDT */ 328struct madt_processor_apic {
83 u8 model; /* System Interrupt Model */ 329 APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */
84 u8 reserved1; /* Reserved, must be zero */ 330 u8 local_apic_id; /* Processor's local APIC id */
85 u16 sci_int; /* System vector of SCI interrupt */ 331 ACPI_MADT_LFLAGS};
86 u32 smi_cmd; /* Port address of SMI command port */ 332
87 u8 acpi_enable; /* Value to write to smi_cmd to enable ACPI */ 333/* 1: IO APIC */
88 u8 acpi_disable; /* Value to write to smi_cmd to disable ACPI */ 334
89 u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */ 335struct madt_io_apic {
90 u8 reserved2; /* Reserved, must be zero */ 336 APIC_HEADER_DEF u8 io_apic_id; /* I/O APIC ID */
91 u32 pm1a_evt_blk; /* Port address of Power Mgt 1a acpi_event Reg Blk */ 337 u8 reserved; /* Reserved - must be zero */
92 u32 pm1b_evt_blk; /* Port address of Power Mgt 1b acpi_event Reg Blk */ 338 u32 address; /* APIC physical address */
93 u32 pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */ 339 u32 interrupt; /* Global system interrupt where INTI lines start */
94 u32 pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */ 340};
95 u32 pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */ 341
96 u32 pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ 342/* 2: Interrupt Override */
97 u32 gpe0_blk; /* Port addr of General Purpose acpi_event 0 Reg Blk */ 343
98 u32 gpe1_blk; /* Port addr of General Purpose acpi_event 1 Reg Blk */ 344struct madt_interrupt_override {
99 u8 pm1_evt_len; /* Byte length of ports at pm1_x_evt_blk */ 345 APIC_HEADER_DEF u8 bus; /* 0 - ISA */
100 u8 pm1_cnt_len; /* Byte length of ports at pm1_x_cnt_blk */ 346 u8 source; /* Interrupt source (IRQ) */
101 u8 pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */ 347 u32 interrupt; /* Global system interrupt */
102 u8 pm_tm_len; /* Byte Length of ports at pm_tm_blk */ 348 ACPI_MADT_IFLAGS};
103 u8 gpe0_blk_len; /* Byte Length of ports at gpe0_blk */ 349
104 u8 gpe1_blk_len; /* Byte Length of ports at gpe1_blk */ 350/* 3: NMI Sources */
105 u8 gpe1_base; /* Offset in gpe model where gpe1 events start */ 351
106 u8 reserved3; /* Reserved, must be zero */ 352struct madt_nmi_source {
107 u16 plvl2_lat; /* Worst case HW latency to enter/exit C2 state */ 353 APIC_HEADER_DEF ACPI_MADT_IFLAGS u32 interrupt; /* Global system interrupt */
108 u16 plvl3_lat; /* Worst case HW latency to enter/exit C3 state */ 354};
109 u16 flush_size; /* Size of area read to flush caches */ 355
110 u16 flush_stride; /* Stride used in flushing caches */ 356/* 4: Local APIC NMI */
111 u8 duty_offset; /* Bit location of duty cycle field in p_cnt reg */ 357
112 u8 duty_width; /* Bit width of duty cycle field in p_cnt reg */ 358struct madt_local_apic_nmi {
113 u8 day_alrm; /* Index to day-of-month alarm in RTC CMOS RAM */ 359 APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */
114 u8 mon_alrm; /* Index to month-of-year alarm in RTC CMOS RAM */ 360 ACPI_MADT_IFLAGS u8 lint; /* LINTn to which NMI is connected */
115 u8 century; /* Index to century in RTC CMOS RAM */ 361};
116 u8 reserved4[3]; /* Reserved, must be zero */ 362
363/* 5: Address Override */
364
365struct madt_address_override {
366 APIC_HEADER_DEF u16 reserved; /* Reserved, must be zero */
367 u64 address; /* APIC physical address */
368};
369
370/* 6: I/O Sapic */
371
372struct madt_io_sapic {
373 APIC_HEADER_DEF u8 io_sapic_id; /* I/O SAPIC ID */
374 u8 reserved; /* Reserved, must be zero */
375 u32 interrupt_base; /* Glocal interrupt for SAPIC start */
376 u64 address; /* SAPIC physical address */
377};
378
379/* 7: Local Sapic */
380
381struct madt_local_sapic {
382 APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */
383 u8 local_sapic_id; /* SAPIC ID */
384 u8 local_sapic_eid; /* SAPIC EID */
385 u8 reserved[3]; /* Reserved, must be zero */
386 ACPI_MADT_LFLAGS u32 processor_uID; /* Numeric UID - ACPI 3.0 */
387 char processor_uIDstring[1]; /* String UID - ACPI 3.0 */
388};
389
390/* 8: Platform Interrupt Source */
391
392struct madt_interrupt_source {
393 APIC_HEADER_DEF ACPI_MADT_IFLAGS u8 interrupt_type; /* 1=PMI, 2=INIT, 3=corrected */
394 u8 processor_id; /* Processor ID */
395 u8 processor_eid; /* Processor EID */
396 u8 io_sapic_vector; /* Vector value for PMI interrupts */
397 u32 interrupt; /* Global system interrupt */
398 u32 flags; /* Interrupt Source Flags */
399};
400
401#ifdef DUPLICATE_DEFINITION_WITH_LINUX_ACPI_H
402/*******************************************************************************
403 *
404 * MCFG - PCI Memory Mapped Configuration table and sub-table
405 *
406 ******************************************************************************/
407
408struct acpi_table_mcfg {
409 ACPI_TABLE_HEADER_DEF u8 reserved[8];
410};
411
412struct acpi_mcfg_allocation {
413 u64 base_address; /* Base address, processor-relative */
414 u16 pci_segment; /* PCI segment group number */
415 u8 start_bus_number; /* Starting PCI Bus number */
416 u8 end_bus_number; /* Final PCI Bus number */
417 u32 reserved;
418};
419#endif
420
421/*******************************************************************************
422 *
423 * SBST - Smart Battery Specification Table
424 *
425 ******************************************************************************/
426
427struct smart_battery_table {
428 ACPI_TABLE_HEADER_DEF u32 warning_level;
429 u32 low_level;
430 u32 critical_level;
431};
432
433/*******************************************************************************
434 *
435 * SLIT - System Locality Distance Information Table
436 *
437 ******************************************************************************/
438
439struct system_locality_info {
440 ACPI_TABLE_HEADER_DEF u64 locality_count;
441 u8 entry[1][1];
442};
443
444/*******************************************************************************
445 *
446 * SPCR - Serial Port Console Redirection table
447 *
448 ******************************************************************************/
449
450struct acpi_table_spcr {
451 ACPI_TABLE_HEADER_DEF u8 interface_type; /* 0=full 16550, 1=subset of 16550 */
452 u8 reserved[3];
453 struct acpi_generic_address serial_port;
454 u8 interrupt_type;
455 u8 pc_interrupt;
456 u32 interrupt;
457 u8 baud_rate;
458 u8 parity;
459 u8 stop_bits;
460 u8 flow_control;
461 u8 terminal_type;
462 u8 reserved2;
463 u16 pci_device_id;
464 u16 pci_vendor_id;
465 u8 pci_bus;
466 u8 pci_device;
467 u8 pci_function;
468 u32 pci_flags;
469 u8 pci_segment;
470 u32 reserved3;
471};
472
473/*******************************************************************************
474 *
475 * SPMI - Server Platform Management Interface table
476 *
477 ******************************************************************************/
478
479struct acpi_table_spmi {
480 ACPI_TABLE_HEADER_DEF u8 reserved;
481 u8 interface_type;
482 u16 spec_revision; /* Version of IPMI */
483 u8 interrupt_type;
484 u8 gpe_number; /* GPE assigned */
485 u8 reserved2;
486 u8 pci_device_flag;
487 u32 interrupt;
488 struct acpi_generic_address ipmi_register;
489 u8 pci_segment;
490 u8 pci_bus;
491 u8 pci_device;
492 u8 pci_function;
493};
494
495/*******************************************************************************
496 *
497 * SRAT - System Resource Affinity Table
498 *
499 ******************************************************************************/
500
501struct system_resource_affinity {
502 ACPI_TABLE_HEADER_DEF u32 reserved1; /* Must be value '1' */
503 u64 reserved2; /* Reserved, must be zero */
504};
505
506/* SRAT common sub-table header */
507
508#define SRAT_SUBTABLE_HEADER \
509 u8 type; \
510 u8 length;
511
512/* Values for Type above */
513
514#define SRAT_CPU_AFFINITY 0
515#define SRAT_MEMORY_AFFINITY 1
516#define SRAT_RESERVED 2
517
518/* SRAT sub-tables */
519
520struct static_resource_alloc {
521 SRAT_SUBTABLE_HEADER u8 proximity_domain_lo;
522 u8 apic_id;
523
524 /* Flags (32 bits) */
525
526 u8 enabled:1; /* 00: Use affinity structure */
527 u8:7; /* 01-07: Reserved, must be zero */
528 u8 reserved3[3]; /* 08-31: Reserved, must be zero */
529
530 u8 local_sapic_eid;
531 u8 proximity_domain_hi[3];
532 u32 reserved4; /* Reserved, must be zero */
533};
534
535struct memory_affinity {
536 SRAT_SUBTABLE_HEADER u32 proximity_domain;
537 u16 reserved3;
538 u64 base_address;
539 u64 address_length;
540 u32 reserved4;
117 541
118 /* Flags (32 bits) */ 542 /* Flags (32 bits) */
119 543
120 u8 wb_invd:1; /* 00: The wbinvd instruction works properly */ 544 u8 enabled:1; /* 00: Use affinity structure */
121 u8 wb_invd_flush:1; /* 01: The wbinvd flushes but does not invalidate */ 545 u8 hot_pluggable:1; /* 01: Memory region is hot pluggable */
122 u8 proc_c1:1; /* 02: All processors support C1 state */ 546 u8 non_volatile:1; /* 02: Memory is non-volatile */
123 u8 plvl2_up:1; /* 03: C2 state works on MP system */ 547 u8:5; /* 03-07: Reserved, must be zero */
124 u8 pwr_button:1; /* 04: Power button is handled as a generic feature */ 548 u8 reserved5[3]; /* 08-31: Reserved, must be zero */
125 u8 sleep_button:1; /* 05: Sleep button is handled as a generic feature, or not present */ 549
126 u8 fixed_rTC:1; /* 06: RTC wakeup stat not in fixed register space */ 550 u64 reserved6; /* Reserved, must be zero */
127 u8 rtcs4:1; /* 07: RTC wakeup stat not possible from S4 */ 551};
128 u8 tmr_val_ext:1; /* 08: tmr_val width is 32 bits (0 = 24 bits) */ 552
129 u8:7; /* 09-15: Reserved, must be zero */ 553/*******************************************************************************
130 u8 reserved5[2]; /* 16-31: Reserved, must be zero */ 554 *
555 * TCPA - Trusted Computing Platform Alliance table
556 *
557 ******************************************************************************/
558
559struct acpi_table_tcpa {
560 ACPI_TABLE_HEADER_DEF u16 reserved;
561 u32 max_log_length; /* Maximum length for the event log area */
562 u64 log_address; /* Address of the event log area */
131}; 563};
132 564
565/*******************************************************************************
566 *
567 * WDRT - Watchdog Resource Table
568 *
569 ******************************************************************************/
570
571struct acpi_table_wdrt {
572 ACPI_TABLE_HEADER_DEF u32 header_length; /* Watchdog Header Length */
573 u8 pci_segment; /* PCI Segment number */
574 u8 pci_bus; /* PCI Bus number */
575 u8 pci_device; /* PCI Device number */
576 u8 pci_function; /* PCI Function number */
577 u32 timer_period; /* Period of one timer count (msec) */
578 u32 max_count; /* Maximum counter value supported */
579 u32 min_count; /* Minimum counter value */
580 u8 flags;
581 u8 reserved[3];
582 u32 entries; /* Number of watchdog entries that follow */
583};
584
585#if 0 /* Flags, will be converted to macros */
586u8 enabled:1; /* 00: Timer enabled */
587u8:6; /* 01-06: Reserved */
588u8 sleep_stop:1; /* 07: Timer stopped in sleep state */
589#endif
590
591/* Macros used to generate offsets to specific table fields */
592
593#define ACPI_ASF0_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_asf_info,f)
594#define ACPI_ASF1_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_asf_alert,f)
595#define ACPI_ASF2_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_asf_remote,f)
596#define ACPI_ASF3_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_asf_rmcp,f)
597#define ACPI_ASF4_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_asf_address,f)
598#define ACPI_BOOT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_boot,f)
599#define ACPI_CPEP_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_cpep,f)
600#define ACPI_CPEP0_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_cpep_polling,f)
601#define ACPI_DBGP_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_dbgp,f)
602#define ACPI_ECDT_OFFSET(f) (u8) ACPI_OFFSET (struct ec_boot_resources,f)
603#define ACPI_HPET_OFFSET(f) (u8) ACPI_OFFSET (struct hpet_table,f)
604#define ACPI_MADT_OFFSET(f) (u8) ACPI_OFFSET (struct multiple_apic_table,f)
605#define ACPI_MADT0_OFFSET(f) (u8) ACPI_OFFSET (struct madt_processor_apic,f)
606#define ACPI_MADT1_OFFSET(f) (u8) ACPI_OFFSET (struct madt_io_apic,f)
607#define ACPI_MADT2_OFFSET(f) (u8) ACPI_OFFSET (struct madt_interrupt_override,f)
608#define ACPI_MADT3_OFFSET(f) (u8) ACPI_OFFSET (struct madt_nmi_source,f)
609#define ACPI_MADT4_OFFSET(f) (u8) ACPI_OFFSET (struct madt_local_apic_nmi,f)
610#define ACPI_MADT5_OFFSET(f) (u8) ACPI_OFFSET (struct madt_address_override,f)
611#define ACPI_MADT6_OFFSET(f) (u8) ACPI_OFFSET (struct madt_io_sapic,f)
612#define ACPI_MADT7_OFFSET(f) (u8) ACPI_OFFSET (struct madt_local_sapic,f)
613#define ACPI_MADT8_OFFSET(f) (u8) ACPI_OFFSET (struct madt_interrupt_source,f)
614#define ACPI_MADTH_OFFSET(f) (u8) ACPI_OFFSET (struct apic_header,f)
615#define ACPI_MCFG_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_mcfg,f)
616#define ACPI_MCFG0_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_mcfg_allocation,f)
617#define ACPI_SBST_OFFSET(f) (u8) ACPI_OFFSET (struct smart_battery_table,f)
618#define ACPI_SLIT_OFFSET(f) (u8) ACPI_OFFSET (struct system_locality_info,f)
619#define ACPI_SPCR_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_spcr,f)
620#define ACPI_SPMI_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_spmi,f)
621#define ACPI_SRAT_OFFSET(f) (u8) ACPI_OFFSET (struct system_resource_affinity,f)
622#define ACPI_SRAT0_OFFSET(f) (u8) ACPI_OFFSET (struct static_resource_alloc,f)
623#define ACPI_SRAT1_OFFSET(f) (u8) ACPI_OFFSET (struct memory_affinity,f)
624#define ACPI_TCPA_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_tcpa,f)
625#define ACPI_WDRT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_wdrt,f)
626
627#define ACPI_HPET_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct hpet_table,f,o)
628#define ACPI_SRAT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct static_resource_alloc,f,o)
629#define ACPI_SRAT1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct memory_affinity,f,o)
630#define ACPI_MADT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct multiple_apic_table,f,o)
631#define ACPI_MADT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_processor_apic,f,o)
632#define ACPI_MADT2_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_interrupt_override,f,o)
633#define ACPI_MADT3_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_nmi_source,f,o)
634#define ACPI_MADT4_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_local_apic_nmi,f,o)
635#define ACPI_MADT7_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_local_sapic,f,o)
636#define ACPI_MADT8_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_interrupt_source,f,o)
637
638/* Reset to default packing */
639
133#pragma pack() 640#pragma pack()
134 641
135#endif /* __ACTBL1_H__ */ 642#endif /* __ACTBL1_H__ */
diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index dfc7ac1094bb..67efe6cad27b 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -44,234 +44,6 @@
44#ifndef __ACTBL2_H__ 44#ifndef __ACTBL2_H__
45#define __ACTBL2_H__ 45#define __ACTBL2_H__
46 46
47/* 47/* Code moved to both actbl.h and actbl1.h */
48 * Prefered Power Management Profiles
49 */
50#define PM_UNSPECIFIED 0
51#define PM_DESKTOP 1
52#define PM_MOBILE 2
53#define PM_WORKSTATION 3
54#define PM_ENTERPRISE_SERVER 4
55#define PM_SOHO_SERVER 5
56#define PM_APPLIANCE_PC 6
57
58/*
59 * ACPI Boot Arch Flags
60 */
61#define BAF_LEGACY_DEVICES 0x0001
62#define BAF_8042_KEYBOARD_CONTROLLER 0x0002
63
64#define FADT2_REVISION_ID 3
65#define FADT2_MINUS_REVISION_ID 2
66
67#pragma pack(1)
68
69/*
70 * ACPI 2.0 Root System Description Table (RSDT)
71 */
72struct rsdt_descriptor_rev2 {
73 ACPI_TABLE_HEADER_DEF /* ACPI common table header */
74 u32 table_offset_entry[1]; /* Array of pointers to ACPI tables */
75};
76
77/*
78 * ACPI 2.0 Extended System Description Table (XSDT)
79 */
80struct xsdt_descriptor_rev2 {
81 ACPI_TABLE_HEADER_DEF /* ACPI common table header */
82 u64 table_offset_entry[1]; /* Array of pointers to ACPI tables */
83};
84
85/*
86 * ACPI 2.0 Firmware ACPI Control Structure (FACS)
87 */
88struct facs_descriptor_rev2 {
89 char signature[4]; /* ASCII table signature */
90 u32 length; /* Length of structure, in bytes */
91 u32 hardware_signature; /* Hardware configuration signature */
92 u32 firmware_waking_vector; /* 32-bit physical address of the Firmware Waking Vector. */
93 u32 global_lock; /* Global Lock used to synchronize access to shared hardware resources */
94
95 /* Flags (32 bits) */
96
97 u8 S4bios_f:1; /* 00: S4BIOS support is present */
98 u8:7; /* 01-07: Reserved, must be zero */
99 u8 reserved1[3]; /* 08-31: Reserved, must be zero */
100
101 u64 xfirmware_waking_vector; /* 64-bit physical address of the Firmware Waking Vector. */
102 u8 version; /* Version of this table */
103 u8 reserved3[31]; /* Reserved, must be zero */
104};
105
106/*
107 * ACPI 2.0+ Generic Address Structure (GAS)
108 */
109struct acpi_generic_address {
110 u8 address_space_id; /* Address space where struct or register exists. */
111 u8 register_bit_width; /* Size in bits of given register */
112 u8 register_bit_offset; /* Bit offset within the register */
113 u8 access_width; /* Minimum Access size (ACPI 3.0) */
114 u64 address; /* 64-bit address of struct or register */
115};
116
117#define FADT_REV2_COMMON \
118 u32 V1_firmware_ctrl; /* 32-bit physical address of FACS */ \
119 u32 V1_dsdt; /* 32-bit physical address of DSDT */ \
120 u8 reserved1; /* System Interrupt Model isn't used in ACPI 2.0*/ \
121 u8 prefer_PM_profile; /* Conveys preferred power management profile to OSPM. */ \
122 u16 sci_int; /* System vector of SCI interrupt */ \
123 u32 smi_cmd; /* Port address of SMI command port */ \
124 u8 acpi_enable; /* Value to write to smi_cmd to enable ACPI */ \
125 u8 acpi_disable; /* Value to write to smi_cmd to disable ACPI */ \
126 u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */ \
127 u8 pstate_cnt; /* Processor performance state control*/ \
128 u32 V1_pm1a_evt_blk; /* Port address of Power Mgt 1a acpi_event Reg Blk */ \
129 u32 V1_pm1b_evt_blk; /* Port address of Power Mgt 1b acpi_event Reg Blk */ \
130 u32 V1_pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */ \
131 u32 V1_pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */ \
132 u32 V1_pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */ \
133 u32 V1_pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ \
134 u32 V1_gpe0_blk; /* Port addr of General Purpose acpi_event 0 Reg Blk */ \
135 u32 V1_gpe1_blk; /* Port addr of General Purpose acpi_event 1 Reg Blk */ \
136 u8 pm1_evt_len; /* Byte length of ports at pm1_x_evt_blk */ \
137 u8 pm1_cnt_len; /* Byte length of ports at pm1_x_cnt_blk */ \
138 u8 pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */ \
139 u8 pm_tm_len; /* Byte Length of ports at pm_tm_blk */ \
140 u8 gpe0_blk_len; /* Byte Length of ports at gpe0_blk */ \
141 u8 gpe1_blk_len; /* Byte Length of ports at gpe1_blk */ \
142 u8 gpe1_base; /* Offset in gpe model where gpe1 events start */ \
143 u8 cst_cnt; /* Support for the _CST object and C States change notification.*/ \
144 u16 plvl2_lat; /* Worst case HW latency to enter/exit C2 state */ \
145 u16 plvl3_lat; /* Worst case HW latency to enter/exit C3 state */ \
146 u16 flush_size; /* Number of flush strides that need to be read */ \
147 u16 flush_stride; /* Processor's memory cache line width, in bytes */ \
148 u8 duty_offset; /* Processor's duty cycle index in processor's P_CNT reg*/ \
149 u8 duty_width; /* Processor's duty cycle value bit width in P_CNT register.*/ \
150 u8 day_alrm; /* Index to day-of-month alarm in RTC CMOS RAM */ \
151 u8 mon_alrm; /* Index to month-of-year alarm in RTC CMOS RAM */ \
152 u8 century; /* Index to century in RTC CMOS RAM */ \
153 u16 iapc_boot_arch; /* IA-PC Boot Architecture Flags. See Table 5-10 for description*/
154
155/*
156 * ACPI 2.0+ Fixed ACPI Description Table (FADT)
157 */
158struct fadt_descriptor_rev2 {
159 ACPI_TABLE_HEADER_DEF /* ACPI common table header */
160 FADT_REV2_COMMON u8 reserved2; /* Reserved, must be zero */
161
162 /* Flags (32 bits) */
163
164 u8 wb_invd:1; /* 00: The wbinvd instruction works properly */
165 u8 wb_invd_flush:1; /* 01: The wbinvd flushes but does not invalidate */
166 u8 proc_c1:1; /* 02: All processors support C1 state */
167 u8 plvl2_up:1; /* 03: C2 state works on MP system */
168 u8 pwr_button:1; /* 04: Power button is handled as a generic feature */
169 u8 sleep_button:1; /* 05: Sleep button is handled as a generic feature, or not present */
170 u8 fixed_rTC:1; /* 06: RTC wakeup stat not in fixed register space */
171 u8 rtcs4:1; /* 07: RTC wakeup stat not possible from S4 */
172 u8 tmr_val_ext:1; /* 08: tmr_val is 32 bits 0=24-bits */
173 u8 dock_cap:1; /* 09: Docking supported */
174 u8 reset_reg_sup:1; /* 10: System reset via the FADT RESET_REG supported */
175 u8 sealed_case:1; /* 11: No internal expansion capabilities and case is sealed */
176 u8 headless:1; /* 12: No local video capabilities or local input devices */
177 u8 cpu_sw_sleep:1; /* 13: Must execute native instruction after writing SLP_TYPx register */
178
179 u8 pci_exp_wak:1; /* 14: System supports PCIEXP_WAKE (STS/EN) bits (ACPI 3.0) */
180 u8 use_platform_clock:1; /* 15: OSPM should use platform-provided timer (ACPI 3.0) */
181 u8 S4rtc_sts_valid:1; /* 16: Contents of RTC_STS valid after S4 wake (ACPI 3.0) */
182 u8 remote_power_on_capable:1; /* 17: System is compatible with remote power on (ACPI 3.0) */
183 u8 force_apic_cluster_model:1; /* 18: All local APICs must use cluster model (ACPI 3.0) */
184 u8 force_apic_physical_destination_mode:1; /* 19: all local x_aPICs must use physical dest mode (ACPI 3.0) */
185 u8:4; /* 20-23: Reserved, must be zero */
186 u8 reserved3; /* 24-31: Reserved, must be zero */
187
188 struct acpi_generic_address reset_register; /* Reset register address in GAS format */
189 u8 reset_value; /* Value to write to the reset_register port to reset the system */
190 u8 reserved4[3]; /* These three bytes must be zero */
191 u64 xfirmware_ctrl; /* 64-bit physical address of FACS */
192 u64 Xdsdt; /* 64-bit physical address of DSDT */
193 struct acpi_generic_address xpm1a_evt_blk; /* Extended Power Mgt 1a acpi_event Reg Blk address */
194 struct acpi_generic_address xpm1b_evt_blk; /* Extended Power Mgt 1b acpi_event Reg Blk address */
195 struct acpi_generic_address xpm1a_cnt_blk; /* Extended Power Mgt 1a Control Reg Blk address */
196 struct acpi_generic_address xpm1b_cnt_blk; /* Extended Power Mgt 1b Control Reg Blk address */
197 struct acpi_generic_address xpm2_cnt_blk; /* Extended Power Mgt 2 Control Reg Blk address */
198 struct acpi_generic_address xpm_tmr_blk; /* Extended Power Mgt Timer Ctrl Reg Blk address */
199 struct acpi_generic_address xgpe0_blk; /* Extended General Purpose acpi_event 0 Reg Blk address */
200 struct acpi_generic_address xgpe1_blk; /* Extended General Purpose acpi_event 1 Reg Blk address */
201};
202
203/* "Down-revved" ACPI 2.0 FADT descriptor */
204
205struct fadt_descriptor_rev2_minus {
206 ACPI_TABLE_HEADER_DEF /* ACPI common table header */
207 FADT_REV2_COMMON u8 reserved2; /* Reserved, must be zero */
208 u32 flags;
209 struct acpi_generic_address reset_register; /* Reset register address in GAS format */
210 u8 reset_value; /* Value to write to the reset_register port to reset the system. */
211 u8 reserved7[3]; /* Reserved, must be zero */
212};
213
214/* ECDT - Embedded Controller Boot Resources Table */
215
216struct ec_boot_resources {
217 ACPI_TABLE_HEADER_DEF struct acpi_generic_address ec_control; /* Address of EC command/status register */
218 struct acpi_generic_address ec_data; /* Address of EC data register */
219 u32 uid; /* Unique ID - must be same as the EC _UID method */
220 u8 gpe_bit; /* The GPE for the EC */
221 u8 ec_id[1]; /* Full namepath of the EC in the ACPI namespace */
222};
223
224/* SRAT - System Resource Affinity Table */
225
226struct static_resource_alloc {
227 u8 type;
228 u8 length;
229 u8 proximity_domain_lo;
230 u8 apic_id;
231
232 /* Flags (32 bits) */
233
234 u8 enabled:1; /* 00: Use affinity structure */
235 u8:7; /* 01-07: Reserved, must be zero */
236 u8 reserved3[3]; /* 08-31: Reserved, must be zero */
237
238 u8 local_sapic_eid;
239 u8 proximity_domain_hi[3];
240 u32 reserved4; /* Reserved, must be zero */
241};
242
243struct memory_affinity {
244 u8 type;
245 u8 length;
246 u32 proximity_domain;
247 u16 reserved3;
248 u64 base_address;
249 u64 address_length;
250 u32 reserved4;
251
252 /* Flags (32 bits) */
253
254 u8 enabled:1; /* 00: Use affinity structure */
255 u8 hot_pluggable:1; /* 01: Memory region is hot pluggable */
256 u8 non_volatile:1; /* 02: Memory is non-volatile */
257 u8:5; /* 03-07: Reserved, must be zero */
258 u8 reserved5[3]; /* 08-31: Reserved, must be zero */
259
260 u64 reserved6; /* Reserved, must be zero */
261};
262
263struct system_resource_affinity {
264 ACPI_TABLE_HEADER_DEF u32 reserved1; /* Must be value '1' */
265 u64 reserved2; /* Reserved, must be zero */
266};
267
268/* SLIT - System Locality Distance Information Table */
269
270struct system_locality_info {
271 ACPI_TABLE_HEADER_DEF u64 locality_count;
272 u8 entry[1][1];
273};
274
275#pragma pack()
276 48
277#endif /* __ACTBL2_H__ */ 49#endif /* __ACTBL2_H__ */
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 7ca89cde706e..77cf1236b05a 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -44,6 +44,8 @@
44#ifndef __ACTYPES_H__ 44#ifndef __ACTYPES_H__
45#define __ACTYPES_H__ 45#define __ACTYPES_H__
46 46
47/* acpisrc:struct_defs -- for acpisrc conversion */
48
47/* 49/*
48 * ACPI_MACHINE_WIDTH must be specified in an OS- or compiler-dependent header 50 * ACPI_MACHINE_WIDTH must be specified in an OS- or compiler-dependent header
49 * and must be either 16, 32, or 64 51 * and must be either 16, 32, or 64
@@ -154,7 +156,6 @@ typedef u64 acpi_physical_address;
154#define ACPI_MAX_PTR ACPI_UINT64_MAX 156#define ACPI_MAX_PTR ACPI_UINT64_MAX
155#define ACPI_SIZE_MAX ACPI_UINT64_MAX 157#define ACPI_SIZE_MAX ACPI_UINT64_MAX
156 158
157#define ALIGNED_ADDRESS_BOUNDARY 0x00000008
158#define ACPI_USE_NATIVE_DIVIDE /* Has native 64-bit integer support */ 159#define ACPI_USE_NATIVE_DIVIDE /* Has native 64-bit integer support */
159 160
160/* 161/*
@@ -195,8 +196,6 @@ typedef u64 acpi_physical_address;
195#define ACPI_MAX_PTR ACPI_UINT32_MAX 196#define ACPI_MAX_PTR ACPI_UINT32_MAX
196#define ACPI_SIZE_MAX ACPI_UINT32_MAX 197#define ACPI_SIZE_MAX ACPI_UINT32_MAX
197 198
198#define ALIGNED_ADDRESS_BOUNDARY 0x00000004
199
200/******************************************************************************* 199/*******************************************************************************
201 * 200 *
202 * Types specific to 16-bit targets 201 * Types specific to 16-bit targets
@@ -223,7 +222,6 @@ typedef char *acpi_physical_address;
223#define ACPI_MAX_PTR ACPI_UINT16_MAX 222#define ACPI_MAX_PTR ACPI_UINT16_MAX
224#define ACPI_SIZE_MAX ACPI_UINT16_MAX 223#define ACPI_SIZE_MAX ACPI_UINT16_MAX
225 224
226#define ALIGNED_ADDRESS_BOUNDARY 0x00000002
227#define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */ 225#define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */
228 226
229/* 64-bit integers cannot be supported */ 227/* 64-bit integers cannot be supported */
@@ -254,7 +252,7 @@ typedef acpi_native_uint acpi_size;
254/* Use C99 uintptr_t for pointer casting if available, "void *" otherwise */ 252/* Use C99 uintptr_t for pointer casting if available, "void *" otherwise */
255 253
256#ifndef acpi_uintptr_t 254#ifndef acpi_uintptr_t
257#define acpi_uintptr_t void * 255#define acpi_uintptr_t void *
258#endif 256#endif
259 257
260/* 258/*
@@ -263,7 +261,7 @@ typedef acpi_native_uint acpi_size;
263 * manager implementation is to be used (ACPI_USE_LOCAL_CACHE) 261 * manager implementation is to be used (ACPI_USE_LOCAL_CACHE)
264 */ 262 */
265#ifndef acpi_cache_t 263#ifndef acpi_cache_t
266#define acpi_cache_t struct acpi_memory_list 264#define acpi_cache_t struct acpi_memory_list
267#endif 265#endif
268 266
269/* 267/*
@@ -271,7 +269,7 @@ typedef acpi_native_uint acpi_size;
271 * lock and unlock OSL interfaces. 269 * lock and unlock OSL interfaces.
272 */ 270 */
273#ifndef acpi_cpu_flags 271#ifndef acpi_cpu_flags
274#define acpi_cpu_flags acpi_native_uint 272#define acpi_cpu_flags acpi_native_uint
275#endif 273#endif
276 274
277/* 275/*
@@ -292,6 +290,21 @@ typedef acpi_native_uint acpi_size;
292#define ACPI_UNUSED_VAR 290#define ACPI_UNUSED_VAR
293#endif 291#endif
294 292
293/*
294 * All ACPICA functions that are available to the rest of the kernel are
295 * tagged with this macro which can be defined as appropriate for the host.
296 */
297#ifndef ACPI_EXPORT_SYMBOL
298#define ACPI_EXPORT_SYMBOL(symbol)
299#endif
300
301/*
302 * thread_id is returned by acpi_os_get_thread_id.
303 */
304#ifndef acpi_thread_id
305#define acpi_thread_id acpi_native_uint
306#endif
307
295/******************************************************************************* 308/*******************************************************************************
296 * 309 *
297 * Independent types 310 * Independent types
@@ -477,15 +490,15 @@ typedef u64 acpi_integer;
477 */ 490 */
478typedef u32 acpi_table_type; 491typedef u32 acpi_table_type;
479 492
480#define ACPI_TABLE_RSDP (acpi_table_type) 0 493#define ACPI_TABLE_ID_RSDP (acpi_table_type) 0
481#define ACPI_TABLE_DSDT (acpi_table_type) 1 494#define ACPI_TABLE_ID_DSDT (acpi_table_type) 1
482#define ACPI_TABLE_FADT (acpi_table_type) 2 495#define ACPI_TABLE_ID_FADT (acpi_table_type) 2
483#define ACPI_TABLE_FACS (acpi_table_type) 3 496#define ACPI_TABLE_ID_FACS (acpi_table_type) 3
484#define ACPI_TABLE_PSDT (acpi_table_type) 4 497#define ACPI_TABLE_ID_PSDT (acpi_table_type) 4
485#define ACPI_TABLE_SSDT (acpi_table_type) 5 498#define ACPI_TABLE_ID_SSDT (acpi_table_type) 5
486#define ACPI_TABLE_XSDT (acpi_table_type) 6 499#define ACPI_TABLE_ID_XSDT (acpi_table_type) 6
487#define ACPI_TABLE_MAX 6 500#define ACPI_TABLE_ID_MAX 6
488#define NUM_ACPI_TABLE_TYPES (ACPI_TABLE_MAX+1) 501#define ACPI_NUM_TABLE_TYPES (ACPI_TABLE_ID_MAX+1)
489 502
490/* 503/*
491 * Types associated with ACPI names and objects. The first group of 504 * Types associated with ACPI names and objects. The first group of
@@ -816,7 +829,7 @@ struct acpi_system_info {
816 u32 debug_level; 829 u32 debug_level;
817 u32 debug_layer; 830 u32 debug_layer;
818 u32 num_table_types; 831 u32 num_table_types;
819 struct acpi_table_info table_info[NUM_ACPI_TABLE_TYPES]; 832 struct acpi_table_info table_info[ACPI_TABLE_ID_MAX + 1];
820}; 833};
821 834
822/* 835/*
@@ -858,7 +871,7 @@ acpi_status(*acpi_adr_space_handler) (u32 function,
858 void *handler_context, 871 void *handler_context,
859 void *region_context); 872 void *region_context);
860 873
861#define ACPI_DEFAULT_HANDLER NULL 874#define ACPI_DEFAULT_HANDLER NULL
862 875
863typedef 876typedef
864acpi_status(*acpi_adr_space_setup) (acpi_handle region_handle, 877acpi_status(*acpi_adr_space_setup) (acpi_handle region_handle,
@@ -911,12 +924,13 @@ struct acpi_compatible_id_list {
911#define ACPI_STA_DEVICE_PRESENT 0x01 924#define ACPI_STA_DEVICE_PRESENT 0x01
912#define ACPI_STA_DEVICE_ENABLED 0x02 925#define ACPI_STA_DEVICE_ENABLED 0x02
913#define ACPI_STA_DEVICE_UI 0x04 926#define ACPI_STA_DEVICE_UI 0x04
914#define ACPI_STA_DEVICE_OK 0x08 927#define ACPI_STA_DEVICE_FUNCTIONING 0x08
928#define ACPI_STA_DEVICE_OK 0x08 /* Synonym */
915#define ACPI_STA_BATTERY_PRESENT 0x10 929#define ACPI_STA_BATTERY_PRESENT 0x10
916 930
917#define ACPI_COMMON_OBJ_INFO \ 931#define ACPI_COMMON_OBJ_INFO \
918 acpi_object_type type; /* ACPI object type */ \ 932 acpi_object_type type; /* ACPI object type */ \
919 acpi_name name /* ACPI object Name */ 933 acpi_name name /* ACPI object Name */
920 934
921struct acpi_obj_info_header { 935struct acpi_obj_info_header {
922 ACPI_COMMON_OBJ_INFO; 936 ACPI_COMMON_OBJ_INFO;
@@ -957,7 +971,7 @@ struct acpi_mem_space_context {
957 * Definitions for Resource Attributes 971 * Definitions for Resource Attributes
958 */ 972 */
959typedef u16 acpi_rs_length; /* Resource Length field is fixed at 16 bits */ 973typedef u16 acpi_rs_length; /* Resource Length field is fixed at 16 bits */
960typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (length+3) = (64_k-1)+3 */ 974typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (Length+3) = (64_k-1)+3 */
961 975
962/* 976/*
963 * Memory Attributes 977 * Memory Attributes
@@ -972,8 +986,8 @@ typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (length+3) = (6
972 986
973/* 987/*
974 * IO Attributes 988 * IO Attributes
975 * The ISA Io ranges are: n000-n0_ffh, n400-n4_ffh, n800-n8_ffh, n_c00-n_cFFh. 989 * The ISA IO ranges are: n000-n0_fFh, n400-n4_fFh, n800-n8_fFh, n_c00-n_cFFh.
976 * The non-ISA Io ranges are: n100-n3_ffh, n500-n7_ffh, n900-n_bFfh, n_cd0-n_fFFh. 990 * The non-ISA IO ranges are: n100-n3_fFh, n500-n7_fFh, n900-n_bFFh, n_cd0-n_fFFh.
977 */ 991 */
978#define ACPI_NON_ISA_ONLY_RANGES (u8) 0x01 992#define ACPI_NON_ISA_ONLY_RANGES (u8) 0x01
979#define ACPI_ISA_ONLY_RANGES (u8) 0x02 993#define ACPI_ISA_ONLY_RANGES (u8) 0x02
@@ -1171,12 +1185,12 @@ struct acpi_resource_source {
1171/* Fields common to all address descriptors, 16/32/64 bit */ 1185/* Fields common to all address descriptors, 16/32/64 bit */
1172 1186
1173#define ACPI_RESOURCE_ADDRESS_COMMON \ 1187#define ACPI_RESOURCE_ADDRESS_COMMON \
1174 u8 resource_type; \ 1188 u8 resource_type; \
1175 u8 producer_consumer; \ 1189 u8 producer_consumer; \
1176 u8 decode; \ 1190 u8 decode; \
1177 u8 min_address_fixed; \ 1191 u8 min_address_fixed; \
1178 u8 max_address_fixed; \ 1192 u8 max_address_fixed; \
1179 union acpi_resource_attribute info; 1193 union acpi_resource_attribute info;
1180 1194
1181struct acpi_resource_address { 1195struct acpi_resource_address {
1182ACPI_RESOURCE_ADDRESS_COMMON}; 1196ACPI_RESOURCE_ADDRESS_COMMON};
@@ -1297,16 +1311,6 @@ struct acpi_resource {
1297 1311
1298#define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length) 1312#define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length)
1299 1313
1300#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
1301#define ACPI_ALIGN_RESOURCE_SIZE(length) (length)
1302#else
1303#define ACPI_ALIGN_RESOURCE_SIZE(length) ACPI_ROUND_UP_TO_NATIVE_WORD(length)
1304#endif
1305
1306/*
1307 * END: of definitions for Resource Attributes
1308 */
1309
1310struct acpi_pci_routing_table { 1314struct acpi_pci_routing_table {
1311 u32 length; 1315 u32 length;
1312 u32 pin; 1316 u32 pin;
@@ -1315,8 +1319,4 @@ struct acpi_pci_routing_table {
1315 char source[4]; /* pad to 64 bits so sizeof() works in all cases */ 1319 char source[4]; /* pad to 64 bits so sizeof() works in all cases */
1316}; 1320};
1317 1321
1318/*
1319 * END: of definitions for PCI Routing tables
1320 */
1321
1322#endif /* __ACTYPES_H__ */ 1322#endif /* __ACTYPES_H__ */
diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h
index 0927765df6aa..ba039ea1a057 100644
--- a/include/acpi/acutils.h
+++ b/include/acpi/acutils.h
@@ -50,24 +50,24 @@ extern const u8 acpi_gbl_resource_aml_sizes[];
50 50
51#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER) 51#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER)
52 52
53extern const char *acpi_gbl_BMdecode[2]; 53extern const char *acpi_gbl_bm_decode[];
54extern const char *acpi_gbl_config_decode[4]; 54extern const char *acpi_gbl_config_decode[];
55extern const char *acpi_gbl_consume_decode[2]; 55extern const char *acpi_gbl_consume_decode[];
56extern const char *acpi_gbl_DECdecode[2]; 56extern const char *acpi_gbl_dec_decode[];
57extern const char *acpi_gbl_HEdecode[2]; 57extern const char *acpi_gbl_he_decode[];
58extern const char *acpi_gbl_io_decode[2]; 58extern const char *acpi_gbl_io_decode[];
59extern const char *acpi_gbl_LLdecode[2]; 59extern const char *acpi_gbl_ll_decode[];
60extern const char *acpi_gbl_max_decode[2]; 60extern const char *acpi_gbl_max_decode[];
61extern const char *acpi_gbl_MEMdecode[4]; 61extern const char *acpi_gbl_mem_decode[];
62extern const char *acpi_gbl_min_decode[2]; 62extern const char *acpi_gbl_min_decode[];
63extern const char *acpi_gbl_MTPdecode[4]; 63extern const char *acpi_gbl_mtp_decode[];
64extern const char *acpi_gbl_RNGdecode[4]; 64extern const char *acpi_gbl_rng_decode[];
65extern const char *acpi_gbl_RWdecode[2]; 65extern const char *acpi_gbl_rw_decode[];
66extern const char *acpi_gbl_SHRdecode[2]; 66extern const char *acpi_gbl_shr_decode[];
67extern const char *acpi_gbl_SIZdecode[4]; 67extern const char *acpi_gbl_siz_decode[];
68extern const char *acpi_gbl_TRSdecode[2]; 68extern const char *acpi_gbl_trs_decode[];
69extern const char *acpi_gbl_TTPdecode[2]; 69extern const char *acpi_gbl_ttp_decode[];
70extern const char *acpi_gbl_TYPdecode[4]; 70extern const char *acpi_gbl_typ_decode[];
71#endif 71#endif
72 72
73/* Types for Resource descriptor entries */ 73/* Types for Resource descriptor entries */
@@ -78,6 +78,12 @@ extern const char *acpi_gbl_TYPdecode[4];
78#define ACPI_SMALL_VARIABLE_LENGTH 3 78#define ACPI_SMALL_VARIABLE_LENGTH 3
79 79
80typedef 80typedef
81acpi_status(*acpi_walk_aml_callback) (u8 * aml,
82 u32 length,
83 u32 offset,
84 u8 resource_index, void **context);
85
86typedef
81acpi_status(*acpi_pkg_callback) (u8 object_type, 87acpi_status(*acpi_pkg_callback) (u8 object_type,
82 union acpi_operand_object * source_object, 88 union acpi_operand_object * source_object,
83 union acpi_generic_state * state, 89 union acpi_generic_state * state,
@@ -277,6 +283,8 @@ acpi_ut_ptr_exit(u32 line_number,
277 283
278void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id); 284void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id);
279 285
286void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display);
287
280void acpi_ut_report_error(char *module_name, u32 line_number); 288void acpi_ut_report_error(char *module_name, u32 line_number);
281 289
282void acpi_ut_report_info(char *module_name, u32 line_number); 290void acpi_ut_report_info(char *module_name, u32 line_number);
@@ -445,6 +453,8 @@ acpi_ut_short_divide(acpi_integer in_dividend,
445/* 453/*
446 * utmisc 454 * utmisc
447 */ 455 */
456u8 acpi_ut_is_aml_table(struct acpi_table_header *table);
457
448acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id); 458acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id);
449 459
450void acpi_ut_release_owner_id(acpi_owner_id * owner_id); 460void acpi_ut_release_owner_id(acpi_owner_id * owner_id);
@@ -460,7 +470,9 @@ void acpi_ut_print_string(char *string, u8 max_length);
460 470
461u8 acpi_ut_valid_acpi_name(u32 name); 471u8 acpi_ut_valid_acpi_name(u32 name);
462 472
463u8 acpi_ut_valid_acpi_character(char character); 473acpi_name acpi_ut_repair_name(acpi_name name);
474
475u8 acpi_ut_valid_acpi_char(char character, acpi_native_uint position);
464 476
465acpi_status 477acpi_status
466acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer); 478acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer);
@@ -469,6 +481,25 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer);
469 481
470#define ACPI_ANY_BASE 0 482#define ACPI_ANY_BASE 0
471 483
484u32 acpi_ut_dword_byte_swap(u32 value);
485
486void acpi_ut_set_integer_width(u8 revision);
487
488#ifdef ACPI_DEBUG_OUTPUT
489void
490acpi_ut_display_init_pathname(u8 type,
491 struct acpi_namespace_node *obj_handle,
492 char *path);
493#endif
494
495/*
496 * utresrc
497 */
498acpi_status
499acpi_ut_walk_aml_resources(u8 * aml,
500 acpi_size aml_length,
501 acpi_walk_aml_callback user_function, void **context);
502
472acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index); 503acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index);
473 504
474u32 acpi_ut_get_descriptor_length(void *aml); 505u32 acpi_ut_get_descriptor_length(void *aml);
@@ -483,20 +514,6 @@ acpi_status
483acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc, 514acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc,
484 u8 ** end_tag); 515 u8 ** end_tag);
485 516
486u8 acpi_ut_generate_checksum(u8 * buffer, u32 length);
487
488u32 acpi_ut_dword_byte_swap(u32 value);
489
490void acpi_ut_set_integer_width(u8 revision);
491
492#ifdef ACPI_DEBUG_OUTPUT
493void
494acpi_ut_display_init_pathname(u8 type,
495 struct acpi_namespace_node *obj_handle,
496 char *path);
497
498#endif
499
500/* 517/*
501 * utmutex - mutex support 518 * utmutex - mutex support
502 */ 519 */
@@ -523,14 +540,15 @@ acpi_ut_initialize_buffer(struct acpi_buffer *buffer,
523 540
524void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line); 541void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line);
525 542
526void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line); 543void *acpi_ut_allocate_zeroed(acpi_size size,
544 u32 component, char *module, u32 line);
527 545
528#ifdef ACPI_DBG_TRACK_ALLOCATIONS 546#ifdef ACPI_DBG_TRACK_ALLOCATIONS
529void *acpi_ut_allocate_and_track(acpi_size size, 547void *acpi_ut_allocate_and_track(acpi_size size,
530 u32 component, char *module, u32 line); 548 u32 component, char *module, u32 line);
531 549
532void *acpi_ut_callocate_and_track(acpi_size size, 550void *acpi_ut_allocate_zeroed_and_track(acpi_size size,
533 u32 component, char *module, u32 line); 551 u32 component, char *module, u32 line);
534 552
535void 553void
536acpi_ut_free_and_track(void *address, u32 component, char *module, u32 line); 554acpi_ut_free_and_track(void *address, u32 component, char *module, u32 line);
@@ -540,6 +558,11 @@ void acpi_ut_dump_allocation_info(void);
540#endif /* ACPI_FUTURE_USAGE */ 558#endif /* ACPI_FUTURE_USAGE */
541 559
542void acpi_ut_dump_allocations(u32 component, char *module); 560void acpi_ut_dump_allocations(u32 component, char *module);
561
562acpi_status
563acpi_ut_create_list(char *list_name,
564 u16 object_size, struct acpi_memory_list **return_cache);
565
543#endif 566#endif
544 567
545#endif /* _ACUTILS_H */ 568#endif /* _ACUTILS_H */
diff --git a/include/acpi/amlcode.h b/include/acpi/amlcode.h
index 37964a59aef8..cf18426a87b1 100644
--- a/include/acpi/amlcode.h
+++ b/include/acpi/amlcode.h
@@ -180,8 +180,10 @@
180#define AML_BANK_FIELD_OP (u16) 0x5b87 180#define AML_BANK_FIELD_OP (u16) 0x5b87
181#define AML_DATA_REGION_OP (u16) 0x5b88 /* ACPI 2.0 */ 181#define AML_DATA_REGION_OP (u16) 0x5b88 /* ACPI 2.0 */
182 182
183/* Bogus opcodes (they are actually two separate opcodes) */ 183/*
184 184 * Combination opcodes (actually two one-byte opcodes)
185 * Used by the disassembler and i_aSL compiler
186 */
185#define AML_LGREATEREQUAL_OP (u16) 0x9295 187#define AML_LGREATEREQUAL_OP (u16) 0x9295
186#define AML_LLESSEQUAL_OP (u16) 0x9294 188#define AML_LLESSEQUAL_OP (u16) 0x9294
187#define AML_LNOTEQUAL_OP (u16) 0x9293 189#define AML_LNOTEQUAL_OP (u16) 0x9293
diff --git a/include/acpi/amlresrc.h b/include/acpi/amlresrc.h
index fb4735315ad3..be03818af9d1 100644
--- a/include/acpi/amlresrc.h
+++ b/include/acpi/amlresrc.h
@@ -42,39 +42,45 @@
42 * POSSIBILITY OF SUCH DAMAGES. 42 * POSSIBILITY OF SUCH DAMAGES.
43 */ 43 */
44 44
45/* acpisrc:struct_defs -- for acpisrc conversion */
46
45#ifndef __AMLRESRC_H 47#ifndef __AMLRESRC_H
46#define __AMLRESRC_H 48#define __AMLRESRC_H
47 49
48#define ASL_RESNAME_ADDRESS "_ADR" 50/*
49#define ASL_RESNAME_ALIGNMENT "_ALN" 51 * Resource descriptor tags, as defined in the ACPI specification.
50#define ASL_RESNAME_ADDRESSSPACE "_ASI" 52 * Used to symbolically reference fields within a descriptor.
51#define ASL_RESNAME_ACCESSSIZE "_ASZ" 53 */
52#define ASL_RESNAME_TYPESPECIFICATTRIBUTES "_ATT" 54#define ACPI_RESTAG_ADDRESS "_ADR"
53#define ASL_RESNAME_BASEADDRESS "_BAS" 55#define ACPI_RESTAG_ALIGNMENT "_ALN"
54#define ASL_RESNAME_BUSMASTER "_BM_" /* Master(1), Slave(0) */ 56#define ACPI_RESTAG_ADDRESSSPACE "_ASI"
55#define ASL_RESNAME_DECODE "_DEC" 57#define ACPI_RESTAG_ACCESSSIZE "_ASZ"
56#define ASL_RESNAME_DMA "_DMA" 58#define ACPI_RESTAG_TYPESPECIFICATTRIBUTES "_ATT"
57#define ASL_RESNAME_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */ 59#define ACPI_RESTAG_BASEADDRESS "_BAS"
58#define ASL_RESNAME_GRANULARITY "_GRA" 60#define ACPI_RESTAG_BUSMASTER "_BM_" /* Master(1), Slave(0) */
59#define ASL_RESNAME_INTERRUPT "_INT" 61#define ACPI_RESTAG_DECODE "_DEC"
60#define ASL_RESNAME_INTERRUPTLEVEL "_LL_" /* active_lo(1), active_hi(0) */ 62#define ACPI_RESTAG_DMA "_DMA"
61#define ASL_RESNAME_INTERRUPTSHARE "_SHR" /* Shareable(1), no_share(0) */ 63#define ACPI_RESTAG_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */
62#define ASL_RESNAME_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */ 64#define ACPI_RESTAG_GRANULARITY "_GRA"
63#define ASL_RESNAME_LENGTH "_LEN" 65#define ACPI_RESTAG_INTERRUPT "_INT"
64#define ASL_RESNAME_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */ 66#define ACPI_RESTAG_INTERRUPTLEVEL "_LL_" /* active_lo(1), active_hi(0) */
65#define ASL_RESNAME_MEMTYPE "_MEM" /* non_cache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */ 67#define ACPI_RESTAG_INTERRUPTSHARE "_SHR" /* Shareable(1), no_share(0) */
66#define ASL_RESNAME_MAXADDR "_MAX" 68#define ACPI_RESTAG_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */
67#define ASL_RESNAME_MINADDR "_MIN" 69#define ACPI_RESTAG_LENGTH "_LEN"
68#define ASL_RESNAME_MAXTYPE "_MAF" 70#define ACPI_RESTAG_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */
69#define ASL_RESNAME_MINTYPE "_MIF" 71#define ACPI_RESTAG_MEMTYPE "_MEM" /* non_cache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */
70#define ASL_RESNAME_REGISTERBITOFFSET "_RBO" 72#define ACPI_RESTAG_MAXADDR "_MAX"
71#define ASL_RESNAME_REGISTERBITWIDTH "_RBW" 73#define ACPI_RESTAG_MINADDR "_MIN"
72#define ASL_RESNAME_RANGETYPE "_RNG" 74#define ACPI_RESTAG_MAXTYPE "_MAF"
73#define ASL_RESNAME_READWRITETYPE "_RW_" /* read_only(0), Writeable (1) */ 75#define ACPI_RESTAG_MINTYPE "_MIF"
74#define ASL_RESNAME_TRANSLATION "_TRA" 76#define ACPI_RESTAG_REGISTERBITOFFSET "_RBO"
75#define ASL_RESNAME_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */ 77#define ACPI_RESTAG_REGISTERBITWIDTH "_RBW"
76#define ASL_RESNAME_TYPE "_TTP" /* Translation(1), Static (0) */ 78#define ACPI_RESTAG_RANGETYPE "_RNG"
77#define ASL_RESNAME_XFERTYPE "_SIz" /* 8(0), 8_and16(1), 16(2) */ 79#define ACPI_RESTAG_READWRITETYPE "_RW_" /* read_only(0), Writeable (1) */
80#define ACPI_RESTAG_TRANSLATION "_TRA"
81#define ACPI_RESTAG_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */
82#define ACPI_RESTAG_TYPE "_TTP" /* Translation(1), Static (0) */
83#define ACPI_RESTAG_XFERTYPE "_SIZ" /* 8(0), 8_and16(1), 16(2) */
78 84
79/* Default sizes for "small" resource descriptors */ 85/* Default sizes for "small" resource descriptors */
80 86
@@ -109,7 +115,7 @@ struct asl_resource_node {
109 * SMALL descriptors 115 * SMALL descriptors
110 */ 116 */
111#define AML_RESOURCE_SMALL_HEADER_COMMON \ 117#define AML_RESOURCE_SMALL_HEADER_COMMON \
112 u8 descriptor_type; 118 u8 descriptor_type;
113 119
114struct aml_resource_small_header { 120struct aml_resource_small_header {
115AML_RESOURCE_SMALL_HEADER_COMMON}; 121AML_RESOURCE_SMALL_HEADER_COMMON};
@@ -162,8 +168,8 @@ struct aml_resource_end_tag {
162 * LARGE descriptors 168 * LARGE descriptors
163 */ 169 */
164#define AML_RESOURCE_LARGE_HEADER_COMMON \ 170#define AML_RESOURCE_LARGE_HEADER_COMMON \
165 u8 descriptor_type;\ 171 u8 descriptor_type;\
166 u16 resource_length; 172 u16 resource_length;
167 173
168struct aml_resource_large_header { 174struct aml_resource_large_header {
169AML_RESOURCE_LARGE_HEADER_COMMON}; 175AML_RESOURCE_LARGE_HEADER_COMMON};
@@ -194,9 +200,9 @@ struct aml_resource_fixed_memory32 {
194}; 200};
195 201
196#define AML_RESOURCE_ADDRESS_COMMON \ 202#define AML_RESOURCE_ADDRESS_COMMON \
197 u8 resource_type; \ 203 u8 resource_type; \
198 u8 flags; \ 204 u8 flags; \
199 u8 specific_flags; 205 u8 specific_flags;
200 206
201struct aml_resource_address { 207struct aml_resource_address {
202AML_RESOURCE_LARGE_HEADER_COMMON AML_RESOURCE_ADDRESS_COMMON}; 208AML_RESOURCE_LARGE_HEADER_COMMON AML_RESOURCE_ADDRESS_COMMON};
@@ -266,6 +272,7 @@ struct aml_resource_generic_register {
266union aml_resource { 272union aml_resource {
267 /* Descriptor headers */ 273 /* Descriptor headers */
268 274
275 u8 descriptor_type;
269 struct aml_resource_small_header small_header; 276 struct aml_resource_small_header small_header;
270 struct aml_resource_large_header large_header; 277 struct aml_resource_large_header large_header;
271 278
@@ -296,9 +303,9 @@ union aml_resource {
296 /* Utility overlays */ 303 /* Utility overlays */
297 304
298 struct aml_resource_address address; 305 struct aml_resource_address address;
299 u32 u32_item; 306 u32 dword_item;
300 u16 u16_item; 307 u16 word_item;
301 u8 U8item; 308 u8 byte_item;
302}; 309};
303 310
304#endif 311#endif
diff --git a/include/acpi/pdc_intel.h b/include/acpi/pdc_intel.h
index 3fa81d55cd0c..c5472be6f3a2 100644
--- a/include/acpi/pdc_intel.h
+++ b/include/acpi/pdc_intel.h
@@ -18,6 +18,11 @@
18 ACPI_PDC_C_C1_HALT | \ 18 ACPI_PDC_C_C1_HALT | \
19 ACPI_PDC_P_FFH) 19 ACPI_PDC_P_FFH)
20 20
21#define ACPI_PDC_EST_CAPABILITY_SWSMP (ACPI_PDC_SMP_C1PT | \
22 ACPI_PDC_C_C1_HALT | \
23 ACPI_PDC_SMP_P_SWCOORD | \
24 ACPI_PDC_P_FFH)
25
21#define ACPI_PDC_C_CAPABILITY_SMP (ACPI_PDC_SMP_C2C3 | \ 26#define ACPI_PDC_C_CAPABILITY_SMP (ACPI_PDC_SMP_C2C3 | \
22 ACPI_PDC_SMP_C1PT | \ 27 ACPI_PDC_SMP_C1PT | \
23 ACPI_PDC_C_C1_HALT) 28 ACPI_PDC_C_C1_HALT)
diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h
index 223ec6467108..453a469fd397 100644
--- a/include/acpi/platform/acenv.h
+++ b/include/acpi/platform/acenv.h
@@ -49,33 +49,41 @@
49 */ 49 */
50 50
51#ifdef ACPI_LIBRARY 51#ifdef ACPI_LIBRARY
52/*
53 * Note: The non-debug version of the acpi_library does not contain any
54 * debug support, for minimimal size. The debug version uses ACPI_FULL_DEBUG
55 */
52#define ACPI_USE_LOCAL_CACHE 56#define ACPI_USE_LOCAL_CACHE
53#endif 57#endif
54 58
55#ifdef ACPI_DUMP_APP 59#ifdef ACPI_ASL_COMPILER
56#ifndef MSDOS
57#define ACPI_DEBUG_OUTPUT 60#define ACPI_DEBUG_OUTPUT
58#endif
59#define ACPI_APPLICATION 61#define ACPI_APPLICATION
60#define ACPI_DISASSEMBLER 62#define ACPI_DISASSEMBLER
61#define ACPI_NO_METHOD_EXECUTION 63#define ACPI_CONSTANT_EVAL_ONLY
64#define ACPI_LARGE_NAMESPACE_NODE
65#define ACPI_DATA_TABLE_DISASSEMBLY
62#endif 66#endif
63 67
64#ifdef ACPI_EXEC_APP 68#ifdef ACPI_EXEC_APP
65#undef DEBUGGER_THREADING 69#undef DEBUGGER_THREADING
66#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED 70#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED
67#define ACPI_DEBUG_OUTPUT 71#define ACPI_FULL_DEBUG
68#define ACPI_APPLICATION 72#define ACPI_APPLICATION
69#define ACPI_DEBUGGER 73#define ACPI_DEBUGGER
70#define ACPI_DISASSEMBLER
71#define ACPI_MUTEX_DEBUG 74#define ACPI_MUTEX_DEBUG
75#define ACPI_DBG_TRACK_ALLOCATIONS
72#endif 76#endif
73 77
74#ifdef ACPI_ASL_COMPILER 78#ifdef ACPI_DASM_APP
79#ifndef MSDOS
75#define ACPI_DEBUG_OUTPUT 80#define ACPI_DEBUG_OUTPUT
81#endif
76#define ACPI_APPLICATION 82#define ACPI_APPLICATION
77#define ACPI_DISASSEMBLER 83#define ACPI_DISASSEMBLER
78#define ACPI_CONSTANT_EVAL_ONLY 84#define ACPI_NO_METHOD_EXECUTION
85#define ACPI_LARGE_NAMESPACE_NODE
86#define ACPI_DATA_TABLE_DISASSEMBLY
79#endif 87#endif
80 88
81#ifdef ACPI_APPLICATION 89#ifdef ACPI_APPLICATION
@@ -83,6 +91,12 @@
83#define ACPI_USE_LOCAL_CACHE 91#define ACPI_USE_LOCAL_CACHE
84#endif 92#endif
85 93
94#ifdef ACPI_FULL_DEBUG
95#define ACPI_DEBUGGER
96#define ACPI_DEBUG_OUTPUT
97#define ACPI_DISASSEMBLER
98#endif
99
86/* 100/*
87 * Environment configuration. The purpose of this file is to interface to the 101 * Environment configuration. The purpose of this file is to interface to the
88 * local generation environment. 102 * local generation environment.
@@ -137,7 +151,7 @@
137#elif defined(MSDOS) /* Must appear after WIN32 and WIN64 check */ 151#elif defined(MSDOS) /* Must appear after WIN32 and WIN64 check */
138#include "acdos16.h" 152#include "acdos16.h"
139 153
140#elif defined(__FreeBSD__) 154#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
141#include "acfreebsd.h" 155#include "acfreebsd.h"
142 156
143#elif defined(__NetBSD__) 157#elif defined(__NetBSD__)
@@ -163,17 +177,6 @@
163 177
164#endif 178#endif
165 179
166/*
167 * Memory allocation tracking. Used only if
168 * 1) This is the debug version
169 * 2) This is NOT a 16-bit version of the code (not enough real-mode memory)
170 */
171#ifdef ACPI_DEBUG_OUTPUT
172#if ACPI_MACHINE_WIDTH != 16
173#define ACPI_DBG_TRACK_ALLOCATIONS
174#endif
175#endif
176
177/*! [End] no source code translation !*/ 180/*! [End] no source code translation !*/
178 181
179/* 182/*
@@ -271,8 +274,8 @@ typedef char *va_list;
271/* 274/*
272 * Storage alignment properties 275 * Storage alignment properties
273 */ 276 */
274#define _AUPBND (sizeof (acpi_native_uint) - 1) 277#define _AUPBND (sizeof (acpi_native_int) - 1)
275#define _ADNBND (sizeof (acpi_native_uint) - 1) 278#define _ADNBND (sizeof (acpi_native_int) - 1)
276 279
277/* 280/*
278 * Variable argument list macro definitions 281 * Variable argument list macro definitions
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 3c6a6205853a..277d35bced03 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -51,27 +51,22 @@
51 51
52#include <linux/string.h> 52#include <linux/string.h>
53#include <linux/kernel.h> 53#include <linux/kernel.h>
54#include <linux/module.h>
54#include <linux/ctype.h> 55#include <linux/ctype.h>
55#include <asm/system.h> 56#include <asm/system.h>
56#include <asm/atomic.h> 57#include <asm/atomic.h>
57#include <asm/div64.h> 58#include <asm/div64.h>
58#include <asm/acpi.h> 59#include <asm/acpi.h>
60#include <linux/slab.h>
59 61
60#define strtoul simple_strtoul 62/* Host-dependent types and defines */
61
62#define ACPI_MACHINE_WIDTH BITS_PER_LONG
63 63
64/* Type(s) for the OSL */ 64#define ACPI_MACHINE_WIDTH BITS_PER_LONG
65 65#define acpi_cache_t kmem_cache_t
66#ifdef ACPI_USE_LOCAL_CACHE 66#define ACPI_EXPORT_SYMBOL(symbol) EXPORT_SYMBOL(symbol);
67#define acpi_cache_t struct acpi_memory_list 67#define strtoul simple_strtoul
68#else
69#include <linux/slab.h>
70#define acpi_cache_t kmem_cache_t
71#endif
72 68
73/* Full namespace pathname length limit - arbitrary */ 69/* Full namespace pathname length limit - arbitrary */
74
75#define ACPI_PATHNAME_MAX 256 70#define ACPI_PATHNAME_MAX 256
76 71
77#else /* !__KERNEL__ */ 72#else /* !__KERNEL__ */
@@ -103,4 +98,8 @@
103 98
104#define acpi_cpu_flags unsigned long 99#define acpi_cpu_flags unsigned long
105 100
101#define acpi_thread_id u32
102
103static inline acpi_thread_id acpi_os_get_thread_id(void) { return 0; }
104
106#endif /* __ACLINUX_H__ */ 105#endif /* __ACLINUX_H__ */
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index ef7d83a41470..77371b3cdc44 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -2,6 +2,7 @@
2#define __ACPI_PROCESSOR_H 2#define __ACPI_PROCESSOR_H
3 3
4#include <linux/kernel.h> 4#include <linux/kernel.h>
5#include <linux/cpu.h>
5 6
6#include <asm/acpi.h> 7#include <asm/acpi.h>
7 8
@@ -17,6 +18,17 @@
17 18
18#define ACPI_PDC_REVISION_ID 0x1 19#define ACPI_PDC_REVISION_ID 0x1
19 20
21#define ACPI_PSD_REV0_REVISION 0 /* Support for _PSD as in ACPI 3.0 */
22#define ACPI_PSD_REV0_ENTRIES 5
23
24/*
25 * Types of coordination defined in ACPI 3.0. Same macros can be used across
26 * P, C and T states
27 */
28#define DOMAIN_COORD_TYPE_SW_ALL 0xfc
29#define DOMAIN_COORD_TYPE_SW_ANY 0xfd
30#define DOMAIN_COORD_TYPE_HW_ALL 0xfe
31
20/* Power Management */ 32/* Power Management */
21 33
22struct acpi_processor_cx; 34struct acpi_processor_cx;
@@ -65,6 +77,14 @@ struct acpi_processor_power {
65 77
66/* Performance Management */ 78/* Performance Management */
67 79
80struct acpi_psd_package {
81 acpi_integer num_entries;
82 acpi_integer revision;
83 acpi_integer domain;
84 acpi_integer coord_type;
85 acpi_integer num_processors;
86} __attribute__ ((packed));
87
68struct acpi_pct_register { 88struct acpi_pct_register {
69 u8 descriptor; 89 u8 descriptor;
70 u16 length; 90 u16 length;
@@ -91,7 +111,9 @@ struct acpi_processor_performance {
91 struct acpi_pct_register status_register; 111 struct acpi_pct_register status_register;
92 unsigned int state_count; 112 unsigned int state_count;
93 struct acpi_processor_px *states; 113 struct acpi_processor_px *states;
94 114 struct acpi_psd_package domain_info;
115 cpumask_t shared_cpu_map;
116 unsigned int shared_type;
95}; 117};
96 118
97/* Throttling Control */ 119/* Throttling Control */
@@ -160,6 +182,9 @@ struct acpi_processor_errata {
160 } piix4; 182 } piix4;
161}; 183};
162 184
185extern int acpi_processor_preregister_performance(
186 struct acpi_processor_performance **performance);
187
163extern int acpi_processor_register_performance(struct acpi_processor_performance 188extern int acpi_processor_register_performance(struct acpi_processor_performance
164 *performance, unsigned int cpu); 189 *performance, unsigned int cpu);
165extern void acpi_processor_unregister_performance(struct 190extern void acpi_processor_unregister_performance(struct
diff --git a/include/asm-alpha/floppy.h b/include/asm-alpha/floppy.h
index e177d4180f83..21816d35ef89 100644
--- a/include/asm-alpha/floppy.h
+++ b/include/asm-alpha/floppy.h
@@ -25,9 +25,8 @@
25#define fd_enable_irq() enable_irq(FLOPPY_IRQ) 25#define fd_enable_irq() enable_irq(FLOPPY_IRQ)
26#define fd_disable_irq() disable_irq(FLOPPY_IRQ) 26#define fd_disable_irq() disable_irq(FLOPPY_IRQ)
27#define fd_cacheflush(addr,size) /* nothing */ 27#define fd_cacheflush(addr,size) /* nothing */
28#define fd_request_irq() request_irq(FLOPPY_IRQ, floppy_interrupt, \ 28#define fd_request_irq() request_irq(FLOPPY_IRQ, floppy_interrupt,\
29 SA_INTERRUPT|SA_SAMPLE_RANDOM, \ 29 SA_INTERRUPT, "floppy", NULL)
30 "floppy", NULL)
31#define fd_free_irq() free_irq(FLOPPY_IRQ, NULL); 30#define fd_free_irq() free_irq(FLOPPY_IRQ, NULL);
32 31
33#ifdef CONFIG_PCI 32#ifdef CONFIG_PCI
diff --git a/include/asm-alpha/irq.h b/include/asm-alpha/irq.h
index f6de033718a0..917b9fe372cf 100644
--- a/include/asm-alpha/irq.h
+++ b/include/asm-alpha/irq.h
@@ -92,8 +92,4 @@ extern void enable_irq(unsigned int);
92struct pt_regs; 92struct pt_regs;
93extern void (*perf_irq)(unsigned long, struct pt_regs *); 93extern void (*perf_irq)(unsigned long, struct pt_regs *);
94 94
95struct irqaction;
96int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *);
97
98
99#endif /* _ALPHA_IRQ_H */ 95#endif /* _ALPHA_IRQ_H */
diff --git a/include/asm-alpha/vga.h b/include/asm-alpha/vga.h
index 8ca4f6b2da19..ed06f59b544d 100644
--- a/include/asm-alpha/vga.h
+++ b/include/asm-alpha/vga.h
@@ -46,6 +46,6 @@ extern void scr_memcpyw(u16 *d, const u16 *s, unsigned int count);
46#define vga_readb(a) readb((u8 __iomem *)(a)) 46#define vga_readb(a) readb((u8 __iomem *)(a))
47#define vga_writeb(v,a) writeb(v, (u8 __iomem *)(a)) 47#define vga_writeb(v,a) writeb(v, (u8 __iomem *)(a))
48 48
49#define VGA_MAP_MEM(x) ((unsigned long) ioremap(x, 0)) 49#define VGA_MAP_MEM(x,s) ((unsigned long) ioremap(x, s))
50 50
51#endif 51#endif
diff --git a/include/asm-arm/arch-aaec2000/io.h b/include/asm-arm/arch-aaec2000/io.h
index 8d67907fd4f0..d710204ac747 100644
--- a/include/asm-arm/arch-aaec2000/io.h
+++ b/include/asm-arm/arch-aaec2000/io.h
@@ -16,6 +16,5 @@
16 */ 16 */
17#define __io(a) ((void __iomem *)(a)) 17#define __io(a) ((void __iomem *)(a))
18#define __mem_pci(a) (a) 18#define __mem_pci(a) (a)
19#define __mem_isa(a) (a)
20 19
21#endif 20#endif
diff --git a/include/asm-arm/arch-clps711x/io.h b/include/asm-arm/arch-clps711x/io.h
index 62613b0e2d96..53d790202c19 100644
--- a/include/asm-arm/arch-clps711x/io.h
+++ b/include/asm-arm/arch-clps711x/io.h
@@ -26,7 +26,6 @@
26 26
27#define __io(a) ((void __iomem *)(a)) 27#define __io(a) ((void __iomem *)(a))
28#define __mem_pci(a) (a) 28#define __mem_pci(a) (a)
29#define __mem_isa(a) (a)
30 29
31/* 30/*
32 * We don't support ins[lb]/outs[lb]. Make them fault. 31 * We don't support ins[lb]/outs[lb]. Make them fault.
diff --git a/include/asm-arm/arch-ebsa285/io.h b/include/asm-arm/arch-ebsa285/io.h
index 776f9d377057..f9c729141860 100644
--- a/include/asm-arm/arch-ebsa285/io.h
+++ b/include/asm-arm/arch-ebsa285/io.h
@@ -24,7 +24,6 @@
24#define __io(a) ((void __iomem *)(PCIO_BASE + (a))) 24#define __io(a) ((void __iomem *)(PCIO_BASE + (a)))
25#if 1 25#if 1
26#define __mem_pci(a) (a) 26#define __mem_pci(a) (a)
27#define __mem_isa(a) ((a) + PCIMEM_BASE)
28#else 27#else
29 28
30static inline void __iomem *___mem_pci(void __iomem *p) 29static inline void __iomem *___mem_pci(void __iomem *p)
@@ -34,14 +33,7 @@ static inline void __iomem *___mem_pci(void __iomem *p)
34 return p; 33 return p;
35} 34}
36 35
37static inline void __iomem *___mem_isa(void __iomem *p)
38{
39 unsigned long a = (unsigned long)p;
40 BUG_ON(a >= 16*1048576);
41 return p + PCIMEM_BASE;
42}
43#define __mem_pci(a) ___mem_pci(a) 36#define __mem_pci(a) ___mem_pci(a)
44#define __mem_isa(a) ___mem_isa(a)
45#endif 37#endif
46 38
47#endif 39#endif
diff --git a/include/asm-arm/arch-ep93xx/ep93xx-regs.h b/include/asm-arm/arch-ep93xx/ep93xx-regs.h
index 71cea0b5841b..8c322975f96e 100644
--- a/include/asm-arm/arch-ep93xx/ep93xx-regs.h
+++ b/include/asm-arm/arch-ep93xx/ep93xx-regs.h
@@ -115,6 +115,8 @@
115#define EP93XX_SYSCON_CLOCK_USH_EN 0x10000000 115#define EP93XX_SYSCON_CLOCK_USH_EN 0x10000000
116#define EP93XX_SYSCON_HALT EP93XX_SYSCON_REG(0x08) 116#define EP93XX_SYSCON_HALT EP93XX_SYSCON_REG(0x08)
117#define EP93XX_SYSCON_STANDBY EP93XX_SYSCON_REG(0x0c) 117#define EP93XX_SYSCON_STANDBY EP93XX_SYSCON_REG(0x0c)
118#define EP93XX_SYSCON_CLOCK_SET1 EP93XX_SYSCON_REG(0x20)
119#define EP93XX_SYSCON_CLOCK_SET2 EP93XX_SYSCON_REG(0x24)
118#define EP93XX_SYSCON_DEVICE_CONFIG EP93XX_SYSCON_REG(0x80) 120#define EP93XX_SYSCON_DEVICE_CONFIG EP93XX_SYSCON_REG(0x80)
119#define EP93XX_SYSCON_DEVICE_CONFIG_CRUNCH_ENABLE 0x00800000 121#define EP93XX_SYSCON_DEVICE_CONFIG_CRUNCH_ENABLE 0x00800000
120#define EP93XX_SYSCON_SWLOCK EP93XX_SYSCON_REG(0xc0) 122#define EP93XX_SYSCON_SWLOCK EP93XX_SYSCON_REG(0xc0)
diff --git a/include/asm-arm/arch-ep93xx/platform.h b/include/asm-arm/arch-ep93xx/platform.h
index df9cbb6ef660..d7a34ce20293 100644
--- a/include/asm-arm/arch-ep93xx/platform.h
+++ b/include/asm-arm/arch-ep93xx/platform.h
@@ -8,6 +8,7 @@ void ep93xx_map_io(void);
8void ep93xx_init_irq(void); 8void ep93xx_init_irq(void);
9void ep93xx_init_time(unsigned long); 9void ep93xx_init_time(unsigned long);
10void ep93xx_init_devices(void); 10void ep93xx_init_devices(void);
11void ep93xx_clock_init(void);
11extern struct sys_timer ep93xx_timer; 12extern struct sys_timer ep93xx_timer;
12 13
13 14
diff --git a/include/asm-arm/arch-imx/imx-dma.h b/include/asm-arm/arch-imx/imx-dma.h
index f2063c1d610d..599f03e5a9ef 100644
--- a/include/asm-arm/arch-imx/imx-dma.h
+++ b/include/asm-arm/arch-imx/imx-dma.h
@@ -46,7 +46,7 @@
46struct imx_dma_channel { 46struct imx_dma_channel {
47 const char *name; 47 const char *name;
48 void (*irq_handler) (int, void *, struct pt_regs *); 48 void (*irq_handler) (int, void *, struct pt_regs *);
49 void (*err_handler) (int, void *, struct pt_regs *); 49 void (*err_handler) (int, void *, struct pt_regs *, int errcode);
50 void *data; 50 void *data;
51 dmamode_t dma_mode; 51 dmamode_t dma_mode;
52 struct scatterlist *sg; 52 struct scatterlist *sg;
@@ -58,6 +58,10 @@ struct imx_dma_channel {
58 58
59extern struct imx_dma_channel imx_dma_channels[IMX_DMA_CHANNELS]; 59extern struct imx_dma_channel imx_dma_channels[IMX_DMA_CHANNELS];
60 60
61#define IMX_DMA_ERR_BURST 1
62#define IMX_DMA_ERR_REQUEST 2
63#define IMX_DMA_ERR_TRANSFER 4
64#define IMX_DMA_ERR_BUFFER 8
61 65
62/* The type to distinguish channel numbers parameter from ordinal int type */ 66/* The type to distinguish channel numbers parameter from ordinal int type */
63typedef int imx_dmach_t; 67typedef int imx_dmach_t;
@@ -74,7 +78,7 @@ imx_dma_setup_sg(imx_dmach_t dma_ch,
74int 78int
75imx_dma_setup_handlers(imx_dmach_t dma_ch, 79imx_dma_setup_handlers(imx_dmach_t dma_ch,
76 void (*irq_handler) (int, void *, struct pt_regs *), 80 void (*irq_handler) (int, void *, struct pt_regs *),
77 void (*err_handler) (int, void *, struct pt_regs *), void *data); 81 void (*err_handler) (int, void *, struct pt_regs *, int), void *data);
78 82
79void imx_dma_enable(imx_dmach_t dma_ch); 83void imx_dma_enable(imx_dmach_t dma_ch);
80 84
diff --git a/include/asm-arm/arch-integrator/io.h b/include/asm-arm/arch-integrator/io.h
index 31f2deab51b0..c8f2175948bd 100644
--- a/include/asm-arm/arch-integrator/io.h
+++ b/include/asm-arm/arch-integrator/io.h
@@ -32,6 +32,5 @@
32 32
33#define __io(a) ((void __iomem *)(PCI_IO_VADDR + (a))) 33#define __io(a) ((void __iomem *)(PCI_IO_VADDR + (a)))
34#define __mem_pci(a) (a) 34#define __mem_pci(a) (a)
35#define __mem_isa(a) ((a) + PCI_MEMORY_VADDR)
36 35
37#endif 36#endif
diff --git a/include/asm-arm/arch-iop3xx/io.h b/include/asm-arm/arch-iop3xx/io.h
index f39046a6ab14..36adbdf5055a 100644
--- a/include/asm-arm/arch-iop3xx/io.h
+++ b/include/asm-arm/arch-iop3xx/io.h
@@ -17,6 +17,5 @@
17 17
18#define __io(p) ((void __iomem *)(p)) 18#define __io(p) ((void __iomem *)(p))
19#define __mem_pci(a) (a) 19#define __mem_pci(a) (a)
20#define __mem_isa(a) (a)
21 20
22#endif 21#endif
diff --git a/include/asm-arm/arch-ixp23xx/ixp23xx.h b/include/asm-arm/arch-ixp23xx/ixp23xx.h
index 01efdbd1180f..d0a72201ee96 100644
--- a/include/asm-arm/arch-ixp23xx/ixp23xx.h
+++ b/include/asm-arm/arch-ixp23xx/ixp23xx.h
@@ -124,6 +124,7 @@
124 124
125#define IXP23XX_EXP_UNIT_FUSE IXP23XX_EXP_CFG_REG(0x28) 125#define IXP23XX_EXP_UNIT_FUSE IXP23XX_EXP_CFG_REG(0x28)
126#define IXP23XX_EXP_MSF_MUX IXP23XX_EXP_CFG_REG(0x30) 126#define IXP23XX_EXP_MSF_MUX IXP23XX_EXP_CFG_REG(0x30)
127#define IXP23XX_EXP_CFG_FUSE IXP23XX_EXP_CFG_REG(0x34)
127 128
128#define IXP23XX_EXP_BUS_PHYS 0x90000000 129#define IXP23XX_EXP_BUS_PHYS 0x90000000
129#define IXP23XX_EXP_BUS_WINDOW_SIZE 0x01000000 130#define IXP23XX_EXP_BUS_WINDOW_SIZE 0x01000000
@@ -265,6 +266,8 @@
265#define IXP23XX_PCI_UNIT_RESET (1 << 1) 266#define IXP23XX_PCI_UNIT_RESET (1 << 1)
266#define IXP23XX_XSCALE_RESET (1 << 0) 267#define IXP23XX_XSCALE_RESET (1 << 0)
267 268
269#define IXP23XX_UENGINE_CSR_VIRT_BASE (IXP23XX_CAP_CSR_VIRT + 0x18000)
270
268 271
269/**************************************************************************** 272/****************************************************************************
270 * PCI CSRs. 273 * PCI CSRs.
diff --git a/include/asm-arm/arch-ixp23xx/platform.h b/include/asm-arm/arch-ixp23xx/platform.h
index e4d99060a049..19a73b39c864 100644
--- a/include/asm-arm/arch-ixp23xx/platform.h
+++ b/include/asm-arm/arch-ixp23xx/platform.h
@@ -14,6 +14,21 @@
14 14
15#ifndef __ASSEMBLY__ 15#ifndef __ASSEMBLY__
16 16
17extern inline unsigned long ixp2000_reg_read(volatile void *reg)
18{
19 return *((volatile unsigned long *)reg);
20}
21
22extern inline void ixp2000_reg_write(volatile void *reg, unsigned long val)
23{
24 *((volatile unsigned long *)reg) = val;
25}
26
27extern inline void ixp2000_reg_wrb(volatile void *reg, unsigned long val)
28{
29 *((volatile unsigned long *)reg) = val;
30}
31
17struct pci_sys_data; 32struct pci_sys_data;
18 33
19void ixp23xx_map_io(void); 34void ixp23xx_map_io(void);
diff --git a/include/asm-arm/arch-l7200/io.h b/include/asm-arm/arch-l7200/io.h
index cab8ad0adf09..cd080d8384d9 100644
--- a/include/asm-arm/arch-l7200/io.h
+++ b/include/asm-arm/arch-l7200/io.h
@@ -19,7 +19,6 @@
19 */ 19 */
20#define __io_pci(a) ((void __iomem *)(PCIO_BASE + (a))) 20#define __io_pci(a) ((void __iomem *)(PCIO_BASE + (a)))
21#define __mem_pci(a) (a) 21#define __mem_pci(a) (a)
22#define __mem_isa(a) (a)
23 22
24#define __ioaddr(p) __io_pci(p) 23#define __ioaddr(p) __io_pci(p)
25 24
diff --git a/include/asm-arm/arch-lh7a40x/io.h b/include/asm-arm/arch-lh7a40x/io.h
index bbcd4335f441..17bc94097481 100644
--- a/include/asm-arm/arch-lh7a40x/io.h
+++ b/include/asm-arm/arch-lh7a40x/io.h
@@ -18,6 +18,5 @@
18/* No ISA or PCI bus on this machine. */ 18/* No ISA or PCI bus on this machine. */
19#define __io(a) ((void __iomem *)(a)) 19#define __io(a) ((void __iomem *)(a))
20#define __mem_pci(a) (a) 20#define __mem_pci(a) (a)
21#define __mem_isa(a) (a)
22 21
23#endif /* __ASM_ARCH_IO_H */ 22#endif /* __ASM_ARCH_IO_H */
diff --git a/include/asm-arm/arch-netx/eth.h b/include/asm-arm/arch-netx/eth.h
new file mode 100644
index 000000000000..643c90ef8b72
--- /dev/null
+++ b/include/asm-arm/arch-netx/eth.h
@@ -0,0 +1,27 @@
1/*
2 * include/asm-arm/arch-netx/eth.h
3 *
4 * Copyright (c) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#ifndef ASMARM_ARCH_ETH_H
21#define ASMARM_ARCH_ETH_H
22
23struct netxeth_platform_data {
24 unsigned int xcno; /* number of xmac/xpec engine this eth uses */
25};
26
27#endif
diff --git a/include/asm-arm/arch-netx/io.h b/include/asm-arm/arch-netx/io.h
index 81b7bc47747e..a7a53f80165d 100644
--- a/include/asm-arm/arch-netx/io.h
+++ b/include/asm-arm/arch-netx/io.h
@@ -24,6 +24,5 @@
24 24
25#define __io(a) ((void __iomem *)(a)) 25#define __io(a) ((void __iomem *)(a))
26#define __mem_pci(a) (a) 26#define __mem_pci(a) (a)
27#define __mem_isa(a) (a)
28 27
29#endif 28#endif
diff --git a/include/asm-arm/arch-omap/io.h b/include/asm-arm/arch-omap/io.h
index b726acfcab14..78f68e6a4f0c 100644
--- a/include/asm-arm/arch-omap/io.h
+++ b/include/asm-arm/arch-omap/io.h
@@ -44,7 +44,6 @@
44 */ 44 */
45#define __io(a) ((void __iomem *)(PCIO_BASE + (a))) 45#define __io(a) ((void __iomem *)(PCIO_BASE + (a)))
46#define __mem_pci(a) (a) 46#define __mem_pci(a) (a)
47#define __mem_isa(a) (a)
48 47
49/* 48/*
50 * ---------------------------------------------------------------------------- 49 * ----------------------------------------------------------------------------
diff --git a/include/asm-arm/arch-pnx4008/debug-macro.S b/include/asm-arm/arch-pnx4008/debug-macro.S
index eb3839de389a..67d18a203d23 100644
--- a/include/asm-arm/arch-pnx4008/debug-macro.S
+++ b/include/asm-arm/arch-pnx4008/debug-macro.S
@@ -19,9 +19,5 @@
19 addne \rx, \rx, #0xf4000000 19 addne \rx, \rx, #0xf4000000
20 .endm 20 .endm
21 21
22 .macro senduart,rd,rx
23 strb \rd, [\rx, #0x0]
24 .endm
25
26#define UART_SHIFT 2 22#define UART_SHIFT 2
27#include <asm/hardware/debug-8250.S> 23#include <asm/hardware/debug-8250.S>
diff --git a/include/asm-arm/arch-pnx4008/gpio.h b/include/asm-arm/arch-pnx4008/gpio.h
index 1fa5a77c3010..d01bf83d55c2 100644
--- a/include/asm-arm/arch-pnx4008/gpio.h
+++ b/include/asm-arm/arch-pnx4008/gpio.h
@@ -127,6 +127,79 @@
127#define GPIO_ISOUT(K) ((GPIO_TYPE_MASK(K) == GPIO_OUT) && (GPIO_BIT(K) & GPIO_OUT_MASK)) 127#define GPIO_ISOUT(K) ((GPIO_TYPE_MASK(K) == GPIO_OUT) && (GPIO_BIT(K) & GPIO_OUT_MASK))
128#define GPIO_ISIN(K) ((GPIO_TYPE_MASK(K) == GPIO_IN) && (GPIO_BIT(K) & GPIO_IN_MASK)) 128#define GPIO_ISIN(K) ((GPIO_TYPE_MASK(K) == GPIO_IN) && (GPIO_BIT(K) & GPIO_IN_MASK))
129 129
130/* Start Enable Pin Interrupts - table 58 page 66 */
131
132#define SE_PIN_BASE_INT 32
133
134#define SE_U7_RX_INT 63
135#define SE_U7_HCTS_INT 62
136#define SE_BT_CLKREQ_INT 61
137#define SE_U6_IRRX_INT 60
138/*59 unused*/
139#define SE_U5_RX_INT 58
140#define SE_GPI_11_INT 57
141#define SE_U3_RX_INT 56
142#define SE_U2_HCTS_INT 55
143#define SE_U2_RX_INT 54
144#define SE_U1_RX_INT 53
145#define SE_DISP_SYNC_INT 52
146/*51 unused*/
147#define SE_SDIO_INT_N 50
148#define SE_MSDIO_START_INT 49
149#define SE_GPI_06_INT 48
150#define SE_GPI_05_INT 47
151#define SE_GPI_04_INT 46
152#define SE_GPI_03_INT 45
153#define SE_GPI_02_INT 44
154#define SE_GPI_01_INT 43
155#define SE_GPI_00_INT 42
156#define SE_SYSCLKEN_PIN_INT 41
157#define SE_SPI1_DATAIN_INT 40
158#define SE_GPI_07_INT 39
159#define SE_SPI2_DATAIN_INT 38
160#define SE_GPI_10_INT 37
161#define SE_GPI_09_INT 36
162#define SE_GPI_08_INT 35
163/*34-32 unused*/
164
165/* Start Enable Internal Interrupts - table 57 page 65 */
166
167#define SE_INT_BASE_INT 0
168
169#define SE_TS_IRQ 31
170#define SE_TS_P_INT 30
171#define SE_TS_AUX_INT 29
172/*27-28 unused*/
173#define SE_USB_AHB_NEED_CLK_INT 26
174#define SE_MSTIMER_INT 25
175#define SE_RTC_INT 24
176#define SE_USB_NEED_CLK_INT 23
177#define SE_USB_INT 22
178#define SE_USB_I2C_INT 21
179#define SE_USB_OTG_TIMER_INT 20
180#define SE_USB_OTG_ATX_INT_N 19
181/*18 unused*/
182#define SE_DSP_GPIO4_INT 17
183#define SE_KEY_IRQ 16
184#define SE_DSP_SLAVEPORT_INT 15
185#define SE_DSP_GPIO1_INT 14
186#define SE_DSP_GPIO0_INT 13
187#define SE_DSP_AHB_INT 12
188/*11-6 unused*/
189#define SE_GPIO_05_INT 5
190#define SE_GPIO_04_INT 4
191#define SE_GPIO_03_INT 3
192#define SE_GPIO_02_INT 2
193#define SE_GPIO_01_INT 1
194#define SE_GPIO_00_INT 0
195
196#define START_INT_REG_BIT(irq) (1<<((irq)&0x1F))
197
198#define START_INT_ER_REG(irq) IO_ADDRESS((PNX4008_PWRMAN_BASE + 0x20 + (((irq)&(0x1<<5))>>1)))
199#define START_INT_RSR_REG(irq) IO_ADDRESS((PNX4008_PWRMAN_BASE + 0x24 + (((irq)&(0x1<<5))>>1)))
200#define START_INT_SR_REG(irq) IO_ADDRESS((PNX4008_PWRMAN_BASE + 0x28 + (((irq)&(0x1<<5))>>1)))
201#define START_INT_APR_REG(irq) IO_ADDRESS((PNX4008_PWRMAN_BASE + 0x2C + (((irq)&(0x1<<5))>>1)))
202
130extern int pnx4008_gpio_register_pin(unsigned short pin); 203extern int pnx4008_gpio_register_pin(unsigned short pin);
131extern int pnx4008_gpio_unregister_pin(unsigned short pin); 204extern int pnx4008_gpio_unregister_pin(unsigned short pin);
132extern unsigned long pnx4008_gpio_read_pin(unsigned short pin); 205extern unsigned long pnx4008_gpio_read_pin(unsigned short pin);
@@ -136,4 +209,33 @@ extern int pnx4008_gpio_read_pin_direction(unsigned short pin);
136extern int pnx4008_gpio_set_pin_mux(unsigned short pin, int output); 209extern int pnx4008_gpio_set_pin_mux(unsigned short pin, int output);
137extern int pnx4008_gpio_read_pin_mux(unsigned short pin); 210extern int pnx4008_gpio_read_pin_mux(unsigned short pin);
138 211
212static inline void start_int_umask(u8 irq)
213{
214 __raw_writel(__raw_readl(START_INT_ER_REG(irq)) |
215 START_INT_REG_BIT(irq), START_INT_ER_REG(irq));
216}
217
218static inline void start_int_mask(u8 irq)
219{
220 __raw_writel(__raw_readl(START_INT_ER_REG(irq)) &
221 ~START_INT_REG_BIT(irq), START_INT_ER_REG(irq));
222}
223
224static inline void start_int_ack(u8 irq)
225{
226 __raw_writel(START_INT_REG_BIT(irq), START_INT_RSR_REG(irq));
227}
228
229static inline void start_int_set_falling_edge(u8 irq)
230{
231 __raw_writel(__raw_readl(START_INT_APR_REG(irq)) &
232 ~START_INT_REG_BIT(irq), START_INT_APR_REG(irq));
233}
234
235static inline void start_int_set_rising_edge(u8 irq)
236{
237 __raw_writel(__raw_readl(START_INT_APR_REG(irq)) |
238 START_INT_REG_BIT(irq), START_INT_APR_REG(irq));
239}
240
139#endif /* _PNX4008_GPIO_H_ */ 241#endif /* _PNX4008_GPIO_H_ */
diff --git a/include/asm-arm/arch-pnx4008/pm.h b/include/asm-arm/arch-pnx4008/pm.h
index c660486670fb..bac1634cb3e0 100644
--- a/include/asm-arm/arch-pnx4008/pm.h
+++ b/include/asm-arm/arch-pnx4008/pm.h
@@ -29,34 +29,5 @@ extern void pnx4008_cpu_standby(void);
29extern int pnx4008_startup_pll(struct clk *); 29extern int pnx4008_startup_pll(struct clk *);
30extern int pnx4008_shutdown_pll(struct clk *); 30extern int pnx4008_shutdown_pll(struct clk *);
31 31
32static inline void start_int_umask(u8 irq)
33{
34 __raw_writel(__raw_readl(START_INT_ER_REG(irq)) |
35 START_INT_REG_BIT(irq), START_INT_ER_REG(irq));
36}
37
38static inline void start_int_mask(u8 irq)
39{
40 __raw_writel(__raw_readl(START_INT_ER_REG(irq)) &
41 ~START_INT_REG_BIT(irq), START_INT_ER_REG(irq));
42}
43
44static inline void start_int_ack(u8 irq)
45{
46 __raw_writel(START_INT_REG_BIT(irq), START_INT_RSR_REG(irq));
47}
48
49static inline void start_int_set_falling_edge(u8 irq)
50{
51 __raw_writel(__raw_readl(START_INT_APR_REG(irq)) &
52 ~START_INT_REG_BIT(irq), START_INT_APR_REG(irq));
53}
54
55static inline void start_int_set_rising_edge(u8 irq)
56{
57 __raw_writel(__raw_readl(START_INT_APR_REG(irq)) |
58 START_INT_REG_BIT(irq), START_INT_APR_REG(irq));
59}
60
61#endif /* ASSEMBLER */ 32#endif /* ASSEMBLER */
62#endif /* __ASM_ARCH_PNX4008_PM_H */ 33#endif /* __ASM_ARCH_PNX4008_PM_H */
diff --git a/include/asm-arm/arch-pxa/io.h b/include/asm-arm/arch-pxa/io.h
index eb2dd58d397f..7f8d817b446f 100644
--- a/include/asm-arm/arch-pxa/io.h
+++ b/include/asm-arm/arch-pxa/io.h
@@ -16,6 +16,5 @@
16 */ 16 */
17#define __io(a) ((void __iomem *)(a)) 17#define __io(a) ((void __iomem *)(a))
18#define __mem_pci(a) (a) 18#define __mem_pci(a) (a)
19#define __mem_isa(a) (a)
20 19
21#endif 20#endif
diff --git a/include/asm-arm/arch-realview/io.h b/include/asm-arm/arch-realview/io.h
index d444a68ac330..c70f1dfbe135 100644
--- a/include/asm-arm/arch-realview/io.h
+++ b/include/asm-arm/arch-realview/io.h
@@ -29,6 +29,5 @@ static inline void __iomem *__io(unsigned long addr)
29 29
30#define __io(a) __io(a) 30#define __io(a) __io(a)
31#define __mem_pci(a) (a) 31#define __mem_pci(a) (a)
32#define __mem_isa(a) (a)
33 32
34#endif 33#endif
diff --git a/include/asm-arm/arch-s3c2410/debug-macro.S b/include/asm-arm/arch-s3c2410/debug-macro.S
index 5f8223e700d3..b7d15d125458 100644
--- a/include/asm-arm/arch-s3c2410/debug-macro.S
+++ b/include/asm-arm/arch-s3c2410/debug-macro.S
@@ -33,7 +33,7 @@
33 .endm 33 .endm
34 34
35 .macro senduart,rd,rx 35 .macro senduart,rd,rx
36 str \rd, [\rx, # S3C2410_UTXH ] 36 strb \rd, [\rx, # S3C2410_UTXH ]
37 .endm 37 .endm
38 38
39 .macro busyuart, rd, rx 39 .macro busyuart, rd, rx
@@ -42,6 +42,12 @@
42 beq 1001f @ 42 beq 1001f @
43 @ FIFO enabled... 43 @ FIFO enabled...
441003: 441003:
45 @ check for arm920 vs arm926. currently assume all arm926
46 @ devices have an 64 byte FIFO identical to the s3c2440
47 mrc p15, 0, \rd, c0, c0
48 and \rd, \rd, #0xff0
49 teq \rd, #0x260
50 beq 1004f
45 mrc p15, 0, \rd, c1, c0 51 mrc p15, 0, \rd, c1, c0
46 tst \rd, #1 52 tst \rd, #1
47 addeq \rd, \rx, #(S3C24XX_PA_GPIO - S3C24XX_PA_UART) 53 addeq \rd, \rx, #(S3C24XX_PA_GPIO - S3C24XX_PA_UART)
@@ -50,7 +56,7 @@
50 ldr \rd, [ \rd, # S3C2410_GSTATUS1 - S3C2410_GPIOREG(0) ] 56 ldr \rd, [ \rd, # S3C2410_GSTATUS1 - S3C2410_GPIOREG(0) ]
51 and \rd, \rd, #0x00ff0000 57 and \rd, \rd, #0x00ff0000
52 teq \rd, #0x00440000 @ is it 2440? 58 teq \rd, #0x00440000 @ is it 2440?
53 591004:
54 ldr \rd, [ \rx, # S3C2410_UFSTAT ] 60 ldr \rd, [ \rx, # S3C2410_UFSTAT ]
55 moveq \rd, \rd, lsr #SHIFT_2440TXF 61 moveq \rd, \rd, lsr #SHIFT_2440TXF
56 tst \rd, #S3C2410_UFSTAT_TXFULL 62 tst \rd, #S3C2410_UFSTAT_TXFULL
diff --git a/include/asm-arm/arch-s3c2410/entry-macro.S b/include/asm-arm/arch-s3c2410/entry-macro.S
index 894c35cf3b1e..e09a6b8ec153 100644
--- a/include/asm-arm/arch-s3c2410/entry-macro.S
+++ b/include/asm-arm/arch-s3c2410/entry-macro.S
@@ -18,8 +18,6 @@
18 18
19#define INTPND (0x10) 19#define INTPND (0x10)
20#define INTOFFSET (0x14) 20#define INTOFFSET (0x14)
21#define EXTINTPEND (0xa8)
22#define EXTINTMASK (0xa4)
23 21
24#include <asm/hardware.h> 22#include <asm/hardware.h>
25#include <asm/arch/irqs.h> 23#include <asm/arch/irqs.h>
@@ -28,37 +26,23 @@
28 26
29 mov \base, #S3C24XX_VA_IRQ 27 mov \base, #S3C24XX_VA_IRQ
30 28
31 ldr \irqstat, [ \base, #INTPND]
32 bics \irqnr, \irqstat, #3<<4 @@ only an GPIO IRQ
33 beq 2000f
34
35 @@ try the interrupt offset register, since it is there 29 @@ try the interrupt offset register, since it is there
36 30
31 ldr \irqstat, [ \base, #INTPND ]
32 teq \irqstat, #0
33 beq 1002f
37 ldr \irqnr, [ \base, #INTOFFSET ] 34 ldr \irqnr, [ \base, #INTOFFSET ]
38 mov \tmp, #1 35 mov \tmp, #1
39 tst \irqstat, \tmp, lsl \irqnr 36 tst \irqstat, \tmp, lsl \irqnr
40 addne \irqnr, \irqnr, #IRQ_EINT0
41 bne 1001f 37 bne 1001f
42 38
43 @@ the number specified is not a valid irq, so try 39 @@ the number specified is not a valid irq, so try
44 @@ and work it out for ourselves 40 @@ and work it out for ourselves
45 41
46 mov \irqnr, #IRQ_EINT0 @@ start here 42 mov \irqnr, #0 @@ start here
47 b 3000f
48
492000:
50 @@ load the GPIO interrupt register, and check it
51
52 add \tmp, \base, #S3C24XX_VA_GPIO - S3C24XX_VA_IRQ
53 ldr \irqstat, [ \tmp, # EXTINTPEND ]
54 ldr \irqnr, [ \tmp, # EXTINTMASK ]
55 bics \irqstat, \irqstat, \irqnr
56 beq 1001f
57
58 mov \irqnr, #(IRQ_EINT4 - 4)
59 43
60 @@ work out which irq (if any) we got 44 @@ work out which irq (if any) we got
613000: 45
62 movs \tmp, \irqstat, lsl#16 46 movs \tmp, \irqstat, lsl#16
63 addeq \irqnr, \irqnr, #16 47 addeq \irqnr, \irqnr, #16
64 moveq \irqstat, \irqstat, lsr#16 48 moveq \irqstat, \irqstat, lsr#16
@@ -75,9 +59,9 @@
75 addeq \irqnr, \irqnr, #1 59 addeq \irqnr, \irqnr, #1
76 60
77 @@ we have the value 61 @@ we have the value
78 movs \irqnr, \irqnr
79
801001: 621001:
63 adds \irqnr, \irqnr, #IRQ_EINT0
641002:
81 @@ exit here, Z flag unset if IRQ 65 @@ exit here, Z flag unset if IRQ
82 66
83 .endm 67 .endm
diff --git a/include/asm-arm/arch-s3c2410/map.h b/include/asm-arm/arch-s3c2410/map.h
index 5e4c8c37bc66..fae2766ff32b 100644
--- a/include/asm-arm/arch-s3c2410/map.h
+++ b/include/asm-arm/arch-s3c2410/map.h
@@ -236,4 +236,20 @@
236#define S3C24XX_PA_SPI S3C2410_PA_SPI 236#define S3C24XX_PA_SPI S3C2410_PA_SPI
237#endif 237#endif
238 238
239/* deal with the registers that move under the 2412/2413 */
240
241#if defined(CONFIG_CPU_S3C2412) || defined(CONFIG_CPU_S3C2413)
242#ifndef __ASSEMBLY__
243extern void __iomem *s3c24xx_va_gpio2;
244#endif
245#ifdef CONFIG_CPU_S3C2412_ONLY
246#define S3C24XX_VA_GPIO2 (S3C24XX_VA_GPIO + 0x10)
247#else
248#define S3C24XX_VA_GPIO2 s3c24xx_va_gpio2
249#endif
250#else
251#define s3c24xx_va_gpio2 S3C24XX_VA_GPIO
252#define S3C24XX_VA_GPIO2 S3C24XX_VA_GPIO
253#endif
254
239#endif /* __ASM_ARCH_MAP_H */ 255#endif /* __ASM_ARCH_MAP_H */
diff --git a/include/asm-arm/arch-s3c2410/regs-clock.h b/include/asm-arm/arch-s3c2410/regs-clock.h
index 6c92faffe985..a7c61feb8433 100644
--- a/include/asm-arm/arch-s3c2410/regs-clock.h
+++ b/include/asm-arm/arch-s3c2410/regs-clock.h
@@ -1,6 +1,6 @@
1/* linux/include/asm/arch-s3c2410/regs-clock.h 1/* linux/include/asm/arch-s3c2410/regs-clock.h
2 * 2 *
3 * Copyright (c) 2003,2004,2005 Simtec Electronics <linux@simtec.co.uk> 3 * Copyright (c) 2003,2004,2005,2006 Simtec Electronics <linux@simtec.co.uk>
4 * http://armlinux.simtec.co.uk/ 4 * http://armlinux.simtec.co.uk/
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
@@ -140,5 +140,66 @@ s3c2410_get_pll(unsigned int pllval, unsigned int baseclk)
140 140
141#endif /* CONFIG_CPU_S3C2440 or CONFIG_CPU_S3C2442 */ 141#endif /* CONFIG_CPU_S3C2440 or CONFIG_CPU_S3C2442 */
142 142
143#if defined(CONFIG_CPU_S3C2412) || defined(CONFIG_CPU_S3C2413)
144
145#define S3C2412_OSCSET S3C2410_CLKREG(0x18)
146#define S3C2412_CLKSRC S3C2410_CLKREG(0x1C)
147
148#define S3C2412_PLLCON_OFF (1<<20)
149
150#define S3C2412_CLKDIVN_PDIVN (1<<2)
151#define S3C2412_CLKDIVN_HDIVN_MASK (3<<0)
152#define S3C2421_CLKDIVN_ARMDIVN (1<<3)
153#define S3C2412_CLKDIVN_USB48DIV (1<<6)
154#define S3C2412_CLKDIVN_UARTDIV_MASK (15<<8)
155#define S3C2412_CLKDIVN_UARTDIV_SHIFT (8)
156#define S3C2412_CLKDIVN_I2SDIV_MASK (15<<12)
157#define S3C2412_CLKDIVN_I2SDIV_SHIFT (12)
158#define S3C2412_CLKDIVN_CAMDIV_MASK (15<<16)
159#define S3C2412_CLKDIVN_CAMDIV_SHIFT (16)
160
161#define S3C2412_CLKCON_WDT (1<<28)
162#define S3C2412_CLKCON_SPI (1<<27)
163#define S3C2412_CLKCON_IIS (1<<26)
164#define S3C2412_CLKCON_IIC (1<<25)
165#define S3C2412_CLKCON_ADC (1<<24)
166#define S3C2412_CLKCON_RTC (1<<23)
167#define S3C2412_CLKCON_GPIO (1<<22)
168#define S3C2412_CLKCON_UART2 (1<<21)
169#define S3C2412_CLKCON_UART1 (1<<20)
170#define S3C2412_CLKCON_UART0 (1<<19)
171#define S3C2412_CLKCON_SDI (1<<18)
172#define S3C2412_CLKCON_PWMT (1<<17)
173#define S3C2412_CLKCON_USBD (1<<16)
174#define S3C2412_CLKCON_CAMCLK (1<<15)
175#define S3C2412_CLKCON_UARTCLK (1<<14)
176/* missing 13 */
177#define S3C2412_CLKCON_USB_HOST48 (1<<12)
178#define S3C2412_CLKCON_USB_DEV48 (1<<11)
179#define S3C2412_CLKCON_HCLKdiv2 (1<<10)
180#define S3C2412_CLKCON_HCLKx2 (1<<9)
181#define S3C2412_CLKCON_SDRAM (1<<8)
182/* missing 7 */
183#define S3C2412_CLKCON_USBH S3C2410_CLKCON_USBH
184#define S3C2412_CLKCON_LCDC S3C2410_CLKCON_LCDC
185#define S3C2412_CLKCON_NAND S3C2410_CLKCON_NAND
186#define S3C2412_CLKCON_DMA3 (1<<3)
187#define S3C2412_CLKCON_DMA2 (1<<2)
188#define S3C2412_CLKCON_DMA1 (1<<1)
189#define S3C2412_CLKCON_DMA0 (1<<0)
190
191/* clock sourec controls */
192
193#define S3C2412_CLKSRC_EXTCLKDIV_MASK (7 << 0)
194#define S3C2412_CLKSRC_EXTCLKDIV_SHIFT (0)
195#define S3C2412_CLKSRC_MDIVCLK_EXTCLKDIV (1<<3)
196#define S3C2412_CLKSRC_MSYSCLK_MPLL (1<<4)
197#define S3C2412_CLKSRC_USYSCLK_UPLL (1<<5)
198#define S3C2412_CLKSRC_UARTCLK_MPLL (1<<8)
199#define S3C2412_CLKSRC_I2SCLK_MPLL (1<<9)
200#define S3C2412_CLKSRC_USBCLK_HCLK (1<<10)
201#define S3C2412_CLKSRC_CAMCLK_HCLK (1<<11)
202
203#endif /* CONFIG_CPU_S3C2412 | CONFIG_CPU_S3C2413 */
143 204
144#endif /* __ASM_ARM_REGS_CLOCK */ 205#endif /* __ASM_ARM_REGS_CLOCK */
diff --git a/include/asm-arm/arch-s3c2410/regs-dsc.h b/include/asm-arm/arch-s3c2410/regs-dsc.h
index a023b0434efe..84aca61cbaa3 100644
--- a/include/asm-arm/arch-s3c2410/regs-dsc.h
+++ b/include/asm-arm/arch-s3c2410/regs-dsc.h
@@ -23,6 +23,9 @@
23#define S3C2440_DSC0 S3C2410_GPIOREG(0xc4) 23#define S3C2440_DSC0 S3C2410_GPIOREG(0xc4)
24#define S3C2440_DSC1 S3C2410_GPIOREG(0xc8) 24#define S3C2440_DSC1 S3C2410_GPIOREG(0xc8)
25 25
26#define S3C2412_DSC0 S3C2410_GPIOREG(0xdc)
27#define S3C2412_DSC1 S3C2410_GPIOREG(0xe0)
28
26#define S3C2440_SELECT_DSC0 (0) 29#define S3C2440_SELECT_DSC0 (0)
27#define S3C2440_SELECT_DSC1 (1<<31) 30#define S3C2440_SELECT_DSC1 (1<<31)
28 31
@@ -170,7 +173,7 @@
170#define S3C2440_DSC1_CS1_4mA (3<<2) 173#define S3C2440_DSC1_CS1_4mA (3<<2)
171#define S3C2440_DSC1_CS1_MASK (3<<2) 174#define S3C2440_DSC1_CS1_MASK (3<<2)
172 175
173#define S3C2440_DSC1_CS0 (S3C2440_SELECT_DSC1 | 0 176#define S3C2440_DSC1_CS0 (S3C2440_SELECT_DSC1 | 0)
174#define S3C2440_DSC1_CS0_10mA (0<<0) 177#define S3C2440_DSC1_CS0_10mA (0<<0)
175#define S3C2440_DSC1_CS0_8mA (1<<0) 178#define S3C2440_DSC1_CS0_8mA (1<<0)
176#define S3C2440_DSC1_CS0_6mA (2<<0) 179#define S3C2440_DSC1_CS0_6mA (2<<0)
diff --git a/include/asm-arm/arch-s3c2410/regs-gpio.h b/include/asm-arm/arch-s3c2410/regs-gpio.h
index 5f10334f06bf..6dd17f0f84e0 100644
--- a/include/asm-arm/arch-s3c2410/regs-gpio.h
+++ b/include/asm-arm/arch-s3c2410/regs-gpio.h
@@ -45,7 +45,7 @@
45#define S3C24XX_MISCCR S3C2400_MISCCR 45#define S3C24XX_MISCCR S3C2400_MISCCR
46#else 46#else
47#define S3C24XX_GPIO_BASE(x) S3C2410_GPIO_BASE(x) 47#define S3C24XX_GPIO_BASE(x) S3C2410_GPIO_BASE(x)
48#define S3C24XX_MISCCR S3C2410_MISCCR 48#define S3C24XX_MISCCR S3C24XX_GPIOREG2(0x80)
49#endif /* CONFIG_CPU_S3C2400 */ 49#endif /* CONFIG_CPU_S3C2400 */
50 50
51 51
@@ -73,9 +73,15 @@
73#define S3C2410_GPIO_SFN2 (0xFFFFFFF2) /* not available on A */ 73#define S3C2410_GPIO_SFN2 (0xFFFFFFF2) /* not available on A */
74#define S3C2410_GPIO_SFN3 (0xFFFFFFF3) /* not available on A */ 74#define S3C2410_GPIO_SFN3 (0xFFFFFFF3) /* not available on A */
75 75
76/* configure GPIO ports A..G */ 76/* register address for the GPIO registers.
77 * S3C24XX_GPIOREG2 is for the second set of registers in the
78 * GPIO which move between s3c2410 and s3c2412 type systems */
77 79
78#define S3C2410_GPIOREG(x) ((x) + S3C24XX_VA_GPIO) 80#define S3C2410_GPIOREG(x) ((x) + S3C24XX_VA_GPIO)
81#define S3C24XX_GPIOREG2(x) ((x) + S3C24XX_VA_GPIO2)
82
83
84/* configure GPIO ports A..G */
79 85
80/* port A - S3C2410: 22bits, zero in bit X makes pin X output 86/* port A - S3C2410: 22bits, zero in bit X makes pin X output
81 * S3C2400: 18bits, zero in bit X makes pin X output 87 * S3C2400: 18bits, zero in bit X makes pin X output
@@ -953,11 +959,18 @@
953#define S3C2410_GPH10_OUTP (0x01 << 20) 959#define S3C2410_GPH10_OUTP (0x01 << 20)
954#define S3C2410_GPH10_CLKOUT1 (0x02 << 20) 960#define S3C2410_GPH10_CLKOUT1 (0x02 << 20)
955 961
962/* The S3C2412 and S3C2413 move the GPJ register set to after
963 * GPH, which means all registers after 0x80 are now offset by 0x10
964 * for the 2412/2413 from the 2410/2440/2442
965*/
966
956/* miscellaneous control */ 967/* miscellaneous control */
957#define S3C2400_MISCCR S3C2410_GPIOREG(0x54) 968#define S3C2400_MISCCR S3C2410_GPIOREG(0x54)
958#define S3C2410_MISCCR S3C2410_GPIOREG(0x80) 969#define S3C2410_MISCCR S3C2410_GPIOREG(0x80)
959#define S3C2410_DCLKCON S3C2410_GPIOREG(0x84) 970#define S3C2410_DCLKCON S3C2410_GPIOREG(0x84)
960 971
972#define S3C24XX_DCLKCON S3C24XX_GPIOREG2(0x84)
973
961/* see clock.h for dclk definitions */ 974/* see clock.h for dclk definitions */
962 975
963/* pullup control on databus */ 976/* pullup control on databus */
@@ -985,6 +998,8 @@
985#define S3C2410_MISCCR_CLK0_DCLK0 (5<<4) 998#define S3C2410_MISCCR_CLK0_DCLK0 (5<<4)
986#define S3C2410_MISCCR_CLK0_MASK (7<<4) 999#define S3C2410_MISCCR_CLK0_MASK (7<<4)
987 1000
1001#define S3C2412_MISCCR_CLK0_RTC (2<<4)
1002
988#define S3C2410_MISCCR_CLK1_MPLL (0<<8) 1003#define S3C2410_MISCCR_CLK1_MPLL (0<<8)
989#define S3C2410_MISCCR_CLK1_UPLL (1<<8) 1004#define S3C2410_MISCCR_CLK1_UPLL (1<<8)
990#define S3C2410_MISCCR_CLK1_FCLK (2<<8) 1005#define S3C2410_MISCCR_CLK1_FCLK (2<<8)
@@ -993,6 +1008,8 @@
993#define S3C2410_MISCCR_CLK1_DCLK1 (5<<8) 1008#define S3C2410_MISCCR_CLK1_DCLK1 (5<<8)
994#define S3C2410_MISCCR_CLK1_MASK (7<<8) 1009#define S3C2410_MISCCR_CLK1_MASK (7<<8)
995 1010
1011#define S3C2412_MISCCR_CLK1_CLKsrc (0<<8)
1012
996#define S3C2410_MISCCR_USBSUSPND0 (1<<12) 1013#define S3C2410_MISCCR_USBSUSPND0 (1<<12)
997#define S3C2410_MISCCR_USBSUSPND1 (1<<13) 1014#define S3C2410_MISCCR_USBSUSPND1 (1<<13)
998 1015
@@ -1000,7 +1017,7 @@
1000 1017
1001#define S3C2410_MISCCR_nEN_SCLK0 (1<<17) 1018#define S3C2410_MISCCR_nEN_SCLK0 (1<<17)
1002#define S3C2410_MISCCR_nEN_SCLK1 (1<<18) 1019#define S3C2410_MISCCR_nEN_SCLK1 (1<<18)
1003#define S3C2410_MISCCR_nEN_SCLKE (1<<19) 1020#define S3C2410_MISCCR_nEN_SCLKE (1<<19) /* not 2412 */
1004#define S3C2410_MISCCR_SDSLEEP (7<<17) 1021#define S3C2410_MISCCR_SDSLEEP (7<<17)
1005 1022
1006/* external interrupt control... */ 1023/* external interrupt control... */
@@ -1017,6 +1034,10 @@
1017#define S3C2410_EXTINT1 S3C2410_GPIOREG(0x8C) 1034#define S3C2410_EXTINT1 S3C2410_GPIOREG(0x8C)
1018#define S3C2410_EXTINT2 S3C2410_GPIOREG(0x90) 1035#define S3C2410_EXTINT2 S3C2410_GPIOREG(0x90)
1019 1036
1037#define S3C24XX_EXTINT0 S3C24XX_GPIOREG2(0x88)
1038#define S3C24XX_EXTINT1 S3C24XX_GPIOREG2(0x8C)
1039#define S3C24XX_EXTINT2 S3C24XX_GPIOREG2(0x90)
1040
1020/* values for S3C2410_EXTINT0/1/2 */ 1041/* values for S3C2410_EXTINT0/1/2 */
1021#define S3C2410_EXTINT_LOWLEV (0x00) 1042#define S3C2410_EXTINT_LOWLEV (0x00)
1022#define S3C2410_EXTINT_HILEV (0x01) 1043#define S3C2410_EXTINT_HILEV (0x01)
@@ -1030,6 +1051,11 @@
1030#define S3C2410_EINFLT2 S3C2410_GPIOREG(0x9C) 1051#define S3C2410_EINFLT2 S3C2410_GPIOREG(0x9C)
1031#define S3C2410_EINFLT3 S3C2410_GPIOREG(0xA0) 1052#define S3C2410_EINFLT3 S3C2410_GPIOREG(0xA0)
1032 1053
1054#define S3C24XX_EINFLT0 S3C24XX_GPIOREG2(0x94)
1055#define S3C24XX_EINFLT1 S3C24XX_GPIOREG2(0x98)
1056#define S3C24XX_EINFLT2 S3C24XX_GPIOREG2(0x9C)
1057#define S3C24XX_EINFLT3 S3C24XX_GPIOREG2(0xA0)
1058
1033/* values for interrupt filtering */ 1059/* values for interrupt filtering */
1034#define S3C2410_EINTFLT_PCLK (0x00) 1060#define S3C2410_EINTFLT_PCLK (0x00)
1035#define S3C2410_EINTFLT_EXTCLK (1<<7) 1061#define S3C2410_EINTFLT_EXTCLK (1<<7)
@@ -1039,6 +1065,7 @@
1039 1065
1040/* GSTATUS have miscellaneous information in them 1066/* GSTATUS have miscellaneous information in them
1041 * 1067 *
1068 * These move between s3c2410 and s3c2412 style systems.
1042 */ 1069 */
1043 1070
1044#define S3C2410_GSTATUS0 S3C2410_GPIOREG(0x0AC) 1071#define S3C2410_GSTATUS0 S3C2410_GPIOREG(0x0AC)
@@ -1047,6 +1074,18 @@
1047#define S3C2410_GSTATUS3 S3C2410_GPIOREG(0x0B8) 1074#define S3C2410_GSTATUS3 S3C2410_GPIOREG(0x0B8)
1048#define S3C2410_GSTATUS4 S3C2410_GPIOREG(0x0BC) 1075#define S3C2410_GSTATUS4 S3C2410_GPIOREG(0x0BC)
1049 1076
1077#define S3C2412_GSTATUS0 S3C2410_GPIOREG(0x0BC)
1078#define S3C2412_GSTATUS1 S3C2410_GPIOREG(0x0C0)
1079#define S3C2412_GSTATUS2 S3C2410_GPIOREG(0x0C4)
1080#define S3C2412_GSTATUS3 S3C2410_GPIOREG(0x0C8)
1081#define S3C2412_GSTATUS4 S3C2410_GPIOREG(0x0CC)
1082
1083#define S3C24XX_GSTATUS0 S3C24XX_GPIOREG2(0x0AC)
1084#define S3C24XX_GSTATUS1 S3C24XX_GPIOREG2(0x0B0)
1085#define S3C24XX_GSTATUS2 S3C24XX_GPIOREG2(0x0B4)
1086#define S3C24XX_GSTATUS3 S3C24XX_GPIOREG2(0x0B8)
1087#define S3C24XX_GSTATUS4 S3C24XX_GPIOREG2(0x0BC)
1088
1050#define S3C2410_GSTATUS0_nWAIT (1<<3) 1089#define S3C2410_GSTATUS0_nWAIT (1<<3)
1051#define S3C2410_GSTATUS0_NCON (1<<2) 1090#define S3C2410_GSTATUS0_NCON (1<<2)
1052#define S3C2410_GSTATUS0_RnB (1<<1) 1091#define S3C2410_GSTATUS0_RnB (1<<1)
@@ -1054,6 +1093,7 @@
1054 1093
1055#define S3C2410_GSTATUS1_IDMASK (0xffff0000) 1094#define S3C2410_GSTATUS1_IDMASK (0xffff0000)
1056#define S3C2410_GSTATUS1_2410 (0x32410000) 1095#define S3C2410_GSTATUS1_2410 (0x32410000)
1096#define S3C2410_GSTATUS1_2412 (0x32412001)
1057#define S3C2410_GSTATUS1_2440 (0x32440000) 1097#define S3C2410_GSTATUS1_2440 (0x32440000)
1058#define S3C2410_GSTATUS1_2442 (0x32440aaa) 1098#define S3C2410_GSTATUS1_2442 (0x32440aaa)
1059 1099
@@ -1077,5 +1117,22 @@
1077#define S3C2400_OPENCR_OPC_MOSIDIS (0<<5) 1117#define S3C2400_OPENCR_OPC_MOSIDIS (0<<5)
1078#define S3C2400_OPENCR_OPC_MOSIEN (1<<5) 1118#define S3C2400_OPENCR_OPC_MOSIEN (1<<5)
1079 1119
1120/* 2412/2413 sleep configuration registers */
1121
1122#define S3C2412_GPBSLPCON S3C2410_GPIOREG(0x1C)
1123#define S3C2412_GPCSLPCON S3C2410_GPIOREG(0x2C)
1124#define S3C2412_GPDSLPCON S3C2410_GPIOREG(0x3C)
1125#define S3C2412_GPESLPCON S3C2410_GPIOREG(0x4C)
1126#define S3C2412_GPFSLPCON S3C2410_GPIOREG(0x5C)
1127#define S3C2412_GPGSLPCON S3C2410_GPIOREG(0x6C)
1128#define S3C2412_GPHSLPCON S3C2410_GPIOREG(0x7C)
1129
1130/* definitions for each pin bit */
1131#define S3C2412_SLPCON_LOW(x) ( 0x00 << ((x) * 2))
1132#define S3C2412_SLPCON_HI(x) ( 0x01 << ((x) * 2))
1133#define S3C2412_SLPCON_IN(x) ( 0x02 << ((x) * 2))
1134#define S3C2412_SLPCON_PDWN(x) ( 0x03 << ((x) * 2))
1135#define S3C2412_SLPCON_MASK(x) ( 0x03 << ((x) * 2))
1136
1080#endif /* __ASM_ARCH_REGS_GPIO_H */ 1137#endif /* __ASM_ARCH_REGS_GPIO_H */
1081 1138
diff --git a/include/asm-arm/arch-s3c2410/regs-gpioj.h b/include/asm-arm/arch-s3c2410/regs-gpioj.h
index 3ad2324acc39..18edae50d0b8 100644
--- a/include/asm-arm/arch-s3c2410/regs-gpioj.h
+++ b/include/asm-arm/arch-s3c2410/regs-gpioj.h
@@ -32,6 +32,11 @@
32#define S3C2440_GPJDAT S3C2410_GPIOREG(0xd4) 32#define S3C2440_GPJDAT S3C2410_GPIOREG(0xd4)
33#define S3C2440_GPJUP S3C2410_GPIOREG(0xd8) 33#define S3C2440_GPJUP S3C2410_GPIOREG(0xd8)
34 34
35#define S3C2413_GPJCON S3C2410_GPIOREG(0x80)
36#define S3C2413_GPJDAT S3C2410_GPIOREG(0x84)
37#define S3C2413_GPJUP S3C2410_GPIOREG(0x88)
38#define S3C2413_GPJSLPCON S3C2410_GPIOREG(0x8C)
39
35#define S3C2440_GPJ0 S3C2410_GPIONO(S3C2440_GPIO_BANKJ, 0) 40#define S3C2440_GPJ0 S3C2410_GPIONO(S3C2440_GPIO_BANKJ, 0)
36#define S3C2440_GPJ0_INP (0x00 << 0) 41#define S3C2440_GPJ0_INP (0x00 << 0)
37#define S3C2440_GPJ0_OUTP (0x01 << 0) 42#define S3C2440_GPJ0_OUTP (0x01 << 0)
diff --git a/include/asm-arm/arch-s3c2410/regs-irq.h b/include/asm-arm/arch-s3c2410/regs-irq.h
index 24b7292df79e..572fca5d9acf 100644
--- a/include/asm-arm/arch-s3c2410/regs-irq.h
+++ b/include/asm-arm/arch-s3c2410/regs-irq.h
@@ -23,6 +23,7 @@
23 23
24#define S3C2410_IRQREG(x) ((x) + S3C24XX_VA_IRQ) 24#define S3C2410_IRQREG(x) ((x) + S3C24XX_VA_IRQ)
25#define S3C2410_EINTREG(x) ((x) + S3C24XX_VA_GPIO) 25#define S3C2410_EINTREG(x) ((x) + S3C24XX_VA_GPIO)
26#define S3C24XX_EINTREG(x) ((x) + S3C24XX_VA_GPIO2)
26 27
27#define S3C2410_SRCPND S3C2410_IRQREG(0x000) 28#define S3C2410_SRCPND S3C2410_IRQREG(0x000)
28#define S3C2410_INTMOD S3C2410_IRQREG(0x004) 29#define S3C2410_INTMOD S3C2410_IRQREG(0x004)
@@ -40,5 +41,10 @@
40 41
41#define S3C2410_EINTMASK S3C2410_EINTREG(0x0A4) 42#define S3C2410_EINTMASK S3C2410_EINTREG(0x0A4)
42#define S3C2410_EINTPEND S3C2410_EINTREG(0X0A8) 43#define S3C2410_EINTPEND S3C2410_EINTREG(0X0A8)
44#define S3C2412_EINTMASK S3C2410_EINTREG(0x0B4)
45#define S3C2412_EINTPEND S3C2410_EINTREG(0X0B8)
46
47#define S3C24XX_EINTMASK S3C24XX_EINTREG(0x0A4)
48#define S3C24XX_EINTPEND S3C24XX_EINTREG(0X0A8)
43 49
44#endif /* ___ASM_ARCH_REGS_IRQ_H */ 50#endif /* ___ASM_ARCH_REGS_IRQ_H */
diff --git a/include/asm-arm/arch-s3c2410/regs-serial.h b/include/asm-arm/arch-s3c2410/regs-serial.h
index 83b01254c4ac..93f651ae2967 100644
--- a/include/asm-arm/arch-s3c2410/regs-serial.h
+++ b/include/asm-arm/arch-s3c2410/regs-serial.h
@@ -82,6 +82,12 @@
82#define S3C2440_UCON2_DIVMASK (7 << 12) 82#define S3C2440_UCON2_DIVMASK (7 << 12)
83#define S3C2440_UCON_DIVSHIFT (12) 83#define S3C2440_UCON_DIVSHIFT (12)
84 84
85#define S3C2412_UCON_CLKMASK (3<<10)
86#define S3C2412_UCON_UCLK (1<<10)
87#define S3C2412_UCON_USYSCLK (3<<10)
88#define S3C2412_UCON_PCLK (0<<10)
89#define S3C2412_UCON_PCLK2 (2<<10)
90
85#define S3C2410_UCON_UCLK (1<<10) 91#define S3C2410_UCON_UCLK (1<<10)
86#define S3C2410_UCON_SBREAK (1<<4) 92#define S3C2410_UCON_SBREAK (1<<4)
87 93
@@ -124,6 +130,15 @@
124#define S3C2410_UMCOM_AFC (1<<4) 130#define S3C2410_UMCOM_AFC (1<<4)
125#define S3C2410_UMCOM_RTS_LOW (1<<0) 131#define S3C2410_UMCOM_RTS_LOW (1<<0)
126 132
133#define S3C2412_UMCON_AFC_63 (0<<5)
134#define S3C2412_UMCON_AFC_56 (1<<5)
135#define S3C2412_UMCON_AFC_48 (2<<5)
136#define S3C2412_UMCON_AFC_40 (3<<5)
137#define S3C2412_UMCON_AFC_32 (4<<5)
138#define S3C2412_UMCON_AFC_24 (5<<5)
139#define S3C2412_UMCON_AFC_16 (6<<5)
140#define S3C2412_UMCON_AFC_8 (7<<5)
141
127#define S3C2410_UFSTAT_TXFULL (1<<9) 142#define S3C2410_UFSTAT_TXFULL (1<<9)
128#define S3C2410_UFSTAT_RXFULL (1<<8) 143#define S3C2410_UFSTAT_RXFULL (1<<8)
129#define S3C2410_UFSTAT_TXMASK (15<<4) 144#define S3C2410_UFSTAT_TXMASK (15<<4)
diff --git a/include/asm-arm/arch-sa1100/io.h b/include/asm-arm/arch-sa1100/io.h
index 040ccde7a11e..0756269404b1 100644
--- a/include/asm-arm/arch-sa1100/io.h
+++ b/include/asm-arm/arch-sa1100/io.h
@@ -22,6 +22,5 @@ static inline void __iomem *__io(unsigned long addr)
22} 22}
23#define __io(a) __io(a) 23#define __io(a) __io(a)
24#define __mem_pci(a) (a) 24#define __mem_pci(a) (a)
25#define __mem_isa(a) (a)
26 25
27#endif 26#endif
diff --git a/include/asm-arm/arch-versatile/io.h b/include/asm-arm/arch-versatile/io.h
index 47e904cf25c7..c4d01948e00b 100644
--- a/include/asm-arm/arch-versatile/io.h
+++ b/include/asm-arm/arch-versatile/io.h
@@ -28,6 +28,5 @@ static inline void __iomem *__io(unsigned long addr)
28} 28}
29#define __io(a) __io(a) 29#define __io(a) __io(a)
30#define __mem_pci(a) (a) 30#define __mem_pci(a) (a)
31#define __mem_isa(a) (a)
32 31
33#endif 32#endif
diff --git a/include/asm-arm/floppy.h b/include/asm-arm/floppy.h
index 6ea657c886b9..aa0c8d28d8d9 100644
--- a/include/asm-arm/floppy.h
+++ b/include/asm-arm/floppy.h
@@ -25,7 +25,7 @@
25 25
26#define fd_inb(port) inb((port)) 26#define fd_inb(port) inb((port))
27#define fd_request_irq() request_irq(IRQ_FLOPPYDISK,floppy_interrupt,\ 27#define fd_request_irq() request_irq(IRQ_FLOPPYDISK,floppy_interrupt,\
28 SA_INTERRUPT|SA_SAMPLE_RANDOM,"floppy",NULL) 28 SA_INTERRUPT,"floppy",NULL)
29#define fd_free_irq() free_irq(IRQ_FLOPPYDISK,NULL) 29#define fd_free_irq() free_irq(IRQ_FLOPPYDISK,NULL)
30#define fd_disable_irq() disable_irq(IRQ_FLOPPYDISK) 30#define fd_disable_irq() disable_irq(IRQ_FLOPPYDISK)
31#define fd_enable_irq() enable_irq(IRQ_FLOPPYDISK) 31#define fd_enable_irq() enable_irq(IRQ_FLOPPYDISK)
diff --git a/include/asm-arm/irq.h b/include/asm-arm/irq.h
index 60b5105c9c93..66e67e60bc56 100644
--- a/include/asm-arm/irq.h
+++ b/include/asm-arm/irq.h
@@ -47,10 +47,6 @@ void disable_irq_wake(unsigned int irq);
47void enable_irq_wake(unsigned int irq); 47void enable_irq_wake(unsigned int irq);
48int setup_irq(unsigned int, struct irqaction *); 48int setup_irq(unsigned int, struct irqaction *);
49 49
50struct irqaction;
51struct pt_regs;
52int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *);
53
54extern void migrate_irqs(void); 50extern void migrate_irqs(void);
55#endif 51#endif
56 52
diff --git a/include/asm-arm/thread_notify.h b/include/asm-arm/thread_notify.h
new file mode 100644
index 000000000000..8866e5216840
--- /dev/null
+++ b/include/asm-arm/thread_notify.h
@@ -0,0 +1,48 @@
1/*
2 * linux/include/asm-arm/thread_notify.h
3 *
4 * Copyright (C) 2006 Russell King.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef ASMARM_THREAD_NOTIFY_H
11#define ASMARM_THREAD_NOTIFY_H
12
13#ifdef __KERNEL__
14
15#ifndef __ASSEMBLY__
16
17#include <linux/notifier.h>
18#include <asm/thread_info.h>
19
20static inline int thread_register_notifier(struct notifier_block *n)
21{
22 extern struct atomic_notifier_head thread_notify_head;
23 return atomic_notifier_chain_register(&thread_notify_head, n);
24}
25
26static inline void thread_unregister_notifier(struct notifier_block *n)
27{
28 extern struct atomic_notifier_head thread_notify_head;
29 atomic_notifier_chain_unregister(&thread_notify_head, n);
30}
31
32static inline void thread_notify(unsigned long rc, struct thread_info *thread)
33{
34 extern struct atomic_notifier_head thread_notify_head;
35 atomic_notifier_call_chain(&thread_notify_head, rc, thread);
36}
37
38#endif
39
40/*
41 * These are the reason codes for the thread notifier.
42 */
43#define THREAD_NOTIFY_FLUSH 0
44#define THREAD_NOTIFY_RELEASE 1
45#define THREAD_NOTIFY_SWITCH 2
46
47#endif
48#endif
diff --git a/include/asm-arm/ucontext.h b/include/asm-arm/ucontext.h
index f853130137cc..9e6f7ca9f5ae 100644
--- a/include/asm-arm/ucontext.h
+++ b/include/asm-arm/ucontext.h
@@ -1,12 +1,89 @@
1#ifndef _ASMARM_UCONTEXT_H 1#ifndef _ASMARM_UCONTEXT_H
2#define _ASMARM_UCONTEXT_H 2#define _ASMARM_UCONTEXT_H
3 3
4#include <asm/fpstate.h>
5
6/*
7 * struct sigcontext only has room for the basic registers, but struct
8 * ucontext now has room for all registers which need to be saved and
9 * restored. Coprocessor registers are stored in uc_regspace. Each
10 * coprocessor's saved state should start with a documented 32-bit magic
11 * number, followed by a 32-bit word giving the coproccesor's saved size.
12 * uc_regspace may be expanded if necessary, although this takes some
13 * coordination with glibc.
14 */
15
4struct ucontext { 16struct ucontext {
5 unsigned long uc_flags; 17 unsigned long uc_flags;
6 struct ucontext *uc_link; 18 struct ucontext *uc_link;
7 stack_t uc_stack; 19 stack_t uc_stack;
8 struct sigcontext uc_mcontext; 20 struct sigcontext uc_mcontext;
9 sigset_t uc_sigmask; /* mask last for extensibility */ 21 sigset_t uc_sigmask;
22 /* Allow for uc_sigmask growth. Glibc uses a 1024-bit sigset_t. */
23 int __unused[32 - (sizeof (sigset_t) / sizeof (int))];
24 /* Last for extensibility. Eight byte aligned because some
25 coprocessors require eight byte alignment. */
26 unsigned long uc_regspace[128] __attribute__((__aligned__(8)));
10}; 27};
11 28
29#ifdef __KERNEL__
30
31/*
32 * Coprocessor save state. The magic values and specific
33 * coprocessor's layouts are part of the userspace ABI. Each one of
34 * these should be a multiple of eight bytes and aligned to eight
35 * bytes, to prevent unpredictable padding in the signal frame.
36 */
37
38#ifdef CONFIG_IWMMXT
39/* iwmmxt_area is 0x98 bytes long, preceeded by 8 bytes of signature */
40#define IWMMXT_MAGIC 0x12ef842a
41#define IWMMXT_STORAGE_SIZE (IWMMXT_SIZE + 8)
42
43struct iwmmxt_sigframe {
44 unsigned long magic;
45 unsigned long size;
46 struct iwmmxt_struct storage;
47} __attribute__((__aligned__(8)));
48#endif /* CONFIG_IWMMXT */
49
50#ifdef CONFIG_VFP
51#if __LINUX_ARM_ARCH__ < 6
52/* For ARM pre-v6, we use fstmiax and fldmiax. This adds one extra
53 * word after the registers, and a word of padding at the end for
54 * alignment. */
55#define VFP_MAGIC 0x56465001
56#define VFP_STORAGE_SIZE 152
57#else
58#define VFP_MAGIC 0x56465002
59#define VFP_STORAGE_SIZE 144
60#endif
61
62struct vfp_sigframe
63{
64 unsigned long magic;
65 unsigned long size;
66 union vfp_state storage;
67};
68#endif /* CONFIG_VFP */
69
70/*
71 * Auxiliary signal frame. This saves stuff like FP state.
72 * The layout of this structure is not part of the user ABI,
73 * because the config options aren't. uc_regspace is really
74 * one of these.
75 */
76struct aux_sigframe {
77#ifdef CONFIG_IWMMXT
78 struct iwmmxt_sigframe iwmmxt;
79#endif
80#if 0 && defined CONFIG_VFP /* Not yet saved. */
81 struct vfp_sigframe vfp;
82#endif
83 /* Something that isn't a valid magic number for any coprocessor. */
84 unsigned long end_magic;
85} __attribute__((__aligned__(8)));
86
87#endif
88
12#endif /* !_ASMARM_UCONTEXT_H */ 89#endif /* !_ASMARM_UCONTEXT_H */
diff --git a/include/asm-arm/vga.h b/include/asm-arm/vga.h
index 926e5ee128e9..1e0b913c3d71 100644
--- a/include/asm-arm/vga.h
+++ b/include/asm-arm/vga.h
@@ -4,7 +4,7 @@
4#include <asm/hardware.h> 4#include <asm/hardware.h>
5#include <asm/io.h> 5#include <asm/io.h>
6 6
7#define VGA_MAP_MEM(x) (PCIMEM_BASE + (x)) 7#define VGA_MAP_MEM(x,s) (PCIMEM_BASE + (x))
8 8
9#define vga_readb(x) (*((volatile unsigned char *)x)) 9#define vga_readb(x) (*((volatile unsigned char *)x))
10#define vga_writeb(x,y) (*((volatile unsigned char *)y) = (x)) 10#define vga_writeb(x,y) (*((volatile unsigned char *)y) = (x))
diff --git a/include/asm-arm26/floppy.h b/include/asm-arm26/floppy.h
index 9e090ad7e477..a18af069ca28 100644
--- a/include/asm-arm26/floppy.h
+++ b/include/asm-arm26/floppy.h
@@ -22,7 +22,7 @@
22 22
23#define fd_inb(port) inb((port)) 23#define fd_inb(port) inb((port))
24#define fd_request_irq() request_irq(IRQ_FLOPPYDISK,floppy_interrupt,\ 24#define fd_request_irq() request_irq(IRQ_FLOPPYDISK,floppy_interrupt,\
25 SA_INTERRUPT|SA_SAMPLE_RANDOM,"floppy",NULL) 25 SA_INTERRUPT,"floppy",NULL)
26#define fd_free_irq() free_irq(IRQ_FLOPPYDISK,NULL) 26#define fd_free_irq() free_irq(IRQ_FLOPPYDISK,NULL)
27#define fd_disable_irq() disable_irq(IRQ_FLOPPYDISK) 27#define fd_disable_irq() disable_irq(IRQ_FLOPPYDISK)
28#define fd_enable_irq() enable_irq(IRQ_FLOPPYDISK) 28#define fd_enable_irq() enable_irq(IRQ_FLOPPYDISK)
diff --git a/include/asm-arm26/irq.h b/include/asm-arm26/irq.h
index 06bd5a543d13..9aaac87efba9 100644
--- a/include/asm-arm26/irq.h
+++ b/include/asm-arm26/irq.h
@@ -44,9 +44,5 @@ extern void enable_irq(unsigned int);
44 44
45int set_irq_type(unsigned int irq, unsigned int type); 45int set_irq_type(unsigned int irq, unsigned int type);
46 46
47int setup_irq(unsigned int, struct irqaction *);
48struct pt_regs;
49int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *);
50
51#endif 47#endif
52 48
diff --git a/include/asm-frv/atomic.h b/include/asm-frv/atomic.h
index 9a4ff03c3969..066386ac238e 100644
--- a/include/asm-frv/atomic.h
+++ b/include/asm-frv/atomic.h
@@ -227,7 +227,7 @@ extern unsigned long atomic_test_and_XOR_mask(unsigned long mask, volatile unsig
227 break; \ 227 break; \
228 \ 228 \
229 default: \ 229 default: \
230 __xg_orig = 0; \ 230 __xg_orig = (__typeof__(__xg_orig))0; \
231 asm volatile("break"); \ 231 asm volatile("break"); \
232 break; \ 232 break; \
233 } \ 233 } \
@@ -247,7 +247,7 @@ extern uint32_t __xchg_32(uint32_t i, volatile void *v);
247 switch (sizeof(__xg_orig)) { \ 247 switch (sizeof(__xg_orig)) { \
248 case 4: __xg_orig = (__typeof__(*(ptr))) __xchg_32((uint32_t) x, __xg_ptr); break; \ 248 case 4: __xg_orig = (__typeof__(*(ptr))) __xchg_32((uint32_t) x, __xg_ptr); break; \
249 default: \ 249 default: \
250 __xg_orig = 0; \ 250 __xg_orig = (__typeof__(__xg_orig))0; \
251 asm volatile("break"); \ 251 asm volatile("break"); \
252 break; \ 252 break; \
253 } \ 253 } \
diff --git a/include/asm-frv/checksum.h b/include/asm-frv/checksum.h
index 10236f6802db..42bf0db2287a 100644
--- a/include/asm-frv/checksum.h
+++ b/include/asm-frv/checksum.h
@@ -43,7 +43,7 @@ unsigned int csum_partial_copy(const char *src, char *dst, int len, int sum);
43 * here even more important to align src and dst on a 32-bit (or even 43 * here even more important to align src and dst on a 32-bit (or even
44 * better 64-bit) boundary 44 * better 64-bit) boundary
45 */ 45 */
46extern unsigned int csum_partial_copy_from_user(const char *src, char *dst, 46extern unsigned int csum_partial_copy_from_user(const char __user *src, char *dst,
47 int len, int sum, int *csum_err); 47 int len, int sum, int *csum_err);
48 48
49#define csum_partial_copy_nocheck(src, dst, len, sum) \ 49#define csum_partial_copy_nocheck(src, dst, len, sum) \
diff --git a/include/asm-frv/highmem.h b/include/asm-frv/highmem.h
index cfbf7d3a1feb..e2247c22a638 100644
--- a/include/asm-frv/highmem.h
+++ b/include/asm-frv/highmem.h
@@ -134,7 +134,7 @@ static inline void *kmap_atomic(struct page *page, enum km_type type)
134 134
135 default: 135 default:
136 BUG(); 136 BUG();
137 return 0; 137 return NULL;
138 } 138 }
139} 139}
140 140
diff --git a/include/asm-frv/io.h b/include/asm-frv/io.h
index b56eba59e3cd..7765f5528894 100644
--- a/include/asm-frv/io.h
+++ b/include/asm-frv/io.h
@@ -40,13 +40,13 @@ static inline unsigned long _swapl(unsigned long v)
40//#define __iormb() asm volatile("membar") 40//#define __iormb() asm volatile("membar")
41//#define __iowmb() asm volatile("membar") 41//#define __iowmb() asm volatile("membar")
42 42
43#define __raw_readb(addr) __builtin_read8((void *) (addr)) 43#define __raw_readb __builtin_read8
44#define __raw_readw(addr) __builtin_read16((void *) (addr)) 44#define __raw_readw __builtin_read16
45#define __raw_readl(addr) __builtin_read32((void *) (addr)) 45#define __raw_readl __builtin_read32
46 46
47#define __raw_writeb(datum, addr) __builtin_write8((void *) (addr), datum) 47#define __raw_writeb(datum, addr) __builtin_write8(addr, datum)
48#define __raw_writew(datum, addr) __builtin_write16((void *) (addr), datum) 48#define __raw_writew(datum, addr) __builtin_write16(addr, datum)
49#define __raw_writel(datum, addr) __builtin_write32((void *) (addr), datum) 49#define __raw_writel(datum, addr) __builtin_write32(addr, datum)
50 50
51static inline void io_outsb(unsigned int addr, const void *buf, int len) 51static inline void io_outsb(unsigned int addr, const void *buf, int len)
52{ 52{
@@ -116,7 +116,7 @@ static inline void memset_io(volatile void __iomem *addr, unsigned char val, int
116 memset((void __force *) addr, val, count); 116 memset((void __force *) addr, val, count);
117} 117}
118 118
119static inline void memcpy_fromio(void *dst, volatile void __iomem *src, int count) 119static inline void memcpy_fromio(void *dst, const volatile void __iomem *src, int count)
120{ 120{
121 memcpy(dst, (void __force *) src, count); 121 memcpy(dst, (void __force *) src, count);
122} 122}
@@ -128,12 +128,12 @@ static inline void memcpy_toio(volatile void __iomem *dst, const void *src, int
128 128
129static inline uint8_t inb(unsigned long addr) 129static inline uint8_t inb(unsigned long addr)
130{ 130{
131 return __builtin_read8((void *)addr); 131 return __builtin_read8((void __iomem *)addr);
132} 132}
133 133
134static inline uint16_t inw(unsigned long addr) 134static inline uint16_t inw(unsigned long addr)
135{ 135{
136 uint16_t ret = __builtin_read16((void *)addr); 136 uint16_t ret = __builtin_read16((void __iomem *)addr);
137 137
138 if (__is_PCI_IO(addr)) 138 if (__is_PCI_IO(addr))
139 ret = _swapw(ret); 139 ret = _swapw(ret);
@@ -143,7 +143,7 @@ static inline uint16_t inw(unsigned long addr)
143 143
144static inline uint32_t inl(unsigned long addr) 144static inline uint32_t inl(unsigned long addr)
145{ 145{
146 uint32_t ret = __builtin_read32((void *)addr); 146 uint32_t ret = __builtin_read32((void __iomem *)addr);
147 147
148 if (__is_PCI_IO(addr)) 148 if (__is_PCI_IO(addr))
149 ret = _swapl(ret); 149 ret = _swapl(ret);
@@ -153,21 +153,21 @@ static inline uint32_t inl(unsigned long addr)
153 153
154static inline void outb(uint8_t datum, unsigned long addr) 154static inline void outb(uint8_t datum, unsigned long addr)
155{ 155{
156 __builtin_write8((void *)addr, datum); 156 __builtin_write8((void __iomem *)addr, datum);
157} 157}
158 158
159static inline void outw(uint16_t datum, unsigned long addr) 159static inline void outw(uint16_t datum, unsigned long addr)
160{ 160{
161 if (__is_PCI_IO(addr)) 161 if (__is_PCI_IO(addr))
162 datum = _swapw(datum); 162 datum = _swapw(datum);
163 __builtin_write16((void *)addr, datum); 163 __builtin_write16((void __iomem *)addr, datum);
164} 164}
165 165
166static inline void outl(uint32_t datum, unsigned long addr) 166static inline void outl(uint32_t datum, unsigned long addr)
167{ 167{
168 if (__is_PCI_IO(addr)) 168 if (__is_PCI_IO(addr))
169 datum = _swapl(datum); 169 datum = _swapl(datum);
170 __builtin_write32((void *)addr, datum); 170 __builtin_write32((void __iomem *)addr, datum);
171} 171}
172 172
173#define inb_p(addr) inb(addr) 173#define inb_p(addr) inb(addr)
@@ -189,12 +189,12 @@ static inline void outl(uint32_t datum, unsigned long addr)
189 189
190static inline uint8_t readb(const volatile void __iomem *addr) 190static inline uint8_t readb(const volatile void __iomem *addr)
191{ 191{
192 return __builtin_read8((volatile uint8_t __force *) addr); 192 return __builtin_read8((__force void volatile __iomem *) addr);
193} 193}
194 194
195static inline uint16_t readw(const volatile void __iomem *addr) 195static inline uint16_t readw(const volatile void __iomem *addr)
196{ 196{
197 uint16_t ret = __builtin_read16((volatile uint16_t __force *)addr); 197 uint16_t ret = __builtin_read16((__force void volatile __iomem *)addr);
198 198
199 if (__is_PCI_MEM(addr)) 199 if (__is_PCI_MEM(addr))
200 ret = _swapw(ret); 200 ret = _swapw(ret);
@@ -203,7 +203,7 @@ static inline uint16_t readw(const volatile void __iomem *addr)
203 203
204static inline uint32_t readl(const volatile void __iomem *addr) 204static inline uint32_t readl(const volatile void __iomem *addr)
205{ 205{
206 uint32_t ret = __builtin_read32((volatile uint32_t __force *)addr); 206 uint32_t ret = __builtin_read32((__force void volatile __iomem *)addr);
207 207
208 if (__is_PCI_MEM(addr)) 208 if (__is_PCI_MEM(addr))
209 ret = _swapl(ret); 209 ret = _swapl(ret);
@@ -217,7 +217,7 @@ static inline uint32_t readl(const volatile void __iomem *addr)
217 217
218static inline void writeb(uint8_t datum, volatile void __iomem *addr) 218static inline void writeb(uint8_t datum, volatile void __iomem *addr)
219{ 219{
220 __builtin_write8((volatile uint8_t __force *) addr, datum); 220 __builtin_write8(addr, datum);
221 if (__is_PCI_MEM(addr)) 221 if (__is_PCI_MEM(addr))
222 __flush_PCI_writes(); 222 __flush_PCI_writes();
223} 223}
@@ -227,7 +227,7 @@ static inline void writew(uint16_t datum, volatile void __iomem *addr)
227 if (__is_PCI_MEM(addr)) 227 if (__is_PCI_MEM(addr))
228 datum = _swapw(datum); 228 datum = _swapw(datum);
229 229
230 __builtin_write16((volatile uint16_t __force *) addr, datum); 230 __builtin_write16(addr, datum);
231 if (__is_PCI_MEM(addr)) 231 if (__is_PCI_MEM(addr))
232 __flush_PCI_writes(); 232 __flush_PCI_writes();
233} 233}
@@ -237,7 +237,7 @@ static inline void writel(uint32_t datum, volatile void __iomem *addr)
237 if (__is_PCI_MEM(addr)) 237 if (__is_PCI_MEM(addr))
238 datum = _swapl(datum); 238 datum = _swapl(datum);
239 239
240 __builtin_write32((volatile uint32_t __force *) addr, datum); 240 __builtin_write32(addr, datum);
241 if (__is_PCI_MEM(addr)) 241 if (__is_PCI_MEM(addr))
242 __flush_PCI_writes(); 242 __flush_PCI_writes();
243} 243}
@@ -271,7 +271,7 @@ static inline void __iomem *ioremap_fullcache(unsigned long physaddr, unsigned l
271 return __ioremap(physaddr, size, IOMAP_FULL_CACHING); 271 return __ioremap(physaddr, size, IOMAP_FULL_CACHING);
272} 272}
273 273
274extern void iounmap(void __iomem *addr); 274extern void iounmap(void volatile __iomem *addr);
275 275
276static inline void __iomem *ioport_map(unsigned long port, unsigned int nr) 276static inline void __iomem *ioport_map(unsigned long port, unsigned int nr)
277{ 277{
diff --git a/include/asm-frv/mb-regs.h b/include/asm-frv/mb-regs.h
index 93fa732fb0cd..219e5f926f18 100644
--- a/include/asm-frv/mb-regs.h
+++ b/include/asm-frv/mb-regs.h
@@ -16,6 +16,17 @@
16#include <asm/sections.h> 16#include <asm/sections.h>
17#include <asm/mem-layout.h> 17#include <asm/mem-layout.h>
18 18
19#ifndef __ASSEMBLY__
20/* gcc builtins, annotated */
21
22unsigned long __builtin_read8(volatile void __iomem *);
23unsigned long __builtin_read16(volatile void __iomem *);
24unsigned long __builtin_read32(volatile void __iomem *);
25void __builtin_write8(volatile void __iomem *, unsigned char);
26void __builtin_write16(volatile void __iomem *, unsigned short);
27void __builtin_write32(volatile void __iomem *, unsigned long);
28#endif
29
19#define __region_IO KERNEL_IO_START /* the region from 0xe0000000 to 0xffffffff has suitable 30#define __region_IO KERNEL_IO_START /* the region from 0xe0000000 to 0xffffffff has suitable
20 * protection laid over the top for use in memory-mapped 31 * protection laid over the top for use in memory-mapped
21 * I/O 32 * I/O
@@ -59,7 +70,7 @@
59#define __region_PCI_MEM (__region_CS2 + 0x08000000UL) 70#define __region_PCI_MEM (__region_CS2 + 0x08000000UL)
60#define __flush_PCI_writes() \ 71#define __flush_PCI_writes() \
61do { \ 72do { \
62 __builtin_write8((volatile void *) __region_PCI_MEM, 0); \ 73 __builtin_write8((volatile void __iomem *) __region_PCI_MEM, 0); \
63} while(0) 74} while(0)
64 75
65#define __is_PCI_IO(addr) \ 76#define __is_PCI_IO(addr) \
@@ -83,15 +94,15 @@ extern int __nongprelbss mb93090_mb00_detected;
83#define __set_LEDS(X) \ 94#define __set_LEDS(X) \
84do { \ 95do { \
85 if (mb93090_mb00_detected) \ 96 if (mb93090_mb00_detected) \
86 __builtin_write32((void *) __addr_LEDS(), ~(X)); \ 97 __builtin_write32((void __iomem *) __addr_LEDS(), ~(X)); \
87} while (0) 98} while (0)
88#else 99#else
89#define __set_LEDS(X) 100#define __set_LEDS(X)
90#endif 101#endif
91 102
92#define __addr_LCD() (__region_CS2 + 0x01200008UL) 103#define __addr_LCD() (__region_CS2 + 0x01200008UL)
93#define __get_LCD(B) __builtin_read32((volatile void *) (B)) 104#define __get_LCD(B) __builtin_read32((volatile void __iomem *) (B))
94#define __set_LCD(B,X) __builtin_write32((volatile void *) (B), (X)) 105#define __set_LCD(B,X) __builtin_write32((volatile void __iomem *) (B), (X))
95 106
96#define LCD_D 0x000000ff /* LCD data bus */ 107#define LCD_D 0x000000ff /* LCD data bus */
97#define LCD_RW 0x00000100 /* LCD R/W signal */ 108#define LCD_RW 0x00000100 /* LCD R/W signal */
@@ -161,11 +172,11 @@ do { \
161#define __get_CLKIN() 66000000UL 172#define __get_CLKIN() 66000000UL
162 173
163#define __addr_LEDS() (__region_CS2 + 0x00000023UL) 174#define __addr_LEDS() (__region_CS2 + 0x00000023UL)
164#define __set_LEDS(X) __builtin_write8((volatile void *) __addr_LEDS(), (X)) 175#define __set_LEDS(X) __builtin_write8((volatile void __iomem *) __addr_LEDS(), (X))
165 176
166#define __addr_FPGATR() (__region_CS2 + 0x00000030UL) 177#define __addr_FPGATR() (__region_CS2 + 0x00000030UL)
167#define __set_FPGATR(X) __builtin_write32((volatile void *) __addr_FPGATR(), (X)) 178#define __set_FPGATR(X) __builtin_write32((volatile void __iomem *) __addr_FPGATR(), (X))
168#define __get_FPGATR() __builtin_read32((volatile void *) __addr_FPGATR()) 179#define __get_FPGATR() __builtin_read32((volatile void __iomem *) __addr_FPGATR())
169 180
170#define MB93093_FPGA_FPGATR_AUDIO_CLK 0x00000003 181#define MB93093_FPGA_FPGATR_AUDIO_CLK 0x00000003
171 182
@@ -180,7 +191,7 @@ do { \
180#define MB93093_FPGA_SWR_PUSHSWMASK (0x1F<<26) 191#define MB93093_FPGA_SWR_PUSHSWMASK (0x1F<<26)
181#define MB93093_FPGA_SWR_PUSHSW4 (1<<29) 192#define MB93093_FPGA_SWR_PUSHSW4 (1<<29)
182 193
183#define __addr_FPGA_SWR ((volatile void *)(__region_CS2 + 0x28UL)) 194#define __addr_FPGA_SWR ((volatile void __iomem *)(__region_CS2 + 0x28UL))
184#define __get_FPGA_PUSHSW1_5() (__builtin_read32(__addr_FPGA_SWR) & MB93093_FPGA_SWR_PUSHSWMASK) 195#define __get_FPGA_PUSHSW1_5() (__builtin_read32(__addr_FPGA_SWR) & MB93093_FPGA_SWR_PUSHSWMASK)
185 196
186 197
diff --git a/include/asm-frv/signal.h b/include/asm-frv/signal.h
index 67366894780f..dcc1b3592918 100644
--- a/include/asm-frv/signal.h
+++ b/include/asm-frv/signal.h
@@ -114,13 +114,13 @@ struct old_sigaction {
114 __sighandler_t sa_handler; 114 __sighandler_t sa_handler;
115 old_sigset_t sa_mask; 115 old_sigset_t sa_mask;
116 unsigned long sa_flags; 116 unsigned long sa_flags;
117 void (*sa_restorer)(void); 117 __sigrestore_t sa_restorer;
118}; 118};
119 119
120struct sigaction { 120struct sigaction {
121 __sighandler_t sa_handler; 121 __sighandler_t sa_handler;
122 unsigned long sa_flags; 122 unsigned long sa_flags;
123 void (*sa_restorer)(void); 123 __sigrestore_t sa_restorer;
124 sigset_t sa_mask; /* mask last for extensibility */ 124 sigset_t sa_mask; /* mask last for extensibility */
125}; 125};
126 126
@@ -146,7 +146,7 @@ struct sigaction {
146#endif /* __KERNEL__ */ 146#endif /* __KERNEL__ */
147 147
148typedef struct sigaltstack { 148typedef struct sigaltstack {
149 void *ss_sp; 149 void __user *ss_sp;
150 int ss_flags; 150 int ss_flags;
151 size_t ss_size; 151 size_t ss_size;
152} stack_t; 152} stack_t;
diff --git a/include/asm-frv/uaccess.h b/include/asm-frv/uaccess.h
index a1d140438863..3d90e1018ee2 100644
--- a/include/asm-frv/uaccess.h
+++ b/include/asm-frv/uaccess.h
@@ -22,7 +22,7 @@
22 22
23#define HAVE_ARCH_UNMAPPED_AREA /* we decide where to put mmaps */ 23#define HAVE_ARCH_UNMAPPED_AREA /* we decide where to put mmaps */
24 24
25#define __ptr(x) ((unsigned long *)(x)) 25#define __ptr(x) ((unsigned long __force *)(x))
26 26
27#define VERIFY_READ 0 27#define VERIFY_READ 0
28#define VERIFY_WRITE 1 28#define VERIFY_WRITE 1
@@ -64,7 +64,7 @@ static inline int ___range_ok(unsigned long addr, unsigned long size)
64 64
65#define __range_ok(addr,size) ___range_ok((unsigned long) (addr), (unsigned long) (size)) 65#define __range_ok(addr,size) ___range_ok((unsigned long) (addr), (unsigned long) (size))
66 66
67#define access_ok(type,addr,size) (__range_ok((addr), (size)) == 0) 67#define access_ok(type,addr,size) (__range_ok((void __user *)(addr), (size)) == 0)
68#define __access_ok(addr,size) (__range_ok((addr), (size)) == 0) 68#define __access_ok(addr,size) (__range_ok((addr), (size)) == 0)
69 69
70/* 70/*
@@ -97,6 +97,7 @@ extern unsigned long search_exception_table(unsigned long);
97 int __pu_err = 0; \ 97 int __pu_err = 0; \
98 \ 98 \
99 typeof(*(ptr)) __pu_val = (x); \ 99 typeof(*(ptr)) __pu_val = (x); \
100 __chk_user_ptr(ptr); \
100 \ 101 \
101 switch (sizeof (*(ptr))) { \ 102 switch (sizeof (*(ptr))) { \
102 case 1: \ 103 case 1: \
@@ -120,7 +121,7 @@ extern unsigned long search_exception_table(unsigned long);
120 121
121#define put_user(x, ptr) \ 122#define put_user(x, ptr) \
122({ \ 123({ \
123 typeof(&*ptr) _p = (ptr); \ 124 typeof(*(ptr)) __user *_p = (ptr); \
124 int _e; \ 125 int _e; \
125 \ 126 \
126 _e = __range_ok(_p, sizeof(*_p)); \ 127 _e = __range_ok(_p, sizeof(*_p)); \
@@ -175,33 +176,44 @@ do { \
175 */ 176 */
176#define __get_user(x, ptr) \ 177#define __get_user(x, ptr) \
177({ \ 178({ \
178 typeof(*(ptr)) __gu_val = 0; \
179 int __gu_err = 0; \ 179 int __gu_err = 0; \
180 __chk_user_ptr(ptr); \
180 \ 181 \
181 switch (sizeof(*(ptr))) { \ 182 switch (sizeof(*(ptr))) { \
182 case 1: \ 183 case 1: { \
183 __get_user_asm(__gu_err, *(u8*)&__gu_val, ptr, "ub", "=r"); \ 184 unsigned char __gu_val; \
185 __get_user_asm(__gu_err, __gu_val, ptr, "ub", "=r"); \
186 (x) = *(__force __typeof__(*(ptr)) *) &__gu_val; \
184 break; \ 187 break; \
185 case 2: \ 188 } \
186 __get_user_asm(__gu_err, *(u16*)&__gu_val, ptr, "uh", "=r"); \ 189 case 2: { \
190 unsigned short __gu_val; \
191 __get_user_asm(__gu_err, __gu_val, ptr, "uh", "=r"); \
192 (x) = *(__force __typeof__(*(ptr)) *) &__gu_val; \
187 break; \ 193 break; \
188 case 4: \ 194 } \
189 __get_user_asm(__gu_err, *(u32*)&__gu_val, ptr, "", "=r"); \ 195 case 4: { \
196 unsigned int __gu_val; \
197 __get_user_asm(__gu_err, __gu_val, ptr, "", "=r"); \
198 (x) = *(__force __typeof__(*(ptr)) *) &__gu_val; \
190 break; \ 199 break; \
191 case 8: \ 200 } \
192 __get_user_asm(__gu_err, *(u64*)&__gu_val, ptr, "d", "=e"); \ 201 case 8: { \
202 unsigned long long __gu_val; \
203 __get_user_asm(__gu_err, __gu_val, ptr, "d", "=e"); \
204 (x) = *(__force __typeof__(*(ptr)) *) &__gu_val; \
193 break; \ 205 break; \
206 } \
194 default: \ 207 default: \
195 __gu_err = __get_user_bad(); \ 208 __gu_err = __get_user_bad(); \
196 break; \ 209 break; \
197 } \ 210 } \
198 (x) = __gu_val; \
199 __gu_err; \ 211 __gu_err; \
200}) 212})
201 213
202#define get_user(x, ptr) \ 214#define get_user(x, ptr) \
203({ \ 215({ \
204 typeof(&*ptr) _p = (ptr); \ 216 const typeof(*(ptr)) __user *_p = (ptr);\
205 int _e; \ 217 int _e; \
206 \ 218 \
207 _e = __range_ok(_p, sizeof(*_p)); \ 219 _e = __range_ok(_p, sizeof(*_p)); \
@@ -248,19 +260,20 @@ do { \
248/* 260/*
249 * 261 *
250 */ 262 */
263#define ____force(x) (__force void *)(void __user *)(x)
251#ifdef CONFIG_MMU 264#ifdef CONFIG_MMU
252extern long __memset_user(void *dst, unsigned long count); 265extern long __memset_user(void *dst, unsigned long count);
253extern long __memcpy_user(void *dst, const void *src, unsigned long count); 266extern long __memcpy_user(void *dst, const void *src, unsigned long count);
254 267
255#define clear_user(dst,count) __memset_user((dst), (count)) 268#define clear_user(dst,count) __memset_user(____force(dst), (count))
256#define __copy_from_user_inatomic(to, from, n) __memcpy_user((to), (from), (n)) 269#define __copy_from_user_inatomic(to, from, n) __memcpy_user((to), ____force(from), (n))
257#define __copy_to_user_inatomic(to, from, n) __memcpy_user((to), (from), (n)) 270#define __copy_to_user_inatomic(to, from, n) __memcpy_user(____force(to), (from), (n))
258 271
259#else 272#else
260 273
261#define clear_user(dst,count) (memset((dst), 0, (count)), 0) 274#define clear_user(dst,count) (memset(____force(dst), 0, (count)), 0)
262#define __copy_from_user_inatomic(to, from, n) (memcpy((to), (from), (n)), 0) 275#define __copy_from_user_inatomic(to, from, n) (memcpy((to), ____force(from), (n)), 0)
263#define __copy_to_user_inatomic(to, from, n) (memcpy((to), (from), (n)), 0) 276#define __copy_to_user_inatomic(to, from, n) (memcpy(____force(to), (from), (n)), 0)
264 277
265#endif 278#endif
266 279
@@ -278,7 +291,7 @@ __copy_from_user(void *to, const void __user *from, unsigned long n)
278 return __copy_from_user_inatomic(to, from, n); 291 return __copy_from_user_inatomic(to, from, n);
279} 292}
280 293
281static inline long copy_from_user(void *to, const void *from, unsigned long n) 294static inline long copy_from_user(void *to, const void __user *from, unsigned long n)
282{ 295{
283 unsigned long ret = n; 296 unsigned long ret = n;
284 297
@@ -291,16 +304,13 @@ static inline long copy_from_user(void *to, const void *from, unsigned long n)
291 return ret; 304 return ret;
292} 305}
293 306
294static inline long copy_to_user(void *to, const void *from, unsigned long n) 307static inline long copy_to_user(void __user *to, const void *from, unsigned long n)
295{ 308{
296 return likely(__access_ok(to, n)) ? __copy_to_user(to, from, n) : n; 309 return likely(__access_ok(to, n)) ? __copy_to_user(to, from, n) : n;
297} 310}
298 311
299#define copy_to_user_ret(to,from,n,retval) ({ if (copy_to_user(to,from,n)) return retval; }) 312extern long strncpy_from_user(char *dst, const char __user *src, long count);
300#define copy_from_user_ret(to,from,n,retval) ({ if (copy_from_user(to,from,n)) return retval; }) 313extern long strnlen_user(const char __user *src, long count);
301
302extern long strncpy_from_user(char *dst, const char *src, long count);
303extern long strnlen_user(const char *src, long count);
304 314
305#define strlen_user(str) strnlen_user(str, 32767) 315#define strlen_user(str) strnlen_user(str, 32767)
306 316
diff --git a/include/asm-frv/unistd.h b/include/asm-frv/unistd.h
index 7c2e712c3b73..b80dbd839475 100644
--- a/include/asm-frv/unistd.h
+++ b/include/asm-frv/unistd.h
@@ -306,7 +306,7 @@
306#define __NR_mknodat 297 306#define __NR_mknodat 297
307#define __NR_fchownat 298 307#define __NR_fchownat 298
308#define __NR_futimesat 299 308#define __NR_futimesat 299
309#define __NR_newfstatat 300 309#define __NR_fstatat64 300
310#define __NR_unlinkat 301 310#define __NR_unlinkat 301
311#define __NR_renameat 302 311#define __NR_renameat 302
312#define __NR_linkat 303 312#define __NR_linkat 303
@@ -460,24 +460,7 @@ type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg
460 * some others too. 460 * some others too.
461 */ 461 */
462#define __NR__exit __NR_exit 462#define __NR__exit __NR_exit
463static inline _syscall0(int,pause)
464static inline _syscall0(int,sync)
465static inline _syscall0(pid_t,setsid)
466static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count)
467static inline _syscall3(int,read,int,fd,char *,buf,off_t,count)
468static inline _syscall3(off_t,lseek,int,fd,off_t,offset,int,count)
469static inline _syscall1(int,dup,int,fd)
470static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp) 463static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp)
471static inline _syscall3(int,open,const char *,file,int,flag,int,mode)
472static inline _syscall1(int,close,int,fd)
473static inline _syscall1(int,_exit,int,exitcode)
474static inline _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options)
475static inline _syscall1(int,delete_module,const char *,name)
476
477static inline pid_t wait(int * wait_stat)
478{
479 return waitpid(-1,wait_stat,0);
480}
481 464
482#endif /* __KERNEL_SYSCALLS__ */ 465#endif /* __KERNEL_SYSCALLS__ */
483 466
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 0cd9711895fa..845cb67ad8ea 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -38,4 +38,17 @@
38#endif 38#endif
39#endif 39#endif
40 40
41#define WARN_ON_ONCE(condition) \
42({ \
43 static int __warn_once = 1; \
44 int __ret = 0; \
45 \
46 if (unlikely((condition) && __warn_once)) { \
47 __warn_once = 0; \
48 WARN_ON(1); \
49 __ret = 1; \
50 } \
51 __ret; \
52})
53
41#endif 54#endif
diff --git a/include/asm-generic/memory_model.h b/include/asm-generic/memory_model.h
index 0cfb086dd373..8078cbd2c016 100644
--- a/include/asm-generic/memory_model.h
+++ b/include/asm-generic/memory_model.h
@@ -23,29 +23,23 @@
23 23
24#endif /* CONFIG_DISCONTIGMEM */ 24#endif /* CONFIG_DISCONTIGMEM */
25 25
26#ifdef CONFIG_OUT_OF_LINE_PFN_TO_PAGE
27struct page;
28/* this is useful when inlined pfn_to_page is too big */
29extern struct page *pfn_to_page(unsigned long pfn);
30extern unsigned long page_to_pfn(struct page *page);
31#else
32/* 26/*
33 * supports 3 memory models. 27 * supports 3 memory models.
34 */ 28 */
35#if defined(CONFIG_FLATMEM) 29#if defined(CONFIG_FLATMEM)
36 30
37#define pfn_to_page(pfn) (mem_map + ((pfn) - ARCH_PFN_OFFSET)) 31#define __pfn_to_page(pfn) (mem_map + ((pfn) - ARCH_PFN_OFFSET))
38#define page_to_pfn(page) ((unsigned long)((page) - mem_map) + \ 32#define __page_to_pfn(page) ((unsigned long)((page) - mem_map) + \
39 ARCH_PFN_OFFSET) 33 ARCH_PFN_OFFSET)
40#elif defined(CONFIG_DISCONTIGMEM) 34#elif defined(CONFIG_DISCONTIGMEM)
41 35
42#define pfn_to_page(pfn) \ 36#define __pfn_to_page(pfn) \
43({ unsigned long __pfn = (pfn); \ 37({ unsigned long __pfn = (pfn); \
44 unsigned long __nid = arch_pfn_to_nid(pfn); \ 38 unsigned long __nid = arch_pfn_to_nid(pfn); \
45 NODE_DATA(__nid)->node_mem_map + arch_local_page_offset(__pfn, __nid);\ 39 NODE_DATA(__nid)->node_mem_map + arch_local_page_offset(__pfn, __nid);\
46}) 40})
47 41
48#define page_to_pfn(pg) \ 42#define __page_to_pfn(pg) \
49({ struct page *__pg = (pg); \ 43({ struct page *__pg = (pg); \
50 struct pglist_data *__pgdat = NODE_DATA(page_to_nid(__pg)); \ 44 struct pglist_data *__pgdat = NODE_DATA(page_to_nid(__pg)); \
51 (unsigned long)(__pg - __pgdat->node_mem_map) + \ 45 (unsigned long)(__pg - __pgdat->node_mem_map) + \
@@ -57,18 +51,27 @@ extern unsigned long page_to_pfn(struct page *page);
57 * Note: section's mem_map is encorded to reflect its start_pfn. 51 * Note: section's mem_map is encorded to reflect its start_pfn.
58 * section[i].section_mem_map == mem_map's address - start_pfn; 52 * section[i].section_mem_map == mem_map's address - start_pfn;
59 */ 53 */
60#define page_to_pfn(pg) \ 54#define __page_to_pfn(pg) \
61({ struct page *__pg = (pg); \ 55({ struct page *__pg = (pg); \
62 int __sec = page_to_section(__pg); \ 56 int __sec = page_to_section(__pg); \
63 __pg - __section_mem_map_addr(__nr_to_section(__sec)); \ 57 __pg - __section_mem_map_addr(__nr_to_section(__sec)); \
64}) 58})
65 59
66#define pfn_to_page(pfn) \ 60#define __pfn_to_page(pfn) \
67({ unsigned long __pfn = (pfn); \ 61({ unsigned long __pfn = (pfn); \
68 struct mem_section *__sec = __pfn_to_section(__pfn); \ 62 struct mem_section *__sec = __pfn_to_section(__pfn); \
69 __section_mem_map_addr(__sec) + __pfn; \ 63 __section_mem_map_addr(__sec) + __pfn; \
70}) 64})
71#endif /* CONFIG_FLATMEM/DISCONTIGMEM/SPARSEMEM */ 65#endif /* CONFIG_FLATMEM/DISCONTIGMEM/SPARSEMEM */
66
67#ifdef CONFIG_OUT_OF_LINE_PFN_TO_PAGE
68struct page;
69/* this is useful when inlined pfn_to_page is too big */
70extern struct page *pfn_to_page(unsigned long pfn);
71extern unsigned long page_to_pfn(struct page *page);
72#else
73#define page_to_pfn __page_to_pfn
74#define pfn_to_page __pfn_to_page
72#endif /* CONFIG_OUT_OF_LINE_PFN_TO_PAGE */ 75#endif /* CONFIG_OUT_OF_LINE_PFN_TO_PAGE */
73 76
74#endif /* __ASSEMBLY__ */ 77#endif /* __ASSEMBLY__ */
diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h
index c0caf433a7d7..c74521157461 100644
--- a/include/asm-generic/percpu.h
+++ b/include/asm-generic/percpu.h
@@ -14,6 +14,7 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
14/* var is in discarded region: offset to particular copy we want */ 14/* var is in discarded region: offset to particular copy we want */
15#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu])) 15#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))
16#define __get_cpu_var(var) per_cpu(var, smp_processor_id()) 16#define __get_cpu_var(var) per_cpu(var, smp_processor_id())
17#define __raw_get_cpu_var(var) per_cpu(var, raw_smp_processor_id())
17 18
18/* A macro to avoid #include hell... */ 19/* A macro to avoid #include hell... */
19#define percpu_modcopy(pcpudst, src, size) \ 20#define percpu_modcopy(pcpudst, src, size) \
@@ -30,6 +31,7 @@ do { \
30 31
31#define per_cpu(var, cpu) (*((void)(cpu), &per_cpu__##var)) 32#define per_cpu(var, cpu) (*((void)(cpu), &per_cpu__##var))
32#define __get_cpu_var(var) per_cpu__##var 33#define __get_cpu_var(var) per_cpu__##var
34#define __raw_get_cpu_var(var) per_cpu__##var
33 35
34#endif /* SMP */ 36#endif /* SMP */
35 37
diff --git a/include/asm-generic/rtc.h b/include/asm-generic/rtc.h
index cef08db34ada..4087037a4225 100644
--- a/include/asm-generic/rtc.h
+++ b/include/asm-generic/rtc.h
@@ -114,6 +114,7 @@ static inline unsigned int get_rtc_time(struct rtc_time *time)
114/* Set the current date and time in the real time clock. */ 114/* Set the current date and time in the real time clock. */
115static inline int set_rtc_time(struct rtc_time *time) 115static inline int set_rtc_time(struct rtc_time *time)
116{ 116{
117 unsigned long flags;
117 unsigned char mon, day, hrs, min, sec; 118 unsigned char mon, day, hrs, min, sec;
118 unsigned char save_control, save_freq_select; 119 unsigned char save_control, save_freq_select;
119 unsigned int yrs; 120 unsigned int yrs;
@@ -131,7 +132,7 @@ static inline int set_rtc_time(struct rtc_time *time)
131 if (yrs > 255) /* They are unsigned */ 132 if (yrs > 255) /* They are unsigned */
132 return -EINVAL; 133 return -EINVAL;
133 134
134 spin_lock_irq(&rtc_lock); 135 spin_lock_irqsave(&rtc_lock, flags);
135#ifdef CONFIG_MACH_DECSTATION 136#ifdef CONFIG_MACH_DECSTATION
136 real_yrs = yrs; 137 real_yrs = yrs;
137 leap_yr = ((!((yrs + 1900) % 4) && ((yrs + 1900) % 100)) || 138 leap_yr = ((!((yrs + 1900) % 4) && ((yrs + 1900) % 100)) ||
@@ -152,7 +153,7 @@ static inline int set_rtc_time(struct rtc_time *time)
152 * whether the chip is in binary mode or not. 153 * whether the chip is in binary mode or not.
153 */ 154 */
154 if (yrs > 169) { 155 if (yrs > 169) {
155 spin_unlock_irq(&rtc_lock); 156 spin_unlock_irqrestore(&rtc_lock, flags);
156 return -EINVAL; 157 return -EINVAL;
157 } 158 }
158 159
@@ -187,7 +188,7 @@ static inline int set_rtc_time(struct rtc_time *time)
187 CMOS_WRITE(save_control, RTC_CONTROL); 188 CMOS_WRITE(save_control, RTC_CONTROL);
188 CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT); 189 CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT);
189 190
190 spin_unlock_irq(&rtc_lock); 191 spin_unlock_irqrestore(&rtc_lock, flags);
191 192
192 return 0; 193 return 0;
193} 194}
diff --git a/include/asm-h8300/irq.h b/include/asm-h8300/irq.h
index 73065f5bda0e..42a3ac424a9e 100644
--- a/include/asm-h8300/irq.h
+++ b/include/asm-h8300/irq.h
@@ -63,8 +63,4 @@ extern void enable_irq(unsigned int);
63extern void disable_irq(unsigned int); 63extern void disable_irq(unsigned int);
64#define disable_irq_nosync(x) disable_irq(x) 64#define disable_irq_nosync(x) disable_irq(x)
65 65
66struct irqaction;
67struct pt_regs;
68int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *);
69
70#endif /* _H8300_IRQ_H_ */ 66#endif /* _H8300_IRQ_H_ */
diff --git a/include/asm-i386/alternative.h b/include/asm-i386/alternative.h
index e201decea0c9..d79e9ee10fd7 100644
--- a/include/asm-i386/alternative.h
+++ b/include/asm-i386/alternative.h
@@ -3,6 +3,8 @@
3 3
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5 5
6#include <asm/types.h>
7
6struct alt_instr { 8struct alt_instr {
7 u8 *instr; /* original instruction */ 9 u8 *instr; /* original instruction */
8 u8 *replacement; 10 u8 *replacement;
diff --git a/include/asm-i386/apic.h b/include/asm-i386/apic.h
index cc9b940fb7e8..1d8362cb2c5d 100644
--- a/include/asm-i386/apic.h
+++ b/include/asm-i386/apic.h
@@ -138,8 +138,6 @@ void switch_ipi_to_APIC_timer(void *cpumask);
138 138
139extern int timer_over_8254; 139extern int timer_over_8254;
140 140
141extern int modern_apic(void);
142
143#else /* !CONFIG_X86_LOCAL_APIC */ 141#else /* !CONFIG_X86_LOCAL_APIC */
144static inline void lapic_shutdown(void) { } 142static inline void lapic_shutdown(void) { }
145 143
diff --git a/include/asm-i386/apicdef.h b/include/asm-i386/apicdef.h
index 5e4a35af2921..9f6995341fdc 100644
--- a/include/asm-i386/apicdef.h
+++ b/include/asm-i386/apicdef.h
@@ -121,7 +121,6 @@
121 */ 121 */
122#define u32 unsigned int 122#define u32 unsigned int
123 123
124#define lapic ((volatile struct local_apic *)APIC_BASE)
125 124
126struct local_apic { 125struct local_apic {
127 126
diff --git a/include/asm-i386/cpufeature.h b/include/asm-i386/cpufeature.h
index b44bfc6239cb..3ecedbafa8ce 100644
--- a/include/asm-i386/cpufeature.h
+++ b/include/asm-i386/cpufeature.h
@@ -88,6 +88,12 @@
88#define X86_FEATURE_XSTORE_EN (5*32+ 3) /* on-CPU RNG enabled */ 88#define X86_FEATURE_XSTORE_EN (5*32+ 3) /* on-CPU RNG enabled */
89#define X86_FEATURE_XCRYPT (5*32+ 6) /* on-CPU crypto (xcrypt insn) */ 89#define X86_FEATURE_XCRYPT (5*32+ 6) /* on-CPU crypto (xcrypt insn) */
90#define X86_FEATURE_XCRYPT_EN (5*32+ 7) /* on-CPU crypto enabled */ 90#define X86_FEATURE_XCRYPT_EN (5*32+ 7) /* on-CPU crypto enabled */
91#define X86_FEATURE_ACE2 (5*32+ 8) /* Advanced Cryptography Engine v2 */
92#define X86_FEATURE_ACE2_EN (5*32+ 9) /* ACE v2 enabled */
93#define X86_FEATURE_PHE (5*32+ 10) /* PadLock Hash Engine */
94#define X86_FEATURE_PHE_EN (5*32+ 11) /* PHE enabled */
95#define X86_FEATURE_PMM (5*32+ 12) /* PadLock Montgomery Multiplier */
96#define X86_FEATURE_PMM_EN (5*32+ 13) /* PMM enabled */
91 97
92/* More extended AMD flags: CPUID level 0x80000001, ecx, word 6 */ 98/* More extended AMD flags: CPUID level 0x80000001, ecx, word 6 */
93#define X86_FEATURE_LAHF_LM (6*32+ 0) /* LAHF/SAHF in long mode */ 99#define X86_FEATURE_LAHF_LM (6*32+ 0) /* LAHF/SAHF in long mode */
@@ -121,6 +127,12 @@
121#define cpu_has_xstore_enabled boot_cpu_has(X86_FEATURE_XSTORE_EN) 127#define cpu_has_xstore_enabled boot_cpu_has(X86_FEATURE_XSTORE_EN)
122#define cpu_has_xcrypt boot_cpu_has(X86_FEATURE_XCRYPT) 128#define cpu_has_xcrypt boot_cpu_has(X86_FEATURE_XCRYPT)
123#define cpu_has_xcrypt_enabled boot_cpu_has(X86_FEATURE_XCRYPT_EN) 129#define cpu_has_xcrypt_enabled boot_cpu_has(X86_FEATURE_XCRYPT_EN)
130#define cpu_has_ace2 boot_cpu_has(X86_FEATURE_ACE2)
131#define cpu_has_ace2_enabled boot_cpu_has(X86_FEATURE_ACE2_EN)
132#define cpu_has_phe boot_cpu_has(X86_FEATURE_PHE)
133#define cpu_has_phe_enabled boot_cpu_has(X86_FEATURE_PHE_EN)
134#define cpu_has_pmm boot_cpu_has(X86_FEATURE_PMM)
135#define cpu_has_pmm_enabled boot_cpu_has(X86_FEATURE_PMM_EN)
124 136
125#endif /* __ASM_I386_CPUFEATURE_H */ 137#endif /* __ASM_I386_CPUFEATURE_H */
126 138
diff --git a/include/asm-i386/floppy.h b/include/asm-i386/floppy.h
index 03403045c182..9cb2793eb211 100644
--- a/include/asm-i386/floppy.h
+++ b/include/asm-i386/floppy.h
@@ -147,9 +147,8 @@ static int fd_request_irq(void)
147 return request_irq(FLOPPY_IRQ, floppy_hardint,SA_INTERRUPT, 147 return request_irq(FLOPPY_IRQ, floppy_hardint,SA_INTERRUPT,
148 "floppy", NULL); 148 "floppy", NULL);
149 else 149 else
150 return request_irq(FLOPPY_IRQ, floppy_interrupt, 150 return request_irq(FLOPPY_IRQ, floppy_interrupt, SA_INTERRUPT,
151 SA_INTERRUPT|SA_SAMPLE_RANDOM, 151 "floppy", NULL);
152 "floppy", NULL);
153 152
154} 153}
155 154
diff --git a/include/asm-i386/mach-default/setup_arch_pre.h b/include/asm-i386/mach-default/setup_arch.h
index fb42099e7bd4..fb42099e7bd4 100644
--- a/include/asm-i386/mach-default/setup_arch_pre.h
+++ b/include/asm-i386/mach-default/setup_arch.h
diff --git a/include/asm-i386/mach-default/setup_arch_post.h b/include/asm-i386/mach-default/setup_arch_post.h
deleted file mode 100644
index 2fc4888721f6..000000000000
--- a/include/asm-i386/mach-default/setup_arch_post.h
+++ /dev/null
@@ -1,40 +0,0 @@
1/**
2 * machine_specific_memory_setup - Hook for machine specific memory setup.
3 *
4 * Description:
5 * This is included late in kernel/setup.c so that it can make
6 * use of all of the static functions.
7 **/
8
9static char * __init machine_specific_memory_setup(void)
10{
11 char *who;
12
13
14 who = "BIOS-e820";
15
16 /*
17 * Try to copy the BIOS-supplied E820-map.
18 *
19 * Otherwise fake a memory map; one section from 0k->640k,
20 * the next section from 1mb->appropriate_mem_k
21 */
22 sanitize_e820_map(E820_MAP, &E820_MAP_NR);
23 if (copy_e820_map(E820_MAP, E820_MAP_NR) < 0) {
24 unsigned long mem_size;
25
26 /* compare results from other methods and take the greater */
27 if (ALT_MEM_K < EXT_MEM_K) {
28 mem_size = EXT_MEM_K;
29 who = "BIOS-88";
30 } else {
31 mem_size = ALT_MEM_K;
32 who = "BIOS-e801";
33 }
34
35 e820.nr_map = 0;
36 add_memory_region(0, LOWMEMSIZE(), E820_RAM);
37 add_memory_region(HIGH_MEMORY, mem_size << 10, E820_RAM);
38 }
39 return who;
40}
diff --git a/include/asm-i386/mach-visws/setup_arch_pre.h b/include/asm-i386/mach-visws/setup_arch.h
index b92d6d9a4d3c..b92d6d9a4d3c 100644
--- a/include/asm-i386/mach-visws/setup_arch_pre.h
+++ b/include/asm-i386/mach-visws/setup_arch.h
diff --git a/include/asm-i386/mach-visws/setup_arch_post.h b/include/asm-i386/mach-visws/setup_arch_post.h
deleted file mode 100644
index cdbd895a54b1..000000000000
--- a/include/asm-i386/mach-visws/setup_arch_post.h
+++ /dev/null
@@ -1,49 +0,0 @@
1/* Hook for machine specific memory setup.
2 *
3 * This is included late in kernel/setup.c so that it can make use of all of
4 * the static functions. */
5
6#define MB (1024 * 1024)
7
8unsigned long sgivwfb_mem_phys;
9unsigned long sgivwfb_mem_size;
10
11long long mem_size __initdata = 0;
12
13static char * __init machine_specific_memory_setup(void)
14{
15 long long gfx_mem_size = 8 * MB;
16
17 mem_size = ALT_MEM_K;
18
19 if (!mem_size) {
20 printk(KERN_WARNING "Bootloader didn't set memory size, upgrade it !\n");
21 mem_size = 128 * MB;
22 }
23
24 /*
25 * this hardcodes the graphics memory to 8 MB
26 * it really should be sized dynamically (or at least
27 * set as a boot param)
28 */
29 if (!sgivwfb_mem_size) {
30 printk(KERN_WARNING "Defaulting to 8 MB framebuffer size\n");
31 sgivwfb_mem_size = 8 * MB;
32 }
33
34 /*
35 * Trim to nearest MB
36 */
37 sgivwfb_mem_size &= ~((1 << 20) - 1);
38 sgivwfb_mem_phys = mem_size - gfx_mem_size;
39
40 add_memory_region(0, LOWMEMSIZE(), E820_RAM);
41 add_memory_region(HIGH_MEMORY, mem_size - sgivwfb_mem_size - HIGH_MEMORY, E820_RAM);
42 add_memory_region(sgivwfb_mem_phys, sgivwfb_mem_size, E820_RESERVED);
43
44 return "PROM";
45
46 /* Remove gcc warnings */
47 (void) sanitize_e820_map(NULL, NULL);
48 (void) copy_e820_map(NULL, 0);
49}
diff --git a/include/asm-i386/mach-voyager/setup_arch_pre.h b/include/asm-i386/mach-voyager/setup_arch.h
index 48f7e6ff49a5..84d01ad33459 100644
--- a/include/asm-i386/mach-voyager/setup_arch_pre.h
+++ b/include/asm-i386/mach-voyager/setup_arch.h
@@ -3,7 +3,7 @@
3 3
4/* Hook to call BIOS initialisation function */ 4/* Hook to call BIOS initialisation function */
5 5
6/* for voyager, pass the voyager BIOS/SUS info area to the detection 6/* for voyager, pass the voyager BIOS/SUS info area to the detection
7 * routines */ 7 * routines */
8 8
9#define ARCH_SETUP voyager_detect(VOYAGER_BIOS_INFO); 9#define ARCH_SETUP voyager_detect(VOYAGER_BIOS_INFO);
diff --git a/include/asm-i386/mach-voyager/setup_arch_post.h b/include/asm-i386/mach-voyager/setup_arch_post.h
deleted file mode 100644
index f6f6c2cbc75c..000000000000
--- a/include/asm-i386/mach-voyager/setup_arch_post.h
+++ /dev/null
@@ -1,73 +0,0 @@
1/* Hook for machine specific memory setup.
2 *
3 * This is included late in kernel/setup.c so that it can make use of all of
4 * the static functions. */
5
6static char * __init machine_specific_memory_setup(void)
7{
8 char *who;
9
10 who = "NOT VOYAGER";
11
12 if(voyager_level == 5) {
13 __u32 addr, length;
14 int i;
15
16 who = "Voyager-SUS";
17
18 e820.nr_map = 0;
19 for(i=0; voyager_memory_detect(i, &addr, &length); i++) {
20 add_memory_region(addr, length, E820_RAM);
21 }
22 return who;
23 } else if(voyager_level == 4) {
24 __u32 tom;
25 __u16 catbase = inb(VOYAGER_SSPB_RELOCATION_PORT)<<8;
26 /* select the DINO config space */
27 outb(VOYAGER_DINO, VOYAGER_CAT_CONFIG_PORT);
28 /* Read DINO top of memory register */
29 tom = ((inb(catbase + 0x4) & 0xf0) << 16)
30 + ((inb(catbase + 0x5) & 0x7f) << 24);
31
32 if(inb(catbase) != VOYAGER_DINO) {
33 printk(KERN_ERR "Voyager: Failed to get DINO for L4, setting tom to EXT_MEM_K\n");
34 tom = (EXT_MEM_K)<<10;
35 }
36 who = "Voyager-TOM";
37 add_memory_region(0, 0x9f000, E820_RAM);
38 /* map from 1M to top of memory */
39 add_memory_region(1*1024*1024, tom - 1*1024*1024, E820_RAM);
40 /* FIXME: Should check the ASICs to see if I need to
41 * take out the 8M window. Just do it at the moment
42 * */
43 add_memory_region(8*1024*1024, 8*1024*1024, E820_RESERVED);
44 return who;
45 }
46
47 who = "BIOS-e820";
48
49 /*
50 * Try to copy the BIOS-supplied E820-map.
51 *
52 * Otherwise fake a memory map; one section from 0k->640k,
53 * the next section from 1mb->appropriate_mem_k
54 */
55 sanitize_e820_map(E820_MAP, &E820_MAP_NR);
56 if (copy_e820_map(E820_MAP, E820_MAP_NR) < 0) {
57 unsigned long mem_size;
58
59 /* compare results from other methods and take the greater */
60 if (ALT_MEM_K < EXT_MEM_K) {
61 mem_size = EXT_MEM_K;
62 who = "BIOS-88";
63 } else {
64 mem_size = ALT_MEM_K;
65 who = "BIOS-e801";
66 }
67
68 e820.nr_map = 0;
69 add_memory_region(0, LOWMEMSIZE(), E820_RAM);
70 add_memory_region(HIGH_MEMORY, mem_size << 10, E820_RAM);
71 }
72 return who;
73}
diff --git a/include/asm-i386/mce.h b/include/asm-i386/mce.h
new file mode 100644
index 000000000000..7cc1a973bf00
--- /dev/null
+++ b/include/asm-i386/mce.h
@@ -0,0 +1,5 @@
1#ifdef CONFIG_X86_MCE
2extern void mcheck_init(struct cpuinfo_x86 *c);
3#else
4#define mcheck_init(c) do {} while(0)
5#endif
diff --git a/include/asm-i386/msi.h b/include/asm-i386/msi.h
index f041d4495faf..b11c4b7dfaef 100644
--- a/include/asm-i386/msi.h
+++ b/include/asm-i386/msi.h
@@ -9,7 +9,15 @@
9#include <asm/desc.h> 9#include <asm/desc.h>
10#include <mach_apic.h> 10#include <mach_apic.h>
11 11
12#define LAST_DEVICE_VECTOR 232 12#define LAST_DEVICE_VECTOR (FIRST_SYSTEM_VECTOR - 1)
13#define MSI_TARGET_CPU_SHIFT 12 13#define MSI_TARGET_CPU_SHIFT 12
14 14
15extern struct msi_ops msi_apic_ops;
16
17static inline int msi_arch_init(void)
18{
19 msi_register(&msi_apic_ops);
20 return 0;
21}
22
15#endif /* ASM_MSI_H */ 23#endif /* ASM_MSI_H */
diff --git a/include/asm-i386/mtrr.h b/include/asm-i386/mtrr.h
index 5a46de08efea..07f063ae26ea 100644
--- a/include/asm-i386/mtrr.h
+++ b/include/asm-i386/mtrr.h
@@ -76,6 +76,8 @@ extern int mtrr_add_page (unsigned long base, unsigned long size,
76extern int mtrr_del (int reg, unsigned long base, unsigned long size); 76extern int mtrr_del (int reg, unsigned long base, unsigned long size);
77extern int mtrr_del_page (int reg, unsigned long base, unsigned long size); 77extern int mtrr_del_page (int reg, unsigned long base, unsigned long size);
78extern void mtrr_centaur_report_mcr(int mcr, u32 lo, u32 hi); 78extern void mtrr_centaur_report_mcr(int mcr, u32 lo, u32 hi);
79extern void mtrr_ap_init(void);
80extern void mtrr_bp_init(void);
79# else 81# else
80static __inline__ int mtrr_add (unsigned long base, unsigned long size, 82static __inline__ int mtrr_add (unsigned long base, unsigned long size,
81 unsigned int type, char increment) 83 unsigned int type, char increment)
@@ -100,6 +102,8 @@ static __inline__ int mtrr_del_page (int reg, unsigned long base,
100 102
101static __inline__ void mtrr_centaur_report_mcr(int mcr, u32 lo, u32 hi) {;} 103static __inline__ void mtrr_centaur_report_mcr(int mcr, u32 lo, u32 hi) {;}
102 104
105#define mtrr_ap_init() do {} while (0)
106#define mtrr_bp_init() do {} while (0)
103# endif 107# endif
104 108
105#endif 109#endif
diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h
index 4df3818e4122..0c83cf12eec9 100644
--- a/include/asm-i386/processor.h
+++ b/include/asm-i386/processor.h
@@ -728,18 +728,4 @@ extern unsigned long boot_option_idle_override;
728extern void enable_sep_cpu(void); 728extern void enable_sep_cpu(void);
729extern int sysenter_setup(void); 729extern int sysenter_setup(void);
730 730
731#ifdef CONFIG_MTRR
732extern void mtrr_ap_init(void);
733extern void mtrr_bp_init(void);
734#else
735#define mtrr_ap_init() do {} while (0)
736#define mtrr_bp_init() do {} while (0)
737#endif
738
739#ifdef CONFIG_X86_MCE
740extern void mcheck_init(struct cpuinfo_x86 *c);
741#else
742#define mcheck_init(c) do {} while(0)
743#endif
744
745#endif /* __ASM_I386_PROCESSOR_H */ 731#endif /* __ASM_I386_PROCESSOR_H */
diff --git a/include/asm-i386/setup.h b/include/asm-i386/setup.h
index ee941457b55d..f737e423029e 100644
--- a/include/asm-i386/setup.h
+++ b/include/asm-i386/setup.h
@@ -59,6 +59,21 @@ extern unsigned char boot_params[PARAM_SIZE];
59#define EDD_MBR_SIGNATURE ((unsigned int *) (PARAM+EDD_MBR_SIG_BUF)) 59#define EDD_MBR_SIGNATURE ((unsigned int *) (PARAM+EDD_MBR_SIG_BUF))
60#define EDD_BUF ((struct edd_info *) (PARAM+EDDBUF)) 60#define EDD_BUF ((struct edd_info *) (PARAM+EDDBUF))
61 61
62/*
63 * Do NOT EVER look at the BIOS memory size location.
64 * It does not work on many machines.
65 */
66#define LOWMEMSIZE() (0x9f000)
67
68struct e820entry;
69
70char * __init machine_specific_memory_setup(void);
71
72int __init copy_e820_map(struct e820entry * biosmap, int nr_map);
73int __init sanitize_e820_map(struct e820entry * biosmap, char * pnr_map);
74void __init add_memory_region(unsigned long long start,
75 unsigned long long size, int type);
76
62#endif /* __ASSEMBLY__ */ 77#endif /* __ASSEMBLY__ */
63 78
64#endif /* _i386_SETUP_H */ 79#endif /* _i386_SETUP_H */
diff --git a/include/asm-i386/uaccess.h b/include/asm-i386/uaccess.h
index 1ec65523ea5e..54d905ebc63d 100644
--- a/include/asm-i386/uaccess.h
+++ b/include/asm-i386/uaccess.h
@@ -58,7 +58,7 @@ extern struct movsl_mask {
58 __chk_user_ptr(addr); \ 58 __chk_user_ptr(addr); \
59 asm("addl %3,%1 ; sbbl %0,%0; cmpl %1,%4; sbbl $0,%0" \ 59 asm("addl %3,%1 ; sbbl %0,%0; cmpl %1,%4; sbbl $0,%0" \
60 :"=&r" (flag), "=r" (sum) \ 60 :"=&r" (flag), "=r" (sum) \
61 :"1" (addr),"g" ((int)(size)),"g" (current_thread_info()->addr_limit.seg)); \ 61 :"1" (addr),"g" ((int)(size)),"rm" (current_thread_info()->addr_limit.seg)); \
62 flag; }) 62 flag; })
63 63
64/** 64/**
@@ -390,6 +390,12 @@ unsigned long __must_check __copy_to_user_ll(void __user *to,
390 const void *from, unsigned long n); 390 const void *from, unsigned long n);
391unsigned long __must_check __copy_from_user_ll(void *to, 391unsigned long __must_check __copy_from_user_ll(void *to,
392 const void __user *from, unsigned long n); 392 const void __user *from, unsigned long n);
393unsigned long __must_check __copy_from_user_ll_nozero(void *to,
394 const void __user *from, unsigned long n);
395unsigned long __must_check __copy_from_user_ll_nocache(void *to,
396 const void __user *from, unsigned long n);
397unsigned long __must_check __copy_from_user_ll_nocache_nozero(void *to,
398 const void __user *from, unsigned long n);
393 399
394/* 400/*
395 * Here we special-case 1, 2 and 4-byte copy_*_user invocations. On a fault 401 * Here we special-case 1, 2 and 4-byte copy_*_user invocations. On a fault
@@ -456,10 +462,41 @@ __copy_to_user(void __user *to, const void *from, unsigned long n)
456 * 462 *
457 * If some data could not be copied, this function will pad the copied 463 * If some data could not be copied, this function will pad the copied
458 * data to the requested size using zero bytes. 464 * data to the requested size using zero bytes.
465 *
466 * An alternate version - __copy_from_user_inatomic() - may be called from
467 * atomic context and will fail rather than sleep. In this case the
468 * uncopied bytes will *NOT* be padded with zeros. See fs/filemap.h
469 * for explanation of why this is needed.
459 */ 470 */
460static __always_inline unsigned long 471static __always_inline unsigned long
461__copy_from_user_inatomic(void *to, const void __user *from, unsigned long n) 472__copy_from_user_inatomic(void *to, const void __user *from, unsigned long n)
462{ 473{
474 /* Avoid zeroing the tail if the copy fails..
475 * If 'n' is constant and 1, 2, or 4, we do still zero on a failure,
476 * but as the zeroing behaviour is only significant when n is not
477 * constant, that shouldn't be a problem.
478 */
479 if (__builtin_constant_p(n)) {
480 unsigned long ret;
481
482 switch (n) {
483 case 1:
484 __get_user_size(*(u8 *)to, from, 1, ret, 1);
485 return ret;
486 case 2:
487 __get_user_size(*(u16 *)to, from, 2, ret, 2);
488 return ret;
489 case 4:
490 __get_user_size(*(u32 *)to, from, 4, ret, 4);
491 return ret;
492 }
493 }
494 return __copy_from_user_ll_nozero(to, from, n);
495}
496static __always_inline unsigned long
497__copy_from_user(void *to, const void __user *from, unsigned long n)
498{
499 might_sleep();
463 if (__builtin_constant_p(n)) { 500 if (__builtin_constant_p(n)) {
464 unsigned long ret; 501 unsigned long ret;
465 502
@@ -478,12 +515,36 @@ __copy_from_user_inatomic(void *to, const void __user *from, unsigned long n)
478 return __copy_from_user_ll(to, from, n); 515 return __copy_from_user_ll(to, from, n);
479} 516}
480 517
518#define ARCH_HAS_NOCACHE_UACCESS
519
520static __always_inline unsigned long __copy_from_user_nocache(void *to,
521 const void __user *from, unsigned long n)
522{
523 might_sleep();
524 if (__builtin_constant_p(n)) {
525 unsigned long ret;
526
527 switch (n) {
528 case 1:
529 __get_user_size(*(u8 *)to, from, 1, ret, 1);
530 return ret;
531 case 2:
532 __get_user_size(*(u16 *)to, from, 2, ret, 2);
533 return ret;
534 case 4:
535 __get_user_size(*(u32 *)to, from, 4, ret, 4);
536 return ret;
537 }
538 }
539 return __copy_from_user_ll_nocache(to, from, n);
540}
541
481static __always_inline unsigned long 542static __always_inline unsigned long
482__copy_from_user(void *to, const void __user *from, unsigned long n) 543__copy_from_user_inatomic_nocache(void *to, const void __user *from, unsigned long n)
483{ 544{
484 might_sleep(); 545 return __copy_from_user_ll_nocache_nozero(to, from, n);
485 return __copy_from_user_inatomic(to, from, n);
486} 546}
547
487unsigned long __must_check copy_to_user(void __user *to, 548unsigned long __must_check copy_to_user(void __user *to,
488 const void *from, unsigned long n); 549 const void *from, unsigned long n);
489unsigned long __must_check copy_from_user(void *to, 550unsigned long __must_check copy_from_user(void *to,
diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h
index de2ccc149e34..fc1c8ddae149 100644
--- a/include/asm-i386/unistd.h
+++ b/include/asm-i386/unistd.h
@@ -322,10 +322,11 @@
322#define __NR_sync_file_range 314 322#define __NR_sync_file_range 314
323#define __NR_tee 315 323#define __NR_tee 315
324#define __NR_vmsplice 316 324#define __NR_vmsplice 316
325#define __NR_move_pages 317
325 326
326#ifdef __KERNEL__ 327#ifdef __KERNEL__
327 328
328#define NR_syscalls 317 329#define NR_syscalls 318
329 330
330/* 331/*
331 * user-visible error numbers are in the range -1 - -128: see 332 * user-visible error numbers are in the range -1 - -128: see
diff --git a/include/asm-i386/vga.h b/include/asm-i386/vga.h
index ef0c0e50cc95..0ecf68ac03aa 100644
--- a/include/asm-i386/vga.h
+++ b/include/asm-i386/vga.h
@@ -12,7 +12,7 @@
12 * access the videoram directly without any black magic. 12 * access the videoram directly without any black magic.
13 */ 13 */
14 14
15#define VGA_MAP_MEM(x) (unsigned long)phys_to_virt(x) 15#define VGA_MAP_MEM(x,s) (unsigned long)phys_to_virt(x)
16 16
17#define vga_readb(x) (*(x)) 17#define vga_readb(x) (*(x))
18#define vga_writeb(x,y) (*(y) = (x)) 18#define vga_writeb(x,y) (*(y) = (x))
diff --git a/include/asm-ia64/hw_irq.h b/include/asm-ia64/hw_irq.h
index 0cf119b42f7d..ea8b8c407ab4 100644
--- a/include/asm-ia64/hw_irq.h
+++ b/include/asm-ia64/hw_irq.h
@@ -47,9 +47,19 @@ typedef u8 ia64_vector;
47#define IA64_CMC_VECTOR 0x1f /* corrected machine-check interrupt vector */ 47#define IA64_CMC_VECTOR 0x1f /* corrected machine-check interrupt vector */
48/* 48/*
49 * Vectors 0x20-0x2f are reserved for legacy ISA IRQs. 49 * Vectors 0x20-0x2f are reserved for legacy ISA IRQs.
50 * Use vectors 0x30-0xe7 as the default device vector range for ia64.
51 * Platforms may choose to reduce this range in platform_irq_setup, but the
52 * platform range must fall within
53 * [IA64_DEF_FIRST_DEVICE_VECTOR..IA64_DEF_LAST_DEVICE_VECTOR]
50 */ 54 */
51#define IA64_FIRST_DEVICE_VECTOR 0x30 55extern int ia64_first_device_vector;
52#define IA64_LAST_DEVICE_VECTOR 0xe7 56extern int ia64_last_device_vector;
57
58#define IA64_DEF_FIRST_DEVICE_VECTOR 0x30
59#define IA64_DEF_LAST_DEVICE_VECTOR 0xe7
60#define IA64_FIRST_DEVICE_VECTOR ia64_first_device_vector
61#define IA64_LAST_DEVICE_VECTOR ia64_last_device_vector
62#define IA64_MAX_DEVICE_VECTORS (IA64_DEF_LAST_DEVICE_VECTOR - IA64_DEF_FIRST_DEVICE_VECTOR + 1)
53#define IA64_NUM_DEVICE_VECTORS (IA64_LAST_DEVICE_VECTOR - IA64_FIRST_DEVICE_VECTOR + 1) 63#define IA64_NUM_DEVICE_VECTORS (IA64_LAST_DEVICE_VECTOR - IA64_FIRST_DEVICE_VECTOR + 1)
54 64
55#define IA64_MCA_RENDEZ_VECTOR 0xe8 /* MCA rendez interrupt */ 65#define IA64_MCA_RENDEZ_VECTOR 0xe8 /* MCA rendez interrupt */
@@ -83,6 +93,7 @@ extern struct hw_interrupt_type irq_type_ia64_lsapic; /* CPU-internal interrupt
83 93
84extern int assign_irq_vector (int irq); /* allocate a free vector */ 94extern int assign_irq_vector (int irq); /* allocate a free vector */
85extern void free_irq_vector (int vector); 95extern void free_irq_vector (int vector);
96extern int reserve_irq_vector (int vector);
86extern void ia64_send_ipi (int cpu, int vector, int delivery_mode, int redirect); 97extern void ia64_send_ipi (int cpu, int vector, int delivery_mode, int redirect);
87extern void register_percpu_irq (ia64_vector vec, struct irqaction *action); 98extern void register_percpu_irq (ia64_vector vec, struct irqaction *action);
88 99
diff --git a/include/asm-ia64/io.h b/include/asm-ia64/io.h
index c2e3742108bb..781ee2c7e8c3 100644
--- a/include/asm-ia64/io.h
+++ b/include/asm-ia64/io.h
@@ -88,6 +88,7 @@ phys_to_virt (unsigned long address)
88} 88}
89 89
90#define ARCH_HAS_VALID_PHYS_ADDR_RANGE 90#define ARCH_HAS_VALID_PHYS_ADDR_RANGE
91extern u64 kern_mem_attribute (unsigned long phys_addr, unsigned long size);
91extern int valid_phys_addr_range (unsigned long addr, size_t count); /* efi.c */ 92extern int valid_phys_addr_range (unsigned long addr, size_t count); /* efi.c */
92extern int valid_mmap_phys_addr_range (unsigned long addr, size_t count); 93extern int valid_mmap_phys_addr_range (unsigned long addr, size_t count);
93 94
diff --git a/include/asm-ia64/machvec.h b/include/asm-ia64/machvec.h
index 0df72a134c8b..15b545a897a4 100644
--- a/include/asm-ia64/machvec.h
+++ b/include/asm-ia64/machvec.h
@@ -75,6 +75,7 @@ typedef unsigned char ia64_mv_readb_relaxed_t (const volatile void __iomem *);
75typedef unsigned short ia64_mv_readw_relaxed_t (const volatile void __iomem *); 75typedef unsigned short ia64_mv_readw_relaxed_t (const volatile void __iomem *);
76typedef unsigned int ia64_mv_readl_relaxed_t (const volatile void __iomem *); 76typedef unsigned int ia64_mv_readl_relaxed_t (const volatile void __iomem *);
77typedef unsigned long ia64_mv_readq_relaxed_t (const volatile void __iomem *); 77typedef unsigned long ia64_mv_readq_relaxed_t (const volatile void __iomem *);
78typedef int ia64_mv_msi_init_t (void);
78 79
79static inline void 80static inline void
80machvec_noop (void) 81machvec_noop (void)
@@ -153,6 +154,7 @@ extern void machvec_tlb_migrate_finish (struct mm_struct *);
153# define platform_readl_relaxed ia64_mv.readl_relaxed 154# define platform_readl_relaxed ia64_mv.readl_relaxed
154# define platform_readq_relaxed ia64_mv.readq_relaxed 155# define platform_readq_relaxed ia64_mv.readq_relaxed
155# define platform_migrate ia64_mv.migrate 156# define platform_migrate ia64_mv.migrate
157# define platform_msi_init ia64_mv.msi_init
156# endif 158# endif
157 159
158/* __attribute__((__aligned__(16))) is required to make size of the 160/* __attribute__((__aligned__(16))) is required to make size of the
@@ -202,6 +204,7 @@ struct ia64_machine_vector {
202 ia64_mv_readl_relaxed_t *readl_relaxed; 204 ia64_mv_readl_relaxed_t *readl_relaxed;
203 ia64_mv_readq_relaxed_t *readq_relaxed; 205 ia64_mv_readq_relaxed_t *readq_relaxed;
204 ia64_mv_migrate_t *migrate; 206 ia64_mv_migrate_t *migrate;
207 ia64_mv_msi_init_t *msi_init;
205} __attribute__((__aligned__(16))); /* align attrib? see above comment */ 208} __attribute__((__aligned__(16))); /* align attrib? see above comment */
206 209
207#define MACHVEC_INIT(name) \ 210#define MACHVEC_INIT(name) \
@@ -247,6 +250,7 @@ struct ia64_machine_vector {
247 platform_readl_relaxed, \ 250 platform_readl_relaxed, \
248 platform_readq_relaxed, \ 251 platform_readq_relaxed, \
249 platform_migrate, \ 252 platform_migrate, \
253 platform_msi_init, \
250} 254}
251 255
252extern struct ia64_machine_vector ia64_mv; 256extern struct ia64_machine_vector ia64_mv;
@@ -400,5 +404,8 @@ extern int ia64_pci_legacy_write(struct pci_bus *bus, u16 port, u32 val, u8 size
400#ifndef platform_migrate 404#ifndef platform_migrate
401# define platform_migrate machvec_noop_task 405# define platform_migrate machvec_noop_task
402#endif 406#endif
407#ifndef platform_msi_init
408# define platform_msi_init ((ia64_mv_msi_init_t*)NULL)
409#endif
403 410
404#endif /* _ASM_IA64_MACHVEC_H */ 411#endif /* _ASM_IA64_MACHVEC_H */
diff --git a/include/asm-ia64/machvec_sn2.h b/include/asm-ia64/machvec_sn2.h
index da1d43755afe..cf724dc79d8c 100644
--- a/include/asm-ia64/machvec_sn2.h
+++ b/include/asm-ia64/machvec_sn2.h
@@ -67,6 +67,8 @@ extern ia64_mv_dma_sync_sg_for_device sn_dma_sync_sg_for_device;
67extern ia64_mv_dma_mapping_error sn_dma_mapping_error; 67extern ia64_mv_dma_mapping_error sn_dma_mapping_error;
68extern ia64_mv_dma_supported sn_dma_supported; 68extern ia64_mv_dma_supported sn_dma_supported;
69extern ia64_mv_migrate_t sn_migrate; 69extern ia64_mv_migrate_t sn_migrate;
70extern ia64_mv_msi_init_t sn_msi_init;
71
70 72
71/* 73/*
72 * This stuff has dual use! 74 * This stuff has dual use!
@@ -117,6 +119,11 @@ extern ia64_mv_migrate_t sn_migrate;
117#define platform_dma_mapping_error sn_dma_mapping_error 119#define platform_dma_mapping_error sn_dma_mapping_error
118#define platform_dma_supported sn_dma_supported 120#define platform_dma_supported sn_dma_supported
119#define platform_migrate sn_migrate 121#define platform_migrate sn_migrate
122#ifdef CONFIG_PCI_MSI
123#define platform_msi_init sn_msi_init
124#else
125#define platform_msi_init ((ia64_mv_msi_init_t*)NULL)
126#endif
120 127
121#include <asm/sn/io.h> 128#include <asm/sn/io.h>
122 129
diff --git a/include/asm-ia64/mca.h b/include/asm-ia64/mca.h
index 9c5389b7e623..ee97f7c2d462 100644
--- a/include/asm-ia64/mca.h
+++ b/include/asm-ia64/mca.h
@@ -69,14 +69,16 @@ typedef struct ia64_mc_info_s {
69 */ 69 */
70 70
71struct ia64_sal_os_state { 71struct ia64_sal_os_state {
72 /* SAL to OS, must be at offset 0 */ 72
73 /* SAL to OS */
73 u64 os_gp; /* GP of the os registered with the SAL, physical */ 74 u64 os_gp; /* GP of the os registered with the SAL, physical */
74 u64 pal_proc; /* PAL_PROC entry point, physical */ 75 u64 pal_proc; /* PAL_PROC entry point, physical */
75 u64 sal_proc; /* SAL_PROC entry point, physical */ 76 u64 sal_proc; /* SAL_PROC entry point, physical */
76 u64 rv_rc; /* MCA - Rendezvous state, INIT - reason code */ 77 u64 rv_rc; /* MCA - Rendezvous state, INIT - reason code */
77 u64 proc_state_param; /* from R18 */ 78 u64 proc_state_param; /* from R18 */
78 u64 monarch; /* 1 for a monarch event, 0 for a slave */ 79 u64 monarch; /* 1 for a monarch event, 0 for a slave */
79 /* common, must follow SAL to OS */ 80
81 /* common */
80 u64 sal_ra; /* Return address in SAL, physical */ 82 u64 sal_ra; /* Return address in SAL, physical */
81 u64 sal_gp; /* GP of the SAL - physical */ 83 u64 sal_gp; /* GP of the SAL - physical */
82 pal_min_state_area_t *pal_min_state; /* from R17. physical in asm, virtual in C */ 84 pal_min_state_area_t *pal_min_state; /* from R17. physical in asm, virtual in C */
@@ -98,7 +100,8 @@ struct ia64_sal_os_state {
98 u64 iipa; 100 u64 iipa;
99 u64 iim; 101 u64 iim;
100 u64 iha; 102 u64 iha;
101 /* OS to SAL, must follow common */ 103
104 /* OS to SAL */
102 u64 os_status; /* OS status to SAL, enum below */ 105 u64 os_status; /* OS status to SAL, enum below */
103 u64 context; /* 0 if return to same context 106 u64 context; /* 0 if return to same context
104 1 if return to new context */ 107 1 if return to new context */
diff --git a/include/asm-ia64/msi.h b/include/asm-ia64/msi.h
index 97890f7762b3..bb92b0dbde2f 100644
--- a/include/asm-ia64/msi.h
+++ b/include/asm-ia64/msi.h
@@ -14,4 +14,16 @@ static inline void set_intr_gate (int nr, void *func) {}
14#define ack_APIC_irq ia64_eoi 14#define ack_APIC_irq ia64_eoi
15#define MSI_TARGET_CPU_SHIFT 4 15#define MSI_TARGET_CPU_SHIFT 4
16 16
17extern struct msi_ops msi_apic_ops;
18
19static inline int msi_arch_init(void)
20{
21 if (platform_msi_init)
22 return platform_msi_init();
23
24 /* default ops for most ia64 platforms */
25 msi_register(&msi_apic_ops);
26 return 0;
27}
28
17#endif /* ASM_MSI_H */ 29#endif /* ASM_MSI_H */
diff --git a/include/asm-ia64/percpu.h b/include/asm-ia64/percpu.h
index ae357d504fba..24d898b650c5 100644
--- a/include/asm-ia64/percpu.h
+++ b/include/asm-ia64/percpu.h
@@ -42,6 +42,7 @@ DECLARE_PER_CPU(unsigned long, local_per_cpu_offset);
42 42
43#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu])) 43#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))
44#define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __ia64_per_cpu_var(local_per_cpu_offset))) 44#define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __ia64_per_cpu_var(local_per_cpu_offset)))
45#define __raw_get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __ia64_per_cpu_var(local_per_cpu_offset)))
45 46
46extern void percpu_modcopy(void *pcpudst, const void *src, unsigned long size); 47extern void percpu_modcopy(void *pcpudst, const void *src, unsigned long size);
47extern void setup_per_cpu_areas (void); 48extern void setup_per_cpu_areas (void);
@@ -51,6 +52,7 @@ extern void *per_cpu_init(void);
51 52
52#define per_cpu(var, cpu) (*((void)(cpu), &per_cpu__##var)) 53#define per_cpu(var, cpu) (*((void)(cpu), &per_cpu__##var))
53#define __get_cpu_var(var) per_cpu__##var 54#define __get_cpu_var(var) per_cpu__##var
55#define __raw_get_cpu_var(var) per_cpu__##var
54#define per_cpu_init() (__phys_per_cpu_start) 56#define per_cpu_init() (__phys_per_cpu_start)
55 57
56#endif /* SMP */ 58#endif /* SMP */
diff --git a/include/asm-ia64/pgtable.h b/include/asm-ia64/pgtable.h
index eaac08d5e0bd..228981cadf8f 100644
--- a/include/asm-ia64/pgtable.h
+++ b/include/asm-ia64/pgtable.h
@@ -316,22 +316,20 @@ ia64_phys_addr_valid (unsigned long addr)
316#define pte_mkhuge(pte) (__pte(pte_val(pte))) 316#define pte_mkhuge(pte) (__pte(pte_val(pte)))
317 317
318/* 318/*
319 * Macro to a page protection value as "uncacheable". Note that "protection" is really a 319 * Make page protection values cacheable, uncacheable, or write-
320 * misnomer here as the protection value contains the memory attribute bits, dirty bits, 320 * combining. Note that "protection" is really a misnomer here as the
321 * and various other bits as well. 321 * protection value contains the memory attribute bits, dirty bits, and
322 * various other bits as well.
322 */ 323 */
324#define pgprot_cacheable(prot) __pgprot((pgprot_val(prot) & ~_PAGE_MA_MASK) | _PAGE_MA_WB)
323#define pgprot_noncached(prot) __pgprot((pgprot_val(prot) & ~_PAGE_MA_MASK) | _PAGE_MA_UC) 325#define pgprot_noncached(prot) __pgprot((pgprot_val(prot) & ~_PAGE_MA_MASK) | _PAGE_MA_UC)
324
325/*
326 * Macro to make mark a page protection value as "write-combining".
327 * Note that "protection" is really a misnomer here as the protection
328 * value contains the memory attribute bits, dirty bits, and various
329 * other bits as well. Accesses through a write-combining translation
330 * works bypasses the caches, but does allow for consecutive writes to
331 * be combined into single (but larger) write transactions.
332 */
333#define pgprot_writecombine(prot) __pgprot((pgprot_val(prot) & ~_PAGE_MA_MASK) | _PAGE_MA_WC) 326#define pgprot_writecombine(prot) __pgprot((pgprot_val(prot) & ~_PAGE_MA_MASK) | _PAGE_MA_WC)
334 327
328struct file;
329extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
330 unsigned long size, pgprot_t vma_prot);
331#define __HAVE_PHYS_MEM_ACCESS_PROT
332
335static inline unsigned long 333static inline unsigned long
336pgd_index (unsigned long address) 334pgd_index (unsigned long address)
337{ 335{
diff --git a/include/asm-ia64/sn/intr.h b/include/asm-ia64/sn/intr.h
index 60a51a406eec..12b54ddb06be 100644
--- a/include/asm-ia64/sn/intr.h
+++ b/include/asm-ia64/sn/intr.h
@@ -10,6 +10,7 @@
10#define _ASM_IA64_SN_INTR_H 10#define _ASM_IA64_SN_INTR_H
11 11
12#include <linux/rcupdate.h> 12#include <linux/rcupdate.h>
13#include <asm/sn/types.h>
13 14
14#define SGI_UART_VECTOR 0xe9 15#define SGI_UART_VECTOR 0xe9
15 16
@@ -40,6 +41,7 @@ struct sn_irq_info {
40 int irq_cpuid; /* kernel logical cpuid */ 41 int irq_cpuid; /* kernel logical cpuid */
41 int irq_irq; /* the IRQ number */ 42 int irq_irq; /* the IRQ number */
42 int irq_int_bit; /* Bridge interrupt pin */ 43 int irq_int_bit; /* Bridge interrupt pin */
44 /* <0 means MSI */
43 u64 irq_xtalkaddr; /* xtalkaddr IRQ is sent to */ 45 u64 irq_xtalkaddr; /* xtalkaddr IRQ is sent to */
44 int irq_bridge_type;/* pciio asic type (pciio.h) */ 46 int irq_bridge_type;/* pciio asic type (pciio.h) */
45 void *irq_bridge; /* bridge generating irq */ 47 void *irq_bridge; /* bridge generating irq */
@@ -53,6 +55,12 @@ struct sn_irq_info {
53}; 55};
54 56
55extern void sn_send_IPI_phys(int, long, int, int); 57extern void sn_send_IPI_phys(int, long, int, int);
58extern u64 sn_intr_alloc(nasid_t, int,
59 struct sn_irq_info *,
60 int, nasid_t, int);
61extern void sn_intr_free(nasid_t, int, struct sn_irq_info *);
62extern struct sn_irq_info *sn_retarget_vector(struct sn_irq_info *, nasid_t, int);
63extern struct list_head **sn_irq_lh;
56 64
57#define CPU_VECTOR_TO_IRQ(cpuid,vector) (vector) 65#define CPU_VECTOR_TO_IRQ(cpuid,vector) (vector)
58 66
diff --git a/include/asm-ia64/sn/pcibr_provider.h b/include/asm-ia64/sn/pcibr_provider.h
index 51260ab70d91..e3b0c3fe5eed 100644
--- a/include/asm-ia64/sn/pcibr_provider.h
+++ b/include/asm-ia64/sn/pcibr_provider.h
@@ -55,6 +55,7 @@
55#define PCI32_ATE_V (0x1 << 0) 55#define PCI32_ATE_V (0x1 << 0)
56#define PCI32_ATE_CO (0x1 << 1) 56#define PCI32_ATE_CO (0x1 << 1)
57#define PCI32_ATE_PREC (0x1 << 2) 57#define PCI32_ATE_PREC (0x1 << 2)
58#define PCI32_ATE_MSI (0x1 << 2)
58#define PCI32_ATE_PREF (0x1 << 3) 59#define PCI32_ATE_PREF (0x1 << 3)
59#define PCI32_ATE_BAR (0x1 << 4) 60#define PCI32_ATE_BAR (0x1 << 4)
60#define PCI32_ATE_ADDR_SHFT 12 61#define PCI32_ATE_ADDR_SHFT 12
@@ -117,8 +118,8 @@ struct pcibus_info {
117 118
118extern int pcibr_init_provider(void); 119extern int pcibr_init_provider(void);
119extern void *pcibr_bus_fixup(struct pcibus_bussoft *, struct pci_controller *); 120extern void *pcibr_bus_fixup(struct pcibus_bussoft *, struct pci_controller *);
120extern dma_addr_t pcibr_dma_map(struct pci_dev *, unsigned long, size_t); 121extern dma_addr_t pcibr_dma_map(struct pci_dev *, unsigned long, size_t, int type);
121extern dma_addr_t pcibr_dma_map_consistent(struct pci_dev *, unsigned long, size_t); 122extern dma_addr_t pcibr_dma_map_consistent(struct pci_dev *, unsigned long, size_t, int type);
122extern void pcibr_dma_unmap(struct pci_dev *, dma_addr_t, int); 123extern void pcibr_dma_unmap(struct pci_dev *, dma_addr_t, int);
123 124
124/* 125/*
diff --git a/include/asm-ia64/sn/pcibus_provider_defs.h b/include/asm-ia64/sn/pcibus_provider_defs.h
index ce3f6c328241..8f7c83d0f6d3 100644
--- a/include/asm-ia64/sn/pcibus_provider_defs.h
+++ b/include/asm-ia64/sn/pcibus_provider_defs.h
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 1992 - 1997, 2000-2004 Silicon Graphics, Inc. All rights reserved. 6 * Copyright (C) 1992 - 1997, 2000-2005 Silicon Graphics, Inc. All rights reserved.
7 */ 7 */
8#ifndef _ASM_IA64_SN_PCI_PCIBUS_PROVIDER_H 8#ifndef _ASM_IA64_SN_PCI_PCIBUS_PROVIDER_H
9#define _ASM_IA64_SN_PCI_PCIBUS_PROVIDER_H 9#define _ASM_IA64_SN_PCI_PCIBUS_PROVIDER_H
@@ -45,13 +45,24 @@ struct pci_controller;
45 */ 45 */
46 46
47struct sn_pcibus_provider { 47struct sn_pcibus_provider {
48 dma_addr_t (*dma_map)(struct pci_dev *, unsigned long, size_t); 48 dma_addr_t (*dma_map)(struct pci_dev *, unsigned long, size_t, int flags);
49 dma_addr_t (*dma_map_consistent)(struct pci_dev *, unsigned long, size_t); 49 dma_addr_t (*dma_map_consistent)(struct pci_dev *, unsigned long, size_t, int flags);
50 void (*dma_unmap)(struct pci_dev *, dma_addr_t, int); 50 void (*dma_unmap)(struct pci_dev *, dma_addr_t, int);
51 void * (*bus_fixup)(struct pcibus_bussoft *, struct pci_controller *); 51 void * (*bus_fixup)(struct pcibus_bussoft *, struct pci_controller *);
52 void (*force_interrupt)(struct sn_irq_info *); 52 void (*force_interrupt)(struct sn_irq_info *);
53 void (*target_interrupt)(struct sn_irq_info *); 53 void (*target_interrupt)(struct sn_irq_info *);
54}; 54};
55 55
56/*
57 * Flags used by the map interfaces
58 * bits 3:0 specifies format of passed in address
59 * bit 4 specifies that address is to be used for MSI
60 */
61
62#define SN_DMA_ADDRTYPE(x) ((x) & 0xf)
63#define SN_DMA_ADDR_PHYS 1 /* address is an xio address. */
64#define SN_DMA_ADDR_XIO 2 /* address is phys memory */
65#define SN_DMA_MSI 0x10 /* Bus address is to be used for MSI */
66
56extern struct sn_pcibus_provider *sn_pci_provider[]; 67extern struct sn_pcibus_provider *sn_pci_provider[];
57#endif /* _ASM_IA64_SN_PCI_PCIBUS_PROVIDER_H */ 68#endif /* _ASM_IA64_SN_PCI_PCIBUS_PROVIDER_H */
diff --git a/include/asm-ia64/sn/sn_sal.h b/include/asm-ia64/sn/sn_sal.h
index 8c865e43f609..cd490b20d592 100644
--- a/include/asm-ia64/sn/sn_sal.h
+++ b/include/asm-ia64/sn/sn_sal.h
@@ -345,7 +345,7 @@ ia64_sn_plat_set_error_handling_features(void)
345 ret_stuff.v1 = 0; 345 ret_stuff.v1 = 0;
346 ret_stuff.v2 = 0; 346 ret_stuff.v2 = 0;
347 SAL_CALL_REENTRANT(ret_stuff, SN_SAL_SET_ERROR_HANDLING_FEATURES, 347 SAL_CALL_REENTRANT(ret_stuff, SN_SAL_SET_ERROR_HANDLING_FEATURES,
348 (SAL_ERR_FEAT_MCA_SLV_TO_OS_INIT_SLV | SAL_ERR_FEAT_LOG_SBES), 348 SAL_ERR_FEAT_LOG_SBES,
349 0, 0, 0, 0, 0, 0); 349 0, 0, 0, 0, 0, 0);
350 350
351 return ret_stuff.status; 351 return ret_stuff.status;
diff --git a/include/asm-ia64/sn/tiocp.h b/include/asm-ia64/sn/tiocp.h
index f47c08ab483c..e8ad0bb5b6c5 100644
--- a/include/asm-ia64/sn/tiocp.h
+++ b/include/asm-ia64/sn/tiocp.h
@@ -3,13 +3,14 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 2003-2004 Silicon Graphics, Inc. All rights reserved. 6 * Copyright (C) 2003-2005 Silicon Graphics, Inc. All rights reserved.
7 */ 7 */
8#ifndef _ASM_IA64_SN_PCI_TIOCP_H 8#ifndef _ASM_IA64_SN_PCI_TIOCP_H
9#define _ASM_IA64_SN_PCI_TIOCP_H 9#define _ASM_IA64_SN_PCI_TIOCP_H
10 10
11#define TIOCP_HOST_INTR_ADDR 0x003FFFFFFFFFFFFFUL 11#define TIOCP_HOST_INTR_ADDR 0x003FFFFFFFFFFFFFUL
12#define TIOCP_PCI64_CMDTYPE_MEM (0x1ull << 60) 12#define TIOCP_PCI64_CMDTYPE_MEM (0x1ull << 60)
13#define TIOCP_PCI64_CMDTYPE_MSI (0x3ull << 60)
13 14
14 15
15/***************************************************************************** 16/*****************************************************************************
diff --git a/include/asm-ia64/unistd.h b/include/asm-ia64/unistd.h
index 632f2eedf72c..bb0eb727dcd0 100644
--- a/include/asm-ia64/unistd.h
+++ b/include/asm-ia64/unistd.h
@@ -265,7 +265,7 @@
265#define __NR_keyctl 1273 265#define __NR_keyctl 1273
266#define __NR_ioprio_set 1274 266#define __NR_ioprio_set 1274
267#define __NR_ioprio_get 1275 267#define __NR_ioprio_get 1275
268/* 1276 is available for reuse (was briefly sys_set_zone_reclaim) */ 268#define __NR_move_pages 1276
269#define __NR_inotify_init 1277 269#define __NR_inotify_init 1277
270#define __NR_inotify_add_watch 1278 270#define __NR_inotify_add_watch 1278
271#define __NR_inotify_rm_watch 1279 271#define __NR_inotify_rm_watch 1279
diff --git a/include/asm-ia64/vga.h b/include/asm-ia64/vga.h
index 091177cda223..02184ecd8208 100644
--- a/include/asm-ia64/vga.h
+++ b/include/asm-ia64/vga.h
@@ -17,7 +17,7 @@
17extern unsigned long vga_console_iobase; 17extern unsigned long vga_console_iobase;
18extern unsigned long vga_console_membase; 18extern unsigned long vga_console_membase;
19 19
20#define VGA_MAP_MEM(x) ((unsigned long) ioremap_nocache(vga_console_membase + (x), 0)) 20#define VGA_MAP_MEM(x,s) ((unsigned long) ioremap_nocache(vga_console_membase + (x), s))
21 21
22#define vga_readb(x) (*(x)) 22#define vga_readb(x) (*(x))
23#define vga_writeb(x,y) (*(y) = (x)) 23#define vga_writeb(x,y) (*(y) = (x))
diff --git a/include/asm-m32r/vga.h b/include/asm-m32r/vga.h
index d0f4b6eed7a3..533163447cc9 100644
--- a/include/asm-m32r/vga.h
+++ b/include/asm-m32r/vga.h
@@ -14,7 +14,7 @@
14 * access the videoram directly without any black magic. 14 * access the videoram directly without any black magic.
15 */ 15 */
16 16
17#define VGA_MAP_MEM(x) (unsigned long)phys_to_virt(x) 17#define VGA_MAP_MEM(x,s) (unsigned long)phys_to_virt(x)
18 18
19#define vga_readb(x) (*(x)) 19#define vga_readb(x) (*(x))
20#define vga_writeb(x,y) (*(y) = (x)) 20#define vga_writeb(x,y) (*(y) = (x))
diff --git a/include/asm-m68k/amigaints.h b/include/asm-m68k/amigaints.h
index aa968d014bb6..7c8713468fd2 100644
--- a/include/asm-m68k/amigaints.h
+++ b/include/asm-m68k/amigaints.h
@@ -13,6 +13,8 @@
13#ifndef _ASMm68k_AMIGAINTS_H_ 13#ifndef _ASMm68k_AMIGAINTS_H_
14#define _ASMm68k_AMIGAINTS_H_ 14#define _ASMm68k_AMIGAINTS_H_
15 15
16#include <asm/irq.h>
17
16/* 18/*
17** Amiga Interrupt sources. 19** Amiga Interrupt sources.
18** 20**
@@ -23,72 +25,52 @@
23#define CIA_IRQS (5) 25#define CIA_IRQS (5)
24#define AMI_IRQS (32) /* AUTO_IRQS+AMI_STD_IRQS+2*CIA_IRQS */ 26#define AMI_IRQS (32) /* AUTO_IRQS+AMI_STD_IRQS+2*CIA_IRQS */
25 27
26/* vertical blanking interrupt */ 28/* builtin serial port interrupts */
27#define IRQ_AMIGA_VERTB 0 29#define IRQ_AMIGA_TBE (IRQ_USER+0)
30#define IRQ_AMIGA_RBF (IRQ_USER+11)
28 31
29/* copper interrupt */ 32/* floppy disk interrupts */
30#define IRQ_AMIGA_COPPER 1 33#define IRQ_AMIGA_DSKBLK (IRQ_USER+1)
34#define IRQ_AMIGA_DSKSYN (IRQ_USER+12)
31 35
32/* Audio interrupts */ 36/* software interrupts */
33#define IRQ_AMIGA_AUD0 2 37#define IRQ_AMIGA_SOFT (IRQ_USER+2)
34#define IRQ_AMIGA_AUD1 3
35#define IRQ_AMIGA_AUD2 4
36#define IRQ_AMIGA_AUD3 5
37 38
38/* Blitter done interrupt */ 39/* interrupts from external hardware */
39#define IRQ_AMIGA_BLIT 6 40#define IRQ_AMIGA_PORTS IRQ_AUTO_2
41#define IRQ_AMIGA_EXTER IRQ_AUTO_6
40 42
41/* floppy disk interrupts */ 43/* copper interrupt */
42#define IRQ_AMIGA_DSKSYN 7 44#define IRQ_AMIGA_COPPER (IRQ_USER+4)
43#define IRQ_AMIGA_DSKBLK 8
44 45
45/* builtin serial port interrupts */ 46/* vertical blanking interrupt */
46#define IRQ_AMIGA_RBF 9 47#define IRQ_AMIGA_VERTB (IRQ_USER+5)
47#define IRQ_AMIGA_TBE 10
48 48
49/* software interrupts */ 49/* Blitter done interrupt */
50#define IRQ_AMIGA_SOFT 11 50#define IRQ_AMIGA_BLIT (IRQ_USER+6)
51 51
52/* interrupts from external hardware */ 52/* Audio interrupts */
53#define IRQ_AMIGA_PORTS 12 53#define IRQ_AMIGA_AUD0 (IRQ_USER+7)
54#define IRQ_AMIGA_EXTER 13 54#define IRQ_AMIGA_AUD1 (IRQ_USER+8)
55#define IRQ_AMIGA_AUD2 (IRQ_USER+9)
56#define IRQ_AMIGA_AUD3 (IRQ_USER+10)
55 57
56/* CIA interrupt sources */ 58/* CIA interrupt sources */
57#define IRQ_AMIGA_CIAA 14 59#define IRQ_AMIGA_CIAA (IRQ_USER+14)
58#define IRQ_AMIGA_CIAA_TA 14 60#define IRQ_AMIGA_CIAA_TA (IRQ_USER+14)
59#define IRQ_AMIGA_CIAA_TB 15 61#define IRQ_AMIGA_CIAA_TB (IRQ_USER+15)
60#define IRQ_AMIGA_CIAA_ALRM 16 62#define IRQ_AMIGA_CIAA_ALRM (IRQ_USER+16)
61#define IRQ_AMIGA_CIAA_SP 17 63#define IRQ_AMIGA_CIAA_SP (IRQ_USER+17)
62#define IRQ_AMIGA_CIAA_FLG 18 64#define IRQ_AMIGA_CIAA_FLG (IRQ_USER+18)
63#define IRQ_AMIGA_CIAB 19 65#define IRQ_AMIGA_CIAB (IRQ_USER+19)
64#define IRQ_AMIGA_CIAB_TA 19 66#define IRQ_AMIGA_CIAB_TA (IRQ_USER+19)
65#define IRQ_AMIGA_CIAB_TB 20 67#define IRQ_AMIGA_CIAB_TB (IRQ_USER+20)
66#define IRQ_AMIGA_CIAB_ALRM 21 68#define IRQ_AMIGA_CIAB_ALRM (IRQ_USER+21)
67#define IRQ_AMIGA_CIAB_SP 22 69#define IRQ_AMIGA_CIAB_SP (IRQ_USER+22)
68#define IRQ_AMIGA_CIAB_FLG 23 70#define IRQ_AMIGA_CIAB_FLG (IRQ_USER+23)
69
70/* auto-vector interrupts */
71#define IRQ_AMIGA_AUTO 24
72#define IRQ_AMIGA_AUTO_0 24 /* This is just a dummy */
73#define IRQ_AMIGA_AUTO_1 25
74#define IRQ_AMIGA_AUTO_2 26
75#define IRQ_AMIGA_AUTO_3 27
76#define IRQ_AMIGA_AUTO_4 28
77#define IRQ_AMIGA_AUTO_5 29
78#define IRQ_AMIGA_AUTO_6 30
79#define IRQ_AMIGA_AUTO_7 31
80
81#define IRQ_FLOPPY IRQ_AMIGA_DSKBLK
82 71
83/* INTREQR masks */
84#define IRQ1_MASK 0x0007 /* INTREQR mask for IRQ 1 */
85#define IRQ2_MASK 0x0008 /* INTREQR mask for IRQ 2 */
86#define IRQ3_MASK 0x0070 /* INTREQR mask for IRQ 3 */
87#define IRQ4_MASK 0x0780 /* INTREQR mask for IRQ 4 */
88#define IRQ5_MASK 0x1800 /* INTREQR mask for IRQ 5 */
89#define IRQ6_MASK 0x2000 /* INTREQR mask for IRQ 6 */
90#define IRQ7_MASK 0x4000 /* INTREQR mask for IRQ 7 */
91 72
73/* INTREQR masks */
92#define IF_SETCLR 0x8000 /* set/clr bit */ 74#define IF_SETCLR 0x8000 /* set/clr bit */
93#define IF_INTEN 0x4000 /* master interrupt bit in INT* registers */ 75#define IF_INTEN 0x4000 /* master interrupt bit in INT* registers */
94#define IF_EXTER 0x2000 /* external level 6 and CIA B interrupt */ 76#define IF_EXTER 0x2000 /* external level 6 and CIA B interrupt */
@@ -106,9 +88,6 @@
106#define IF_DSKBLK 0x0002 /* diskblock DMA finished */ 88#define IF_DSKBLK 0x0002 /* diskblock DMA finished */
107#define IF_TBE 0x0001 /* serial transmit buffer empty interrupt */ 89#define IF_TBE 0x0001 /* serial transmit buffer empty interrupt */
108 90
109extern void amiga_do_irq(int irq, struct pt_regs *fp);
110extern void amiga_do_irq_list(int irq, struct pt_regs *fp);
111
112/* CIA interrupt control register bits */ 91/* CIA interrupt control register bits */
113 92
114#define CIA_ICR_TA 0x01 93#define CIA_ICR_TA 0x01
@@ -125,6 +104,7 @@ extern void amiga_do_irq_list(int irq, struct pt_regs *fp);
125 104
126extern struct ciabase ciaa_base, ciab_base; 105extern struct ciabase ciaa_base, ciab_base;
127 106
107extern void cia_init_IRQ(struct ciabase *base);
128extern unsigned char cia_set_irq(struct ciabase *base, unsigned char mask); 108extern unsigned char cia_set_irq(struct ciabase *base, unsigned char mask);
129extern unsigned char cia_able_irq(struct ciabase *base, unsigned char mask); 109extern unsigned char cia_able_irq(struct ciabase *base, unsigned char mask);
130 110
diff --git a/include/asm-m68k/apollohw.h b/include/asm-m68k/apollohw.h
index 4304e1c33e17..a1373b9aa281 100644
--- a/include/asm-m68k/apollohw.h
+++ b/include/asm-m68k/apollohw.h
@@ -3,6 +3,8 @@
3#ifndef _ASMm68k_APOLLOHW_H_ 3#ifndef _ASMm68k_APOLLOHW_H_
4#define _ASMm68k_APOLLOHW_H_ 4#define _ASMm68k_APOLLOHW_H_
5 5
6#include <linux/types.h>
7
6/* 8/*
7 apollo models 9 apollo models
8*/ 10*/
@@ -101,4 +103,6 @@ extern u_long timer_physaddr;
101 103
102#define isaIO2mem(x) (((((x) & 0x3f8) << 7) | (((x) & 0xfc00) >> 6) | ((x) & 0x7)) + 0x40000 + IO_BASE) 104#define isaIO2mem(x) (((((x) & 0x3f8) << 7) | (((x) & 0xfc00) >> 6) | ((x) & 0x7)) + 0x40000 + IO_BASE)
103 105
106#define IRQ_APOLLO IRQ_USER
107
104#endif 108#endif
diff --git a/include/asm-m68k/atari_stdma.h b/include/asm-m68k/atari_stdma.h
index 64f92880ce43..b4eadf852738 100644
--- a/include/asm-m68k/atari_stdma.h
+++ b/include/asm-m68k/atari_stdma.h
@@ -3,7 +3,7 @@
3#define _atari_stdma_h 3#define _atari_stdma_h
4 4
5 5
6#include <asm/irq.h> 6#include <linux/interrupt.h>
7 7
8 8
9/***************************** Prototypes *****************************/ 9/***************************** Prototypes *****************************/
diff --git a/include/asm-m68k/atariints.h b/include/asm-m68k/atariints.h
index 42952c890593..0ed454fc24bb 100644
--- a/include/asm-m68k/atariints.h
+++ b/include/asm-m68k/atariints.h
@@ -45,17 +45,6 @@
45#define IRQ_TYPE_FAST 1 45#define IRQ_TYPE_FAST 1
46#define IRQ_TYPE_PRIO 2 46#define IRQ_TYPE_PRIO 2
47 47
48#define IRQ_SPURIOUS (0)
49
50/* auto-vector interrupts */
51#define IRQ_AUTO_1 (1)
52#define IRQ_AUTO_2 (2)
53#define IRQ_AUTO_3 (3)
54#define IRQ_AUTO_4 (4)
55#define IRQ_AUTO_5 (5)
56#define IRQ_AUTO_6 (6)
57#define IRQ_AUTO_7 (7)
58
59/* ST-MFP interrupts */ 48/* ST-MFP interrupts */
60#define IRQ_MFP_BUSY (8) 49#define IRQ_MFP_BUSY (8)
61#define IRQ_MFP_DCD (9) 50#define IRQ_MFP_DCD (9)
diff --git a/include/asm-m68k/bvme6000hw.h b/include/asm-m68k/bvme6000hw.h
index 28a859b03959..f40d2f8510ee 100644
--- a/include/asm-m68k/bvme6000hw.h
+++ b/include/asm-m68k/bvme6000hw.h
@@ -109,23 +109,23 @@ typedef struct {
109 109
110#define BVME_IRQ_TYPE_PRIO 0 110#define BVME_IRQ_TYPE_PRIO 0
111 111
112#define BVME_IRQ_PRN 0x54 112#define BVME_IRQ_PRN (IRQ_USER+20)
113#define BVME_IRQ_I596 0x1a 113#define BVME_IRQ_TIMER (IRQ_USER+25)
114#define BVME_IRQ_SCSI 0x1b 114#define BVME_IRQ_I596 IRQ_AUTO_2
115#define BVME_IRQ_TIMER 0x59 115#define BVME_IRQ_SCSI IRQ_AUTO_3
116#define BVME_IRQ_RTC 0x1e 116#define BVME_IRQ_RTC IRQ_AUTO_6
117#define BVME_IRQ_ABORT 0x1f 117#define BVME_IRQ_ABORT IRQ_AUTO_7
118 118
119/* SCC interrupts */ 119/* SCC interrupts */
120#define BVME_IRQ_SCC_BASE 0x40 120#define BVME_IRQ_SCC_BASE IRQ_USER
121#define BVME_IRQ_SCCB_TX 0x40 121#define BVME_IRQ_SCCB_TX IRQ_USER
122#define BVME_IRQ_SCCB_STAT 0x42 122#define BVME_IRQ_SCCB_STAT (IRQ_USER+2)
123#define BVME_IRQ_SCCB_RX 0x44 123#define BVME_IRQ_SCCB_RX (IRQ_USER+4)
124#define BVME_IRQ_SCCB_SPCOND 0x46 124#define BVME_IRQ_SCCB_SPCOND (IRQ_USER+6)
125#define BVME_IRQ_SCCA_TX 0x48 125#define BVME_IRQ_SCCA_TX (IRQ_USER+8)
126#define BVME_IRQ_SCCA_STAT 0x4a 126#define BVME_IRQ_SCCA_STAT (IRQ_USER+10)
127#define BVME_IRQ_SCCA_RX 0x4c 127#define BVME_IRQ_SCCA_RX (IRQ_USER+12)
128#define BVME_IRQ_SCCA_SPCOND 0x4e 128#define BVME_IRQ_SCCA_SPCOND (IRQ_USER+14)
129 129
130/* Address control registers */ 130/* Address control registers */
131 131
diff --git a/include/asm-m68k/cacheflush.h b/include/asm-m68k/cacheflush.h
index 8aba971b1368..24d3ff449135 100644
--- a/include/asm-m68k/cacheflush.h
+++ b/include/asm-m68k/cacheflush.h
@@ -3,26 +3,30 @@
3 3
4#include <linux/mm.h> 4#include <linux/mm.h>
5 5
6/* cache code */
7#define FLUSH_I_AND_D (0x00000808)
8#define FLUSH_I (0x00000008)
9
6/* 10/*
7 * Cache handling functions 11 * Cache handling functions
8 */ 12 */
9 13
10#define flush_icache() \ 14static inline void flush_icache(void)
11({ \ 15{
12 if (CPU_IS_040_OR_060) \ 16 if (CPU_IS_040_OR_060)
13 __asm__ __volatile__("nop\n\t" \ 17 asm volatile ( "nop\n"
14 ".chip 68040\n\t" \ 18 " .chip 68040\n"
15 "cinva %%ic\n\t" \ 19 " cpusha %bc\n"
16 ".chip 68k" : ); \ 20 " .chip 68k");
17 else { \ 21 else {
18 unsigned long _tmp; \ 22 unsigned long tmp;
19 __asm__ __volatile__("movec %%cacr,%0\n\t" \ 23 asm volatile ( "movec %%cacr,%0\n"
20 "orw %1,%0\n\t" \ 24 " or.w %1,%0\n"
21 "movec %0,%%cacr" \ 25 " movec %0,%%cacr"
22 : "=&d" (_tmp) \ 26 : "=&d" (tmp)
23 : "id" (FLUSH_I)); \ 27 : "id" (FLUSH_I));
24 } \ 28 }
25}) 29}
26 30
27/* 31/*
28 * invalidate the cache for the specified memory range. 32 * invalidate the cache for the specified memory range.
@@ -43,10 +47,6 @@ extern void cache_push(unsigned long paddr, int len);
43 */ 47 */
44extern void cache_push_v(unsigned long vaddr, int len); 48extern void cache_push_v(unsigned long vaddr, int len);
45 49
46/* cache code */
47#define FLUSH_I_AND_D (0x00000808)
48#define FLUSH_I (0x00000008)
49
50/* This is needed whenever the virtual mapping of the current 50/* This is needed whenever the virtual mapping of the current
51 process changes. */ 51 process changes. */
52#define __flush_cache_all() \ 52#define __flush_cache_all() \
diff --git a/include/asm-m68k/dma-mapping.h b/include/asm-m68k/dma-mapping.h
index dffd59cf1364..cebbb03370ec 100644
--- a/include/asm-m68k/dma-mapping.h
+++ b/include/asm-m68k/dma-mapping.h
@@ -1,11 +1,91 @@
1#ifndef _M68K_DMA_MAPPING_H 1#ifndef _M68K_DMA_MAPPING_H
2#define _M68K_DMA_MAPPING_H 2#define _M68K_DMA_MAPPING_H
3 3
4#include <asm/cache.h>
4 5
5#ifdef CONFIG_PCI 6struct scatterlist;
6#include <asm-generic/dma-mapping.h> 7
7#else 8static inline int dma_supported(struct device *dev, u64 mask)
8#include <asm-generic/dma-mapping-broken.h> 9{
9#endif 10 return 1;
11}
12
13static inline int dma_set_mask(struct device *dev, u64 mask)
14{
15 return 0;
16}
17
18static inline int dma_get_cache_alignment(void)
19{
20 return 1 << L1_CACHE_SHIFT;
21}
22
23static inline int dma_is_consistent(dma_addr_t dma_addr)
24{
25 return 0;
26}
27
28extern void *dma_alloc_coherent(struct device *, size_t,
29 dma_addr_t *, int);
30extern void dma_free_coherent(struct device *, size_t,
31 void *, dma_addr_t);
32
33static inline void *dma_alloc_noncoherent(struct device *dev, size_t size,
34 dma_addr_t *handle, int flag)
35{
36 return dma_alloc_coherent(dev, size, handle, flag);
37}
38static inline void dma_free_noncoherent(struct device *dev, size_t size,
39 void *addr, dma_addr_t handle)
40{
41 dma_free_coherent(dev, size, addr, handle);
42}
43static inline void dma_cache_sync(void *vaddr, size_t size,
44 enum dma_data_direction dir)
45{
46 /* we use coherent allocation, so not much to do here. */
47}
48
49extern dma_addr_t dma_map_single(struct device *, void *, size_t,
50 enum dma_data_direction);
51static inline void dma_unmap_single(struct device *dev, dma_addr_t addr,
52 size_t size, enum dma_data_direction dir)
53{
54}
55
56extern dma_addr_t dma_map_page(struct device *, struct page *,
57 unsigned long, size_t size,
58 enum dma_data_direction);
59static inline void dma_unmap_page(struct device *dev, dma_addr_t address,
60 size_t size, enum dma_data_direction dir)
61{
62}
63
64extern int dma_map_sg(struct device *, struct scatterlist *, int,
65 enum dma_data_direction);
66static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
67 int nhwentries, enum dma_data_direction dir)
68{
69}
70
71extern void dma_sync_single_for_device(struct device *, dma_addr_t, size_t,
72 enum dma_data_direction);
73extern void dma_sync_sg_for_device(struct device *, struct scatterlist *, int,
74 enum dma_data_direction);
75
76static inline void dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
77 size_t size, enum dma_data_direction dir)
78{
79}
80
81static inline void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
82 int nents, enum dma_data_direction dir)
83{
84}
85
86static inline int dma_mapping_error(dma_addr_t handle)
87{
88 return 0;
89}
10 90
11#endif /* _M68K_DMA_MAPPING_H */ 91#endif /* _M68K_DMA_MAPPING_H */
diff --git a/include/asm-m68k/irq.h b/include/asm-m68k/irq.h
index b4f48b2a6a57..f4ae7d8feac6 100644
--- a/include/asm-m68k/irq.h
+++ b/include/asm-m68k/irq.h
@@ -1,13 +1,9 @@
1#ifndef _M68K_IRQ_H_ 1#ifndef _M68K_IRQ_H_
2#define _M68K_IRQ_H_ 2#define _M68K_IRQ_H_
3 3
4#include <linux/interrupt.h> 4#include <linux/linkage.h>
5 5#include <linux/hardirq.h>
6/* 6#include <linux/spinlock_types.h>
7 * # of m68k interrupts
8 */
9
10#define SYS_IRQS 8
11 7
12/* 8/*
13 * This should be the same as the max(NUM_X_SOURCES) for all the 9 * This should be the same as the max(NUM_X_SOURCES) for all the
@@ -15,10 +11,20 @@
15 * Currently the Atari has 72 and the Amiga 24, but if both are 11 * Currently the Atari has 72 and the Amiga 24, but if both are
16 * supported in the kernel it is better to make room for 72. 12 * supported in the kernel it is better to make room for 72.
17 */ 13 */
18#if defined(CONFIG_ATARI) || defined(CONFIG_MAC) 14#if defined(CONFIG_VME) || defined(CONFIG_SUN3) || defined(CONFIG_SUN3X)
19#define NR_IRQS (72+SYS_IRQS) 15#define NR_IRQS 200
16#elif defined(CONFIG_ATARI) || defined(CONFIG_MAC)
17#define NR_IRQS 72
18#elif defined(CONFIG_Q40)
19#define NR_IRQS 43
20#elif defined(CONFIG_AMIGA)
21#define NR_IRQS 32
22#elif defined(CONFIG_APOLLO)
23#define NR_IRQS 24
24#elif defined(CONFIG_HP300)
25#define NR_IRQS 8
20#else 26#else
21#define NR_IRQS (24+SYS_IRQS) 27#error unknown nr of irqs
22#endif 28#endif
23 29
24/* 30/*
@@ -40,53 +46,25 @@
40 * that routine requires service. 46 * that routine requires service.
41 */ 47 */
42 48
43#define IRQ1 (1) /* level 1 interrupt */ 49#define IRQ_SPURIOUS 0
44#define IRQ2 (2) /* level 2 interrupt */
45#define IRQ3 (3) /* level 3 interrupt */
46#define IRQ4 (4) /* level 4 interrupt */
47#define IRQ5 (5) /* level 5 interrupt */
48#define IRQ6 (6) /* level 6 interrupt */
49#define IRQ7 (7) /* level 7 interrupt (non-maskable) */
50 50
51/* 51#define IRQ_AUTO_1 1 /* level 1 interrupt */
52 * "Generic" interrupt sources 52#define IRQ_AUTO_2 2 /* level 2 interrupt */
53 */ 53#define IRQ_AUTO_3 3 /* level 3 interrupt */
54 54#define IRQ_AUTO_4 4 /* level 4 interrupt */
55#define IRQ_SCHED_TIMER (8) /* interrupt source for scheduling timer */ 55#define IRQ_AUTO_5 5 /* level 5 interrupt */
56#define IRQ_AUTO_6 6 /* level 6 interrupt */
57#define IRQ_AUTO_7 7 /* level 7 interrupt (non-maskable) */
56 58
57static __inline__ int irq_canonicalize(int irq) 59#define IRQ_USER 8
58{
59 return irq;
60}
61
62/*
63 * Machine specific interrupt sources.
64 *
65 * Adding an interrupt service routine for a source with this bit
66 * set indicates a special machine specific interrupt source.
67 * The machine specific files define these sources.
68 *
69 * The IRQ_MACHSPEC bit is now gone - the only thing it did was to
70 * introduce unnecessary overhead.
71 *
72 * All interrupt handling is actually machine specific so it is better
73 * to use function pointers, as used by the Sparc port, and select the
74 * interrupt handling functions when initializing the kernel. This way
75 * we save some unnecessary overhead at run-time.
76 * 01/11/97 - Jes
77 */
78 60
79extern void (*enable_irq)(unsigned int); 61extern unsigned int irq_canonicalize(unsigned int irq);
80extern void (*disable_irq)(unsigned int); 62extern void enable_irq(unsigned int);
63extern void disable_irq(unsigned int);
81#define disable_irq_nosync disable_irq 64#define disable_irq_nosync disable_irq
82 65
83struct pt_regs; 66struct pt_regs;
84 67
85extern int cpu_request_irq(unsigned int,
86 irqreturn_t (*)(int, void *, struct pt_regs *),
87 unsigned long, const char *, void *);
88extern void cpu_free_irq(unsigned int, void *);
89
90/* 68/*
91 * various flags for request_irq() - the Amiga now uses the standard 69 * various flags for request_irq() - the Amiga now uses the standard
92 * mechanism like all other architectures - SA_INTERRUPT and SA_SHIRQ 70 * mechanism like all other architectures - SA_INTERRUPT and SA_SHIRQ
@@ -105,33 +83,45 @@ extern void cpu_free_irq(unsigned int, void *);
105 * interrupt source (if it supports chaining). 83 * interrupt source (if it supports chaining).
106 */ 84 */
107typedef struct irq_node { 85typedef struct irq_node {
108 irqreturn_t (*handler)(int, void *, struct pt_regs *); 86 int (*handler)(int, void *, struct pt_regs *);
109 unsigned long flags;
110 void *dev_id; 87 void *dev_id;
111 const char *devname;
112 struct irq_node *next; 88 struct irq_node *next;
89 unsigned long flags;
90 const char *devname;
113} irq_node_t; 91} irq_node_t;
114 92
115/* 93/*
116 * This structure has only 4 elements for speed reasons 94 * This structure has only 4 elements for speed reasons
117 */ 95 */
118typedef struct irq_handler { 96typedef struct irq_handler {
119 irqreturn_t (*handler)(int, void *, struct pt_regs *); 97 int (*handler)(int, void *, struct pt_regs *);
120 unsigned long flags; 98 unsigned long flags;
121 void *dev_id; 99 void *dev_id;
122 const char *devname; 100 const char *devname;
123} irq_handler_t; 101} irq_handler_t;
124 102
125/* count of spurious interrupts */ 103struct irq_controller {
126extern volatile unsigned int num_spurious; 104 const char *name;
105 spinlock_t lock;
106 int (*startup)(unsigned int irq);
107 void (*shutdown)(unsigned int irq);
108 void (*enable)(unsigned int irq);
109 void (*disable)(unsigned int irq);
110};
111
112extern int m68k_irq_startup(unsigned int);
113extern void m68k_irq_shutdown(unsigned int);
127 114
128/* 115/*
129 * This function returns a new irq_node_t 116 * This function returns a new irq_node_t
130 */ 117 */
131extern irq_node_t *new_irq_node(void); 118extern irq_node_t *new_irq_node(void);
132 119
133struct irqaction; 120extern void m68k_setup_auto_interrupt(void (*handler)(unsigned int, struct pt_regs *));
134struct pt_regs; 121extern void m68k_setup_user_interrupt(unsigned int vec, unsigned int cnt,
135int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *); 122 void (*handler)(unsigned int, struct pt_regs *));
123extern void m68k_setup_irq_controller(struct irq_controller *, unsigned int, unsigned int);
124
125asmlinkage void m68k_handle_int(unsigned int, struct pt_regs *);
136 126
137#endif /* _M68K_IRQ_H_ */ 127#endif /* _M68K_IRQ_H_ */
diff --git a/include/asm-m68k/mac_oss.h b/include/asm-m68k/mac_oss.h
index 7644a639cd6c..7221f7251934 100644
--- a/include/asm-m68k/mac_oss.h
+++ b/include/asm-m68k/mac_oss.h
@@ -69,12 +69,12 @@
69 69
70#define OSS_IRQLEV_DISABLED 0 70#define OSS_IRQLEV_DISABLED 0
71#define OSS_IRQLEV_IOPISM 1 /* ADB? */ 71#define OSS_IRQLEV_IOPISM 1 /* ADB? */
72#define OSS_IRQLEV_SCSI 2 72#define OSS_IRQLEV_SCSI IRQ_AUTO_2
73#define OSS_IRQLEV_NUBUS 3 /* keep this on its own level */ 73#define OSS_IRQLEV_NUBUS IRQ_AUTO_3 /* keep this on its own level */
74#define OSS_IRQLEV_IOPSCC 4 /* matches VIA alternate mapping */ 74#define OSS_IRQLEV_IOPSCC IRQ_AUTO_4 /* matches VIA alternate mapping */
75#define OSS_IRQLEV_SOUND 5 /* matches VIA alternate mapping */ 75#define OSS_IRQLEV_SOUND IRQ_AUTO_5 /* matches VIA alternate mapping */
76#define OSS_IRQLEV_60HZ 6 /* matches VIA alternate mapping */ 76#define OSS_IRQLEV_60HZ 6 /* matches VIA alternate mapping */
77#define OSS_IRQLEV_VIA1 6 /* matches VIA alternate mapping */ 77#define OSS_IRQLEV_VIA1 IRQ_AUTO_6 /* matches VIA alternate mapping */
78#define OSS_IRQLEV_PARITY 7 /* matches VIA alternate mapping */ 78#define OSS_IRQLEV_PARITY 7 /* matches VIA alternate mapping */
79 79
80#ifndef __ASSEMBLY__ 80#ifndef __ASSEMBLY__
diff --git a/include/asm-m68k/machdep.h b/include/asm-m68k/machdep.h
index 7d3fee342369..df898f27e434 100644
--- a/include/asm-m68k/machdep.h
+++ b/include/asm-m68k/machdep.h
@@ -13,14 +13,8 @@ struct buffer_head;
13extern void (*mach_sched_init) (irqreturn_t (*handler)(int, void *, struct pt_regs *)); 13extern void (*mach_sched_init) (irqreturn_t (*handler)(int, void *, struct pt_regs *));
14/* machine dependent irq functions */ 14/* machine dependent irq functions */
15extern void (*mach_init_IRQ) (void); 15extern void (*mach_init_IRQ) (void);
16extern irqreturn_t (*(*mach_default_handler)[]) (int, void *, struct pt_regs *);
17extern int (*mach_request_irq) (unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_regs *),
18 unsigned long flags, const char *devname, void *dev_id);
19extern void (*mach_free_irq) (unsigned int irq, void *dev_id);
20extern void (*mach_get_model) (char *model); 16extern void (*mach_get_model) (char *model);
21extern int (*mach_get_hardware_list) (char *buffer); 17extern int (*mach_get_hardware_list) (char *buffer);
22extern int (*mach_get_irq_list) (struct seq_file *p, void *v);
23extern irqreturn_t (*mach_process_int) (int irq, struct pt_regs *fp);
24/* machine dependent timer functions */ 18/* machine dependent timer functions */
25extern unsigned long (*mach_gettimeoffset)(void); 19extern unsigned long (*mach_gettimeoffset)(void);
26extern int (*mach_hwclk)(int, struct rtc_time*); 20extern int (*mach_hwclk)(int, struct rtc_time*);
diff --git a/include/asm-m68k/macintosh.h b/include/asm-m68k/macintosh.h
index 6fc3d19512d1..27d11da2b479 100644
--- a/include/asm-m68k/macintosh.h
+++ b/include/asm-m68k/macintosh.h
@@ -11,17 +11,7 @@
11extern void mac_reset(void); 11extern void mac_reset(void);
12extern void mac_poweroff(void); 12extern void mac_poweroff(void);
13extern void mac_init_IRQ(void); 13extern void mac_init_IRQ(void);
14extern int mac_request_irq (unsigned int, irqreturn_t (*)(int, void *,
15 struct pt_regs *),
16 unsigned long, const char *, void *);
17extern void mac_free_irq(unsigned int, void *);
18extern void mac_enable_irq(unsigned int);
19extern void mac_disable_irq(unsigned int);
20extern int mac_irq_pending(unsigned int); 14extern int mac_irq_pending(unsigned int);
21extern int show_mac_interrupts(struct seq_file *, void *);
22#if 0
23extern void mac_default_handler(int irq);
24#endif
25extern void mac_identify(void); 15extern void mac_identify(void);
26extern void mac_report_hardware(void); 16extern void mac_report_hardware(void);
27extern void mac_debugging_penguin(int); 17extern void mac_debugging_penguin(int);
diff --git a/include/asm-m68k/macints.h b/include/asm-m68k/macints.h
index fd8c3a9fea4d..679c48ab4407 100644
--- a/include/asm-m68k/macints.h
+++ b/include/asm-m68k/macints.h
@@ -59,17 +59,6 @@
59#define IRQ_SRC(irq) (irq >> 3) 59#define IRQ_SRC(irq) (irq >> 3)
60#define IRQ_IDX(irq) (irq & 7) 60#define IRQ_IDX(irq) (irq & 7)
61 61
62#define IRQ_SPURIOUS (0)
63
64/* auto-vector interrupts */
65#define IRQ_AUTO_1 (1)
66#define IRQ_AUTO_2 (2)
67#define IRQ_AUTO_3 (3)
68#define IRQ_AUTO_4 (4)
69#define IRQ_AUTO_5 (5)
70#define IRQ_AUTO_6 (6)
71#define IRQ_AUTO_7 (7)
72
73/* VIA1 interrupts */ 62/* VIA1 interrupts */
74#define IRQ_VIA1_0 (8) /* one second int. */ 63#define IRQ_VIA1_0 (8) /* one second int. */
75#define IRQ_VIA1_1 (9) /* VBlank int. */ 64#define IRQ_VIA1_1 (9) /* VBlank int. */
@@ -163,7 +152,4 @@
163#define INT_CLK 24576 /* CLK while int_clk =2.456MHz and divide = 100 */ 152#define INT_CLK 24576 /* CLK while int_clk =2.456MHz and divide = 100 */
164#define INT_TICKS 246 /* to make sched_time = 99.902... HZ */ 153#define INT_TICKS 246 /* to make sched_time = 99.902... HZ */
165 154
166extern irq_node_t *mac_irq_list[NUM_MAC_SOURCES];
167extern void mac_do_irq_list(int irq, struct pt_regs *);
168
169#endif /* asm/macints.h */ 155#endif /* asm/macints.h */
diff --git a/include/asm-m68k/mvme147hw.h b/include/asm-m68k/mvme147hw.h
index f245139f3671..b81043108472 100644
--- a/include/asm-m68k/mvme147hw.h
+++ b/include/asm-m68k/mvme147hw.h
@@ -1,6 +1,8 @@
1#ifndef _MVME147HW_H_ 1#ifndef _MVME147HW_H_
2#define _MVME147HW_H_ 2#define _MVME147HW_H_
3 3
4#include <asm/irq.h>
5
4typedef struct { 6typedef struct {
5 unsigned char 7 unsigned char
6 ctrl, 8 ctrl,
@@ -72,39 +74,39 @@ struct pcc_regs {
72#define PCC_LEVEL_SCSI_PORT 0x04 74#define PCC_LEVEL_SCSI_PORT 0x04
73#define PCC_LEVEL_SCSI_DMA 0x04 75#define PCC_LEVEL_SCSI_DMA 0x04
74 76
75#define PCC_IRQ_AC_FAIL 0x40 77#define PCC_IRQ_AC_FAIL (IRQ_USER+0)
76#define PCC_IRQ_BERR 0x41 78#define PCC_IRQ_BERR (IRQ_USER+1)
77#define PCC_IRQ_ABORT 0x42 79#define PCC_IRQ_ABORT (IRQ_USER+2)
78/* #define PCC_IRQ_SERIAL 0x43 */ 80/* #define PCC_IRQ_SERIAL (IRQ_USER+3) */
79#define PCC_IRQ_PRINTER 0x47 81#define PCC_IRQ_PRINTER (IRQ_USER+7)
80#define PCC_IRQ_TIMER1 0x48 82#define PCC_IRQ_TIMER1 (IRQ_USER+8)
81#define PCC_IRQ_TIMER2 0x49 83#define PCC_IRQ_TIMER2 (IRQ_USER+9)
82#define PCC_IRQ_SOFTWARE1 0x4a 84#define PCC_IRQ_SOFTWARE1 (IRQ_USER+10)
83#define PCC_IRQ_SOFTWARE2 0x4b 85#define PCC_IRQ_SOFTWARE2 (IRQ_USER+11)
84 86
85 87
86#define M147_SCC_A_ADDR 0xfffe3002 88#define M147_SCC_A_ADDR 0xfffe3002
87#define M147_SCC_B_ADDR 0xfffe3000 89#define M147_SCC_B_ADDR 0xfffe3000
88#define M147_SCC_PCLK 5000000 90#define M147_SCC_PCLK 5000000
89 91
90#define MVME147_IRQ_SCSI_PORT 0x45 92#define MVME147_IRQ_SCSI_PORT (IRQ_USER+0x45)
91#define MVME147_IRQ_SCSI_DMA 0x46 93#define MVME147_IRQ_SCSI_DMA (IRQ_USER+0x46)
92 94
93/* SCC interrupts, for MVME147 */ 95/* SCC interrupts, for MVME147 */
94 96
95#define MVME147_IRQ_TYPE_PRIO 0 97#define MVME147_IRQ_TYPE_PRIO 0
96#define MVME147_IRQ_SCC_BASE 0x60 98#define MVME147_IRQ_SCC_BASE (IRQ_USER+32)
97#define MVME147_IRQ_SCCB_TX 0x60 99#define MVME147_IRQ_SCCB_TX (IRQ_USER+32)
98#define MVME147_IRQ_SCCB_STAT 0x62 100#define MVME147_IRQ_SCCB_STAT (IRQ_USER+34)
99#define MVME147_IRQ_SCCB_RX 0x64 101#define MVME147_IRQ_SCCB_RX (IRQ_USER+36)
100#define MVME147_IRQ_SCCB_SPCOND 0x66 102#define MVME147_IRQ_SCCB_SPCOND (IRQ_USER+38)
101#define MVME147_IRQ_SCCA_TX 0x68 103#define MVME147_IRQ_SCCA_TX (IRQ_USER+40)
102#define MVME147_IRQ_SCCA_STAT 0x6a 104#define MVME147_IRQ_SCCA_STAT (IRQ_USER+42)
103#define MVME147_IRQ_SCCA_RX 0x6c 105#define MVME147_IRQ_SCCA_RX (IRQ_USER+44)
104#define MVME147_IRQ_SCCA_SPCOND 0x6e 106#define MVME147_IRQ_SCCA_SPCOND (IRQ_USER+46)
105 107
106#define MVME147_LANCE_BASE 0xfffe1800 108#define MVME147_LANCE_BASE 0xfffe1800
107#define MVME147_LANCE_IRQ 0x44 109#define MVME147_LANCE_IRQ (IRQ_USER+4)
108 110
109#define ETHERNET_ADDRESS 0xfffe0778 111#define ETHERNET_ADDRESS 0xfffe0778
110 112
diff --git a/include/asm-m68k/mvme16xhw.h b/include/asm-m68k/mvme16xhw.h
index 5d07231d2426..6117f56653d2 100644
--- a/include/asm-m68k/mvme16xhw.h
+++ b/include/asm-m68k/mvme16xhw.h
@@ -66,28 +66,28 @@ typedef struct {
66 66
67#define MVME162_IRQ_TYPE_PRIO 0 67#define MVME162_IRQ_TYPE_PRIO 0
68 68
69#define MVME167_IRQ_PRN 0x54 69#define MVME167_IRQ_PRN (IRQ_USER+20)
70#define MVME16x_IRQ_I596 0x57 70#define MVME16x_IRQ_I596 (IRQ_USER+23)
71#define MVME16x_IRQ_SCSI 0x55 71#define MVME16x_IRQ_SCSI (IRQ_USER+21)
72#define MVME16x_IRQ_FLY 0x7f 72#define MVME16x_IRQ_FLY (IRQ_USER+63)
73#define MVME167_IRQ_SER_ERR 0x5c 73#define MVME167_IRQ_SER_ERR (IRQ_USER+28)
74#define MVME167_IRQ_SER_MODEM 0x5d 74#define MVME167_IRQ_SER_MODEM (IRQ_USER+29)
75#define MVME167_IRQ_SER_TX 0x5e 75#define MVME167_IRQ_SER_TX (IRQ_USER+30)
76#define MVME167_IRQ_SER_RX 0x5f 76#define MVME167_IRQ_SER_RX (IRQ_USER+31)
77#define MVME16x_IRQ_TIMER 0x59 77#define MVME16x_IRQ_TIMER (IRQ_USER+25)
78#define MVME167_IRQ_ABORT 0x6e 78#define MVME167_IRQ_ABORT (IRQ_USER+46)
79#define MVME162_IRQ_ABORT 0x5e 79#define MVME162_IRQ_ABORT (IRQ_USER+30)
80 80
81/* SCC interrupts, for MVME162 */ 81/* SCC interrupts, for MVME162 */
82#define MVME162_IRQ_SCC_BASE 0x40 82#define MVME162_IRQ_SCC_BASE (IRQ_USER+0)
83#define MVME162_IRQ_SCCB_TX 0x40 83#define MVME162_IRQ_SCCB_TX (IRQ_USER+0)
84#define MVME162_IRQ_SCCB_STAT 0x42 84#define MVME162_IRQ_SCCB_STAT (IRQ_USER+2)
85#define MVME162_IRQ_SCCB_RX 0x44 85#define MVME162_IRQ_SCCB_RX (IRQ_USER+4)
86#define MVME162_IRQ_SCCB_SPCOND 0x46 86#define MVME162_IRQ_SCCB_SPCOND (IRQ_USER+6)
87#define MVME162_IRQ_SCCA_TX 0x48 87#define MVME162_IRQ_SCCA_TX (IRQ_USER+8)
88#define MVME162_IRQ_SCCA_STAT 0x4a 88#define MVME162_IRQ_SCCA_STAT (IRQ_USER+10)
89#define MVME162_IRQ_SCCA_RX 0x4c 89#define MVME162_IRQ_SCCA_RX (IRQ_USER+12)
90#define MVME162_IRQ_SCCA_SPCOND 0x4e 90#define MVME162_IRQ_SCCA_SPCOND (IRQ_USER+14)
91 91
92/* MVME162 version register */ 92/* MVME162 version register */
93 93
diff --git a/include/asm-m68k/processor.h b/include/asm-m68k/processor.h
index 352799e71f08..8455f778b601 100644
--- a/include/asm-m68k/processor.h
+++ b/include/asm-m68k/processor.h
@@ -71,10 +71,10 @@ struct thread_struct {
71}; 71};
72 72
73#define INIT_THREAD { \ 73#define INIT_THREAD { \
74 ksp: sizeof(init_stack) + (unsigned long) init_stack, \ 74 .ksp = sizeof(init_stack) + (unsigned long) init_stack, \
75 sr: PS_S, \ 75 .sr = PS_S, \
76 fs: __KERNEL_DS, \ 76 .fs = __KERNEL_DS, \
77 info: INIT_THREAD_INFO(init_task) \ 77 .info = INIT_THREAD_INFO(init_task), \
78} 78}
79 79
80/* 80/*
diff --git a/include/asm-m68k/scatterlist.h b/include/asm-m68k/scatterlist.h
index d7c9b5c5e6c7..8e612266da51 100644
--- a/include/asm-m68k/scatterlist.h
+++ b/include/asm-m68k/scatterlist.h
@@ -2,18 +2,17 @@
2#define _M68K_SCATTERLIST_H 2#define _M68K_SCATTERLIST_H
3 3
4struct scatterlist { 4struct scatterlist {
5 /* These two are only valid if ADDRESS member of this
6 * struct is NULL.
7 */
8 struct page *page; 5 struct page *page;
9 unsigned int offset; 6 unsigned int offset;
10
11 unsigned int length; 7 unsigned int length;
12 8
13 __u32 dvma_address; /* A place to hang host-specific addresses at. */ 9 __u32 dma_address; /* A place to hang host-specific addresses at. */
14}; 10};
15 11
16/* This is bogus and should go away. */ 12/* This is bogus and should go away. */
17#define ISA_DMA_THRESHOLD (0x00ffffff) 13#define ISA_DMA_THRESHOLD (0x00ffffff)
18 14
15#define sg_dma_address(sg) ((sg)->dma_address)
16#define sg_dma_len(sg) ((sg)->length)
17
19#endif /* !(_M68K_SCATTERLIST_H) */ 18#endif /* !(_M68K_SCATTERLIST_H) */
diff --git a/include/asm-m68k/signal.h b/include/asm-m68k/signal.h
index b7b7ea20caab..85037a3d3e8e 100644
--- a/include/asm-m68k/signal.h
+++ b/include/asm-m68k/signal.h
@@ -156,13 +156,17 @@ typedef struct sigaltstack {
156 156
157static inline void sigaddset(sigset_t *set, int _sig) 157static inline void sigaddset(sigset_t *set, int _sig)
158{ 158{
159 __asm__("bfset %0{%1,#1}" : "=m" (*set) : "id" ((_sig - 1) ^ 31) 159 asm ("bfset %0{%1,#1}"
160 : "+od" (*set)
161 : "id" ((_sig - 1) ^ 31)
160 : "cc"); 162 : "cc");
161} 163}
162 164
163static inline void sigdelset(sigset_t *set, int _sig) 165static inline void sigdelset(sigset_t *set, int _sig)
164{ 166{
165 __asm__("bfclr %0{%1,#1}" : "=m"(*set) : "id"((_sig - 1) ^ 31) 167 asm ("bfclr %0{%1,#1}"
168 : "+od" (*set)
169 : "id" ((_sig - 1) ^ 31)
166 : "cc"); 170 : "cc");
167} 171}
168 172
@@ -175,8 +179,10 @@ static inline int __const_sigismember(sigset_t *set, int _sig)
175static inline int __gen_sigismember(sigset_t *set, int _sig) 179static inline int __gen_sigismember(sigset_t *set, int _sig)
176{ 180{
177 int ret; 181 int ret;
178 __asm__("bfextu %1{%2,#1},%0" 182 asm ("bfextu %1{%2,#1},%0"
179 : "=d"(ret) : "m"(*set), "id"((_sig-1) ^ 31)); 183 : "=d" (ret)
184 : "od" (*set), "id" ((_sig-1) ^ 31)
185 : "cc");
180 return ret; 186 return ret;
181} 187}
182 188
@@ -187,7 +193,10 @@ static inline int __gen_sigismember(sigset_t *set, int _sig)
187 193
188static inline int sigfindinword(unsigned long word) 194static inline int sigfindinword(unsigned long word)
189{ 195{
190 __asm__("bfffo %1{#0,#0},%0" : "=d"(word) : "d"(word & -word) : "cc"); 196 asm ("bfffo %1{#0,#0},%0"
197 : "=d" (word)
198 : "d" (word & -word)
199 : "cc");
191 return word ^ 31; 200 return word ^ 31;
192} 201}
193 202
diff --git a/include/asm-m68k/sun3ints.h b/include/asm-m68k/sun3ints.h
index bd038fccb64b..de91fa071b99 100644
--- a/include/asm-m68k/sun3ints.h
+++ b/include/asm-m68k/sun3ints.h
@@ -12,37 +12,25 @@
12#define SUN3INTS_H 12#define SUN3INTS_H
13 13
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/kernel.h>
16#include <linux/sched.h>
17#include <linux/kernel_stat.h>
18#include <linux/interrupt.h> 15#include <linux/interrupt.h>
19#include <linux/seq_file.h>
20#include <asm/segment.h>
21#include <asm/intersil.h> 16#include <asm/intersil.h>
22#include <asm/oplib.h> 17#include <asm/oplib.h>
18#include <asm/traps.h>
23 19
24#define SUN3_INT_VECS 192 20#define SUN3_INT_VECS 192
25 21
26void sun3_enable_irq(unsigned int irq); 22void sun3_enable_irq(unsigned int irq);
27void sun3_disable_irq(unsigned int irq); 23void sun3_disable_irq(unsigned int irq);
28int sun3_request_irq(unsigned int irq,
29 irqreturn_t (*handler)(int, void *, struct pt_regs *),
30 unsigned long flags, const char *devname, void *dev_id
31 );
32extern void sun3_init_IRQ (void); 24extern void sun3_init_IRQ (void);
33extern irqreturn_t (*sun3_default_handler[]) (int, void *, struct pt_regs *);
34extern void sun3_free_irq (unsigned int irq, void *dev_id);
35extern void sun3_enable_interrupts (void); 25extern void sun3_enable_interrupts (void);
36extern void sun3_disable_interrupts (void); 26extern void sun3_disable_interrupts (void);
37extern int show_sun3_interrupts(struct seq_file *, void *);
38extern irqreturn_t sun3_process_int(int, struct pt_regs *);
39extern volatile unsigned char* sun3_intreg; 27extern volatile unsigned char* sun3_intreg;
40 28
41/* master list of VME vectors -- don't fuck with this */ 29/* master list of VME vectors -- don't fuck with this */
42#define SUN3_VEC_FLOPPY 0x40 30#define SUN3_VEC_FLOPPY (IRQ_USER+0)
43#define SUN3_VEC_VMESCSI0 0x40 31#define SUN3_VEC_VMESCSI0 (IRQ_USER+0)
44#define SUN3_VEC_VMESCSI1 0x41 32#define SUN3_VEC_VMESCSI1 (IRQ_USER+1)
45#define SUN3_VEC_CG 0xA8 33#define SUN3_VEC_CG (IRQ_USER+104)
46 34
47 35
48#endif /* SUN3INTS_H */ 36#endif /* SUN3INTS_H */
diff --git a/include/asm-m68k/traps.h b/include/asm-m68k/traps.h
index 475056191252..8caef25624c7 100644
--- a/include/asm-m68k/traps.h
+++ b/include/asm-m68k/traps.h
@@ -13,8 +13,15 @@
13 13
14#ifndef __ASSEMBLY__ 14#ifndef __ASSEMBLY__
15 15
16#include <linux/linkage.h>
17#include <asm/ptrace.h>
18
16typedef void (*e_vector)(void); 19typedef void (*e_vector)(void);
17 20
21asmlinkage void auto_inthandler(void);
22asmlinkage void user_inthandler(void);
23asmlinkage void bad_inthandler(void);
24
18extern e_vector vectors[]; 25extern e_vector vectors[];
19 26
20#endif 27#endif
diff --git a/include/asm-m68k/uaccess.h b/include/asm-m68k/uaccess.h
index 2ffd87b0a769..88b1f47400e1 100644
--- a/include/asm-m68k/uaccess.h
+++ b/include/asm-m68k/uaccess.h
@@ -4,8 +4,9 @@
4/* 4/*
5 * User space memory access functions 5 * User space memory access functions
6 */ 6 */
7#include <linux/compiler.h>
7#include <linux/errno.h> 8#include <linux/errno.h>
8#include <linux/sched.h> 9#include <linux/types.h>
9#include <asm/segment.h> 10#include <asm/segment.h>
10 11
11#define VERIFY_READ 0 12#define VERIFY_READ 0
@@ -32,858 +33,335 @@ struct exception_table_entry
32 unsigned long insn, fixup; 33 unsigned long insn, fixup;
33}; 34};
34 35
36extern int __put_user_bad(void);
37extern int __get_user_bad(void);
38
39#define __put_user_asm(res, x, ptr, bwl, reg, err) \
40asm volatile ("\n" \
41 "1: moves."#bwl" %2,%1\n" \
42 "2:\n" \
43 " .section .fixup,\"ax\"\n" \
44 " .even\n" \
45 "10: moveq.l %3,%0\n" \
46 " jra 2b\n" \
47 " .previous\n" \
48 "\n" \
49 " .section __ex_table,\"a\"\n" \
50 " .align 4\n" \
51 " .long 1b,10b\n" \
52 " .long 2b,10b\n" \
53 " .previous" \
54 : "+d" (res), "=m" (*(ptr)) \
55 : #reg (x), "i" (err))
35 56
36/* 57/*
37 * These are the main single-value transfer routines. They automatically 58 * These are the main single-value transfer routines. They automatically
38 * use the right size if we just have the right pointer type. 59 * use the right size if we just have the right pointer type.
39 */ 60 */
40 61
41#define put_user(x, ptr) \ 62#define __put_user(x, ptr) \
42({ \ 63({ \
43 int __pu_err; \ 64 typeof(*(ptr)) __pu_val = (x); \
44 typeof(*(ptr)) __pu_val = (x); \ 65 int __pu_err = 0; \
45 __chk_user_ptr(ptr); \ 66 __chk_user_ptr(ptr); \
46 switch (sizeof (*(ptr))) { \ 67 switch (sizeof (*(ptr))) { \
47 case 1: \ 68 case 1: \
48 __put_user_asm(__pu_err, __pu_val, ptr, b); \ 69 __put_user_asm(__pu_err, __pu_val, ptr, b, d, -EFAULT); \
49 break; \ 70 break; \
50 case 2: \ 71 case 2: \
51 __put_user_asm(__pu_err, __pu_val, ptr, w); \ 72 __put_user_asm(__pu_err, __pu_val, ptr, w, d, -EFAULT); \
52 break; \ 73 break; \
53 case 4: \ 74 case 4: \
54 __put_user_asm(__pu_err, __pu_val, ptr, l); \ 75 __put_user_asm(__pu_err, __pu_val, ptr, l, r, -EFAULT); \
55 break; \ 76 break; \
56 case 8: \ 77 case 8: \
57 __pu_err = __constant_copy_to_user(ptr, &__pu_val, 8); \ 78 { \
58 break; \ 79 const void *__pu_ptr = (ptr); \
59 default: \ 80 asm volatile ("\n" \
60 __pu_err = __put_user_bad(); \ 81 "1: moves.l %2,(%1)+\n" \
61 break; \ 82 "2: moves.l %R2,(%1)\n" \
62 } \ 83 "3:\n" \
63 __pu_err; \ 84 " .section .fixup,\"ax\"\n" \
85 " .even\n" \
86 "10: movel %3,%0\n" \
87 " jra 3b\n" \
88 " .previous\n" \
89 "\n" \
90 " .section __ex_table,\"a\"\n" \
91 " .align 4\n" \
92 " .long 1b,10b\n" \
93 " .long 2b,10b\n" \
94 " .long 3b,10b\n" \
95 " .previous" \
96 : "+d" (__pu_err), "+a" (__pu_ptr) \
97 : "r" (__pu_val), "i" (-EFAULT) \
98 : "memory"); \
99 break; \
100 } \
101 default: \
102 __pu_err = __put_user_bad(); \
103 break; \
104 } \
105 __pu_err; \
64}) 106})
65#define __put_user(x, ptr) put_user(x, ptr) 107#define put_user(x, ptr) __put_user(x, ptr)
66
67extern int __put_user_bad(void);
68 108
69/*
70 * Tell gcc we read from memory instead of writing: this is because
71 * we do not write to any memory gcc knows about, so there are no
72 * aliasing issues.
73 */
74#define __put_user_asm(err,x,ptr,bwl) \
75__asm__ __volatile__ \
76 ("21:moves" #bwl " %2,%1\n" \
77 "1:\n" \
78 ".section .fixup,\"ax\"\n" \
79 " .even\n" \
80 "2: movel %3,%0\n" \
81 " jra 1b\n" \
82 ".previous\n" \
83 ".section __ex_table,\"a\"\n" \
84 " .align 4\n" \
85 " .long 21b,2b\n" \
86 " .long 1b,2b\n" \
87 ".previous" \
88 : "=d"(err) \
89 : "m"(*(ptr)), "r"(x), "i"(-EFAULT), "0"(0))
90 109
91#define get_user(x, ptr) \ 110#define __get_user_asm(res, x, ptr, type, bwl, reg, err) ({ \
92({ \ 111 type __gu_val; \
93 int __gu_err; \ 112 asm volatile ("\n" \
94 typeof(*(ptr)) __gu_val; \ 113 "1: moves."#bwl" %2,%1\n" \
95 __chk_user_ptr(ptr); \ 114 "2:\n" \
96 switch (sizeof(*(ptr))) { \ 115 " .section .fixup,\"ax\"\n" \
97 case 1: \ 116 " .even\n" \
98 __get_user_asm(__gu_err, __gu_val, ptr, b, "=d"); \ 117 "10: move.l %3,%0\n" \
99 break; \ 118 " sub."#bwl" %1,%1\n" \
100 case 2: \ 119 " jra 2b\n" \
101 __get_user_asm(__gu_err, __gu_val, ptr, w, "=r"); \ 120 " .previous\n" \
102 break; \ 121 "\n" \
103 case 4: \ 122 " .section __ex_table,\"a\"\n" \
104 __get_user_asm(__gu_err, __gu_val, ptr, l, "=r"); \ 123 " .align 4\n" \
105 break; \ 124 " .long 1b,10b\n" \
106 case 8: \ 125 " .previous" \
107 __gu_err = __constant_copy_from_user(&__gu_val, ptr, 8); \ 126 : "+d" (res), "=&" #reg (__gu_val) \
108 break; \ 127 : "m" (*(ptr)), "i" (err)); \
109 default: \ 128 (x) = (typeof(*(ptr)))(long)__gu_val; \
110 __gu_val = (typeof(*(ptr)))0; \
111 __gu_err = __get_user_bad(); \
112 break; \
113 } \
114 (x) = __gu_val; \
115 __gu_err; \
116}) 129})
117#define __get_user(x, ptr) get_user(x, ptr)
118
119extern int __get_user_bad(void);
120
121#define __get_user_asm(err,x,ptr,bwl,reg) \
122__asm__ __volatile__ \
123 ("1: moves" #bwl " %2,%1\n" \
124 "2:\n" \
125 ".section .fixup,\"ax\"\n" \
126 " .even\n" \
127 "3: movel %3,%0\n" \
128 " sub" #bwl " %1,%1\n" \
129 " jra 2b\n" \
130 ".previous\n" \
131 ".section __ex_table,\"a\"\n" \
132 " .align 4\n" \
133 " .long 1b,3b\n" \
134 ".previous" \
135 : "=d"(err), reg(x) \
136 : "m"(*(ptr)), "i" (-EFAULT), "0"(0))
137 130
138static inline unsigned long 131#define __get_user(x, ptr) \
139__generic_copy_from_user(void *to, const void __user *from, unsigned long n) 132({ \
140{ 133 int __gu_err = 0; \
141 unsigned long tmp; 134 __chk_user_ptr(ptr); \
142 __asm__ __volatile__ 135 switch (sizeof(*(ptr))) { \
143 (" tstl %2\n" 136 case 1: \
144 " jeq 2f\n" 137 __get_user_asm(__gu_err, x, ptr, u8, b, d, -EFAULT); \
145 "1: movesl (%1)+,%3\n" 138 break; \
146 " movel %3,(%0)+\n" 139 case 2: \
147 " subql #1,%2\n" 140 __get_user_asm(__gu_err, x, ptr, u16, w, d, -EFAULT); \
148 " jne 1b\n" 141 break; \
149 "2: movel %4,%2\n" 142 case 4: \
150 " bclr #1,%2\n" 143 __get_user_asm(__gu_err, x, ptr, u32, l, r, -EFAULT); \
151 " jeq 4f\n" 144 break; \
152 "3: movesw (%1)+,%3\n" 145/* case 8: disabled because gcc-4.1 has a broken typeof \
153 " movew %3,(%0)+\n" 146 { \
154 "4: bclr #0,%2\n" 147 const void *__gu_ptr = (ptr); \
155 " jeq 6f\n" 148 u64 __gu_val; \
156 "5: movesb (%1)+,%3\n" 149 asm volatile ("\n" \
157 " moveb %3,(%0)+\n" 150 "1: moves.l (%2)+,%1\n" \
158 "6:\n" 151 "2: moves.l (%2),%R1\n" \
159 ".section .fixup,\"ax\"\n" 152 "3:\n" \
160 " .even\n" 153 " .section .fixup,\"ax\"\n" \
161 "7: movel %2,%%d0\n" 154 " .even\n" \
162 "71:clrl (%0)+\n" 155 "10: move.l %3,%0\n" \
163 " subql #1,%%d0\n" 156 " sub.l %1,%1\n" \
164 " jne 71b\n" 157 " sub.l %R1,%R1\n" \
165 " lsll #2,%2\n" 158 " jra 3b\n" \
166 " addl %4,%2\n" 159 " .previous\n" \
167 " btst #1,%4\n" 160 "\n" \
168 " jne 81f\n" 161 " .section __ex_table,\"a\"\n" \
169 " btst #0,%4\n" 162 " .align 4\n" \
170 " jne 91f\n" 163 " .long 1b,10b\n" \
171 " jra 6b\n" 164 " .long 2b,10b\n" \
172 "8: addql #2,%2\n" 165 " .previous" \
173 "81:clrw (%0)+\n" 166 : "+d" (__gu_err), "=&r" (__gu_val), \
174 " btst #0,%4\n" 167 "+a" (__gu_ptr) \
175 " jne 91f\n" 168 : "i" (-EFAULT) \
176 " jra 6b\n" 169 : "memory"); \
177 "9: addql #1,%2\n" 170 (x) = (typeof(*(ptr)))__gu_val; \
178 "91:clrb (%0)+\n" 171 break; \
179 " jra 6b\n" 172 } */ \
180 ".previous\n" 173 default: \
181 ".section __ex_table,\"a\"\n" 174 __gu_err = __get_user_bad(); \
182 " .align 4\n" 175 break; \
183 " .long 1b,7b\n" 176 } \
184 " .long 3b,8b\n" 177 __gu_err; \
185 " .long 5b,9b\n" 178})
186 ".previous" 179#define get_user(x, ptr) __get_user(x, ptr)
187 : "=a"(to), "=a"(from), "=d"(n), "=&d"(tmp)
188 : "d"(n & 3), "0"(to), "1"(from), "2"(n/4)
189 : "d0", "memory");
190 return n;
191}
192 180
193static inline unsigned long 181unsigned long __generic_copy_from_user(void *to, const void __user *from, unsigned long n);
194__generic_copy_to_user(void __user *to, const void *from, unsigned long n) 182unsigned long __generic_copy_to_user(void __user *to, const void *from, unsigned long n);
195{
196 unsigned long tmp;
197 __asm__ __volatile__
198 (" tstl %2\n"
199 " jeq 3f\n"
200 "1: movel (%1)+,%3\n"
201 "22:movesl %3,(%0)+\n"
202 "2: subql #1,%2\n"
203 " jne 1b\n"
204 "3: movel %4,%2\n"
205 " bclr #1,%2\n"
206 " jeq 4f\n"
207 " movew (%1)+,%3\n"
208 "24:movesw %3,(%0)+\n"
209 "4: bclr #0,%2\n"
210 " jeq 5f\n"
211 " moveb (%1)+,%3\n"
212 "25:movesb %3,(%0)+\n"
213 "5:\n"
214 ".section .fixup,\"ax\"\n"
215 " .even\n"
216 "60:addql #1,%2\n"
217 "6: lsll #2,%2\n"
218 " addl %4,%2\n"
219 " jra 5b\n"
220 "7: addql #2,%2\n"
221 " jra 5b\n"
222 "8: addql #1,%2\n"
223 " jra 5b\n"
224 ".previous\n"
225 ".section __ex_table,\"a\"\n"
226 " .align 4\n"
227 " .long 1b,60b\n"
228 " .long 22b,6b\n"
229 " .long 2b,6b\n"
230 " .long 24b,7b\n"
231 " .long 3b,60b\n"
232 " .long 4b,7b\n"
233 " .long 25b,8b\n"
234 " .long 5b,8b\n"
235 ".previous"
236 : "=a"(to), "=a"(from), "=d"(n), "=&d"(tmp)
237 : "r"(n & 3), "0"(to), "1"(from), "2"(n / 4)
238 : "memory");
239 return n;
240}
241 183
242#define __copy_from_user_big(to, from, n, fixup, copy) \ 184#define __constant_copy_from_user_asm(res, to, from, tmp, n, s1, s2, s3)\
243 __asm__ __volatile__ \ 185 asm volatile ("\n" \
244 ("10: movesl (%1)+,%%d0\n" \ 186 "1: moves."#s1" (%2)+,%3\n" \
245 " movel %%d0,(%0)+\n" \ 187 " move."#s1" %3,(%1)+\n" \
246 " subql #1,%2\n" \ 188 "2: moves."#s2" (%2)+,%3\n" \
247 " jne 10b\n" \ 189 " move."#s2" %3,(%1)+\n" \
248 ".section .fixup,\"ax\"\n" \ 190 " .ifnc \""#s3"\",\"\"\n" \
249 " .even\n" \ 191 "3: moves."#s3" (%2)+,%3\n" \
250 "11: movel %2,%%d0\n" \ 192 " move."#s3" %3,(%1)+\n" \
251 "13: clrl (%0)+\n" \ 193 " .endif\n" \
252 " subql #1,%%d0\n" \ 194 "4:\n" \
253 " jne 13b\n" \ 195 " .section __ex_table,\"a\"\n" \
254 " lsll #2,%2\n" \ 196 " .align 4\n" \
255 fixup "\n" \ 197 " .long 1b,10f\n" \
256 " jra 12f\n" \ 198 " .long 2b,20f\n" \
257 ".previous\n" \ 199 " .ifnc \""#s3"\",\"\"\n" \
258 ".section __ex_table,\"a\"\n" \ 200 " .long 3b,30f\n" \
259 " .align 4\n" \ 201 " .endif\n" \
260 " .long 10b,11b\n" \ 202 " .previous\n" \
261 ".previous\n" \ 203 "\n" \
262 copy "\n" \ 204 " .section .fixup,\"ax\"\n" \
263 "12:" \ 205 " .even\n" \
264 : "=a"(to), "=a"(from), "=d"(n) \ 206 "10: clr."#s1" (%1)+\n" \
265 : "0"(to), "1"(from), "2"(n/4) \ 207 "20: clr."#s2" (%1)+\n" \
266 : "d0", "memory") 208 " .ifnc \""#s3"\",\"\"\n" \
209 "30: clr."#s3" (%1)+\n" \
210 " .endif\n" \
211 " moveq.l #"#n",%0\n" \
212 " jra 4b\n" \
213 " .previous\n" \
214 : "+d" (res), "+&a" (to), "+a" (from), "=&d" (tmp) \
215 : : "memory")
267 216
268static inline unsigned long 217static __always_inline unsigned long
269__constant_copy_from_user(void *to, const void __user *from, unsigned long n) 218__constant_copy_from_user(void *to, const void __user *from, unsigned long n)
270{ 219{
271 switch (n) { 220 unsigned long res = 0, tmp;
272 case 0: 221
273 break; 222 switch (n) {
274 case 1:
275 __asm__ __volatile__
276 ("1: movesb (%1)+,%%d0\n"
277 " moveb %%d0,(%0)+\n"
278 "2:\n"
279 ".section .fixup,\"ax\"\n"
280 " .even\n"
281 "3: addql #1,%2\n"
282 " clrb (%0)+\n"
283 " jra 2b\n"
284 ".previous\n"
285 ".section __ex_table,\"a\"\n"
286 " .align 4\n"
287 " .long 1b,3b\n"
288 ".previous"
289 : "=a"(to), "=a"(from), "=d"(n)
290 : "0"(to), "1"(from), "2"(0)
291 : "d0", "memory");
292 break;
293 case 2:
294 __asm__ __volatile__
295 ("1: movesw (%1)+,%%d0\n"
296 " movew %%d0,(%0)+\n"
297 "2:\n"
298 ".section .fixup,\"ax\"\n"
299 " .even\n"
300 "3: addql #2,%2\n"
301 " clrw (%0)+\n"
302 " jra 2b\n"
303 ".previous\n"
304 ".section __ex_table,\"a\"\n"
305 " .align 4\n"
306 " .long 1b,3b\n"
307 ".previous"
308 : "=a"(to), "=a"(from), "=d"(n)
309 : "0"(to), "1"(from), "2"(0)
310 : "d0", "memory");
311 break;
312 case 3:
313 __asm__ __volatile__
314 ("1: movesw (%1)+,%%d0\n"
315 " movew %%d0,(%0)+\n"
316 "2: movesb (%1)+,%%d0\n"
317 " moveb %%d0,(%0)+\n"
318 "3:"
319 ".section .fixup,\"ax\"\n"
320 " .even\n"
321 "4: addql #2,%2\n"
322 " clrw (%0)+\n"
323 "5: addql #1,%2\n"
324 " clrb (%0)+\n"
325 " jra 3b\n"
326 ".previous\n"
327 ".section __ex_table,\"a\"\n"
328 " .align 4\n"
329 " .long 1b,4b\n"
330 " .long 2b,5b\n"
331 ".previous"
332 : "=a"(to), "=a"(from), "=d"(n)
333 : "0"(to), "1"(from), "2"(0)
334 : "d0", "memory");
335 break;
336 case 4:
337 __asm__ __volatile__
338 ("1: movesl (%1)+,%%d0\n"
339 " movel %%d0,(%0)+\n"
340 "2:"
341 ".section .fixup,\"ax\"\n"
342 " .even\n"
343 "3: addql #4,%2\n"
344 " clrl (%0)+\n"
345 " jra 2b\n"
346 ".previous\n"
347 ".section __ex_table,\"a\"\n"
348 " .align 4\n"
349 " .long 1b,3b\n"
350 ".previous"
351 : "=a"(to), "=a"(from), "=d"(n)
352 : "0"(to), "1"(from), "2"(0)
353 : "d0", "memory");
354 break;
355 case 8:
356 __asm__ __volatile__
357 ("1: movesl (%1)+,%%d0\n"
358 " movel %%d0,(%0)+\n"
359 "2: movesl (%1)+,%%d0\n"
360 " movel %%d0,(%0)+\n"
361 "3:"
362 ".section .fixup,\"ax\"\n"
363 " .even\n"
364 "4: addql #4,%2\n"
365 " clrl (%0)+\n"
366 "5: addql #4,%2\n"
367 " clrl (%0)+\n"
368 " jra 3b\n"
369 ".previous\n"
370 ".section __ex_table,\"a\"\n"
371 " .align 4\n"
372 " .long 1b,4b\n"
373 " .long 2b,5b\n"
374 ".previous"
375 : "=a"(to), "=a"(from), "=d"(n)
376 : "0"(to), "1"(from), "2"(0)
377 : "d0", "memory");
378 break;
379 case 12:
380 __asm__ __volatile__
381 ("1: movesl (%1)+,%%d0\n"
382 " movel %%d0,(%0)+\n"
383 "2: movesl (%1)+,%%d0\n"
384 " movel %%d0,(%0)+\n"
385 "3: movesl (%1)+,%%d0\n"
386 " movel %%d0,(%0)+\n"
387 "4:"
388 ".section .fixup,\"ax\"\n"
389 " .even\n"
390 "5: addql #4,%2\n"
391 " clrl (%0)+\n"
392 "6: addql #4,%2\n"
393 " clrl (%0)+\n"
394 "7: addql #4,%2\n"
395 " clrl (%0)+\n"
396 " jra 4b\n"
397 ".previous\n"
398 ".section __ex_table,\"a\"\n"
399 " .align 4\n"
400 " .long 1b,5b\n"
401 " .long 2b,6b\n"
402 " .long 3b,7b\n"
403 ".previous"
404 : "=a"(to), "=a"(from), "=d"(n)
405 : "0"(to), "1"(from), "2"(0)
406 : "d0", "memory");
407 break;
408 case 16:
409 __asm__ __volatile__
410 ("1: movesl (%1)+,%%d0\n"
411 " movel %%d0,(%0)+\n"
412 "2: movesl (%1)+,%%d0\n"
413 " movel %%d0,(%0)+\n"
414 "3: movesl (%1)+,%%d0\n"
415 " movel %%d0,(%0)+\n"
416 "4: movesl (%1)+,%%d0\n"
417 " movel %%d0,(%0)+\n"
418 "5:"
419 ".section .fixup,\"ax\"\n"
420 " .even\n"
421 "6: addql #4,%2\n"
422 " clrl (%0)+\n"
423 "7: addql #4,%2\n"
424 " clrl (%0)+\n"
425 "8: addql #4,%2\n"
426 " clrl (%0)+\n"
427 "9: addql #4,%2\n"
428 " clrl (%0)+\n"
429 " jra 5b\n"
430 ".previous\n"
431 ".section __ex_table,\"a\"\n"
432 " .align 4\n"
433 " .long 1b,6b\n"
434 " .long 2b,7b\n"
435 " .long 3b,8b\n"
436 " .long 4b,9b\n"
437 ".previous"
438 : "=a"(to), "=a"(from), "=d"(n)
439 : "0"(to), "1"(from), "2"(0)
440 : "d0", "memory");
441 break;
442 default:
443 switch (n & 3) {
444 case 0:
445 __copy_from_user_big(to, from, n, "", "");
446 break;
447 case 1: 223 case 1:
448 __copy_from_user_big(to, from, n, 224 __get_user_asm(res, *(u8 *)to, (u8 *)from, u8, b, d, 1);
449 /* fixup */ 225 break;
450 "1: addql #1,%2\n"
451 " clrb (%0)+",
452 /* copy */
453 "2: movesb (%1)+,%%d0\n"
454 " moveb %%d0,(%0)+\n"
455 ".section __ex_table,\"a\"\n"
456 " .long 2b,1b\n"
457 ".previous");
458 break;
459 case 2: 226 case 2:
460 __copy_from_user_big(to, from, n, 227 __get_user_asm(res, *(u16 *)to, (u16 *)from, u16, w, d, 2);
461 /* fixup */ 228 break;
462 "1: addql #2,%2\n"
463 " clrw (%0)+",
464 /* copy */
465 "2: movesw (%1)+,%%d0\n"
466 " movew %%d0,(%0)+\n"
467 ".section __ex_table,\"a\"\n"
468 " .long 2b,1b\n"
469 ".previous");
470 break;
471 case 3: 229 case 3:
472 __copy_from_user_big(to, from, n, 230 __constant_copy_from_user_asm(res, to, from, tmp, 3, w, b,);
473 /* fixup */ 231 break;
474 "1: addql #2,%2\n" 232 case 4:
475 " clrw (%0)+\n" 233 __get_user_asm(res, *(u32 *)to, (u32 *)from, u32, l, r, 4);
476 "2: addql #1,%2\n" 234 break;
477 " clrb (%0)+", 235 case 5:
478 /* copy */ 236 __constant_copy_from_user_asm(res, to, from, tmp, 5, l, b,);
479 "3: movesw (%1)+,%%d0\n" 237 break;
480 " movew %%d0,(%0)+\n" 238 case 6:
481 "4: movesb (%1)+,%%d0\n" 239 __constant_copy_from_user_asm(res, to, from, tmp, 6, l, w,);
482 " moveb %%d0,(%0)+\n" 240 break;
483 ".section __ex_table,\"a\"\n" 241 case 7:
484 " .long 3b,1b\n" 242 __constant_copy_from_user_asm(res, to, from, tmp, 7, l, w, b);
485 " .long 4b,2b\n" 243 break;
486 ".previous"); 244 case 8:
487 break; 245 __constant_copy_from_user_asm(res, to, from, tmp, 8, l, l,);
246 break;
247 case 9:
248 __constant_copy_from_user_asm(res, to, from, tmp, 9, l, l, b);
249 break;
250 case 10:
251 __constant_copy_from_user_asm(res, to, from, tmp, 10, l, l, w);
252 break;
253 case 12:
254 __constant_copy_from_user_asm(res, to, from, tmp, 12, l, l, l);
255 break;
256 default:
257 /* we limit the inlined version to 3 moves */
258 return __generic_copy_from_user(to, from, n);
488 } 259 }
489 break;
490 }
491 return n;
492}
493 260
494#define __copy_to_user_big(to, from, n, fixup, copy) \ 261 return res;
495 __asm__ __volatile__ \ 262}
496 ("10: movel (%1)+,%%d0\n" \
497 "31: movesl %%d0,(%0)+\n" \
498 "11: subql #1,%2\n" \
499 " jne 10b\n" \
500 "41:\n" \
501 ".section .fixup,\"ax\"\n" \
502 " .even\n" \
503 "22: addql #1,%2\n" \
504 "12: lsll #2,%2\n" \
505 fixup "\n" \
506 " jra 13f\n" \
507 ".previous\n" \
508 ".section __ex_table,\"a\"\n" \
509 " .align 4\n" \
510 " .long 10b,22b\n" \
511 " .long 31b,12b\n" \
512 " .long 11b,12b\n" \
513 " .long 41b,22b\n" \
514 ".previous\n" \
515 copy "\n" \
516 "13:" \
517 : "=a"(to), "=a"(from), "=d"(n) \
518 : "0"(to), "1"(from), "2"(n/4) \
519 : "d0", "memory")
520 263
521#define __copy_to_user_inatomic __copy_to_user 264#define __constant_copy_to_user_asm(res, to, from, tmp, n, s1, s2, s3) \
522#define __copy_from_user_inatomic __copy_from_user 265 asm volatile ("\n" \
266 " move."#s1" (%2)+,%3\n" \
267 "11: moves."#s1" %3,(%1)+\n" \
268 "12: move."#s2" (%2)+,%3\n" \
269 "21: moves."#s2" %3,(%1)+\n" \
270 "22:\n" \
271 " .ifnc \""#s3"\",\"\"\n" \
272 " move."#s3" (%2)+,%3\n" \
273 "31: moves."#s3" %3,(%1)+\n" \
274 "32:\n" \
275 " .endif\n" \
276 "4:\n" \
277 "\n" \
278 " .section __ex_table,\"a\"\n" \
279 " .align 4\n" \
280 " .long 11b,5f\n" \
281 " .long 12b,5f\n" \
282 " .long 21b,5f\n" \
283 " .long 22b,5f\n" \
284 " .ifnc \""#s3"\",\"\"\n" \
285 " .long 31b,5f\n" \
286 " .long 32b,5f\n" \
287 " .endif\n" \
288 " .previous\n" \
289 "\n" \
290 " .section .fixup,\"ax\"\n" \
291 " .even\n" \
292 "5: moveq.l #"#n",%0\n" \
293 " jra 4b\n" \
294 " .previous\n" \
295 : "+d" (res), "+a" (to), "+a" (from), "=&d" (tmp) \
296 : : "memory")
523 297
524static inline unsigned long 298static __always_inline unsigned long
525__constant_copy_to_user(void __user *to, const void *from, unsigned long n) 299__constant_copy_to_user(void __user *to, const void *from, unsigned long n)
526{ 300{
527 switch (n) { 301 unsigned long res = 0, tmp;
528 case 0: 302
529 break; 303 switch (n) {
530 case 1:
531 __asm__ __volatile__
532 (" moveb (%1)+,%%d0\n"
533 "21:movesb %%d0,(%0)+\n"
534 "1:\n"
535 ".section .fixup,\"ax\"\n"
536 " .even\n"
537 "2: addql #1,%2\n"
538 " jra 1b\n"
539 ".previous\n"
540 ".section __ex_table,\"a\"\n"
541 " .align 4\n "
542 " .long 21b,2b\n"
543 " .long 1b,2b\n"
544 ".previous"
545 : "=a"(to), "=a"(from), "=d"(n)
546 : "0"(to), "1"(from), "2"(0)
547 : "d0", "memory");
548 break;
549 case 2:
550 __asm__ __volatile__
551 (" movew (%1)+,%%d0\n"
552 "21:movesw %%d0,(%0)+\n"
553 "1:\n"
554 ".section .fixup,\"ax\"\n"
555 " .even\n"
556 "2: addql #2,%2\n"
557 " jra 1b\n"
558 ".previous\n"
559 ".section __ex_table,\"a\"\n"
560 " .align 4\n"
561 " .long 21b,2b\n"
562 " .long 1b,2b\n"
563 ".previous"
564 : "=a"(to), "=a"(from), "=d"(n)
565 : "0"(to), "1"(from), "2"(0)
566 : "d0", "memory");
567 break;
568 case 3:
569 __asm__ __volatile__
570 (" movew (%1)+,%%d0\n"
571 "21:movesw %%d0,(%0)+\n"
572 "1: moveb (%1)+,%%d0\n"
573 "22:movesb %%d0,(%0)+\n"
574 "2:\n"
575 ".section .fixup,\"ax\"\n"
576 " .even\n"
577 "3: addql #2,%2\n"
578 "4: addql #1,%2\n"
579 " jra 2b\n"
580 ".previous\n"
581 ".section __ex_table,\"a\"\n"
582 " .align 4\n"
583 " .long 21b,3b\n"
584 " .long 1b,3b\n"
585 " .long 22b,4b\n"
586 " .long 2b,4b\n"
587 ".previous"
588 : "=a"(to), "=a"(from), "=d"(n)
589 : "0"(to), "1"(from), "2"(0)
590 : "d0", "memory");
591 break;
592 case 4:
593 __asm__ __volatile__
594 (" movel (%1)+,%%d0\n"
595 "21:movesl %%d0,(%0)+\n"
596 "1:\n"
597 ".section .fixup,\"ax\"\n"
598 " .even\n"
599 "2: addql #4,%2\n"
600 " jra 1b\n"
601 ".previous\n"
602 ".section __ex_table,\"a\"\n"
603 " .align 4\n"
604 " .long 21b,2b\n"
605 " .long 1b,2b\n"
606 ".previous"
607 : "=a"(to), "=a"(from), "=d"(n)
608 : "0"(to), "1"(from), "2"(0)
609 : "d0", "memory");
610 break;
611 case 8:
612 __asm__ __volatile__
613 (" movel (%1)+,%%d0\n"
614 "21:movesl %%d0,(%0)+\n"
615 "1: movel (%1)+,%%d0\n"
616 "22:movesl %%d0,(%0)+\n"
617 "2:\n"
618 ".section .fixup,\"ax\"\n"
619 " .even\n"
620 "3: addql #4,%2\n"
621 "4: addql #4,%2\n"
622 " jra 2b\n"
623 ".previous\n"
624 ".section __ex_table,\"a\"\n"
625 " .align 4\n"
626 " .long 21b,3b\n"
627 " .long 1b,3b\n"
628 " .long 22b,4b\n"
629 " .long 2b,4b\n"
630 ".previous"
631 : "=a"(to), "=a"(from), "=d"(n)
632 : "0"(to), "1"(from), "2"(0)
633 : "d0", "memory");
634 break;
635 case 12:
636 __asm__ __volatile__
637 (" movel (%1)+,%%d0\n"
638 "21:movesl %%d0,(%0)+\n"
639 "1: movel (%1)+,%%d0\n"
640 "22:movesl %%d0,(%0)+\n"
641 "2: movel (%1)+,%%d0\n"
642 "23:movesl %%d0,(%0)+\n"
643 "3:\n"
644 ".section .fixup,\"ax\"\n"
645 " .even\n"
646 "4: addql #4,%2\n"
647 "5: addql #4,%2\n"
648 "6: addql #4,%2\n"
649 " jra 3b\n"
650 ".previous\n"
651 ".section __ex_table,\"a\"\n"
652 " .align 4\n"
653 " .long 21b,4b\n"
654 " .long 1b,4b\n"
655 " .long 22b,5b\n"
656 " .long 2b,5b\n"
657 " .long 23b,6b\n"
658 " .long 3b,6b\n"
659 ".previous"
660 : "=a"(to), "=a"(from), "=d"(n)
661 : "0"(to), "1"(from), "2"(0)
662 : "d0", "memory");
663 break;
664 case 16:
665 __asm__ __volatile__
666 (" movel (%1)+,%%d0\n"
667 "21:movesl %%d0,(%0)+\n"
668 "1: movel (%1)+,%%d0\n"
669 "22:movesl %%d0,(%0)+\n"
670 "2: movel (%1)+,%%d0\n"
671 "23:movesl %%d0,(%0)+\n"
672 "3: movel (%1)+,%%d0\n"
673 "24:movesl %%d0,(%0)+\n"
674 "4:"
675 ".section .fixup,\"ax\"\n"
676 " .even\n"
677 "5: addql #4,%2\n"
678 "6: addql #4,%2\n"
679 "7: addql #4,%2\n"
680 "8: addql #4,%2\n"
681 " jra 4b\n"
682 ".previous\n"
683 ".section __ex_table,\"a\"\n"
684 " .align 4\n"
685 " .long 21b,5b\n"
686 " .long 1b,5b\n"
687 " .long 22b,6b\n"
688 " .long 2b,6b\n"
689 " .long 23b,7b\n"
690 " .long 3b,7b\n"
691 " .long 24b,8b\n"
692 " .long 4b,8b\n"
693 ".previous"
694 : "=a"(to), "=a"(from), "=d"(n)
695 : "0"(to), "1"(from), "2"(0)
696 : "d0", "memory");
697 break;
698 default:
699 switch (n & 3) {
700 case 0:
701 __copy_to_user_big(to, from, n, "", "");
702 break;
703 case 1: 304 case 1:
704 __copy_to_user_big(to, from, n, 305 __put_user_asm(res, *(u8 *)from, (u8 *)to, b, d, 1);
705 /* fixup */ 306 break;
706 "1: addql #1,%2",
707 /* copy */
708 " moveb (%1)+,%%d0\n"
709 "22:movesb %%d0,(%0)+\n"
710 "2:"
711 ".section __ex_table,\"a\"\n"
712 " .long 22b,1b\n"
713 " .long 2b,1b\n"
714 ".previous");
715 break;
716 case 2: 307 case 2:
717 __copy_to_user_big(to, from, n, 308 __put_user_asm(res, *(u16 *)from, (u16 *)to, w, d, 2);
718 /* fixup */ 309 break;
719 "1: addql #2,%2",
720 /* copy */
721 " movew (%1)+,%%d0\n"
722 "22:movesw %%d0,(%0)+\n"
723 "2:"
724 ".section __ex_table,\"a\"\n"
725 " .long 22b,1b\n"
726 " .long 2b,1b\n"
727 ".previous");
728 break;
729 case 3: 310 case 3:
730 __copy_to_user_big(to, from, n, 311 __constant_copy_to_user_asm(res, to, from, tmp, 3, w, b,);
731 /* fixup */ 312 break;
732 "1: addql #2,%2\n" 313 case 4:
733 "2: addql #1,%2", 314 __put_user_asm(res, *(u32 *)from, (u32 *)to, l, r, 4);
734 /* copy */ 315 break;
735 " movew (%1)+,%%d0\n" 316 case 5:
736 "23:movesw %%d0,(%0)+\n" 317 __constant_copy_to_user_asm(res, to, from, tmp, 5, l, b,);
737 "3: moveb (%1)+,%%d0\n" 318 break;
738 "24:movesb %%d0,(%0)+\n" 319 case 6:
739 "4:" 320 __constant_copy_to_user_asm(res, to, from, tmp, 6, l, w,);
740 ".section __ex_table,\"a\"\n" 321 break;
741 " .long 23b,1b\n" 322 case 7:
742 " .long 3b,1b\n" 323 __constant_copy_to_user_asm(res, to, from, tmp, 7, l, w, b);
743 " .long 24b,2b\n" 324 break;
744 " .long 4b,2b\n" 325 case 8:
745 ".previous"); 326 __constant_copy_to_user_asm(res, to, from, tmp, 8, l, l,);
746 break; 327 break;
328 case 9:
329 __constant_copy_to_user_asm(res, to, from, tmp, 9, l, l, b);
330 break;
331 case 10:
332 __constant_copy_to_user_asm(res, to, from, tmp, 10, l, l, w);
333 break;
334 case 12:
335 __constant_copy_to_user_asm(res, to, from, tmp, 12, l, l, l);
336 break;
337 default:
338 /* limit the inlined version to 3 moves */
339 return __generic_copy_to_user(to, from, n);
747 } 340 }
748 break; 341
749 } 342 return res;
750 return n;
751} 343}
752 344
753#define copy_from_user(to, from, n) \ 345#define __copy_from_user(to, from, n) \
754(__builtin_constant_p(n) ? \ 346(__builtin_constant_p(n) ? \
755 __constant_copy_from_user(to, from, n) : \ 347 __constant_copy_from_user(to, from, n) : \
756 __generic_copy_from_user(to, from, n)) 348 __generic_copy_from_user(to, from, n))
757 349
758#define copy_to_user(to, from, n) \ 350#define __copy_to_user(to, from, n) \
759(__builtin_constant_p(n) ? \ 351(__builtin_constant_p(n) ? \
760 __constant_copy_to_user(to, from, n) : \ 352 __constant_copy_to_user(to, from, n) : \
761 __generic_copy_to_user(to, from, n)) 353 __generic_copy_to_user(to, from, n))
762 354
763#define __copy_from_user(to, from, n) copy_from_user(to, from, n) 355#define __copy_to_user_inatomic __copy_to_user
764#define __copy_to_user(to, from, n) copy_to_user(to, from, n) 356#define __copy_from_user_inatomic __copy_from_user
765
766/*
767 * Copy a null terminated string from userspace.
768 */
769
770static inline long
771strncpy_from_user(char *dst, const char __user *src, long count)
772{
773 long res;
774 if (count == 0) return count;
775 __asm__ __volatile__
776 ("1: movesb (%2)+,%%d0\n"
777 "12:moveb %%d0,(%1)+\n"
778 " jeq 2f\n"
779 " subql #1,%3\n"
780 " jne 1b\n"
781 "2: subl %3,%0\n"
782 "3:\n"
783 ".section .fixup,\"ax\"\n"
784 " .even\n"
785 "4: movel %4,%0\n"
786 " jra 3b\n"
787 ".previous\n"
788 ".section __ex_table,\"a\"\n"
789 " .align 4\n"
790 " .long 1b,4b\n"
791 " .long 12b,4b\n"
792 ".previous"
793 : "=d"(res), "=a"(dst), "=a"(src), "=d"(count)
794 : "i"(-EFAULT), "0"(count), "1"(dst), "2"(src), "3"(count)
795 : "d0", "memory");
796 return res;
797}
798 357
799/* 358#define copy_from_user(to, from, n) __copy_from_user(to, from, n)
800 * Return the size of a string (including the ending 0) 359#define copy_to_user(to, from, n) __copy_to_user(to, from, n)
801 *
802 * Return 0 on exception, a value greater than N if too long
803 */
804static inline long strnlen_user(const char __user *src, long n)
805{
806 long res;
807 360
808 res = -(unsigned long)src; 361long strncpy_from_user(char *dst, const char __user *src, long count);
809 __asm__ __volatile__ 362long strnlen_user(const char __user *src, long n);
810 ("1:\n" 363unsigned long clear_user(void __user *to, unsigned long n);
811 " tstl %2\n"
812 " jeq 3f\n"
813 "2: movesb (%1)+,%%d0\n"
814 "22:\n"
815 " subql #1,%2\n"
816 " tstb %%d0\n"
817 " jne 1b\n"
818 " jra 4f\n"
819 "3:\n"
820 " addql #1,%0\n"
821 "4:\n"
822 " addl %1,%0\n"
823 "5:\n"
824 ".section .fixup,\"ax\"\n"
825 " .even\n"
826 "6: moveq %3,%0\n"
827 " jra 5b\n"
828 ".previous\n"
829 ".section __ex_table,\"a\"\n"
830 " .align 4\n"
831 " .long 2b,6b\n"
832 " .long 22b,6b\n"
833 ".previous"
834 : "=d"(res), "=a"(src), "=d"(n)
835 : "i"(0), "0"(res), "1"(src), "2"(n)
836 : "d0");
837 return res;
838}
839 364
840#define strlen_user(str) strnlen_user(str, 32767) 365#define strlen_user(str) strnlen_user(str, 32767)
841 366
842/*
843 * Zero Userspace
844 */
845
846static inline unsigned long
847clear_user(void __user *to, unsigned long n)
848{
849 __asm__ __volatile__
850 (" tstl %1\n"
851 " jeq 3f\n"
852 "1: movesl %3,(%0)+\n"
853 "2: subql #1,%1\n"
854 " jne 1b\n"
855 "3: movel %2,%1\n"
856 " bclr #1,%1\n"
857 " jeq 4f\n"
858 "24:movesw %3,(%0)+\n"
859 "4: bclr #0,%1\n"
860 " jeq 5f\n"
861 "25:movesb %3,(%0)+\n"
862 "5:\n"
863 ".section .fixup,\"ax\"\n"
864 " .even\n"
865 "61:addql #1,%1\n"
866 "6: lsll #2,%1\n"
867 " addl %2,%1\n"
868 " jra 5b\n"
869 "7: addql #2,%1\n"
870 " jra 5b\n"
871 "8: addql #1,%1\n"
872 " jra 5b\n"
873 ".previous\n"
874 ".section __ex_table,\"a\"\n"
875 " .align 4\n"
876 " .long 1b,61b\n"
877 " .long 2b,6b\n"
878 " .long 3b,61b\n"
879 " .long 24b,7b\n"
880 " .long 4b,7b\n"
881 " .long 25b,8b\n"
882 " .long 5b,8b\n"
883 ".previous"
884 : "=a"(to), "=d"(n)
885 : "r"(n & 3), "r"(0), "0"(to), "1"(n/4));
886 return n;
887}
888
889#endif /* _M68K_UACCESS_H */ 367#endif /* _M68K_UACCESS_H */
diff --git a/include/asm-m68k/unistd.h b/include/asm-m68k/unistd.h
index f236fe92156f..7c0b6296b45c 100644
--- a/include/asm-m68k/unistd.h
+++ b/include/asm-m68k/unistd.h
@@ -410,46 +410,7 @@ __syscall_return(type,__res); \
410 410
411#ifdef __KERNEL_SYSCALLS__ 411#ifdef __KERNEL_SYSCALLS__
412 412
413#include <linux/compiler.h>
414#include <linux/interrupt.h>
415#include <linux/types.h>
416
417/*
418 * we need this inline - forking from kernel space will result
419 * in NO COPY ON WRITE (!!!), until an execve is executed. This
420 * is no problem, but for the stack. This is handled by not letting
421 * main() use the stack at all after fork(). Thus, no function
422 * calls - which means inline code for fork too, as otherwise we
423 * would use the stack upon exit from 'fork()'.
424 *
425 * Actually only pause and fork are needed inline, so that there
426 * won't be any messing with the stack from main(), but we define
427 * some others too.
428 */
429#define __NR__exit __NR_exit
430static inline _syscall0(pid_t,setsid)
431static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count)
432static inline _syscall3(int,read,int,fd,char *,buf,off_t,count)
433static inline _syscall3(off_t,lseek,int,fd,off_t,offset,int,count)
434static inline _syscall1(int,dup,int,fd)
435static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp) 413static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp)
436static inline _syscall3(int,open,const char *,file,int,flag,int,mode)
437static inline _syscall1(int,close,int,fd)
438static inline _syscall1(int,_exit,int,exitcode)
439static inline _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options)
440
441asmlinkage long sys_mmap2(
442 unsigned long addr, unsigned long len,
443 unsigned long prot, unsigned long flags,
444 unsigned long fd, unsigned long pgoff);
445asmlinkage int sys_execve(char *name, char **argv, char **envp);
446asmlinkage int sys_pipe(unsigned long *fildes);
447struct pt_regs;
448struct sigaction;
449asmlinkage long sys_rt_sigaction(int sig,
450 const struct sigaction __user *act,
451 struct sigaction __user *oact,
452 size_t sigsetsize);
453 414
454#endif /* __KERNEL_SYSCALLS__ */ 415#endif /* __KERNEL_SYSCALLS__ */
455 416
diff --git a/include/asm-m68knommu/cacheflush.h b/include/asm-m68knommu/cacheflush.h
index 49925e91e89c..c3aadf3b0d88 100644
--- a/include/asm-m68knommu/cacheflush.h
+++ b/include/asm-m68knommu/cacheflush.h
@@ -57,13 +57,13 @@ static inline void __flush_cache_all(void)
57 "nop\n\t" 57 "nop\n\t"
58 : : : "d0" ); 58 : : : "d0" );
59#endif /* CONFIG_M527x || CONFIG_M528x */ 59#endif /* CONFIG_M527x || CONFIG_M528x */
60#ifdef CONFIG_M5272 60#if defined(CONFIG_M5206) || defined(CONFIG_M5206e) || defined(CONFIG_M5272)
61 __asm__ __volatile__ ( 61 __asm__ __volatile__ (
62 "movel #0x01000000, %%d0\n\t" 62 "movel #0x81000100, %%d0\n\t"
63 "movec %%d0, %%CACR\n\t" 63 "movec %%d0, %%CACR\n\t"
64 "nop\n\t" 64 "nop\n\t"
65 : : : "d0" ); 65 : : : "d0" );
66#endif /* CONFIG_M5272 */ 66#endif /* CONFIG_M5206 || CONFIG_M5206e || CONFIG_M5272 */
67#ifdef CONFIG_M5249 67#ifdef CONFIG_M5249
68 __asm__ __volatile__ ( 68 __asm__ __volatile__ (
69 "movel #0xa1000200, %%d0\n\t" 69 "movel #0xa1000200, %%d0\n\t"
@@ -71,6 +71,13 @@ static inline void __flush_cache_all(void)
71 "nop\n\t" 71 "nop\n\t"
72 : : : "d0" ); 72 : : : "d0" );
73#endif /* CONFIG_M5249 */ 73#endif /* CONFIG_M5249 */
74#ifdef CONFIG_M532x
75 __asm__ __volatile__ (
76 "movel #0x81000200, %%d0\n\t"
77 "movec %%d0, %%CACR\n\t"
78 "nop\n\t"
79 : : : "d0" );
80#endif /* CONFIG_M532x */
74} 81}
75 82
76#endif /* _M68KNOMMU_CACHEFLUSH_H */ 83#endif /* _M68KNOMMU_CACHEFLUSH_H */
diff --git a/include/asm-m68knommu/coldfire.h b/include/asm-m68knommu/coldfire.h
index 2fabca91df83..83a9fa4e618a 100644
--- a/include/asm-m68knommu/coldfire.h
+++ b/include/asm-m68knommu/coldfire.h
@@ -3,7 +3,7 @@
3/* 3/*
4 * coldfire.h -- Motorola ColdFire CPU sepecific defines 4 * coldfire.h -- Motorola ColdFire CPU sepecific defines
5 * 5 *
6 * (C) Copyright 1999-2002, Greg Ungerer (gerg@snapgear.com) 6 * (C) Copyright 1999-2006, Greg Ungerer (gerg@snapgear.com)
7 * (C) Copyright 2000, Lineo (www.lineo.com) 7 * (C) Copyright 2000, Lineo (www.lineo.com)
8 */ 8 */
9 9
@@ -14,6 +14,19 @@
14 14
15 15
16/* 16/*
17 * Define master clock frequency. This is essentially done at config
18 * time now. No point enumerating dozens of possible clock options
19 * here. Also the peripheral clock (bus clock) divide ratio is set
20 * at config time too.
21 */
22#ifdef CONFIG_CLOCK_SET
23#define MCF_CLK CONFIG_CLOCK_FREQ
24#define MCF_BUSCLK (CONFIG_CLOCK_FREQ / CONFIG_CLOCK_DIV)
25#else
26#error "Don't know what your ColdFire CPU clock frequency is??"
27#endif
28
29/*
17 * Define the processor support peripherals base address. 30 * Define the processor support peripherals base address.
18 * This is generally setup by the boards start up code. 31 * This is generally setup by the boards start up code.
19 */ 32 */
@@ -29,64 +42,9 @@
29 defined(CONFIG_M520x) 42 defined(CONFIG_M520x)
30#undef MCF_MBAR 43#undef MCF_MBAR
31#define MCF_MBAR MCF_IPSBAR 44#define MCF_MBAR MCF_IPSBAR
32#endif 45#elif defined(CONFIG_M532x)
33 46#undef MCF_MBAR
34/* 47#define MCF_MBAR 0x00000000
35 * Define master clock frequency.
36 */
37#if defined(CONFIG_CLOCK_11MHz)
38#define MCF_CLK 11289600
39#elif defined(CONFIG_CLOCK_16MHz)
40#define MCF_CLK 16000000
41#elif defined(CONFIG_CLOCK_20MHz)
42#define MCF_CLK 20000000
43#elif defined(CONFIG_CLOCK_24MHz)
44#define MCF_CLK 24000000
45#elif defined(CONFIG_CLOCK_25MHz)
46#define MCF_CLK 25000000
47#elif defined(CONFIG_CLOCK_33MHz)
48#define MCF_CLK 33000000
49#elif defined(CONFIG_CLOCK_40MHz)
50#define MCF_CLK 40000000
51#elif defined(CONFIG_CLOCK_45MHz)
52#define MCF_CLK 45000000
53#elif defined(CONFIG_CLOCK_48MHz)
54#define MCF_CLK 48000000
55#elif defined(CONFIG_CLOCK_50MHz)
56#define MCF_CLK 50000000
57#elif defined(CONFIG_CLOCK_54MHz)
58#define MCF_CLK 54000000
59#elif defined(CONFIG_CLOCK_60MHz)
60#define MCF_CLK 60000000
61#elif defined(CONFIG_CLOCK_62_5MHz)
62#define MCF_CLK 62500000
63#elif defined(CONFIG_CLOCK_64MHz)
64#define MCF_CLK 64000000
65#elif defined(CONFIG_CLOCK_66MHz)
66#define MCF_CLK 66000000
67#elif defined(CONFIG_CLOCK_70MHz)
68#define MCF_CLK 70000000
69#elif defined(CONFIG_CLOCK_100MHz)
70#define MCF_CLK 100000000
71#elif defined(CONFIG_CLOCK_140MHz)
72#define MCF_CLK 140000000
73#elif defined(CONFIG_CLOCK_150MHz)
74#define MCF_CLK 150000000
75#elif defined(CONFIG_CLOCK_166MHz)
76#define MCF_CLK 166000000
77#else
78#error "Don't know what your ColdFire CPU clock frequency is??"
79#endif
80
81/*
82 * One some ColdFire family members the bus clock (used by internal
83 * peripherals) is not the same as the CPU clock.
84 */
85#if defined(CONFIG_M523x) || defined(CONFIG_M5249) || defined(CONFIG_M527x) || \
86 defined(CONFIG_M520x)
87#define MCF_BUSCLK (MCF_CLK / 2)
88#else
89#define MCF_BUSCLK MCF_CLK
90#endif 48#endif
91 49
92/****************************************************************************/ 50/****************************************************************************/
diff --git a/include/asm-m68knommu/irq.h b/include/asm-m68knommu/irq.h
index 2b408842a30e..53557274eef8 100644
--- a/include/asm-m68knommu/irq.h
+++ b/include/asm-m68knommu/irq.h
@@ -83,12 +83,8 @@ extern void (*mach_disable_irq)(unsigned int);
83/* 83/*
84 * Some drivers want these entry points 84 * Some drivers want these entry points
85 */ 85 */
86#define enable_irq(x) 0 86#define enable_irq(x) do { } while (0)
87#define disable_irq(x) do { } while (0) 87#define disable_irq(x) do { } while (0)
88#define disable_irq_nosync(x) disable_irq(x) 88#define disable_irq_nosync(x) disable_irq(x)
89 89
90struct irqaction;
91struct pt_regs;
92int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *);
93
94#endif /* _M68K_IRQ_H_ */ 90#endif /* _M68K_IRQ_H_ */
diff --git a/include/asm-m68knommu/m5249sim.h b/include/asm-m68knommu/m5249sim.h
index 9344f529bd8f..399814f0b219 100644
--- a/include/asm-m68knommu/m5249sim.h
+++ b/include/asm-m68knommu/m5249sim.h
@@ -157,7 +157,7 @@
157 movel %d0,0x180(%a1) /* set PLL register */ 157 movel %d0,0x180(%a1) /* set PLL register */
158 nop 158 nop
159 159
160#ifdef CONFIG_CLOCK_140MHz 160#if CONFIG_CLOCK_FREQ == 140000000
161 /* 161 /*
162 * Set initial clock frequency. This assumes M5249C3 board 162 * Set initial clock frequency. This assumes M5249C3 board
163 * is fitted with 11.2896MHz crystal. It will program the 163 * is fitted with 11.2896MHz crystal. It will program the
diff --git a/include/asm-m68knommu/m532xsim.h b/include/asm-m68knommu/m532xsim.h
new file mode 100644
index 000000000000..1835fd20a82c
--- /dev/null
+++ b/include/asm-m68knommu/m532xsim.h
@@ -0,0 +1,2238 @@
1/****************************************************************************/
2
3/*
4 * m532xsim.h -- ColdFire 5329 registers
5 */
6
7/****************************************************************************/
8#ifndef m532xsim_h
9#define m532xsim_h
10/****************************************************************************/
11
12#define MCF_REG32(x) (*(volatile unsigned long *)(x))
13#define MCF_REG16(x) (*(volatile unsigned short *)(x))
14#define MCF_REG08(x) (*(volatile unsigned char *)(x))
15
16#define MCFINT_VECBASE 64
17#define MCFINT_UART0 26 /* Interrupt number for UART0 */
18#define MCFINT_UART1 27 /* Interrupt number for UART1 */
19
20#define MCF_WTM_WCR MCF_REG16(0xFC098000)
21
22/*
23 * Define the 532x SIM register set addresses.
24 */
25#define MCFSIM_IPRL 0xFC048004
26#define MCFSIM_IPRH 0xFC048000
27#define MCFSIM_IPR MCFSIM_IPRL
28#define MCFSIM_IMRL 0xFC04800C
29#define MCFSIM_IMRH 0xFC048008
30#define MCFSIM_IMR MCFSIM_IMRL
31#define MCFSIM_ICR0 0xFC048040
32#define MCFSIM_ICR1 0xFC048041
33#define MCFSIM_ICR2 0xFC048042
34#define MCFSIM_ICR3 0xFC048043
35#define MCFSIM_ICR4 0xFC048044
36#define MCFSIM_ICR5 0xFC048045
37#define MCFSIM_ICR6 0xFC048046
38#define MCFSIM_ICR7 0xFC048047
39#define MCFSIM_ICR8 0xFC048048
40#define MCFSIM_ICR9 0xFC048049
41#define MCFSIM_ICR10 0xFC04804A
42#define MCFSIM_ICR11 0xFC04804B
43
44/*
45 * Some symbol defines for the above...
46 */
47#define MCFSIM_SWDICR MCFSIM_ICR0 /* Watchdog timer ICR */
48#define MCFSIM_TIMER1ICR MCFSIM_ICR1 /* Timer 1 ICR */
49#define MCFSIM_TIMER2ICR MCFSIM_ICR2 /* Timer 2 ICR */
50#define MCFSIM_UART1ICR MCFSIM_ICR4 /* UART 1 ICR */
51#define MCFSIM_UART2ICR MCFSIM_ICR5 /* UART 2 ICR */
52#define MCFSIM_DMA0ICR MCFSIM_ICR6 /* DMA 0 ICR */
53#define MCFSIM_DMA1ICR MCFSIM_ICR7 /* DMA 1 ICR */
54#define MCFSIM_DMA2ICR MCFSIM_ICR8 /* DMA 2 ICR */
55#define MCFSIM_DMA3ICR MCFSIM_ICR9 /* DMA 3 ICR */
56
57
58#define MCFSIM_IMR_MASKALL 0xFFFFFFFF /* All SIM intr sources */
59
60#define MCFSIM_IMR_SIMR0 0xFC04801C
61#define MCFSIM_IMR_SIMR1 0xFC04C01C
62#define MCFSIM_IMR_CIMR0 0xFC04801D
63#define MCFSIM_IMR_CIMR1 0xFC04C01D
64
65#define MCFSIM_ICR_TIMER1 (0xFC048040+32)
66#define MCFSIM_ICR_TIMER2 (0xFC048040+33)
67
68
69/*
70 * Macro to set IMR register. It is 32 bits on the 5307.
71 */
72#define mcf_getimr() \
73 *((volatile unsigned long *) (MCF_MBAR + MCFSIM_IMR))
74
75#define mcf_setimr(imr) \
76 *((volatile unsigned long *) (MCF_MBAR + MCFSIM_IMR)) = (imr);
77
78#define mcf_getipr() \
79 *((volatile unsigned long *) (MCF_MBAR + MCFSIM_IPR))
80
81#define mcf_getiprl() \
82 *((volatile unsigned long *) (MCF_MBAR + MCFSIM_IPRL))
83
84#define mcf_getiprh() \
85 *((volatile unsigned long *) (MCF_MBAR + MCFSIM_IPRH))
86
87
88#define mcf_enable_irq0(irq) \
89 *((volatile unsigned char*) (MCFSIM_IMR_CIMR0)) = (irq);
90
91#define mcf_enable_irq1(irq) \
92 *((volatile unsigned char*) (MCFSIM_IMR_CIMR1)) = (irq);
93
94#define mcf_disable_irq0(irq) \
95 *((volatile unsigned char*) (MCFSIM_IMR_SIMR0)) = (irq);
96
97#define mcf_disable_irq1(irq) \
98 *((volatile unsigned char*) (MCFSIM_IMR_SIMR1)) = (irq);
99
100/*
101 * Define the Cache register flags.
102 */
103#define CACR_EC (1<<31)
104#define CACR_ESB (1<<29)
105#define CACR_DPI (1<<28)
106#define CACR_HLCK (1<<27)
107#define CACR_CINVA (1<<24)
108#define CACR_DNFB (1<<10)
109#define CACR_DCM_WTHRU (0<<8)
110#define CACR_DCM_WBACK (1<<8)
111#define CACR_DCM_OFF_PRE (2<<8)
112#define CACR_DCM_OFF_IMP (3<<8)
113#define CACR_DW (1<<5)
114
115#define ACR_BASE_POS 24
116#define ACR_MASK_POS 16
117#define ACR_ENABLE (1<<15)
118#define ACR_USER (0<<13)
119#define ACR_SUPER (1<<13)
120#define ACR_ANY (2<<13)
121#define ACR_CM_WTHRU (0<<5)
122#define ACR_CM_WBACK (1<<5)
123#define ACR_CM_OFF_PRE (2<<5)
124#define ACR_CM_OFF_IMP (3<<5)
125#define ACR_WPROTECT (1<<2)
126
127/*********************************************************************
128 *
129 * Inter-IC (I2C) Module
130 *
131 *********************************************************************/
132
133/* Read/Write access macros for general use */
134#define MCF532x_I2C_I2ADR (volatile u8 *) (0xFC058000) // Address
135#define MCF532x_I2C_I2FDR (volatile u8 *) (0xFC058004) // Freq Divider
136#define MCF532x_I2C_I2CR (volatile u8 *) (0xFC058008) // Control
137#define MCF532x_I2C_I2SR (volatile u8 *) (0xFC05800C) // Status
138#define MCF532x_I2C_I2DR (volatile u8 *) (0xFC058010) // Data I/O
139
140/* Bit level definitions and macros */
141#define MCF532x_I2C_I2ADR_ADDR(x) (((x)&0x7F)<<0x01)
142
143#define MCF532x_I2C_I2FDR_IC(x) (((x)&0x3F))
144
145#define MCF532x_I2C_I2CR_IEN (0x80) // I2C enable
146#define MCF532x_I2C_I2CR_IIEN (0x40) // interrupt enable
147#define MCF532x_I2C_I2CR_MSTA (0x20) // master/slave mode
148#define MCF532x_I2C_I2CR_MTX (0x10) // transmit/receive mode
149#define MCF532x_I2C_I2CR_TXAK (0x08) // transmit acknowledge enable
150#define MCF532x_I2C_I2CR_RSTA (0x04) // repeat start
151
152#define MCF532x_I2C_I2SR_ICF (0x80) // data transfer bit
153#define MCF532x_I2C_I2SR_IAAS (0x40) // I2C addressed as a slave
154#define MCF532x_I2C_I2SR_IBB (0x20) // I2C bus busy
155#define MCF532x_I2C_I2SR_IAL (0x10) // aribitration lost
156#define MCF532x_I2C_I2SR_SRW (0x04) // slave read/write
157#define MCF532x_I2C_I2SR_IIF (0x02) // I2C interrupt
158#define MCF532x_I2C_I2SR_RXAK (0x01) // received acknowledge
159
160#define MCF532x_PAR_FECI2C (volatile u8 *) (0xFC0A4053)
161
162
163/*
164 * The M5329EVB board needs a help getting its devices initialized
165 * at kernel start time if dBUG doesn't set it up (for example
166 * it is not used), so we need to do it manually.
167 */
168#ifdef __ASSEMBLER__
169.macro m5329EVB_setup
170 movel #0xFC098000, %a7
171 movel #0x0, (%a7)
172#define CORE_SRAM 0x80000000
173#define CORE_SRAM_SIZE 0x8000
174 movel #CORE_SRAM, %d0
175 addl #0x221, %d0
176 movec %d0,%RAMBAR1
177 movel #CORE_SRAM, %sp
178 addl #CORE_SRAM_SIZE, %sp
179 jsr sysinit
180.endm
181#define PLATFORM_SETUP m5329EVB_setup
182
183#endif /* __ASSEMBLER__ */
184
185/*********************************************************************
186 *
187 * Chip Configuration Module (CCM)
188 *
189 *********************************************************************/
190
191/* Register read/write macros */
192#define MCF_CCM_CCR MCF_REG16(0xFC0A0004)
193#define MCF_CCM_RCON MCF_REG16(0xFC0A0008)
194#define MCF_CCM_CIR MCF_REG16(0xFC0A000A)
195#define MCF_CCM_MISCCR MCF_REG16(0xFC0A0010)
196#define MCF_CCM_CDR MCF_REG16(0xFC0A0012)
197#define MCF_CCM_UHCSR MCF_REG16(0xFC0A0014)
198#define MCF_CCM_UOCSR MCF_REG16(0xFC0A0016)
199
200/* Bit definitions and macros for MCF_CCM_CCR */
201#define MCF_CCM_CCR_RESERVED (0x0001)
202#define MCF_CCM_CCR_PLL_MODE (0x0003)
203#define MCF_CCM_CCR_OSC_MODE (0x0005)
204#define MCF_CCM_CCR_BOOTPS(x) (((x)&0x0003)<<3|0x0001)
205#define MCF_CCM_CCR_LOAD (0x0021)
206#define MCF_CCM_CCR_LIMP (0x0041)
207#define MCF_CCM_CCR_CSC(x) (((x)&0x0003)<<8|0x0001)
208
209/* Bit definitions and macros for MCF_CCM_RCON */
210#define MCF_CCM_RCON_RESERVED (0x0001)
211#define MCF_CCM_RCON_PLL_MODE (0x0003)
212#define MCF_CCM_RCON_OSC_MODE (0x0005)
213#define MCF_CCM_RCON_BOOTPS(x) (((x)&0x0003)<<3|0x0001)
214#define MCF_CCM_RCON_LOAD (0x0021)
215#define MCF_CCM_RCON_LIMP (0x0041)
216#define MCF_CCM_RCON_CSC(x) (((x)&0x0003)<<8|0x0001)
217
218/* Bit definitions and macros for MCF_CCM_CIR */
219#define MCF_CCM_CIR_PRN(x) (((x)&0x003F)<<0)
220#define MCF_CCM_CIR_PIN(x) (((x)&0x03FF)<<6)
221
222/* Bit definitions and macros for MCF_CCM_MISCCR */
223#define MCF_CCM_MISCCR_USBSRC (0x0001)
224#define MCF_CCM_MISCCR_USBDIV (0x0002)
225#define MCF_CCM_MISCCR_SSI_SRC (0x0010)
226#define MCF_CCM_MISCCR_TIM_DMA (0x0020)
227#define MCF_CCM_MISCCR_SSI_PUS (0x0040)
228#define MCF_CCM_MISCCR_SSI_PUE (0x0080)
229#define MCF_CCM_MISCCR_LCD_CHEN (0x0100)
230#define MCF_CCM_MISCCR_LIMP (0x1000)
231#define MCF_CCM_MISCCR_PLL_LOCK (0x2000)
232
233/* Bit definitions and macros for MCF_CCM_CDR */
234#define MCF_CCM_CDR_SSIDIV(x) (((x)&0x000F)<<0)
235#define MCF_CCM_CDR_LPDIV(x) (((x)&0x000F)<<8)
236
237/* Bit definitions and macros for MCF_CCM_UHCSR */
238#define MCF_CCM_UHCSR_XPDE (0x0001)
239#define MCF_CCM_UHCSR_UHMIE (0x0002)
240#define MCF_CCM_UHCSR_WKUP (0x0004)
241#define MCF_CCM_UHCSR_PORTIND(x) (((x)&0x0003)<<14)
242
243/* Bit definitions and macros for MCF_CCM_UOCSR */
244#define MCF_CCM_UOCSR_XPDE (0x0001)
245#define MCF_CCM_UOCSR_UOMIE (0x0002)
246#define MCF_CCM_UOCSR_WKUP (0x0004)
247#define MCF_CCM_UOCSR_PWRFLT (0x0008)
248#define MCF_CCM_UOCSR_SEND (0x0010)
249#define MCF_CCM_UOCSR_VVLD (0x0020)
250#define MCF_CCM_UOCSR_BVLD (0x0040)
251#define MCF_CCM_UOCSR_AVLD (0x0080)
252#define MCF_CCM_UOCSR_DPPU (0x0100)
253#define MCF_CCM_UOCSR_DCR_VBUS (0x0200)
254#define MCF_CCM_UOCSR_CRG_VBUS (0x0400)
255#define MCF_CCM_UOCSR_DRV_VBUS (0x0800)
256#define MCF_CCM_UOCSR_DMPD (0x1000)
257#define MCF_CCM_UOCSR_DPPD (0x2000)
258#define MCF_CCM_UOCSR_PORTIND(x) (((x)&0x0003)<<14)
259
260/*********************************************************************
261 *
262 * DMA Timers (DTIM)
263 *
264 *********************************************************************/
265
266/* Register read/write macros */
267#define MCF_DTIM0_DTMR MCF_REG16(0xFC070000)
268#define MCF_DTIM0_DTXMR MCF_REG08(0xFC070002)
269#define MCF_DTIM0_DTER MCF_REG08(0xFC070003)
270#define MCF_DTIM0_DTRR MCF_REG32(0xFC070004)
271#define MCF_DTIM0_DTCR MCF_REG32(0xFC070008)
272#define MCF_DTIM0_DTCN MCF_REG32(0xFC07000C)
273#define MCF_DTIM1_DTMR MCF_REG16(0xFC074000)
274#define MCF_DTIM1_DTXMR MCF_REG08(0xFC074002)
275#define MCF_DTIM1_DTER MCF_REG08(0xFC074003)
276#define MCF_DTIM1_DTRR MCF_REG32(0xFC074004)
277#define MCF_DTIM1_DTCR MCF_REG32(0xFC074008)
278#define MCF_DTIM1_DTCN MCF_REG32(0xFC07400C)
279#define MCF_DTIM2_DTMR MCF_REG16(0xFC078000)
280#define MCF_DTIM2_DTXMR MCF_REG08(0xFC078002)
281#define MCF_DTIM2_DTER MCF_REG08(0xFC078003)
282#define MCF_DTIM2_DTRR MCF_REG32(0xFC078004)
283#define MCF_DTIM2_DTCR MCF_REG32(0xFC078008)
284#define MCF_DTIM2_DTCN MCF_REG32(0xFC07800C)
285#define MCF_DTIM3_DTMR MCF_REG16(0xFC07C000)
286#define MCF_DTIM3_DTXMR MCF_REG08(0xFC07C002)
287#define MCF_DTIM3_DTER MCF_REG08(0xFC07C003)
288#define MCF_DTIM3_DTRR MCF_REG32(0xFC07C004)
289#define MCF_DTIM3_DTCR MCF_REG32(0xFC07C008)
290#define MCF_DTIM3_DTCN MCF_REG32(0xFC07C00C)
291#define MCF_DTIM_DTMR(x) MCF_REG16(0xFC070000+((x)*0x4000))
292#define MCF_DTIM_DTXMR(x) MCF_REG08(0xFC070002+((x)*0x4000))
293#define MCF_DTIM_DTER(x) MCF_REG08(0xFC070003+((x)*0x4000))
294#define MCF_DTIM_DTRR(x) MCF_REG32(0xFC070004+((x)*0x4000))
295#define MCF_DTIM_DTCR(x) MCF_REG32(0xFC070008+((x)*0x4000))
296#define MCF_DTIM_DTCN(x) MCF_REG32(0xFC07000C+((x)*0x4000))
297
298/* Bit definitions and macros for MCF_DTIM_DTMR */
299#define MCF_DTIM_DTMR_RST (0x0001)
300#define MCF_DTIM_DTMR_CLK(x) (((x)&0x0003)<<1)
301#define MCF_DTIM_DTMR_FRR (0x0008)
302#define MCF_DTIM_DTMR_ORRI (0x0010)
303#define MCF_DTIM_DTMR_OM (0x0020)
304#define MCF_DTIM_DTMR_CE(x) (((x)&0x0003)<<6)
305#define MCF_DTIM_DTMR_PS(x) (((x)&0x00FF)<<8)
306#define MCF_DTIM_DTMR_CE_ANY (0x00C0)
307#define MCF_DTIM_DTMR_CE_FALL (0x0080)
308#define MCF_DTIM_DTMR_CE_RISE (0x0040)
309#define MCF_DTIM_DTMR_CE_NONE (0x0000)
310#define MCF_DTIM_DTMR_CLK_DTIN (0x0006)
311#define MCF_DTIM_DTMR_CLK_DIV16 (0x0004)
312#define MCF_DTIM_DTMR_CLK_DIV1 (0x0002)
313#define MCF_DTIM_DTMR_CLK_STOP (0x0000)
314
315/* Bit definitions and macros for MCF_DTIM_DTXMR */
316#define MCF_DTIM_DTXMR_MODE16 (0x01)
317#define MCF_DTIM_DTXMR_DMAEN (0x80)
318
319/* Bit definitions and macros for MCF_DTIM_DTER */
320#define MCF_DTIM_DTER_CAP (0x01)
321#define MCF_DTIM_DTER_REF (0x02)
322
323/* Bit definitions and macros for MCF_DTIM_DTRR */
324#define MCF_DTIM_DTRR_REF(x) (((x)&0xFFFFFFFF)<<0)
325
326/* Bit definitions and macros for MCF_DTIM_DTCR */
327#define MCF_DTIM_DTCR_CAP(x) (((x)&0xFFFFFFFF)<<0)
328
329/* Bit definitions and macros for MCF_DTIM_DTCN */
330#define MCF_DTIM_DTCN_CNT(x) (((x)&0xFFFFFFFF)<<0)
331
332/*********************************************************************
333 *
334 * FlexBus Chip Selects (FBCS)
335 *
336 *********************************************************************/
337
338/* Register read/write macros */
339#define MCF_FBCS0_CSAR MCF_REG32(0xFC008000)
340#define MCF_FBCS0_CSMR MCF_REG32(0xFC008004)
341#define MCF_FBCS0_CSCR MCF_REG32(0xFC008008)
342#define MCF_FBCS1_CSAR MCF_REG32(0xFC00800C)
343#define MCF_FBCS1_CSMR MCF_REG32(0xFC008010)
344#define MCF_FBCS1_CSCR MCF_REG32(0xFC008014)
345#define MCF_FBCS2_CSAR MCF_REG32(0xFC008018)
346#define MCF_FBCS2_CSMR MCF_REG32(0xFC00801C)
347#define MCF_FBCS2_CSCR MCF_REG32(0xFC008020)
348#define MCF_FBCS3_CSAR MCF_REG32(0xFC008024)
349#define MCF_FBCS3_CSMR MCF_REG32(0xFC008028)
350#define MCF_FBCS3_CSCR MCF_REG32(0xFC00802C)
351#define MCF_FBCS4_CSAR MCF_REG32(0xFC008030)
352#define MCF_FBCS4_CSMR MCF_REG32(0xFC008034)
353#define MCF_FBCS4_CSCR MCF_REG32(0xFC008038)
354#define MCF_FBCS5_CSAR MCF_REG32(0xFC00803C)
355#define MCF_FBCS5_CSMR MCF_REG32(0xFC008040)
356#define MCF_FBCS5_CSCR MCF_REG32(0xFC008044)
357#define MCF_FBCS_CSAR(x) MCF_REG32(0xFC008000+((x)*0x00C))
358#define MCF_FBCS_CSMR(x) MCF_REG32(0xFC008004+((x)*0x00C))
359#define MCF_FBCS_CSCR(x) MCF_REG32(0xFC008008+((x)*0x00C))
360
361/* Bit definitions and macros for MCF_FBCS_CSAR */
362#define MCF_FBCS_CSAR_BA(x) ((x)&0xFFFF0000)
363
364/* Bit definitions and macros for MCF_FBCS_CSMR */
365#define MCF_FBCS_CSMR_V (0x00000001)
366#define MCF_FBCS_CSMR_WP (0x00000100)
367#define MCF_FBCS_CSMR_BAM(x) (((x)&0x0000FFFF)<<16)
368#define MCF_FBCS_CSMR_BAM_4G (0xFFFF0000)
369#define MCF_FBCS_CSMR_BAM_2G (0x7FFF0000)
370#define MCF_FBCS_CSMR_BAM_1G (0x3FFF0000)
371#define MCF_FBCS_CSMR_BAM_1024M (0x3FFF0000)
372#define MCF_FBCS_CSMR_BAM_512M (0x1FFF0000)
373#define MCF_FBCS_CSMR_BAM_256M (0x0FFF0000)
374#define MCF_FBCS_CSMR_BAM_128M (0x07FF0000)
375#define MCF_FBCS_CSMR_BAM_64M (0x03FF0000)
376#define MCF_FBCS_CSMR_BAM_32M (0x01FF0000)
377#define MCF_FBCS_CSMR_BAM_16M (0x00FF0000)
378#define MCF_FBCS_CSMR_BAM_8M (0x007F0000)
379#define MCF_FBCS_CSMR_BAM_4M (0x003F0000)
380#define MCF_FBCS_CSMR_BAM_2M (0x001F0000)
381#define MCF_FBCS_CSMR_BAM_1M (0x000F0000)
382#define MCF_FBCS_CSMR_BAM_1024K (0x000F0000)
383#define MCF_FBCS_CSMR_BAM_512K (0x00070000)
384#define MCF_FBCS_CSMR_BAM_256K (0x00030000)
385#define MCF_FBCS_CSMR_BAM_128K (0x00010000)
386#define MCF_FBCS_CSMR_BAM_64K (0x00000000)
387
388/* Bit definitions and macros for MCF_FBCS_CSCR */
389#define MCF_FBCS_CSCR_BSTW (0x00000008)
390#define MCF_FBCS_CSCR_BSTR (0x00000010)
391#define MCF_FBCS_CSCR_BEM (0x00000020)
392#define MCF_FBCS_CSCR_PS(x) (((x)&0x00000003)<<6)
393#define MCF_FBCS_CSCR_AA (0x00000100)
394#define MCF_FBCS_CSCR_SBM (0x00000200)
395#define MCF_FBCS_CSCR_WS(x) (((x)&0x0000003F)<<10)
396#define MCF_FBCS_CSCR_WRAH(x) (((x)&0x00000003)<<16)
397#define MCF_FBCS_CSCR_RDAH(x) (((x)&0x00000003)<<18)
398#define MCF_FBCS_CSCR_ASET(x) (((x)&0x00000003)<<20)
399#define MCF_FBCS_CSCR_SWSEN (0x00800000)
400#define MCF_FBCS_CSCR_SWS(x) (((x)&0x0000003F)<<26)
401#define MCF_FBCS_CSCR_PS_8 (0x0040)
402#define MCF_FBCS_CSCR_PS_16 (0x0080)
403#define MCF_FBCS_CSCR_PS_32 (0x0000)
404
405/*********************************************************************
406 *
407 * General Purpose I/O (GPIO)
408 *
409 *********************************************************************/
410
411/* Register read/write macros */
412#define MCF_GPIO_PODR_FECH MCF_REG08(0xFC0A4000)
413#define MCF_GPIO_PODR_FECL MCF_REG08(0xFC0A4001)
414#define MCF_GPIO_PODR_SSI MCF_REG08(0xFC0A4002)
415#define MCF_GPIO_PODR_BUSCTL MCF_REG08(0xFC0A4003)
416#define MCF_GPIO_PODR_BE MCF_REG08(0xFC0A4004)
417#define MCF_GPIO_PODR_CS MCF_REG08(0xFC0A4005)
418#define MCF_GPIO_PODR_PWM MCF_REG08(0xFC0A4006)
419#define MCF_GPIO_PODR_FECI2C MCF_REG08(0xFC0A4007)
420#define MCF_GPIO_PODR_UART MCF_REG08(0xFC0A4009)
421#define MCF_GPIO_PODR_QSPI MCF_REG08(0xFC0A400A)
422#define MCF_GPIO_PODR_TIMER MCF_REG08(0xFC0A400B)
423#define MCF_GPIO_PODR_LCDDATAH MCF_REG08(0xFC0A400D)
424#define MCF_GPIO_PODR_LCDDATAM MCF_REG08(0xFC0A400E)
425#define MCF_GPIO_PODR_LCDDATAL MCF_REG08(0xFC0A400F)
426#define MCF_GPIO_PODR_LCDCTLH MCF_REG08(0xFC0A4010)
427#define MCF_GPIO_PODR_LCDCTLL MCF_REG08(0xFC0A4011)
428#define MCF_GPIO_PDDR_FECH MCF_REG08(0xFC0A4014)
429#define MCF_GPIO_PDDR_FECL MCF_REG08(0xFC0A4015)
430#define MCF_GPIO_PDDR_SSI MCF_REG08(0xFC0A4016)
431#define MCF_GPIO_PDDR_BUSCTL MCF_REG08(0xFC0A4017)
432#define MCF_GPIO_PDDR_BE MCF_REG08(0xFC0A4018)
433#define MCF_GPIO_PDDR_CS MCF_REG08(0xFC0A4019)
434#define MCF_GPIO_PDDR_PWM MCF_REG08(0xFC0A401A)
435#define MCF_GPIO_PDDR_FECI2C MCF_REG08(0xFC0A401B)
436#define MCF_GPIO_PDDR_UART MCF_REG08(0xFC0A401C)
437#define MCF_GPIO_PDDR_QSPI MCF_REG08(0xFC0A401E)
438#define MCF_GPIO_PDDR_TIMER MCF_REG08(0xFC0A401F)
439#define MCF_GPIO_PDDR_LCDDATAH MCF_REG08(0xFC0A4021)
440#define MCF_GPIO_PDDR_LCDDATAM MCF_REG08(0xFC0A4022)
441#define MCF_GPIO_PDDR_LCDDATAL MCF_REG08(0xFC0A4023)
442#define MCF_GPIO_PDDR_LCDCTLH MCF_REG08(0xFC0A4024)
443#define MCF_GPIO_PDDR_LCDCTLL MCF_REG08(0xFC0A4025)
444#define MCF_GPIO_PPDSDR_FECH MCF_REG08(0xFC0A4028)
445#define MCF_GPIO_PPDSDR_FECL MCF_REG08(0xFC0A4029)
446#define MCF_GPIO_PPDSDR_SSI MCF_REG08(0xFC0A402A)
447#define MCF_GPIO_PPDSDR_BUSCTL MCF_REG08(0xFC0A402B)
448#define MCF_GPIO_PPDSDR_BE MCF_REG08(0xFC0A402C)
449#define MCF_GPIO_PPDSDR_CS MCF_REG08(0xFC0A402D)
450#define MCF_GPIO_PPDSDR_PWM MCF_REG08(0xFC0A402E)
451#define MCF_GPIO_PPDSDR_FECI2C MCF_REG08(0xFC0A402F)
452#define MCF_GPIO_PPDSDR_UART MCF_REG08(0xFC0A4031)
453#define MCF_GPIO_PPDSDR_QSPI MCF_REG08(0xFC0A4032)
454#define MCF_GPIO_PPDSDR_TIMER MCF_REG08(0xFC0A4033)
455#define MCF_GPIO_PPDSDR_LCDDATAH MCF_REG08(0xFC0A4035)
456#define MCF_GPIO_PPDSDR_LCDDATAM MCF_REG08(0xFC0A4036)
457#define MCF_GPIO_PPDSDR_LCDDATAL MCF_REG08(0xFC0A4037)
458#define MCF_GPIO_PPDSDR_LCDCTLH MCF_REG08(0xFC0A4038)
459#define MCF_GPIO_PPDSDR_LCDCTLL MCF_REG08(0xFC0A4039)
460#define MCF_GPIO_PCLRR_FECH MCF_REG08(0xFC0A403C)
461#define MCF_GPIO_PCLRR_FECL MCF_REG08(0xFC0A403D)
462#define MCF_GPIO_PCLRR_SSI MCF_REG08(0xFC0A403E)
463#define MCF_GPIO_PCLRR_BUSCTL MCF_REG08(0xFC0A403F)
464#define MCF_GPIO_PCLRR_BE MCF_REG08(0xFC0A4040)
465#define MCF_GPIO_PCLRR_CS MCF_REG08(0xFC0A4041)
466#define MCF_GPIO_PCLRR_PWM MCF_REG08(0xFC0A4042)
467#define MCF_GPIO_PCLRR_FECI2C MCF_REG08(0xFC0A4043)
468#define MCF_GPIO_PCLRR_UART MCF_REG08(0xFC0A4045)
469#define MCF_GPIO_PCLRR_QSPI MCF_REG08(0xFC0A4046)
470#define MCF_GPIO_PCLRR_TIMER MCF_REG08(0xFC0A4047)
471#define MCF_GPIO_PCLRR_LCDDATAH MCF_REG08(0xFC0A4049)
472#define MCF_GPIO_PCLRR_LCDDATAM MCF_REG08(0xFC0A404A)
473#define MCF_GPIO_PCLRR_LCDDATAL MCF_REG08(0xFC0A404B)
474#define MCF_GPIO_PCLRR_LCDCTLH MCF_REG08(0xFC0A404C)
475#define MCF_GPIO_PCLRR_LCDCTLL MCF_REG08(0xFC0A404D)
476#define MCF_GPIO_PAR_FEC MCF_REG08(0xFC0A4050)
477#define MCF_GPIO_PAR_PWM MCF_REG08(0xFC0A4051)
478#define MCF_GPIO_PAR_BUSCTL MCF_REG08(0xFC0A4052)
479#define MCF_GPIO_PAR_FECI2C MCF_REG08(0xFC0A4053)
480#define MCF_GPIO_PAR_BE MCF_REG08(0xFC0A4054)
481#define MCF_GPIO_PAR_CS MCF_REG08(0xFC0A4055)
482#define MCF_GPIO_PAR_SSI MCF_REG16(0xFC0A4056)
483#define MCF_GPIO_PAR_UART MCF_REG16(0xFC0A4058)
484#define MCF_GPIO_PAR_QSPI MCF_REG16(0xFC0A405A)
485#define MCF_GPIO_PAR_TIMER MCF_REG08(0xFC0A405C)
486#define MCF_GPIO_PAR_LCDDATA MCF_REG08(0xFC0A405D)
487#define MCF_GPIO_PAR_LCDCTL MCF_REG16(0xFC0A405E)
488#define MCF_GPIO_PAR_IRQ MCF_REG16(0xFC0A4060)
489#define MCF_GPIO_MSCR_FLEXBUS MCF_REG08(0xFC0A4064)
490#define MCF_GPIO_MSCR_SDRAM MCF_REG08(0xFC0A4065)
491#define MCF_GPIO_DSCR_I2C MCF_REG08(0xFC0A4068)
492#define MCF_GPIO_DSCR_PWM MCF_REG08(0xFC0A4069)
493#define MCF_GPIO_DSCR_FEC MCF_REG08(0xFC0A406A)
494#define MCF_GPIO_DSCR_UART MCF_REG08(0xFC0A406B)
495#define MCF_GPIO_DSCR_QSPI MCF_REG08(0xFC0A406C)
496#define MCF_GPIO_DSCR_TIMER MCF_REG08(0xFC0A406D)
497#define MCF_GPIO_DSCR_SSI MCF_REG08(0xFC0A406E)
498#define MCF_GPIO_DSCR_LCD MCF_REG08(0xFC0A406F)
499#define MCF_GPIO_DSCR_DEBUG MCF_REG08(0xFC0A4070)
500#define MCF_GPIO_DSCR_CLKRST MCF_REG08(0xFC0A4071)
501#define MCF_GPIO_DSCR_IRQ MCF_REG08(0xFC0A4072)
502
503/* Bit definitions and macros for MCF_GPIO_PODR_FECH */
504#define MCF_GPIO_PODR_FECH_PODR_FECH0 (0x01)
505#define MCF_GPIO_PODR_FECH_PODR_FECH1 (0x02)
506#define MCF_GPIO_PODR_FECH_PODR_FECH2 (0x04)
507#define MCF_GPIO_PODR_FECH_PODR_FECH3 (0x08)
508#define MCF_GPIO_PODR_FECH_PODR_FECH4 (0x10)
509#define MCF_GPIO_PODR_FECH_PODR_FECH5 (0x20)
510#define MCF_GPIO_PODR_FECH_PODR_FECH6 (0x40)
511#define MCF_GPIO_PODR_FECH_PODR_FECH7 (0x80)
512
513/* Bit definitions and macros for MCF_GPIO_PODR_FECL */
514#define MCF_GPIO_PODR_FECL_PODR_FECL0 (0x01)
515#define MCF_GPIO_PODR_FECL_PODR_FECL1 (0x02)
516#define MCF_GPIO_PODR_FECL_PODR_FECL2 (0x04)
517#define MCF_GPIO_PODR_FECL_PODR_FECL3 (0x08)
518#define MCF_GPIO_PODR_FECL_PODR_FECL4 (0x10)
519#define MCF_GPIO_PODR_FECL_PODR_FECL5 (0x20)
520#define MCF_GPIO_PODR_FECL_PODR_FECL6 (0x40)
521#define MCF_GPIO_PODR_FECL_PODR_FECL7 (0x80)
522
523/* Bit definitions and macros for MCF_GPIO_PODR_SSI */
524#define MCF_GPIO_PODR_SSI_PODR_SSI0 (0x01)
525#define MCF_GPIO_PODR_SSI_PODR_SSI1 (0x02)
526#define MCF_GPIO_PODR_SSI_PODR_SSI2 (0x04)
527#define MCF_GPIO_PODR_SSI_PODR_SSI3 (0x08)
528#define MCF_GPIO_PODR_SSI_PODR_SSI4 (0x10)
529
530/* Bit definitions and macros for MCF_GPIO_PODR_BUSCTL */
531#define MCF_GPIO_PODR_BUSCTL_POSDR_BUSCTL0 (0x01)
532#define MCF_GPIO_PODR_BUSCTL_PODR_BUSCTL1 (0x02)
533#define MCF_GPIO_PODR_BUSCTL_PODR_BUSCTL2 (0x04)
534#define MCF_GPIO_PODR_BUSCTL_PODR_BUSCTL3 (0x08)
535
536/* Bit definitions and macros for MCF_GPIO_PODR_BE */
537#define MCF_GPIO_PODR_BE_PODR_BE0 (0x01)
538#define MCF_GPIO_PODR_BE_PODR_BE1 (0x02)
539#define MCF_GPIO_PODR_BE_PODR_BE2 (0x04)
540#define MCF_GPIO_PODR_BE_PODR_BE3 (0x08)
541
542/* Bit definitions and macros for MCF_GPIO_PODR_CS */
543#define MCF_GPIO_PODR_CS_PODR_CS1 (0x02)
544#define MCF_GPIO_PODR_CS_PODR_CS2 (0x04)
545#define MCF_GPIO_PODR_CS_PODR_CS3 (0x08)
546#define MCF_GPIO_PODR_CS_PODR_CS4 (0x10)
547#define MCF_GPIO_PODR_CS_PODR_CS5 (0x20)
548
549/* Bit definitions and macros for MCF_GPIO_PODR_PWM */
550#define MCF_GPIO_PODR_PWM_PODR_PWM2 (0x04)
551#define MCF_GPIO_PODR_PWM_PODR_PWM3 (0x08)
552#define MCF_GPIO_PODR_PWM_PODR_PWM4 (0x10)
553#define MCF_GPIO_PODR_PWM_PODR_PWM5 (0x20)
554
555/* Bit definitions and macros for MCF_GPIO_PODR_FECI2C */
556#define MCF_GPIO_PODR_FECI2C_PODR_FECI2C0 (0x01)
557#define MCF_GPIO_PODR_FECI2C_PODR_FECI2C1 (0x02)
558#define MCF_GPIO_PODR_FECI2C_PODR_FECI2C2 (0x04)
559#define MCF_GPIO_PODR_FECI2C_PODR_FECI2C3 (0x08)
560
561/* Bit definitions and macros for MCF_GPIO_PODR_UART */
562#define MCF_GPIO_PODR_UART_PODR_UART0 (0x01)
563#define MCF_GPIO_PODR_UART_PODR_UART1 (0x02)
564#define MCF_GPIO_PODR_UART_PODR_UART2 (0x04)
565#define MCF_GPIO_PODR_UART_PODR_UART3 (0x08)
566#define MCF_GPIO_PODR_UART_PODR_UART4 (0x10)
567#define MCF_GPIO_PODR_UART_PODR_UART5 (0x20)
568#define MCF_GPIO_PODR_UART_PODR_UART6 (0x40)
569#define MCF_GPIO_PODR_UART_PODR_UART7 (0x80)
570
571/* Bit definitions and macros for MCF_GPIO_PODR_QSPI */
572#define MCF_GPIO_PODR_QSPI_PODR_QSPI0 (0x01)
573#define MCF_GPIO_PODR_QSPI_PODR_QSPI1 (0x02)
574#define MCF_GPIO_PODR_QSPI_PODR_QSPI2 (0x04)
575#define MCF_GPIO_PODR_QSPI_PODR_QSPI3 (0x08)
576#define MCF_GPIO_PODR_QSPI_PODR_QSPI4 (0x10)
577#define MCF_GPIO_PODR_QSPI_PODR_QSPI5 (0x20)
578
579/* Bit definitions and macros for MCF_GPIO_PODR_TIMER */
580#define MCF_GPIO_PODR_TIMER_PODR_TIMER0 (0x01)
581#define MCF_GPIO_PODR_TIMER_PODR_TIMER1 (0x02)
582#define MCF_GPIO_PODR_TIMER_PODR_TIMER2 (0x04)
583#define MCF_GPIO_PODR_TIMER_PODR_TIMER3 (0x08)
584
585/* Bit definitions and macros for MCF_GPIO_PODR_LCDDATAH */
586#define MCF_GPIO_PODR_LCDDATAH_PODR_LCDDATAH0 (0x01)
587#define MCF_GPIO_PODR_LCDDATAH_PODR_LCDDATAH1 (0x02)
588
589/* Bit definitions and macros for MCF_GPIO_PODR_LCDDATAM */
590#define MCF_GPIO_PODR_LCDDATAM_PODR_LCDDATAM0 (0x01)
591#define MCF_GPIO_PODR_LCDDATAM_PODR_LCDDATAM1 (0x02)
592#define MCF_GPIO_PODR_LCDDATAM_PODR_LCDDATAM2 (0x04)
593#define MCF_GPIO_PODR_LCDDATAM_PODR_LCDDATAM3 (0x08)
594#define MCF_GPIO_PODR_LCDDATAM_PODR_LCDDATAM4 (0x10)
595#define MCF_GPIO_PODR_LCDDATAM_PODR_LCDDATAM5 (0x20)
596#define MCF_GPIO_PODR_LCDDATAM_PODR_LCDDATAM6 (0x40)
597#define MCF_GPIO_PODR_LCDDATAM_PODR_LCDDATAM7 (0x80)
598
599/* Bit definitions and macros for MCF_GPIO_PODR_LCDDATAL */
600#define MCF_GPIO_PODR_LCDDATAL_PODR_LCDDATAL0 (0x01)
601#define MCF_GPIO_PODR_LCDDATAL_PODR_LCDDATAL1 (0x02)
602#define MCF_GPIO_PODR_LCDDATAL_PODR_LCDDATAL2 (0x04)
603#define MCF_GPIO_PODR_LCDDATAL_PODR_LCDDATAL3 (0x08)
604#define MCF_GPIO_PODR_LCDDATAL_PODR_LCDDATAL4 (0x10)
605#define MCF_GPIO_PODR_LCDDATAL_PODR_LCDDATAL5 (0x20)
606#define MCF_GPIO_PODR_LCDDATAL_PODR_LCDDATAL6 (0x40)
607#define MCF_GPIO_PODR_LCDDATAL_PODR_LCDDATAL7 (0x80)
608
609/* Bit definitions and macros for MCF_GPIO_PODR_LCDCTLH */
610#define MCF_GPIO_PODR_LCDCTLH_PODR_LCDCTLH0 (0x01)
611
612/* Bit definitions and macros for MCF_GPIO_PODR_LCDCTLL */
613#define MCF_GPIO_PODR_LCDCTLL_PODR_LCDCTLL0 (0x01)
614#define MCF_GPIO_PODR_LCDCTLL_PODR_LCDCTLL1 (0x02)
615#define MCF_GPIO_PODR_LCDCTLL_PODR_LCDCTLL2 (0x04)
616#define MCF_GPIO_PODR_LCDCTLL_PODR_LCDCTLL3 (0x08)
617#define MCF_GPIO_PODR_LCDCTLL_PODR_LCDCTLL4 (0x10)
618#define MCF_GPIO_PODR_LCDCTLL_PODR_LCDCTLL5 (0x20)
619#define MCF_GPIO_PODR_LCDCTLL_PODR_LCDCTLL6 (0x40)
620#define MCF_GPIO_PODR_LCDCTLL_PODR_LCDCTLL7 (0x80)
621
622/* Bit definitions and macros for MCF_GPIO_PDDR_FECH */
623#define MCF_GPIO_PDDR_FECH_PDDR_FECH0 (0x01)
624#define MCF_GPIO_PDDR_FECH_PDDR_FECH1 (0x02)
625#define MCF_GPIO_PDDR_FECH_PDDR_FECH2 (0x04)
626#define MCF_GPIO_PDDR_FECH_PDDR_FECH3 (0x08)
627#define MCF_GPIO_PDDR_FECH_PDDR_FECH4 (0x10)
628#define MCF_GPIO_PDDR_FECH_PDDR_FECH5 (0x20)
629#define MCF_GPIO_PDDR_FECH_PDDR_FECH6 (0x40)
630#define MCF_GPIO_PDDR_FECH_PDDR_FECH7 (0x80)
631
632/* Bit definitions and macros for MCF_GPIO_PDDR_FECL */
633#define MCF_GPIO_PDDR_FECL_PDDR_FECL0 (0x01)
634#define MCF_GPIO_PDDR_FECL_PDDR_FECL1 (0x02)
635#define MCF_GPIO_PDDR_FECL_PDDR_FECL2 (0x04)
636#define MCF_GPIO_PDDR_FECL_PDDR_FECL3 (0x08)
637#define MCF_GPIO_PDDR_FECL_PDDR_FECL4 (0x10)
638#define MCF_GPIO_PDDR_FECL_PDDR_FECL5 (0x20)
639#define MCF_GPIO_PDDR_FECL_PDDR_FECL6 (0x40)
640#define MCF_GPIO_PDDR_FECL_PDDR_FECL7 (0x80)
641
642/* Bit definitions and macros for MCF_GPIO_PDDR_SSI */
643#define MCF_GPIO_PDDR_SSI_PDDR_SSI0 (0x01)
644#define MCF_GPIO_PDDR_SSI_PDDR_SSI1 (0x02)
645#define MCF_GPIO_PDDR_SSI_PDDR_SSI2 (0x04)
646#define MCF_GPIO_PDDR_SSI_PDDR_SSI3 (0x08)
647#define MCF_GPIO_PDDR_SSI_PDDR_SSI4 (0x10)
648
649/* Bit definitions and macros for MCF_GPIO_PDDR_BUSCTL */
650#define MCF_GPIO_PDDR_BUSCTL_POSDR_BUSCTL0 (0x01)
651#define MCF_GPIO_PDDR_BUSCTL_PDDR_BUSCTL1 (0x02)
652#define MCF_GPIO_PDDR_BUSCTL_PDDR_BUSCTL2 (0x04)
653#define MCF_GPIO_PDDR_BUSCTL_PDDR_BUSCTL3 (0x08)
654
655/* Bit definitions and macros for MCF_GPIO_PDDR_BE */
656#define MCF_GPIO_PDDR_BE_PDDR_BE0 (0x01)
657#define MCF_GPIO_PDDR_BE_PDDR_BE1 (0x02)
658#define MCF_GPIO_PDDR_BE_PDDR_BE2 (0x04)
659#define MCF_GPIO_PDDR_BE_PDDR_BE3 (0x08)
660
661/* Bit definitions and macros for MCF_GPIO_PDDR_CS */
662#define MCF_GPIO_PDDR_CS_PDDR_CS1 (0x02)
663#define MCF_GPIO_PDDR_CS_PDDR_CS2 (0x04)
664#define MCF_GPIO_PDDR_CS_PDDR_CS3 (0x08)
665#define MCF_GPIO_PDDR_CS_PDDR_CS4 (0x10)
666#define MCF_GPIO_PDDR_CS_PDDR_CS5 (0x20)
667
668/* Bit definitions and macros for MCF_GPIO_PDDR_PWM */
669#define MCF_GPIO_PDDR_PWM_PDDR_PWM2 (0x04)
670#define MCF_GPIO_PDDR_PWM_PDDR_PWM3 (0x08)
671#define MCF_GPIO_PDDR_PWM_PDDR_PWM4 (0x10)
672#define MCF_GPIO_PDDR_PWM_PDDR_PWM5 (0x20)
673
674/* Bit definitions and macros for MCF_GPIO_PDDR_FECI2C */
675#define MCF_GPIO_PDDR_FECI2C_PDDR_FECI2C0 (0x01)
676#define MCF_GPIO_PDDR_FECI2C_PDDR_FECI2C1 (0x02)
677#define MCF_GPIO_PDDR_FECI2C_PDDR_FECI2C2 (0x04)
678#define MCF_GPIO_PDDR_FECI2C_PDDR_FECI2C3 (0x08)
679
680/* Bit definitions and macros for MCF_GPIO_PDDR_UART */
681#define MCF_GPIO_PDDR_UART_PDDR_UART0 (0x01)
682#define MCF_GPIO_PDDR_UART_PDDR_UART1 (0x02)
683#define MCF_GPIO_PDDR_UART_PDDR_UART2 (0x04)
684#define MCF_GPIO_PDDR_UART_PDDR_UART3 (0x08)
685#define MCF_GPIO_PDDR_UART_PDDR_UART4 (0x10)
686#define MCF_GPIO_PDDR_UART_PDDR_UART5 (0x20)
687#define MCF_GPIO_PDDR_UART_PDDR_UART6 (0x40)
688#define MCF_GPIO_PDDR_UART_PDDR_UART7 (0x80)
689
690/* Bit definitions and macros for MCF_GPIO_PDDR_QSPI */
691#define MCF_GPIO_PDDR_QSPI_PDDR_QSPI0 (0x01)
692#define MCF_GPIO_PDDR_QSPI_PDDR_QSPI1 (0x02)
693#define MCF_GPIO_PDDR_QSPI_PDDR_QSPI2 (0x04)
694#define MCF_GPIO_PDDR_QSPI_PDDR_QSPI3 (0x08)
695#define MCF_GPIO_PDDR_QSPI_PDDR_QSPI4 (0x10)
696#define MCF_GPIO_PDDR_QSPI_PDDR_QSPI5 (0x20)
697
698/* Bit definitions and macros for MCF_GPIO_PDDR_TIMER */
699#define MCF_GPIO_PDDR_TIMER_PDDR_TIMER0 (0x01)
700#define MCF_GPIO_PDDR_TIMER_PDDR_TIMER1 (0x02)
701#define MCF_GPIO_PDDR_TIMER_PDDR_TIMER2 (0x04)
702#define MCF_GPIO_PDDR_TIMER_PDDR_TIMER3 (0x08)
703
704/* Bit definitions and macros for MCF_GPIO_PDDR_LCDDATAH */
705#define MCF_GPIO_PDDR_LCDDATAH_PDDR_LCDDATAH0 (0x01)
706#define MCF_GPIO_PDDR_LCDDATAH_PDDR_LCDDATAH1 (0x02)
707
708/* Bit definitions and macros for MCF_GPIO_PDDR_LCDDATAM */
709#define MCF_GPIO_PDDR_LCDDATAM_PDDR_LCDDATAM0 (0x01)
710#define MCF_GPIO_PDDR_LCDDATAM_PDDR_LCDDATAM1 (0x02)
711#define MCF_GPIO_PDDR_LCDDATAM_PDDR_LCDDATAM2 (0x04)
712#define MCF_GPIO_PDDR_LCDDATAM_PDDR_LCDDATAM3 (0x08)
713#define MCF_GPIO_PDDR_LCDDATAM_PDDR_LCDDATAM4 (0x10)
714#define MCF_GPIO_PDDR_LCDDATAM_PDDR_LCDDATAM5 (0x20)
715#define MCF_GPIO_PDDR_LCDDATAM_PDDR_LCDDATAM6 (0x40)
716#define MCF_GPIO_PDDR_LCDDATAM_PDDR_LCDDATAM7 (0x80)
717
718/* Bit definitions and macros for MCF_GPIO_PDDR_LCDDATAL */
719#define MCF_GPIO_PDDR_LCDDATAL_PDDR_LCDDATAL0 (0x01)
720#define MCF_GPIO_PDDR_LCDDATAL_PDDR_LCDDATAL1 (0x02)
721#define MCF_GPIO_PDDR_LCDDATAL_PDDR_LCDDATAL2 (0x04)
722#define MCF_GPIO_PDDR_LCDDATAL_PDDR_LCDDATAL3 (0x08)
723#define MCF_GPIO_PDDR_LCDDATAL_PDDR_LCDDATAL4 (0x10)
724#define MCF_GPIO_PDDR_LCDDATAL_PDDR_LCDDATAL5 (0x20)
725#define MCF_GPIO_PDDR_LCDDATAL_PDDR_LCDDATAL6 (0x40)
726#define MCF_GPIO_PDDR_LCDDATAL_PDDR_LCDDATAL7 (0x80)
727
728/* Bit definitions and macros for MCF_GPIO_PDDR_LCDCTLH */
729#define MCF_GPIO_PDDR_LCDCTLH_PDDR_LCDCTLH0 (0x01)
730
731/* Bit definitions and macros for MCF_GPIO_PDDR_LCDCTLL */
732#define MCF_GPIO_PDDR_LCDCTLL_PDDR_LCDCTLL0 (0x01)
733#define MCF_GPIO_PDDR_LCDCTLL_PDDR_LCDCTLL1 (0x02)
734#define MCF_GPIO_PDDR_LCDCTLL_PDDR_LCDCTLL2 (0x04)
735#define MCF_GPIO_PDDR_LCDCTLL_PDDR_LCDCTLL3 (0x08)
736#define MCF_GPIO_PDDR_LCDCTLL_PDDR_LCDCTLL4 (0x10)
737#define MCF_GPIO_PDDR_LCDCTLL_PDDR_LCDCTLL5 (0x20)
738#define MCF_GPIO_PDDR_LCDCTLL_PDDR_LCDCTLL6 (0x40)
739#define MCF_GPIO_PDDR_LCDCTLL_PDDR_LCDCTLL7 (0x80)
740
741/* Bit definitions and macros for MCF_GPIO_PPDSDR_FECH */
742#define MCF_GPIO_PPDSDR_FECH_PPDSDR_FECH0 (0x01)
743#define MCF_GPIO_PPDSDR_FECH_PPDSDR_FECH1 (0x02)
744#define MCF_GPIO_PPDSDR_FECH_PPDSDR_FECH2 (0x04)
745#define MCF_GPIO_PPDSDR_FECH_PPDSDR_FECH3 (0x08)
746#define MCF_GPIO_PPDSDR_FECH_PPDSDR_FECH4 (0x10)
747#define MCF_GPIO_PPDSDR_FECH_PPDSDR_FECH5 (0x20)
748#define MCF_GPIO_PPDSDR_FECH_PPDSDR_FECH6 (0x40)
749#define MCF_GPIO_PPDSDR_FECH_PPDSDR_FECH7 (0x80)
750
751/* Bit definitions and macros for MCF_GPIO_PPDSDR_FECL */
752#define MCF_GPIO_PPDSDR_FECL_PPDSDR_FECL0 (0x01)
753#define MCF_GPIO_PPDSDR_FECL_PPDSDR_FECL1 (0x02)
754#define MCF_GPIO_PPDSDR_FECL_PPDSDR_FECL2 (0x04)
755#define MCF_GPIO_PPDSDR_FECL_PPDSDR_FECL3 (0x08)
756#define MCF_GPIO_PPDSDR_FECL_PPDSDR_FECL4 (0x10)
757#define MCF_GPIO_PPDSDR_FECL_PPDSDR_FECL5 (0x20)
758#define MCF_GPIO_PPDSDR_FECL_PPDSDR_FECL6 (0x40)
759#define MCF_GPIO_PPDSDR_FECL_PPDSDR_FECL7 (0x80)
760
761/* Bit definitions and macros for MCF_GPIO_PPDSDR_SSI */
762#define MCF_GPIO_PPDSDR_SSI_PPDSDR_SSI0 (0x01)
763#define MCF_GPIO_PPDSDR_SSI_PPDSDR_SSI1 (0x02)
764#define MCF_GPIO_PPDSDR_SSI_PPDSDR_SSI2 (0x04)
765#define MCF_GPIO_PPDSDR_SSI_PPDSDR_SSI3 (0x08)
766#define MCF_GPIO_PPDSDR_SSI_PPDSDR_SSI4 (0x10)
767
768/* Bit definitions and macros for MCF_GPIO_PPDSDR_BUSCTL */
769#define MCF_GPIO_PPDSDR_BUSCTL_POSDR_BUSCTL0 (0x01)
770#define MCF_GPIO_PPDSDR_BUSCTL_PPDSDR_BUSCTL1 (0x02)
771#define MCF_GPIO_PPDSDR_BUSCTL_PPDSDR_BUSCTL2 (0x04)
772#define MCF_GPIO_PPDSDR_BUSCTL_PPDSDR_BUSCTL3 (0x08)
773
774/* Bit definitions and macros for MCF_GPIO_PPDSDR_BE */
775#define MCF_GPIO_PPDSDR_BE_PPDSDR_BE0 (0x01)
776#define MCF_GPIO_PPDSDR_BE_PPDSDR_BE1 (0x02)
777#define MCF_GPIO_PPDSDR_BE_PPDSDR_BE2 (0x04)
778#define MCF_GPIO_PPDSDR_BE_PPDSDR_BE3 (0x08)
779
780/* Bit definitions and macros for MCF_GPIO_PPDSDR_CS */
781#define MCF_GPIO_PPDSDR_CS_PPDSDR_CS1 (0x02)
782#define MCF_GPIO_PPDSDR_CS_PPDSDR_CS2 (0x04)
783#define MCF_GPIO_PPDSDR_CS_PPDSDR_CS3 (0x08)
784#define MCF_GPIO_PPDSDR_CS_PPDSDR_CS4 (0x10)
785#define MCF_GPIO_PPDSDR_CS_PPDSDR_CS5 (0x20)
786
787/* Bit definitions and macros for MCF_GPIO_PPDSDR_PWM */
788#define MCF_GPIO_PPDSDR_PWM_PPDSDR_PWM2 (0x04)
789#define MCF_GPIO_PPDSDR_PWM_PPDSDR_PWM3 (0x08)
790#define MCF_GPIO_PPDSDR_PWM_PPDSDR_PWM4 (0x10)
791#define MCF_GPIO_PPDSDR_PWM_PPDSDR_PWM5 (0x20)
792
793/* Bit definitions and macros for MCF_GPIO_PPDSDR_FECI2C */
794#define MCF_GPIO_PPDSDR_FECI2C_PPDSDR_FECI2C0 (0x01)
795#define MCF_GPIO_PPDSDR_FECI2C_PPDSDR_FECI2C1 (0x02)
796#define MCF_GPIO_PPDSDR_FECI2C_PPDSDR_FECI2C2 (0x04)
797#define MCF_GPIO_PPDSDR_FECI2C_PPDSDR_FECI2C3 (0x08)
798
799/* Bit definitions and macros for MCF_GPIO_PPDSDR_UART */
800#define MCF_GPIO_PPDSDR_UART_PPDSDR_UART0 (0x01)
801#define MCF_GPIO_PPDSDR_UART_PPDSDR_UART1 (0x02)
802#define MCF_GPIO_PPDSDR_UART_PPDSDR_UART2 (0x04)
803#define MCF_GPIO_PPDSDR_UART_PPDSDR_UART3 (0x08)
804#define MCF_GPIO_PPDSDR_UART_PPDSDR_UART4 (0x10)
805#define MCF_GPIO_PPDSDR_UART_PPDSDR_UART5 (0x20)
806#define MCF_GPIO_PPDSDR_UART_PPDSDR_UART6 (0x40)
807#define MCF_GPIO_PPDSDR_UART_PPDSDR_UART7 (0x80)
808
809/* Bit definitions and macros for MCF_GPIO_PPDSDR_QSPI */
810#define MCF_GPIO_PPDSDR_QSPI_PPDSDR_QSPI0 (0x01)
811#define MCF_GPIO_PPDSDR_QSPI_PPDSDR_QSPI1 (0x02)
812#define MCF_GPIO_PPDSDR_QSPI_PPDSDR_QSPI2 (0x04)
813#define MCF_GPIO_PPDSDR_QSPI_PPDSDR_QSPI3 (0x08)
814#define MCF_GPIO_PPDSDR_QSPI_PPDSDR_QSPI4 (0x10)
815#define MCF_GPIO_PPDSDR_QSPI_PPDSDR_QSPI5 (0x20)
816
817/* Bit definitions and macros for MCF_GPIO_PPDSDR_TIMER */
818#define MCF_GPIO_PPDSDR_TIMER_PPDSDR_TIMER0 (0x01)
819#define MCF_GPIO_PPDSDR_TIMER_PPDSDR_TIMER1 (0x02)
820#define MCF_GPIO_PPDSDR_TIMER_PPDSDR_TIMER2 (0x04)
821#define MCF_GPIO_PPDSDR_TIMER_PPDSDR_TIMER3 (0x08)
822
823/* Bit definitions and macros for MCF_GPIO_PPDSDR_LCDDATAH */
824#define MCF_GPIO_PPDSDR_LCDDATAH_PPDSDR_LCDDATAH0 (0x01)
825#define MCF_GPIO_PPDSDR_LCDDATAH_PPDSDR_LCDDATAH1 (0x02)
826
827/* Bit definitions and macros for MCF_GPIO_PPDSDR_LCDDATAM */
828#define MCF_GPIO_PPDSDR_LCDDATAM_PPDSDR_LCDDATAM0 (0x01)
829#define MCF_GPIO_PPDSDR_LCDDATAM_PPDSDR_LCDDATAM1 (0x02)
830#define MCF_GPIO_PPDSDR_LCDDATAM_PPDSDR_LCDDATAM2 (0x04)
831#define MCF_GPIO_PPDSDR_LCDDATAM_PPDSDR_LCDDATAM3 (0x08)
832#define MCF_GPIO_PPDSDR_LCDDATAM_PPDSDR_LCDDATAM4 (0x10)
833#define MCF_GPIO_PPDSDR_LCDDATAM_PPDSDR_LCDDATAM5 (0x20)
834#define MCF_GPIO_PPDSDR_LCDDATAM_PPDSDR_LCDDATAM6 (0x40)
835#define MCF_GPIO_PPDSDR_LCDDATAM_PPDSDR_LCDDATAM7 (0x80)
836
837/* Bit definitions and macros for MCF_GPIO_PPDSDR_LCDDATAL */
838#define MCF_GPIO_PPDSDR_LCDDATAL_PPDSDR_LCDDATAL0 (0x01)
839#define MCF_GPIO_PPDSDR_LCDDATAL_PPDSDR_LCDDATAL1 (0x02)
840#define MCF_GPIO_PPDSDR_LCDDATAL_PPDSDR_LCDDATAL2 (0x04)
841#define MCF_GPIO_PPDSDR_LCDDATAL_PPDSDR_LCDDATAL3 (0x08)
842#define MCF_GPIO_PPDSDR_LCDDATAL_PPDSDR_LCDDATAL4 (0x10)
843#define MCF_GPIO_PPDSDR_LCDDATAL_PPDSDR_LCDDATAL5 (0x20)
844#define MCF_GPIO_PPDSDR_LCDDATAL_PPDSDR_LCDDATAL6 (0x40)
845#define MCF_GPIO_PPDSDR_LCDDATAL_PPDSDR_LCDDATAL7 (0x80)
846
847/* Bit definitions and macros for MCF_GPIO_PPDSDR_LCDCTLH */
848#define MCF_GPIO_PPDSDR_LCDCTLH_PPDSDR_LCDCTLH0 (0x01)
849
850/* Bit definitions and macros for MCF_GPIO_PPDSDR_LCDCTLL */
851#define MCF_GPIO_PPDSDR_LCDCTLL_PPDSDR_LCDCTLL0 (0x01)
852#define MCF_GPIO_PPDSDR_LCDCTLL_PPDSDR_LCDCTLL1 (0x02)
853#define MCF_GPIO_PPDSDR_LCDCTLL_PPDSDR_LCDCTLL2 (0x04)
854#define MCF_GPIO_PPDSDR_LCDCTLL_PPDSDR_LCDCTLL3 (0x08)
855#define MCF_GPIO_PPDSDR_LCDCTLL_PPDSDR_LCDCTLL4 (0x10)
856#define MCF_GPIO_PPDSDR_LCDCTLL_PPDSDR_LCDCTLL5 (0x20)
857#define MCF_GPIO_PPDSDR_LCDCTLL_PPDSDR_LCDCTLL6 (0x40)
858#define MCF_GPIO_PPDSDR_LCDCTLL_PPDSDR_LCDCTLL7 (0x80)
859
860/* Bit definitions and macros for MCF_GPIO_PCLRR_FECH */
861#define MCF_GPIO_PCLRR_FECH_PCLRR_FECH0 (0x01)
862#define MCF_GPIO_PCLRR_FECH_PCLRR_FECH1 (0x02)
863#define MCF_GPIO_PCLRR_FECH_PCLRR_FECH2 (0x04)
864#define MCF_GPIO_PCLRR_FECH_PCLRR_FECH3 (0x08)
865#define MCF_GPIO_PCLRR_FECH_PCLRR_FECH4 (0x10)
866#define MCF_GPIO_PCLRR_FECH_PCLRR_FECH5 (0x20)
867#define MCF_GPIO_PCLRR_FECH_PCLRR_FECH6 (0x40)
868#define MCF_GPIO_PCLRR_FECH_PCLRR_FECH7 (0x80)
869
870/* Bit definitions and macros for MCF_GPIO_PCLRR_FECL */
871#define MCF_GPIO_PCLRR_FECL_PCLRR_FECL0 (0x01)
872#define MCF_GPIO_PCLRR_FECL_PCLRR_FECL1 (0x02)
873#define MCF_GPIO_PCLRR_FECL_PCLRR_FECL2 (0x04)
874#define MCF_GPIO_PCLRR_FECL_PCLRR_FECL3 (0x08)
875#define MCF_GPIO_PCLRR_FECL_PCLRR_FECL4 (0x10)
876#define MCF_GPIO_PCLRR_FECL_PCLRR_FECL5 (0x20)
877#define MCF_GPIO_PCLRR_FECL_PCLRR_FECL6 (0x40)
878#define MCF_GPIO_PCLRR_FECL_PCLRR_FECL7 (0x80)
879
880/* Bit definitions and macros for MCF_GPIO_PCLRR_SSI */
881#define MCF_GPIO_PCLRR_SSI_PCLRR_SSI0 (0x01)
882#define MCF_GPIO_PCLRR_SSI_PCLRR_SSI1 (0x02)
883#define MCF_GPIO_PCLRR_SSI_PCLRR_SSI2 (0x04)
884#define MCF_GPIO_PCLRR_SSI_PCLRR_SSI3 (0x08)
885#define MCF_GPIO_PCLRR_SSI_PCLRR_SSI4 (0x10)
886
887/* Bit definitions and macros for MCF_GPIO_PCLRR_BUSCTL */
888#define MCF_GPIO_PCLRR_BUSCTL_POSDR_BUSCTL0 (0x01)
889#define MCF_GPIO_PCLRR_BUSCTL_PCLRR_BUSCTL1 (0x02)
890#define MCF_GPIO_PCLRR_BUSCTL_PCLRR_BUSCTL2 (0x04)
891#define MCF_GPIO_PCLRR_BUSCTL_PCLRR_BUSCTL3 (0x08)
892
893/* Bit definitions and macros for MCF_GPIO_PCLRR_BE */
894#define MCF_GPIO_PCLRR_BE_PCLRR_BE0 (0x01)
895#define MCF_GPIO_PCLRR_BE_PCLRR_BE1 (0x02)
896#define MCF_GPIO_PCLRR_BE_PCLRR_BE2 (0x04)
897#define MCF_GPIO_PCLRR_BE_PCLRR_BE3 (0x08)
898
899/* Bit definitions and macros for MCF_GPIO_PCLRR_CS */
900#define MCF_GPIO_PCLRR_CS_PCLRR_CS1 (0x02)
901#define MCF_GPIO_PCLRR_CS_PCLRR_CS2 (0x04)
902#define MCF_GPIO_PCLRR_CS_PCLRR_CS3 (0x08)
903#define MCF_GPIO_PCLRR_CS_PCLRR_CS4 (0x10)
904#define MCF_GPIO_PCLRR_CS_PCLRR_CS5 (0x20)
905
906/* Bit definitions and macros for MCF_GPIO_PCLRR_PWM */
907#define MCF_GPIO_PCLRR_PWM_PCLRR_PWM2 (0x04)
908#define MCF_GPIO_PCLRR_PWM_PCLRR_PWM3 (0x08)
909#define MCF_GPIO_PCLRR_PWM_PCLRR_PWM4 (0x10)
910#define MCF_GPIO_PCLRR_PWM_PCLRR_PWM5 (0x20)
911
912/* Bit definitions and macros for MCF_GPIO_PCLRR_FECI2C */
913#define MCF_GPIO_PCLRR_FECI2C_PCLRR_FECI2C0 (0x01)
914#define MCF_GPIO_PCLRR_FECI2C_PCLRR_FECI2C1 (0x02)
915#define MCF_GPIO_PCLRR_FECI2C_PCLRR_FECI2C2 (0x04)
916#define MCF_GPIO_PCLRR_FECI2C_PCLRR_FECI2C3 (0x08)
917
918/* Bit definitions and macros for MCF_GPIO_PCLRR_UART */
919#define MCF_GPIO_PCLRR_UART_PCLRR_UART0 (0x01)
920#define MCF_GPIO_PCLRR_UART_PCLRR_UART1 (0x02)
921#define MCF_GPIO_PCLRR_UART_PCLRR_UART2 (0x04)
922#define MCF_GPIO_PCLRR_UART_PCLRR_UART3 (0x08)
923#define MCF_GPIO_PCLRR_UART_PCLRR_UART4 (0x10)
924#define MCF_GPIO_PCLRR_UART_PCLRR_UART5 (0x20)
925#define MCF_GPIO_PCLRR_UART_PCLRR_UART6 (0x40)
926#define MCF_GPIO_PCLRR_UART_PCLRR_UART7 (0x80)
927
928/* Bit definitions and macros for MCF_GPIO_PCLRR_QSPI */
929#define MCF_GPIO_PCLRR_QSPI_PCLRR_QSPI0 (0x01)
930#define MCF_GPIO_PCLRR_QSPI_PCLRR_QSPI1 (0x02)
931#define MCF_GPIO_PCLRR_QSPI_PCLRR_QSPI2 (0x04)
932#define MCF_GPIO_PCLRR_QSPI_PCLRR_QSPI3 (0x08)
933#define MCF_GPIO_PCLRR_QSPI_PCLRR_QSPI4 (0x10)
934#define MCF_GPIO_PCLRR_QSPI_PCLRR_QSPI5 (0x20)
935
936/* Bit definitions and macros for MCF_GPIO_PCLRR_TIMER */
937#define MCF_GPIO_PCLRR_TIMER_PCLRR_TIMER0 (0x01)
938#define MCF_GPIO_PCLRR_TIMER_PCLRR_TIMER1 (0x02)
939#define MCF_GPIO_PCLRR_TIMER_PCLRR_TIMER2 (0x04)
940#define MCF_GPIO_PCLRR_TIMER_PCLRR_TIMER3 (0x08)
941
942/* Bit definitions and macros for MCF_GPIO_PCLRR_LCDDATAH */
943#define MCF_GPIO_PCLRR_LCDDATAH_PCLRR_LCDDATAH0 (0x01)
944#define MCF_GPIO_PCLRR_LCDDATAH_PCLRR_LCDDATAH1 (0x02)
945
946/* Bit definitions and macros for MCF_GPIO_PCLRR_LCDDATAM */
947#define MCF_GPIO_PCLRR_LCDDATAM_PCLRR_LCDDATAM0 (0x01)
948#define MCF_GPIO_PCLRR_LCDDATAM_PCLRR_LCDDATAM1 (0x02)
949#define MCF_GPIO_PCLRR_LCDDATAM_PCLRR_LCDDATAM2 (0x04)
950#define MCF_GPIO_PCLRR_LCDDATAM_PCLRR_LCDDATAM3 (0x08)
951#define MCF_GPIO_PCLRR_LCDDATAM_PCLRR_LCDDATAM4 (0x10)
952#define MCF_GPIO_PCLRR_LCDDATAM_PCLRR_LCDDATAM5 (0x20)
953#define MCF_GPIO_PCLRR_LCDDATAM_PCLRR_LCDDATAM6 (0x40)
954#define MCF_GPIO_PCLRR_LCDDATAM_PCLRR_LCDDATAM7 (0x80)
955
956/* Bit definitions and macros for MCF_GPIO_PCLRR_LCDDATAL */
957#define MCF_GPIO_PCLRR_LCDDATAL_PCLRR_LCDDATAL0 (0x01)
958#define MCF_GPIO_PCLRR_LCDDATAL_PCLRR_LCDDATAL1 (0x02)
959#define MCF_GPIO_PCLRR_LCDDATAL_PCLRR_LCDDATAL2 (0x04)
960#define MCF_GPIO_PCLRR_LCDDATAL_PCLRR_LCDDATAL3 (0x08)
961#define MCF_GPIO_PCLRR_LCDDATAL_PCLRR_LCDDATAL4 (0x10)
962#define MCF_GPIO_PCLRR_LCDDATAL_PCLRR_LCDDATAL5 (0x20)
963#define MCF_GPIO_PCLRR_LCDDATAL_PCLRR_LCDDATAL6 (0x40)
964#define MCF_GPIO_PCLRR_LCDDATAL_PCLRR_LCDDATAL7 (0x80)
965
966/* Bit definitions and macros for MCF_GPIO_PCLRR_LCDCTLH */
967#define MCF_GPIO_PCLRR_LCDCTLH_PCLRR_LCDCTLH0 (0x01)
968
969/* Bit definitions and macros for MCF_GPIO_PCLRR_LCDCTLL */
970#define MCF_GPIO_PCLRR_LCDCTLL_PCLRR_LCDCTLL0 (0x01)
971#define MCF_GPIO_PCLRR_LCDCTLL_PCLRR_LCDCTLL1 (0x02)
972#define MCF_GPIO_PCLRR_LCDCTLL_PCLRR_LCDCTLL2 (0x04)
973#define MCF_GPIO_PCLRR_LCDCTLL_PCLRR_LCDCTLL3 (0x08)
974#define MCF_GPIO_PCLRR_LCDCTLL_PCLRR_LCDCTLL4 (0x10)
975#define MCF_GPIO_PCLRR_LCDCTLL_PCLRR_LCDCTLL5 (0x20)
976#define MCF_GPIO_PCLRR_LCDCTLL_PCLRR_LCDCTLL6 (0x40)
977#define MCF_GPIO_PCLRR_LCDCTLL_PCLRR_LCDCTLL7 (0x80)
978
979/* Bit definitions and macros for MCF_GPIO_PAR_FEC */
980#define MCF_GPIO_PAR_FEC_PAR_FEC_MII(x) (((x)&0x03)<<0)
981#define MCF_GPIO_PAR_FEC_PAR_FEC_7W(x) (((x)&0x03)<<2)
982#define MCF_GPIO_PAR_FEC_PAR_FEC_7W_GPIO (0x00)
983#define MCF_GPIO_PAR_FEC_PAR_FEC_7W_URTS1 (0x04)
984#define MCF_GPIO_PAR_FEC_PAR_FEC_7W_FEC (0x0C)
985#define MCF_GPIO_PAR_FEC_PAR_FEC_MII_GPIO (0x00)
986#define MCF_GPIO_PAR_FEC_PAR_FEC_MII_UART (0x01)
987#define MCF_GPIO_PAR_FEC_PAR_FEC_MII_FEC (0x03)
988
989/* Bit definitions and macros for MCF_GPIO_PAR_PWM */
990#define MCF_GPIO_PAR_PWM_PAR_PWM1(x) (((x)&0x03)<<0)
991#define MCF_GPIO_PAR_PWM_PAR_PWM3(x) (((x)&0x03)<<2)
992#define MCF_GPIO_PAR_PWM_PAR_PWM5 (0x10)
993#define MCF_GPIO_PAR_PWM_PAR_PWM7 (0x20)
994
995/* Bit definitions and macros for MCF_GPIO_PAR_BUSCTL */
996#define MCF_GPIO_PAR_BUSCTL_PAR_TS(x) (((x)&0x03)<<3)
997#define MCF_GPIO_PAR_BUSCTL_PAR_RWB (0x20)
998#define MCF_GPIO_PAR_BUSCTL_PAR_TA (0x40)
999#define MCF_GPIO_PAR_BUSCTL_PAR_OE (0x80)
1000#define MCF_GPIO_PAR_BUSCTL_PAR_OE_GPIO (0x00)
1001#define MCF_GPIO_PAR_BUSCTL_PAR_OE_OE (0x80)
1002#define MCF_GPIO_PAR_BUSCTL_PAR_TA_GPIO (0x00)
1003#define MCF_GPIO_PAR_BUSCTL_PAR_TA_TA (0x40)
1004#define MCF_GPIO_PAR_BUSCTL_PAR_RWB_GPIO (0x00)
1005#define MCF_GPIO_PAR_BUSCTL_PAR_RWB_RWB (0x20)
1006#define MCF_GPIO_PAR_BUSCTL_PAR_TS_GPIO (0x00)
1007#define MCF_GPIO_PAR_BUSCTL_PAR_TS_DACK0 (0x10)
1008#define MCF_GPIO_PAR_BUSCTL_PAR_TS_TS (0x18)
1009
1010/* Bit definitions and macros for MCF_GPIO_PAR_FECI2C */
1011#define MCF_GPIO_PAR_FECI2C_PAR_SDA(x) (((x)&0x03)<<0)
1012#define MCF_GPIO_PAR_FECI2C_PAR_SCL(x) (((x)&0x03)<<2)
1013#define MCF_GPIO_PAR_FECI2C_PAR_MDIO(x) (((x)&0x03)<<4)
1014#define MCF_GPIO_PAR_FECI2C_PAR_MDC(x) (((x)&0x03)<<6)
1015#define MCF_GPIO_PAR_FECI2C_PAR_MDC_GPIO (0x00)
1016#define MCF_GPIO_PAR_FECI2C_PAR_MDC_UTXD2 (0x40)
1017#define MCF_GPIO_PAR_FECI2C_PAR_MDC_SCL (0x80)
1018#define MCF_GPIO_PAR_FECI2C_PAR_MDC_EMDC (0xC0)
1019#define MCF_GPIO_PAR_FECI2C_PAR_MDIO_GPIO (0x00)
1020#define MCF_GPIO_PAR_FECI2C_PAR_MDIO_URXD2 (0x10)
1021#define MCF_GPIO_PAR_FECI2C_PAR_MDIO_SDA (0x20)
1022#define MCF_GPIO_PAR_FECI2C_PAR_MDIO_EMDIO (0x30)
1023#define MCF_GPIO_PAR_FECI2C_PAR_SCL_GPIO (0x00)
1024#define MCF_GPIO_PAR_FECI2C_PAR_SCL_UTXD2 (0x04)
1025#define MCF_GPIO_PAR_FECI2C_PAR_SCL_SCL (0x0C)
1026#define MCF_GPIO_PAR_FECI2C_PAR_SDA_GPIO (0x00)
1027#define MCF_GPIO_PAR_FECI2C_PAR_SDA_URXD2 (0x02)
1028#define MCF_GPIO_PAR_FECI2C_PAR_SDA_SDA (0x03)
1029
1030/* Bit definitions and macros for MCF_GPIO_PAR_BE */
1031#define MCF_GPIO_PAR_BE_PAR_BE0 (0x01)
1032#define MCF_GPIO_PAR_BE_PAR_BE1 (0x02)
1033#define MCF_GPIO_PAR_BE_PAR_BE2 (0x04)
1034#define MCF_GPIO_PAR_BE_PAR_BE3 (0x08)
1035
1036/* Bit definitions and macros for MCF_GPIO_PAR_CS */
1037#define MCF_GPIO_PAR_CS_PAR_CS1 (0x02)
1038#define MCF_GPIO_PAR_CS_PAR_CS2 (0x04)
1039#define MCF_GPIO_PAR_CS_PAR_CS3 (0x08)
1040#define MCF_GPIO_PAR_CS_PAR_CS4 (0x10)
1041#define MCF_GPIO_PAR_CS_PAR_CS5 (0x20)
1042#define MCF_GPIO_PAR_CS_PAR_CS_CS1_GPIO (0x00)
1043#define MCF_GPIO_PAR_CS_PAR_CS_CS1_SDCS1 (0x01)
1044#define MCF_GPIO_PAR_CS_PAR_CS_CS1_CS1 (0x03)
1045
1046/* Bit definitions and macros for MCF_GPIO_PAR_SSI */
1047#define MCF_GPIO_PAR_SSI_PAR_MCLK (0x0080)
1048#define MCF_GPIO_PAR_SSI_PAR_TXD(x) (((x)&0x0003)<<8)
1049#define MCF_GPIO_PAR_SSI_PAR_RXD(x) (((x)&0x0003)<<10)
1050#define MCF_GPIO_PAR_SSI_PAR_FS(x) (((x)&0x0003)<<12)
1051#define MCF_GPIO_PAR_SSI_PAR_BCLK(x) (((x)&0x0003)<<14)
1052
1053/* Bit definitions and macros for MCF_GPIO_PAR_UART */
1054#define MCF_GPIO_PAR_UART_PAR_UTXD0 (0x0001)
1055#define MCF_GPIO_PAR_UART_PAR_URXD0 (0x0002)
1056#define MCF_GPIO_PAR_UART_PAR_URTS0 (0x0004)
1057#define MCF_GPIO_PAR_UART_PAR_UCTS0 (0x0008)
1058#define MCF_GPIO_PAR_UART_PAR_UTXD1(x) (((x)&0x0003)<<4)
1059#define MCF_GPIO_PAR_UART_PAR_URXD1(x) (((x)&0x0003)<<6)
1060#define MCF_GPIO_PAR_UART_PAR_URTS1(x) (((x)&0x0003)<<8)
1061#define MCF_GPIO_PAR_UART_PAR_UCTS1(x) (((x)&0x0003)<<10)
1062#define MCF_GPIO_PAR_UART_PAR_UCTS1_GPIO (0x0000)
1063#define MCF_GPIO_PAR_UART_PAR_UCTS1_SSI_BCLK (0x0800)
1064#define MCF_GPIO_PAR_UART_PAR_UCTS1_ULPI_D7 (0x0400)
1065#define MCF_GPIO_PAR_UART_PAR_UCTS1_UCTS1 (0x0C00)
1066#define MCF_GPIO_PAR_UART_PAR_URTS1_GPIO (0x0000)
1067#define MCF_GPIO_PAR_UART_PAR_URTS1_SSI_FS (0x0200)
1068#define MCF_GPIO_PAR_UART_PAR_URTS1_ULPI_D6 (0x0100)
1069#define MCF_GPIO_PAR_UART_PAR_URTS1_URTS1 (0x0300)
1070#define MCF_GPIO_PAR_UART_PAR_URXD1_GPIO (0x0000)
1071#define MCF_GPIO_PAR_UART_PAR_URXD1_SSI_RXD (0x0080)
1072#define MCF_GPIO_PAR_UART_PAR_URXD1_ULPI_D5 (0x0040)
1073#define MCF_GPIO_PAR_UART_PAR_URXD1_URXD1 (0x00C0)
1074#define MCF_GPIO_PAR_UART_PAR_UTXD1_GPIO (0x0000)
1075#define MCF_GPIO_PAR_UART_PAR_UTXD1_SSI_TXD (0x0020)
1076#define MCF_GPIO_PAR_UART_PAR_UTXD1_ULPI_D4 (0x0010)
1077#define MCF_GPIO_PAR_UART_PAR_UTXD1_UTXD1 (0x0030)
1078
1079/* Bit definitions and macros for MCF_GPIO_PAR_QSPI */
1080#define MCF_GPIO_PAR_QSPI_PAR_SCK(x) (((x)&0x0003)<<4)
1081#define MCF_GPIO_PAR_QSPI_PAR_DOUT(x) (((x)&0x0003)<<6)
1082#define MCF_GPIO_PAR_QSPI_PAR_DIN(x) (((x)&0x0003)<<8)
1083#define MCF_GPIO_PAR_QSPI_PAR_PCS0(x) (((x)&0x0003)<<10)
1084#define MCF_GPIO_PAR_QSPI_PAR_PCS1(x) (((x)&0x0003)<<12)
1085#define MCF_GPIO_PAR_QSPI_PAR_PCS2(x) (((x)&0x0003)<<14)
1086
1087/* Bit definitions and macros for MCF_GPIO_PAR_TIMER */
1088#define MCF_GPIO_PAR_TIMER_PAR_TIN0(x) (((x)&0x03)<<0)
1089#define MCF_GPIO_PAR_TIMER_PAR_TIN1(x) (((x)&0x03)<<2)
1090#define MCF_GPIO_PAR_TIMER_PAR_TIN2(x) (((x)&0x03)<<4)
1091#define MCF_GPIO_PAR_TIMER_PAR_TIN3(x) (((x)&0x03)<<6)
1092#define MCF_GPIO_PAR_TIMER_PAR_TIN3_GPIO (0x00)
1093#define MCF_GPIO_PAR_TIMER_PAR_TIN3_TOUT3 (0x80)
1094#define MCF_GPIO_PAR_TIMER_PAR_TIN3_URXD2 (0x40)
1095#define MCF_GPIO_PAR_TIMER_PAR_TIN3_TIN3 (0xC0)
1096#define MCF_GPIO_PAR_TIMER_PAR_TIN2_GPIO (0x00)
1097#define MCF_GPIO_PAR_TIMER_PAR_TIN2_TOUT2 (0x20)
1098#define MCF_GPIO_PAR_TIMER_PAR_TIN2_UTXD2 (0x10)
1099#define MCF_GPIO_PAR_TIMER_PAR_TIN2_TIN2 (0x30)
1100#define MCF_GPIO_PAR_TIMER_PAR_TIN1_GPIO (0x00)
1101#define MCF_GPIO_PAR_TIMER_PAR_TIN1_TOUT1 (0x08)
1102#define MCF_GPIO_PAR_TIMER_PAR_TIN1_DACK1 (0x04)
1103#define MCF_GPIO_PAR_TIMER_PAR_TIN1_TIN1 (0x0C)
1104#define MCF_GPIO_PAR_TIMER_PAR_TIN0_GPIO (0x00)
1105#define MCF_GPIO_PAR_TIMER_PAR_TIN0_TOUT0 (0x02)
1106#define MCF_GPIO_PAR_TIMER_PAR_TIN0_DREQ0 (0x01)
1107#define MCF_GPIO_PAR_TIMER_PAR_TIN0_TIN0 (0x03)
1108
1109/* Bit definitions and macros for MCF_GPIO_PAR_LCDDATA */
1110#define MCF_GPIO_PAR_LCDDATA_PAR_LD7_0(x) (((x)&0x03)<<0)
1111#define MCF_GPIO_PAR_LCDDATA_PAR_LD15_8(x) (((x)&0x03)<<2)
1112#define MCF_GPIO_PAR_LCDDATA_PAR_LD16(x) (((x)&0x03)<<4)
1113#define MCF_GPIO_PAR_LCDDATA_PAR_LD17(x) (((x)&0x03)<<6)
1114
1115/* Bit definitions and macros for MCF_GPIO_PAR_LCDCTL */
1116#define MCF_GPIO_PAR_LCDCTL_PAR_CLS (0x0001)
1117#define MCF_GPIO_PAR_LCDCTL_PAR_PS (0x0002)
1118#define MCF_GPIO_PAR_LCDCTL_PAR_REV (0x0004)
1119#define MCF_GPIO_PAR_LCDCTL_PAR_SPL_SPR (0x0008)
1120#define MCF_GPIO_PAR_LCDCTL_PAR_CONTRAST (0x0010)
1121#define MCF_GPIO_PAR_LCDCTL_PAR_LSCLK (0x0020)
1122#define MCF_GPIO_PAR_LCDCTL_PAR_LP_HSYNC (0x0040)
1123#define MCF_GPIO_PAR_LCDCTL_PAR_FLM_VSYNC (0x0080)
1124#define MCF_GPIO_PAR_LCDCTL_PAR_ACD_OE (0x0100)
1125
1126/* Bit definitions and macros for MCF_GPIO_PAR_IRQ */
1127#define MCF_GPIO_PAR_IRQ_PAR_IRQ1(x) (((x)&0x0003)<<4)
1128#define MCF_GPIO_PAR_IRQ_PAR_IRQ2(x) (((x)&0x0003)<<6)
1129#define MCF_GPIO_PAR_IRQ_PAR_IRQ4(x) (((x)&0x0003)<<8)
1130#define MCF_GPIO_PAR_IRQ_PAR_IRQ5(x) (((x)&0x0003)<<10)
1131#define MCF_GPIO_PAR_IRQ_PAR_IRQ6(x) (((x)&0x0003)<<12)
1132
1133/* Bit definitions and macros for MCF_GPIO_MSCR_FLEXBUS */
1134#define MCF_GPIO_MSCR_FLEXBUS_MSCR_ADDRCTL(x) (((x)&0x03)<<0)
1135#define MCF_GPIO_MSCR_FLEXBUS_MSCR_DLOWER(x) (((x)&0x03)<<2)
1136#define MCF_GPIO_MSCR_FLEXBUS_MSCR_DUPPER(x) (((x)&0x03)<<4)
1137
1138/* Bit definitions and macros for MCF_GPIO_MSCR_SDRAM */
1139#define MCF_GPIO_MSCR_SDRAM_MSCR_SDRAM(x) (((x)&0x03)<<0)
1140#define MCF_GPIO_MSCR_SDRAM_MSCR_SDCLK(x) (((x)&0x03)<<2)
1141#define MCF_GPIO_MSCR_SDRAM_MSCR_SDCLKB(x) (((x)&0x03)<<4)
1142
1143/* Bit definitions and macros for MCF_GPIO_DSCR_I2C */
1144#define MCF_GPIO_DSCR_I2C_I2C_DSE(x) (((x)&0x03)<<0)
1145
1146/* Bit definitions and macros for MCF_GPIO_DSCR_PWM */
1147#define MCF_GPIO_DSCR_PWM_PWM_DSE(x) (((x)&0x03)<<0)
1148
1149/* Bit definitions and macros for MCF_GPIO_DSCR_FEC */
1150#define MCF_GPIO_DSCR_FEC_FEC_DSE(x) (((x)&0x03)<<0)
1151
1152/* Bit definitions and macros for MCF_GPIO_DSCR_UART */
1153#define MCF_GPIO_DSCR_UART_UART0_DSE(x) (((x)&0x03)<<0)
1154#define MCF_GPIO_DSCR_UART_UART1_DSE(x) (((x)&0x03)<<2)
1155
1156/* Bit definitions and macros for MCF_GPIO_DSCR_QSPI */
1157#define MCF_GPIO_DSCR_QSPI_QSPI_DSE(x) (((x)&0x03)<<0)
1158
1159/* Bit definitions and macros for MCF_GPIO_DSCR_TIMER */
1160#define MCF_GPIO_DSCR_TIMER_TIMER_DSE(x) (((x)&0x03)<<0)
1161
1162/* Bit definitions and macros for MCF_GPIO_DSCR_SSI */
1163#define MCF_GPIO_DSCR_SSI_SSI_DSE(x) (((x)&0x03)<<0)
1164
1165/* Bit definitions and macros for MCF_GPIO_DSCR_LCD */
1166#define MCF_GPIO_DSCR_LCD_LCD_DSE(x) (((x)&0x03)<<0)
1167
1168/* Bit definitions and macros for MCF_GPIO_DSCR_DEBUG */
1169#define MCF_GPIO_DSCR_DEBUG_DEBUG_DSE(x) (((x)&0x03)<<0)
1170
1171/* Bit definitions and macros for MCF_GPIO_DSCR_CLKRST */
1172#define MCF_GPIO_DSCR_CLKRST_CLKRST_DSE(x) (((x)&0x03)<<0)
1173
1174/* Bit definitions and macros for MCF_GPIO_DSCR_IRQ */
1175#define MCF_GPIO_DSCR_IRQ_IRQ_DSE(x) (((x)&0x03)<<0)
1176
1177/*********************************************************************
1178 *
1179 * Interrupt Controller (INTC)
1180 *
1181 *********************************************************************/
1182
1183/* Register read/write macros */
1184#define MCF_INTC0_IPRH MCF_REG32(0xFC048000)
1185#define MCF_INTC0_IPRL MCF_REG32(0xFC048004)
1186#define MCF_INTC0_IMRH MCF_REG32(0xFC048008)
1187#define MCF_INTC0_IMRL MCF_REG32(0xFC04800C)
1188#define MCF_INTC0_INTFRCH MCF_REG32(0xFC048010)
1189#define MCF_INTC0_INTFRCL MCF_REG32(0xFC048014)
1190#define MCF_INTC0_ICONFIG MCF_REG16(0xFC04801A)
1191#define MCF_INTC0_SIMR MCF_REG08(0xFC04801C)
1192#define MCF_INTC0_CIMR MCF_REG08(0xFC04801D)
1193#define MCF_INTC0_CLMASK MCF_REG08(0xFC04801E)
1194#define MCF_INTC0_SLMASK MCF_REG08(0xFC04801F)
1195#define MCF_INTC0_ICR0 MCF_REG08(0xFC048040)
1196#define MCF_INTC0_ICR1 MCF_REG08(0xFC048041)
1197#define MCF_INTC0_ICR2 MCF_REG08(0xFC048042)
1198#define MCF_INTC0_ICR3 MCF_REG08(0xFC048043)
1199#define MCF_INTC0_ICR4 MCF_REG08(0xFC048044)
1200#define MCF_INTC0_ICR5 MCF_REG08(0xFC048045)
1201#define MCF_INTC0_ICR6 MCF_REG08(0xFC048046)
1202#define MCF_INTC0_ICR7 MCF_REG08(0xFC048047)
1203#define MCF_INTC0_ICR8 MCF_REG08(0xFC048048)
1204#define MCF_INTC0_ICR9 MCF_REG08(0xFC048049)
1205#define MCF_INTC0_ICR10 MCF_REG08(0xFC04804A)
1206#define MCF_INTC0_ICR11 MCF_REG08(0xFC04804B)
1207#define MCF_INTC0_ICR12 MCF_REG08(0xFC04804C)
1208#define MCF_INTC0_ICR13 MCF_REG08(0xFC04804D)
1209#define MCF_INTC0_ICR14 MCF_REG08(0xFC04804E)
1210#define MCF_INTC0_ICR15 MCF_REG08(0xFC04804F)
1211#define MCF_INTC0_ICR16 MCF_REG08(0xFC048050)
1212#define MCF_INTC0_ICR17 MCF_REG08(0xFC048051)
1213#define MCF_INTC0_ICR18 MCF_REG08(0xFC048052)
1214#define MCF_INTC0_ICR19 MCF_REG08(0xFC048053)
1215#define MCF_INTC0_ICR20 MCF_REG08(0xFC048054)
1216#define MCF_INTC0_ICR21 MCF_REG08(0xFC048055)
1217#define MCF_INTC0_ICR22 MCF_REG08(0xFC048056)
1218#define MCF_INTC0_ICR23 MCF_REG08(0xFC048057)
1219#define MCF_INTC0_ICR24 MCF_REG08(0xFC048058)
1220#define MCF_INTC0_ICR25 MCF_REG08(0xFC048059)
1221#define MCF_INTC0_ICR26 MCF_REG08(0xFC04805A)
1222#define MCF_INTC0_ICR27 MCF_REG08(0xFC04805B)
1223#define MCF_INTC0_ICR28 MCF_REG08(0xFC04805C)
1224#define MCF_INTC0_ICR29 MCF_REG08(0xFC04805D)
1225#define MCF_INTC0_ICR30 MCF_REG08(0xFC04805E)
1226#define MCF_INTC0_ICR31 MCF_REG08(0xFC04805F)
1227#define MCF_INTC0_ICR32 MCF_REG08(0xFC048060)
1228#define MCF_INTC0_ICR33 MCF_REG08(0xFC048061)
1229#define MCF_INTC0_ICR34 MCF_REG08(0xFC048062)
1230#define MCF_INTC0_ICR35 MCF_REG08(0xFC048063)
1231#define MCF_INTC0_ICR36 MCF_REG08(0xFC048064)
1232#define MCF_INTC0_ICR37 MCF_REG08(0xFC048065)
1233#define MCF_INTC0_ICR38 MCF_REG08(0xFC048066)
1234#define MCF_INTC0_ICR39 MCF_REG08(0xFC048067)
1235#define MCF_INTC0_ICR40 MCF_REG08(0xFC048068)
1236#define MCF_INTC0_ICR41 MCF_REG08(0xFC048069)
1237#define MCF_INTC0_ICR42 MCF_REG08(0xFC04806A)
1238#define MCF_INTC0_ICR43 MCF_REG08(0xFC04806B)
1239#define MCF_INTC0_ICR44 MCF_REG08(0xFC04806C)
1240#define MCF_INTC0_ICR45 MCF_REG08(0xFC04806D)
1241#define MCF_INTC0_ICR46 MCF_REG08(0xFC04806E)
1242#define MCF_INTC0_ICR47 MCF_REG08(0xFC04806F)
1243#define MCF_INTC0_ICR48 MCF_REG08(0xFC048070)
1244#define MCF_INTC0_ICR49 MCF_REG08(0xFC048071)
1245#define MCF_INTC0_ICR50 MCF_REG08(0xFC048072)
1246#define MCF_INTC0_ICR51 MCF_REG08(0xFC048073)
1247#define MCF_INTC0_ICR52 MCF_REG08(0xFC048074)
1248#define MCF_INTC0_ICR53 MCF_REG08(0xFC048075)
1249#define MCF_INTC0_ICR54 MCF_REG08(0xFC048076)
1250#define MCF_INTC0_ICR55 MCF_REG08(0xFC048077)
1251#define MCF_INTC0_ICR56 MCF_REG08(0xFC048078)
1252#define MCF_INTC0_ICR57 MCF_REG08(0xFC048079)
1253#define MCF_INTC0_ICR58 MCF_REG08(0xFC04807A)
1254#define MCF_INTC0_ICR59 MCF_REG08(0xFC04807B)
1255#define MCF_INTC0_ICR60 MCF_REG08(0xFC04807C)
1256#define MCF_INTC0_ICR61 MCF_REG08(0xFC04807D)
1257#define MCF_INTC0_ICR62 MCF_REG08(0xFC04807E)
1258#define MCF_INTC0_ICR63 MCF_REG08(0xFC04807F)
1259#define MCF_INTC0_ICR(x) MCF_REG08(0xFC048040+((x)*0x001))
1260#define MCF_INTC0_SWIACK MCF_REG08(0xFC0480E0)
1261#define MCF_INTC0_L1IACK MCF_REG08(0xFC0480E4)
1262#define MCF_INTC0_L2IACK MCF_REG08(0xFC0480E8)
1263#define MCF_INTC0_L3IACK MCF_REG08(0xFC0480EC)
1264#define MCF_INTC0_L4IACK MCF_REG08(0xFC0480F0)
1265#define MCF_INTC0_L5IACK MCF_REG08(0xFC0480F4)
1266#define MCF_INTC0_L6IACK MCF_REG08(0xFC0480F8)
1267#define MCF_INTC0_L7IACK MCF_REG08(0xFC0480FC)
1268#define MCF_INTC0_LIACK(x) MCF_REG08(0xFC0480E4+((x)*0x004))
1269#define MCF_INTC1_IPRH MCF_REG32(0xFC04C000)
1270#define MCF_INTC1_IPRL MCF_REG32(0xFC04C004)
1271#define MCF_INTC1_IMRH MCF_REG32(0xFC04C008)
1272#define MCF_INTC1_IMRL MCF_REG32(0xFC04C00C)
1273#define MCF_INTC1_INTFRCH MCF_REG32(0xFC04C010)
1274#define MCF_INTC1_INTFRCL MCF_REG32(0xFC04C014)
1275#define MCF_INTC1_ICONFIG MCF_REG16(0xFC04C01A)
1276#define MCF_INTC1_SIMR MCF_REG08(0xFC04C01C)
1277#define MCF_INTC1_CIMR MCF_REG08(0xFC04C01D)
1278#define MCF_INTC1_CLMASK MCF_REG08(0xFC04C01E)
1279#define MCF_INTC1_SLMASK MCF_REG08(0xFC04C01F)
1280#define MCF_INTC1_ICR0 MCF_REG08(0xFC04C040)
1281#define MCF_INTC1_ICR1 MCF_REG08(0xFC04C041)
1282#define MCF_INTC1_ICR2 MCF_REG08(0xFC04C042)
1283#define MCF_INTC1_ICR3 MCF_REG08(0xFC04C043)
1284#define MCF_INTC1_ICR4 MCF_REG08(0xFC04C044)
1285#define MCF_INTC1_ICR5 MCF_REG08(0xFC04C045)
1286#define MCF_INTC1_ICR6 MCF_REG08(0xFC04C046)
1287#define MCF_INTC1_ICR7 MCF_REG08(0xFC04C047)
1288#define MCF_INTC1_ICR8 MCF_REG08(0xFC04C048)
1289#define MCF_INTC1_ICR9 MCF_REG08(0xFC04C049)
1290#define MCF_INTC1_ICR10 MCF_REG08(0xFC04C04A)
1291#define MCF_INTC1_ICR11 MCF_REG08(0xFC04C04B)
1292#define MCF_INTC1_ICR12 MCF_REG08(0xFC04C04C)
1293#define MCF_INTC1_ICR13 MCF_REG08(0xFC04C04D)
1294#define MCF_INTC1_ICR14 MCF_REG08(0xFC04C04E)
1295#define MCF_INTC1_ICR15 MCF_REG08(0xFC04C04F)
1296#define MCF_INTC1_ICR16 MCF_REG08(0xFC04C050)
1297#define MCF_INTC1_ICR17 MCF_REG08(0xFC04C051)
1298#define MCF_INTC1_ICR18 MCF_REG08(0xFC04C052)
1299#define MCF_INTC1_ICR19 MCF_REG08(0xFC04C053)
1300#define MCF_INTC1_ICR20 MCF_REG08(0xFC04C054)
1301#define MCF_INTC1_ICR21 MCF_REG08(0xFC04C055)
1302#define MCF_INTC1_ICR22 MCF_REG08(0xFC04C056)
1303#define MCF_INTC1_ICR23 MCF_REG08(0xFC04C057)
1304#define MCF_INTC1_ICR24 MCF_REG08(0xFC04C058)
1305#define MCF_INTC1_ICR25 MCF_REG08(0xFC04C059)
1306#define MCF_INTC1_ICR26 MCF_REG08(0xFC04C05A)
1307#define MCF_INTC1_ICR27 MCF_REG08(0xFC04C05B)
1308#define MCF_INTC1_ICR28 MCF_REG08(0xFC04C05C)
1309#define MCF_INTC1_ICR29 MCF_REG08(0xFC04C05D)
1310#define MCF_INTC1_ICR30 MCF_REG08(0xFC04C05E)
1311#define MCF_INTC1_ICR31 MCF_REG08(0xFC04C05F)
1312#define MCF_INTC1_ICR32 MCF_REG08(0xFC04C060)
1313#define MCF_INTC1_ICR33 MCF_REG08(0xFC04C061)
1314#define MCF_INTC1_ICR34 MCF_REG08(0xFC04C062)
1315#define MCF_INTC1_ICR35 MCF_REG08(0xFC04C063)
1316#define MCF_INTC1_ICR36 MCF_REG08(0xFC04C064)
1317#define MCF_INTC1_ICR37 MCF_REG08(0xFC04C065)
1318#define MCF_INTC1_ICR38 MCF_REG08(0xFC04C066)
1319#define MCF_INTC1_ICR39 MCF_REG08(0xFC04C067)
1320#define MCF_INTC1_ICR40 MCF_REG08(0xFC04C068)
1321#define MCF_INTC1_ICR41 MCF_REG08(0xFC04C069)
1322#define MCF_INTC1_ICR42 MCF_REG08(0xFC04C06A)
1323#define MCF_INTC1_ICR43 MCF_REG08(0xFC04C06B)
1324#define MCF_INTC1_ICR44 MCF_REG08(0xFC04C06C)
1325#define MCF_INTC1_ICR45 MCF_REG08(0xFC04C06D)
1326#define MCF_INTC1_ICR46 MCF_REG08(0xFC04C06E)
1327#define MCF_INTC1_ICR47 MCF_REG08(0xFC04C06F)
1328#define MCF_INTC1_ICR48 MCF_REG08(0xFC04C070)
1329#define MCF_INTC1_ICR49 MCF_REG08(0xFC04C071)
1330#define MCF_INTC1_ICR50 MCF_REG08(0xFC04C072)
1331#define MCF_INTC1_ICR51 MCF_REG08(0xFC04C073)
1332#define MCF_INTC1_ICR52 MCF_REG08(0xFC04C074)
1333#define MCF_INTC1_ICR53 MCF_REG08(0xFC04C075)
1334#define MCF_INTC1_ICR54 MCF_REG08(0xFC04C076)
1335#define MCF_INTC1_ICR55 MCF_REG08(0xFC04C077)
1336#define MCF_INTC1_ICR56 MCF_REG08(0xFC04C078)
1337#define MCF_INTC1_ICR57 MCF_REG08(0xFC04C079)
1338#define MCF_INTC1_ICR58 MCF_REG08(0xFC04C07A)
1339#define MCF_INTC1_ICR59 MCF_REG08(0xFC04C07B)
1340#define MCF_INTC1_ICR60 MCF_REG08(0xFC04C07C)
1341#define MCF_INTC1_ICR61 MCF_REG08(0xFC04C07D)
1342#define MCF_INTC1_ICR62 MCF_REG08(0xFC04C07E)
1343#define MCF_INTC1_ICR63 MCF_REG08(0xFC04C07F)
1344#define MCF_INTC1_ICR(x) MCF_REG08(0xFC04C040+((x)*0x001))
1345#define MCF_INTC1_SWIACK MCF_REG08(0xFC04C0E0)
1346#define MCF_INTC1_L1IACK MCF_REG08(0xFC04C0E4)
1347#define MCF_INTC1_L2IACK MCF_REG08(0xFC04C0E8)
1348#define MCF_INTC1_L3IACK MCF_REG08(0xFC04C0EC)
1349#define MCF_INTC1_L4IACK MCF_REG08(0xFC04C0F0)
1350#define MCF_INTC1_L5IACK MCF_REG08(0xFC04C0F4)
1351#define MCF_INTC1_L6IACK MCF_REG08(0xFC04C0F8)
1352#define MCF_INTC1_L7IACK MCF_REG08(0xFC04C0FC)
1353#define MCF_INTC1_LIACK(x) MCF_REG08(0xFC04C0E4+((x)*0x004))
1354#define MCF_INTC_IPRH(x) MCF_REG32(0xFC048000+((x)*0x4000))
1355#define MCF_INTC_IPRL(x) MCF_REG32(0xFC048004+((x)*0x4000))
1356#define MCF_INTC_IMRH(x) MCF_REG32(0xFC048008+((x)*0x4000))
1357#define MCF_INTC_IMRL(x) MCF_REG32(0xFC04800C+((x)*0x4000))
1358#define MCF_INTC_INTFRCH(x) MCF_REG32(0xFC048010+((x)*0x4000))
1359#define MCF_INTC_INTFRCL(x) MCF_REG32(0xFC048014+((x)*0x4000))
1360#define MCF_INTC_ICONFIG(x) MCF_REG16(0xFC04801A+((x)*0x4000))
1361#define MCF_INTC_SIMR(x) MCF_REG08(0xFC04801C+((x)*0x4000))
1362#define MCF_INTC_CIMR(x) MCF_REG08(0xFC04801D+((x)*0x4000))
1363#define MCF_INTC_CLMASK(x) MCF_REG08(0xFC04801E+((x)*0x4000))
1364#define MCF_INTC_SLMASK(x) MCF_REG08(0xFC04801F+((x)*0x4000))
1365#define MCF_INTC_ICR0(x) MCF_REG08(0xFC048040+((x)*0x4000))
1366#define MCF_INTC_ICR1(x) MCF_REG08(0xFC048041+((x)*0x4000))
1367#define MCF_INTC_ICR2(x) MCF_REG08(0xFC048042+((x)*0x4000))
1368#define MCF_INTC_ICR3(x) MCF_REG08(0xFC048043+((x)*0x4000))
1369#define MCF_INTC_ICR4(x) MCF_REG08(0xFC048044+((x)*0x4000))
1370#define MCF_INTC_ICR5(x) MCF_REG08(0xFC048045+((x)*0x4000))
1371#define MCF_INTC_ICR6(x) MCF_REG08(0xFC048046+((x)*0x4000))
1372#define MCF_INTC_ICR7(x) MCF_REG08(0xFC048047+((x)*0x4000))
1373#define MCF_INTC_ICR8(x) MCF_REG08(0xFC048048+((x)*0x4000))
1374#define MCF_INTC_ICR9(x) MCF_REG08(0xFC048049+((x)*0x4000))
1375#define MCF_INTC_ICR10(x) MCF_REG08(0xFC04804A+((x)*0x4000))
1376#define MCF_INTC_ICR11(x) MCF_REG08(0xFC04804B+((x)*0x4000))
1377#define MCF_INTC_ICR12(x) MCF_REG08(0xFC04804C+((x)*0x4000))
1378#define MCF_INTC_ICR13(x) MCF_REG08(0xFC04804D+((x)*0x4000))
1379#define MCF_INTC_ICR14(x) MCF_REG08(0xFC04804E+((x)*0x4000))
1380#define MCF_INTC_ICR15(x) MCF_REG08(0xFC04804F+((x)*0x4000))
1381#define MCF_INTC_ICR16(x) MCF_REG08(0xFC048050+((x)*0x4000))
1382#define MCF_INTC_ICR17(x) MCF_REG08(0xFC048051+((x)*0x4000))
1383#define MCF_INTC_ICR18(x) MCF_REG08(0xFC048052+((x)*0x4000))
1384#define MCF_INTC_ICR19(x) MCF_REG08(0xFC048053+((x)*0x4000))
1385#define MCF_INTC_ICR20(x) MCF_REG08(0xFC048054+((x)*0x4000))
1386#define MCF_INTC_ICR21(x) MCF_REG08(0xFC048055+((x)*0x4000))
1387#define MCF_INTC_ICR22(x) MCF_REG08(0xFC048056+((x)*0x4000))
1388#define MCF_INTC_ICR23(x) MCF_REG08(0xFC048057+((x)*0x4000))
1389#define MCF_INTC_ICR24(x) MCF_REG08(0xFC048058+((x)*0x4000))
1390#define MCF_INTC_ICR25(x) MCF_REG08(0xFC048059+((x)*0x4000))
1391#define MCF_INTC_ICR26(x) MCF_REG08(0xFC04805A+((x)*0x4000))
1392#define MCF_INTC_ICR27(x) MCF_REG08(0xFC04805B+((x)*0x4000))
1393#define MCF_INTC_ICR28(x) MCF_REG08(0xFC04805C+((x)*0x4000))
1394#define MCF_INTC_ICR29(x) MCF_REG08(0xFC04805D+((x)*0x4000))
1395#define MCF_INTC_ICR30(x) MCF_REG08(0xFC04805E+((x)*0x4000))
1396#define MCF_INTC_ICR31(x) MCF_REG08(0xFC04805F+((x)*0x4000))
1397#define MCF_INTC_ICR32(x) MCF_REG08(0xFC048060+((x)*0x4000))
1398#define MCF_INTC_ICR33(x) MCF_REG08(0xFC048061+((x)*0x4000))
1399#define MCF_INTC_ICR34(x) MCF_REG08(0xFC048062+((x)*0x4000))
1400#define MCF_INTC_ICR35(x) MCF_REG08(0xFC048063+((x)*0x4000))
1401#define MCF_INTC_ICR36(x) MCF_REG08(0xFC048064+((x)*0x4000))
1402#define MCF_INTC_ICR37(x) MCF_REG08(0xFC048065+((x)*0x4000))
1403#define MCF_INTC_ICR38(x) MCF_REG08(0xFC048066+((x)*0x4000))
1404#define MCF_INTC_ICR39(x) MCF_REG08(0xFC048067+((x)*0x4000))
1405#define MCF_INTC_ICR40(x) MCF_REG08(0xFC048068+((x)*0x4000))
1406#define MCF_INTC_ICR41(x) MCF_REG08(0xFC048069+((x)*0x4000))
1407#define MCF_INTC_ICR42(x) MCF_REG08(0xFC04806A+((x)*0x4000))
1408#define MCF_INTC_ICR43(x) MCF_REG08(0xFC04806B+((x)*0x4000))
1409#define MCF_INTC_ICR44(x) MCF_REG08(0xFC04806C+((x)*0x4000))
1410#define MCF_INTC_ICR45(x) MCF_REG08(0xFC04806D+((x)*0x4000))
1411#define MCF_INTC_ICR46(x) MCF_REG08(0xFC04806E+((x)*0x4000))
1412#define MCF_INTC_ICR47(x) MCF_REG08(0xFC04806F+((x)*0x4000))
1413#define MCF_INTC_ICR48(x) MCF_REG08(0xFC048070+((x)*0x4000))
1414#define MCF_INTC_ICR49(x) MCF_REG08(0xFC048071+((x)*0x4000))
1415#define MCF_INTC_ICR50(x) MCF_REG08(0xFC048072+((x)*0x4000))
1416#define MCF_INTC_ICR51(x) MCF_REG08(0xFC048073+((x)*0x4000))
1417#define MCF_INTC_ICR52(x) MCF_REG08(0xFC048074+((x)*0x4000))
1418#define MCF_INTC_ICR53(x) MCF_REG08(0xFC048075+((x)*0x4000))
1419#define MCF_INTC_ICR54(x) MCF_REG08(0xFC048076+((x)*0x4000))
1420#define MCF_INTC_ICR55(x) MCF_REG08(0xFC048077+((x)*0x4000))
1421#define MCF_INTC_ICR56(x) MCF_REG08(0xFC048078+((x)*0x4000))
1422#define MCF_INTC_ICR57(x) MCF_REG08(0xFC048079+((x)*0x4000))
1423#define MCF_INTC_ICR58(x) MCF_REG08(0xFC04807A+((x)*0x4000))
1424#define MCF_INTC_ICR59(x) MCF_REG08(0xFC04807B+((x)*0x4000))
1425#define MCF_INTC_ICR60(x) MCF_REG08(0xFC04807C+((x)*0x4000))
1426#define MCF_INTC_ICR61(x) MCF_REG08(0xFC04807D+((x)*0x4000))
1427#define MCF_INTC_ICR62(x) MCF_REG08(0xFC04807E+((x)*0x4000))
1428#define MCF_INTC_ICR63(x) MCF_REG08(0xFC04807F+((x)*0x4000))
1429#define MCF_INTC_SWIACK(x) MCF_REG08(0xFC0480E0+((x)*0x4000))
1430#define MCF_INTC_L1IACK(x) MCF_REG08(0xFC0480E4+((x)*0x4000))
1431#define MCF_INTC_L2IACK(x) MCF_REG08(0xFC0480E8+((x)*0x4000))
1432#define MCF_INTC_L3IACK(x) MCF_REG08(0xFC0480EC+((x)*0x4000))
1433#define MCF_INTC_L4IACK(x) MCF_REG08(0xFC0480F0+((x)*0x4000))
1434#define MCF_INTC_L5IACK(x) MCF_REG08(0xFC0480F4+((x)*0x4000))
1435#define MCF_INTC_L6IACK(x) MCF_REG08(0xFC0480F8+((x)*0x4000))
1436#define MCF_INTC_L7IACK(x) MCF_REG08(0xFC0480FC+((x)*0x4000))
1437
1438/* Bit definitions and macros for MCF_INTC_IPRH */
1439#define MCF_INTC_IPRH_INT32 (0x00000001)
1440#define MCF_INTC_IPRH_INT33 (0x00000002)
1441#define MCF_INTC_IPRH_INT34 (0x00000004)
1442#define MCF_INTC_IPRH_INT35 (0x00000008)
1443#define MCF_INTC_IPRH_INT36 (0x00000010)
1444#define MCF_INTC_IPRH_INT37 (0x00000020)
1445#define MCF_INTC_IPRH_INT38 (0x00000040)
1446#define MCF_INTC_IPRH_INT39 (0x00000080)
1447#define MCF_INTC_IPRH_INT40 (0x00000100)
1448#define MCF_INTC_IPRH_INT41 (0x00000200)
1449#define MCF_INTC_IPRH_INT42 (0x00000400)
1450#define MCF_INTC_IPRH_INT43 (0x00000800)
1451#define MCF_INTC_IPRH_INT44 (0x00001000)
1452#define MCF_INTC_IPRH_INT45 (0x00002000)
1453#define MCF_INTC_IPRH_INT46 (0x00004000)
1454#define MCF_INTC_IPRH_INT47 (0x00008000)
1455#define MCF_INTC_IPRH_INT48 (0x00010000)
1456#define MCF_INTC_IPRH_INT49 (0x00020000)
1457#define MCF_INTC_IPRH_INT50 (0x00040000)
1458#define MCF_INTC_IPRH_INT51 (0x00080000)
1459#define MCF_INTC_IPRH_INT52 (0x00100000)
1460#define MCF_INTC_IPRH_INT53 (0x00200000)
1461#define MCF_INTC_IPRH_INT54 (0x00400000)
1462#define MCF_INTC_IPRH_INT55 (0x00800000)
1463#define MCF_INTC_IPRH_INT56 (0x01000000)
1464#define MCF_INTC_IPRH_INT57 (0x02000000)
1465#define MCF_INTC_IPRH_INT58 (0x04000000)
1466#define MCF_INTC_IPRH_INT59 (0x08000000)
1467#define MCF_INTC_IPRH_INT60 (0x10000000)
1468#define MCF_INTC_IPRH_INT61 (0x20000000)
1469#define MCF_INTC_IPRH_INT62 (0x40000000)
1470#define MCF_INTC_IPRH_INT63 (0x80000000)
1471
1472/* Bit definitions and macros for MCF_INTC_IPRL */
1473#define MCF_INTC_IPRL_INT0 (0x00000001)
1474#define MCF_INTC_IPRL_INT1 (0x00000002)
1475#define MCF_INTC_IPRL_INT2 (0x00000004)
1476#define MCF_INTC_IPRL_INT3 (0x00000008)
1477#define MCF_INTC_IPRL_INT4 (0x00000010)
1478#define MCF_INTC_IPRL_INT5 (0x00000020)
1479#define MCF_INTC_IPRL_INT6 (0x00000040)
1480#define MCF_INTC_IPRL_INT7 (0x00000080)
1481#define MCF_INTC_IPRL_INT8 (0x00000100)
1482#define MCF_INTC_IPRL_INT9 (0x00000200)
1483#define MCF_INTC_IPRL_INT10 (0x00000400)
1484#define MCF_INTC_IPRL_INT11 (0x00000800)
1485#define MCF_INTC_IPRL_INT12 (0x00001000)
1486#define MCF_INTC_IPRL_INT13 (0x00002000)
1487#define MCF_INTC_IPRL_INT14 (0x00004000)
1488#define MCF_INTC_IPRL_INT15 (0x00008000)
1489#define MCF_INTC_IPRL_INT16 (0x00010000)
1490#define MCF_INTC_IPRL_INT17 (0x00020000)
1491#define MCF_INTC_IPRL_INT18 (0x00040000)
1492#define MCF_INTC_IPRL_INT19 (0x00080000)
1493#define MCF_INTC_IPRL_INT20 (0x00100000)
1494#define MCF_INTC_IPRL_INT21 (0x00200000)
1495#define MCF_INTC_IPRL_INT22 (0x00400000)
1496#define MCF_INTC_IPRL_INT23 (0x00800000)
1497#define MCF_INTC_IPRL_INT24 (0x01000000)
1498#define MCF_INTC_IPRL_INT25 (0x02000000)
1499#define MCF_INTC_IPRL_INT26 (0x04000000)
1500#define MCF_INTC_IPRL_INT27 (0x08000000)
1501#define MCF_INTC_IPRL_INT28 (0x10000000)
1502#define MCF_INTC_IPRL_INT29 (0x20000000)
1503#define MCF_INTC_IPRL_INT30 (0x40000000)
1504#define MCF_INTC_IPRL_INT31 (0x80000000)
1505
1506/* Bit definitions and macros for MCF_INTC_IMRH */
1507#define MCF_INTC_IMRH_INT_MASK32 (0x00000001)
1508#define MCF_INTC_IMRH_INT_MASK33 (0x00000002)
1509#define MCF_INTC_IMRH_INT_MASK34 (0x00000004)
1510#define MCF_INTC_IMRH_INT_MASK35 (0x00000008)
1511#define MCF_INTC_IMRH_INT_MASK36 (0x00000010)
1512#define MCF_INTC_IMRH_INT_MASK37 (0x00000020)
1513#define MCF_INTC_IMRH_INT_MASK38 (0x00000040)
1514#define MCF_INTC_IMRH_INT_MASK39 (0x00000080)
1515#define MCF_INTC_IMRH_INT_MASK40 (0x00000100)
1516#define MCF_INTC_IMRH_INT_MASK41 (0x00000200)
1517#define MCF_INTC_IMRH_INT_MASK42 (0x00000400)
1518#define MCF_INTC_IMRH_INT_MASK43 (0x00000800)
1519#define MCF_INTC_IMRH_INT_MASK44 (0x00001000)
1520#define MCF_INTC_IMRH_INT_MASK45 (0x00002000)
1521#define MCF_INTC_IMRH_INT_MASK46 (0x00004000)
1522#define MCF_INTC_IMRH_INT_MASK47 (0x00008000)
1523#define MCF_INTC_IMRH_INT_MASK48 (0x00010000)
1524#define MCF_INTC_IMRH_INT_MASK49 (0x00020000)
1525#define MCF_INTC_IMRH_INT_MASK50 (0x00040000)
1526#define MCF_INTC_IMRH_INT_MASK51 (0x00080000)
1527#define MCF_INTC_IMRH_INT_MASK52 (0x00100000)
1528#define MCF_INTC_IMRH_INT_MASK53 (0x00200000)
1529#define MCF_INTC_IMRH_INT_MASK54 (0x00400000)
1530#define MCF_INTC_IMRH_INT_MASK55 (0x00800000)
1531#define MCF_INTC_IMRH_INT_MASK56 (0x01000000)
1532#define MCF_INTC_IMRH_INT_MASK57 (0x02000000)
1533#define MCF_INTC_IMRH_INT_MASK58 (0x04000000)
1534#define MCF_INTC_IMRH_INT_MASK59 (0x08000000)
1535#define MCF_INTC_IMRH_INT_MASK60 (0x10000000)
1536#define MCF_INTC_IMRH_INT_MASK61 (0x20000000)
1537#define MCF_INTC_IMRH_INT_MASK62 (0x40000000)
1538#define MCF_INTC_IMRH_INT_MASK63 (0x80000000)
1539
1540/* Bit definitions and macros for MCF_INTC_IMRL */
1541#define MCF_INTC_IMRL_INT_MASK0 (0x00000001)
1542#define MCF_INTC_IMRL_INT_MASK1 (0x00000002)
1543#define MCF_INTC_IMRL_INT_MASK2 (0x00000004)
1544#define MCF_INTC_IMRL_INT_MASK3 (0x00000008)
1545#define MCF_INTC_IMRL_INT_MASK4 (0x00000010)
1546#define MCF_INTC_IMRL_INT_MASK5 (0x00000020)
1547#define MCF_INTC_IMRL_INT_MASK6 (0x00000040)
1548#define MCF_INTC_IMRL_INT_MASK7 (0x00000080)
1549#define MCF_INTC_IMRL_INT_MASK8 (0x00000100)
1550#define MCF_INTC_IMRL_INT_MASK9 (0x00000200)
1551#define MCF_INTC_IMRL_INT_MASK10 (0x00000400)
1552#define MCF_INTC_IMRL_INT_MASK11 (0x00000800)
1553#define MCF_INTC_IMRL_INT_MASK12 (0x00001000)
1554#define MCF_INTC_IMRL_INT_MASK13 (0x00002000)
1555#define MCF_INTC_IMRL_INT_MASK14 (0x00004000)
1556#define MCF_INTC_IMRL_INT_MASK15 (0x00008000)
1557#define MCF_INTC_IMRL_INT_MASK16 (0x00010000)
1558#define MCF_INTC_IMRL_INT_MASK17 (0x00020000)
1559#define MCF_INTC_IMRL_INT_MASK18 (0x00040000)
1560#define MCF_INTC_IMRL_INT_MASK19 (0x00080000)
1561#define MCF_INTC_IMRL_INT_MASK20 (0x00100000)
1562#define MCF_INTC_IMRL_INT_MASK21 (0x00200000)
1563#define MCF_INTC_IMRL_INT_MASK22 (0x00400000)
1564#define MCF_INTC_IMRL_INT_MASK23 (0x00800000)
1565#define MCF_INTC_IMRL_INT_MASK24 (0x01000000)
1566#define MCF_INTC_IMRL_INT_MASK25 (0x02000000)
1567#define MCF_INTC_IMRL_INT_MASK26 (0x04000000)
1568#define MCF_INTC_IMRL_INT_MASK27 (0x08000000)
1569#define MCF_INTC_IMRL_INT_MASK28 (0x10000000)
1570#define MCF_INTC_IMRL_INT_MASK29 (0x20000000)
1571#define MCF_INTC_IMRL_INT_MASK30 (0x40000000)
1572#define MCF_INTC_IMRL_INT_MASK31 (0x80000000)
1573
1574/* Bit definitions and macros for MCF_INTC_INTFRCH */
1575#define MCF_INTC_INTFRCH_INTFRC32 (0x00000001)
1576#define MCF_INTC_INTFRCH_INTFRC33 (0x00000002)
1577#define MCF_INTC_INTFRCH_INTFRC34 (0x00000004)
1578#define MCF_INTC_INTFRCH_INTFRC35 (0x00000008)
1579#define MCF_INTC_INTFRCH_INTFRC36 (0x00000010)
1580#define MCF_INTC_INTFRCH_INTFRC37 (0x00000020)
1581#define MCF_INTC_INTFRCH_INTFRC38 (0x00000040)
1582#define MCF_INTC_INTFRCH_INTFRC39 (0x00000080)
1583#define MCF_INTC_INTFRCH_INTFRC40 (0x00000100)
1584#define MCF_INTC_INTFRCH_INTFRC41 (0x00000200)
1585#define MCF_INTC_INTFRCH_INTFRC42 (0x00000400)
1586#define MCF_INTC_INTFRCH_INTFRC43 (0x00000800)
1587#define MCF_INTC_INTFRCH_INTFRC44 (0x00001000)
1588#define MCF_INTC_INTFRCH_INTFRC45 (0x00002000)
1589#define MCF_INTC_INTFRCH_INTFRC46 (0x00004000)
1590#define MCF_INTC_INTFRCH_INTFRC47 (0x00008000)
1591#define MCF_INTC_INTFRCH_INTFRC48 (0x00010000)
1592#define MCF_INTC_INTFRCH_INTFRC49 (0x00020000)
1593#define MCF_INTC_INTFRCH_INTFRC50 (0x00040000)
1594#define MCF_INTC_INTFRCH_INTFRC51 (0x00080000)
1595#define MCF_INTC_INTFRCH_INTFRC52 (0x00100000)
1596#define MCF_INTC_INTFRCH_INTFRC53 (0x00200000)
1597#define MCF_INTC_INTFRCH_INTFRC54 (0x00400000)
1598#define MCF_INTC_INTFRCH_INTFRC55 (0x00800000)
1599#define MCF_INTC_INTFRCH_INTFRC56 (0x01000000)
1600#define MCF_INTC_INTFRCH_INTFRC57 (0x02000000)
1601#define MCF_INTC_INTFRCH_INTFRC58 (0x04000000)
1602#define MCF_INTC_INTFRCH_INTFRC59 (0x08000000)
1603#define MCF_INTC_INTFRCH_INTFRC60 (0x10000000)
1604#define MCF_INTC_INTFRCH_INTFRC61 (0x20000000)
1605#define MCF_INTC_INTFRCH_INTFRC62 (0x40000000)
1606#define MCF_INTC_INTFRCH_INTFRC63 (0x80000000)
1607
1608/* Bit definitions and macros for MCF_INTC_INTFRCL */
1609#define MCF_INTC_INTFRCL_INTFRC0 (0x00000001)
1610#define MCF_INTC_INTFRCL_INTFRC1 (0x00000002)
1611#define MCF_INTC_INTFRCL_INTFRC2 (0x00000004)
1612#define MCF_INTC_INTFRCL_INTFRC3 (0x00000008)
1613#define MCF_INTC_INTFRCL_INTFRC4 (0x00000010)
1614#define MCF_INTC_INTFRCL_INTFRC5 (0x00000020)
1615#define MCF_INTC_INTFRCL_INTFRC6 (0x00000040)
1616#define MCF_INTC_INTFRCL_INTFRC7 (0x00000080)
1617#define MCF_INTC_INTFRCL_INTFRC8 (0x00000100)
1618#define MCF_INTC_INTFRCL_INTFRC9 (0x00000200)
1619#define MCF_INTC_INTFRCL_INTFRC10 (0x00000400)
1620#define MCF_INTC_INTFRCL_INTFRC11 (0x00000800)
1621#define MCF_INTC_INTFRCL_INTFRC12 (0x00001000)
1622#define MCF_INTC_INTFRCL_INTFRC13 (0x00002000)
1623#define MCF_INTC_INTFRCL_INTFRC14 (0x00004000)
1624#define MCF_INTC_INTFRCL_INTFRC15 (0x00008000)
1625#define MCF_INTC_INTFRCL_INTFRC16 (0x00010000)
1626#define MCF_INTC_INTFRCL_INTFRC17 (0x00020000)
1627#define MCF_INTC_INTFRCL_INTFRC18 (0x00040000)
1628#define MCF_INTC_INTFRCL_INTFRC19 (0x00080000)
1629#define MCF_INTC_INTFRCL_INTFRC20 (0x00100000)
1630#define MCF_INTC_INTFRCL_INTFRC21 (0x00200000)
1631#define MCF_INTC_INTFRCL_INTFRC22 (0x00400000)
1632#define MCF_INTC_INTFRCL_INTFRC23 (0x00800000)
1633#define MCF_INTC_INTFRCL_INTFRC24 (0x01000000)
1634#define MCF_INTC_INTFRCL_INTFRC25 (0x02000000)
1635#define MCF_INTC_INTFRCL_INTFRC26 (0x04000000)
1636#define MCF_INTC_INTFRCL_INTFRC27 (0x08000000)
1637#define MCF_INTC_INTFRCL_INTFRC28 (0x10000000)
1638#define MCF_INTC_INTFRCL_INTFRC29 (0x20000000)
1639#define MCF_INTC_INTFRCL_INTFRC30 (0x40000000)
1640#define MCF_INTC_INTFRCL_INTFRC31 (0x80000000)
1641
1642/* Bit definitions and macros for MCF_INTC_ICONFIG */
1643#define MCF_INTC_ICONFIG_EMASK (0x0020)
1644#define MCF_INTC_ICONFIG_ELVLPRI1 (0x0200)
1645#define MCF_INTC_ICONFIG_ELVLPRI2 (0x0400)
1646#define MCF_INTC_ICONFIG_ELVLPRI3 (0x0800)
1647#define MCF_INTC_ICONFIG_ELVLPRI4 (0x1000)
1648#define MCF_INTC_ICONFIG_ELVLPRI5 (0x2000)
1649#define MCF_INTC_ICONFIG_ELVLPRI6 (0x4000)
1650#define MCF_INTC_ICONFIG_ELVLPRI7 (0x8000)
1651
1652/* Bit definitions and macros for MCF_INTC_SIMR */
1653#define MCF_INTC_SIMR_SIMR(x) (((x)&0x7F)<<0)
1654
1655/* Bit definitions and macros for MCF_INTC_CIMR */
1656#define MCF_INTC_CIMR_CIMR(x) (((x)&0x7F)<<0)
1657
1658/* Bit definitions and macros for MCF_INTC_CLMASK */
1659#define MCF_INTC_CLMASK_CLMASK(x) (((x)&0x0F)<<0)
1660
1661/* Bit definitions and macros for MCF_INTC_SLMASK */
1662#define MCF_INTC_SLMASK_SLMASK(x) (((x)&0x0F)<<0)
1663
1664/* Bit definitions and macros for MCF_INTC_ICR */
1665#define MCF_INTC_ICR_IL(x) (((x)&0x07)<<0)
1666
1667/* Bit definitions and macros for MCF_INTC_SWIACK */
1668#define MCF_INTC_SWIACK_VECTOR(x) (((x)&0xFF)<<0)
1669
1670/* Bit definitions and macros for MCF_INTC_LIACK */
1671#define MCF_INTC_LIACK_VECTOR(x) (((x)&0xFF)<<0)
1672
1673/********************************************************************/
1674/*********************************************************************
1675*
1676* LCD Controller (LCDC)
1677*
1678*********************************************************************/
1679
1680/* Register read/write macros */
1681#define MCF_LCDC_LSSAR MCF_REG32(0xFC0AC000)
1682#define MCF_LCDC_LSR MCF_REG32(0xFC0AC004)
1683#define MCF_LCDC_LVPWR MCF_REG32(0xFC0AC008)
1684#define MCF_LCDC_LCPR MCF_REG32(0xFC0AC00C)
1685#define MCF_LCDC_LCWHBR MCF_REG32(0xFC0AC010)
1686#define MCF_LCDC_LCCMR MCF_REG32(0xFC0AC014)
1687#define MCF_LCDC_LPCR MCF_REG32(0xFC0AC018)
1688#define MCF_LCDC_LHCR MCF_REG32(0xFC0AC01C)
1689#define MCF_LCDC_LVCR MCF_REG32(0xFC0AC020)
1690#define MCF_LCDC_LPOR MCF_REG32(0xFC0AC024)
1691#define MCF_LCDC_LSCR MCF_REG32(0xFC0AC028)
1692#define MCF_LCDC_LPCCR MCF_REG32(0xFC0AC02C)
1693#define MCF_LCDC_LDCR MCF_REG32(0xFC0AC030)
1694#define MCF_LCDC_LRMCR MCF_REG32(0xFC0AC034)
1695#define MCF_LCDC_LICR MCF_REG32(0xFC0AC038)
1696#define MCF_LCDC_LIER MCF_REG32(0xFC0AC03C)
1697#define MCF_LCDC_LISR MCF_REG32(0xFC0AC040)
1698#define MCF_LCDC_LGWSAR MCF_REG32(0xFC0AC050)
1699#define MCF_LCDC_LGWSR MCF_REG32(0xFC0AC054)
1700#define MCF_LCDC_LGWVPWR MCF_REG32(0xFC0AC058)
1701#define MCF_LCDC_LGWPOR MCF_REG32(0xFC0AC05C)
1702#define MCF_LCDC_LGWPR MCF_REG32(0xFC0AC060)
1703#define MCF_LCDC_LGWCR MCF_REG32(0xFC0AC064)
1704#define MCF_LCDC_LGWDCR MCF_REG32(0xFC0AC068)
1705#define MCF_LCDC_BPLUT_BASE MCF_REG32(0xFC0AC800)
1706#define MCF_LCDC_GWLUT_BASE MCF_REG32(0xFC0ACC00)
1707
1708/* Bit definitions and macros for MCF_LCDC_LSSAR */
1709#define MCF_LCDC_LSSAR_SSA(x) (((x)&0x3FFFFFFF)<<2)
1710
1711/* Bit definitions and macros for MCF_LCDC_LSR */
1712#define MCF_LCDC_LSR_YMAX(x) (((x)&0x000003FF)<<0)
1713#define MCF_LCDC_LSR_XMAX(x) (((x)&0x0000003F)<<20)
1714
1715/* Bit definitions and macros for MCF_LCDC_LVPWR */
1716#define MCF_LCDC_LVPWR_VPW(x) (((x)&0x000003FF)<<0)
1717
1718/* Bit definitions and macros for MCF_LCDC_LCPR */
1719#define MCF_LCDC_LCPR_CYP(x) (((x)&0x000003FF)<<0)
1720#define MCF_LCDC_LCPR_CXP(x) (((x)&0x000003FF)<<16)
1721#define MCF_LCDC_LCPR_OP (0x10000000)
1722#define MCF_LCDC_LCPR_CC(x) (((x)&0x00000003)<<30)
1723#define MCF_LCDC_LCPR_CC_TRANSPARENT (0x00000000)
1724#define MCF_LCDC_LCPR_CC_OR (0x40000000)
1725#define MCF_LCDC_LCPR_CC_XOR (0x80000000)
1726#define MCF_LCDC_LCPR_CC_AND (0xC0000000)
1727#define MCF_LCDC_LCPR_OP_ON (0x10000000)
1728#define MCF_LCDC_LCPR_OP_OFF (0x00000000)
1729
1730/* Bit definitions and macros for MCF_LCDC_LCWHBR */
1731#define MCF_LCDC_LCWHBR_BD(x) (((x)&0x000000FF)<<0)
1732#define MCF_LCDC_LCWHBR_CH(x) (((x)&0x0000001F)<<16)
1733#define MCF_LCDC_LCWHBR_CW(x) (((x)&0x0000001F)<<24)
1734#define MCF_LCDC_LCWHBR_BK_EN (0x80000000)
1735#define MCF_LCDC_LCWHBR_BK_EN_ON (0x80000000)
1736#define MCF_LCDC_LCWHBR_BK_EN_OFF (0x00000000)
1737
1738/* Bit definitions and macros for MCF_LCDC_LCCMR */
1739#define MCF_LCDC_LCCMR_CUR_COL_B(x) (((x)&0x0000003F)<<0)
1740#define MCF_LCDC_LCCMR_CUR_COL_G(x) (((x)&0x0000003F)<<6)
1741#define MCF_LCDC_LCCMR_CUR_COL_R(x) (((x)&0x0000003F)<<12)
1742
1743/* Bit definitions and macros for MCF_LCDC_LPCR */
1744#define MCF_LCDC_LPCR_PCD(x) (((x)&0x0000003F)<<0)
1745#define MCF_LCDC_LPCR_SHARP (0x00000040)
1746#define MCF_LCDC_LPCR_SCLKSEL (0x00000080)
1747#define MCF_LCDC_LPCR_ACD(x) (((x)&0x0000007F)<<8)
1748#define MCF_LCDC_LPCR_ACDSEL (0x00008000)
1749#define MCF_LCDC_LPCR_REV_VS (0x00010000)
1750#define MCF_LCDC_LPCR_SWAP_SEL (0x00020000)
1751#define MCF_LCDC_LPCR_ENDSEL (0x00040000)
1752#define MCF_LCDC_LPCR_SCLKIDLE (0x00080000)
1753#define MCF_LCDC_LPCR_OEPOL (0x00100000)
1754#define MCF_LCDC_LPCR_CLKPOL (0x00200000)
1755#define MCF_LCDC_LPCR_LPPOL (0x00400000)
1756#define MCF_LCDC_LPCR_FLM (0x00800000)
1757#define MCF_LCDC_LPCR_PIXPOL (0x01000000)
1758#define MCF_LCDC_LPCR_BPIX(x) (((x)&0x00000007)<<25)
1759#define MCF_LCDC_LPCR_PBSIZ(x) (((x)&0x00000003)<<28)
1760#define MCF_LCDC_LPCR_COLOR (0x40000000)
1761#define MCF_LCDC_LPCR_TFT (0x80000000)
1762#define MCF_LCDC_LPCR_MODE_MONOCGROME (0x00000000)
1763#define MCF_LCDC_LPCR_MODE_CSTN (0x40000000)
1764#define MCF_LCDC_LPCR_MODE_TFT (0xC0000000)
1765#define MCF_LCDC_LPCR_PBSIZ_1 (0x00000000)
1766#define MCF_LCDC_LPCR_PBSIZ_2 (0x10000000)
1767#define MCF_LCDC_LPCR_PBSIZ_4 (0x20000000)
1768#define MCF_LCDC_LPCR_PBSIZ_8 (0x30000000)
1769#define MCF_LCDC_LPCR_BPIX_1bpp (0x00000000)
1770#define MCF_LCDC_LPCR_BPIX_2bpp (0x02000000)
1771#define MCF_LCDC_LPCR_BPIX_4bpp (0x04000000)
1772#define MCF_LCDC_LPCR_BPIX_8bpp (0x06000000)
1773#define MCF_LCDC_LPCR_BPIX_12bpp (0x08000000)
1774#define MCF_LCDC_LPCR_BPIX_16bpp (0x0A000000)
1775#define MCF_LCDC_LPCR_BPIX_18bpp (0x0C000000)
1776
1777#define MCF_LCDC_LPCR_PANEL_TYPE(x) (((x)&0x00000003)<<30)
1778
1779/* Bit definitions and macros for MCF_LCDC_LHCR */
1780#define MCF_LCDC_LHCR_H_WAIT_2(x) (((x)&0x000000FF)<<0)
1781#define MCF_LCDC_LHCR_H_WAIT_1(x) (((x)&0x000000FF)<<8)
1782#define MCF_LCDC_LHCR_H_WIDTH(x) (((x)&0x0000003F)<<26)
1783
1784/* Bit definitions and macros for MCF_LCDC_LVCR */
1785#define MCF_LCDC_LVCR_V_WAIT_2(x) (((x)&0x000000FF)<<0)
1786#define MCF_LCDC_LVCR_V_WAIT_1(x) (((x)&0x000000FF)<<8)
1787#define MCF_LCDC_LVCR_V_WIDTH(x) (((x)&0x0000003F)<<26)
1788
1789/* Bit definitions and macros for MCF_LCDC_LPOR */
1790#define MCF_LCDC_LPOR_POS(x) (((x)&0x0000001F)<<0)
1791
1792/* Bit definitions and macros for MCF_LCDC_LPCCR */
1793#define MCF_LCDC_LPCCR_PW(x) (((x)&0x000000FF)<<0)
1794#define MCF_LCDC_LPCCR_CC_EN (0x00000100)
1795#define MCF_LCDC_LPCCR_SCR(x) (((x)&0x00000003)<<9)
1796#define MCF_LCDC_LPCCR_LDMSK (0x00008000)
1797#define MCF_LCDC_LPCCR_CLS_HI_WIDTH(x) (((x)&0x000001FF)<<16)
1798#define MCF_LCDC_LPCCR_SCR_LINEPULSE (0x00000000)
1799#define MCF_LCDC_LPCCR_SCR_PIXELCLK (0x00002000)
1800#define MCF_LCDC_LPCCR_SCR_LCDCLOCK (0x00004000)
1801
1802/* Bit definitions and macros for MCF_LCDC_LDCR */
1803#define MCF_LCDC_LDCR_TM(x) (((x)&0x0000001F)<<0)
1804#define MCF_LCDC_LDCR_HM(x) (((x)&0x0000001F)<<16)
1805#define MCF_LCDC_LDCR_BURST (0x80000000)
1806
1807/* Bit definitions and macros for MCF_LCDC_LRMCR */
1808#define MCF_LCDC_LRMCR_SEL_REF (0x00000001)
1809
1810/* Bit definitions and macros for MCF_LCDC_LICR */
1811#define MCF_LCDC_LICR_INTCON (0x00000001)
1812#define MCF_LCDC_LICR_INTSYN (0x00000004)
1813#define MCF_LCDC_LICR_GW_INT_CON (0x00000010)
1814
1815/* Bit definitions and macros for MCF_LCDC_LIER */
1816#define MCF_LCDC_LIER_BOF_EN (0x00000001)
1817#define MCF_LCDC_LIER_EOF_EN (0x00000002)
1818#define MCF_LCDC_LIER_ERR_RES_EN (0x00000004)
1819#define MCF_LCDC_LIER_UDR_ERR_EN (0x00000008)
1820#define MCF_LCDC_LIER_GW_BOF_EN (0x00000010)
1821#define MCF_LCDC_LIER_GW_EOF_EN (0x00000020)
1822#define MCF_LCDC_LIER_GW_ERR_RES_EN (0x00000040)
1823#define MCF_LCDC_LIER_GW_UDR_ERR_EN (0x00000080)
1824
1825/* Bit definitions and macros for MCF_LCDC_LISR */
1826#define MCF_LCDC_LISR_BOF (0x00000001)
1827#define MCF_LCDC_LISR_EOF (0x00000002)
1828#define MCF_LCDC_LISR_ERR_RES (0x00000004)
1829#define MCF_LCDC_LISR_UDR_ERR (0x00000008)
1830#define MCF_LCDC_LISR_GW_BOF (0x00000010)
1831#define MCF_LCDC_LISR_GW_EOF (0x00000020)
1832#define MCF_LCDC_LISR_GW_ERR_RES (0x00000040)
1833#define MCF_LCDC_LISR_GW_UDR_ERR (0x00000080)
1834
1835/* Bit definitions and macros for MCF_LCDC_LGWSAR */
1836#define MCF_LCDC_LGWSAR_GWSA(x) (((x)&0x3FFFFFFF)<<2)
1837
1838/* Bit definitions and macros for MCF_LCDC_LGWSR */
1839#define MCF_LCDC_LGWSR_GWH(x) (((x)&0x000003FF)<<0)
1840#define MCF_LCDC_LGWSR_GWW(x) (((x)&0x0000003F)<<20)
1841
1842/* Bit definitions and macros for MCF_LCDC_LGWVPWR */
1843#define MCF_LCDC_LGWVPWR_GWVPW(x) (((x)&0x000003FF)<<0)
1844
1845/* Bit definitions and macros for MCF_LCDC_LGWPOR */
1846#define MCF_LCDC_LGWPOR_GWPO(x) (((x)&0x0000001F)<<0)
1847
1848/* Bit definitions and macros for MCF_LCDC_LGWPR */
1849#define MCF_LCDC_LGWPR_GWYP(x) (((x)&0x000003FF)<<0)
1850#define MCF_LCDC_LGWPR_GWXP(x) (((x)&0x000003FF)<<16)
1851
1852/* Bit definitions and macros for MCF_LCDC_LGWCR */
1853#define MCF_LCDC_LGWCR_GWCKB(x) (((x)&0x0000003F)<<0)
1854#define MCF_LCDC_LGWCR_GWCKG(x) (((x)&0x0000003F)<<6)
1855#define MCF_LCDC_LGWCR_GWCKR(x) (((x)&0x0000003F)<<12)
1856#define MCF_LCDC_LGWCR_GW_RVS (0x00200000)
1857#define MCF_LCDC_LGWCR_GWE (0x00400000)
1858#define MCF_LCDC_LGWCR_GWCKE (0x00800000)
1859#define MCF_LCDC_LGWCR_GWAV(x) (((x)&0x000000FF)<<24)
1860
1861/* Bit definitions and macros for MCF_LCDC_LGWDCR */
1862#define MCF_LCDC_LGWDCR_GWTM(x) (((x)&0x0000001F)<<0)
1863#define MCF_LCDC_LGWDCR_GWHM(x) (((x)&0x0000001F)<<16)
1864#define MCF_LCDC_LGWDCR_GWBT (0x80000000)
1865
1866/* Bit definitions and macros for MCF_LCDC_LSCR */
1867#define MCF_LCDC_LSCR_PS_RISE_DELAY(x) (((x)&0x0000003F)<<26)
1868#define MCF_LCDC_LSCR_CLS_RISE_DELAY(x) (((x)&0x000000FF)<<16)
1869#define MCF_LCDC_LSCR_REV_TOGGLE_DELAY(x) (((x)&0x0000000F)<<8)
1870#define MCF_LCDC_LSCR_GRAY_2(x) (((x)&0x0000000F)<<4)
1871#define MCF_LCDC_LSCR_GRAY_1(x) (((x)&0x0000000F)<<0)
1872
1873/* Bit definitions and macros for MCF_LCDC_BPLUT_BASE */
1874#define MCF_LCDC_BPLUT_BASE_BASE(x) (((x)&0xFFFFFFFF)<<0)
1875
1876/* Bit definitions and macros for MCF_LCDC_GWLUT_BASE */
1877#define MCF_LCDC_GWLUT_BASE_BASE(x) (((x)&0xFFFFFFFF)<<0)
1878
1879/*********************************************************************
1880 *
1881 * Phase Locked Loop (PLL)
1882 *
1883 *********************************************************************/
1884
1885/* Register read/write macros */
1886#define MCF_PLL_PODR MCF_REG08(0xFC0C0000)
1887#define MCF_PLL_PLLCR MCF_REG08(0xFC0C0004)
1888#define MCF_PLL_PMDR MCF_REG08(0xFC0C0008)
1889#define MCF_PLL_PFDR MCF_REG08(0xFC0C000C)
1890
1891/* Bit definitions and macros for MCF_PLL_PODR */
1892#define MCF_PLL_PODR_BUSDIV(x) (((x)&0x0F)<<0)
1893#define MCF_PLL_PODR_CPUDIV(x) (((x)&0x0F)<<4)
1894
1895/* Bit definitions and macros for MCF_PLL_PLLCR */
1896#define MCF_PLL_PLLCR_DITHDEV(x) (((x)&0x07)<<0)
1897#define MCF_PLL_PLLCR_DITHEN (0x80)
1898
1899/* Bit definitions and macros for MCF_PLL_PMDR */
1900#define MCF_PLL_PMDR_MODDIV(x) (((x)&0xFF)<<0)
1901
1902/* Bit definitions and macros for MCF_PLL_PFDR */
1903#define MCF_PLL_PFDR_MFD(x) (((x)&0xFF)<<0)
1904
1905/*********************************************************************
1906 *
1907 * System Control Module Registers (SCM)
1908 *
1909 *********************************************************************/
1910
1911/* Register read/write macros */
1912#define MCF_SCM_MPR MCF_REG32(0xFC000000)
1913#define MCF_SCM_PACRA MCF_REG32(0xFC000020)
1914#define MCF_SCM_PACRB MCF_REG32(0xFC000024)
1915#define MCF_SCM_PACRC MCF_REG32(0xFC000028)
1916#define MCF_SCM_PACRD MCF_REG32(0xFC00002C)
1917#define MCF_SCM_PACRE MCF_REG32(0xFC000040)
1918#define MCF_SCM_PACRF MCF_REG32(0xFC000044)
1919
1920#define MCF_SCM_BCR MCF_REG32(0xFC040024)
1921
1922/*********************************************************************
1923 *
1924 * SDRAM Controller (SDRAMC)
1925 *
1926 *********************************************************************/
1927
1928/* Register read/write macros */
1929#define MCF_SDRAMC_SDMR MCF_REG32(0xFC0B8000)
1930#define MCF_SDRAMC_SDCR MCF_REG32(0xFC0B8004)
1931#define MCF_SDRAMC_SDCFG1 MCF_REG32(0xFC0B8008)
1932#define MCF_SDRAMC_SDCFG2 MCF_REG32(0xFC0B800C)
1933#define MCF_SDRAMC_LIMP_FIX MCF_REG32(0xFC0B8080)
1934#define MCF_SDRAMC_SDDS MCF_REG32(0xFC0B8100)
1935#define MCF_SDRAMC_SDCS0 MCF_REG32(0xFC0B8110)
1936#define MCF_SDRAMC_SDCS1 MCF_REG32(0xFC0B8114)
1937#define MCF_SDRAMC_SDCS2 MCF_REG32(0xFC0B8118)
1938#define MCF_SDRAMC_SDCS3 MCF_REG32(0xFC0B811C)
1939#define MCF_SDRAMC_SDCS(x) MCF_REG32(0xFC0B8110+((x)*0x004))
1940
1941/* Bit definitions and macros for MCF_SDRAMC_SDMR */
1942#define MCF_SDRAMC_SDMR_CMD (0x00010000)
1943#define MCF_SDRAMC_SDMR_AD(x) (((x)&0x00000FFF)<<18)
1944#define MCF_SDRAMC_SDMR_BNKAD(x) (((x)&0x00000003)<<30)
1945#define MCF_SDRAMC_SDMR_BNKAD_LMR (0x00000000)
1946#define MCF_SDRAMC_SDMR_BNKAD_LEMR (0x40000000)
1947
1948/* Bit definitions and macros for MCF_SDRAMC_SDCR */
1949#define MCF_SDRAMC_SDCR_IPALL (0x00000002)
1950#define MCF_SDRAMC_SDCR_IREF (0x00000004)
1951#define MCF_SDRAMC_SDCR_DQS_OE(x) (((x)&0x0000000F)<<8)
1952#define MCF_SDRAMC_SDCR_PS(x) (((x)&0x00000003)<<12)
1953#define MCF_SDRAMC_SDCR_RCNT(x) (((x)&0x0000003F)<<16)
1954#define MCF_SDRAMC_SDCR_OE_RULE (0x00400000)
1955#define MCF_SDRAMC_SDCR_MUX(x) (((x)&0x00000003)<<24)
1956#define MCF_SDRAMC_SDCR_REF (0x10000000)
1957#define MCF_SDRAMC_SDCR_DDR (0x20000000)
1958#define MCF_SDRAMC_SDCR_CKE (0x40000000)
1959#define MCF_SDRAMC_SDCR_MODE_EN (0x80000000)
1960#define MCF_SDRAMC_SDCR_PS_16 (0x00002000)
1961#define MCF_SDRAMC_SDCR_PS_32 (0x00000000)
1962
1963/* Bit definitions and macros for MCF_SDRAMC_SDCFG1 */
1964#define MCF_SDRAMC_SDCFG1_WTLAT(x) (((x)&0x00000007)<<4)
1965#define MCF_SDRAMC_SDCFG1_REF2ACT(x) (((x)&0x0000000F)<<8)
1966#define MCF_SDRAMC_SDCFG1_PRE2ACT(x) (((x)&0x00000007)<<12)
1967#define MCF_SDRAMC_SDCFG1_ACT2RW(x) (((x)&0x00000007)<<16)
1968#define MCF_SDRAMC_SDCFG1_RDLAT(x) (((x)&0x0000000F)<<20)
1969#define MCF_SDRAMC_SDCFG1_SWT2RD(x) (((x)&0x00000007)<<24)
1970#define MCF_SDRAMC_SDCFG1_SRD2RW(x) (((x)&0x0000000F)<<28)
1971
1972/* Bit definitions and macros for MCF_SDRAMC_SDCFG2 */
1973#define MCF_SDRAMC_SDCFG2_BL(x) (((x)&0x0000000F)<<16)
1974#define MCF_SDRAMC_SDCFG2_BRD2WT(x) (((x)&0x0000000F)<<20)
1975#define MCF_SDRAMC_SDCFG2_BWT2RW(x) (((x)&0x0000000F)<<24)
1976#define MCF_SDRAMC_SDCFG2_BRD2PRE(x) (((x)&0x0000000F)<<28)
1977
1978/* Device Errata - LIMP mode work around */
1979#define MCF_SDRAMC_REFRESH (0x40000000)
1980
1981/* Bit definitions and macros for MCF_SDRAMC_SDDS */
1982#define MCF_SDRAMC_SDDS_SB_D(x) (((x)&0x00000003)<<0)
1983#define MCF_SDRAMC_SDDS_SB_S(x) (((x)&0x00000003)<<2)
1984#define MCF_SDRAMC_SDDS_SB_A(x) (((x)&0x00000003)<<4)
1985#define MCF_SDRAMC_SDDS_SB_C(x) (((x)&0x00000003)<<6)
1986#define MCF_SDRAMC_SDDS_SB_E(x) (((x)&0x00000003)<<8)
1987
1988/* Bit definitions and macros for MCF_SDRAMC_SDCS */
1989#define MCF_SDRAMC_SDCS_CSSZ(x) (((x)&0x0000001F)<<0)
1990#define MCF_SDRAMC_SDCS_BASE(x) (((x)&0x00000FFF)<<20)
1991#define MCF_SDRAMC_SDCS_BA(x) ((x)&0xFFF00000)
1992#define MCF_SDRAMC_SDCS_CSSZ_DIABLE (0x00000000)
1993#define MCF_SDRAMC_SDCS_CSSZ_1MBYTE (0x00000013)
1994#define MCF_SDRAMC_SDCS_CSSZ_2MBYTE (0x00000014)
1995#define MCF_SDRAMC_SDCS_CSSZ_4MBYTE (0x00000015)
1996#define MCF_SDRAMC_SDCS_CSSZ_8MBYTE (0x00000016)
1997#define MCF_SDRAMC_SDCS_CSSZ_16MBYTE (0x00000017)
1998#define MCF_SDRAMC_SDCS_CSSZ_32MBYTE (0x00000018)
1999#define MCF_SDRAMC_SDCS_CSSZ_64MBYTE (0x00000019)
2000#define MCF_SDRAMC_SDCS_CSSZ_128MBYTE (0x0000001A)
2001#define MCF_SDRAMC_SDCS_CSSZ_256MBYTE (0x0000001B)
2002#define MCF_SDRAMC_SDCS_CSSZ_512MBYTE (0x0000001C)
2003#define MCF_SDRAMC_SDCS_CSSZ_1GBYTE (0x0000001D)
2004#define MCF_SDRAMC_SDCS_CSSZ_2GBYTE (0x0000001E)
2005#define MCF_SDRAMC_SDCS_CSSZ_4GBYTE (0x0000001F)
2006
2007/*********************************************************************
2008 *
2009 * FlexCAN module registers
2010 *
2011 *********************************************************************/
2012#define MCF_FLEXCAN_BASEADDR(x) (0xFC020000+(x)*0x0800)
2013#define MCF_FLEXCAN_CANMCR(x) MCF_REG32(0xFC020000+(x)*0x0800+0x00)
2014#define MCF_FLEXCAN_CANCTRL(x) MCF_REG32(0xFC020000+(x)*0x0800+0x04)
2015#define MCF_FLEXCAN_TIMER(x) MCF_REG32(0xFC020000+(x)*0x0800+0x08)
2016#define MCF_FLEXCAN_RXGMASK(x) MCF_REG32(0xFC020000+(x)*0x0800+0x10)
2017#define MCF_FLEXCAN_RX14MASK(x) MCF_REG32(0xFC020000+(x)*0x0800+0x14)
2018#define MCF_FLEXCAN_RX15MASK(x) MCF_REG32(0xFC020000+(x)*0x0800+0x18)
2019#define MCF_FLEXCAN_ERRCNT(x) MCF_REG32(0xFC020000+(x)*0x0800+0x1C)
2020#define MCF_FLEXCAN_ERRSTAT(x) MCF_REG32(0xFC020000+(x)*0x0800+0x20)
2021#define MCF_FLEXCAN_IMASK(x) MCF_REG32(0xFC020000+(x)*0x0800+0x28)
2022#define MCF_FLEXCAN_IFLAG(x) MCF_REG32(0xFC020000+(x)*0x0800+0x30)
2023
2024#define MCF_FLEXCAN_MB_CNT(x,y) MCF_REG32(0xFC020080+(x)*0x0800+(y)*0x10+0x0)
2025#define MCF_FLEXCAN_MB_ID(x,y) MCF_REG32(0xFC020080+(x)*0x0800+(y)*0x10+0x4)
2026#define MCF_FLEXCAN_MB_DB(x,y,z) MCF_REG08(0xFC020080+(x)*0x0800+(y)*0x10+0x8+(z)*0x1)
2027
2028/*
2029 * FlexCAN Module Configuration Register
2030 */
2031#define CANMCR_MDIS (0x80000000)
2032#define CANMCR_FRZ (0x40000000)
2033#define CANMCR_HALT (0x10000000)
2034#define CANMCR_SOFTRST (0x02000000)
2035#define CANMCR_FRZACK (0x01000000)
2036#define CANMCR_SUPV (0x00800000)
2037#define CANMCR_MAXMB(x) ((x)&0x0F)
2038
2039/*
2040 * FlexCAN Control Register
2041 */
2042#define CANCTRL_PRESDIV(x) (((x)&0xFF)<<24)
2043#define CANCTRL_RJW(x) (((x)&0x03)<<22)
2044#define CANCTRL_PSEG1(x) (((x)&0x07)<<19)
2045#define CANCTRL_PSEG2(x) (((x)&0x07)<<16)
2046#define CANCTRL_BOFFMSK (0x00008000)
2047#define CANCTRL_ERRMSK (0x00004000)
2048#define CANCTRL_CLKSRC (0x00002000)
2049#define CANCTRL_LPB (0x00001000)
2050#define CANCTRL_SAMP (0x00000080)
2051#define CANCTRL_BOFFREC (0x00000040)
2052#define CANCTRL_TSYNC (0x00000020)
2053#define CANCTRL_LBUF (0x00000010)
2054#define CANCTRL_LOM (0x00000008)
2055#define CANCTRL_PROPSEG(x) ((x)&0x07)
2056
2057/*
2058 * FlexCAN Error Counter Register
2059 */
2060#define ERRCNT_RXECTR(x) (((x)&0xFF)<<8)
2061#define ERRCNT_TXECTR(x) ((x)&0xFF)
2062
2063/*
2064 * FlexCAN Error and Status Register
2065 */
2066#define ERRSTAT_BITERR(x) (((x)&0x03)<<14)
2067#define ERRSTAT_ACKERR (0x00002000)
2068#define ERRSTAT_CRCERR (0x00001000)
2069#define ERRSTAT_FRMERR (0x00000800)
2070#define ERRSTAT_STFERR (0x00000400)
2071#define ERRSTAT_TXWRN (0x00000200)
2072#define ERRSTAT_RXWRN (0x00000100)
2073#define ERRSTAT_IDLE (0x00000080)
2074#define ERRSTAT_TXRX (0x00000040)
2075#define ERRSTAT_FLTCONF(x) (((x)&0x03)<<4)
2076#define ERRSTAT_BOFFINT (0x00000004)
2077#define ERRSTAT_ERRINT (0x00000002)
2078
2079/*
2080 * Interrupt Mask Register
2081 */
2082#define IMASK_BUF15M (0x8000)
2083#define IMASK_BUF14M (0x4000)
2084#define IMASK_BUF13M (0x2000)
2085#define IMASK_BUF12M (0x1000)
2086#define IMASK_BUF11M (0x0800)
2087#define IMASK_BUF10M (0x0400)
2088#define IMASK_BUF9M (0x0200)
2089#define IMASK_BUF8M (0x0100)
2090#define IMASK_BUF7M (0x0080)
2091#define IMASK_BUF6M (0x0040)
2092#define IMASK_BUF5M (0x0020)
2093#define IMASK_BUF4M (0x0010)
2094#define IMASK_BUF3M (0x0008)
2095#define IMASK_BUF2M (0x0004)
2096#define IMASK_BUF1M (0x0002)
2097#define IMASK_BUF0M (0x0001)
2098#define IMASK_BUFnM(x) (0x1<<(x))
2099#define IMASK_BUFF_ENABLE_ALL (0x1111)
2100#define IMASK_BUFF_DISABLE_ALL (0x0000)
2101
2102/*
2103 * Interrupt Flag Register
2104 */
2105#define IFLAG_BUF15M (0x8000)
2106#define IFLAG_BUF14M (0x4000)
2107#define IFLAG_BUF13M (0x2000)
2108#define IFLAG_BUF12M (0x1000)
2109#define IFLAG_BUF11M (0x0800)
2110#define IFLAG_BUF10M (0x0400)
2111#define IFLAG_BUF9M (0x0200)
2112#define IFLAG_BUF8M (0x0100)
2113#define IFLAG_BUF7M (0x0080)
2114#define IFLAG_BUF6M (0x0040)
2115#define IFLAG_BUF5M (0x0020)
2116#define IFLAG_BUF4M (0x0010)
2117#define IFLAG_BUF3M (0x0008)
2118#define IFLAG_BUF2M (0x0004)
2119#define IFLAG_BUF1M (0x0002)
2120#define IFLAG_BUF0M (0x0001)
2121#define IFLAG_BUFF_SET_ALL (0xFFFF)
2122#define IFLAG_BUFF_CLEAR_ALL (0x0000)
2123#define IFLAG_BUFnM(x) (0x1<<(x))
2124
2125/*
2126 * Message Buffers
2127 */
2128#define MB_CNT_CODE(x) (((x)&0x0F)<<24)
2129#define MB_CNT_SRR (0x00400000)
2130#define MB_CNT_IDE (0x00200000)
2131#define MB_CNT_RTR (0x00100000)
2132#define MB_CNT_LENGTH(x) (((x)&0x0F)<<16)
2133#define MB_CNT_TIMESTAMP(x) ((x)&0xFFFF)
2134#define MB_ID_STD(x) (((x)&0x07FF)<<18)
2135#define MB_ID_EXT(x) ((x)&0x3FFFF)
2136
2137/*********************************************************************
2138 *
2139 * Edge Port Module (EPORT)
2140 *
2141 *********************************************************************/
2142
2143/* Register read/write macros */
2144#define MCF_EPORT_EPPAR MCF_REG16(0xFC094000)
2145#define MCF_EPORT_EPDDR MCF_REG08(0xFC094002)
2146#define MCF_EPORT_EPIER MCF_REG08(0xFC094003)
2147#define MCF_EPORT_EPDR MCF_REG08(0xFC094004)
2148#define MCF_EPORT_EPPDR MCF_REG08(0xFC094005)
2149#define MCF_EPORT_EPFR MCF_REG08(0xFC094006)
2150
2151/* Bit definitions and macros for MCF_EPORT_EPPAR */
2152#define MCF_EPORT_EPPAR_EPPA1(x) (((x)&0x0003)<<2)
2153#define MCF_EPORT_EPPAR_EPPA2(x) (((x)&0x0003)<<4)
2154#define MCF_EPORT_EPPAR_EPPA3(x) (((x)&0x0003)<<6)
2155#define MCF_EPORT_EPPAR_EPPA4(x) (((x)&0x0003)<<8)
2156#define MCF_EPORT_EPPAR_EPPA5(x) (((x)&0x0003)<<10)
2157#define MCF_EPORT_EPPAR_EPPA6(x) (((x)&0x0003)<<12)
2158#define MCF_EPORT_EPPAR_EPPA7(x) (((x)&0x0003)<<14)
2159#define MCF_EPORT_EPPAR_LEVEL (0)
2160#define MCF_EPORT_EPPAR_RISING (1)
2161#define MCF_EPORT_EPPAR_FALLING (2)
2162#define MCF_EPORT_EPPAR_BOTH (3)
2163#define MCF_EPORT_EPPAR_EPPA7_LEVEL (0x0000)
2164#define MCF_EPORT_EPPAR_EPPA7_RISING (0x4000)
2165#define MCF_EPORT_EPPAR_EPPA7_FALLING (0x8000)
2166#define MCF_EPORT_EPPAR_EPPA7_BOTH (0xC000)
2167#define MCF_EPORT_EPPAR_EPPA6_LEVEL (0x0000)
2168#define MCF_EPORT_EPPAR_EPPA6_RISING (0x1000)
2169#define MCF_EPORT_EPPAR_EPPA6_FALLING (0x2000)
2170#define MCF_EPORT_EPPAR_EPPA6_BOTH (0x3000)
2171#define MCF_EPORT_EPPAR_EPPA5_LEVEL (0x0000)
2172#define MCF_EPORT_EPPAR_EPPA5_RISING (0x0400)
2173#define MCF_EPORT_EPPAR_EPPA5_FALLING (0x0800)
2174#define MCF_EPORT_EPPAR_EPPA5_BOTH (0x0C00)
2175#define MCF_EPORT_EPPAR_EPPA4_LEVEL (0x0000)
2176#define MCF_EPORT_EPPAR_EPPA4_RISING (0x0100)
2177#define MCF_EPORT_EPPAR_EPPA4_FALLING (0x0200)
2178#define MCF_EPORT_EPPAR_EPPA4_BOTH (0x0300)
2179#define MCF_EPORT_EPPAR_EPPA3_LEVEL (0x0000)
2180#define MCF_EPORT_EPPAR_EPPA3_RISING (0x0040)
2181#define MCF_EPORT_EPPAR_EPPA3_FALLING (0x0080)
2182#define MCF_EPORT_EPPAR_EPPA3_BOTH (0x00C0)
2183#define MCF_EPORT_EPPAR_EPPA2_LEVEL (0x0000)
2184#define MCF_EPORT_EPPAR_EPPA2_RISING (0x0010)
2185#define MCF_EPORT_EPPAR_EPPA2_FALLING (0x0020)
2186#define MCF_EPORT_EPPAR_EPPA2_BOTH (0x0030)
2187#define MCF_EPORT_EPPAR_EPPA1_LEVEL (0x0000)
2188#define MCF_EPORT_EPPAR_EPPA1_RISING (0x0004)
2189#define MCF_EPORT_EPPAR_EPPA1_FALLING (0x0008)
2190#define MCF_EPORT_EPPAR_EPPA1_BOTH (0x000C)
2191
2192/* Bit definitions and macros for MCF_EPORT_EPDDR */
2193#define MCF_EPORT_EPDDR_EPDD1 (0x02)
2194#define MCF_EPORT_EPDDR_EPDD2 (0x04)
2195#define MCF_EPORT_EPDDR_EPDD3 (0x08)
2196#define MCF_EPORT_EPDDR_EPDD4 (0x10)
2197#define MCF_EPORT_EPDDR_EPDD5 (0x20)
2198#define MCF_EPORT_EPDDR_EPDD6 (0x40)
2199#define MCF_EPORT_EPDDR_EPDD7 (0x80)
2200
2201/* Bit definitions and macros for MCF_EPORT_EPIER */
2202#define MCF_EPORT_EPIER_EPIE1 (0x02)
2203#define MCF_EPORT_EPIER_EPIE2 (0x04)
2204#define MCF_EPORT_EPIER_EPIE3 (0x08)
2205#define MCF_EPORT_EPIER_EPIE4 (0x10)
2206#define MCF_EPORT_EPIER_EPIE5 (0x20)
2207#define MCF_EPORT_EPIER_EPIE6 (0x40)
2208#define MCF_EPORT_EPIER_EPIE7 (0x80)
2209
2210/* Bit definitions and macros for MCF_EPORT_EPDR */
2211#define MCF_EPORT_EPDR_EPD1 (0x02)
2212#define MCF_EPORT_EPDR_EPD2 (0x04)
2213#define MCF_EPORT_EPDR_EPD3 (0x08)
2214#define MCF_EPORT_EPDR_EPD4 (0x10)
2215#define MCF_EPORT_EPDR_EPD5 (0x20)
2216#define MCF_EPORT_EPDR_EPD6 (0x40)
2217#define MCF_EPORT_EPDR_EPD7 (0x80)
2218
2219/* Bit definitions and macros for MCF_EPORT_EPPDR */
2220#define MCF_EPORT_EPPDR_EPPD1 (0x02)
2221#define MCF_EPORT_EPPDR_EPPD2 (0x04)
2222#define MCF_EPORT_EPPDR_EPPD3 (0x08)
2223#define MCF_EPORT_EPPDR_EPPD4 (0x10)
2224#define MCF_EPORT_EPPDR_EPPD5 (0x20)
2225#define MCF_EPORT_EPPDR_EPPD6 (0x40)
2226#define MCF_EPORT_EPPDR_EPPD7 (0x80)
2227
2228/* Bit definitions and macros for MCF_EPORT_EPFR */
2229#define MCF_EPORT_EPFR_EPF1 (0x02)
2230#define MCF_EPORT_EPFR_EPF2 (0x04)
2231#define MCF_EPORT_EPFR_EPF3 (0x08)
2232#define MCF_EPORT_EPFR_EPF4 (0x10)
2233#define MCF_EPORT_EPFR_EPF5 (0x20)
2234#define MCF_EPORT_EPFR_EPF6 (0x40)
2235#define MCF_EPORT_EPFR_EPF7 (0x80)
2236
2237/********************************************************************/
2238#endif /* m532xsim_h */
diff --git a/include/asm-m68knommu/mcfcache.h b/include/asm-m68knommu/mcfcache.h
index 45d1ac57ea82..7b61a8a529f5 100644
--- a/include/asm-m68knommu/mcfcache.h
+++ b/include/asm-m68knommu/mcfcache.h
@@ -92,6 +92,21 @@
92.endm 92.endm
93#endif /* CONFIG_M5249 || CONFIG_M5307 */ 93#endif /* CONFIG_M5249 || CONFIG_M5307 */
94 94
95#if defined(CONFIG_M532x)
96.macro CACHE_ENABLE
97 movel #0x01000000,%d0 /* invalidate cache cmd */
98 movec %d0,%CACR /* do invalidate cache */
99 nop
100 movel #0x4001C000,%d0 /* set SDRAM cached (write-thru) */
101 movec %d0,%ACR0
102 movel #0x00000000,%d0 /* no other regions cached */
103 movec %d0,%ACR1
104 movel #0x80000200,%d0 /* setup cache mask */
105 movec %d0,%CACR /* enable cache */
106 nop
107.endm
108#endif /* CONFIG_M532x */
109
95#if defined(CONFIG_M5407) 110#if defined(CONFIG_M5407)
96/* 111/*
97 * Version 4 cores have a true harvard style separate instruction 112 * Version 4 cores have a true harvard style separate instruction
diff --git a/include/asm-m68knommu/mcfpit.h b/include/asm-m68knommu/mcfpit.h
index 0d2672dd518a..f570cf64fd29 100644
--- a/include/asm-m68knommu/mcfpit.h
+++ b/include/asm-m68knommu/mcfpit.h
@@ -28,11 +28,9 @@
28/* 28/*
29 * Define the PIT timer register set addresses. 29 * Define the PIT timer register set addresses.
30 */ 30 */
31struct mcfpit { 31#define MCFPIT_PCSR 0x0 /* PIT control register */
32 unsigned short pcsr; /* PIT control and status */ 32#define MCFPIT_PMR 0x2 /* PIT modulus register */
33 unsigned short pmr; /* PIT modulus register */ 33#define MCFPIT_PCNTR 0x4 /* PIT count register */
34 unsigned short pcntr; /* PIT count register */
35} __attribute__((packed));
36 34
37/* 35/*
38 * Bit definitions for the PIT Control and Status register. 36 * Bit definitions for the PIT Control and Status register.
diff --git a/include/asm-m68knommu/mcfsim.h b/include/asm-m68knommu/mcfsim.h
index 97a0c2734a72..1074ae717f74 100644
--- a/include/asm-m68knommu/mcfsim.h
+++ b/include/asm-m68knommu/mcfsim.h
@@ -35,6 +35,8 @@
35#include <asm/m528xsim.h> 35#include <asm/m528xsim.h>
36#elif defined(CONFIG_M5307) 36#elif defined(CONFIG_M5307)
37#include <asm/m5307sim.h> 37#include <asm/m5307sim.h>
38#elif defined(CONFIG_M532x)
39#include <asm/m532xsim.h>
38#elif defined(CONFIG_M5407) 40#elif defined(CONFIG_M5407)
39#include <asm/m5407sim.h> 41#include <asm/m5407sim.h>
40#endif 42#endif
@@ -100,6 +102,7 @@
100#define MCFSIM_IMR_MASKALL 0x3ffe /* All intr sources */ 102#define MCFSIM_IMR_MASKALL 0x3ffe /* All intr sources */
101#endif 103#endif
102 104
105
103/* 106/*
104 * PIT interrupt settings, if not found in mXXXXsim.h file. 107 * PIT interrupt settings, if not found in mXXXXsim.h file.
105 */ 108 */
diff --git a/include/asm-m68knommu/mcftimer.h b/include/asm-m68knommu/mcftimer.h
index 68bf33ac10d1..6f4d796e03db 100644
--- a/include/asm-m68knommu/mcftimer.h
+++ b/include/asm-m68knommu/mcftimer.h
@@ -3,7 +3,7 @@
3/* 3/*
4 * mcftimer.h -- ColdFire internal TIMER support defines. 4 * mcftimer.h -- ColdFire internal TIMER support defines.
5 * 5 *
6 * (C) Copyright 1999-2002, Greg Ungerer (gerg@snapgear.com) 6 * (C) Copyright 1999-2006, Greg Ungerer <gerg@snapgear.com>
7 * (C) Copyright 2000, Lineo Inc. (www.lineo.com) 7 * (C) Copyright 2000, Lineo Inc. (www.lineo.com)
8 */ 8 */
9 9
@@ -27,6 +27,11 @@
27#elif defined(CONFIG_M5249) || defined(CONFIG_M5307) || defined(CONFIG_M5407) 27#elif defined(CONFIG_M5249) || defined(CONFIG_M5307) || defined(CONFIG_M5407)
28#define MCFTIMER_BASE1 0x140 /* Base address of TIMER1 */ 28#define MCFTIMER_BASE1 0x140 /* Base address of TIMER1 */
29#define MCFTIMER_BASE2 0x180 /* Base address of TIMER2 */ 29#define MCFTIMER_BASE2 0x180 /* Base address of TIMER2 */
30#elif defined(CONFIG_M532x)
31#define MCFTIMER_BASE1 0xfc070000 /* Base address of TIMER1 */
32#define MCFTIMER_BASE2 0xfc074000 /* Base address of TIMER2 */
33#define MCFTIMER_BASE3 0xfc078000 /* Base address of TIMER3 */
34#define MCFTIMER_BASE4 0xfc07c000 /* Base address of TIMER4 */
30#endif 35#endif
31 36
32 37
@@ -34,23 +39,14 @@
34 * Define the TIMER register set addresses. 39 * Define the TIMER register set addresses.
35 */ 40 */
36#define MCFTIMER_TMR 0x00 /* Timer Mode reg (r/w) */ 41#define MCFTIMER_TMR 0x00 /* Timer Mode reg (r/w) */
37#define MCFTIMER_TRR 0x02 /* Timer Reference (r/w) */ 42#define MCFTIMER_TRR 0x04 /* Timer Reference (r/w) */
38#define MCFTIMER_TCR 0x04 /* Timer Capture reg (r/w) */ 43#define MCFTIMER_TCR 0x08 /* Timer Capture reg (r/w) */
39#define MCFTIMER_TCN 0x06 /* Timer Counter reg (r/w) */ 44#define MCFTIMER_TCN 0x0C /* Timer Counter reg (r/w) */
45#if defined(CONFIG_M532x)
46#define MCFTIMER_TER 0x03 /* Timer Event reg (r/w) */
47#else
40#define MCFTIMER_TER 0x11 /* Timer Event reg (r/w) */ 48#define MCFTIMER_TER 0x11 /* Timer Event reg (r/w) */
41 49#endif
42struct mcftimer {
43 unsigned short tmr; /* Timer Mode reg (r/w) */
44 unsigned short reserved1;
45 unsigned short trr; /* Timer Reference (r/w) */
46 unsigned short reserved2;
47 unsigned short tcr; /* Timer Capture reg (r/w) */
48 unsigned short reserved3;
49 unsigned short tcn; /* Timer Counter reg (r/w) */
50 unsigned short reserved4;
51 unsigned char reserved5;
52 unsigned char ter; /* Timer Event reg (r/w) */
53} __attribute__((packed));
54 50
55/* 51/*
56 * Bit definitions for the Timer Mode Register (TMR). 52 * Bit definitions for the Timer Mode Register (TMR).
diff --git a/include/asm-m68knommu/mcfuart.h b/include/asm-m68knommu/mcfuart.h
index 8040e43786be..dc0146c5258b 100644
--- a/include/asm-m68knommu/mcfuart.h
+++ b/include/asm-m68knommu/mcfuart.h
@@ -44,6 +44,10 @@
44#define MCFUART_BASE1 0x60000 /* Base address of UART1 */ 44#define MCFUART_BASE1 0x60000 /* Base address of UART1 */
45#define MCFUART_BASE2 0x64000 /* Base address of UART2 */ 45#define MCFUART_BASE2 0x64000 /* Base address of UART2 */
46#define MCFUART_BASE3 0x68000 /* Base address of UART2 */ 46#define MCFUART_BASE3 0x68000 /* Base address of UART2 */
47#elif defined(CONFIG_M532x)
48#define MCFUART_BASE1 0xfc060000 /* Base address of UART1 */
49#define MCFUART_BASE2 0xfc064000 /* Base address of UART2 */
50#define MCFUART_BASE3 0xfc068000 /* Base address of UART3 */
47#endif 51#endif
48 52
49 53
diff --git a/include/asm-m68knommu/processor.h b/include/asm-m68knommu/processor.h
index 278b00bc60c5..0ee158e09abb 100644
--- a/include/asm-m68knommu/processor.h
+++ b/include/asm-m68knommu/processor.h
@@ -78,19 +78,31 @@ struct thread_struct {
78} 78}
79 79
80/* 80/*
81 * Coldfire stacks need to be re-aligned on trap exit, conventional
82 * 68k can handle this case cleanly.
83 */
84#if defined(CONFIG_COLDFIRE)
85#define reformat(_regs) do { (_regs)->format = 0x4; } while(0)
86#else
87#define reformat(_regs) do { } while (0)
88#endif
89
90/*
81 * Do necessary setup to start up a newly executed thread. 91 * Do necessary setup to start up a newly executed thread.
82 * 92 *
83 * pass the data segment into user programs if it exists, 93 * pass the data segment into user programs if it exists,
84 * it can't hurt anything as far as I can tell 94 * it can't hurt anything as far as I can tell
85 */ 95 */
86#define start_thread(_regs, _pc, _usp) \ 96#define start_thread(_regs, _pc, _usp) \
87do { \ 97do { \
88 set_fs(USER_DS); /* reads from user space */ \ 98 set_fs(USER_DS); /* reads from user space */ \
89 (_regs)->pc = (_pc); \ 99 (_regs)->pc = (_pc); \
90 if (current->mm) \ 100 ((struct switch_stack *)(_regs))[-1].a6 = 0; \
91 (_regs)->d5 = current->mm->start_data; \ 101 reformat(_regs); \
92 (_regs)->sr &= ~0x2000; \ 102 if (current->mm) \
93 wrusp(_usp); \ 103 (_regs)->d5 = current->mm->start_data; \
104 (_regs)->sr &= ~0x2000; \
105 wrusp(_usp); \
94} while(0) 106} while(0)
95 107
96/* Forward declaration, a strange C thing */ 108/* Forward declaration, a strange C thing */
diff --git a/include/asm-m68knommu/ptrace.h b/include/asm-m68knommu/ptrace.h
index f65bd90749e6..1e19c457de7d 100644
--- a/include/asm-m68knommu/ptrace.h
+++ b/include/asm-m68knommu/ptrace.h
@@ -70,7 +70,7 @@ struct switch_stack {
70/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ 70/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
71#define PTRACE_GETREGS 12 71#define PTRACE_GETREGS 12
72#define PTRACE_SETREGS 13 72#define PTRACE_SETREGS 13
73#ifdef COFNIG_FPU 73#ifdef CONFIG_FPU
74#define PTRACE_GETFPREGS 14 74#define PTRACE_GETFPREGS 14
75#define PTRACE_SETFPREGS 15 75#define PTRACE_SETFPREGS 15
76#endif 76#endif
diff --git a/include/asm-mips/compat.h b/include/asm-mips/compat.h
index 986511db54a6..900f472fdd2b 100644
--- a/include/asm-mips/compat.h
+++ b/include/asm-mips/compat.h
@@ -145,8 +145,5 @@ static inline void __user *compat_alloc_user_space(long len)
145 145
146 return (void __user *) (regs->regs[29] - len); 146 return (void __user *) (regs->regs[29] - len);
147} 147}
148#if defined (__MIPSEL__)
149#define __COMPAT_ENDIAN_SWAP__ 1
150#endif
151 148
152#endif /* _ASM_COMPAT_H */ 149#endif /* _ASM_COMPAT_H */
diff --git a/include/asm-mips/mach-au1x00/au1xxx_psc.h b/include/asm-mips/mach-au1x00/au1xxx_psc.h
index 5c3e2a38ce12..d7cbacdd21fe 100644
--- a/include/asm-mips/mach-au1x00/au1xxx_psc.h
+++ b/include/asm-mips/mach-au1x00/au1xxx_psc.h
@@ -39,7 +39,12 @@
39#define PSC0_BASE_ADDR 0xb1a00000 39#define PSC0_BASE_ADDR 0xb1a00000
40#define PSC1_BASE_ADDR 0xb1b00000 40#define PSC1_BASE_ADDR 0xb1b00000
41#define PSC2_BASE_ADDR 0xb0a00000 41#define PSC2_BASE_ADDR 0xb0a00000
42#define PSC3_BASE_ADDR 0xb0d00000 42#define PSC3_BASE_ADDR 0xb0b00000
43#endif
44
45#ifdef CONFIG_SOC_AU1200
46#define PSC0_BASE_ADDR 0xb1a00000
47#define PSC1_BASE_ADDR 0xb1b00000
43#endif 48#endif
44 49
45/* The PSC select and control registers are common to 50/* The PSC select and control registers are common to
@@ -227,6 +232,8 @@ typedef struct psc_i2s {
227#define PSC_I2SCFG_DD_DISABLE (1 << 27) 232#define PSC_I2SCFG_DD_DISABLE (1 << 27)
228#define PSC_I2SCFG_DE_ENABLE (1 << 26) 233#define PSC_I2SCFG_DE_ENABLE (1 << 26)
229#define PSC_I2SCFG_SET_WS(x) (((((x) / 2) - 1) & 0x7f) << 16) 234#define PSC_I2SCFG_SET_WS(x) (((((x) / 2) - 1) & 0x7f) << 16)
235#define PSC_I2SCFG_WS(n) ((n & 0xFF) << 16)
236#define PSC_I2SCFG_WS_MASK (PSC_I2SCFG_WS(0x3F))
230#define PSC_I2SCFG_WI (1 << 15) 237#define PSC_I2SCFG_WI (1 << 15)
231 238
232#define PSC_I2SCFG_DIV_MASK (3 << 13) 239#define PSC_I2SCFG_DIV_MASK (3 << 13)
diff --git a/include/asm-mips/mach-db1x00/db1x00.h b/include/asm-mips/mach-db1x00/db1x00.h
index 8fbb4b42a8b5..0f5f4c29f4e8 100644
--- a/include/asm-mips/mach-db1x00/db1x00.h
+++ b/include/asm-mips/mach-db1x00/db1x00.h
@@ -30,8 +30,20 @@
30 30
31 31
32#ifdef CONFIG_MIPS_DB1550 32#ifdef CONFIG_MIPS_DB1550
33
34#define DBDMA_AC97_TX_CHAN DSCR_CMD0_PSC1_TX
35#define DBDMA_AC97_RX_CHAN DSCR_CMD0_PSC1_RX
36#define DBDMA_I2S_TX_CHAN DSCR_CMD0_PSC3_TX
37#define DBDMA_I2S_RX_CHAN DSCR_CMD0_PSC3_RX
38
39#define SPI_PSC_BASE PSC0_BASE_ADDR
40#define AC97_PSC_BASE PSC1_BASE_ADDR
41#define SMBUS_PSC_BASE PSC2_BASE_ADDR
42#define I2S_PSC_BASE PSC3_BASE_ADDR
43
33#define BCSR_KSEG1_ADDR 0xAF000000 44#define BCSR_KSEG1_ADDR 0xAF000000
34#define NAND_PHYS_ADDR 0x20000000 45#define NAND_PHYS_ADDR 0x20000000
46
35#else 47#else
36#define BCSR_KSEG1_ADDR 0xAE000000 48#define BCSR_KSEG1_ADDR 0xAE000000
37#endif 49#endif
diff --git a/include/asm-mips/mach-generic/floppy.h b/include/asm-mips/mach-generic/floppy.h
index 682a5858f8d7..83cd69e30ec3 100644
--- a/include/asm-mips/mach-generic/floppy.h
+++ b/include/asm-mips/mach-generic/floppy.h
@@ -98,7 +98,7 @@ static inline void fd_disable_irq(void)
98static inline int fd_request_irq(void) 98static inline int fd_request_irq(void)
99{ 99{
100 return request_irq(FLOPPY_IRQ, floppy_interrupt, 100 return request_irq(FLOPPY_IRQ, floppy_interrupt,
101 SA_INTERRUPT | SA_SAMPLE_RANDOM, "floppy", NULL); 101 SA_INTERRUPT, "floppy", NULL);
102} 102}
103 103
104static inline void fd_free_irq(void) 104static inline void fd_free_irq(void)
diff --git a/include/asm-mips/mach-jazz/floppy.h b/include/asm-mips/mach-jazz/floppy.h
index c9dad99b1232..9413117915f4 100644
--- a/include/asm-mips/mach-jazz/floppy.h
+++ b/include/asm-mips/mach-jazz/floppy.h
@@ -90,7 +90,7 @@ static inline void fd_disable_irq(void)
90static inline int fd_request_irq(void) 90static inline int fd_request_irq(void)
91{ 91{
92 return request_irq(FLOPPY_IRQ, floppy_interrupt, 92 return request_irq(FLOPPY_IRQ, floppy_interrupt,
93 SA_INTERRUPT | SA_SAMPLE_RANDOM, "floppy", NULL); 93 SA_INTERRUPT, "floppy", NULL);
94} 94}
95 95
96static inline void fd_free_irq(void) 96static inline void fd_free_irq(void)
diff --git a/include/asm-mips/mmzone.h b/include/asm-mips/mmzone.h
index dc231c89bef9..f53ec54c92ff 100644
--- a/include/asm-mips/mmzone.h
+++ b/include/asm-mips/mmzone.h
@@ -10,7 +10,6 @@
10 10
11#ifdef CONFIG_DISCONTIGMEM 11#ifdef CONFIG_DISCONTIGMEM
12 12
13#define kvaddr_to_nid(kvaddr) pa_to_nid(__pa(kvaddr))
14#define pfn_to_nid(pfn) pa_to_nid((pfn) << PAGE_SHIFT) 13#define pfn_to_nid(pfn) pa_to_nid((pfn) << PAGE_SHIFT)
15 14
16#endif /* CONFIG_DISCONTIGMEM */ 15#endif /* CONFIG_DISCONTIGMEM */
diff --git a/include/asm-mips/vga.h b/include/asm-mips/vga.h
index 34755c0a6398..c1dd0b10bc27 100644
--- a/include/asm-mips/vga.h
+++ b/include/asm-mips/vga.h
@@ -13,7 +13,7 @@
13 * access the videoram directly without any black magic. 13 * access the videoram directly without any black magic.
14 */ 14 */
15 15
16#define VGA_MAP_MEM(x) (0xb0000000L + (unsigned long)(x)) 16#define VGA_MAP_MEM(x,s) (0xb0000000L + (unsigned long)(x))
17 17
18#define vga_readb(x) (*(x)) 18#define vga_readb(x) (*(x))
19#define vga_writeb(x,y) (*(y) = (x)) 19#define vga_writeb(x,y) (*(y) = (x))
diff --git a/include/asm-parisc/floppy.h b/include/asm-parisc/floppy.h
index ca3aed768cdc..458cdb2a7530 100644
--- a/include/asm-parisc/floppy.h
+++ b/include/asm-parisc/floppy.h
@@ -159,10 +159,8 @@ static int fd_request_irq(void)
159 return request_irq(FLOPPY_IRQ, floppy_hardint,SA_INTERRUPT, 159 return request_irq(FLOPPY_IRQ, floppy_hardint,SA_INTERRUPT,
160 "floppy", NULL); 160 "floppy", NULL);
161 else 161 else
162 return request_irq(FLOPPY_IRQ, floppy_interrupt, 162 return request_irq(FLOPPY_IRQ, floppy_interrupt, SA_INTERRUPT,
163 SA_INTERRUPT|SA_SAMPLE_RANDOM, 163 "floppy", NULL);
164 "floppy", NULL);
165
166} 164}
167 165
168static unsigned long dma_mem_alloc(unsigned long size) 166static unsigned long dma_mem_alloc(unsigned long size)
diff --git a/include/asm-parisc/mmzone.h b/include/asm-parisc/mmzone.h
index ceb9b73199d1..c87813662d4d 100644
--- a/include/asm-parisc/mmzone.h
+++ b/include/asm-parisc/mmzone.h
@@ -14,11 +14,6 @@ extern struct node_map_data node_data[];
14 14
15#define NODE_DATA(nid) (&node_data[nid].pg_data) 15#define NODE_DATA(nid) (&node_data[nid].pg_data)
16 16
17/*
18 * Given a kernel address, find the home node of the underlying memory.
19 */
20#define kvaddr_to_nid(kaddr) pfn_to_nid(__pa(kaddr) >> PAGE_SHIFT)
21
22#define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) 17#define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn)
23#define node_end_pfn(nid) \ 18#define node_end_pfn(nid) \
24({ \ 19({ \
diff --git a/include/asm-powerpc/backlight.h b/include/asm-powerpc/backlight.h
index 1ba1f27a0b63..a5e9e656e332 100644
--- a/include/asm-powerpc/backlight.h
+++ b/include/asm-powerpc/backlight.h
@@ -2,30 +2,30 @@
2 * Routines for handling backlight control on PowerBooks 2 * Routines for handling backlight control on PowerBooks
3 * 3 *
4 * For now, implementation resides in 4 * For now, implementation resides in
5 * arch/powerpc/platforms/powermac/pmac_support.c 5 * arch/powerpc/platforms/powermac/backlight.c
6 * 6 *
7 */ 7 */
8#ifndef __ASM_POWERPC_BACKLIGHT_H 8#ifndef __ASM_POWERPC_BACKLIGHT_H
9#define __ASM_POWERPC_BACKLIGHT_H 9#define __ASM_POWERPC_BACKLIGHT_H
10#ifdef __KERNEL__ 10#ifdef __KERNEL__
11 11
12/* Abstract values */ 12#include <linux/fb.h>
13#define BACKLIGHT_OFF 0 13#include <linux/mutex.h>
14#define BACKLIGHT_MIN 1
15#define BACKLIGHT_MAX 0xf
16 14
17struct backlight_controller { 15/* For locking instructions, see the implementation file */
18 int (*set_enable)(int enable, int level, void *data); 16extern struct backlight_device *pmac_backlight;
19 int (*set_level)(int level, void *data); 17extern struct mutex pmac_backlight_mutex;
20};
21 18
22extern void register_backlight_controller(struct backlight_controller *ctrler, void *data, char *type); 19extern void pmac_backlight_calc_curve(struct fb_info*);
23extern void unregister_backlight_controller(struct backlight_controller *ctrler, void *data); 20extern int pmac_backlight_curve_lookup(struct fb_info *info, int value);
24 21
25extern int set_backlight_enable(int enable); 22extern int pmac_has_backlight_type(const char *type);
26extern int get_backlight_enable(void); 23
27extern int set_backlight_level(int level); 24extern void pmac_backlight_key_up(void);
28extern int get_backlight_level(void); 25extern void pmac_backlight_key_down(void);
26
27extern int pmac_backlight_set_legacy_brightness(int brightness);
28extern int pmac_backlight_get_legacy_brightness(void);
29 29
30#endif /* __KERNEL__ */ 30#endif /* __KERNEL__ */
31#endif 31#endif
diff --git a/include/asm-powerpc/bitops.h b/include/asm-powerpc/bitops.h
index d1c2a4405660..76e2f08c3c83 100644
--- a/include/asm-powerpc/bitops.h
+++ b/include/asm-powerpc/bitops.h
@@ -288,8 +288,8 @@ static __inline__ int test_le_bit(unsigned long nr,
288#define __test_and_clear_le_bit(nr, addr) \ 288#define __test_and_clear_le_bit(nr, addr) \
289 __test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) 289 __test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
290 290
291#define find_first_zero_le_bit(addr, size) find_next_zero_le_bit((addr), (size), 0) 291#define find_first_zero_le_bit(addr, size) generic_find_next_zero_le_bit((addr), (size), 0)
292unsigned long find_next_zero_le_bit(const unsigned long *addr, 292unsigned long generic_find_next_zero_le_bit(const unsigned long *addr,
293 unsigned long size, unsigned long offset); 293 unsigned long size, unsigned long offset);
294 294
295/* Bitmap functions for the ext2 filesystem */ 295/* Bitmap functions for the ext2 filesystem */
@@ -309,7 +309,7 @@ unsigned long find_next_zero_le_bit(const unsigned long *addr,
309#define ext2_find_first_zero_bit(addr, size) \ 309#define ext2_find_first_zero_bit(addr, size) \
310 find_first_zero_le_bit((unsigned long*)addr, size) 310 find_first_zero_le_bit((unsigned long*)addr, size)
311#define ext2_find_next_zero_bit(addr, size, off) \ 311#define ext2_find_next_zero_bit(addr, size, off) \
312 find_next_zero_le_bit((unsigned long*)addr, size, off) 312 generic_find_next_zero_le_bit((unsigned long*)addr, size, off)
313 313
314/* Bitmap functions for the minix filesystem. */ 314/* Bitmap functions for the minix filesystem. */
315 315
diff --git a/include/asm-powerpc/cputable.h b/include/asm-powerpc/cputable.h
index f6265c2a0dd2..fab41c280aa1 100644
--- a/include/asm-powerpc/cputable.h
+++ b/include/asm-powerpc/cputable.h
@@ -24,6 +24,9 @@
24#define PPC_FEATURE_ICACHE_SNOOP 0x00002000 24#define PPC_FEATURE_ICACHE_SNOOP 0x00002000
25#define PPC_FEATURE_ARCH_2_05 0x00001000 25#define PPC_FEATURE_ARCH_2_05 0x00001000
26 26
27#define PPC_FEATURE_TRUE_LE 0x00000002
28#define PPC_FEATURE_PPC_LE 0x00000001
29
27#ifdef __KERNEL__ 30#ifdef __KERNEL__
28#ifndef __ASSEMBLY__ 31#ifndef __ASSEMBLY__
29 32
@@ -69,6 +72,13 @@ struct cpu_spec {
69 /* Processor specific oprofile operations */ 72 /* Processor specific oprofile operations */
70 enum powerpc_oprofile_type oprofile_type; 73 enum powerpc_oprofile_type oprofile_type;
71 74
75 /* Bit locations inside the mmcra change */
76 unsigned long oprofile_mmcra_sihv;
77 unsigned long oprofile_mmcra_sipr;
78
79 /* Bits to clear during an oprofile exception */
80 unsigned long oprofile_mmcra_clear;
81
72 /* Name of processor class, for the ELF AT_PLATFORM entry */ 82 /* Name of processor class, for the ELF AT_PLATFORM entry */
73 char *platform; 83 char *platform;
74}; 84};
@@ -104,6 +114,8 @@ extern void do_cpu_ftr_fixups(unsigned long offset);
104#define CPU_FTR_NO_BTIC ASM_CONST(0x0000000000040000) 114#define CPU_FTR_NO_BTIC ASM_CONST(0x0000000000040000)
105#define CPU_FTR_BIG_PHYS ASM_CONST(0x0000000000080000) 115#define CPU_FTR_BIG_PHYS ASM_CONST(0x0000000000080000)
106#define CPU_FTR_NODSISRALIGN ASM_CONST(0x0000000000100000) 116#define CPU_FTR_NODSISRALIGN ASM_CONST(0x0000000000100000)
117#define CPU_FTR_PPC_LE ASM_CONST(0x0000000000200000)
118#define CPU_FTR_REAL_LE ASM_CONST(0x0000000000400000)
107 119
108#ifdef __powerpc64__ 120#ifdef __powerpc64__
109/* Add the 64b processor unique features in the top half of the word */ 121/* Add the 64b processor unique features in the top half of the word */
@@ -117,7 +129,6 @@ extern void do_cpu_ftr_fixups(unsigned long offset);
117#define CPU_FTR_SMT ASM_CONST(0x0000010000000000) 129#define CPU_FTR_SMT ASM_CONST(0x0000010000000000)
118#define CPU_FTR_COHERENT_ICACHE ASM_CONST(0x0000020000000000) 130#define CPU_FTR_COHERENT_ICACHE ASM_CONST(0x0000020000000000)
119#define CPU_FTR_LOCKLESS_TLBIE ASM_CONST(0x0000040000000000) 131#define CPU_FTR_LOCKLESS_TLBIE ASM_CONST(0x0000040000000000)
120#define CPU_FTR_MMCRA_SIHV ASM_CONST(0x0000080000000000)
121#define CPU_FTR_CI_LARGE_PAGE ASM_CONST(0x0000100000000000) 132#define CPU_FTR_CI_LARGE_PAGE ASM_CONST(0x0000100000000000)
122#define CPU_FTR_PAUSE_ZERO ASM_CONST(0x0000200000000000) 133#define CPU_FTR_PAUSE_ZERO ASM_CONST(0x0000200000000000)
123#define CPU_FTR_PURR ASM_CONST(0x0000400000000000) 134#define CPU_FTR_PURR ASM_CONST(0x0000400000000000)
@@ -134,7 +145,6 @@ extern void do_cpu_ftr_fixups(unsigned long offset);
134#define CPU_FTR_SMT ASM_CONST(0x0) 145#define CPU_FTR_SMT ASM_CONST(0x0)
135#define CPU_FTR_COHERENT_ICACHE ASM_CONST(0x0) 146#define CPU_FTR_COHERENT_ICACHE ASM_CONST(0x0)
136#define CPU_FTR_LOCKLESS_TLBIE ASM_CONST(0x0) 147#define CPU_FTR_LOCKLESS_TLBIE ASM_CONST(0x0)
137#define CPU_FTR_MMCRA_SIHV ASM_CONST(0x0)
138#define CPU_FTR_CI_LARGE_PAGE ASM_CONST(0x0) 148#define CPU_FTR_CI_LARGE_PAGE ASM_CONST(0x0)
139#define CPU_FTR_PURR ASM_CONST(0x0) 149#define CPU_FTR_PURR ASM_CONST(0x0)
140#endif 150#endif
@@ -192,92 +202,95 @@ extern void do_cpu_ftr_fixups(unsigned long offset);
192#define CPU_FTRS_PPC601 (CPU_FTR_COMMON | CPU_FTR_601 | CPU_FTR_HPTE_TABLE) 202#define CPU_FTRS_PPC601 (CPU_FTR_COMMON | CPU_FTR_601 | CPU_FTR_HPTE_TABLE)
193#define CPU_FTRS_603 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 203#define CPU_FTRS_603 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
194 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | \ 204 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | \
195 CPU_FTR_MAYBE_CAN_NAP) 205 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_PPC_LE)
196#define CPU_FTRS_604 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 206#define CPU_FTRS_604 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
197 CPU_FTR_USE_TB | CPU_FTR_604_PERF_MON | CPU_FTR_HPTE_TABLE) 207 CPU_FTR_USE_TB | CPU_FTR_604_PERF_MON | CPU_FTR_HPTE_TABLE | \
208 CPU_FTR_PPC_LE)
198#define CPU_FTRS_740_NOTAU (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 209#define CPU_FTRS_740_NOTAU (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
199 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \ 210 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
200 CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP) 211 CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_PPC_LE)
201#define CPU_FTRS_740 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 212#define CPU_FTRS_740 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
202 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \ 213 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
203 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP) 214 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \
215 CPU_FTR_PPC_LE)
204#define CPU_FTRS_750 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 216#define CPU_FTRS_750 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
205 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \ 217 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
206 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP) 218 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \
219 CPU_FTR_PPC_LE)
207#define CPU_FTRS_750FX1 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 220#define CPU_FTRS_750FX1 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
208 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \ 221 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
209 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \ 222 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \
210 CPU_FTR_DUAL_PLL_750FX | CPU_FTR_NO_DPM) 223 CPU_FTR_DUAL_PLL_750FX | CPU_FTR_NO_DPM | CPU_FTR_PPC_LE)
211#define CPU_FTRS_750FX2 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 224#define CPU_FTRS_750FX2 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
212 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \ 225 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
213 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \ 226 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \
214 CPU_FTR_NO_DPM) 227 CPU_FTR_NO_DPM | CPU_FTR_PPC_LE)
215#define CPU_FTRS_750FX (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 228#define CPU_FTRS_750FX (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
216 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \ 229 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
217 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \ 230 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \
218 CPU_FTR_DUAL_PLL_750FX | CPU_FTR_HAS_HIGH_BATS) 231 CPU_FTR_DUAL_PLL_750FX | CPU_FTR_HAS_HIGH_BATS | CPU_FTR_PPC_LE)
219#define CPU_FTRS_750GX (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_MAYBE_CAN_DOZE | \ 232#define CPU_FTRS_750GX (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_MAYBE_CAN_DOZE | \
220 CPU_FTR_USE_TB | CPU_FTR_L2CR | CPU_FTR_TAU | \ 233 CPU_FTR_USE_TB | CPU_FTR_L2CR | CPU_FTR_TAU | \
221 CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \ 234 CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \
222 CPU_FTR_DUAL_PLL_750FX | CPU_FTR_HAS_HIGH_BATS) 235 CPU_FTR_DUAL_PLL_750FX | CPU_FTR_HAS_HIGH_BATS | CPU_FTR_PPC_LE)
223#define CPU_FTRS_7400_NOTAU (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 236#define CPU_FTRS_7400_NOTAU (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
224 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \ 237 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
225 CPU_FTR_ALTIVEC_COMP | CPU_FTR_HPTE_TABLE | \ 238 CPU_FTR_ALTIVEC_COMP | CPU_FTR_HPTE_TABLE | \
226 CPU_FTR_MAYBE_CAN_NAP) 239 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_PPC_LE)
227#define CPU_FTRS_7400 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 240#define CPU_FTRS_7400 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
228 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \ 241 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
229 CPU_FTR_TAU | CPU_FTR_ALTIVEC_COMP | CPU_FTR_HPTE_TABLE | \ 242 CPU_FTR_TAU | CPU_FTR_ALTIVEC_COMP | CPU_FTR_HPTE_TABLE | \
230 CPU_FTR_MAYBE_CAN_NAP) 243 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_PPC_LE)
231#define CPU_FTRS_7450_20 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 244#define CPU_FTRS_7450_20 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
232 CPU_FTR_USE_TB | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ 245 CPU_FTR_USE_TB | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
233 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ 246 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \
234 CPU_FTR_NEED_COHERENT) 247 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE)
235#define CPU_FTRS_7450_21 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 248#define CPU_FTRS_7450_21 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
236 CPU_FTR_USE_TB | \ 249 CPU_FTR_USE_TB | \
237 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ 250 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
238 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ 251 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \
239 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_L3_DISABLE_NAP | \ 252 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_L3_DISABLE_NAP | \
240 CPU_FTR_NEED_COHERENT) 253 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE)
241#define CPU_FTRS_7450_23 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 254#define CPU_FTRS_7450_23 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
242 CPU_FTR_USE_TB | \ 255 CPU_FTR_USE_TB | \
243 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ 256 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
244 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ 257 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \
245 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_NEED_COHERENT) 258 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE)
246#define CPU_FTRS_7455_1 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 259#define CPU_FTRS_7455_1 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
247 CPU_FTR_USE_TB | \ 260 CPU_FTR_USE_TB | \
248 CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | CPU_FTR_L3CR | \ 261 CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | CPU_FTR_L3CR | \
249 CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | CPU_FTR_HAS_HIGH_BATS | \ 262 CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | CPU_FTR_HAS_HIGH_BATS | \
250 CPU_FTR_NEED_COHERENT) 263 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE)
251#define CPU_FTRS_7455_20 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 264#define CPU_FTRS_7455_20 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
252 CPU_FTR_USE_TB | \ 265 CPU_FTR_USE_TB | \
253 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ 266 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
254 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ 267 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \
255 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_L3_DISABLE_NAP | \ 268 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_L3_DISABLE_NAP | \
256 CPU_FTR_NEED_COHERENT | CPU_FTR_HAS_HIGH_BATS) 269 CPU_FTR_NEED_COHERENT | CPU_FTR_HAS_HIGH_BATS | CPU_FTR_PPC_LE)
257#define CPU_FTRS_7455 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 270#define CPU_FTRS_7455 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
258 CPU_FTR_USE_TB | \ 271 CPU_FTR_USE_TB | \
259 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ 272 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
260 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ 273 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \
261 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \ 274 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \
262 CPU_FTR_NEED_COHERENT) 275 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE)
263#define CPU_FTRS_7447_10 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 276#define CPU_FTRS_7447_10 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
264 CPU_FTR_USE_TB | \ 277 CPU_FTR_USE_TB | \
265 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ 278 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
266 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ 279 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \
267 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \ 280 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \
268 CPU_FTR_NEED_COHERENT | CPU_FTR_NO_BTIC) 281 CPU_FTR_NEED_COHERENT | CPU_FTR_NO_BTIC | CPU_FTR_PPC_LE)
269#define CPU_FTRS_7447 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 282#define CPU_FTRS_7447 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
270 CPU_FTR_USE_TB | \ 283 CPU_FTR_USE_TB | \
271 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ 284 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
272 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ 285 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \
273 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \ 286 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \
274 CPU_FTR_NEED_COHERENT) 287 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE)
275#define CPU_FTRS_7447A (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 288#define CPU_FTRS_7447A (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
276 CPU_FTR_USE_TB | \ 289 CPU_FTR_USE_TB | \
277 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ 290 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
278 CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ 291 CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \
279 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \ 292 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \
280 CPU_FTR_NEED_COHERENT) 293 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE)
281#define CPU_FTRS_82XX (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 294#define CPU_FTRS_82XX (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
282 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB) 295 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB)
283#define CPU_FTRS_G2_LE (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_MAYBE_CAN_DOZE | \ 296#define CPU_FTRS_G2_LE (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_MAYBE_CAN_DOZE | \
@@ -287,13 +300,6 @@ extern void do_cpu_ftr_fixups(unsigned long offset);
287 CPU_FTR_COMMON) 300 CPU_FTR_COMMON)
288#define CPU_FTRS_CLASSIC32 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 301#define CPU_FTRS_CLASSIC32 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
289 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE) 302 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE)
290#define CPU_FTRS_POWER3_32 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
291 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE)
292#define CPU_FTRS_POWER4_32 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
293 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | CPU_FTR_NODSISRALIGN)
294#define CPU_FTRS_970_32 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
295 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | CPU_FTR_ALTIVEC_COMP | \
296 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_NODSISRALIGN)
297#define CPU_FTRS_8XX (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB) 303#define CPU_FTRS_8XX (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB)
298#define CPU_FTRS_40X (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 304#define CPU_FTRS_40X (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
299 CPU_FTR_NODSISRALIGN) 305 CPU_FTR_NODSISRALIGN)
@@ -307,7 +313,7 @@ extern void do_cpu_ftr_fixups(unsigned long offset);
307#define CPU_FTRS_GENERIC_32 (CPU_FTR_COMMON | CPU_FTR_NODSISRALIGN) 313#define CPU_FTRS_GENERIC_32 (CPU_FTR_COMMON | CPU_FTR_NODSISRALIGN)
308#ifdef __powerpc64__ 314#ifdef __powerpc64__
309#define CPU_FTRS_POWER3 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 315#define CPU_FTRS_POWER3 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
310 CPU_FTR_HPTE_TABLE | CPU_FTR_IABR) 316 CPU_FTR_HPTE_TABLE | CPU_FTR_IABR | CPU_FTR_PPC_LE)
311#define CPU_FTRS_RS64 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 317#define CPU_FTRS_RS64 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
312 CPU_FTR_HPTE_TABLE | CPU_FTR_IABR | \ 318 CPU_FTR_HPTE_TABLE | CPU_FTR_IABR | \
313 CPU_FTR_MMCRA | CPU_FTR_CTRL) 319 CPU_FTR_MMCRA | CPU_FTR_CTRL)
@@ -320,12 +326,12 @@ extern void do_cpu_ftr_fixups(unsigned long offset);
320 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \ 326 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \
321 CPU_FTR_MMCRA | CPU_FTR_SMT | \ 327 CPU_FTR_MMCRA | CPU_FTR_SMT | \
322 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \ 328 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \
323 CPU_FTR_MMCRA_SIHV | CPU_FTR_PURR) 329 CPU_FTR_PURR)
324#define CPU_FTRS_POWER6 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 330#define CPU_FTRS_POWER6 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
325 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \ 331 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \
326 CPU_FTR_MMCRA | CPU_FTR_SMT | \ 332 CPU_FTR_MMCRA | CPU_FTR_SMT | \
327 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \ 333 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \
328 CPU_FTR_PURR | CPU_FTR_CI_LARGE_PAGE) 334 CPU_FTR_PURR | CPU_FTR_CI_LARGE_PAGE | CPU_FTR_REAL_LE)
329#define CPU_FTRS_CELL (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 335#define CPU_FTRS_CELL (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
330 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \ 336 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \
331 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \ 337 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \
@@ -354,12 +360,6 @@ enum {
354#else 360#else
355 CPU_FTRS_GENERIC_32 | 361 CPU_FTRS_GENERIC_32 |
356#endif 362#endif
357#ifdef CONFIG_PPC64BRIDGE
358 CPU_FTRS_POWER3_32 |
359#endif
360#ifdef CONFIG_POWER4
361 CPU_FTRS_POWER4_32 | CPU_FTRS_970_32 |
362#endif
363#ifdef CONFIG_8xx 363#ifdef CONFIG_8xx
364 CPU_FTRS_8XX | 364 CPU_FTRS_8XX |
365#endif 365#endif
@@ -399,12 +399,6 @@ enum {
399#else 399#else
400 CPU_FTRS_GENERIC_32 & 400 CPU_FTRS_GENERIC_32 &
401#endif 401#endif
402#ifdef CONFIG_PPC64BRIDGE
403 CPU_FTRS_POWER3_32 &
404#endif
405#ifdef CONFIG_POWER4
406 CPU_FTRS_POWER4_32 & CPU_FTRS_970_32 &
407#endif
408#ifdef CONFIG_8xx 402#ifdef CONFIG_8xx
409 CPU_FTRS_8XX & 403 CPU_FTRS_8XX &
410#endif 404#endif
diff --git a/include/asm-powerpc/delay.h b/include/asm-powerpc/delay.h
index 057a60955474..f9200a65c632 100644
--- a/include/asm-powerpc/delay.h
+++ b/include/asm-powerpc/delay.h
@@ -17,5 +17,18 @@
17extern void __delay(unsigned long loops); 17extern void __delay(unsigned long loops);
18extern void udelay(unsigned long usecs); 18extern void udelay(unsigned long usecs);
19 19
20/*
21 * On shared processor machines the generic implementation of mdelay can
22 * result in large errors. While each iteration of the loop inside mdelay
23 * is supposed to take 1ms, the hypervisor could sleep our partition for
24 * longer (eg 10ms). With the right timing these errors can add up.
25 *
26 * Since there is no 32bit overflow issue on 64bit kernels, just call
27 * udelay directly.
28 */
29#ifdef CONFIG_PPC64
30#define mdelay(n) udelay((n) * 1000)
31#endif
32
20#endif /* __KERNEL__ */ 33#endif /* __KERNEL__ */
21#endif /* _ASM_POWERPC_DELAY_H */ 34#endif /* _ASM_POWERPC_DELAY_H */
diff --git a/include/asm-powerpc/eeh.h b/include/asm-powerpc/eeh.h
index e9c86b1eedab..4df3e80118f4 100644
--- a/include/asm-powerpc/eeh.h
+++ b/include/asm-powerpc/eeh.h
@@ -292,8 +292,6 @@ static inline void eeh_memcpy_toio(volatile void __iomem *dest, const void *src,
292static inline u8 eeh_inb(unsigned long port) 292static inline u8 eeh_inb(unsigned long port)
293{ 293{
294 u8 val; 294 u8 val;
295 if (!_IO_IS_VALID(port))
296 return ~0;
297 val = in_8((u8 __iomem *)(port+pci_io_base)); 295 val = in_8((u8 __iomem *)(port+pci_io_base));
298 if (EEH_POSSIBLE_ERROR(val, u8)) 296 if (EEH_POSSIBLE_ERROR(val, u8))
299 return eeh_check_failure((void __iomem *)(port), val); 297 return eeh_check_failure((void __iomem *)(port), val);
@@ -302,15 +300,12 @@ static inline u8 eeh_inb(unsigned long port)
302 300
303static inline void eeh_outb(u8 val, unsigned long port) 301static inline void eeh_outb(u8 val, unsigned long port)
304{ 302{
305 if (_IO_IS_VALID(port)) 303 out_8((u8 __iomem *)(port+pci_io_base), val);
306 out_8((u8 __iomem *)(port+pci_io_base), val);
307} 304}
308 305
309static inline u16 eeh_inw(unsigned long port) 306static inline u16 eeh_inw(unsigned long port)
310{ 307{
311 u16 val; 308 u16 val;
312 if (!_IO_IS_VALID(port))
313 return ~0;
314 val = in_le16((u16 __iomem *)(port+pci_io_base)); 309 val = in_le16((u16 __iomem *)(port+pci_io_base));
315 if (EEH_POSSIBLE_ERROR(val, u16)) 310 if (EEH_POSSIBLE_ERROR(val, u16))
316 return eeh_check_failure((void __iomem *)(port), val); 311 return eeh_check_failure((void __iomem *)(port), val);
@@ -319,15 +314,12 @@ static inline u16 eeh_inw(unsigned long port)
319 314
320static inline void eeh_outw(u16 val, unsigned long port) 315static inline void eeh_outw(u16 val, unsigned long port)
321{ 316{
322 if (_IO_IS_VALID(port)) 317 out_le16((u16 __iomem *)(port+pci_io_base), val);
323 out_le16((u16 __iomem *)(port+pci_io_base), val);
324} 318}
325 319
326static inline u32 eeh_inl(unsigned long port) 320static inline u32 eeh_inl(unsigned long port)
327{ 321{
328 u32 val; 322 u32 val;
329 if (!_IO_IS_VALID(port))
330 return ~0;
331 val = in_le32((u32 __iomem *)(port+pci_io_base)); 323 val = in_le32((u32 __iomem *)(port+pci_io_base));
332 if (EEH_POSSIBLE_ERROR(val, u32)) 324 if (EEH_POSSIBLE_ERROR(val, u32))
333 return eeh_check_failure((void __iomem *)(port), val); 325 return eeh_check_failure((void __iomem *)(port), val);
@@ -336,8 +328,7 @@ static inline u32 eeh_inl(unsigned long port)
336 328
337static inline void eeh_outl(u32 val, unsigned long port) 329static inline void eeh_outl(u32 val, unsigned long port)
338{ 330{
339 if (_IO_IS_VALID(port)) 331 out_le32((u32 __iomem *)(port+pci_io_base), val);
340 out_le32((u32 __iomem *)(port+pci_io_base), val);
341} 332}
342 333
343/* in-string eeh macros */ 334/* in-string eeh macros */
diff --git a/include/asm-powerpc/eeh_event.h b/include/asm-powerpc/eeh_event.h
index 93d55a2bebfd..dc6bf0ffb796 100644
--- a/include/asm-powerpc/eeh_event.h
+++ b/include/asm-powerpc/eeh_event.h
@@ -18,8 +18,8 @@
18 * Copyright (c) 2005 Linas Vepstas <linas@linas.org> 18 * Copyright (c) 2005 Linas Vepstas <linas@linas.org>
19 */ 19 */
20 20
21#ifndef ASM_PPC64_EEH_EVENT_H 21#ifndef ASM_POWERPC_EEH_EVENT_H
22#define ASM_PPC64_EEH_EVENT_H 22#define ASM_POWERPC_EEH_EVENT_H
23#ifdef __KERNEL__ 23#ifdef __KERNEL__
24 24
25/** EEH event -- structure holding pci controller data that describes 25/** EEH event -- structure holding pci controller data that describes
@@ -39,7 +39,7 @@ struct eeh_event {
39 * @dev pci device 39 * @dev pci device
40 * 40 *
41 * This routine builds a PCI error event which will be delivered 41 * This routine builds a PCI error event which will be delivered
42 * to all listeners on the peh_notifier_chain. 42 * to all listeners on the eeh_notifier_chain.
43 * 43 *
44 * This routine can be called within an interrupt context; 44 * This routine can be called within an interrupt context;
45 * the actual event will be delivered in a normal context 45 * the actual event will be delivered in a normal context
@@ -51,7 +51,7 @@ int eeh_send_failure_event (struct device_node *dn,
51 int time_unavail); 51 int time_unavail);
52 52
53/* Main recovery function */ 53/* Main recovery function */
54void handle_eeh_events (struct eeh_event *); 54struct pci_dn * handle_eeh_events (struct eeh_event *);
55 55
56#endif /* __KERNEL__ */ 56#endif /* __KERNEL__ */
57#endif /* ASM_PPC64_EEH_EVENT_H */ 57#endif /* ASM_POWERPC_EEH_EVENT_H */
diff --git a/include/asm-powerpc/elf.h b/include/asm-powerpc/elf.h
index 99c18b71aa82..9a83a987d396 100644
--- a/include/asm-powerpc/elf.h
+++ b/include/asm-powerpc/elf.h
@@ -293,7 +293,7 @@ do { \
293 NEW_AUX_ENT(AT_DCACHEBSIZE, dcache_bsize); \ 293 NEW_AUX_ENT(AT_DCACHEBSIZE, dcache_bsize); \
294 NEW_AUX_ENT(AT_ICACHEBSIZE, icache_bsize); \ 294 NEW_AUX_ENT(AT_ICACHEBSIZE, icache_bsize); \
295 NEW_AUX_ENT(AT_UCACHEBSIZE, ucache_bsize); \ 295 NEW_AUX_ENT(AT_UCACHEBSIZE, ucache_bsize); \
296 VDSO_AUX_ENT(AT_SYSINFO_EHDR, current->thread.vdso_base) \ 296 VDSO_AUX_ENT(AT_SYSINFO_EHDR, current->mm->context.vdso_base) \
297} while (0) 297} while (0)
298 298
299/* PowerPC64 relocations defined by the ABIs */ 299/* PowerPC64 relocations defined by the ABIs */
diff --git a/include/asm-powerpc/floppy.h b/include/asm-powerpc/floppy.h
index 7e2d169ee856..9c8d91bf5a0d 100644
--- a/include/asm-powerpc/floppy.h
+++ b/include/asm-powerpc/floppy.h
@@ -27,8 +27,7 @@
27#define fd_disable_irq() disable_irq(FLOPPY_IRQ) 27#define fd_disable_irq() disable_irq(FLOPPY_IRQ)
28#define fd_cacheflush(addr,size) /* nothing */ 28#define fd_cacheflush(addr,size) /* nothing */
29#define fd_request_irq() request_irq(FLOPPY_IRQ, floppy_interrupt, \ 29#define fd_request_irq() request_irq(FLOPPY_IRQ, floppy_interrupt, \
30 SA_INTERRUPT|SA_SAMPLE_RANDOM, \ 30 SA_INTERRUPT, "floppy", NULL)
31 "floppy", NULL)
32#define fd_free_irq() free_irq(FLOPPY_IRQ, NULL); 31#define fd_free_irq() free_irq(FLOPPY_IRQ, NULL);
33 32
34#ifdef CONFIG_PCI 33#ifdef CONFIG_PCI
diff --git a/include/asm-powerpc/hvcall.h b/include/asm-powerpc/hvcall.h
index 6cc7e1fb7bfd..0d3c4e85711a 100644
--- a/include/asm-powerpc/hvcall.h
+++ b/include/asm-powerpc/hvcall.h
@@ -102,6 +102,15 @@
102#define H_PP1 (1UL<<(63-62)) 102#define H_PP1 (1UL<<(63-62))
103#define H_PP2 (1UL<<(63-63)) 103#define H_PP2 (1UL<<(63-63))
104 104
105/* VASI States */
106#define H_VASI_INVALID 0
107#define H_VASI_ENABLED 1
108#define H_VASI_ABORTED 2
109#define H_VASI_SUSPENDING 3
110#define H_VASI_SUSPENDED 4
111#define H_VASI_RESUMED 5
112#define H_VASI_COMPLETED 6
113
105/* DABRX flags */ 114/* DABRX flags */
106#define H_DABRX_HYPERVISOR (1UL<<(63-61)) 115#define H_DABRX_HYPERVISOR (1UL<<(63-61))
107#define H_DABRX_KERNEL (1UL<<(63-62)) 116#define H_DABRX_KERNEL (1UL<<(63-62))
@@ -190,6 +199,7 @@
190#define H_QUERY_INT_STATE 0x1E4 199#define H_QUERY_INT_STATE 0x1E4
191#define H_POLL_PENDING 0x1D8 200#define H_POLL_PENDING 0x1D8
192#define H_JOIN 0x298 201#define H_JOIN 0x298
202#define H_VASI_STATE 0x2A4
193#define H_ENABLE_CRQ 0x2B0 203#define H_ENABLE_CRQ 0x2B0
194 204
195#ifndef __ASSEMBLY__ 205#ifndef __ASSEMBLY__
diff --git a/include/asm-powerpc/immap_86xx.h b/include/asm-powerpc/immap_86xx.h
new file mode 100644
index 000000000000..d905b6622268
--- /dev/null
+++ b/include/asm-powerpc/immap_86xx.h
@@ -0,0 +1,199 @@
1/*
2 * MPC86xx Internal Memory Map
3 *
4 * Author: Jeff Brown
5 *
6 * Copyright 2004 Freescale Semiconductor, Inc
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 */
14
15#ifndef __ASM_POWERPC_IMMAP_86XX_H__
16#define __ASM_POWERPC_IMMAP_86XX_H__
17#ifdef __KERNEL__
18
19/* Eventually this should define all the IO block registers in 86xx */
20
21/* PCI Registers */
22typedef struct ccsr_pci {
23 uint cfg_addr; /* 0x.000 - PCI Configuration Address Register */
24 uint cfg_data; /* 0x.004 - PCI Configuration Data Register */
25 uint int_ack; /* 0x.008 - PCI Interrupt Acknowledge Register */
26 char res1[3060];
27 uint potar0; /* 0x.c00 - PCI Outbound Transaction Address Register 0 */
28 uint potear0; /* 0x.c04 - PCI Outbound Translation Extended Address Register 0 */
29 uint powbar0; /* 0x.c08 - PCI Outbound Window Base Address Register 0 */
30 char res2[4];
31 uint powar0; /* 0x.c10 - PCI Outbound Window Attributes Register 0 */
32 char res3[12];
33 uint potar1; /* 0x.c20 - PCI Outbound Transaction Address Register 1 */
34 uint potear1; /* 0x.c24 - PCI Outbound Translation Extended Address Register 1 */
35 uint powbar1; /* 0x.c28 - PCI Outbound Window Base Address Register 1 */
36 char res4[4];
37 uint powar1; /* 0x.c30 - PCI Outbound Window Attributes Register 1 */
38 char res5[12];
39 uint potar2; /* 0x.c40 - PCI Outbound Transaction Address Register 2 */
40 uint potear2; /* 0x.c44 - PCI Outbound Translation Extended Address Register 2 */
41 uint powbar2; /* 0x.c48 - PCI Outbound Window Base Address Register 2 */
42 char res6[4];
43 uint powar2; /* 0x.c50 - PCI Outbound Window Attributes Register 2 */
44 char res7[12];
45 uint potar3; /* 0x.c60 - PCI Outbound Transaction Address Register 3 */
46 uint potear3; /* 0x.c64 - PCI Outbound Translation Extended Address Register 3 */
47 uint powbar3; /* 0x.c68 - PCI Outbound Window Base Address Register 3 */
48 char res8[4];
49 uint powar3; /* 0x.c70 - PCI Outbound Window Attributes Register 3 */
50 char res9[12];
51 uint potar4; /* 0x.c80 - PCI Outbound Transaction Address Register 4 */
52 uint potear4; /* 0x.c84 - PCI Outbound Translation Extended Address Register 4 */
53 uint powbar4; /* 0x.c88 - PCI Outbound Window Base Address Register 4 */
54 char res10[4];
55 uint powar4; /* 0x.c90 - PCI Outbound Window Attributes Register 4 */
56 char res11[268];
57 uint pitar3; /* 0x.da0 - PCI Inbound Translation Address Register 3 */
58 char res12[4];
59 uint piwbar3; /* 0x.da8 - PCI Inbound Window Base Address Register 3 */
60 uint piwbear3; /* 0x.dac - PCI Inbound Window Base Extended Address Register 3 */
61 uint piwar3; /* 0x.db0 - PCI Inbound Window Attributes Register 3 */
62 char res13[12];
63 uint pitar2; /* 0x.dc0 - PCI Inbound Translation Address Register 2 */
64 char res14[4];
65 uint piwbar2; /* 0x.dc8 - PCI Inbound Window Base Address Register 2 */
66 uint piwbear2; /* 0x.dcc - PCI Inbound Window Base Extended Address Register 2 */
67 uint piwar2; /* 0x.dd0 - PCI Inbound Window Attributes Register 2 */
68 char res15[12];
69 uint pitar1; /* 0x.de0 - PCI Inbound Translation Address Register 1 */
70 char res16[4];
71 uint piwbar1; /* 0x.de8 - PCI Inbound Window Base Address Register 1 */
72 char res17[4];
73 uint piwar1; /* 0x.df0 - PCI Inbound Window Attributes Register 1 */
74 char res18[12];
75 uint err_dr; /* 0x.e00 - PCI Error Detect Register */
76 uint err_cap_dr; /* 0x.e04 - PCI Error Capture Disable Register */
77 uint err_en; /* 0x.e08 - PCI Error Enable Register */
78 uint err_attrib; /* 0x.e0c - PCI Error Attributes Capture Register */
79 uint err_addr; /* 0x.e10 - PCI Error Address Capture Register */
80 uint err_ext_addr; /* 0x.e14 - PCI Error Extended Address Capture Register */
81 uint err_dl; /* 0x.e18 - PCI Error Data Low Capture Register */
82 uint err_dh; /* 0x.e1c - PCI Error Data High Capture Register */
83 uint gas_timr; /* 0x.e20 - PCI Gasket Timer Register */
84 uint pci_timr; /* 0x.e24 - PCI Timer Register */
85 char res19[472];
86} ccsr_pci_t;
87
88/* PCI Express Registers */
89typedef struct ccsr_pex {
90 uint pex_config_addr; /* 0x.000 - PCI Express Configuration Address Register */
91 uint pex_config_data; /* 0x.004 - PCI Express Configuration Data Register */
92 char res1[4];
93 uint pex_otb_cpl_tor; /* 0x.00c - PCI Express Outbound completion timeout register */
94 uint pex_conf_tor; /* 0x.010 - PCI Express configuration timeout register */
95 char res2[12];
96 uint pex_pme_mes_dr; /* 0x.020 - PCI Express PME and message detect register */
97 uint pex_pme_mes_disr; /* 0x.024 - PCI Express PME and message disable register */
98 uint pex_pme_mes_ier; /* 0x.028 - PCI Express PME and message interrupt enable register */
99 uint pex_pmcr; /* 0x.02c - PCI Express power management command register */
100 char res3[3024];
101 uint pexotar0; /* 0x.c00 - PCI Express outbound translation address register 0 */
102 uint pexotear0; /* 0x.c04 - PCI Express outbound translation extended address register 0*/
103 char res4[8];
104 uint pexowar0; /* 0x.c10 - PCI Express outbound window attributes register 0*/
105 char res5[12];
106 uint pexotar1; /* 0x.c20 - PCI Express outbound translation address register 1 */
107 uint pexotear1; /* 0x.c24 - PCI Express outbound translation extended address register 1*/
108 uint pexowbar1; /* 0x.c28 - PCI Express outbound window base address register 1*/
109 char res6[4];
110 uint pexowar1; /* 0x.c30 - PCI Express outbound window attributes register 1*/
111 char res7[12];
112 uint pexotar2; /* 0x.c40 - PCI Express outbound translation address register 2 */
113 uint pexotear2; /* 0x.c44 - PCI Express outbound translation extended address register 2*/
114 uint pexowbar2; /* 0x.c48 - PCI Express outbound window base address register 2*/
115 char res8[4];
116 uint pexowar2; /* 0x.c50 - PCI Express outbound window attributes register 2*/
117 char res9[12];
118 uint pexotar3; /* 0x.c60 - PCI Express outbound translation address register 3 */
119 uint pexotear3; /* 0x.c64 - PCI Express outbound translation extended address register 3*/
120 uint pexowbar3; /* 0x.c68 - PCI Express outbound window base address register 3*/
121 char res10[4];
122 uint pexowar3; /* 0x.c70 - PCI Express outbound window attributes register 3*/
123 char res11[12];
124 uint pexotar4; /* 0x.c80 - PCI Express outbound translation address register 4 */
125 uint pexotear4; /* 0x.c84 - PCI Express outbound translation extended address register 4*/
126 uint pexowbar4; /* 0x.c88 - PCI Express outbound window base address register 4*/
127 char res12[4];
128 uint pexowar4; /* 0x.c90 - PCI Express outbound window attributes register 4*/
129 char res13[12];
130 char res14[256];
131 uint pexitar3; /* 0x.da0 - PCI Express inbound translation address register 3 */
132 char res15[4];
133 uint pexiwbar3; /* 0x.da8 - PCI Express inbound window base address register 3 */
134 uint pexiwbear3; /* 0x.dac - PCI Express inbound window base extended address register 3 */
135 uint pexiwar3; /* 0x.db0 - PCI Express inbound window attributes register 3 */
136 char res16[12];
137 uint pexitar2; /* 0x.dc0 - PCI Express inbound translation address register 2 */
138 char res17[4];
139 uint pexiwbar2; /* 0x.dc8 - PCI Express inbound window base address register 2 */
140 uint pexiwbear2; /* 0x.dcc - PCI Express inbound window base extended address register 2 */
141 uint pexiwar2; /* 0x.dd0 - PCI Express inbound window attributes register 2 */
142 char res18[12];
143 uint pexitar1; /* 0x.de0 - PCI Express inbound translation address register 2 */
144 char res19[4];
145 uint pexiwbar1; /* 0x.de8 - PCI Express inbound window base address register 2 */
146 uint pexiwbear1; /* 0x.dec - PCI Express inbound window base extended address register 2 */
147 uint pexiwar1; /* 0x.df0 - PCI Express inbound window attributes register 2 */
148 char res20[12];
149 uint pex_err_dr; /* 0x.e00 - PCI Express error detect register */
150 char res21[4];
151 uint pex_err_en; /* 0x.e08 - PCI Express error interrupt enable register */
152 char res22[4];
153 uint pex_err_disr; /* 0x.e10 - PCI Express error disable register */
154 char res23[12];
155 uint pex_err_cap_stat; /* 0x.e20 - PCI Express error capture status register */
156 char res24[4];
157 uint pex_err_cap_r0; /* 0x.e28 - PCI Express error capture register 0 */
158 uint pex_err_cap_r1; /* 0x.e2c - PCI Express error capture register 0 */
159 uint pex_err_cap_r2; /* 0x.e30 - PCI Express error capture register 0 */
160 uint pex_err_cap_r3; /* 0x.e34 - PCI Express error capture register 0 */
161} ccsr_pex_t;
162
163/* Global Utility Registers */
164typedef struct ccsr_guts {
165 uint porpllsr; /* 0x.0000 - POR PLL Ratio Status Register */
166 uint porbmsr; /* 0x.0004 - POR Boot Mode Status Register */
167 uint porimpscr; /* 0x.0008 - POR I/O Impedance Status and Control Register */
168 uint pordevsr; /* 0x.000c - POR I/O Device Status Register */
169 uint pordbgmsr; /* 0x.0010 - POR Debug Mode Status Register */
170 char res1[12];
171 uint gpporcr; /* 0x.0020 - General-Purpose POR Configuration Register */
172 char res2[12];
173 uint gpiocr; /* 0x.0030 - GPIO Control Register */
174 char res3[12];
175 uint gpoutdr; /* 0x.0040 - General-Purpose Output Data Register */
176 char res4[12];
177 uint gpindr; /* 0x.0050 - General-Purpose Input Data Register */
178 char res5[12];
179 uint pmuxcr; /* 0x.0060 - Alternate Function Signal Multiplex Control */
180 char res6[12];
181 uint devdisr; /* 0x.0070 - Device Disable Control */
182 char res7[12];
183 uint powmgtcsr; /* 0x.0080 - Power Management Status and Control Register */
184 char res8[12];
185 uint mcpsumr; /* 0x.0090 - Machine Check Summary Register */
186 char res9[12];
187 uint pvr; /* 0x.00a0 - Processor Version Register */
188 uint svr; /* 0x.00a4 - System Version Register */
189 char res10[3416];
190 uint clkocr; /* 0x.0e00 - Clock Out Select Register */
191 char res11[12];
192 uint ddrdllcr; /* 0x.0e10 - DDR DLL Control Register */
193 char res12[12];
194 uint lbcdllcr; /* 0x.0e20 - LBC DLL Control Register */
195 char res13[61916];
196} ccsr_guts_t;
197
198#endif /* __ASM_POWERPC_IMMAP_86XX_H__ */
199#endif /* __KERNEL__ */
diff --git a/include/asm-powerpc/io.h b/include/asm-powerpc/io.h
index f1c2469b8844..a9496f34b048 100644
--- a/include/asm-powerpc/io.h
+++ b/include/asm-powerpc/io.h
@@ -40,12 +40,6 @@ extern int check_legacy_ioport(unsigned long base_port);
40 40
41extern unsigned long isa_io_base; 41extern unsigned long isa_io_base;
42extern unsigned long pci_io_base; 42extern unsigned long pci_io_base;
43extern unsigned long io_page_mask;
44
45#define MAX_ISA_PORT 0x10000
46
47#define _IO_IS_VALID(port) ((port) >= MAX_ISA_PORT || (1 << (port>>PAGE_SHIFT)) \
48 & io_page_mask)
49 43
50#ifdef CONFIG_PPC_ISERIES 44#ifdef CONFIG_PPC_ISERIES
51/* __raw_* accessors aren't supported on iSeries */ 45/* __raw_* accessors aren't supported on iSeries */
diff --git a/include/asm-powerpc/iommu.h b/include/asm-powerpc/iommu.h
index 2acf7b29ef06..a5e98641a2ae 100644
--- a/include/asm-powerpc/iommu.h
+++ b/include/asm-powerpc/iommu.h
@@ -66,7 +66,8 @@ extern void iommu_free_table(struct device_node *dn);
66/* Initializes an iommu_table based in values set in the passed-in 66/* Initializes an iommu_table based in values set in the passed-in
67 * structure 67 * structure
68 */ 68 */
69extern struct iommu_table *iommu_init_table(struct iommu_table * tbl); 69extern struct iommu_table *iommu_init_table(struct iommu_table * tbl,
70 int nid);
70 71
71extern int iommu_map_sg(struct device *dev, struct iommu_table *tbl, 72extern int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
72 struct scatterlist *sglist, int nelems, unsigned long mask, 73 struct scatterlist *sglist, int nelems, unsigned long mask,
@@ -75,7 +76,8 @@ extern void iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist,
75 int nelems, enum dma_data_direction direction); 76 int nelems, enum dma_data_direction direction);
76 77
77extern void *iommu_alloc_coherent(struct iommu_table *tbl, size_t size, 78extern void *iommu_alloc_coherent(struct iommu_table *tbl, size_t size,
78 dma_addr_t *dma_handle, unsigned long mask, gfp_t flag); 79 dma_addr_t *dma_handle, unsigned long mask,
80 gfp_t flag, int node);
79extern void iommu_free_coherent(struct iommu_table *tbl, size_t size, 81extern void iommu_free_coherent(struct iommu_table *tbl, size_t size,
80 void *vaddr, dma_addr_t dma_handle); 82 void *vaddr, dma_addr_t dma_handle);
81extern dma_addr_t iommu_map_single(struct iommu_table *tbl, void *vaddr, 83extern dma_addr_t iommu_map_single(struct iommu_table *tbl, void *vaddr,
diff --git a/include/asm-powerpc/irq.h b/include/asm-powerpc/irq.h
index 1e9f25330307..a10feec29d4d 100644
--- a/include/asm-powerpc/irq.h
+++ b/include/asm-powerpc/irq.h
@@ -347,6 +347,92 @@ extern u64 ppc64_interrupt_controller;
347#define SIU_INT_PC1 ((uint)0x3e+CPM_IRQ_OFFSET) 347#define SIU_INT_PC1 ((uint)0x3e+CPM_IRQ_OFFSET)
348#define SIU_INT_PC0 ((uint)0x3f+CPM_IRQ_OFFSET) 348#define SIU_INT_PC0 ((uint)0x3f+CPM_IRQ_OFFSET)
349 349
350#elif defined(CONFIG_PPC_86xx)
351#include <asm/mpc86xx.h>
352
353#define NR_EPIC_INTS 48
354#ifndef NR_8259_INTS
355#define NR_8259_INTS 16 /*ULI 1575 can route 12 interrupts */
356#endif
357#define NUM_8259_INTERRUPTS NR_8259_INTS
358
359#ifndef I8259_OFFSET
360#define I8259_OFFSET 0
361#endif
362
363#define NR_IRQS 256
364
365/* Internal IRQs on MPC86xx OpenPIC */
366
367#ifndef MPC86xx_OPENPIC_IRQ_OFFSET
368#define MPC86xx_OPENPIC_IRQ_OFFSET NR_8259_INTS
369#endif
370
371/* The 48 internal sources */
372#define MPC86xx_IRQ_NULL ( 0 + MPC86xx_OPENPIC_IRQ_OFFSET)
373#define MPC86xx_IRQ_MCM ( 1 + MPC86xx_OPENPIC_IRQ_OFFSET)
374#define MPC86xx_IRQ_DDR ( 2 + MPC86xx_OPENPIC_IRQ_OFFSET)
375#define MPC86xx_IRQ_LBC ( 3 + MPC86xx_OPENPIC_IRQ_OFFSET)
376#define MPC86xx_IRQ_DMA0 ( 4 + MPC86xx_OPENPIC_IRQ_OFFSET)
377#define MPC86xx_IRQ_DMA1 ( 5 + MPC86xx_OPENPIC_IRQ_OFFSET)
378#define MPC86xx_IRQ_DMA2 ( 6 + MPC86xx_OPENPIC_IRQ_OFFSET)
379#define MPC86xx_IRQ_DMA3 ( 7 + MPC86xx_OPENPIC_IRQ_OFFSET)
380
381/* no 10,11 */
382#define MPC86xx_IRQ_UART2 (12 + MPC86xx_OPENPIC_IRQ_OFFSET)
383#define MPC86xx_IRQ_TSEC1_TX (13 + MPC86xx_OPENPIC_IRQ_OFFSET)
384#define MPC86xx_IRQ_TSEC1_RX (14 + MPC86xx_OPENPIC_IRQ_OFFSET)
385#define MPC86xx_IRQ_TSEC3_TX (15 + MPC86xx_OPENPIC_IRQ_OFFSET)
386#define MPC86xx_IRQ_TSEC3_RX (16 + MPC86xx_OPENPIC_IRQ_OFFSET)
387#define MPC86xx_IRQ_TSEC3_ERROR (17 + MPC86xx_OPENPIC_IRQ_OFFSET)
388#define MPC86xx_IRQ_TSEC1_ERROR (18 + MPC86xx_OPENPIC_IRQ_OFFSET)
389#define MPC86xx_IRQ_TSEC2_TX (19 + MPC86xx_OPENPIC_IRQ_OFFSET)
390#define MPC86xx_IRQ_TSEC2_RX (20 + MPC86xx_OPENPIC_IRQ_OFFSET)
391#define MPC86xx_IRQ_TSEC4_TX (21 + MPC86xx_OPENPIC_IRQ_OFFSET)
392#define MPC86xx_IRQ_TSEC4_RX (22 + MPC86xx_OPENPIC_IRQ_OFFSET)
393#define MPC86xx_IRQ_TSEC4_ERROR (23 + MPC86xx_OPENPIC_IRQ_OFFSET)
394#define MPC86xx_IRQ_TSEC2_ERROR (24 + MPC86xx_OPENPIC_IRQ_OFFSET)
395/* no 25 */
396#define MPC86xx_IRQ_UART1 (26 + MPC86xx_OPENPIC_IRQ_OFFSET)
397#define MPC86xx_IRQ_IIC (27 + MPC86xx_OPENPIC_IRQ_OFFSET)
398#define MPC86xx_IRQ_PERFMON (28 + MPC86xx_OPENPIC_IRQ_OFFSET)
399/* no 29,30,31 */
400#define MPC86xx_IRQ_SRIO_ERROR (32 + MPC86xx_OPENPIC_IRQ_OFFSET)
401#define MPC86xx_IRQ_SRIO_OUT_BELL (33 + MPC86xx_OPENPIC_IRQ_OFFSET)
402#define MPC86xx_IRQ_SRIO_IN_BELL (34 + MPC86xx_OPENPIC_IRQ_OFFSET)
403/* no 35,36 */
404#define MPC86xx_IRQ_SRIO_OUT_MSG1 (37 + MPC86xx_OPENPIC_IRQ_OFFSET)
405#define MPC86xx_IRQ_SRIO_IN_MSG1 (38 + MPC86xx_OPENPIC_IRQ_OFFSET)
406#define MPC86xx_IRQ_SRIO_OUT_MSG2 (39 + MPC86xx_OPENPIC_IRQ_OFFSET)
407#define MPC86xx_IRQ_SRIO_IN_MSG2 (40 + MPC86xx_OPENPIC_IRQ_OFFSET)
408
409/* The 12 external interrupt lines */
410#define MPC86xx_IRQ_EXT_BASE 48
411#define MPC86xx_IRQ_EXT0 (0 + MPC86xx_IRQ_EXT_BASE \
412 + MPC86xx_OPENPIC_IRQ_OFFSET)
413#define MPC86xx_IRQ_EXT1 (1 + MPC86xx_IRQ_EXT_BASE \
414 + MPC86xx_OPENPIC_IRQ_OFFSET)
415#define MPC86xx_IRQ_EXT2 (2 + MPC86xx_IRQ_EXT_BASE \
416 + MPC86xx_OPENPIC_IRQ_OFFSET)
417#define MPC86xx_IRQ_EXT3 (3 + MPC86xx_IRQ_EXT_BASE \
418 + MPC86xx_OPENPIC_IRQ_OFFSET)
419#define MPC86xx_IRQ_EXT4 (4 + MPC86xx_IRQ_EXT_BASE \
420 + MPC86xx_OPENPIC_IRQ_OFFSET)
421#define MPC86xx_IRQ_EXT5 (5 + MPC86xx_IRQ_EXT_BASE \
422 + MPC86xx_OPENPIC_IRQ_OFFSET)
423#define MPC86xx_IRQ_EXT6 (6 + MPC86xx_IRQ_EXT_BASE \
424 + MPC86xx_OPENPIC_IRQ_OFFSET)
425#define MPC86xx_IRQ_EXT7 (7 + MPC86xx_IRQ_EXT_BASE \
426 + MPC86xx_OPENPIC_IRQ_OFFSET)
427#define MPC86xx_IRQ_EXT8 (8 + MPC86xx_IRQ_EXT_BASE \
428 + MPC86xx_OPENPIC_IRQ_OFFSET)
429#define MPC86xx_IRQ_EXT9 (9 + MPC86xx_IRQ_EXT_BASE \
430 + MPC86xx_OPENPIC_IRQ_OFFSET)
431#define MPC86xx_IRQ_EXT10 (10 + MPC86xx_IRQ_EXT_BASE \
432 + MPC86xx_OPENPIC_IRQ_OFFSET)
433#define MPC86xx_IRQ_EXT11 (11 + MPC86xx_IRQ_EXT_BASE \
434 + MPC86xx_OPENPIC_IRQ_OFFSET)
435
350#else /* CONFIG_40x + CONFIG_8xx */ 436#else /* CONFIG_40x + CONFIG_8xx */
351/* 437/*
352 * this is the # irq's for all ppc arch's (pmac/chrp/prep) 438 * this is the # irq's for all ppc arch's (pmac/chrp/prep)
diff --git a/include/asm-powerpc/iseries/iommu.h b/include/asm-powerpc/iseries/iommu.h
new file mode 100644
index 000000000000..0edbfe10cb37
--- /dev/null
+++ b/include/asm-powerpc/iseries/iommu.h
@@ -0,0 +1,35 @@
1#ifndef _ASM_POWERPC_ISERIES_IOMMU_H
2#define _ASM_POWERPC_ISERIES_IOMMU_H
3
4/*
5 * Copyright (C) 2005 Stephen Rothwell, IBM Corporation
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the:
19 * Free Software Foundation, Inc.,
20 * 59 Temple Place, Suite 330,
21 * Boston, MA 02111-1307 USA
22 */
23
24struct device_node;
25struct iommu_table;
26
27/* Creates table for an individual device node */
28extern void iommu_devnode_init_iSeries(struct device_node *dn);
29
30/* Get table parameters from HV */
31extern void iommu_table_getparms_iSeries(unsigned long busno,
32 unsigned char slotno, unsigned char virtbus,
33 struct iommu_table *tbl);
34
35#endif /* _ASM_POWERPC_ISERIES_IOMMU_H */
diff --git a/include/asm-powerpc/kdump.h b/include/asm-powerpc/kdump.h
index a87aed00d61f..5a5c3b5ab1e0 100644
--- a/include/asm-powerpc/kdump.h
+++ b/include/asm-powerpc/kdump.h
@@ -1,13 +1,38 @@
1#ifndef _PPC64_KDUMP_H 1#ifndef _PPC64_KDUMP_H
2#define _PPC64_KDUMP_H 2#define _PPC64_KDUMP_H
3 3
4/* Kdump kernel runs at 32 MB, change at your peril. */
5#define KDUMP_KERNELBASE 0x2000000
6
4/* How many bytes to reserve at zero for kdump. The reserve limit should 7/* How many bytes to reserve at zero for kdump. The reserve limit should
5 * be greater or equal to the trampoline's end address. */ 8 * be greater or equal to the trampoline's end address.
9 * Reserve to the end of the FWNMI area, see head_64.S */
6#define KDUMP_RESERVE_LIMIT 0x8000 10#define KDUMP_RESERVE_LIMIT 0x8000
7 11
12#ifdef CONFIG_CRASH_DUMP
13
14#define PHYSICAL_START KDUMP_KERNELBASE
8#define KDUMP_TRAMPOLINE_START 0x0100 15#define KDUMP_TRAMPOLINE_START 0x0100
9#define KDUMP_TRAMPOLINE_END 0x3000 16#define KDUMP_TRAMPOLINE_END 0x3000
10 17
11extern void kdump_setup(void); 18#else /* !CONFIG_CRASH_DUMP */
19
20#define PHYSICAL_START 0x0
21
22#endif /* CONFIG_CRASH_DUMP */
23
24#ifndef __ASSEMBLY__
25#ifdef CONFIG_CRASH_DUMP
26
27extern void reserve_kdump_trampoline(void);
28extern void setup_kdump_trampoline(void);
29
30#else /* !CONFIG_CRASH_DUMP */
31
32static inline void reserve_kdump_trampoline(void) { ; }
33static inline void setup_kdump_trampoline(void) { ; }
34
35#endif /* CONFIG_CRASH_DUMP */
36#endif /* __ASSEMBLY__ */
12 37
13#endif /* __PPC64_KDUMP_H */ 38#endif /* __PPC64_KDUMP_H */
diff --git a/include/asm-powerpc/kexec.h b/include/asm-powerpc/kexec.h
index 6a2af2f6853b..efe8872ec583 100644
--- a/include/asm-powerpc/kexec.h
+++ b/include/asm-powerpc/kexec.h
@@ -31,9 +31,10 @@
31#define KEXEC_ARCH KEXEC_ARCH_PPC 31#define KEXEC_ARCH KEXEC_ARCH_PPC
32#endif 32#endif
33 33
34#ifndef __ASSEMBLY__
35
34#ifdef CONFIG_KEXEC 36#ifdef CONFIG_KEXEC
35 37
36#ifndef __ASSEMBLY__
37#ifdef __powerpc64__ 38#ifdef __powerpc64__
38/* 39/*
39 * This function is responsible for capturing register states if coming 40 * This function is responsible for capturing register states if coming
@@ -123,8 +124,19 @@ extern int default_machine_kexec_prepare(struct kimage *image);
123extern void default_machine_crash_shutdown(struct pt_regs *regs); 124extern void default_machine_crash_shutdown(struct pt_regs *regs);
124 125
125extern void machine_kexec_simple(struct kimage *image); 126extern void machine_kexec_simple(struct kimage *image);
127extern int overlaps_crashkernel(unsigned long start, unsigned long size);
128extern void reserve_crashkernel(void);
129
130#else /* !CONFIG_KEXEC */
131
132static inline int overlaps_crashkernel(unsigned long start, unsigned long size)
133{
134 return 0;
135}
136
137static inline void reserve_crashkernel(void) { ; }
126 138
127#endif /* ! __ASSEMBLY__ */
128#endif /* CONFIG_KEXEC */ 139#endif /* CONFIG_KEXEC */
140#endif /* ! __ASSEMBLY__ */
129#endif /* __KERNEL__ */ 141#endif /* __KERNEL__ */
130#endif /* _ASM_POWERPC_KEXEC_H */ 142#endif /* _ASM_POWERPC_KEXEC_H */
diff --git a/include/asm-powerpc/machdep.h b/include/asm-powerpc/machdep.h
index 3e7d37aa4a6d..73db1f71329d 100644
--- a/include/asm-powerpc/machdep.h
+++ b/include/asm-powerpc/machdep.h
@@ -237,6 +237,11 @@ struct machdep_calls {
237 */ 237 */
238 void (*machine_kexec)(struct kimage *image); 238 void (*machine_kexec)(struct kimage *image);
239#endif /* CONFIG_KEXEC */ 239#endif /* CONFIG_KEXEC */
240
241#ifdef CONFIG_PCI_MSI
242 int (*enable_msi)(struct pci_dev *pdev);
243 void (*disable_msi)(struct pci_dev *pdev);
244#endif /* CONFIG_PCI_MSI */
240}; 245};
241 246
242extern void power4_idle(void); 247extern void power4_idle(void);
diff --git a/include/asm-powerpc/mmu.h b/include/asm-powerpc/mmu.h
index 31f721994bd8..3a5ebe229af5 100644
--- a/include/asm-powerpc/mmu.h
+++ b/include/asm-powerpc/mmu.h
@@ -96,6 +96,8 @@ extern char initial_stab[];
96#define HPTE_R_FLAGS ASM_CONST(0x00000000000003ff) 96#define HPTE_R_FLAGS ASM_CONST(0x00000000000003ff)
97#define HPTE_R_PP ASM_CONST(0x0000000000000003) 97#define HPTE_R_PP ASM_CONST(0x0000000000000003)
98#define HPTE_R_N ASM_CONST(0x0000000000000004) 98#define HPTE_R_N ASM_CONST(0x0000000000000004)
99#define HPTE_R_C ASM_CONST(0x0000000000000080)
100#define HPTE_R_R ASM_CONST(0x0000000000000100)
99 101
100/* Values for PP (assumes Ks=0, Kp=1) */ 102/* Values for PP (assumes Ks=0, Kp=1) */
101/* pp0 will always be 0 for linux */ 103/* pp0 will always be 0 for linux */
@@ -163,6 +165,16 @@ struct mmu_psize_def
163extern struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT]; 165extern struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT];
164extern int mmu_linear_psize; 166extern int mmu_linear_psize;
165extern int mmu_virtual_psize; 167extern int mmu_virtual_psize;
168extern int mmu_vmalloc_psize;
169extern int mmu_io_psize;
170
171/*
172 * If the processor supports 64k normal pages but not 64k cache
173 * inhibited pages, we have to be prepared to switch processes
174 * to use 4k pages when they create cache-inhibited mappings.
175 * If this is the case, mmu_ci_restrictions will be set to 1.
176 */
177extern int mmu_ci_restrictions;
166 178
167#ifdef CONFIG_HUGETLB_PAGE 179#ifdef CONFIG_HUGETLB_PAGE
168/* 180/*
@@ -254,6 +266,7 @@ extern long iSeries_hpte_insert(unsigned long hpte_group,
254 266
255extern void stabs_alloc(void); 267extern void stabs_alloc(void);
256extern void slb_initialize(void); 268extern void slb_initialize(void);
269extern void slb_flush_and_rebolt(void);
257extern void stab_initialize(unsigned long stab); 270extern void stab_initialize(unsigned long stab);
258 271
259#endif /* __ASSEMBLY__ */ 272#endif /* __ASSEMBLY__ */
@@ -357,9 +370,12 @@ typedef unsigned long mm_context_id_t;
357 370
358typedef struct { 371typedef struct {
359 mm_context_id_t id; 372 mm_context_id_t id;
373 u16 user_psize; /* page size index */
374 u16 sllp; /* SLB entry page size encoding */
360#ifdef CONFIG_HUGETLB_PAGE 375#ifdef CONFIG_HUGETLB_PAGE
361 u16 low_htlb_areas, high_htlb_areas; 376 u16 low_htlb_areas, high_htlb_areas;
362#endif 377#endif
378 unsigned long vdso_base;
363} mm_context_t; 379} mm_context_t;
364 380
365 381
diff --git a/include/asm-powerpc/mmu_context.h b/include/asm-powerpc/mmu_context.h
index 1b8a25fd48f3..8c6b1a6d944f 100644
--- a/include/asm-powerpc/mmu_context.h
+++ b/include/asm-powerpc/mmu_context.h
@@ -20,16 +20,9 @@
20 * 2 of the License, or (at your option) any later version. 20 * 2 of the License, or (at your option) any later version.
21 */ 21 */
22 22
23/*
24 * Getting into a kernel thread, there is no valid user segment, mark
25 * paca->pgdir NULL so that SLB miss on user addresses will fault
26 */
27static inline void enter_lazy_tlb(struct mm_struct *mm, 23static inline void enter_lazy_tlb(struct mm_struct *mm,
28 struct task_struct *tsk) 24 struct task_struct *tsk)
29{ 25{
30#ifdef CONFIG_PPC_64K_PAGES
31 get_paca()->pgdir = NULL;
32#endif /* CONFIG_PPC_64K_PAGES */
33} 26}
34 27
35#define NO_CONTEXT 0 28#define NO_CONTEXT 0
@@ -52,13 +45,8 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
52 cpu_set(smp_processor_id(), next->cpu_vm_mask); 45 cpu_set(smp_processor_id(), next->cpu_vm_mask);
53 46
54 /* No need to flush userspace segments if the mm doesnt change */ 47 /* No need to flush userspace segments if the mm doesnt change */
55#ifdef CONFIG_PPC_64K_PAGES
56 if (prev == next && get_paca()->pgdir == next->pgd)
57 return;
58#else
59 if (prev == next) 48 if (prev == next)
60 return; 49 return;
61#endif /* CONFIG_PPC_64K_PAGES */
62 50
63#ifdef CONFIG_ALTIVEC 51#ifdef CONFIG_ALTIVEC
64 if (cpu_has_feature(CPU_FTR_ALTIVEC)) 52 if (cpu_has_feature(CPU_FTR_ALTIVEC))
diff --git a/include/asm-powerpc/mpc86xx.h b/include/asm-powerpc/mpc86xx.h
new file mode 100644
index 000000000000..d0a6718d188b
--- /dev/null
+++ b/include/asm-powerpc/mpc86xx.h
@@ -0,0 +1,47 @@
1/*
2 * MPC86xx definitions
3 *
4 * Author: Jeff Brown
5 *
6 * Copyright 2004 Freescale Semiconductor, Inc
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14#ifdef __KERNEL__
15#ifndef __ASM_POWERPC_MPC86xx_H__
16#define __ASM_POWERPC_MPC86xx_H__
17
18#include <linux/config.h>
19#include <asm/mmu.h>
20
21#ifdef CONFIG_PPC_86xx
22
23#ifdef CONFIG_MPC8641_HPCN
24#include <platforms/86xx/mpc8641_hpcn.h>
25#endif
26
27#define _IO_BASE isa_io_base
28#define _ISA_MEM_BASE isa_mem_base
29#ifdef CONFIG_PCI
30#define PCI_DRAM_OFFSET pci_dram_offset
31#else
32#define PCI_DRAM_OFFSET 0
33#endif
34
35#define CPU0_BOOT_RELEASE 0x01000000
36#define CPU1_BOOT_RELEASE 0x02000000
37#define CPU_ALL_RELEASED (CPU0_BOOT_RELEASE | CPU1_BOOT_RELEASE)
38#define MCM_PORT_CONFIG_OFFSET 0x1010
39
40/* Offset from CCSRBAR */
41#define MPC86xx_OPENPIC_OFFSET (0x40000)
42#define MPC86xx_MCM_OFFSET (0x00000)
43#define MPC86xx_MCM_SIZE (0x02000)
44
45#endif /* CONFIG_PPC_86xx */
46#endif /* __ASM_POWERPC_MPC86xx_H__ */
47#endif /* __KERNEL__ */
diff --git a/include/asm-powerpc/mpic.h b/include/asm-powerpc/mpic.h
index 6b9e78142f4f..f0d22ac34b96 100644
--- a/include/asm-powerpc/mpic.h
+++ b/include/asm-powerpc/mpic.h
@@ -22,6 +22,10 @@
22#define MPIC_GREG_GCONF_8259_PTHROU_DIS 0x20000000 22#define MPIC_GREG_GCONF_8259_PTHROU_DIS 0x20000000
23#define MPIC_GREG_GCONF_BASE_MASK 0x000fffff 23#define MPIC_GREG_GCONF_BASE_MASK 0x000fffff
24#define MPIC_GREG_GLOBAL_CONF_1 0x00030 24#define MPIC_GREG_GLOBAL_CONF_1 0x00030
25#define MPIC_GREG_GLOBAL_CONF_1_SIE 0x08000000
26#define MPIC_GREG_GLOBAL_CONF_1_CLK_RATIO_MASK 0x70000000
27#define MPIC_GREG_GLOBAL_CONF_1_CLK_RATIO(r) \
28 (((r) << 28) & MPIC_GREG_GLOBAL_CONF_1_CLK_RATIO_MASK)
25#define MPIC_GREG_VENDOR_0 0x00040 29#define MPIC_GREG_VENDOR_0 0x00040
26#define MPIC_GREG_VENDOR_1 0x00050 30#define MPIC_GREG_VENDOR_1 0x00050
27#define MPIC_GREG_VENDOR_2 0x00060 31#define MPIC_GREG_VENDOR_2 0x00060
@@ -284,6 +288,12 @@ extern int mpic_get_one_irq(struct mpic *mpic, struct pt_regs *regs);
284/* This one gets to the primary mpic */ 288/* This one gets to the primary mpic */
285extern int mpic_get_irq(struct pt_regs *regs); 289extern int mpic_get_irq(struct pt_regs *regs);
286 290
291/* Set the EPIC clock ratio */
292void mpic_set_clk_ratio(struct mpic *mpic, u32 clock_ratio);
293
294/* Enable/Disable EPIC serial interrupt mode */
295void mpic_set_serial_int(struct mpic *mpic, int enable);
296
287/* global mpic for pSeries */ 297/* global mpic for pSeries */
288extern struct mpic *pSeries_mpic; 298extern struct mpic *pSeries_mpic;
289 299
diff --git a/include/asm-powerpc/paca.h b/include/asm-powerpc/paca.h
index 3c6f644d49b4..2d4585f06209 100644
--- a/include/asm-powerpc/paca.h
+++ b/include/asm-powerpc/paca.h
@@ -78,11 +78,9 @@ struct paca_struct {
78 u64 exmc[10]; /* used for machine checks */ 78 u64 exmc[10]; /* used for machine checks */
79 u64 exslb[10]; /* used for SLB/segment table misses 79 u64 exslb[10]; /* used for SLB/segment table misses
80 * on the linear mapping */ 80 * on the linear mapping */
81#ifdef CONFIG_PPC_64K_PAGES
82 pgd_t *pgdir;
83#endif /* CONFIG_PPC_64K_PAGES */
84 81
85 mm_context_t context; 82 mm_context_t context;
83 u16 vmalloc_sllp;
86 u16 slb_cache[SLB_CACHE_ENTRIES]; 84 u16 slb_cache[SLB_CACHE_ENTRIES];
87 u16 slb_cache_ptr; 85 u16 slb_cache_ptr;
88 86
diff --git a/include/asm-powerpc/page.h b/include/asm-powerpc/page.h
index f0469b961359..fb597b37c2a2 100644
--- a/include/asm-powerpc/page.h
+++ b/include/asm-powerpc/page.h
@@ -12,6 +12,7 @@
12 12
13#ifdef __KERNEL__ 13#ifdef __KERNEL__
14#include <asm/asm-compat.h> 14#include <asm/asm-compat.h>
15#include <asm/kdump.h>
15 16
16/* 17/*
17 * On PPC32 page size is 4K. For PPC64 we support either 4K or 64K software 18 * On PPC32 page size is 4K. For PPC64 we support either 4K or 64K software
@@ -51,13 +52,6 @@
51 * If you want to test if something's a kernel address, use is_kernel_addr(). 52 * If you want to test if something's a kernel address, use is_kernel_addr().
52 */ 53 */
53 54
54#ifdef CONFIG_CRASH_DUMP
55/* Kdump kernel runs at 32 MB, change at your peril. */
56#define PHYSICAL_START 0x2000000
57#else
58#define PHYSICAL_START 0x0
59#endif
60
61#define PAGE_OFFSET ASM_CONST(CONFIG_KERNEL_START) 55#define PAGE_OFFSET ASM_CONST(CONFIG_KERNEL_START)
62#define KERNELBASE (PAGE_OFFSET + PHYSICAL_START) 56#define KERNELBASE (PAGE_OFFSET + PHYSICAL_START)
63 57
@@ -197,6 +191,9 @@ extern void copy_user_page(void *to, void *from, unsigned long vaddr,
197 struct page *p); 191 struct page *p);
198extern int page_is_ram(unsigned long pfn); 192extern int page_is_ram(unsigned long pfn);
199 193
194struct vm_area_struct;
195extern const char *arch_vma_name(struct vm_area_struct *vma);
196
200#include <asm-generic/memory_model.h> 197#include <asm-generic/memory_model.h>
201#endif /* __ASSEMBLY__ */ 198#endif /* __ASSEMBLY__ */
202 199
diff --git a/include/asm-powerpc/pci-bridge.h b/include/asm-powerpc/pci-bridge.h
index 38de92d41a14..4f55573762bb 100644
--- a/include/asm-powerpc/pci-bridge.h
+++ b/include/asm-powerpc/pci-bridge.h
@@ -6,6 +6,7 @@
6#include <asm-ppc/pci-bridge.h> 6#include <asm-ppc/pci-bridge.h>
7#else 7#else
8 8
9#include <linux/config.h>
9#include <linux/pci.h> 10#include <linux/pci.h>
10#include <linux/list.h> 11#include <linux/list.h>
11 12
@@ -22,6 +23,7 @@
22struct pci_controller { 23struct pci_controller {
23 struct pci_bus *bus; 24 struct pci_bus *bus;
24 char is_dynamic; 25 char is_dynamic;
26 int node;
25 void *arch_data; 27 void *arch_data;
26 struct list_head list_node; 28 struct list_head list_node;
27 29
@@ -78,12 +80,6 @@ struct pci_dn {
78 struct iommu_table *iommu_table; /* for phb's or bridges */ 80 struct iommu_table *iommu_table; /* for phb's or bridges */
79 struct pci_dev *pcidev; /* back-pointer to the pci device */ 81 struct pci_dev *pcidev; /* back-pointer to the pci device */
80 struct device_node *node; /* back-pointer to the device_node */ 82 struct device_node *node; /* back-pointer to the device_node */
81#ifdef CONFIG_PPC_ISERIES
82 struct list_head Device_List;
83 int Irq; /* Assigned IRQ */
84 int Flags; /* Possible flags(disable/bist)*/
85 u8 LogicalSlot; /* Hv Slot Index for Tces */
86#endif
87 u32 config_space[16]; /* saved PCI config space */ 83 u32 config_space[16]; /* saved PCI config space */
88}; 84};
89 85
@@ -171,6 +167,12 @@ static inline unsigned long pci_address_to_pio(phys_addr_t address)
171#define PCI_PROBE_NORMAL 0 /* Do normal PCI probing */ 167#define PCI_PROBE_NORMAL 0 /* Do normal PCI probing */
172#define PCI_PROBE_DEVTREE 1 /* Instantiate from device tree */ 168#define PCI_PROBE_DEVTREE 1 /* Instantiate from device tree */
173 169
170#ifdef CONFIG_NUMA
171#define PHB_SET_NODE(PHB, NODE) ((PHB)->node = (NODE))
172#else
173#define PHB_SET_NODE(PHB, NODE) ((PHB)->node = -1)
174#endif
175
174#endif /* CONFIG_PPC64 */ 176#endif /* CONFIG_PPC64 */
175#endif /* __KERNEL__ */ 177#endif /* __KERNEL__ */
176#endif 178#endif
diff --git a/include/asm-powerpc/percpu.h b/include/asm-powerpc/percpu.h
index 184a7a4d2fdf..faa1fc703053 100644
--- a/include/asm-powerpc/percpu.h
+++ b/include/asm-powerpc/percpu.h
@@ -22,6 +22,7 @@
22/* var is in discarded region: offset to particular copy we want */ 22/* var is in discarded region: offset to particular copy we want */
23#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu))) 23#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu)))
24#define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __my_cpu_offset())) 24#define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __my_cpu_offset()))
25#define __raw_get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __my_cpu_offset()))
25 26
26/* A macro to avoid #include hell... */ 27/* A macro to avoid #include hell... */
27#define percpu_modcopy(pcpudst, src, size) \ 28#define percpu_modcopy(pcpudst, src, size) \
@@ -41,6 +42,7 @@ extern void setup_per_cpu_areas(void);
41 42
42#define per_cpu(var, cpu) (*((void)(cpu), &per_cpu__##var)) 43#define per_cpu(var, cpu) (*((void)(cpu), &per_cpu__##var))
43#define __get_cpu_var(var) per_cpu__##var 44#define __get_cpu_var(var) per_cpu__##var
45#define __raw_get_cpu_var(var) per_cpu__##var
44 46
45#endif /* SMP */ 47#endif /* SMP */
46 48
diff --git a/include/asm-powerpc/pgtable-4k.h b/include/asm-powerpc/pgtable-4k.h
index b2e18629932a..e7036155672e 100644
--- a/include/asm-powerpc/pgtable-4k.h
+++ b/include/asm-powerpc/pgtable-4k.h
@@ -78,6 +78,8 @@
78 78
79#define pte_iterate_hashed_end() } while(0) 79#define pte_iterate_hashed_end() } while(0)
80 80
81#define pte_pagesize_index(pte) MMU_PAGE_4K
82
81/* 83/*
82 * 4-level page tables related bits 84 * 4-level page tables related bits
83 */ 85 */
diff --git a/include/asm-powerpc/pgtable-64k.h b/include/asm-powerpc/pgtable-64k.h
index 653915014dcd..4b7126c53f37 100644
--- a/include/asm-powerpc/pgtable-64k.h
+++ b/include/asm-powerpc/pgtable-64k.h
@@ -90,6 +90,8 @@
90 90
91#define pte_iterate_hashed_end() } while(0); } } while(0) 91#define pte_iterate_hashed_end() } while(0); } } while(0)
92 92
93#define pte_pagesize_index(pte) \
94 (((pte) & _PAGE_COMBO)? MMU_PAGE_4K: MMU_PAGE_64K)
93 95
94#endif /* __ASSEMBLY__ */ 96#endif /* __ASSEMBLY__ */
95#endif /* __KERNEL__ */ 97#endif /* __KERNEL__ */
diff --git a/include/asm-powerpc/pgtable.h b/include/asm-powerpc/pgtable.h
index 964e312a1ffc..8dbf5ad8150f 100644
--- a/include/asm-powerpc/pgtable.h
+++ b/include/asm-powerpc/pgtable.h
@@ -46,8 +46,8 @@ struct mm_struct;
46/* 46/*
47 * Define the address range of the vmalloc VM area. 47 * Define the address range of the vmalloc VM area.
48 */ 48 */
49#define VMALLOC_START (0xD000000000000000ul) 49#define VMALLOC_START ASM_CONST(0xD000000000000000)
50#define VMALLOC_SIZE (0x80000000000UL) 50#define VMALLOC_SIZE ASM_CONST(0x80000000000)
51#define VMALLOC_END (VMALLOC_START + VMALLOC_SIZE) 51#define VMALLOC_END (VMALLOC_START + VMALLOC_SIZE)
52 52
53/* 53/*
@@ -412,12 +412,6 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
412 flush_tlb_pending(); 412 flush_tlb_pending();
413 } 413 }
414 pte = __pte(pte_val(pte) & ~_PAGE_HPTEFLAGS); 414 pte = __pte(pte_val(pte) & ~_PAGE_HPTEFLAGS);
415
416#ifdef CONFIG_PPC_64K_PAGES
417 if (mmu_virtual_psize != MMU_PAGE_64K)
418 pte = __pte(pte_val(pte) | _PAGE_COMBO);
419#endif /* CONFIG_PPC_64K_PAGES */
420
421 *ptep = pte; 415 *ptep = pte;
422} 416}
423 417
diff --git a/include/asm-powerpc/processor.h b/include/asm-powerpc/processor.h
index 93f83efeb310..22e54a2a6604 100644
--- a/include/asm-powerpc/processor.h
+++ b/include/asm-powerpc/processor.h
@@ -149,11 +149,11 @@ struct thread_struct {
149 unsigned int val; /* Floating point status */ 149 unsigned int val; /* Floating point status */
150 } fpscr; 150 } fpscr;
151 int fpexc_mode; /* floating-point exception mode */ 151 int fpexc_mode; /* floating-point exception mode */
152 unsigned int align_ctl; /* alignment handling control */
152#ifdef CONFIG_PPC64 153#ifdef CONFIG_PPC64
153 unsigned long start_tb; /* Start purr when proc switched in */ 154 unsigned long start_tb; /* Start purr when proc switched in */
154 unsigned long accum_tb; /* Total accumilated purr for process */ 155 unsigned long accum_tb; /* Total accumilated purr for process */
155#endif 156#endif
156 unsigned long vdso_base; /* base of the vDSO library */
157 unsigned long dabr; /* Data address breakpoint register */ 157 unsigned long dabr; /* Data address breakpoint register */
158#ifdef CONFIG_ALTIVEC 158#ifdef CONFIG_ALTIVEC
159 /* Complete AltiVec register set */ 159 /* Complete AltiVec register set */
@@ -190,7 +190,7 @@ struct thread_struct {
190 .fs = KERNEL_DS, \ 190 .fs = KERNEL_DS, \
191 .fpr = {0}, \ 191 .fpr = {0}, \
192 .fpscr = { .val = 0, }, \ 192 .fpscr = { .val = 0, }, \
193 .fpexc_mode = MSR_FE0|MSR_FE1, \ 193 .fpexc_mode = 0, \
194} 194}
195#endif 195#endif
196 196
@@ -212,6 +212,18 @@ unsigned long get_wchan(struct task_struct *p);
212extern int get_fpexc_mode(struct task_struct *tsk, unsigned long adr); 212extern int get_fpexc_mode(struct task_struct *tsk, unsigned long adr);
213extern int set_fpexc_mode(struct task_struct *tsk, unsigned int val); 213extern int set_fpexc_mode(struct task_struct *tsk, unsigned int val);
214 214
215#define GET_ENDIAN(tsk, adr) get_endian((tsk), (adr))
216#define SET_ENDIAN(tsk, val) set_endian((tsk), (val))
217
218extern int get_endian(struct task_struct *tsk, unsigned long adr);
219extern int set_endian(struct task_struct *tsk, unsigned int val);
220
221#define GET_UNALIGN_CTL(tsk, adr) get_unalign_ctl((tsk), (adr))
222#define SET_UNALIGN_CTL(tsk, val) set_unalign_ctl((tsk), (val))
223
224extern int get_unalign_ctl(struct task_struct *tsk, unsigned long adr);
225extern int set_unalign_ctl(struct task_struct *tsk, unsigned int val);
226
215static inline unsigned int __unpack_fe01(unsigned long msr_bits) 227static inline unsigned int __unpack_fe01(unsigned long msr_bits)
216{ 228{
217 return ((msr_bits & MSR_FE0) >> 10) | ((msr_bits & MSR_FE1) >> 8); 229 return ((msr_bits & MSR_FE0) >> 10) | ((msr_bits & MSR_FE1) >> 8);
diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h
index f4e2ca6fd53f..010d186d095b 100644
--- a/include/asm-powerpc/prom.h
+++ b/include/asm-powerpc/prom.h
@@ -229,7 +229,16 @@ extern int of_address_to_resource(struct device_node *dev, int index,
229extern int of_pci_address_to_resource(struct device_node *dev, int bar, 229extern int of_pci_address_to_resource(struct device_node *dev, int bar,
230 struct resource *r); 230 struct resource *r);
231 231
232/* Parse the ibm,dma-window property of an OF node into the busno, phys and
233 * size parameters.
234 */
235void of_parse_dma_window(struct device_node *dn, unsigned char *dma_window_prop,
236 unsigned long *busno, unsigned long *phys, unsigned long *size);
237
232extern void kdump_move_device_tree(void); 238extern void kdump_move_device_tree(void);
233 239
240/* CPU OF node matching */
241struct device_node *of_get_cpu_node(int cpu, unsigned int *thread);
242
234#endif /* __KERNEL__ */ 243#endif /* __KERNEL__ */
235#endif /* _POWERPC_PROM_H */ 244#endif /* _POWERPC_PROM_H */
diff --git a/include/asm-powerpc/ptrace.h b/include/asm-powerpc/ptrace.h
index 9c550b314823..dc4cb9cc73a1 100644
--- a/include/asm-powerpc/ptrace.h
+++ b/include/asm-powerpc/ptrace.h
@@ -229,13 +229,13 @@ do { \
229#define PTRACE_GET_DEBUGREG 25 229#define PTRACE_GET_DEBUGREG 25
230#define PTRACE_SET_DEBUGREG 26 230#define PTRACE_SET_DEBUGREG 26
231 231
232#ifdef __powerpc64__
233/* Additional PTRACE requests implemented on PowerPC. */ 232/* Additional PTRACE requests implemented on PowerPC. */
234#define PPC_PTRACE_GETREGS 0x99 /* Get GPRs 0 - 31 */ 233#define PPC_PTRACE_GETREGS 0x99 /* Get GPRs 0 - 31 */
235#define PPC_PTRACE_SETREGS 0x98 /* Set GPRs 0 - 31 */ 234#define PPC_PTRACE_SETREGS 0x98 /* Set GPRs 0 - 31 */
236#define PPC_PTRACE_GETFPREGS 0x97 /* Get FPRs 0 - 31 */ 235#define PPC_PTRACE_GETFPREGS 0x97 /* Get FPRs 0 - 31 */
237#define PPC_PTRACE_SETFPREGS 0x96 /* Set FPRs 0 - 31 */ 236#define PPC_PTRACE_SETFPREGS 0x96 /* Set FPRs 0 - 31 */
238 237
238#ifdef __powerpc64__
239/* Calls to trace a 64bit program from a 32bit program */ 239/* Calls to trace a 64bit program from a 32bit program */
240#define PPC_PTRACE_PEEKTEXT_3264 0x95 240#define PPC_PTRACE_PEEKTEXT_3264 0x95
241#define PPC_PTRACE_PEEKDATA_3264 0x94 241#define PPC_PTRACE_PEEKDATA_3264 0x94
diff --git a/include/asm-powerpc/reg.h b/include/asm-powerpc/reg.h
index bd467bf5cf5a..cf73475a0c69 100644
--- a/include/asm-powerpc/reg.h
+++ b/include/asm-powerpc/reg.h
@@ -93,8 +93,8 @@
93#define MSR_LE __MASK(MSR_LE_LG) /* Little Endian */ 93#define MSR_LE __MASK(MSR_LE_LG) /* Little Endian */
94 94
95#ifdef CONFIG_PPC64 95#ifdef CONFIG_PPC64
96#define MSR_ MSR_ME | MSR_RI | MSR_IR | MSR_DR | MSR_ISF 96#define MSR_ MSR_ME | MSR_RI | MSR_IR | MSR_DR | MSR_ISF |MSR_HV
97#define MSR_KERNEL MSR_ | MSR_SF | MSR_HV 97#define MSR_KERNEL MSR_ | MSR_SF
98 98
99#define MSR_USER32 MSR_ | MSR_PR | MSR_EE 99#define MSR_USER32 MSR_ | MSR_PR | MSR_EE
100#define MSR_USER64 MSR_USER32 | MSR_SF 100#define MSR_USER64 MSR_USER32 | MSR_SF
@@ -153,7 +153,7 @@
153#define SPRN_DABR 0x3F5 /* Data Address Breakpoint Register */ 153#define SPRN_DABR 0x3F5 /* Data Address Breakpoint Register */
154#define DABR_TRANSLATION (1UL << 2) 154#define DABR_TRANSLATION (1UL << 2)
155#define SPRN_DAR 0x013 /* Data Address Register */ 155#define SPRN_DAR 0x013 /* Data Address Register */
156#define SPRN_DSISR 0x012 /* Data Storage Interrupt Status Register */ 156#define SPRN_DSISR 0x012 /* Data Storage Interrupt Status Register */
157#define DSISR_NOHPTE 0x40000000 /* no translation found */ 157#define DSISR_NOHPTE 0x40000000 /* no translation found */
158#define DSISR_PROTFAULT 0x08000000 /* protection fault */ 158#define DSISR_PROTFAULT 0x08000000 /* protection fault */
159#define DSISR_ISSTORE 0x02000000 /* access was a store */ 159#define DSISR_ISSTORE 0x02000000 /* access was a store */
@@ -258,16 +258,16 @@
258#define SPRN_IABR 0x3F2 /* Instruction Address Breakpoint Register */ 258#define SPRN_IABR 0x3F2 /* Instruction Address Breakpoint Register */
259#define SPRN_HID4 0x3F4 /* 970 HID4 */ 259#define SPRN_HID4 0x3F4 /* 970 HID4 */
260#define SPRN_HID5 0x3F6 /* 970 HID5 */ 260#define SPRN_HID5 0x3F6 /* 970 HID5 */
261#define SPRN_HID6 0x3F9 /* BE HID 6 */ 261#define SPRN_HID6 0x3F9 /* BE HID 6 */
262#define HID6_LB (0x0F<<12) /* Concurrent Large Page Modes */ 262#define HID6_LB (0x0F<<12) /* Concurrent Large Page Modes */
263#define HID6_DLP (1<<20) /* Disable all large page modes (4K only) */ 263#define HID6_DLP (1<<20) /* Disable all large page modes (4K only) */
264#define SPRN_TSC_CELL 0x399 /* Thread switch control on Cell */ 264#define SPRN_TSC_CELL 0x399 /* Thread switch control on Cell */
265#define TSC_CELL_DEC_ENABLE_0 0x400000 /* Decrementer Interrupt */ 265#define TSC_CELL_DEC_ENABLE_0 0x400000 /* Decrementer Interrupt */
266#define TSC_CELL_DEC_ENABLE_1 0x200000 /* Decrementer Interrupt */ 266#define TSC_CELL_DEC_ENABLE_1 0x200000 /* Decrementer Interrupt */
267#define TSC_CELL_EE_ENABLE 0x100000 /* External Interrupt */ 267#define TSC_CELL_EE_ENABLE 0x100000 /* External Interrupt */
268#define TSC_CELL_EE_BOOST 0x080000 /* External Interrupt Boost */ 268#define TSC_CELL_EE_BOOST 0x080000 /* External Interrupt Boost */
269#define SPRN_TSC 0x3FD /* Thread switch control on others */ 269#define SPRN_TSC 0x3FD /* Thread switch control on others */
270#define SPRN_TST 0x3FC /* Thread switch timeout on others */ 270#define SPRN_TST 0x3FC /* Thread switch timeout on others */
271#if !defined(SPRN_IAC1) && !defined(SPRN_IAC2) 271#if !defined(SPRN_IAC1) && !defined(SPRN_IAC2)
272#define SPRN_IAC1 0x3F4 /* Instruction Address Compare 1 */ 272#define SPRN_IAC1 0x3F4 /* Instruction Address Compare 1 */
273#define SPRN_IAC2 0x3F5 /* Instruction Address Compare 2 */ 273#define SPRN_IAC2 0x3F5 /* Instruction Address Compare 2 */
@@ -362,7 +362,7 @@
362#endif 362#endif
363#define SPRN_PTEHI 0x3D5 /* 981 7450 PTE HI word (S/W TLB load) */ 363#define SPRN_PTEHI 0x3D5 /* 981 7450 PTE HI word (S/W TLB load) */
364#define SPRN_PTELO 0x3D6 /* 982 7450 PTE LO word (S/W TLB load) */ 364#define SPRN_PTELO 0x3D6 /* 982 7450 PTE LO word (S/W TLB load) */
365#define SPRN_PURR 0x135 /* Processor Utilization of Resources Reg */ 365#define SPRN_PURR 0x135 /* Processor Utilization of Resources Reg */
366#define SPRN_PVR 0x11F /* Processor Version Register */ 366#define SPRN_PVR 0x11F /* Processor Version Register */
367#define SPRN_RPA 0x3D6 /* Required Physical Address Register */ 367#define SPRN_RPA 0x3D6 /* Required Physical Address Register */
368#define SPRN_SDA 0x3BF /* Sampled Data Address Register */ 368#define SPRN_SDA 0x3BF /* Sampled Data Address Register */
@@ -386,6 +386,8 @@
386#define SRR1_WAKEMT 0x00280000 /* mtctrl */ 386#define SRR1_WAKEMT 0x00280000 /* mtctrl */
387#define SRR1_WAKEDEC 0x00180000 /* Decrementer interrupt */ 387#define SRR1_WAKEDEC 0x00180000 /* Decrementer interrupt */
388#define SRR1_WAKETHERM 0x00100000 /* Thermal management interrupt */ 388#define SRR1_WAKETHERM 0x00100000 /* Thermal management interrupt */
389#define SPRN_HSRR0 0x13A /* Save/Restore Register 0 */
390#define SPRN_HSRR1 0x13B /* Save/Restore Register 1 */
389 391
390#ifndef SPRN_SVR 392#ifndef SPRN_SVR
391#define SPRN_SVR 0x11E /* System Version Register */ 393#define SPRN_SVR 0x11E /* System Version Register */
@@ -443,6 +445,10 @@
443#define MMCRA_SIHV 0x10000000UL /* state of MSR HV when SIAR set */ 445#define MMCRA_SIHV 0x10000000UL /* state of MSR HV when SIAR set */
444#define MMCRA_SIPR 0x08000000UL /* state of MSR PR when SIAR set */ 446#define MMCRA_SIPR 0x08000000UL /* state of MSR PR when SIAR set */
445#define MMCRA_SAMPLE_ENABLE 0x00000001UL /* enable sampling */ 447#define MMCRA_SAMPLE_ENABLE 0x00000001UL /* enable sampling */
448#define POWER6_MMCRA_SIHV 0x0000040000000000ULL
449#define POWER6_MMCRA_SIPR 0x0000020000000000ULL
450#define POWER6_MMCRA_THRM 0x00000020UL
451#define POWER6_MMCRA_OTHER 0x0000000EUL
446#define SPRN_PMC1 787 452#define SPRN_PMC1 787
447#define SPRN_PMC2 788 453#define SPRN_PMC2 788
448#define SPRN_PMC3 789 454#define SPRN_PMC3 789
@@ -495,6 +501,19 @@
495#define MMCR0_PMC2_LOADMISSTIME 0x5 501#define MMCR0_PMC2_LOADMISSTIME 0x5
496#endif 502#endif
497 503
504/*
505 * An mtfsf instruction with the L bit set. On CPUs that support this a
506 * full 64bits of FPSCR is restored and on other CPUs it is ignored.
507 *
508 * Until binutils gets the new form of mtfsf, hardwire the instruction.
509 */
510#ifdef CONFIG_PPC64
511#define MTFSF_L(REG) \
512 .long (0xfc00058e | ((0xff) << 17) | ((REG) << 11) | (1 << 25))
513#else
514#define MTFSF_L(REG) mtfsf 0xff, (REG)
515#endif
516
498/* Processor Version Register (PVR) field extraction */ 517/* Processor Version Register (PVR) field extraction */
499 518
500#define PVR_VER(pvr) (((pvr) >> 16) & 0xFFFF) /* Version field */ 519#define PVR_VER(pvr) (((pvr) >> 16) & 0xFFFF) /* Version field */
@@ -559,20 +578,20 @@
559 578
560/* 64-bit processors */ 579/* 64-bit processors */
561/* XXX the prefix should be PVR_, we'll do a global sweep to fix it one day */ 580/* XXX the prefix should be PVR_, we'll do a global sweep to fix it one day */
562#define PV_NORTHSTAR 0x0033 581#define PV_NORTHSTAR 0x0033
563#define PV_PULSAR 0x0034 582#define PV_PULSAR 0x0034
564#define PV_POWER4 0x0035 583#define PV_POWER4 0x0035
565#define PV_ICESTAR 0x0036 584#define PV_ICESTAR 0x0036
566#define PV_SSTAR 0x0037 585#define PV_SSTAR 0x0037
567#define PV_POWER4p 0x0038 586#define PV_POWER4p 0x0038
568#define PV_970 0x0039 587#define PV_970 0x0039
569#define PV_POWER5 0x003A 588#define PV_POWER5 0x003A
570#define PV_POWER5p 0x003B 589#define PV_POWER5p 0x003B
571#define PV_970FX 0x003C 590#define PV_970FX 0x003C
572#define PV_630 0x0040 591#define PV_630 0x0040
573#define PV_630p 0x0041 592#define PV_630p 0x0041
574#define PV_970MP 0x0044 593#define PV_970MP 0x0044
575#define PV_BE 0x0070 594#define PV_BE 0x0070
576 595
577/* 596/*
578 * Number of entries in the SLB. If this ever changes we should handle 597 * Number of entries in the SLB. If this ever changes we should handle
diff --git a/include/asm-powerpc/rtas.h b/include/asm-powerpc/rtas.h
index f43c6835e62a..02e213e3d69f 100644
--- a/include/asm-powerpc/rtas.h
+++ b/include/asm-powerpc/rtas.h
@@ -24,6 +24,7 @@
24#define RTAS_RMOBUF_MAX (64 * 1024) 24#define RTAS_RMOBUF_MAX (64 * 1024)
25 25
26/* RTAS return status codes */ 26/* RTAS return status codes */
27#define RTAS_NOT_SUSPENDABLE -9004
27#define RTAS_BUSY -2 /* RTAS Busy */ 28#define RTAS_BUSY -2 /* RTAS Busy */
28#define RTAS_EXTENDED_DELAY_MIN 9900 29#define RTAS_EXTENDED_DELAY_MIN 9900
29#define RTAS_EXTENDED_DELAY_MAX 9905 30#define RTAS_EXTENDED_DELAY_MAX 9905
@@ -177,12 +178,8 @@ extern unsigned long rtas_get_boot_time(void);
177extern void rtas_get_rtc_time(struct rtc_time *rtc_time); 178extern void rtas_get_rtc_time(struct rtc_time *rtc_time);
178extern int rtas_set_rtc_time(struct rtc_time *rtc_time); 179extern int rtas_set_rtc_time(struct rtc_time *rtc_time);
179 180
180/* Given an RTAS status code of 9900..9905 compute the hinted delay */ 181extern unsigned int rtas_busy_delay_time(int status);
181unsigned int rtas_extended_busy_delay_time(int status); 182extern unsigned int rtas_busy_delay(int status);
182static inline int rtas_is_extended_busy(int status)
183{
184 return status >= 9900 && status <= 9909;
185}
186 183
187extern void pSeries_log_error(char *buf, unsigned int err_type, int fatal); 184extern void pSeries_log_error(char *buf, unsigned int err_type, int fatal);
188 185
diff --git a/include/asm-powerpc/spu.h b/include/asm-powerpc/spu.h
index 95713f397357..9609d3ee8798 100644
--- a/include/asm-powerpc/spu.h
+++ b/include/asm-powerpc/spu.h
@@ -24,8 +24,8 @@
24#define _SPU_H 24#define _SPU_H
25#ifdef __KERNEL__ 25#ifdef __KERNEL__
26 26
27#include <linux/kref.h>
28#include <linux/workqueue.h> 27#include <linux/workqueue.h>
28#include <linux/sysdev.h>
29 29
30#define LS_SIZE (256 * 1024) 30#define LS_SIZE (256 * 1024)
31#define LS_ADDR_MASK (LS_SIZE - 1) 31#define LS_ADDR_MASK (LS_SIZE - 1)
@@ -122,7 +122,6 @@ struct spu {
122 u64 flags; 122 u64 flags;
123 u64 dar; 123 u64 dar;
124 u64 dsisr; 124 u64 dsisr;
125 struct kref kref;
126 size_t ls_size; 125 size_t ls_size;
127 unsigned int slb_replace; 126 unsigned int slb_replace;
128 struct mm_struct *mm; 127 struct mm_struct *mm;
@@ -134,7 +133,6 @@ struct spu {
134 int class_0_pending; 133 int class_0_pending;
135 spinlock_t register_lock; 134 spinlock_t register_lock;
136 135
137 u32 stop_code;
138 void (* wbox_callback)(struct spu *spu); 136 void (* wbox_callback)(struct spu *spu);
139 void (* ibox_callback)(struct spu *spu); 137 void (* ibox_callback)(struct spu *spu);
140 void (* stop_callback)(struct spu *spu); 138 void (* stop_callback)(struct spu *spu);
@@ -143,6 +141,8 @@ struct spu {
143 char irq_c0[8]; 141 char irq_c0[8];
144 char irq_c1[8]; 142 char irq_c1[8];
145 char irq_c2[8]; 143 char irq_c2[8];
144
145 struct sys_device sysdev;
146}; 146};
147 147
148struct spu *spu_alloc(void); 148struct spu *spu_alloc(void);
@@ -181,29 +181,6 @@ static inline void unregister_spu_syscalls(struct spufs_calls *calls)
181#endif /* MODULE */ 181#endif /* MODULE */
182 182
183 183
184/* access to priv1 registers */
185void spu_int_mask_and(struct spu *spu, int class, u64 mask);
186void spu_int_mask_or(struct spu *spu, int class, u64 mask);
187void spu_int_mask_set(struct spu *spu, int class, u64 mask);
188u64 spu_int_mask_get(struct spu *spu, int class);
189void spu_int_stat_clear(struct spu *spu, int class, u64 stat);
190u64 spu_int_stat_get(struct spu *spu, int class);
191void spu_int_route_set(struct spu *spu, u64 route);
192u64 spu_mfc_dar_get(struct spu *spu);
193u64 spu_mfc_dsisr_get(struct spu *spu);
194void spu_mfc_dsisr_set(struct spu *spu, u64 dsisr);
195void spu_mfc_sdr_set(struct spu *spu, u64 sdr);
196void spu_mfc_sr1_set(struct spu *spu, u64 sr1);
197u64 spu_mfc_sr1_get(struct spu *spu);
198void spu_mfc_tclass_id_set(struct spu *spu, u64 tclass_id);
199u64 spu_mfc_tclass_id_get(struct spu *spu);
200void spu_tlb_invalidate(struct spu *spu);
201void spu_resource_allocation_groupID_set(struct spu *spu, u64 id);
202u64 spu_resource_allocation_groupID_get(struct spu *spu);
203void spu_resource_allocation_enable_set(struct spu *spu, u64 enable);
204u64 spu_resource_allocation_enable_get(struct spu *spu);
205
206
207/* 184/*
208 * This defines the Local Store, Problem Area and Privlege Area of an SPU. 185 * This defines the Local Store, Problem Area and Privlege Area of an SPU.
209 */ 186 */
diff --git a/include/asm-powerpc/spu_csa.h b/include/asm-powerpc/spu_csa.h
index ba18d7d4dde2..964c2d38ccb7 100644
--- a/include/asm-powerpc/spu_csa.h
+++ b/include/asm-powerpc/spu_csa.h
@@ -86,10 +86,18 @@ struct spu_lscsa {
86 struct spu_reg128 event_mask; 86 struct spu_reg128 event_mask;
87 struct spu_reg128 srr0; 87 struct spu_reg128 srr0;
88 struct spu_reg128 stopped_status; 88 struct spu_reg128 stopped_status;
89 struct spu_reg128 pad[119]; /* 'ls' must be page-aligned. */ 89
90 unsigned char ls[LS_SIZE]; 90 /*
91 * 'ls' must be page-aligned on all configurations.
92 * Since we don't want to rely on having the spu-gcc
93 * installed to build the kernel and this structure
94 * is used in the SPU-side code, make it 64k-page
95 * aligned for now.
96 */
97 unsigned char ls[LS_SIZE] __attribute__((aligned(65536)));
91}; 98};
92 99
100#ifndef __SPU__
93/* 101/*
94 * struct spu_problem_collapsed - condensed problem state area, w/o pads. 102 * struct spu_problem_collapsed - condensed problem state area, w/o pads.
95 */ 103 */
@@ -250,6 +258,7 @@ extern int spu_restore(struct spu_state *new, struct spu *spu);
250extern int spu_switch(struct spu_state *prev, struct spu_state *new, 258extern int spu_switch(struct spu_state *prev, struct spu_state *new,
251 struct spu *spu); 259 struct spu *spu);
252 260
261#endif /* !__SPU__ */
253#endif /* __KERNEL__ */ 262#endif /* __KERNEL__ */
254#endif /* !__ASSEMBLY__ */ 263#endif /* !__ASSEMBLY__ */
255#endif /* _SPU_CSA_H_ */ 264#endif /* _SPU_CSA_H_ */
diff --git a/include/asm-powerpc/spu_priv1.h b/include/asm-powerpc/spu_priv1.h
new file mode 100644
index 000000000000..300c458b6d06
--- /dev/null
+++ b/include/asm-powerpc/spu_priv1.h
@@ -0,0 +1,182 @@
1/*
2 * Defines an spu hypervisor abstraction layer.
3 *
4 * Copyright 2006 Sony Corp.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#if !defined(_SPU_PRIV1_H)
21#define _SPU_PRIV1_H
22#if defined(__KERNEL__)
23
24struct spu;
25
26/* access to priv1 registers */
27
28struct spu_priv1_ops
29{
30 void (*int_mask_and) (struct spu *spu, int class, u64 mask);
31 void (*int_mask_or) (struct spu *spu, int class, u64 mask);
32 void (*int_mask_set) (struct spu *spu, int class, u64 mask);
33 u64 (*int_mask_get) (struct spu *spu, int class);
34 void (*int_stat_clear) (struct spu *spu, int class, u64 stat);
35 u64 (*int_stat_get) (struct spu *spu, int class);
36 void (*cpu_affinity_set) (struct spu *spu, int cpu);
37 u64 (*mfc_dar_get) (struct spu *spu);
38 u64 (*mfc_dsisr_get) (struct spu *spu);
39 void (*mfc_dsisr_set) (struct spu *spu, u64 dsisr);
40 void (*mfc_sdr_set) (struct spu *spu, u64 sdr);
41 void (*mfc_sr1_set) (struct spu *spu, u64 sr1);
42 u64 (*mfc_sr1_get) (struct spu *spu);
43 void (*mfc_tclass_id_set) (struct spu *spu, u64 tclass_id);
44 u64 (*mfc_tclass_id_get) (struct spu *spu);
45 void (*tlb_invalidate) (struct spu *spu);
46 void (*resource_allocation_groupID_set) (struct spu *spu, u64 id);
47 u64 (*resource_allocation_groupID_get) (struct spu *spu);
48 void (*resource_allocation_enable_set) (struct spu *spu, u64 enable);
49 u64 (*resource_allocation_enable_get) (struct spu *spu);
50};
51
52extern const struct spu_priv1_ops* spu_priv1_ops;
53
54static inline void
55spu_int_mask_and (struct spu *spu, int class, u64 mask)
56{
57 spu_priv1_ops->int_mask_and(spu, class, mask);
58}
59
60static inline void
61spu_int_mask_or (struct spu *spu, int class, u64 mask)
62{
63 spu_priv1_ops->int_mask_or(spu, class, mask);
64}
65
66static inline void
67spu_int_mask_set (struct spu *spu, int class, u64 mask)
68{
69 spu_priv1_ops->int_mask_set(spu, class, mask);
70}
71
72static inline u64
73spu_int_mask_get (struct spu *spu, int class)
74{
75 return spu_priv1_ops->int_mask_get(spu, class);
76}
77
78static inline void
79spu_int_stat_clear (struct spu *spu, int class, u64 stat)
80{
81 spu_priv1_ops->int_stat_clear(spu, class, stat);
82}
83
84static inline u64
85spu_int_stat_get (struct spu *spu, int class)
86{
87 return spu_priv1_ops->int_stat_get (spu, class);
88}
89
90static inline void
91spu_cpu_affinity_set (struct spu *spu, int cpu)
92{
93 spu_priv1_ops->cpu_affinity_set(spu, cpu);
94}
95
96static inline u64
97spu_mfc_dar_get (struct spu *spu)
98{
99 return spu_priv1_ops->mfc_dar_get(spu);
100}
101
102static inline u64
103spu_mfc_dsisr_get (struct spu *spu)
104{
105 return spu_priv1_ops->mfc_dsisr_get(spu);
106}
107
108static inline void
109spu_mfc_dsisr_set (struct spu *spu, u64 dsisr)
110{
111 spu_priv1_ops->mfc_dsisr_set(spu, dsisr);
112}
113
114static inline void
115spu_mfc_sdr_set (struct spu *spu, u64 sdr)
116{
117 spu_priv1_ops->mfc_sdr_set(spu, sdr);
118}
119
120static inline void
121spu_mfc_sr1_set (struct spu *spu, u64 sr1)
122{
123 spu_priv1_ops->mfc_sr1_set(spu, sr1);
124}
125
126static inline u64
127spu_mfc_sr1_get (struct spu *spu)
128{
129 return spu_priv1_ops->mfc_sr1_get(spu);
130}
131
132static inline void
133spu_mfc_tclass_id_set (struct spu *spu, u64 tclass_id)
134{
135 spu_priv1_ops->mfc_tclass_id_set(spu, tclass_id);
136}
137
138static inline u64
139spu_mfc_tclass_id_get (struct spu *spu)
140{
141 return spu_priv1_ops->mfc_tclass_id_get(spu);
142}
143
144static inline void
145spu_tlb_invalidate (struct spu *spu)
146{
147 spu_priv1_ops->tlb_invalidate(spu);
148}
149
150static inline void
151spu_resource_allocation_groupID_set (struct spu *spu, u64 id)
152{
153 spu_priv1_ops->resource_allocation_groupID_set(spu, id);
154}
155
156static inline u64
157spu_resource_allocation_groupID_get (struct spu *spu)
158{
159 return spu_priv1_ops->resource_allocation_groupID_get(spu);
160}
161
162static inline void
163spu_resource_allocation_enable_set (struct spu *spu, u64 enable)
164{
165 spu_priv1_ops->resource_allocation_enable_set(spu, enable);
166}
167
168static inline u64
169spu_resource_allocation_enable_get (struct spu *spu)
170{
171 return spu_priv1_ops->resource_allocation_enable_get(spu);
172}
173
174/* The declarations folowing are put here for convenience
175 * and only intended to be used by the platform setup code
176 * for initializing spu_priv1_ops.
177 */
178
179extern const struct spu_priv1_ops spu_priv1_mmio_ops;
180
181#endif /* __KERNEL__ */
182#endif
diff --git a/include/asm-powerpc/systbl.h b/include/asm-powerpc/systbl.h
new file mode 100644
index 000000000000..eac85ce101b6
--- /dev/null
+++ b/include/asm-powerpc/systbl.h
@@ -0,0 +1,306 @@
1/*
2 * List of powerpc syscalls. For the meaning of the _SPU suffix see
3 * arch/powerpc/platforms/cell/spu_callbacks.c
4 */
5
6SYSCALL(restart_syscall)
7SYSCALL(exit)
8PPC_SYS(fork)
9SYSCALL_SPU(read)
10SYSCALL_SPU(write)
11COMPAT_SYS_SPU(open)
12SYSCALL_SPU(close)
13COMPAT_SYS_SPU(waitpid)
14COMPAT_SYS_SPU(creat)
15SYSCALL_SPU(link)
16SYSCALL_SPU(unlink)
17COMPAT_SYS(execve)
18SYSCALL_SPU(chdir)
19COMPAT_SYS_SPU(time)
20SYSCALL_SPU(mknod)
21SYSCALL_SPU(chmod)
22SYSCALL_SPU(lchown)
23SYSCALL(ni_syscall)
24OLDSYS(stat)
25SYSX_SPU(sys_lseek,ppc32_lseek,sys_lseek)
26SYSCALL_SPU(getpid)
27COMPAT_SYS(mount)
28SYSX(sys_ni_syscall,sys_oldumount,sys_oldumount)
29SYSCALL_SPU(setuid)
30SYSCALL_SPU(getuid)
31COMPAT_SYS_SPU(stime)
32COMPAT_SYS(ptrace)
33SYSCALL_SPU(alarm)
34OLDSYS(fstat)
35COMPAT_SYS(pause)
36COMPAT_SYS(utime)
37SYSCALL(ni_syscall)
38SYSCALL(ni_syscall)
39COMPAT_SYS_SPU(access)
40COMPAT_SYS_SPU(nice)
41SYSCALL(ni_syscall)
42SYSCALL_SPU(sync)
43COMPAT_SYS_SPU(kill)
44SYSCALL_SPU(rename)
45COMPAT_SYS_SPU(mkdir)
46SYSCALL_SPU(rmdir)
47SYSCALL_SPU(dup)
48SYSCALL_SPU(pipe)
49COMPAT_SYS_SPU(times)
50SYSCALL(ni_syscall)
51SYSCALL_SPU(brk)
52SYSCALL_SPU(setgid)
53SYSCALL_SPU(getgid)
54SYSCALL(signal)
55SYSCALL_SPU(geteuid)
56SYSCALL_SPU(getegid)
57SYSCALL(acct)
58SYSCALL(umount)
59SYSCALL(ni_syscall)
60COMPAT_SYS_SPU(ioctl)
61COMPAT_SYS_SPU(fcntl)
62SYSCALL(ni_syscall)
63COMPAT_SYS_SPU(setpgid)
64SYSCALL(ni_syscall)
65SYSX(sys_ni_syscall,sys_olduname, sys_olduname)
66COMPAT_SYS_SPU(umask)
67SYSCALL_SPU(chroot)
68SYSCALL(ustat)
69SYSCALL_SPU(dup2)
70SYSCALL_SPU(getppid)
71SYSCALL_SPU(getpgrp)
72SYSCALL_SPU(setsid)
73SYS32ONLY(sigaction)
74SYSCALL_SPU(sgetmask)
75COMPAT_SYS_SPU(ssetmask)
76SYSCALL_SPU(setreuid)
77SYSCALL_SPU(setregid)
78SYS32ONLY(sigsuspend)
79COMPAT_SYS(sigpending)
80COMPAT_SYS_SPU(sethostname)
81COMPAT_SYS_SPU(setrlimit)
82COMPAT_SYS(old_getrlimit)
83COMPAT_SYS_SPU(getrusage)
84COMPAT_SYS_SPU(gettimeofday)
85COMPAT_SYS_SPU(settimeofday)
86COMPAT_SYS_SPU(getgroups)
87COMPAT_SYS_SPU(setgroups)
88SYSX(sys_ni_syscall,sys_ni_syscall,ppc_select)
89SYSCALL_SPU(symlink)
90OLDSYS(lstat)
91COMPAT_SYS_SPU(readlink)
92SYSCALL(uselib)
93SYSCALL(swapon)
94SYSCALL(reboot)
95SYSX(sys_ni_syscall,old32_readdir,old_readdir)
96SYSCALL_SPU(mmap)
97SYSCALL_SPU(munmap)
98SYSCALL_SPU(truncate)
99SYSCALL_SPU(ftruncate)
100SYSCALL_SPU(fchmod)
101SYSCALL_SPU(fchown)
102COMPAT_SYS_SPU(getpriority)
103COMPAT_SYS_SPU(setpriority)
104SYSCALL(ni_syscall)
105COMPAT_SYS(statfs)
106COMPAT_SYS(fstatfs)
107SYSCALL(ni_syscall)
108COMPAT_SYS_SPU(socketcall)
109COMPAT_SYS_SPU(syslog)
110COMPAT_SYS_SPU(setitimer)
111COMPAT_SYS_SPU(getitimer)
112COMPAT_SYS_SPU(newstat)
113COMPAT_SYS_SPU(newlstat)
114COMPAT_SYS_SPU(newfstat)
115SYSX(sys_ni_syscall,sys_uname,sys_uname)
116SYSCALL(ni_syscall)
117SYSCALL_SPU(vhangup)
118SYSCALL(ni_syscall)
119SYSCALL(ni_syscall)
120COMPAT_SYS_SPU(wait4)
121SYSCALL(swapoff)
122COMPAT_SYS_SPU(sysinfo)
123COMPAT_SYS(ipc)
124SYSCALL_SPU(fsync)
125SYS32ONLY(sigreturn)
126PPC_SYS(clone)
127COMPAT_SYS_SPU(setdomainname)
128PPC_SYS_SPU(newuname)
129SYSCALL(ni_syscall)
130COMPAT_SYS_SPU(adjtimex)
131SYSCALL_SPU(mprotect)
132SYSX(sys_ni_syscall,compat_sys_sigprocmask,sys_sigprocmask)
133SYSCALL(ni_syscall)
134SYSCALL(init_module)
135SYSCALL(delete_module)
136SYSCALL(ni_syscall)
137SYSCALL(quotactl)
138COMPAT_SYS_SPU(getpgid)
139SYSCALL_SPU(fchdir)
140SYSCALL_SPU(bdflush)
141COMPAT_SYS(sysfs)
142SYSX_SPU(ppc64_personality,ppc64_personality,sys_personality)
143SYSCALL(ni_syscall)
144SYSCALL_SPU(setfsuid)
145SYSCALL_SPU(setfsgid)
146SYSCALL_SPU(llseek)
147COMPAT_SYS_SPU(getdents)
148SYSX_SPU(sys_select,ppc32_select,ppc_select)
149SYSCALL_SPU(flock)
150SYSCALL_SPU(msync)
151COMPAT_SYS_SPU(readv)
152COMPAT_SYS_SPU(writev)
153COMPAT_SYS_SPU(getsid)
154SYSCALL_SPU(fdatasync)
155COMPAT_SYS(sysctl)
156SYSCALL_SPU(mlock)
157SYSCALL_SPU(munlock)
158SYSCALL_SPU(mlockall)
159SYSCALL_SPU(munlockall)
160COMPAT_SYS_SPU(sched_setparam)
161COMPAT_SYS_SPU(sched_getparam)
162COMPAT_SYS_SPU(sched_setscheduler)
163COMPAT_SYS_SPU(sched_getscheduler)
164SYSCALL_SPU(sched_yield)
165COMPAT_SYS_SPU(sched_get_priority_max)
166COMPAT_SYS_SPU(sched_get_priority_min)
167COMPAT_SYS_SPU(sched_rr_get_interval)
168COMPAT_SYS_SPU(nanosleep)
169SYSCALL_SPU(mremap)
170SYSCALL_SPU(setresuid)
171SYSCALL_SPU(getresuid)
172SYSCALL(ni_syscall)
173SYSCALL_SPU(poll)
174COMPAT_SYS(nfsservctl)
175SYSCALL_SPU(setresgid)
176SYSCALL_SPU(getresgid)
177COMPAT_SYS_SPU(prctl)
178COMPAT_SYS(rt_sigreturn)
179COMPAT_SYS(rt_sigaction)
180COMPAT_SYS(rt_sigprocmask)
181COMPAT_SYS(rt_sigpending)
182COMPAT_SYS(rt_sigtimedwait)
183COMPAT_SYS(rt_sigqueueinfo)
184COMPAT_SYS(rt_sigsuspend)
185COMPAT_SYS_SPU(pread64)
186COMPAT_SYS_SPU(pwrite64)
187SYSCALL_SPU(chown)
188SYSCALL_SPU(getcwd)
189SYSCALL_SPU(capget)
190SYSCALL_SPU(capset)
191COMPAT_SYS(sigaltstack)
192SYSX_SPU(sys_sendfile64,compat_sys_sendfile,sys_sendfile)
193SYSCALL(ni_syscall)
194SYSCALL(ni_syscall)
195PPC_SYS(vfork)
196COMPAT_SYS_SPU(getrlimit)
197COMPAT_SYS_SPU(readahead)
198SYS32ONLY(mmap2)
199SYS32ONLY(truncate64)
200SYS32ONLY(ftruncate64)
201SYSX(sys_ni_syscall,sys_stat64,sys_stat64)
202SYSX(sys_ni_syscall,sys_lstat64,sys_lstat64)
203SYSX(sys_ni_syscall,sys_fstat64,sys_fstat64)
204SYSCALL(pciconfig_read)
205SYSCALL(pciconfig_write)
206SYSCALL(pciconfig_iobase)
207SYSCALL(ni_syscall)
208SYSCALL_SPU(getdents64)
209SYSCALL_SPU(pivot_root)
210SYSX(sys_ni_syscall,compat_sys_fcntl64,sys_fcntl64)
211SYSCALL_SPU(madvise)
212SYSCALL_SPU(mincore)
213SYSCALL_SPU(gettid)
214SYSCALL_SPU(tkill)
215SYSCALL_SPU(setxattr)
216SYSCALL_SPU(lsetxattr)
217SYSCALL_SPU(fsetxattr)
218SYSCALL_SPU(getxattr)
219SYSCALL_SPU(lgetxattr)
220SYSCALL_SPU(fgetxattr)
221SYSCALL_SPU(listxattr)
222SYSCALL_SPU(llistxattr)
223SYSCALL_SPU(flistxattr)
224SYSCALL_SPU(removexattr)
225SYSCALL_SPU(lremovexattr)
226SYSCALL_SPU(fremovexattr)
227COMPAT_SYS_SPU(futex)
228COMPAT_SYS_SPU(sched_setaffinity)
229COMPAT_SYS_SPU(sched_getaffinity)
230SYSCALL(ni_syscall)
231SYSCALL(ni_syscall)
232SYS32ONLY(sendfile64)
233COMPAT_SYS_SPU(io_setup)
234SYSCALL_SPU(io_destroy)
235COMPAT_SYS_SPU(io_getevents)
236COMPAT_SYS_SPU(io_submit)
237SYSCALL_SPU(io_cancel)
238SYSCALL(set_tid_address)
239SYSX_SPU(sys_fadvise64,ppc32_fadvise64,sys_fadvise64)
240SYSCALL(exit_group)
241SYSX(sys_lookup_dcookie,ppc32_lookup_dcookie,sys_lookup_dcookie)
242SYSCALL_SPU(epoll_create)
243SYSCALL_SPU(epoll_ctl)
244SYSCALL_SPU(epoll_wait)
245SYSCALL_SPU(remap_file_pages)
246SYSX_SPU(sys_timer_create,compat_sys_timer_create,sys_timer_create)
247COMPAT_SYS_SPU(timer_settime)
248COMPAT_SYS_SPU(timer_gettime)
249SYSCALL_SPU(timer_getoverrun)
250SYSCALL_SPU(timer_delete)
251COMPAT_SYS_SPU(clock_settime)
252COMPAT_SYS_SPU(clock_gettime)
253COMPAT_SYS_SPU(clock_getres)
254COMPAT_SYS_SPU(clock_nanosleep)
255SYSX(ppc64_swapcontext,ppc32_swapcontext,ppc_swapcontext)
256COMPAT_SYS_SPU(tgkill)
257COMPAT_SYS_SPU(utimes)
258COMPAT_SYS_SPU(statfs64)
259COMPAT_SYS_SPU(fstatfs64)
260SYSX(sys_ni_syscall, ppc_fadvise64_64, ppc_fadvise64_64)
261PPC_SYS_SPU(rtas)
262OLDSYS(debug_setcontext)
263SYSCALL(ni_syscall)
264SYSCALL(ni_syscall)
265COMPAT_SYS(mbind)
266COMPAT_SYS(get_mempolicy)
267COMPAT_SYS(set_mempolicy)
268COMPAT_SYS(mq_open)
269SYSCALL(mq_unlink)
270COMPAT_SYS(mq_timedsend)
271COMPAT_SYS(mq_timedreceive)
272COMPAT_SYS(mq_notify)
273COMPAT_SYS(mq_getsetattr)
274COMPAT_SYS(kexec_load)
275COMPAT_SYS(add_key)
276COMPAT_SYS(request_key)
277COMPAT_SYS(keyctl)
278COMPAT_SYS(waitid)
279COMPAT_SYS(ioprio_set)
280COMPAT_SYS(ioprio_get)
281SYSCALL(inotify_init)
282SYSCALL(inotify_add_watch)
283SYSCALL(inotify_rm_watch)
284SYSCALL(spu_run)
285SYSCALL(spu_create)
286COMPAT_SYS(pselect6)
287COMPAT_SYS(ppoll)
288SYSCALL_SPU(unshare)
289SYSCALL_SPU(splice)
290SYSCALL_SPU(tee)
291SYSCALL_SPU(vmsplice)
292COMPAT_SYS_SPU(openat)
293SYSCALL_SPU(mkdirat)
294SYSCALL_SPU(mknodat)
295SYSCALL_SPU(fchownat)
296COMPAT_SYS_SPU(futimesat)
297SYSX_SPU(sys_newfstatat, sys_fstatat64, sys_fstatat64)
298SYSCALL_SPU(unlinkat)
299SYSCALL_SPU(renameat)
300SYSCALL_SPU(linkat)
301SYSCALL_SPU(symlinkat)
302SYSCALL_SPU(readlinkat)
303SYSCALL_SPU(fchmodat)
304SYSCALL_SPU(faccessat)
305COMPAT_SYS_SPU(get_robust_list)
306COMPAT_SYS_SPU(set_robust_list)
diff --git a/include/asm-powerpc/tce.h b/include/asm-powerpc/tce.h
index 6fa200ad7a7f..c9483adbf599 100644
--- a/include/asm-powerpc/tce.h
+++ b/include/asm-powerpc/tce.h
@@ -35,32 +35,15 @@
35#define TCE_PAGE_SIZE (1 << TCE_SHIFT) 35#define TCE_PAGE_SIZE (1 << TCE_SHIFT)
36#define TCE_PAGE_FACTOR (PAGE_SHIFT - TCE_SHIFT) 36#define TCE_PAGE_FACTOR (PAGE_SHIFT - TCE_SHIFT)
37 37
38 38#define TCE_ENTRY_SIZE 8 /* each TCE is 64 bits */
39/* tce_entry 39
40 * Used by pSeries (SMP) and iSeries/pSeries LPAR, but there it's 40#define TCE_RPN_MASK 0xfffffffffful /* 40-bit RPN (4K pages) */
41 * abstracted so layout is irrelevant. 41#define TCE_RPN_SHIFT 12
42 */ 42#define TCE_VALID 0x800 /* TCE valid */
43union tce_entry { 43#define TCE_ALLIO 0x400 /* TCE valid for all lpars */
44 unsigned long te_word; 44#define TCE_PCI_WRITE 0x2 /* write from PCI allowed */
45 struct { 45#define TCE_PCI_READ 0x1 /* read from PCI allowed */
46 unsigned int tb_cacheBits :6; /* Cache hash bits - not used */ 46#define TCE_VB_WRITE 0x1 /* write from VB allowed */
47 unsigned int tb_rsvd :6;
48 unsigned long tb_rpn :40; /* Real page number */
49 unsigned int tb_valid :1; /* Tce is valid (vb only) */
50 unsigned int tb_allio :1; /* Tce is valid for all lps (vb only) */
51 unsigned int tb_lpindex :8; /* LpIndex for user of TCE (vb only) */
52 unsigned int tb_pciwr :1; /* Write allowed (pci only) */
53 unsigned int tb_rdwr :1; /* Read allowed (pci), Write allowed (vb) */
54 } te_bits;
55#define te_cacheBits te_bits.tb_cacheBits
56#define te_rpn te_bits.tb_rpn
57#define te_valid te_bits.tb_valid
58#define te_allio te_bits.tb_allio
59#define te_lpindex te_bits.tb_lpindex
60#define te_pciwr te_bits.tb_pciwr
61#define te_rdwr te_bits.tb_rdwr
62};
63
64 47
65#endif /* __KERNEL__ */ 48#endif /* __KERNEL__ */
66#endif /* _ASM_POWERPC_TCE_H */ 49#endif /* _ASM_POWERPC_TCE_H */
diff --git a/include/asm-powerpc/topology.h b/include/asm-powerpc/topology.h
index 19c575f39164..92f3e5507d22 100644
--- a/include/asm-powerpc/topology.h
+++ b/include/asm-powerpc/topology.h
@@ -31,8 +31,13 @@ static inline int node_to_first_cpu(int node)
31 31
32int of_node_to_nid(struct device_node *device); 32int of_node_to_nid(struct device_node *device);
33 33
34#define pcibus_to_node(node) (-1) 34struct pci_bus;
35#define pcibus_to_cpumask(bus) (cpu_online_map) 35extern int pcibus_to_node(struct pci_bus *bus);
36
37#define pcibus_to_cpumask(bus) (pcibus_to_node(bus) == -1 ? \
38 CPU_MASK_ALL : \
39 node_to_cpumask(pcibus_to_node(bus)) \
40 )
36 41
37/* sched_domains SD_NODE_INIT for PPC64 machines */ 42/* sched_domains SD_NODE_INIT for PPC64 machines */
38#define SD_NODE_INIT (struct sched_domain) { \ 43#define SD_NODE_INIT (struct sched_domain) { \
diff --git a/include/asm-powerpc/udbg.h b/include/asm-powerpc/udbg.h
index 5c4236c342bb..19a1517ac43b 100644
--- a/include/asm-powerpc/udbg.h
+++ b/include/asm-powerpc/udbg.h
@@ -23,7 +23,8 @@ extern int udbg_write(const char *s, int n);
23extern int udbg_read(char *buf, int buflen); 23extern int udbg_read(char *buf, int buflen);
24 24
25extern void register_early_udbg_console(void); 25extern void register_early_udbg_console(void);
26extern void udbg_printf(const char *fmt, ...); 26extern void udbg_printf(const char *fmt, ...)
27 __attribute__ ((format (printf, 1, 2)));
27extern void udbg_progress(char *s, unsigned short hex); 28extern void udbg_progress(char *s, unsigned short hex);
28 29
29extern void udbg_init_uart(void __iomem *comport, unsigned int speed, 30extern void udbg_init_uart(void __iomem *comport, unsigned int speed,
diff --git a/include/asm-powerpc/vga.h b/include/asm-powerpc/vga.h
index eadaf2f3d032..a2eac409c1ec 100644
--- a/include/asm-powerpc/vga.h
+++ b/include/asm-powerpc/vga.h
@@ -41,9 +41,9 @@ static inline u16 scr_readw(volatile const u16 *addr)
41extern unsigned long vgacon_remap_base; 41extern unsigned long vgacon_remap_base;
42 42
43#ifdef __powerpc64__ 43#ifdef __powerpc64__
44#define VGA_MAP_MEM(x) ((unsigned long) ioremap((x), 0)) 44#define VGA_MAP_MEM(x,s) ((unsigned long) ioremap((x), s))
45#else 45#else
46#define VGA_MAP_MEM(x) (x + vgacon_remap_base) 46#define VGA_MAP_MEM(x,s) (x + vgacon_remap_base)
47#endif 47#endif
48 48
49#define vga_readb(x) (*(x)) 49#define vga_readb(x) (*(x))
diff --git a/include/asm-powerpc/vio.h b/include/asm-powerpc/vio.h
index be14c59846f9..dc9bd101ca14 100644
--- a/include/asm-powerpc/vio.h
+++ b/include/asm-powerpc/vio.h
@@ -63,32 +63,22 @@ struct vio_driver {
63 struct device_driver driver; 63 struct device_driver driver;
64}; 64};
65 65
66struct vio_bus_ops {
67 int (*match)(const struct vio_device_id *id, const struct vio_dev *dev);
68 void (*unregister_device)(struct vio_dev *);
69 void (*release_device)(struct device *);
70};
71
72extern struct dma_mapping_ops vio_dma_ops; 66extern struct dma_mapping_ops vio_dma_ops;
73extern struct bus_type vio_bus_type; 67extern struct bus_type vio_bus_type;
74extern struct vio_dev vio_bus_device;
75 68
76extern int vio_register_driver(struct vio_driver *drv); 69extern int vio_register_driver(struct vio_driver *drv);
77extern void vio_unregister_driver(struct vio_driver *drv); 70extern void vio_unregister_driver(struct vio_driver *drv);
78 71
79extern struct vio_dev * __devinit vio_register_device(struct vio_dev *viodev);
80extern void __devinit vio_unregister_device(struct vio_dev *dev); 72extern void __devinit vio_unregister_device(struct vio_dev *dev);
81 73
82extern int vio_bus_init(struct vio_bus_ops *);
83
84#ifdef CONFIG_PPC_PSERIES
85struct device_node; 74struct device_node;
86 75
87extern struct vio_dev * __devinit vio_register_device_node( 76extern struct vio_dev * __devinit vio_register_device_node(
88 struct device_node *node_vdev); 77 struct device_node *node_vdev);
89extern struct vio_dev *vio_find_node(struct device_node *vnode); 78extern const void *vio_get_attribute(struct vio_dev *vdev, char *which,
90extern const void *vio_get_attribute(struct vio_dev *vdev, void *which,
91 int *length); 79 int *length);
80#ifdef CONFIG_PPC_PSERIES
81extern struct vio_dev *vio_find_node(struct device_node *vnode);
92extern int vio_enable_interrupts(struct vio_dev *dev); 82extern int vio_enable_interrupts(struct vio_dev *dev);
93extern int vio_disable_interrupts(struct vio_dev *dev); 83extern int vio_disable_interrupts(struct vio_dev *dev);
94#endif 84#endif
diff --git a/include/asm-ppc/floppy.h b/include/asm-ppc/floppy.h
index 8ccd4a276fe9..2ba191eba448 100644
--- a/include/asm-ppc/floppy.h
+++ b/include/asm-ppc/floppy.h
@@ -99,10 +99,8 @@ static int fd_request_irq(void)
99 return request_irq(FLOPPY_IRQ, floppy_hardint,SA_INTERRUPT, 99 return request_irq(FLOPPY_IRQ, floppy_hardint,SA_INTERRUPT,
100 "floppy", NULL); 100 "floppy", NULL);
101 else 101 else
102 return request_irq(FLOPPY_IRQ, floppy_interrupt, 102 return request_irq(FLOPPY_IRQ, floppy_interrupt, SA_INTERRUPT,
103 SA_INTERRUPT|SA_SAMPLE_RANDOM, 103 "floppy", NULL);
104 "floppy", NULL);
105
106} 104}
107 105
108static int vdma_dma_setup(char *addr, unsigned long size, int mode, int io) 106static int vdma_dma_setup(char *addr, unsigned long size, int mode, int io)
diff --git a/include/asm-ppc/mmu.h b/include/asm-ppc/mmu.h
index 0a70b05b3afb..14584e505ed5 100644
--- a/include/asm-ppc/mmu.h
+++ b/include/asm-ppc/mmu.h
@@ -23,25 +23,18 @@ extern phys_addr_t fixup_bigphys_addr(phys_addr_t, phys_addr_t);
23#define PHYS_FMT "%16Lx" 23#define PHYS_FMT "%16Lx"
24#endif 24#endif
25 25
26/* Default "unsigned long" context */ 26typedef struct {
27typedef unsigned long mm_context_t; 27 unsigned long id;
28 unsigned long vdso_base;
29} mm_context_t;
28 30
29/* Hardware Page Table Entry */ 31/* Hardware Page Table Entry */
30typedef struct _PTE { 32typedef struct _PTE {
31#ifdef CONFIG_PPC64BRIDGE
32 unsigned long long vsid:52;
33 unsigned long api:5;
34 unsigned long :5;
35 unsigned long h:1;
36 unsigned long v:1;
37 unsigned long long rpn:52;
38#else /* CONFIG_PPC64BRIDGE */
39 unsigned long v:1; /* Entry is valid */ 33 unsigned long v:1; /* Entry is valid */
40 unsigned long vsid:24; /* Virtual segment identifier */ 34 unsigned long vsid:24; /* Virtual segment identifier */
41 unsigned long h:1; /* Hash algorithm indicator */ 35 unsigned long h:1; /* Hash algorithm indicator */
42 unsigned long api:6; /* Abbreviated page index */ 36 unsigned long api:6; /* Abbreviated page index */
43 unsigned long rpn:20; /* Real (physical) page number */ 37 unsigned long rpn:20; /* Real (physical) page number */
44#endif /* CONFIG_PPC64BRIDGE */
45 unsigned long :3; /* Unused */ 38 unsigned long :3; /* Unused */
46 unsigned long r:1; /* Referenced */ 39 unsigned long r:1; /* Referenced */
47 unsigned long c:1; /* Changed */ 40 unsigned long c:1; /* Changed */
@@ -82,11 +75,7 @@ typedef struct _P601_BATU { /* Upper part of BAT for 601 processor */
82} P601_BATU; 75} P601_BATU;
83 76
84typedef struct _BATU { /* Upper part of BAT (all except 601) */ 77typedef struct _BATU { /* Upper part of BAT (all except 601) */
85#ifdef CONFIG_PPC64BRIDGE
86 unsigned long long bepi:47;
87#else /* CONFIG_PPC64BRIDGE */
88 unsigned long bepi:15; /* Effective page index (virtual address) */ 78 unsigned long bepi:15; /* Effective page index (virtual address) */
89#endif /* CONFIG_PPC64BRIDGE */
90 unsigned long :4; /* Unused */ 79 unsigned long :4; /* Unused */
91 unsigned long bl:11; /* Block size mask */ 80 unsigned long bl:11; /* Block size mask */
92 unsigned long vs:1; /* Supervisor valid */ 81 unsigned long vs:1; /* Supervisor valid */
@@ -101,11 +90,7 @@ typedef struct _P601_BATL { /* Lower part of BAT for 601 processor */
101} P601_BATL; 90} P601_BATL;
102 91
103typedef struct _BATL { /* Lower part of BAT (all except 601) */ 92typedef struct _BATL { /* Lower part of BAT (all except 601) */
104#ifdef CONFIG_PPC64BRIDGE
105 unsigned long long brpn:47;
106#else /* CONFIG_PPC64BRIDGE */
107 unsigned long brpn:15; /* Real page index (physical address) */ 93 unsigned long brpn:15; /* Real page index (physical address) */
108#endif /* CONFIG_PPC64BRIDGE */
109 unsigned long :10; /* Unused */ 94 unsigned long :10; /* Unused */
110 unsigned long w:1; /* Write-thru cache */ 95 unsigned long w:1; /* Write-thru cache */
111 unsigned long i:1; /* Cache inhibit */ 96 unsigned long i:1; /* Cache inhibit */
diff --git a/include/asm-ppc/mmu_context.h b/include/asm-ppc/mmu_context.h
index 94f2bf71310d..2bc8589cc451 100644
--- a/include/asm-ppc/mmu_context.h
+++ b/include/asm-ppc/mmu_context.h
@@ -70,7 +70,7 @@ static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
70#else 70#else
71 71
72/* PPC 6xx, 7xx CPUs */ 72/* PPC 6xx, 7xx CPUs */
73#define NO_CONTEXT ((mm_context_t) -1) 73#define NO_CONTEXT ((unsigned long) -1)
74#define LAST_CONTEXT 32767 74#define LAST_CONTEXT 32767
75#define FIRST_CONTEXT 1 75#define FIRST_CONTEXT 1
76#endif 76#endif
@@ -85,7 +85,7 @@ static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
85 * can be used for debugging on all processors (if you happen to have 85 * can be used for debugging on all processors (if you happen to have
86 * an Abatron). 86 * an Abatron).
87 */ 87 */
88extern void set_context(mm_context_t context, pgd_t *pgd); 88extern void set_context(unsigned long contextid, pgd_t *pgd);
89 89
90/* 90/*
91 * Bitmap of contexts in use. 91 * Bitmap of contexts in use.
@@ -98,7 +98,7 @@ extern unsigned long context_map[];
98 * Its use is an optimization only, we can't rely on this context 98 * Its use is an optimization only, we can't rely on this context
99 * number to be free, but it usually will be. 99 * number to be free, but it usually will be.
100 */ 100 */
101extern mm_context_t next_mmu_context; 101extern unsigned long next_mmu_context;
102 102
103/* 103/*
104 * If we don't have sufficient contexts to give one to every task 104 * If we don't have sufficient contexts to give one to every task
@@ -117,9 +117,9 @@ extern void steal_context(void);
117 */ 117 */
118static inline void get_mmu_context(struct mm_struct *mm) 118static inline void get_mmu_context(struct mm_struct *mm)
119{ 119{
120 mm_context_t ctx; 120 unsigned long ctx;
121 121
122 if (mm->context != NO_CONTEXT) 122 if (mm->context.id != NO_CONTEXT)
123 return; 123 return;
124#ifdef FEW_CONTEXTS 124#ifdef FEW_CONTEXTS
125 while (atomic_dec_if_positive(&nr_free_contexts) < 0) 125 while (atomic_dec_if_positive(&nr_free_contexts) < 0)
@@ -132,7 +132,7 @@ static inline void get_mmu_context(struct mm_struct *mm)
132 ctx = 0; 132 ctx = 0;
133 } 133 }
134 next_mmu_context = (ctx + 1) & LAST_CONTEXT; 134 next_mmu_context = (ctx + 1) & LAST_CONTEXT;
135 mm->context = ctx; 135 mm->context.id = ctx;
136#ifdef FEW_CONTEXTS 136#ifdef FEW_CONTEXTS
137 context_mm[ctx] = mm; 137 context_mm[ctx] = mm;
138#endif 138#endif
@@ -141,7 +141,12 @@ static inline void get_mmu_context(struct mm_struct *mm)
141/* 141/*
142 * Set up the context for a new address space. 142 * Set up the context for a new address space.
143 */ 143 */
144#define init_new_context(tsk,mm) (((mm)->context = NO_CONTEXT), 0) 144static inline int init_new_context(struct task_struct *t, struct mm_struct *mm)
145{
146 mm->context.id = NO_CONTEXT;
147 mm->context.vdso_base = 0;
148 return 0;
149}
145 150
146/* 151/*
147 * We're finished using the context for an address space. 152 * We're finished using the context for an address space.
@@ -149,9 +154,9 @@ static inline void get_mmu_context(struct mm_struct *mm)
149static inline void destroy_context(struct mm_struct *mm) 154static inline void destroy_context(struct mm_struct *mm)
150{ 155{
151 preempt_disable(); 156 preempt_disable();
152 if (mm->context != NO_CONTEXT) { 157 if (mm->context.id != NO_CONTEXT) {
153 clear_bit(mm->context, context_map); 158 clear_bit(mm->context.id, context_map);
154 mm->context = NO_CONTEXT; 159 mm->context.id = NO_CONTEXT;
155#ifdef FEW_CONTEXTS 160#ifdef FEW_CONTEXTS
156 atomic_inc(&nr_free_contexts); 161 atomic_inc(&nr_free_contexts);
157#endif 162#endif
@@ -179,7 +184,7 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
179 184
180 /* Setup new userspace context */ 185 /* Setup new userspace context */
181 get_mmu_context(next); 186 get_mmu_context(next);
182 set_context(next->context, next->pgd); 187 set_context(next->context.id, next->pgd);
183} 188}
184 189
185#define deactivate_mm(tsk,mm) do { } while (0) 190#define deactivate_mm(tsk,mm) do { } while (0)
diff --git a/include/asm-ppc/mpc85xx.h b/include/asm-ppc/mpc85xx.h
index c25bdd9debf8..9b4851199c76 100644
--- a/include/asm-ppc/mpc85xx.h
+++ b/include/asm-ppc/mpc85xx.h
@@ -27,6 +27,9 @@
27#if defined(CONFIG_MPC8555_CDS) || defined(CONFIG_MPC8548_CDS) 27#if defined(CONFIG_MPC8555_CDS) || defined(CONFIG_MPC8548_CDS)
28#include <platforms/85xx/mpc8555_cds.h> 28#include <platforms/85xx/mpc8555_cds.h>
29#endif 29#endif
30#ifdef CONFIG_MPC85xx_CDS
31#include <platforms/85xx/mpc85xx_cds.h>
32#endif
30#ifdef CONFIG_MPC8560_ADS 33#ifdef CONFIG_MPC8560_ADS
31#include <platforms/85xx/mpc8560_ads.h> 34#include <platforms/85xx/mpc8560_ads.h>
32#endif 35#endif
diff --git a/include/asm-ppc/pgtable.h b/include/asm-ppc/pgtable.h
index 9cb83679836c..51fa7c662917 100644
--- a/include/asm-ppc/pgtable.h
+++ b/include/asm-ppc/pgtable.h
@@ -662,7 +662,7 @@ static inline int __ptep_test_and_clear_young(unsigned int context, unsigned lon
662 return (old & _PAGE_ACCESSED) != 0; 662 return (old & _PAGE_ACCESSED) != 0;
663} 663}
664#define ptep_test_and_clear_young(__vma, __addr, __ptep) \ 664#define ptep_test_and_clear_young(__vma, __addr, __ptep) \
665 __ptep_test_and_clear_young((__vma)->vm_mm->context, __addr, __ptep) 665 __ptep_test_and_clear_young((__vma)->vm_mm->context.id, __addr, __ptep)
666 666
667#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY 667#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
668static inline int ptep_test_and_clear_dirty(struct vm_area_struct *vma, 668static inline int ptep_test_and_clear_dirty(struct vm_area_struct *vma,
diff --git a/include/asm-s390/irq.h b/include/asm-s390/irq.h
index 916a1aa0b073..bd1a721f7aa2 100644
--- a/include/asm-s390/irq.h
+++ b/include/asm-s390/irq.h
@@ -21,10 +21,6 @@ enum interruption_class {
21 21
22#define touch_nmi_watchdog() do { } while(0) 22#define touch_nmi_watchdog() do { } while(0)
23 23
24struct irqaction;
25struct pt_regs;
26int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *);
27
28#endif /* __KERNEL__ */ 24#endif /* __KERNEL__ */
29#endif 25#endif
30 26
diff --git a/include/asm-s390/percpu.h b/include/asm-s390/percpu.h
index 436d216601e5..d9a8cca9b653 100644
--- a/include/asm-s390/percpu.h
+++ b/include/asm-s390/percpu.h
@@ -40,6 +40,7 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
40 __typeof__(type) per_cpu__##name 40 __typeof__(type) per_cpu__##name
41 41
42#define __get_cpu_var(var) __reloc_hide(var,S390_lowcore.percpu_offset) 42#define __get_cpu_var(var) __reloc_hide(var,S390_lowcore.percpu_offset)
43#define __raw_get_cpu_var(var) __reloc_hide(var,S390_lowcore.percpu_offset)
43#define per_cpu(var,cpu) __reloc_hide(var,__per_cpu_offset[cpu]) 44#define per_cpu(var,cpu) __reloc_hide(var,__per_cpu_offset[cpu])
44 45
45/* A macro to avoid #include hell... */ 46/* A macro to avoid #include hell... */
@@ -57,6 +58,7 @@ do { \
57 __typeof__(type) per_cpu__##name 58 __typeof__(type) per_cpu__##name
58 59
59#define __get_cpu_var(var) __reloc_hide(var,0) 60#define __get_cpu_var(var) __reloc_hide(var,0)
61#define __raw_get_cpu_var(var) __reloc_hide(var,0)
60#define per_cpu(var,cpu) __reloc_hide(var,0) 62#define per_cpu(var,cpu) __reloc_hide(var,0)
61 63
62#endif /* SMP */ 64#endif /* SMP */
diff --git a/include/asm-sh/floppy.h b/include/asm-sh/floppy.h
index 38d7a2942476..307d9ce9f9ed 100644
--- a/include/asm-sh/floppy.h
+++ b/include/asm-sh/floppy.h
@@ -147,11 +147,10 @@ static int fd_request_irq(void)
147{ 147{
148 if(can_use_virtual_dma) 148 if(can_use_virtual_dma)
149 return request_irq(FLOPPY_IRQ, floppy_hardint,SA_INTERRUPT, 149 return request_irq(FLOPPY_IRQ, floppy_hardint,SA_INTERRUPT,
150 "floppy", NULL); 150 "floppy", NULL);
151 else 151 else
152 return request_irq(FLOPPY_IRQ, floppy_interrupt, 152 return request_irq(FLOPPY_IRQ, floppy_interrupt, SA_INTERRUPT,
153 SA_INTERRUPT|SA_SAMPLE_RANDOM, 153 "floppy", NULL);
154 "floppy", NULL);
155 154
156} 155}
157 156
diff --git a/include/asm-sparc/ebus.h b/include/asm-sparc/ebus.h
index 2d6a997c5b0c..54652887c127 100644
--- a/include/asm-sparc/ebus.h
+++ b/include/asm-sparc/ebus.h
@@ -13,13 +13,14 @@
13#include <linux/ioport.h> 13#include <linux/ioport.h>
14#endif 14#endif
15#include <asm/oplib.h> 15#include <asm/oplib.h>
16#include <asm/prom.h>
17#include <asm/of_device.h>
16 18
17struct linux_ebus_child { 19struct linux_ebus_child {
18 struct linux_ebus_child *next; 20 struct linux_ebus_child *next;
19 struct linux_ebus_device *parent; 21 struct linux_ebus_device *parent;
20 struct linux_ebus *bus; 22 struct linux_ebus *bus;
21 int prom_node; 23 struct device_node *prom_node;
22 char prom_name[64];
23 struct resource resource[PROMREG_MAX]; 24 struct resource resource[PROMREG_MAX];
24 int num_addrs; 25 int num_addrs;
25 unsigned int irqs[PROMINTR_MAX]; 26 unsigned int irqs[PROMINTR_MAX];
@@ -27,27 +28,27 @@ struct linux_ebus_child {
27}; 28};
28 29
29struct linux_ebus_device { 30struct linux_ebus_device {
31 struct of_device ofdev;
30 struct linux_ebus_device *next; 32 struct linux_ebus_device *next;
31 struct linux_ebus_child *children; 33 struct linux_ebus_child *children;
32 struct linux_ebus *bus; 34 struct linux_ebus *bus;
33 int prom_node; 35 struct device_node *prom_node;
34 char prom_name[64];
35 struct resource resource[PROMREG_MAX]; 36 struct resource resource[PROMREG_MAX];
36 int num_addrs; 37 int num_addrs;
37 unsigned int irqs[PROMINTR_MAX]; 38 unsigned int irqs[PROMINTR_MAX];
38 int num_irqs; 39 int num_irqs;
39}; 40};
41#define to_ebus_device(d) container_of(d, struct linux_ebus_device, ofdev.dev)
40 42
41struct linux_ebus { 43struct linux_ebus {
44 struct of_device ofdev;
42 struct linux_ebus *next; 45 struct linux_ebus *next;
43 struct linux_ebus_device *devices; 46 struct linux_ebus_device *devices;
44 struct linux_pbm_info *parent; 47 struct linux_pbm_info *parent;
45 struct pci_dev *self; 48 struct pci_dev *self;
46 int prom_node; 49 struct device_node *prom_node;
47 char prom_name[64];
48 struct linux_prom_ebus_ranges ebus_ranges[PROMREG_MAX];
49 int num_ebus_ranges;
50}; 50};
51#define to_ebus(d) container_of(d, struct linux_ebus, ofdev.dev)
51 52
52struct linux_ebus_dma { 53struct linux_ebus_dma {
53 unsigned int dcsr; 54 unsigned int dcsr;
diff --git a/include/asm-sparc/irq.h b/include/asm-sparc/irq.h
index f2d64537e29d..3141ddfea97d 100644
--- a/include/asm-sparc/irq.h
+++ b/include/asm-sparc/irq.h
@@ -181,8 +181,4 @@ extern struct sun4m_intregs *sun4m_interrupts;
181#define SUN4M_INT_SBUS(x) (1 << (x+7)) 181#define SUN4M_INT_SBUS(x) (1 << (x+7))
182#define SUN4M_INT_VME(x) (1 << (x)) 182#define SUN4M_INT_VME(x) (1 << (x))
183 183
184struct irqaction;
185struct pt_regs;
186int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *);
187
188#endif 184#endif
diff --git a/include/asm-sparc/of_device.h b/include/asm-sparc/of_device.h
new file mode 100644
index 000000000000..4816d102f918
--- /dev/null
+++ b/include/asm-sparc/of_device.h
@@ -0,0 +1,63 @@
1#ifndef _ASM_SPARC_OF_DEVICE_H
2#define _ASM_SPARC_OF_DEVICE_H
3#ifdef __KERNEL__
4
5#include <linux/device.h>
6#include <linux/mod_devicetable.h>
7#include <asm/prom.h>
8
9extern struct bus_type ebus_bus_type;
10extern struct bus_type sbus_bus_type;
11
12/*
13 * The of_device is a kind of "base class" that is a superset of
14 * struct device for use by devices attached to an OF node and
15 * probed using OF properties.
16 */
17struct of_device
18{
19 struct device_node *node; /* OF device node */
20 struct device dev; /* Generic device interface */
21};
22#define to_of_device(d) container_of(d, struct of_device, dev)
23
24extern const struct of_device_id *of_match_device(
25 const struct of_device_id *matches, const struct of_device *dev);
26
27extern struct of_device *of_dev_get(struct of_device *dev);
28extern void of_dev_put(struct of_device *dev);
29
30/*
31 * An of_platform_driver driver is attached to a basic of_device on
32 * the ISA, EBUS, and SBUS busses on sparc64.
33 */
34struct of_platform_driver
35{
36 char *name;
37 struct of_device_id *match_table;
38 struct module *owner;
39
40 int (*probe)(struct of_device* dev, const struct of_device_id *match);
41 int (*remove)(struct of_device* dev);
42
43 int (*suspend)(struct of_device* dev, pm_message_t state);
44 int (*resume)(struct of_device* dev);
45 int (*shutdown)(struct of_device* dev);
46
47 struct device_driver driver;
48};
49#define to_of_platform_driver(drv) container_of(drv,struct of_platform_driver, driver)
50
51extern int of_register_driver(struct of_platform_driver *drv,
52 struct bus_type *bus);
53extern void of_unregister_driver(struct of_platform_driver *drv);
54extern int of_device_register(struct of_device *ofdev);
55extern void of_device_unregister(struct of_device *ofdev);
56extern struct of_device *of_platform_device_create(struct device_node *np,
57 const char *bus_id,
58 struct device *parent,
59 struct bus_type *bus);
60extern void of_release_dev(struct device *dev);
61
62#endif /* __KERNEL__ */
63#endif /* _ASM_SPARC_OF_DEVICE_H */
diff --git a/include/asm-sparc/pbm.h b/include/asm-sparc/pbm.h
index 0aba3a82c2eb..fedd9c6e875c 100644
--- a/include/asm-sparc/pbm.h
+++ b/include/asm-sparc/pbm.h
@@ -22,6 +22,7 @@
22 22
23#include <linux/pci.h> 23#include <linux/pci.h>
24#include <asm/oplib.h> 24#include <asm/oplib.h>
25#include <asm/prom.h>
25 26
26struct linux_pbm_info { 27struct linux_pbm_info {
27 int prom_node; 28 int prom_node;
@@ -40,7 +41,7 @@ struct linux_pbm_info {
40 */ 41 */
41struct pcidev_cookie { 42struct pcidev_cookie {
42 struct linux_pbm_info *pbm; 43 struct linux_pbm_info *pbm;
43 int prom_node; 44 struct device_node *prom_node;
44}; 45};
45 46
46#endif /* !(__SPARC_PBM_H) */ 47#endif /* !(__SPARC_PBM_H) */
diff --git a/include/asm-sparc/prom.h b/include/asm-sparc/prom.h
new file mode 100644
index 000000000000..c5e3d26eabd3
--- /dev/null
+++ b/include/asm-sparc/prom.h
@@ -0,0 +1,98 @@
1#ifndef _SPARC_PROM_H
2#define _SPARC_PROM_H
3#ifdef __KERNEL__
4
5
6/*
7 * Definitions for talking to the Open Firmware PROM on
8 * Power Macintosh computers.
9 *
10 * Copyright (C) 1996-2005 Paul Mackerras.
11 *
12 * Updates for PPC64 by Peter Bergner & David Engebretsen, IBM Corp.
13 * Updates for SPARC32 by David S. Miller
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version
18 * 2 of the License, or (at your option) any later version.
19 */
20
21#include <linux/types.h>
22#include <linux/proc_fs.h>
23#include <asm/atomic.h>
24
25typedef u32 phandle;
26typedef u32 ihandle;
27
28struct interrupt_info {
29 int line;
30 int sense; /* +ve/-ve logic, edge or level, etc. */
31};
32
33struct property {
34 char *name;
35 int length;
36 void *value;
37 struct property *next;
38};
39
40struct device_node {
41 char *name;
42 char *type;
43 phandle node;
44 phandle linux_phandle;
45 int n_intrs;
46 struct interrupt_info *intrs;
47 char *path_component_name;
48 char *full_name;
49
50 struct property *properties;
51 struct property *deadprops; /* removed properties */
52 struct device_node *parent;
53 struct device_node *child;
54 struct device_node *sibling;
55 struct device_node *next; /* next device of same type */
56 struct device_node *allnext; /* next in list of all nodes */
57 struct proc_dir_entry *pde; /* this node's proc directory */
58 struct kref kref;
59 unsigned long _flags;
60 void *data;
61};
62
63static inline void set_node_proc_entry(struct device_node *dn, struct proc_dir_entry *de)
64{
65 dn->pde = de;
66}
67
68extern struct device_node *of_find_node_by_name(struct device_node *from,
69 const char *name);
70#define for_each_node_by_name(dn, name) \
71 for (dn = of_find_node_by_name(NULL, name); dn; \
72 dn = of_find_node_by_name(dn, name))
73extern struct device_node *of_find_node_by_type(struct device_node *from,
74 const char *type);
75#define for_each_node_by_type(dn, type) \
76 for (dn = of_find_node_by_type(NULL, type); dn; \
77 dn = of_find_node_by_type(dn, type))
78extern struct device_node *of_find_compatible_node(struct device_node *from,
79 const char *type, const char *compat);
80extern struct device_node *of_find_node_by_path(const char *path);
81extern struct device_node *of_find_node_by_phandle(phandle handle);
82extern struct device_node *of_get_parent(const struct device_node *node);
83extern struct device_node *of_get_next_child(const struct device_node *node,
84 struct device_node *prev);
85extern struct property *of_find_property(struct device_node *np,
86 const char *name,
87 int *lenp);
88extern int of_device_is_compatible(struct device_node *device, const char *);
89extern void *of_get_property(struct device_node *node, const char *name,
90 int *lenp);
91extern int of_getintprop_default(struct device_node *np,
92 const char *name,
93 int def);
94
95extern void prom_build_devicetree(void);
96
97#endif /* __KERNEL__ */
98#endif /* _SPARC_PROM_H */
diff --git a/include/asm-sparc/sbus.h b/include/asm-sparc/sbus.h
index a13cddcecec5..d036e4419d79 100644
--- a/include/asm-sparc/sbus.h
+++ b/include/asm-sparc/sbus.h
@@ -11,7 +11,8 @@
11#include <linux/ioport.h> 11#include <linux/ioport.h>
12 12
13#include <asm/oplib.h> 13#include <asm/oplib.h>
14/* #include <asm/iommu.h> */ /* Unused since we use opaque iommu (|io-unit) */ 14#include <asm/prom.h>
15#include <asm/of_device.h>
15#include <asm/scatterlist.h> 16#include <asm/scatterlist.h>
16 17
17/* We scan which devices are on the SBus using the PROM node device 18/* We scan which devices are on the SBus using the PROM node device
@@ -42,18 +43,19 @@ struct sbus_bus;
42 43
43/* Linux SBUS device tables */ 44/* Linux SBUS device tables */
44struct sbus_dev { 45struct sbus_dev {
45 struct sbus_bus *bus; /* Back ptr to sbus */ 46 struct of_device ofdev;
46 struct sbus_dev *next; /* next device on this SBus or null */ 47 struct sbus_bus *bus;
47 struct sbus_dev *child; /* For ledma and espdma on sun4m */ 48 struct sbus_dev *next;
48 struct sbus_dev *parent; /* Parent device if not toplevel */ 49 struct sbus_dev *child;
49 int prom_node; /* PROM device tree node for this device */ 50 struct sbus_dev *parent;
50 char prom_name[64]; /* PROM device name */ 51 int prom_node;
52 char prom_name[64];
51 int slot; 53 int slot;
52 54
53 struct resource resource[PROMREG_MAX]; 55 struct resource resource[PROMREG_MAX];
54 56
55 struct linux_prom_registers reg_addrs[PROMREG_MAX]; 57 struct linux_prom_registers reg_addrs[PROMREG_MAX];
56 int num_registers, ranges_applied; 58 int num_registers;
57 59
58 struct linux_prom_ranges device_ranges[PROMREG_MAX]; 60 struct linux_prom_ranges device_ranges[PROMREG_MAX];
59 int num_device_ranges; 61 int num_device_ranges;
@@ -61,9 +63,11 @@ struct sbus_dev {
61 unsigned int irqs[4]; 63 unsigned int irqs[4];
62 int num_irqs; 64 int num_irqs;
63}; 65};
66#define to_sbus_device(d) container_of(d, struct sbus_dev, ofdev.dev)
64 67
65/* This struct describes the SBus(s) found on this machine. */ 68/* This struct describes the SBus(s) found on this machine. */
66struct sbus_bus { 69struct sbus_bus {
70 struct of_device ofdev;
67 void *iommu; /* Opaque IOMMU cookie */ 71 void *iommu; /* Opaque IOMMU cookie */
68 struct sbus_dev *devices; /* Link to devices on this SBus */ 72 struct sbus_dev *devices; /* Link to devices on this SBus */
69 struct sbus_bus *next; /* next SBus, if more than one SBus */ 73 struct sbus_bus *next; /* next SBus, if more than one SBus */
@@ -77,6 +81,7 @@ struct sbus_bus {
77 int devid; 81 int devid;
78 int board; 82 int board;
79}; 83};
84#define to_sbus(d) container_of(d, struct sbus_bus, ofdev.dev)
80 85
81extern struct sbus_bus *sbus_root; 86extern struct sbus_bus *sbus_root;
82 87
@@ -102,6 +107,7 @@ sbus_is_slave(struct sbus_dev *dev)
102#define sbus_can_dma_64bit(sdev) (0) /* actually, sparc_cpu_model==sun4d */ 107#define sbus_can_dma_64bit(sdev) (0) /* actually, sparc_cpu_model==sun4d */
103#define sbus_can_burst64(sdev) (0) /* actually, sparc_cpu_model==sun4d */ 108#define sbus_can_burst64(sdev) (0) /* actually, sparc_cpu_model==sun4d */
104extern void sbus_set_sbus64(struct sbus_dev *, int); 109extern void sbus_set_sbus64(struct sbus_dev *, int);
110extern void sbus_fill_device_irq(struct sbus_dev *);
105 111
106/* These yield IOMMU mappings in consistent mode. */ 112/* These yield IOMMU mappings in consistent mode. */
107extern void *sbus_alloc_consistent(struct sbus_dev *, long, u32 *dma_addrp); 113extern void *sbus_alloc_consistent(struct sbus_dev *, long, u32 *dma_addrp);
@@ -139,4 +145,10 @@ extern void sbus_dma_sync_sg_for_device(struct sbus_dev *, struct scatterlist *,
139BTFIXUPDEF_CALL(unsigned int, sbint_to_irq, struct sbus_dev *sdev, unsigned int) 145BTFIXUPDEF_CALL(unsigned int, sbint_to_irq, struct sbus_dev *sdev, unsigned int)
140#define sbint_to_irq(sdev, sbint) BTFIXUP_CALL(sbint_to_irq)(sdev, sbint) 146#define sbint_to_irq(sdev, sbint) BTFIXUP_CALL(sbint_to_irq)(sdev, sbint)
141 147
148extern void sbus_arch_bus_ranges_init(struct device_node *, struct sbus_bus *);
149extern void sbus_setup_iommu(struct sbus_bus *, struct device_node *);
150extern void sbus_setup_arch_props(struct sbus_bus *, struct device_node *);
151extern int sbus_arch_preinit(void);
152extern void sbus_arch_postinit(void);
153
142#endif /* !(_SPARC_SBUS_H) */ 154#endif /* !(_SPARC_SBUS_H) */
diff --git a/include/asm-sparc64/ebus.h b/include/asm-sparc64/ebus.h
index 7a408a030f52..a4afe9d5703a 100644
--- a/include/asm-sparc64/ebus.h
+++ b/include/asm-sparc64/ebus.h
@@ -10,13 +10,14 @@
10 10
11#include <asm/pbm.h> 11#include <asm/pbm.h>
12#include <asm/oplib.h> 12#include <asm/oplib.h>
13#include <asm/prom.h>
14#include <asm/of_device.h>
13 15
14struct linux_ebus_child { 16struct linux_ebus_child {
15 struct linux_ebus_child *next; 17 struct linux_ebus_child *next;
16 struct linux_ebus_device *parent; 18 struct linux_ebus_device *parent;
17 struct linux_ebus *bus; 19 struct linux_ebus *bus;
18 int prom_node; 20 struct device_node *prom_node;
19 char prom_name[64];
20 struct resource resource[PROMREG_MAX]; 21 struct resource resource[PROMREG_MAX];
21 int num_addrs; 22 int num_addrs;
22 unsigned int irqs[PROMINTR_MAX]; 23 unsigned int irqs[PROMINTR_MAX];
@@ -24,32 +25,29 @@ struct linux_ebus_child {
24}; 25};
25 26
26struct linux_ebus_device { 27struct linux_ebus_device {
28 struct of_device ofdev;
27 struct linux_ebus_device *next; 29 struct linux_ebus_device *next;
28 struct linux_ebus_child *children; 30 struct linux_ebus_child *children;
29 struct linux_ebus *bus; 31 struct linux_ebus *bus;
30 int prom_node; 32 struct device_node *prom_node;
31 char prom_name[64];
32 struct resource resource[PROMREG_MAX]; 33 struct resource resource[PROMREG_MAX];
33 int num_addrs; 34 int num_addrs;
34 unsigned int irqs[PROMINTR_MAX]; 35 unsigned int irqs[PROMINTR_MAX];
35 int num_irqs; 36 int num_irqs;
36}; 37};
38#define to_ebus_device(d) container_of(d, struct linux_ebus_device, ofdev.dev)
37 39
38struct linux_ebus { 40struct linux_ebus {
41 struct of_device ofdev;
39 struct linux_ebus *next; 42 struct linux_ebus *next;
40 struct linux_ebus_device *devices; 43 struct linux_ebus_device *devices;
41 struct pci_pbm_info *parent; 44 struct pci_pbm_info *parent;
42 struct pci_dev *self; 45 struct pci_dev *self;
43 int index; 46 int index;
44 int is_rio; 47 int is_rio;
45 int prom_node; 48 struct device_node *prom_node;
46 char prom_name[64];
47 struct linux_prom_ebus_ranges ebus_ranges[PROMREG_MAX];
48 int num_ebus_ranges;
49 struct linux_prom_ebus_intmap ebus_intmap[PROMREG_MAX];
50 int num_ebus_intmap;
51 struct linux_prom_ebus_intmask ebus_intmask;
52}; 49};
50#define to_ebus(d) container_of(d, struct linux_ebus, ofdev.dev)
53 51
54struct ebus_dma_info { 52struct ebus_dma_info {
55 spinlock_t lock; 53 spinlock_t lock;
diff --git a/include/asm-sparc64/fhc.h b/include/asm-sparc64/fhc.h
index f29eaa254055..9e7f1b0d78b9 100644
--- a/include/asm-sparc64/fhc.h
+++ b/include/asm-sparc64/fhc.h
@@ -10,6 +10,7 @@
10#include <linux/timer.h> 10#include <linux/timer.h>
11 11
12#include <asm/oplib.h> 12#include <asm/oplib.h>
13#include <asm/prom.h>
13#include <asm/upa.h> 14#include <asm/upa.h>
14 15
15struct linux_fhc; 16struct linux_fhc;
@@ -34,8 +35,7 @@ struct linux_central {
34 unsigned long clkregs; 35 unsigned long clkregs;
35 unsigned long clkver; 36 unsigned long clkver;
36 int slots; 37 int slots;
37 int prom_node; 38 struct device_node *prom_node;
38 char prom_name[64];
39 39
40 struct linux_prom_ranges central_ranges[PROMREG_MAX]; 40 struct linux_prom_ranges central_ranges[PROMREG_MAX];
41 int num_central_ranges; 41 int num_central_ranges;
@@ -112,8 +112,7 @@ struct linux_fhc {
112 struct fhc_regs fhc_regs; 112 struct fhc_regs fhc_regs;
113 int board; 113 int board;
114 int jtag_master; 114 int jtag_master;
115 int prom_node; 115 struct device_node *prom_node;
116 char prom_name[64];
117 116
118 struct linux_prom_ranges fhc_ranges[PROMREG_MAX]; 117 struct linux_prom_ranges fhc_ranges[PROMREG_MAX];
119 int num_fhc_ranges; 118 int num_fhc_ranges;
diff --git a/include/asm-sparc64/floppy.h b/include/asm-sparc64/floppy.h
index 07ccd6f04b52..f8d57bb5570c 100644
--- a/include/asm-sparc64/floppy.h
+++ b/include/asm-sparc64/floppy.h
@@ -498,15 +498,14 @@ static int sun_pci_fd_test_drive(unsigned long port, int drive)
498#ifdef CONFIG_PCI 498#ifdef CONFIG_PCI
499static int __init ebus_fdthree_p(struct linux_ebus_device *edev) 499static int __init ebus_fdthree_p(struct linux_ebus_device *edev)
500{ 500{
501 if (!strcmp(edev->prom_name, "fdthree")) 501 if (!strcmp(edev->prom_node->name, "fdthree"))
502 return 1; 502 return 1;
503 if (!strcmp(edev->prom_name, "floppy")) { 503 if (!strcmp(edev->prom_node->name, "floppy")) {
504 char compat[16]; 504 char *compat;
505 prom_getstring(edev->prom_node, 505
506 "compatible", 506 compat = of_get_property(edev->prom_node,
507 compat, sizeof(compat)); 507 "compatible", NULL);
508 compat[15] = '\0'; 508 if (compat && !strcmp(compat, "fdthree"))
509 if (!strcmp(compat, "fdthree"))
510 return 1; 509 return 1;
511 } 510 }
512 return 0; 511 return 0;
@@ -524,12 +523,12 @@ static unsigned long __init isa_floppy_init(void)
524 523
525 for_each_isa(isa_br) { 524 for_each_isa(isa_br) {
526 for_each_isadev(isa_dev, isa_br) { 525 for_each_isadev(isa_dev, isa_br) {
527 if (!strcmp(isa_dev->prom_name, "dma")) { 526 if (!strcmp(isa_dev->prom_node->name, "dma")) {
528 struct sparc_isa_device *child = 527 struct sparc_isa_device *child =
529 isa_dev->child; 528 isa_dev->child;
530 529
531 while (child) { 530 while (child) {
532 if (!strcmp(child->prom_name, 531 if (!strcmp(child->prom_node->name,
533 "floppy")) { 532 "floppy")) {
534 isa_dev = child; 533 isa_dev = child;
535 goto isa_done; 534 goto isa_done;
@@ -614,6 +613,7 @@ static unsigned long __init sun_floppy_init(void)
614 struct linux_ebus_device *edev = NULL; 613 struct linux_ebus_device *edev = NULL;
615 unsigned long config = 0; 614 unsigned long config = 0;
616 void __iomem *auxio_reg; 615 void __iomem *auxio_reg;
616 char *state_prop;
617 617
618 for_each_ebus(ebus) { 618 for_each_ebus(ebus) {
619 for_each_ebusdev(edev, ebus) { 619 for_each_ebusdev(edev, ebus) {
@@ -630,9 +630,8 @@ static unsigned long __init sun_floppy_init(void)
630#endif 630#endif
631 } 631 }
632 632
633 prom_getproperty(edev->prom_node, "status", 633 state_prop = of_get_property(edev->prom_node, "status", NULL);
634 state, sizeof(state)); 634 if (state_prop && !strncmp(state_prop, "disabled", 8))
635 if (!strncmp(state, "disabled", 8))
636 return 0; 635 return 0;
637 636
638 FLOPPY_IRQ = edev->irqs[0]; 637 FLOPPY_IRQ = edev->irqs[0];
@@ -703,7 +702,7 @@ static unsigned long __init sun_floppy_init(void)
703 */ 702 */
704 for_each_ebus(ebus) { 703 for_each_ebus(ebus) {
705 for_each_ebusdev(edev, ebus) { 704 for_each_ebusdev(edev, ebus) {
706 if (!strcmp(edev->prom_name, "ecpp")) { 705 if (!strcmp(edev->prom_node->name, "ecpp")) {
707 config = edev->resource[1].start; 706 config = edev->resource[1].start;
708 goto config_done; 707 goto config_done;
709 } 708 }
diff --git a/include/asm-sparc64/isa.h b/include/asm-sparc64/isa.h
index 4601bbfc3e7b..d9728b9031fc 100644
--- a/include/asm-sparc64/isa.h
+++ b/include/asm-sparc64/isa.h
@@ -9,37 +9,32 @@
9 9
10#include <asm/pbm.h> 10#include <asm/pbm.h>
11#include <asm/oplib.h> 11#include <asm/oplib.h>
12#include <asm/prom.h>
13#include <asm/of_device.h>
12 14
13struct sparc_isa_bridge; 15struct sparc_isa_bridge;
14 16
15struct sparc_isa_device { 17struct sparc_isa_device {
18 struct of_device ofdev;
16 struct sparc_isa_device *next; 19 struct sparc_isa_device *next;
17 struct sparc_isa_device *child; 20 struct sparc_isa_device *child;
18 struct sparc_isa_bridge *bus; 21 struct sparc_isa_bridge *bus;
19 int prom_node; 22 struct device_node *prom_node;
20 char prom_name[64];
21 char compatible[64];
22 struct resource resource; 23 struct resource resource;
23 unsigned int irq; 24 unsigned int irq;
24}; 25};
26#define to_isa_device(d) container_of(d, struct sparc_isa_device, ofdev.dev)
25 27
26struct sparc_isa_bridge { 28struct sparc_isa_bridge {
29 struct of_device ofdev;
27 struct sparc_isa_bridge *next; 30 struct sparc_isa_bridge *next;
28 struct sparc_isa_device *devices; 31 struct sparc_isa_device *devices;
29 struct pci_pbm_info *parent; 32 struct pci_pbm_info *parent;
30 struct pci_dev *self; 33 struct pci_dev *self;
31 int index; 34 int index;
32 int prom_node; 35 struct device_node *prom_node;
33 char prom_name[64];
34#define linux_prom_isa_ranges linux_prom_ebus_ranges
35 struct linux_prom_isa_ranges isa_ranges[PROMREG_MAX];
36 int num_isa_ranges;
37#define linux_prom_isa_intmap linux_prom_ebus_intmap
38 struct linux_prom_isa_intmap isa_intmap[PROMREG_MAX];
39 int num_isa_intmap;
40#define linux_prom_isa_intmask linux_prom_ebus_intmask
41 struct linux_prom_isa_intmap isa_intmask;
42}; 36};
37#define to_isa_bridge(d) container_of(d, struct sparc_isa_bridge, ofdev.dev)
43 38
44extern struct sparc_isa_bridge *isa_chain; 39extern struct sparc_isa_bridge *isa_chain;
45 40
diff --git a/include/asm-sparc64/of_device.h b/include/asm-sparc64/of_device.h
new file mode 100644
index 000000000000..024088ef9d27
--- /dev/null
+++ b/include/asm-sparc64/of_device.h
@@ -0,0 +1,64 @@
1#ifndef _ASM_SPARC64_OF_DEVICE_H
2#define _ASM_SPARC64_OF_DEVICE_H
3#ifdef __KERNEL__
4
5#include <linux/device.h>
6#include <linux/mod_devicetable.h>
7#include <asm/prom.h>
8
9extern struct bus_type isa_bus_type;
10extern struct bus_type ebus_bus_type;
11extern struct bus_type sbus_bus_type;
12
13/*
14 * The of_device is a kind of "base class" that is a superset of
15 * struct device for use by devices attached to an OF node and
16 * probed using OF properties.
17 */
18struct of_device
19{
20 struct device_node *node; /* OF device node */
21 struct device dev; /* Generic device interface */
22};
23#define to_of_device(d) container_of(d, struct of_device, dev)
24
25extern const struct of_device_id *of_match_device(
26 const struct of_device_id *matches, const struct of_device *dev);
27
28extern struct of_device *of_dev_get(struct of_device *dev);
29extern void of_dev_put(struct of_device *dev);
30
31/*
32 * An of_platform_driver driver is attached to a basic of_device on
33 * the ISA, EBUS, and SBUS busses on sparc64.
34 */
35struct of_platform_driver
36{
37 char *name;
38 struct of_device_id *match_table;
39 struct module *owner;
40
41 int (*probe)(struct of_device* dev, const struct of_device_id *match);
42 int (*remove)(struct of_device* dev);
43
44 int (*suspend)(struct of_device* dev, pm_message_t state);
45 int (*resume)(struct of_device* dev);
46 int (*shutdown)(struct of_device* dev);
47
48 struct device_driver driver;
49};
50#define to_of_platform_driver(drv) container_of(drv,struct of_platform_driver, driver)
51
52extern int of_register_driver(struct of_platform_driver *drv,
53 struct bus_type *bus);
54extern void of_unregister_driver(struct of_platform_driver *drv);
55extern int of_device_register(struct of_device *ofdev);
56extern void of_device_unregister(struct of_device *ofdev);
57extern struct of_device *of_platform_device_create(struct device_node *np,
58 const char *bus_id,
59 struct device *parent,
60 struct bus_type *bus);
61extern void of_release_dev(struct device *dev);
62
63#endif /* __KERNEL__ */
64#endif /* _ASM_SPARC64_OF_DEVICE_H */
diff --git a/include/asm-sparc64/oplib.h b/include/asm-sparc64/oplib.h
index dea3e73f0955..a68b0bb05958 100644
--- a/include/asm-sparc64/oplib.h
+++ b/include/asm-sparc64/oplib.h
@@ -323,8 +323,9 @@ extern int prom_pathtoinode(const char *path);
323extern int prom_inst2pkg(int); 323extern int prom_inst2pkg(int);
324 324
325/* CPU probing helpers. */ 325/* CPU probing helpers. */
326int cpu_find_by_instance(int instance, int *prom_node, int *mid); 326struct device_node;
327int cpu_find_by_mid(int mid, int *prom_node); 327int cpu_find_by_instance(int instance, struct device_node **dev_node, int *mid);
328int cpu_find_by_mid(int mid, struct device_node **prom_node);
328 329
329/* Client interface level routines. */ 330/* Client interface level routines. */
330extern void prom_set_trap_table(unsigned long tba); 331extern void prom_set_trap_table(unsigned long tba);
diff --git a/include/asm-sparc64/parport.h b/include/asm-sparc64/parport.h
index 56b5197d7898..d3895873e4c7 100644
--- a/include/asm-sparc64/parport.h
+++ b/include/asm-sparc64/parport.h
@@ -67,18 +67,17 @@ static __inline__ unsigned int get_dma_residue(unsigned int dmanr)
67 67
68static int ebus_ecpp_p(struct linux_ebus_device *edev) 68static int ebus_ecpp_p(struct linux_ebus_device *edev)
69{ 69{
70 if (!strcmp(edev->prom_name, "ecpp")) 70 if (!strcmp(edev->prom_node->name, "ecpp"))
71 return 1; 71 return 1;
72 if (!strcmp(edev->prom_name, "parallel")) { 72 if (!strcmp(edev->prom_node->name, "parallel")) {
73 char compat[19]; 73 char *compat;
74 prom_getstring(edev->prom_node, 74
75 "compatible", 75 compat = of_get_property(edev->prom_node,
76 compat, sizeof(compat)); 76 "compatible", NULL);
77 compat[18] = '\0'; 77 if (compat &&
78 if (!strcmp(compat, "ecpp")) 78 (!strcmp(compat, "ecpp") ||
79 return 1; 79 !strcmp(compat, "ns87317-ecpp") ||
80 if (!strcmp(compat, "ns87317-ecpp") && 80 !strcmp(compat + 13, "ecpp")))
81 !strcmp(compat + 13, "ecpp"))
82 return 1; 81 return 1;
83 } 82 }
84 return 0; 83 return 0;
@@ -94,12 +93,12 @@ static int parport_isa_probe(int count)
94 struct sparc_isa_device *child; 93 struct sparc_isa_device *child;
95 unsigned long base; 94 unsigned long base;
96 95
97 if (strcmp(isa_dev->prom_name, "dma")) 96 if (strcmp(isa_dev->prom_node->name, "dma"))
98 continue; 97 continue;
99 98
100 child = isa_dev->child; 99 child = isa_dev->child;
101 while (child) { 100 while (child) {
102 if (!strcmp(child->prom_name, "parallel")) 101 if (!strcmp(child->prom_node->name, "parallel"))
103 break; 102 break;
104 child = child->next; 103 child = child->next;
105 } 104 }
diff --git a/include/asm-sparc64/pbm.h b/include/asm-sparc64/pbm.h
index 1396f110939a..cebe80b1da6c 100644
--- a/include/asm-sparc64/pbm.h
+++ b/include/asm-sparc64/pbm.h
@@ -15,6 +15,7 @@
15#include <asm/io.h> 15#include <asm/io.h>
16#include <asm/page.h> 16#include <asm/page.h>
17#include <asm/oplib.h> 17#include <asm/oplib.h>
18#include <asm/prom.h>
18#include <asm/iommu.h> 19#include <asm/iommu.h>
19 20
20/* The abstraction used here is that there are PCI controllers, 21/* The abstraction used here is that there are PCI controllers,
@@ -153,16 +154,15 @@ struct pci_pbm_info {
153 int chip_revision; 154 int chip_revision;
154 155
155 /* Name used for top-level resources. */ 156 /* Name used for top-level resources. */
156 char name[64]; 157 char *name;
157 158
158 /* OBP specific information. */ 159 /* OBP specific information. */
159 int prom_node; 160 struct device_node *prom_node;
160 char prom_name[64]; 161 struct linux_prom_pci_ranges *pbm_ranges;
161 struct linux_prom_pci_ranges pbm_ranges[PROM_PCIRNG_MAX];
162 int num_pbm_ranges; 162 int num_pbm_ranges;
163 struct linux_prom_pci_intmap pbm_intmap[PROM_PCIIMAP_MAX]; 163 struct linux_prom_pci_intmap *pbm_intmap;
164 int num_pbm_intmap; 164 int num_pbm_intmap;
165 struct linux_prom_pci_intmask pbm_intmask; 165 struct linux_prom_pci_intmask *pbm_intmask;
166 u64 ino_bitmap; 166 u64 ino_bitmap;
167 167
168 /* PBM I/O and Memory space resources. */ 168 /* PBM I/O and Memory space resources. */
@@ -227,8 +227,7 @@ struct pci_controller_info {
227 */ 227 */
228struct pcidev_cookie { 228struct pcidev_cookie {
229 struct pci_pbm_info *pbm; 229 struct pci_pbm_info *pbm;
230 char prom_name[64]; 230 struct device_node *prom_node;
231 int prom_node;
232 struct linux_prom_pci_registers prom_regs[PROMREG_MAX]; 231 struct linux_prom_pci_registers prom_regs[PROMREG_MAX];
233 int num_prom_regs; 232 int num_prom_regs;
234 struct linux_prom_pci_registers prom_assignments[PROMREG_MAX]; 233 struct linux_prom_pci_registers prom_assignments[PROMREG_MAX];
diff --git a/include/asm-sparc64/percpu.h b/include/asm-sparc64/percpu.h
index baef13b58952..a6ece06b83db 100644
--- a/include/asm-sparc64/percpu.h
+++ b/include/asm-sparc64/percpu.h
@@ -21,6 +21,7 @@ register unsigned long __local_per_cpu_offset asm("g5");
21/* var is in discarded region: offset to particular copy we want */ 21/* var is in discarded region: offset to particular copy we want */
22#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu))) 22#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu)))
23#define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __local_per_cpu_offset)) 23#define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __local_per_cpu_offset))
24#define __raw_get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __local_per_cpu_offset))
24 25
25/* A macro to avoid #include hell... */ 26/* A macro to avoid #include hell... */
26#define percpu_modcopy(pcpudst, src, size) \ 27#define percpu_modcopy(pcpudst, src, size) \
@@ -37,6 +38,7 @@ do { \
37 38
38#define per_cpu(var, cpu) (*((void)cpu, &per_cpu__##var)) 39#define per_cpu(var, cpu) (*((void)cpu, &per_cpu__##var))
39#define __get_cpu_var(var) per_cpu__##var 40#define __get_cpu_var(var) per_cpu__##var
41#define __raw_get_cpu_var(var) per_cpu__##var
40 42
41#endif /* SMP */ 43#endif /* SMP */
42 44
diff --git a/include/asm-sparc64/pgtable.h b/include/asm-sparc64/pgtable.h
index 4e218814bb3c..03f5bc9b6bec 100644
--- a/include/asm-sparc64/pgtable.h
+++ b/include/asm-sparc64/pgtable.h
@@ -756,6 +756,8 @@ extern unsigned long *sparc64_valid_addr_bitmap;
756#define kern_addr_valid(addr) \ 756#define kern_addr_valid(addr) \
757 (test_bit(__pa((unsigned long)(addr))>>22, sparc64_valid_addr_bitmap)) 757 (test_bit(__pa((unsigned long)(addr))>>22, sparc64_valid_addr_bitmap))
758 758
759extern int page_in_phys_avail(unsigned long paddr);
760
759extern int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from, 761extern int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from,
760 unsigned long pfn, 762 unsigned long pfn,
761 unsigned long size, pgprot_t prot); 763 unsigned long size, pgprot_t prot);
diff --git a/include/asm-sparc64/prom.h b/include/asm-sparc64/prom.h
new file mode 100644
index 000000000000..6d1556c0c263
--- /dev/null
+++ b/include/asm-sparc64/prom.h
@@ -0,0 +1,98 @@
1#ifndef _SPARC64_PROM_H
2#define _SPARC64_PROM_H
3#ifdef __KERNEL__
4
5
6/*
7 * Definitions for talking to the Open Firmware PROM on
8 * Power Macintosh computers.
9 *
10 * Copyright (C) 1996-2005 Paul Mackerras.
11 *
12 * Updates for PPC64 by Peter Bergner & David Engebretsen, IBM Corp.
13 * Updates for SPARC64 by David S. Miller
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version
18 * 2 of the License, or (at your option) any later version.
19 */
20
21#include <linux/types.h>
22#include <linux/proc_fs.h>
23#include <asm/atomic.h>
24
25typedef u32 phandle;
26typedef u32 ihandle;
27
28struct interrupt_info {
29 int line;
30 int sense; /* +ve/-ve logic, edge or level, etc. */
31};
32
33struct property {
34 char *name;
35 int length;
36 void *value;
37 struct property *next;
38};
39
40struct device_node {
41 char *name;
42 char *type;
43 phandle node;
44 phandle linux_phandle;
45 int n_intrs;
46 struct interrupt_info *intrs;
47 char *path_component_name;
48 char *full_name;
49
50 struct property *properties;
51 struct property *deadprops; /* removed properties */
52 struct device_node *parent;
53 struct device_node *child;
54 struct device_node *sibling;
55 struct device_node *next; /* next device of same type */
56 struct device_node *allnext; /* next in list of all nodes */
57 struct proc_dir_entry *pde; /* this node's proc directory */
58 struct kref kref;
59 unsigned long _flags;
60 void *data;
61};
62
63static inline void set_node_proc_entry(struct device_node *dn, struct proc_dir_entry *de)
64{
65 dn->pde = de;
66}
67
68extern struct device_node *of_find_node_by_name(struct device_node *from,
69 const char *name);
70#define for_each_node_by_name(dn, name) \
71 for (dn = of_find_node_by_name(NULL, name); dn; \
72 dn = of_find_node_by_name(dn, name))
73extern struct device_node *of_find_node_by_type(struct device_node *from,
74 const char *type);
75#define for_each_node_by_type(dn, type) \
76 for (dn = of_find_node_by_type(NULL, type); dn; \
77 dn = of_find_node_by_type(dn, type))
78extern struct device_node *of_find_compatible_node(struct device_node *from,
79 const char *type, const char *compat);
80extern struct device_node *of_find_node_by_path(const char *path);
81extern struct device_node *of_find_node_by_phandle(phandle handle);
82extern struct device_node *of_get_parent(const struct device_node *node);
83extern struct device_node *of_get_next_child(const struct device_node *node,
84 struct device_node *prev);
85extern struct property *of_find_property(struct device_node *np,
86 const char *name,
87 int *lenp);
88extern int of_device_is_compatible(struct device_node *device, const char *);
89extern void *of_get_property(struct device_node *node, const char *name,
90 int *lenp);
91extern int of_getintprop_default(struct device_node *np,
92 const char *name,
93 int def);
94
95extern void prom_build_devicetree(void);
96
97#endif /* __KERNEL__ */
98#endif /* _SPARC64_PROM_H */
diff --git a/include/asm-sparc64/sbus.h b/include/asm-sparc64/sbus.h
index 48279e10f385..56ee985e4605 100644
--- a/include/asm-sparc64/sbus.h
+++ b/include/asm-sparc64/sbus.h
@@ -11,6 +11,8 @@
11#include <linux/ioport.h> 11#include <linux/ioport.h>
12 12
13#include <asm/oplib.h> 13#include <asm/oplib.h>
14#include <asm/prom.h>
15#include <asm/of_device.h>
14#include <asm/iommu.h> 16#include <asm/iommu.h>
15#include <asm/scatterlist.h> 17#include <asm/scatterlist.h>
16 18
@@ -42,18 +44,19 @@ struct sbus_bus;
42 44
43/* Linux SBUS device tables */ 45/* Linux SBUS device tables */
44struct sbus_dev { 46struct sbus_dev {
45 struct sbus_bus *bus; /* Our toplevel parent SBUS */ 47 struct of_device ofdev;
46 struct sbus_dev *next; /* Chain of siblings */ 48 struct sbus_bus *bus;
47 struct sbus_dev *child; /* Chain of children */ 49 struct sbus_dev *next;
48 struct sbus_dev *parent;/* Parent device if not toplevel*/ 50 struct sbus_dev *child;
49 int prom_node; /* OBP node of this device */ 51 struct sbus_dev *parent;
50 char prom_name[64]; /* OBP device name property */ 52 int prom_node;
51 int slot; /* SBUS slot number */ 53 char prom_name[64];
54 int slot;
52 55
53 struct resource resource[PROMREG_MAX]; 56 struct resource resource[PROMREG_MAX];
54 57
55 struct linux_prom_registers reg_addrs[PROMREG_MAX]; 58 struct linux_prom_registers reg_addrs[PROMREG_MAX];
56 int num_registers, ranges_applied; 59 int num_registers;
57 60
58 struct linux_prom_ranges device_ranges[PROMREG_MAX]; 61 struct linux_prom_ranges device_ranges[PROMREG_MAX];
59 int num_device_ranges; 62 int num_device_ranges;
@@ -61,9 +64,11 @@ struct sbus_dev {
61 unsigned int irqs[4]; 64 unsigned int irqs[4];
62 int num_irqs; 65 int num_irqs;
63}; 66};
67#define to_sbus_device(d) container_of(d, struct sbus_dev, ofdev.dev)
64 68
65/* This struct describes the SBus(s) found on this machine. */ 69/* This struct describes the SBus(s) found on this machine. */
66struct sbus_bus { 70struct sbus_bus {
71 struct of_device ofdev;
67 void *iommu; /* Opaque IOMMU cookie */ 72 void *iommu; /* Opaque IOMMU cookie */
68 struct sbus_dev *devices; /* Tree of SBUS devices */ 73 struct sbus_dev *devices; /* Tree of SBUS devices */
69 struct sbus_bus *next; /* Next SBUS in system */ 74 struct sbus_bus *next; /* Next SBUS in system */
@@ -77,6 +82,7 @@ struct sbus_bus {
77 int portid; 82 int portid;
78 void *starfire_cookie; 83 void *starfire_cookie;
79}; 84};
85#define to_sbus(d) container_of(d, struct sbus_bus, ofdev.dev)
80 86
81extern struct sbus_bus *sbus_root; 87extern struct sbus_bus *sbus_root;
82 88
@@ -95,6 +101,7 @@ extern struct sbus_bus *sbus_root;
95#define sbus_can_dma_64bit(sdev) (1) 101#define sbus_can_dma_64bit(sdev) (1)
96#define sbus_can_burst64(sdev) (1) 102#define sbus_can_burst64(sdev) (1)
97extern void sbus_set_sbus64(struct sbus_dev *, int); 103extern void sbus_set_sbus64(struct sbus_dev *, int);
104extern void sbus_fill_device_irq(struct sbus_dev *);
98 105
99/* These yield IOMMU mappings in consistent mode. */ 106/* These yield IOMMU mappings in consistent mode. */
100extern void *sbus_alloc_consistent(struct sbus_dev *, size_t, dma_addr_t *dma_addrp); 107extern void *sbus_alloc_consistent(struct sbus_dev *, size_t, dma_addr_t *dma_addrp);
@@ -119,4 +126,10 @@ extern void sbus_dma_sync_sg_for_cpu(struct sbus_dev *, struct scatterlist *, in
119#define sbus_dma_sync_sg sbus_dma_sync_sg_for_cpu 126#define sbus_dma_sync_sg sbus_dma_sync_sg_for_cpu
120extern void sbus_dma_sync_sg_for_device(struct sbus_dev *, struct scatterlist *, int, int); 127extern void sbus_dma_sync_sg_for_device(struct sbus_dev *, struct scatterlist *, int, int);
121 128
129extern void sbus_arch_bus_ranges_init(struct device_node *, struct sbus_bus *);
130extern void sbus_setup_iommu(struct sbus_bus *, struct device_node *);
131extern void sbus_setup_arch_props(struct sbus_bus *, struct device_node *);
132extern int sbus_arch_preinit(void);
133extern void sbus_arch_postinit(void);
134
122#endif /* !(_SPARC64_SBUS_H) */ 135#endif /* !(_SPARC64_SBUS_H) */
diff --git a/include/asm-sparc64/vdev.h b/include/asm-sparc64/vdev.h
index 996e6be7b976..25637c57675d 100644
--- a/include/asm-sparc64/vdev.h
+++ b/include/asm-sparc64/vdev.h
@@ -7,10 +7,11 @@
7#define _SPARC64_VDEV_H 7#define _SPARC64_VDEV_H
8 8
9#include <linux/types.h> 9#include <linux/types.h>
10#include <asm/prom.h>
10 11
11extern u32 sun4v_vdev_devhandle; 12extern u32 sun4v_vdev_devhandle;
12extern int sun4v_vdev_root; 13extern struct device_node *sun4v_vdev_root;
13 14
14extern unsigned int sun4v_vdev_device_interrupt(unsigned int); 15extern unsigned int sun4v_vdev_device_interrupt(struct device_node *dev_node);
15 16
16#endif /* !(_SPARC64_VDEV_H) */ 17#endif /* !(_SPARC64_VDEV_H) */
diff --git a/include/asm-sparc64/vga.h b/include/asm-sparc64/vga.h
index 9c57eb363b40..c69d5b2ba19a 100644
--- a/include/asm-sparc64/vga.h
+++ b/include/asm-sparc64/vga.h
@@ -28,6 +28,6 @@ static inline u16 scr_readw(const u16 *addr)
28 return *addr; 28 return *addr;
29} 29}
30 30
31#define VGA_MAP_MEM(x) (x) 31#define VGA_MAP_MEM(x,s) (x)
32 32
33#endif 33#endif
diff --git a/include/asm-v850/irq.h b/include/asm-v850/irq.h
index 44431152b36d..1bf096db8f4c 100644
--- a/include/asm-v850/irq.h
+++ b/include/asm-v850/irq.h
@@ -62,8 +62,6 @@ extern void disable_irq (unsigned int irq);
62/* Disable an irq without waiting. */ 62/* Disable an irq without waiting. */
63extern void disable_irq_nosync (unsigned int irq); 63extern void disable_irq_nosync (unsigned int irq);
64 64
65extern int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *);
66
67#endif /* !__ASSEMBLY__ */ 65#endif /* !__ASSEMBLY__ */
68 66
69#endif /* __V850_IRQ_H__ */ 67#endif /* __V850_IRQ_H__ */
diff --git a/include/asm-x86_64/acpi.h b/include/asm-x86_64/acpi.h
index aa1c7b2e438c..2c95a319c056 100644
--- a/include/asm-x86_64/acpi.h
+++ b/include/asm-x86_64/acpi.h
@@ -162,6 +162,8 @@ extern int acpi_pci_disabled;
162 162
163extern u8 x86_acpiid_to_apicid[]; 163extern u8 x86_acpiid_to_apicid[];
164 164
165#define ARCH_HAS_POWER_INIT 1
166
165extern int acpi_skip_timer_override; 167extern int acpi_skip_timer_override;
166 168
167#endif /*__KERNEL__*/ 169#endif /*__KERNEL__*/
diff --git a/include/asm-x86_64/apicdef.h b/include/asm-x86_64/apicdef.h
index 5a48e9bcf218..1dd40067c67c 100644
--- a/include/asm-x86_64/apicdef.h
+++ b/include/asm-x86_64/apicdef.h
@@ -137,8 +137,6 @@
137 */ 137 */
138#define u32 unsigned int 138#define u32 unsigned int
139 139
140#define lapic ((volatile struct local_apic *)APIC_BASE)
141
142struct local_apic { 140struct local_apic {
143 141
144/*000*/ struct { u32 __reserved[4]; } __reserved_01; 142/*000*/ struct { u32 __reserved[4]; } __reserved_01;
diff --git a/include/asm-x86_64/floppy.h b/include/asm-x86_64/floppy.h
index 52825ce689f2..006291e89b4a 100644
--- a/include/asm-x86_64/floppy.h
+++ b/include/asm-x86_64/floppy.h
@@ -147,10 +147,8 @@ static int fd_request_irq(void)
147 return request_irq(FLOPPY_IRQ, floppy_hardint,SA_INTERRUPT, 147 return request_irq(FLOPPY_IRQ, floppy_hardint,SA_INTERRUPT,
148 "floppy", NULL); 148 "floppy", NULL);
149 else 149 else
150 return request_irq(FLOPPY_IRQ, floppy_interrupt, 150 return request_irq(FLOPPY_IRQ, floppy_interrupt, SA_INTERRUPT,
151 SA_INTERRUPT|SA_SAMPLE_RANDOM, 151 "floppy", NULL);
152 "floppy", NULL);
153
154} 152}
155 153
156static unsigned long dma_mem_alloc(unsigned long size) 154static unsigned long dma_mem_alloc(unsigned long size)
diff --git a/include/asm-x86_64/mmzone.h b/include/asm-x86_64/mmzone.h
index 70bb9969766e..c38ebdf6f426 100644
--- a/include/asm-x86_64/mmzone.h
+++ b/include/asm-x86_64/mmzone.h
@@ -42,7 +42,6 @@ static inline __attribute__((pure)) int phys_to_nid(unsigned long addr)
42 42
43#ifdef CONFIG_DISCONTIGMEM 43#ifdef CONFIG_DISCONTIGMEM
44#define pfn_to_nid(pfn) phys_to_nid((unsigned long)(pfn) << PAGE_SHIFT) 44#define pfn_to_nid(pfn) phys_to_nid((unsigned long)(pfn) << PAGE_SHIFT)
45#define kvaddr_to_nid(kaddr) phys_to_nid(__pa(kaddr))
46 45
47extern int pfn_valid(unsigned long pfn); 46extern int pfn_valid(unsigned long pfn);
48#endif 47#endif
diff --git a/include/asm-x86_64/msi.h b/include/asm-x86_64/msi.h
index 356e0e82f50b..3ad2346624b2 100644
--- a/include/asm-x86_64/msi.h
+++ b/include/asm-x86_64/msi.h
@@ -10,7 +10,15 @@
10#include <asm/mach_apic.h> 10#include <asm/mach_apic.h>
11#include <asm/smp.h> 11#include <asm/smp.h>
12 12
13#define LAST_DEVICE_VECTOR 232 13#define LAST_DEVICE_VECTOR (FIRST_SYSTEM_VECTOR - 1)
14#define MSI_TARGET_CPU_SHIFT 12 14#define MSI_TARGET_CPU_SHIFT 12
15 15
16extern struct msi_ops msi_apic_ops;
17
18static inline int msi_arch_init(void)
19{
20 msi_register(&msi_apic_ops);
21 return 0;
22}
23
16#endif /* ASM_MSI_H */ 24#endif /* ASM_MSI_H */
diff --git a/include/asm-x86_64/numa.h b/include/asm-x86_64/numa.h
index 1cc92fe02503..933ff11ece15 100644
--- a/include/asm-x86_64/numa.h
+++ b/include/asm-x86_64/numa.h
@@ -8,7 +8,6 @@ struct bootnode {
8}; 8};
9 9
10extern int compute_hash_shift(struct bootnode *nodes, int numnodes); 10extern int compute_hash_shift(struct bootnode *nodes, int numnodes);
11extern int pxm_to_node(int nid);
12 11
13#define ZONE_ALIGN (1UL << (MAX_ORDER+PAGE_SHIFT)) 12#define ZONE_ALIGN (1UL << (MAX_ORDER+PAGE_SHIFT))
14 13
diff --git a/include/asm-x86_64/percpu.h b/include/asm-x86_64/percpu.h
index 7f33aaf9f7b1..549eb929b2c0 100644
--- a/include/asm-x86_64/percpu.h
+++ b/include/asm-x86_64/percpu.h
@@ -21,6 +21,7 @@
21/* var is in discarded region: offset to particular copy we want */ 21/* var is in discarded region: offset to particular copy we want */
22#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu))) 22#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu)))
23#define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __my_cpu_offset())) 23#define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __my_cpu_offset()))
24#define __raw_get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __my_cpu_offset()))
24 25
25/* A macro to avoid #include hell... */ 26/* A macro to avoid #include hell... */
26#define percpu_modcopy(pcpudst, src, size) \ 27#define percpu_modcopy(pcpudst, src, size) \
@@ -40,6 +41,7 @@ extern void setup_per_cpu_areas(void);
40 41
41#define per_cpu(var, cpu) (*((void)(cpu), &per_cpu__##var)) 42#define per_cpu(var, cpu) (*((void)(cpu), &per_cpu__##var))
42#define __get_cpu_var(var) per_cpu__##var 43#define __get_cpu_var(var) per_cpu__##var
44#define __raw_get_cpu_var(var) per_cpu__##var
43 45
44#endif /* SMP */ 46#endif /* SMP */
45 47
diff --git a/include/asm-x86_64/unistd.h b/include/asm-x86_64/unistd.h
index 0aff22bdbb21..94387c915e53 100644
--- a/include/asm-x86_64/unistd.h
+++ b/include/asm-x86_64/unistd.h
@@ -617,10 +617,12 @@ __SYSCALL(__NR_tee, sys_tee)
617__SYSCALL(__NR_sync_file_range, sys_sync_file_range) 617__SYSCALL(__NR_sync_file_range, sys_sync_file_range)
618#define __NR_vmsplice 278 618#define __NR_vmsplice 278
619__SYSCALL(__NR_vmsplice, sys_vmsplice) 619__SYSCALL(__NR_vmsplice, sys_vmsplice)
620#define __NR_move_pages 279
621__SYSCALL(__NR_move_pages, sys_move_pages)
620 622
621#ifdef __KERNEL__ 623#ifdef __KERNEL__
622 624
623#define __NR_syscall_max __NR_vmsplice 625#define __NR_syscall_max __NR_move_pages
624 626
625#ifndef __NO_STUBS 627#ifndef __NO_STUBS
626 628
diff --git a/include/asm-x86_64/vga.h b/include/asm-x86_64/vga.h
index ef0c0e50cc95..0ecf68ac03aa 100644
--- a/include/asm-x86_64/vga.h
+++ b/include/asm-x86_64/vga.h
@@ -12,7 +12,7 @@
12 * access the videoram directly without any black magic. 12 * access the videoram directly without any black magic.
13 */ 13 */
14 14
15#define VGA_MAP_MEM(x) (unsigned long)phys_to_virt(x) 15#define VGA_MAP_MEM(x,s) (unsigned long)phys_to_virt(x)
16 16
17#define vga_readb(x) (*(x)) 17#define vga_readb(x) (*(x))
18#define vga_writeb(x,y) (*(y) = (x)) 18#define vga_writeb(x,y) (*(y) = (x))
diff --git a/include/asm-xtensa/checksum.h b/include/asm-xtensa/checksum.h
index bdc00ae9be48..03114f8d1e18 100644
--- a/include/asm-xtensa/checksum.h
+++ b/include/asm-xtensa/checksum.h
@@ -43,8 +43,7 @@ asmlinkage unsigned int csum_partial_copy_generic( const char *src, char *dst, i
43 * Note: when you get a NULL pointer exception here this means someone 43 * Note: when you get a NULL pointer exception here this means someone
44 * passed in an incorrect kernel address to one of these functions. 44 * passed in an incorrect kernel address to one of these functions.
45 * 45 *
46 * If you use these functions directly please don't forget the 46 * If you use these functions directly please don't forget the access_ok().
47 * verify_area().
48 */ 47 */
49static inline 48static inline
50unsigned int csum_partial_copy_nocheck ( const char *src, char *dst, 49unsigned int csum_partial_copy_nocheck ( const char *src, char *dst,
diff --git a/include/asm-xtensa/rwsem.h b/include/asm-xtensa/rwsem.h
index 3c02b0e033f0..abcd86dc5ab9 100644
--- a/include/asm-xtensa/rwsem.h
+++ b/include/asm-xtensa/rwsem.h
@@ -172,4 +172,9 @@ static inline int rwsem_atomic_update(int delta, struct rw_semaphore *sem)
172 return atomic_add_return(delta, (atomic_t *)(&sem->count)); 172 return atomic_add_return(delta, (atomic_t *)(&sem->count));
173} 173}
174 174
175#endif /* _XTENSA_RWSEM_XADD_H */ 175static inline int rwsem_is_locked(struct rw_semaphore *sem)
176{
177 return (sem->count != 0);
178}
179
180#endif /* _XTENSA_RWSEM_H */
diff --git a/include/asm-xtensa/uaccess.h b/include/asm-xtensa/uaccess.h
index 06a22b83ba17..88a64e1144d5 100644
--- a/include/asm-xtensa/uaccess.h
+++ b/include/asm-xtensa/uaccess.h
@@ -154,35 +154,6 @@
154.Laccess_ok_\@: 154.Laccess_ok_\@:
155 .endm 155 .endm
156 156
157/*
158 * verify_area determines whether a memory access is allowed. It's
159 * mostly an unnecessary wrapper for access_ok, but we provide it as a
160 * duplicate of the verify_area() C inline function below. See the
161 * equivalent C version below for clarity.
162 *
163 * On error, verify_area branches to a label indicated by parameter
164 * <error>. This implies that the macro falls through to the next
165 * instruction on success.
166 *
167 * Note that we assume success is the common case, and we optimize the
168 * branch fall-through case on success.
169 *
170 * On Entry:
171 * <aa> register containing memory address
172 * <as> register containing memory size
173 * <at> temp register
174 * <error> label to branch to on error; implies fall-through
175 * macro on success
176 * On Exit:
177 * <aa> preserved
178 * <as> preserved
179 * <at> destroyed
180 */
181 .macro verify_area aa, as, at, sp, error
182 access_ok \at, \aa, \as, \sp, \error
183 .endm
184
185
186#else /* __ASSEMBLY__ not defined */ 157#else /* __ASSEMBLY__ not defined */
187 158
188#include <linux/sched.h> 159#include <linux/sched.h>
@@ -211,11 +182,6 @@
211#define __access_ok(addr,size) (__kernel_ok || __user_ok((addr),(size))) 182#define __access_ok(addr,size) (__kernel_ok || __user_ok((addr),(size)))
212#define access_ok(type,addr,size) __access_ok((unsigned long)(addr),(size)) 183#define access_ok(type,addr,size) __access_ok((unsigned long)(addr),(size))
213 184
214static inline int verify_area(int type, const void * addr, unsigned long size)
215{
216 return access_ok(type,addr,size) ? 0 : -EFAULT;
217}
218
219/* 185/*
220 * These are the main single-value transfer routines. They 186 * These are the main single-value transfer routines. They
221 * automatically use the right size if we just have the right pointer 187 * automatically use the right size if we just have the right pointer
diff --git a/include/asm-xtensa/vga.h b/include/asm-xtensa/vga.h
index 23d82f6acb57..1fd8cab3a297 100644
--- a/include/asm-xtensa/vga.h
+++ b/include/asm-xtensa/vga.h
@@ -11,7 +11,7 @@
11#ifndef _XTENSA_VGA_H 11#ifndef _XTENSA_VGA_H
12#define _XTENSA_VGA_H 12#define _XTENSA_VGA_H
13 13
14#define VGA_MAP_MEM(x) (unsigned long)phys_to_virt(x) 14#define VGA_MAP_MEM(x,s) (unsigned long)phys_to_virt(x)
15 15
16#define vga_readb(x) (*(x)) 16#define vga_readb(x) (*(x))
17#define vga_writeb(x,y) (*(y) = (x)) 17#define vga_writeb(x,y) (*(y) = (x))
diff --git a/include/linux/acct.h b/include/linux/acct.h
index 3d54fbcf969e..e86bae7324d2 100644
--- a/include/linux/acct.h
+++ b/include/linux/acct.h
@@ -121,13 +121,17 @@ struct vfsmount;
121struct super_block; 121struct super_block;
122extern void acct_auto_close_mnt(struct vfsmount *m); 122extern void acct_auto_close_mnt(struct vfsmount *m);
123extern void acct_auto_close(struct super_block *sb); 123extern void acct_auto_close(struct super_block *sb);
124extern void acct_process(long exitcode); 124extern void acct_init_pacct(struct pacct_struct *pacct);
125extern void acct_collect(long exitcode, int group_dead);
126extern void acct_process(void);
125extern void acct_update_integrals(struct task_struct *tsk); 127extern void acct_update_integrals(struct task_struct *tsk);
126extern void acct_clear_integrals(struct task_struct *tsk); 128extern void acct_clear_integrals(struct task_struct *tsk);
127#else 129#else
128#define acct_auto_close_mnt(x) do { } while (0) 130#define acct_auto_close_mnt(x) do { } while (0)
129#define acct_auto_close(x) do { } while (0) 131#define acct_auto_close(x) do { } while (0)
130#define acct_process(x) do { } while (0) 132#define acct_init_pacct(x) do { } while (0)
133#define acct_collect(x,y) do { } while (0)
134#define acct_process() do { } while (0)
131#define acct_update_integrals(x) do { } while (0) 135#define acct_update_integrals(x) do { } while (0)
132#define acct_clear_integrals(task) do { } while (0) 136#define acct_clear_integrals(task) do { } while (0)
133#endif 137#endif
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 1cf0b91d05bd..90d6df1551ed 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -37,6 +37,7 @@
37#include <acpi/acpi.h> 37#include <acpi/acpi.h>
38#include <acpi/acpi_bus.h> 38#include <acpi/acpi_bus.h>
39#include <acpi/acpi_drivers.h> 39#include <acpi/acpi_drivers.h>
40#include <acpi/acpi_numa.h>
40#include <asm/acpi.h> 41#include <asm/acpi.h>
41 42
42 43
@@ -407,10 +408,18 @@ void acpi_table_print_madt_entry (acpi_table_entry_header *madt);
407void acpi_table_print_srat_entry (acpi_table_entry_header *srat); 408void acpi_table_print_srat_entry (acpi_table_entry_header *srat);
408 409
409/* the following four functions are architecture-dependent */ 410/* the following four functions are architecture-dependent */
411#ifdef CONFIG_HAVE_ARCH_PARSE_SRAT
412#define NR_NODE_MEMBLKS MAX_NUMNODES
413#define acpi_numa_slit_init(slit) do {} while (0)
414#define acpi_numa_processor_affinity_init(pa) do {} while (0)
415#define acpi_numa_memory_affinity_init(ma) do {} while (0)
416#define acpi_numa_arch_fixup() do {} while (0)
417#else
410void acpi_numa_slit_init (struct acpi_table_slit *slit); 418void acpi_numa_slit_init (struct acpi_table_slit *slit);
411void acpi_numa_processor_affinity_init (struct acpi_table_processor_affinity *pa); 419void acpi_numa_processor_affinity_init (struct acpi_table_processor_affinity *pa);
412void acpi_numa_memory_affinity_init (struct acpi_table_memory_affinity *ma); 420void acpi_numa_memory_affinity_init (struct acpi_table_memory_affinity *ma);
413void acpi_numa_arch_fixup(void); 421void acpi_numa_arch_fixup(void);
422#endif
414 423
415#ifdef CONFIG_ACPI_HOTPLUG_CPU 424#ifdef CONFIG_ACPI_HOTPLUG_CPU
416/* Arch dependent functions for cpu hotplug support */ 425/* Arch dependent functions for cpu hotplug support */
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 312a2c0c64e6..3671af869696 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -97,6 +97,9 @@ enum {
97 ATA_DRQ = (1 << 3), /* data request i/o */ 97 ATA_DRQ = (1 << 3), /* data request i/o */
98 ATA_ERR = (1 << 0), /* have an error */ 98 ATA_ERR = (1 << 0), /* have an error */
99 ATA_SRST = (1 << 2), /* software reset */ 99 ATA_SRST = (1 << 2), /* software reset */
100 ATA_ICRC = (1 << 7), /* interface CRC error */
101 ATA_UNC = (1 << 6), /* uncorrectable media error */
102 ATA_IDNF = (1 << 4), /* ID not found */
100 ATA_ABORTED = (1 << 2), /* command aborted */ 103 ATA_ABORTED = (1 << 2), /* command aborted */
101 104
102 /* ATA command block registers */ 105 /* ATA command block registers */
@@ -130,6 +133,8 @@ enum {
130 ATA_CMD_WRITE = 0xCA, 133 ATA_CMD_WRITE = 0xCA,
131 ATA_CMD_WRITE_EXT = 0x35, 134 ATA_CMD_WRITE_EXT = 0x35,
132 ATA_CMD_WRITE_FUA_EXT = 0x3D, 135 ATA_CMD_WRITE_FUA_EXT = 0x3D,
136 ATA_CMD_FPDMA_READ = 0x60,
137 ATA_CMD_FPDMA_WRITE = 0x61,
133 ATA_CMD_PIO_READ = 0x20, 138 ATA_CMD_PIO_READ = 0x20,
134 ATA_CMD_PIO_READ_EXT = 0x24, 139 ATA_CMD_PIO_READ_EXT = 0x24,
135 ATA_CMD_PIO_WRITE = 0x30, 140 ATA_CMD_PIO_WRITE = 0x30,
@@ -148,6 +153,10 @@ enum {
148 ATA_CMD_INIT_DEV_PARAMS = 0x91, 153 ATA_CMD_INIT_DEV_PARAMS = 0x91,
149 ATA_CMD_READ_NATIVE_MAX = 0xF8, 154 ATA_CMD_READ_NATIVE_MAX = 0xF8,
150 ATA_CMD_READ_NATIVE_MAX_EXT = 0x27, 155 ATA_CMD_READ_NATIVE_MAX_EXT = 0x27,
156 ATA_CMD_READ_LOG_EXT = 0x2f,
157
158 /* READ_LOG_EXT pages */
159 ATA_LOG_SATA_NCQ = 0x10,
151 160
152 /* SETFEATURES stuff */ 161 /* SETFEATURES stuff */
153 SETFEATURES_XFER = 0x03, 162 SETFEATURES_XFER = 0x03,
@@ -172,6 +181,9 @@ enum {
172 XFER_PIO_0 = 0x08, 181 XFER_PIO_0 = 0x08,
173 XFER_PIO_SLOW = 0x00, 182 XFER_PIO_SLOW = 0x00,
174 183
184 SETFEATURES_WC_ON = 0x02, /* Enable write cache */
185 SETFEATURES_WC_OFF = 0x82, /* Disable write cache */
186
175 /* ATAPI stuff */ 187 /* ATAPI stuff */
176 ATAPI_PKT_DMA = (1 << 0), 188 ATAPI_PKT_DMA = (1 << 0),
177 ATAPI_DMADIR = (1 << 2), /* ATAPI data dir: 189 ATAPI_DMADIR = (1 << 2), /* ATAPI data dir:
@@ -192,6 +204,16 @@ enum {
192 SCR_ACTIVE = 3, 204 SCR_ACTIVE = 3,
193 SCR_NOTIFICATION = 4, 205 SCR_NOTIFICATION = 4,
194 206
207 /* SError bits */
208 SERR_DATA_RECOVERED = (1 << 0), /* recovered data error */
209 SERR_COMM_RECOVERED = (1 << 1), /* recovered comm failure */
210 SERR_DATA = (1 << 8), /* unrecovered data error */
211 SERR_PERSISTENT = (1 << 9), /* persistent data/comm error */
212 SERR_PROTOCOL = (1 << 10), /* protocol violation */
213 SERR_INTERNAL = (1 << 11), /* host internal error */
214 SERR_PHYRDY_CHG = (1 << 16), /* PHY RDY changed */
215 SERR_DEV_XCHG = (1 << 26), /* device exchanged */
216
195 /* struct ata_taskfile flags */ 217 /* struct ata_taskfile flags */
196 ATA_TFLAG_LBA48 = (1 << 0), /* enable 48-bit LBA and "HOB" */ 218 ATA_TFLAG_LBA48 = (1 << 0), /* enable 48-bit LBA and "HOB" */
197 ATA_TFLAG_ISADDR = (1 << 1), /* enable r/w to nsect/lba regs */ 219 ATA_TFLAG_ISADDR = (1 << 1), /* enable r/w to nsect/lba regs */
@@ -199,6 +221,7 @@ enum {
199 ATA_TFLAG_WRITE = (1 << 3), /* data dir: host->dev==1 (write) */ 221 ATA_TFLAG_WRITE = (1 << 3), /* data dir: host->dev==1 (write) */
200 ATA_TFLAG_LBA = (1 << 4), /* enable LBA */ 222 ATA_TFLAG_LBA = (1 << 4), /* enable LBA */
201 ATA_TFLAG_FUA = (1 << 5), /* enable FUA */ 223 ATA_TFLAG_FUA = (1 << 5), /* enable FUA */
224 ATA_TFLAG_POLLING = (1 << 6), /* set nIEN to 1 and use polling */
202}; 225};
203 226
204enum ata_tf_protocols { 227enum ata_tf_protocols {
@@ -207,6 +230,7 @@ enum ata_tf_protocols {
207 ATA_PROT_NODATA, /* no data */ 230 ATA_PROT_NODATA, /* no data */
208 ATA_PROT_PIO, /* PIO single sector */ 231 ATA_PROT_PIO, /* PIO single sector */
209 ATA_PROT_DMA, /* DMA */ 232 ATA_PROT_DMA, /* DMA */
233 ATA_PROT_NCQ, /* NCQ */
210 ATA_PROT_ATAPI, /* packet command, PIO data xfer*/ 234 ATA_PROT_ATAPI, /* packet command, PIO data xfer*/
211 ATA_PROT_ATAPI_NODATA, /* packet command, no data */ 235 ATA_PROT_ATAPI_NODATA, /* packet command, no data */
212 ATA_PROT_ATAPI_DMA, /* packet command with special DMA sauce */ 236 ATA_PROT_ATAPI_DMA, /* packet command with special DMA sauce */
@@ -262,6 +286,8 @@ struct ata_taskfile {
262#define ata_id_has_pm(id) ((id)[82] & (1 << 3)) 286#define ata_id_has_pm(id) ((id)[82] & (1 << 3))
263#define ata_id_has_lba(id) ((id)[49] & (1 << 9)) 287#define ata_id_has_lba(id) ((id)[49] & (1 << 9))
264#define ata_id_has_dma(id) ((id)[49] & (1 << 8)) 288#define ata_id_has_dma(id) ((id)[49] & (1 << 8))
289#define ata_id_has_ncq(id) ((id)[76] & (1 << 8))
290#define ata_id_queue_depth(id) (((id)[75] & 0x1f) + 1)
265#define ata_id_removeable(id) ((id)[0] & (1 << 7)) 291#define ata_id_removeable(id) ((id)[0] & (1 << 7))
266#define ata_id_has_dword_io(id) ((id)[50] & (1 << 0)) 292#define ata_id_has_dword_io(id) ((id)[50] & (1 << 0))
267#define ata_id_u32(id,n) \ 293#define ata_id_u32(id,n) \
@@ -272,6 +298,8 @@ struct ata_taskfile {
272 ((u64) (id)[(n) + 1] << 16) | \ 298 ((u64) (id)[(n) + 1] << 16) | \
273 ((u64) (id)[(n) + 0]) ) 299 ((u64) (id)[(n) + 0]) )
274 300
301#define ata_id_cdb_intr(id) (((id)[0] & 0x60) == 0x20)
302
275static inline unsigned int ata_id_major_version(const u16 *id) 303static inline unsigned int ata_id_major_version(const u16 *id)
276{ 304{
277 unsigned int mver; 305 unsigned int mver;
@@ -311,6 +339,15 @@ static inline int is_atapi_taskfile(const struct ata_taskfile *tf)
311 (tf->protocol == ATA_PROT_ATAPI_DMA); 339 (tf->protocol == ATA_PROT_ATAPI_DMA);
312} 340}
313 341
342static inline int is_multi_taskfile(struct ata_taskfile *tf)
343{
344 return (tf->command == ATA_CMD_READ_MULTI) ||
345 (tf->command == ATA_CMD_WRITE_MULTI) ||
346 (tf->command == ATA_CMD_READ_MULTI_EXT) ||
347 (tf->command == ATA_CMD_WRITE_MULTI_EXT) ||
348 (tf->command == ATA_CMD_WRITE_MULTI_FUA_EXT);
349}
350
314static inline int ata_ok(u8 status) 351static inline int ata_ok(u8 status)
315{ 352{
316 return ((status & (ATA_BUSY | ATA_DRDY | ATA_DF | ATA_DRQ | ATA_ERR)) 353 return ((status & (ATA_BUSY | ATA_DRDY | ATA_DF | ATA_DRQ | ATA_ERR))
diff --git a/include/linux/bio.h b/include/linux/bio.h
index b60ffe32cd21..76bdaeab6f62 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -47,7 +47,7 @@
47#define BIO_BUG_ON 47#define BIO_BUG_ON
48#endif 48#endif
49 49
50#define BIO_MAX_PAGES (256) 50#define BIO_MAX_PAGES 256
51#define BIO_MAX_SIZE (BIO_MAX_PAGES << PAGE_CACHE_SHIFT) 51#define BIO_MAX_SIZE (BIO_MAX_PAGES << PAGE_CACHE_SHIFT)
52#define BIO_MAX_SECTORS (BIO_MAX_SIZE >> 9) 52#define BIO_MAX_SECTORS (BIO_MAX_SIZE >> 9)
53 53
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 5d327313a9f7..aafe82788b4e 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -151,11 +151,9 @@ struct request {
151 void *elevator_private; 151 void *elevator_private;
152 void *completion_data; 152 void *completion_data;
153 153
154 unsigned short ioprio;
155
156 int rq_status; /* should split this into a few status bits */ 154 int rq_status; /* should split this into a few status bits */
157 struct gendisk *rq_disk;
158 int errors; 155 int errors;
156 struct gendisk *rq_disk;
159 unsigned long start_time; 157 unsigned long start_time;
160 158
161 /* Number of scatter-gather DMA addr+len pairs after 159 /* Number of scatter-gather DMA addr+len pairs after
@@ -170,8 +168,9 @@ struct request {
170 */ 168 */
171 unsigned short nr_hw_segments; 169 unsigned short nr_hw_segments;
172 170
171 unsigned short ioprio;
172
173 int tag; 173 int tag;
174 char *buffer;
175 174
176 int ref_count; 175 int ref_count;
177 request_queue_t *q; 176 request_queue_t *q;
@@ -179,6 +178,7 @@ struct request {
179 178
180 struct completion *waiting; 179 struct completion *waiting;
181 void *special; 180 void *special;
181 char *buffer;
182 182
183 /* 183 /*
184 * when request is used as a packet command carrier 184 * when request is used as a packet command carrier
@@ -187,20 +187,14 @@ struct request {
187 unsigned char cmd[BLK_MAX_CDB]; 187 unsigned char cmd[BLK_MAX_CDB];
188 188
189 unsigned int data_len; 189 unsigned int data_len;
190 void *data;
191
192 unsigned int sense_len; 190 unsigned int sense_len;
191 void *data;
193 void *sense; 192 void *sense;
194 193
195 unsigned int timeout; 194 unsigned int timeout;
196 int retries; 195 int retries;
197 196
198 /* 197 /*
199 * For Power Management requests
200 */
201 struct request_pm_state *pm;
202
203 /*
204 * completion callback. end_io_data should be folded in with waiting 198 * completion callback. end_io_data should be folded in with waiting
205 */ 199 */
206 rq_end_io_fn *end_io; 200 rq_end_io_fn *end_io;
@@ -241,6 +235,7 @@ enum rq_flag_bits {
241 __REQ_PM_RESUME, /* resume request */ 235 __REQ_PM_RESUME, /* resume request */
242 __REQ_PM_SHUTDOWN, /* shutdown request */ 236 __REQ_PM_SHUTDOWN, /* shutdown request */
243 __REQ_ORDERED_COLOR, /* is before or after barrier */ 237 __REQ_ORDERED_COLOR, /* is before or after barrier */
238 __REQ_RW_SYNC, /* request is sync (O_DIRECT) */
244 __REQ_NR_BITS, /* stops here */ 239 __REQ_NR_BITS, /* stops here */
245}; 240};
246 241
@@ -270,6 +265,7 @@ enum rq_flag_bits {
270#define REQ_PM_RESUME (1 << __REQ_PM_RESUME) 265#define REQ_PM_RESUME (1 << __REQ_PM_RESUME)
271#define REQ_PM_SHUTDOWN (1 << __REQ_PM_SHUTDOWN) 266#define REQ_PM_SHUTDOWN (1 << __REQ_PM_SHUTDOWN)
272#define REQ_ORDERED_COLOR (1 << __REQ_ORDERED_COLOR) 267#define REQ_ORDERED_COLOR (1 << __REQ_ORDERED_COLOR)
268#define REQ_RW_SYNC (1 << __REQ_RW_SYNC)
273 269
274/* 270/*
275 * State information carried for REQ_PM_SUSPEND and REQ_PM_RESUME 271 * State information carried for REQ_PM_SUSPEND and REQ_PM_RESUME
@@ -438,9 +434,6 @@ struct request_queue
438 434
439#define RQ_INACTIVE (-1) 435#define RQ_INACTIVE (-1)
440#define RQ_ACTIVE 1 436#define RQ_ACTIVE 1
441#define RQ_SCSI_BUSY 0xffff
442#define RQ_SCSI_DONE 0xfffe
443#define RQ_SCSI_DISCONNECTING 0xffe0
444 437
445#define QUEUE_FLAG_CLUSTER 0 /* cluster several segments into 1 */ 438#define QUEUE_FLAG_CLUSTER 0 /* cluster several segments into 1 */
446#define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */ 439#define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index eb1a867ed245..a7e8cef73d15 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -90,9 +90,9 @@ struct blk_io_trace {
90 * The remap event 90 * The remap event
91 */ 91 */
92struct blk_io_trace_remap { 92struct blk_io_trace_remap {
93 u32 device; 93 __be32 device;
94 u32 __pad; 94 u32 __pad;
95 u64 sector; 95 __be64 sector;
96}; 96};
97 97
98enum { 98enum {
@@ -224,7 +224,7 @@ static inline void blk_add_trace_pdu_int(struct request_queue *q, u32 what,
224 struct bio *bio, unsigned int pdu) 224 struct bio *bio, unsigned int pdu)
225{ 225{
226 struct blk_trace *bt = q->blk_trace; 226 struct blk_trace *bt = q->blk_trace;
227 u64 rpdu = cpu_to_be64(pdu); 227 __be64 rpdu = cpu_to_be64(pdu);
228 228
229 if (likely(!bt)) 229 if (likely(!bt))
230 return; 230 return;
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index da2d107fe2cf..22866fa2d960 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -91,8 +91,8 @@ static inline void *alloc_remap(int nid, unsigned long size)
91} 91}
92#endif 92#endif
93 93
94extern unsigned long __initdata nr_kernel_pages; 94extern unsigned long nr_kernel_pages;
95extern unsigned long __initdata nr_all_pages; 95extern unsigned long nr_all_pages;
96 96
97extern void *__init alloc_large_system_hash(const char *tablename, 97extern void *__init alloc_large_system_hash(const char *tablename,
98 unsigned long bucketsize, 98 unsigned long bucketsize,
diff --git a/include/linux/cn_proc.h b/include/linux/cn_proc.h
index 1417de935057..dbb7769009be 100644
--- a/include/linux/cn_proc.h
+++ b/include/linux/cn_proc.h
@@ -3,31 +3,22 @@
3 * 3 *
4 * Copyright (C) Matt Helsley, IBM Corp. 2005 4 * Copyright (C) Matt Helsley, IBM Corp. 2005
5 * Based on cn_fork.h by Nguyen Anh Quynh and Guillaume Thouvenin 5 * Based on cn_fork.h by Nguyen Anh Quynh and Guillaume Thouvenin
6 * Original copyright notice follows:
7 * Copyright (C) 2005 Nguyen Anh Quynh <aquynh@gmail.com> 6 * Copyright (C) 2005 Nguyen Anh Quynh <aquynh@gmail.com>
8 * Copyright (C) 2005 Guillaume Thouvenin <guillaume.thouvenin@bull.net> 7 * Copyright (C) 2005 Guillaume Thouvenin <guillaume.thouvenin@bull.net>
9 * 8 *
10 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify it
11 * it under the terms of the GNU General Public License as published by 10 * under the terms of version 2.1 of the GNU Lesser General Public License
12 * the Free Software Foundation; either version 2 of the License, or 11 * as published by the Free Software Foundation.
13 * (at your option) any later version.
14 * 12 *
15 * This program is distributed in the hope that it will be useful, 13 * This program is distributed in the hope that it would be useful, but
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */ 16 */
24 17
25#ifndef CN_PROC_H 18#ifndef CN_PROC_H
26#define CN_PROC_H 19#define CN_PROC_H
27 20
28#include <linux/types.h> 21#include <linux/types.h>
29#include <linux/time.h>
30#include <linux/connector.h>
31 22
32/* 23/*
33 * Userspace sends this enum to register with the kernel that it is listening 24 * Userspace sends this enum to register with the kernel that it is listening
diff --git a/include/linux/coda_linux.h b/include/linux/coda_linux.h
index b3ecf8f71d97..7b5c5df5cb69 100644
--- a/include/linux/coda_linux.h
+++ b/include/linux/coda_linux.h
@@ -36,7 +36,7 @@ extern const struct file_operations coda_ioctl_operations;
36 36
37/* operations shared over more than one file */ 37/* operations shared over more than one file */
38int coda_open(struct inode *i, struct file *f); 38int coda_open(struct inode *i, struct file *f);
39int coda_flush(struct file *f); 39int coda_flush(struct file *f, fl_owner_t id);
40int coda_release(struct inode *i, struct file *f); 40int coda_release(struct inode *i, struct file *f);
41int coda_permission(struct inode *inode, int mask, struct nameidata *nd); 41int coda_permission(struct inode *inode, int mask, struct nameidata *nd);
42int coda_revalidate_inode(struct dentry *); 42int coda_revalidate_inode(struct dentry *);
diff --git a/include/linux/coda_psdev.h b/include/linux/coda_psdev.h
index d539262a8f89..98f6c52c152b 100644
--- a/include/linux/coda_psdev.h
+++ b/include/linux/coda_psdev.h
@@ -70,7 +70,7 @@ int venus_pioctl(struct super_block *sb, struct CodaFid *fid,
70 unsigned int cmd, struct PioctlData *data); 70 unsigned int cmd, struct PioctlData *data);
71int coda_downcall(int opcode, union outputArgs *out, struct super_block *sb); 71int coda_downcall(int opcode, union outputArgs *out, struct super_block *sb);
72int venus_fsync(struct super_block *sb, struct CodaFid *fid); 72int venus_fsync(struct super_block *sb, struct CodaFid *fid);
73int venus_statfs(struct super_block *sb, struct kstatfs *sfs); 73int venus_statfs(struct dentry *dentry, struct kstatfs *sfs);
74 74
75 75
76/* messages between coda filesystem in kernel and Venus */ 76/* messages between coda filesystem in kernel and Venus */
diff --git a/include/linux/connector.h b/include/linux/connector.h
index ad1a22c1c42e..4c02119c6ab9 100644
--- a/include/linux/connector.h
+++ b/include/linux/connector.h
@@ -34,8 +34,11 @@
34#define CN_VAL_PROC 0x1 34#define CN_VAL_PROC 0x1
35#define CN_IDX_CIFS 0x2 35#define CN_IDX_CIFS 0x2
36#define CN_VAL_CIFS 0x1 36#define CN_VAL_CIFS 0x1
37#define CN_W1_IDX 0x3 /* w1 communication */
38#define CN_W1_VAL 0x1
37 39
38#define CN_NETLINK_USERS 1 40
41#define CN_NETLINK_USERS 4
39 42
40/* 43/*
41 * Maximum connector's message size. 44 * Maximum connector's message size.
diff --git a/include/linux/console.h b/include/linux/console.h
index 08734e660d41..d0f8a8009490 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -87,6 +87,7 @@ void give_up_console(const struct consw *sw);
87#define CON_CONSDEV (2) /* Last on the command line */ 87#define CON_CONSDEV (2) /* Last on the command line */
88#define CON_ENABLED (4) 88#define CON_ENABLED (4)
89#define CON_BOOT (8) 89#define CON_BOOT (8)
90#define CON_ANYTIME (16) /* Safe to call when cpu is offline */
90 91
91struct console 92struct console
92{ 93{
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 5aa95011f7e6..466fbe9e4899 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -72,6 +72,8 @@ struct cpufreq_real_policy {
72 72
73struct cpufreq_policy { 73struct cpufreq_policy {
74 cpumask_t cpus; /* affected CPUs */ 74 cpumask_t cpus; /* affected CPUs */
75 unsigned int shared_type; /* ANY or ALL affected CPUs
76 should set cpufreq */
75 unsigned int cpu; /* cpu nr of registered CPU */ 77 unsigned int cpu; /* cpu nr of registered CPU */
76 struct cpufreq_cpuinfo cpuinfo;/* see above */ 78 struct cpufreq_cpuinfo cpuinfo;/* see above */
77 79
@@ -98,6 +100,8 @@ struct cpufreq_policy {
98#define CPUFREQ_INCOMPATIBLE (1) 100#define CPUFREQ_INCOMPATIBLE (1)
99#define CPUFREQ_NOTIFY (2) 101#define CPUFREQ_NOTIFY (2)
100 102
103#define CPUFREQ_SHARED_TYPE_ALL (0) /* All dependent CPUs should set freq */
104#define CPUFREQ_SHARED_TYPE_ANY (1) /* Freq can be set from any dependent CPU */
101 105
102/******************** cpufreq transition notifiers *******************/ 106/******************** cpufreq transition notifiers *******************/
103 107
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 9cbb781d6f80..b268a3c0c376 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -317,7 +317,8 @@ static inline void __cpus_remap(cpumask_t *dstp, const cpumask_t *srcp,
317 (cpu) < NR_CPUS; \ 317 (cpu) < NR_CPUS; \
318 (cpu) = next_cpu((cpu), (mask))) 318 (cpu) = next_cpu((cpu), (mask)))
319#else /* NR_CPUS == 1 */ 319#else /* NR_CPUS == 1 */
320#define for_each_cpu_mask(cpu, mask) for ((cpu) = 0; (cpu) < 1; (cpu)++) 320#define for_each_cpu_mask(cpu, mask) \
321 for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask)
321#endif /* NR_CPUS */ 322#endif /* NR_CPUS */
322 323
323/* 324/*
@@ -405,7 +406,6 @@ int __any_online_cpu(const cpumask_t *mask);
405#define any_online_cpu(mask) 0 406#define any_online_cpu(mask) 0
406#endif 407#endif
407 408
408#define for_each_cpu(cpu) for_each_cpu_mask((cpu), cpu_possible_map)
409#define for_each_possible_cpu(cpu) for_each_cpu_mask((cpu), cpu_possible_map) 409#define for_each_possible_cpu(cpu) for_each_cpu_mask((cpu), cpu_possible_map)
410#define for_each_online_cpu(cpu) for_each_cpu_mask((cpu), cpu_online_map) 410#define for_each_online_cpu(cpu) for_each_cpu_mask((cpu), cpu_online_map)
411#define for_each_present_cpu(cpu) for_each_cpu_mask((cpu), cpu_present_map) 411#define for_each_present_cpu(cpu) for_each_cpu_mask((cpu), cpu_present_map)
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 836325ee0931..0dd1610a94a9 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -217,7 +217,6 @@ extern struct dentry * d_alloc_anon(struct inode *);
217extern struct dentry * d_splice_alias(struct inode *, struct dentry *); 217extern struct dentry * d_splice_alias(struct inode *, struct dentry *);
218extern void shrink_dcache_sb(struct super_block *); 218extern void shrink_dcache_sb(struct super_block *);
219extern void shrink_dcache_parent(struct dentry *); 219extern void shrink_dcache_parent(struct dentry *);
220extern void shrink_dcache_anon(struct hlist_head *);
221extern int d_invalidate(struct dentry *); 220extern int d_invalidate(struct dentry *);
222 221
223/* only used at mount-time */ 222/* only used at mount-time */
diff --git a/include/linux/delay.h b/include/linux/delay.h
index acb74865b973..17ddb55430ae 100644
--- a/include/linux/delay.h
+++ b/include/linux/delay.h
@@ -25,10 +25,7 @@ extern unsigned long loops_per_jiffy;
25#define MAX_UDELAY_MS 5 25#define MAX_UDELAY_MS 5
26#endif 26#endif
27 27
28#ifdef notdef 28#ifndef mdelay
29#define mdelay(n) (\
30 {unsigned long __ms=(n); while (__ms--) udelay(1000);})
31#else
32#define mdelay(n) (\ 29#define mdelay(n) (\
33 (__builtin_constant_p(n) && (n)<=MAX_UDELAY_MS) ? udelay((n)*1000) : \ 30 (__builtin_constant_p(n) && (n)<=MAX_UDELAY_MS) ? udelay((n)*1000) : \
34 ({unsigned long __ms=(n); while (__ms--) udelay(1000);})) 31 ({unsigned long __ms=(n); while (__ms--) udelay(1000);}))
diff --git a/include/linux/device.h b/include/linux/device.h
index b2e5da2b637b..1e5f30da98bc 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -60,11 +60,6 @@ extern void bus_unregister(struct bus_type * bus);
60 60
61extern void bus_rescan_devices(struct bus_type * bus); 61extern void bus_rescan_devices(struct bus_type * bus);
62 62
63extern struct bus_type * get_bus(struct bus_type * bus);
64extern void put_bus(struct bus_type * bus);
65
66extern struct bus_type * find_bus(char * name);
67
68/* iterator helpers for buses */ 63/* iterator helpers for buses */
69 64
70int bus_for_each_dev(struct bus_type * bus, struct device * start, void * data, 65int bus_for_each_dev(struct bus_type * bus, struct device * start, void * data,
@@ -147,6 +142,7 @@ struct class {
147 142
148 struct subsystem subsys; 143 struct subsystem subsys;
149 struct list_head children; 144 struct list_head children;
145 struct list_head devices;
150 struct list_head interfaces; 146 struct list_head interfaces;
151 struct semaphore sem; /* locks both the children and interfaces lists */ 147 struct semaphore sem; /* locks both the children and interfaces lists */
152 148
@@ -163,9 +159,6 @@ struct class {
163extern int class_register(struct class *); 159extern int class_register(struct class *);
164extern void class_unregister(struct class *); 160extern void class_unregister(struct class *);
165 161
166extern struct class * class_get(struct class *);
167extern void class_put(struct class *);
168
169 162
170struct class_attribute { 163struct class_attribute {
171 struct attribute attr; 164 struct attribute attr;
@@ -313,6 +306,7 @@ struct device {
313 struct kobject kobj; 306 struct kobject kobj;
314 char bus_id[BUS_ID_SIZE]; /* position on parent bus */ 307 char bus_id[BUS_ID_SIZE]; /* position on parent bus */
315 struct device_attribute uevent_attr; 308 struct device_attribute uevent_attr;
309 struct device_attribute *devt_attr;
316 310
317 struct semaphore sem; /* semaphore to synchronize calls to 311 struct semaphore sem; /* semaphore to synchronize calls to
318 * its driver. 312 * its driver.
@@ -340,6 +334,11 @@ struct device {
340 struct dma_coherent_mem *dma_mem; /* internal for coherent mem 334 struct dma_coherent_mem *dma_mem; /* internal for coherent mem
341 override */ 335 override */
342 336
337 /* class_device migration path */
338 struct list_head node;
339 struct class *class; /* optional*/
340 dev_t devt; /* dev_t, creates the sysfs "dev" */
341
343 void (*release)(struct device * dev); 342 void (*release)(struct device * dev);
344}; 343};
345 344
@@ -381,6 +380,13 @@ extern int device_attach(struct device * dev);
381extern void driver_attach(struct device_driver * drv); 380extern void driver_attach(struct device_driver * drv);
382extern void device_reprobe(struct device *dev); 381extern void device_reprobe(struct device *dev);
383 382
383/*
384 * Easy functions for dynamically creating devices on the fly
385 */
386extern struct device *device_create(struct class *cls, struct device *parent,
387 dev_t devt, char *fmt, ...)
388 __attribute__((format(printf,4,5)));
389extern void device_destroy(struct class *cls, dev_t devt);
384 390
385/* 391/*
386 * Platform "fixup" functions - allow the platform to have their say 392 * Platform "fixup" functions - allow the platform to have their say
@@ -410,8 +416,9 @@ extern int firmware_register(struct subsystem *);
410extern void firmware_unregister(struct subsystem *); 416extern void firmware_unregister(struct subsystem *);
411 417
412/* debugging and troubleshooting/diagnostic helpers. */ 418/* debugging and troubleshooting/diagnostic helpers. */
419extern const char *dev_driver_string(struct device *dev);
413#define dev_printk(level, dev, format, arg...) \ 420#define dev_printk(level, dev, format, arg...) \
414 printk(level "%s %s: " format , (dev)->driver ? (dev)->driver->name : "" , (dev)->bus_id , ## arg) 421 printk(level "%s %s: " format , dev_driver_string(dev) , (dev)->bus_id , ## arg)
415 422
416#ifdef DEBUG 423#ifdef DEBUG
417#define dev_dbg(dev, format, arg...) \ 424#define dev_dbg(dev, format, arg...) \
diff --git a/include/linux/dvb/dmx.h b/include/linux/dvb/dmx.h
index 2787b8a22ff1..c6a2353c4e68 100644
--- a/include/linux/dvb/dmx.h
+++ b/include/linux/dvb/dmx.h
@@ -88,20 +88,6 @@ typedef enum
88#define DMX_PES_PCR DMX_PES_PCR0 88#define DMX_PES_PCR DMX_PES_PCR0
89 89
90 90
91typedef enum
92{
93 DMX_SCRAMBLING_EV,
94 DMX_FRONTEND_EV
95} dmx_event_t;
96
97
98typedef enum
99{
100 DMX_SCRAMBLING_OFF,
101 DMX_SCRAMBLING_ON
102} dmx_scrambling_status_t;
103
104
105typedef struct dmx_filter 91typedef struct dmx_filter
106{ 92{
107 __u8 filter[DMX_FILTER_SIZE]; 93 __u8 filter[DMX_FILTER_SIZE];
@@ -132,17 +118,6 @@ struct dmx_pes_filter_params
132 __u32 flags; 118 __u32 flags;
133}; 119};
134 120
135
136struct dmx_event
137{
138 dmx_event_t event;
139 time_t timeStamp;
140 union
141 {
142 dmx_scrambling_status_t scrambling;
143 } u;
144};
145
146typedef struct dmx_caps { 121typedef struct dmx_caps {
147 __u32 caps; 122 __u32 caps;
148 int num_decoders; 123 int num_decoders;
@@ -171,7 +146,6 @@ struct dmx_stc {
171#define DMX_SET_FILTER _IOW('o', 43, struct dmx_sct_filter_params) 146#define DMX_SET_FILTER _IOW('o', 43, struct dmx_sct_filter_params)
172#define DMX_SET_PES_FILTER _IOW('o', 44, struct dmx_pes_filter_params) 147#define DMX_SET_PES_FILTER _IOW('o', 44, struct dmx_pes_filter_params)
173#define DMX_SET_BUFFER_SIZE _IO('o', 45) 148#define DMX_SET_BUFFER_SIZE _IO('o', 45)
174#define DMX_GET_EVENT _IOR('o', 46, struct dmx_event)
175#define DMX_GET_PES_PIDS _IOR('o', 47, __u16[5]) 149#define DMX_GET_PES_PIDS _IOR('o', 47, __u16[5])
176#define DMX_GET_CAPS _IOR('o', 48, dmx_caps_t) 150#define DMX_GET_CAPS _IOR('o', 48, dmx_caps_t)
177#define DMX_SET_SOURCE _IOW('o', 49, dmx_source_t) 151#define DMX_SET_SOURCE _IOW('o', 49, dmx_source_t)
diff --git a/include/linux/efi.h b/include/linux/efi.h
index e203613d3aec..66d621dbcb6c 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -294,6 +294,7 @@ extern void efi_enter_virtual_mode (void); /* switch EFI to virtual mode, if pos
294extern u64 efi_get_iobase (void); 294extern u64 efi_get_iobase (void);
295extern u32 efi_mem_type (unsigned long phys_addr); 295extern u32 efi_mem_type (unsigned long phys_addr);
296extern u64 efi_mem_attributes (unsigned long phys_addr); 296extern u64 efi_mem_attributes (unsigned long phys_addr);
297extern u64 efi_mem_attribute (unsigned long phys_addr, unsigned long size);
297extern int efi_mem_attribute_range (unsigned long phys_addr, unsigned long size, 298extern int efi_mem_attribute_range (unsigned long phys_addr, unsigned long size,
298 u64 attr); 299 u64 attr);
299extern int __init efi_uart_console_only (void); 300extern int __init efi_uart_console_only (void);
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index cf2abeca92a0..c6310aef5ab0 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -411,6 +411,8 @@ struct ethtool_ops {
411#define ETHTOOL_GPERMADDR 0x00000020 /* Get permanent hardware address */ 411#define ETHTOOL_GPERMADDR 0x00000020 /* Get permanent hardware address */
412#define ETHTOOL_GUFO 0x00000021 /* Get UFO enable (ethtool_value) */ 412#define ETHTOOL_GUFO 0x00000021 /* Get UFO enable (ethtool_value) */
413#define ETHTOOL_SUFO 0x00000022 /* Set UFO enable (ethtool_value) */ 413#define ETHTOOL_SUFO 0x00000022 /* Set UFO enable (ethtool_value) */
414#define ETHTOOL_GGSO 0x00000023 /* Get GSO enable (ethtool_value) */
415#define ETHTOOL_SGSO 0x00000024 /* Set GSO enable (ethtool_value) */
414 416
415/* compatibility with older code */ 417/* compatibility with older code */
416#define SPARC_ETH_GSET ETHTOOL_GSET 418#define SPARC_ETH_GSET ETHTOOL_GSET
diff --git a/include/linux/eventpoll.h b/include/linux/eventpoll.h
index 1e4bdfcf83a2..84cfa8bbdc36 100644
--- a/include/linux/eventpoll.h
+++ b/include/linux/eventpoll.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * include/linux/eventpoll.h ( Efficent event polling implementation ) 2 * include/linux/eventpoll.h ( Efficent event polling implementation )
3 * Copyright (C) 2001,...,2003 Davide Libenzi 3 * Copyright (C) 2001,...,2006 Davide Libenzi
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index 757d54d8f1a5..5607e6457a65 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -710,6 +710,14 @@ struct dir_private_info {
710 __u32 next_hash; 710 __u32 next_hash;
711}; 711};
712 712
713/* calculate the first block number of the group */
714static inline ext3_fsblk_t
715ext3_group_first_block_no(struct super_block *sb, unsigned long group_no)
716{
717 return group_no * (ext3_fsblk_t)EXT3_BLOCKS_PER_GROUP(sb) +
718 le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block);
719}
720
713/* 721/*
714 * Special error return code only used by dx_probe() and its callers. 722 * Special error return code only used by dx_probe() and its callers.
715 */ 723 */
@@ -730,14 +738,16 @@ struct dir_private_info {
730/* balloc.c */ 738/* balloc.c */
731extern int ext3_bg_has_super(struct super_block *sb, int group); 739extern int ext3_bg_has_super(struct super_block *sb, int group);
732extern unsigned long ext3_bg_num_gdb(struct super_block *sb, int group); 740extern unsigned long ext3_bg_num_gdb(struct super_block *sb, int group);
733extern int ext3_new_block (handle_t *, struct inode *, unsigned long, int *); 741extern ext3_fsblk_t ext3_new_block (handle_t *handle, struct inode *inode,
734extern int ext3_new_blocks (handle_t *, struct inode *, unsigned long, 742 ext3_fsblk_t goal, int *errp);
735 unsigned long *, int *); 743extern ext3_fsblk_t ext3_new_blocks (handle_t *handle, struct inode *inode,
736extern void ext3_free_blocks (handle_t *, struct inode *, unsigned long, 744 ext3_fsblk_t goal, unsigned long *count, int *errp);
737 unsigned long); 745extern void ext3_free_blocks (handle_t *handle, struct inode *inode,
738extern void ext3_free_blocks_sb (handle_t *, struct super_block *, 746 ext3_fsblk_t block, unsigned long count);
739 unsigned long, unsigned long, int *); 747extern void ext3_free_blocks_sb (handle_t *handle, struct super_block *sb,
740extern unsigned long ext3_count_free_blocks (struct super_block *); 748 ext3_fsblk_t block, unsigned long count,
749 unsigned long *pdquot_freed_blocks);
750extern ext3_fsblk_t ext3_count_free_blocks (struct super_block *);
741extern void ext3_check_blocks_bitmap (struct super_block *); 751extern void ext3_check_blocks_bitmap (struct super_block *);
742extern struct ext3_group_desc * ext3_get_group_desc(struct super_block * sb, 752extern struct ext3_group_desc * ext3_get_group_desc(struct super_block * sb,
743 unsigned int block_group, 753 unsigned int block_group,
@@ -773,7 +783,8 @@ extern unsigned long ext3_count_free (struct buffer_head *, unsigned);
773 783
774 784
775/* inode.c */ 785/* inode.c */
776int ext3_forget(handle_t *, int, struct inode *, struct buffer_head *, int); 786int ext3_forget(handle_t *handle, int is_metadata, struct inode *inode,
787 struct buffer_head *bh, ext3_fsblk_t blocknr);
777struct buffer_head * ext3_getblk (handle_t *, struct inode *, long, int, int *); 788struct buffer_head * ext3_getblk (handle_t *, struct inode *, long, int, int *);
778struct buffer_head * ext3_bread (handle_t *, struct inode *, int, int, int *); 789struct buffer_head * ext3_bread (handle_t *, struct inode *, int, int, int *);
779int ext3_get_blocks_handle(handle_t *handle, struct inode *inode, 790int ext3_get_blocks_handle(handle_t *handle, struct inode *inode,
@@ -808,7 +819,7 @@ extern int ext3_group_add(struct super_block *sb,
808 struct ext3_new_group_data *input); 819 struct ext3_new_group_data *input);
809extern int ext3_group_extend(struct super_block *sb, 820extern int ext3_group_extend(struct super_block *sb,
810 struct ext3_super_block *es, 821 struct ext3_super_block *es,
811 unsigned long n_blocks_count); 822 ext3_fsblk_t n_blocks_count);
812 823
813/* super.c */ 824/* super.c */
814extern void ext3_error (struct super_block *, const char *, const char *, ...) 825extern void ext3_error (struct super_block *, const char *, const char *, ...)
diff --git a/include/linux/ext3_fs_i.h b/include/linux/ext3_fs_i.h
index 7abf90147180..2f18b9511f21 100644
--- a/include/linux/ext3_fs_i.h
+++ b/include/linux/ext3_fs_i.h
@@ -21,9 +21,17 @@
21#include <linux/seqlock.h> 21#include <linux/seqlock.h>
22#include <linux/mutex.h> 22#include <linux/mutex.h>
23 23
24/* data type for block offset of block group */
25typedef int ext3_grpblk_t;
26
27/* data type for filesystem-wide blocks number */
28typedef unsigned long ext3_fsblk_t;
29
30#define E3FSBLK "%lu"
31
24struct ext3_reserve_window { 32struct ext3_reserve_window {
25 __u32 _rsv_start; /* First byte reserved */ 33 ext3_fsblk_t _rsv_start; /* First byte reserved */
26 __u32 _rsv_end; /* Last byte reserved or 0 */ 34 ext3_fsblk_t _rsv_end; /* Last byte reserved or 0 */
27}; 35};
28 36
29struct ext3_reserve_window_node { 37struct ext3_reserve_window_node {
@@ -50,7 +58,7 @@ struct ext3_block_alloc_info {
50 * allocated to this file. This give us the goal (target) for the next 58 * allocated to this file. This give us the goal (target) for the next
51 * allocation when we detect linearly ascending requests. 59 * allocation when we detect linearly ascending requests.
52 */ 60 */
53 __u32 last_alloc_physical_block; 61 ext3_fsblk_t last_alloc_physical_block;
54}; 62};
55 63
56#define rsv_start rsv_window._rsv_start 64#define rsv_start rsv_window._rsv_start
@@ -67,7 +75,7 @@ struct ext3_inode_info {
67 __u8 i_frag_no; 75 __u8 i_frag_no;
68 __u8 i_frag_size; 76 __u8 i_frag_size;
69#endif 77#endif
70 __u32 i_file_acl; 78 ext3_fsblk_t i_file_acl;
71 __u32 i_dir_acl; 79 __u32 i_dir_acl;
72 __u32 i_dtime; 80 __u32 i_dtime;
73 81
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 315d89740ddf..f1281687e549 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -1,6 +1,7 @@
1#ifndef _LINUX_FB_H 1#ifndef _LINUX_FB_H
2#define _LINUX_FB_H 2#define _LINUX_FB_H
3 3
4#include <linux/backlight.h>
4#include <asm/types.h> 5#include <asm/types.h>
5 6
6/* Definitions of frame buffers */ 7/* Definitions of frame buffers */
@@ -366,6 +367,12 @@ struct fb_cursor {
366 struct fb_image image; /* Cursor image */ 367 struct fb_image image; /* Cursor image */
367}; 368};
368 369
370#ifdef CONFIG_FB_BACKLIGHT
371/* Settings for the generic backlight code */
372#define FB_BACKLIGHT_LEVELS 128
373#define FB_BACKLIGHT_MAX 0xFF
374#endif
375
369#ifdef __KERNEL__ 376#ifdef __KERNEL__
370 377
371#include <linux/fs.h> 378#include <linux/fs.h>
@@ -756,6 +763,21 @@ struct fb_info {
756 struct fb_cmap cmap; /* Current cmap */ 763 struct fb_cmap cmap; /* Current cmap */
757 struct list_head modelist; /* mode list */ 764 struct list_head modelist; /* mode list */
758 struct fb_videomode *mode; /* current mode */ 765 struct fb_videomode *mode; /* current mode */
766
767#ifdef CONFIG_FB_BACKLIGHT
768 /* Lock ordering:
769 * bl_mutex (protects bl_dev and bl_curve)
770 * bl_dev->sem (backlight class)
771 */
772 struct mutex bl_mutex;
773
774 /* assigned backlight device */
775 struct backlight_device *bl_dev;
776
777 /* Backlight level curve */
778 u8 bl_curve[FB_BACKLIGHT_LEVELS];
779#endif
780
759 struct fb_ops *fbops; 781 struct fb_ops *fbops;
760 struct device *device; 782 struct device *device;
761 struct class_device *class_device; /* sysfs per device attrs */ 783 struct class_device *class_device; /* sysfs per device attrs */
@@ -895,6 +917,7 @@ extern struct fb_info *framebuffer_alloc(size_t size, struct device *dev);
895extern void framebuffer_release(struct fb_info *info); 917extern void framebuffer_release(struct fb_info *info);
896extern int fb_init_class_device(struct fb_info *fb_info); 918extern int fb_init_class_device(struct fb_info *fb_info);
897extern void fb_cleanup_class_device(struct fb_info *head); 919extern void fb_cleanup_class_device(struct fb_info *head);
920extern void fb_bl_default_curve(struct fb_info *fb_info, u8 off, u8 min, u8 max);
898 921
899/* drivers/video/fbmon.c */ 922/* drivers/video/fbmon.c */
900#define FB_MAXTIMINGS 0 923#define FB_MAXTIMINGS 0
diff --git a/include/linux/fcntl.h b/include/linux/fcntl.h
index c52a63755fdd..996f5611cd59 100644
--- a/include/linux/fcntl.h
+++ b/include/linux/fcntl.h
@@ -29,6 +29,7 @@
29#define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic links. */ 29#define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic links. */
30#define AT_REMOVEDIR 0x200 /* Remove directory instead of 30#define AT_REMOVEDIR 0x200 /* Remove directory instead of
31 unlinking file. */ 31 unlinking file. */
32#define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */
32 33
33#ifdef __KERNEL__ 34#ifdef __KERNEL__
34 35
diff --git a/include/linux/fs.h b/include/linux/fs.h
index ecc8c2c3d8ca..2d8b348c1192 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -376,7 +376,8 @@ struct address_space_operations {
376 struct page* (*get_xip_page)(struct address_space *, sector_t, 376 struct page* (*get_xip_page)(struct address_space *, sector_t,
377 int); 377 int);
378 /* migrate the contents of a page to the specified target */ 378 /* migrate the contents of a page to the specified target */
379 int (*migratepage) (struct page *, struct page *); 379 int (*migratepage) (struct address_space *,
380 struct page *, struct page *);
380}; 381};
381 382
382struct backing_dev_info; 383struct backing_dev_info;
@@ -682,6 +683,7 @@ extern spinlock_t files_lock;
682#define FL_FLOCK 2 683#define FL_FLOCK 2
683#define FL_ACCESS 8 /* not trying to lock, just looking */ 684#define FL_ACCESS 8 /* not trying to lock, just looking */
684#define FL_LEASE 32 /* lease held on this file */ 685#define FL_LEASE 32 /* lease held on this file */
686#define FL_CLOSE 64 /* unlock on close */
685#define FL_SLEEP 128 /* A blocking lock */ 687#define FL_SLEEP 128 /* A blocking lock */
686 688
687/* 689/*
@@ -774,7 +776,6 @@ extern int posix_lock_file_conf(struct file *, struct file_lock *, struct file_l
774extern int posix_lock_file(struct file *, struct file_lock *); 776extern int posix_lock_file(struct file *, struct file_lock *);
775extern int posix_lock_file_wait(struct file *, struct file_lock *); 777extern int posix_lock_file_wait(struct file *, struct file_lock *);
776extern int posix_unblock_lock(struct file *, struct file_lock *); 778extern int posix_unblock_lock(struct file *, struct file_lock *);
777extern int posix_locks_deadlock(struct file_lock *, struct file_lock *);
778extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl); 779extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl);
779extern int __break_lease(struct inode *inode, unsigned int flags); 780extern int __break_lease(struct inode *inode, unsigned int flags);
780extern void lease_get_mtime(struct inode *, struct timespec *time); 781extern void lease_get_mtime(struct inode *, struct timespec *time);
@@ -782,7 +783,6 @@ extern int setlease(struct file *, long, struct file_lock **);
782extern int lease_modify(struct file_lock **, int); 783extern int lease_modify(struct file_lock **, int);
783extern int lock_may_read(struct inode *, loff_t start, unsigned long count); 784extern int lock_may_read(struct inode *, loff_t start, unsigned long count);
784extern int lock_may_write(struct inode *, loff_t start, unsigned long count); 785extern int lock_may_write(struct inode *, loff_t start, unsigned long count);
785extern void steal_locks(fl_owner_t from);
786 786
787struct fasync_struct { 787struct fasync_struct {
788 int magic; 788 int magic;
@@ -1025,7 +1025,7 @@ struct file_operations {
1025 long (*compat_ioctl) (struct file *, unsigned int, unsigned long); 1025 long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
1026 int (*mmap) (struct file *, struct vm_area_struct *); 1026 int (*mmap) (struct file *, struct vm_area_struct *);
1027 int (*open) (struct inode *, struct file *); 1027 int (*open) (struct inode *, struct file *);
1028 int (*flush) (struct file *); 1028 int (*flush) (struct file *, fl_owner_t id);
1029 int (*release) (struct inode *, struct file *); 1029 int (*release) (struct inode *, struct file *);
1030 int (*fsync) (struct file *, struct dentry *, int datasync); 1030 int (*fsync) (struct file *, struct dentry *, int datasync);
1031 int (*aio_fsync) (struct kiocb *, int datasync); 1031 int (*aio_fsync) (struct kiocb *, int datasync);
@@ -1097,10 +1097,10 @@ struct super_operations {
1097 int (*sync_fs)(struct super_block *sb, int wait); 1097 int (*sync_fs)(struct super_block *sb, int wait);
1098 void (*write_super_lockfs) (struct super_block *); 1098 void (*write_super_lockfs) (struct super_block *);
1099 void (*unlockfs) (struct super_block *); 1099 void (*unlockfs) (struct super_block *);
1100 int (*statfs) (struct super_block *, struct kstatfs *); 1100 int (*statfs) (struct dentry *, struct kstatfs *);
1101 int (*remount_fs) (struct super_block *, int *, char *); 1101 int (*remount_fs) (struct super_block *, int *, char *);
1102 void (*clear_inode) (struct inode *); 1102 void (*clear_inode) (struct inode *);
1103 void (*umount_begin) (struct super_block *); 1103 void (*umount_begin) (struct vfsmount *, int);
1104 1104
1105 int (*show_options)(struct seq_file *, struct vfsmount *); 1105 int (*show_options)(struct seq_file *, struct vfsmount *);
1106 int (*show_stats)(struct seq_file *, struct vfsmount *); 1106 int (*show_stats)(struct seq_file *, struct vfsmount *);
@@ -1270,23 +1270,26 @@ find_exported_dentry(struct super_block *sb, void *obj, void *parent,
1270struct file_system_type { 1270struct file_system_type {
1271 const char *name; 1271 const char *name;
1272 int fs_flags; 1272 int fs_flags;
1273 struct super_block *(*get_sb) (struct file_system_type *, int, 1273 int (*get_sb) (struct file_system_type *, int,
1274 const char *, void *); 1274 const char *, void *, struct vfsmount *);
1275 void (*kill_sb) (struct super_block *); 1275 void (*kill_sb) (struct super_block *);
1276 struct module *owner; 1276 struct module *owner;
1277 struct file_system_type * next; 1277 struct file_system_type * next;
1278 struct list_head fs_supers; 1278 struct list_head fs_supers;
1279}; 1279};
1280 1280
1281struct super_block *get_sb_bdev(struct file_system_type *fs_type, 1281extern int get_sb_bdev(struct file_system_type *fs_type,
1282 int flags, const char *dev_name, void *data, 1282 int flags, const char *dev_name, void *data,
1283 int (*fill_super)(struct super_block *, void *, int)); 1283 int (*fill_super)(struct super_block *, void *, int),
1284struct super_block *get_sb_single(struct file_system_type *fs_type, 1284 struct vfsmount *mnt);
1285extern int get_sb_single(struct file_system_type *fs_type,
1285 int flags, void *data, 1286 int flags, void *data,
1286 int (*fill_super)(struct super_block *, void *, int)); 1287 int (*fill_super)(struct super_block *, void *, int),
1287struct super_block *get_sb_nodev(struct file_system_type *fs_type, 1288 struct vfsmount *mnt);
1289extern int get_sb_nodev(struct file_system_type *fs_type,
1288 int flags, void *data, 1290 int flags, void *data,
1289 int (*fill_super)(struct super_block *, void *, int)); 1291 int (*fill_super)(struct super_block *, void *, int),
1292 struct vfsmount *mnt);
1290void generic_shutdown_super(struct super_block *sb); 1293void generic_shutdown_super(struct super_block *sb);
1291void kill_block_super(struct super_block *sb); 1294void kill_block_super(struct super_block *sb);
1292void kill_anon_super(struct super_block *sb); 1295void kill_anon_super(struct super_block *sb);
@@ -1297,8 +1300,10 @@ struct super_block *sget(struct file_system_type *type,
1297 int (*test)(struct super_block *,void *), 1300 int (*test)(struct super_block *,void *),
1298 int (*set)(struct super_block *,void *), 1301 int (*set)(struct super_block *,void *),
1299 void *data); 1302 void *data);
1300struct super_block *get_sb_pseudo(struct file_system_type *, char *, 1303extern int get_sb_pseudo(struct file_system_type *, char *,
1301 struct super_operations *ops, unsigned long); 1304 struct super_operations *ops, unsigned long,
1305 struct vfsmount *mnt);
1306extern int simple_set_mnt(struct vfsmount *mnt, struct super_block *sb);
1302int __put_super(struct super_block *sb); 1307int __put_super(struct super_block *sb);
1303int __put_super_and_need_restart(struct super_block *sb); 1308int __put_super_and_need_restart(struct super_block *sb);
1304void unnamed_dev_init(void); 1309void unnamed_dev_init(void);
@@ -1321,7 +1326,7 @@ extern struct vfsmount *copy_tree(struct vfsmount *, struct dentry *, int);
1321extern void mnt_set_mountpoint(struct vfsmount *, struct dentry *, 1326extern void mnt_set_mountpoint(struct vfsmount *, struct dentry *,
1322 struct vfsmount *); 1327 struct vfsmount *);
1323 1328
1324extern int vfs_statfs(struct super_block *, struct kstatfs *); 1329extern int vfs_statfs(struct dentry *, struct kstatfs *);
1325 1330
1326/* /sys/fs */ 1331/* /sys/fs */
1327extern struct subsystem fs_subsys; 1332extern struct subsystem fs_subsys;
@@ -1742,7 +1747,7 @@ extern int dcache_dir_close(struct inode *, struct file *);
1742extern loff_t dcache_dir_lseek(struct file *, loff_t, int); 1747extern loff_t dcache_dir_lseek(struct file *, loff_t, int);
1743extern int dcache_readdir(struct file *, void *, filldir_t); 1748extern int dcache_readdir(struct file *, void *, filldir_t);
1744extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *); 1749extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *);
1745extern int simple_statfs(struct super_block *, struct kstatfs *); 1750extern int simple_statfs(struct dentry *, struct kstatfs *);
1746extern int simple_link(struct dentry *, struct inode *, struct dentry *); 1751extern int simple_link(struct dentry *, struct inode *, struct dentry *);
1747extern int simple_unlink(struct inode *, struct dentry *); 1752extern int simple_unlink(struct inode *, struct dentry *);
1748extern int simple_rmdir(struct inode *, struct dentry *); 1753extern int simple_rmdir(struct inode *, struct dentry *);
@@ -1762,13 +1767,14 @@ extern struct inode_operations simple_dir_inode_operations;
1762struct tree_descr { char *name; const struct file_operations *ops; int mode; }; 1767struct tree_descr { char *name; const struct file_operations *ops; int mode; };
1763struct dentry *d_alloc_name(struct dentry *, const char *); 1768struct dentry *d_alloc_name(struct dentry *, const char *);
1764extern int simple_fill_super(struct super_block *, int, struct tree_descr *); 1769extern int simple_fill_super(struct super_block *, int, struct tree_descr *);
1765extern int simple_pin_fs(char *name, struct vfsmount **mount, int *count); 1770extern int simple_pin_fs(struct file_system_type *, struct vfsmount **mount, int *count);
1766extern void simple_release_fs(struct vfsmount **mount, int *count); 1771extern void simple_release_fs(struct vfsmount **mount, int *count);
1767 1772
1768extern ssize_t simple_read_from_buffer(void __user *, size_t, loff_t *, const void *, size_t); 1773extern ssize_t simple_read_from_buffer(void __user *, size_t, loff_t *, const void *, size_t);
1769 1774
1770#ifdef CONFIG_MIGRATION 1775#ifdef CONFIG_MIGRATION
1771extern int buffer_migrate_page(struct page *, struct page *); 1776extern int buffer_migrate_page(struct address_space *,
1777 struct page *, struct page *);
1772#else 1778#else
1773#define buffer_migrate_page NULL 1779#define buffer_migrate_page NULL
1774#endif 1780#endif
diff --git a/include/linux/fuse.h b/include/linux/fuse.h
index 5425b60021e3..9fc48a674b82 100644
--- a/include/linux/fuse.h
+++ b/include/linux/fuse.h
@@ -1,6 +1,6 @@
1/* 1/*
2 FUSE: Filesystem in Userspace 2 FUSE: Filesystem in Userspace
3 Copyright (C) 2001-2005 Miklos Szeredi <miklos@szeredi.hu> 3 Copyright (C) 2001-2006 Miklos Szeredi <miklos@szeredi.hu>
4 4
5 This program can be distributed under the terms of the GNU GPL. 5 This program can be distributed under the terms of the GNU GPL.
6 See the file COPYING. 6 See the file COPYING.
@@ -9,18 +9,19 @@
9/* This file defines the kernel interface of FUSE */ 9/* This file defines the kernel interface of FUSE */
10 10
11#include <asm/types.h> 11#include <asm/types.h>
12#include <linux/major.h>
12 13
13/** Version number of this interface */ 14/** Version number of this interface */
14#define FUSE_KERNEL_VERSION 7 15#define FUSE_KERNEL_VERSION 7
15 16
16/** Minor version number of this interface */ 17/** Minor version number of this interface */
17#define FUSE_KERNEL_MINOR_VERSION 6 18#define FUSE_KERNEL_MINOR_VERSION 7
18 19
19/** The node ID of the root inode */ 20/** The node ID of the root inode */
20#define FUSE_ROOT_ID 1 21#define FUSE_ROOT_ID 1
21 22
22/** The major number of the fuse character device */ 23/** The major number of the fuse character device */
23#define FUSE_MAJOR 10 24#define FUSE_MAJOR MISC_MAJOR
24 25
25/** The minor number of the fuse character device */ 26/** The minor number of the fuse character device */
26#define FUSE_MINOR 229 27#define FUSE_MINOR 229
@@ -58,6 +59,13 @@ struct fuse_kstatfs {
58 __u32 spare[6]; 59 __u32 spare[6];
59}; 60};
60 61
62struct fuse_file_lock {
63 __u64 start;
64 __u64 end;
65 __u32 type;
66 __u32 pid; /* tgid */
67};
68
61/** 69/**
62 * Bitmasks for fuse_setattr_in.valid 70 * Bitmasks for fuse_setattr_in.valid
63 */ 71 */
@@ -82,6 +90,7 @@ struct fuse_kstatfs {
82 * INIT request/reply flags 90 * INIT request/reply flags
83 */ 91 */
84#define FUSE_ASYNC_READ (1 << 0) 92#define FUSE_ASYNC_READ (1 << 0)
93#define FUSE_POSIX_LOCKS (1 << 1)
85 94
86enum fuse_opcode { 95enum fuse_opcode {
87 FUSE_LOOKUP = 1, 96 FUSE_LOOKUP = 1,
@@ -112,8 +121,12 @@ enum fuse_opcode {
112 FUSE_READDIR = 28, 121 FUSE_READDIR = 28,
113 FUSE_RELEASEDIR = 29, 122 FUSE_RELEASEDIR = 29,
114 FUSE_FSYNCDIR = 30, 123 FUSE_FSYNCDIR = 30,
124 FUSE_GETLK = 31,
125 FUSE_SETLK = 32,
126 FUSE_SETLKW = 33,
115 FUSE_ACCESS = 34, 127 FUSE_ACCESS = 34,
116 FUSE_CREATE = 35 128 FUSE_CREATE = 35,
129 FUSE_INTERRUPT = 36,
117}; 130};
118 131
119/* The read buffer is required to be at least 8k, but may be much larger */ 132/* The read buffer is required to be at least 8k, but may be much larger */
@@ -199,6 +212,7 @@ struct fuse_flush_in {
199 __u64 fh; 212 __u64 fh;
200 __u32 flush_flags; 213 __u32 flush_flags;
201 __u32 padding; 214 __u32 padding;
215 __u64 lock_owner;
202}; 216};
203 217
204struct fuse_read_in { 218struct fuse_read_in {
@@ -247,6 +261,16 @@ struct fuse_getxattr_out {
247 __u32 padding; 261 __u32 padding;
248}; 262};
249 263
264struct fuse_lk_in {
265 __u64 fh;
266 __u64 owner;
267 struct fuse_file_lock lk;
268};
269
270struct fuse_lk_out {
271 struct fuse_file_lock lk;
272};
273
250struct fuse_access_in { 274struct fuse_access_in {
251 __u32 mask; 275 __u32 mask;
252 __u32 padding; 276 __u32 padding;
@@ -268,6 +292,10 @@ struct fuse_init_out {
268 __u32 max_write; 292 __u32 max_write;
269}; 293};
270 294
295struct fuse_interrupt_in {
296 __u64 unique;
297};
298
271struct fuse_in_header { 299struct fuse_in_header {
272 __u32 len; 300 __u32 len;
273 __u32 opcode; 301 __u32 opcode;
diff --git a/include/linux/genalloc.h b/include/linux/genalloc.h
index 7fd0576a4454..690c42803d2e 100644
--- a/include/linux/genalloc.h
+++ b/include/linux/genalloc.h
@@ -4,37 +4,32 @@
4 * Uses for this includes on-device special memory, uncached memory 4 * Uses for this includes on-device special memory, uncached memory
5 * etc. 5 * etc.
6 * 6 *
7 * This code is based on the buddy allocator found in the sym53c8xx_2
8 * driver, adapted for general purpose use.
9 *
10 * This source code is licensed under the GNU General Public License, 7 * This source code is licensed under the GNU General Public License,
11 * Version 2. See the file COPYING for more details. 8 * Version 2. See the file COPYING for more details.
12 */ 9 */
13 10
14#include <linux/spinlock.h>
15 11
16#define ALLOC_MIN_SHIFT 5 /* 32 bytes minimum */
17/* 12/*
18 * Link between free memory chunks of a given size. 13 * General purpose special memory pool descriptor.
19 */ 14 */
20struct gen_pool_link { 15struct gen_pool {
21 struct gen_pool_link *next; 16 rwlock_t lock;
17 struct list_head chunks; /* list of chunks in this pool */
18 int min_alloc_order; /* minimum allocation order */
22}; 19};
23 20
24/* 21/*
25 * Memory pool descriptor. 22 * General purpose special memory pool chunk descriptor.
26 */ 23 */
27struct gen_pool { 24struct gen_pool_chunk {
28 spinlock_t lock; 25 spinlock_t lock;
29 unsigned long (*get_new_chunk)(struct gen_pool *); 26 struct list_head next_chunk; /* next chunk in pool */
30 struct gen_pool *next; 27 unsigned long start_addr; /* starting address of memory chunk */
31 struct gen_pool_link *h; 28 unsigned long end_addr; /* ending address of memory chunk */
32 unsigned long private; 29 unsigned long bits[0]; /* bitmap for allocating memory chunk */
33 int max_chunk_shift;
34}; 30};
35 31
36unsigned long gen_pool_alloc(struct gen_pool *poolp, int size); 32extern struct gen_pool *gen_pool_create(int, int);
37void gen_pool_free(struct gen_pool *mp, unsigned long ptr, int size); 33extern int gen_pool_add(struct gen_pool *, unsigned long, size_t, int);
38struct gen_pool *gen_pool_create(int nr_chunks, int max_chunk_shift, 34extern unsigned long gen_pool_alloc(struct gen_pool *, size_t);
39 unsigned long (*fp)(struct gen_pool *), 35extern void gen_pool_free(struct gen_pool *, unsigned long, size_t);
40 unsigned long data);
diff --git a/include/linux/hdlc.h b/include/linux/hdlc.h
index df695e9ae327..4513f9e40937 100644
--- a/include/linux/hdlc.h
+++ b/include/linux/hdlc.h
@@ -188,7 +188,7 @@ int hdlc_x25_ioctl(struct net_device *dev, struct ifreq *ifr);
188int hdlc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); 188int hdlc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
189 189
190/* Must be used by hardware driver on module startup/exit */ 190/* Must be used by hardware driver on module startup/exit */
191int register_hdlc_device(struct net_device *dev); 191#define register_hdlc_device(dev) register_netdev(dev)
192void unregister_hdlc_device(struct net_device *dev); 192void unregister_hdlc_device(struct net_device *dev);
193 193
194struct net_device *alloc_hdlcdev(void *priv); 194struct net_device *alloc_hdlcdev(void *priv);
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 7d2a1b974c5e..07d7305f131e 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -40,7 +40,6 @@ struct hrtimer_base;
40 40
41/** 41/**
42 * struct hrtimer - the basic hrtimer structure 42 * struct hrtimer - the basic hrtimer structure
43 *
44 * @node: red black tree node for time ordered insertion 43 * @node: red black tree node for time ordered insertion
45 * @expires: the absolute expiry time in the hrtimers internal 44 * @expires: the absolute expiry time in the hrtimers internal
46 * representation. The time is related to the clock on 45 * representation. The time is related to the clock on
@@ -59,7 +58,6 @@ struct hrtimer {
59 58
60/** 59/**
61 * struct hrtimer_sleeper - simple sleeper structure 60 * struct hrtimer_sleeper - simple sleeper structure
62 *
63 * @timer: embedded timer structure 61 * @timer: embedded timer structure
64 * @task: task to wake up 62 * @task: task to wake up
65 * 63 *
@@ -72,7 +70,6 @@ struct hrtimer_sleeper {
72 70
73/** 71/**
74 * struct hrtimer_base - the timer base for a specific clock 72 * struct hrtimer_base - the timer base for a specific clock
75 *
76 * @index: clock type index for per_cpu support when moving a timer 73 * @index: clock type index for per_cpu support when moving a timer
77 * to a base on another cpu. 74 * to a base on another cpu.
78 * @lock: lock protecting the base and associated timers 75 * @lock: lock protecting the base and associated timers
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 4c5e610fe442..c25a38d8f600 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -23,6 +23,8 @@ int hugetlb_report_node_meminfo(int, char *);
23unsigned long hugetlb_total_pages(void); 23unsigned long hugetlb_total_pages(void);
24int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, 24int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
25 unsigned long address, int write_access); 25 unsigned long address, int write_access);
26int hugetlb_reserve_pages(struct inode *inode, long from, long to);
27void hugetlb_unreserve_pages(struct inode *inode, long offset, long freed);
26 28
27extern unsigned long max_huge_pages; 29extern unsigned long max_huge_pages;
28extern const unsigned long hugetlb_zero, hugetlb_infinity; 30extern const unsigned long hugetlb_zero, hugetlb_infinity;
@@ -139,8 +141,6 @@ struct hugetlbfs_sb_info {
139 141
140struct hugetlbfs_inode_info { 142struct hugetlbfs_inode_info {
141 struct shared_policy policy; 143 struct shared_policy policy;
142 /* Protected by the (global) hugetlb_lock */
143 unsigned long prereserved_hpages;
144 struct inode vfs_inode; 144 struct inode vfs_inode;
145}; 145};
146 146
@@ -157,10 +157,6 @@ static inline struct hugetlbfs_sb_info *HUGETLBFS_SB(struct super_block *sb)
157extern const struct file_operations hugetlbfs_file_operations; 157extern const struct file_operations hugetlbfs_file_operations;
158extern struct vm_operations_struct hugetlb_vm_ops; 158extern struct vm_operations_struct hugetlb_vm_ops;
159struct file *hugetlb_zero_setup(size_t); 159struct file *hugetlb_zero_setup(size_t);
160int hugetlb_extend_reservation(struct hugetlbfs_inode_info *info,
161 unsigned long atleast_hpages);
162void hugetlb_truncate_reservation(struct hugetlbfs_inode_info *info,
163 unsigned long atmost_hpages);
164int hugetlb_get_quota(struct address_space *mapping); 160int hugetlb_get_quota(struct address_space *mapping);
165void hugetlb_put_quota(struct address_space *mapping); 161void hugetlb_put_quota(struct address_space *mapping);
166 162
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h
index c8b81f419fd8..21338bb3441d 100644
--- a/include/linux/i2c-id.h
+++ b/include/linux/i2c-id.h
@@ -112,6 +112,9 @@
112#define I2C_DRIVERID_X1205 82 /* Xicor/Intersil X1205 RTC */ 112#define I2C_DRIVERID_X1205 82 /* Xicor/Intersil X1205 RTC */
113#define I2C_DRIVERID_PCF8563 83 /* Philips PCF8563 RTC */ 113#define I2C_DRIVERID_PCF8563 83 /* Philips PCF8563 RTC */
114#define I2C_DRIVERID_RS5C372 84 /* Ricoh RS5C372 RTC */ 114#define I2C_DRIVERID_RS5C372 84 /* Ricoh RS5C372 RTC */
115#define I2C_DRIVERID_BT866 85 /* Conexant bt866 video encoder */
116#define I2C_DRIVERID_KS0127 86 /* Samsung ks0127 video decoder */
117#define I2C_DRIVERID_TLV320AIC23B 87 /* TI TLV320AIC23B audio codec */
115 118
116#define I2C_DRIVERID_I2CDEV 900 119#define I2C_DRIVERID_I2CDEV 900
117#define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */ 120#define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */
diff --git a/include/linux/i2c-ocores.h b/include/linux/i2c-ocores.h
new file mode 100644
index 000000000000..8ed591b0887e
--- /dev/null
+++ b/include/linux/i2c-ocores.h
@@ -0,0 +1,19 @@
1/*
2 * i2c-ocores.h - definitions for the i2c-ocores interface
3 *
4 * Peter Korsgaard <jacmet@sunsite.dk>
5 *
6 * This file is licensed under the terms of the GNU General Public License
7 * version 2. This program is licensed "as is" without any warranty of any
8 * kind, whether express or implied.
9 */
10
11#ifndef _LINUX_I2C_OCORES_H
12#define _LINUX_I2C_OCORES_H
13
14struct ocores_i2c_platform_data {
15 u32 regstep; /* distance between registers */
16 u32 clock_khz; /* input clock in kHz */
17};
18
19#endif /* _LINUX_I2C_OCORES_H */
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 0510430e00db..526ddc8eecfb 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -97,13 +97,13 @@ extern s32 i2c_smbus_write_word_data(struct i2c_client * client,
97 u8 command, u16 value); 97 u8 command, u16 value);
98extern s32 i2c_smbus_write_block_data(struct i2c_client * client, 98extern s32 i2c_smbus_write_block_data(struct i2c_client * client,
99 u8 command, u8 length, 99 u8 command, u8 length,
100 u8 *values); 100 const u8 *values);
101/* Returns the number of read bytes */ 101/* Returns the number of read bytes */
102extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client * client, 102extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client * client,
103 u8 command, u8 *values); 103 u8 command, u8 *values);
104extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client * client, 104extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client * client,
105 u8 command, u8 length, 105 u8 command, u8 length,
106 u8 *values); 106 const u8 *values);
107 107
108/* 108/*
109 * A driver is capable of handling one or more physical devices present on 109 * A driver is capable of handling one or more physical devices present on
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 77e66d055f5b..ef7bef207f48 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -630,6 +630,7 @@ typedef struct ide_drive_s {
630 unsigned int usage; /* current "open()" count for drive */ 630 unsigned int usage; /* current "open()" count for drive */
631 unsigned int failures; /* current failure count */ 631 unsigned int failures; /* current failure count */
632 unsigned int max_failures; /* maximum allowed failure count */ 632 unsigned int max_failures; /* maximum allowed failure count */
633 u64 probed_capacity;/* initial reported media capacity (ide-cd only currently) */
633 634
634 u64 capacity64; /* total number of sectors */ 635 u64 capacity64; /* total number of sectors */
635 636
@@ -1005,6 +1006,8 @@ extern ide_hwif_t ide_hwifs[]; /* master data repository */
1005extern int noautodma; 1006extern int noautodma;
1006 1007
1007extern int ide_end_request (ide_drive_t *drive, int uptodate, int nrsecs); 1008extern int ide_end_request (ide_drive_t *drive, int uptodate, int nrsecs);
1009int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq,
1010 int uptodate, int nr_sectors);
1008 1011
1009/* 1012/*
1010 * This is used on exit from the driver to designate the next irq handler 1013 * This is used on exit from the driver to designate the next irq handler
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 9e0fefd7884a..70741e170114 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -7,32 +7,13 @@
7#include <linux/bitops.h> 7#include <linux/bitops.h>
8#include <linux/preempt.h> 8#include <linux/preempt.h>
9#include <linux/cpumask.h> 9#include <linux/cpumask.h>
10#include <linux/irqreturn.h>
10#include <linux/hardirq.h> 11#include <linux/hardirq.h>
11#include <linux/sched.h> 12#include <linux/sched.h>
12#include <asm/atomic.h> 13#include <asm/atomic.h>
13#include <asm/ptrace.h> 14#include <asm/ptrace.h>
14#include <asm/system.h> 15#include <asm/system.h>
15 16
16/*
17 * For 2.4.x compatibility, 2.4.x can use
18 *
19 * typedef void irqreturn_t;
20 * #define IRQ_NONE
21 * #define IRQ_HANDLED
22 * #define IRQ_RETVAL(x)
23 *
24 * To mix old-style and new-style irq handler returns.
25 *
26 * IRQ_NONE means we didn't handle it.
27 * IRQ_HANDLED means that we did have a valid interrupt and handled it.
28 * IRQ_RETVAL(x) selects on the two depending on x being non-zero (for handled)
29 */
30typedef int irqreturn_t;
31
32#define IRQ_NONE (0)
33#define IRQ_HANDLED (1)
34#define IRQ_RETVAL(x) ((x) != 0)
35
36struct irqaction { 17struct irqaction {
37 irqreturn_t (*handler)(int, void *, struct pt_regs *); 18 irqreturn_t (*handler)(int, void *, struct pt_regs *);
38 unsigned long flags; 19 unsigned long flags;
diff --git a/include/linux/ioc4.h b/include/linux/ioc4.h
index 3dd18b785ebd..de73a3289cc2 100644
--- a/include/linux/ioc4.h
+++ b/include/linux/ioc4.h
@@ -147,6 +147,10 @@ struct ioc4_misc_regs {
147#define IOC4_GPCR_EDGE_6 0x40 147#define IOC4_GPCR_EDGE_6 0x40
148#define IOC4_GPCR_EDGE_7 0x80 148#define IOC4_GPCR_EDGE_7 0x80
149 149
150#define IOC4_VARIANT_IO9 0x0900
151#define IOC4_VARIANT_PCI_RT 0x0901
152#define IOC4_VARIANT_IO10 0x1000
153
150/* One of these per IOC4 */ 154/* One of these per IOC4 */
151struct ioc4_driver_data { 155struct ioc4_driver_data {
152 struct list_head idd_list; 156 struct list_head idd_list;
@@ -156,6 +160,7 @@ struct ioc4_driver_data {
156 struct __iomem ioc4_misc_regs *idd_misc_regs; 160 struct __iomem ioc4_misc_regs *idd_misc_regs;
157 unsigned long count_period; 161 unsigned long count_period;
158 void *idd_serial_data; 162 void *idd_serial_data;
163 unsigned int idd_variant;
159}; 164};
160 165
161/* One per submodule */ 166/* One per submodule */
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 42c9cd562860..676e00dfb21a 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -17,6 +17,7 @@
17#include <linux/cache.h> 17#include <linux/cache.h>
18#include <linux/spinlock.h> 18#include <linux/spinlock.h>
19#include <linux/cpumask.h> 19#include <linux/cpumask.h>
20#include <linux/irqreturn.h>
20 21
21#include <asm/irq.h> 22#include <asm/irq.h>
22#include <asm/ptrace.h> 23#include <asm/ptrace.h>
@@ -164,10 +165,18 @@ static inline void set_irq_info(int irq, cpumask_t mask)
164 165
165#endif // CONFIG_SMP 166#endif // CONFIG_SMP
166 167
168#ifdef CONFIG_IRQBALANCE
169extern void set_balance_irq_affinity(unsigned int irq, cpumask_t mask);
170#else
171static inline void set_balance_irq_affinity(unsigned int irq, cpumask_t mask)
172{
173}
174#endif
175
167extern int no_irq_affinity; 176extern int no_irq_affinity;
168extern int noirqdebug_setup(char *str); 177extern int noirqdebug_setup(char *str);
169 178
170extern fastcall int handle_IRQ_event(unsigned int irq, struct pt_regs *regs, 179extern fastcall irqreturn_t handle_IRQ_event(unsigned int irq, struct pt_regs *regs,
171 struct irqaction *action); 180 struct irqaction *action);
172extern fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs); 181extern fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs);
173extern void note_interrupt(unsigned int irq, irq_desc_t *desc, 182extern void note_interrupt(unsigned int irq, irq_desc_t *desc,
diff --git a/include/linux/irqreturn.h b/include/linux/irqreturn.h
new file mode 100644
index 000000000000..881883c2009d
--- /dev/null
+++ b/include/linux/irqreturn.h
@@ -0,0 +1,25 @@
1/* irqreturn.h */
2#ifndef _LINUX_IRQRETURN_H
3#define _LINUX_IRQRETURN_H
4
5/*
6 * For 2.4.x compatibility, 2.4.x can use
7 *
8 * typedef void irqreturn_t;
9 * #define IRQ_NONE
10 * #define IRQ_HANDLED
11 * #define IRQ_RETVAL(x)
12 *
13 * To mix old-style and new-style irq handler returns.
14 *
15 * IRQ_NONE means we didn't handle it.
16 * IRQ_HANDLED means that we did have a valid interrupt and handled it.
17 * IRQ_RETVAL(x) selects on the two depending on x being non-zero (for handled)
18 */
19typedef int irqreturn_t;
20
21#define IRQ_NONE (0)
22#define IRQ_HANDLED (1)
23#define IRQ_RETVAL(x) ((x) != 0)
24
25#endif
diff --git a/include/linux/isa.h b/include/linux/isa.h
new file mode 100644
index 000000000000..1b855335cb11
--- /dev/null
+++ b/include/linux/isa.h
@@ -0,0 +1,28 @@
1/*
2 * ISA bus.
3 */
4
5#ifndef __LINUX_ISA_H
6#define __LINUX_ISA_H
7
8#include <linux/device.h>
9#include <linux/kernel.h>
10
11struct isa_driver {
12 int (*match)(struct device *, unsigned int);
13 int (*probe)(struct device *, unsigned int);
14 int (*remove)(struct device *, unsigned int);
15 void (*shutdown)(struct device *, unsigned int);
16 int (*suspend)(struct device *, unsigned int, pm_message_t);
17 int (*resume)(struct device *, unsigned int);
18
19 struct device_driver driver;
20 struct device *devices;
21};
22
23#define to_isa_driver(x) container_of((x), struct isa_driver, driver)
24
25int isa_register_driver(struct isa_driver *, unsigned int);
26void isa_unregister_driver(struct isa_driver *);
27
28#endif /* __LINUX_ISA_H */
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index 6a425e370cb3..20eb34403d0c 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -501,6 +501,12 @@ struct transaction_s
501 struct journal_head *t_checkpoint_list; 501 struct journal_head *t_checkpoint_list;
502 502
503 /* 503 /*
504 * Doubly-linked circular list of all buffers submitted for IO while
505 * checkpointing. [j_list_lock]
506 */
507 struct journal_head *t_checkpoint_io_list;
508
509 /*
504 * Doubly-linked circular list of temporary buffers currently undergoing 510 * Doubly-linked circular list of temporary buffers currently undergoing
505 * IO in the log [j_list_lock] 511 * IO in the log [j_list_lock]
506 */ 512 */
@@ -849,7 +855,7 @@ extern void journal_commit_transaction(journal_t *);
849 855
850/* Checkpoint list management */ 856/* Checkpoint list management */
851int __journal_clean_checkpoint_list(journal_t *journal); 857int __journal_clean_checkpoint_list(journal_t *journal);
852void __journal_remove_checkpoint(struct journal_head *); 858int __journal_remove_checkpoint(struct journal_head *);
853void __journal_insert_checkpoint(struct journal_head *, transaction_t *); 859void __journal_insert_checkpoint(struct journal_head *, transaction_t *);
854 860
855/* Buffer IO */ 861/* Buffer IO */
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index f4fc576ed4c4..3c5e4c2e517d 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -24,6 +24,9 @@ extern const char linux_banner[];
24#define LONG_MAX ((long)(~0UL>>1)) 24#define LONG_MAX ((long)(~0UL>>1))
25#define LONG_MIN (-LONG_MAX - 1) 25#define LONG_MIN (-LONG_MAX - 1)
26#define ULONG_MAX (~0UL) 26#define ULONG_MAX (~0UL)
27#define LLONG_MAX ((long long)(~0ULL>>1))
28#define LLONG_MIN (-LLONG_MAX - 1)
29#define ULLONG_MAX (~0ULL)
27 30
28#define STACK_MAGIC 0xdeadbeef 31#define STACK_MAGIC 0xdeadbeef
29 32
@@ -75,7 +78,7 @@ extern int cond_resched(void);
75# define might_sleep() do { might_resched(); } while (0) 78# define might_sleep() do { might_resched(); } while (0)
76#endif 79#endif
77 80
78#define might_sleep_if(cond) do { if (unlikely(cond)) might_sleep(); } while (0) 81#define might_sleep_if(cond) do { if (cond) might_sleep(); } while (0)
79 82
80#define abs(x) ({ \ 83#define abs(x) ({ \
81 int __x = (x); \ 84 int __x = (x); \
@@ -114,6 +117,8 @@ extern int scnprintf(char * buf, size_t size, const char * fmt, ...)
114 __attribute__ ((format (printf, 3, 4))); 117 __attribute__ ((format (printf, 3, 4)));
115extern int vscnprintf(char *buf, size_t size, const char *fmt, va_list args) 118extern int vscnprintf(char *buf, size_t size, const char *fmt, va_list args)
116 __attribute__ ((format (printf, 3, 0))); 119 __attribute__ ((format (printf, 3, 0)));
120extern char *kasprintf(gfp_t gfp, const char *fmt, ...)
121 __attribute__ ((format (printf, 2, 3)));
117 122
118extern int sscanf(const char *, const char *, ...) 123extern int sscanf(const char *, const char *, ...)
119 __attribute__ ((format (scanf, 2, 3))); 124 __attribute__ ((format (scanf, 2, 3)));
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index cfb3410e32b1..6427949ddf99 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -106,6 +106,7 @@ extern struct page *kimage_alloc_control_pages(struct kimage *image,
106extern void crash_kexec(struct pt_regs *); 106extern void crash_kexec(struct pt_regs *);
107int kexec_should_crash(struct task_struct *); 107int kexec_should_crash(struct task_struct *);
108extern struct kimage *kexec_image; 108extern struct kimage *kexec_image;
109extern struct kimage *kexec_crash_image;
109 110
110#define KEXEC_ON_CRASH 0x00000001 111#define KEXEC_ON_CRASH 0x00000001
111#define KEXEC_ARCH_MASK 0xffff0000 112#define KEXEC_ARCH_MASK 0xffff0000
diff --git a/include/linux/key.h b/include/linux/key.h
index cbf464ad9589..e81ebf910d0b 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -205,6 +205,11 @@ struct key_type {
205 /* match a key against a description */ 205 /* match a key against a description */
206 int (*match)(const struct key *key, const void *desc); 206 int (*match)(const struct key *key, const void *desc);
207 207
208 /* clear some of the data from a key on revokation (optional)
209 * - the key's semaphore will be write-locked by the caller
210 */
211 void (*revoke)(struct key *key);
212
208 /* clear the data from a key (optional) */ 213 /* clear the data from a key (optional) */
209 void (*destroy)(struct key *key); 214 void (*destroy)(struct key *key);
210 215
@@ -241,8 +246,9 @@ extern void unregister_key_type(struct key_type *ktype);
241 246
242extern struct key *key_alloc(struct key_type *type, 247extern struct key *key_alloc(struct key_type *type,
243 const char *desc, 248 const char *desc,
244 uid_t uid, gid_t gid, key_perm_t perm, 249 uid_t uid, gid_t gid,
245 int not_in_quota); 250 struct task_struct *ctx,
251 key_perm_t perm, int not_in_quota);
246extern int key_payload_reserve(struct key *key, size_t datalen); 252extern int key_payload_reserve(struct key *key, size_t datalen);
247extern int key_instantiate_and_link(struct key *key, 253extern int key_instantiate_and_link(struct key *key,
248 const void *data, 254 const void *data,
@@ -292,7 +298,9 @@ extern int key_unlink(struct key *keyring,
292 struct key *key); 298 struct key *key);
293 299
294extern struct key *keyring_alloc(const char *description, uid_t uid, gid_t gid, 300extern struct key *keyring_alloc(const char *description, uid_t uid, gid_t gid,
295 int not_in_quota, struct key *dest); 301 struct task_struct *ctx,
302 int not_in_quota,
303 struct key *dest);
296 304
297extern int keyring_clear(struct key *keyring); 305extern int keyring_clear(struct key *keyring);
298 306
@@ -313,7 +321,8 @@ extern void keyring_replace_payload(struct key *key, void *replacement);
313 * the userspace interface 321 * the userspace interface
314 */ 322 */
315extern struct key root_user_keyring, root_session_keyring; 323extern struct key root_user_keyring, root_session_keyring;
316extern int alloc_uid_keyring(struct user_struct *user); 324extern int alloc_uid_keyring(struct user_struct *user,
325 struct task_struct *ctx);
317extern void switch_uid_keyring(struct user_struct *new_user); 326extern void switch_uid_keyring(struct user_struct *new_user);
318extern int copy_keys(unsigned long clone_flags, struct task_struct *tsk); 327extern int copy_keys(unsigned long clone_flags, struct task_struct *tsk);
319extern int copy_thread_group_keys(struct task_struct *tsk); 328extern int copy_thread_group_keys(struct task_struct *tsk);
@@ -342,7 +351,7 @@ extern void key_init(void);
342#define make_key_ref(k) ({ NULL; }) 351#define make_key_ref(k) ({ NULL; })
343#define key_ref_to_ptr(k) ({ NULL; }) 352#define key_ref_to_ptr(k) ({ NULL; })
344#define is_key_possessed(k) 0 353#define is_key_possessed(k) 0
345#define alloc_uid_keyring(u) 0 354#define alloc_uid_keyring(u,c) 0
346#define switch_uid_keyring(u) do { } while(0) 355#define switch_uid_keyring(u) do { } while(0)
347#define __install_session_keyring(t, k) ({ NULL; }) 356#define __install_session_keyring(t, k) ({ NULL; })
348#define copy_keys(f,t) 0 357#define copy_keys(f,t) 0
@@ -355,6 +364,10 @@ extern void key_init(void);
355#define key_fsgid_changed(t) do { } while(0) 364#define key_fsgid_changed(t) do { } while(0)
356#define key_init() do { } while(0) 365#define key_init() do { } while(0)
357 366
367/* Initial keyrings */
368extern struct key root_user_keyring;
369extern struct key root_session_keyring;
370
358#endif /* CONFIG_KEYS */ 371#endif /* CONFIG_KEYS */
359#endif /* __KERNEL__ */ 372#endif /* __KERNEL__ */
360#endif /* _LINUX_KEY_H */ 373#endif /* _LINUX_KEY_H */
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index c187c53cecd0..2d229327959e 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -190,6 +190,8 @@ struct subsystem _varname##_subsys = { \
190 190
191/* The global /sys/kernel/ subsystem for people to chain off of */ 191/* The global /sys/kernel/ subsystem for people to chain off of */
192extern struct subsystem kernel_subsys; 192extern struct subsystem kernel_subsys;
193/* The global /sys/hypervisor/ subsystem */
194extern struct subsystem hypervisor_subsys;
193 195
194/** 196/**
195 * Helpers for setting the kset of registered objects. 197 * Helpers for setting the kset of registered objects.
diff --git a/include/linux/kthread.h b/include/linux/kthread.h
index ebdd41fd1082..7cce5dfa092f 100644
--- a/include/linux/kthread.h
+++ b/include/linux/kthread.h
@@ -4,37 +4,19 @@
4#include <linux/err.h> 4#include <linux/err.h>
5#include <linux/sched.h> 5#include <linux/sched.h>
6 6
7/**
8 * kthread_create: create a kthread.
9 * @threadfn: the function to run until signal_pending(current).
10 * @data: data ptr for @threadfn.
11 * @namefmt: printf-style name for the thread.
12 *
13 * Description: This helper function creates and names a kernel
14 * thread. The thread will be stopped: use wake_up_process() to start
15 * it. See also kthread_run(), kthread_create_on_cpu().
16 *
17 * When woken, the thread will run @threadfn() with @data as its
18 * argument. @threadfn can either call do_exit() directly if it is a
19 * standalone thread for which noone will call kthread_stop(), or
20 * return when 'kthread_should_stop()' is true (which means
21 * kthread_stop() has been called). The return value should be zero
22 * or a negative error number: it will be passed to kthread_stop().
23 *
24 * Returns a task_struct or ERR_PTR(-ENOMEM).
25 */
26struct task_struct *kthread_create(int (*threadfn)(void *data), 7struct task_struct *kthread_create(int (*threadfn)(void *data),
27 void *data, 8 void *data,
28 const char namefmt[], ...); 9 const char namefmt[], ...);
29 10
30/** 11/**
31 * kthread_run: create and wake a thread. 12 * kthread_run - create and wake a thread.
32 * @threadfn: the function to run until signal_pending(current). 13 * @threadfn: the function to run until signal_pending(current).
33 * @data: data ptr for @threadfn. 14 * @data: data ptr for @threadfn.
34 * @namefmt: printf-style name for the thread. 15 * @namefmt: printf-style name for the thread.
35 * 16 *
36 * Description: Convenient wrapper for kthread_create() followed by 17 * Description: Convenient wrapper for kthread_create() followed by
37 * wake_up_process(). Returns the kthread, or ERR_PTR(-ENOMEM). */ 18 * wake_up_process(). Returns the kthread or ERR_PTR(-ENOMEM).
19 */
38#define kthread_run(threadfn, data, namefmt, ...) \ 20#define kthread_run(threadfn, data, namefmt, ...) \
39({ \ 21({ \
40 struct task_struct *__k \ 22 struct task_struct *__k \
@@ -44,50 +26,9 @@ struct task_struct *kthread_create(int (*threadfn)(void *data),
44 __k; \ 26 __k; \
45}) 27})
46 28
47/**
48 * kthread_bind: bind a just-created kthread to a cpu.
49 * @k: thread created by kthread_create().
50 * @cpu: cpu (might not be online, must be possible) for @k to run on.
51 *
52 * Description: This function is equivalent to set_cpus_allowed(),
53 * except that @cpu doesn't need to be online, and the thread must be
54 * stopped (ie. just returned from kthread_create().
55 */
56void kthread_bind(struct task_struct *k, unsigned int cpu); 29void kthread_bind(struct task_struct *k, unsigned int cpu);
57
58/**
59 * kthread_stop: stop a thread created by kthread_create().
60 * @k: thread created by kthread_create().
61 *
62 * Sets kthread_should_stop() for @k to return true, wakes it, and
63 * waits for it to exit. Your threadfn() must not call do_exit()
64 * itself if you use this function! This can also be called after
65 * kthread_create() instead of calling wake_up_process(): the thread
66 * will exit without calling threadfn().
67 *
68 * Returns the result of threadfn(), or -EINTR if wake_up_process()
69 * was never called. */
70int kthread_stop(struct task_struct *k); 30int kthread_stop(struct task_struct *k);
71
72/**
73 * kthread_stop_sem: stop a thread created by kthread_create().
74 * @k: thread created by kthread_create().
75 * @s: semaphore that @k waits on while idle.
76 *
77 * Does essentially the same thing as kthread_stop() above, but wakes
78 * @k by calling up(@s).
79 *
80 * Returns the result of threadfn(), or -EINTR if wake_up_process()
81 * was never called. */
82int kthread_stop_sem(struct task_struct *k, struct semaphore *s); 31int kthread_stop_sem(struct task_struct *k, struct semaphore *s);
83
84/**
85 * kthread_should_stop: should this kthread return now?
86 *
87 * When someone calls kthread_stop on your kthread, it will be woken
88 * and this will return true. You should then return, and your return
89 * value will be passed through to kthread_stop().
90 */
91int kthread_should_stop(void); 32int kthread_should_stop(void);
92 33
93#endif /* _LINUX_KTHREAD_H */ 34#endif /* _LINUX_KTHREAD_H */
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index 62bc57580707..ed3396dcc4f7 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -66,7 +66,6 @@ typedef union {
66 66
67/** 67/**
68 * ktime_set - Set a ktime_t variable from a seconds/nanoseconds value 68 * ktime_set - Set a ktime_t variable from a seconds/nanoseconds value
69 *
70 * @secs: seconds to set 69 * @secs: seconds to set
71 * @nsecs: nanoseconds to set 70 * @nsecs: nanoseconds to set
72 * 71 *
@@ -138,7 +137,6 @@ static inline ktime_t ktime_set(const long secs, const unsigned long nsecs)
138 137
139/** 138/**
140 * ktime_sub - subtract two ktime_t variables 139 * ktime_sub - subtract two ktime_t variables
141 *
142 * @lhs: minuend 140 * @lhs: minuend
143 * @rhs: subtrahend 141 * @rhs: subtrahend
144 * 142 *
@@ -157,7 +155,6 @@ static inline ktime_t ktime_sub(const ktime_t lhs, const ktime_t rhs)
157 155
158/** 156/**
159 * ktime_add - add two ktime_t variables 157 * ktime_add - add two ktime_t variables
160 *
161 * @add1: addend1 158 * @add1: addend1
162 * @add2: addend2 159 * @add2: addend2
163 * 160 *
@@ -184,7 +181,6 @@ static inline ktime_t ktime_add(const ktime_t add1, const ktime_t add2)
184 181
185/** 182/**
186 * ktime_add_ns - Add a scalar nanoseconds value to a ktime_t variable 183 * ktime_add_ns - Add a scalar nanoseconds value to a ktime_t variable
187 *
188 * @kt: addend 184 * @kt: addend
189 * @nsec: the scalar nsec value to add 185 * @nsec: the scalar nsec value to add
190 * 186 *
@@ -194,7 +190,6 @@ extern ktime_t ktime_add_ns(const ktime_t kt, u64 nsec);
194 190
195/** 191/**
196 * timespec_to_ktime - convert a timespec to ktime_t format 192 * timespec_to_ktime - convert a timespec to ktime_t format
197 *
198 * @ts: the timespec variable to convert 193 * @ts: the timespec variable to convert
199 * 194 *
200 * Returns a ktime_t variable with the converted timespec value 195 * Returns a ktime_t variable with the converted timespec value
@@ -207,7 +202,6 @@ static inline ktime_t timespec_to_ktime(const struct timespec ts)
207 202
208/** 203/**
209 * timeval_to_ktime - convert a timeval to ktime_t format 204 * timeval_to_ktime - convert a timeval to ktime_t format
210 *
211 * @tv: the timeval variable to convert 205 * @tv: the timeval variable to convert
212 * 206 *
213 * Returns a ktime_t variable with the converted timeval value 207 * Returns a ktime_t variable with the converted timeval value
@@ -220,7 +214,6 @@ static inline ktime_t timeval_to_ktime(const struct timeval tv)
220 214
221/** 215/**
222 * ktime_to_timespec - convert a ktime_t variable to timespec format 216 * ktime_to_timespec - convert a ktime_t variable to timespec format
223 *
224 * @kt: the ktime_t variable to convert 217 * @kt: the ktime_t variable to convert
225 * 218 *
226 * Returns the timespec representation of the ktime value 219 * Returns the timespec representation of the ktime value
@@ -233,7 +226,6 @@ static inline struct timespec ktime_to_timespec(const ktime_t kt)
233 226
234/** 227/**
235 * ktime_to_timeval - convert a ktime_t variable to timeval format 228 * ktime_to_timeval - convert a ktime_t variable to timeval format
236 *
237 * @kt: the ktime_t variable to convert 229 * @kt: the ktime_t variable to convert
238 * 230 *
239 * Returns the timeval representation of the ktime value 231 * Returns the timeval representation of the ktime value
diff --git a/include/linux/libata.h b/include/linux/libata.h
index b80d2e7fa6d2..20b1cf527c60 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -33,6 +33,7 @@
33#include <asm/io.h> 33#include <asm/io.h>
34#include <linux/ata.h> 34#include <linux/ata.h>
35#include <linux/workqueue.h> 35#include <linux/workqueue.h>
36#include <scsi/scsi_host.h>
36 37
37/* 38/*
38 * compile-time options: to be removed as soon as all the drivers are 39 * compile-time options: to be removed as soon as all the drivers are
@@ -44,7 +45,6 @@
44#undef ATA_NDEBUG /* define to disable quick runtime checks */ 45#undef ATA_NDEBUG /* define to disable quick runtime checks */
45#undef ATA_ENABLE_PATA /* define to enable PATA support in some 46#undef ATA_ENABLE_PATA /* define to enable PATA support in some
46 * low-level drivers */ 47 * low-level drivers */
47#undef ATAPI_ENABLE_DMADIR /* enables ATAPI DMADIR bridge support */
48 48
49 49
50/* note: prints function name for you */ 50/* note: prints function name for you */
@@ -108,8 +108,11 @@ enum {
108 LIBATA_MAX_PRD = ATA_MAX_PRD / 2, 108 LIBATA_MAX_PRD = ATA_MAX_PRD / 2,
109 ATA_MAX_PORTS = 8, 109 ATA_MAX_PORTS = 8,
110 ATA_DEF_QUEUE = 1, 110 ATA_DEF_QUEUE = 1,
111 ATA_MAX_QUEUE = 1, 111 /* tag ATA_MAX_QUEUE - 1 is reserved for internal commands */
112 ATA_MAX_QUEUE = 32,
113 ATA_TAG_INTERNAL = ATA_MAX_QUEUE - 1,
112 ATA_MAX_SECTORS = 200, /* FIXME */ 114 ATA_MAX_SECTORS = 200, /* FIXME */
115 ATA_MAX_SECTORS_LBA48 = 65535,
113 ATA_MAX_BUS = 2, 116 ATA_MAX_BUS = 2,
114 ATA_DEF_BUSY_WAIT = 10000, 117 ATA_DEF_BUSY_WAIT = 10000,
115 ATA_SHORT_PAUSE = (HZ >> 6) + 1, 118 ATA_SHORT_PAUSE = (HZ >> 6) + 1,
@@ -120,9 +123,17 @@ enum {
120 ATA_SHT_USE_CLUSTERING = 1, 123 ATA_SHT_USE_CLUSTERING = 1,
121 124
122 /* struct ata_device stuff */ 125 /* struct ata_device stuff */
123 ATA_DFLAG_LBA48 = (1 << 0), /* device supports LBA48 */ 126 ATA_DFLAG_LBA = (1 << 0), /* device supports LBA */
124 ATA_DFLAG_PIO = (1 << 1), /* device currently in PIO mode */ 127 ATA_DFLAG_LBA48 = (1 << 1), /* device supports LBA48 */
125 ATA_DFLAG_LBA = (1 << 2), /* device supports LBA */ 128 ATA_DFLAG_CDB_INTR = (1 << 2), /* device asserts INTRQ when ready for CDB */
129 ATA_DFLAG_NCQ = (1 << 3), /* device supports NCQ */
130 ATA_DFLAG_CFG_MASK = (1 << 8) - 1,
131
132 ATA_DFLAG_PIO = (1 << 8), /* device currently in PIO mode */
133 ATA_DFLAG_INIT_MASK = (1 << 16) - 1,
134
135 ATA_DFLAG_DETACH = (1 << 16),
136 ATA_DFLAG_DETACHED = (1 << 17),
126 137
127 ATA_DEV_UNKNOWN = 0, /* unknown device */ 138 ATA_DEV_UNKNOWN = 0, /* unknown device */
128 ATA_DEV_ATA = 1, /* ATA device */ 139 ATA_DEV_ATA = 1, /* ATA device */
@@ -132,43 +143,57 @@ enum {
132 ATA_DEV_NONE = 5, /* no device */ 143 ATA_DEV_NONE = 5, /* no device */
133 144
134 /* struct ata_port flags */ 145 /* struct ata_port flags */
135 ATA_FLAG_SLAVE_POSS = (1 << 1), /* host supports slave dev */ 146 ATA_FLAG_SLAVE_POSS = (1 << 0), /* host supports slave dev */
136 /* (doesn't imply presence) */ 147 /* (doesn't imply presence) */
137 ATA_FLAG_PORT_DISABLED = (1 << 2), /* port is disabled, ignore it */ 148 ATA_FLAG_SATA = (1 << 1),
138 ATA_FLAG_SATA = (1 << 3), 149 ATA_FLAG_NO_LEGACY = (1 << 2), /* no legacy mode check */
139 ATA_FLAG_NO_LEGACY = (1 << 4), /* no legacy mode check */ 150 ATA_FLAG_MMIO = (1 << 3), /* use MMIO, not PIO */
140 ATA_FLAG_SRST = (1 << 5), /* (obsolete) use ATA SRST, not E.D.D. */ 151 ATA_FLAG_SRST = (1 << 4), /* (obsolete) use ATA SRST, not E.D.D. */
141 ATA_FLAG_MMIO = (1 << 6), /* use MMIO, not PIO */ 152 ATA_FLAG_SATA_RESET = (1 << 5), /* (obsolete) use COMRESET */
142 ATA_FLAG_SATA_RESET = (1 << 7), /* (obsolete) use COMRESET */ 153 ATA_FLAG_NO_ATAPI = (1 << 6), /* No ATAPI support */
143 ATA_FLAG_PIO_DMA = (1 << 8), /* PIO cmds via DMA */ 154 ATA_FLAG_PIO_DMA = (1 << 7), /* PIO cmds via DMA */
144 ATA_FLAG_NOINTR = (1 << 9), /* FIXME: Remove this once 155 ATA_FLAG_PIO_LBA48 = (1 << 8), /* Host DMA engine is LBA28 only */
145 * proper HSM is in place. */ 156 ATA_FLAG_PIO_POLLING = (1 << 9), /* use polling PIO if LLD
146 ATA_FLAG_DEBUGMSG = (1 << 10), 157 * doesn't handle PIO interrupts */
147 ATA_FLAG_NO_ATAPI = (1 << 11), /* No ATAPI support */ 158 ATA_FLAG_NCQ = (1 << 10), /* host supports NCQ */
148 159 ATA_FLAG_HRST_TO_RESUME = (1 << 11), /* hardreset to resume phy */
149 ATA_FLAG_SUSPENDED = (1 << 12), /* port is suspended */ 160 ATA_FLAG_SKIP_D2H_BSY = (1 << 12), /* can't wait for the first D2H
150 161 * Register FIS clearing BSY */
151 ATA_FLAG_PIO_LBA48 = (1 << 13), /* Host DMA engine is LBA28 only */ 162
152 ATA_FLAG_IRQ_MASK = (1 << 14), /* Mask IRQ in PIO xfers */ 163 ATA_FLAG_DEBUGMSG = (1 << 13),
153 164 ATA_FLAG_FLUSH_PORT_TASK = (1 << 14), /* flush port task */
154 ATA_FLAG_FLUSH_PORT_TASK = (1 << 15), /* Flush port task */ 165
155 ATA_FLAG_IN_EH = (1 << 16), /* EH in progress */ 166 ATA_FLAG_EH_PENDING = (1 << 15), /* EH pending */
156 167 ATA_FLAG_EH_IN_PROGRESS = (1 << 16), /* EH in progress */
157 ATA_QCFLAG_ACTIVE = (1 << 1), /* cmd not yet ack'd to scsi lyer */ 168 ATA_FLAG_FROZEN = (1 << 17), /* port is frozen */
158 ATA_QCFLAG_SG = (1 << 3), /* have s/g table? */ 169 ATA_FLAG_RECOVERED = (1 << 18), /* recovery action performed */
159 ATA_QCFLAG_SINGLE = (1 << 4), /* no s/g, just a single buffer */ 170 ATA_FLAG_LOADING = (1 << 19), /* boot/loading probe */
171 ATA_FLAG_UNLOADING = (1 << 20), /* module is unloading */
172 ATA_FLAG_SCSI_HOTPLUG = (1 << 21), /* SCSI hotplug scheduled */
173
174 ATA_FLAG_DISABLED = (1 << 22), /* port is disabled, ignore it */
175 ATA_FLAG_SUSPENDED = (1 << 23), /* port is suspended (power) */
176
177 /* bits 24:31 of ap->flags are reserved for LLDD specific flags */
178
179 /* struct ata_queued_cmd flags */
180 ATA_QCFLAG_ACTIVE = (1 << 0), /* cmd not yet ack'd to scsi lyer */
181 ATA_QCFLAG_SG = (1 << 1), /* have s/g table? */
182 ATA_QCFLAG_SINGLE = (1 << 2), /* no s/g, just a single buffer */
160 ATA_QCFLAG_DMAMAP = ATA_QCFLAG_SG | ATA_QCFLAG_SINGLE, 183 ATA_QCFLAG_DMAMAP = ATA_QCFLAG_SG | ATA_QCFLAG_SINGLE,
161 ATA_QCFLAG_EH_SCHEDULED = (1 << 5), /* EH scheduled */ 184 ATA_QCFLAG_IO = (1 << 3), /* standard IO command */
185 ATA_QCFLAG_RESULT_TF = (1 << 4), /* result TF requested */
186
187 ATA_QCFLAG_FAILED = (1 << 16), /* cmd failed and is owned by EH */
188 ATA_QCFLAG_SENSE_VALID = (1 << 17), /* sense data valid */
189 ATA_QCFLAG_EH_SCHEDULED = (1 << 18), /* EH scheduled (obsolete) */
162 190
163 /* host set flags */ 191 /* host set flags */
164 ATA_HOST_SIMPLEX = (1 << 0), /* Host is simplex, one DMA channel per host_set only */ 192 ATA_HOST_SIMPLEX = (1 << 0), /* Host is simplex, one DMA channel per host_set only */
165 193
166 /* various lengths of time */ 194 /* various lengths of time */
167 ATA_TMOUT_PIO = 30 * HZ,
168 ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */ 195 ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */
169 ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* heuristic */ 196 ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* heuristic */
170 ATA_TMOUT_CDB = 30 * HZ,
171 ATA_TMOUT_CDB_QUICK = 5 * HZ,
172 ATA_TMOUT_INTERNAL = 30 * HZ, 197 ATA_TMOUT_INTERNAL = 30 * HZ,
173 ATA_TMOUT_INTERNAL_QUICK = 5 * HZ, 198 ATA_TMOUT_INTERNAL_QUICK = 5 * HZ,
174 199
@@ -207,21 +232,56 @@ enum {
207 /* size of buffer to pad xfers ending on unaligned boundaries */ 232 /* size of buffer to pad xfers ending on unaligned boundaries */
208 ATA_DMA_PAD_SZ = 4, 233 ATA_DMA_PAD_SZ = 4,
209 ATA_DMA_PAD_BUF_SZ = ATA_DMA_PAD_SZ * ATA_MAX_QUEUE, 234 ATA_DMA_PAD_BUF_SZ = ATA_DMA_PAD_SZ * ATA_MAX_QUEUE,
210 235
211 /* Masks for port functions */ 236 /* masks for port functions */
212 ATA_PORT_PRIMARY = (1 << 0), 237 ATA_PORT_PRIMARY = (1 << 0),
213 ATA_PORT_SECONDARY = (1 << 1), 238 ATA_PORT_SECONDARY = (1 << 1),
239
240 /* ering size */
241 ATA_ERING_SIZE = 32,
242
243 /* desc_len for ata_eh_info and context */
244 ATA_EH_DESC_LEN = 80,
245
246 /* reset / recovery action types */
247 ATA_EH_REVALIDATE = (1 << 0),
248 ATA_EH_SOFTRESET = (1 << 1),
249 ATA_EH_HARDRESET = (1 << 2),
250
251 ATA_EH_RESET_MASK = ATA_EH_SOFTRESET | ATA_EH_HARDRESET,
252 ATA_EH_PERDEV_MASK = ATA_EH_REVALIDATE,
253
254 /* ata_eh_info->flags */
255 ATA_EHI_HOTPLUGGED = (1 << 0), /* could have been hotplugged */
256
257 ATA_EHI_DID_RESET = (1 << 16), /* already reset this port */
258
259 /* max repeat if error condition is still set after ->error_handler */
260 ATA_EH_MAX_REPEAT = 5,
261
262 /* how hard are we gonna try to probe/recover devices */
263 ATA_PROBE_MAX_TRIES = 3,
264 ATA_EH_RESET_TRIES = 3,
265 ATA_EH_DEV_TRIES = 3,
266
267 /* Drive spinup time (time from power-on to the first D2H FIS)
268 * in msecs - 8s currently. Failing to get ready in this time
269 * isn't critical. It will result in reset failure for
270 * controllers which can't wait for the first D2H FIS. libata
271 * will retry, so it just has to be long enough to spin up
272 * most devices.
273 */
274 ATA_SPINUP_WAIT = 8000,
214}; 275};
215 276
216enum hsm_task_states { 277enum hsm_task_states {
217 HSM_ST_UNKNOWN, 278 HSM_ST_UNKNOWN, /* state unknown */
218 HSM_ST_IDLE, 279 HSM_ST_IDLE, /* no command on going */
219 HSM_ST_POLL, 280 HSM_ST, /* (waiting the device to) transfer data */
220 HSM_ST_TMOUT, 281 HSM_ST_LAST, /* (waiting the device to) complete command */
221 HSM_ST, 282 HSM_ST_ERR, /* error */
222 HSM_ST_LAST, 283 HSM_ST_FIRST, /* (waiting the device to)
223 HSM_ST_LAST_POLL, 284 write CDB or first data block */
224 HSM_ST_ERR,
225}; 285};
226 286
227enum ata_completion_errors { 287enum ata_completion_errors {
@@ -244,9 +304,9 @@ struct ata_queued_cmd;
244 304
245/* typedefs */ 305/* typedefs */
246typedef void (*ata_qc_cb_t) (struct ata_queued_cmd *qc); 306typedef void (*ata_qc_cb_t) (struct ata_queued_cmd *qc);
247typedef void (*ata_probeinit_fn_t)(struct ata_port *); 307typedef int (*ata_prereset_fn_t)(struct ata_port *ap);
248typedef int (*ata_reset_fn_t)(struct ata_port *, int, unsigned int *); 308typedef int (*ata_reset_fn_t)(struct ata_port *ap, unsigned int *classes);
249typedef void (*ata_postreset_fn_t)(struct ata_port *ap, unsigned int *); 309typedef void (*ata_postreset_fn_t)(struct ata_port *ap, unsigned int *classes);
250 310
251struct ata_ioports { 311struct ata_ioports {
252 unsigned long cmd_addr; 312 unsigned long cmd_addr;
@@ -297,7 +357,8 @@ struct ata_host_set {
297 unsigned long flags; 357 unsigned long flags;
298 int simplex_claimed; /* Keep seperate in case we 358 int simplex_claimed; /* Keep seperate in case we
299 ever need to do this locked */ 359 ever need to do this locked */
300 struct ata_port * ports[0]; 360 struct ata_host_set *next; /* for legacy mode */
361 struct ata_port *ports[0];
301}; 362};
302 363
303struct ata_queued_cmd { 364struct ata_queued_cmd {
@@ -336,7 +397,7 @@ struct ata_queued_cmd {
336 struct scatterlist *__sg; 397 struct scatterlist *__sg;
337 398
338 unsigned int err_mask; 399 unsigned int err_mask;
339 400 struct ata_taskfile result_tf;
340 ata_qc_cb_t complete_fn; 401 ata_qc_cb_t complete_fn;
341 402
342 void *private_data; 403 void *private_data;
@@ -348,12 +409,26 @@ struct ata_host_stats {
348 unsigned long rw_reqbuf; 409 unsigned long rw_reqbuf;
349}; 410};
350 411
412struct ata_ering_entry {
413 int is_io;
414 unsigned int err_mask;
415 u64 timestamp;
416};
417
418struct ata_ering {
419 int cursor;
420 struct ata_ering_entry ring[ATA_ERING_SIZE];
421};
422
351struct ata_device { 423struct ata_device {
352 u64 n_sectors; /* size of device, if ATA */ 424 struct ata_port *ap;
425 unsigned int devno; /* 0 or 1 */
353 unsigned long flags; /* ATA_DFLAG_xxx */ 426 unsigned long flags; /* ATA_DFLAG_xxx */
427 struct scsi_device *sdev; /* attached SCSI device */
428 /* n_sector is used as CLEAR_OFFSET, read comment above CLEAR_OFFSET */
429 u64 n_sectors; /* size of device, if ATA */
354 unsigned int class; /* ATA_DEV_xxx */ 430 unsigned int class; /* ATA_DEV_xxx */
355 unsigned int devno; /* 0 or 1 */ 431 u16 id[ATA_ID_WORDS]; /* IDENTIFY xxx DEVICE data */
356 u16 *id; /* IDENTIFY xxx DEVICE data */
357 u8 pio_mode; 432 u8 pio_mode;
358 u8 dma_mode; 433 u8 dma_mode;
359 u8 xfer_mode; 434 u8 xfer_mode;
@@ -373,11 +448,42 @@ struct ata_device {
373 u16 cylinders; /* Number of cylinders */ 448 u16 cylinders; /* Number of cylinders */
374 u16 heads; /* Number of heads */ 449 u16 heads; /* Number of heads */
375 u16 sectors; /* Number of sectors per track */ 450 u16 sectors; /* Number of sectors per track */
451
452 /* error history */
453 struct ata_ering ering;
454};
455
456/* Offset into struct ata_device. Fields above it are maintained
457 * acress device init. Fields below are zeroed.
458 */
459#define ATA_DEVICE_CLEAR_OFFSET offsetof(struct ata_device, n_sectors)
460
461struct ata_eh_info {
462 struct ata_device *dev; /* offending device */
463 u32 serror; /* SError from LLDD */
464 unsigned int err_mask; /* port-wide err_mask */
465 unsigned int action; /* ATA_EH_* action mask */
466 unsigned int dev_action[ATA_MAX_DEVICES]; /* dev EH action */
467 unsigned int flags; /* ATA_EHI_* flags */
468
469 unsigned long hotplug_timestamp;
470 unsigned int probe_mask;
471
472 char desc[ATA_EH_DESC_LEN];
473 int desc_len;
474};
475
476struct ata_eh_context {
477 struct ata_eh_info i;
478 int tries[ATA_MAX_DEVICES];
479 unsigned int classes[ATA_MAX_DEVICES];
480 unsigned int did_probe_mask;
376}; 481};
377 482
378struct ata_port { 483struct ata_port {
379 struct Scsi_Host *host; /* our co-allocated scsi host */ 484 struct Scsi_Host *host; /* our co-allocated scsi host */
380 const struct ata_port_operations *ops; 485 const struct ata_port_operations *ops;
486 spinlock_t *lock;
381 unsigned long flags; /* ATA_FLAG_xxx */ 487 unsigned long flags; /* ATA_FLAG_xxx */
382 unsigned int id; /* unique id req'd by scsi midlyr */ 488 unsigned int id; /* unique id req'd by scsi midlyr */
383 unsigned int port_no; /* unique port #; from zero */ 489 unsigned int port_no; /* unique port #; from zero */
@@ -397,26 +503,40 @@ struct ata_port {
397 unsigned int mwdma_mask; 503 unsigned int mwdma_mask;
398 unsigned int udma_mask; 504 unsigned int udma_mask;
399 unsigned int cbl; /* cable type; ATA_CBL_xxx */ 505 unsigned int cbl; /* cable type; ATA_CBL_xxx */
506 unsigned int hw_sata_spd_limit;
507 unsigned int sata_spd_limit; /* SATA PHY speed limit */
508
509 /* record runtime error info, protected by host_set lock */
510 struct ata_eh_info eh_info;
511 /* EH context owned by EH */
512 struct ata_eh_context eh_context;
400 513
401 struct ata_device device[ATA_MAX_DEVICES]; 514 struct ata_device device[ATA_MAX_DEVICES];
402 515
403 struct ata_queued_cmd qcmd[ATA_MAX_QUEUE]; 516 struct ata_queued_cmd qcmd[ATA_MAX_QUEUE];
404 unsigned long qactive; 517 unsigned long qc_allocated;
518 unsigned int qc_active;
519
405 unsigned int active_tag; 520 unsigned int active_tag;
521 u32 sactive;
406 522
407 struct ata_host_stats stats; 523 struct ata_host_stats stats;
408 struct ata_host_set *host_set; 524 struct ata_host_set *host_set;
409 struct device *dev; 525 struct device *dev;
410 526
411 struct work_struct port_task; 527 struct work_struct port_task;
528 struct work_struct hotplug_task;
529 struct work_struct scsi_rescan_task;
412 530
413 unsigned int hsm_task_state; 531 unsigned int hsm_task_state;
414 unsigned long pio_task_timeout;
415 532
416 u32 msg_enable; 533 u32 msg_enable;
417 struct list_head eh_done_q; 534 struct list_head eh_done_q;
535 wait_queue_head_t eh_wait_q;
418 536
419 void *private_data; 537 void *private_data;
538
539 u8 sector_buf[ATA_SECT_SIZE]; /* owned by EH */
420}; 540};
421 541
422struct ata_port_operations { 542struct ata_port_operations {
@@ -438,7 +558,6 @@ struct ata_port_operations {
438 558
439 void (*phy_reset) (struct ata_port *ap); /* obsolete */ 559 void (*phy_reset) (struct ata_port *ap); /* obsolete */
440 void (*set_mode) (struct ata_port *ap); 560 void (*set_mode) (struct ata_port *ap);
441 int (*probe_reset) (struct ata_port *ap, unsigned int *classes);
442 561
443 void (*post_set_mode) (struct ata_port *ap); 562 void (*post_set_mode) (struct ata_port *ap);
444 563
@@ -447,10 +566,20 @@ struct ata_port_operations {
447 void (*bmdma_setup) (struct ata_queued_cmd *qc); 566 void (*bmdma_setup) (struct ata_queued_cmd *qc);
448 void (*bmdma_start) (struct ata_queued_cmd *qc); 567 void (*bmdma_start) (struct ata_queued_cmd *qc);
449 568
569 void (*data_xfer) (struct ata_device *, unsigned char *, unsigned int, int);
570
450 void (*qc_prep) (struct ata_queued_cmd *qc); 571 void (*qc_prep) (struct ata_queued_cmd *qc);
451 unsigned int (*qc_issue) (struct ata_queued_cmd *qc); 572 unsigned int (*qc_issue) (struct ata_queued_cmd *qc);
452 573
453 void (*eng_timeout) (struct ata_port *ap); 574 /* Error handlers. ->error_handler overrides ->eng_timeout and
575 * indicates that new-style EH is in place.
576 */
577 void (*eng_timeout) (struct ata_port *ap); /* obsolete */
578
579 void (*freeze) (struct ata_port *ap);
580 void (*thaw) (struct ata_port *ap);
581 void (*error_handler) (struct ata_port *ap);
582 void (*post_internal_cmd) (struct ata_queued_cmd *qc);
454 583
455 irqreturn_t (*irq_handler)(int, void *, struct pt_regs *); 584 irqreturn_t (*irq_handler)(int, void *, struct pt_regs *);
456 void (*irq_clear) (struct ata_port *); 585 void (*irq_clear) (struct ata_port *);
@@ -492,22 +621,22 @@ struct ata_timing {
492 621
493#define FIT(v,vmin,vmax) max_t(short,min_t(short,v,vmax),vmin) 622#define FIT(v,vmin,vmax) max_t(short,min_t(short,v,vmax),vmin)
494 623
624extern const unsigned long sata_deb_timing_boot[];
625extern const unsigned long sata_deb_timing_eh[];
626extern const unsigned long sata_deb_timing_before_fsrst[];
627
495extern void ata_port_probe(struct ata_port *); 628extern void ata_port_probe(struct ata_port *);
496extern void __sata_phy_reset(struct ata_port *ap); 629extern void __sata_phy_reset(struct ata_port *ap);
497extern void sata_phy_reset(struct ata_port *ap); 630extern void sata_phy_reset(struct ata_port *ap);
498extern void ata_bus_reset(struct ata_port *ap); 631extern void ata_bus_reset(struct ata_port *ap);
499extern int ata_drive_probe_reset(struct ata_port *ap, 632extern int sata_set_spd(struct ata_port *ap);
500 ata_probeinit_fn_t probeinit, 633extern int sata_phy_debounce(struct ata_port *ap, const unsigned long *param);
501 ata_reset_fn_t softreset, ata_reset_fn_t hardreset, 634extern int sata_phy_resume(struct ata_port *ap, const unsigned long *param);
502 ata_postreset_fn_t postreset, unsigned int *classes); 635extern int ata_std_prereset(struct ata_port *ap);
503extern void ata_std_probeinit(struct ata_port *ap); 636extern int ata_std_softreset(struct ata_port *ap, unsigned int *classes);
504extern int ata_std_softreset(struct ata_port *ap, int verbose, 637extern int sata_std_hardreset(struct ata_port *ap, unsigned int *class);
505 unsigned int *classes);
506extern int sata_std_hardreset(struct ata_port *ap, int verbose,
507 unsigned int *class);
508extern void ata_std_postreset(struct ata_port *ap, unsigned int *classes); 638extern void ata_std_postreset(struct ata_port *ap, unsigned int *classes);
509extern int ata_dev_revalidate(struct ata_port *ap, struct ata_device *dev, 639extern int ata_dev_revalidate(struct ata_device *dev, int post_reset);
510 int post_reset);
511extern void ata_port_disable(struct ata_port *); 640extern void ata_port_disable(struct ata_port *);
512extern void ata_std_ports(struct ata_ioports *ioaddr); 641extern void ata_std_ports(struct ata_ioports *ioaddr);
513#ifdef CONFIG_PCI 642#ifdef CONFIG_PCI
@@ -519,24 +648,32 @@ extern int ata_pci_device_resume(struct pci_dev *pdev);
519extern int ata_pci_clear_simplex(struct pci_dev *pdev); 648extern int ata_pci_clear_simplex(struct pci_dev *pdev);
520#endif /* CONFIG_PCI */ 649#endif /* CONFIG_PCI */
521extern int ata_device_add(const struct ata_probe_ent *ent); 650extern int ata_device_add(const struct ata_probe_ent *ent);
651extern void ata_port_detach(struct ata_port *ap);
522extern void ata_host_set_remove(struct ata_host_set *host_set); 652extern void ata_host_set_remove(struct ata_host_set *host_set);
523extern int ata_scsi_detect(struct scsi_host_template *sht); 653extern int ata_scsi_detect(struct scsi_host_template *sht);
524extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg); 654extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg);
525extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)); 655extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *));
526extern void ata_eh_qc_complete(struct ata_queued_cmd *qc);
527extern void ata_eh_qc_retry(struct ata_queued_cmd *qc);
528extern int ata_scsi_release(struct Scsi_Host *host); 656extern int ata_scsi_release(struct Scsi_Host *host);
529extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc); 657extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc);
658extern int sata_scr_valid(struct ata_port *ap);
659extern int sata_scr_read(struct ata_port *ap, int reg, u32 *val);
660extern int sata_scr_write(struct ata_port *ap, int reg, u32 val);
661extern int sata_scr_write_flush(struct ata_port *ap, int reg, u32 val);
662extern int ata_port_online(struct ata_port *ap);
663extern int ata_port_offline(struct ata_port *ap);
530extern int ata_scsi_device_resume(struct scsi_device *); 664extern int ata_scsi_device_resume(struct scsi_device *);
531extern int ata_scsi_device_suspend(struct scsi_device *, pm_message_t state); 665extern int ata_scsi_device_suspend(struct scsi_device *, pm_message_t state);
532extern int ata_device_resume(struct ata_port *, struct ata_device *); 666extern int ata_device_resume(struct ata_device *);
533extern int ata_device_suspend(struct ata_port *, struct ata_device *, pm_message_t state); 667extern int ata_device_suspend(struct ata_device *, pm_message_t state);
534extern int ata_ratelimit(void); 668extern int ata_ratelimit(void);
535extern unsigned int ata_busy_sleep(struct ata_port *ap, 669extern unsigned int ata_busy_sleep(struct ata_port *ap,
536 unsigned long timeout_pat, 670 unsigned long timeout_pat,
537 unsigned long timeout); 671 unsigned long timeout);
538extern void ata_port_queue_task(struct ata_port *ap, void (*fn)(void *), 672extern void ata_port_queue_task(struct ata_port *ap, void (*fn)(void *),
539 void *data, unsigned long delay); 673 void *data, unsigned long delay);
674extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val,
675 unsigned long interval_msec,
676 unsigned long timeout_msec);
540 677
541/* 678/*
542 * Default driver ops implementations 679 * Default driver ops implementations
@@ -550,11 +687,16 @@ extern void ata_std_dev_select (struct ata_port *ap, unsigned int device);
550extern u8 ata_check_status(struct ata_port *ap); 687extern u8 ata_check_status(struct ata_port *ap);
551extern u8 ata_altstatus(struct ata_port *ap); 688extern u8 ata_altstatus(struct ata_port *ap);
552extern void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf); 689extern void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf);
553extern int ata_std_probe_reset(struct ata_port *ap, unsigned int *classes);
554extern int ata_port_start (struct ata_port *ap); 690extern int ata_port_start (struct ata_port *ap);
555extern void ata_port_stop (struct ata_port *ap); 691extern void ata_port_stop (struct ata_port *ap);
556extern void ata_host_stop (struct ata_host_set *host_set); 692extern void ata_host_stop (struct ata_host_set *host_set);
557extern irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs); 693extern irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs);
694extern void ata_mmio_data_xfer(struct ata_device *adev, unsigned char *buf,
695 unsigned int buflen, int write_data);
696extern void ata_pio_data_xfer(struct ata_device *adev, unsigned char *buf,
697 unsigned int buflen, int write_data);
698extern void ata_pio_data_xfer_noirq(struct ata_device *adev, unsigned char *buf,
699 unsigned int buflen, int write_data);
558extern void ata_qc_prep(struct ata_queued_cmd *qc); 700extern void ata_qc_prep(struct ata_queued_cmd *qc);
559extern void ata_noop_qc_prep(struct ata_queued_cmd *qc); 701extern void ata_noop_qc_prep(struct ata_queued_cmd *qc);
560extern unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc); 702extern unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc);
@@ -572,17 +714,29 @@ extern void ata_bmdma_start (struct ata_queued_cmd *qc);
572extern void ata_bmdma_stop(struct ata_queued_cmd *qc); 714extern void ata_bmdma_stop(struct ata_queued_cmd *qc);
573extern u8 ata_bmdma_status(struct ata_port *ap); 715extern u8 ata_bmdma_status(struct ata_port *ap);
574extern void ata_bmdma_irq_clear(struct ata_port *ap); 716extern void ata_bmdma_irq_clear(struct ata_port *ap);
575extern void __ata_qc_complete(struct ata_queued_cmd *qc); 717extern void ata_bmdma_freeze(struct ata_port *ap);
576extern void ata_eng_timeout(struct ata_port *ap); 718extern void ata_bmdma_thaw(struct ata_port *ap);
577extern void ata_scsi_simulate(struct ata_port *ap, struct ata_device *dev, 719extern void ata_bmdma_drive_eh(struct ata_port *ap, ata_prereset_fn_t prereset,
578 struct scsi_cmnd *cmd, 720 ata_reset_fn_t softreset,
721 ata_reset_fn_t hardreset,
722 ata_postreset_fn_t postreset);
723extern void ata_bmdma_error_handler(struct ata_port *ap);
724extern void ata_bmdma_post_internal_cmd(struct ata_queued_cmd *qc);
725extern int ata_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc,
726 u8 status, int in_wq);
727extern void ata_qc_complete(struct ata_queued_cmd *qc);
728extern int ata_qc_complete_multiple(struct ata_port *ap, u32 qc_active,
729 void (*finish_qc)(struct ata_queued_cmd *));
730extern void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd,
579 void (*done)(struct scsi_cmnd *)); 731 void (*done)(struct scsi_cmnd *));
580extern int ata_std_bios_param(struct scsi_device *sdev, 732extern int ata_std_bios_param(struct scsi_device *sdev,
581 struct block_device *bdev, 733 struct block_device *bdev,
582 sector_t capacity, int geom[]); 734 sector_t capacity, int geom[]);
583extern int ata_scsi_slave_config(struct scsi_device *sdev); 735extern int ata_scsi_slave_config(struct scsi_device *sdev);
584extern struct ata_device *ata_dev_pair(struct ata_port *ap, 736extern void ata_scsi_slave_destroy(struct scsi_device *sdev);
585 struct ata_device *adev); 737extern int ata_scsi_change_queue_depth(struct scsi_device *sdev,
738 int queue_depth);
739extern struct ata_device *ata_dev_pair(struct ata_device *adev);
586 740
587/* 741/*
588 * Timing helpers 742 * Timing helpers
@@ -628,7 +782,64 @@ extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bit
628extern unsigned long ata_pci_default_filter(const struct ata_port *, struct ata_device *, unsigned long); 782extern unsigned long ata_pci_default_filter(const struct ata_port *, struct ata_device *, unsigned long);
629#endif /* CONFIG_PCI */ 783#endif /* CONFIG_PCI */
630 784
785/*
786 * EH
787 */
788extern void ata_eng_timeout(struct ata_port *ap);
789
790extern void ata_port_schedule_eh(struct ata_port *ap);
791extern int ata_port_abort(struct ata_port *ap);
792extern int ata_port_freeze(struct ata_port *ap);
793
794extern void ata_eh_freeze_port(struct ata_port *ap);
795extern void ata_eh_thaw_port(struct ata_port *ap);
796
797extern void ata_eh_qc_complete(struct ata_queued_cmd *qc);
798extern void ata_eh_qc_retry(struct ata_queued_cmd *qc);
799
800extern void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset,
801 ata_reset_fn_t softreset, ata_reset_fn_t hardreset,
802 ata_postreset_fn_t postreset);
803
804/*
805 * printk helpers
806 */
807#define ata_port_printk(ap, lv, fmt, args...) \
808 printk(lv"ata%u: "fmt, (ap)->id , ##args)
809
810#define ata_dev_printk(dev, lv, fmt, args...) \
811 printk(lv"ata%u.%02u: "fmt, (dev)->ap->id, (dev)->devno , ##args)
812
813/*
814 * ata_eh_info helpers
815 */
816#define ata_ehi_push_desc(ehi, fmt, args...) do { \
817 (ehi)->desc_len += scnprintf((ehi)->desc + (ehi)->desc_len, \
818 ATA_EH_DESC_LEN - (ehi)->desc_len, \
819 fmt , ##args); \
820} while (0)
821
822#define ata_ehi_clear_desc(ehi) do { \
823 (ehi)->desc[0] = '\0'; \
824 (ehi)->desc_len = 0; \
825} while (0)
826
827static inline void ata_ehi_hotplugged(struct ata_eh_info *ehi)
828{
829 if (ehi->flags & ATA_EHI_HOTPLUGGED)
830 return;
831
832 ehi->flags |= ATA_EHI_HOTPLUGGED;
833 ehi->hotplug_timestamp = jiffies;
631 834
835 ehi->err_mask |= AC_ERR_ATA_BUS;
836 ehi->action |= ATA_EH_SOFTRESET;
837 ehi->probe_mask |= (1 << ATA_MAX_DEVICES) - 1;
838}
839
840/*
841 * qc helpers
842 */
632static inline int 843static inline int
633ata_sg_is_last(struct scatterlist *sg, struct ata_queued_cmd *qc) 844ata_sg_is_last(struct scatterlist *sg, struct ata_queued_cmd *qc)
634{ 845{
@@ -671,14 +882,39 @@ static inline unsigned int ata_tag_valid(unsigned int tag)
671 return (tag < ATA_MAX_QUEUE) ? 1 : 0; 882 return (tag < ATA_MAX_QUEUE) ? 1 : 0;
672} 883}
673 884
674static inline unsigned int ata_class_present(unsigned int class) 885static inline unsigned int ata_tag_internal(unsigned int tag)
886{
887 return tag == ATA_MAX_QUEUE - 1;
888}
889
890static inline unsigned int ata_class_enabled(unsigned int class)
675{ 891{
676 return class == ATA_DEV_ATA || class == ATA_DEV_ATAPI; 892 return class == ATA_DEV_ATA || class == ATA_DEV_ATAPI;
677} 893}
678 894
679static inline unsigned int ata_dev_present(const struct ata_device *dev) 895static inline unsigned int ata_class_disabled(unsigned int class)
680{ 896{
681 return ata_class_present(dev->class); 897 return class == ATA_DEV_ATA_UNSUP || class == ATA_DEV_ATAPI_UNSUP;
898}
899
900static inline unsigned int ata_class_absent(unsigned int class)
901{
902 return !ata_class_enabled(class) && !ata_class_disabled(class);
903}
904
905static inline unsigned int ata_dev_enabled(const struct ata_device *dev)
906{
907 return ata_class_enabled(dev->class);
908}
909
910static inline unsigned int ata_dev_disabled(const struct ata_device *dev)
911{
912 return ata_class_disabled(dev->class);
913}
914
915static inline unsigned int ata_dev_absent(const struct ata_device *dev)
916{
917 return ata_class_absent(dev->class);
682} 918}
683 919
684static inline u8 ata_chk_status(struct ata_port *ap) 920static inline u8 ata_chk_status(struct ata_port *ap)
@@ -759,20 +995,35 @@ static inline void ata_qc_set_polling(struct ata_queued_cmd *qc)
759 qc->tf.ctl |= ATA_NIEN; 995 qc->tf.ctl |= ATA_NIEN;
760} 996}
761 997
762static inline struct ata_queued_cmd *ata_qc_from_tag (struct ata_port *ap, 998static inline struct ata_queued_cmd *__ata_qc_from_tag(struct ata_port *ap,
763 unsigned int tag) 999 unsigned int tag)
764{ 1000{
765 if (likely(ata_tag_valid(tag))) 1001 if (likely(ata_tag_valid(tag)))
766 return &ap->qcmd[tag]; 1002 return &ap->qcmd[tag];
767 return NULL; 1003 return NULL;
768} 1004}
769 1005
770static inline void ata_tf_init(struct ata_port *ap, struct ata_taskfile *tf, unsigned int device) 1006static inline struct ata_queued_cmd *ata_qc_from_tag(struct ata_port *ap,
1007 unsigned int tag)
1008{
1009 struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag);
1010
1011 if (unlikely(!qc) || !ap->ops->error_handler)
1012 return qc;
1013
1014 if ((qc->flags & (ATA_QCFLAG_ACTIVE |
1015 ATA_QCFLAG_FAILED)) == ATA_QCFLAG_ACTIVE)
1016 return qc;
1017
1018 return NULL;
1019}
1020
1021static inline void ata_tf_init(struct ata_device *dev, struct ata_taskfile *tf)
771{ 1022{
772 memset(tf, 0, sizeof(*tf)); 1023 memset(tf, 0, sizeof(*tf));
773 1024
774 tf->ctl = ap->ctl; 1025 tf->ctl = dev->ap->ctl;
775 if (device == 0) 1026 if (dev->devno == 0)
776 tf->device = ATA_DEVICE_OBS; 1027 tf->device = ATA_DEVICE_OBS;
777 else 1028 else
778 tf->device = ATA_DEVICE_OBS | ATA_DEV1; 1029 tf->device = ATA_DEVICE_OBS | ATA_DEV1;
@@ -787,26 +1038,11 @@ static inline void ata_qc_reinit(struct ata_queued_cmd *qc)
787 qc->nbytes = qc->curbytes = 0; 1038 qc->nbytes = qc->curbytes = 0;
788 qc->err_mask = 0; 1039 qc->err_mask = 0;
789 1040
790 ata_tf_init(qc->ap, &qc->tf, qc->dev->devno); 1041 ata_tf_init(qc->dev, &qc->tf);
791}
792
793/**
794 * ata_qc_complete - Complete an active ATA command
795 * @qc: Command to complete
796 * @err_mask: ATA Status register contents
797 *
798 * Indicate to the mid and upper layers that an ATA
799 * command has completed, with either an ok or not-ok status.
800 *
801 * LOCKING:
802 * spin_lock_irqsave(host_set lock)
803 */
804static inline void ata_qc_complete(struct ata_queued_cmd *qc)
805{
806 if (unlikely(qc->flags & ATA_QCFLAG_EH_SCHEDULED))
807 return;
808 1042
809 __ata_qc_complete(qc); 1043 /* init result_tf such that it indicates normal completion */
1044 qc->result_tf.command = ATA_DRDY;
1045 qc->result_tf.feature = 0;
810} 1046}
811 1047
812/** 1048/**
@@ -885,28 +1121,6 @@ static inline u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq)
885 return status; 1121 return status;
886} 1122}
887 1123
888static inline u32 scr_read(struct ata_port *ap, unsigned int reg)
889{
890 return ap->ops->scr_read(ap, reg);
891}
892
893static inline void scr_write(struct ata_port *ap, unsigned int reg, u32 val)
894{
895 ap->ops->scr_write(ap, reg, val);
896}
897
898static inline void scr_write_flush(struct ata_port *ap, unsigned int reg,
899 u32 val)
900{
901 ap->ops->scr_write(ap, reg, val);
902 (void) ap->ops->scr_read(ap, reg);
903}
904
905static inline unsigned int sata_dev_present(struct ata_port *ap)
906{
907 return ((scr_read(ap, SCR_STATUS) & 0xf) == 0x3) ? 1 : 0;
908}
909
910static inline int ata_try_flush_cache(const struct ata_device *dev) 1124static inline int ata_try_flush_cache(const struct ata_device *dev)
911{ 1125{
912 return ata_id_wcache_enabled(dev->id) || 1126 return ata_id_wcache_enabled(dev->id) ||
@@ -916,7 +1130,7 @@ static inline int ata_try_flush_cache(const struct ata_device *dev)
916 1130
917static inline unsigned int ac_err_mask(u8 status) 1131static inline unsigned int ac_err_mask(u8 status)
918{ 1132{
919 if (status & ATA_BUSY) 1133 if (status & (ATA_BUSY | ATA_DRQ))
920 return AC_ERR_HSM; 1134 return AC_ERR_HSM;
921 if (status & (ATA_ERR | ATA_DF)) 1135 if (status & (ATA_ERR | ATA_DF))
922 return AC_ERR_DEV; 1136 return AC_ERR_DEV;
@@ -944,4 +1158,9 @@ static inline void ata_pad_free(struct ata_port *ap, struct device *dev)
944 dma_free_coherent(dev, ATA_DMA_PAD_BUF_SZ, ap->pad, ap->pad_dma); 1158 dma_free_coherent(dev, ATA_DMA_PAD_BUF_SZ, ap->pad, ap->pad_dma);
945} 1159}
946 1160
1161static inline struct ata_port *ata_shost_to_port(struct Scsi_Host *host)
1162{
1163 return (struct ata_port *) &host->hostdata[0];
1164}
1165
947#endif /* __LINUX_LIBATA_H__ */ 1166#endif /* __LINUX_LIBATA_H__ */
diff --git a/include/linux/list.h b/include/linux/list.h
index 76f05718342c..37ca31b21bb7 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -197,12 +197,35 @@ static inline void list_del_rcu(struct list_head *entry)
197 entry->prev = LIST_POISON2; 197 entry->prev = LIST_POISON2;
198} 198}
199 199
200/**
201 * list_replace - replace old entry by new one
202 * @old : the element to be replaced
203 * @new : the new element to insert
204 * Note: if 'old' was empty, it will be overwritten.
205 */
206static inline void list_replace(struct list_head *old,
207 struct list_head *new)
208{
209 new->next = old->next;
210 new->next->prev = new;
211 new->prev = old->prev;
212 new->prev->next = new;
213}
214
215static inline void list_replace_init(struct list_head *old,
216 struct list_head *new)
217{
218 list_replace(old, new);
219 INIT_LIST_HEAD(old);
220}
221
200/* 222/*
201 * list_replace_rcu - replace old entry by new one 223 * list_replace_rcu - replace old entry by new one
202 * @old : the element to be replaced 224 * @old : the element to be replaced
203 * @new : the new element to insert 225 * @new : the new element to insert
204 * 226 *
205 * The old entry will be replaced with the new entry atomically. 227 * The old entry will be replaced with the new entry atomically.
228 * Note: 'old' should not be empty.
206 */ 229 */
207static inline void list_replace_rcu(struct list_head *old, 230static inline void list_replace_rcu(struct list_head *old,
208 struct list_head *new) 231 struct list_head *new)
@@ -258,16 +281,17 @@ static inline int list_empty(const struct list_head *head)
258} 281}
259 282
260/** 283/**
261 * list_empty_careful - tests whether a list is 284 * list_empty_careful - tests whether a list is empty and not being modified
262 * empty _and_ checks that no other CPU might be 285 * @head: the list to test
263 * in the process of still modifying either member 286 *
287 * Description:
288 * tests whether a list is empty _and_ checks that no other CPU might be
289 * in the process of modifying either member (next or prev)
264 * 290 *
265 * NOTE: using list_empty_careful() without synchronization 291 * NOTE: using list_empty_careful() without synchronization
266 * can only be safe if the only activity that can happen 292 * can only be safe if the only activity that can happen
267 * to the list entry is list_del_init(). Eg. it cannot be used 293 * to the list entry is list_del_init(). Eg. it cannot be used
268 * if another CPU could re-list_add() it. 294 * if another CPU could re-list_add() it.
269 *
270 * @head: the list to test.
271 */ 295 */
272static inline int list_empty_careful(const struct list_head *head) 296static inline int list_empty_careful(const struct list_head *head)
273{ 297{
@@ -327,7 +351,7 @@ static inline void list_splice_init(struct list_head *list,
327 351
328/** 352/**
329 * list_for_each - iterate over a list 353 * list_for_each - iterate over a list
330 * @pos: the &struct list_head to use as a loop counter. 354 * @pos: the &struct list_head to use as a loop cursor.
331 * @head: the head for your list. 355 * @head: the head for your list.
332 */ 356 */
333#define list_for_each(pos, head) \ 357#define list_for_each(pos, head) \
@@ -336,7 +360,7 @@ static inline void list_splice_init(struct list_head *list,
336 360
337/** 361/**
338 * __list_for_each - iterate over a list 362 * __list_for_each - iterate over a list
339 * @pos: the &struct list_head to use as a loop counter. 363 * @pos: the &struct list_head to use as a loop cursor.
340 * @head: the head for your list. 364 * @head: the head for your list.
341 * 365 *
342 * This variant differs from list_for_each() in that it's the 366 * This variant differs from list_for_each() in that it's the
@@ -349,7 +373,7 @@ static inline void list_splice_init(struct list_head *list,
349 373
350/** 374/**
351 * list_for_each_prev - iterate over a list backwards 375 * list_for_each_prev - iterate over a list backwards
352 * @pos: the &struct list_head to use as a loop counter. 376 * @pos: the &struct list_head to use as a loop cursor.
353 * @head: the head for your list. 377 * @head: the head for your list.
354 */ 378 */
355#define list_for_each_prev(pos, head) \ 379#define list_for_each_prev(pos, head) \
@@ -357,8 +381,8 @@ static inline void list_splice_init(struct list_head *list,
357 pos = pos->prev) 381 pos = pos->prev)
358 382
359/** 383/**
360 * list_for_each_safe - iterate over a list safe against removal of list entry 384 * list_for_each_safe - iterate over a list safe against removal of list entry
361 * @pos: the &struct list_head to use as a loop counter. 385 * @pos: the &struct list_head to use as a loop cursor.
362 * @n: another &struct list_head to use as temporary storage 386 * @n: another &struct list_head to use as temporary storage
363 * @head: the head for your list. 387 * @head: the head for your list.
364 */ 388 */
@@ -368,7 +392,7 @@ static inline void list_splice_init(struct list_head *list,
368 392
369/** 393/**
370 * list_for_each_entry - iterate over list of given type 394 * list_for_each_entry - iterate over list of given type
371 * @pos: the type * to use as a loop counter. 395 * @pos: the type * to use as a loop cursor.
372 * @head: the head for your list. 396 * @head: the head for your list.
373 * @member: the name of the list_struct within the struct. 397 * @member: the name of the list_struct within the struct.
374 */ 398 */
@@ -379,7 +403,7 @@ static inline void list_splice_init(struct list_head *list,
379 403
380/** 404/**
381 * list_for_each_entry_reverse - iterate backwards over list of given type. 405 * list_for_each_entry_reverse - iterate backwards over list of given type.
382 * @pos: the type * to use as a loop counter. 406 * @pos: the type * to use as a loop cursor.
383 * @head: the head for your list. 407 * @head: the head for your list.
384 * @member: the name of the list_struct within the struct. 408 * @member: the name of the list_struct within the struct.
385 */ 409 */
@@ -389,21 +413,24 @@ static inline void list_splice_init(struct list_head *list,
389 pos = list_entry(pos->member.prev, typeof(*pos), member)) 413 pos = list_entry(pos->member.prev, typeof(*pos), member))
390 414
391/** 415/**
392 * list_prepare_entry - prepare a pos entry for use as a start point in 416 * list_prepare_entry - prepare a pos entry for use in list_for_each_entry_continue
393 * list_for_each_entry_continue
394 * @pos: the type * to use as a start point 417 * @pos: the type * to use as a start point
395 * @head: the head of the list 418 * @head: the head of the list
396 * @member: the name of the list_struct within the struct. 419 * @member: the name of the list_struct within the struct.
420 *
421 * Prepares a pos entry for use as a start point in list_for_each_entry_continue.
397 */ 422 */
398#define list_prepare_entry(pos, head, member) \ 423#define list_prepare_entry(pos, head, member) \
399 ((pos) ? : list_entry(head, typeof(*pos), member)) 424 ((pos) ? : list_entry(head, typeof(*pos), member))
400 425
401/** 426/**
402 * list_for_each_entry_continue - iterate over list of given type 427 * list_for_each_entry_continue - continue iteration over list of given type
403 * continuing after existing point 428 * @pos: the type * to use as a loop cursor.
404 * @pos: the type * to use as a loop counter.
405 * @head: the head for your list. 429 * @head: the head for your list.
406 * @member: the name of the list_struct within the struct. 430 * @member: the name of the list_struct within the struct.
431 *
432 * Continue to iterate over list of given type, continuing after
433 * the current position.
407 */ 434 */
408#define list_for_each_entry_continue(pos, head, member) \ 435#define list_for_each_entry_continue(pos, head, member) \
409 for (pos = list_entry(pos->member.next, typeof(*pos), member); \ 436 for (pos = list_entry(pos->member.next, typeof(*pos), member); \
@@ -411,11 +438,12 @@ static inline void list_splice_init(struct list_head *list,
411 pos = list_entry(pos->member.next, typeof(*pos), member)) 438 pos = list_entry(pos->member.next, typeof(*pos), member))
412 439
413/** 440/**
414 * list_for_each_entry_from - iterate over list of given type 441 * list_for_each_entry_from - iterate over list of given type from the current point
415 * continuing from existing point 442 * @pos: the type * to use as a loop cursor.
416 * @pos: the type * to use as a loop counter.
417 * @head: the head for your list. 443 * @head: the head for your list.
418 * @member: the name of the list_struct within the struct. 444 * @member: the name of the list_struct within the struct.
445 *
446 * Iterate over list of given type, continuing from current position.
419 */ 447 */
420#define list_for_each_entry_from(pos, head, member) \ 448#define list_for_each_entry_from(pos, head, member) \
421 for (; prefetch(pos->member.next), &pos->member != (head); \ 449 for (; prefetch(pos->member.next), &pos->member != (head); \
@@ -423,7 +451,7 @@ static inline void list_splice_init(struct list_head *list,
423 451
424/** 452/**
425 * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry 453 * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
426 * @pos: the type * to use as a loop counter. 454 * @pos: the type * to use as a loop cursor.
427 * @n: another type * to use as temporary storage 455 * @n: another type * to use as temporary storage
428 * @head: the head for your list. 456 * @head: the head for your list.
429 * @member: the name of the list_struct within the struct. 457 * @member: the name of the list_struct within the struct.
@@ -435,12 +463,14 @@ static inline void list_splice_init(struct list_head *list,
435 pos = n, n = list_entry(n->member.next, typeof(*n), member)) 463 pos = n, n = list_entry(n->member.next, typeof(*n), member))
436 464
437/** 465/**
438 * list_for_each_entry_safe_continue - iterate over list of given type 466 * list_for_each_entry_safe_continue
439 * continuing after existing point safe against removal of list entry 467 * @pos: the type * to use as a loop cursor.
440 * @pos: the type * to use as a loop counter.
441 * @n: another type * to use as temporary storage 468 * @n: another type * to use as temporary storage
442 * @head: the head for your list. 469 * @head: the head for your list.
443 * @member: the name of the list_struct within the struct. 470 * @member: the name of the list_struct within the struct.
471 *
472 * Iterate over list of given type, continuing after current point,
473 * safe against removal of list entry.
444 */ 474 */
445#define list_for_each_entry_safe_continue(pos, n, head, member) \ 475#define list_for_each_entry_safe_continue(pos, n, head, member) \
446 for (pos = list_entry(pos->member.next, typeof(*pos), member), \ 476 for (pos = list_entry(pos->member.next, typeof(*pos), member), \
@@ -449,12 +479,14 @@ static inline void list_splice_init(struct list_head *list,
449 pos = n, n = list_entry(n->member.next, typeof(*n), member)) 479 pos = n, n = list_entry(n->member.next, typeof(*n), member))
450 480
451/** 481/**
452 * list_for_each_entry_safe_from - iterate over list of given type 482 * list_for_each_entry_safe_from
453 * from existing point safe against removal of list entry 483 * @pos: the type * to use as a loop cursor.
454 * @pos: the type * to use as a loop counter.
455 * @n: another type * to use as temporary storage 484 * @n: another type * to use as temporary storage
456 * @head: the head for your list. 485 * @head: the head for your list.
457 * @member: the name of the list_struct within the struct. 486 * @member: the name of the list_struct within the struct.
487 *
488 * Iterate over list of given type from current point, safe against
489 * removal of list entry.
458 */ 490 */
459#define list_for_each_entry_safe_from(pos, n, head, member) \ 491#define list_for_each_entry_safe_from(pos, n, head, member) \
460 for (n = list_entry(pos->member.next, typeof(*pos), member); \ 492 for (n = list_entry(pos->member.next, typeof(*pos), member); \
@@ -462,12 +494,14 @@ static inline void list_splice_init(struct list_head *list,
462 pos = n, n = list_entry(n->member.next, typeof(*n), member)) 494 pos = n, n = list_entry(n->member.next, typeof(*n), member))
463 495
464/** 496/**
465 * list_for_each_entry_safe_reverse - iterate backwards over list of given type safe against 497 * list_for_each_entry_safe_reverse
466 * removal of list entry 498 * @pos: the type * to use as a loop cursor.
467 * @pos: the type * to use as a loop counter.
468 * @n: another type * to use as temporary storage 499 * @n: another type * to use as temporary storage
469 * @head: the head for your list. 500 * @head: the head for your list.
470 * @member: the name of the list_struct within the struct. 501 * @member: the name of the list_struct within the struct.
502 *
503 * Iterate backwards over list of given type, safe against removal
504 * of list entry.
471 */ 505 */
472#define list_for_each_entry_safe_reverse(pos, n, head, member) \ 506#define list_for_each_entry_safe_reverse(pos, n, head, member) \
473 for (pos = list_entry((head)->prev, typeof(*pos), member), \ 507 for (pos = list_entry((head)->prev, typeof(*pos), member), \
@@ -477,7 +511,7 @@ static inline void list_splice_init(struct list_head *list,
477 511
478/** 512/**
479 * list_for_each_rcu - iterate over an rcu-protected list 513 * list_for_each_rcu - iterate over an rcu-protected list
480 * @pos: the &struct list_head to use as a loop counter. 514 * @pos: the &struct list_head to use as a loop cursor.
481 * @head: the head for your list. 515 * @head: the head for your list.
482 * 516 *
483 * This list-traversal primitive may safely run concurrently with 517 * This list-traversal primitive may safely run concurrently with
@@ -495,12 +529,13 @@ static inline void list_splice_init(struct list_head *list,
495 pos = pos->next) 529 pos = pos->next)
496 530
497/** 531/**
498 * list_for_each_safe_rcu - iterate over an rcu-protected list safe 532 * list_for_each_safe_rcu
499 * against removal of list entry 533 * @pos: the &struct list_head to use as a loop cursor.
500 * @pos: the &struct list_head to use as a loop counter.
501 * @n: another &struct list_head to use as temporary storage 534 * @n: another &struct list_head to use as temporary storage
502 * @head: the head for your list. 535 * @head: the head for your list.
503 * 536 *
537 * Iterate over an rcu-protected list, safe against removal of list entry.
538 *
504 * This list-traversal primitive may safely run concurrently with 539 * This list-traversal primitive may safely run concurrently with
505 * the _rcu list-mutation primitives such as list_add_rcu() 540 * the _rcu list-mutation primitives such as list_add_rcu()
506 * as long as the traversal is guarded by rcu_read_lock(). 541 * as long as the traversal is guarded by rcu_read_lock().
@@ -512,7 +547,7 @@ static inline void list_splice_init(struct list_head *list,
512 547
513/** 548/**
514 * list_for_each_entry_rcu - iterate over rcu list of given type 549 * list_for_each_entry_rcu - iterate over rcu list of given type
515 * @pos: the type * to use as a loop counter. 550 * @pos: the type * to use as a loop cursor.
516 * @head: the head for your list. 551 * @head: the head for your list.
517 * @member: the name of the list_struct within the struct. 552 * @member: the name of the list_struct within the struct.
518 * 553 *
@@ -528,11 +563,12 @@ static inline void list_splice_init(struct list_head *list,
528 563
529 564
530/** 565/**
531 * list_for_each_continue_rcu - iterate over an rcu-protected list 566 * list_for_each_continue_rcu
532 * continuing after existing point. 567 * @pos: the &struct list_head to use as a loop cursor.
533 * @pos: the &struct list_head to use as a loop counter.
534 * @head: the head for your list. 568 * @head: the head for your list.
535 * 569 *
570 * Iterate over an rcu-protected list, continuing after current point.
571 *
536 * This list-traversal primitive may safely run concurrently with 572 * This list-traversal primitive may safely run concurrently with
537 * the _rcu list-mutation primitives such as list_add_rcu() 573 * the _rcu list-mutation primitives such as list_add_rcu()
538 * as long as the traversal is guarded by rcu_read_lock(). 574 * as long as the traversal is guarded by rcu_read_lock().
@@ -658,11 +694,14 @@ static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h)
658 694
659 695
660/** 696/**
661 * hlist_add_head_rcu - adds the specified element to the specified hlist, 697 * hlist_add_head_rcu
662 * while permitting racing traversals.
663 * @n: the element to add to the hash list. 698 * @n: the element to add to the hash list.
664 * @h: the list to add to. 699 * @h: the list to add to.
665 * 700 *
701 * Description:
702 * Adds the specified element to the specified hlist,
703 * while permitting racing traversals.
704 *
666 * The caller must take whatever precautions are necessary 705 * The caller must take whatever precautions are necessary
667 * (such as holding appropriate locks) to avoid racing 706 * (such as holding appropriate locks) to avoid racing
668 * with another list-mutation primitive, such as hlist_add_head_rcu() 707 * with another list-mutation primitive, such as hlist_add_head_rcu()
@@ -707,11 +746,14 @@ static inline void hlist_add_after(struct hlist_node *n,
707} 746}
708 747
709/** 748/**
710 * hlist_add_before_rcu - adds the specified element to the specified hlist 749 * hlist_add_before_rcu
711 * before the specified node while permitting racing traversals.
712 * @n: the new element to add to the hash list. 750 * @n: the new element to add to the hash list.
713 * @next: the existing element to add the new element before. 751 * @next: the existing element to add the new element before.
714 * 752 *
753 * Description:
754 * Adds the specified element to the specified hlist
755 * before the specified node while permitting racing traversals.
756 *
715 * The caller must take whatever precautions are necessary 757 * The caller must take whatever precautions are necessary
716 * (such as holding appropriate locks) to avoid racing 758 * (such as holding appropriate locks) to avoid racing
717 * with another list-mutation primitive, such as hlist_add_head_rcu() 759 * with another list-mutation primitive, such as hlist_add_head_rcu()
@@ -732,11 +774,14 @@ static inline void hlist_add_before_rcu(struct hlist_node *n,
732} 774}
733 775
734/** 776/**
735 * hlist_add_after_rcu - adds the specified element to the specified hlist 777 * hlist_add_after_rcu
736 * after the specified node while permitting racing traversals.
737 * @prev: the existing element to add the new element after. 778 * @prev: the existing element to add the new element after.
738 * @n: the new element to add to the hash list. 779 * @n: the new element to add to the hash list.
739 * 780 *
781 * Description:
782 * Adds the specified element to the specified hlist
783 * after the specified node while permitting racing traversals.
784 *
740 * The caller must take whatever precautions are necessary 785 * The caller must take whatever precautions are necessary
741 * (such as holding appropriate locks) to avoid racing 786 * (such as holding appropriate locks) to avoid racing
742 * with another list-mutation primitive, such as hlist_add_head_rcu() 787 * with another list-mutation primitive, such as hlist_add_head_rcu()
@@ -769,8 +814,8 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
769 814
770/** 815/**
771 * hlist_for_each_entry - iterate over list of given type 816 * hlist_for_each_entry - iterate over list of given type
772 * @tpos: the type * to use as a loop counter. 817 * @tpos: the type * to use as a loop cursor.
773 * @pos: the &struct hlist_node to use as a loop counter. 818 * @pos: the &struct hlist_node to use as a loop cursor.
774 * @head: the head for your list. 819 * @head: the head for your list.
775 * @member: the name of the hlist_node within the struct. 820 * @member: the name of the hlist_node within the struct.
776 */ 821 */
@@ -781,9 +826,9 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
781 pos = pos->next) 826 pos = pos->next)
782 827
783/** 828/**
784 * hlist_for_each_entry_continue - iterate over a hlist continuing after existing point 829 * hlist_for_each_entry_continue - iterate over a hlist continuing after current point
785 * @tpos: the type * to use as a loop counter. 830 * @tpos: the type * to use as a loop cursor.
786 * @pos: the &struct hlist_node to use as a loop counter. 831 * @pos: the &struct hlist_node to use as a loop cursor.
787 * @member: the name of the hlist_node within the struct. 832 * @member: the name of the hlist_node within the struct.
788 */ 833 */
789#define hlist_for_each_entry_continue(tpos, pos, member) \ 834#define hlist_for_each_entry_continue(tpos, pos, member) \
@@ -793,9 +838,9 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
793 pos = pos->next) 838 pos = pos->next)
794 839
795/** 840/**
796 * hlist_for_each_entry_from - iterate over a hlist continuing from existing point 841 * hlist_for_each_entry_from - iterate over a hlist continuing from current point
797 * @tpos: the type * to use as a loop counter. 842 * @tpos: the type * to use as a loop cursor.
798 * @pos: the &struct hlist_node to use as a loop counter. 843 * @pos: the &struct hlist_node to use as a loop cursor.
799 * @member: the name of the hlist_node within the struct. 844 * @member: the name of the hlist_node within the struct.
800 */ 845 */
801#define hlist_for_each_entry_from(tpos, pos, member) \ 846#define hlist_for_each_entry_from(tpos, pos, member) \
@@ -805,8 +850,8 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
805 850
806/** 851/**
807 * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry 852 * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry
808 * @tpos: the type * to use as a loop counter. 853 * @tpos: the type * to use as a loop cursor.
809 * @pos: the &struct hlist_node to use as a loop counter. 854 * @pos: the &struct hlist_node to use as a loop cursor.
810 * @n: another &struct hlist_node to use as temporary storage 855 * @n: another &struct hlist_node to use as temporary storage
811 * @head: the head for your list. 856 * @head: the head for your list.
812 * @member: the name of the hlist_node within the struct. 857 * @member: the name of the hlist_node within the struct.
@@ -819,8 +864,8 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
819 864
820/** 865/**
821 * hlist_for_each_entry_rcu - iterate over rcu list of given type 866 * hlist_for_each_entry_rcu - iterate over rcu list of given type
822 * @tpos: the type * to use as a loop counter. 867 * @tpos: the type * to use as a loop cursor.
823 * @pos: the &struct hlist_node to use as a loop counter. 868 * @pos: the &struct hlist_node to use as a loop cursor.
824 * @head: the head for your list. 869 * @head: the head for your list.
825 * @member: the name of the hlist_node within the struct. 870 * @member: the name of the hlist_node within the struct.
826 * 871 *
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index a8876bc6513b..aa4fe905bb4d 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -49,11 +49,12 @@ struct nlm_host {
49 h_killed : 1, 49 h_killed : 1,
50 h_monitored : 1; 50 h_monitored : 1;
51 wait_queue_head_t h_gracewait; /* wait while reclaiming */ 51 wait_queue_head_t h_gracewait; /* wait while reclaiming */
52 struct rw_semaphore h_rwsem; /* Reboot recovery lock */
52 u32 h_state; /* pseudo-state counter */ 53 u32 h_state; /* pseudo-state counter */
53 u32 h_nsmstate; /* true remote NSM state */ 54 u32 h_nsmstate; /* true remote NSM state */
54 u32 h_pidcount; /* Pseudopids */ 55 u32 h_pidcount; /* Pseudopids */
55 atomic_t h_count; /* reference count */ 56 atomic_t h_count; /* reference count */
56 struct semaphore h_sema; /* mutex for pmap binding */ 57 struct mutex h_mutex; /* mutex for pmap binding */
57 unsigned long h_nextrebind; /* next portmap call */ 58 unsigned long h_nextrebind; /* next portmap call */
58 unsigned long h_expires; /* eligible for GC */ 59 unsigned long h_expires; /* eligible for GC */
59 struct list_head h_lockowners; /* Lockowners for the client */ 60 struct list_head h_lockowners; /* Lockowners for the client */
@@ -219,6 +220,7 @@ static __inline__ int
219nlm_compare_locks(const struct file_lock *fl1, const struct file_lock *fl2) 220nlm_compare_locks(const struct file_lock *fl1, const struct file_lock *fl2)
220{ 221{
221 return fl1->fl_pid == fl2->fl_pid 222 return fl1->fl_pid == fl2->fl_pid
223 && fl1->fl_owner == fl2->fl_owner
222 && fl1->fl_start == fl2->fl_start 224 && fl1->fl_start == fl2->fl_start
223 && fl1->fl_end == fl2->fl_end 225 && fl1->fl_end == fl2->fl_end
224 &&(fl1->fl_type == fl2->fl_type || fl2->fl_type == F_UNLCK); 226 &&(fl1->fl_type == fl2->fl_type || fl2->fl_type == F_UNLCK);
diff --git a/include/linux/loop.h b/include/linux/loop.h
index e76c7611d6cc..bf3d2345ce99 100644
--- a/include/linux/loop.h
+++ b/include/linux/loop.h
@@ -59,7 +59,7 @@ struct loop_device {
59 struct bio *lo_bio; 59 struct bio *lo_bio;
60 struct bio *lo_biotail; 60 struct bio *lo_biotail;
61 int lo_state; 61 int lo_state;
62 struct completion lo_done; 62 struct task_struct *lo_thread;
63 struct completion lo_bh_done; 63 struct completion lo_bh_done;
64 struct mutex lo_ctl_mutex; 64 struct mutex lo_ctl_mutex;
65 int lo_pending; 65 int lo_pending;
diff --git a/include/linux/m41t00.h b/include/linux/m41t00.h
new file mode 100644
index 000000000000..b423360ca38e
--- /dev/null
+++ b/include/linux/m41t00.h
@@ -0,0 +1,50 @@
1/*
2 * Definitions for the ST M41T00 family of i2c rtc chips.
3 *
4 * Author: Mark A. Greer <mgreer@mvista.com>
5 *
6 * 2005, 2006 (c) MontaVista Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10 */
11
12#ifndef _M41T00_H
13#define _M41T00_H
14
15#define M41T00_DRV_NAME "m41t00"
16#define M41T00_I2C_ADDR 0x68
17
18#define M41T00_TYPE_M41T00 0
19#define M41T00_TYPE_M41T81 81
20#define M41T00_TYPE_M41T85 85
21
22struct m41t00_platform_data {
23 u8 type;
24 u8 i2c_addr;
25 u8 sqw_freq;
26};
27
28/* SQW output disabled, this is default value by power on */
29#define M41T00_SQW_DISABLE (0)
30
31#define M41T00_SQW_32KHZ (1<<4) /* 32.768 KHz */
32#define M41T00_SQW_8KHZ (2<<4) /* 8.192 KHz */
33#define M41T00_SQW_4KHZ (3<<4) /* 4.096 KHz */
34#define M41T00_SQW_2KHZ (4<<4) /* 2.048 KHz */
35#define M41T00_SQW_1KHZ (5<<4) /* 1.024 KHz */
36#define M41T00_SQW_512HZ (6<<4) /* 512 Hz */
37#define M41T00_SQW_256HZ (7<<4) /* 256 Hz */
38#define M41T00_SQW_128HZ (8<<4) /* 128 Hz */
39#define M41T00_SQW_64HZ (9<<4) /* 64 Hz */
40#define M41T00_SQW_32HZ (10<<4) /* 32 Hz */
41#define M41T00_SQW_16HZ (11<<4) /* 16 Hz */
42#define M41T00_SQW_8HZ (12<<4) /* 8 Hz */
43#define M41T00_SQW_4HZ (13<<4) /* 4 Hz */
44#define M41T00_SQW_2HZ (14<<4) /* 2 Hz */
45#define M41T00_SQW_1HZ (15<<4) /* 1 Hz */
46
47extern ulong m41t00_get_rtc_time(void);
48extern int m41t00_set_rtc_time(ulong nowtime);
49
50#endif /* _M41T00_H */
diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index 6789c4940c9c..48148e0cdbd1 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -3,33 +3,42 @@
3 3
4#include <linux/mm.h> 4#include <linux/mm.h>
5 5
6typedef struct page *new_page_t(struct page *, unsigned long private, int **);
7
6#ifdef CONFIG_MIGRATION 8#ifdef CONFIG_MIGRATION
7extern int isolate_lru_page(struct page *p, struct list_head *pagelist); 9extern int isolate_lru_page(struct page *p, struct list_head *pagelist);
8extern int putback_lru_pages(struct list_head *l); 10extern int putback_lru_pages(struct list_head *l);
9extern int migrate_page(struct page *, struct page *); 11extern int migrate_page(struct address_space *,
10extern void migrate_page_copy(struct page *, struct page *); 12 struct page *, struct page *);
11extern int migrate_page_remove_references(struct page *, struct page *, int); 13extern int migrate_pages(struct list_head *l, new_page_t x, unsigned long);
12extern int migrate_pages(struct list_head *l, struct list_head *t,
13 struct list_head *moved, struct list_head *failed);
14extern int migrate_pages_to(struct list_head *pagelist,
15 struct vm_area_struct *vma, int dest);
16extern int fail_migrate_page(struct page *, struct page *);
17 14
18extern int migrate_prep(void); 15extern int fail_migrate_page(struct address_space *,
16 struct page *, struct page *);
19 17
18extern int migrate_prep(void);
19extern int migrate_vmas(struct mm_struct *mm,
20 const nodemask_t *from, const nodemask_t *to,
21 unsigned long flags);
20#else 22#else
21 23
22static inline int isolate_lru_page(struct page *p, struct list_head *list) 24static inline int isolate_lru_page(struct page *p, struct list_head *list)
23 { return -ENOSYS; } 25 { return -ENOSYS; }
24static inline int putback_lru_pages(struct list_head *l) { return 0; } 26static inline int putback_lru_pages(struct list_head *l) { return 0; }
25static inline int migrate_pages(struct list_head *l, struct list_head *t, 27static inline int migrate_pages(struct list_head *l, new_page_t x,
26 struct list_head *moved, struct list_head *failed) { return -ENOSYS; } 28 unsigned long private) { return -ENOSYS; }
27 29
28static inline int migrate_pages_to(struct list_head *pagelist, 30static inline int migrate_pages_to(struct list_head *pagelist,
29 struct vm_area_struct *vma, int dest) { return 0; } 31 struct vm_area_struct *vma, int dest) { return 0; }
30 32
31static inline int migrate_prep(void) { return -ENOSYS; } 33static inline int migrate_prep(void) { return -ENOSYS; }
32 34
35static inline int migrate_vmas(struct mm_struct *mm,
36 const nodemask_t *from, const nodemask_t *to,
37 unsigned long flags)
38{
39 return -ENOSYS;
40}
41
33/* Possible settings for the migrate_page() method in address_operations */ 42/* Possible settings for the migrate_page() method in address_operations */
34#define migrate_page NULL 43#define migrate_page NULL
35#define fail_migrate_page NULL 44#define fail_migrate_page NULL
diff --git a/include/linux/mm.h b/include/linux/mm.h
index e2fa375e478e..a929ea197e48 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -145,7 +145,6 @@ extern unsigned int kobjsize(const void *objp);
145 145
146#define VM_GROWSDOWN 0x00000100 /* general info on the segment */ 146#define VM_GROWSDOWN 0x00000100 /* general info on the segment */
147#define VM_GROWSUP 0x00000200 147#define VM_GROWSUP 0x00000200
148#define VM_SHM 0x00000000 /* Means nothing: delete it later */
149#define VM_PFNMAP 0x00000400 /* Page-ranges managed without "struct page", just pure PFN */ 148#define VM_PFNMAP 0x00000400 /* Page-ranges managed without "struct page", just pure PFN */
150#define VM_DENYWRITE 0x00000800 /* ETXTBSY on write attempts.. */ 149#define VM_DENYWRITE 0x00000800 /* ETXTBSY on write attempts.. */
151 150
@@ -199,10 +198,16 @@ struct vm_operations_struct {
199 void (*close)(struct vm_area_struct * area); 198 void (*close)(struct vm_area_struct * area);
200 struct page * (*nopage)(struct vm_area_struct * area, unsigned long address, int *type); 199 struct page * (*nopage)(struct vm_area_struct * area, unsigned long address, int *type);
201 int (*populate)(struct vm_area_struct * area, unsigned long address, unsigned long len, pgprot_t prot, unsigned long pgoff, int nonblock); 200 int (*populate)(struct vm_area_struct * area, unsigned long address, unsigned long len, pgprot_t prot, unsigned long pgoff, int nonblock);
201
202 /* notification that a previously read-only page is about to become
203 * writable, if an error is returned it will cause a SIGBUS */
204 int (*page_mkwrite)(struct vm_area_struct *vma, struct page *page);
202#ifdef CONFIG_NUMA 205#ifdef CONFIG_NUMA
203 int (*set_policy)(struct vm_area_struct *vma, struct mempolicy *new); 206 int (*set_policy)(struct vm_area_struct *vma, struct mempolicy *new);
204 struct mempolicy *(*get_policy)(struct vm_area_struct *vma, 207 struct mempolicy *(*get_policy)(struct vm_area_struct *vma,
205 unsigned long addr); 208 unsigned long addr);
209 int (*migrate)(struct vm_area_struct *vma, const nodemask_t *from,
210 const nodemask_t *to, unsigned long flags);
206#endif 211#endif
207}; 212};
208 213
@@ -465,10 +470,13 @@ static inline unsigned long page_zonenum(struct page *page)
465struct zone; 470struct zone;
466extern struct zone *zone_table[]; 471extern struct zone *zone_table[];
467 472
473static inline int page_zone_id(struct page *page)
474{
475 return (page->flags >> ZONETABLE_PGSHIFT) & ZONETABLE_MASK;
476}
468static inline struct zone *page_zone(struct page *page) 477static inline struct zone *page_zone(struct page *page)
469{ 478{
470 return zone_table[(page->flags >> ZONETABLE_PGSHIFT) & 479 return zone_table[page_zone_id(page)];
471 ZONETABLE_MASK];
472} 480}
473 481
474static inline unsigned long page_to_nid(struct page *page) 482static inline unsigned long page_to_nid(struct page *page)
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 9742e3c16222..d6120fa69116 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -197,7 +197,7 @@ struct zone {
197 197
198 /* 198 /*
199 * wait_table -- the array holding the hash table 199 * wait_table -- the array holding the hash table
200 * wait_table_size -- the size of the hash table array 200 * wait_table_hash_nr_entries -- the size of the hash table array
201 * wait_table_bits -- wait_table_size == (1 << wait_table_bits) 201 * wait_table_bits -- wait_table_size == (1 << wait_table_bits)
202 * 202 *
203 * The purpose of all these is to keep track of the people 203 * The purpose of all these is to keep track of the people
@@ -220,7 +220,7 @@ struct zone {
220 * free_area_init_core() performs the initialization of them. 220 * free_area_init_core() performs the initialization of them.
221 */ 221 */
222 wait_queue_head_t * wait_table; 222 wait_queue_head_t * wait_table;
223 unsigned long wait_table_size; 223 unsigned long wait_table_hash_nr_entries;
224 unsigned long wait_table_bits; 224 unsigned long wait_table_bits;
225 225
226 /* 226 /*
@@ -333,6 +333,9 @@ void wakeup_kswapd(struct zone *zone, int order);
333int zone_watermark_ok(struct zone *z, int order, unsigned long mark, 333int zone_watermark_ok(struct zone *z, int order, unsigned long mark,
334 int classzone_idx, int alloc_flags); 334 int classzone_idx, int alloc_flags);
335 335
336extern int init_currently_empty_zone(struct zone *zone, unsigned long start_pfn,
337 unsigned long size);
338
336#ifdef CONFIG_HAVE_MEMORY_PRESENT 339#ifdef CONFIG_HAVE_MEMORY_PRESENT
337void memory_present(int nid, unsigned long start, unsigned long end); 340void memory_present(int nid, unsigned long start, unsigned long end);
338#else 341#else
@@ -506,6 +509,10 @@ struct mem_section {
506 * pages. However, it is stored with some other magic. 509 * pages. However, it is stored with some other magic.
507 * (see sparse.c::sparse_init_one_section()) 510 * (see sparse.c::sparse_init_one_section())
508 * 511 *
512 * Additionally during early boot we encode node id of
513 * the location of the section here to guide allocation.
514 * (see sparse.c::memory_present())
515 *
509 * Making it a UL at least makes someone do a cast 516 * Making it a UL at least makes someone do a cast
510 * before using it wrong. 517 * before using it wrong.
511 */ 518 */
@@ -545,6 +552,7 @@ extern int __section_nr(struct mem_section* ms);
545#define SECTION_HAS_MEM_MAP (1UL<<1) 552#define SECTION_HAS_MEM_MAP (1UL<<1)
546#define SECTION_MAP_LAST_BIT (1UL<<2) 553#define SECTION_MAP_LAST_BIT (1UL<<2)
547#define SECTION_MAP_MASK (~(SECTION_MAP_LAST_BIT-1)) 554#define SECTION_MAP_MASK (~(SECTION_MAP_LAST_BIT-1))
555#define SECTION_NID_SHIFT 2
548 556
549static inline struct page *__section_mem_map_addr(struct mem_section *section) 557static inline struct page *__section_mem_map_addr(struct mem_section *section)
550{ 558{
diff --git a/include/linux/module.h b/include/linux/module.h
index c2d89e037af0..2d366098eab5 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -105,6 +105,8 @@ extern struct module __this_module;
105 * "GPL and additional rights" [GNU Public License v2 rights and more] 105 * "GPL and additional rights" [GNU Public License v2 rights and more]
106 * "Dual BSD/GPL" [GNU Public License v2 106 * "Dual BSD/GPL" [GNU Public License v2
107 * or BSD license choice] 107 * or BSD license choice]
108 * "Dual MIT/GPL" [GNU Public License v2
109 * or MIT license choice]
108 * "Dual MPL/GPL" [GNU Public License v2 110 * "Dual MPL/GPL" [GNU Public License v2
109 * or Mozilla license choice] 111 * or Mozilla license choice]
110 * 112 *
diff --git a/include/linux/mount.h b/include/linux/mount.h
index b7472ae91fa4..403d1a97c512 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -17,12 +17,19 @@
17#include <linux/spinlock.h> 17#include <linux/spinlock.h>
18#include <asm/atomic.h> 18#include <asm/atomic.h>
19 19
20struct super_block;
21struct vfsmount;
22struct dentry;
23struct namespace;
24
20#define MNT_NOSUID 0x01 25#define MNT_NOSUID 0x01
21#define MNT_NODEV 0x02 26#define MNT_NODEV 0x02
22#define MNT_NOEXEC 0x04 27#define MNT_NOEXEC 0x04
23#define MNT_NOATIME 0x08 28#define MNT_NOATIME 0x08
24#define MNT_NODIRATIME 0x10 29#define MNT_NODIRATIME 0x10
25 30
31#define MNT_SHRINKABLE 0x100
32
26#define MNT_SHARED 0x1000 /* if the vfsmount is a shared mount */ 33#define MNT_SHARED 0x1000 /* if the vfsmount is a shared mount */
27#define MNT_UNBINDABLE 0x2000 /* if the vfsmount is a unbindable mount */ 34#define MNT_UNBINDABLE 0x2000 /* if the vfsmount is a unbindable mount */
28#define MNT_PNODE_MASK 0x3000 /* propogation flag mask */ 35#define MNT_PNODE_MASK 0x3000 /* propogation flag mask */
@@ -73,12 +80,18 @@ extern struct vfsmount *alloc_vfsmnt(const char *name);
73extern struct vfsmount *do_kern_mount(const char *fstype, int flags, 80extern struct vfsmount *do_kern_mount(const char *fstype, int flags,
74 const char *name, void *data); 81 const char *name, void *data);
75 82
83struct file_system_type;
84extern struct vfsmount *vfs_kern_mount(struct file_system_type *type,
85 int flags, const char *name,
86 void *data);
87
76struct nameidata; 88struct nameidata;
77 89
78extern int do_add_mount(struct vfsmount *newmnt, struct nameidata *nd, 90extern int do_add_mount(struct vfsmount *newmnt, struct nameidata *nd,
79 int mnt_flags, struct list_head *fslist); 91 int mnt_flags, struct list_head *fslist);
80 92
81extern void mark_mounts_for_expiry(struct list_head *mounts); 93extern void mark_mounts_for_expiry(struct list_head *mounts);
94extern void shrink_submounts(struct vfsmount *mountpoint, struct list_head *mounts);
82 95
83extern spinlock_t vfsmount_lock; 96extern spinlock_t vfsmount_lock;
84extern dev_t name_to_dev_t(char *name); 97extern dev_t name_to_dev_t(char *name);
diff --git a/include/linux/nbd.h b/include/linux/nbd.h
index 1d7cdd20b553..e712e7d47cc2 100644
--- a/include/linux/nbd.h
+++ b/include/linux/nbd.h
@@ -77,11 +77,11 @@ struct nbd_device {
77 * server. All data are in network byte order. 77 * server. All data are in network byte order.
78 */ 78 */
79struct nbd_request { 79struct nbd_request {
80 __u32 magic; 80 __be32 magic;
81 __u32 type; /* == READ || == WRITE */ 81 __be32 type; /* == READ || == WRITE */
82 char handle[8]; 82 char handle[8];
83 __u64 from; 83 __be64 from;
84 __u32 len; 84 __be32 len;
85} 85}
86#ifdef __GNUC__ 86#ifdef __GNUC__
87 __attribute__ ((packed)) 87 __attribute__ ((packed))
@@ -93,8 +93,8 @@ struct nbd_request {
93 * it has completed an I/O request (or an error occurs). 93 * it has completed an I/O request (or an error occurs).
94 */ 94 */
95struct nbd_reply { 95struct nbd_reply {
96 __u32 magic; 96 __be32 magic;
97 __u32 error; /* 0 = ok, else error */ 97 __be32 error; /* 0 = ok, else error */
98 char handle[8]; /* handle you got from request */ 98 char handle[8]; /* handle you got from request */
99}; 99};
100#endif 100#endif
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index cead6be467ed..bc747e5d7138 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -308,9 +308,13 @@ struct net_device
308#define NETIF_F_HW_VLAN_RX 256 /* Receive VLAN hw acceleration */ 308#define NETIF_F_HW_VLAN_RX 256 /* Receive VLAN hw acceleration */
309#define NETIF_F_HW_VLAN_FILTER 512 /* Receive filtering on VLAN */ 309#define NETIF_F_HW_VLAN_FILTER 512 /* Receive filtering on VLAN */
310#define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */ 310#define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */
311#define NETIF_F_TSO 2048 /* Can offload TCP/IP segmentation */ 311#define NETIF_F_GSO 2048 /* Enable software GSO. */
312#define NETIF_F_LLTX 4096 /* LockLess TX */ 312#define NETIF_F_LLTX 4096 /* LockLess TX */
313#define NETIF_F_UFO 8192 /* Can offload UDP Large Send*/ 313
314 /* Segmentation offload features */
315#define NETIF_F_GSO_SHIFT 16
316#define NETIF_F_TSO (SKB_GSO_TCPV4 << NETIF_F_GSO_SHIFT)
317#define NETIF_F_UFO (SKB_GSO_UDPV4 << NETIF_F_GSO_SHIFT)
314 318
315#define NETIF_F_GEN_CSUM (NETIF_F_NO_CSUM | NETIF_F_HW_CSUM) 319#define NETIF_F_GEN_CSUM (NETIF_F_NO_CSUM | NETIF_F_HW_CSUM)
316#define NETIF_F_ALL_CSUM (NETIF_F_IP_CSUM | NETIF_F_GEN_CSUM) 320#define NETIF_F_ALL_CSUM (NETIF_F_IP_CSUM | NETIF_F_GEN_CSUM)
@@ -402,6 +406,9 @@ struct net_device
402 struct list_head qdisc_list; 406 struct list_head qdisc_list;
403 unsigned long tx_queue_len; /* Max frames per queue allowed */ 407 unsigned long tx_queue_len; /* Max frames per queue allowed */
404 408
409 /* Partially transmitted GSO packet. */
410 struct sk_buff *gso_skb;
411
405 /* ingress path synchronizer */ 412 /* ingress path synchronizer */
406 spinlock_t ingress_lock; 413 spinlock_t ingress_lock;
407 struct Qdisc *qdisc_ingress; 414 struct Qdisc *qdisc_ingress;
@@ -536,6 +543,7 @@ struct packet_type {
536 struct net_device *, 543 struct net_device *,
537 struct packet_type *, 544 struct packet_type *,
538 struct net_device *); 545 struct net_device *);
546 struct sk_buff *(*gso_segment)(struct sk_buff *skb, int sg);
539 void *af_packet_priv; 547 void *af_packet_priv;
540 struct list_head list; 548 struct list_head list;
541}; 549};
@@ -686,7 +694,8 @@ extern int dev_change_name(struct net_device *, char *);
686extern int dev_set_mtu(struct net_device *, int); 694extern int dev_set_mtu(struct net_device *, int);
687extern int dev_set_mac_address(struct net_device *, 695extern int dev_set_mac_address(struct net_device *,
688 struct sockaddr *); 696 struct sockaddr *);
689extern void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev); 697extern int dev_hard_start_xmit(struct sk_buff *skb,
698 struct net_device *dev);
690 699
691extern void dev_init(void); 700extern void dev_init(void);
692 701
@@ -960,6 +969,7 @@ extern int netdev_max_backlog;
960extern int weight_p; 969extern int weight_p;
961extern int netdev_set_master(struct net_device *dev, struct net_device *master); 970extern int netdev_set_master(struct net_device *dev, struct net_device *master);
962extern int skb_checksum_help(struct sk_buff *skb, int inward); 971extern int skb_checksum_help(struct sk_buff *skb, int inward);
972extern struct sk_buff *skb_gso_segment(struct sk_buff *skb, int sg);
963#ifdef CONFIG_BUG 973#ifdef CONFIG_BUG
964extern void netdev_rx_csum_fault(struct net_device *dev); 974extern void netdev_rx_csum_fault(struct net_device *dev);
965#else 975#else
@@ -979,6 +989,13 @@ extern void dev_seq_stop(struct seq_file *seq, void *v);
979 989
980extern void linkwatch_run_queue(void); 990extern void linkwatch_run_queue(void);
981 991
992static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb)
993{
994 int feature = skb_shinfo(skb)->gso_type << NETIF_F_GSO_SHIFT;
995 return skb_shinfo(skb)->gso_size &&
996 (dev->features & feature) != feature;
997}
998
982#endif /* __KERNEL__ */ 999#endif /* __KERNEL__ */
983 1000
984#endif /* _LINUX_DEV_H */ 1001#endif /* _LINUX_DEV_H */
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 87b8a5703ebc..855b44668caa 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -5,7 +5,7 @@
5#include <linux/types.h> 5#include <linux/types.h>
6 6
7#define NETLINK_ROUTE 0 /* Routing/device hook */ 7#define NETLINK_ROUTE 0 /* Routing/device hook */
8#define NETLINK_W1 1 /* 1-wire subsystem */ 8#define NETLINK_UNUSED 1 /* Unused number */
9#define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */ 9#define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */
10#define NETLINK_FIREWALL 3 /* Firewalling hook */ 10#define NETLINK_FIREWALL 3 /* Firewalling hook */
11#define NETLINK_INET_DIAG 4 /* INET socket monitoring */ 11#define NETLINK_INET_DIAG 4 /* INET socket monitoring */
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index 1059e6d69d3b..5f681d534295 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -384,6 +384,7 @@ enum {
384 NFSPROC4_CLNT_DELEGRETURN, 384 NFSPROC4_CLNT_DELEGRETURN,
385 NFSPROC4_CLNT_GETACL, 385 NFSPROC4_CLNT_GETACL,
386 NFSPROC4_CLNT_SETACL, 386 NFSPROC4_CLNT_SETACL,
387 NFSPROC4_CLNT_FS_LOCATIONS,
387}; 388};
388 389
389#endif 390#endif
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 7e079f8ce18b..0a1740b2532e 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -9,6 +9,27 @@
9#ifndef _LINUX_NFS_FS_H 9#ifndef _LINUX_NFS_FS_H
10#define _LINUX_NFS_FS_H 10#define _LINUX_NFS_FS_H
11 11
12#include <linux/config.h>
13#include <linux/in.h>
14#include <linux/mm.h>
15#include <linux/pagemap.h>
16#include <linux/rwsem.h>
17#include <linux/wait.h>
18
19#include <linux/sunrpc/debug.h>
20#include <linux/sunrpc/auth.h>
21#include <linux/sunrpc/clnt.h>
22
23#include <linux/nfs.h>
24#include <linux/nfs2.h>
25#include <linux/nfs3.h>
26#include <linux/nfs4.h>
27#include <linux/nfs_xdr.h>
28
29#include <linux/nfs_fs_sb.h>
30
31#include <linux/rwsem.h>
32#include <linux/mempool.h>
12 33
13/* 34/*
14 * Enable debugging support for nfs client. 35 * Enable debugging support for nfs client.
@@ -41,27 +62,9 @@
41#define FLUSH_LOWPRI 8 /* low priority background flush */ 62#define FLUSH_LOWPRI 8 /* low priority background flush */
42#define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */ 63#define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */
43#define FLUSH_NOCOMMIT 32 /* Don't send the NFSv3/v4 COMMIT */ 64#define FLUSH_NOCOMMIT 32 /* Don't send the NFSv3/v4 COMMIT */
65#define FLUSH_INVALIDATE 64 /* Invalidate the page cache */
44 66
45#ifdef __KERNEL__ 67#ifdef __KERNEL__
46#include <linux/in.h>
47#include <linux/mm.h>
48#include <linux/pagemap.h>
49#include <linux/rwsem.h>
50#include <linux/wait.h>
51
52#include <linux/nfs_fs_sb.h>
53
54#include <linux/sunrpc/debug.h>
55#include <linux/sunrpc/auth.h>
56#include <linux/sunrpc/clnt.h>
57
58#include <linux/nfs.h>
59#include <linux/nfs2.h>
60#include <linux/nfs3.h>
61#include <linux/nfs4.h>
62#include <linux/nfs_xdr.h>
63#include <linux/rwsem.h>
64#include <linux/mempool.h>
65 68
66/* 69/*
67 * NFSv3/v4 Access mode cache entry 70 * NFSv3/v4 Access mode cache entry
@@ -233,8 +236,12 @@ static inline int nfs_caches_unstable(struct inode *inode)
233 236
234static inline void nfs_mark_for_revalidate(struct inode *inode) 237static inline void nfs_mark_for_revalidate(struct inode *inode)
235{ 238{
239 struct nfs_inode *nfsi = NFS_I(inode);
240
236 spin_lock(&inode->i_lock); 241 spin_lock(&inode->i_lock);
237 NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS; 242 nfsi->cache_validity |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ACCESS;
243 if (S_ISDIR(inode->i_mode))
244 nfsi->cache_validity |= NFS_INO_REVAL_PAGECACHE|NFS_INO_INVALID_DATA;
238 spin_unlock(&inode->i_lock); 245 spin_unlock(&inode->i_lock);
239} 246}
240 247
@@ -296,7 +303,7 @@ extern int nfs_release(struct inode *, struct file *);
296extern int nfs_attribute_timeout(struct inode *inode); 303extern int nfs_attribute_timeout(struct inode *inode);
297extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode); 304extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode);
298extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *); 305extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *);
299extern void nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping); 306extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping);
300extern int nfs_setattr(struct dentry *, struct iattr *); 307extern int nfs_setattr(struct dentry *, struct iattr *);
301extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr); 308extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr);
302extern void nfs_begin_attr_update(struct inode *); 309extern void nfs_begin_attr_update(struct inode *);
@@ -306,6 +313,10 @@ extern void nfs_end_data_update(struct inode *);
306extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); 313extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx);
307extern void put_nfs_open_context(struct nfs_open_context *ctx); 314extern void put_nfs_open_context(struct nfs_open_context *ctx);
308extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode); 315extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode);
316extern struct vfsmount *nfs_do_submount(const struct vfsmount *mnt_parent,
317 const struct dentry *dentry,
318 struct nfs_fh *fh,
319 struct nfs_fattr *fattr);
309 320
310/* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */ 321/* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */
311extern u32 root_nfs_parse_addr(char *name); /*__init*/ 322extern u32 root_nfs_parse_addr(char *name); /*__init*/
@@ -392,6 +403,15 @@ extern void nfs_unregister_sysctl(void);
392#endif 403#endif
393 404
394/* 405/*
406 * linux/fs/nfs/namespace.c
407 */
408extern struct list_head nfs_automount_list;
409extern struct inode_operations nfs_mountpoint_inode_operations;
410extern struct inode_operations nfs_referral_inode_operations;
411extern int nfs_mountpoint_expiry_timeout;
412extern void nfs_release_automount_timer(void);
413
414/*
395 * linux/fs/nfs/unlink.c 415 * linux/fs/nfs/unlink.c
396 */ 416 */
397extern int nfs_async_unlink(struct dentry *); 417extern int nfs_async_unlink(struct dentry *);
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 65dec21af774..6b4a13c79474 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -35,6 +35,7 @@ struct nfs_server {
35 char * hostname; /* remote hostname */ 35 char * hostname; /* remote hostname */
36 struct nfs_fh fh; 36 struct nfs_fh fh;
37 struct sockaddr_in addr; 37 struct sockaddr_in addr;
38 struct nfs_fsid fsid;
38 unsigned long mount_time; /* when this fs was mounted */ 39 unsigned long mount_time; /* when this fs was mounted */
39#ifdef CONFIG_NFS_V4 40#ifdef CONFIG_NFS_V4
40 /* Our own IP address, as a null-terminated string. 41 /* Our own IP address, as a null-terminated string.
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
index 66e2ed658527..1f7bd287c230 100644
--- a/include/linux/nfs_page.h
+++ b/include/linux/nfs_page.h
@@ -13,7 +13,6 @@
13#include <linux/list.h> 13#include <linux/list.h>
14#include <linux/pagemap.h> 14#include <linux/pagemap.h>
15#include <linux/wait.h> 15#include <linux/wait.h>
16#include <linux/nfs_fs_sb.h>
17#include <linux/sunrpc/auth.h> 16#include <linux/sunrpc/auth.h>
18#include <linux/nfs_xdr.h> 17#include <linux/nfs_xdr.h>
19 18
@@ -63,8 +62,8 @@ extern void nfs_release_request(struct nfs_page *req);
63 62
64extern int nfs_scan_lock_dirty(struct nfs_inode *nfsi, struct list_head *dst, 63extern int nfs_scan_lock_dirty(struct nfs_inode *nfsi, struct list_head *dst,
65 unsigned long idx_start, unsigned int npages); 64 unsigned long idx_start, unsigned int npages);
66extern int nfs_scan_list(struct list_head *, struct list_head *, 65extern int nfs_scan_list(struct nfs_inode *nfsi, struct list_head *head, struct list_head *dst,
67 unsigned long, unsigned int); 66 unsigned long idx_start, unsigned int npages);
68extern int nfs_coalesce_requests(struct list_head *, struct list_head *, 67extern int nfs_coalesce_requests(struct list_head *, struct list_head *,
69 unsigned int); 68 unsigned int);
70extern int nfs_wait_on_request(struct nfs_page *); 69extern int nfs_wait_on_request(struct nfs_page *);
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 7fafc4c546b7..7c7320fa51aa 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -14,11 +14,19 @@
14#define NFS_DEF_FILE_IO_SIZE (4096U) 14#define NFS_DEF_FILE_IO_SIZE (4096U)
15#define NFS_MIN_FILE_IO_SIZE (1024U) 15#define NFS_MIN_FILE_IO_SIZE (1024U)
16 16
17struct nfs4_fsid { 17struct nfs_fsid {
18 __u64 major; 18 uint64_t major;
19 __u64 minor; 19 uint64_t minor;
20}; 20};
21 21
22/*
23 * Helper for checking equality between 2 fsids.
24 */
25static inline int nfs_fsid_equal(const struct nfs_fsid *a, const struct nfs_fsid *b)
26{
27 return a->major == b->major && a->minor == b->minor;
28}
29
22struct nfs_fattr { 30struct nfs_fattr {
23 unsigned short valid; /* which fields are valid */ 31 unsigned short valid; /* which fields are valid */
24 __u64 pre_size; /* pre_op_attr.size */ 32 __u64 pre_size; /* pre_op_attr.size */
@@ -40,10 +48,7 @@ struct nfs_fattr {
40 } nfs3; 48 } nfs3;
41 } du; 49 } du;
42 dev_t rdev; 50 dev_t rdev;
43 union { 51 struct nfs_fsid fsid;
44 __u64 nfs3; /* also nfs2 */
45 struct nfs4_fsid nfs4;
46 } fsid_u;
47 __u64 fileid; 52 __u64 fileid;
48 struct timespec atime; 53 struct timespec atime;
49 struct timespec mtime; 54 struct timespec mtime;
@@ -57,8 +62,8 @@ struct nfs_fattr {
57#define NFS_ATTR_WCC 0x0001 /* pre-op WCC data */ 62#define NFS_ATTR_WCC 0x0001 /* pre-op WCC data */
58#define NFS_ATTR_FATTR 0x0002 /* post-op attributes */ 63#define NFS_ATTR_FATTR 0x0002 /* post-op attributes */
59#define NFS_ATTR_FATTR_V3 0x0004 /* NFSv3 attributes */ 64#define NFS_ATTR_FATTR_V3 0x0004 /* NFSv3 attributes */
60#define NFS_ATTR_FATTR_V4 0x0008 65#define NFS_ATTR_FATTR_V4 0x0008 /* NFSv4 change attribute */
61#define NFS_ATTR_PRE_CHANGE 0x0010 66#define NFS_ATTR_FATTR_V4_REFERRAL 0x0010 /* NFSv4 referral */
62 67
63/* 68/*
64 * Info on the file system 69 * Info on the file system
@@ -675,6 +680,40 @@ struct nfs4_server_caps_res {
675 u32 has_symlinks; 680 u32 has_symlinks;
676}; 681};
677 682
683struct nfs4_string {
684 unsigned int len;
685 char *data;
686};
687
688#define NFS4_PATHNAME_MAXCOMPONENTS 512
689struct nfs4_pathname {
690 unsigned int ncomponents;
691 struct nfs4_string components[NFS4_PATHNAME_MAXCOMPONENTS];
692};
693
694#define NFS4_FS_LOCATION_MAXSERVERS 10
695struct nfs4_fs_location {
696 unsigned int nservers;
697 struct nfs4_string servers[NFS4_FS_LOCATION_MAXSERVERS];
698 struct nfs4_pathname rootpath;
699};
700
701#define NFS4_FS_LOCATIONS_MAXENTRIES 10
702struct nfs4_fs_locations {
703 struct nfs_fattr fattr;
704 const struct nfs_server *server;
705 struct nfs4_pathname fs_path;
706 int nlocations;
707 struct nfs4_fs_location locations[NFS4_FS_LOCATIONS_MAXENTRIES];
708};
709
710struct nfs4_fs_locations_arg {
711 const struct nfs_fh *dir_fh;
712 const struct qstr *name;
713 struct page *page;
714 const u32 *bitmask;
715};
716
678#endif /* CONFIG_NFS_V4 */ 717#endif /* CONFIG_NFS_V4 */
679 718
680struct nfs_page; 719struct nfs_page;
@@ -695,7 +734,7 @@ struct nfs_read_data {
695#ifdef CONFIG_NFS_V4 734#ifdef CONFIG_NFS_V4
696 unsigned long timestamp; /* For lease renewal */ 735 unsigned long timestamp; /* For lease renewal */
697#endif 736#endif
698 struct page *page_array[NFS_PAGEVEC_SIZE + 1]; 737 struct page *page_array[NFS_PAGEVEC_SIZE];
699}; 738};
700 739
701struct nfs_write_data { 740struct nfs_write_data {
@@ -713,7 +752,7 @@ struct nfs_write_data {
713#ifdef CONFIG_NFS_V4 752#ifdef CONFIG_NFS_V4
714 unsigned long timestamp; /* For lease renewal */ 753 unsigned long timestamp; /* For lease renewal */
715#endif 754#endif
716 struct page *page_array[NFS_PAGEVEC_SIZE + 1]; 755 struct page *page_array[NFS_PAGEVEC_SIZE];
717}; 756};
718 757
719struct nfs_access_entry; 758struct nfs_access_entry;
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index d276a4e2f825..0c076d58c676 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -7,6 +7,8 @@
7 7
8#include <linux/percpu.h> 8#include <linux/percpu.h>
9#include <linux/cache.h> 9#include <linux/cache.h>
10#include <linux/types.h>
11
10#include <asm/pgtable.h> 12#include <asm/pgtable.h>
11 13
12/* 14/*
@@ -88,7 +90,17 @@
88#define PG_nosave_free 18 /* Free, should not be written */ 90#define PG_nosave_free 18 /* Free, should not be written */
89#define PG_buddy 19 /* Page is free, on buddy lists */ 91#define PG_buddy 19 /* Page is free, on buddy lists */
90 92
91#define PG_uncached 20 /* Page has been mapped as uncached */ 93
94#if (BITS_PER_LONG > 32)
95/*
96 * 64-bit-only flags build down from bit 31
97 *
98 * 32 bit -------------------------------| FIELDS | FLAGS |
99 * 64 bit | FIELDS | ?????? FLAGS |
100 * 63 32 0
101 */
102#define PG_uncached 31 /* Page has been mapped as uncached */
103#endif
92 104
93/* 105/*
94 * Global page accounting. One instance per CPU. Only unsigned longs are 106 * Global page accounting. One instance per CPU. Only unsigned longs are
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 7a1af574dedf..1245df7141aa 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -99,6 +99,13 @@ extern struct page * read_cache_page(struct address_space *mapping,
99extern int read_cache_pages(struct address_space *mapping, 99extern int read_cache_pages(struct address_space *mapping,
100 struct list_head *pages, filler_t *filler, void *data); 100 struct list_head *pages, filler_t *filler, void *data);
101 101
102static inline struct page *read_mapping_page(struct address_space *mapping,
103 unsigned long index, void *data)
104{
105 filler_t *filler = (filler_t *)mapping->a_ops->readpage;
106 return read_cache_page(mapping, index, filler, data);
107}
108
102int add_to_page_cache(struct page *page, struct address_space *mapping, 109int add_to_page_cache(struct page *page, struct address_space *mapping,
103 unsigned long index, gfp_t gfp_mask); 110 unsigned long index, gfp_t gfp_mask);
104int add_to_page_cache_lru(struct page *page, struct address_space *mapping, 111int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
diff --git a/include/linux/parport.h b/include/linux/parport.h
index d42737eeee06..5bf321e82c99 100644
--- a/include/linux/parport.h
+++ b/include/linux/parport.h
@@ -127,6 +127,10 @@ struct amiga_parport_state {
127 unsigned char statusdir;/* ciab.ddrb & 7 */ 127 unsigned char statusdir;/* ciab.ddrb & 7 */
128}; 128};
129 129
130struct ax88796_parport_state {
131 unsigned char cpr;
132};
133
130struct ip32_parport_state { 134struct ip32_parport_state {
131 unsigned int dcr; 135 unsigned int dcr;
132 unsigned int ecr; 136 unsigned int ecr;
@@ -138,6 +142,7 @@ struct parport_state {
138 /* ARC has no state. */ 142 /* ARC has no state. */
139 struct ax_parport_state ax; 143 struct ax_parport_state ax;
140 struct amiga_parport_state amiga; 144 struct amiga_parport_state amiga;
145 struct ax88796_parport_state ax88796;
141 /* Atari has not state. */ 146 /* Atari has not state. */
142 struct ip32_parport_state ip32; 147 struct ip32_parport_state ip32;
143 void *misc; 148 void *misc;
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 6c4bc773f7b7..62a8c22f5f60 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -162,6 +162,9 @@ struct pci_dev {
162 unsigned int is_busmaster:1; /* device is busmaster */ 162 unsigned int is_busmaster:1; /* device is busmaster */
163 unsigned int no_msi:1; /* device may not use msi */ 163 unsigned int no_msi:1; /* device may not use msi */
164 unsigned int block_ucfg_access:1; /* userspace config space access is blocked */ 164 unsigned int block_ucfg_access:1; /* userspace config space access is blocked */
165 unsigned int broken_parity_status:1; /* Device generates false positive parity */
166 unsigned int msi_enabled:1;
167 unsigned int msix_enabled:1;
165 168
166 u32 saved_config_space[16]; /* config space saved at suspend time */ 169 u32 saved_config_space[16]; /* config space saved at suspend time */
167 struct hlist_head saved_cap_space; 170 struct hlist_head saved_cap_space;
@@ -496,6 +499,7 @@ int pci_set_dma_mask(struct pci_dev *dev, u64 mask);
496int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask); 499int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask);
497void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno); 500void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno);
498int pci_assign_resource(struct pci_dev *dev, int i); 501int pci_assign_resource(struct pci_dev *dev, int i);
502int pci_assign_resource_fixed(struct pci_dev *dev, int i);
499void pci_restore_bars(struct pci_dev *dev); 503void pci_restore_bars(struct pci_dev *dev);
500 504
501/* ROM control related routines */ 505/* ROM control related routines */
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index bcfe9d4f56ae..c2fd2d19938b 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -352,8 +352,11 @@
352#define PCI_DEVICE_ID_ATI_RS480 0x5950 352#define PCI_DEVICE_ID_ATI_RS480 0x5950
353/* ATI IXP Chipset */ 353/* ATI IXP Chipset */
354#define PCI_DEVICE_ID_ATI_IXP200_IDE 0x4349 354#define PCI_DEVICE_ID_ATI_IXP200_IDE 0x4349
355#define PCI_DEVICE_ID_ATI_IXP200_SMBUS 0x4353
356#define PCI_DEVICE_ID_ATI_IXP300_SMBUS 0x4363
355#define PCI_DEVICE_ID_ATI_IXP300_IDE 0x4369 357#define PCI_DEVICE_ID_ATI_IXP300_IDE 0x4369
356#define PCI_DEVICE_ID_ATI_IXP300_SATA 0x436e 358#define PCI_DEVICE_ID_ATI_IXP300_SATA 0x436e
359#define PCI_DEVICE_ID_ATI_IXP400_SMBUS 0x4372
357#define PCI_DEVICE_ID_ATI_IXP400_IDE 0x4376 360#define PCI_DEVICE_ID_ATI_IXP400_IDE 0x4376
358#define PCI_DEVICE_ID_ATI_IXP400_SATA 0x4379 361#define PCI_DEVICE_ID_ATI_IXP400_SATA 0x4379
359#define PCI_DEVICE_ID_ATI_IXP400_SATA2 0x437a 362#define PCI_DEVICE_ID_ATI_IXP400_SATA2 0x437a
@@ -848,7 +851,12 @@
848 851
849 852
850#define PCI_VENDOR_ID_QLOGIC 0x1077 853#define PCI_VENDOR_ID_QLOGIC 0x1077
854#define PCI_DEVICE_ID_QLOGIC_ISP10160 0x1016
851#define PCI_DEVICE_ID_QLOGIC_ISP1020 0x1020 855#define PCI_DEVICE_ID_QLOGIC_ISP1020 0x1020
856#define PCI_DEVICE_ID_QLOGIC_ISP1080 0x1080
857#define PCI_DEVICE_ID_QLOGIC_ISP12160 0x1216
858#define PCI_DEVICE_ID_QLOGIC_ISP1240 0x1240
859#define PCI_DEVICE_ID_QLOGIC_ISP1280 0x1280
852#define PCI_DEVICE_ID_QLOGIC_ISP2100 0x2100 860#define PCI_DEVICE_ID_QLOGIC_ISP2100 0x2100
853#define PCI_DEVICE_ID_QLOGIC_ISP2200 0x2200 861#define PCI_DEVICE_ID_QLOGIC_ISP2200 0x2200
854#define PCI_DEVICE_ID_QLOGIC_ISP2300 0x2300 862#define PCI_DEVICE_ID_QLOGIC_ISP2300 0x2300
@@ -1018,6 +1026,7 @@
1018#define PCI_DEVICE_ID_NVIDIA_NVENET_8 0x0056 1026#define PCI_DEVICE_ID_NVIDIA_NVENET_8 0x0056
1019#define PCI_DEVICE_ID_NVIDIA_NVENET_9 0x0057 1027#define PCI_DEVICE_ID_NVIDIA_NVENET_9 0x0057
1020#define PCI_DEVICE_ID_NVIDIA_CK804_AUDIO 0x0059 1028#define PCI_DEVICE_ID_NVIDIA_CK804_AUDIO 0x0059
1029#define PCI_DEVICE_ID_NVIDIA_CK804_PCIE 0x005d
1021#define PCI_DEVICE_ID_NVIDIA_NFORCE2_SMBUS 0x0064 1030#define PCI_DEVICE_ID_NVIDIA_NFORCE2_SMBUS 0x0064
1022#define PCI_DEVICE_ID_NVIDIA_NFORCE2_IDE 0x0065 1031#define PCI_DEVICE_ID_NVIDIA_NFORCE2_IDE 0x0065
1023#define PCI_DEVICE_ID_NVIDIA_NVENET_2 0x0066 1032#define PCI_DEVICE_ID_NVIDIA_NVENET_2 0x0066
@@ -1127,9 +1136,11 @@
1127#define PCI_DEVICE_ID_NVIDIA_QUADRO4_900XGL 0x0258 1136#define PCI_DEVICE_ID_NVIDIA_QUADRO4_900XGL 0x0258
1128#define PCI_DEVICE_ID_NVIDIA_QUADRO4_750XGL 0x0259 1137#define PCI_DEVICE_ID_NVIDIA_QUADRO4_750XGL 0x0259
1129#define PCI_DEVICE_ID_NVIDIA_QUADRO4_700XGL 0x025B 1138#define PCI_DEVICE_ID_NVIDIA_QUADRO4_700XGL 0x025B
1139#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SMBUS 0x0264
1130#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE 0x0265 1140#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE 0x0265
1131#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA 0x0266 1141#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA 0x0266
1132#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA2 0x0267 1142#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA2 0x0267
1143#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SMBUS 0x0368
1133#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE 0x036E 1144#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE 0x036E
1134#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA 0x037E 1145#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA 0x037E
1135#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA2 0x037F 1146#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA2 0x037F
@@ -1185,8 +1196,12 @@
1185#define PCI_DEVICE_ID_NVIDIA_NVENET_15 0x0373 1196#define PCI_DEVICE_ID_NVIDIA_NVENET_15 0x0373
1186#define PCI_DEVICE_ID_NVIDIA_NVENET_16 0x03E5 1197#define PCI_DEVICE_ID_NVIDIA_NVENET_16 0x03E5
1187#define PCI_DEVICE_ID_NVIDIA_NVENET_17 0x03E6 1198#define PCI_DEVICE_ID_NVIDIA_NVENET_17 0x03E6
1199#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA 0x03E7
1200#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_IDE 0x03EC
1188#define PCI_DEVICE_ID_NVIDIA_NVENET_18 0x03EE 1201#define PCI_DEVICE_ID_NVIDIA_NVENET_18 0x03EE
1189#define PCI_DEVICE_ID_NVIDIA_NVENET_19 0x03EF 1202#define PCI_DEVICE_ID_NVIDIA_NVENET_19 0x03EF
1203#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA2 0x03F6
1204#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA3 0x03F7
1190#define PCI_DEVICE_ID_NVIDIA_NVENET_20 0x0450 1205#define PCI_DEVICE_ID_NVIDIA_NVENET_20 0x0450
1191#define PCI_DEVICE_ID_NVIDIA_NVENET_21 0x0451 1206#define PCI_DEVICE_ID_NVIDIA_NVENET_21 0x0451
1192#define PCI_DEVICE_ID_NVIDIA_NVENET_22 0x0452 1207#define PCI_DEVICE_ID_NVIDIA_NVENET_22 0x0452
@@ -1244,6 +1259,7 @@
1244#define PCI_DEVICE_ID_VIA_PX8X0_0 0x0259 1259#define PCI_DEVICE_ID_VIA_PX8X0_0 0x0259
1245#define PCI_DEVICE_ID_VIA_3269_0 0x0269 1260#define PCI_DEVICE_ID_VIA_3269_0 0x0269
1246#define PCI_DEVICE_ID_VIA_K8T800PRO_0 0x0282 1261#define PCI_DEVICE_ID_VIA_K8T800PRO_0 0x0282
1262#define PCI_DEVICE_ID_VIA_3296_0 0x0296
1247#define PCI_DEVICE_ID_VIA_8363_0 0x0305 1263#define PCI_DEVICE_ID_VIA_8363_0 0x0305
1248#define PCI_DEVICE_ID_VIA_P4M800CE 0x0314 1264#define PCI_DEVICE_ID_VIA_P4M800CE 0x0314
1249#define PCI_DEVICE_ID_VIA_8371_0 0x0391 1265#define PCI_DEVICE_ID_VIA_8371_0 0x0391
@@ -1251,6 +1267,7 @@
1251#define PCI_DEVICE_ID_VIA_82C561 0x0561 1267#define PCI_DEVICE_ID_VIA_82C561 0x0561
1252#define PCI_DEVICE_ID_VIA_82C586_1 0x0571 1268#define PCI_DEVICE_ID_VIA_82C586_1 0x0571
1253#define PCI_DEVICE_ID_VIA_82C576 0x0576 1269#define PCI_DEVICE_ID_VIA_82C576 0x0576
1270#define PCI_DEVICE_ID_VIA_SATA_EIDE 0x0581
1254#define PCI_DEVICE_ID_VIA_82C586_0 0x0586 1271#define PCI_DEVICE_ID_VIA_82C586_0 0x0586
1255#define PCI_DEVICE_ID_VIA_82C596 0x0596 1272#define PCI_DEVICE_ID_VIA_82C596 0x0596
1256#define PCI_DEVICE_ID_VIA_82C597_0 0x0597 1273#define PCI_DEVICE_ID_VIA_82C597_0 0x0597
@@ -1291,10 +1308,11 @@
1291#define PCI_DEVICE_ID_VIA_8783_0 0x3208 1308#define PCI_DEVICE_ID_VIA_8783_0 0x3208
1292#define PCI_DEVICE_ID_VIA_8237 0x3227 1309#define PCI_DEVICE_ID_VIA_8237 0x3227
1293#define PCI_DEVICE_ID_VIA_8251 0x3287 1310#define PCI_DEVICE_ID_VIA_8251 0x3287
1294#define PCI_DEVICE_ID_VIA_3296_0 0x0296 1311#define PCI_DEVICE_ID_VIA_8237A 0x3337
1295#define PCI_DEVICE_ID_VIA_8231 0x8231 1312#define PCI_DEVICE_ID_VIA_8231 0x8231
1296#define PCI_DEVICE_ID_VIA_8231_4 0x8235 1313#define PCI_DEVICE_ID_VIA_8231_4 0x8235
1297#define PCI_DEVICE_ID_VIA_8365_1 0x8305 1314#define PCI_DEVICE_ID_VIA_8365_1 0x8305
1315#define PCI_DEVICE_ID_VIA_CX700 0x8324
1298#define PCI_DEVICE_ID_VIA_8371_1 0x8391 1316#define PCI_DEVICE_ID_VIA_8371_1 0x8391
1299#define PCI_DEVICE_ID_VIA_82C598_1 0x8598 1317#define PCI_DEVICE_ID_VIA_82C598_1 0x8598
1300#define PCI_DEVICE_ID_VIA_838X_1 0xB188 1318#define PCI_DEVICE_ID_VIA_838X_1 0xB188
@@ -1946,6 +1964,7 @@
1946 1964
1947#define PCI_VENDOR_ID_MELLANOX 0x15b3 1965#define PCI_VENDOR_ID_MELLANOX 0x15b3
1948#define PCI_DEVICE_ID_MELLANOX_TAVOR 0x5a44 1966#define PCI_DEVICE_ID_MELLANOX_TAVOR 0x5a44
1967#define PCI_DEVICE_ID_MELLANOX_TAVOR_BRIDGE 0x5a46
1949#define PCI_DEVICE_ID_MELLANOX_ARBEL_COMPAT 0x6278 1968#define PCI_DEVICE_ID_MELLANOX_ARBEL_COMPAT 0x6278
1950#define PCI_DEVICE_ID_MELLANOX_ARBEL 0x6282 1969#define PCI_DEVICE_ID_MELLANOX_ARBEL 0x6282
1951#define PCI_DEVICE_ID_MELLANOX_SINAI_OLD 0x5e8c 1970#define PCI_DEVICE_ID_MELLANOX_SINAI_OLD 0x5e8c
@@ -1969,6 +1988,9 @@
1969#define PCI_VENDOR_ID_NETCELL 0x169c 1988#define PCI_VENDOR_ID_NETCELL 0x169c
1970#define PCI_DEVICE_ID_REVOLUTION 0x0044 1989#define PCI_DEVICE_ID_REVOLUTION 0x0044
1971 1990
1991#define PCI_VENDOR_ID_VITESSE 0x1725
1992#define PCI_DEVICE_ID_VITESSE_VSC7174 0x7174
1993
1972#define PCI_VENDOR_ID_LINKSYS 0x1737 1994#define PCI_VENDOR_ID_LINKSYS 0x1737
1973#define PCI_DEVICE_ID_LINKSYS_EG1064 0x1064 1995#define PCI_DEVICE_ID_LINKSYS_EG1064 0x1064
1974 1996
@@ -2148,6 +2170,7 @@
2148#define PCI_DEVICE_ID_INTEL_ICH8_4 0x2815 2170#define PCI_DEVICE_ID_INTEL_ICH8_4 0x2815
2149#define PCI_DEVICE_ID_INTEL_ICH8_5 0x283e 2171#define PCI_DEVICE_ID_INTEL_ICH8_5 0x283e
2150#define PCI_DEVICE_ID_INTEL_ICH8_6 0x2850 2172#define PCI_DEVICE_ID_INTEL_ICH8_6 0x2850
2173#define PCI_DEVICE_ID_INTEL_GD31244 0x3200
2151#define PCI_DEVICE_ID_INTEL_82855PM_HB 0x3340 2174#define PCI_DEVICE_ID_INTEL_82855PM_HB 0x3340
2152#define PCI_DEVICE_ID_INTEL_82830_HB 0x3575 2175#define PCI_DEVICE_ID_INTEL_82830_HB 0x3575
2153#define PCI_DEVICE_ID_INTEL_82830_CGC 0x3577 2176#define PCI_DEVICE_ID_INTEL_82830_CGC 0x3577
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
index d27a78b71297..6bce4a240364 100644
--- a/include/linux/pci_regs.h
+++ b/include/linux/pci_regs.h
@@ -197,6 +197,7 @@
197#define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */ 197#define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */
198#define PCI_CAP_ID_PCIX 0x07 /* PCI-X */ 198#define PCI_CAP_ID_PCIX 0x07 /* PCI-X */
199#define PCI_CAP_ID_HT_IRQCONF 0x08 /* HyperTransport IRQ Configuration */ 199#define PCI_CAP_ID_HT_IRQCONF 0x08 /* HyperTransport IRQ Configuration */
200#define PCI_CAP_ID_VNDR 0x09 /* Vendor specific capability */
200#define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */ 201#define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */
201#define PCI_CAP_ID_EXP 0x10 /* PCI Express */ 202#define PCI_CAP_ID_EXP 0x10 /* PCI Express */
202#define PCI_CAP_ID_MSIX 0x11 /* MSI-X */ 203#define PCI_CAP_ID_MSIX 0x11 /* MSI-X */
diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h
index 66b5de404f22..f5aa593ccf32 100644
--- a/include/linux/percpu_counter.h
+++ b/include/linux/percpu_counter.h
@@ -10,13 +10,14 @@
10#include <linux/smp.h> 10#include <linux/smp.h>
11#include <linux/threads.h> 11#include <linux/threads.h>
12#include <linux/percpu.h> 12#include <linux/percpu.h>
13#include <linux/types.h>
13 14
14#ifdef CONFIG_SMP 15#ifdef CONFIG_SMP
15 16
16struct percpu_counter { 17struct percpu_counter {
17 spinlock_t lock; 18 spinlock_t lock;
18 long count; 19 s64 count;
19 long *counters; 20 s32 *counters;
20}; 21};
21 22
22#if NR_CPUS >= 16 23#if NR_CPUS >= 16
@@ -25,11 +26,11 @@ struct percpu_counter {
25#define FBC_BATCH (NR_CPUS*4) 26#define FBC_BATCH (NR_CPUS*4)
26#endif 27#endif
27 28
28static inline void percpu_counter_init(struct percpu_counter *fbc) 29static inline void percpu_counter_init(struct percpu_counter *fbc, s64 amount)
29{ 30{
30 spin_lock_init(&fbc->lock); 31 spin_lock_init(&fbc->lock);
31 fbc->count = 0; 32 fbc->count = amount;
32 fbc->counters = alloc_percpu(long); 33 fbc->counters = alloc_percpu(s32);
33} 34}
34 35
35static inline void percpu_counter_destroy(struct percpu_counter *fbc) 36static inline void percpu_counter_destroy(struct percpu_counter *fbc)
@@ -37,10 +38,10 @@ static inline void percpu_counter_destroy(struct percpu_counter *fbc)
37 free_percpu(fbc->counters); 38 free_percpu(fbc->counters);
38} 39}
39 40
40void percpu_counter_mod(struct percpu_counter *fbc, long amount); 41void percpu_counter_mod(struct percpu_counter *fbc, s32 amount);
41long percpu_counter_sum(struct percpu_counter *fbc); 42s64 percpu_counter_sum(struct percpu_counter *fbc);
42 43
43static inline long percpu_counter_read(struct percpu_counter *fbc) 44static inline s64 percpu_counter_read(struct percpu_counter *fbc)
44{ 45{
45 return fbc->count; 46 return fbc->count;
46} 47}
@@ -48,13 +49,14 @@ static inline long percpu_counter_read(struct percpu_counter *fbc)
48/* 49/*
49 * It is possible for the percpu_counter_read() to return a small negative 50 * It is possible for the percpu_counter_read() to return a small negative
50 * number for some counter which should never be negative. 51 * number for some counter which should never be negative.
52 *
51 */ 53 */
52static inline long percpu_counter_read_positive(struct percpu_counter *fbc) 54static inline s64 percpu_counter_read_positive(struct percpu_counter *fbc)
53{ 55{
54 long ret = fbc->count; 56 s64 ret = fbc->count;
55 57
56 barrier(); /* Prevent reloads of fbc->count */ 58 barrier(); /* Prevent reloads of fbc->count */
57 if (ret > 0) 59 if (ret >= 0)
58 return ret; 60 return ret;
59 return 1; 61 return 1;
60} 62}
@@ -62,12 +64,12 @@ static inline long percpu_counter_read_positive(struct percpu_counter *fbc)
62#else 64#else
63 65
64struct percpu_counter { 66struct percpu_counter {
65 long count; 67 s64 count;
66}; 68};
67 69
68static inline void percpu_counter_init(struct percpu_counter *fbc) 70static inline void percpu_counter_init(struct percpu_counter *fbc, s64 amount)
69{ 71{
70 fbc->count = 0; 72 fbc->count = amount;
71} 73}
72 74
73static inline void percpu_counter_destroy(struct percpu_counter *fbc) 75static inline void percpu_counter_destroy(struct percpu_counter *fbc)
@@ -75,24 +77,24 @@ static inline void percpu_counter_destroy(struct percpu_counter *fbc)
75} 77}
76 78
77static inline void 79static inline void
78percpu_counter_mod(struct percpu_counter *fbc, long amount) 80percpu_counter_mod(struct percpu_counter *fbc, s32 amount)
79{ 81{
80 preempt_disable(); 82 preempt_disable();
81 fbc->count += amount; 83 fbc->count += amount;
82 preempt_enable(); 84 preempt_enable();
83} 85}
84 86
85static inline long percpu_counter_read(struct percpu_counter *fbc) 87static inline s64 percpu_counter_read(struct percpu_counter *fbc)
86{ 88{
87 return fbc->count; 89 return fbc->count;
88} 90}
89 91
90static inline long percpu_counter_read_positive(struct percpu_counter *fbc) 92static inline s64 percpu_counter_read_positive(struct percpu_counter *fbc)
91{ 93{
92 return fbc->count; 94 return fbc->count;
93} 95}
94 96
95static inline long percpu_counter_sum(struct percpu_counter *fbc) 97static inline s64 percpu_counter_sum(struct percpu_counter *fbc)
96{ 98{
97 return percpu_counter_read_positive(fbc); 99 return percpu_counter_read_positive(fbc);
98} 100}
diff --git a/include/linux/pmu.h b/include/linux/pmu.h
index ecce5912f4d6..2ed807ddc08c 100644
--- a/include/linux/pmu.h
+++ b/include/linux/pmu.h
@@ -230,4 +230,8 @@ extern int pmu_battery_count;
230extern struct pmu_battery_info pmu_batteries[PMU_MAX_BATTERIES]; 230extern struct pmu_battery_info pmu_batteries[PMU_MAX_BATTERIES];
231extern unsigned int pmu_power_flags; 231extern unsigned int pmu_power_flags;
232 232
233/* Backlight */
234extern int disable_kernel_backlight;
235extern void pmu_backlight_init(struct device_node*);
236
233#endif /* __KERNEL__ */ 237#endif /* __KERNEL__ */
diff --git a/include/linux/prctl.h b/include/linux/prctl.h
index bf022c43a18e..52a9be41250d 100644
--- a/include/linux/prctl.h
+++ b/include/linux/prctl.h
@@ -52,4 +52,11 @@
52#define PR_SET_NAME 15 /* Set process name */ 52#define PR_SET_NAME 15 /* Set process name */
53#define PR_GET_NAME 16 /* Get process name */ 53#define PR_GET_NAME 16 /* Get process name */
54 54
55/* Get/set process endian */
56#define PR_GET_ENDIAN 19
57#define PR_SET_ENDIAN 20
58# define PR_ENDIAN_BIG 0
59# define PR_ENDIAN_LITTLE 1 /* True little endian mode */
60# define PR_ENDIAN_PPC_LITTLE 2 /* "PowerPC" pseudo little endian */
61
55#endif /* _LINUX_PRCTL_H */ 62#endif /* _LINUX_PRCTL_H */
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 0d36750fc0f1..ee918bc6e18c 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -51,6 +51,10 @@
51#ifdef __KERNEL__ 51#ifdef __KERNEL__
52/* 52/*
53 * Ptrace flags 53 * Ptrace flags
54 *
55 * The owner ship rules for task->ptrace which holds the ptrace
56 * flags is simple. When a task is running it owns it's task->ptrace
57 * flags. When the a task is stopped the ptracer owns task->ptrace.
54 */ 58 */
55 59
56#define PT_PTRACED 0x00000001 60#define PT_PTRACED 0x00000001
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index dd83cca28001..9158a68140c9 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -23,6 +23,9 @@
23#include <linux/preempt.h> 23#include <linux/preempt.h>
24#include <linux/types.h> 24#include <linux/types.h>
25 25
26#define RADIX_TREE_MAX_TAGS 2
27
28/* root tags are stored in gfp_mask, shifted by __GFP_BITS_SHIFT */
26struct radix_tree_root { 29struct radix_tree_root {
27 unsigned int height; 30 unsigned int height;
28 gfp_t gfp_mask; 31 gfp_t gfp_mask;
@@ -45,8 +48,6 @@ do { \
45 (root)->rnode = NULL; \ 48 (root)->rnode = NULL; \
46} while (0) 49} while (0)
47 50
48#define RADIX_TREE_MAX_TAGS 2
49
50int radix_tree_insert(struct radix_tree_root *, unsigned long, void *); 51int radix_tree_insert(struct radix_tree_root *, unsigned long, void *);
51void *radix_tree_lookup(struct radix_tree_root *, unsigned long); 52void *radix_tree_lookup(struct radix_tree_root *, unsigned long);
52void **radix_tree_lookup_slot(struct radix_tree_root *, unsigned long); 53void **radix_tree_lookup_slot(struct radix_tree_root *, unsigned long);
diff --git a/include/linux/ramfs.h b/include/linux/ramfs.h
index 78ecfa28b1c2..00b340ba6612 100644
--- a/include/linux/ramfs.h
+++ b/include/linux/ramfs.h
@@ -2,8 +2,8 @@
2#define _LINUX_RAMFS_H 2#define _LINUX_RAMFS_H
3 3
4struct inode *ramfs_get_inode(struct super_block *sb, int mode, dev_t dev); 4struct inode *ramfs_get_inode(struct super_block *sb, int mode, dev_t dev);
5struct super_block *ramfs_get_sb(struct file_system_type *fs_type, 5extern int ramfs_get_sb(struct file_system_type *fs_type,
6 int flags, const char *dev_name, void *data); 6 int flags, const char *dev_name, void *data, struct vfsmount *mnt);
7 7
8#ifndef CONFIG_MMU 8#ifndef CONFIG_MMU
9extern unsigned long ramfs_nommu_get_unmapped_area(struct file *file, 9extern unsigned long ramfs_nommu_get_unmapped_area(struct file *file,
diff --git a/include/linux/rbtree.h b/include/linux/rbtree.h
index f37006f21664..8d5382e62c08 100644
--- a/include/linux/rbtree.h
+++ b/include/linux/rbtree.h
@@ -132,6 +132,10 @@ static inline void rb_set_color(struct rb_node *rb, int color)
132#define RB_ROOT (struct rb_root) { NULL, } 132#define RB_ROOT (struct rb_root) { NULL, }
133#define rb_entry(ptr, type, member) container_of(ptr, type, member) 133#define rb_entry(ptr, type, member) container_of(ptr, type, member)
134 134
135#define RB_EMPTY_ROOT(root) ((root)->rb_node == NULL)
136#define RB_EMPTY_NODE(node) (rb_parent(node) != node)
137#define RB_CLEAR_NODE(node) (rb_set_parent(node, node))
138
135extern void rb_insert_color(struct rb_node *, struct rb_root *); 139extern void rb_insert_color(struct rb_node *, struct rb_root *);
136extern void rb_erase(struct rb_node *, struct rb_root *); 140extern void rb_erase(struct rb_node *, struct rb_root *);
137 141
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 970284f571a6..6312758393b6 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -246,7 +246,7 @@ extern int rcu_needs_cpu(int cpu);
246 * softirq handlers will have completed, since in some kernels, these 246 * softirq handlers will have completed, since in some kernels, these
247 * handlers can run in process context, and can block. 247 * handlers can run in process context, and can block.
248 * 248 *
249 * This primitive provides the guarantees made by the (deprecated) 249 * This primitive provides the guarantees made by the (now removed)
250 * synchronize_kernel() API. In contrast, synchronize_rcu() only 250 * synchronize_kernel() API. In contrast, synchronize_rcu() only
251 * guarantees that rcu_read_lock() sections will have completed. 251 * guarantees that rcu_read_lock() sections will have completed.
252 * In "classic RCU", these two guarantees happen to be one and 252 * In "classic RCU", these two guarantees happen to be one and
@@ -264,7 +264,6 @@ extern void FASTCALL(call_rcu(struct rcu_head *head,
264 void (*func)(struct rcu_head *head))); 264 void (*func)(struct rcu_head *head)));
265extern void FASTCALL(call_rcu_bh(struct rcu_head *head, 265extern void FASTCALL(call_rcu_bh(struct rcu_head *head,
266 void (*func)(struct rcu_head *head))); 266 void (*func)(struct rcu_head *head)));
267extern __deprecated_for_modules void synchronize_kernel(void);
268extern void synchronize_rcu(void); 267extern void synchronize_rcu(void);
269void synchronize_idle(void); 268void synchronize_idle(void);
270extern void rcu_barrier(void); 269extern void rcu_barrier(void);
diff --git a/include/linux/reboot.h b/include/linux/reboot.h
index 015297ff73fa..1dd1c707311f 100644
--- a/include/linux/reboot.h
+++ b/include/linux/reboot.h
@@ -59,13 +59,13 @@ extern void machine_crash_shutdown(struct pt_regs *);
59 * Architecture independent implemenations of sys_reboot commands. 59 * Architecture independent implemenations of sys_reboot commands.
60 */ 60 */
61 61
62extern void kernel_restart_prepare(char *cmd);
63extern void kernel_shutdown_prepare(enum system_states state); 62extern void kernel_shutdown_prepare(enum system_states state);
64 63
65extern void kernel_restart(char *cmd); 64extern void kernel_restart(char *cmd);
66extern void kernel_halt(void); 65extern void kernel_halt(void);
67extern void kernel_power_off(void); 66extern void kernel_power_off(void);
68extern void kernel_kexec(void); 67
68void ctrl_alt_del(void);
69 69
70/* 70/*
71 * Emergency restart, callable from an interrupt handler. 71 * Emergency restart, callable from an interrupt handler.
diff --git a/include/linux/resource.h b/include/linux/resource.h
index 21a86cb6acdb..ae13db714742 100644
--- a/include/linux/resource.h
+++ b/include/linux/resource.h
@@ -3,6 +3,8 @@
3 3
4#include <linux/time.h> 4#include <linux/time.h>
5 5
6struct task_struct;
7
6/* 8/*
7 * Resource control/accounting header file for linux 9 * Resource control/accounting header file for linux
8 */ 10 */
@@ -67,4 +69,6 @@ struct rlimit {
67 */ 69 */
68#include <asm/resource.h> 70#include <asm/resource.h>
69 71
72int getrusage(struct task_struct *p, int who, struct rusage __user *ru);
73
70#endif 74#endif
diff --git a/include/linux/resume-trace.h b/include/linux/resume-trace.h
new file mode 100644
index 000000000000..a376bd4ade39
--- /dev/null
+++ b/include/linux/resume-trace.h
@@ -0,0 +1,30 @@
1#ifndef RESUME_TRACE_H
2#define RESUME_TRACE_H
3
4#ifdef CONFIG_PM_TRACE
5
6struct device;
7extern void set_trace_device(struct device *);
8extern void generate_resume_trace(void *tracedata, unsigned int user);
9
10#define TRACE_DEVICE(dev) set_trace_device(dev)
11#define TRACE_RESUME(user) do { \
12 void *tracedata; \
13 asm volatile("movl $1f,%0\n" \
14 ".section .tracedata,\"a\"\n" \
15 "1:\t.word %c1\n" \
16 "\t.long %c2\n" \
17 ".previous" \
18 :"=r" (tracedata) \
19 : "i" (__LINE__), "i" (__FILE__)); \
20 generate_resume_trace(tracedata, user); \
21} while (0)
22
23#else
24
25#define TRACE_DEVICE(dev) do { } while (0)
26#define TRACE_RESUME(dev) do { } while (0)
27
28#endif
29
30#endif
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index 2d4c81a220db..bf97b0900014 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -91,7 +91,6 @@ static inline void page_dup_rmap(struct page *page)
91 */ 91 */
92int page_referenced(struct page *, int is_locked); 92int page_referenced(struct page *, int is_locked);
93int try_to_unmap(struct page *, int ignore_refs); 93int try_to_unmap(struct page *, int ignore_refs);
94void remove_from_swap(struct page *page);
95 94
96/* 95/*
97 * Called from mm/filemap_xip.c to unmap empty zero page 96 * Called from mm/filemap_xip.c to unmap empty zero page
diff --git a/include/linux/rtc-v3020.h b/include/linux/rtc-v3020.h
new file mode 100644
index 000000000000..bf74e63c98fe
--- /dev/null
+++ b/include/linux/rtc-v3020.h
@@ -0,0 +1,35 @@
1/*
2 * v3020.h - Registers definition and platform data structure for the v3020 RTC.
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2006, 8D Technologies inc.
9 */
10#ifndef __LINUX_V3020_H
11#define __LINUX_V3020_H
12
13/* The v3020 has only one data pin but which one
14 * is used depends on the board. */
15struct v3020_platform_data {
16 int leftshift; /* (1<<(leftshift)) & readl() */
17};
18
19#define V3020_STATUS_0 0x00
20#define V3020_STATUS_1 0x01
21#define V3020_SECONDS 0x02
22#define V3020_MINUTES 0x03
23#define V3020_HOURS 0x04
24#define V3020_MONTH_DAY 0x05
25#define V3020_MONTH 0x06
26#define V3020_YEAR 0x07
27#define V3020_WEEK_DAY 0x08
28#define V3020_WEEK 0x09
29
30#define V3020_IS_COMMAND(val) ((val)>=0x0E)
31
32#define V3020_CMD_RAM2CLOCK 0x0E
33#define V3020_CMD_CLOCK2RAM 0x0F
34
35#endif /* __LINUX_V3020_H */
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index ab61cd1199f2..36e2bf4b4315 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -102,6 +102,7 @@ struct rtc_pll_info {
102#include <linux/interrupt.h> 102#include <linux/interrupt.h>
103 103
104extern int rtc_month_days(unsigned int month, unsigned int year); 104extern int rtc_month_days(unsigned int month, unsigned int year);
105extern int rtc_year_days(unsigned int day, unsigned int month, unsigned int year);
105extern int rtc_valid_tm(struct rtc_time *tm); 106extern int rtc_valid_tm(struct rtc_time *tm);
106extern int rtc_tm_to_time(struct rtc_time *tm, unsigned long *time); 107extern int rtc_tm_to_time(struct rtc_time *tm, unsigned long *time);
107extern void rtc_time_to_tm(unsigned long time, struct rtc_time *tm); 108extern void rtc_time_to_tm(unsigned long time, struct rtc_time *tm);
@@ -155,6 +156,17 @@ struct rtc_device
155 struct rtc_task *irq_task; 156 struct rtc_task *irq_task;
156 spinlock_t irq_task_lock; 157 spinlock_t irq_task_lock;
157 int irq_freq; 158 int irq_freq;
159 int max_user_freq;
160#ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL
161 struct work_struct uie_task;
162 struct timer_list uie_timer;
163 /* Those fields are protected by rtc->irq_lock */
164 unsigned int oldsecs;
165 unsigned int irq_active:1;
166 unsigned int stop_uie_polling:1;
167 unsigned int uie_task_active:1;
168 unsigned int uie_timer_active:1;
169#endif
158}; 170};
159#define to_rtc_device(d) container_of(d, struct rtc_device, class_dev) 171#define to_rtc_device(d) container_of(d, struct rtc_device, class_dev)
160 172
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 267f15257040..8d11d9310db0 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -358,6 +358,14 @@ struct sighand_struct {
358 spinlock_t siglock; 358 spinlock_t siglock;
359}; 359};
360 360
361struct pacct_struct {
362 int ac_flag;
363 long ac_exitcode;
364 unsigned long ac_mem;
365 cputime_t ac_utime, ac_stime;
366 unsigned long ac_minflt, ac_majflt;
367};
368
361/* 369/*
362 * NOTE! "signal_struct" does not have it's own 370 * NOTE! "signal_struct" does not have it's own
363 * locking, because a shared signal_struct always 371 * locking, because a shared signal_struct always
@@ -449,6 +457,9 @@ struct signal_struct {
449 struct key *session_keyring; /* keyring inherited over fork */ 457 struct key *session_keyring; /* keyring inherited over fork */
450 struct key *process_keyring; /* keyring private to this process */ 458 struct key *process_keyring; /* keyring private to this process */
451#endif 459#endif
460#ifdef CONFIG_BSD_PROCESS_ACCT
461 struct pacct_struct pacct; /* per-process accounting information */
462#endif
452}; 463};
453 464
454/* Context switch must be unlocked if interrupts are to be enabled */ 465/* Context switch must be unlocked if interrupts are to be enabled */
@@ -941,12 +952,11 @@ static inline void put_task_struct(struct task_struct *t)
941#define PF_KSWAPD 0x00040000 /* I am kswapd */ 952#define PF_KSWAPD 0x00040000 /* I am kswapd */
942#define PF_SWAPOFF 0x00080000 /* I am in swapoff */ 953#define PF_SWAPOFF 0x00080000 /* I am in swapoff */
943#define PF_LESS_THROTTLE 0x00100000 /* Throttle me less: I clean memory */ 954#define PF_LESS_THROTTLE 0x00100000 /* Throttle me less: I clean memory */
944#define PF_SYNCWRITE 0x00200000 /* I am doing a sync write */ 955#define PF_BORROWED_MM 0x00200000 /* I am a kthread doing use_mm */
945#define PF_BORROWED_MM 0x00400000 /* I am a kthread doing use_mm */ 956#define PF_RANDOMIZE 0x00400000 /* randomize virtual address space */
946#define PF_RANDOMIZE 0x00800000 /* randomize virtual address space */ 957#define PF_SWAPWRITE 0x00800000 /* Allowed to write to swap */
947#define PF_SWAPWRITE 0x01000000 /* Allowed to write to swap */ 958#define PF_SPREAD_PAGE 0x01000000 /* Spread page cache over cpuset */
948#define PF_SPREAD_PAGE 0x04000000 /* Spread page cache over cpuset */ 959#define PF_SPREAD_SLAB 0x02000000 /* Spread some slab caches over cpuset */
949#define PF_SPREAD_SLAB 0x08000000 /* Spread some slab caches over cpuset */
950#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */ 960#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */
951 961
952/* 962/*
@@ -1225,7 +1235,7 @@ static inline int thread_group_empty(task_t *p)
1225 (thread_group_leader(p) && !thread_group_empty(p)) 1235 (thread_group_leader(p) && !thread_group_empty(p))
1226 1236
1227/* 1237/*
1228 * Protects ->fs, ->files, ->mm, ->ptrace, ->group_info, ->comm, keyring 1238 * Protects ->fs, ->files, ->mm, ->group_info, ->comm, keyring
1229 * subscriptions and synchronises with wait4(). Also used in procfs. Also 1239 * subscriptions and synchronises with wait4(). Also used in procfs. Also
1230 * pins the final release of task.io_context. Also protects ->cpuset. 1240 * pins the final release of task.io_context. Also protects ->cpuset.
1231 * 1241 *
diff --git a/include/linux/security.h b/include/linux/security.h
index 4dfb1b84a9b3..d2c17bd91a29 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -171,9 +171,9 @@ struct swap_info_struct;
171 * Deallocate and clear the sb->s_security field. 171 * Deallocate and clear the sb->s_security field.
172 * @sb contains the super_block structure to be modified. 172 * @sb contains the super_block structure to be modified.
173 * @sb_statfs: 173 * @sb_statfs:
174 * Check permission before obtaining filesystem statistics for the @sb 174 * Check permission before obtaining filesystem statistics for the @mnt
175 * filesystem. 175 * mountpoint.
176 * @sb contains the super_block structure for the filesystem. 176 * @dentry is a handle on the superblock for the filesystem.
177 * Return 0 if permission is granted. 177 * Return 0 if permission is granted.
178 * @sb_mount: 178 * @sb_mount:
179 * Check permission before an object specified by @dev_name is mounted on 179 * Check permission before an object specified by @dev_name is mounted on
@@ -577,6 +577,11 @@ struct swap_info_struct;
577 * @p contains the task_struct of process. 577 * @p contains the task_struct of process.
578 * @nice contains the new nice value. 578 * @nice contains the new nice value.
579 * Return 0 if permission is granted. 579 * Return 0 if permission is granted.
580 * @task_setioprio
581 * Check permission before setting the ioprio value of @p to @ioprio.
582 * @p contains the task_struct of process.
583 * @ioprio contains the new ioprio value
584 * Return 0 if permission is granted.
580 * @task_setrlimit: 585 * @task_setrlimit:
581 * Check permission before setting the resource limits of the current 586 * Check permission before setting the resource limits of the current
582 * process for @resource to @new_rlim. The old resource limit values can 587 * process for @resource to @new_rlim. The old resource limit values can
@@ -596,6 +601,10 @@ struct swap_info_struct;
596 * @p. 601 * @p.
597 * @p contains the task_struct for process. 602 * @p contains the task_struct for process.
598 * Return 0 if permission is granted. 603 * Return 0 if permission is granted.
604 * @task_movememory
605 * Check permission before moving memory owned by process @p.
606 * @p contains the task_struct for process.
607 * Return 0 if permission is granted.
599 * @task_kill: 608 * @task_kill:
600 * Check permission before sending signal @sig to @p. @info can be NULL, 609 * Check permission before sending signal @sig to @p. @info can be NULL,
601 * the constant 1, or a pointer to a siginfo structure. If @info is 1 or 610 * the constant 1, or a pointer to a siginfo structure. If @info is 1 or
@@ -1127,7 +1136,7 @@ struct security_operations {
1127 int (*sb_copy_data)(struct file_system_type *type, 1136 int (*sb_copy_data)(struct file_system_type *type,
1128 void *orig, void *copy); 1137 void *orig, void *copy);
1129 int (*sb_kern_mount) (struct super_block *sb, void *data); 1138 int (*sb_kern_mount) (struct super_block *sb, void *data);
1130 int (*sb_statfs) (struct super_block * sb); 1139 int (*sb_statfs) (struct dentry *dentry);
1131 int (*sb_mount) (char *dev_name, struct nameidata * nd, 1140 int (*sb_mount) (char *dev_name, struct nameidata * nd,
1132 char *type, unsigned long flags, void *data); 1141 char *type, unsigned long flags, void *data);
1133 int (*sb_check_sb) (struct vfsmount * mnt, struct nameidata * nd); 1142 int (*sb_check_sb) (struct vfsmount * mnt, struct nameidata * nd);
@@ -1210,10 +1219,12 @@ struct security_operations {
1210 int (*task_getsid) (struct task_struct * p); 1219 int (*task_getsid) (struct task_struct * p);
1211 int (*task_setgroups) (struct group_info *group_info); 1220 int (*task_setgroups) (struct group_info *group_info);
1212 int (*task_setnice) (struct task_struct * p, int nice); 1221 int (*task_setnice) (struct task_struct * p, int nice);
1222 int (*task_setioprio) (struct task_struct * p, int ioprio);
1213 int (*task_setrlimit) (unsigned int resource, struct rlimit * new_rlim); 1223 int (*task_setrlimit) (unsigned int resource, struct rlimit * new_rlim);
1214 int (*task_setscheduler) (struct task_struct * p, int policy, 1224 int (*task_setscheduler) (struct task_struct * p, int policy,
1215 struct sched_param * lp); 1225 struct sched_param * lp);
1216 int (*task_getscheduler) (struct task_struct * p); 1226 int (*task_getscheduler) (struct task_struct * p);
1227 int (*task_movememory) (struct task_struct * p);
1217 int (*task_kill) (struct task_struct * p, 1228 int (*task_kill) (struct task_struct * p,
1218 struct siginfo * info, int sig); 1229 struct siginfo * info, int sig);
1219 int (*task_wait) (struct task_struct * p); 1230 int (*task_wait) (struct task_struct * p);
@@ -1313,7 +1324,7 @@ struct security_operations {
1313 1324
1314 /* key management security hooks */ 1325 /* key management security hooks */
1315#ifdef CONFIG_KEYS 1326#ifdef CONFIG_KEYS
1316 int (*key_alloc)(struct key *key); 1327 int (*key_alloc)(struct key *key, struct task_struct *tsk);
1317 void (*key_free)(struct key *key); 1328 void (*key_free)(struct key *key);
1318 int (*key_permission)(key_ref_t key_ref, 1329 int (*key_permission)(key_ref_t key_ref,
1319 struct task_struct *context, 1330 struct task_struct *context,
@@ -1450,9 +1461,9 @@ static inline int security_sb_kern_mount (struct super_block *sb, void *data)
1450 return security_ops->sb_kern_mount (sb, data); 1461 return security_ops->sb_kern_mount (sb, data);
1451} 1462}
1452 1463
1453static inline int security_sb_statfs (struct super_block *sb) 1464static inline int security_sb_statfs (struct dentry *dentry)
1454{ 1465{
1455 return security_ops->sb_statfs (sb); 1466 return security_ops->sb_statfs (dentry);
1456} 1467}
1457 1468
1458static inline int security_sb_mount (char *dev_name, struct nameidata *nd, 1469static inline int security_sb_mount (char *dev_name, struct nameidata *nd,
@@ -1836,6 +1847,11 @@ static inline int security_task_setnice (struct task_struct *p, int nice)
1836 return security_ops->task_setnice (p, nice); 1847 return security_ops->task_setnice (p, nice);
1837} 1848}
1838 1849
1850static inline int security_task_setioprio (struct task_struct *p, int ioprio)
1851{
1852 return security_ops->task_setioprio (p, ioprio);
1853}
1854
1839static inline int security_task_setrlimit (unsigned int resource, 1855static inline int security_task_setrlimit (unsigned int resource,
1840 struct rlimit *new_rlim) 1856 struct rlimit *new_rlim)
1841{ 1857{
@@ -1854,6 +1870,11 @@ static inline int security_task_getscheduler (struct task_struct *p)
1854 return security_ops->task_getscheduler (p); 1870 return security_ops->task_getscheduler (p);
1855} 1871}
1856 1872
1873static inline int security_task_movememory (struct task_struct *p)
1874{
1875 return security_ops->task_movememory (p);
1876}
1877
1857static inline int security_task_kill (struct task_struct *p, 1878static inline int security_task_kill (struct task_struct *p,
1858 struct siginfo *info, int sig) 1879 struct siginfo *info, int sig)
1859{ 1880{
@@ -2162,7 +2183,7 @@ static inline int security_sb_kern_mount (struct super_block *sb, void *data)
2162 return 0; 2183 return 0;
2163} 2184}
2164 2185
2165static inline int security_sb_statfs (struct super_block *sb) 2186static inline int security_sb_statfs (struct dentry *dentry)
2166{ 2187{
2167 return 0; 2188 return 0;
2168} 2189}
@@ -2478,6 +2499,11 @@ static inline int security_task_setnice (struct task_struct *p, int nice)
2478 return 0; 2499 return 0;
2479} 2500}
2480 2501
2502static inline int security_task_setioprio (struct task_struct *p, int ioprio)
2503{
2504 return 0;
2505}
2506
2481static inline int security_task_setrlimit (unsigned int resource, 2507static inline int security_task_setrlimit (unsigned int resource,
2482 struct rlimit *new_rlim) 2508 struct rlimit *new_rlim)
2483{ 2509{
@@ -2496,6 +2522,11 @@ static inline int security_task_getscheduler (struct task_struct *p)
2496 return 0; 2522 return 0;
2497} 2523}
2498 2524
2525static inline int security_task_movememory (struct task_struct *p)
2526{
2527 return 0;
2528}
2529
2499static inline int security_task_kill (struct task_struct *p, 2530static inline int security_task_kill (struct task_struct *p,
2500 struct siginfo *info, int sig) 2531 struct siginfo *info, int sig)
2501{ 2532{
@@ -3008,9 +3039,10 @@ static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 sk_sid
3008 3039
3009#ifdef CONFIG_KEYS 3040#ifdef CONFIG_KEYS
3010#ifdef CONFIG_SECURITY 3041#ifdef CONFIG_SECURITY
3011static inline int security_key_alloc(struct key *key) 3042static inline int security_key_alloc(struct key *key,
3043 struct task_struct *tsk)
3012{ 3044{
3013 return security_ops->key_alloc(key); 3045 return security_ops->key_alloc(key, tsk);
3014} 3046}
3015 3047
3016static inline void security_key_free(struct key *key) 3048static inline void security_key_free(struct key *key)
@@ -3027,7 +3059,8 @@ static inline int security_key_permission(key_ref_t key_ref,
3027 3059
3028#else 3060#else
3029 3061
3030static inline int security_key_alloc(struct key *key) 3062static inline int security_key_alloc(struct key *key,
3063 struct task_struct *tsk)
3031{ 3064{
3032 return 0; 3065 return 0;
3033} 3066}
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 0ef50baa7da6..951c4e858274 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -130,6 +130,9 @@
130/* SUN4V Hypervisor Console */ 130/* SUN4V Hypervisor Console */
131#define PORT_SUNHV 72 131#define PORT_SUNHV 72
132 132
133#define PORT_S3C2412 73
134
135
133#ifdef __KERNEL__ 136#ifdef __KERNEL__
134 137
135#include <linux/compiler.h> 138#include <linux/compiler.h>
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 66f8819f9568..16eef03ce0eb 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -134,9 +134,10 @@ struct skb_frag_struct {
134struct skb_shared_info { 134struct skb_shared_info {
135 atomic_t dataref; 135 atomic_t dataref;
136 unsigned short nr_frags; 136 unsigned short nr_frags;
137 unsigned short tso_size; 137 unsigned short gso_size;
138 unsigned short tso_segs; 138 /* Warning: this field is not always filled in (UFO)! */
139 unsigned short ufo_size; 139 unsigned short gso_segs;
140 unsigned short gso_type;
140 unsigned int ip6_frag_id; 141 unsigned int ip6_frag_id;
141 struct sk_buff *frag_list; 142 struct sk_buff *frag_list;
142 skb_frag_t frags[MAX_SKB_FRAGS]; 143 skb_frag_t frags[MAX_SKB_FRAGS];
@@ -168,6 +169,11 @@ enum {
168 SKB_FCLONE_CLONE, 169 SKB_FCLONE_CLONE,
169}; 170};
170 171
172enum {
173 SKB_GSO_TCPV4 = 1 << 0,
174 SKB_GSO_UDPV4 = 1 << 1,
175};
176
171/** 177/**
172 * struct sk_buff - socket buffer 178 * struct sk_buff - socket buffer
173 * @next: Next buffer in list 179 * @next: Next buffer in list
@@ -209,6 +215,8 @@ enum {
209 * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c 215 * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c
210 * @tc_index: Traffic control index 216 * @tc_index: Traffic control index
211 * @tc_verd: traffic control verdict 217 * @tc_verd: traffic control verdict
218 * @dma_cookie: a cookie to one of several possible DMA operations
219 * done by skb DMA functions
212 * @secmark: security marking 220 * @secmark: security marking
213 */ 221 */
214 222
@@ -345,7 +353,7 @@ extern struct sk_buff *skb_realloc_headroom(struct sk_buff *skb,
345extern struct sk_buff *skb_copy_expand(const struct sk_buff *skb, 353extern struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
346 int newheadroom, int newtailroom, 354 int newheadroom, int newtailroom,
347 gfp_t priority); 355 gfp_t priority);
348extern struct sk_buff * skb_pad(struct sk_buff *skb, int pad); 356extern int skb_pad(struct sk_buff *skb, int pad);
349#define dev_kfree_skb(a) kfree_skb(a) 357#define dev_kfree_skb(a) kfree_skb(a)
350extern void skb_over_panic(struct sk_buff *skb, int len, 358extern void skb_over_panic(struct sk_buff *skb, int len,
351 void *here); 359 void *here);
@@ -1122,16 +1130,15 @@ static inline int skb_cow(struct sk_buff *skb, unsigned int headroom)
1122 * 1130 *
1123 * Pads up a buffer to ensure the trailing bytes exist and are 1131 * Pads up a buffer to ensure the trailing bytes exist and are
1124 * blanked. If the buffer already contains sufficient data it 1132 * blanked. If the buffer already contains sufficient data it
1125 * is untouched. Returns the buffer, which may be a replacement 1133 * is untouched. Otherwise it is extended. Returns zero on
1126 * for the original, or NULL for out of memory - in which case 1134 * success. The skb is freed on error.
1127 * the original buffer is still freed.
1128 */ 1135 */
1129 1136
1130static inline struct sk_buff *skb_padto(struct sk_buff *skb, unsigned int len) 1137static inline int skb_padto(struct sk_buff *skb, unsigned int len)
1131{ 1138{
1132 unsigned int size = skb->len; 1139 unsigned int size = skb->len;
1133 if (likely(size >= len)) 1140 if (likely(size >= len))
1134 return skb; 1141 return 0;
1135 return skb_pad(skb, len-size); 1142 return skb_pad(skb, len-size);
1136} 1143}
1137 1144
@@ -1292,6 +1299,7 @@ extern void skb_split(struct sk_buff *skb,
1292 struct sk_buff *skb1, const u32 len); 1299 struct sk_buff *skb1, const u32 len);
1293 1300
1294extern void skb_release_data(struct sk_buff *skb); 1301extern void skb_release_data(struct sk_buff *skb);
1302extern struct sk_buff *skb_segment(struct sk_buff *skb, int sg);
1295 1303
1296static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, 1304static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
1297 int len, void *buffer) 1305 int len, void *buffer)
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 9dc93163e065..45ad55b70d1c 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -86,6 +86,51 @@ extern void *__kmalloc_track_caller(size_t, gfp_t, void*);
86 __kmalloc_track_caller(size, flags, __builtin_return_address(0)) 86 __kmalloc_track_caller(size, flags, __builtin_return_address(0))
87#endif 87#endif
88 88
89/**
90 * kmalloc - allocate memory
91 * @size: how many bytes of memory are required.
92 * @flags: the type of memory to allocate.
93 *
94 * kmalloc is the normal method of allocating memory
95 * in the kernel.
96 *
97 * The @flags argument may be one of:
98 *
99 * %GFP_USER - Allocate memory on behalf of user. May sleep.
100 *
101 * %GFP_KERNEL - Allocate normal kernel ram. May sleep.
102 *
103 * %GFP_ATOMIC - Allocation will not sleep.
104 * For example, use this inside interrupt handlers.
105 *
106 * %GFP_HIGHUSER - Allocate pages from high memory.
107 *
108 * %GFP_NOIO - Do not do any I/O at all while trying to get memory.
109 *
110 * %GFP_NOFS - Do not make any fs calls while trying to get memory.
111 *
112 * Also it is possible to set different flags by OR'ing
113 * in one or more of the following additional @flags:
114 *
115 * %__GFP_COLD - Request cache-cold pages instead of
116 * trying to return cache-warm pages.
117 *
118 * %__GFP_DMA - Request memory from the DMA-capable zone.
119 *
120 * %__GFP_HIGH - This allocation has high priority and may use emergency pools.
121 *
122 * %__GFP_HIGHMEM - Allocated memory may be from highmem.
123 *
124 * %__GFP_NOFAIL - Indicate that this allocation is in no way allowed to fail
125 * (think twice before using).
126 *
127 * %__GFP_NORETRY - If memory is not immediately available,
128 * then give up at once.
129 *
130 * %__GFP_NOWARN - If allocation fails, don't issue any warnings.
131 *
132 * %__GFP_REPEAT - If allocation fails initially, try once more before failing.
133 */
89static inline void *kmalloc(size_t size, gfp_t flags) 134static inline void *kmalloc(size_t size, gfp_t flags)
90{ 135{
91 if (__builtin_constant_p(size)) { 136 if (__builtin_constant_p(size)) {
@@ -111,6 +156,11 @@ found:
111 156
112extern void *__kzalloc(size_t, gfp_t); 157extern void *__kzalloc(size_t, gfp_t);
113 158
159/**
160 * kzalloc - allocate memory. The memory is set to zero.
161 * @size: how many bytes of memory are required.
162 * @flags: the type of memory to allocate (see kmalloc).
163 */
114static inline void *kzalloc(size_t size, gfp_t flags) 164static inline void *kzalloc(size_t size, gfp_t flags)
115{ 165{
116 if (__builtin_constant_p(size)) { 166 if (__builtin_constant_p(size)) {
diff --git a/include/linux/string.h b/include/linux/string.h
index c61306da8c52..e4c755860316 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -56,6 +56,7 @@ extern char * strnchr(const char *, size_t, int);
56#ifndef __HAVE_ARCH_STRRCHR 56#ifndef __HAVE_ARCH_STRRCHR
57extern char * strrchr(const char *,int); 57extern char * strrchr(const char *,int);
58#endif 58#endif
59extern char * strstrip(char *);
59#ifndef __HAVE_ARCH_STRSTR 60#ifndef __HAVE_ARCH_STRSTR
60extern char * strstr(const char *,const char *); 61extern char * strstr(const char *,const char *);
61#endif 62#endif
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index 84c35d42d250..e6d3d349506c 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -194,6 +194,7 @@ extern void xdr_write_pages(struct xdr_stream *xdr, struct page **pages,
194extern void xdr_init_decode(struct xdr_stream *xdr, struct xdr_buf *buf, uint32_t *p); 194extern void xdr_init_decode(struct xdr_stream *xdr, struct xdr_buf *buf, uint32_t *p);
195extern uint32_t *xdr_inline_decode(struct xdr_stream *xdr, size_t nbytes); 195extern uint32_t *xdr_inline_decode(struct xdr_stream *xdr, size_t nbytes);
196extern void xdr_read_pages(struct xdr_stream *xdr, unsigned int len); 196extern void xdr_read_pages(struct xdr_stream *xdr, unsigned int len);
197extern void xdr_enter_page(struct xdr_stream *xdr, unsigned int len);
197 198
198#endif /* __KERNEL__ */ 199#endif /* __KERNEL__ */
199 200
diff --git a/include/linux/swap.h b/include/linux/swap.h
index aca9bfae208f..dc3f3aa0c83e 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -28,7 +28,14 @@ static inline int current_is_kswapd(void)
28 * the type/offset into the pte as 5/27 as well. 28 * the type/offset into the pte as 5/27 as well.
29 */ 29 */
30#define MAX_SWAPFILES_SHIFT 5 30#define MAX_SWAPFILES_SHIFT 5
31#ifndef CONFIG_MIGRATION
31#define MAX_SWAPFILES (1 << MAX_SWAPFILES_SHIFT) 32#define MAX_SWAPFILES (1 << MAX_SWAPFILES_SHIFT)
33#else
34/* Use last two entries for page migration swap entries */
35#define MAX_SWAPFILES ((1 << MAX_SWAPFILES_SHIFT)-2)
36#define SWP_MIGRATION_READ MAX_SWAPFILES
37#define SWP_MIGRATION_WRITE (MAX_SWAPFILES + 1)
38#endif
32 39
33/* 40/*
34 * Magic header for a swap area. The first part of the union is 41 * Magic header for a swap area. The first part of the union is
@@ -48,12 +55,14 @@ union swap_header {
48 char magic[10]; /* SWAP-SPACE or SWAPSPACE2 */ 55 char magic[10]; /* SWAP-SPACE or SWAPSPACE2 */
49 } magic; 56 } magic;
50 struct { 57 struct {
51 char bootbits[1024]; /* Space for disklabel etc. */ 58 char bootbits[1024]; /* Space for disklabel etc. */
52 unsigned int version; 59 __u32 version;
53 unsigned int last_page; 60 __u32 last_page;
54 unsigned int nr_badpages; 61 __u32 nr_badpages;
55 unsigned int padding[125]; 62 unsigned char sws_uuid[16];
56 unsigned int badpages[1]; 63 unsigned char sws_volume[16];
64 __u32 padding[117];
65 __u32 badpages[1];
57 } info; 66 } info;
58}; 67};
59 68
@@ -176,20 +185,7 @@ extern unsigned long try_to_free_pages(struct zone **, gfp_t);
176extern unsigned long shrink_all_memory(unsigned long nr_pages); 185extern unsigned long shrink_all_memory(unsigned long nr_pages);
177extern int vm_swappiness; 186extern int vm_swappiness;
178extern int remove_mapping(struct address_space *mapping, struct page *page); 187extern int remove_mapping(struct address_space *mapping, struct page *page);
179 188extern long vm_total_pages;
180/* possible outcome of pageout() */
181typedef enum {
182 /* failed to write page out, page is locked */
183 PAGE_KEEP,
184 /* move page to the active list, page is locked */
185 PAGE_ACTIVATE,
186 /* page has been sent to the disk successfully, page is unlocked */
187 PAGE_SUCCESS,
188 /* page is clean and locked */
189 PAGE_CLEAN,
190} pageout_t;
191
192extern pageout_t pageout(struct page *page, struct address_space *mapping);
193 189
194#ifdef CONFIG_NUMA 190#ifdef CONFIG_NUMA
195extern int zone_reclaim_mode; 191extern int zone_reclaim_mode;
@@ -250,7 +246,6 @@ extern int remove_exclusive_swap_page(struct page *);
250struct backing_dev_info; 246struct backing_dev_info;
251 247
252extern spinlock_t swap_lock; 248extern spinlock_t swap_lock;
253extern int remove_vma_swap(struct vm_area_struct *vma, struct page *page);
254 249
255/* linux/mm/thrash.c */ 250/* linux/mm/thrash.c */
256extern struct mm_struct * swap_token_mm; 251extern struct mm_struct * swap_token_mm;
@@ -288,18 +283,60 @@ static inline void disable_swap_token(void)
288#define free_pages_and_swap_cache(pages, nr) \ 283#define free_pages_and_swap_cache(pages, nr) \
289 release_pages((pages), (nr), 0); 284 release_pages((pages), (nr), 0);
290 285
291#define show_swap_cache_info() /*NOTHING*/ 286static inline void show_swap_cache_info(void)
292#define free_swap_and_cache(swp) /*NOTHING*/ 287{
293#define swap_duplicate(swp) /*NOTHING*/ 288}
294#define swap_free(swp) /*NOTHING*/ 289
295#define read_swap_cache_async(swp,vma,addr) NULL 290static inline void free_swap_and_cache(swp_entry_t swp)
296#define lookup_swap_cache(swp) NULL 291{
297#define valid_swaphandles(swp, off) 0 292}
293
294static inline int swap_duplicate(swp_entry_t swp)
295{
296 return 0;
297}
298
299static inline void swap_free(swp_entry_t swp)
300{
301}
302
303static inline struct page *read_swap_cache_async(swp_entry_t swp,
304 struct vm_area_struct *vma, unsigned long addr)
305{
306 return NULL;
307}
308
309static inline struct page *lookup_swap_cache(swp_entry_t swp)
310{
311 return NULL;
312}
313
314static inline int valid_swaphandles(swp_entry_t entry, unsigned long *offset)
315{
316 return 0;
317}
318
298#define can_share_swap_page(p) (page_mapcount(p) == 1) 319#define can_share_swap_page(p) (page_mapcount(p) == 1)
299#define move_to_swap_cache(p, swp) 1 320
300#define move_from_swap_cache(p, i, m) 1 321static inline int move_to_swap_cache(struct page *page, swp_entry_t entry)
301#define __delete_from_swap_cache(p) /*NOTHING*/ 322{
302#define delete_from_swap_cache(p) /*NOTHING*/ 323 return 1;
324}
325
326static inline int move_from_swap_cache(struct page *page, unsigned long index,
327 struct address_space *mapping)
328{
329 return 1;
330}
331
332static inline void __delete_from_swap_cache(struct page *page)
333{
334}
335
336static inline void delete_from_swap_cache(struct page *page)
337{
338}
339
303#define swap_token_default_timeout 0 340#define swap_token_default_timeout 0
304 341
305static inline int remove_exclusive_swap_page(struct page *p) 342static inline int remove_exclusive_swap_page(struct page *p)
diff --git a/include/linux/swapops.h b/include/linux/swapops.h
index 87b9d14c710d..ec639aa3a1d3 100644
--- a/include/linux/swapops.h
+++ b/include/linux/swapops.h
@@ -67,3 +67,56 @@ static inline pte_t swp_entry_to_pte(swp_entry_t entry)
67 BUG_ON(pte_file(__swp_entry_to_pte(arch_entry))); 67 BUG_ON(pte_file(__swp_entry_to_pte(arch_entry)));
68 return __swp_entry_to_pte(arch_entry); 68 return __swp_entry_to_pte(arch_entry);
69} 69}
70
71#ifdef CONFIG_MIGRATION
72static inline swp_entry_t make_migration_entry(struct page *page, int write)
73{
74 BUG_ON(!PageLocked(page));
75 return swp_entry(write ? SWP_MIGRATION_WRITE : SWP_MIGRATION_READ,
76 page_to_pfn(page));
77}
78
79static inline int is_migration_entry(swp_entry_t entry)
80{
81 return unlikely(swp_type(entry) == SWP_MIGRATION_READ ||
82 swp_type(entry) == SWP_MIGRATION_WRITE);
83}
84
85static inline int is_write_migration_entry(swp_entry_t entry)
86{
87 return unlikely(swp_type(entry) == SWP_MIGRATION_WRITE);
88}
89
90static inline struct page *migration_entry_to_page(swp_entry_t entry)
91{
92 struct page *p = pfn_to_page(swp_offset(entry));
93 /*
94 * Any use of migration entries may only occur while the
95 * corresponding page is locked
96 */
97 BUG_ON(!PageLocked(p));
98 return p;
99}
100
101static inline void make_migration_entry_read(swp_entry_t *entry)
102{
103 *entry = swp_entry(SWP_MIGRATION_READ, swp_offset(*entry));
104}
105
106extern void migration_entry_wait(struct mm_struct *mm, pmd_t *pmd,
107 unsigned long address);
108#else
109
110#define make_migration_entry(page, write) swp_entry(0, 0)
111#define is_migration_entry(swp) 0
112#define migration_entry_to_page(swp) NULL
113static inline void make_migration_entry_read(swp_entry_t *entryp) { }
114static inline void migration_entry_wait(struct mm_struct *mm, pmd_t *pmd,
115 unsigned long address) { }
116static inline int is_write_migration_entry(swp_entry_t entry)
117{
118 return 0;
119}
120
121#endif
122
diff --git a/include/linux/synclink.h b/include/linux/synclink.h
index 2993302f7923..0577f5284cbc 100644
--- a/include/linux/synclink.h
+++ b/include/linux/synclink.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * SyncLink Multiprotocol Serial Adapter Driver 2 * SyncLink Multiprotocol Serial Adapter Driver
3 * 3 *
4 * $Id: synclink.h,v 3.11 2006/02/06 21:20:29 paulkf Exp $ 4 * $Id: synclink.h,v 3.13 2006/05/23 18:25:06 paulkf Exp $
5 * 5 *
6 * Copyright (C) 1998-2000 by Microgate Corporation 6 * Copyright (C) 1998-2000 by Microgate Corporation
7 * 7 *
@@ -97,6 +97,8 @@
97#define HDLC_TXIDLE_ALT_MARK_SPACE 4 97#define HDLC_TXIDLE_ALT_MARK_SPACE 4
98#define HDLC_TXIDLE_SPACE 5 98#define HDLC_TXIDLE_SPACE 5
99#define HDLC_TXIDLE_MARK 6 99#define HDLC_TXIDLE_MARK 6
100#define HDLC_TXIDLE_CUSTOM_8 0x10000000
101#define HDLC_TXIDLE_CUSTOM_16 0x20000000
100 102
101#define HDLC_ENCODING_NRZ 0 103#define HDLC_ENCODING_NRZ 0
102#define HDLC_ENCODING_NRZB 1 104#define HDLC_ENCODING_NRZB 1
@@ -170,6 +172,7 @@ typedef struct _MGSL_PARAMS
170#define SYNCLINK_GT_DEVICE_ID 0x0070 172#define SYNCLINK_GT_DEVICE_ID 0x0070
171#define SYNCLINK_GT4_DEVICE_ID 0x0080 173#define SYNCLINK_GT4_DEVICE_ID 0x0080
172#define SYNCLINK_AC_DEVICE_ID 0x0090 174#define SYNCLINK_AC_DEVICE_ID 0x0090
175#define SYNCLINK_GT2_DEVICE_ID 0x00A0
173#define MGSL_MAX_SERIAL_NUMBER 30 176#define MGSL_MAX_SERIAL_NUMBER 30
174 177
175/* 178/*
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index bd67a4413df7..33785b79d548 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -516,6 +516,16 @@ asmlinkage long sys_set_mempolicy(int mode, unsigned long __user *nmask,
516asmlinkage long sys_migrate_pages(pid_t pid, unsigned long maxnode, 516asmlinkage long sys_migrate_pages(pid_t pid, unsigned long maxnode,
517 const unsigned long __user *from, 517 const unsigned long __user *from,
518 const unsigned long __user *to); 518 const unsigned long __user *to);
519asmlinkage long sys_move_pages(pid_t pid, unsigned long nr_pages,
520 const void __user * __user *pages,
521 const int __user *nodes,
522 int __user *status,
523 int flags);
524asmlinkage long compat_sys_move_pages(pid_t pid, unsigned long nr_page,
525 __u32 __user *pages,
526 const int __user *nodes,
527 int __user *status,
528 int flags);
519asmlinkage long sys_mbind(unsigned long start, unsigned long len, 529asmlinkage long sys_mbind(unsigned long start, unsigned long len,
520 unsigned long mode, 530 unsigned long mode,
521 unsigned long __user *nmask, 531 unsigned long __user *nmask,
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index cee944dbdcd4..6a60770984e9 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -55,7 +55,7 @@ enum
55 CTL_KERN=1, /* General kernel info and control */ 55 CTL_KERN=1, /* General kernel info and control */
56 CTL_VM=2, /* VM management */ 56 CTL_VM=2, /* VM management */
57 CTL_NET=3, /* Networking */ 57 CTL_NET=3, /* Networking */
58 CTL_PROC=4, /* Process info */ 58 /* was CTL_PROC */
59 CTL_FS=5, /* Filesystems */ 59 CTL_FS=5, /* Filesystems */
60 CTL_DEBUG=6, /* Debugging */ 60 CTL_DEBUG=6, /* Debugging */
61 CTL_DEV=7, /* Devices */ 61 CTL_DEV=7, /* Devices */
@@ -186,6 +186,7 @@ enum
186 VM_PERCPU_PAGELIST_FRACTION=30,/* int: fraction of pages in each percpu_pagelist */ 186 VM_PERCPU_PAGELIST_FRACTION=30,/* int: fraction of pages in each percpu_pagelist */
187 VM_ZONE_RECLAIM_MODE=31, /* reclaim local zone memory before going off node */ 187 VM_ZONE_RECLAIM_MODE=31, /* reclaim local zone memory before going off node */
188 VM_ZONE_RECLAIM_INTERVAL=32, /* time period to wait after reclaim failure */ 188 VM_ZONE_RECLAIM_INTERVAL=32, /* time period to wait after reclaim failure */
189 VM_PANIC_ON_OOM=33, /* panic at out-of-memory */
189}; 190};
190 191
191 192
@@ -766,8 +767,6 @@ enum {
766 NET_BRIDGE_NF_FILTER_VLAN_TAGGED = 4, 767 NET_BRIDGE_NF_FILTER_VLAN_TAGGED = 4,
767}; 768};
768 769
769/* CTL_PROC names: */
770
771/* CTL_FS names: */ 770/* CTL_FS names: */
772enum 771enum
773{ 772{
diff --git a/include/linux/sysdev.h b/include/linux/sysdev.h
index 2a4b432e1176..166a2e58c287 100644
--- a/include/linux/sysdev.h
+++ b/include/linux/sysdev.h
@@ -37,11 +37,27 @@ struct sysdev_class {
37 struct kset kset; 37 struct kset kset;
38}; 38};
39 39
40struct sysdev_class_attribute {
41 struct attribute attr;
42 ssize_t (*show)(struct sysdev_class *, char *);
43 ssize_t (*store)(struct sysdev_class *, const char *, size_t);
44};
45
46#define SYSDEV_CLASS_ATTR(_name,_mode,_show,_store) \
47struct sysdev_class_attribute attr_##_name = { \
48 .attr = {.name = __stringify(_name), .mode = _mode }, \
49 .show = _show, \
50 .store = _store, \
51};
52
40 53
41extern int sysdev_class_register(struct sysdev_class *); 54extern int sysdev_class_register(struct sysdev_class *);
42extern void sysdev_class_unregister(struct sysdev_class *); 55extern void sysdev_class_unregister(struct sysdev_class *);
43 56
44 57extern int sysdev_class_create_file(struct sysdev_class *,
58 struct sysdev_class_attribute *);
59extern void sysdev_class_remove_file(struct sysdev_class *,
60 struct sysdev_class_attribute *);
45/** 61/**
46 * Auxillary system device drivers. 62 * Auxillary system device drivers.
47 */ 63 */
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 420a689c3fb4..8ebf497907f8 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -18,7 +18,6 @@
18#define _LINUX_TCP_H 18#define _LINUX_TCP_H
19 19
20#include <linux/types.h> 20#include <linux/types.h>
21#include <linux/dmaengine.h>
22#include <asm/byteorder.h> 21#include <asm/byteorder.h>
23 22
24struct tcphdr { 23struct tcphdr {
@@ -161,6 +160,7 @@ struct tcp_info
161#ifdef __KERNEL__ 160#ifdef __KERNEL__
162 161
163#include <linux/skbuff.h> 162#include <linux/skbuff.h>
163#include <linux/dmaengine.h>
164#include <net/sock.h> 164#include <net/sock.h>
165#include <net/inet_connection_sock.h> 165#include <net/inet_connection_sock.h>
166#include <net/inet_timewait_sock.h> 166#include <net/inet_timewait_sock.h>
diff --git a/include/linux/tty.h b/include/linux/tty.h
index e898eeb94166..cb35ca50a0a6 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -290,7 +290,9 @@ extern int tty_register_ldisc(int disc, struct tty_ldisc *new_ldisc);
290extern int tty_unregister_ldisc(int disc); 290extern int tty_unregister_ldisc(int disc);
291extern int tty_register_driver(struct tty_driver *driver); 291extern int tty_register_driver(struct tty_driver *driver);
292extern int tty_unregister_driver(struct tty_driver *driver); 292extern int tty_unregister_driver(struct tty_driver *driver);
293extern void tty_register_device(struct tty_driver *driver, unsigned index, struct device *dev); 293extern struct class_device *tty_register_device(struct tty_driver *driver,
294 unsigned index,
295 struct device *dev);
294extern void tty_unregister_device(struct tty_driver *driver, unsigned index); 296extern void tty_unregister_device(struct tty_driver *driver, unsigned index);
295extern int tty_read_raw_data(struct tty_struct *tty, unsigned char *bufp, 297extern int tty_read_raw_data(struct tty_struct *tty, unsigned char *bufp,
296 int buflen); 298 int buflen);
diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h
new file mode 100644
index 000000000000..391e7ed1eb3f
--- /dev/null
+++ b/include/linux/uaccess.h
@@ -0,0 +1,22 @@
1#ifndef __LINUX_UACCESS_H__
2#define __LINUX_UACCESS_H__
3
4#include <asm/uaccess.h>
5
6#ifndef ARCH_HAS_NOCACHE_UACCESS
7
8static inline unsigned long __copy_from_user_inatomic_nocache(void *to,
9 const void __user *from, unsigned long n)
10{
11 return __copy_from_user_inatomic(to, from, n);
12}
13
14static inline unsigned long __copy_from_user_nocache(void *to,
15 const void __user *from, unsigned long n)
16{
17 return __copy_from_user(to, from, n);
18}
19
20#endif /* ARCH_HAS_NOCACHE_UACCESS */
21
22#endif /* __LINUX_UACCESS_H__ */
diff --git a/include/linux/ufs_fs.h b/include/linux/ufs_fs.h
index 86b5b4271b5a..914f911325be 100644
--- a/include/linux/ufs_fs.h
+++ b/include/linux/ufs_fs.h
@@ -220,6 +220,19 @@ typedef __u16 __bitwise __fs16;
220 */ 220 */
221#define UFS_MINFREE 5 221#define UFS_MINFREE 5
222#define UFS_DEFAULTOPT UFS_OPTTIME 222#define UFS_DEFAULTOPT UFS_OPTTIME
223
224/*
225 * Debug code
226 */
227#ifdef CONFIG_UFS_DEBUG
228# define UFSD(f, a...) { \
229 printk ("UFSD (%s, %d): %s:", \
230 __FILE__, __LINE__, __FUNCTION__); \
231 printk (f, ## a); \
232 }
233#else
234# define UFSD(f, a...) /**/
235#endif
223 236
224/* 237/*
225 * Turn file system block numbers into disk block addresses. 238 * Turn file system block numbers into disk block addresses.
@@ -339,7 +352,22 @@ struct ufs2_csum_total {
339}; 352};
340 353
341/* 354/*
355 * File system flags
356 */
357#define UFS_UNCLEAN 0x01 /* file system not clean at mount (unused) */
358#define UFS_DOSOFTDEP 0x02 /* file system using soft dependencies */
359#define UFS_NEEDSFSCK 0x04 /* needs sync fsck (FreeBSD compat, unused) */
360#define UFS_INDEXDIRS 0x08 /* kernel supports indexed directories */
361#define UFS_ACLS 0x10 /* file system has ACLs enabled */
362#define UFS_MULTILABEL 0x20 /* file system is MAC multi-label */
363#define UFS_FLAGS_UPDATED 0x80 /* flags have been moved to new location */
364
365#if 0
366/*
342 * This is the actual superblock, as it is laid out on the disk. 367 * This is the actual superblock, as it is laid out on the disk.
368 * Do NOT use this structure, because of sizeof(ufs_super_block) > 512 and
369 * it may occupy several blocks, use
370 * struct ufs_super_block_(first,second,third) instead.
343 */ 371 */
344struct ufs_super_block { 372struct ufs_super_block {
345 __fs32 fs_link; /* UNUSED */ 373 __fs32 fs_link; /* UNUSED */
@@ -416,7 +444,7 @@ struct ufs_super_block {
416 __s8 fs_fmod; /* super block modified flag */ 444 __s8 fs_fmod; /* super block modified flag */
417 __s8 fs_clean; /* file system is clean flag */ 445 __s8 fs_clean; /* file system is clean flag */
418 __s8 fs_ronly; /* mounted read-only flag */ 446 __s8 fs_ronly; /* mounted read-only flag */
419 __s8 fs_flags; /* currently unused flag */ 447 __s8 fs_flags;
420 union { 448 union {
421 struct { 449 struct {
422 __s8 fs_fsmnt[UFS_MAXMNTLEN];/* name mounted on */ 450 __s8 fs_fsmnt[UFS_MAXMNTLEN];/* name mounted on */
@@ -485,6 +513,7 @@ struct ufs_super_block {
485 __fs32 fs_magic; /* magic number */ 513 __fs32 fs_magic; /* magic number */
486 __u8 fs_space[1]; /* list of blocks for each rotation */ 514 __u8 fs_space[1]; /* list of blocks for each rotation */
487}; 515};
516#endif/*struct ufs_super_block*/
488 517
489/* 518/*
490 * Preference for optimization. 519 * Preference for optimization.
@@ -666,7 +695,7 @@ struct ufs_buffer_head {
666}; 695};
667 696
668struct ufs_cg_private_info { 697struct ufs_cg_private_info {
669 struct ufs_cylinder_group ucg; 698 struct ufs_buffer_head c_ubh;
670 __u32 c_cgx; /* number of cylidner group */ 699 __u32 c_cgx; /* number of cylidner group */
671 __u16 c_ncyl; /* number of cyl's this cg */ 700 __u16 c_ncyl; /* number of cyl's this cg */
672 __u16 c_niblk; /* number of inode blocks this cg */ 701 __u16 c_niblk; /* number of inode blocks this cg */
@@ -686,6 +715,7 @@ struct ufs_cg_private_info {
686 715
687struct ufs_sb_private_info { 716struct ufs_sb_private_info {
688 struct ufs_buffer_head s_ubh; /* buffer containing super block */ 717 struct ufs_buffer_head s_ubh; /* buffer containing super block */
718 struct ufs2_csum_total cs_total;
689 __u32 s_sblkno; /* offset of super-blocks in filesys */ 719 __u32 s_sblkno; /* offset of super-blocks in filesys */
690 __u32 s_cblkno; /* offset of cg-block in filesys */ 720 __u32 s_cblkno; /* offset of cg-block in filesys */
691 __u32 s_iblkno; /* offset of inode-blocks in filesys */ 721 __u32 s_iblkno; /* offset of inode-blocks in filesys */
@@ -824,16 +854,54 @@ struct ufs_super_block_first {
824}; 854};
825 855
826struct ufs_super_block_second { 856struct ufs_super_block_second {
827 __s8 fs_fsmnt[212]; 857 union {
828 __fs32 fs_cgrotor; 858 struct {
829 __fs32 fs_csp[UFS_MAXCSBUFS]; 859 __s8 fs_fsmnt[212];
830 __fs32 fs_maxcluster; 860 __fs32 fs_cgrotor;
831 __fs32 fs_cpc; 861 __fs32 fs_csp[UFS_MAXCSBUFS];
832 __fs16 fs_opostbl[82]; 862 __fs32 fs_maxcluster;
833}; 863 __fs32 fs_cpc;
864 __fs16 fs_opostbl[82];
865 } fs_u1;
866 struct {
867 __s8 fs_fsmnt[UFS2_MAXMNTLEN - UFS_MAXMNTLEN + 212];
868 __u8 fs_volname[UFS2_MAXVOLLEN];
869 __fs64 fs_swuid;
870 __fs32 fs_pad;
871 __fs32 fs_cgrotor;
872 __fs32 fs_ocsp[UFS2_NOCSPTRS];
873 __fs32 fs_contigdirs;
874 __fs32 fs_csp;
875 __fs32 fs_maxcluster;
876 __fs32 fs_active;
877 __fs32 fs_old_cpc;
878 __fs32 fs_maxbsize;
879 __fs64 fs_sparecon64[17];
880 __fs64 fs_sblockloc;
881 __fs64 cs_ndir;
882 __fs64 cs_nbfree;
883 } fs_u2;
884 } fs_un;
885};
834 886
835struct ufs_super_block_third { 887struct ufs_super_block_third {
836 __fs16 fs_opostbl[46]; 888 union {
889 struct {
890 __fs16 fs_opostbl[46];
891 } fs_u1;
892 struct {
893 __fs64 cs_nifree; /* number of free inodes */
894 __fs64 cs_nffree; /* number of free frags */
895 __fs64 cs_numclusters; /* number of free clusters */
896 __fs64 cs_spare[3]; /* future expansion */
897 struct ufs_timeval fs_time; /* last time written */
898 __fs64 fs_size; /* number of blocks in fs */
899 __fs64 fs_dsize; /* number of data blocks in fs */
900 __fs64 fs_csaddr; /* blk addr of cyl grp summary area */
901 __fs64 fs_pendingblocks;/* blocks in process of being freed */
902 __fs32 fs_pendinginodes;/*inodes in process of being freed */
903 } fs_u2;
904 } fs_un1;
837 union { 905 union {
838 struct { 906 struct {
839 __fs32 fs_sparecon[53];/* reserved for future constants */ 907 __fs32 fs_sparecon[53];/* reserved for future constants */
@@ -861,7 +929,7 @@ struct ufs_super_block_third {
861 __fs32 fs_qfmask[2]; /* ~usb_fmask */ 929 __fs32 fs_qfmask[2]; /* ~usb_fmask */
862 __fs32 fs_state; /* file system state time stamp */ 930 __fs32 fs_state; /* file system state time stamp */
863 } fs_44; 931 } fs_44;
864 } fs_u2; 932 } fs_un2;
865 __fs32 fs_postblformat; 933 __fs32 fs_postblformat;
866 __fs32 fs_nrpos; 934 __fs32 fs_nrpos;
867 __fs32 fs_postbloff; 935 __fs32 fs_postbloff;
@@ -875,7 +943,8 @@ struct ufs_super_block_third {
875/* balloc.c */ 943/* balloc.c */
876extern void ufs_free_fragments (struct inode *, unsigned, unsigned); 944extern void ufs_free_fragments (struct inode *, unsigned, unsigned);
877extern void ufs_free_blocks (struct inode *, unsigned, unsigned); 945extern void ufs_free_blocks (struct inode *, unsigned, unsigned);
878extern unsigned ufs_new_fragments (struct inode *, __fs32 *, unsigned, unsigned, unsigned, int *); 946extern unsigned ufs_new_fragments(struct inode *, __fs32 *, unsigned, unsigned,
947 unsigned, int *, struct page *);
879 948
880/* cylinder.c */ 949/* cylinder.c */
881extern struct ufs_cg_private_info * ufs_load_cylinder (struct super_block *, unsigned); 950extern struct ufs_cg_private_info * ufs_load_cylinder (struct super_block *, unsigned);
@@ -886,11 +955,12 @@ extern struct inode_operations ufs_dir_inode_operations;
886extern int ufs_add_link (struct dentry *, struct inode *); 955extern int ufs_add_link (struct dentry *, struct inode *);
887extern ino_t ufs_inode_by_name(struct inode *, struct dentry *); 956extern ino_t ufs_inode_by_name(struct inode *, struct dentry *);
888extern int ufs_make_empty(struct inode *, struct inode *); 957extern int ufs_make_empty(struct inode *, struct inode *);
889extern struct ufs_dir_entry * ufs_find_entry (struct dentry *, struct buffer_head **); 958extern struct ufs_dir_entry *ufs_find_entry(struct inode *, struct dentry *, struct page **);
890extern int ufs_delete_entry (struct inode *, struct ufs_dir_entry *, struct buffer_head *); 959extern int ufs_delete_entry(struct inode *, struct ufs_dir_entry *, struct page *);
891extern int ufs_empty_dir (struct inode *); 960extern int ufs_empty_dir (struct inode *);
892extern struct ufs_dir_entry * ufs_dotdot (struct inode *, struct buffer_head **); 961extern struct ufs_dir_entry *ufs_dotdot(struct inode *, struct page **);
893extern void ufs_set_link(struct inode *, struct ufs_dir_entry *, struct buffer_head *, struct inode *); 962extern void ufs_set_link(struct inode *dir, struct ufs_dir_entry *de,
963 struct page *page, struct inode *inode);
894 964
895/* file.c */ 965/* file.c */
896extern struct inode_operations ufs_file_inode_operations; 966extern struct inode_operations ufs_file_inode_operations;
@@ -903,13 +973,11 @@ extern void ufs_free_inode (struct inode *inode);
903extern struct inode * ufs_new_inode (struct inode *, int); 973extern struct inode * ufs_new_inode (struct inode *, int);
904 974
905/* inode.c */ 975/* inode.c */
906extern u64 ufs_frag_map (struct inode *, sector_t);
907extern void ufs_read_inode (struct inode *); 976extern void ufs_read_inode (struct inode *);
908extern void ufs_put_inode (struct inode *); 977extern void ufs_put_inode (struct inode *);
909extern int ufs_write_inode (struct inode *, int); 978extern int ufs_write_inode (struct inode *, int);
910extern int ufs_sync_inode (struct inode *); 979extern int ufs_sync_inode (struct inode *);
911extern void ufs_delete_inode (struct inode *); 980extern void ufs_delete_inode (struct inode *);
912extern struct buffer_head * ufs_getfrag (struct inode *, unsigned, int, int *);
913extern struct buffer_head * ufs_bread (struct inode *, unsigned, int, int *); 981extern struct buffer_head * ufs_bread (struct inode *, unsigned, int, int *);
914extern int ufs_getfrag_block (struct inode *inode, sector_t fragment, struct buffer_head *bh_result, int create); 982extern int ufs_getfrag_block (struct inode *inode, sector_t fragment, struct buffer_head *bh_result, int create);
915 983
diff --git a/include/linux/ufs_fs_i.h b/include/linux/ufs_fs_i.h
index 21665a953978..f50ce3b0cd52 100644
--- a/include/linux/ufs_fs_i.h
+++ b/include/linux/ufs_fs_i.h
@@ -27,6 +27,7 @@ struct ufs_inode_info {
27 __u32 i_oeftflag; 27 __u32 i_oeftflag;
28 __u16 i_osync; 28 __u16 i_osync;
29 __u32 i_lastfrag; 29 __u32 i_lastfrag;
30 __u32 i_dir_start_lookup;
30 struct inode vfs_inode; 31 struct inode vfs_inode;
31}; 32};
32 33
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 1f492c0c7047..8dead32e7ebf 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -40,6 +40,8 @@ struct usb_driver;
40 * Devices may also have class-specific or vendor-specific descriptors. 40 * Devices may also have class-specific or vendor-specific descriptors.
41 */ 41 */
42 42
43struct ep_device;
44
43/** 45/**
44 * struct usb_host_endpoint - host-side endpoint descriptor and queue 46 * struct usb_host_endpoint - host-side endpoint descriptor and queue
45 * @desc: descriptor for this endpoint, wMaxPacketSize in native byteorder 47 * @desc: descriptor for this endpoint, wMaxPacketSize in native byteorder
@@ -57,7 +59,7 @@ struct usb_host_endpoint {
57 struct usb_endpoint_descriptor desc; 59 struct usb_endpoint_descriptor desc;
58 struct list_head urb_list; 60 struct list_head urb_list;
59 void *hcpriv; 61 void *hcpriv;
60 struct kobject *kobj; /* For sysfs info */ 62 struct ep_device *ep_dev; /* For sysfs info */
61 63
62 unsigned char *extra; /* Extra descriptors */ 64 unsigned char *extra; /* Extra descriptors */
63 int extralen; 65 int extralen;
@@ -101,7 +103,8 @@ enum usb_interface_condition {
101 * @condition: binding state of the interface: not bound, binding 103 * @condition: binding state of the interface: not bound, binding
102 * (in probe()), bound to a driver, or unbinding (in disconnect()) 104 * (in probe()), bound to a driver, or unbinding (in disconnect())
103 * @dev: driver model's view of this device 105 * @dev: driver model's view of this device
104 * @class_dev: driver model's class view of this device. 106 * @usb_dev: if an interface is bound to the USB major, this will point
107 * to the sysfs representation for that device.
105 * 108 *
106 * USB device drivers attach to interfaces on a physical device. Each 109 * USB device drivers attach to interfaces on a physical device. Each
107 * interface encapsulates a single high level function, such as feeding 110 * interface encapsulates a single high level function, such as feeding
@@ -141,7 +144,7 @@ struct usb_interface {
141 * bound to */ 144 * bound to */
142 enum usb_interface_condition condition; /* state of binding */ 145 enum usb_interface_condition condition; /* state of binding */
143 struct device dev; /* interface specific device info */ 146 struct device dev; /* interface specific device info */
144 struct class_device *class_dev; 147 struct device *usb_dev; /* pointer to the usb class's device, if any */
145}; 148};
146#define to_usb_interface(d) container_of(d, struct usb_interface, dev) 149#define to_usb_interface(d) container_of(d, struct usb_interface, dev)
147#define interface_to_usbdev(intf) \ 150#define interface_to_usbdev(intf) \
@@ -358,7 +361,7 @@ struct usb_device {
358 char *serial; /* iSerialNumber string, if present */ 361 char *serial; /* iSerialNumber string, if present */
359 362
360 struct list_head filelist; 363 struct list_head filelist;
361 struct class_device *class_dev; 364 struct device *usbfs_dev;
362 struct dentry *usbfs_dentry; /* usbfs dentry entry for the device */ 365 struct dentry *usbfs_dentry; /* usbfs dentry entry for the device */
363 366
364 /* 367 /*
@@ -386,6 +389,8 @@ extern int usb_lock_device_for_reset(struct usb_device *udev,
386 389
387/* USB port reset for device reinitialization */ 390/* USB port reset for device reinitialization */
388extern int usb_reset_device(struct usb_device *dev); 391extern int usb_reset_device(struct usb_device *dev);
392extern int usb_reset_composite_device(struct usb_device *dev,
393 struct usb_interface *iface);
389 394
390extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id); 395extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id);
391 396
@@ -554,6 +559,10 @@ struct usb_dynids {
554 * do (or don't) show up otherwise in the filesystem. 559 * do (or don't) show up otherwise in the filesystem.
555 * @suspend: Called when the device is going to be suspended by the system. 560 * @suspend: Called when the device is going to be suspended by the system.
556 * @resume: Called when the device is being resumed by the system. 561 * @resume: Called when the device is being resumed by the system.
562 * @pre_reset: Called by usb_reset_composite_device() when the device
563 * is about to be reset.
564 * @post_reset: Called by usb_reset_composite_device() after the device
565 * has been reset.
557 * @id_table: USB drivers use ID table to support hotplugging. 566 * @id_table: USB drivers use ID table to support hotplugging.
558 * Export this with MODULE_DEVICE_TABLE(usb,...). This must be set 567 * Export this with MODULE_DEVICE_TABLE(usb,...). This must be set
559 * or your driver's probe function will never get called. 568 * or your driver's probe function will never get called.
@@ -592,6 +601,9 @@ struct usb_driver {
592 int (*suspend) (struct usb_interface *intf, pm_message_t message); 601 int (*suspend) (struct usb_interface *intf, pm_message_t message);
593 int (*resume) (struct usb_interface *intf); 602 int (*resume) (struct usb_interface *intf);
594 603
604 void (*pre_reset) (struct usb_interface *intf);
605 void (*post_reset) (struct usb_interface *intf);
606
595 const struct usb_device_id *id_table; 607 const struct usb_device_id *id_table;
596 608
597 struct usb_dynids dynids; 609 struct usb_dynids dynids;
@@ -1008,6 +1020,8 @@ void usb_buffer_unmap_sg (struct usb_device *dev, unsigned pipe,
1008extern int usb_control_msg(struct usb_device *dev, unsigned int pipe, 1020extern int usb_control_msg(struct usb_device *dev, unsigned int pipe,
1009 __u8 request, __u8 requesttype, __u16 value, __u16 index, 1021 __u8 request, __u8 requesttype, __u16 value, __u16 index,
1010 void *data, __u16 size, int timeout); 1022 void *data, __u16 size, int timeout);
1023extern int usb_interrupt_msg(struct usb_device *usb_dev, unsigned int pipe,
1024 void *data, int len, int *actual_length, int timeout);
1011extern int usb_bulk_msg(struct usb_device *usb_dev, unsigned int pipe, 1025extern int usb_bulk_msg(struct usb_device *usb_dev, unsigned int pipe,
1012 void *data, int len, int *actual_length, 1026 void *data, int len, int *actual_length,
1013 int timeout); 1027 int timeout);
diff --git a/include/linux/usb_cdc.h b/include/linux/usb/cdc.h
index ba617c372455..ba617c372455 100644
--- a/include/linux/usb_cdc.h
+++ b/include/linux/usb/cdc.h
diff --git a/include/linux/usb_input.h b/include/linux/usb/input.h
index 716e0cc16043..716e0cc16043 100644
--- a/include/linux/usb_input.h
+++ b/include/linux/usb/input.h
diff --git a/include/linux/usb_isp116x.h b/include/linux/usb/isp116x.h
index 436dd8a2b64a..436dd8a2b64a 100644
--- a/include/linux/usb_isp116x.h
+++ b/include/linux/usb/isp116x.h
diff --git a/include/linux/usb_sl811.h b/include/linux/usb/sl811.h
index 4f2d012d7309..397ee3b3d7f3 100644
--- a/include/linux/usb_sl811.h
+++ b/include/linux/usb/sl811.h
@@ -14,13 +14,13 @@ struct sl811_platform_data {
14 u8 power; 14 u8 power;
15 15
16 /* sl811 relies on an external source of VBUS current */ 16 /* sl811 relies on an external source of VBUS current */
17 void (*port_power)(struct device *dev, int is_on); 17 void (*port_power)(struct device *dev, int is_on);
18 18
19 /* pulse sl811 nRST (probably with a GPIO) */ 19 /* pulse sl811 nRST (probably with a GPIO) */
20 void (*reset)(struct device *dev); 20 void (*reset)(struct device *dev);
21 21
22 // some boards need something like these: 22 // some boards need something like these:
23 // int (*check_overcurrent)(struct device *dev); 23 // int (*check_overcurrent)(struct device *dev);
24 // void (*clock_enable)(struct device *dev, int is_on); 24 // void (*clock_enable)(struct device *dev, int is_on);
25}; 25};
26 26
diff --git a/include/linux/videodev.h b/include/linux/videodev.h
index 91140091ced2..41bc7e9603cd 100644
--- a/include/linux/videodev.h
+++ b/include/linux/videodev.h
@@ -1,49 +1,21 @@
1/*
2 * Video for Linux version 1 - OBSOLETE
3 *
4 * Header file for v4l1 drivers and applications, for
5 * Linux kernels 2.2.x or 2.4.x.
6 *
7 * Provides header for legacy drivers and applications
8 *
9 * See http://linuxtv.org for more info
10 *
11 */
1#ifndef __LINUX_VIDEODEV_H 12#ifndef __LINUX_VIDEODEV_H
2#define __LINUX_VIDEODEV_H 13#define __LINUX_VIDEODEV_H
3 14
4#include <linux/types.h>
5
6#define HAVE_V4L1 1 15#define HAVE_V4L1 1
7 16
8#include <linux/videodev2.h> 17#include <linux/videodev2.h>
9 18
10#ifdef __KERNEL__
11
12#include <linux/mm.h>
13
14extern struct video_device* video_devdata(struct file*);
15
16#define to_video_device(cd) container_of(cd, struct video_device, class_dev)
17static inline void
18video_device_create_file(struct video_device *vfd,
19 struct class_device_attribute *attr)
20{
21 class_device_create_file(&vfd->class_dev, attr);
22}
23static inline void
24video_device_remove_file(struct video_device *vfd,
25 struct class_device_attribute *attr)
26{
27 class_device_remove_file(&vfd->class_dev, attr);
28}
29
30#if OBSOLETE_OWNER /* to be removed in 2.6.15 */
31/* helper functions to access driver private data. */
32static inline void *video_get_drvdata(struct video_device *dev)
33{
34 return dev->priv;
35}
36
37static inline void video_set_drvdata(struct video_device *dev, void *data)
38{
39 dev->priv = data;
40}
41#endif
42
43extern int video_exclusive_open(struct inode *inode, struct file *file);
44extern int video_exclusive_release(struct inode *inode, struct file *file);
45#endif /* __KERNEL__ */
46
47struct video_capability 19struct video_capability
48{ 20{
49 char name[32]; 21 char name[32];
@@ -363,6 +335,7 @@ struct video_code
363#define VID_HARDWARE_SAA7114H 37 335#define VID_HARDWARE_SAA7114H 37
364#define VID_HARDWARE_SN9C102 38 336#define VID_HARDWARE_SN9C102 38
365#define VID_HARDWARE_ARV 39 337#define VID_HARDWARE_ARV 39
338
366#endif /* __LINUX_VIDEODEV_H */ 339#endif /* __LINUX_VIDEODEV_H */
367 340
368/* 341/*
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index ad7fa9c86c10..4f428547ec09 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -1,35 +1,33 @@
1#ifndef __LINUX_VIDEODEV2_H
2#define __LINUX_VIDEODEV2_H
3/* 1/*
4 * Video for Linux Two 2 * Video for Linux Two
5 * 3 *
6 * Header file for v4l or V4L2 drivers and applications, for 4 * Header file for v4l or V4L2 drivers and applications
7 * Linux kernels 2.2.x or 2.4.x. 5 * with public API.
6 * All kernel-specific stuff were moved to media/v4l2-dev.h, so
7 * no #if __KERNEL tests are allowed here
8 * 8 *
9 * See http://bytesex.org/v4l/ for API specs and other 9 * See http://linuxtv.org for more info
10 * v4l2 documentation.
11 * 10 *
12 * Author: Bill Dirks <bdirks@pacbell.net> 11 * Author: Bill Dirks <bdirks@pacbell.net>
13 * Justin Schoeman 12 * Justin Schoeman
14 * et al. 13 * et al.
15 */ 14 */
15#ifndef __LINUX_VIDEODEV2_H
16#define __LINUX_VIDEODEV2_H
16#ifdef __KERNEL__ 17#ifdef __KERNEL__
17#include <linux/time.h> /* need struct timeval */ 18#include <linux/time.h> /* need struct timeval */
18#include <linux/poll.h>
19#include <linux/device.h>
20#include <linux/mutex.h>
21#endif
22#include <linux/compiler.h> /* need __user */ 19#include <linux/compiler.h> /* need __user */
20#else
21#define __user
22#endif
23#include <linux/types.h>
23 24
24
25#define OBSOLETE_OWNER 1 /* It will be removed for 2.6.17 */
26#define HAVE_V4L2 1 25#define HAVE_V4L2 1
27 26
28/* 27/*
29 * Common stuff for both V4L1 and V4L2 28 * Common stuff for both V4L1 and V4L2
30 * Moved from videodev.h 29 * Moved from videodev.h
31 */ 30 */
32
33#define VIDEO_MAX_FRAME 32 31#define VIDEO_MAX_FRAME 32
34 32
35#define VID_TYPE_CAPTURE 1 /* Can capture */ 33#define VID_TYPE_CAPTURE 1 /* Can capture */
@@ -47,71 +45,6 @@
47#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */ 45#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */
48#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */ 46#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */
49 47
50#ifdef __KERNEL__
51
52/* Minor device allocation */
53#define MINOR_VFL_TYPE_GRABBER_MIN 0
54#define MINOR_VFL_TYPE_GRABBER_MAX 63
55#define MINOR_VFL_TYPE_RADIO_MIN 64
56#define MINOR_VFL_TYPE_RADIO_MAX 127
57#define MINOR_VFL_TYPE_VTX_MIN 192
58#define MINOR_VFL_TYPE_VTX_MAX 223
59#define MINOR_VFL_TYPE_VBI_MIN 224
60#define MINOR_VFL_TYPE_VBI_MAX 255
61
62#define VFL_TYPE_GRABBER 0
63#define VFL_TYPE_VBI 1
64#define VFL_TYPE_RADIO 2
65#define VFL_TYPE_VTX 3
66
67struct video_device
68{
69 /* device info */
70 struct device *dev;
71 char name[32];
72 int type; /* v4l1 */
73 int type2; /* v4l2 */
74 int hardware;
75 int minor;
76
77 /* device ops + callbacks */
78 const struct file_operations *fops;
79 void (*release)(struct video_device *vfd);
80
81
82#if OBSOLETE_OWNER /* to be removed in 2.6.15 */
83 /* obsolete -- fops->owner is used instead */
84 struct module *owner;
85 /* dev->driver_data will be used instead some day.
86 * Use the video_{get|set}_drvdata() helper functions,
87 * so the switch over will be transparent for you.
88 * Or use {pci|usb}_{get|set}_drvdata() directly. */
89 void *priv;
90#endif
91
92 /* for videodev.c intenal usage -- please don't touch */
93 int users; /* video_exclusive_{open|close} ... */
94 struct mutex lock; /* ... helper function uses these */
95 char devfs_name[64]; /* devfs */
96 struct class_device class_dev; /* sysfs */
97};
98
99#define VIDEO_MAJOR 81
100
101extern int video_register_device(struct video_device *, int type, int nr);
102extern void video_unregister_device(struct video_device *);
103extern int video_usercopy(struct inode *inode, struct file *file,
104 unsigned int cmd, unsigned long arg,
105 int (*func)(struct inode *inode, struct file *file,
106 unsigned int cmd, void *arg));
107
108/* helper functions to alloc / release struct video_device, the
109 later can be used for video_device->release() */
110struct video_device *video_device_alloc(void);
111void video_device_release(struct video_device *vfd);
112
113#endif
114
115/* 48/*
116 * M I S C E L L A N E O U S 49 * M I S C E L L A N E O U S
117 */ 50 */
@@ -172,6 +105,8 @@ enum v4l2_ctrl_type {
172 V4L2_CTRL_TYPE_BOOLEAN = 2, 105 V4L2_CTRL_TYPE_BOOLEAN = 2,
173 V4L2_CTRL_TYPE_MENU = 3, 106 V4L2_CTRL_TYPE_MENU = 3,
174 V4L2_CTRL_TYPE_BUTTON = 4, 107 V4L2_CTRL_TYPE_BUTTON = 4,
108 V4L2_CTRL_TYPE_INTEGER64 = 5,
109 V4L2_CTRL_TYPE_CTRL_CLASS = 6,
175}; 110};
176 111
177enum v4l2_tuner_type { 112enum v4l2_tuner_type {
@@ -270,7 +205,6 @@ struct v4l2_capability
270/* 205/*
271 * V I D E O I M A G E F O R M A T 206 * V I D E O I M A G E F O R M A T
272 */ 207 */
273
274struct v4l2_pix_format 208struct v4l2_pix_format
275{ 209{
276 __u32 width; 210 __u32 width;
@@ -283,7 +217,7 @@ struct v4l2_pix_format
283 __u32 priv; /* private data, depends on pixelformat */ 217 __u32 priv; /* private data, depends on pixelformat */
284}; 218};
285 219
286/* Pixel format FOURCC depth Description */ 220/* Pixel format FOURCC depth Description */
287#define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R','G','B','1') /* 8 RGB-3-3-2 */ 221#define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R','G','B','1') /* 8 RGB-3-3-2 */
288#define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R','G','B','O') /* 16 RGB-5-5-5 */ 222#define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R','G','B','O') /* 16 RGB-5-5-5 */
289#define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R','G','B','P') /* 16 RGB-5-6-5 */ 223#define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R','G','B','P') /* 16 RGB-5-6-5 */
@@ -319,7 +253,7 @@ struct v4l2_pix_format
319#define V4L2_PIX_FMT_MJPEG v4l2_fourcc('M','J','P','G') /* Motion-JPEG */ 253#define V4L2_PIX_FMT_MJPEG v4l2_fourcc('M','J','P','G') /* Motion-JPEG */
320#define V4L2_PIX_FMT_JPEG v4l2_fourcc('J','P','E','G') /* JFIF JPEG */ 254#define V4L2_PIX_FMT_JPEG v4l2_fourcc('J','P','E','G') /* JFIF JPEG */
321#define V4L2_PIX_FMT_DV v4l2_fourcc('d','v','s','d') /* 1394 */ 255#define V4L2_PIX_FMT_DV v4l2_fourcc('d','v','s','d') /* 1394 */
322#define V4L2_PIX_FMT_MPEG v4l2_fourcc('M','P','E','G') /* MPEG */ 256#define V4L2_PIX_FMT_MPEG v4l2_fourcc('M','P','E','G') /* MPEG-1/2/4 */
323 257
324/* Vendor-specific formats */ 258/* Vendor-specific formats */
325#define V4L2_PIX_FMT_WNVA v4l2_fourcc('W','N','V','A') /* Winnov hw compress */ 259#define V4L2_PIX_FMT_WNVA v4l2_fourcc('W','N','V','A') /* Winnov hw compress */
@@ -343,7 +277,6 @@ struct v4l2_fmtdesc
343 277
344#define V4L2_FMT_FLAG_COMPRESSED 0x0001 278#define V4L2_FMT_FLAG_COMPRESSED 0x0001
345 279
346
347/* 280/*
348 * T I M E C O D E 281 * T I M E C O D E
349 */ 282 */
@@ -373,16 +306,15 @@ struct v4l2_timecode
373#define V4L2_TC_USERBITS_8BITCHARS 0x0008 306#define V4L2_TC_USERBITS_8BITCHARS 0x0008
374/* The above is based on SMPTE timecodes */ 307/* The above is based on SMPTE timecodes */
375 308
376 309#ifdef __KERNEL__
377/* 310/*
378 * M P E G C O M P R E S S I O N P A R A M E T E R S 311 * M P E G C O M P R E S S I O N P A R A M E T E R S
379 * 312 *
380 * ### WARNING: this is still work-in-progress right now, most likely 313 * ### WARNING: This experimental MPEG compression API is obsolete.
381 * ### there will be some incompatible changes. 314 * ### It is replaced by the MPEG controls API.
315 * ### This old API will disappear in the near future!
382 * 316 *
383 */ 317 */
384
385
386enum v4l2_bitrate_mode { 318enum v4l2_bitrate_mode {
387 V4L2_BITRATE_NONE = 0, /* not specified */ 319 V4L2_BITRATE_NONE = 0, /* not specified */
388 V4L2_BITRATE_CBR, /* constant bitrate */ 320 V4L2_BITRATE_CBR, /* constant bitrate */
@@ -460,6 +392,7 @@ struct v4l2_mpeg_compression {
460 /* I don't expect the above being perfect yet ;) */ 392 /* I don't expect the above being perfect yet ;) */
461 __u32 reserved_5[8]; 393 __u32 reserved_5[8];
462}; 394};
395#endif
463 396
464struct v4l2_jpegcompression 397struct v4l2_jpegcompression
465{ 398{
@@ -491,7 +424,6 @@ struct v4l2_jpegcompression
491 * allways use APP0 */ 424 * allways use APP0 */
492}; 425};
493 426
494
495/* 427/*
496 * M E M O R Y - M A P P I N G B U F F E R S 428 * M E M O R Y - M A P P I N G B U F F E R S
497 */ 429 */
@@ -573,7 +505,6 @@ struct v4l2_window
573 void __user *bitmap; 505 void __user *bitmap;
574}; 506};
575 507
576
577/* 508/*
578 * C A P T U R E P A R A M E T E R S 509 * C A P T U R E P A R A M E T E R S
579 */ 510 */
@@ -586,6 +517,7 @@ struct v4l2_captureparm
586 __u32 readbuffers; /* # of buffers for read */ 517 __u32 readbuffers; /* # of buffers for read */
587 __u32 reserved[4]; 518 __u32 reserved[4];
588}; 519};
520
589/* Flags for 'capability' and 'capturemode' fields */ 521/* Flags for 'capability' and 'capturemode' fields */
590#define V4L2_MODE_HIGHQUALITY 0x0001 /* High quality imaging mode */ 522#define V4L2_MODE_HIGHQUALITY 0x0001 /* High quality imaging mode */
591#define V4L2_CAP_TIMEPERFRAME 0x1000 /* timeperframe field is supported */ 523#define V4L2_CAP_TIMEPERFRAME 0x1000 /* timeperframe field is supported */
@@ -603,7 +535,6 @@ struct v4l2_outputparm
603/* 535/*
604 * I N P U T I M A G E C R O P P I N G 536 * I N P U T I M A G E C R O P P I N G
605 */ 537 */
606
607struct v4l2_cropcap { 538struct v4l2_cropcap {
608 enum v4l2_buf_type type; 539 enum v4l2_buf_type type;
609 struct v4l2_rect bounds; 540 struct v4l2_rect bounds;
@@ -710,7 +641,6 @@ struct v4l2_standard
710 __u32 reserved[4]; 641 __u32 reserved[4];
711}; 642};
712 643
713
714/* 644/*
715 * V I D E O I N P U T S 645 * V I D E O I N P U T S
716 */ 646 */
@@ -725,6 +655,7 @@ struct v4l2_input
725 __u32 status; 655 __u32 status;
726 __u32 reserved[4]; 656 __u32 reserved[4];
727}; 657};
658
728/* Values for the 'type' field */ 659/* Values for the 'type' field */
729#define V4L2_INPUT_TYPE_TUNER 1 660#define V4L2_INPUT_TYPE_TUNER 1
730#define V4L2_INPUT_TYPE_CAMERA 2 661#define V4L2_INPUT_TYPE_CAMERA 2
@@ -775,6 +706,34 @@ struct v4l2_control
775 __s32 value; 706 __s32 value;
776}; 707};
777 708
709struct v4l2_ext_control
710{
711 __u32 id;
712 __u32 reserved2[2];
713 union {
714 __s32 value;
715 __s64 value64;
716 void *reserved;
717 };
718};
719
720struct v4l2_ext_controls
721{
722 __u32 ctrl_class;
723 __u32 count;
724 __u32 error_idx;
725 __u32 reserved[2];
726 struct v4l2_ext_control *controls;
727};
728
729/* Values for ctrl_class field */
730#define V4L2_CTRL_CLASS_USER 0x00980000 /* Old-style 'user' controls */
731#define V4L2_CTRL_CLASS_MPEG 0x00990000 /* MPEG-compression controls */
732
733#define V4L2_CTRL_ID_MASK (0x0fffffff)
734#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL)
735#define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000)
736
778/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */ 737/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
779struct v4l2_queryctrl 738struct v4l2_queryctrl
780{ 739{
@@ -801,12 +760,21 @@ struct v4l2_querymenu
801/* Control flags */ 760/* Control flags */
802#define V4L2_CTRL_FLAG_DISABLED 0x0001 761#define V4L2_CTRL_FLAG_DISABLED 0x0001
803#define V4L2_CTRL_FLAG_GRABBED 0x0002 762#define V4L2_CTRL_FLAG_GRABBED 0x0002
763#define V4L2_CTRL_FLAG_READ_ONLY 0x0004
764#define V4L2_CTRL_FLAG_UPDATE 0x0008
765#define V4L2_CTRL_FLAG_INACTIVE 0x0010
766#define V4L2_CTRL_FLAG_SLIDER 0x0020
767
768/* Query flag, to be ORed with the control ID */
769#define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000
804 770
805/* Control IDs defined by V4L2 */ 771/* User-class control IDs defined by V4L2 */
806#define V4L2_CID_BASE 0x00980900 772#define V4L2_CID_BASE (V4L2_CTRL_CLASS_USER | 0x900)
773#define V4L2_CID_USER_BASE V4L2_CID_BASE
807/* IDs reserved for driver specific controls */ 774/* IDs reserved for driver specific controls */
808#define V4L2_CID_PRIVATE_BASE 0x08000000 775#define V4L2_CID_PRIVATE_BASE 0x08000000
809 776
777#define V4L2_CID_USER_CLASS (V4L2_CTRL_CLASS_USER | 1)
810#define V4L2_CID_BRIGHTNESS (V4L2_CID_BASE+0) 778#define V4L2_CID_BRIGHTNESS (V4L2_CID_BASE+0)
811#define V4L2_CID_CONTRAST (V4L2_CID_BASE+1) 779#define V4L2_CID_CONTRAST (V4L2_CID_BASE+1)
812#define V4L2_CID_SATURATION (V4L2_CID_BASE+2) 780#define V4L2_CID_SATURATION (V4L2_CID_BASE+2)
@@ -833,6 +801,183 @@ struct v4l2_querymenu
833#define V4L2_CID_VCENTER (V4L2_CID_BASE+23) 801#define V4L2_CID_VCENTER (V4L2_CID_BASE+23)
834#define V4L2_CID_LASTP1 (V4L2_CID_BASE+24) /* last CID + 1 */ 802#define V4L2_CID_LASTP1 (V4L2_CID_BASE+24) /* last CID + 1 */
835 803
804/* MPEG-class control IDs defined by V4L2 */
805#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900)
806#define V4L2_CID_MPEG_CLASS (V4L2_CTRL_CLASS_MPEG | 1)
807
808/* MPEG streams */
809#define V4L2_CID_MPEG_STREAM_TYPE (V4L2_CID_MPEG_BASE+0)
810enum v4l2_mpeg_stream_type {
811 V4L2_MPEG_STREAM_TYPE_MPEG2_PS = 0, /* MPEG-2 program stream */
812 V4L2_MPEG_STREAM_TYPE_MPEG2_TS = 1, /* MPEG-2 transport stream */
813 V4L2_MPEG_STREAM_TYPE_MPEG1_SS = 2, /* MPEG-1 system stream */
814 V4L2_MPEG_STREAM_TYPE_MPEG2_DVD = 3, /* MPEG-2 DVD-compatible stream */
815 V4L2_MPEG_STREAM_TYPE_MPEG1_VCD = 4, /* MPEG-1 VCD-compatible stream */
816 V4L2_MPEG_STREAM_TYPE_MPEG2_SVCD = 5, /* MPEG-2 SVCD-compatible stream */
817};
818#define V4L2_CID_MPEG_STREAM_PID_PMT (V4L2_CID_MPEG_BASE+1)
819#define V4L2_CID_MPEG_STREAM_PID_AUDIO (V4L2_CID_MPEG_BASE+2)
820#define V4L2_CID_MPEG_STREAM_PID_VIDEO (V4L2_CID_MPEG_BASE+3)
821#define V4L2_CID_MPEG_STREAM_PID_PCR (V4L2_CID_MPEG_BASE+4)
822#define V4L2_CID_MPEG_STREAM_PES_ID_AUDIO (V4L2_CID_MPEG_BASE+5)
823#define V4L2_CID_MPEG_STREAM_PES_ID_VIDEO (V4L2_CID_MPEG_BASE+6)
824
825/* MPEG audio */
826#define V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ (V4L2_CID_MPEG_BASE+100)
827enum v4l2_mpeg_audio_sampling_freq {
828 V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100 = 0,
829 V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000 = 1,
830 V4L2_MPEG_AUDIO_SAMPLING_FREQ_32000 = 2,
831};
832#define V4L2_CID_MPEG_AUDIO_ENCODING (V4L2_CID_MPEG_BASE+101)
833enum v4l2_mpeg_audio_encoding {
834 V4L2_MPEG_AUDIO_ENCODING_LAYER_1 = 0,
835 V4L2_MPEG_AUDIO_ENCODING_LAYER_2 = 1,
836 V4L2_MPEG_AUDIO_ENCODING_LAYER_3 = 2,
837};
838#define V4L2_CID_MPEG_AUDIO_L1_BITRATE (V4L2_CID_MPEG_BASE+102)
839enum v4l2_mpeg_audio_l1_bitrate {
840 V4L2_MPEG_AUDIO_L1_BITRATE_32K = 0,
841 V4L2_MPEG_AUDIO_L1_BITRATE_64K = 1,
842 V4L2_MPEG_AUDIO_L1_BITRATE_96K = 2,
843 V4L2_MPEG_AUDIO_L1_BITRATE_128K = 3,
844 V4L2_MPEG_AUDIO_L1_BITRATE_160K = 4,
845 V4L2_MPEG_AUDIO_L1_BITRATE_192K = 5,
846 V4L2_MPEG_AUDIO_L1_BITRATE_224K = 6,
847 V4L2_MPEG_AUDIO_L1_BITRATE_256K = 7,
848 V4L2_MPEG_AUDIO_L1_BITRATE_288K = 8,
849 V4L2_MPEG_AUDIO_L1_BITRATE_320K = 9,
850 V4L2_MPEG_AUDIO_L1_BITRATE_352K = 10,
851 V4L2_MPEG_AUDIO_L1_BITRATE_384K = 11,
852 V4L2_MPEG_AUDIO_L1_BITRATE_416K = 12,
853 V4L2_MPEG_AUDIO_L1_BITRATE_448K = 13,
854};
855#define V4L2_CID_MPEG_AUDIO_L2_BITRATE (V4L2_CID_MPEG_BASE+103)
856enum v4l2_mpeg_audio_l2_bitrate {
857 V4L2_MPEG_AUDIO_L2_BITRATE_32K = 0,
858 V4L2_MPEG_AUDIO_L2_BITRATE_48K = 1,
859 V4L2_MPEG_AUDIO_L2_BITRATE_56K = 2,
860 V4L2_MPEG_AUDIO_L2_BITRATE_64K = 3,
861 V4L2_MPEG_AUDIO_L2_BITRATE_80K = 4,
862 V4L2_MPEG_AUDIO_L2_BITRATE_96K = 5,
863 V4L2_MPEG_AUDIO_L2_BITRATE_112K = 6,
864 V4L2_MPEG_AUDIO_L2_BITRATE_128K = 7,
865 V4L2_MPEG_AUDIO_L2_BITRATE_160K = 8,
866 V4L2_MPEG_AUDIO_L2_BITRATE_192K = 9,
867 V4L2_MPEG_AUDIO_L2_BITRATE_224K = 10,
868 V4L2_MPEG_AUDIO_L2_BITRATE_256K = 11,
869 V4L2_MPEG_AUDIO_L2_BITRATE_320K = 12,
870 V4L2_MPEG_AUDIO_L2_BITRATE_384K = 13,
871};
872#define V4L2_CID_MPEG_AUDIO_L3_BITRATE (V4L2_CID_MPEG_BASE+104)
873enum v4l2_mpeg_audio_l3_bitrate {
874 V4L2_MPEG_AUDIO_L3_BITRATE_32K = 0,
875 V4L2_MPEG_AUDIO_L3_BITRATE_40K = 1,
876 V4L2_MPEG_AUDIO_L3_BITRATE_48K = 2,
877 V4L2_MPEG_AUDIO_L3_BITRATE_56K = 3,
878 V4L2_MPEG_AUDIO_L3_BITRATE_64K = 4,
879 V4L2_MPEG_AUDIO_L3_BITRATE_80K = 5,
880 V4L2_MPEG_AUDIO_L3_BITRATE_96K = 6,
881 V4L2_MPEG_AUDIO_L3_BITRATE_112K = 7,
882 V4L2_MPEG_AUDIO_L3_BITRATE_128K = 8,
883 V4L2_MPEG_AUDIO_L3_BITRATE_160K = 9,
884 V4L2_MPEG_AUDIO_L3_BITRATE_192K = 10,
885 V4L2_MPEG_AUDIO_L3_BITRATE_224K = 11,
886 V4L2_MPEG_AUDIO_L3_BITRATE_256K = 12,
887 V4L2_MPEG_AUDIO_L3_BITRATE_320K = 13,
888};
889#define V4L2_CID_MPEG_AUDIO_MODE (V4L2_CID_MPEG_BASE+105)
890enum v4l2_mpeg_audio_mode {
891 V4L2_MPEG_AUDIO_MODE_STEREO = 0,
892 V4L2_MPEG_AUDIO_MODE_JOINT_STEREO = 1,
893 V4L2_MPEG_AUDIO_MODE_DUAL = 2,
894 V4L2_MPEG_AUDIO_MODE_MONO = 3,
895};
896#define V4L2_CID_MPEG_AUDIO_MODE_EXTENSION (V4L2_CID_MPEG_BASE+106)
897enum v4l2_mpeg_audio_mode_extension {
898 V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4 = 0,
899 V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_8 = 1,
900 V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_12 = 2,
901 V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_16 = 3,
902};
903#define V4L2_CID_MPEG_AUDIO_EMPHASIS (V4L2_CID_MPEG_BASE+107)
904enum v4l2_mpeg_audio_emphasis {
905 V4L2_MPEG_AUDIO_EMPHASIS_NONE = 0,
906 V4L2_MPEG_AUDIO_EMPHASIS_50_DIV_15_uS = 1,
907 V4L2_MPEG_AUDIO_EMPHASIS_CCITT_J17 = 2,
908};
909#define V4L2_CID_MPEG_AUDIO_CRC (V4L2_CID_MPEG_BASE+108)
910enum v4l2_mpeg_audio_crc {
911 V4L2_MPEG_AUDIO_CRC_NONE = 0,
912 V4L2_MPEG_AUDIO_CRC_CRC16 = 1,
913};
914
915/* MPEG video */
916#define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200)
917enum v4l2_mpeg_video_encoding {
918 V4L2_MPEG_VIDEO_ENCODING_MPEG_1 = 0,
919 V4L2_MPEG_VIDEO_ENCODING_MPEG_2 = 1,
920};
921#define V4L2_CID_MPEG_VIDEO_ASPECT (V4L2_CID_MPEG_BASE+201)
922enum v4l2_mpeg_video_aspect {
923 V4L2_MPEG_VIDEO_ASPECT_1x1 = 0,
924 V4L2_MPEG_VIDEO_ASPECT_4x3 = 1,
925 V4L2_MPEG_VIDEO_ASPECT_16x9 = 2,
926 V4L2_MPEG_VIDEO_ASPECT_221x100 = 3,
927};
928#define V4L2_CID_MPEG_VIDEO_B_FRAMES (V4L2_CID_MPEG_BASE+202)
929#define V4L2_CID_MPEG_VIDEO_GOP_SIZE (V4L2_CID_MPEG_BASE+203)
930#define V4L2_CID_MPEG_VIDEO_GOP_CLOSURE (V4L2_CID_MPEG_BASE+204)
931#define V4L2_CID_MPEG_VIDEO_PULLDOWN (V4L2_CID_MPEG_BASE+205)
932#define V4L2_CID_MPEG_VIDEO_BITRATE_MODE (V4L2_CID_MPEG_BASE+206)
933enum v4l2_mpeg_video_bitrate_mode {
934 V4L2_MPEG_VIDEO_BITRATE_MODE_VBR = 0,
935 V4L2_MPEG_VIDEO_BITRATE_MODE_CBR = 1,
936};
937#define V4L2_CID_MPEG_VIDEO_BITRATE (V4L2_CID_MPEG_BASE+207)
938#define V4L2_CID_MPEG_VIDEO_BITRATE_PEAK (V4L2_CID_MPEG_BASE+208)
939#define V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION (V4L2_CID_MPEG_BASE+209)
940
941/* MPEG-class control IDs specific to the CX2584x driver as defined by V4L2 */
942#define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000)
943#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+0)
944enum v4l2_mpeg_cx2341x_video_spatial_filter_mode {
945 V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL = 0,
946 V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO = 1,
947};
948#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+1)
949#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+2)
950enum v4l2_mpeg_cx2341x_video_luma_spatial_filter_type {
951 V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_OFF = 0,
952 V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_HOR = 1,
953 V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_VERT = 2,
954 V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_HV_SEPARABLE = 3,
955 V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_SYM_NON_SEPARABLE = 4,
956};
957#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+3)
958enum v4l2_mpeg_cx2341x_video_chroma_spatial_filter_type {
959 V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_OFF = 0,
960 V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR = 1,
961};
962#define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+4)
963enum v4l2_mpeg_cx2341x_video_temporal_filter_mode {
964 V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL = 0,
965 V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_AUTO = 1,
966};
967#define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+5)
968#define V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+6)
969enum v4l2_mpeg_cx2341x_video_median_filter_type {
970 V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF = 0,
971 V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR = 1,
972 V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_VERT = 2,
973 V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR_VERT = 3,
974 V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_DIAG = 4,
975};
976#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+7)
977#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+8)
978#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+9)
979#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+10)
980
836/* 981/*
837 * T U N I N G 982 * T U N I N G
838 */ 983 */
@@ -904,6 +1049,7 @@ struct v4l2_audio
904 __u32 mode; 1049 __u32 mode;
905 __u32 reserved[2]; 1050 __u32 reserved[2];
906}; 1051};
1052
907/* Flags for the 'capability' field */ 1053/* Flags for the 'capability' field */
908#define V4L2_AUDCAP_STEREO 0x00001 1054#define V4L2_AUDCAP_STEREO 0x00001
909#define V4L2_AUDCAP_AVL 0x00002 1055#define V4L2_AUDCAP_AVL 0x00002
@@ -927,7 +1073,6 @@ struct v4l2_audioout
927 */ 1073 */
928 1074
929/* Raw VBI */ 1075/* Raw VBI */
930
931struct v4l2_vbi_format 1076struct v4l2_vbi_format
932{ 1077{
933 __u32 sampling_rate; /* in 1 Hz */ 1078 __u32 sampling_rate; /* in 1 Hz */
@@ -1034,8 +1179,6 @@ struct v4l2_streamparm
1034 } parm; 1179 } parm;
1035}; 1180};
1036 1181
1037
1038
1039/* 1182/*
1040 * I O C T L C O D E S F O R V I D E O D E V I C E S 1183 * I O C T L C O D E S F O R V I D E O D E V I C E S
1041 * 1184 *
@@ -1045,8 +1188,10 @@ struct v4l2_streamparm
1045#define VIDIOC_ENUM_FMT _IOWR ('V', 2, struct v4l2_fmtdesc) 1188#define VIDIOC_ENUM_FMT _IOWR ('V', 2, struct v4l2_fmtdesc)
1046#define VIDIOC_G_FMT _IOWR ('V', 4, struct v4l2_format) 1189#define VIDIOC_G_FMT _IOWR ('V', 4, struct v4l2_format)
1047#define VIDIOC_S_FMT _IOWR ('V', 5, struct v4l2_format) 1190#define VIDIOC_S_FMT _IOWR ('V', 5, struct v4l2_format)
1191#ifdef __KERNEL__
1048#define VIDIOC_G_MPEGCOMP _IOR ('V', 6, struct v4l2_mpeg_compression) 1192#define VIDIOC_G_MPEGCOMP _IOR ('V', 6, struct v4l2_mpeg_compression)
1049#define VIDIOC_S_MPEGCOMP _IOW ('V', 7, struct v4l2_mpeg_compression) 1193#define VIDIOC_S_MPEGCOMP _IOW ('V', 7, struct v4l2_mpeg_compression)
1194#endif
1050#define VIDIOC_REQBUFS _IOWR ('V', 8, struct v4l2_requestbuffers) 1195#define VIDIOC_REQBUFS _IOWR ('V', 8, struct v4l2_requestbuffers)
1051#define VIDIOC_QUERYBUF _IOWR ('V', 9, struct v4l2_buffer) 1196#define VIDIOC_QUERYBUF _IOWR ('V', 9, struct v4l2_buffer)
1052#define VIDIOC_G_FBUF _IOR ('V', 10, struct v4l2_framebuffer) 1197#define VIDIOC_G_FBUF _IOR ('V', 10, struct v4l2_framebuffer)
@@ -1096,7 +1241,11 @@ struct v4l2_streamparm
1096#define VIDIOC_G_SLICED_VBI_CAP _IOR ('V', 69, struct v4l2_sliced_vbi_cap) 1241#define VIDIOC_G_SLICED_VBI_CAP _IOR ('V', 69, struct v4l2_sliced_vbi_cap)
1097#endif 1242#endif
1098#define VIDIOC_LOG_STATUS _IO ('V', 70) 1243#define VIDIOC_LOG_STATUS _IO ('V', 70)
1244#define VIDIOC_G_EXT_CTRLS _IOWR ('V', 71, struct v4l2_ext_controls)
1245#define VIDIOC_S_EXT_CTRLS _IOWR ('V', 72, struct v4l2_ext_controls)
1246#define VIDIOC_TRY_EXT_CTRLS _IOWR ('V', 73, struct v4l2_ext_controls)
1099 1247
1248#ifdef __OLD_VIDIOC_
1100/* for compatibility, will go away some day */ 1249/* for compatibility, will go away some day */
1101#define VIDIOC_OVERLAY_OLD _IOWR ('V', 14, int) 1250#define VIDIOC_OVERLAY_OLD _IOWR ('V', 14, int)
1102#define VIDIOC_S_PARM_OLD _IOW ('V', 22, struct v4l2_streamparm) 1251#define VIDIOC_S_PARM_OLD _IOW ('V', 22, struct v4l2_streamparm)
@@ -1104,57 +1253,10 @@ struct v4l2_streamparm
1104#define VIDIOC_G_AUDIO_OLD _IOWR ('V', 33, struct v4l2_audio) 1253#define VIDIOC_G_AUDIO_OLD _IOWR ('V', 33, struct v4l2_audio)
1105#define VIDIOC_G_AUDOUT_OLD _IOWR ('V', 49, struct v4l2_audioout) 1254#define VIDIOC_G_AUDOUT_OLD _IOWR ('V', 49, struct v4l2_audioout)
1106#define VIDIOC_CROPCAP_OLD _IOR ('V', 58, struct v4l2_cropcap) 1255#define VIDIOC_CROPCAP_OLD _IOR ('V', 58, struct v4l2_cropcap)
1107
1108#define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */
1109
1110
1111#ifdef __KERNEL__
1112/*
1113 *
1114 * V 4 L 2 D R I V E R H E L P E R A P I
1115 *
1116 * Some commonly needed functions for drivers (v4l2-common.o module)
1117 */
1118#include <linux/fs.h>
1119
1120/* Video standard functions */
1121extern unsigned int v4l2_video_std_fps(struct v4l2_standard *vs);
1122extern int v4l2_video_std_construct(struct v4l2_standard *vs,
1123 int id, char *name);
1124
1125/* prority handling */
1126struct v4l2_prio_state {
1127 atomic_t prios[4];
1128};
1129int v4l2_prio_init(struct v4l2_prio_state *global);
1130int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local,
1131 enum v4l2_priority new);
1132int v4l2_prio_open(struct v4l2_prio_state *global, enum v4l2_priority *local);
1133int v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority *local);
1134enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global);
1135int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority *local);
1136
1137/* names for fancy debug output */
1138extern char *v4l2_field_names[];
1139extern char *v4l2_type_names[];
1140
1141/* Compatibility layer interface -- v4l1-compat module */
1142typedef int (*v4l2_kioctl)(struct inode *inode, struct file *file,
1143 unsigned int cmd, void *arg);
1144
1145#ifdef CONFIG_VIDEO_V4L1_COMPAT
1146int v4l_compat_translate_ioctl(struct inode *inode, struct file *file,
1147 int cmd, void *arg, v4l2_kioctl driver_ioctl);
1148#else
1149#define v4l_compat_translate_ioctl(inode,file,cmd,arg,ioctl) -EINVAL
1150#endif 1256#endif
1151 1257
1152/* 32 Bits compatibility layer for 64 bits processors */ 1258#define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */
1153extern long v4l_compat_ioctl32(struct file *file, unsigned int cmd,
1154 unsigned long arg);
1155
1156 1259
1157#endif /* __KERNEL__ */
1158#endif /* __LINUX_VIDEODEV2_H */ 1260#endif /* __LINUX_VIDEODEV2_H */
1159 1261
1160/* 1262/*
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 1d5577b2b752..f6024ab4eff0 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -4,10 +4,13 @@
4#include <linux/spinlock.h> 4#include <linux/spinlock.h>
5#include <asm/page.h> /* pgprot_t */ 5#include <asm/page.h> /* pgprot_t */
6 6
7struct vm_area_struct;
8
7/* bits in vm_struct->flags */ 9/* bits in vm_struct->flags */
8#define VM_IOREMAP 0x00000001 /* ioremap() and friends */ 10#define VM_IOREMAP 0x00000001 /* ioremap() and friends */
9#define VM_ALLOC 0x00000002 /* vmalloc() */ 11#define VM_ALLOC 0x00000002 /* vmalloc() */
10#define VM_MAP 0x00000004 /* vmap()ed pages */ 12#define VM_MAP 0x00000004 /* vmap()ed pages */
13#define VM_USERMAP 0x00000008 /* suitable for remap_vmalloc_range */
11/* bits [20..32] reserved for arch specific ioremap internals */ 14/* bits [20..32] reserved for arch specific ioremap internals */
12 15
13/* 16/*
@@ -32,9 +35,11 @@ struct vm_struct {
32 * Highlevel APIs for driver use 35 * Highlevel APIs for driver use
33 */ 36 */
34extern void *vmalloc(unsigned long size); 37extern void *vmalloc(unsigned long size);
38extern void *vmalloc_user(unsigned long size);
35extern void *vmalloc_node(unsigned long size, int node); 39extern void *vmalloc_node(unsigned long size, int node);
36extern void *vmalloc_exec(unsigned long size); 40extern void *vmalloc_exec(unsigned long size);
37extern void *vmalloc_32(unsigned long size); 41extern void *vmalloc_32(unsigned long size);
42extern void *vmalloc_32_user(unsigned long size);
38extern void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot); 43extern void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot);
39extern void *__vmalloc_area(struct vm_struct *area, gfp_t gfp_mask, 44extern void *__vmalloc_area(struct vm_struct *area, gfp_t gfp_mask,
40 pgprot_t prot); 45 pgprot_t prot);
@@ -45,6 +50,9 @@ extern void vfree(void *addr);
45extern void *vmap(struct page **pages, unsigned int count, 50extern void *vmap(struct page **pages, unsigned int count,
46 unsigned long flags, pgprot_t prot); 51 unsigned long flags, pgprot_t prot);
47extern void vunmap(void *addr); 52extern void vunmap(void *addr);
53
54extern int remap_vmalloc_range(struct vm_area_struct *vma, void *addr,
55 unsigned long pgoff);
48 56
49/* 57/*
50 * Lowlevel-APIs (not for driver use!) 58 * Lowlevel-APIs (not for driver use!)
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 56f92fcbe94a..9e38b566d0e7 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -50,14 +50,15 @@ struct writeback_control {
50 * a hint that the filesystem need only write out the pages inside that 50 * a hint that the filesystem need only write out the pages inside that
51 * byterange. The byte at `end' is included in the writeout request. 51 * byterange. The byte at `end' is included in the writeout request.
52 */ 52 */
53 loff_t start; 53 loff_t range_start;
54 loff_t end; 54 loff_t range_end;
55 55
56 unsigned nonblocking:1; /* Don't get stuck on request queues */ 56 unsigned nonblocking:1; /* Don't get stuck on request queues */
57 unsigned encountered_congestion:1; /* An output: a queue is full */ 57 unsigned encountered_congestion:1; /* An output: a queue is full */
58 unsigned for_kupdate:1; /* A kupdate writeback */ 58 unsigned for_kupdate:1; /* A kupdate writeback */
59 unsigned for_reclaim:1; /* Invoked from the page allocator */ 59 unsigned for_reclaim:1; /* Invoked from the page allocator */
60 unsigned for_writepages:1; /* This is a writepages() call */ 60 unsigned for_writepages:1; /* This is a writepages() call */
61 unsigned range_cyclic:1; /* range_start is cyclic */
61}; 62};
62 63
63/* 64/*
diff --git a/include/linux/zconf.h b/include/linux/zconf.h
index f1cfd66b9554..0beb75e38caa 100644
--- a/include/linux/zconf.h
+++ b/include/linux/zconf.h
@@ -35,6 +35,18 @@
35# define MAX_WBITS 15 /* 32K LZ77 window */ 35# define MAX_WBITS 15 /* 32K LZ77 window */
36#endif 36#endif
37 37
38/* default windowBits for decompression. MAX_WBITS is for compression only */
39#ifndef DEF_WBITS
40# define DEF_WBITS MAX_WBITS
41#endif
42
43/* default memLevel */
44#if MAX_MEM_LEVEL >= 8
45# define DEF_MEM_LEVEL 8
46#else
47# define DEF_MEM_LEVEL MAX_MEM_LEVEL
48#endif
49
38 /* Type declarations */ 50 /* Type declarations */
39 51
40typedef unsigned char Byte; /* 8 bits */ 52typedef unsigned char Byte; /* 8 bits */
diff --git a/include/linux/zlib.h b/include/linux/zlib.h
index 4fa32f0d4df8..9e3192a7dc6f 100644
--- a/include/linux/zlib.h
+++ b/include/linux/zlib.h
@@ -1,7 +1,6 @@
1/* zlib.h -- interface of the 'zlib' general purpose compression library 1/* zlib.h -- interface of the 'zlib' general purpose compression library
2 version 1.1.3, July 9th, 1998
3 2
4 Copyright (C) 1995-1998 Jean-loup Gailly and Mark Adler 3 Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler
5 4
6 This software is provided 'as-is', without any express or implied 5 This software is provided 'as-is', without any express or implied
7 warranty. In no event will the authors be held liable for any damages 6 warranty. In no event will the authors be held liable for any damages
@@ -24,7 +23,7 @@
24 23
25 24
26 The data format used by the zlib library is described by RFCs (Request for 25 The data format used by the zlib library is described by RFCs (Request for
27 Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt 26 Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt
28 (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). 27 (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
29*/ 28*/
30 29
@@ -33,7 +32,22 @@
33 32
34#include <linux/zconf.h> 33#include <linux/zconf.h>
35 34
36#define ZLIB_VERSION "1.1.3" 35/* zlib deflate based on ZLIB_VERSION "1.1.3" */
36/* zlib inflate based on ZLIB_VERSION "1.2.3" */
37
38/*
39 This is a modified version of zlib for use inside the Linux kernel.
40 The main changes are to perform all memory allocation in advance.
41
42 Inflation Changes:
43 * Z_PACKET_FLUSH is added and used by ppp_deflate. Before returning
44 this checks there is no more input data available and the next data
45 is a STORED block. It also resets the mode to be read for the next
46 data, all as per PPP requirements.
47 * Addition of zlib_inflateIncomp which copies incompressible data into
48 the history window and adjusts the accoutning without calling
49 zlib_inflate itself to inflate the data.
50*/
37 51
38/* 52/*
39 The 'zlib' compression library provides in-memory compression and 53 The 'zlib' compression library provides in-memory compression and
@@ -48,9 +62,18 @@
48 application must provide more input and/or consume the output 62 application must provide more input and/or consume the output
49 (providing more output space) before each call. 63 (providing more output space) before each call.
50 64
65 The compressed data format used by default by the in-memory functions is
66 the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped
67 around a deflate stream, which is itself documented in RFC 1951.
68
51 The library also supports reading and writing files in gzip (.gz) format 69 The library also supports reading and writing files in gzip (.gz) format
52 with an interface similar to that of stdio. 70 with an interface similar to that of stdio.
53 71
72 The zlib format was designed to be compact and fast for use in memory
73 and on communications channels. The gzip format was designed for single-
74 file compression on file systems, has a larger header than zlib to maintain
75 directory information, and uses a different, slower check method than zlib.
76
54 The library does not install any signal handler. The decoder checks 77 The library does not install any signal handler. The decoder checks
55 the consistency of the compressed data, so the library should never 78 the consistency of the compressed data, so the library should never
56 crash even in case of corrupted input. 79 crash even in case of corrupted input.
@@ -119,7 +142,8 @@ typedef z_stream *z_streamp;
119#define Z_SYNC_FLUSH 3 142#define Z_SYNC_FLUSH 3
120#define Z_FULL_FLUSH 4 143#define Z_FULL_FLUSH 4
121#define Z_FINISH 5 144#define Z_FINISH 5
122/* Allowed flush values; see deflate() below for details */ 145#define Z_BLOCK 6 /* Only for inflate at present */
146/* Allowed flush values; see deflate() and inflate() below for details */
123 147
124#define Z_OK 0 148#define Z_OK 0
125#define Z_STREAM_END 1 149#define Z_STREAM_END 1
@@ -155,13 +179,6 @@ typedef z_stream *z_streamp;
155 179
156 /* basic functions */ 180 /* basic functions */
157 181
158extern const char * zlib_zlibVersion (void);
159/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
160 If the first character differs, the library code actually used is
161 not compatible with the zlib.h header file used by the application.
162 This check is automatically made by deflateInit and inflateInit.
163 */
164
165extern int zlib_deflate_workspacesize (void); 182extern int zlib_deflate_workspacesize (void);
166/* 183/*
167 Returns the number of bytes that needs to be allocated for a per- 184 Returns the number of bytes that needs to be allocated for a per-
@@ -315,9 +332,9 @@ extern int zlib_inflateInit (z_streamp strm);
315extern int zlib_inflate (z_streamp strm, int flush); 332extern int zlib_inflate (z_streamp strm, int flush);
316/* 333/*
317 inflate decompresses as much data as possible, and stops when the input 334 inflate decompresses as much data as possible, and stops when the input
318 buffer becomes empty or the output buffer becomes full. It may some 335 buffer becomes empty or the output buffer becomes full. It may introduce
319 introduce some output latency (reading input without producing any output) 336 some output latency (reading input without producing any output) except when
320 except when forced to flush. 337 forced to flush.
321 338
322 The detailed semantics are as follows. inflate performs one or both of the 339 The detailed semantics are as follows. inflate performs one or both of the
323 following actions: 340 following actions:
@@ -341,11 +358,26 @@ extern int zlib_inflate (z_streamp strm, int flush);
341 must be called again after making room in the output buffer because there 358 must be called again after making room in the output buffer because there
342 might be more output pending. 359 might be more output pending.
343 360
344 If the parameter flush is set to Z_SYNC_FLUSH, inflate flushes as much 361 The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH,
345 output as possible to the output buffer. The flushing behavior of inflate is 362 Z_FINISH, or Z_BLOCK. Z_SYNC_FLUSH requests that inflate() flush as much
346 not specified for values of the flush parameter other than Z_SYNC_FLUSH 363 output as possible to the output buffer. Z_BLOCK requests that inflate() stop
347 and Z_FINISH, but the current implementation actually flushes as much output 364 if and when it gets to the next deflate block boundary. When decoding the
348 as possible anyway. 365 zlib or gzip format, this will cause inflate() to return immediately after
366 the header and before the first block. When doing a raw inflate, inflate()
367 will go ahead and process the first block, and will return when it gets to
368 the end of that block, or when it runs out of data.
369
370 The Z_BLOCK option assists in appending to or combining deflate streams.
371 Also to assist in this, on return inflate() will set strm->data_type to the
372 number of unused bits in the last byte taken from strm->next_in, plus 64
373 if inflate() is currently decoding the last block in the deflate stream,
374 plus 128 if inflate() returned immediately after decoding an end-of-block
375 code or decoding the complete header up to just before the first byte of the
376 deflate stream. The end-of-block will not be indicated until all of the
377 uncompressed data from that block has been written to strm->next_out. The
378 number of unused bits may in general be greater than seven, except when
379 bit 7 of data_type is set, in which case the number of unused bits will be
380 less than eight.
349 381
350 inflate() should normally be called until it returns Z_STREAM_END or an 382 inflate() should normally be called until it returns Z_STREAM_END or an
351 error. However if all decompression is to be performed in a single step 383 error. However if all decompression is to be performed in a single step
@@ -355,29 +387,44 @@ extern int zlib_inflate (z_streamp strm, int flush);
355 uncompressed data. (The size of the uncompressed data may have been saved 387 uncompressed data. (The size of the uncompressed data may have been saved
356 by the compressor for this purpose.) The next operation on this stream must 388 by the compressor for this purpose.) The next operation on this stream must
357 be inflateEnd to deallocate the decompression state. The use of Z_FINISH 389 be inflateEnd to deallocate the decompression state. The use of Z_FINISH
358 is never required, but can be used to inform inflate that a faster routine 390 is never required, but can be used to inform inflate that a faster approach
359 may be used for the single inflate() call. 391 may be used for the single inflate() call.
360 392
361 If a preset dictionary is needed at this point (see inflateSetDictionary 393 In this implementation, inflate() always flushes as much output as
362 below), inflate sets strm-adler to the adler32 checksum of the 394 possible to the output buffer, and always uses the faster approach on the
363 dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise 395 first call. So the only effect of the flush parameter in this implementation
364 it sets strm->adler to the adler32 checksum of all output produced 396 is on the return value of inflate(), as noted below, or when it returns early
365 so far (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or 397 because Z_BLOCK is used.
366 an error code as described below. At the end of the stream, inflate() 398
367 checks that its computed adler32 checksum is equal to that saved by the 399 If a preset dictionary is needed after this call (see inflateSetDictionary
368 compressor and returns Z_STREAM_END only if the checksum is correct. 400 below), inflate sets strm->adler to the adler32 checksum of the dictionary
401 chosen by the compressor and returns Z_NEED_DICT; otherwise it sets
402 strm->adler to the adler32 checksum of all output produced so far (that is,
403 total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described
404 below. At the end of the stream, inflate() checks that its computed adler32
405 checksum is equal to that saved by the compressor and returns Z_STREAM_END
406 only if the checksum is correct.
407
408 inflate() will decompress and check either zlib-wrapped or gzip-wrapped
409 deflate data. The header type is detected automatically. Any information
410 contained in the gzip header is not retained, so applications that need that
411 information should instead use raw inflate, see inflateInit2() below, or
412 inflateBack() and perform their own processing of the gzip header and
413 trailer.
369 414
370 inflate() returns Z_OK if some progress has been made (more input processed 415 inflate() returns Z_OK if some progress has been made (more input processed
371 or more output produced), Z_STREAM_END if the end of the compressed data has 416 or more output produced), Z_STREAM_END if the end of the compressed data has
372 been reached and all uncompressed output has been produced, Z_NEED_DICT if a 417 been reached and all uncompressed output has been produced, Z_NEED_DICT if a
373 preset dictionary is needed at this point, Z_DATA_ERROR if the input data was 418 preset dictionary is needed at this point, Z_DATA_ERROR if the input data was
374 corrupted (input stream not conforming to the zlib format or incorrect 419 corrupted (input stream not conforming to the zlib format or incorrect check
375 adler32 checksum), Z_STREAM_ERROR if the stream structure was inconsistent 420 value), Z_STREAM_ERROR if the stream structure was inconsistent (for example
376 (for example if next_in or next_out was NULL), Z_MEM_ERROR if there was not 421 if next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory,
377 enough memory, Z_BUF_ERROR if no progress is possible or if there was not 422 Z_BUF_ERROR if no progress is possible or if there was not enough room in the
378 enough room in the output buffer when Z_FINISH is used. In the Z_DATA_ERROR 423 output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and
379 case, the application may then call inflateSync to look for a good 424 inflate() can be called again with more input and more output space to
380 compression block. 425 continue decompressing. If Z_DATA_ERROR is returned, the application may then
426 call inflateSync() to look for a good compression block if a partial recovery
427 of the data is desired.
381*/ 428*/
382 429
383 430
@@ -547,16 +594,36 @@ extern int inflateInit2 (z_streamp strm, int windowBits);
547 The windowBits parameter is the base two logarithm of the maximum window 594 The windowBits parameter is the base two logarithm of the maximum window
548 size (the size of the history buffer). It should be in the range 8..15 for 595 size (the size of the history buffer). It should be in the range 8..15 for
549 this version of the library. The default value is 15 if inflateInit is used 596 this version of the library. The default value is 15 if inflateInit is used
550 instead. If a compressed stream with a larger window size is given as 597 instead. windowBits must be greater than or equal to the windowBits value
551 input, inflate() will return with the error code Z_DATA_ERROR instead of 598 provided to deflateInit2() while compressing, or it must be equal to 15 if
552 trying to allocate a larger window. 599 deflateInit2() was not used. If a compressed stream with a larger window
553 600 size is given as input, inflate() will return with the error code
554 inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough 601 Z_DATA_ERROR instead of trying to allocate a larger window.
555 memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative 602
556 memLevel). msg is set to null if there is no error message. inflateInit2 603 windowBits can also be -8..-15 for raw inflate. In this case, -windowBits
557 does not perform any decompression apart from reading the zlib header if 604 determines the window size. inflate() will then process raw deflate data,
558 present: this will be done by inflate(). (So next_in and avail_in may be 605 not looking for a zlib or gzip header, not generating a check value, and not
559 modified, but next_out and avail_out are unchanged.) 606 looking for any check values for comparison at the end of the stream. This
607 is for use with other formats that use the deflate compressed data format
608 such as zip. Those formats provide their own check values. If a custom
609 format is developed using the raw deflate format for compressed data, it is
610 recommended that a check value such as an adler32 or a crc32 be applied to
611 the uncompressed data as is done in the zlib, gzip, and zip formats. For
612 most applications, the zlib format should be used as is. Note that comments
613 above on the use in deflateInit2() applies to the magnitude of windowBits.
614
615 windowBits can also be greater than 15 for optional gzip decoding. Add
616 32 to windowBits to enable zlib and gzip decoding with automatic header
617 detection, or add 16 to decode only the gzip format (the zlib format will
618 return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is
619 a crc32 instead of an adler32.
620
621 inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
622 memory, Z_STREAM_ERROR if a parameter is invalid (such as a null strm). msg
623 is set to null if there is no error message. inflateInit2 does not perform
624 any decompression apart from reading the zlib header if present: this will
625 be done by inflate(). (So next_in and avail_in may be modified, but next_out
626 and avail_out are unchanged.)
560*/ 627*/
561 628
562extern int zlib_inflateSetDictionary (z_streamp strm, 629extern int zlib_inflateSetDictionary (z_streamp strm,
@@ -564,16 +631,19 @@ extern int zlib_inflateSetDictionary (z_streamp strm,
564 uInt dictLength); 631 uInt dictLength);
565/* 632/*
566 Initializes the decompression dictionary from the given uncompressed byte 633 Initializes the decompression dictionary from the given uncompressed byte
567 sequence. This function must be called immediately after a call of inflate 634 sequence. This function must be called immediately after a call of inflate,
568 if this call returned Z_NEED_DICT. The dictionary chosen by the compressor 635 if that call returned Z_NEED_DICT. The dictionary chosen by the compressor
569 can be determined from the Adler32 value returned by this call of 636 can be determined from the adler32 value returned by that call of inflate.
570 inflate. The compressor and decompressor must use exactly the same 637 The compressor and decompressor must use exactly the same dictionary (see
571 dictionary (see deflateSetDictionary). 638 deflateSetDictionary). For raw inflate, this function can be called
639 immediately after inflateInit2() or inflateReset() and before any call of
640 inflate() to set the dictionary. The application must insure that the
641 dictionary that was used for compression is provided.
572 642
573 inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a 643 inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
574 parameter is invalid (such as NULL dictionary) or the stream state is 644 parameter is invalid (such as NULL dictionary) or the stream state is
575 inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the 645 inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
576 expected one (incorrect Adler32 value). inflateSetDictionary does not 646 expected one (incorrect adler32 value). inflateSetDictionary does not
577 perform any decompression: this will be done by subsequent calls of 647 perform any decompression: this will be done by subsequent calls of
578 inflate(). 648 inflate().
579*/ 649*/
@@ -614,40 +684,19 @@ extern int zlib_inflateIncomp (z_stream *strm);
614 containing the data at next_in (except that the data is not output). 684 containing the data at next_in (except that the data is not output).
615*/ 685*/
616 686
617 /* various hacks, don't look :) */
618
619/* deflateInit and inflateInit are macros to allow checking the zlib version
620 * and the compiler's view of z_stream:
621 */
622extern int zlib_deflateInit_ (z_streamp strm, int level,
623 const char *version, int stream_size);
624extern int zlib_inflateInit_ (z_streamp strm,
625 const char *version, int stream_size);
626extern int zlib_deflateInit2_ (z_streamp strm, int level, int method,
627 int windowBits, int memLevel,
628 int strategy, const char *version,
629 int stream_size);
630extern int zlib_inflateInit2_ (z_streamp strm, int windowBits,
631 const char *version, int stream_size);
632#define zlib_deflateInit(strm, level) \ 687#define zlib_deflateInit(strm, level) \
633 zlib_deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) 688 zlib_deflateInit2((strm), (level), Z_DEFLATED, MAX_WBITS, \
689 DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY)
634#define zlib_inflateInit(strm) \ 690#define zlib_inflateInit(strm) \
635 zlib_inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) 691 zlib_inflateInit2((strm), DEF_WBITS)
636#define zlib_deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
637 zlib_deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
638 (strategy), ZLIB_VERSION, sizeof(z_stream))
639#define zlib_inflateInit2(strm, windowBits) \
640 zlib_inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
641 692
693extern int zlib_deflateInit2(z_streamp strm, int level, int method,
694 int windowBits, int memLevel,
695 int strategy);
696extern int zlib_inflateInit2(z_streamp strm, int windowBits);
642 697
643#if !defined(_Z_UTIL_H) && !defined(NO_DUMMY_DECL) 698#if !defined(_Z_UTIL_H) && !defined(NO_DUMMY_DECL)
644 struct internal_state {int dummy;}; /* hack for buggy compilers */ 699 struct internal_state {int dummy;}; /* hack for buggy compilers */
645#endif 700#endif
646 701
647extern const char * zlib_zError (int err);
648#if 0
649extern int zlib_inflateSyncPoint (z_streamp z);
650#endif
651extern const uLong * zlib_get_crc_table (void);
652
653#endif /* _ZLIB_H */ 702#endif /* _ZLIB_H */
diff --git a/include/linux/zorro.h b/include/linux/zorro.h
index 2f135cf6eef1..913bfc226dda 100644
--- a/include/linux/zorro.h
+++ b/include/linux/zorro.h
@@ -11,8 +11,6 @@
11#ifndef _LINUX_ZORRO_H 11#ifndef _LINUX_ZORRO_H
12#define _LINUX_ZORRO_H 12#define _LINUX_ZORRO_H
13 13
14#ifndef __ASSEMBLY__
15
16#include <linux/device.h> 14#include <linux/device.h>
17 15
18 16
@@ -112,45 +110,6 @@ struct ConfigDev {
112 __u32 cd_Unused[4]; /* for whatever the driver wants */ 110 __u32 cd_Unused[4]; /* for whatever the driver wants */
113} __attribute__ ((packed)); 111} __attribute__ ((packed));
114 112
115#else /* __ASSEMBLY__ */
116
117LN_Succ = 0
118LN_Pred = LN_Succ+4
119LN_Type = LN_Pred+4
120LN_Pri = LN_Type+1
121LN_Name = LN_Pri+1
122LN_sizeof = LN_Name+4
123
124ER_Type = 0
125ER_Product = ER_Type+1
126ER_Flags = ER_Product+1
127ER_Reserved03 = ER_Flags+1
128ER_Manufacturer = ER_Reserved03+1
129ER_SerialNumber = ER_Manufacturer+2
130ER_InitDiagVec = ER_SerialNumber+4
131ER_Reserved0c = ER_InitDiagVec+2
132ER_Reserved0d = ER_Reserved0c+1
133ER_Reserved0e = ER_Reserved0d+1
134ER_Reserved0f = ER_Reserved0e+1
135ER_sizeof = ER_Reserved0f+1
136
137CD_Node = 0
138CD_Flags = CD_Node+LN_sizeof
139CD_Pad = CD_Flags+1
140CD_Rom = CD_Pad+1
141CD_BoardAddr = CD_Rom+ER_sizeof
142CD_BoardSize = CD_BoardAddr+4
143CD_SlotAddr = CD_BoardSize+4
144CD_SlotSize = CD_SlotAddr+2
145CD_Driver = CD_SlotSize+2
146CD_NextCD = CD_Driver+4
147CD_Unused = CD_NextCD+4
148CD_sizeof = CD_Unused+(4*4)
149
150#endif /* __ASSEMBLY__ */
151
152#ifndef __ASSEMBLY__
153
154#define ZORRO_NUM_AUTO 16 113#define ZORRO_NUM_AUTO 16
155 114
156#ifdef __KERNEL__ 115#ifdef __KERNEL__
@@ -290,7 +249,6 @@ extern DECLARE_BITMAP(zorro_unused_z2ram, 128);
290#define Z2RAM_CHUNKSHIFT (16) 249#define Z2RAM_CHUNKSHIFT (16)
291 250
292 251
293#endif /* !__ASSEMBLY__ */
294#endif /* __KERNEL__ */ 252#endif /* __KERNEL__ */
295 253
296#endif /* _LINUX_ZORRO_H */ 254#endif /* _LINUX_ZORRO_H */
diff --git a/include/linux/zutil.h b/include/linux/zutil.h
index ee0c59cf2136..6adfa9a6ffe9 100644
--- a/include/linux/zutil.h
+++ b/include/linux/zutil.h
@@ -23,18 +23,6 @@ typedef unsigned long ulg;
23 23
24 /* common constants */ 24 /* common constants */
25 25
26#ifndef DEF_WBITS
27# define DEF_WBITS MAX_WBITS
28#endif
29/* default windowBits for decompression. MAX_WBITS is for compression only */
30
31#if MAX_MEM_LEVEL >= 8
32# define DEF_MEM_LEVEL 8
33#else
34# define DEF_MEM_LEVEL MAX_MEM_LEVEL
35#endif
36/* default memLevel */
37
38#define STORED_BLOCK 0 26#define STORED_BLOCK 0
39#define STATIC_TREES 1 27#define STATIC_TREES 1
40#define DYN_TREES 2 28#define DYN_TREES 2
diff --git a/include/media/cx2341x.h b/include/media/cx2341x.h
new file mode 100644
index 000000000000..51fb06b4c394
--- /dev/null
+++ b/include/media/cx2341x.h
@@ -0,0 +1,189 @@
1/*
2 cx23415/6 header containing common defines.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#ifndef CX2341X_H
20#define CX2341X_H
21
22enum cx2341x_port {
23 CX2341X_PORT_MEMORY = 0,
24 CX2341X_PORT_STREAMING = 1,
25 CX2341X_PORT_SERIAL = 2
26};
27
28struct cx2341x_mpeg_params {
29 /* misc */
30 enum cx2341x_port port;
31 u16 width;
32 u16 height;
33 u16 is_50hz;
34
35 /* stream */
36 enum v4l2_mpeg_stream_type stream_type;
37
38 /* audio */
39 enum v4l2_mpeg_audio_sampling_freq audio_sampling_freq;
40 enum v4l2_mpeg_audio_encoding audio_encoding;
41 enum v4l2_mpeg_audio_l2_bitrate audio_l2_bitrate;
42 enum v4l2_mpeg_audio_mode audio_mode;
43 enum v4l2_mpeg_audio_mode_extension audio_mode_extension;
44 enum v4l2_mpeg_audio_emphasis audio_emphasis;
45 enum v4l2_mpeg_audio_crc audio_crc;
46 u8 audio_properties;
47
48 /* video */
49 enum v4l2_mpeg_video_encoding video_encoding;
50 enum v4l2_mpeg_video_aspect video_aspect;
51 u16 video_b_frames;
52 u16 video_gop_size;
53 u16 video_gop_closure;
54 u16 video_pulldown;
55 enum v4l2_mpeg_video_bitrate_mode video_bitrate_mode;
56 u32 video_bitrate;
57 u32 video_bitrate_peak;
58 u16 video_temporal_decimation;
59
60 /* encoding filters */
61 enum v4l2_mpeg_cx2341x_video_spatial_filter_mode video_spatial_filter_mode;
62 u16 video_spatial_filter;
63 enum v4l2_mpeg_cx2341x_video_luma_spatial_filter_type video_luma_spatial_filter_type;
64 enum v4l2_mpeg_cx2341x_video_chroma_spatial_filter_type video_chroma_spatial_filter_type;
65 enum v4l2_mpeg_cx2341x_video_temporal_filter_mode video_temporal_filter_mode;
66 u16 video_temporal_filter;
67 enum v4l2_mpeg_cx2341x_video_median_filter_type video_median_filter_type;
68 u16 video_luma_median_filter_top;
69 u16 video_luma_median_filter_bottom;
70 u16 video_chroma_median_filter_top;
71 u16 video_chroma_median_filter_bottom;
72};
73
74#define CX2341X_MBOX_MAX_DATA 16
75
76extern const u32 cx2341x_mpeg_ctrls[];
77typedef int (*cx2341x_mbox_func)(void *priv, int cmd, int in, int out,
78 u32 data[CX2341X_MBOX_MAX_DATA]);
79int cx2341x_update(void *priv, cx2341x_mbox_func func,
80 const struct cx2341x_mpeg_params *old,
81 const struct cx2341x_mpeg_params *new);
82int cx2341x_ctrl_query(struct cx2341x_mpeg_params *params,
83 struct v4l2_queryctrl *qctrl);
84const char **cx2341x_ctrl_get_menu(u32 id);
85int cx2341x_ext_ctrls(struct cx2341x_mpeg_params *params,
86 struct v4l2_ext_controls *ctrls, int cmd);
87void cx2341x_fill_defaults(struct cx2341x_mpeg_params *p);
88void cx2341x_log_status(struct cx2341x_mpeg_params *p, int cardid);
89
90/* Firmware names */
91#define CX2341X_FIRM_ENC_FILENAME "v4l-cx2341x-enc.fw"
92/* Decoder firmware for the cx23415 only */
93#define CX2341X_FIRM_DEC_FILENAME "v4l-cx2341x-dec.fw"
94
95/* Firmware API commands */
96
97/* MPEG decoder API, specific to the cx23415 */
98#define CX2341X_DEC_PING_FW 0x00
99#define CX2341X_DEC_START_PLAYBACK 0x01
100#define CX2341X_DEC_STOP_PLAYBACK 0x02
101#define CX2341X_DEC_SET_PLAYBACK_SPEED 0x03
102#define CX2341X_DEC_STEP_VIDEO 0x05
103#define CX2341X_DEC_SET_DMA_BLOCK_SIZE 0x08
104#define CX2341X_DEC_GET_XFER_INFO 0x09
105#define CX2341X_DEC_GET_DMA_STATUS 0x0a
106#define CX2341X_DEC_SCHED_DMA_FROM_HOST 0x0b
107#define CX2341X_DEC_PAUSE_PLAYBACK 0x0d
108#define CX2341X_DEC_HALT_FW 0x0e
109#define CX2341X_DEC_SET_STANDARD 0x10
110#define CX2341X_DEC_GET_VERSION 0x11
111#define CX2341X_DEC_SET_STREAM_INPUT 0x14
112#define CX2341X_DEC_GET_TIMING_INFO 0x15
113#define CX2341X_DEC_SET_AUDIO_MODE 0x16
114#define CX2341X_DEC_SET_EVENT_NOTIFICATION 0x17
115#define CX2341X_DEC_SET_DISPLAY_BUFFERS 0x18
116#define CX2341X_DEC_EXTRACT_VBI 0x19
117#define CX2341X_DEC_SET_DECODER_SOURCE 0x1a
118#define CX2341X_DEC_SET_AUDIO_OUTPUT 0x1b
119#define CX2341X_DEC_SET_AV_DELAY 0x1c
120#define CX2341X_DEC_SET_PREBUFFERING 0x1e
121
122/* MPEG encoder API */
123#define CX2341X_ENC_PING_FW 0x80
124#define CX2341X_ENC_START_CAPTURE 0x81
125#define CX2341X_ENC_STOP_CAPTURE 0x82
126#define CX2341X_ENC_SET_AUDIO_ID 0x89
127#define CX2341X_ENC_SET_VIDEO_ID 0x8b
128#define CX2341X_ENC_SET_PCR_ID 0x8d
129#define CX2341X_ENC_SET_FRAME_RATE 0x8f
130#define CX2341X_ENC_SET_FRAME_SIZE 0x91
131#define CX2341X_ENC_SET_BIT_RATE 0x95
132#define CX2341X_ENC_SET_GOP_PROPERTIES 0x97
133#define CX2341X_ENC_SET_ASPECT_RATIO 0x99
134#define CX2341X_ENC_SET_DNR_FILTER_MODE 0x9b
135#define CX2341X_ENC_SET_DNR_FILTER_PROPS 0x9d
136#define CX2341X_ENC_SET_CORING_LEVELS 0x9f
137#define CX2341X_ENC_SET_SPATIAL_FILTER_TYPE 0xa1
138#define CX2341X_ENC_SET_3_2_PULLDOWN 0xb1
139#define CX2341X_ENC_SET_VBI_LINE 0xb7
140#define CX2341X_ENC_SET_STREAM_TYPE 0xb9
141#define CX2341X_ENC_SET_OUTPUT_PORT 0xbb
142#define CX2341X_ENC_SET_AUDIO_PROPERTIES 0xbd
143#define CX2341X_ENC_HALT_FW 0xc3
144#define CX2341X_ENC_GET_VERSION 0xc4
145#define CX2341X_ENC_SET_GOP_CLOSURE 0xc5
146#define CX2341X_ENC_GET_SEQ_END 0xc6
147#define CX2341X_ENC_SET_PGM_INDEX_INFO 0xc7
148#define CX2341X_ENC_SET_VBI_CONFIG 0xc8
149#define CX2341X_ENC_SET_DMA_BLOCK_SIZE 0xc9
150#define CX2341X_ENC_GET_PREV_DMA_INFO_MB_10 0xca
151#define CX2341X_ENC_GET_PREV_DMA_INFO_MB_9 0xcb
152#define CX2341X_ENC_SCHED_DMA_TO_HOST 0xcc
153#define CX2341X_ENC_INITIALIZE_INPUT 0xcd
154#define CX2341X_ENC_SET_FRAME_DROP_RATE 0xd0
155#define CX2341X_ENC_PAUSE_ENCODER 0xd2
156#define CX2341X_ENC_REFRESH_INPUT 0xd3
157#define CX2341X_ENC_SET_COPYRIGHT 0xd4
158#define CX2341X_ENC_SET_EVENT_NOTIFICATION 0xd5
159#define CX2341X_ENC_SET_NUM_VSYNC_LINES 0xd6
160#define CX2341X_ENC_SET_PLACEHOLDER 0xd7
161#define CX2341X_ENC_MUTE_VIDEO 0xd9
162#define CX2341X_ENC_MUTE_AUDIO 0xda
163#define CX2341X_ENC_UNKNOWN 0xdb
164#define CX2341X_ENC_MISC 0xdc
165
166/* OSD API, specific to the cx23415 */
167#define CX2341X_OSD_GET_FRAMEBUFFER 0x41
168#define CX2341X_OSD_GET_PIXEL_FORMAT 0x42
169#define CX2341X_OSD_SET_PIXEL_FORMAT 0x43
170#define CX2341X_OSD_GET_STATE 0x44
171#define CX2341X_OSD_SET_STATE 0x45
172#define CX2341X_OSD_GET_OSD_COORDS 0x46
173#define CX2341X_OSD_SET_OSD_COORDS 0x47
174#define CX2341X_OSD_GET_SCREEN_COORDS 0x48
175#define CX2341X_OSD_SET_SCREEN_COORDS 0x49
176#define CX2341X_OSD_GET_GLOBAL_ALPHA 0x4a
177#define CX2341X_OSD_SET_GLOBAL_ALPHA 0x4b
178#define CX2341X_OSD_SET_BLEND_COORDS 0x4c
179#define CX2341X_OSD_GET_FLICKER_STATE 0x4f
180#define CX2341X_OSD_SET_FLICKER_STATE 0x50
181#define CX2341X_OSD_BLT_COPY 0x52
182#define CX2341X_OSD_BLT_FILL 0x53
183#define CX2341X_OSD_BLT_TEXT 0x54
184#define CX2341X_OSD_SET_FRAMEBUFFER_WINDOW 0x56
185#define CX2341X_OSD_SET_CHROMA_KEY 0x60
186#define CX2341X_OSD_GET_ALPHA_CONTENT_INDEX 0x61
187#define CX2341X_OSD_SET_ALPHA_CONTENT_INDEX 0x62
188
189#endif /* CX2341X_H */
diff --git a/include/media/ir-common.h b/include/media/ir-common.h
index 302d5b3946e7..7bab09b0ed45 100644
--- a/include/media/ir-common.h
+++ b/include/media/ir-common.h
@@ -73,7 +73,7 @@ extern IR_KEYTAB_TYPE ir_codes_cinergy_1400[IR_KEYTAB_SIZE];
73extern IR_KEYTAB_TYPE ir_codes_avertv_303[IR_KEYTAB_SIZE]; 73extern IR_KEYTAB_TYPE ir_codes_avertv_303[IR_KEYTAB_SIZE];
74extern IR_KEYTAB_TYPE ir_codes_dntv_live_dvbt_pro[IR_KEYTAB_SIZE]; 74extern IR_KEYTAB_TYPE ir_codes_dntv_live_dvbt_pro[IR_KEYTAB_SIZE];
75extern IR_KEYTAB_TYPE ir_codes_em_terratec[IR_KEYTAB_SIZE]; 75extern IR_KEYTAB_TYPE ir_codes_em_terratec[IR_KEYTAB_SIZE];
76extern IR_KEYTAB_TYPE ir_codes_em_pinnacle_usb[IR_KEYTAB_SIZE]; 76extern IR_KEYTAB_TYPE ir_codes_pinnacle_grey[IR_KEYTAB_SIZE];
77extern IR_KEYTAB_TYPE ir_codes_flyvideo[IR_KEYTAB_SIZE]; 77extern IR_KEYTAB_TYPE ir_codes_flyvideo[IR_KEYTAB_SIZE];
78extern IR_KEYTAB_TYPE ir_codes_flydvb[IR_KEYTAB_SIZE]; 78extern IR_KEYTAB_TYPE ir_codes_flydvb[IR_KEYTAB_SIZE];
79extern IR_KEYTAB_TYPE ir_codes_cinergy[IR_KEYTAB_SIZE]; 79extern IR_KEYTAB_TYPE ir_codes_cinergy[IR_KEYTAB_SIZE];
@@ -87,8 +87,9 @@ extern IR_KEYTAB_TYPE ir_codes_pctv_sedna[IR_KEYTAB_SIZE];
87extern IR_KEYTAB_TYPE ir_codes_pv951[IR_KEYTAB_SIZE]; 87extern IR_KEYTAB_TYPE ir_codes_pv951[IR_KEYTAB_SIZE];
88extern IR_KEYTAB_TYPE ir_codes_rc5_tv[IR_KEYTAB_SIZE]; 88extern IR_KEYTAB_TYPE ir_codes_rc5_tv[IR_KEYTAB_SIZE];
89extern IR_KEYTAB_TYPE ir_codes_winfast[IR_KEYTAB_SIZE]; 89extern IR_KEYTAB_TYPE ir_codes_winfast[IR_KEYTAB_SIZE];
90extern IR_KEYTAB_TYPE ir_codes_pinnacle[IR_KEYTAB_SIZE]; 90extern IR_KEYTAB_TYPE ir_codes_pinnacle_color[IR_KEYTAB_SIZE];
91extern IR_KEYTAB_TYPE ir_codes_hauppauge_new[IR_KEYTAB_SIZE]; 91extern IR_KEYTAB_TYPE ir_codes_hauppauge_new[IR_KEYTAB_SIZE];
92extern IR_KEYTAB_TYPE ir_codes_npgtech[IR_KEYTAB_SIZE];
92 93
93#endif 94#endif
94 95
diff --git a/include/media/ir-kbd-i2c.h b/include/media/ir-kbd-i2c.h
index 730f21ed91db..a455f7ce5ee8 100644
--- a/include/media/ir-kbd-i2c.h
+++ b/include/media/ir-kbd-i2c.h
@@ -20,5 +20,6 @@ struct IR_i2c {
20 int (*get_key)(struct IR_i2c*, u32*, u32*); 20 int (*get_key)(struct IR_i2c*, u32*, u32*);
21}; 21};
22 22
23int get_key_pinnacle(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw); 23int get_key_pinnacle_grey(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw);
24int get_key_pinnacle_color(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw);
24#endif 25#endif
diff --git a/include/media/ovcamchip.h b/include/media/ovcamchip.h
index 8138983adced..0f43451f8bb3 100644
--- a/include/media/ovcamchip.h
+++ b/include/media/ovcamchip.h
@@ -15,6 +15,7 @@
15#define __LINUX_OVCAMCHIP_H 15#define __LINUX_OVCAMCHIP_H
16 16
17#include <linux/videodev.h> 17#include <linux/videodev.h>
18#include <media/v4l2-common.h>
18#include <linux/i2c.h> 19#include <linux/i2c.h>
19 20
20/* --------------------------------- */ 21/* --------------------------------- */
diff --git a/include/media/pwc-ioctl.h b/include/media/pwc-ioctl.h
new file mode 100644
index 000000000000..adc1254e887e
--- /dev/null
+++ b/include/media/pwc-ioctl.h
@@ -0,0 +1,325 @@
1#ifndef PWC_IOCTL_H
2#define PWC_IOCTL_H
3
4/* (C) 2001-2004 Nemosoft Unv.
5 (C) 2004-2006 Luc Saillard (luc@saillard.org)
6
7 NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx
8 driver and thus may have bugs that are not present in the original version.
9 Please send bug reports and support requests to <luc@saillard.org>.
10 The decompression routines have been implemented by reverse-engineering the
11 Nemosoft binary pwcx module. Caveat emptor.
12
13 This program is free software; you can redistribute it and/or modify
14 it under the terms of the GNU General Public License as published by
15 the Free Software Foundation; either version 2 of the License, or
16 (at your option) any later version.
17
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26*/
27
28/* This is pwc-ioctl.h belonging to PWC 10.0.10
29 It contains structures and defines to communicate from user space
30 directly to the driver.
31 */
32
33/*
34 Changes
35 2001/08/03 Alvarado Added ioctl constants to access methods for
36 changing white balance and red/blue gains
37 2002/12/15 G. H. Fernandez-Toribio VIDIOCGREALSIZE
38 2003/12/13 Nemosft Unv. Some modifications to make interfacing to
39 PWCX easier
40 2006/01/01 Luc Saillard Add raw format definition
41 */
42
43/* These are private ioctl() commands, specific for the Philips webcams.
44 They contain functions not found in other webcams, and settings not
45 specified in the Video4Linux API.
46
47 The #define names are built up like follows:
48 VIDIOC VIDeo IOCtl prefix
49 PWC Philps WebCam
50 G optional: Get
51 S optional: Set
52 ... the function
53 */
54
55#include <linux/types.h>
56#include <linux/version.h>
57
58
59 /* Enumeration of image sizes */
60#define PSZ_SQCIF 0x00
61#define PSZ_QSIF 0x01
62#define PSZ_QCIF 0x02
63#define PSZ_SIF 0x03
64#define PSZ_CIF 0x04
65#define PSZ_VGA 0x05
66#define PSZ_MAX 6
67
68
69/* The frame rate is encoded in the video_window.flags parameter using
70 the upper 16 bits, since some flags are defined nowadays. The following
71 defines provide a mask and shift to filter out this value.
72 This value can also be passing using the private flag when using v4l2 and
73 VIDIOC_S_FMT ioctl.
74
75 In 'Snapshot' mode the camera freezes its automatic exposure and colour
76 balance controls.
77 */
78#define PWC_FPS_SHIFT 16
79#define PWC_FPS_MASK 0x00FF0000
80#define PWC_FPS_FRMASK 0x003F0000
81#define PWC_FPS_SNAPSHOT 0x00400000
82#define PWC_QLT_MASK 0x03000000
83#define PWC_QLT_SHIFT 24
84
85
86/* structure for transferring x & y coordinates */
87struct pwc_coord
88{
89 int x, y; /* guess what */
90 int size; /* size, or offset */
91};
92
93
94/* Used with VIDIOCPWCPROBE */
95struct pwc_probe
96{
97 char name[32];
98 int type;
99};
100
101struct pwc_serial
102{
103 char serial[30]; /* String with serial number. Contains terminating 0 */
104};
105
106/* pwc_whitebalance.mode values */
107#define PWC_WB_INDOOR 0
108#define PWC_WB_OUTDOOR 1
109#define PWC_WB_FL 2
110#define PWC_WB_MANUAL 3
111#define PWC_WB_AUTO 4
112
113/* Used with VIDIOCPWC[SG]AWB (Auto White Balance).
114 Set mode to one of the PWC_WB_* values above.
115 *red and *blue are the respective gains of these colour components inside
116 the camera; range 0..65535
117 When 'mode' == PWC_WB_MANUAL, 'manual_red' and 'manual_blue' are set or read;
118 otherwise undefined.
119 'read_red' and 'read_blue' are read-only.
120*/
121struct pwc_whitebalance
122{
123 int mode;
124 int manual_red, manual_blue; /* R/W */
125 int read_red, read_blue; /* R/O */
126};
127
128/*
129 'control_speed' and 'control_delay' are used in automatic whitebalance mode,
130 and tell the camera how fast it should react to changes in lighting, and
131 with how much delay. Valid values are 0..65535.
132*/
133struct pwc_wb_speed
134{
135 int control_speed;
136 int control_delay;
137
138};
139
140/* Used with VIDIOCPWC[SG]LED */
141struct pwc_leds
142{
143 int led_on; /* Led on-time; range = 0..25000 */
144 int led_off; /* Led off-time; range = 0..25000 */
145};
146
147/* Image size (used with GREALSIZE) */
148struct pwc_imagesize
149{
150 int width;
151 int height;
152};
153
154/* Defines and structures for Motorized Pan & Tilt */
155#define PWC_MPT_PAN 0x01
156#define PWC_MPT_TILT 0x02
157#define PWC_MPT_TIMEOUT 0x04 /* for status */
158
159/* Set angles; when absolute != 0, the angle is absolute and the
160 driver calculates the relative offset for you. This can only
161 be used with VIDIOCPWCSANGLE; VIDIOCPWCGANGLE always returns
162 absolute angles.
163 */
164struct pwc_mpt_angles
165{
166 int absolute; /* write-only */
167 int pan; /* degrees * 100 */
168 int tilt; /* degress * 100 */
169};
170
171/* Range of angles of the camera, both horizontally and vertically.
172 */
173struct pwc_mpt_range
174{
175 int pan_min, pan_max; /* degrees * 100 */
176 int tilt_min, tilt_max;
177};
178
179struct pwc_mpt_status
180{
181 int status;
182 int time_pan;
183 int time_tilt;
184};
185
186
187/* This is used for out-of-kernel decompression. With it, you can get
188 all the necessary information to initialize and use the decompressor
189 routines in standalone applications.
190 */
191struct pwc_video_command
192{
193 int type; /* camera type (645, 675, 730, etc.) */
194 int release; /* release number */
195
196 int size; /* one of PSZ_* */
197 int alternate;
198 int command_len; /* length of USB video command */
199 unsigned char command_buf[13]; /* Actual USB video command */
200 int bandlength; /* >0 = compressed */
201 int frame_size; /* Size of one (un)compressed frame */
202};
203
204/* Flags for PWCX subroutines. Not all modules honour all flags. */
205#define PWCX_FLAG_PLANAR 0x0001
206#define PWCX_FLAG_BAYER 0x0008
207
208
209/* IOCTL definitions */
210
211 /* Restore user settings */
212#define VIDIOCPWCRUSER _IO('v', 192)
213 /* Save user settings */
214#define VIDIOCPWCSUSER _IO('v', 193)
215 /* Restore factory settings */
216#define VIDIOCPWCFACTORY _IO('v', 194)
217
218 /* You can manipulate the compression factor. A compression preference of 0
219 means use uncompressed modes when available; 1 is low compression, 2 is
220 medium and 3 is high compression preferred. Of course, the higher the
221 compression, the lower the bandwidth used but more chance of artefacts
222 in the image. The driver automatically chooses a higher compression when
223 the preferred mode is not available.
224 */
225 /* Set preferred compression quality (0 = uncompressed, 3 = highest compression) */
226#define VIDIOCPWCSCQUAL _IOW('v', 195, int)
227 /* Get preferred compression quality */
228#define VIDIOCPWCGCQUAL _IOR('v', 195, int)
229
230
231/* Retrieve serial number of camera */
232#define VIDIOCPWCGSERIAL _IOR('v', 198, struct pwc_serial)
233
234 /* This is a probe function; since so many devices are supported, it
235 becomes difficult to include all the names in programs that want to
236 check for the enhanced Philips stuff. So in stead, try this PROBE;
237 it returns a structure with the original name, and the corresponding
238 Philips type.
239 To use, fill the structure with zeroes, call PROBE and if that succeeds,
240 compare the name with that returned from VIDIOCGCAP; they should be the
241 same. If so, you can be assured it is a Philips (OEM) cam and the type
242 is valid.
243 */
244#define VIDIOCPWCPROBE _IOR('v', 199, struct pwc_probe)
245
246 /* Set AGC (Automatic Gain Control); int < 0 = auto, 0..65535 = fixed */
247#define VIDIOCPWCSAGC _IOW('v', 200, int)
248 /* Get AGC; int < 0 = auto; >= 0 = fixed, range 0..65535 */
249#define VIDIOCPWCGAGC _IOR('v', 200, int)
250 /* Set shutter speed; int < 0 = auto; >= 0 = fixed, range 0..65535 */
251#define VIDIOCPWCSSHUTTER _IOW('v', 201, int)
252
253 /* Color compensation (Auto White Balance) */
254#define VIDIOCPWCSAWB _IOW('v', 202, struct pwc_whitebalance)
255#define VIDIOCPWCGAWB _IOR('v', 202, struct pwc_whitebalance)
256
257 /* Auto WB speed */
258#define VIDIOCPWCSAWBSPEED _IOW('v', 203, struct pwc_wb_speed)
259#define VIDIOCPWCGAWBSPEED _IOR('v', 203, struct pwc_wb_speed)
260
261 /* LEDs on/off/blink; int range 0..65535 */
262#define VIDIOCPWCSLED _IOW('v', 205, struct pwc_leds)
263#define VIDIOCPWCGLED _IOR('v', 205, struct pwc_leds)
264
265 /* Contour (sharpness); int < 0 = auto, 0..65536 = fixed */
266#define VIDIOCPWCSCONTOUR _IOW('v', 206, int)
267#define VIDIOCPWCGCONTOUR _IOR('v', 206, int)
268
269 /* Backlight compensation; 0 = off, otherwise on */
270#define VIDIOCPWCSBACKLIGHT _IOW('v', 207, int)
271#define VIDIOCPWCGBACKLIGHT _IOR('v', 207, int)
272
273 /* Flickerless mode; = 0 off, otherwise on */
274#define VIDIOCPWCSFLICKER _IOW('v', 208, int)
275#define VIDIOCPWCGFLICKER _IOR('v', 208, int)
276
277 /* Dynamic noise reduction; 0 off, 3 = high noise reduction */
278#define VIDIOCPWCSDYNNOISE _IOW('v', 209, int)
279#define VIDIOCPWCGDYNNOISE _IOR('v', 209, int)
280
281 /* Real image size as used by the camera; tells you whether or not there's a gray border around the image */
282#define VIDIOCPWCGREALSIZE _IOR('v', 210, struct pwc_imagesize)
283
284 /* Motorized pan & tilt functions */
285#define VIDIOCPWCMPTRESET _IOW('v', 211, int)
286#define VIDIOCPWCMPTGRANGE _IOR('v', 211, struct pwc_mpt_range)
287#define VIDIOCPWCMPTSANGLE _IOW('v', 212, struct pwc_mpt_angles)
288#define VIDIOCPWCMPTGANGLE _IOR('v', 212, struct pwc_mpt_angles)
289#define VIDIOCPWCMPTSTATUS _IOR('v', 213, struct pwc_mpt_status)
290
291 /* Get the USB set-video command; needed for initializing libpwcx */
292#define VIDIOCPWCGVIDCMD _IOR('v', 215, struct pwc_video_command)
293struct pwc_table_init_buffer {
294 int len;
295 char *buffer;
296
297};
298#define VIDIOCPWCGVIDTABLE _IOR('v', 216, struct pwc_table_init_buffer)
299
300/*
301 * This is private command used when communicating with v4l2.
302 * In the future all private ioctl will be remove/replace to
303 * use interface offer by v4l2.
304 */
305
306#define V4L2_CID_PRIVATE_SAVE_USER (V4L2_CID_PRIVATE_BASE + 0)
307#define V4L2_CID_PRIVATE_RESTORE_USER (V4L2_CID_PRIVATE_BASE + 1)
308#define V4L2_CID_PRIVATE_RESTORE_FACTORY (V4L2_CID_PRIVATE_BASE + 2)
309#define V4L2_CID_PRIVATE_COLOUR_MODE (V4L2_CID_PRIVATE_BASE + 3)
310#define V4L2_CID_PRIVATE_AUTOCONTOUR (V4L2_CID_PRIVATE_BASE + 4)
311#define V4L2_CID_PRIVATE_CONTOUR (V4L2_CID_PRIVATE_BASE + 5)
312#define V4L2_CID_PRIVATE_BACKLIGHT (V4L2_CID_PRIVATE_BASE + 6)
313#define V4L2_CID_PRIVATE_FLICKERLESS (V4L2_CID_PRIVATE_BASE + 7)
314#define V4L2_CID_PRIVATE_NOISE_REDUCTION (V4L2_CID_PRIVATE_BASE + 8)
315
316struct pwc_raw_frame {
317 __le16 type; /* type of the webcam */
318 __le16 vbandlength; /* Size of 4lines compressed (used by the decompressor) */
319 __u8 cmd[4]; /* the four byte of the command (in case of nala,
320 only the first 3 bytes is filled) */
321 __u8 rawframe[0]; /* frame_size = H/4*vbandlength */
322} __attribute__ ((packed));
323
324
325#endif
diff --git a/include/media/saa7115.h b/include/media/saa7115.h
index 6b4836f3f057..9f0e2285a099 100644
--- a/include/media/saa7115.h
+++ b/include/media/saa7115.h
@@ -1,5 +1,5 @@
1/* 1/*
2 saa7115.h - definition for saa7113/4/5 inputs 2 saa7115.h - definition for saa7113/4/5 inputs and frequency flags
3 3
4 Copyright (C) 2006 Hans Verkuil (hverkuil@xs4all.nl) 4 Copyright (C) 2006 Hans Verkuil (hverkuil@xs4all.nl)
5 5
@@ -33,5 +33,14 @@
33#define SAA7115_SVIDEO2 8 33#define SAA7115_SVIDEO2 8
34#define SAA7115_SVIDEO3 9 34#define SAA7115_SVIDEO3 9
35 35
36/* SAA7115 v4l2_crystal_freq frequency values */
37#define SAA7115_FREQ_32_11_MHZ 32110000 /* 32.11 MHz crystal, SAA7114/5 only */
38#define SAA7115_FREQ_24_576_MHZ 24576000 /* 24.576 MHz crystal */
39
40/* SAA7115 v4l2_crystal_freq audio clock control flags */
41#define SAA7115_FREQ_FL_UCGC (1 << 0) /* SA 3A[7], UCGC, SAA7115 only */
42#define SAA7115_FREQ_FL_CGCDIV (1 << 1) /* SA 3A[6], CGCDIV, SAA7115 only */
43#define SAA7115_FREQ_FL_APLL (1 << 2) /* SA 3A[3], APLL, SAA7114/5 only */
44
36#endif 45#endif
37 46
diff --git a/include/media/saa7146_vv.h b/include/media/saa7146_vv.h
index 4507cb61ae93..83fe2e3d1e25 100644
--- a/include/media/saa7146_vv.h
+++ b/include/media/saa7146_vv.h
@@ -2,7 +2,7 @@
2#define __SAA7146_VV__ 2#define __SAA7146_VV__
3 3
4#include <linux/videodev.h> 4#include <linux/videodev.h>
5 5#include <media/v4l2-common.h>
6#include <media/saa7146.h> 6#include <media/saa7146.h>
7#include <media/video-buf.h> 7#include <media/video-buf.h>
8 8
diff --git a/include/media/tuner.h b/include/media/tuner.h
index 017fed7d5e4d..2f7b00b08e88 100644
--- a/include/media/tuner.h
+++ b/include/media/tuner.h
@@ -25,6 +25,8 @@
25#include <linux/videodev2.h> 25#include <linux/videodev2.h>
26#include <media/tuner-types.h> 26#include <media/tuner-types.h>
27 27
28extern int tuner_debug;
29
28#define ADDR_UNSET (255) 30#define ADDR_UNSET (255)
29 31
30#define TUNER_TEMIC_PAL 0 /* 4002 FH5 (3X 7756, 9483) */ 32#define TUNER_TEMIC_PAL 0 /* 4002 FH5 (3X 7756, 9483) */
@@ -108,7 +110,7 @@
108#define TUNER_TEA5767 62 /* Only FM Radio Tuner */ 110#define TUNER_TEA5767 62 /* Only FM Radio Tuner */
109#define TUNER_PHILIPS_FMD1216ME_MK3 63 111#define TUNER_PHILIPS_FMD1216ME_MK3 63
110 112
111#define TUNER_LG_TDVS_H062F 64 /* DViCO FusionHDTV 5 */ 113#define TUNER_LG_TDVS_H06XF 64 /* TDVS H061F, H062F, H064F */
112#define TUNER_YMEC_TVF66T5_B_DFF 65 /* Acorp Y878F */ 114#define TUNER_YMEC_TVF66T5_B_DFF 65 /* Acorp Y878F */
113#define TUNER_LG_TALN 66 115#define TUNER_LG_TALN 66
114#define TUNER_PHILIPS_TD1316 67 116#define TUNER_PHILIPS_TD1316 67
@@ -119,6 +121,8 @@
119#define TUNER_XCEIVE_XC3028 71 121#define TUNER_XCEIVE_XC3028 71
120 122
121#define TUNER_THOMSON_FE6600 72 /* DViCO FusionHDTV DVB-T Hybrid */ 123#define TUNER_THOMSON_FE6600 72 /* DViCO FusionHDTV DVB-T Hybrid */
124#define TUNER_SAMSUNG_TCPG_6121P30A 73 /* Hauppauge PVR-500 PAL */
125#define TUNER_TDA9887 74 /* This tuner should be used only internally */
122 126
123/* tv card specific */ 127/* tv card specific */
124#define TDA9887_PRESENT (1<<0) 128#define TDA9887_PRESENT (1<<0)
@@ -190,6 +194,10 @@ struct tuner {
190 194
191 int using_v4l2; 195 int using_v4l2;
192 196
197 /* used by tda9887 */
198 unsigned int tda9887_config;
199 unsigned char tda9887_data[4];
200
193 /* used by MT2032 */ 201 /* used by MT2032 */
194 unsigned int xogc; 202 unsigned int xogc;
195 unsigned int radio_if2; 203 unsigned int radio_if2;
@@ -206,6 +214,8 @@ struct tuner {
206 void (*set_radio_freq)(struct i2c_client *c, unsigned int freq); 214 void (*set_radio_freq)(struct i2c_client *c, unsigned int freq);
207 int (*has_signal)(struct i2c_client *c); 215 int (*has_signal)(struct i2c_client *c);
208 int (*is_stereo)(struct i2c_client *c); 216 int (*is_stereo)(struct i2c_client *c);
217 int (*get_afc)(struct i2c_client *c);
218 void (*tuner_status)(struct i2c_client *c);
209 void (*standby)(struct i2c_client *c); 219 void (*standby)(struct i2c_client *c);
210}; 220};
211 221
@@ -218,6 +228,7 @@ extern int tda8290_probe(struct i2c_client *c);
218extern int tea5767_tuner_init(struct i2c_client *c); 228extern int tea5767_tuner_init(struct i2c_client *c);
219extern int default_tuner_init(struct i2c_client *c); 229extern int default_tuner_init(struct i2c_client *c);
220extern int tea5767_autodetection(struct i2c_client *c); 230extern int tea5767_autodetection(struct i2c_client *c);
231extern int tda9887_tuner_init(struct i2c_client *c);
221 232
222#define tuner_warn(fmt, arg...) do {\ 233#define tuner_warn(fmt, arg...) do {\
223 printk(KERN_WARNING "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \ 234 printk(KERN_WARNING "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \
diff --git a/include/media/tvp5150.h b/include/media/tvp5150.h
new file mode 100644
index 000000000000..72bd2a2b8bfd
--- /dev/null
+++ b/include/media/tvp5150.h
@@ -0,0 +1,34 @@
1/*
2 tvp5150.h - definition for tvp5150 inputs
3
4 Copyright (C) 2006 Hans Verkuil (hverkuil@xs4all.nl)
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19*/
20
21#ifndef _TVP5150_H_
22#define _TVP5150_H_
23
24/* TVP5150 HW inputs */
25#define TVP5150_COMPOSITE0 0
26#define TVP5150_COMPOSITE1 1
27#define TVP5150_SVIDEO 2
28
29/* TVP5150 HW outputs */
30#define TVP5150_NORMAL 0
31#define TVP5150_BLACK_SCREEN 1
32
33#endif
34
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index 642520acdfa7..5564db13c0d5 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -26,8 +26,14 @@
26#ifndef V4L2_COMMON_H_ 26#ifndef V4L2_COMMON_H_
27#define V4L2_COMMON_H_ 27#define V4L2_COMMON_H_
28 28
29#include <media/v4l2-dev.h>
30
29/* v4l debugging and diagnostics */ 31/* v4l debugging and diagnostics */
30 32
33/* Debug bitmask flags to be used on V4L2 */
34#define V4L2_DEBUG_IOCTL 0x01
35#define V4L2_DEBUG_IOCTL_ARG 0x02
36
31/* Common printk constucts for v4l-i2c drivers. These macros create a unique 37/* Common printk constucts for v4l-i2c drivers. These macros create a unique
32 prefix consisting of the driver name, the adapter number and the i2c 38 prefix consisting of the driver name, the adapter number and the i2c
33 address. */ 39 address. */
@@ -78,6 +84,19 @@ extern void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg);
78 84
79/* ------------------------------------------------------------------------- */ 85/* ------------------------------------------------------------------------- */
80 86
87/* Control helper functions */
88
89int v4l2_ctrl_check(struct v4l2_ext_control *ctrl, struct v4l2_queryctrl *qctrl,
90 const char **menu_items);
91const char **v4l2_ctrl_get_menu(u32 id);
92int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 step, s32 def);
93int v4l2_ctrl_query_fill_std(struct v4l2_queryctrl *qctrl);
94int v4l2_ctrl_query_menu(struct v4l2_querymenu *qmenu,
95 struct v4l2_queryctrl *qctrl, const char **menu_items);
96u32 v4l2_ctrl_next(const u32 * const *ctrl_classes, u32 id);
97
98/* ------------------------------------------------------------------------- */
99
81/* Internal ioctls */ 100/* Internal ioctls */
82 101
83/* VIDIOC_INT_G_REGISTER and VIDIOC_INT_S_REGISTER */ 102/* VIDIOC_INT_G_REGISTER and VIDIOC_INT_S_REGISTER */
@@ -112,6 +131,8 @@ enum v4l2_chip_ident {
112 V4L2_IDENT_SAA7129 = 159, 131 V4L2_IDENT_SAA7129 = 159,
113 132
114 /* module cx25840: reserved range 200-249 */ 133 /* module cx25840: reserved range 200-249 */
134 V4L2_IDENT_CX25836 = 236,
135 V4L2_IDENT_CX25837 = 237,
115 V4L2_IDENT_CX25840 = 240, 136 V4L2_IDENT_CX25840 = 240,
116 V4L2_IDENT_CX25841 = 241, 137 V4L2_IDENT_CX25841 = 241,
117 V4L2_IDENT_CX25842 = 242, 138 V4L2_IDENT_CX25842 = 242,
@@ -211,4 +232,15 @@ struct v4l2_routing {
211#define VIDIOC_INT_S_VIDEO_ROUTING _IOW ('d', 111, struct v4l2_routing) 232#define VIDIOC_INT_S_VIDEO_ROUTING _IOW ('d', 111, struct v4l2_routing)
212#define VIDIOC_INT_G_VIDEO_ROUTING _IOR ('d', 112, struct v4l2_routing) 233#define VIDIOC_INT_G_VIDEO_ROUTING _IOR ('d', 112, struct v4l2_routing)
213 234
235struct v4l2_crystal_freq {
236 u32 freq; /* frequency in Hz of the crystal */
237 u32 flags; /* device specific flags */
238};
239
240/* Sets the frequency of the crystal used to generate the clocks.
241 An extra flags field allows device specific configuration regarding
242 clock frequency dividers, etc. If not used, then set flags to 0.
243 If the frequency is not supported, then -EINVAL is returned. */
244#define VIDIOC_INT_S_CRYSTAL_FREQ _IOW ('d', 113, struct v4l2_crystal_freq)
245
214#endif /* V4L2_COMMON_H_ */ 246#endif /* V4L2_COMMON_H_ */
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
new file mode 100644
index 000000000000..a1b473190e65
--- /dev/null
+++ b/include/media/v4l2-dev.h
@@ -0,0 +1,375 @@
1/*
2 *
3 * V 4 L 2 D R I V E R H E L P E R A P I
4 *
5 * Moved from videodev2.h
6 *
7 * Some commonly needed functions for drivers (v4l2-common.o module)
8 */
9#ifndef _V4L2_DEV_H
10#define _V4L2_DEV_H
11
12#define OBSOLETE_OWNER 1 /* to be removed soon */
13
14#include <linux/poll.h>
15#include <linux/fs.h>
16#include <linux/device.h>
17#include <linux/mutex.h>
18#include <linux/compiler.h> /* need __user */
19#ifdef CONFIG_VIDEO_V4L1
20#include <linux/videodev.h>
21#else
22#include <linux/videodev2.h>
23#endif
24
25#include <linux/fs.h>
26
27#define VIDEO_MAJOR 81
28/* Minor device allocation */
29#define MINOR_VFL_TYPE_GRABBER_MIN 0
30#define MINOR_VFL_TYPE_GRABBER_MAX 63
31#define MINOR_VFL_TYPE_RADIO_MIN 64
32#define MINOR_VFL_TYPE_RADIO_MAX 127
33#define MINOR_VFL_TYPE_VTX_MIN 192
34#define MINOR_VFL_TYPE_VTX_MAX 223
35#define MINOR_VFL_TYPE_VBI_MIN 224
36#define MINOR_VFL_TYPE_VBI_MAX 255
37
38#define VFL_TYPE_GRABBER 0
39#define VFL_TYPE_VBI 1
40#define VFL_TYPE_RADIO 2
41#define VFL_TYPE_VTX 3
42
43/* Video standard functions */
44extern unsigned int v4l2_video_std_fps(struct v4l2_standard *vs);
45extern int v4l2_video_std_construct(struct v4l2_standard *vs,
46 int id, char *name);
47
48/* prority handling */
49struct v4l2_prio_state {
50 atomic_t prios[4];
51};
52int v4l2_prio_init(struct v4l2_prio_state *global);
53int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local,
54 enum v4l2_priority new);
55int v4l2_prio_open(struct v4l2_prio_state *global, enum v4l2_priority *local);
56int v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority *local);
57enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global);
58int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority *local);
59
60/* names for fancy debug output */
61extern char *v4l2_field_names[];
62extern char *v4l2_type_names[];
63
64/* Compatibility layer interface -- v4l1-compat module */
65typedef int (*v4l2_kioctl)(struct inode *inode, struct file *file,
66 unsigned int cmd, void *arg);
67#ifdef CONFIG_VIDEO_V4L1_COMPAT
68int v4l_compat_translate_ioctl(struct inode *inode, struct file *file,
69 int cmd, void *arg, v4l2_kioctl driver_ioctl);
70#else
71#define v4l_compat_translate_ioctl(inode,file,cmd,arg,ioctl) -EINVAL
72#endif
73
74/* 32 Bits compatibility layer for 64 bits processors */
75extern long v4l_compat_ioctl32(struct file *file, unsigned int cmd,
76 unsigned long arg);
77
78/*
79 * Newer version of video_device, handled by videodev2.c
80 * This version moves redundant code from video device code to
81 * the common handler
82 */
83struct v4l2_tvnorm {
84 char *name;
85 v4l2_std_id id;
86
87 void *priv_data;
88};
89
90struct video_device
91{
92 /* device ops */
93 const struct file_operations *fops;
94
95 /* device info */
96 struct device *dev;
97 char name[32];
98 int type; /* v4l1 */
99 int type2; /* v4l2 */
100 int hardware;
101 int minor;
102
103 int debug; /* Activates debug level*/
104
105 /* Video standard vars */
106 int tvnormsize; /* Size of tvnorm array */
107 v4l2_std_id current_norm; /* Current tvnorm */
108 struct v4l2_tvnorm *tvnorms;
109
110 /* callbacks */
111 void (*release)(struct video_device *vfd);
112
113 /* ioctl callbacks */
114
115 /* VIDIOC_QUERYCAP handler */
116 int (*vidioc_querycap)(struct file *file, void *fh, struct v4l2_capability *cap);
117
118 /* Priority handling */
119 int (*vidioc_g_priority) (struct file *file, void *fh,
120 enum v4l2_priority *p);
121 int (*vidioc_s_priority) (struct file *file, void *fh,
122 enum v4l2_priority p);
123
124 /* VIDIOC_ENUM_FMT handlers */
125 int (*vidioc_enum_fmt_cap) (struct file *file, void *fh,
126 struct v4l2_fmtdesc *f);
127 int (*vidioc_enum_fmt_overlay) (struct file *file, void *fh,
128 struct v4l2_fmtdesc *f);
129 int (*vidioc_enum_fmt_vbi) (struct file *file, void *fh,
130 struct v4l2_fmtdesc *f);
131 int (*vidioc_enum_fmt_vbi_capture) (struct file *file, void *fh,
132 struct v4l2_fmtdesc *f);
133 int (*vidioc_enum_fmt_video_output)(struct file *file, void *fh,
134 struct v4l2_fmtdesc *f);
135 int (*vidioc_enum_fmt_vbi_output) (struct file *file, void *fh,
136 struct v4l2_fmtdesc *f);
137 int (*vidioc_enum_fmt_type_private)(struct file *file, void *fh,
138 struct v4l2_fmtdesc *f);
139
140 /* VIDIOC_G_FMT handlers */
141 int (*vidioc_g_fmt_cap) (struct file *file, void *fh,
142 struct v4l2_format *f);
143 int (*vidioc_g_fmt_overlay) (struct file *file, void *fh,
144 struct v4l2_format *f);
145 int (*vidioc_g_fmt_vbi) (struct file *file, void *fh,
146 struct v4l2_format *f);
147 int (*vidioc_g_fmt_vbi_output) (struct file *file, void *fh,
148 struct v4l2_format *f);
149 int (*vidioc_g_fmt_vbi_capture)(struct file *file, void *fh,
150 struct v4l2_format *f);
151 int (*vidioc_g_fmt_video_output)(struct file *file, void *fh,
152 struct v4l2_format *f);
153 int (*vidioc_g_fmt_type_private)(struct file *file, void *fh,
154 struct v4l2_format *f);
155
156 /* VIDIOC_S_FMT handlers */
157 int (*vidioc_s_fmt_cap) (struct file *file, void *fh,
158 struct v4l2_format *f);
159
160 int (*vidioc_s_fmt_overlay) (struct file *file, void *fh,
161 struct v4l2_format *f);
162 int (*vidioc_s_fmt_vbi) (struct file *file, void *fh,
163 struct v4l2_format *f);
164 int (*vidioc_s_fmt_vbi_output) (struct file *file, void *fh,
165 struct v4l2_format *f);
166 int (*vidioc_s_fmt_vbi_capture)(struct file *file, void *fh,
167 struct v4l2_format *f);
168 int (*vidioc_s_fmt_video_output)(struct file *file, void *fh,
169 struct v4l2_format *f);
170 int (*vidioc_s_fmt_type_private)(struct file *file, void *fh,
171 struct v4l2_format *f);
172
173 /* VIDIOC_TRY_FMT handlers */
174 int (*vidioc_try_fmt_cap) (struct file *file, void *fh,
175 struct v4l2_format *f);
176 int (*vidioc_try_fmt_overlay) (struct file *file, void *fh,
177 struct v4l2_format *f);
178 int (*vidioc_try_fmt_vbi) (struct file *file, void *fh,
179 struct v4l2_format *f);
180 int (*vidioc_try_fmt_vbi_output) (struct file *file, void *fh,
181 struct v4l2_format *f);
182 int (*vidioc_try_fmt_vbi_capture)(struct file *file, void *fh,
183 struct v4l2_format *f);
184 int (*vidioc_try_fmt_video_output)(struct file *file, void *fh,
185 struct v4l2_format *f);
186 int (*vidioc_try_fmt_type_private)(struct file *file, void *fh,
187 struct v4l2_format *f);
188
189 /* Buffer handlers */
190 int (*vidioc_reqbufs) (struct file *file, void *fh, struct v4l2_requestbuffers *b);
191 int (*vidioc_querybuf)(struct file *file, void *fh, struct v4l2_buffer *b);
192 int (*vidioc_qbuf) (struct file *file, void *fh, struct v4l2_buffer *b);
193 int (*vidioc_dqbuf) (struct file *file, void *fh, struct v4l2_buffer *b);
194
195
196 int (*vidioc_overlay) (struct file *file, void *fh, unsigned int i);
197#ifdef HAVE_V4L1
198 /* buffer type is struct vidio_mbuf * */
199 int (*vidiocgmbuf) (struct file *file, void *fh, struct video_mbuf *p);
200#endif
201 int (*vidioc_g_fbuf) (struct file *file, void *fh,
202 struct v4l2_framebuffer *a);
203 int (*vidioc_s_fbuf) (struct file *file, void *fh,
204 struct v4l2_framebuffer *a);
205
206 /* Stream on/off */
207 int (*vidioc_streamon) (struct file *file, void *fh, enum v4l2_buf_type i);
208 int (*vidioc_streamoff)(struct file *file, void *fh, enum v4l2_buf_type i);
209
210 /* Standard handling
211 G_STD and ENUMSTD are handled by videodev.c
212 */
213 int (*vidioc_s_std) (struct file *file, void *fh, v4l2_std_id a);
214 int (*vidioc_querystd) (struct file *file, void *fh, v4l2_std_id *a);
215
216 /* Input handling */
217 int (*vidioc_enum_input)(struct file *file, void *fh,
218 struct v4l2_input *inp);
219 int (*vidioc_g_input) (struct file *file, void *fh, unsigned int *i);
220 int (*vidioc_s_input) (struct file *file, void *fh, unsigned int i);
221
222 /* Output handling */
223 int (*vidioc_enumoutput) (struct file *file, void *fh,
224 struct v4l2_output *a);
225 int (*vidioc_g_output) (struct file *file, void *fh, unsigned int *i);
226 int (*vidioc_s_output) (struct file *file, void *fh, unsigned int i);
227
228 /* Control handling */
229 int (*vidioc_queryctrl) (struct file *file, void *fh,
230 struct v4l2_queryctrl *a);
231 int (*vidioc_g_ctrl) (struct file *file, void *fh,
232 struct v4l2_control *a);
233 int (*vidioc_s_ctrl) (struct file *file, void *fh,
234 struct v4l2_control *a);
235 int (*vidioc_g_ext_ctrls) (struct file *file, void *fh,
236 struct v4l2_ext_controls *a);
237 int (*vidioc_s_ext_ctrls) (struct file *file, void *fh,
238 struct v4l2_ext_controls *a);
239 int (*vidioc_try_ext_ctrls) (struct file *file, void *fh,
240 struct v4l2_ext_controls *a);
241 int (*vidioc_querymenu) (struct file *file, void *fh,
242 struct v4l2_querymenu *a);
243
244 /* Audio ioctls */
245 int (*vidioc_enumaudio) (struct file *file, void *fh,
246 struct v4l2_audio *a);
247 int (*vidioc_g_audio) (struct file *file, void *fh,
248 struct v4l2_audio *a);
249 int (*vidioc_s_audio) (struct file *file, void *fh,
250 struct v4l2_audio *a);
251
252 /* Audio out ioctls */
253 int (*vidioc_enumaudout) (struct file *file, void *fh,
254 struct v4l2_audioout *a);
255 int (*vidioc_g_audout) (struct file *file, void *fh,
256 struct v4l2_audioout *a);
257 int (*vidioc_s_audout) (struct file *file, void *fh,
258 struct v4l2_audioout *a);
259 int (*vidioc_g_modulator) (struct file *file, void *fh,
260 struct v4l2_modulator *a);
261 int (*vidioc_s_modulator) (struct file *file, void *fh,
262 struct v4l2_modulator *a);
263 /* Crop ioctls */
264 int (*vidioc_cropcap) (struct file *file, void *fh,
265 struct v4l2_cropcap *a);
266 int (*vidioc_g_crop) (struct file *file, void *fh,
267 struct v4l2_crop *a);
268 int (*vidioc_s_crop) (struct file *file, void *fh,
269 struct v4l2_crop *a);
270 /* Compression ioctls */
271 int (*vidioc_g_mpegcomp) (struct file *file, void *fh,
272 struct v4l2_mpeg_compression *a);
273 int (*vidioc_s_mpegcomp) (struct file *file, void *fh,
274 struct v4l2_mpeg_compression *a);
275 int (*vidioc_g_jpegcomp) (struct file *file, void *fh,
276 struct v4l2_jpegcompression *a);
277 int (*vidioc_s_jpegcomp) (struct file *file, void *fh,
278 struct v4l2_jpegcompression *a);
279
280 /* Stream type-dependent parameter ioctls */
281 int (*vidioc_g_parm) (struct file *file, void *fh,
282 struct v4l2_streamparm *a);
283 int (*vidioc_s_parm) (struct file *file, void *fh,
284 struct v4l2_streamparm *a);
285
286 /* Tuner ioctls */
287 int (*vidioc_g_tuner) (struct file *file, void *fh,
288 struct v4l2_tuner *a);
289 int (*vidioc_s_tuner) (struct file *file, void *fh,
290 struct v4l2_tuner *a);
291 int (*vidioc_g_frequency) (struct file *file, void *fh,
292 struct v4l2_frequency *a);
293 int (*vidioc_s_frequency) (struct file *file, void *fh,
294 struct v4l2_frequency *a);
295
296 /* Sliced VBI cap */
297 int (*vidioc_g_sliced_vbi_cap) (struct file *file, void *fh,
298 struct v4l2_sliced_vbi_cap *a);
299
300 /* Log status ioctl */
301 int (*vidioc_log_status) (struct file *file, void *fh);
302
303
304#ifdef OBSOLETE_OWNER /* to be removed soon */
305/* obsolete -- fops->owner is used instead */
306struct module *owner;
307/* dev->driver_data will be used instead some day.
308 * Use the video_{get|set}_drvdata() helper functions,
309 * so the switch over will be transparent for you.
310 * Or use {pci|usb}_{get|set}_drvdata() directly. */
311void *priv;
312#endif
313
314 /* for videodev.c intenal usage -- please don't touch */
315 int users; /* video_exclusive_{open|close} ... */
316 struct mutex lock; /* ... helper function uses these */
317 char devfs_name[64]; /* devfs */
318 struct class_device class_dev; /* sysfs */
319};
320
321/* Version 2 functions */
322extern int video_register_device(struct video_device *vfd, int type, int nr);
323void video_unregister_device(struct video_device *);
324extern int video_ioctl2(struct inode *inode, struct file *file,
325 unsigned int cmd, unsigned long arg);
326
327/* helper functions to alloc / release struct video_device, the
328 later can be used for video_device->release() */
329struct video_device *video_device_alloc(void);
330void video_device_release(struct video_device *vfd);
331
332/* Include support for obsoleted stuff */
333extern int video_usercopy(struct inode *inode, struct file *file,
334 unsigned int cmd, unsigned long arg,
335 int (*func)(struct inode *inode, struct file *file,
336 unsigned int cmd, void *arg));
337
338
339#ifdef HAVE_V4L1
340#include <linux/mm.h>
341
342extern struct video_device* video_devdata(struct file*);
343
344#define to_video_device(cd) container_of(cd, struct video_device, class_dev)
345static inline void
346video_device_create_file(struct video_device *vfd,
347 struct class_device_attribute *attr)
348{
349 class_device_create_file(&vfd->class_dev, attr);
350}
351static inline void
352video_device_remove_file(struct video_device *vfd,
353 struct class_device_attribute *attr)
354{
355 class_device_remove_file(&vfd->class_dev, attr);
356}
357
358#ifdef OBSOLETE_OWNER /* to be removed soon */
359/* helper functions to access driver private data. */
360static inline void *video_get_drvdata(struct video_device *dev)
361{
362 return dev->priv;
363}
364
365static inline void video_set_drvdata(struct video_device *dev, void *data)
366{
367 dev->priv = data;
368}
369#endif
370
371extern int video_exclusive_open(struct inode *inode, struct file *file);
372extern int video_exclusive_release(struct inode *inode, struct file *file);
373#endif /* HAVE_V4L1 */
374
375#endif /* _V4L2_DEV_H */
diff --git a/include/media/video-buf-dvb.h b/include/media/video-buf-dvb.h
index b78d90fe629f..8233cafdeef6 100644
--- a/include/media/video-buf-dvb.h
+++ b/include/media/video-buf-dvb.h
@@ -26,7 +26,8 @@ struct videobuf_dvb {
26 26
27int videobuf_dvb_register(struct videobuf_dvb *dvb, 27int videobuf_dvb_register(struct videobuf_dvb *dvb,
28 struct module *module, 28 struct module *module,
29 void *adapter_priv); 29 void *adapter_priv,
30 struct device *device);
30void videobuf_dvb_unregister(struct videobuf_dvb *dvb); 31void videobuf_dvb_unregister(struct videobuf_dvb *dvb);
31 32
32/* 33/*
diff --git a/include/media/video-buf.h b/include/media/video-buf.h
index fff3fd0fbf94..1115a256969f 100644
--- a/include/media/video-buf.h
+++ b/include/media/video-buf.h
@@ -23,6 +23,7 @@
23 */ 23 */
24 24
25#include <linux/videodev2.h> 25#include <linux/videodev2.h>
26#include <linux/poll.h>
26 27
27#define UNSET (-1U) 28#define UNSET (-1U)
28 29
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h
index d5147770ad47..ecc42864b001 100644
--- a/include/net/ieee80211.h
+++ b/include/net/ieee80211.h
@@ -968,6 +968,7 @@ enum ieee80211_state {
968 968
969enum { 969enum {
970 IEEE80211_CH_PASSIVE_ONLY = (1 << 0), 970 IEEE80211_CH_PASSIVE_ONLY = (1 << 0),
971 IEEE80211_CH_80211H_RULES = (1 << 1),
971 IEEE80211_CH_B_ONLY = (1 << 2), 972 IEEE80211_CH_B_ONLY = (1 << 2),
972 IEEE80211_CH_NO_IBSS = (1 << 3), 973 IEEE80211_CH_NO_IBSS = (1 << 3),
973 IEEE80211_CH_UNIFORM_SPREADING = (1 << 4), 974 IEEE80211_CH_UNIFORM_SPREADING = (1 << 4),
@@ -976,10 +977,10 @@ enum {
976}; 977};
977 978
978struct ieee80211_channel { 979struct ieee80211_channel {
979 u32 freq; 980 u32 freq; /* in MHz */
980 u8 channel; 981 u8 channel;
981 u8 flags; 982 u8 flags;
982 u8 max_power; 983 u8 max_power; /* in dBm */
983}; 984};
984 985
985struct ieee80211_geo { 986struct ieee80211_geo {
diff --git a/include/net/protocol.h b/include/net/protocol.h
index bcaee39bd2ff..3b6dc15c68a5 100644
--- a/include/net/protocol.h
+++ b/include/net/protocol.h
@@ -36,6 +36,7 @@
36struct net_protocol { 36struct net_protocol {
37 int (*handler)(struct sk_buff *skb); 37 int (*handler)(struct sk_buff *skb);
38 void (*err_handler)(struct sk_buff *skb, u32 info); 38 void (*err_handler)(struct sk_buff *skb, u32 info);
39 struct sk_buff *(*gso_segment)(struct sk_buff *skb, int sg);
39 int no_policy; 40 int no_policy;
40}; 41};
41 42
diff --git a/include/net/sock.h b/include/net/sock.h
index d10dfecb6cbd..2d8d6adf1616 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1030,9 +1030,13 @@ static inline void sk_setup_caps(struct sock *sk, struct dst_entry *dst)
1030{ 1030{
1031 __sk_dst_set(sk, dst); 1031 __sk_dst_set(sk, dst);
1032 sk->sk_route_caps = dst->dev->features; 1032 sk->sk_route_caps = dst->dev->features;
1033 if (sk->sk_route_caps & NETIF_F_GSO)
1034 sk->sk_route_caps |= NETIF_F_TSO;
1033 if (sk->sk_route_caps & NETIF_F_TSO) { 1035 if (sk->sk_route_caps & NETIF_F_TSO) {
1034 if (sock_flag(sk, SOCK_NO_LARGESEND) || dst->header_len) 1036 if (sock_flag(sk, SOCK_NO_LARGESEND) || dst->header_len)
1035 sk->sk_route_caps &= ~NETIF_F_TSO; 1037 sk->sk_route_caps &= ~NETIF_F_TSO;
1038 else
1039 sk->sk_route_caps |= NETIF_F_SG | NETIF_F_HW_CSUM;
1036 } 1040 }
1037} 1041}
1038 1042
@@ -1265,6 +1269,7 @@ sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
1265 * sk_eat_skb - Release a skb if it is no longer needed 1269 * sk_eat_skb - Release a skb if it is no longer needed
1266 * @sk: socket to eat this skb from 1270 * @sk: socket to eat this skb from
1267 * @skb: socket buffer to eat 1271 * @skb: socket buffer to eat
1272 * @copied_early: flag indicating whether DMA operations copied this data early
1268 * 1273 *
1269 * This routine must be called with interrupts disabled or with the socket 1274 * This routine must be called with interrupts disabled or with the socket
1270 * locked so that the sk_buff queue operation is ok. 1275 * locked so that the sk_buff queue operation is ok.
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 5f4eb5c79689..ca3d38dfc00b 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -569,13 +569,13 @@ struct tcp_skb_cb {
569 */ 569 */
570static inline int tcp_skb_pcount(const struct sk_buff *skb) 570static inline int tcp_skb_pcount(const struct sk_buff *skb)
571{ 571{
572 return skb_shinfo(skb)->tso_segs; 572 return skb_shinfo(skb)->gso_segs;
573} 573}
574 574
575/* This is valid iff tcp_skb_pcount() > 1. */ 575/* This is valid iff tcp_skb_pcount() > 1. */
576static inline int tcp_skb_mss(const struct sk_buff *skb) 576static inline int tcp_skb_mss(const struct sk_buff *skb)
577{ 577{
578 return skb_shinfo(skb)->tso_size; 578 return skb_shinfo(skb)->gso_size;
579} 579}
580 580
581static inline void tcp_dec_pcount_approx(__u32 *count, 581static inline void tcp_dec_pcount_approx(__u32 *count,
@@ -1086,6 +1086,8 @@ extern struct request_sock_ops tcp_request_sock_ops;
1086 1086
1087extern int tcp_v4_destroy_sock(struct sock *sk); 1087extern int tcp_v4_destroy_sock(struct sock *sk);
1088 1088
1089extern struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int sg);
1090
1089#ifdef CONFIG_PROC_FS 1091#ifdef CONFIG_PROC_FS
1090extern int tcp4_proc_init(void); 1092extern int tcp4_proc_init(void);
1091extern void tcp4_proc_exit(void); 1093extern void tcp4_proc_exit(void);
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h
index e5618b90996e..253797c60095 100644
--- a/include/scsi/iscsi_if.h
+++ b/include/scsi/iscsi_if.h
@@ -43,6 +43,10 @@ enum iscsi_uevent_e {
43 ISCSI_UEVENT_GET_STATS = UEVENT_BASE + 10, 43 ISCSI_UEVENT_GET_STATS = UEVENT_BASE + 10,
44 ISCSI_UEVENT_GET_PARAM = UEVENT_BASE + 11, 44 ISCSI_UEVENT_GET_PARAM = UEVENT_BASE + 11,
45 45
46 ISCSI_UEVENT_TRANSPORT_EP_CONNECT = UEVENT_BASE + 12,
47 ISCSI_UEVENT_TRANSPORT_EP_POLL = UEVENT_BASE + 13,
48 ISCSI_UEVENT_TRANSPORT_EP_DISCONNECT = UEVENT_BASE + 14,
49
46 /* up events */ 50 /* up events */
47 ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1, 51 ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1,
48 ISCSI_KEVENT_CONN_ERROR = KEVENT_BASE + 2, 52 ISCSI_KEVENT_CONN_ERROR = KEVENT_BASE + 2,
@@ -60,61 +64,83 @@ struct iscsi_uevent {
60 uint32_t initial_cmdsn; 64 uint32_t initial_cmdsn;
61 } c_session; 65 } c_session;
62 struct msg_destroy_session { 66 struct msg_destroy_session {
63 uint64_t session_handle;
64 uint32_t sid; 67 uint32_t sid;
65 } d_session; 68 } d_session;
66 struct msg_create_conn { 69 struct msg_create_conn {
67 uint64_t session_handle;
68 uint32_t cid;
69 uint32_t sid; 70 uint32_t sid;
71 uint32_t cid;
70 } c_conn; 72 } c_conn;
71 struct msg_bind_conn { 73 struct msg_bind_conn {
72 uint64_t session_handle; 74 uint32_t sid;
73 uint64_t conn_handle; 75 uint32_t cid;
74 uint32_t transport_fd; 76 uint64_t transport_eph;
75 uint32_t is_leading; 77 uint32_t is_leading;
76 } b_conn; 78 } b_conn;
77 struct msg_destroy_conn { 79 struct msg_destroy_conn {
78 uint64_t conn_handle; 80 uint32_t sid;
79 uint32_t cid; 81 uint32_t cid;
80 } d_conn; 82 } d_conn;
81 struct msg_send_pdu { 83 struct msg_send_pdu {
84 uint32_t sid;
85 uint32_t cid;
82 uint32_t hdr_size; 86 uint32_t hdr_size;
83 uint32_t data_size; 87 uint32_t data_size;
84 uint64_t conn_handle;
85 } send_pdu; 88 } send_pdu;
86 struct msg_set_param { 89 struct msg_set_param {
87 uint64_t conn_handle; 90 uint32_t sid;
91 uint32_t cid;
88 uint32_t param; /* enum iscsi_param */ 92 uint32_t param; /* enum iscsi_param */
89 uint32_t value; 93 uint32_t len;
90 } set_param; 94 } set_param;
91 struct msg_start_conn { 95 struct msg_start_conn {
92 uint64_t conn_handle; 96 uint32_t sid;
97 uint32_t cid;
93 } start_conn; 98 } start_conn;
94 struct msg_stop_conn { 99 struct msg_stop_conn {
100 uint32_t sid;
101 uint32_t cid;
95 uint64_t conn_handle; 102 uint64_t conn_handle;
96 uint32_t flag; 103 uint32_t flag;
97 } stop_conn; 104 } stop_conn;
98 struct msg_get_stats { 105 struct msg_get_stats {
99 uint64_t conn_handle; 106 uint32_t sid;
107 uint32_t cid;
100 } get_stats; 108 } get_stats;
109 struct msg_transport_connect {
110 uint32_t non_blocking;
111 } ep_connect;
112 struct msg_transport_poll {
113 uint64_t ep_handle;
114 uint32_t timeout_ms;
115 } ep_poll;
116 struct msg_transport_disconnect {
117 uint64_t ep_handle;
118 } ep_disconnect;
101 } u; 119 } u;
102 union { 120 union {
103 /* messages k -> u */ 121 /* messages k -> u */
104 uint64_t handle;
105 int retcode; 122 int retcode;
106 struct msg_create_session_ret { 123 struct msg_create_session_ret {
107 uint64_t session_handle;
108 uint32_t sid; 124 uint32_t sid;
125 uint32_t host_no;
109 } c_session_ret; 126 } c_session_ret;
127 struct msg_create_conn_ret {
128 uint32_t sid;
129 uint32_t cid;
130 } c_conn_ret;
110 struct msg_recv_req { 131 struct msg_recv_req {
132 uint32_t sid;
133 uint32_t cid;
111 uint64_t recv_handle; 134 uint64_t recv_handle;
112 uint64_t conn_handle;
113 } recv_req; 135 } recv_req;
114 struct msg_conn_error { 136 struct msg_conn_error {
115 uint64_t conn_handle; 137 uint32_t sid;
138 uint32_t cid;
116 uint32_t error; /* enum iscsi_err */ 139 uint32_t error; /* enum iscsi_err */
117 } connerror; 140 } connerror;
141 struct msg_transport_connect_ret {
142 uint64_t handle;
143 } ep_connect_ret;
118 } r; 144 } r;
119} __attribute__ ((aligned (sizeof(uint64_t)))); 145} __attribute__ ((aligned (sizeof(uint64_t))));
120 146
@@ -139,29 +165,66 @@ enum iscsi_err {
139 ISCSI_ERR_SESSION_FAILED = ISCSI_ERR_BASE + 13, 165 ISCSI_ERR_SESSION_FAILED = ISCSI_ERR_BASE + 13,
140 ISCSI_ERR_HDR_DGST = ISCSI_ERR_BASE + 14, 166 ISCSI_ERR_HDR_DGST = ISCSI_ERR_BASE + 14,
141 ISCSI_ERR_DATA_DGST = ISCSI_ERR_BASE + 15, 167 ISCSI_ERR_DATA_DGST = ISCSI_ERR_BASE + 15,
142 ISCSI_ERR_PARAM_NOT_FOUND = ISCSI_ERR_BASE + 16 168 ISCSI_ERR_PARAM_NOT_FOUND = ISCSI_ERR_BASE + 16,
169 ISCSI_ERR_NO_SCSI_CMD = ISCSI_ERR_BASE + 17,
143}; 170};
144 171
145/* 172/*
146 * iSCSI Parameters (RFC3720) 173 * iSCSI Parameters (RFC3720)
147 */ 174 */
148enum iscsi_param { 175enum iscsi_param {
149 ISCSI_PARAM_MAX_RECV_DLENGTH = 0, 176 /* passed in using netlink set param */
150 ISCSI_PARAM_MAX_XMIT_DLENGTH = 1, 177 ISCSI_PARAM_MAX_RECV_DLENGTH,
151 ISCSI_PARAM_HDRDGST_EN = 2, 178 ISCSI_PARAM_MAX_XMIT_DLENGTH,
152 ISCSI_PARAM_DATADGST_EN = 3, 179 ISCSI_PARAM_HDRDGST_EN,
153 ISCSI_PARAM_INITIAL_R2T_EN = 4, 180 ISCSI_PARAM_DATADGST_EN,
154 ISCSI_PARAM_MAX_R2T = 5, 181 ISCSI_PARAM_INITIAL_R2T_EN,
155 ISCSI_PARAM_IMM_DATA_EN = 6, 182 ISCSI_PARAM_MAX_R2T,
156 ISCSI_PARAM_FIRST_BURST = 7, 183 ISCSI_PARAM_IMM_DATA_EN,
157 ISCSI_PARAM_MAX_BURST = 8, 184 ISCSI_PARAM_FIRST_BURST,
158 ISCSI_PARAM_PDU_INORDER_EN = 9, 185 ISCSI_PARAM_MAX_BURST,
159 ISCSI_PARAM_DATASEQ_INORDER_EN = 10, 186 ISCSI_PARAM_PDU_INORDER_EN,
160 ISCSI_PARAM_ERL = 11, 187 ISCSI_PARAM_DATASEQ_INORDER_EN,
161 ISCSI_PARAM_IFMARKER_EN = 12, 188 ISCSI_PARAM_ERL,
162 ISCSI_PARAM_OFMARKER_EN = 13, 189 ISCSI_PARAM_IFMARKER_EN,
190 ISCSI_PARAM_OFMARKER_EN,
191 ISCSI_PARAM_EXP_STATSN,
192 ISCSI_PARAM_TARGET_NAME,
193 ISCSI_PARAM_TPGT,
194 ISCSI_PARAM_PERSISTENT_ADDRESS,
195 ISCSI_PARAM_PERSISTENT_PORT,
196 ISCSI_PARAM_SESS_RECOVERY_TMO,
197
198 /* pased in through bind conn using transport_fd */
199 ISCSI_PARAM_CONN_PORT,
200 ISCSI_PARAM_CONN_ADDRESS,
201
202 /* must always be last */
203 ISCSI_PARAM_MAX,
163}; 204};
164#define ISCSI_PARAM_MAX 14 205
206#define ISCSI_MAX_RECV_DLENGTH (1 << ISCSI_PARAM_MAX_RECV_DLENGTH)
207#define ISCSI_MAX_XMIT_DLENGTH (1 << ISCSI_PARAM_MAX_XMIT_DLENGTH)
208#define ISCSI_HDRDGST_EN (1 << ISCSI_PARAM_HDRDGST_EN)
209#define ISCSI_DATADGST_EN (1 << ISCSI_PARAM_DATADGST_EN)
210#define ISCSI_INITIAL_R2T_EN (1 << ISCSI_PARAM_INITIAL_R2T_EN)
211#define ISCSI_MAX_R2T (1 << ISCSI_PARAM_MAX_R2T)
212#define ISCSI_IMM_DATA_EN (1 << ISCSI_PARAM_IMM_DATA_EN)
213#define ISCSI_FIRST_BURST (1 << ISCSI_PARAM_FIRST_BURST)
214#define ISCSI_MAX_BURST (1 << ISCSI_PARAM_MAX_BURST)
215#define ISCSI_PDU_INORDER_EN (1 << ISCSI_PARAM_PDU_INORDER_EN)
216#define ISCSI_DATASEQ_INORDER_EN (1 << ISCSI_PARAM_DATASEQ_INORDER_EN)
217#define ISCSI_ERL (1 << ISCSI_PARAM_ERL)
218#define ISCSI_IFMARKER_EN (1 << ISCSI_PARAM_IFMARKER_EN)
219#define ISCSI_OFMARKER_EN (1 << ISCSI_PARAM_OFMARKER_EN)
220#define ISCSI_EXP_STATSN (1 << ISCSI_PARAM_EXP_STATSN)
221#define ISCSI_TARGET_NAME (1 << ISCSI_PARAM_TARGET_NAME)
222#define ISCSI_TPGT (1 << ISCSI_PARAM_TPGT)
223#define ISCSI_PERSISTENT_ADDRESS (1 << ISCSI_PARAM_PERSISTENT_ADDRESS)
224#define ISCSI_PERSISTENT_PORT (1 << ISCSI_PARAM_PERSISTENT_PORT)
225#define ISCSI_SESS_RECOVERY_TMO (1 << ISCSI_PARAM_SESS_RECOVERY_TMO)
226#define ISCSI_CONN_PORT (1 << ISCSI_PARAM_CONN_PORT)
227#define ISCSI_CONN_ADDRESS (1 << ISCSI_PARAM_CONN_ADDRESS)
165 228
166#define iscsi_ptr(_handle) ((void*)(unsigned long)_handle) 229#define iscsi_ptr(_handle) ((void*)(unsigned long)_handle)
167#define iscsi_handle(_ptr) ((uint64_t)(unsigned long)_ptr) 230#define iscsi_handle(_ptr) ((uint64_t)(unsigned long)_ptr)
diff --git a/include/scsi/iscsi_proto.h b/include/scsi/iscsi_proto.h
index 4feda05fdf25..02f6e4b9e693 100644
--- a/include/scsi/iscsi_proto.h
+++ b/include/scsi/iscsi_proto.h
@@ -21,8 +21,6 @@
21#ifndef ISCSI_PROTO_H 21#ifndef ISCSI_PROTO_H
22#define ISCSI_PROTO_H 22#define ISCSI_PROTO_H
23 23
24#define ISCSI_VERSION_STR "0.3"
25#define ISCSI_DATE_STR "22-Apr-2005"
26#define ISCSI_DRAFT20_VERSION 0x00 24#define ISCSI_DRAFT20_VERSION 0x00
27 25
28/* default iSCSI listen port for incoming connections */ 26/* default iSCSI listen port for incoming connections */
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
new file mode 100644
index 000000000000..cbf7e58bd6f9
--- /dev/null
+++ b/include/scsi/libiscsi.h
@@ -0,0 +1,282 @@
1/*
2 * iSCSI lib definitions
3 *
4 * Copyright (C) 2006 Red Hat, Inc. All rights reserved.
5 * Copyright (C) 2004 - 2006 Mike Christie
6 * Copyright (C) 2004 - 2005 Dmitry Yusupov
7 * Copyright (C) 2004 - 2005 Alex Aizman
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 */
23#ifndef LIBISCSI_H
24#define LIBISCSI_H
25
26#include <linux/types.h>
27#include <linux/mutex.h>
28#include <scsi/iscsi_proto.h>
29#include <scsi/iscsi_if.h>
30
31struct scsi_transport_template;
32struct scsi_device;
33struct Scsi_Host;
34struct scsi_cmnd;
35struct socket;
36struct iscsi_transport;
37struct iscsi_cls_session;
38struct iscsi_cls_conn;
39struct iscsi_session;
40struct iscsi_nopin;
41
42/* #define DEBUG_SCSI */
43#ifdef DEBUG_SCSI
44#define debug_scsi(fmt...) printk(KERN_INFO "iscsi: " fmt)
45#else
46#define debug_scsi(fmt...)
47#endif
48
49#define ISCSI_XMIT_CMDS_MAX 128 /* must be power of 2 */
50#define ISCSI_MGMT_CMDS_MAX 32 /* must be power of 2 */
51#define ISCSI_CONN_MAX 1
52
53#define ISCSI_MGMT_ITT_OFFSET 0xa00
54
55#define ISCSI_DEF_CMD_PER_LUN 32
56#define ISCSI_MAX_CMD_PER_LUN 128
57
58/* Task Mgmt states */
59#define TMABORT_INITIAL 0x0
60#define TMABORT_SUCCESS 0x1
61#define TMABORT_FAILED 0x2
62#define TMABORT_TIMEDOUT 0x3
63
64/* Connection suspend "bit" */
65#define ISCSI_SUSPEND_BIT 1
66
67#define ISCSI_ITT_MASK (0xfff)
68#define ISCSI_CID_SHIFT 12
69#define ISCSI_CID_MASK (0xffff << ISCSI_CID_SHIFT)
70#define ISCSI_AGE_SHIFT 28
71#define ISCSI_AGE_MASK (0xf << ISCSI_AGE_SHIFT)
72
73struct iscsi_mgmt_task {
74 /*
75 * Becuae LLDs allocate their hdr differently, this is a pointer to
76 * that storage. It must be setup at session creation time.
77 */
78 struct iscsi_hdr *hdr;
79 char *data; /* mgmt payload */
80 int data_count; /* counts data to be sent */
81 uint32_t itt; /* this ITT */
82 void *dd_data; /* driver/transport data */
83 struct list_head running;
84};
85
86struct iscsi_cmd_task {
87 /*
88 * Becuae LLDs allocate their hdr differently, this is a pointer to
89 * that storage. It must be setup at session creation time.
90 */
91 struct iscsi_cmd *hdr;
92 int itt; /* this ITT */
93 int datasn; /* DataSN */
94
95 uint32_t unsol_datasn;
96 int imm_count; /* imm-data (bytes) */
97 int unsol_count; /* unsolicited (bytes)*/
98 int data_count; /* remaining Data-Out */
99 struct scsi_cmnd *sc; /* associated SCSI cmd*/
100 int total_length;
101 struct iscsi_conn *conn; /* used connection */
102 struct iscsi_mgmt_task *mtask; /* tmf mtask in progr */
103
104 struct list_head running; /* running cmd list */
105 void *dd_data; /* driver/transport data */
106};
107
108struct iscsi_conn {
109 struct iscsi_cls_conn *cls_conn; /* ptr to class connection */
110 void *dd_data; /* iscsi_transport data */
111 struct iscsi_session *session; /* parent session */
112 /*
113 * LLDs should set this lock. It protects the transport recv
114 * code
115 */
116 rwlock_t *recv_lock;
117 /*
118 * conn_stop() flag: stop to recover, stop to terminate
119 */
120 int stop_stage;
121
122 /* iSCSI connection-wide sequencing */
123 uint32_t exp_statsn;
124
125 /* control data */
126 int id; /* CID */
127 struct list_head item; /* maintains list of conns */
128 int c_stage; /* connection state */
129 struct iscsi_mgmt_task *login_mtask; /* mtask used for login/text */
130 struct iscsi_mgmt_task *mtask; /* xmit mtask in progress */
131 struct iscsi_cmd_task *ctask; /* xmit ctask in progress */
132
133 /* xmit */
134 struct kfifo *immqueue; /* immediate xmit queue */
135 struct kfifo *mgmtqueue; /* mgmt (control) xmit queue */
136 struct list_head mgmt_run_list; /* list of control tasks */
137 struct kfifo *xmitqueue; /* data-path cmd queue */
138 struct list_head run_list; /* list of cmds in progress */
139 struct work_struct xmitwork; /* per-conn. xmit workqueue */
140 /*
141 * serializes connection xmit, access to kfifos:
142 * xmitqueue, immqueue, mgmtqueue
143 */
144 struct mutex xmitmutex;
145
146 unsigned long suspend_tx; /* suspend Tx */
147 unsigned long suspend_rx; /* suspend Rx */
148
149 /* abort */
150 wait_queue_head_t ehwait; /* used in eh_abort() */
151 struct iscsi_tm tmhdr;
152 struct timer_list tmabort_timer;
153 int tmabort_state; /* see TMABORT_INITIAL, etc.*/
154
155 /* negotiated params */
156 int max_recv_dlength; /* initiator_max_recv_dsl*/
157 int max_xmit_dlength; /* target_max_recv_dsl */
158 int hdrdgst_en;
159 int datadgst_en;
160
161 /* MIB-statistics */
162 uint64_t txdata_octets;
163 uint64_t rxdata_octets;
164 uint32_t scsicmd_pdus_cnt;
165 uint32_t dataout_pdus_cnt;
166 uint32_t scsirsp_pdus_cnt;
167 uint32_t datain_pdus_cnt;
168 uint32_t r2t_pdus_cnt;
169 uint32_t tmfcmd_pdus_cnt;
170 int32_t tmfrsp_pdus_cnt;
171
172 /* custom statistics */
173 uint32_t eh_abort_cnt;
174};
175
176struct iscsi_queue {
177 struct kfifo *queue; /* FIFO Queue */
178 void **pool; /* Pool of elements */
179 int max; /* Max number of elements */
180};
181
182struct iscsi_session {
183 /* iSCSI session-wide sequencing */
184 uint32_t cmdsn;
185 uint32_t exp_cmdsn;
186 uint32_t max_cmdsn;
187
188 /* configuration */
189 int initial_r2t_en;
190 int max_r2t;
191 int imm_data_en;
192 int first_burst;
193 int max_burst;
194 int time2wait;
195 int time2retain;
196 int pdu_inorder_en;
197 int dataseq_inorder_en;
198 int erl;
199 int ifmarker_en;
200 int ofmarker_en;
201
202 /* control data */
203 struct iscsi_transport *tt;
204 struct Scsi_Host *host;
205 struct iscsi_conn *leadconn; /* leading connection */
206 spinlock_t lock; /* protects session state, *
207 * sequence numbers, *
208 * session resources: *
209 * - cmdpool, *
210 * - mgmtpool, *
211 * - r2tpool */
212 int state; /* session state */
213 struct list_head item;
214 int age; /* counts session re-opens */
215
216 struct list_head connections; /* list of connections */
217 int cmds_max; /* size of cmds array */
218 struct iscsi_cmd_task **cmds; /* Original Cmds arr */
219 struct iscsi_queue cmdpool; /* PDU's pool */
220 int mgmtpool_max; /* size of mgmt array */
221 struct iscsi_mgmt_task **mgmt_cmds; /* Original mgmt arr */
222 struct iscsi_queue mgmtpool; /* Mgmt PDU's pool */
223};
224
225/*
226 * scsi host template
227 */
228extern int iscsi_change_queue_depth(struct scsi_device *sdev, int depth);
229extern int iscsi_eh_abort(struct scsi_cmnd *sc);
230extern int iscsi_eh_host_reset(struct scsi_cmnd *sc);
231extern int iscsi_queuecommand(struct scsi_cmnd *sc,
232 void (*done)(struct scsi_cmnd *));
233
234/*
235 * session management
236 */
237extern struct iscsi_cls_session *
238iscsi_session_setup(struct iscsi_transport *, struct scsi_transport_template *,
239 int, int, uint32_t, uint32_t *);
240extern void iscsi_session_teardown(struct iscsi_cls_session *);
241extern struct iscsi_session *class_to_transport_session(struct iscsi_cls_session *);
242extern void iscsi_session_recovery_timedout(struct iscsi_cls_session *);
243
244#define session_to_cls(_sess) \
245 hostdata_session(_sess->host->hostdata)
246
247/*
248 * connection management
249 */
250extern struct iscsi_cls_conn *iscsi_conn_setup(struct iscsi_cls_session *,
251 uint32_t);
252extern void iscsi_conn_teardown(struct iscsi_cls_conn *);
253extern int iscsi_conn_start(struct iscsi_cls_conn *);
254extern void iscsi_conn_stop(struct iscsi_cls_conn *, int);
255extern int iscsi_conn_bind(struct iscsi_cls_session *, struct iscsi_cls_conn *,
256 int);
257extern void iscsi_conn_failure(struct iscsi_conn *conn, enum iscsi_err err);
258
259/*
260 * pdu and task processing
261 */
262extern int iscsi_check_assign_cmdsn(struct iscsi_session *,
263 struct iscsi_nopin *);
264extern void iscsi_prep_unsolicit_data_pdu(struct iscsi_cmd_task *,
265 struct iscsi_data *hdr,
266 int transport_data_cnt);
267extern int iscsi_conn_send_pdu(struct iscsi_cls_conn *, struct iscsi_hdr *,
268 char *, uint32_t);
269extern int iscsi_complete_pdu(struct iscsi_conn *, struct iscsi_hdr *,
270 char *, int);
271extern int __iscsi_complete_pdu(struct iscsi_conn *, struct iscsi_hdr *,
272 char *, int);
273extern int iscsi_verify_itt(struct iscsi_conn *, struct iscsi_hdr *,
274 uint32_t *);
275
276/*
277 * generic helpers
278 */
279extern void iscsi_pool_free(struct iscsi_queue *, void **);
280extern int iscsi_pool_init(struct iscsi_queue *, int, void ***, int);
281
282#endif
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 1ace1b9fe537..e46cd404bd7d 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -9,7 +9,6 @@
9struct request; 9struct request;
10struct scatterlist; 10struct scatterlist;
11struct scsi_device; 11struct scsi_device;
12struct scsi_request;
13 12
14 13
15/* embedded in scsi_cmnd */ 14/* embedded in scsi_cmnd */
@@ -29,13 +28,8 @@ struct scsi_pointer {
29}; 28};
30 29
31struct scsi_cmnd { 30struct scsi_cmnd {
32 int sc_magic;
33
34 struct scsi_device *device; 31 struct scsi_device *device;
35 struct scsi_request *sc_request;
36
37 struct list_head list; /* scsi_cmnd participates in queue lists */ 32 struct list_head list; /* scsi_cmnd participates in queue lists */
38
39 struct list_head eh_entry; /* entry for the host eh_cmd_q */ 33 struct list_head eh_entry; /* entry for the host eh_cmd_q */
40 int eh_eflags; /* Used by error handlr */ 34 int eh_eflags; /* Used by error handlr */
41 void (*done) (struct scsi_cmnd *); /* Mid-level done function */ 35 void (*done) (struct scsi_cmnd *); /* Mid-level done function */
@@ -151,5 +145,10 @@ extern struct scsi_cmnd *scsi_get_command(struct scsi_device *, gfp_t);
151extern void scsi_put_command(struct scsi_cmnd *); 145extern void scsi_put_command(struct scsi_cmnd *);
152extern void scsi_io_completion(struct scsi_cmnd *, unsigned int, unsigned int); 146extern void scsi_io_completion(struct scsi_cmnd *, unsigned int, unsigned int);
153extern void scsi_finish_command(struct scsi_cmnd *cmd); 147extern void scsi_finish_command(struct scsi_cmnd *cmd);
148extern void scsi_req_abort_cmd(struct scsi_cmnd *cmd);
149
150extern void *scsi_kmap_atomic_sg(struct scatterlist *sg, int sg_count,
151 size_t *offset, size_t *len);
152extern void scsi_kunmap_atomic_sg(void *virt);
154 153
155#endif /* _SCSI_SCSI_CMND_H */ 154#endif /* _SCSI_SCSI_CMND_H */
diff --git a/include/scsi/scsi_dbg.h b/include/scsi/scsi_dbg.h
index 4d69dee66d4d..3bbbfbe8cbfc 100644
--- a/include/scsi/scsi_dbg.h
+++ b/include/scsi/scsi_dbg.h
@@ -2,14 +2,12 @@
2#define _SCSI_SCSI_DBG_H 2#define _SCSI_SCSI_DBG_H
3 3
4struct scsi_cmnd; 4struct scsi_cmnd;
5struct scsi_request;
6struct scsi_sense_hdr; 5struct scsi_sense_hdr;
7 6
8extern void scsi_print_command(struct scsi_cmnd *); 7extern void scsi_print_command(struct scsi_cmnd *);
9extern void scsi_print_sense_hdr(const char *, struct scsi_sense_hdr *); 8extern void scsi_print_sense_hdr(const char *, struct scsi_sense_hdr *);
10extern void __scsi_print_command(unsigned char *); 9extern void __scsi_print_command(unsigned char *);
11extern void scsi_print_sense(const char *, struct scsi_cmnd *); 10extern void scsi_print_sense(const char *, struct scsi_cmnd *);
12extern void scsi_print_req_sense(const char *, struct scsi_request *);
13extern void __scsi_print_sense(const char *name, 11extern void __scsi_print_sense(const char *name,
14 const unsigned char *sense_buffer, 12 const unsigned char *sense_buffer,
15 int sense_len); 13 int sense_len);
diff --git a/include/scsi/scsi_devinfo.h b/include/scsi/scsi_devinfo.h
index d31b16d25a09..b4ddd3b18b4c 100644
--- a/include/scsi/scsi_devinfo.h
+++ b/include/scsi/scsi_devinfo.h
@@ -29,4 +29,5 @@
29#define BLIST_SELECT_NO_ATN 0x200000 /* select without ATN */ 29#define BLIST_SELECT_NO_ATN 0x200000 /* select without ATN */
30#define BLIST_RETRY_HWERROR 0x400000 /* retry HARDWARE_ERROR */ 30#define BLIST_RETRY_HWERROR 0x400000 /* retry HARDWARE_ERROR */
31#define BLIST_MAX_512 0x800000 /* maximum 512 sector cdb length */ 31#define BLIST_MAX_512 0x800000 /* maximum 512 sector cdb length */
32#define BLIST_ATTACH_PQ3 0x1000000 /* Scan: Attach to PQ3 devices */
32#endif 33#endif
diff --git a/include/scsi/scsi_eh.h b/include/scsi/scsi_eh.h
index d160880b2a87..c5c0f6762a01 100644
--- a/include/scsi/scsi_eh.h
+++ b/include/scsi/scsi_eh.h
@@ -3,7 +3,6 @@
3 3
4struct scsi_cmnd; 4struct scsi_cmnd;
5struct scsi_device; 5struct scsi_device;
6struct scsi_request;
7struct Scsi_Host; 6struct Scsi_Host;
8 7
9/* 8/*
@@ -43,8 +42,6 @@ extern void scsi_report_device_reset(struct Scsi_Host *, int, int);
43extern int scsi_block_when_processing_errors(struct scsi_device *); 42extern int scsi_block_when_processing_errors(struct scsi_device *);
44extern int scsi_normalize_sense(const u8 *sense_buffer, int sb_len, 43extern int scsi_normalize_sense(const u8 *sense_buffer, int sb_len,
45 struct scsi_sense_hdr *sshdr); 44 struct scsi_sense_hdr *sshdr);
46extern int scsi_request_normalize_sense(struct scsi_request *sreq,
47 struct scsi_sense_hdr *sshdr);
48extern int scsi_command_normalize_sense(struct scsi_cmnd *cmd, 45extern int scsi_command_normalize_sense(struct scsi_cmnd *cmd,
49 struct scsi_sense_hdr *sshdr); 46 struct scsi_sense_hdr *sshdr);
50 47
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index de6ce541a046..a42efd6e4be8 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -472,6 +472,7 @@ struct Scsi_Host {
472 */ 472 */
473 unsigned int host_busy; /* commands actually active on low-level */ 473 unsigned int host_busy; /* commands actually active on low-level */
474 unsigned int host_failed; /* commands that failed. */ 474 unsigned int host_failed; /* commands that failed. */
475 unsigned int host_eh_scheduled; /* EH scheduled without command */
475 476
476 unsigned short host_no; /* Used for IOCTL_GET_IDLUN, /proc/scsi et al. */ 477 unsigned short host_no; /* Used for IOCTL_GET_IDLUN, /proc/scsi et al. */
477 int resetting; /* if set, it means that last_reset is a valid value */ 478 int resetting; /* if set, it means that last_reset is a valid value */
diff --git a/include/scsi/scsi_request.h b/include/scsi/scsi_request.h
deleted file mode 100644
index 98d69fdb851c..000000000000
--- a/include/scsi/scsi_request.h
+++ /dev/null
@@ -1,54 +0,0 @@
1#ifndef _SCSI_SCSI_REQUEST_H
2#define _SCSI_SCSI_REQUEST_H
3
4#include <scsi/scsi_cmnd.h>
5
6struct request;
7struct scsi_cmnd;
8struct scsi_device;
9struct Scsi_Host;
10
11
12/*
13 * This is essentially a slimmed down version of Scsi_Cmnd. The point of
14 * having this is that requests that are injected into the queue as result
15 * of things like ioctls and character devices shouldn't be using a
16 * Scsi_Cmnd until such a time that the command is actually at the head
17 * of the queue and being sent to the driver.
18 */
19struct scsi_request {
20 int sr_magic;
21 int sr_result; /* Status code from lower level driver */
22 unsigned char sr_sense_buffer[SCSI_SENSE_BUFFERSIZE]; /* obtained by REQUEST SENSE
23 * when CHECK CONDITION is
24 * received on original command
25 * (auto-sense) */
26
27 struct Scsi_Host *sr_host;
28 struct scsi_device *sr_device;
29 struct scsi_cmnd *sr_command;
30 struct request *sr_request; /* A copy of the command we are
31 working on */
32 unsigned sr_bufflen; /* Size of data buffer */
33 void *sr_buffer; /* Data buffer */
34 int sr_allowed;
35 enum dma_data_direction sr_data_direction;
36 unsigned char sr_cmd_len;
37 unsigned char sr_cmnd[MAX_COMMAND_SIZE];
38 void (*sr_done) (struct scsi_cmnd *); /* Mid-level done function */
39 int sr_timeout_per_command;
40 unsigned short sr_use_sg; /* Number of pieces of scatter-gather */
41 unsigned short sr_sglist_len; /* size of malloc'd scatter-gather list */
42 unsigned sr_underflow; /* Return error if less than
43 this amount is transferred */
44 void *upper_private_data; /* reserved for owner (usually upper
45 level driver) of this request */
46};
47
48extern struct scsi_request *scsi_allocate_request(struct scsi_device *, gfp_t);
49extern void scsi_release_request(struct scsi_request *);
50extern void scsi_do_req(struct scsi_request *, const void *cmnd,
51 void *buffer, unsigned bufflen,
52 void (*done) (struct scsi_cmnd *),
53 int timeout, int retries);
54#endif /* _SCSI_SCSI_REQUEST_H */
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index b41cf077e54b..b684426a5900 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -2,7 +2,7 @@
2 * iSCSI transport class definitions 2 * iSCSI transport class definitions
3 * 3 *
4 * Copyright (C) IBM Corporation, 2004 4 * Copyright (C) IBM Corporation, 2004
5 * Copyright (C) Mike Christie, 2004 - 2005 5 * Copyright (C) Mike Christie, 2004 - 2006
6 * Copyright (C) Dmitry Yusupov, 2004 - 2005 6 * Copyright (C) Dmitry Yusupov, 2004 - 2005
7 * Copyright (C) Alex Aizman, 2004 - 2005 7 * Copyright (C) Alex Aizman, 2004 - 2005
8 * 8 *
@@ -27,9 +27,13 @@
27#include <scsi/iscsi_if.h> 27#include <scsi/iscsi_if.h>
28 28
29struct scsi_transport_template; 29struct scsi_transport_template;
30struct iscsi_transport;
30struct Scsi_Host; 31struct Scsi_Host;
31struct mempool_zone; 32struct mempool_zone;
32struct iscsi_cls_conn; 33struct iscsi_cls_conn;
34struct iscsi_conn;
35struct iscsi_cmd_task;
36struct iscsi_mgmt_task;
33 37
34/** 38/**
35 * struct iscsi_transport - iSCSI Transport template 39 * struct iscsi_transport - iSCSI Transport template
@@ -46,6 +50,24 @@ struct iscsi_cls_conn;
46 * @start_conn: set connection to be operational 50 * @start_conn: set connection to be operational
47 * @stop_conn: suspend/recover/terminate connection 51 * @stop_conn: suspend/recover/terminate connection
48 * @send_pdu: send iSCSI PDU, Login, Logout, NOP-Out, Reject, Text. 52 * @send_pdu: send iSCSI PDU, Login, Logout, NOP-Out, Reject, Text.
53 * @session_recovery_timedout: notify LLD a block during recovery timed out
54 * @suspend_conn_recv: susepend the recv side of the connection
55 * @termincate_conn: destroy socket connection. Called with mutex lock.
56 * @init_cmd_task: Initialize a iscsi_cmd_task and any internal structs.
57 * Called from queuecommand with session lock held.
58 * @init_mgmt_task: Initialize a iscsi_mgmt_task and any internal structs.
59 * Called from iscsi_conn_send_generic with xmitmutex.
60 * @xmit_cmd_task: Requests LLD to transfer cmd task. Returns 0 or the
61 * the number of bytes transferred on success, and -Exyz
62 * value on error.
63 * @xmit_mgmt_task: Requests LLD to transfer mgmt task. Returns 0 or the
64 * the number of bytes transferred on success, and -Exyz
65 * value on error.
66 * @cleanup_cmd_task: requests LLD to fail cmd task. Called with xmitmutex
67 * and session->lock after the connection has been
68 * suspended and terminated during recovery. If called
69 * from abort task then connection is not suspended
70 * or terminated but sk_callback_lock is held
49 * 71 *
50 * Template API provided by iSCSI Transport 72 * Template API provided by iSCSI Transport
51 */ 73 */
@@ -53,38 +75,58 @@ struct iscsi_transport {
53 struct module *owner; 75 struct module *owner;
54 char *name; 76 char *name;
55 unsigned int caps; 77 unsigned int caps;
78 /* LLD sets this to indicate what values it can export to sysfs */
79 unsigned int param_mask;
56 struct scsi_host_template *host_template; 80 struct scsi_host_template *host_template;
57 /* LLD session/scsi_host data size */
58 int hostdata_size;
59 /* LLD iscsi_host data size */
60 int ihostdata_size;
61 /* LLD connection data size */ 81 /* LLD connection data size */
62 int conndata_size; 82 int conndata_size;
83 /* LLD session data size */
84 int sessiondata_size;
63 int max_lun; 85 int max_lun;
64 unsigned int max_conn; 86 unsigned int max_conn;
65 unsigned int max_cmd_len; 87 unsigned int max_cmd_len;
66 struct iscsi_cls_session *(*create_session) 88 struct iscsi_cls_session *(*create_session) (struct iscsi_transport *it,
67 (struct scsi_transport_template *t, uint32_t sn, uint32_t *sid); 89 struct scsi_transport_template *t, uint32_t sn, uint32_t *hn);
68 void (*destroy_session) (struct iscsi_cls_session *session); 90 void (*destroy_session) (struct iscsi_cls_session *session);
69 struct iscsi_cls_conn *(*create_conn) (struct iscsi_cls_session *sess, 91 struct iscsi_cls_conn *(*create_conn) (struct iscsi_cls_session *sess,
70 uint32_t cid); 92 uint32_t cid);
71 int (*bind_conn) (struct iscsi_cls_session *session, 93 int (*bind_conn) (struct iscsi_cls_session *session,
72 struct iscsi_cls_conn *cls_conn, 94 struct iscsi_cls_conn *cls_conn,
73 uint32_t transport_fd, int is_leading); 95 uint64_t transport_eph, int is_leading);
74 int (*start_conn) (struct iscsi_cls_conn *conn); 96 int (*start_conn) (struct iscsi_cls_conn *conn);
75 void (*stop_conn) (struct iscsi_cls_conn *conn, int flag); 97 void (*stop_conn) (struct iscsi_cls_conn *conn, int flag);
76 void (*destroy_conn) (struct iscsi_cls_conn *conn); 98 void (*destroy_conn) (struct iscsi_cls_conn *conn);
77 int (*set_param) (struct iscsi_cls_conn *conn, enum iscsi_param param, 99 int (*set_param) (struct iscsi_cls_conn *conn, enum iscsi_param param,
78 uint32_t value); 100 uint32_t value);
79 int (*get_conn_param) (struct iscsi_cls_conn *conn, 101 int (*get_conn_param) (struct iscsi_cls_conn *conn,
80 enum iscsi_param param, 102 enum iscsi_param param, uint32_t *value);
81 uint32_t *value);
82 int (*get_session_param) (struct iscsi_cls_session *session, 103 int (*get_session_param) (struct iscsi_cls_session *session,
83 enum iscsi_param param, uint32_t *value); 104 enum iscsi_param param, uint32_t *value);
105 int (*get_conn_str_param) (struct iscsi_cls_conn *conn,
106 enum iscsi_param param, char *buf);
107 int (*get_session_str_param) (struct iscsi_cls_session *session,
108 enum iscsi_param param, char *buf);
84 int (*send_pdu) (struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr, 109 int (*send_pdu) (struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr,
85 char *data, uint32_t data_size); 110 char *data, uint32_t data_size);
86 void (*get_stats) (struct iscsi_cls_conn *conn, 111 void (*get_stats) (struct iscsi_cls_conn *conn,
87 struct iscsi_stats *stats); 112 struct iscsi_stats *stats);
113 void (*suspend_conn_recv) (struct iscsi_conn *conn);
114 void (*terminate_conn) (struct iscsi_conn *conn);
115 void (*init_cmd_task) (struct iscsi_cmd_task *ctask);
116 void (*init_mgmt_task) (struct iscsi_conn *conn,
117 struct iscsi_mgmt_task *mtask,
118 char *data, uint32_t data_size);
119 int (*xmit_cmd_task) (struct iscsi_conn *conn,
120 struct iscsi_cmd_task *ctask);
121 void (*cleanup_cmd_task) (struct iscsi_conn *conn,
122 struct iscsi_cmd_task *ctask);
123 int (*xmit_mgmt_task) (struct iscsi_conn *conn,
124 struct iscsi_mgmt_task *mtask);
125 void (*session_recovery_timedout) (struct iscsi_cls_session *session);
126 int (*ep_connect) (struct sockaddr *dst_addr, int non_blocking,
127 uint64_t *ep_handle);
128 int (*ep_poll) (uint64_t ep_handle, int timeout_ms);
129 void (*ep_disconnect) (uint64_t ep_handle);
88}; 130};
89 131
90/* 132/*
@@ -100,10 +142,26 @@ extern void iscsi_conn_error(struct iscsi_cls_conn *conn, enum iscsi_err error);
100extern int iscsi_recv_pdu(struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr, 142extern int iscsi_recv_pdu(struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr,
101 char *data, uint32_t data_size); 143 char *data, uint32_t data_size);
102 144
145
146/* Connection's states */
147#define ISCSI_CONN_INITIAL_STAGE 0
148#define ISCSI_CONN_STARTED 1
149#define ISCSI_CONN_STOPPED 2
150#define ISCSI_CONN_CLEANUP_WAIT 3
151
103struct iscsi_cls_conn { 152struct iscsi_cls_conn {
104 struct list_head conn_list; /* item in connlist */ 153 struct list_head conn_list; /* item in connlist */
105 void *dd_data; /* LLD private data */ 154 void *dd_data; /* LLD private data */
106 struct iscsi_transport *transport; 155 struct iscsi_transport *transport;
156 uint32_t cid; /* connection id */
157
158 /* portal/group values we got during discovery */
159 char *persistent_address;
160 int persistent_port;
161 /* portal/group values we are currently using */
162 char *address;
163 int port;
164
107 int active; /* must be accessed with the connlock */ 165 int active; /* must be accessed with the connlock */
108 struct device dev; /* sysfs transport/container device */ 166 struct device dev; /* sysfs transport/container device */
109 struct mempool_zone *z_error; 167 struct mempool_zone *z_error;
@@ -114,9 +172,32 @@ struct iscsi_cls_conn {
114#define iscsi_dev_to_conn(_dev) \ 172#define iscsi_dev_to_conn(_dev) \
115 container_of(_dev, struct iscsi_cls_conn, dev) 173 container_of(_dev, struct iscsi_cls_conn, dev)
116 174
175/* Session's states */
176#define ISCSI_STATE_FREE 1
177#define ISCSI_STATE_LOGGED_IN 2
178#define ISCSI_STATE_FAILED 3
179#define ISCSI_STATE_TERMINATE 4
180#define ISCSI_STATE_IN_RECOVERY 5
181#define ISCSI_STATE_RECOVERY_FAILED 6
182
117struct iscsi_cls_session { 183struct iscsi_cls_session {
118 struct list_head sess_list; /* item in session_list */ 184 struct list_head sess_list; /* item in session_list */
185 struct list_head host_list;
119 struct iscsi_transport *transport; 186 struct iscsi_transport *transport;
187
188 /* iSCSI values used as unique id by userspace. */
189 char *targetname;
190 int tpgt;
191
192 /* recovery fields */
193 int recovery_tmo;
194 struct work_struct recovery_work;
195
196 int target_id;
197 int channel;
198
199 int sid; /* session id */
200 void *dd_data; /* LLD private data */
120 struct device dev; /* sysfs transport/container device */ 201 struct device dev; /* sysfs transport/container device */
121}; 202};
122 203
@@ -126,22 +207,22 @@ struct iscsi_cls_session {
126#define iscsi_session_to_shost(_session) \ 207#define iscsi_session_to_shost(_session) \
127 dev_to_shost(_session->dev.parent) 208 dev_to_shost(_session->dev.parent)
128 209
210struct iscsi_host {
211 int next_target_id;
212 struct list_head sessions;
213 struct mutex mutex;
214};
215
129/* 216/*
130 * session and connection functions that can be used by HW iSCSI LLDs 217 * session and connection functions that can be used by HW iSCSI LLDs
131 */ 218 */
132extern struct iscsi_cls_session *iscsi_create_session(struct Scsi_Host *shost, 219extern struct iscsi_cls_session *iscsi_create_session(struct Scsi_Host *shost,
133 struct iscsi_transport *t); 220 struct iscsi_transport *t, int channel);
134extern int iscsi_destroy_session(struct iscsi_cls_session *session); 221extern int iscsi_destroy_session(struct iscsi_cls_session *session);
135extern struct iscsi_cls_conn *iscsi_create_conn(struct iscsi_cls_session *sess, 222extern struct iscsi_cls_conn *iscsi_create_conn(struct iscsi_cls_session *sess,
136 uint32_t cid); 223 uint32_t cid);
137extern int iscsi_destroy_conn(struct iscsi_cls_conn *conn); 224extern int iscsi_destroy_conn(struct iscsi_cls_conn *conn);
138 225extern void iscsi_unblock_session(struct iscsi_cls_session *session);
139/* 226extern void iscsi_block_session(struct iscsi_cls_session *session);
140 * session functions used by software iscsi
141 */
142extern struct Scsi_Host *
143iscsi_transport_create_session(struct scsi_transport_template *scsit,
144 struct iscsi_transport *transport);
145extern int iscsi_transport_destroy_session(struct Scsi_Host *shost);
146 227
147#endif 228#endif
diff --git a/include/scsi/sg_request.h b/include/scsi/sg_request.h
deleted file mode 100644
index 57ff525bdd3b..000000000000
--- a/include/scsi/sg_request.h
+++ /dev/null
@@ -1,26 +0,0 @@
1typedef struct scsi_request Scsi_Request;
2
3static Scsi_Request *dummy_cmdp; /* only used for sizeof */
4
5typedef struct sg_scatter_hold { /* holding area for scsi scatter gather info */
6 unsigned short k_use_sg; /* Count of kernel scatter-gather pieces */
7 unsigned short sglist_len; /* size of malloc'd scatter-gather list ++ */
8 unsigned bufflen; /* Size of (aggregate) data buffer */
9 unsigned b_malloc_len; /* actual len malloc'ed in buffer */
10 void *buffer; /* Data buffer or scatter list (k_use_sg>0) */
11 char dio_in_use; /* 0->indirect IO (or mmap), 1->dio */
12 unsigned char cmd_opcode; /* first byte of command */
13} Sg_scatter_hold;
14
15typedef struct sg_request { /* SG_MAX_QUEUE requests outstanding per file */
16 Scsi_Request *my_cmdp; /* != 0 when request with lower levels */
17 struct sg_request *nextrp; /* NULL -> tail request (slist) */
18 struct sg_fd *parentfp; /* NULL -> not in use */
19 Sg_scatter_hold data; /* hold buffer, perhaps scatter list */
20 sg_io_hdr_t header; /* scsi command+info, see <scsi/sg.h> */
21 unsigned char sense_b[sizeof (dummy_cmdp->sr_sense_buffer)];
22 char res_used; /* 1 -> using reserve buffer, 0 -> not ... */
23 char orphan; /* 1 -> drop on sight, 0 -> normal */
24 char sg_io_owned; /* 1 -> packet belongs to SG_IO */
25 volatile char done; /* 0->before bh, 1->before read, 2->read */
26} Sg_request;
diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h
index b45a73712748..446afc3ea27f 100644
--- a/include/sound/ac97_codec.h
+++ b/include/sound/ac97_codec.h
@@ -378,6 +378,7 @@
378#define AC97_HAS_NO_MIC (1<<15) /* no MIC volume */ 378#define AC97_HAS_NO_MIC (1<<15) /* no MIC volume */
379#define AC97_HAS_NO_TONE (1<<16) /* no Tone volume */ 379#define AC97_HAS_NO_TONE (1<<16) /* no Tone volume */
380#define AC97_HAS_NO_STD_PCM (1<<17) /* no standard AC97 PCM volume and mute */ 380#define AC97_HAS_NO_STD_PCM (1<<17) /* no standard AC97 PCM volume and mute */
381#define AC97_HAS_NO_AUX (1<<18) /* no standard AC97 AUX volume and mute */
381 382
382/* rates indexes */ 383/* rates indexes */
383#define AC97_RATES_FRONT_DAC 0 384#define AC97_RATES_FRONT_DAC 0
diff --git a/include/sound/asequencer.h b/include/sound/asequencer.h
index 6691e4aa4ea7..3f2f4042a20d 100644
--- a/include/sound/asequencer.h
+++ b/include/sound/asequencer.h
@@ -605,6 +605,10 @@ struct snd_seq_remove_events {
605#define SNDRV_SEQ_PORT_TYPE_DIRECT_SAMPLE (1<<11) /* Sampling device (support sample download) */ 605#define SNDRV_SEQ_PORT_TYPE_DIRECT_SAMPLE (1<<11) /* Sampling device (support sample download) */
606#define SNDRV_SEQ_PORT_TYPE_SAMPLE (1<<12) /* Sampling device (sample can be downloaded at any time) */ 606#define SNDRV_SEQ_PORT_TYPE_SAMPLE (1<<12) /* Sampling device (sample can be downloaded at any time) */
607/*...*/ 607/*...*/
608#define SNDRV_SEQ_PORT_TYPE_HARDWARE (1<<16) /* driver for a hardware device */
609#define SNDRV_SEQ_PORT_TYPE_SOFTWARE (1<<17) /* implemented in software */
610#define SNDRV_SEQ_PORT_TYPE_SYNTHESIZER (1<<18) /* generates sound */
611#define SNDRV_SEQ_PORT_TYPE_PORT (1<<19) /* connects to other device(s) */
608#define SNDRV_SEQ_PORT_TYPE_APPLICATION (1<<20) /* application (sequencer/editor) */ 612#define SNDRV_SEQ_PORT_TYPE_APPLICATION (1<<20) /* application (sequencer/editor) */
609 613
610/* misc. conditioning flags */ 614/* misc. conditioning flags */
diff --git a/include/sound/asound.h b/include/sound/asound.h
index 9cc021c7ee11..41885f48ad91 100644
--- a/include/sound/asound.h
+++ b/include/sound/asound.h
@@ -137,7 +137,7 @@ enum {
137 * * 137 * *
138 *****************************************************************************/ 138 *****************************************************************************/
139 139
140#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 7) 140#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 8)
141 141
142typedef unsigned long snd_pcm_uframes_t; 142typedef unsigned long snd_pcm_uframes_t;
143typedef signed long snd_pcm_sframes_t; 143typedef signed long snd_pcm_sframes_t;
diff --git a/include/sound/core.h b/include/sound/core.h
index 5135147f20e8..5d184be0ff72 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -233,9 +233,8 @@ int copy_from_user_toio(volatile void __iomem *dst, const void __user *src, size
233 233
234/* init.c */ 234/* init.c */
235 235
236extern unsigned int snd_cards_lock;
237extern struct snd_card *snd_cards[SNDRV_CARDS]; 236extern struct snd_card *snd_cards[SNDRV_CARDS];
238extern rwlock_t snd_card_rwlock; 237int snd_card_locked(int card);
239#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE) 238#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE)
240#define SND_MIXER_OSS_NOTIFY_REGISTER 0 239#define SND_MIXER_OSS_NOTIFY_REGISTER 0
241#define SND_MIXER_OSS_NOTIFY_DISCONNECT 1 240#define SND_MIXER_OSS_NOTIFY_DISCONNECT 1
diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h
index 186e00ad9e79..884bbf54cd36 100644
--- a/include/sound/emu10k1.h
+++ b/include/sound/emu10k1.h
@@ -245,6 +245,7 @@
245#define A_IOCFG_GPOUT0 0x0044 /* analog/digital */ 245#define A_IOCFG_GPOUT0 0x0044 /* analog/digital */
246#define A_IOCFG_DISABLE_ANALOG 0x0040 /* = 'enable' for Audigy2 (chiprev=4) */ 246#define A_IOCFG_DISABLE_ANALOG 0x0040 /* = 'enable' for Audigy2 (chiprev=4) */
247#define A_IOCFG_ENABLE_DIGITAL 0x0004 247#define A_IOCFG_ENABLE_DIGITAL 0x0004
248#define A_IOCFG_ENABLE_DIGITAL_AUDIGY4 0x0080
248#define A_IOCFG_UNKNOWN_20 0x0020 249#define A_IOCFG_UNKNOWN_20 0x0020
249#define A_IOCFG_DISABLE_AC97_FRONT 0x0080 /* turn off ac97 front -> front (10k2.1) */ 250#define A_IOCFG_DISABLE_AC97_FRONT 0x0080 /* turn off ac97 front -> front (10k2.1) */
250#define A_IOCFG_GPOUT1 0x0002 /* IR? drive's internal bypass (?) */ 251#define A_IOCFG_GPOUT1 0x0002 /* IR? drive's internal bypass (?) */
@@ -1065,6 +1066,7 @@ struct snd_emu_chip_details {
1065 unsigned char emu1212m; /* EMU 1212m card */ 1066 unsigned char emu1212m; /* EMU 1212m card */
1066 unsigned char spi_dac; /* SPI interface for DAC */ 1067 unsigned char spi_dac; /* SPI interface for DAC */
1067 unsigned char i2c_adc; /* I2C interface for ADC */ 1068 unsigned char i2c_adc; /* I2C interface for ADC */
1069 unsigned char adc_1361t; /* Use Philips 1361T ADC */
1068 const char *driver; 1070 const char *driver;
1069 const char *name; 1071 const char *name;
1070 const char *id; /* for backward compatibility - can be NULL if not needed */ 1072 const char *id; /* for backward compatibility - can be NULL if not needed */
diff --git a/include/sound/info.h b/include/sound/info.h
index f23d8381c216..74f6996769c7 100644
--- a/include/sound/info.h
+++ b/include/sound/info.h
@@ -27,9 +27,9 @@
27/* buffer for information */ 27/* buffer for information */
28struct snd_info_buffer { 28struct snd_info_buffer {
29 char *buffer; /* pointer to begin of buffer */ 29 char *buffer; /* pointer to begin of buffer */
30 char *curr; /* current position in buffer */ 30 unsigned int curr; /* current position in buffer */
31 unsigned long size; /* current size */ 31 unsigned int size; /* current size */
32 unsigned long len; /* total length of buffer */ 32 unsigned int len; /* total length of buffer */
33 int stop; /* stop flag */ 33 int stop; /* stop flag */
34 int error; /* error code */ 34 int error; /* error code */
35}; 35};
@@ -40,8 +40,6 @@ struct snd_info_buffer {
40struct snd_info_entry; 40struct snd_info_entry;
41 41
42struct snd_info_entry_text { 42struct snd_info_entry_text {
43 unsigned long read_size;
44 unsigned long write_size;
45 void (*read) (struct snd_info_entry *entry, struct snd_info_buffer *buffer); 43 void (*read) (struct snd_info_entry *entry, struct snd_info_buffer *buffer);
46 void (*write) (struct snd_info_entry *entry, struct snd_info_buffer *buffer); 44 void (*write) (struct snd_info_entry *entry, struct snd_info_buffer *buffer);
47}; 45};
@@ -132,11 +130,9 @@ int snd_card_proc_new(struct snd_card *card, const char *name, struct snd_info_e
132 130
133static inline void snd_info_set_text_ops(struct snd_info_entry *entry, 131static inline void snd_info_set_text_ops(struct snd_info_entry *entry,
134 void *private_data, 132 void *private_data,
135 long read_size,
136 void (*read)(struct snd_info_entry *, struct snd_info_buffer *)) 133 void (*read)(struct snd_info_entry *, struct snd_info_buffer *))
137{ 134{
138 entry->private_data = private_data; 135 entry->private_data = private_data;
139 entry->c.text.read_size = read_size;
140 entry->c.text.read = read; 136 entry->c.text.read = read;
141} 137}
142 138
@@ -167,7 +163,6 @@ static inline int snd_card_proc_new(struct snd_card *card, const char *name,
167 struct snd_info_entry **entryp) { return -EINVAL; } 163 struct snd_info_entry **entryp) { return -EINVAL; }
168static inline void snd_info_set_text_ops(struct snd_info_entry *entry __attribute__((unused)), 164static inline void snd_info_set_text_ops(struct snd_info_entry *entry __attribute__((unused)),
169 void *private_data, 165 void *private_data,
170 long read_size,
171 void (*read)(struct snd_info_entry *, struct snd_info_buffer *)) {} 166 void (*read)(struct snd_info_entry *, struct snd_info_buffer *)) {}
172 167
173static inline int snd_info_check_reserved_words(const char *str) { return 1; } 168static inline int snd_info_check_reserved_words(const char *str) { return 1; }
diff --git a/include/sound/mpu401.h b/include/sound/mpu401.h
index 8e97ace78f16..ac504321ea56 100644
--- a/include/sound/mpu401.h
+++ b/include/sound/mpu401.h
@@ -45,6 +45,12 @@
45#define MPU401_HW_PC98II 18 /* Roland PC98II */ 45#define MPU401_HW_PC98II 18 /* Roland PC98II */
46#define MPU401_HW_AUREAL 19 /* Aureal Vortex */ 46#define MPU401_HW_AUREAL 19 /* Aureal Vortex */
47 47
48#define MPU401_INFO_INPUT (1 << 0) /* input stream */
49#define MPU401_INFO_OUTPUT (1 << 1) /* output stream */
50#define MPU401_INFO_INTEGRATED (1 << 2) /* integrated h/w port */
51#define MPU401_INFO_MMIO (1 << 3) /* MMIO access */
52#define MPU401_INFO_TX_IRQ (1 << 4) /* independent TX irq */
53
48#define MPU401_MODE_BIT_INPUT 0 54#define MPU401_MODE_BIT_INPUT 0
49#define MPU401_MODE_BIT_OUTPUT 1 55#define MPU401_MODE_BIT_OUTPUT 1
50#define MPU401_MODE_BIT_INPUT_TRIGGER 2 56#define MPU401_MODE_BIT_INPUT_TRIGGER 2
@@ -62,6 +68,7 @@ struct snd_mpu401 {
62 struct snd_rawmidi *rmidi; 68 struct snd_rawmidi *rmidi;
63 69
64 unsigned short hardware; /* MPU401_HW_XXXX */ 70 unsigned short hardware; /* MPU401_HW_XXXX */
71 unsigned int info_flags; /* MPU401_INFO_XXX */
65 unsigned long port; /* base port of MPU-401 chip */ 72 unsigned long port; /* base port of MPU-401 chip */
66 unsigned long cport; /* port + 1 (usually) */ 73 unsigned long cport; /* port + 1 (usually) */
67 struct resource *res; /* port resource */ 74 struct resource *res; /* port resource */
@@ -99,13 +106,16 @@ struct snd_mpu401 {
99 106
100 */ 107 */
101 108
102irqreturn_t snd_mpu401_uart_interrupt(int irq, void *dev_id, struct pt_regs *regs); 109irqreturn_t snd_mpu401_uart_interrupt(int irq, void *dev_id,
110 struct pt_regs *regs);
111irqreturn_t snd_mpu401_uart_interrupt_tx(int irq, void *dev_id,
112 struct pt_regs *regs);
103 113
104int snd_mpu401_uart_new(struct snd_card *card, 114int snd_mpu401_uart_new(struct snd_card *card,
105 int device, 115 int device,
106 unsigned short hardware, 116 unsigned short hardware,
107 unsigned long port, 117 unsigned long port,
108 int integrated, 118 unsigned int info_flags,
109 int irq, 119 int irq,
110 int irq_flags, 120 int irq_flags,
111 struct snd_rawmidi ** rrawmidi); 121 struct snd_rawmidi ** rrawmidi);
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 373425895faa..f84d84993a31 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -300,7 +300,6 @@ struct snd_pcm_runtime {
300 /* -- mmap -- */ 300 /* -- mmap -- */
301 volatile struct snd_pcm_mmap_status *status; 301 volatile struct snd_pcm_mmap_status *status;
302 volatile struct snd_pcm_mmap_control *control; 302 volatile struct snd_pcm_mmap_control *control;
303 atomic_t mmap_count;
304 303
305 /* -- locking / scheduling -- */ 304 /* -- locking / scheduling -- */
306 wait_queue_head_t sleep; 305 wait_queue_head_t sleep;
@@ -368,7 +367,9 @@ struct snd_pcm_substream {
368 struct snd_pcm_group *group; /* pointer to current group */ 367 struct snd_pcm_group *group; /* pointer to current group */
369 /* -- assigned files -- */ 368 /* -- assigned files -- */
370 void *file; 369 void *file;
371 struct file *ffile; 370 int ref_count;
371 atomic_t mmap_count;
372 unsigned int f_flags;
372 void (*pcm_release)(struct snd_pcm_substream *); 373 void (*pcm_release)(struct snd_pcm_substream *);
373#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) 374#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
374 /* -- OSS things -- */ 375 /* -- OSS things -- */
@@ -387,7 +388,7 @@ struct snd_pcm_substream {
387 unsigned int hw_opened: 1; 388 unsigned int hw_opened: 1;
388}; 389};
389 390
390#define SUBSTREAM_BUSY(substream) ((substream)->file != NULL) 391#define SUBSTREAM_BUSY(substream) ((substream)->ref_count > 0)
391 392
392 393
393struct snd_pcm_str { 394struct snd_pcm_str {
@@ -825,14 +826,6 @@ int snd_interval_ratnum(struct snd_interval *i,
825 826
826void _snd_pcm_hw_params_any(struct snd_pcm_hw_params *params); 827void _snd_pcm_hw_params_any(struct snd_pcm_hw_params *params);
827void _snd_pcm_hw_param_setempty(struct snd_pcm_hw_params *params, snd_pcm_hw_param_t var); 828void _snd_pcm_hw_param_setempty(struct snd_pcm_hw_params *params, snd_pcm_hw_param_t var);
828int snd_pcm_hw_param_near(struct snd_pcm_substream *substream,
829 struct snd_pcm_hw_params *params,
830 snd_pcm_hw_param_t var,
831 unsigned int val, int *dir);
832int snd_pcm_hw_param_set(struct snd_pcm_substream *pcm,
833 struct snd_pcm_hw_params *params,
834 snd_pcm_hw_param_t var,
835 unsigned int val, int dir);
836int snd_pcm_hw_params_choose(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params); 829int snd_pcm_hw_params_choose(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params);
837 830
838int snd_pcm_hw_refine(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params); 831int snd_pcm_hw_refine(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params);
@@ -979,13 +972,13 @@ struct page *snd_pcm_sgbuf_ops_page(struct snd_pcm_substream *substream, unsigne
979static inline void snd_pcm_mmap_data_open(struct vm_area_struct *area) 972static inline void snd_pcm_mmap_data_open(struct vm_area_struct *area)
980{ 973{
981 struct snd_pcm_substream *substream = (struct snd_pcm_substream *)area->vm_private_data; 974 struct snd_pcm_substream *substream = (struct snd_pcm_substream *)area->vm_private_data;
982 atomic_inc(&substream->runtime->mmap_count); 975 atomic_inc(&substream->mmap_count);
983} 976}
984 977
985static inline void snd_pcm_mmap_data_close(struct vm_area_struct *area) 978static inline void snd_pcm_mmap_data_close(struct vm_area_struct *area)
986{ 979{
987 struct snd_pcm_substream *substream = (struct snd_pcm_substream *)area->vm_private_data; 980 struct snd_pcm_substream *substream = (struct snd_pcm_substream *)area->vm_private_data;
988 atomic_dec(&substream->runtime->mmap_count); 981 atomic_dec(&substream->mmap_count);
989} 982}
990 983
991/* mmap for io-memory area */ 984/* mmap for io-memory area */
diff --git a/include/sound/pcm_params.h b/include/sound/pcm_params.h
index fb18aef77341..85cf1cf4f31a 100644
--- a/include/sound/pcm_params.h
+++ b/include/sound/pcm_params.h
@@ -22,29 +22,21 @@
22 * 22 *
23 */ 23 */
24 24
25extern int snd_pcm_hw_param_mask(struct snd_pcm_substream *pcm, struct snd_pcm_hw_params *params, 25int snd_pcm_hw_param_first(struct snd_pcm_substream *pcm,
26 snd_pcm_hw_param_t var, const struct snd_mask *val); 26 struct snd_pcm_hw_params *params,
27extern unsigned int snd_pcm_hw_param_value_min(const struct snd_pcm_hw_params *params, 27 snd_pcm_hw_param_t var, int *dir);
28 snd_pcm_hw_param_t var, int *dir); 28int snd_pcm_hw_param_last(struct snd_pcm_substream *pcm,
29extern unsigned int snd_pcm_hw_param_value_max(const struct snd_pcm_hw_params *params, 29 struct snd_pcm_hw_params *params,
30 snd_pcm_hw_param_t var, int *dir); 30 snd_pcm_hw_param_t var, int *dir);
31extern int _snd_pcm_hw_param_min(struct snd_pcm_hw_params *params, 31int snd_pcm_hw_param_value(const struct snd_pcm_hw_params *params,
32 snd_pcm_hw_param_t var, unsigned int val, int dir); 32 snd_pcm_hw_param_t var, int *dir);
33extern int _snd_pcm_hw_param_setinteger(struct snd_pcm_hw_params *params,
34 snd_pcm_hw_param_t var);
35extern int _snd_pcm_hw_param_set(struct snd_pcm_hw_params *params,
36 snd_pcm_hw_param_t var, unsigned int val, int dir);
37
38/* To share the same code we have alsa-lib */
39#define INLINE static inline
40#define assert(a) (void)(a)
41 33
42#define SNDRV_MASK_BITS 64 /* we use so far 64bits only */ 34#define SNDRV_MASK_BITS 64 /* we use so far 64bits only */
43#define SNDRV_MASK_SIZE (SNDRV_MASK_BITS / 32) 35#define SNDRV_MASK_SIZE (SNDRV_MASK_BITS / 32)
44#define MASK_OFS(i) ((i) >> 5) 36#define MASK_OFS(i) ((i) >> 5)
45#define MASK_BIT(i) (1U << ((i) & 31)) 37#define MASK_BIT(i) (1U << ((i) & 31))
46 38
47INLINE unsigned int ld2(u_int32_t v) 39static inline unsigned int ld2(u_int32_t v)
48{ 40{
49 unsigned r = 0; 41 unsigned r = 0;
50 42
@@ -69,22 +61,22 @@ INLINE unsigned int ld2(u_int32_t v)
69 return r; 61 return r;
70} 62}
71 63
72INLINE size_t snd_mask_sizeof(void) 64static inline size_t snd_mask_sizeof(void)
73{ 65{
74 return sizeof(struct snd_mask); 66 return sizeof(struct snd_mask);
75} 67}
76 68
77INLINE void snd_mask_none(struct snd_mask *mask) 69static inline void snd_mask_none(struct snd_mask *mask)
78{ 70{
79 memset(mask, 0, sizeof(*mask)); 71 memset(mask, 0, sizeof(*mask));
80} 72}
81 73
82INLINE void snd_mask_any(struct snd_mask *mask) 74static inline void snd_mask_any(struct snd_mask *mask)
83{ 75{
84 memset(mask, 0xff, SNDRV_MASK_SIZE * sizeof(u_int32_t)); 76 memset(mask, 0xff, SNDRV_MASK_SIZE * sizeof(u_int32_t));
85} 77}
86 78
87INLINE int snd_mask_empty(const struct snd_mask *mask) 79static inline int snd_mask_empty(const struct snd_mask *mask)
88{ 80{
89 int i; 81 int i;
90 for (i = 0; i < SNDRV_MASK_SIZE; i++) 82 for (i = 0; i < SNDRV_MASK_SIZE; i++)
@@ -93,10 +85,9 @@ INLINE int snd_mask_empty(const struct snd_mask *mask)
93 return 1; 85 return 1;
94} 86}
95 87
96INLINE unsigned int snd_mask_min(const struct snd_mask *mask) 88static inline unsigned int snd_mask_min(const struct snd_mask *mask)
97{ 89{
98 int i; 90 int i;
99 assert(!snd_mask_empty(mask));
100 for (i = 0; i < SNDRV_MASK_SIZE; i++) { 91 for (i = 0; i < SNDRV_MASK_SIZE; i++) {
101 if (mask->bits[i]) 92 if (mask->bits[i])
102 return ffs(mask->bits[i]) - 1 + (i << 5); 93 return ffs(mask->bits[i]) - 1 + (i << 5);
@@ -104,10 +95,9 @@ INLINE unsigned int snd_mask_min(const struct snd_mask *mask)
104 return 0; 95 return 0;
105} 96}
106 97
107INLINE unsigned int snd_mask_max(const struct snd_mask *mask) 98static inline unsigned int snd_mask_max(const struct snd_mask *mask)
108{ 99{
109 int i; 100 int i;
110 assert(!snd_mask_empty(mask));
111 for (i = SNDRV_MASK_SIZE - 1; i >= 0; i--) { 101 for (i = SNDRV_MASK_SIZE - 1; i >= 0; i--) {
112 if (mask->bits[i]) 102 if (mask->bits[i])
113 return ld2(mask->bits[i]) + (i << 5); 103 return ld2(mask->bits[i]) + (i << 5);
@@ -115,70 +105,68 @@ INLINE unsigned int snd_mask_max(const struct snd_mask *mask)
115 return 0; 105 return 0;
116} 106}
117 107
118INLINE void snd_mask_set(struct snd_mask *mask, unsigned int val) 108static inline void snd_mask_set(struct snd_mask *mask, unsigned int val)
119{ 109{
120 assert(val <= SNDRV_MASK_BITS);
121 mask->bits[MASK_OFS(val)] |= MASK_BIT(val); 110 mask->bits[MASK_OFS(val)] |= MASK_BIT(val);
122} 111}
123 112
124INLINE void snd_mask_reset(struct snd_mask *mask, unsigned int val) 113static inline void snd_mask_reset(struct snd_mask *mask, unsigned int val)
125{ 114{
126 assert(val <= SNDRV_MASK_BITS);
127 mask->bits[MASK_OFS(val)] &= ~MASK_BIT(val); 115 mask->bits[MASK_OFS(val)] &= ~MASK_BIT(val);
128} 116}
129 117
130INLINE void snd_mask_set_range(struct snd_mask *mask, unsigned int from, unsigned int to) 118static inline void snd_mask_set_range(struct snd_mask *mask,
119 unsigned int from, unsigned int to)
131{ 120{
132 unsigned int i; 121 unsigned int i;
133 assert(to <= SNDRV_MASK_BITS && from <= to);
134 for (i = from; i <= to; i++) 122 for (i = from; i <= to; i++)
135 mask->bits[MASK_OFS(i)] |= MASK_BIT(i); 123 mask->bits[MASK_OFS(i)] |= MASK_BIT(i);
136} 124}
137 125
138INLINE void snd_mask_reset_range(struct snd_mask *mask, unsigned int from, unsigned int to) 126static inline void snd_mask_reset_range(struct snd_mask *mask,
127 unsigned int from, unsigned int to)
139{ 128{
140 unsigned int i; 129 unsigned int i;
141 assert(to <= SNDRV_MASK_BITS && from <= to);
142 for (i = from; i <= to; i++) 130 for (i = from; i <= to; i++)
143 mask->bits[MASK_OFS(i)] &= ~MASK_BIT(i); 131 mask->bits[MASK_OFS(i)] &= ~MASK_BIT(i);
144} 132}
145 133
146INLINE void snd_mask_leave(struct snd_mask *mask, unsigned int val) 134static inline void snd_mask_leave(struct snd_mask *mask, unsigned int val)
147{ 135{
148 unsigned int v; 136 unsigned int v;
149 assert(val <= SNDRV_MASK_BITS);
150 v = mask->bits[MASK_OFS(val)] & MASK_BIT(val); 137 v = mask->bits[MASK_OFS(val)] & MASK_BIT(val);
151 snd_mask_none(mask); 138 snd_mask_none(mask);
152 mask->bits[MASK_OFS(val)] = v; 139 mask->bits[MASK_OFS(val)] = v;
153} 140}
154 141
155INLINE void snd_mask_intersect(struct snd_mask *mask, const struct snd_mask *v) 142static inline void snd_mask_intersect(struct snd_mask *mask,
143 const struct snd_mask *v)
156{ 144{
157 int i; 145 int i;
158 for (i = 0; i < SNDRV_MASK_SIZE; i++) 146 for (i = 0; i < SNDRV_MASK_SIZE; i++)
159 mask->bits[i] &= v->bits[i]; 147 mask->bits[i] &= v->bits[i];
160} 148}
161 149
162INLINE int snd_mask_eq(const struct snd_mask *mask, const struct snd_mask *v) 150static inline int snd_mask_eq(const struct snd_mask *mask,
151 const struct snd_mask *v)
163{ 152{
164 return ! memcmp(mask, v, SNDRV_MASK_SIZE * sizeof(u_int32_t)); 153 return ! memcmp(mask, v, SNDRV_MASK_SIZE * sizeof(u_int32_t));
165} 154}
166 155
167INLINE void snd_mask_copy(struct snd_mask *mask, const struct snd_mask *v) 156static inline void snd_mask_copy(struct snd_mask *mask,
157 const struct snd_mask *v)
168{ 158{
169 *mask = *v; 159 *mask = *v;
170} 160}
171 161
172INLINE int snd_mask_test(const struct snd_mask *mask, unsigned int val) 162static inline int snd_mask_test(const struct snd_mask *mask, unsigned int val)
173{ 163{
174 assert(val <= SNDRV_MASK_BITS);
175 return mask->bits[MASK_OFS(val)] & MASK_BIT(val); 164 return mask->bits[MASK_OFS(val)] & MASK_BIT(val);
176} 165}
177 166
178INLINE int snd_mask_single(const struct snd_mask *mask) 167static inline int snd_mask_single(const struct snd_mask *mask)
179{ 168{
180 int i, c = 0; 169 int i, c = 0;
181 assert(!snd_mask_empty(mask));
182 for (i = 0; i < SNDRV_MASK_SIZE; i++) { 170 for (i = 0; i < SNDRV_MASK_SIZE; i++) {
183 if (! mask->bits[i]) 171 if (! mask->bits[i])
184 continue; 172 continue;
@@ -191,10 +179,10 @@ INLINE int snd_mask_single(const struct snd_mask *mask)
191 return 1; 179 return 1;
192} 180}
193 181
194INLINE int snd_mask_refine(struct snd_mask *mask, const struct snd_mask *v) 182static inline int snd_mask_refine(struct snd_mask *mask,
183 const struct snd_mask *v)
195{ 184{
196 struct snd_mask old; 185 struct snd_mask old;
197 assert(!snd_mask_empty(mask));
198 snd_mask_copy(&old, mask); 186 snd_mask_copy(&old, mask);
199 snd_mask_intersect(mask, v); 187 snd_mask_intersect(mask, v);
200 if (snd_mask_empty(mask)) 188 if (snd_mask_empty(mask))
@@ -202,27 +190,24 @@ INLINE int snd_mask_refine(struct snd_mask *mask, const struct snd_mask *v)
202 return !snd_mask_eq(mask, &old); 190 return !snd_mask_eq(mask, &old);
203} 191}
204 192
205INLINE int snd_mask_refine_first(struct snd_mask *mask) 193static inline int snd_mask_refine_first(struct snd_mask *mask)
206{ 194{
207 assert(!snd_mask_empty(mask));
208 if (snd_mask_single(mask)) 195 if (snd_mask_single(mask))
209 return 0; 196 return 0;
210 snd_mask_leave(mask, snd_mask_min(mask)); 197 snd_mask_leave(mask, snd_mask_min(mask));
211 return 1; 198 return 1;
212} 199}
213 200
214INLINE int snd_mask_refine_last(struct snd_mask *mask) 201static inline int snd_mask_refine_last(struct snd_mask *mask)
215{ 202{
216 assert(!snd_mask_empty(mask));
217 if (snd_mask_single(mask)) 203 if (snd_mask_single(mask))
218 return 0; 204 return 0;
219 snd_mask_leave(mask, snd_mask_max(mask)); 205 snd_mask_leave(mask, snd_mask_max(mask));
220 return 1; 206 return 1;
221} 207}
222 208
223INLINE int snd_mask_refine_min(struct snd_mask *mask, unsigned int val) 209static inline int snd_mask_refine_min(struct snd_mask *mask, unsigned int val)
224{ 210{
225 assert(!snd_mask_empty(mask));
226 if (snd_mask_min(mask) >= val) 211 if (snd_mask_min(mask) >= val)
227 return 0; 212 return 0;
228 snd_mask_reset_range(mask, 0, val - 1); 213 snd_mask_reset_range(mask, 0, val - 1);
@@ -231,9 +216,8 @@ INLINE int snd_mask_refine_min(struct snd_mask *mask, unsigned int val)
231 return 1; 216 return 1;
232} 217}
233 218
234INLINE int snd_mask_refine_max(struct snd_mask *mask, unsigned int val) 219static inline int snd_mask_refine_max(struct snd_mask *mask, unsigned int val)
235{ 220{
236 assert(!snd_mask_empty(mask));
237 if (snd_mask_max(mask) <= val) 221 if (snd_mask_max(mask) <= val)
238 return 0; 222 return 0;
239 snd_mask_reset_range(mask, val + 1, SNDRV_MASK_BITS); 223 snd_mask_reset_range(mask, val + 1, SNDRV_MASK_BITS);
@@ -242,10 +226,9 @@ INLINE int snd_mask_refine_max(struct snd_mask *mask, unsigned int val)
242 return 1; 226 return 1;
243} 227}
244 228
245INLINE int snd_mask_refine_set(struct snd_mask *mask, unsigned int val) 229static inline int snd_mask_refine_set(struct snd_mask *mask, unsigned int val)
246{ 230{
247 int changed; 231 int changed;
248 assert(!snd_mask_empty(mask));
249 changed = !snd_mask_single(mask); 232 changed = !snd_mask_single(mask);
250 snd_mask_leave(mask, val); 233 snd_mask_leave(mask, val);
251 if (snd_mask_empty(mask)) 234 if (snd_mask_empty(mask))
@@ -253,13 +236,12 @@ INLINE int snd_mask_refine_set(struct snd_mask *mask, unsigned int val)
253 return changed; 236 return changed;
254} 237}
255 238
256INLINE int snd_mask_value(const struct snd_mask *mask) 239static inline int snd_mask_value(const struct snd_mask *mask)
257{ 240{
258 assert(!snd_mask_empty(mask));
259 return snd_mask_min(mask); 241 return snd_mask_min(mask);
260} 242}
261 243
262INLINE void snd_interval_any(struct snd_interval *i) 244static inline void snd_interval_any(struct snd_interval *i)
263{ 245{
264 i->min = 0; 246 i->min = 0;
265 i->openmin = 0; 247 i->openmin = 0;
@@ -269,63 +251,59 @@ INLINE void snd_interval_any(struct snd_interval *i)
269 i->empty = 0; 251 i->empty = 0;
270} 252}
271 253
272INLINE void snd_interval_none(struct snd_interval *i) 254static inline void snd_interval_none(struct snd_interval *i)
273{ 255{
274 i->empty = 1; 256 i->empty = 1;
275} 257}
276 258
277INLINE int snd_interval_checkempty(const struct snd_interval *i) 259static inline int snd_interval_checkempty(const struct snd_interval *i)
278{ 260{
279 return (i->min > i->max || 261 return (i->min > i->max ||
280 (i->min == i->max && (i->openmin || i->openmax))); 262 (i->min == i->max && (i->openmin || i->openmax)));
281} 263}
282 264
283INLINE int snd_interval_empty(const struct snd_interval *i) 265static inline int snd_interval_empty(const struct snd_interval *i)
284{ 266{
285 return i->empty; 267 return i->empty;
286} 268}
287 269
288INLINE int snd_interval_single(const struct snd_interval *i) 270static inline int snd_interval_single(const struct snd_interval *i)
289{ 271{
290 assert(!snd_interval_empty(i));
291 return (i->min == i->max || 272 return (i->min == i->max ||
292 (i->min + 1 == i->max && i->openmax)); 273 (i->min + 1 == i->max && i->openmax));
293} 274}
294 275
295INLINE int snd_interval_value(const struct snd_interval *i) 276static inline int snd_interval_value(const struct snd_interval *i)
296{ 277{
297 assert(snd_interval_single(i));
298 return i->min; 278 return i->min;
299} 279}
300 280
301INLINE int snd_interval_min(const struct snd_interval *i) 281static inline int snd_interval_min(const struct snd_interval *i)
302{ 282{
303 assert(!snd_interval_empty(i));
304 return i->min; 283 return i->min;
305} 284}
306 285
307INLINE int snd_interval_max(const struct snd_interval *i) 286static inline int snd_interval_max(const struct snd_interval *i)
308{ 287{
309 unsigned int v; 288 unsigned int v;
310 assert(!snd_interval_empty(i));
311 v = i->max; 289 v = i->max;
312 if (i->openmax) 290 if (i->openmax)
313 v--; 291 v--;
314 return v; 292 return v;
315} 293}
316 294
317INLINE int snd_interval_test(const struct snd_interval *i, unsigned int val) 295static inline int snd_interval_test(const struct snd_interval *i, unsigned int val)
318{ 296{
319 return !((i->min > val || (i->min == val && i->openmin) || 297 return !((i->min > val || (i->min == val && i->openmin) ||
320 i->max < val || (i->max == val && i->openmax))); 298 i->max < val || (i->max == val && i->openmax)));
321} 299}
322 300
323INLINE void snd_interval_copy(struct snd_interval *d, const struct snd_interval *s) 301static inline void snd_interval_copy(struct snd_interval *d, const struct snd_interval *s)
324{ 302{
325 *d = *s; 303 *d = *s;
326} 304}
327 305
328INLINE int snd_interval_setinteger(struct snd_interval *i) 306static inline int snd_interval_setinteger(struct snd_interval *i)
329{ 307{
330 if (i->integer) 308 if (i->integer)
331 return 0; 309 return 0;
@@ -335,7 +313,7 @@ INLINE int snd_interval_setinteger(struct snd_interval *i)
335 return 1; 313 return 1;
336} 314}
337 315
338INLINE int snd_interval_eq(const struct snd_interval *i1, const struct snd_interval *i2) 316static inline int snd_interval_eq(const struct snd_interval *i1, const struct snd_interval *i2)
339{ 317{
340 if (i1->empty) 318 if (i1->empty)
341 return i2->empty; 319 return i2->empty;
@@ -359,8 +337,5 @@ static inline unsigned int sub(unsigned int a, unsigned int b)
359 return 0; 337 return 0;
360} 338}
361 339
362#undef INLINE
363#undef assert
364
365#endif /* __SOUND_PCM_PARAMS_H */ 340#endif /* __SOUND_PCM_PARAMS_H */
366 341
diff --git a/include/sound/rawmidi.h b/include/sound/rawmidi.h
index 584e73dd4793..7dbcd10fa215 100644
--- a/include/sound/rawmidi.h
+++ b/include/sound/rawmidi.h
@@ -46,6 +46,7 @@
46 46
47struct snd_rawmidi; 47struct snd_rawmidi;
48struct snd_rawmidi_substream; 48struct snd_rawmidi_substream;
49struct snd_seq_port_info;
49 50
50struct snd_rawmidi_ops { 51struct snd_rawmidi_ops {
51 int (*open) (struct snd_rawmidi_substream * substream); 52 int (*open) (struct snd_rawmidi_substream * substream);
@@ -57,6 +58,8 @@ struct snd_rawmidi_ops {
57struct snd_rawmidi_global_ops { 58struct snd_rawmidi_global_ops {
58 int (*dev_register) (struct snd_rawmidi * rmidi); 59 int (*dev_register) (struct snd_rawmidi * rmidi);
59 int (*dev_unregister) (struct snd_rawmidi * rmidi); 60 int (*dev_unregister) (struct snd_rawmidi * rmidi);
61 void (*get_port_info)(struct snd_rawmidi *rmidi, int number,
62 struct snd_seq_port_info *info);
60}; 63};
61 64
62struct snd_rawmidi_runtime { 65struct snd_rawmidi_runtime {
diff --git a/include/sound/tea575x-tuner.h b/include/sound/tea575x-tuner.h
index a4f554520197..b5067d3c2387 100644
--- a/include/sound/tea575x-tuner.h
+++ b/include/sound/tea575x-tuner.h
@@ -20,9 +20,10 @@
20 * along with this program; if not, write to the Free Software 20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * 22 *
23 */ 23 */
24 24
25#include <linux/videodev.h> 25#include <linux/videodev.h>
26#include <media/v4l2-dev.h>
26 27
27struct snd_tea575x; 28struct snd_tea575x;
28 29
diff --git a/include/sound/version.h b/include/sound/version.h
index 4f0e65808cf1..2ee849d0e198 100644
--- a/include/sound/version.h
+++ b/include/sound/version.h
@@ -1,3 +1,3 @@
1/* include/version.h. Generated by configure. */ 1/* include/version.h. Generated by configure. */
2#define CONFIG_SND_VERSION "1.0.11rc4" 2#define CONFIG_SND_VERSION "1.0.12rc1"
3#define CONFIG_SND_DATE " (Wed Mar 22 10:27:24 2006 UTC)" 3#define CONFIG_SND_DATE " (Thu Jun 22 13:55:50 2006 UTC)"