aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2006-06-24 08:41:41 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-06-24 13:07:53 -0400
commit816724e65c72a90a44fbad0ef0b59b186c85fa90 (patch)
tree421fa29aedff988e392f92780637553e275d37a0 /include
parent70ac4385a13f78bc478f26d317511893741b05bd (diff)
parentd384ea691fe4ea8c2dd5b9b8d9042eb181776f18 (diff)
Merge branch 'master' of /home/trondmy/kernel/linux-2.6/
Conflicts: fs/nfs/inode.c fs/super.c Fix conflicts between patch 'NFS: Split fs/nfs/inode.c' and patch 'VFS: Permit filesystem to override root dentry on mount'
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/irq.h4
-rw-r--r--include/asm-alpha/vga.h2
-rw-r--r--include/asm-arm/arch-at91rm9200/at91rm9200_spi.h81
-rw-r--r--include/asm-arm/arch-at91rm9200/at91rm9200_ssc.h96
-rw-r--r--include/asm-arm/arch-at91rm9200/at91rm9200_sys.h11
-rw-r--r--include/asm-arm/arch-at91rm9200/at91rm9200_tc.h146
-rw-r--r--include/asm-arm/arch-at91rm9200/at91rm9200_udp.h77
-rw-r--r--include/asm-arm/arch-at91rm9200/board.h30
-rw-r--r--include/asm-arm/arch-at91rm9200/gpio.h5
-rw-r--r--include/asm-arm/arch-at91rm9200/hardware.h9
-rw-r--r--include/asm-arm/arch-at91rm9200/io.h1
-rw-r--r--include/asm-arm/arch-at91rm9200/irqs.h2
-rw-r--r--include/asm-arm/arch-at91rm9200/memory.h2
-rw-r--r--include/asm-arm/arch-at91rm9200/pio.h115
-rw-r--r--include/asm-arm/arch-at91rm9200/system.h10
-rw-r--r--include/asm-arm/arch-at91rm9200/timex.h2
-rw-r--r--include/asm-arm/arch-at91rm9200/uncompress.h2
-rw-r--r--include/asm-arm/arch-at91rm9200/vmalloc.h2
-rw-r--r--include/asm-arm/arch-imx/imx-dma.h8
-rw-r--r--include/asm-arm/arch-ixp23xx/entry-macro.S2
-rw-r--r--include/asm-arm/arch-ixp23xx/ixp23xx.h5
-rw-r--r--include/asm-arm/arch-ixp23xx/platform.h15
-rw-r--r--include/asm-arm/arch-netx/debug-macro.S38
-rw-r--r--include/asm-arm/arch-netx/dma.h21
-rw-r--r--include/asm-arm/arch-netx/entry-macro.S35
-rw-r--r--include/asm-arm/arch-netx/eth.h27
-rw-r--r--include/asm-arm/arch-netx/hardware.h39
-rw-r--r--include/asm-arm/arch-netx/io.h29
-rw-r--r--include/asm-arm/arch-netx/irqs.h70
-rw-r--r--include/asm-arm/arch-netx/memory.h36
-rw-r--r--include/asm-arm/arch-netx/netx-regs.h410
-rw-r--r--include/asm-arm/arch-netx/param.h18
-rw-r--r--include/asm-arm/arch-netx/pfifo.h54
-rw-r--r--include/asm-arm/arch-netx/system.h38
-rw-r--r--include/asm-arm/arch-netx/timex.h20
-rw-r--r--include/asm-arm/arch-netx/uncompress.h76
-rw-r--r--include/asm-arm/arch-netx/vmalloc.h19
-rw-r--r--include/asm-arm/arch-netx/xc.h42
-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/poodle.h4
-rw-r--r--include/asm-arm/arch-pxa/pxa-regs.h18
-rw-r--r--include/asm-arm/arch-pxa/system.h1
-rw-r--r--include/asm-arm/arch-s3c2410/regs-dsc.h2
-rw-r--r--include/asm-arm/arch-versatile/system.h16
-rw-r--r--include/asm-arm/byteorder.h10
-rw-r--r--include/asm-arm/hardware/sharpsl_pm.h11
-rw-r--r--include/asm-arm/irq.h4
-rw-r--r--include/asm-arm/mach/serial_at91.h (renamed from include/asm-arm/mach/serial_at91rm9200.h)8
-rw-r--r--include/asm-arm/system.h3
-rw-r--r--include/asm-arm/thread_notify.h48
-rw-r--r--include/asm-arm/vga.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/memory_model.h27
-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/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/uaccess.h35
-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/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/irq.h4
-rw-r--r--include/asm-m68k/processor.h8
-rw-r--r--include/asm-m68k/uaccess.h1084
-rw-r--r--include/asm-m68k/unistd.h39
-rw-r--r--include/asm-m68knommu/irq.h4
-rw-r--r--include/asm-m68knommu/ptrace.h2
-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/mmzone.h1
-rw-r--r--include/asm-mips/vga.h2
-rw-r--r--include/asm-parisc/mmzone.h5
-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/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/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/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/io.h5
-rw-r--r--include/asm-s390/irq.h4
-rw-r--r--include/asm-sparc/irq.h6
-rw-r--r--include/asm-sparc/smp.h8
-rw-r--r--include/asm-sparc/spinlock.h3
-rw-r--r--include/asm-sparc64/cpudata.h19
-rw-r--r--include/asm-sparc64/hardirq.h2
-rw-r--r--include/asm-sparc64/hw_irq.h2
-rw-r--r--include/asm-sparc64/irq.h96
-rw-r--r--include/asm-sparc64/pil.h7
-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/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/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/acpi.h9
-rw-r--r--include/linux/ata.h37
-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/cpufreq.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/efi.h1
-rw-r--r--include/linux/ethtool.h2
-rw-r--r--include/linux/fs.h42
-rw-r--r--include/linux/genalloc.h35
-rw-r--r--include/linux/hdlc.h2
-rw-r--r--include/linux/hugetlb.h8
-rw-r--r--include/linux/i2c-ocores.h19
-rw-r--r--include/linux/i2c.h4
-rw-r--r--include/linux/interrupt.h21
-rw-r--r--include/linux/io.h1
-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.h5
-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/libata.h473
-rw-r--r--include/linux/list.h23
-rw-r--r--include/linux/m41t00.h50
-rw-r--r--include/linux/migrate.h20
-rw-r--r--include/linux/mm.h11
-rw-r--r--include/linux/mmzone.h12
-rw-r--r--include/linux/module.h2
-rw-r--r--include/linux/mount.h5
-rw-r--r--include/linux/netdevice.h24
-rw-r--r--include/linux/netlink.h2
-rw-r--r--include/linux/page-flags.h14
-rw-r--r--include/linux/pagemap.h7
-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/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/rmap.h1
-rw-r--r--include/linux/sched.h13
-rw-r--r--include/linux/security.h55
-rw-r--r--include/linux/serial_core.h4
-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/suspend.h1
-rw-r--r--include/linux/swap.h101
-rw-r--r--include/linux/swapops.h53
-rw-r--r--include/linux/syscalls.h10
-rw-r--r--include/linux/sysctl.h1
-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/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/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/net/ieee80211.h5
-rw-r--r--include/net/pkt_sched.h7
-rw-r--r--include/net/protocol.h1
-rw-r--r--include/net/sctp/sctp.h2
-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/version.h4
307 files changed, 6986 insertions, 3419 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/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-at91rm9200/at91rm9200_spi.h b/include/asm-arm/arch-at91rm9200/at91rm9200_spi.h
new file mode 100644
index 000000000000..bff5ea45f604
--- /dev/null
+++ b/include/asm-arm/arch-at91rm9200/at91rm9200_spi.h
@@ -0,0 +1,81 @@
1/*
2 * include/asm-arm/arch-at91rm9200/at91rm9200_spi.h
3 *
4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People
6 *
7 * Serial Peripheral Interface (SPI) registers.
8 * Based on AT91RM9200 datasheet revision E.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef AT91RM9200_SPI_H
17#define AT91RM9200_SPI_H
18
19#define AT91_SPI_CR 0x00 /* Control Register */
20#define AT91_SPI_SPIEN (1 << 0) /* SPI Enable */
21#define AT91_SPI_SPIDIS (1 << 1) /* SPI Disable */
22#define AT91_SPI_SWRST (1 << 7) /* SPI Software Reset */
23#define AT91_SPI_LASTXFER (1 << 24) /* Last Transfer [SAM9261 only] */
24
25#define AT91_SPI_MR 0x04 /* Mode Register */
26#define AT91_SPI_MSTR (1 << 0) /* Master/Slave Mode */
27#define AT91_SPI_PS (1 << 1) /* Peripheral Select */
28#define AT91_SPI_PS_FIXED (0 << 1)
29#define AT91_SPI_PS_VARIABLE (1 << 1)
30#define AT91_SPI_PCSDEC (1 << 2) /* Chip Select Decode */
31#define AT91_SPI_DIV32 (1 << 3) /* Clock Selection */
32#define AT91_SPI_MODFDIS (1 << 4) /* Mode Fault Detection */
33#define AT91_SPI_LLB (1 << 7) /* Local Loopback Enable */
34#define AT91_SPI_PCS (0xf << 16) /* Peripheral Chip Select */
35#define AT91_SPI_DLYBCS (0xff << 24) /* Delay Between Chip Selects */
36
37#define AT91_SPI_RDR 0x08 /* Receive Data Register */
38#define AT91_SPI_RD (0xffff << 0) /* Receive Data */
39#define AT91_SPI_PCS (0xf << 16) /* Peripheral Chip Select */
40
41#define AT91_SPI_TDR 0x0c /* Transmit Data Register */
42#define AT91_SPI_TD (0xffff << 0) /* Transmit Data */
43#define AT91_SPI_PCS (0xf << 16) /* Peripheral Chip Select */
44#define AT91_SPI_LASTXFER (1 << 24) /* Last Transfer [SAM9261 only] */
45
46#define AT91_SPI_SR 0x10 /* Status Register */
47#define AT91_SPI_RDRF (1 << 0) /* Receive Data Register Full */
48#define AT91_SPI_TDRE (1 << 1) /* Transmit Data Register Full */
49#define AT91_SPI_MODF (1 << 2) /* Mode Fault Error */
50#define AT91_SPI_OVRES (1 << 3) /* Overrun Error Status */
51#define AT91_SPI_ENDRX (1 << 4) /* End of RX buffer */
52#define AT91_SPI_ENDTX (1 << 5) /* End of TX buffer */
53#define AT91_SPI_RXBUFF (1 << 6) /* RX Buffer Full */
54#define AT91_SPI_TXBUFE (1 << 7) /* TX Buffer Empty */
55#define AT91_SPI_NSSR (1 << 8) /* NSS Rising [SAM9261 only] */
56#define AT91_SPI_TXEMPTY (1 << 9) /* Transmission Register Empty [SAM9261 only] */
57#define AT91_SPI_SPIENS (1 << 16) /* SPI Enable Status */
58
59#define AT91_SPI_IER 0x14 /* Interrupt Enable Register */
60#define AT91_SPI_IDR 0x18 /* Interrupt Disable Register */
61#define AT91_SPI_IMR 0x1c /* Interrupt Mask Register */
62
63#define AT91_SPI_CSR(n) (0x30 + ((n) * 4)) /* Chip Select Registers 0-3 */
64#define AT91_SPI_CPOL (1 << 0) /* Clock Polarity */
65#define AT91_SPI_NCPHA (1 << 1) /* Clock Phase */
66#define AT91_SPI_CSAAT (1 << 3) /* Chip Select Active After Transfer [SAM9261 only] */
67#define AT91_SPI_BITS (0xf << 4) /* Bits Per Transfer */
68#define AT91_SPI_BITS_8 (0 << 4)
69#define AT91_SPI_BITS_9 (1 << 4)
70#define AT91_SPI_BITS_10 (2 << 4)
71#define AT91_SPI_BITS_11 (3 << 4)
72#define AT91_SPI_BITS_12 (4 << 4)
73#define AT91_SPI_BITS_13 (5 << 4)
74#define AT91_SPI_BITS_14 (6 << 4)
75#define AT91_SPI_BITS_15 (7 << 4)
76#define AT91_SPI_BITS_16 (8 << 4)
77#define AT91_SPI_SCBR (0xff << 8) /* Serial Clock Baud Rate */
78#define AT91_SPI_DLYBS (0xff << 16) /* Delay before SPCK */
79#define AT91_SPI_DLYBCT (0xff << 24) /* Delay between Consecutive Transfers */
80
81#endif
diff --git a/include/asm-arm/arch-at91rm9200/at91rm9200_ssc.h b/include/asm-arm/arch-at91rm9200/at91rm9200_ssc.h
new file mode 100644
index 000000000000..ac880227147f
--- /dev/null
+++ b/include/asm-arm/arch-at91rm9200/at91rm9200_ssc.h
@@ -0,0 +1,96 @@
1/*
2 * include/asm-arm/arch-at91rm9200/at91rm9200_ssc.h
3 *
4 * Copyright (C) SAN People
5 *
6 * Serial Synchronous Controller (SSC) registers.
7 * Based on AT91RM9200 datasheet revision E.
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
15#ifndef AT91RM9200_SSC_H
16#define AT91RM9200_SSC_H
17
18#define AT91_SSC_CR 0x00 /* Control Register */
19#define AT91_SSC_RXEN (1 << 0) /* Receive Enable */
20#define AT91_SSC_RXDIS (1 << 1) /* Receive Disable */
21#define AT91_SSC_TXEN (1 << 8) /* Transmit Enable */
22#define AT91_SSC_TXDIS (1 << 9) /* Transmit Disable */
23#define AT91_SSC_SWRST (1 << 15) /* Software Reset */
24
25#define AT91_SSC_CMR 0x04 /* Clock Mode Register */
26#define AT91_SSC_CMR_DIV (0xfff << 0) /* Clock Divider */
27
28#define AT91_SSC_RCMR 0x10 /* Receive Clock Mode Register */
29#define AT91_SSC_CKS (3 << 0) /* Clock Selection */
30#define AT91_SSC_CKS_DIV (0 << 0)
31#define AT91_SSC_CKS_CLOCK (1 << 0)
32#define AT91_SSC_CKS_PIN (2 << 0)
33#define AT91_SSC_CKO (7 << 2) /* Clock Output Mode Selection */
34#define AT91_SSC_CKO_NONE (0 << 2)
35#define AT91_SSC_CKO_CONTINUOUS (1 << 2)
36#define AT91_SSC_CKI (1 << 5) /* Clock Inversion */
37#define AT91_SSC_CKI_FALLING (0 << 5)
38#define AT91_SSC_CK_RISING (1 << 5)
39#define AT91_SSC_START (0xf << 8) /* Start Selection */
40#define AT91_SSC_START_CONTINUOUS (0 << 8)
41#define AT91_SSC_START_TX_RX (1 << 8)
42#define AT91_SSC_START_LOW_RF (2 << 8)
43#define AT91_SSC_START_HIGH_RF (3 << 8)
44#define AT91_SSC_START_FALLING_RF (4 << 8)
45#define AT91_SSC_START_RISING_RF (5 << 8)
46#define AT91_SSC_START_LEVEL_RF (6 << 8)
47#define AT91_SSC_START_EDGE_RF (7 << 8)
48#define AT91_SSC_STTDLY (0xff << 16) /* Start Delay */
49#define AT91_SSC_PERIOD (0xff << 24) /* Period Divider Selection */
50
51#define AT91_SSC_RFMR 0x14 /* Receive Frame Mode Register */
52#define AT91_SSC_DATALEN (0x1f << 0) /* Data Length */
53#define AT91_SSC_LOOP (1 << 5) /* Loop Mode */
54#define AT91_SSC_MSBF (1 << 7) /* Most Significant Bit First */
55#define AT91_SSC_DATNB (0xf << 8) /* Data Number per Frame */
56#define AT91_SSC_FSLEN (0xf << 16) /* Frame Sync Length */
57#define AT91_SSC_FSOS (7 << 20) /* Frame Sync Output Selection */
58#define AT91_SSC_FSOS_NONE (0 << 20)
59#define AT91_SSC_FSOS_NEGATIVE (1 << 20)
60#define AT91_SSC_FSOS_POSITIVE (2 << 20)
61#define AT91_SSC_FSOS_LOW (3 << 20)
62#define AT91_SSC_FSOS_HIGH (4 << 20)
63#define AT91_SSC_FSOS_TOGGLE (5 << 20)
64#define AT91_SSC_FSEDGE (1 << 24) /* Frame Sync Edge Detection */
65#define AT91_SSC_FSEDGE_POSITIVE (0 << 24)
66#define AT91_SSC_FSEDGE_NEGATIVE (1 << 24)
67
68#define AT91_SSC_TCMR 0x18 /* Transmit Clock Mode Register */
69#define AT91_SSC_TFMR 0x1c /* Transmit Fram Mode Register */
70#define AT91_SSC_DATDEF (1 << 5) /* Data Default Value */
71#define AT91_SSC_FSDEN (1 << 23) /* Frame Sync Data Enable */
72
73#define AT91_SSC_RHR 0x20 /* Receive Holding Register */
74#define AT91_SSC_THR 0x24 /* Transmit Holding Register */
75#define AT91_SSC_RSHR 0x30 /* Receive Sync Holding Register */
76#define AT91_SSC_TSHR 0x34 /* Transmit Sync Holding Register */
77
78#define AT91_SSC_SR 0x40 /* Status Register */
79#define AT91_SSC_TXRDY (1 << 0) /* Transmit Ready */
80#define AT91_SSC_TXEMPTY (1 << 1) /* Transmit Empty */
81#define AT91_SSC_ENDTX (1 << 2) /* End of Transmission */
82#define AT91_SSC_TXBUFE (1 << 3) /* Transmit Buffer Empty */
83#define AT91_SSC_RXRDY (1 << 4) /* Receive Ready */
84#define AT91_SSC_OVRUN (1 << 5) /* Receive Overrun */
85#define AT91_SSC_ENDRX (1 << 6) /* End of Reception */
86#define AT91_SSC_RXBUFF (1 << 7) /* Receive Buffer Full */
87#define AT91_SSC_TXSYN (1 << 10) /* Transmit Sync */
88#define AT91_SSC_RXSYN (1 << 11) /* Receive Sync */
89#define AT91_SSC_TXENA (1 << 16) /* Transmit Enable */
90#define AT91_SSC_RXENA (1 << 17) /* Receive Enable */
91
92#define AT91_SSC_IER 0x44 /* Interrupt Enable Register */
93#define AT91_SSC_IDR 0x48 /* Interrupt Disable Register */
94#define AT91_SSC_IMR 0x4c /* Interrupt Mask Register */
95
96#endif
diff --git a/include/asm-arm/arch-at91rm9200/at91rm9200_sys.h b/include/asm-arm/arch-at91rm9200/at91rm9200_sys.h
index 2910d359f919..0f4c12d5f0cd 100644
--- a/include/asm-arm/arch-at91rm9200/at91rm9200_sys.h
+++ b/include/asm-arm/arch-at91rm9200/at91rm9200_sys.h
@@ -68,8 +68,17 @@
68#define AT91_DBGU_RHR (AT91_DBGU + 0x18) /* Receiver Holding Register */ 68#define AT91_DBGU_RHR (AT91_DBGU + 0x18) /* Receiver Holding Register */
69#define AT91_DBGU_THR (AT91_DBGU + 0x1c) /* Transmitter Holding Register */ 69#define AT91_DBGU_THR (AT91_DBGU + 0x1c) /* Transmitter Holding Register */
70#define AT91_DBGU_BRGR (AT91_DBGU + 0x20) /* Baud Rate Generator Register */ 70#define AT91_DBGU_BRGR (AT91_DBGU + 0x20) /* Baud Rate Generator Register */
71
71#define AT91_DBGU_CIDR (AT91_DBGU + 0x40) /* Chip ID Register */ 72#define AT91_DBGU_CIDR (AT91_DBGU + 0x40) /* Chip ID Register */
72#define AT91_DBGU_EXID (AT91_DBGU + 0x44) /* Chip ID Extension Register */ 73#define AT91_DBGU_EXID (AT91_DBGU + 0x44) /* Chip ID Extension Register */
74#define AT91_CIDR_VERSION (0x1f << 0) /* Version of the Device */
75#define AT91_CIDR_EPROC (7 << 5) /* Embedded Processor */
76#define AT91_CIDR_NVPSIZ (0xf << 8) /* Nonvolatile Program Memory Size */
77#define AT91_CIDR_NVPSIZ2 (0xf << 12) /* Second Nonvolatile Program Memory Size */
78#define AT91_CIDR_SRAMSIZ (0xf << 16) /* Internal SRAM Size */
79#define AT91_CIDR_ARCH (0xff << 20) /* Architecture Identifier */
80#define AT91_CIDR_NVPTYP (7 << 28) /* Nonvolatile Program Memory Type */
81#define AT91_CIDR_EXT (1 << 31) /* Extension Flag */
73 82
74 83
75/* 84/*
@@ -241,7 +250,7 @@
241#define AT91_RTC_SEC (0x7f << 0) /* Current Second */ 250#define AT91_RTC_SEC (0x7f << 0) /* Current Second */
242#define AT91_RTC_MIN (0x7f << 8) /* Current Minute */ 251#define AT91_RTC_MIN (0x7f << 8) /* Current Minute */
243#define AT91_RTC_HOUR (0x3f << 16) /* Current Hour */ 252#define AT91_RTC_HOUR (0x3f << 16) /* Current Hour */
244#define At91_RTC_AMPM (1 << 22) /* Ante Meridiem Post Meridiem Indicator */ 253#define AT91_RTC_AMPM (1 << 22) /* Ante Meridiem Post Meridiem Indicator */
245 254
246#define AT91_RTC_CALR (AT91_RTC + 0x0c) /* Calendar Register */ 255#define AT91_RTC_CALR (AT91_RTC + 0x0c) /* Calendar Register */
247#define AT91_RTC_CENT (0x7f << 0) /* Current Century */ 256#define AT91_RTC_CENT (0x7f << 0) /* Current Century */
diff --git a/include/asm-arm/arch-at91rm9200/at91rm9200_tc.h b/include/asm-arm/arch-at91rm9200/at91rm9200_tc.h
new file mode 100644
index 000000000000..f4da752bb0c8
--- /dev/null
+++ b/include/asm-arm/arch-at91rm9200/at91rm9200_tc.h
@@ -0,0 +1,146 @@
1/*
2 * include/asm-arm/arch-at91rm9200/at91rm9200_tc.h
3 *
4 * Copyright (C) SAN People
5 *
6 * Timer/Counter Unit (TC) registers.
7 * Based on AT91RM9200 datasheet revision E.
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
15#ifndef AT91RM9200_TC_H
16#define AT91RM9200_TC_H
17
18#define AT91_TC_BCR 0xc0 /* TC Block Control Register */
19#define AT91_TC_SYNC (1 << 0) /* Synchro Command */
20
21#define AT91_TC_BMR 0xc4 /* TC Block Mode Register */
22#define AT91_TC_TC0XC0S (3 << 0) /* External Clock Signal 0 Selection */
23#define AT91_TC_TC0XC0S_TCLK0 (0 << 0)
24#define AT91_TC_TC0XC0S_NONE (1 << 0)
25#define AT91_TC_TC0XC0S_TIOA1 (2 << 0)
26#define AT91_TC_TC0XC0S_TIOA2 (3 << 0)
27#define AT91_TC_TC1XC1S (3 << 2) /* External Clock Signal 1 Selection */
28#define AT91_TC_TC1XC1S_TCLK1 (0 << 2)
29#define AT91_TC_TC1XC1S_NONE (1 << 2)
30#define AT91_TC_TC1XC1S_TIOA0 (2 << 2)
31#define AT91_TC_TC1XC1S_TIOA2 (3 << 2)
32#define AT91_TC_TC2XC2S (3 << 4) /* External Clock Signal 2 Selection */
33#define AT91_TC_TC2XC2S_TCLK2 (0 << 4)
34#define AT91_TC_TC2XC2S_NONE (1 << 4)
35#define AT91_TC_TC2XC2S_TIOA0 (2 << 4)
36#define AT91_TC_TC2XC2S_TIOA1 (3 << 4)
37
38
39#define AT91_TC_CCR 0x00 /* Channel Control Register */
40#define AT91_TC_CLKEN (1 << 0) /* Counter Clock Enable Command */
41#define AT91_TC_CLKDIS (1 << 1) /* Counter CLock Disable Command */
42#define AT91_TC_SWTRG (1 << 2) /* Software Trigger Command */
43
44#define AT91_TC_CMR 0x04 /* Channel Mode Register */
45#define AT91_TC_TCCLKS (7 << 0) /* Capture/Waveform Mode: Clock Selection */
46#define AT91_TC_TIMER_CLOCK1 (0 << 0)
47#define AT91_TC_TIMER_CLOCK2 (1 << 0)
48#define AT91_TC_TIMER_CLOCK3 (2 << 0)
49#define AT91_TC_TIMER_CLOCK4 (3 << 0)
50#define AT91_TC_TIMER_CLOCK5 (4 << 0)
51#define AT91_TC_XC0 (5 << 0)
52#define AT91_TC_XC1 (6 << 0)
53#define AT91_TC_XC2 (7 << 0)
54#define AT91_TC_CLKI (1 << 3) /* Capture/Waveform Mode: Clock Invert */
55#define AT91_TC_BURST (3 << 4) /* Capture/Waveform Mode: Burst Signal Selection */
56#define AT91_TC_LDBSTOP (1 << 6) /* Capture Mode: Counter Clock Stopped with TB Loading */
57#define AT91_TC_LDBDIS (1 << 7) /* Capture Mode: Counter Clock Disable with RB Loading */
58#define AT91_TC_ETRGEDG (3 << 8) /* Capture Mode: External Trigger Edge Selection */
59#define AT91_TC_ABETRG (1 << 10) /* Capture Mode: TIOA or TIOB External Trigger Selection */
60#define AT91_TC_CPCTRG (1 << 14) /* Capture Mode: RC Compare Trigger Enable */
61#define AT91_TC_WAVE (1 << 15) /* Capture/Waveform mode */
62#define AT91_TC_LDRA (3 << 16) /* Capture Mode: RA Loading Selection */
63#define AT91_TC_LDRB (3 << 18) /* Capture Mode: RB Loading Selection */
64
65#define AT91_TC_CPCSTOP (1 << 6) /* Waveform Mode: Counter Clock Stopped with RC Compare */
66#define AT91_TC_CPCDIS (1 << 7) /* Waveform Mode: Counter Clock Disable with RC Compare */
67#define AT91_TC_EEVTEDG (3 << 8) /* Waveform Mode: External Event Edge Selection */
68#define AT91_TC_EEVTEDG_NONE (0 << 8)
69#define AT91_TC_EEVTEDG_RISING (1 << 8)
70#define AT91_TC_EEVTEDG_FALLING (2 << 8)
71#define AT91_TC_EEVTEDG_BOTH (3 << 8)
72#define AT91_TC_EEVT (3 << 10) /* Waveform Mode: External Event Selection */
73#define AT91_TC_EEVT_TIOB (0 << 10)
74#define AT91_TC_EEVT_XC0 (1 << 10)
75#define AT91_TC_EEVT_XC1 (2 << 10)
76#define AT91_TC_EEVT_XC2 (3 << 10)
77#define AT91_TC_ENETRG (1 << 12) /* Waveform Mode: External Event Trigger Enable */
78#define AT91_TC_WAVESEL (3 << 13) /* Waveform Mode: Waveform Selection */
79#define AT91_TC_WAVESEL_UP (0 << 13)
80#define AT91_TC_WAVESEL_UP_AUTO (2 << 13)
81#define AT91_TC_WAVESEL_UPDOWN (1 << 13)
82#define AT91_TC_WAVESEL_UPDOWN_AUTO (3 << 13)
83#define AT91_TC_ACPA (3 << 16) /* Waveform Mode: RA Compare Effect on TIOA */
84#define AT91_TC_ACPA_NONE (0 << 16)
85#define AT91_TC_ACPA_SET (1 << 16)
86#define AT91_TC_ACPA_CLEAR (2 << 16)
87#define AT91_TC_ACPA_TOGGLE (3 << 16)
88#define AT91_TC_ACPC (3 << 18) /* Waveform Mode: RC Compre Effect on TIOA */
89#define AT91_TC_ACPC_NONE (0 << 18)
90#define AT91_TC_ACPC_SET (1 << 18)
91#define AT91_TC_ACPC_CLEAR (2 << 18)
92#define AT91_TC_ACPC_TOGGLE (3 << 18)
93#define AT91_TC_AEEVT (3 << 20) /* Waveform Mode: External Event Effect on TIOA */
94#define AT91_TC_AEEVT_NONE (0 << 20)
95#define AT91_TC_AEEVT_SET (1 << 20)
96#define AT91_TC_AEEVT_CLEAR (2 << 20)
97#define AT91_TC_AEEVT_TOGGLE (3 << 20)
98#define AT91_TC_ASWTRG (3 << 22) /* Waveform Mode: Software Trigger Effect on TIOA */
99#define AT91_TC_ASWTRG_NONE (0 << 22)
100#define AT91_TC_ASWTRG_SET (1 << 22)
101#define AT91_TC_ASWTRG_CLEAR (2 << 22)
102#define AT91_TC_ASWTRG_TOGGLE (3 << 22)
103#define AT91_TC_BCPB (3 << 24) /* Waveform Mode: RB Compare Effect on TIOB */
104#define AT91_TC_BCPB_NONE (0 << 24)
105#define AT91_TC_BCPB_SET (1 << 24)
106#define AT91_TC_BCPB_CLEAR (2 << 24)
107#define AT91_TC_BCPB_TOGGLE (3 << 24)
108#define AT91_TC_BCPC (3 << 26) /* Waveform Mode: RC Compare Effect on TIOB */
109#define AT91_TC_BCPC_NONE (0 << 26)
110#define AT91_TC_BCPC_SET (1 << 26)
111#define AT91_TC_BCPC_CLEAR (2 << 26)
112#define AT91_TC_BCPC_TOGGLE (3 << 26)
113#define AT91_TC_BEEVT (3 << 28) /* Waveform Mode: External Event Effect on TIOB */
114#define AT91_TC_BEEVT_NONE (0 << 28)
115#define AT91_TC_BEEVT_SET (1 << 28)
116#define AT91_TC_BEEVT_CLEAR (2 << 28)
117#define AT91_TC_BEEVT_TOGGLE (3 << 28)
118#define AT91_TC_BSWTRG (3 << 30) /* Waveform Mode: Software Trigger Effect on TIOB */
119#define AT91_TC_BSWTRG_NONE (0 << 30)
120#define AT91_TC_BSWTRG_SET (1 << 30)
121#define AT91_TC_BSWTRG_CLEAR (2 << 30)
122#define AT91_TC_BSWTRG_TOGGLE (3 << 30)
123
124#define AT91_TC_CV 0x10 /* Counter Value */
125#define AT91_TC_RA 0x14 /* Register A */
126#define AT91_TC_RB 0x18 /* Register B */
127#define AT91_TC_RC 0x1c /* Register C */
128
129#define AT91_TC_SR 0x20 /* Status Register */
130#define AT91_TC_COVFS (1 << 0) /* Counter Overflow Status */
131#define AT91_TC_LOVRS (1 << 1) /* Load Overrun Status */
132#define AT91_TC_CPAS (1 << 2) /* RA Compare Status */
133#define AT91_TC_CPBS (1 << 3) /* RB Compare Status */
134#define AT91_TC_CPCS (1 << 4) /* RC Compare Status */
135#define AT91_TC_LDRAS (1 << 5) /* RA Loading Status */
136#define AT91_TC_LDRBS (1 << 6) /* RB Loading Status */
137#define AT91_TC_ETRGS (1 << 7) /* External Trigger Status */
138#define AT91_TC_CLKSTA (1 << 16) /* Clock Enabling Status */
139#define AT91_TC_MTIOA (1 << 17) /* TIOA Mirror */
140#define AT91_TC_MTIOB (1 << 18) /* TIOB Mirror */
141
142#define AT91_TC_IER 0x24 /* Interrupt Enable Register */
143#define AT91_TC_IDR 0x28 /* Interrupt Disable Register */
144#define AT91_TC_IMR 0x2c /* Interrupt Mask Register */
145
146#endif
diff --git a/include/asm-arm/arch-at91rm9200/at91rm9200_udp.h b/include/asm-arm/arch-at91rm9200/at91rm9200_udp.h
new file mode 100644
index 000000000000..951e3f61cef4
--- /dev/null
+++ b/include/asm-arm/arch-at91rm9200/at91rm9200_udp.h
@@ -0,0 +1,77 @@
1/*
2 * include/asm-arm/arch-at91rm9200/at91rm9200_udp.h
3 *
4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People
6 *
7 * USB Device Port (UDP) registers.
8 * Based on AT91RM9200 datasheet revision E.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef AT91RM9200_UDP_H
17#define AT91RM9200_UDP_H
18
19#define AT91_UDP_FRM_NUM 0x00 /* Frame Number Register */
20#define AT91_UDP_NUM (0x7ff << 0) /* Frame Number */
21#define AT91_UDP_FRM_ERR (1 << 16) /* Frame Error */
22#define AT91_UDP_FRM_OK (1 << 17) /* Frame OK */
23
24#define AT91_UDP_GLB_STAT 0x04 /* Global State Register */
25#define AT91_UDP_FADDEN (1 << 0) /* Function Address Enable */
26#define AT91_UDP_CONFG (1 << 1) /* Configured */
27#define AT91_UDP_ESR (1 << 2) /* Enable Send Resume */
28#define AT91_UDP_RSMINPR (1 << 3) /* Resume has been sent */
29#define AT91_UDP_RMWUPE (1 << 4) /* Remote Wake Up Enable */
30
31#define AT91_UDP_FADDR 0x08 /* Function Address Register */
32#define AT91_UDP_FADD (0x7f << 0) /* Function Address Value */
33#define AT91_UDP_FEN (1 << 8) /* Function Enable */
34
35#define AT91_UDP_IER 0x10 /* Interrupt Enable Register */
36#define AT91_UDP_IDR 0x14 /* Interrupt Disable Register */
37#define AT91_UDP_IMR 0x18 /* Interrupt Mask Register */
38
39#define AT91_UDP_ISR 0x1c /* Interrupt Status Register */
40#define AT91_UDP_EP(n) (1 << (n)) /* Endpoint Interrupt Status */
41#define AT91_UDP_RXSUSP (1 << 8) /* USB Suspend Interrupt Status */
42#define AT91_UDP_RXRSM (1 << 9) /* USB Resume Interrupt Status */
43#define AT91_UDP_EXTRSM (1 << 10) /* External Resume Interrupt Status */
44#define AT91_UDP_SOFINT (1 << 11) /* Start of Frame Interrupt Status */
45#define AT91_UDP_ENDBUSRES (1 << 12) /* End of Bus Reset Interrpt Status */
46#define AT91_UDP_WAKEUP (1 << 13) /* USB Wakeup Interrupt Status */
47
48#define AT91_UDP_ICR 0x20 /* Interrupt Clear Register */
49#define AT91_UDP_RST_EP 0x28 /* Reset Endpoint Register */
50
51#define AT91_UDP_CSR(n) (0x30 + ((n) * 4)) /* Endpoint Control/Status Registers 0-7 */
52#define AT91_UDP_TXCOMP (1 << 0) /* Generates IN packet with data previously written in DPR */
53#define AT91_UDP_RX_DATA_BK0 (1 << 1) /* Receive Data Bank 0 */
54#define AT91_UDP_RXSETUP (1 << 2) /* Send STALL to the host */
55#define AT91_UDP_STALLSENT (1 << 3) /* Stall Sent / Isochronous error (Isochronous endpoints) */
56#define AT91_UDP_TXPKTRDY (1 << 4) /* Transmit Packet Ready */
57#define AT91_UDP_FORCESTALL (1 << 5) /* Force Stall */
58#define AT91_UDP_RX_DATA_BK1 (1 << 6) /* Receive Data Bank 1 */
59#define AT91_UDP_DIR (1 << 7) /* Transfer Direction */
60#define AT91_UDP_EPTYPE (7 << 8) /* Endpoint Type */
61#define AT91_UDP_EPTYPE_CTRL (0 << 8)
62#define AT91_UDP_EPTYPE_ISO_OUT (1 << 8)
63#define AT91_UDP_EPTYPE_BULK_OUT (2 << 8)
64#define AT91_UDP_EPTYPE_INT_OUT (3 << 8)
65#define AT91_UDP_EPTYPE_ISO_IN (5 << 8)
66#define AT91_UDP_EPTYPE_BULK_IN (6 << 8)
67#define AT91_UDP_EPTYPE_INT_IN (7 << 8)
68#define AT91_UDP_DTGLE (1 << 11) /* Data Toggle */
69#define AT91_UDP_EPEDS (1 << 15) /* Endpoint Enable/Disable */
70#define AT91_UDP_RXBYTECNT (0x7ff << 16) /* Number of bytes in FIFO */
71
72#define AT91_UDP_FDR(n) (0x50 + ((n) * 4)) /* Endpoint FIFO Data Registers 0-7 */
73
74#define AT91_UDP_TXVC 0x74 /* Transceiver Control Register */
75#define AT91_UDP_TXVC_TXVDIS (1 << 8) /* Transceiver Disable */
76
77#endif
diff --git a/include/asm-arm/arch-at91rm9200/board.h b/include/asm-arm/arch-at91rm9200/board.h
index 4fdef13d01d4..1fdd70b23809 100644
--- a/include/asm-arm/arch-at91rm9200/board.h
+++ b/include/asm-arm/arch-at91rm9200/board.h
@@ -31,14 +31,9 @@
31#ifndef __ASM_ARCH_BOARD_H 31#ifndef __ASM_ARCH_BOARD_H
32#define __ASM_ARCH_BOARD_H 32#define __ASM_ARCH_BOARD_H
33 33
34 /* Clocks */
35extern unsigned long at91_master_clock;
36
37 /* Serial Port */
38extern int at91_serial_map[AT91_NR_UART];
39extern int at91_console_port;
40
41#include <linux/mtd/partitions.h> 34#include <linux/mtd/partitions.h>
35#include <linux/device.h>
36#include <linux/spi/spi.h>
42 37
43 /* USB Device */ 38 /* USB Device */
44struct at91_udc_data { 39struct at91_udc_data {
@@ -91,10 +86,25 @@ struct at91_nand_data {
91extern void __init at91_add_device_nand(struct at91_nand_data *data); 86extern void __init at91_add_device_nand(struct at91_nand_data *data);
92 87
93 /* I2C*/ 88 /* I2C*/
94void __init at91_add_device_i2c(void); 89extern void __init at91_add_device_i2c(void);
90
91 /* SPI */
92extern void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices);
95 93
96 /* RTC */ 94 /* Serial */
97void __init at91_add_device_rtc(void); 95struct at91_uart_config {
96 unsigned short console_tty; /* tty number of serial console */
97 unsigned short nr_tty; /* number of serial tty's */
98 short tty_map[]; /* map UART to tty number */
99};
100extern struct platform_device *at91_default_console_device;
101extern void __init at91_init_serial(struct at91_uart_config *config);
102
103struct at91_uart_data {
104 short use_dma_tx; /* use transmit DMA? */
105 short use_dma_rx; /* use receive DMA? */
106};
107extern void __init at91_add_device_serial(void);
98 108
99 /* LEDs */ 109 /* LEDs */
100extern u8 at91_leds_cpu; 110extern u8 at91_leds_cpu;
diff --git a/include/asm-arm/arch-at91rm9200/gpio.h b/include/asm-arm/arch-at91rm9200/gpio.h
index 6176ab2dc417..dbde1baaf251 100644
--- a/include/asm-arm/arch-at91rm9200/gpio.h
+++ b/include/asm-arm/arch-at91rm9200/gpio.h
@@ -13,6 +13,8 @@
13#ifndef __ASM_ARCH_AT91RM9200_GPIO_H 13#ifndef __ASM_ARCH_AT91RM9200_GPIO_H
14#define __ASM_ARCH_AT91RM9200_GPIO_H 14#define __ASM_ARCH_AT91RM9200_GPIO_H
15 15
16#include <asm/irq.h>
17
16#define PIN_BASE NR_AIC_IRQS 18#define PIN_BASE NR_AIC_IRQS
17 19
18#define PQFP_GPIO_BANKS 3 /* PQFP package has 3 banks */ 20#define PQFP_GPIO_BANKS 3 /* PQFP package has 3 banks */
@@ -188,6 +190,9 @@ extern int at91_set_multi_drive(unsigned pin, int is_on);
188/* callable at any time */ 190/* callable at any time */
189extern int at91_set_gpio_value(unsigned pin, int value); 191extern int at91_set_gpio_value(unsigned pin, int value);
190extern int at91_get_gpio_value(unsigned pin); 192extern int at91_get_gpio_value(unsigned pin);
193
194extern void at91_gpio_suspend(void);
195extern void at91_gpio_resume(void);
191#endif 196#endif
192 197
193#endif 198#endif
diff --git a/include/asm-arm/arch-at91rm9200/hardware.h b/include/asm-arm/arch-at91rm9200/hardware.h
index 59e6f44d3a0d..235d39d91107 100644
--- a/include/asm-arm/arch-at91rm9200/hardware.h
+++ b/include/asm-arm/arch-at91rm9200/hardware.h
@@ -50,9 +50,12 @@
50#define AT91_VA_BASE_TCB0 AT91_IO_P2V(AT91_BASE_TCB0) 50#define AT91_VA_BASE_TCB0 AT91_IO_P2V(AT91_BASE_TCB0)
51 51
52/* Internal SRAM */ 52/* Internal SRAM */
53#define AT91_BASE_SRAM 0x00200000 /* Internal SRAM base address */ 53#define AT91_SRAM_BASE 0x00200000 /* Internal SRAM base address */
54#define AT91_SRAM_SIZE 0x00004000 /* Internal SRAM SIZE (16Kb) */ 54#define AT91_SRAM_SIZE 0x00004000 /* Internal SRAM SIZE (16Kb) */
55 55
56 /* Internal SRAM is mapped below the IO devices */
57#define AT91_SRAM_VIRT_BASE (AT91_IO_VIRT_BASE - AT91_SRAM_SIZE)
58
56/* Serial ports */ 59/* Serial ports */
57#define AT91_NR_UART 5 /* 4 USART3's and one DBGU port */ 60#define AT91_NR_UART 5 /* 4 USART3's and one DBGU port */
58 61
@@ -81,14 +84,14 @@ static inline unsigned int at91_sys_read(unsigned int reg_offset)
81{ 84{
82 void __iomem *addr = (void __iomem *)AT91_VA_BASE_SYS; 85 void __iomem *addr = (void __iomem *)AT91_VA_BASE_SYS;
83 86
84 return readl(addr + reg_offset); 87 return __raw_readl(addr + reg_offset);
85} 88}
86 89
87static inline void at91_sys_write(unsigned int reg_offset, unsigned long value) 90static inline void at91_sys_write(unsigned int reg_offset, unsigned long value)
88{ 91{
89 void __iomem *addr = (void __iomem *)AT91_VA_BASE_SYS; 92 void __iomem *addr = (void __iomem *)AT91_VA_BASE_SYS;
90 93
91 writel(value, addr + reg_offset); 94 __raw_writel(value, addr + reg_offset);
92} 95}
93#endif 96#endif
94 97
diff --git a/include/asm-arm/arch-at91rm9200/io.h b/include/asm-arm/arch-at91rm9200/io.h
index 23e670d85c9d..88fd1bebcef3 100644
--- a/include/asm-arm/arch-at91rm9200/io.h
+++ b/include/asm-arm/arch-at91rm9200/io.h
@@ -21,7 +21,6 @@
21#ifndef __ASM_ARCH_IO_H 21#ifndef __ASM_ARCH_IO_H
22#define __ASM_ARCH_IO_H 22#define __ASM_ARCH_IO_H
23 23
24#include <asm/arch/at91rm9200.h>
25#include <asm/io.h> 24#include <asm/io.h>
26 25
27#define IO_SPACE_LIMIT 0xFFFFFFFF 26#define IO_SPACE_LIMIT 0xFFFFFFFF
diff --git a/include/asm-arm/arch-at91rm9200/irqs.h b/include/asm-arm/arch-at91rm9200/irqs.h
index 27b0497f1b36..2dc93b174a8f 100644
--- a/include/asm-arm/arch-at91rm9200/irqs.h
+++ b/include/asm-arm/arch-at91rm9200/irqs.h
@@ -37,8 +37,6 @@
37 * symbols in gpio.h for ones handled indirectly as GPIOs. 37 * symbols in gpio.h for ones handled indirectly as GPIOs.
38 * We make provision for 4 banks of GPIO. 38 * We make provision for 4 banks of GPIO.
39 */ 39 */
40#include <asm/arch/gpio.h>
41
42#define NR_IRQS (NR_AIC_IRQS + (4 * 32)) 40#define NR_IRQS (NR_AIC_IRQS + (4 * 32))
43 41
44 42
diff --git a/include/asm-arm/arch-at91rm9200/memory.h b/include/asm-arm/arch-at91rm9200/memory.h
index 462f1f0ad67c..3c327c404373 100644
--- a/include/asm-arm/arch-at91rm9200/memory.h
+++ b/include/asm-arm/arch-at91rm9200/memory.h
@@ -21,7 +21,7 @@
21#ifndef __ASM_ARCH_MEMORY_H 21#ifndef __ASM_ARCH_MEMORY_H
22#define __ASM_ARCH_MEMORY_H 22#define __ASM_ARCH_MEMORY_H
23 23
24#include <asm/arch/hardware.h> 24#include <asm/hardware.h>
25 25
26#define PHYS_OFFSET (AT91_SDRAM_BASE) 26#define PHYS_OFFSET (AT91_SDRAM_BASE)
27 27
diff --git a/include/asm-arm/arch-at91rm9200/pio.h b/include/asm-arm/arch-at91rm9200/pio.h
deleted file mode 100644
index a89501b4a703..000000000000
--- a/include/asm-arm/arch-at91rm9200/pio.h
+++ /dev/null
@@ -1,115 +0,0 @@
1/*
2 * include/asm-arm/arch-at91rm9200/pio.h
3 *
4 * Copyright (C) 2003 SAN People
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 */
12
13#ifndef __ASM_ARCH_PIO_H
14#define __ASM_ARCH_PIO_H
15
16#include <asm/arch/hardware.h>
17
18static inline void AT91_CfgPIO_USART0(void) {
19 at91_sys_write(AT91_PIOA + PIO_PDR, AT91_PA17_TXD0 | AT91_PA18_RXD0 | AT91_PA20_CTS0);
20
21 /*
22 * Errata #39 - RTS0 is not internally connected to PA21. We need to drive
23 * the pin manually. Default is off (RTS is active low).
24 */
25 at91_sys_write(AT91_PIOA + PIO_PER, AT91_PA21_RTS0);
26 at91_sys_write(AT91_PIOA + PIO_OER, AT91_PA21_RTS0);
27 at91_sys_write(AT91_PIOA + PIO_SODR, AT91_PA21_RTS0);
28}
29
30static inline void AT91_CfgPIO_USART1(void) {
31 at91_sys_write(AT91_PIOB + PIO_PDR, AT91_PB18_RI1 | AT91_PB19_DTR1
32 | AT91_PB20_TXD1 | AT91_PB21_RXD1 | AT91_PB23_DCD1
33 | AT91_PB24_CTS1 | AT91_PB25_DSR1 | AT91_PB26_RTS1);
34}
35
36static inline void AT91_CfgPIO_USART2(void) {
37 at91_sys_write(AT91_PIOA + PIO_PDR, AT91_PA22_RXD2 | AT91_PA23_TXD2);
38}
39
40static inline void AT91_CfgPIO_USART3(void) {
41 at91_sys_write(AT91_PIOA + PIO_PDR, AT91_PA5_TXD3 | AT91_PA6_RXD3);
42 at91_sys_write(AT91_PIOA + PIO_BSR, AT91_PA5_TXD3 | AT91_PA6_RXD3);
43}
44
45static inline void AT91_CfgPIO_DBGU(void) {
46 at91_sys_write(AT91_PIOA + PIO_PDR, AT91_PA31_DTXD | AT91_PA30_DRXD);
47}
48
49/*
50 * Enable the Two-Wire interface.
51 */
52static inline void AT91_CfgPIO_TWI(void) {
53 at91_sys_write(AT91_PIOA + PIO_PDR, AT91_PA25_TWD | AT91_PA26_TWCK);
54 at91_sys_write(AT91_PIOA + PIO_ASR, AT91_PA25_TWD | AT91_PA26_TWCK);
55 at91_sys_write(AT91_PIOA + PIO_MDER, AT91_PA25_TWD | AT91_PA26_TWCK); /* open drain */
56}
57
58/*
59 * Enable the Serial Peripheral Interface.
60 */
61static inline void AT91_CfgPIO_SPI(void) {
62 at91_sys_write(AT91_PIOA + PIO_PDR, AT91_PA0_MISO | AT91_PA1_MOSI | AT91_PA2_SPCK);
63}
64
65static inline void AT91_CfgPIO_SPI_CS0(void) {
66 at91_sys_write(AT91_PIOA + PIO_PDR, AT91_PA3_NPCS0);
67}
68
69static inline void AT91_CfgPIO_SPI_CS1(void) {
70 at91_sys_write(AT91_PIOA + PIO_PDR, AT91_PA4_NPCS1);
71}
72
73static inline void AT91_CfgPIO_SPI_CS2(void) {
74 at91_sys_write(AT91_PIOA + PIO_PDR, AT91_PA5_NPCS2);
75}
76
77static inline void AT91_CfgPIO_SPI_CS3(void) {
78 at91_sys_write(AT91_PIOA + PIO_PDR, AT91_PA6_NPCS3);
79}
80
81/*
82 * Select the DataFlash card.
83 */
84static inline void AT91_CfgPIO_DataFlashCard(void) {
85 at91_sys_write(AT91_PIOB + PIO_PER, AT91_PIO_P(7));
86 at91_sys_write(AT91_PIOB + PIO_OER, AT91_PIO_P(7));
87 at91_sys_write(AT91_PIOB + PIO_CODR, AT91_PIO_P(7));
88}
89
90/*
91 * Enable NAND Flash (SmartMedia) interface.
92 */
93static inline void AT91_CfgPIO_SmartMedia(void) {
94 /* enable PC0=SMCE, PC1=SMOE, PC3=SMWE, A21=CLE, A22=ALE */
95 at91_sys_write(AT91_PIOC + PIO_ASR, AT91_PC0_BFCK | AT91_PC1_BFRDY_SMOE | AT91_PC3_BFBAA_SMWE);
96 at91_sys_write(AT91_PIOC + PIO_PDR, AT91_PC0_BFCK | AT91_PC1_BFRDY_SMOE | AT91_PC3_BFBAA_SMWE);
97
98 /* Configure PC2 as input (signal READY of the SmartMedia) */
99 at91_sys_write(AT91_PIOC + PIO_PER, AT91_PC2_BFAVD); /* enable direct output enable */
100 at91_sys_write(AT91_PIOC + PIO_ODR, AT91_PC2_BFAVD); /* disable output */
101
102 /* Configure PB1 as input (signal Card Detect of the SmartMedia) */
103 at91_sys_write(AT91_PIOB + PIO_PER, AT91_PIO_P(1)); /* enable direct output enable */
104 at91_sys_write(AT91_PIOB + PIO_ODR, AT91_PIO_P(1)); /* disable output */
105}
106
107static inline int AT91_PIO_SmartMedia_RDY(void) {
108 return (at91_sys_read(AT91_PIOC + PIO_PDSR) & AT91_PIO_P(2)) ? 1 : 0;
109}
110
111static inline int AT91_PIO_SmartMedia_CardDetect(void) {
112 return (at91_sys_read(AT91_PIOB + PIO_PDSR) & AT91_PIO_P(1)) ? 1 : 0;
113}
114
115#endif
diff --git a/include/asm-arm/arch-at91rm9200/system.h b/include/asm-arm/arch-at91rm9200/system.h
index 29c42655f05c..8a2ff472e4cf 100644
--- a/include/asm-arm/arch-at91rm9200/system.h
+++ b/include/asm-arm/arch-at91rm9200/system.h
@@ -21,7 +21,7 @@
21#ifndef __ASM_ARCH_SYSTEM_H 21#ifndef __ASM_ARCH_SYSTEM_H
22#define __ASM_ARCH_SYSTEM_H 22#define __ASM_ARCH_SYSTEM_H
23 23
24#include <asm/arch/hardware.h> 24#include <asm/hardware.h>
25 25
26static inline void arch_idle(void) 26static inline void arch_idle(void)
27{ 27{
@@ -48,4 +48,12 @@ static inline void arch_reset(char mode)
48 at91_sys_write(AT91_ST_CR, AT91_ST_WDRST); 48 at91_sys_write(AT91_ST_CR, AT91_ST_WDRST);
49} 49}
50 50
51#define ARCH_ID_AT91RM9200 0x09200080
52#define ARCH_ID_AT91SAM9261 0x019000a0
53
54static inline unsigned long arch_identify(void)
55{
56 return at91_sys_read(AT91_DBGU_CIDR) & (AT91_CIDR_EPROC | AT91_CIDR_ARCH);
57}
58
51#endif 59#endif
diff --git a/include/asm-arm/arch-at91rm9200/timex.h b/include/asm-arm/arch-at91rm9200/timex.h
index 3f112dd12587..88687cefe6eb 100644
--- a/include/asm-arm/arch-at91rm9200/timex.h
+++ b/include/asm-arm/arch-at91rm9200/timex.h
@@ -21,7 +21,7 @@
21#ifndef __ASM_ARCH_TIMEX_H 21#ifndef __ASM_ARCH_TIMEX_H
22#define __ASM_ARCH_TIMEX_H 22#define __ASM_ARCH_TIMEX_H
23 23
24#include <asm/arch/hardware.h> 24#include <asm/hardware.h>
25 25
26#define CLOCK_TICK_RATE (AT91_SLOW_CLOCK) 26#define CLOCK_TICK_RATE (AT91_SLOW_CLOCK)
27 27
diff --git a/include/asm-arm/arch-at91rm9200/uncompress.h b/include/asm-arm/arch-at91rm9200/uncompress.h
index 7b38497c24b5..ec7811ab0a52 100644
--- a/include/asm-arm/arch-at91rm9200/uncompress.h
+++ b/include/asm-arm/arch-at91rm9200/uncompress.h
@@ -21,7 +21,7 @@
21#ifndef __ASM_ARCH_UNCOMPRESS_H 21#ifndef __ASM_ARCH_UNCOMPRESS_H
22#define __ASM_ARCH_UNCOMPRESS_H 22#define __ASM_ARCH_UNCOMPRESS_H
23 23
24#include <asm/arch/hardware.h> 24#include <asm/hardware.h>
25 25
26/* 26/*
27 * The following code assumes the serial port has already been 27 * The following code assumes the serial port has already been
diff --git a/include/asm-arm/arch-at91rm9200/vmalloc.h b/include/asm-arm/arch-at91rm9200/vmalloc.h
index 34d9718feb90..4c367eb57f47 100644
--- a/include/asm-arm/arch-at91rm9200/vmalloc.h
+++ b/include/asm-arm/arch-at91rm9200/vmalloc.h
@@ -21,6 +21,6 @@
21#ifndef __ASM_ARCH_VMALLOC_H 21#ifndef __ASM_ARCH_VMALLOC_H
22#define __ASM_ARCH_VMALLOC_H 22#define __ASM_ARCH_VMALLOC_H
23 23
24#define VMALLOC_END (AT91_IO_VIRT_BASE & PGDIR_MASK) 24#define VMALLOC_END (AT91_SRAM_VIRT_BASE & PGDIR_MASK)
25 25
26#endif 26#endif
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-ixp23xx/entry-macro.S b/include/asm-arm/arch-ixp23xx/entry-macro.S
index 0ef4e6016ac4..867761677b57 100644
--- a/include/asm-arm/arch-ixp23xx/entry-macro.S
+++ b/include/asm-arm/arch-ixp23xx/entry-macro.S
@@ -8,7 +8,7 @@
8 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 8 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
9 ldr \irqnr, =(IXP23XX_INTC_VIRT + IXP23XX_INTR_IRQ_ENC_ST_OFFSET) 9 ldr \irqnr, =(IXP23XX_INTC_VIRT + IXP23XX_INTR_IRQ_ENC_ST_OFFSET)
10 ldr \irqnr, [\irqnr] @ get interrupt number 10 ldr \irqnr, [\irqnr] @ get interrupt number
11 cmp \irqnr, #0x0 @ suprious interrupt ? 11 cmp \irqnr, #0x0 @ spurious interrupt ?
12 movne \irqnr, \irqnr, lsr #2 @ skip unwanted low order bits 12 movne \irqnr, \irqnr, lsr #2 @ skip unwanted low order bits
13 subne \irqnr, \irqnr, #1 @ convert to 0 based 13 subne \irqnr, \irqnr, #1 @ convert to 0 based
14 14
diff --git a/include/asm-arm/arch-ixp23xx/ixp23xx.h b/include/asm-arm/arch-ixp23xx/ixp23xx.h
index e49e1ca61b1a..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
@@ -251,7 +252,7 @@
251 * CAP CSRs. 252 * CAP CSRs.
252 ****************************************************************************/ 253 ****************************************************************************/
253#define IXP23XX_GLOBAL_REG(x) ((volatile unsigned long *)(IXP23XX_CAP_CSR_VIRT + 0x4a00 + (x))) 254#define IXP23XX_GLOBAL_REG(x) ((volatile unsigned long *)(IXP23XX_CAP_CSR_VIRT + 0x4a00 + (x)))
254#define IXP23XX_PROD_IDG IXP23XX_GLOBAL_REG(0x00) 255#define IXP23XX_PRODUCT_ID IXP23XX_GLOBAL_REG(0x00)
255#define IXP23XX_MISC_CONTROL IXP23XX_GLOBAL_REG(0x04) 256#define IXP23XX_MISC_CONTROL IXP23XX_GLOBAL_REG(0x04)
256#define IXP23XX_MSF_CLK_CNTRL IXP23XX_GLOBAL_REG(0x08) 257#define IXP23XX_MSF_CLK_CNTRL IXP23XX_GLOBAL_REG(0x08)
257#define IXP23XX_RESET0 IXP23XX_GLOBAL_REG(0x0c) 258#define IXP23XX_RESET0 IXP23XX_GLOBAL_REG(0x0c)
@@ -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-netx/debug-macro.S b/include/asm-arm/arch-netx/debug-macro.S
new file mode 100644
index 000000000000..a940d0e80cb2
--- /dev/null
+++ b/include/asm-arm/arch-netx/debug-macro.S
@@ -0,0 +1,38 @@
1/* linux/include/asm-arm/arch-netx/debug-macro.S
2 *
3 * Debugging macro include header
4 *
5 * Copyright (C) 1994-1999 Russell King
6 * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12*/
13
14#include "hardware.h"
15
16 .macro addruart,rx
17 mrc p15, 0, \rx, c1, c0
18 tst \rx, #1 @ MMU enabled?
19 moveq \rx, #0x00100000 @ physical
20 movne \rx, #io_p2v(0x00100000) @ virtual
21 orr \rx, \rx, #0x00000a00
22 .endm
23
24 .macro senduart,rd,rx
25 str \rd, [\rx, #0]
26 .endm
27
28 .macro busyuart,rd,rx
291002: ldr \rd, [\rx, #0x18]
30 tst \rd, #(1 << 3)
31 bne 1002b
32 .endm
33
34 .macro waituart,rd,rx
351001: ldr \rd, [\rx, #0x18]
36 tst \rd, #(1 << 3)
37 bne 1001b
38 .endm
diff --git a/include/asm-arm/arch-netx/dma.h b/include/asm-arm/arch-netx/dma.h
new file mode 100644
index 000000000000..4eda5feed81c
--- /dev/null
+++ b/include/asm-arm/arch-netx/dma.h
@@ -0,0 +1,21 @@
1/*
2 * linux/include/asm-arm/arch-netx/dma.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#define MAX_DMA_CHANNELS 0
21#define MAX_DMA_ADDRESS ~0
diff --git a/include/asm-arm/arch-netx/entry-macro.S b/include/asm-arm/arch-netx/entry-macro.S
new file mode 100644
index 000000000000..658df4d60ff3
--- /dev/null
+++ b/include/asm-arm/arch-netx/entry-macro.S
@@ -0,0 +1,35 @@
1/*
2 * include/asm-arm/arch-netx/entry-macro.S
3 *
4 * Low-level IRQ helper macros for Hilscher netX based platforms
5 *
6 * Copyright (C) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2
10 * as published by the Free Software Foundation.
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 Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21#include <asm/hardware.h>
22
23 .macro disable_fiq
24 .endm
25
26 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
27 mov \base, #io_p2v(0x00100000)
28 add \base, \base, #0x000ff000
29
30 ldr \irqstat, [\base, #0]
31 clz \irqnr, \irqstat
32 rsb \irqnr, \irqnr, #31
33 cmp \irqstat, #0
34 .endm
35
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/hardware.h b/include/asm-arm/arch-netx/hardware.h
new file mode 100644
index 000000000000..7786c45455cd
--- /dev/null
+++ b/include/asm-arm/arch-netx/hardware.h
@@ -0,0 +1,39 @@
1/*
2 * include/asm-arm/arch-netx/hardware.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#ifndef __ASM_ARCH_HARDWARE_H
20#define __ASM_ARCH_HARDWARE_H
21
22#define NETX_IO_PHYS 0x00100000
23#define NETX_IO_VIRT 0xe0000000
24#define NETX_IO_SIZE 0x00100000
25
26#define SRAM_INTERNAL_PHYS_0 0x00000
27#define SRAM_INTERNAL_PHYS_1 0x08000
28#define SRAM_INTERNAL_PHYS_2 0x10000
29#define SRAM_INTERNAL_PHYS_3 0x18000
30#define SRAM_INTERNAL_PHYS(no) ((no) * 0x8000)
31
32#define XPEC_MEM_SIZE 0x4000
33#define XMAC_MEM_SIZE 0x1000
34#define SRAM_MEM_SIZE 0x8000
35
36#define io_p2v(x) ((x) - NETX_IO_PHYS + NETX_IO_VIRT)
37#define io_v2p(x) ((x) - NETX_IO_VIRT + NETX_IO_PHYS)
38
39#endif
diff --git a/include/asm-arm/arch-netx/io.h b/include/asm-arm/arch-netx/io.h
new file mode 100644
index 000000000000..81b7bc47747e
--- /dev/null
+++ b/include/asm-arm/arch-netx/io.h
@@ -0,0 +1,29 @@
1/*
2 * linux/include/asm-arm/arch-netx/io.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 __ASM_ARM_ARCH_IO_H
21#define __ASM_ARM_ARCH_IO_H
22
23#define IO_SPACE_LIMIT 0xffffffff
24
25#define __io(a) ((void __iomem *)(a))
26#define __mem_pci(a) (a)
27#define __mem_isa(a) (a)
28
29#endif
diff --git a/include/asm-arm/arch-netx/irqs.h b/include/asm-arm/arch-netx/irqs.h
new file mode 100644
index 000000000000..a487dc6e2661
--- /dev/null
+++ b/include/asm-arm/arch-netx/irqs.h
@@ -0,0 +1,70 @@
1/*
2 * include/asm-arm/arch-netx/irqs.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#define NETX_IRQ_VIC_START 0
21#define NETX_IRQ_SOFTINT 0
22#define NETX_IRQ_TIMER0 1
23#define NETX_IRQ_TIMER1 2
24#define NETX_IRQ_TIMER2 3
25#define NETX_IRQ_SYSTIME_NS 4
26#define NETX_IRQ_SYSTIME_S 5
27#define NETX_IRQ_GPIO_15 6
28#define NETX_IRQ_WATCHDOG 7
29#define NETX_IRQ_UART0 8
30#define NETX_IRQ_UART1 9
31#define NETX_IRQ_UART2 10
32#define NETX_IRQ_USB 11
33#define NETX_IRQ_SPI 12
34#define NETX_IRQ_I2C 13
35#define NETX_IRQ_LCD 14
36#define NETX_IRQ_HIF 15
37#define NETX_IRQ_GPIO_0_14 16
38#define NETX_IRQ_XPEC0 17
39#define NETX_IRQ_XPEC1 18
40#define NETX_IRQ_XPEC2 19
41#define NETX_IRQ_XPEC3 20
42#define NETX_IRQ_XPEC(no) (17 + (no))
43#define NETX_IRQ_MSYNC0 21
44#define NETX_IRQ_MSYNC1 22
45#define NETX_IRQ_MSYNC2 23
46#define NETX_IRQ_MSYNC3 24
47#define NETX_IRQ_IRQ_PHY 25
48#define NETX_IRQ_ISO_AREA 26
49/* int 27 is reserved */
50/* int 28 is reserved */
51#define NETX_IRQ_TIMER3 29
52#define NETX_IRQ_TIMER4 30
53/* int 31 is reserved */
54
55#define NETX_IRQS 32
56
57/* for multiplexed irqs on gpio 0..14 */
58#define NETX_IRQ_GPIO(x) (NETX_IRQS + (x))
59#define NETX_IRQ_GPIO_LAST NETX_IRQ_GPIO(14)
60
61/* Host interface interrupts */
62#define NETX_IRQ_HIF_CHAINED(x) (NETX_IRQ_GPIO_LAST + 1 + (x))
63#define NETX_IRQ_HIF_PIO35 NETX_IRQ_HIF_CHAINED(0)
64#define NETX_IRQ_HIF_PIO36 NETX_IRQ_HIF_CHAINED(1)
65#define NETX_IRQ_HIF_PIO40 NETX_IRQ_HIF_CHAINED(2)
66#define NETX_IRQ_HIF_PIO47 NETX_IRQ_HIF_CHAINED(3)
67#define NETX_IRQ_HIF_PIO72 NETX_IRQ_HIF_CHAINED(4)
68#define NETX_IRQ_HIF_LAST NETX_IRQ_HIF_CHAINED(4)
69
70#define NR_IRQS (NETX_IRQ_HIF_LAST + 1)
diff --git a/include/asm-arm/arch-netx/memory.h b/include/asm-arm/arch-netx/memory.h
new file mode 100644
index 000000000000..6d8d2df3e99d
--- /dev/null
+++ b/include/asm-arm/arch-netx/memory.h
@@ -0,0 +1,36 @@
1/*
2 * linux/include/asm-arm/arch-netx/memory.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 __ASM_ARCH_MEMORY_H
21#define __ASM_ARCH_MEMORY_H
22
23#define PHYS_OFFSET UL(0x80000000)
24
25/*
26 * Virtual view <-> DMA view memory address translations
27 * virt_to_bus: Used to translate the virtual address to an
28 * address suitable to be passed to set_dma_addr
29 * bus_to_virt: Used to convert an address for DMA operations
30 * to an address that the kernel can use.
31 */
32#define __virt_to_bus(x) __virt_to_phys(x)
33#define __bus_to_virt(x) __phys_to_virt(x)
34
35#endif
36
diff --git a/include/asm-arm/arch-netx/netx-regs.h b/include/asm-arm/arch-netx/netx-regs.h
new file mode 100644
index 000000000000..8ab45bea83ca
--- /dev/null
+++ b/include/asm-arm/arch-netx/netx-regs.h
@@ -0,0 +1,410 @@
1/*
2 * include/asm-arm/arch-netx/netx-regs.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 __ASM_ARCH_NETX_REGS_H
21#define __ASM_ARCH_NETX_REGS_H
22
23/* offsets relative to the beginning of the io space */
24#define NETX_OFS_SYSTEM 0x00000
25#define NETX_OFS_MEMCR 0x00100
26#define NETX_OFS_DPMAS 0x03000
27#define NETX_OFS_GPIO 0x00800
28#define NETX_OFS_PIO 0x00900
29#define NETX_OFS_UART0 0x00a00
30#define NETX_OFS_UART1 0x00a40
31#define NETX_OFS_UART2 0x00a80
32#define NETX_OF_MIIMU 0x00b00
33#define NETX_OFS_SPI 0x00c00
34#define NETX_OFS_I2C 0x00d00
35#define NETX_OFS_SYSTIME 0x01100
36#define NETX_OFS_RTC 0x01200
37#define NETX_OFS_EXTBUS 0x03600
38#define NETX_OFS_LCD 0x04000
39#define NETX_OFS_USB 0x20000
40#define NETX_OFS_XMAC0 0x60000
41#define NETX_OFS_XMAC1 0x61000
42#define NETX_OFS_XMAC2 0x62000
43#define NETX_OFS_XMAC3 0x63000
44#define NETX_OFS_XMAC(no) (0x60000 + (no) * 0x1000)
45#define NETX_OFS_PFIFO 0x64000
46#define NETX_OFS_XPEC0 0x70000
47#define NETX_OFS_XPEC1 0x74000
48#define NETX_OFS_XPEC2 0x78000
49#define NETX_OFS_XPEC3 0x7c000
50#define NETX_OFS_XPEC(no) (0x70000 + (no) * 0x4000)
51#define NETX_OFS_VIC 0xff000
52
53/* physical addresses */
54#define NETX_PA_SYSTEM (NETX_IO_PHYS + NETX_OFS_SYSTEM)
55#define NETX_PA_MEMCR (NETX_IO_PHYS + NETX_OFS_MEMCR)
56#define NETX_PA_DPMAS (NETX_IO_PHYS + NETX_OFS_DPMAS)
57#define NETX_PA_GPIO (NETX_IO_PHYS + NETX_OFS_GPIO)
58#define NETX_PA_PIO (NETX_IO_PHYS + NETX_OFS_PIO)
59#define NETX_PA_UART0 (NETX_IO_PHYS + NETX_OFS_UART0)
60#define NETX_PA_UART1 (NETX_IO_PHYS + NETX_OFS_UART1)
61#define NETX_PA_UART2 (NETX_IO_PHYS + NETX_OFS_UART2)
62#define NETX_PA_MIIMU (NETX_IO_PHYS + NETX_OF_MIIMU)
63#define NETX_PA_SPI (NETX_IO_PHYS + NETX_OFS_SPI)
64#define NETX_PA_I2C (NETX_IO_PHYS + NETX_OFS_I2C)
65#define NETX_PA_SYSTIME (NETX_IO_PHYS + NETX_OFS_SYSTIME)
66#define NETX_PA_RTC (NETX_IO_PHYS + NETX_OFS_RTC)
67#define NETX_PA_EXTBUS (NETX_IO_PHYS + NETX_OFS_EXTBUS)
68#define NETX_PA_LCD (NETX_IO_PHYS + NETX_OFS_LCD)
69#define NETX_PA_USB (NETX_IO_PHYS + NETX_OFS_USB)
70#define NETX_PA_XMAC0 (NETX_IO_PHYS + NETX_OFS_XMAC0)
71#define NETX_PA_XMAC1 (NETX_IO_PHYS + NETX_OFS_XMAC1)
72#define NETX_PA_XMAC2 (NETX_IO_PHYS + NETX_OFS_XMAC2)
73#define NETX_PA_XMAC3 (NETX_IO_PHYS + NETX_OFS_XMAC3)
74#define NETX_PA_XMAC(no) (NETX_IO_PHYS + NETX_OFS_XMAC(no))
75#define NETX_PA_PFIFO (NETX_IO_PHYS + NETX_OFS_PFIFO)
76#define NETX_PA_XPEC0 (NETX_IO_PHYS + NETX_OFS_XPEC0)
77#define NETX_PA_XPEC1 (NETX_IO_PHYS + NETX_OFS_XPEC1)
78#define NETX_PA_XPEC2 (NETX_IO_PHYS + NETX_OFS_XPEC2)
79#define NETX_PA_XPEC3 (NETX_IO_PHYS + NETX_OFS_XPEC3)
80#define NETX_PA_XPEC(no) (NETX_IO_PHYS + NETX_OFS_XPEC(no))
81#define NETX_PA_VIC (NETX_IO_PHYS + NETX_OFS_VIC)
82
83/* virual addresses */
84#define NETX_VA_SYSTEM (NETX_IO_VIRT + NETX_OFS_SYSTEM)
85#define NETX_VA_MEMCR (NETX_IO_VIRT + NETX_OFS_MEMCR)
86#define NETX_VA_DPMAS (NETX_IO_VIRT + NETX_OFS_DPMAS)
87#define NETX_VA_GPIO (NETX_IO_VIRT + NETX_OFS_GPIO)
88#define NETX_VA_PIO (NETX_IO_VIRT + NETX_OFS_PIO)
89#define NETX_VA_UART0 (NETX_IO_VIRT + NETX_OFS_UART0)
90#define NETX_VA_UART1 (NETX_IO_VIRT + NETX_OFS_UART1)
91#define NETX_VA_UART2 (NETX_IO_VIRT + NETX_OFS_UART2)
92#define NETX_VA_MIIMU (NETX_IO_VIRT + NETX_OF_MIIMU)
93#define NETX_VA_SPI (NETX_IO_VIRT + NETX_OFS_SPI)
94#define NETX_VA_I2C (NETX_IO_VIRT + NETX_OFS_I2C)
95#define NETX_VA_SYSTIME (NETX_IO_VIRT + NETX_OFS_SYSTIME)
96#define NETX_VA_RTC (NETX_IO_VIRT + NETX_OFS_RTC)
97#define NETX_VA_EXTBUS (NETX_IO_VIRT + NETX_OFS_EXTBUS)
98#define NETX_VA_LCD (NETX_IO_VIRT + NETX_OFS_LCD)
99#define NETX_VA_USB (NETX_IO_VIRT + NETX_OFS_USB)
100#define NETX_VA_XMAC0 (NETX_IO_VIRT + NETX_OFS_XMAC0)
101#define NETX_VA_XMAC1 (NETX_IO_VIRT + NETX_OFS_XMAC1)
102#define NETX_VA_XMAC2 (NETX_IO_VIRT + NETX_OFS_XMAC2)
103#define NETX_VA_XMAC3 (NETX_IO_VIRT + NETX_OFS_XMAC3)
104#define NETX_VA_XMAC(no) (NETX_IO_VIRT + NETX_OFS_XMAC(no))
105#define NETX_VA_PFIFO (NETX_IO_VIRT + NETX_OFS_PFIFO)
106#define NETX_VA_XPEC0 (NETX_IO_VIRT + NETX_OFS_XPEC0)
107#define NETX_VA_XPEC1 (NETX_IO_VIRT + NETX_OFS_XPEC1)
108#define NETX_VA_XPEC2 (NETX_IO_VIRT + NETX_OFS_XPEC2)
109#define NETX_VA_XPEC3 (NETX_IO_VIRT + NETX_OFS_XPEC3)
110#define NETX_VA_XPEC(no) (NETX_IO_VIRT + NETX_OFS_XPEC(no))
111#define NETX_VA_VIC (NETX_IO_VIRT + NETX_OFS_VIC)
112
113/*********************************
114 * System functions *
115 *********************************/
116
117/* Registers */
118#define NETX_SYSTEM_REG(ofs) __io(NETX_VA_SYSTEM + (ofs))
119#define NETX_SYSTEM_BOO_SR NETX_SYSTEM_REG(0x00)
120#define NETX_SYSTEM_IOC_CR NETX_SYSTEM_REG(0x04)
121#define NETX_SYSTEM_IOC_MR NETX_SYSTEM_REG(0x08)
122
123/* FIXME: Docs are not consistent */
124#define NETX_SYSTEM_RES_CR NETX_SYSTEM_REG(0x08)
125/* #define NETX_SYSTEM_RES_CR NETX_SYSTEM_REG(0x0c) */
126
127#define NETX_SYSTEM_PHY_CONTROL NETX_SYSTEM_REG(0x10)
128#define NETX_SYSTEM_REV NETX_SYSTEM_REG(0x34)
129#define NETX_SYSTEM_IOC_ACCESS_KEY NETX_SYSTEM_REG(0x70)
130#define NETX_SYSTEM_WDG_TR NETX_SYSTEM_REG(0x200)
131#define NETX_SYSTEM_WDG_CTR NETX_SYSTEM_REG(0x204)
132#define NETX_SYSTEM_WDG_IRQ_TIMEOUT NETX_SYSTEM_REG(0x208)
133#define NETX_SYSTEM_WDG_RES_TIMEOUT NETX_SYSTEM_REG(0x20c)
134
135/* Bits */
136#define NETX_SYSTEM_RES_CR_RSTIN (1<<0)
137#define NETX_SYSTEM_RES_CR_WDG_RES (1<<1)
138#define NETX_SYSTEM_RES_CR_HOST_RES (1<<2)
139#define NETX_SYSTEM_RES_CR_FIRMW_RES (1<<3)
140#define NETX_SYSTEM_RES_CR_XPEC0_RES (1<<4)
141#define NETX_SYSTEM_RES_CR_XPEC1_RES (1<<5)
142#define NETX_SYSTEM_RES_CR_XPEC2_RES (1<<6)
143#define NETX_SYSTEM_RES_CR_XPEC3_RES (1<<7)
144#define NETX_SYSTEM_RES_CR_DIS_XPEC0_RES (1<<16)
145#define NETX_SYSTEM_RES_CR_DIS_XPEC1_RES (1<<17)
146#define NETX_SYSTEM_RES_CR_DIS_XPEC2_RES (1<<18)
147#define NETX_SYSTEM_RES_CR_DIS_XPEC3_RES (1<<19)
148#define NETX_SYSTEM_RES_CR_FIRMW_FLG0 (1<<20)
149#define NETX_SYSTEM_RES_CR_FIRMW_FLG1 (1<<21)
150#define NETX_SYSTEM_RES_CR_FIRMW_FLG2 (1<<22)
151#define NETX_SYSTEM_RES_CR_FIRMW_FLG3 (1<<23)
152#define NETX_SYSTEM_RES_CR_FIRMW_RES_EN (1<<24)
153#define NETX_SYSTEM_RES_CR_RSTOUT (1<<25)
154#define NETX_SYSTEM_RES_CR_EN_RSTOUT (1<<26)
155
156#define PHY_CONTROL_RESET (1<<31)
157#define PHY_CONTROL_SIM_BYP (1<<30)
158#define PHY_CONTROL_CLK_XLATIN (1<<29)
159#define PHY_CONTROL_PHY1_EN (1<<21)
160#define PHY_CONTROL_PHY1_NP_MSG_CODE
161#define PHY_CONTROL_PHY1_AUTOMDIX (1<<17)
162#define PHY_CONTROL_PHY1_FIXMODE (1<<16)
163#define PHY_CONTROL_PHY1_MODE(mode) (((mode) & 0x7) << 13)
164#define PHY_CONTROL_PHY0_EN (1<<12)
165#define PHY_CONTROL_PHY0_NP_MSG_CODE
166#define PHY_CONTROL_PHY0_AUTOMDIX (1<<8)
167#define PHY_CONTROL_PHY0_FIXMODE (1<<7)
168#define PHY_CONTROL_PHY0_MODE(mode) (((mode) & 0x7) << 4)
169#define PHY_CONTROL_PHY_ADDRESS(adr) ((adr) & 0xf)
170
171#define PHY_MODE_10BASE_T_HALF 0
172#define PHY_MODE_10BASE_T_FULL 1
173#define PHY_MODE_100BASE_TX_FX_FULL 2
174#define PHY_MODE_100BASE_TX_FX_HALF 3
175#define PHY_MODE_100BASE_TX_HALF 4
176#define PHY_MODE_REPEATER 5
177#define PHY_MODE_POWER_DOWN 6
178#define PHY_MODE_ALL 7
179
180/* Bits */
181#define VECT_CNTL_ENABLE (1 << 5)
182
183/*******************************
184 * GPIO and timer module *
185 *******************************/
186
187/* Registers */
188#define NETX_GPIO_REG(ofs) __io(NETX_VA_GPIO + (ofs))
189#define NETX_GPIO_CFG(gpio) NETX_GPIO_REG(0x0 + ((gpio)<<2))
190#define NETX_GPIO_THRESHOLD_CAPTURE(gpio) NETX_GPIO_REG(0x40 + ((gpio)<<2))
191#define NETX_GPIO_COUNTER_CTRL(counter) NETX_GPIO_REG(0x80 + ((counter)<<2))
192#define NETX_GPIO_COUNTER_MAX(counter) NETX_GPIO_REG(0x94 + ((counter)<<2))
193#define NETX_GPIO_COUNTER_CURRENT(counter) NETX_GPIO_REG(0xa8 + ((counter)<<2))
194#define NETX_GPIO_IRQ_ENABLE NETX_GPIO_REG(0xbc)
195#define NETX_GPIO_IRQ_DISABLE NETX_GPIO_REG(0xc0)
196#define NETX_GPIO_SYSTIME_NS_CMP NETX_GPIO_REG(0xc4)
197#define NETX_GPIO_LINE NETX_GPIO_REG(0xc8)
198#define NETX_GPIO_IRQ NETX_GPIO_REG(0xd0)
199
200/* Bits */
201#define NETX_GPIO_CFG_IOCFG_GP_INPUT (0x0)
202#define NETX_GPIO_CFG_IOCFG_GP_OUTPUT (0x1)
203#define NETX_GPIO_CFG_IOCFG_GP_UART (0x2)
204#define NETX_GPIO_CFG_INV (1<<2)
205#define NETX_GPIO_CFG_MODE_INPUT_READ (0<<3)
206#define NETX_GPIO_CFG_MODE_INPUT_CAPTURE_CONT_RISING (1<<3)
207#define NETX_GPIO_CFG_MODE_INPUT_CAPTURE_ONCE_RISING (2<<3)
208#define NETX_GPIO_CFG_MODE_INPUT_CAPTURE_HIGH_LEVEL (3<<3)
209#define NETX_GPIO_CFG_COUNT_REF_COUNTER0 (0<<5)
210#define NETX_GPIO_CFG_COUNT_REF_COUNTER1 (1<<5)
211#define NETX_GPIO_CFG_COUNT_REF_COUNTER2 (2<<5)
212#define NETX_GPIO_CFG_COUNT_REF_COUNTER3 (3<<5)
213#define NETX_GPIO_CFG_COUNT_REF_COUNTER4 (4<<5)
214#define NETX_GPIO_CFG_COUNT_REF_SYSTIME (7<<5)
215
216#define NETX_GPIO_COUNTER_CTRL_RUN (1<<0)
217#define NETX_GPIO_COUNTER_CTRL_SYM (1<<1)
218#define NETX_GPIO_COUNTER_CTRL_ONCE (1<<2)
219#define NETX_GPIO_COUNTER_CTRL_IRQ_EN (1<<3)
220#define NETX_GPIO_COUNTER_CTRL_CNT_EVENT (1<<4)
221#define NETX_GPIO_COUNTER_CTRL_RST_EN (1<<5)
222#define NETX_GPIO_COUNTER_CTRL_SEL_EVENT (1<<6)
223#define NETX_GPIO_COUNTER_CTRL_GPIO_REF /* FIXME */
224
225#define GPIO_BIT(gpio) (1<<(gpio))
226#define COUNTER_BIT(counter) ((1<<16)<<(counter))
227
228/*******************************
229 * PIO *
230 *******************************/
231
232/* Registers */
233#define NETX_PIO_REG(ofs) __io(NETX_VA_PIO + (ofs))
234#define NETX_PIO_INPIO NETX_PIO_REG(0x0)
235#define NETX_PIO_OUTPIO NETX_PIO_REG(0x4)
236#define NETX_PIO_OEPIO NETX_PIO_REG(0x8)
237
238/*******************************
239 * MII Unit *
240 *******************************/
241
242/* Registers */
243#define NETX_MIIMU __io(NETX_VA_MIIMU)
244
245/* Bits */
246#define MIIMU_SNRDY (1<<0)
247#define MIIMU_PREAMBLE (1<<1)
248#define MIIMU_OPMODE_WRITE (1<<2)
249#define MIIMU_MDC_PERIOD (1<<3)
250#define MIIMU_PHY_NRES (1<<4)
251#define MIIMU_RTA (1<<5)
252#define MIIMU_REGADDR(adr) (((adr) & 0x1f) << 6)
253#define MIIMU_PHYADDR(adr) (((adr) & 0x1f) << 11)
254#define MIIMU_DATA(data) (((data) & 0xffff) << 16)
255
256/*******************************
257 * xmac / xpec *
258 *******************************/
259
260/* XPEC register offsets relative to NETX_VA_XPEC(no) */
261#define NETX_XPEC_R0_OFS 0x00
262#define NETX_XPEC_R1_OFS 0x04
263#define NETX_XPEC_R2_OFS 0x08
264#define NETX_XPEC_R3_OFS 0x0c
265#define NETX_XPEC_R4_OFS 0x10
266#define NETX_XPEC_R5_OFS 0x14
267#define NETX_XPEC_R6_OFS 0x18
268#define NETX_XPEC_R7_OFS 0x1c
269#define NETX_XPEC_RANGE01_OFS 0x20
270#define NETX_XPEC_RANGE23_OFS 0x24
271#define NETX_XPEC_RANGE45_OFS 0x28
272#define NETX_XPEC_RANGE67_OFS 0x2c
273#define NETX_XPEC_PC_OFS 0x48
274#define NETX_XPEC_TIMER_OFS(timer) (0x30 + ((timer)<<2))
275#define NETX_XPEC_IRQ_OFS 0x8c
276#define NETX_XPEC_SYSTIME_NS_OFS 0x90
277#define NETX_XPEC_FIFO_DATA_OFS 0x94
278#define NETX_XPEC_SYSTIME_S_OFS 0x98
279#define NETX_XPEC_ADC_OFS 0x9c
280#define NETX_XPEC_URX_COUNT_OFS 0x40
281#define NETX_XPEC_UTX_COUNT_OFS 0x44
282#define NETX_XPEC_PC_OFS 0x48
283#define NETX_XPEC_ZERO_OFS 0x4c
284#define NETX_XPEC_STATCFG_OFS 0x50
285#define NETX_XPEC_EC_MASKA_OFS 0x54
286#define NETX_XPEC_EC_MASKB_OFS 0x58
287#define NETX_XPEC_EC_MASK0_OFS 0x5c
288#define NETX_XPEC_EC_MASK8_OFS 0x7c
289#define NETX_XPEC_EC_MASK9_OFS 0x80
290#define NETX_XPEC_XPU_HOLD_PC_OFS 0x100
291#define NETX_XPEC_RAM_START_OFS 0x2000
292
293/* Bits */
294#define XPU_HOLD_PC (1<<0)
295
296/* XMAC register offsets relative to NETX_VA_XMAC(no) */
297#define NETX_XMAC_RPU_PROGRAM_START_OFS 0x000
298#define NETX_XMAC_RPU_PROGRAM_END_OFS 0x3ff
299#define NETX_XMAC_TPU_PROGRAM_START_OFS 0x400
300#define NETX_XMAC_TPU_PROGRAM_END_OFS 0x7ff
301#define NETX_XMAC_RPU_HOLD_PC_OFS 0xa00
302#define NETX_XMAC_TPU_HOLD_PC_OFS 0xa04
303#define NETX_XMAC_STATUS_SHARED0_OFS 0x840
304#define NETX_XMAC_CONFIG_SHARED0_OFS 0x844
305#define NETX_XMAC_STATUS_SHARED1_OFS 0x848
306#define NETX_XMAC_CONFIG_SHARED1_OFS 0x84c
307#define NETX_XMAC_STATUS_SHARED2_OFS 0x850
308#define NETX_XMAC_CONFIG_SHARED2_OFS 0x854
309#define NETX_XMAC_STATUS_SHARED3_OFS 0x858
310#define NETX_XMAC_CONFIG_SHARED3_OFS 0x85c
311
312#define RPU_HOLD_PC (1<<15)
313#define TPU_HOLD_PC (1<<15)
314
315/*******************************
316 * Pointer FIFO *
317 *******************************/
318
319/* Registers */
320#define NETX_PFIFO_REG(ofs) __io(NETX_VA_PFIFO + (ofs))
321#define NETX_PFIFO_BASE(pfifo) NETX_PFIFO_REG(0x00 + ((pfifo)<<2))
322#define NETX_PFIFO_BORDER_BASE(pfifo) NETX_PFIFO_REG(0x80 + ((pfifo)<<2))
323#define NETX_PFIFO_RESET NETX_PFIFO_REG(0x100)
324#define NETX_PFIFO_FULL NETX_PFIFO_REG(0x104)
325#define NETX_PFIFO_EMPTY NETX_PFIFO_REG(0x108)
326#define NETX_PFIFO_OVEFLOW NETX_PFIFO_REG(0x10c)
327#define NETX_PFIFO_UNDERRUN NETX_PFIFO_REG(0x110)
328#define NETX_PFIFO_FILL_LEVEL(pfifo) NETX_PFIFO_REG(0x180 + ((pfifo)<<2))
329#define NETX_PFIFO_XPEC_ISR(xpec) NETX_PFIFO_REG(0x400 + ((xpec) << 2))
330
331/*******************************
332 * Dual Port Memory *
333 *******************************/
334
335/* Registers */
336#define NETX_DPMAS_REG(ofs) __io(NETX_VA_DPMAS + (ofs))
337#define NETX_DPMAS_SYS_STAT NETX_DPMAS_REG(0x4d8)
338#define NETX_DPMAS_INT_STAT NETX_DPMAS_REG(0x4e0)
339#define NETX_DPMAS_INT_EN NETX_DPMAS_REG(0x4f0)
340#define NETX_DPMAS_IF_CONF0 NETX_DPMAS_REG(0x608)
341#define NETX_DPMAS_IF_CONF1 NETX_DPMAS_REG(0x60c)
342#define NETX_DPMAS_EXT_CONFIG(cs) NETX_DPMAS_REG(0x610 + 4 * (cs))
343#define NETX_DPMAS_IO_MODE0 NETX_DPMAS_REG(0x620) /* I/O 32..63 */
344#define NETX_DPMAS_DRV_EN0 NETX_DPMAS_REG(0x624)
345#define NETX_DPMAS_DATA0 NETX_DPMAS_REG(0x628)
346#define NETX_DPMAS_IO_MODE1 NETX_DPMAS_REG(0x630) /* I/O 64..84 */
347#define NETX_DPMAS_DRV_EN1 NETX_DPMAS_REG(0x634)
348#define NETX_DPMAS_DATA1 NETX_DPMAS_REG(0x638)
349
350/* Bits */
351#define NETX_DPMAS_INT_EN_GLB_EN (1<<31)
352#define NETX_DPMAS_INT_EN_MEM_LCK (1<<30)
353#define NETX_DPMAS_INT_EN_WDG (1<<29)
354#define NETX_DPMAS_INT_EN_PIO72 (1<<28)
355#define NETX_DPMAS_INT_EN_PIO47 (1<<27)
356#define NETX_DPMAS_INT_EN_PIO40 (1<<26)
357#define NETX_DPMAS_INT_EN_PIO36 (1<<25)
358#define NETX_DPMAS_INT_EN_PIO35 (1<<24)
359
360#define NETX_DPMAS_IF_CONF0_HIF_DISABLED (0<<28)
361#define NETX_DPMAS_IF_CONF0_HIF_EXT_BUS (1<<28)
362#define NETX_DPMAS_IF_CONF0_HIF_UP_8BIT (2<<28)
363#define NETX_DPMAS_IF_CONF0_HIF_UP_16BIT (3<<28)
364#define NETX_DPMAS_IF_CONF0_HIF_IO (4<<28)
365#define NETX_DPMAS_IF_CONF0_WAIT_DRV_PP (1<<14)
366#define NETX_DPMAS_IF_CONF0_WAIT_DRV_OD (2<<14)
367#define NETX_DPMAS_IF_CONF0_WAIT_DRV_TRI (3<<14)
368
369#define NETX_DPMAS_IF_CONF1_IRQ_POL_PIO35 (1<<26)
370#define NETX_DPMAS_IF_CONF1_IRQ_POL_PIO36 (1<<27)
371#define NETX_DPMAS_IF_CONF1_IRQ_POL_PIO40 (1<<28)
372#define NETX_DPMAS_IF_CONF1_IRQ_POL_PIO47 (1<<29)
373#define NETX_DPMAS_IF_CONF1_IRQ_POL_PIO72 (1<<30)
374
375#define NETX_EXT_CONFIG_TALEWIDTH(x) (((x) & 0x7) << 29)
376#define NETX_EXT_CONFIG_TADRHOLD(x) (((x) & 0x7) << 26)
377#define NETX_EXT_CONFIG_TCSON(x) (((x) & 0x7) << 23)
378#define NETX_EXT_CONFIG_TRDON(x) (((x) & 0x7) << 20)
379#define NETX_EXT_CONFIG_TWRON(x) (((x) & 0x7) << 17)
380#define NETX_EXT_CONFIG_TWROFF(x) (((x) & 0x1f) << 12)
381#define NETX_EXT_CONFIG_TRDWRCYC(x) (((x) & 0x1f) << 7)
382#define NETX_EXT_CONFIG_WAIT_POL (1<<6)
383#define NETX_EXT_CONFIG_WAIT_EN (1<<5)
384#define NETX_EXT_CONFIG_NRD_MODE (1<<4)
385#define NETX_EXT_CONFIG_DS_MODE (1<<3)
386#define NETX_EXT_CONFIG_NWR_MODE (1<<2)
387#define NETX_EXT_CONFIG_16BIT (1<<1)
388#define NETX_EXT_CONFIG_CS_ENABLE (1<<0)
389
390#define NETX_DPMAS_IO_MODE0_WRL (1<<13)
391#define NETX_DPMAS_IO_MODE0_WAIT (1<<14)
392#define NETX_DPMAS_IO_MODE0_READY (1<<15)
393#define NETX_DPMAS_IO_MODE0_CS0 (1<<19)
394#define NETX_DPMAS_IO_MODE0_EXTRD (1<<20)
395
396#define NETX_DPMAS_IO_MODE1_CS2 (1<<15)
397#define NETX_DPMAS_IO_MODE1_CS1 (1<<16)
398#define NETX_DPMAS_IO_MODE1_SAMPLE_NPOR (0<<30)
399#define NETX_DPMAS_IO_MODE1_SAMPLE_100MHZ (1<<30)
400#define NETX_DPMAS_IO_MODE1_SAMPLE_NPIO36 (2<<30)
401#define NETX_DPMAS_IO_MODE1_SAMPLE_PIO36 (3<<30)
402
403/*******************************
404 * I2C *
405 *******************************/
406#define NETX_I2C_REG(ofs) __io(NETX_VA_I2C, (ofs))
407#define NETX_I2C_CTRL NETX_I2C_REG(0x0)
408#define NETX_I2C_DATA NETX_I2C_REG(0x4)
409
410#endif /* __ASM_ARCH_NETX_REGS_H */
diff --git a/include/asm-arm/arch-netx/param.h b/include/asm-arm/arch-netx/param.h
new file mode 100644
index 000000000000..7a80c26178a8
--- /dev/null
+++ b/include/asm-arm/arch-netx/param.h
@@ -0,0 +1,18 @@
1/*
2 * linux/include/asm-arm/arch-netx/param.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 */
diff --git a/include/asm-arm/arch-netx/pfifo.h b/include/asm-arm/arch-netx/pfifo.h
new file mode 100644
index 000000000000..4af2ee4a32c1
--- /dev/null
+++ b/include/asm-arm/arch-netx/pfifo.h
@@ -0,0 +1,54 @@
1/*
2 * include/asm-arm/arch-netx/pfifo.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
21#ifndef ASM_ARCH_PFIFO_H
22#define ASM_ARCH_PFIFO_H
23
24static inline int pfifo_push(int no, unsigned int pointer)
25{
26 writel(pointer, NETX_PFIFO_BASE(no));
27 return 0;
28}
29
30static inline unsigned int pfifo_pop(int no)
31{
32 return readl(NETX_PFIFO_BASE(no));
33}
34
35static inline int pfifo_fill_level(int no)
36{
37
38 return readl(NETX_PFIFO_FILL_LEVEL(no));
39}
40
41static inline int pfifo_full(int no)
42{
43 return readl(NETX_PFIFO_FULL) & (1<<no) ? 1 : 0;
44}
45
46static inline int pfifo_empty(int no)
47{
48 return readl(NETX_PFIFO_EMPTY) & (1<<no) ? 1 : 0;
49}
50
51int pfifo_request(unsigned int pfifo_mask);
52void pfifo_free(unsigned int pfifo_mask);
53
54#endif /* ASM_ARCH_PFIFO_H */
diff --git a/include/asm-arm/arch-netx/system.h b/include/asm-arm/arch-netx/system.h
new file mode 100644
index 000000000000..52adf368d765
--- /dev/null
+++ b/include/asm-arm/arch-netx/system.h
@@ -0,0 +1,38 @@
1/*
2 * include/asm-arm/arch-netx/system.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#ifndef __ASM_ARCH_SYSTEM_H
20#define __ASM_ARCH_SYSTEM_H
21
22#include <asm/io.h>
23#include <asm/hardware.h>
24#include "netx-regs.h"
25
26static inline void arch_idle(void)
27{
28 cpu_do_idle();
29}
30
31static inline void arch_reset(char mode)
32{
33 writel(NETX_SYSTEM_RES_CR_FIRMW_RES_EN | NETX_SYSTEM_RES_CR_FIRMW_RES,
34 NETX_SYSTEM_RES_CR);
35}
36
37#endif
38
diff --git a/include/asm-arm/arch-netx/timex.h b/include/asm-arm/arch-netx/timex.h
new file mode 100644
index 000000000000..7fdb42da0b40
--- /dev/null
+++ b/include/asm-arm/arch-netx/timex.h
@@ -0,0 +1,20 @@
1/*
2 * include/asm-arm/arch-netx/timex.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#define CLOCK_TICK_RATE 100000000
diff --git a/include/asm-arm/arch-netx/uncompress.h b/include/asm-arm/arch-netx/uncompress.h
new file mode 100644
index 000000000000..f89434547102
--- /dev/null
+++ b/include/asm-arm/arch-netx/uncompress.h
@@ -0,0 +1,76 @@
1/*
2 * include/asm-arm/arch-netx/uncompress.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/*
21 * The following code assumes the serial port has already been
22 * initialized by the bootloader. We search for the first enabled
23 * port in the most probable order. If you didn't setup a port in
24 * your bootloader then nothing will appear (which might be desired).
25 *
26 * This does not append a newline
27 */
28
29#define REG(x) (*(volatile unsigned long *)(x))
30
31#define UART1_BASE 0x100a00
32#define UART2_BASE 0x100a80
33
34#define UART_DR 0x0
35
36#define UART_CR 0x14
37#define CR_UART_EN (1<<0)
38
39#define UART_FR 0x18
40#define FR_BUSY (1<<3)
41#define FR_TXFF (1<<5)
42
43static void putc(char c)
44{
45 unsigned long base;
46
47 if (REG(UART1_BASE + UART_CR) & CR_UART_EN)
48 base = UART1_BASE;
49 else if (REG(UART2_BASE + UART_CR) & CR_UART_EN)
50 base = UART2_BASE;
51 else
52 return;
53
54 while (REG(base + UART_FR) & FR_TXFF);
55 REG(base + UART_DR) = c;
56}
57
58static inline void flush(void)
59{
60 unsigned long base;
61
62 if (REG(UART1_BASE + UART_CR) & CR_UART_EN)
63 base = UART1_BASE;
64 else if (REG(UART2_BASE + UART_CR) & CR_UART_EN)
65 base = UART2_BASE;
66 else
67 return;
68
69 while (REG(base + UART_FR) & FR_BUSY);
70}
71
72/*
73 * nothing to do
74 */
75#define arch_decomp_setup()
76#define arch_decomp_wdog()
diff --git a/include/asm-arm/arch-netx/vmalloc.h b/include/asm-arm/arch-netx/vmalloc.h
new file mode 100644
index 000000000000..da2da5a595da
--- /dev/null
+++ b/include/asm-arm/arch-netx/vmalloc.h
@@ -0,0 +1,19 @@
1/*
2 * linux/include/asm-arm/arch-netx/vmalloc.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#define VMALLOC_END (PAGE_OFFSET + 0x10000000)
diff --git a/include/asm-arm/arch-netx/xc.h b/include/asm-arm/arch-netx/xc.h
new file mode 100644
index 000000000000..659af19512a9
--- /dev/null
+++ b/include/asm-arm/arch-netx/xc.h
@@ -0,0 +1,42 @@
1/*
2 * linux/include/asm-arm/arch-netx/xc.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 __ASM_ARCH_XC_H
21#define __ASM_ARCH_XC_H
22
23struct xc {
24 int no;
25 unsigned int type;
26 unsigned int version;
27 void __iomem *xpec_base;
28 void __iomem *xmac_base;
29 void __iomem *sram_base;
30 int irq;
31 struct device *dev;
32};
33
34int xc_reset(struct xc *x);
35int xc_stop(struct xc* x);
36int xc_start(struct xc *x);
37int xc_running(struct xc *x);
38int xc_request_firmware(struct xc* x);
39struct xc* request_xc(int xcno, struct device *dev);
40void free_xc(struct xc *x);
41
42#endif /* __ASM_ARCH_XC_H */
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/poodle.h b/include/asm-arm/arch-pxa/poodle.h
index 6b5ac5144e70..4d6a40315764 100644
--- a/include/asm-arm/arch-pxa/poodle.h
+++ b/include/asm-arm/arch-pxa/poodle.h
@@ -31,6 +31,7 @@
31#define POODLE_GPIO_CF_CD (14) 31#define POODLE_GPIO_CF_CD (14)
32#define POODLE_GPIO_CF_STSCHG (14) 32#define POODLE_GPIO_CF_STSCHG (14)
33#define POODLE_GPIO_SD_PWR (33) 33#define POODLE_GPIO_SD_PWR (33)
34#define POODLE_GPIO_SD_PWR1 (3)
34#define POODLE_GPIO_nSD_CLK (6) 35#define POODLE_GPIO_nSD_CLK (6)
35#define POODLE_GPIO_nSD_WP (7) 36#define POODLE_GPIO_nSD_WP (7)
36#define POODLE_GPIO_nSD_INT (8) 37#define POODLE_GPIO_nSD_INT (8)
@@ -42,6 +43,7 @@
42#define POODLE_GPIO_BYPASS_ON (36) 43#define POODLE_GPIO_BYPASS_ON (36)
43#define POODLE_GPIO_CHRG_ON (38) 44#define POODLE_GPIO_CHRG_ON (38)
44#define POODLE_GPIO_CHRG_FULL (16) 45#define POODLE_GPIO_CHRG_FULL (16)
46#define POODLE_GPIO_DISCHARGE_ON (42) /* Enable battery discharge */
45 47
46/* PXA GPIOs */ 48/* PXA GPIOs */
47#define POODLE_IRQ_GPIO_ON_KEY IRQ_GPIO(0) 49#define POODLE_IRQ_GPIO_ON_KEY IRQ_GPIO(0)
@@ -68,4 +70,6 @@
68#define POODLE_SCOOP_IO_DIR ( POODLE_SCOOP_VPEN | POODLE_SCOOP_HS_OUT ) 70#define POODLE_SCOOP_IO_DIR ( POODLE_SCOOP_VPEN | POODLE_SCOOP_HS_OUT )
69#define POODLE_SCOOP_IO_OUT ( 0 ) 71#define POODLE_SCOOP_IO_OUT ( 0 )
70 72
73extern struct platform_device poodle_locomo_device;
74
71#endif /* __ASM_ARCH_POODLE_H */ 75#endif /* __ASM_ARCH_POODLE_H */
diff --git a/include/asm-arm/arch-pxa/pxa-regs.h b/include/asm-arm/arch-pxa/pxa-regs.h
index 6650d4decaeb..9f83f4adfbf3 100644
--- a/include/asm-arm/arch-pxa/pxa-regs.h
+++ b/include/asm-arm/arch-pxa/pxa-regs.h
@@ -1625,7 +1625,7 @@
1625#define SSCR0_RIM (1 << 22) /* Receive FIFO overrrun interrupt mask */ 1625#define SSCR0_RIM (1 << 22) /* Receive FIFO overrrun interrupt mask */
1626#define SSCR0_TUM (1 << 23) /* Transmit FIFO underrun interrupt mask */ 1626#define SSCR0_TUM (1 << 23) /* Transmit FIFO underrun interrupt mask */
1627#define SSCR0_FRDC (0x07000000) /* Frame rate divider control (mask) */ 1627#define SSCR0_FRDC (0x07000000) /* Frame rate divider control (mask) */
1628#define SSCR0_SlotsPerFrm(c) ((x) - 1) /* Time slots per frame [1..8] */ 1628#define SSCR0_SlotsPerFrm(x) ((x) - 1) /* Time slots per frame [1..8] */
1629#define SSCR0_ADC (1 << 30) /* Audio clock select */ 1629#define SSCR0_ADC (1 << 30) /* Audio clock select */
1630#define SSCR0_MOD (1 << 31) /* Mode (normal or network) */ 1630#define SSCR0_MOD (1 << 31) /* Mode (normal or network) */
1631#endif 1631#endif
@@ -1706,6 +1706,10 @@
1706#if defined (CONFIG_PXA27x) 1706#if defined (CONFIG_PXA27x)
1707#define SSTO_P1 __REG(0x41000028) /* SSP Port 1 Time Out Register */ 1707#define SSTO_P1 __REG(0x41000028) /* SSP Port 1 Time Out Register */
1708#define SSPSP_P1 __REG(0x4100002C) /* SSP Port 1 Programmable Serial Protocol */ 1708#define SSPSP_P1 __REG(0x4100002C) /* SSP Port 1 Programmable Serial Protocol */
1709#define SSTSA_P1 __REG(0x41000030) /* SSP Port 1 Tx Timeslot Active */
1710#define SSRSA_P1 __REG(0x41000034) /* SSP Port 1 Rx Timeslot Active */
1711#define SSTSS_P1 __REG(0x41000038) /* SSP Port 1 Timeslot Status */
1712#define SSACD_P1 __REG(0x4100003C) /* SSP Port 1 Audio Clock Divider */
1709#define SSCR0_P2 __REG(0x41700000) /* SSP Port 2 Control Register 0 */ 1713#define SSCR0_P2 __REG(0x41700000) /* SSP Port 2 Control Register 0 */
1710#define SSCR1_P2 __REG(0x41700004) /* SSP Port 2 Control Register 1 */ 1714#define SSCR1_P2 __REG(0x41700004) /* SSP Port 2 Control Register 1 */
1711#define SSSR_P2 __REG(0x41700008) /* SSP Port 2 Status Register */ 1715#define SSSR_P2 __REG(0x41700008) /* SSP Port 2 Status Register */
@@ -1713,6 +1717,10 @@
1713#define SSDR_P2 __REG(0x41700010) /* (Write / Read) SSP Port 2 Data Write Register/SSP Data Read Register */ 1717#define SSDR_P2 __REG(0x41700010) /* (Write / Read) SSP Port 2 Data Write Register/SSP Data Read Register */
1714#define SSTO_P2 __REG(0x41700028) /* SSP Port 2 Time Out Register */ 1718#define SSTO_P2 __REG(0x41700028) /* SSP Port 2 Time Out Register */
1715#define SSPSP_P2 __REG(0x4170002C) /* SSP Port 2 Programmable Serial Protocol */ 1719#define SSPSP_P2 __REG(0x4170002C) /* SSP Port 2 Programmable Serial Protocol */
1720#define SSTSA_P2 __REG(0x41700030) /* SSP Port 2 Tx Timeslot Active */
1721#define SSRSA_P2 __REG(0x41700034) /* SSP Port 2 Rx Timeslot Active */
1722#define SSTSS_P2 __REG(0x41700038) /* SSP Port 2 Timeslot Status */
1723#define SSACD_P2 __REG(0x4170003C) /* SSP Port 2 Audio Clock Divider */
1716#define SSCR0_P3 __REG(0x41900000) /* SSP Port 3 Control Register 0 */ 1724#define SSCR0_P3 __REG(0x41900000) /* SSP Port 3 Control Register 0 */
1717#define SSCR1_P3 __REG(0x41900004) /* SSP Port 3 Control Register 1 */ 1725#define SSCR1_P3 __REG(0x41900004) /* SSP Port 3 Control Register 1 */
1718#define SSSR_P3 __REG(0x41900008) /* SSP Port 3 Status Register */ 1726#define SSSR_P3 __REG(0x41900008) /* SSP Port 3 Status Register */
@@ -1720,6 +1728,10 @@
1720#define SSDR_P3 __REG(0x41900010) /* (Write / Read) SSP Port 3 Data Write Register/SSP Data Read Register */ 1728#define SSDR_P3 __REG(0x41900010) /* (Write / Read) SSP Port 3 Data Write Register/SSP Data Read Register */
1721#define SSTO_P3 __REG(0x41900028) /* SSP Port 3 Time Out Register */ 1729#define SSTO_P3 __REG(0x41900028) /* SSP Port 3 Time Out Register */
1722#define SSPSP_P3 __REG(0x4190002C) /* SSP Port 3 Programmable Serial Protocol */ 1730#define SSPSP_P3 __REG(0x4190002C) /* SSP Port 3 Programmable Serial Protocol */
1731#define SSTSA_P3 __REG(0x41900030) /* SSP Port 3 Tx Timeslot Active */
1732#define SSRSA_P3 __REG(0x41900034) /* SSP Port 3 Rx Timeslot Active */
1733#define SSTSS_P3 __REG(0x41900038) /* SSP Port 3 Timeslot Status */
1734#define SSACD_P3 __REG(0x4190003C) /* SSP Port 3 Audio Clock Divider */
1723#else /* PXA255 (only port 2) and PXA26x ports*/ 1735#else /* PXA255 (only port 2) and PXA26x ports*/
1724#define SSTO_P1 __REG(0x41000028) /* SSP Port 1 Time Out Register */ 1736#define SSTO_P1 __REG(0x41000028) /* SSP Port 1 Time Out Register */
1725#define SSPSP_P1 __REG(0x4100002C) /* SSP Port 1 Programmable Serial Protocol */ 1737#define SSPSP_P1 __REG(0x4100002C) /* SSP Port 1 Programmable Serial Protocol */
@@ -1746,6 +1758,10 @@
1746#define SSDR_P(x) (*(((x) == 1) ? &SSDR_P1 : ((x) == 2) ? &SSDR_P2 : ((x) == 3) ? &SSDR_P3 : NULL)) 1758#define SSDR_P(x) (*(((x) == 1) ? &SSDR_P1 : ((x) == 2) ? &SSDR_P2 : ((x) == 3) ? &SSDR_P3 : NULL))
1747#define SSTO_P(x) (*(((x) == 1) ? &SSTO_P1 : ((x) == 2) ? &SSTO_P2 : ((x) == 3) ? &SSTO_P3 : NULL)) 1759#define SSTO_P(x) (*(((x) == 1) ? &SSTO_P1 : ((x) == 2) ? &SSTO_P2 : ((x) == 3) ? &SSTO_P3 : NULL))
1748#define SSPSP_P(x) (*(((x) == 1) ? &SSPSP_P1 : ((x) == 2) ? &SSPSP_P2 : ((x) == 3) ? &SSPSP_P3 : NULL)) 1760#define SSPSP_P(x) (*(((x) == 1) ? &SSPSP_P1 : ((x) == 2) ? &SSPSP_P2 : ((x) == 3) ? &SSPSP_P3 : NULL))
1761#define SSTSA_P(x) (*(((x) == 1) ? &SSTSA_P1 : ((x) == 2) ? &SSTSA_P2 : ((x) == 3) ? &SSTSA_P3 : NULL))
1762#define SSRSA_P(x) (*(((x) == 1) ? &SSRSA_P1 : ((x) == 2) ? &SSRSA_P2 : ((x) == 3) ? &SSRSA_P3 : NULL))
1763#define SSTSS_P(x) (*(((x) == 1) ? &SSTSS_P1 : ((x) == 2) ? &SSTSS_P2 : ((x) == 3) ? &SSTSS_P3 : NULL))
1764#define SSACD_P(x) (*(((x) == 1) ? &SSACD_P1 : ((x) == 2) ? &SSACD_P2 : ((x) == 3) ? &SSACD_P3 : NULL))
1749 1765
1750/* 1766/*
1751 * MultiMediaCard (MMC) controller 1767 * MultiMediaCard (MMC) controller
diff --git a/include/asm-arm/arch-pxa/system.h b/include/asm-arm/arch-pxa/system.h
index 840a46bfbc54..1d56a3ef89fd 100644
--- a/include/asm-arm/arch-pxa/system.h
+++ b/include/asm-arm/arch-pxa/system.h
@@ -10,6 +10,7 @@
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 */ 11 */
12 12
13#include <asm/proc-fns.h>
13#include "hardware.h" 14#include "hardware.h"
14#include "pxa-regs.h" 15#include "pxa-regs.h"
15 16
diff --git a/include/asm-arm/arch-s3c2410/regs-dsc.h b/include/asm-arm/arch-s3c2410/regs-dsc.h
index a023b0434efe..ba13a2c9e547 100644
--- a/include/asm-arm/arch-s3c2410/regs-dsc.h
+++ b/include/asm-arm/arch-s3c2410/regs-dsc.h
@@ -170,7 +170,7 @@
170#define S3C2440_DSC1_CS1_4mA (3<<2) 170#define S3C2440_DSC1_CS1_4mA (3<<2)
171#define S3C2440_DSC1_CS1_MASK (3<<2) 171#define S3C2440_DSC1_CS1_MASK (3<<2)
172 172
173#define S3C2440_DSC1_CS0 (S3C2440_SELECT_DSC1 | 0 173#define S3C2440_DSC1_CS0 (S3C2440_SELECT_DSC1 | 0)
174#define S3C2440_DSC1_CS0_10mA (0<<0) 174#define S3C2440_DSC1_CS0_10mA (0<<0)
175#define S3C2440_DSC1_CS0_8mA (1<<0) 175#define S3C2440_DSC1_CS0_8mA (1<<0)
176#define S3C2440_DSC1_CS0_6mA (2<<0) 176#define S3C2440_DSC1_CS0_6mA (2<<0)
diff --git a/include/asm-arm/arch-versatile/system.h b/include/asm-arm/arch-versatile/system.h
index 8889a189739f..71c6254c0d9b 100644
--- a/include/asm-arm/arch-versatile/system.h
+++ b/include/asm-arm/arch-versatile/system.h
@@ -36,16 +36,14 @@ static inline void arch_idle(void)
36 36
37static inline void arch_reset(char mode) 37static inline void arch_reset(char mode)
38{ 38{
39 unsigned int hdr_ctrl = (IO_ADDRESS(VERSATILE_SYS_BASE) + VERSATILE_SYS_RESETCTL_OFFSET); 39 u32 val;
40 unsigned int val;
41 40
42 /* 41 val = __raw_readl(IO_ADDRESS(VERSATILE_SYS_RESETCTL)) & ~0x7;
43 * To reset, we hit the on-board reset register 42 val |= 0x105;
44 * in the system FPGA 43
45 */ 44 __raw_writel(0xa05f, IO_ADDRESS(VERSATILE_SYS_LOCK));
46 val = __raw_readl(hdr_ctrl); 45 __raw_writel(val, IO_ADDRESS(VERSATILE_SYS_RESETCTL));
47 val |= VERSATILE_SYS_CTRL_RESET_CONFIGCLR; 46 __raw_writel(0, IO_ADDRESS(VERSATILE_SYS_LOCK));
48 __raw_writel(val, hdr_ctrl);
49} 47}
50 48
51#endif 49#endif
diff --git a/include/asm-arm/byteorder.h b/include/asm-arm/byteorder.h
index 17eaf8bdf092..e6f7fcdc73b0 100644
--- a/include/asm-arm/byteorder.h
+++ b/include/asm-arm/byteorder.h
@@ -22,16 +22,18 @@ static inline __attribute_const__ __u32 ___arch__swab32(__u32 x)
22{ 22{
23 __u32 t; 23 __u32 t;
24 24
25 if (__builtin_constant_p(x)) { 25#ifndef __thumb__
26 t = x ^ ((x << 16) | (x >> 16)); /* eor r1,r0,r0,ror #16 */ 26 if (!__builtin_constant_p(x)) {
27 } else {
28 /* 27 /*
29 * The compiler needs a bit of a hint here to always do the 28 * The compiler needs a bit of a hint here to always do the
30 * right thing and not screw it up to different degrees 29 * right thing and not screw it up to different degrees
31 * depending on the gcc version. 30 * depending on the gcc version.
32 */ 31 */
33 asm ("eor\t%0, %1, %1, ror #16" : "=r" (t) : "r" (x)); 32 asm ("eor\t%0, %1, %1, ror #16" : "=r" (t) : "r" (x));
34 } 33 } else
34#endif
35 t = x ^ ((x << 16) | (x >> 16)); /* eor r1,r0,r0,ror #16 */
36
35 x = (x << 24) | (x >> 8); /* mov r0,r0,ror #8 */ 37 x = (x << 24) | (x >> 8); /* mov r0,r0,ror #8 */
36 t &= ~0x00FF0000; /* bic r1,r1,#0x00FF0000 */ 38 t &= ~0x00FF0000; /* bic r1,r1,#0x00FF0000 */
37 x ^= (t >> 8); /* eor r0,r0,r1,lsr #8 */ 39 x ^= (t >> 8); /* eor r0,r0,r1,lsr #8 */
diff --git a/include/asm-arm/hardware/sharpsl_pm.h b/include/asm-arm/hardware/sharpsl_pm.h
index 36983e5f3665..ecf15b83956f 100644
--- a/include/asm-arm/hardware/sharpsl_pm.h
+++ b/include/asm-arm/hardware/sharpsl_pm.h
@@ -16,6 +16,7 @@ struct sharpsl_charger_machinfo {
16 void (*exit)(void); 16 void (*exit)(void);
17 int gpio_acin; 17 int gpio_acin;
18 int gpio_batfull; 18 int gpio_batfull;
19 int batfull_irq;
19 int gpio_batlock; 20 int gpio_batlock;
20 int gpio_fatal; 21 int gpio_fatal;
21 void (*discharge)(int); 22 void (*discharge)(int);
@@ -34,9 +35,19 @@ struct sharpsl_charger_machinfo {
34#define SHARPSL_STATUS_FATAL 7 35#define SHARPSL_STATUS_FATAL 7
35 unsigned long (*charger_wakeup)(void); 36 unsigned long (*charger_wakeup)(void);
36 int (*should_wakeup)(unsigned int resume_on_alarm); 37 int (*should_wakeup)(unsigned int resume_on_alarm);
38 void (*backlight_limit)(int);
39 int (*backlight_get_status) (void);
40 int charge_on_volt;
41 int charge_on_temp;
42 int charge_acin_high;
43 int charge_acin_low;
44 int fatal_acin_volt;
45 int fatal_noacin_volt;
37 int bat_levels; 46 int bat_levels;
38 struct battery_thresh *bat_levels_noac; 47 struct battery_thresh *bat_levels_noac;
39 struct battery_thresh *bat_levels_acin; 48 struct battery_thresh *bat_levels_acin;
49 struct battery_thresh *bat_levels_noac_bl;
50 struct battery_thresh *bat_levels_acin_bl;
40 int status_high_acin; 51 int status_high_acin;
41 int status_low_acin; 52 int status_low_acin;
42 int status_high_noac; 53 int status_high_noac;
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/mach/serial_at91rm9200.h b/include/asm-arm/mach/serial_at91.h
index a0269de12079..1290bb32802d 100644
--- a/include/asm-arm/mach/serial_at91rm9200.h
+++ b/include/asm-arm/mach/serial_at91.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/include/asm-arm/mach/serial_at91rm9200.h 2 * linux/include/asm-arm/mach/serial_at91.h
3 * 3 *
4 * Based on serial_sa1100.h by Nicolas Pitre 4 * Based on serial_sa1100.h by Nicolas Pitre
5 * 5 *
@@ -14,7 +14,7 @@ struct uart_port;
14 * This is a temporary structure for registering these 14 * This is a temporary structure for registering these
15 * functions; it is intended to be discarded after boot. 15 * functions; it is intended to be discarded after boot.
16 */ 16 */
17struct at91rm9200_port_fns { 17struct at91_port_fns {
18 void (*set_mctrl)(struct uart_port *, u_int); 18 void (*set_mctrl)(struct uart_port *, u_int);
19 u_int (*get_mctrl)(struct uart_port *); 19 u_int (*get_mctrl)(struct uart_port *);
20 void (*enable_ms)(struct uart_port *); 20 void (*enable_ms)(struct uart_port *);
@@ -25,11 +25,9 @@ struct at91rm9200_port_fns {
25}; 25};
26 26
27#if defined(CONFIG_SERIAL_AT91) 27#if defined(CONFIG_SERIAL_AT91)
28void at91_register_uart_fns(struct at91rm9200_port_fns *fns); 28void at91_register_uart_fns(struct at91_port_fns *fns);
29void at91_register_uart(int idx, int port);
30#else 29#else
31#define at91_register_uart_fns(fns) do { } while (0) 30#define at91_register_uart_fns(fns) do { } while (0)
32#define at91_register_uart(idx,port) do { } while (0)
33#endif 31#endif
34 32
35 33
diff --git a/include/asm-arm/system.h b/include/asm-arm/system.h
index 9c744ae6c6e3..6001febfe63b 100644
--- a/include/asm-arm/system.h
+++ b/include/asm-arm/system.h
@@ -107,6 +107,9 @@ extern void __show_regs(struct pt_regs *);
107extern int cpu_architecture(void); 107extern int cpu_architecture(void);
108extern void cpu_init(void); 108extern void cpu_init(void);
109 109
110void arm_machine_restart(char mode);
111extern void (*arm_pm_restart)(char str);
112
110/* 113/*
111 * Intel's XScale3 core supports some v6 features (supersections, L2) 114 * Intel's XScale3 core supports some v6 features (supersections, L2)
112 * but advertises itself as v5 as it does not support the v6 ISA. For 115 * but advertises itself as v5 as it does not support the v6 ISA. For
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/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/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/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-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/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/uaccess.h b/include/asm-i386/uaccess.h
index 1ec65523ea5e..8462f8e0e658 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,8 @@ 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_nocache(void *to,
394 const void __user *from, unsigned long n);
393 395
394/* 396/*
395 * Here we special-case 1, 2 and 4-byte copy_*_user invocations. On a fault 397 * Here we special-case 1, 2 and 4-byte copy_*_user invocations. On a fault
@@ -478,12 +480,43 @@ __copy_from_user_inatomic(void *to, const void __user *from, unsigned long n)
478 return __copy_from_user_ll(to, from, n); 480 return __copy_from_user_ll(to, from, n);
479} 481}
480 482
483#define ARCH_HAS_NOCACHE_UACCESS
484
485static __always_inline unsigned long __copy_from_user_inatomic_nocache(void *to,
486 const void __user *from, unsigned long n)
487{
488 if (__builtin_constant_p(n)) {
489 unsigned long ret;
490
491 switch (n) {
492 case 1:
493 __get_user_size(*(u8 *)to, from, 1, ret, 1);
494 return ret;
495 case 2:
496 __get_user_size(*(u16 *)to, from, 2, ret, 2);
497 return ret;
498 case 4:
499 __get_user_size(*(u32 *)to, from, 4, ret, 4);
500 return ret;
501 }
502 }
503 return __copy_from_user_ll_nocache(to, from, n);
504}
505
481static __always_inline unsigned long 506static __always_inline unsigned long
482__copy_from_user(void *to, const void __user *from, unsigned long n) 507__copy_from_user(void *to, const void __user *from, unsigned long n)
483{ 508{
484 might_sleep(); 509 might_sleep();
485 return __copy_from_user_inatomic(to, from, n); 510 return __copy_from_user_inatomic(to, from, n);
486} 511}
512
513static __always_inline unsigned long
514__copy_from_user_nocache(void *to, const void __user *from, unsigned long n)
515{
516 might_sleep();
517 return __copy_from_user_inatomic_nocache(to, from, n);
518}
519
487unsigned long __must_check copy_to_user(void __user *to, 520unsigned long __must_check copy_to_user(void __user *to,
488 const void *from, unsigned long n); 521 const void *from, unsigned long n);
489unsigned long __must_check copy_from_user(void *to, 522unsigned 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/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/irq.h b/include/asm-m68k/irq.h
index b4f48b2a6a57..9727ca9d9f26 100644
--- a/include/asm-m68k/irq.h
+++ b/include/asm-m68k/irq.h
@@ -130,8 +130,4 @@ extern volatile unsigned int num_spurious;
130 */ 130 */
131extern irq_node_t *new_irq_node(void); 131extern irq_node_t *new_irq_node(void);
132 132
133struct irqaction;
134struct pt_regs;
135int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *);
136
137#endif /* _M68K_IRQ_H_ */ 133#endif /* _M68K_IRQ_H_ */
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/uaccess.h b/include/asm-m68k/uaccess.h
index 2ffd87b0a769..b761ef218cea 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,315 @@ 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 108
67extern int __put_user_bad(void);
68 109
69/* 110#define __get_user_asm(res, x, ptr, type, bwl, reg, err) ({ \
70 * Tell gcc we read from memory instead of writing: this is because 111 type __gu_val; \
71 * we do not write to any memory gcc knows about, so there are no 112 asm volatile ("\n" \
72 * aliasing issues. 113 "1: moves."#bwl" %2,%1\n" \
73 */ 114 "2:\n" \
74#define __put_user_asm(err,x,ptr,bwl) \ 115 " .section .fixup,\"ax\"\n" \
75__asm__ __volatile__ \ 116 " .even\n" \
76 ("21:moves" #bwl " %2,%1\n" \ 117 "10: move.l %3,%0\n" \
77 "1:\n" \ 118 " sub."#bwl" %1,%1\n" \
78 ".section .fixup,\"ax\"\n" \ 119 " jra 2b\n" \
79 " .even\n" \ 120 " .previous\n" \
80 "2: movel %3,%0\n" \ 121 "\n" \
81 " jra 1b\n" \ 122 " .section __ex_table,\"a\"\n" \
82 ".previous\n" \ 123 " .align 4\n" \
83 ".section __ex_table,\"a\"\n" \ 124 " .long 1b,10b\n" \
84 " .align 4\n" \ 125 " .previous" \
85 " .long 21b,2b\n" \ 126 : "+d" (res), "=&" #reg (__gu_val) \
86 " .long 1b,2b\n" \ 127 : "m" (*(ptr)), "i" (err)); \
87 ".previous" \ 128 (x) = (typeof(*(ptr)))(long)__gu_val; \
88 : "=d"(err) \
89 : "m"(*(ptr)), "r"(x), "i"(-EFAULT), "0"(0))
90
91#define get_user(x, ptr) \
92({ \
93 int __gu_err; \
94 typeof(*(ptr)) __gu_val; \
95 __chk_user_ptr(ptr); \
96 switch (sizeof(*(ptr))) { \
97 case 1: \
98 __get_user_asm(__gu_err, __gu_val, ptr, b, "=d"); \
99 break; \
100 case 2: \
101 __get_user_asm(__gu_err, __gu_val, ptr, w, "=r"); \
102 break; \
103 case 4: \
104 __get_user_asm(__gu_err, __gu_val, ptr, l, "=r"); \
105 break; \
106 case 8: \
107 __gu_err = __constant_copy_from_user(&__gu_val, ptr, 8); \
108 break; \
109 default: \
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 130
119extern int __get_user_bad(void); 131#define __get_user(x, ptr) \
132({ \
133 int __gu_err = 0; \
134 __chk_user_ptr(ptr); \
135 switch (sizeof(*(ptr))) { \
136 case 1: \
137 __get_user_asm(__gu_err, x, ptr, u8, b, d, -EFAULT); \
138 break; \
139 case 2: \
140 __get_user_asm(__gu_err, x, ptr, u16, w, d, -EFAULT); \
141 break; \
142 case 4: \
143 __get_user_asm(__gu_err, x, ptr, u32, l, r, -EFAULT); \
144 break; \
145/* case 8: disabled because gcc-4.1 has a broken typeof \
146 { \
147 const void *__gu_ptr = (ptr); \
148 u64 __gu_val; \
149 asm volatile ("\n" \
150 "1: moves.l (%2)+,%1\n" \
151 "2: moves.l (%2),%R1\n" \
152 "3:\n" \
153 " .section .fixup,\"ax\"\n" \
154 " .even\n" \
155 "10: move.l %3,%0\n" \
156 " sub.l %1,%1\n" \
157 " sub.l %R1,%R1\n" \
158 " jra 3b\n" \
159 " .previous\n" \
160 "\n" \
161 " .section __ex_table,\"a\"\n" \
162 " .align 4\n" \
163 " .long 1b,10b\n" \
164 " .long 2b,10b\n" \
165 " .previous" \
166 : "+d" (__gu_err), "=&r" (__gu_val), \
167 "+a" (__gu_ptr) \
168 : "i" (-EFAULT) \
169 : "memory"); \
170 (x) = (typeof(*(ptr)))__gu_val; \
171 break; \
172 } */ \
173 default: \
174 __gu_err = __get_user_bad(); \
175 break; \
176 } \
177 __gu_err; \
178})
179#define get_user(x, ptr) __get_user(x, ptr)
120 180
121#define __get_user_asm(err,x,ptr,bwl,reg) \ 181unsigned long __generic_copy_from_user(void *to, const void __user *from, unsigned long n);
122__asm__ __volatile__ \ 182unsigned long __generic_copy_to_user(void __user *to, const void *from, unsigned long n);
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 183
138static inline unsigned long 184static __always_inline unsigned long
139__generic_copy_from_user(void *to, const void __user *from, unsigned long n) 185__constant_copy_from_user(void *to, const void __user *from, unsigned long n)
140{
141 unsigned long tmp;
142 __asm__ __volatile__
143 (" tstl %2\n"
144 " jeq 2f\n"
145 "1: movesl (%1)+,%3\n"
146 " movel %3,(%0)+\n"
147 " subql #1,%2\n"
148 " jne 1b\n"
149 "2: movel %4,%2\n"
150 " bclr #1,%2\n"
151 " jeq 4f\n"
152 "3: movesw (%1)+,%3\n"
153 " movew %3,(%0)+\n"
154 "4: bclr #0,%2\n"
155 " jeq 6f\n"
156 "5: movesb (%1)+,%3\n"
157 " moveb %3,(%0)+\n"
158 "6:\n"
159 ".section .fixup,\"ax\"\n"
160 " .even\n"
161 "7: movel %2,%%d0\n"
162 "71:clrl (%0)+\n"
163 " subql #1,%%d0\n"
164 " jne 71b\n"
165 " lsll #2,%2\n"
166 " addl %4,%2\n"
167 " btst #1,%4\n"
168 " jne 81f\n"
169 " btst #0,%4\n"
170 " jne 91f\n"
171 " jra 6b\n"
172 "8: addql #2,%2\n"
173 "81:clrw (%0)+\n"
174 " btst #0,%4\n"
175 " jne 91f\n"
176 " jra 6b\n"
177 "9: addql #1,%2\n"
178 "91:clrb (%0)+\n"
179 " jra 6b\n"
180 ".previous\n"
181 ".section __ex_table,\"a\"\n"
182 " .align 4\n"
183 " .long 1b,7b\n"
184 " .long 3b,8b\n"
185 " .long 5b,9b\n"
186 ".previous"
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
193static inline unsigned long
194__generic_copy_to_user(void __user *to, const void *from, unsigned long n)
195{ 186{
196 unsigned long tmp; 187 unsigned long res = 0, 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 188
242#define __copy_from_user_big(to, from, n, fixup, copy) \ 189 /* limit the inlined version to 3 moves */
243 __asm__ __volatile__ \ 190 if (n == 11 || n > 12)
244 ("10: movesl (%1)+,%%d0\n" \ 191 return __generic_copy_from_user(to, from, n);
245 " movel %%d0,(%0)+\n" \
246 " subql #1,%2\n" \
247 " jne 10b\n" \
248 ".section .fixup,\"ax\"\n" \
249 " .even\n" \
250 "11: movel %2,%%d0\n" \
251 "13: clrl (%0)+\n" \
252 " subql #1,%%d0\n" \
253 " jne 13b\n" \
254 " lsll #2,%2\n" \
255 fixup "\n" \
256 " jra 12f\n" \
257 ".previous\n" \
258 ".section __ex_table,\"a\"\n" \
259 " .align 4\n" \
260 " .long 10b,11b\n" \
261 ".previous\n" \
262 copy "\n" \
263 "12:" \
264 : "=a"(to), "=a"(from), "=d"(n) \
265 : "0"(to), "1"(from), "2"(n/4) \
266 : "d0", "memory")
267 192
268static inline unsigned long 193 switch (n) {
269__constant_copy_from_user(void *to, const void __user *from, unsigned long n)
270{
271 switch (n) {
272 case 0:
273 break;
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: 194 case 1:
448 __copy_from_user_big(to, from, n, 195 __get_user_asm(res, *(u8 *)to, (u8 *)from, u8, b, d, 1);
449 /* fixup */ 196 return res;
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: 197 case 2:
460 __copy_from_user_big(to, from, n, 198 __get_user_asm(res, *(u16 *)to, (u16 *)from, u16, w, d, 2);
461 /* fixup */ 199 return res;
462 "1: addql #2,%2\n" 200 case 4:
463 " clrw (%0)+", 201 __get_user_asm(res, *(u32 *)to, (u32 *)from, u32, l, r, 4);
464 /* copy */ 202 return res;
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:
472 __copy_from_user_big(to, from, n,
473 /* fixup */
474 "1: addql #2,%2\n"
475 " clrw (%0)+\n"
476 "2: addql #1,%2\n"
477 " clrb (%0)+",
478 /* copy */
479 "3: movesw (%1)+,%%d0\n"
480 " movew %%d0,(%0)+\n"
481 "4: movesb (%1)+,%%d0\n"
482 " moveb %%d0,(%0)+\n"
483 ".section __ex_table,\"a\"\n"
484 " .long 3b,1b\n"
485 " .long 4b,2b\n"
486 ".previous");
487 break;
488 } 203 }
489 break;
490 }
491 return n;
492}
493 204
494#define __copy_to_user_big(to, from, n, fixup, copy) \ 205 asm volatile ("\n"
495 __asm__ __volatile__ \ 206 " .ifndef .Lfrom_user\n"
496 ("10: movel (%1)+,%%d0\n" \ 207 " .set .Lfrom_user,1\n"
497 "31: movesl %%d0,(%0)+\n" \ 208 " .macro copy_from_user to,from,tmp\n"
498 "11: subql #1,%2\n" \ 209 " .if .Lcnt >= 4\n"
499 " jne 10b\n" \ 210 "1: moves.l (\\from)+,\\tmp\n"
500 "41:\n" \ 211 " move.l \\tmp,(\\to)+\n"
501 ".section .fixup,\"ax\"\n" \ 212 " .set .Lcnt,.Lcnt-4\n"
502 " .even\n" \ 213 " .elseif .Lcnt & 2\n"
503 "22: addql #1,%2\n" \ 214 "1: moves.w (\\from)+,\\tmp\n"
504 "12: lsll #2,%2\n" \ 215 " move.w \\tmp,(\\to)+\n"
505 fixup "\n" \ 216 " .set .Lcnt,.Lcnt-2\n"
506 " jra 13f\n" \ 217 " .elseif .Lcnt & 1\n"
507 ".previous\n" \ 218 "1: moves.b (\\from)+,\\tmp\n"
508 ".section __ex_table,\"a\"\n" \ 219 " move.b \\tmp,(\\to)+\n"
509 " .align 4\n" \ 220 " .set .Lcnt,.Lcnt-1\n"
510 " .long 10b,22b\n" \ 221 " .else\n"
511 " .long 31b,12b\n" \ 222 " .exitm\n"
512 " .long 11b,12b\n" \ 223 " .endif\n"
513 " .long 41b,22b\n" \ 224 "\n"
514 ".previous\n" \ 225 " .section __ex_table,\"a\"\n"
515 copy "\n" \ 226 " .align 4\n"
516 "13:" \ 227 " .long 1b,3f\n"
517 : "=a"(to), "=a"(from), "=d"(n) \ 228 " .previous\n"
518 : "0"(to), "1"(from), "2"(n/4) \ 229 " .endm\n"
519 : "d0", "memory") 230 " .endif\n"
231 "\n"
232 " .set .Lcnt,%c4\n"
233 " copy_from_user %1,%2,%3\n"
234 " copy_from_user %1,%2,%3\n"
235 " copy_from_user %1,%2,%3\n"
236 "2:\n"
237 " .section .fixup,\"ax\"\n"
238 " .even\n"
239 "3: moveq.l %4,%0\n"
240 " move.l %5,%1\n"
241 " .rept %c4 / 4\n"
242 " clr.l (%1)+\n"
243 " .endr\n"
244 " .if %c4 & 2\n"
245 " clr.w (%1)+\n"
246 " .endif\n"
247 " .if %c4 & 1\n"
248 " clr.b (%1)+\n"
249 " .endif\n"
250 " jra 2b\n"
251 " .previous\n"
252 : "+r" (res), "+a" (to), "+a" (from), "=&d" (tmp)
253 : "i" (n), "g" (to)
254 : "memory");
520 255
521#define __copy_to_user_inatomic __copy_to_user 256 return res;
522#define __copy_from_user_inatomic __copy_from_user 257}
523 258
524static inline unsigned long 259static __always_inline unsigned long
525__constant_copy_to_user(void __user *to, const void *from, unsigned long n) 260__constant_copy_to_user(void __user *to, const void *from, unsigned long n)
526{ 261{
527 switch (n) { 262 unsigned long res = 0, tmp;
528 case 0: 263
529 break; 264 /* limit the inlined version to 3 moves */
530 case 1: 265 if (n == 11 || n > 12)
531 __asm__ __volatile__ 266 return __generic_copy_to_user(to, from, n);
532 (" moveb (%1)+,%%d0\n" 267
533 "21:movesb %%d0,(%0)+\n" 268 switch (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: 269 case 1:
704 __copy_to_user_big(to, from, n, 270 __put_user_asm(res, *(u8 *)from, (u8 *)to, b, d, 1);
705 /* fixup */ 271 return res;
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: 272 case 2:
717 __copy_to_user_big(to, from, n, 273 __put_user_asm(res, *(u16 *)from, (u16 *)to, w, d, 2);
718 /* fixup */ 274 return res;
719 "1: addql #2,%2", 275 case 4:
720 /* copy */ 276 __put_user_asm(res, *(u32 *)from, (u32 *)to, l, r, 4);
721 " movew (%1)+,%%d0\n" 277 return res;
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:
730 __copy_to_user_big(to, from, n,
731 /* fixup */
732 "1: addql #2,%2\n"
733 "2: addql #1,%2",
734 /* copy */
735 " movew (%1)+,%%d0\n"
736 "23:movesw %%d0,(%0)+\n"
737 "3: moveb (%1)+,%%d0\n"
738 "24:movesb %%d0,(%0)+\n"
739 "4:"
740 ".section __ex_table,\"a\"\n"
741 " .long 23b,1b\n"
742 " .long 3b,1b\n"
743 " .long 24b,2b\n"
744 " .long 4b,2b\n"
745 ".previous");
746 break;
747 } 278 }
748 break; 279
749 } 280 asm volatile ("\n"
750 return n; 281 " .ifndef .Lto_user\n"
282 " .set .Lto_user,1\n"
283 " .macro copy_to_user to,from,tmp\n"
284 " .if .Lcnt >= 4\n"
285 " move.l (\\from)+,\\tmp\n"
286 "11: moves.l \\tmp,(\\to)+\n"
287 "12: .set .Lcnt,.Lcnt-4\n"
288 " .elseif .Lcnt & 2\n"
289 " move.w (\\from)+,\\tmp\n"
290 "11: moves.w \\tmp,(\\to)+\n"
291 "12: .set .Lcnt,.Lcnt-2\n"
292 " .elseif .Lcnt & 1\n"
293 " move.b (\\from)+,\\tmp\n"
294 "11: moves.b \\tmp,(\\to)+\n"
295 "12: .set .Lcnt,.Lcnt-1\n"
296 " .else\n"
297 " .exitm\n"
298 " .endif\n"
299 "\n"
300 " .section __ex_table,\"a\"\n"
301 " .align 4\n"
302 " .long 11b,3f\n"
303 " .long 12b,3f\n"
304 " .previous\n"
305 " .endm\n"
306 " .endif\n"
307 "\n"
308 " .set .Lcnt,%c4\n"
309 " copy_to_user %1,%2,%3\n"
310 " copy_to_user %1,%2,%3\n"
311 " copy_to_user %1,%2,%3\n"
312 "2:\n"
313 " .section .fixup,\"ax\"\n"
314 " .even\n"
315 "3: moveq.l %4,%0\n"
316 " jra 2b\n"
317 " .previous\n"
318 : "+r" (res), "+a" (to), "+a" (from), "=&d" (tmp)
319 : "i" (n)
320 : "memory");
321
322 return res;
751} 323}
752 324
753#define copy_from_user(to, from, n) \ 325#define __copy_from_user(to, from, n) \
754(__builtin_constant_p(n) ? \ 326(__builtin_constant_p(n) ? \
755 __constant_copy_from_user(to, from, n) : \ 327 __constant_copy_from_user(to, from, n) : \
756 __generic_copy_from_user(to, from, n)) 328 __generic_copy_from_user(to, from, n))
757 329
758#define copy_to_user(to, from, n) \ 330#define __copy_to_user(to, from, n) \
759(__builtin_constant_p(n) ? \ 331(__builtin_constant_p(n) ? \
760 __constant_copy_to_user(to, from, n) : \ 332 __constant_copy_to_user(to, from, n) : \
761 __generic_copy_to_user(to, from, n)) 333 __generic_copy_to_user(to, from, n))
762 334
763#define __copy_from_user(to, from, n) copy_from_user(to, from, n) 335#define __copy_to_user_inatomic __copy_to_user
764#define __copy_to_user(to, from, n) copy_to_user(to, from, n) 336#define __copy_from_user_inatomic __copy_from_user
765 337
766/* 338#define copy_from_user(to, from, n) __copy_from_user(to, from, n)
767 * Copy a null terminated string from userspace. 339#define copy_to_user(to, from, n) __copy_to_user(to, from, n)
768 */
769 340
770static inline long 341long strncpy_from_user(char *dst, const char __user *src, long count);
771strncpy_from_user(char *dst, const char __user *src, long count) 342long strnlen_user(const char __user *src, long n);
772{ 343unsigned long clear_user(void __user *to, unsigned long n);
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
799/*
800 * Return the size of a string (including the ending 0)
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
808 res = -(unsigned long)src;
809 __asm__ __volatile__
810 ("1:\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 344
840#define strlen_user(str) strnlen_user(str, 32767) 345#define strlen_user(str) strnlen_user(str, 32767)
841 346
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 */ 347#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/irq.h b/include/asm-m68knommu/irq.h
index 2b408842a30e..c5247516fcfe 100644
--- a/include/asm-m68knommu/irq.h
+++ b/include/asm-m68knommu/irq.h
@@ -87,8 +87,4 @@ extern void (*mach_disable_irq)(unsigned int);
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/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/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/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/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/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/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/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/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/io.h b/include/asm-s390/io.h
index b05825dd16d7..d4614b35f423 100644
--- a/include/asm-s390/io.h
+++ b/include/asm-s390/io.h
@@ -86,20 +86,25 @@ extern void iounmap(void *addr);
86#define readb(addr) (*(volatile unsigned char *) __io_virt(addr)) 86#define readb(addr) (*(volatile unsigned char *) __io_virt(addr))
87#define readw(addr) (*(volatile unsigned short *) __io_virt(addr)) 87#define readw(addr) (*(volatile unsigned short *) __io_virt(addr))
88#define readl(addr) (*(volatile unsigned int *) __io_virt(addr)) 88#define readl(addr) (*(volatile unsigned int *) __io_virt(addr))
89#define readq(addr) (*(volatile unsigned long long *) __io_virt(addr))
89 90
90#define readb_relaxed(addr) readb(addr) 91#define readb_relaxed(addr) readb(addr)
91#define readw_relaxed(addr) readw(addr) 92#define readw_relaxed(addr) readw(addr)
92#define readl_relaxed(addr) readl(addr) 93#define readl_relaxed(addr) readl(addr)
94#define readq_relaxed(addr) readq(addr)
93#define __raw_readb readb 95#define __raw_readb readb
94#define __raw_readw readw 96#define __raw_readw readw
95#define __raw_readl readl 97#define __raw_readl readl
98#define __raw_readq readq
96 99
97#define writeb(b,addr) (*(volatile unsigned char *) __io_virt(addr) = (b)) 100#define writeb(b,addr) (*(volatile unsigned char *) __io_virt(addr) = (b))
98#define writew(b,addr) (*(volatile unsigned short *) __io_virt(addr) = (b)) 101#define writew(b,addr) (*(volatile unsigned short *) __io_virt(addr) = (b))
99#define writel(b,addr) (*(volatile unsigned int *) __io_virt(addr) = (b)) 102#define writel(b,addr) (*(volatile unsigned int *) __io_virt(addr) = (b))
103#define writeq(b,addr) (*(volatile unsigned long long *) __io_virt(addr) = (b))
100#define __raw_writeb writeb 104#define __raw_writeb writeb
101#define __raw_writew writew 105#define __raw_writew writew
102#define __raw_writel writel 106#define __raw_writel writel
107#define __raw_writeq writeq
103 108
104#define memset_io(a,b,c) memset(__io_virt(a),(b),(c)) 109#define memset_io(a,b,c) memset(__io_virt(a),(b),(c))
105#define memcpy_fromio(a,b,c) memcpy((a),__io_virt(b),(c)) 110#define memcpy_fromio(a,b,c) memcpy((a),__io_virt(b),(c))
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-sparc/irq.h b/include/asm-sparc/irq.h
index dbc687403208..3141ddfea97d 100644
--- a/include/asm-sparc/irq.h
+++ b/include/asm-sparc/irq.h
@@ -16,8 +16,6 @@
16 16
17#define __irq_ino(irq) irq 17#define __irq_ino(irq) irq
18#define __irq_pil(irq) irq 18#define __irq_pil(irq) irq
19BTFIXUPDEF_CALL(char *, __irq_itoa, unsigned int)
20#define __irq_itoa(irq) BTFIXUP_CALL(__irq_itoa)(irq)
21 19
22#define NR_IRQS 16 20#define NR_IRQS 16
23 21
@@ -183,8 +181,4 @@ extern struct sun4m_intregs *sun4m_interrupts;
183#define SUN4M_INT_SBUS(x) (1 << (x+7)) 181#define SUN4M_INT_SBUS(x) (1 << (x+7))
184#define SUN4M_INT_VME(x) (1 << (x)) 182#define SUN4M_INT_VME(x) (1 << (x))
185 183
186struct irqaction;
187struct pt_regs;
188int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *);
189
190#endif 184#endif
diff --git a/include/asm-sparc/smp.h b/include/asm-sparc/smp.h
index 5a1b7e4e7cc9..b9da9a600e35 100644
--- a/include/asm-sparc/smp.h
+++ b/include/asm-sparc/smp.h
@@ -145,6 +145,8 @@ static inline int hard_smp_processor_id(void)
145#define prof_multiplier(__cpu) cpu_data(__cpu).multiplier 145#define prof_multiplier(__cpu) cpu_data(__cpu).multiplier
146#define prof_counter(__cpu) cpu_data(__cpu).counter 146#define prof_counter(__cpu) cpu_data(__cpu).counter
147 147
148void smp_setup_cpu_possible_map(void);
149
148#endif /* !(__ASSEMBLY__) */ 150#endif /* !(__ASSEMBLY__) */
149 151
150/* Sparc specific messages. */ 152/* Sparc specific messages. */
@@ -161,7 +163,11 @@ static inline int hard_smp_processor_id(void)
161#define MBOX_IDLECPU2 0xFD 163#define MBOX_IDLECPU2 0xFD
162#define MBOX_STOPCPU2 0xFE 164#define MBOX_STOPCPU2 0xFE
163 165
164#endif /* SMP */ 166#else /* SMP */
167
168#define smp_setup_cpu_possible_map() do { } while (0)
169
170#endif /* !(SMP) */
165 171
166#define NO_PROC_ID 0xFF 172#define NO_PROC_ID 0xFF
167 173
diff --git a/include/asm-sparc/spinlock.h b/include/asm-sparc/spinlock.h
index 3350c90c7869..1c75474ba1df 100644
--- a/include/asm-sparc/spinlock.h
+++ b/include/asm-sparc/spinlock.h
@@ -154,6 +154,9 @@ static inline int __raw_write_trylock(raw_rwlock_t *rw)
154#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) 154#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock)
155#define __raw_read_trylock(lock) generic__raw_read_trylock(lock) 155#define __raw_read_trylock(lock) generic__raw_read_trylock(lock)
156 156
157#define __raw_read_can_lock(rw) (!((rw)->lock & 0xff))
158#define __raw_write_can_lock(rw) (!(rw)->lock)
159
157#endif /* !(__ASSEMBLY__) */ 160#endif /* !(__ASSEMBLY__) */
158 161
159#endif /* __SPARC_SPINLOCK_H */ 162#endif /* __SPARC_SPINLOCK_H */
diff --git a/include/asm-sparc64/cpudata.h b/include/asm-sparc64/cpudata.h
index 9d6a6dbaf126..f2cc9411b4c7 100644
--- a/include/asm-sparc64/cpudata.h
+++ b/include/asm-sparc64/cpudata.h
@@ -74,8 +74,10 @@ struct trap_per_cpu {
74 unsigned long tsb_huge; 74 unsigned long tsb_huge;
75 unsigned long tsb_huge_temp; 75 unsigned long tsb_huge_temp;
76 76
77/* Dcache line 8: Unused, needed to keep trap_block a power-of-2 in size. */ 77/* Dcache line 8: IRQ work list, and keep trap_block a power-of-2 in size. */
78 unsigned long __pad2[4]; 78 unsigned int irq_worklist;
79 unsigned int __pad1;
80 unsigned long __pad2[3];
79} __attribute__((aligned(64))); 81} __attribute__((aligned(64)));
80extern struct trap_per_cpu trap_block[NR_CPUS]; 82extern struct trap_per_cpu trap_block[NR_CPUS];
81extern void init_cur_cpu_trap(struct thread_info *); 83extern void init_cur_cpu_trap(struct thread_info *);
@@ -119,6 +121,7 @@ extern struct sun4v_2insn_patch_entry __sun4v_2insn_patch,
119#define TRAP_PER_CPU_CPU_LIST_PA 0xc8 121#define TRAP_PER_CPU_CPU_LIST_PA 0xc8
120#define TRAP_PER_CPU_TSB_HUGE 0xd0 122#define TRAP_PER_CPU_TSB_HUGE 0xd0
121#define TRAP_PER_CPU_TSB_HUGE_TEMP 0xd8 123#define TRAP_PER_CPU_TSB_HUGE_TEMP 0xd8
124#define TRAP_PER_CPU_IRQ_WORKLIST 0xe0
122 125
123#define TRAP_BLOCK_SZ_SHIFT 8 126#define TRAP_BLOCK_SZ_SHIFT 8
124 127
@@ -171,11 +174,8 @@ extern struct sun4v_2insn_patch_entry __sun4v_2insn_patch,
171 174
172/* Clobbers TMP, loads local processor's IRQ work area into DEST. */ 175/* Clobbers TMP, loads local processor's IRQ work area into DEST. */
173#define TRAP_LOAD_IRQ_WORK(DEST, TMP) \ 176#define TRAP_LOAD_IRQ_WORK(DEST, TMP) \
174 __GET_CPUID(TMP) \ 177 TRAP_LOAD_TRAP_BLOCK(DEST, TMP) \
175 sethi %hi(__irq_work), DEST; \ 178 add DEST, TRAP_PER_CPU_IRQ_WORKLIST, DEST;
176 sllx TMP, 6, TMP; \
177 or DEST, %lo(__irq_work), DEST; \
178 add DEST, TMP, DEST;
179 179
180/* Clobbers TMP, loads DEST with current thread info pointer. */ 180/* Clobbers TMP, loads DEST with current thread info pointer. */
181#define TRAP_LOAD_THREAD_REG(DEST, TMP) \ 181#define TRAP_LOAD_THREAD_REG(DEST, TMP) \
@@ -211,9 +211,10 @@ extern struct sun4v_2insn_patch_entry __sun4v_2insn_patch,
211 TRAP_LOAD_TRAP_BLOCK(DEST, TMP) \ 211 TRAP_LOAD_TRAP_BLOCK(DEST, TMP) \
212 ldx [DEST + TRAP_PER_CPU_PGD_PADDR], DEST; 212 ldx [DEST + TRAP_PER_CPU_PGD_PADDR], DEST;
213 213
214/* Clobbers TMP, loads local processor's IRQ work area into DEST. */
214#define TRAP_LOAD_IRQ_WORK(DEST, TMP) \ 215#define TRAP_LOAD_IRQ_WORK(DEST, TMP) \
215 sethi %hi(__irq_work), DEST; \ 216 TRAP_LOAD_TRAP_BLOCK(DEST, TMP) \
216 or DEST, %lo(__irq_work), DEST; 217 add DEST, TRAP_PER_CPU_IRQ_WORKLIST, DEST;
217 218
218#define TRAP_LOAD_THREAD_REG(DEST, TMP) \ 219#define TRAP_LOAD_THREAD_REG(DEST, TMP) \
219 TRAP_LOAD_TRAP_BLOCK(DEST, TMP) \ 220 TRAP_LOAD_TRAP_BLOCK(DEST, TMP) \
diff --git a/include/asm-sparc64/hardirq.h b/include/asm-sparc64/hardirq.h
index f0cf71376ec5..7c29fd1a87aa 100644
--- a/include/asm-sparc64/hardirq.h
+++ b/include/asm-sparc64/hardirq.h
@@ -12,6 +12,8 @@
12#define local_softirq_pending() \ 12#define local_softirq_pending() \
13 (local_cpu_data().__softirq_pending) 13 (local_cpu_data().__softirq_pending)
14 14
15void ack_bad_irq(unsigned int irq);
16
15#define HARDIRQ_BITS 8 17#define HARDIRQ_BITS 8
16 18
17#endif /* !(__SPARC64_HARDIRQ_H) */ 19#endif /* !(__SPARC64_HARDIRQ_H) */
diff --git a/include/asm-sparc64/hw_irq.h b/include/asm-sparc64/hw_irq.h
index 153cae2ddaee..599b3b073450 100644
--- a/include/asm-sparc64/hw_irq.h
+++ b/include/asm-sparc64/hw_irq.h
@@ -1,6 +1,6 @@
1#ifndef __ASM_SPARC64_HW_IRQ_H 1#ifndef __ASM_SPARC64_HW_IRQ_H
2#define __ASM_SPARC64_HW_IRQ_H 2#define __ASM_SPARC64_HW_IRQ_H
3 3
4/* Dummy include. */ 4extern void hw_resend_irq(struct hw_interrupt_type *handler, unsigned int virt_irq);
5 5
6#endif 6#endif
diff --git a/include/asm-sparc64/irq.h b/include/asm-sparc64/irq.h
index fa164d37ee3f..905e59b4a737 100644
--- a/include/asm-sparc64/irq.h
+++ b/include/asm-sparc64/irq.h
@@ -15,58 +15,6 @@
15#include <asm/pil.h> 15#include <asm/pil.h>
16#include <asm/ptrace.h> 16#include <asm/ptrace.h>
17 17
18struct ino_bucket;
19
20#define MAX_IRQ_DESC_ACTION 4
21
22struct irq_desc {
23 void (*pre_handler)(struct ino_bucket *, void *, void *);
24 void *pre_handler_arg1;
25 void *pre_handler_arg2;
26 u32 action_active_mask;
27 struct irqaction action[MAX_IRQ_DESC_ACTION];
28};
29
30/* You should not mess with this directly. That's the job of irq.c.
31 *
32 * If you make changes here, please update hand coded assembler of
33 * the vectored interrupt trap handler in entry.S -DaveM
34 *
35 * This is currently one DCACHE line, two buckets per L2 cache
36 * line. Keep this in mind please.
37 */
38struct ino_bucket {
39 /* Next handler in per-CPU PIL worklist. We know that
40 * bucket pointers have the high 32-bits clear, so to
41 * save space we only store the bits we need.
42 */
43/*0x00*/unsigned int irq_chain;
44
45 /* PIL to schedule this IVEC at. */
46/*0x04*/unsigned char pil;
47
48 /* If an IVEC arrives while irq_info is NULL, we
49 * set this to notify request_irq() about the event.
50 */
51/*0x05*/unsigned char pending;
52
53 /* Miscellaneous flags. */
54/*0x06*/unsigned char flags;
55
56 /* Currently unused. */
57/*0x07*/unsigned char __pad;
58
59 /* Reference to IRQ descriptor for this bucket. */
60/*0x08*/struct irq_desc *irq_info;
61
62 /* Sun5 Interrupt Clear Register. */
63/*0x10*/unsigned long iclr;
64
65 /* Sun5 Interrupt Mapping Register. */
66/*0x18*/unsigned long imap;
67
68};
69
70/* IMAP/ICLR register defines */ 18/* IMAP/ICLR register defines */
71#define IMAP_VALID 0x80000000 /* IRQ Enabled */ 19#define IMAP_VALID 0x80000000 /* IRQ Enabled */
72#define IMAP_TID_UPA 0x7c000000 /* UPA TargetID */ 20#define IMAP_TID_UPA 0x7c000000 /* UPA TargetID */
@@ -84,36 +32,20 @@ struct ino_bucket {
84#define ICLR_TRANSMIT 0x00000001 /* Transmit state */ 32#define ICLR_TRANSMIT 0x00000001 /* Transmit state */
85#define ICLR_PENDING 0x00000003 /* Pending state */ 33#define ICLR_PENDING 0x00000003 /* Pending state */
86 34
87/* Only 8-bits are available, be careful. -DaveM */ 35/* The largest number of unique interrupt sources we support.
88#define IBF_PCI 0x02 /* PSYCHO/SABRE/SCHIZO PCI interrupt. */ 36 * If this needs to ever be larger than 255, you need to change
89#define IBF_ACTIVE 0x04 /* Interrupt is active and has a handler.*/ 37 * the type of ino_bucket->virt_irq as appropriate.
90#define IBF_INPROGRESS 0x10 /* IRQ is being serviced. */ 38 *
91 39 * ino_bucket->virt_irq allocation is made during {sun4v_,}build_irq().
92#define NUM_IVECS (IMAP_INR + 1) 40 */
93extern struct ino_bucket ivector_table[NUM_IVECS]; 41#define NR_IRQS 255
94
95#define __irq_ino(irq) \
96 (((struct ino_bucket *)(unsigned long)(irq)) - &ivector_table[0])
97#define __irq_pil(irq) ((struct ino_bucket *)(unsigned long)(irq))->pil
98#define __bucket(irq) ((struct ino_bucket *)(unsigned long)(irq))
99#define __irq(bucket) ((unsigned int)(unsigned long)(bucket))
100
101static __inline__ char *__irq_itoa(unsigned int irq)
102{
103 static char buff[16];
104
105 sprintf(buff, "%d,%x", __irq_pil(irq), (unsigned int)__irq_ino(irq));
106 return buff;
107}
108
109#define NR_IRQS 16
110 42
43extern void irq_install_pre_handler(int virt_irq,
44 void (*func)(unsigned int, void *, void *),
45 void *arg1, void *arg2);
111#define irq_canonicalize(irq) (irq) 46#define irq_canonicalize(irq) (irq)
112extern void disable_irq(unsigned int); 47extern unsigned int build_irq(int inofixup, unsigned long iclr, unsigned long imap);
113#define disable_irq_nosync disable_irq 48extern unsigned int sun4v_build_irq(u32 devhandle, unsigned int devino);
114extern void enable_irq(unsigned int);
115extern unsigned int build_irq(int pil, int inofixup, unsigned long iclr, unsigned long imap);
116extern unsigned int sun4v_build_irq(u32 devhandle, unsigned int devino, int pil, unsigned char flags);
117extern unsigned int sbus_build_irq(void *sbus, unsigned int ino); 49extern unsigned int sbus_build_irq(void *sbus, unsigned int ino);
118 50
119static __inline__ void set_softint(unsigned long bits) 51static __inline__ void set_softint(unsigned long bits)
@@ -139,8 +71,4 @@ static __inline__ unsigned long get_softint(void)
139 return retval; 71 return retval;
140} 72}
141 73
142struct irqaction;
143struct pt_regs;
144int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *);
145
146#endif 74#endif
diff --git a/include/asm-sparc64/pil.h b/include/asm-sparc64/pil.h
index 79f827eb3f5d..72927749aebf 100644
--- a/include/asm-sparc64/pil.h
+++ b/include/asm-sparc64/pil.h
@@ -5,9 +5,9 @@
5/* To avoid some locking problems, we hard allocate certain PILs 5/* To avoid some locking problems, we hard allocate certain PILs
6 * for SMP cross call messages that must do a etrap/rtrap. 6 * for SMP cross call messages that must do a etrap/rtrap.
7 * 7 *
8 * A cli() does not block the cross call delivery, so when SMP 8 * A local_irq_disable() does not block the cross call delivery, so
9 * locking is an issue we reschedule the event into a PIL interrupt 9 * when SMP locking is an issue we reschedule the event into a PIL
10 * which is blocked by cli(). 10 * interrupt which is blocked by local_irq_disable().
11 * 11 *
12 * In fact any XCALL which has to etrap/rtrap has a problem because 12 * In fact any XCALL which has to etrap/rtrap has a problem because
13 * it is difficult to prevent rtrap from running BH's, and that would 13 * it is difficult to prevent rtrap from running BH's, and that would
@@ -17,6 +17,7 @@
17#define PIL_SMP_RECEIVE_SIGNAL 2 17#define PIL_SMP_RECEIVE_SIGNAL 2
18#define PIL_SMP_CAPTURE 3 18#define PIL_SMP_CAPTURE 3
19#define PIL_SMP_CTX_NEW_VERSION 4 19#define PIL_SMP_CTX_NEW_VERSION 4
20#define PIL_DEVICE_IRQ 5
20 21
21#ifndef __ASSEMBLY__ 22#ifndef __ASSEMBLY__
22#define PIL_RESERVED(PIL) ((PIL) == PIL_SMP_CALL_FUNC || \ 23#define PIL_RESERVED(PIL) ((PIL) == PIL_SMP_CALL_FUNC || \
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/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/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/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/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/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/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/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/fs.h b/include/linux/fs.h
index 2d5a112e8404..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,7 +1097,7 @@ 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 vfsmount *, int); 1103 void (*umount_begin) (struct vfsmount *, int);
@@ -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 *);
@@ -1768,7 +1773,8 @@ extern void simple_release_fs(struct vfsmount **mount, int *count);
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/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/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-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/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/io.h b/include/linux/io.h
index 85533ec5aaa1..420e2fdf26f6 100644
--- a/include/linux/io.h
+++ b/include/linux/io.h
@@ -21,5 +21,6 @@
21#include <asm/io.h> 21#include <asm/io.h>
22 22
23void __iowrite32_copy(void __iomem *to, const void *from, size_t count); 23void __iowrite32_copy(void __iomem *to, const void *from, size_t count);
24void __iowrite64_copy(void __iomem *to, const void *from, size_t count);
24 25
25#endif /* _LINUX_IO_H */ 26#endif /* _LINUX_IO_H */
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..8c21aaa248b4 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); \
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/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..a02642e4710a 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)
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..5dba23a1c0d0 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -3,17 +3,17 @@
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, 14
13 struct list_head *moved, struct list_head *failed); 15extern int fail_migrate_page(struct address_space *,
14extern int migrate_pages_to(struct list_head *pagelist, 16 struct page *, struct page *);
15 struct vm_area_struct *vma, int dest);
16extern int fail_migrate_page(struct page *, struct page *);
17 17
18extern int migrate_prep(void); 18extern int migrate_prep(void);
19 19
@@ -22,8 +22,8 @@ extern int migrate_prep(void);
22static inline int isolate_lru_page(struct page *p, struct list_head *list) 22static inline int isolate_lru_page(struct page *p, struct list_head *list)
23 { return -ENOSYS; } 23 { return -ENOSYS; }
24static inline int putback_lru_pages(struct list_head *l) { return 0; } 24static inline int putback_lru_pages(struct list_head *l) { return 0; }
25static inline int migrate_pages(struct list_head *l, struct list_head *t, 25static inline int migrate_pages(struct list_head *l, new_page_t x,
26 struct list_head *moved, struct list_head *failed) { return -ENOSYS; } 26 unsigned long private) { return -ENOSYS; }
27 27
28static inline int migrate_pages_to(struct list_head *pagelist, 28static inline int migrate_pages_to(struct list_head *pagelist,
29 struct vm_area_struct *vma, int dest) { return 0; } 29 struct vm_area_struct *vma, int dest) { return 0; }
diff --git a/include/linux/mm.h b/include/linux/mm.h
index e2fa375e478e..3b09444121d9 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -199,6 +199,10 @@ struct vm_operations_struct {
199 void (*close)(struct vm_area_struct * area); 199 void (*close)(struct vm_area_struct * area);
200 struct page * (*nopage)(struct vm_area_struct * area, unsigned long address, int *type); 200 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); 201 int (*populate)(struct vm_area_struct * area, unsigned long address, unsigned long len, pgprot_t prot, unsigned long pgoff, int nonblock);
202
203 /* notification that a previously read-only page is about to become
204 * writable, if an error is returned it will cause a SIGBUS */
205 int (*page_mkwrite)(struct vm_area_struct *vma, struct page *page);
202#ifdef CONFIG_NUMA 206#ifdef CONFIG_NUMA
203 int (*set_policy)(struct vm_area_struct *vma, struct mempolicy *new); 207 int (*set_policy)(struct vm_area_struct *vma, struct mempolicy *new);
204 struct mempolicy *(*get_policy)(struct vm_area_struct *vma, 208 struct mempolicy *(*get_policy)(struct vm_area_struct *vma,
@@ -465,10 +469,13 @@ static inline unsigned long page_zonenum(struct page *page)
465struct zone; 469struct zone;
466extern struct zone *zone_table[]; 470extern struct zone *zone_table[];
467 471
472static inline int page_zone_id(struct page *page)
473{
474 return (page->flags >> ZONETABLE_PGSHIFT) & ZONETABLE_MASK;
475}
468static inline struct zone *page_zone(struct page *page) 476static inline struct zone *page_zone(struct page *page)
469{ 477{
470 return zone_table[(page->flags >> ZONETABLE_PGSHIFT) & 478 return zone_table[page_zone_id(page)];
471 ZONETABLE_MASK];
472} 479}
473 480
474static inline unsigned long page_to_nid(struct page *page) 481static 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 9b4e0071b92e..403d1a97c512 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -17,6 +17,11 @@
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
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 5e8e2d50429a..bc747e5d7138 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -232,6 +232,7 @@ enum netdev_state_t
232 __LINK_STATE_RX_SCHED, 232 __LINK_STATE_RX_SCHED,
233 __LINK_STATE_LINKWATCH_PENDING, 233 __LINK_STATE_LINKWATCH_PENDING,
234 __LINK_STATE_DORMANT, 234 __LINK_STATE_DORMANT,
235 __LINK_STATE_QDISC_RUNNING,
235}; 236};
236 237
237 238
@@ -307,9 +308,13 @@ struct net_device
307#define NETIF_F_HW_VLAN_RX 256 /* Receive VLAN hw acceleration */ 308#define NETIF_F_HW_VLAN_RX 256 /* Receive VLAN hw acceleration */
308#define NETIF_F_HW_VLAN_FILTER 512 /* Receive filtering on VLAN */ 309#define NETIF_F_HW_VLAN_FILTER 512 /* Receive filtering on VLAN */
309#define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */ 310#define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */
310#define NETIF_F_TSO 2048 /* Can offload TCP/IP segmentation */ 311#define NETIF_F_GSO 2048 /* Enable software GSO. */
311#define NETIF_F_LLTX 4096 /* LockLess TX */ 312#define NETIF_F_LLTX 4096 /* LockLess TX */
312#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)
313 318
314#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)
315#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)
@@ -401,6 +406,9 @@ struct net_device
401 struct list_head qdisc_list; 406 struct list_head qdisc_list;
402 unsigned long tx_queue_len; /* Max frames per queue allowed */ 407 unsigned long tx_queue_len; /* Max frames per queue allowed */
403 408
409 /* Partially transmitted GSO packet. */
410 struct sk_buff *gso_skb;
411
404 /* ingress path synchronizer */ 412 /* ingress path synchronizer */
405 spinlock_t ingress_lock; 413 spinlock_t ingress_lock;
406 struct Qdisc *qdisc_ingress; 414 struct Qdisc *qdisc_ingress;
@@ -535,6 +543,7 @@ struct packet_type {
535 struct net_device *, 543 struct net_device *,
536 struct packet_type *, 544 struct packet_type *,
537 struct net_device *); 545 struct net_device *);
546 struct sk_buff *(*gso_segment)(struct sk_buff *skb, int sg);
538 void *af_packet_priv; 547 void *af_packet_priv;
539 struct list_head list; 548 struct list_head list;
540}; 549};
@@ -685,7 +694,8 @@ extern int dev_change_name(struct net_device *, char *);
685extern int dev_set_mtu(struct net_device *, int); 694extern int dev_set_mtu(struct net_device *, int);
686extern int dev_set_mac_address(struct net_device *, 695extern int dev_set_mac_address(struct net_device *,
687 struct sockaddr *); 696 struct sockaddr *);
688extern 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);
689 699
690extern void dev_init(void); 700extern void dev_init(void);
691 701
@@ -959,6 +969,7 @@ extern int netdev_max_backlog;
959extern int weight_p; 969extern int weight_p;
960extern 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);
961extern 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);
962#ifdef CONFIG_BUG 973#ifdef CONFIG_BUG
963extern void netdev_rx_csum_fault(struct net_device *dev); 974extern void netdev_rx_csum_fault(struct net_device *dev);
964#else 975#else
@@ -978,6 +989,13 @@ extern void dev_seq_stop(struct seq_file *seq, void *v);
978 989
979extern void linkwatch_run_queue(void); 990extern void linkwatch_run_queue(void);
980 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
981#endif /* __KERNEL__ */ 999#endif /* __KERNEL__ */
982 1000
983#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/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/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/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/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/sched.h b/include/linux/sched.h
index 267f15257040..38b4791e6a5d 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -941,12 +941,11 @@ static inline void put_task_struct(struct task_struct *t)
941#define PF_KSWAPD 0x00040000 /* I am kswapd */ 941#define PF_KSWAPD 0x00040000 /* I am kswapd */
942#define PF_SWAPOFF 0x00080000 /* I am in swapoff */ 942#define PF_SWAPOFF 0x00080000 /* I am in swapoff */
943#define PF_LESS_THROTTLE 0x00100000 /* Throttle me less: I clean memory */ 943#define PF_LESS_THROTTLE 0x00100000 /* Throttle me less: I clean memory */
944#define PF_SYNCWRITE 0x00200000 /* I am doing a sync write */ 944#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 */ 945#define PF_RANDOMIZE 0x00400000 /* randomize virtual address space */
946#define PF_RANDOMIZE 0x00800000 /* randomize virtual address space */ 946#define PF_SWAPWRITE 0x00800000 /* Allowed to write to swap */
947#define PF_SWAPWRITE 0x01000000 /* Allowed to write to swap */ 947#define PF_SPREAD_PAGE 0x01000000 /* Spread page cache over cpuset */
948#define PF_SPREAD_PAGE 0x04000000 /* Spread page cache over cpuset */ 948#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 */ 949#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */
951 950
952/* 951/*
@@ -1225,7 +1224,7 @@ static inline int thread_group_empty(task_t *p)
1225 (thread_group_leader(p) && !thread_group_empty(p)) 1224 (thread_group_leader(p) && !thread_group_empty(p))
1226 1225
1227/* 1226/*
1228 * Protects ->fs, ->files, ->mm, ->ptrace, ->group_info, ->comm, keyring 1227 * Protects ->fs, ->files, ->mm, ->group_info, ->comm, keyring
1229 * subscriptions and synchronises with wait4(). Also used in procfs. Also 1228 * subscriptions and synchronises with wait4(). Also used in procfs. Also
1230 * pins the final release of task.io_context. Also protects ->cpuset. 1229 * pins the final release of task.io_context. Also protects ->cpuset.
1231 * 1230 *
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 94b9286cf6bd..0ef50baa7da6 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -67,8 +67,8 @@
67/* Parisc type numbers. */ 67/* Parisc type numbers. */
68#define PORT_MUX 48 68#define PORT_MUX 48
69 69
70/* Atmel AT91RM9200 SoC */ 70/* Atmel AT91xxx SoC */
71#define PORT_AT91RM9200 49 71#define PORT_AT91 49
72 72
73/* Macintosh Zilog type numbers */ 73/* Macintosh Zilog type numbers */
74#define PORT_MAC_ZILOG 50 /* m68k : not yet implemented */ 74#define PORT_MAC_ZILOG 50 /* m68k : not yet implemented */
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/suspend.h b/include/linux/suspend.h
index 96e31aa64cc7..e82cb10fb3ea 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -71,6 +71,7 @@ struct saved_context;
71void __save_processor_state(struct saved_context *ctxt); 71void __save_processor_state(struct saved_context *ctxt);
72void __restore_processor_state(struct saved_context *ctxt); 72void __restore_processor_state(struct saved_context *ctxt);
73unsigned long get_safe_page(gfp_t gfp_mask); 73unsigned long get_safe_page(gfp_t gfp_mask);
74int swsusp_add_arch_pages(unsigned long start, unsigned long end);
74 75
75/* 76/*
76 * XXX: We try to keep some more pages free so that I/O operations succeed 77 * XXX: We try to keep some more pages free so that I/O operations succeed
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/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..c7132029af0f 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -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
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/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/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/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/pkt_sched.h b/include/net/pkt_sched.h
index b94d1ad92c4d..75b5b9333fc7 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -218,12 +218,13 @@ extern struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r,
218 struct rtattr *tab); 218 struct rtattr *tab);
219extern void qdisc_put_rtab(struct qdisc_rate_table *tab); 219extern void qdisc_put_rtab(struct qdisc_rate_table *tab);
220 220
221extern int qdisc_restart(struct net_device *dev); 221extern void __qdisc_run(struct net_device *dev);
222 222
223static inline void qdisc_run(struct net_device *dev) 223static inline void qdisc_run(struct net_device *dev)
224{ 224{
225 while (!netif_queue_stopped(dev) && qdisc_restart(dev) < 0) 225 if (!netif_queue_stopped(dev) &&
226 /* NOTHING */; 226 !test_and_set_bit(__LINK_STATE_QDISC_RUNNING, &dev->state))
227 __qdisc_run(dev);
227} 228}
228 229
229extern int tc_classify(struct sk_buff *skb, struct tcf_proto *tp, 230extern int tc_classify(struct sk_buff *skb, struct tcf_proto *tp,
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/sctp/sctp.h b/include/net/sctp/sctp.h
index 237f82b05e40..a9663b49ea54 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -254,7 +254,7 @@ extern int sctp_debug_flag;
254#define SCTP_DEBUG_PRINTK_IPADDR(whatever...) 254#define SCTP_DEBUG_PRINTK_IPADDR(whatever...)
255#define SCTP_ENABLE_DEBUG 255#define SCTP_ENABLE_DEBUG
256#define SCTP_DISABLE_DEBUG 256#define SCTP_DISABLE_DEBUG
257#define SCTP_ASSERT(expr, str, func) BUG_ON(!(expr)) 257#define SCTP_ASSERT(expr, str, func)
258 258
259#endif /* SCTP_DEBUG */ 259#endif /* SCTP_DEBUG */
260 260
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/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)"