aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-09-14 08:57:30 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-09-14 08:57:30 -0400
commitdbaa9a9d2b37d838125fb7f2b9fdc5dc5fa4eaa9 (patch)
tree8641efeba632bddfa0e486b41a5f19578b1a1a31 /include
parent142e27fc8a3619471669d6241784eec9167c47d1 (diff)
parent2f4ba45a75d6383b4a1201169a808ffea416ffa0 (diff)
Merge /spare/repo/linux-2.6/
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acconfig.h29
-rw-r--r--include/acpi/acdebug.h259
-rw-r--r--include/acpi/acdisasm.h322
-rw-r--r--include/acpi/acdispat.h405
-rw-r--r--include/acpi/acevents.h241
-rw-r--r--include/acpi/acexcep.h34
-rw-r--r--include/acpi/acglobal.h271
-rw-r--r--include/acpi/achware.h107
-rw-r--r--include/acpi/acinterp.h626
-rw-r--r--include/acpi/aclocal.h722
-rw-r--r--include/acpi/acmacros.h145
-rw-r--r--include/acpi/acnames.h13
-rw-r--r--include/acpi/acnamesp.h357
-rw-r--r--include/acpi/acobject.h390
-rw-r--r--include/acpi/acopcode.h6
-rw-r--r--include/acpi/acoutput.h10
-rw-r--r--include/acpi/acparser.h255
-rw-r--r--include/acpi/acpi.h35
-rw-r--r--include/acpi/acpi_bus.h334
-rw-r--r--include/acpi/acpi_drivers.h40
-rw-r--r--include/acpi/acpiosxf.h264
-rw-r--r--include/acpi/acpixf.h408
-rw-r--r--include/acpi/acresrc.h309
-rw-r--r--include/acpi/acstruct.h221
-rw-r--r--include/acpi/actables.h121
-rw-r--r--include/acpi/actbl.h282
-rw-r--r--include/acpi/actbl1.h141
-rw-r--r--include/acpi/actbl2.h260
-rw-r--r--include/acpi/actbl71.h148
-rw-r--r--include/acpi/actypes.h807
-rw-r--r--include/acpi/acutils.h718
-rw-r--r--include/acpi/amlcode.h172
-rw-r--r--include/acpi/amlresrc.h380
-rw-r--r--include/acpi/container.h3
-rw-r--r--include/acpi/pdc_intel.h4
-rw-r--r--include/acpi/platform/acenv.h70
-rw-r--r--include/acpi/platform/acgcc.h10
-rw-r--r--include/acpi/platform/aclinux.h15
-rw-r--r--include/acpi/processor.h238
-rw-r--r--include/asm-alpha/pci.h13
-rw-r--r--include/asm-alpha/spinlock.h96
-rw-r--r--include/asm-alpha/spinlock_types.h20
-rw-r--r--include/asm-arm/arch-pxa/hardware.h18
-rw-r--r--include/asm-arm/arch-pxa/i2c.h70
-rw-r--r--include/asm-arm/arch-pxa/mmc.h1
-rw-r--r--include/asm-arm/arch-pxa/pxafb.h1
-rw-r--r--include/asm-arm/arch-s3c2410/fb.h69
-rw-r--r--include/asm-arm/arch-s3c2410/regs-lcd.h17
-rw-r--r--include/asm-arm/arch-sa1100/hardware.h18
-rw-r--r--include/asm-arm/cacheflush.h7
-rw-r--r--include/asm-arm/pci.h13
-rw-r--r--include/asm-arm/spinlock.h50
-rw-r--r--include/asm-arm/spinlock_types.h20
-rw-r--r--include/asm-arm/unistd.h3
-rw-r--r--include/asm-arm26/hardirq.h2
-rw-r--r--include/asm-generic/pci.h13
-rw-r--r--include/asm-generic/tlb.h6
-rw-r--r--include/asm-generic/vmlinux.lds.h38
-rw-r--r--include/asm-i386/acpi.h20
-rw-r--r--include/asm-i386/apic.h2
-rw-r--r--include/asm-i386/div64.h2
-rw-r--r--include/asm-i386/fixmap.h2
-rw-r--r--include/asm-i386/io_apic.h4
-rw-r--r--include/asm-i386/mach-default/mach_reboot.h10
-rw-r--r--include/asm-i386/mmzone.h2
-rw-r--r--include/asm-i386/mpspec.h4
-rw-r--r--include/asm-i386/numa.h3
-rw-r--r--include/asm-i386/processor.h4
-rw-r--r--include/asm-i386/spinlock.h200
-rw-r--r--include/asm-i386/spinlock_types.h20
-rw-r--r--include/asm-i386/thread_info.h2
-rw-r--r--include/asm-i386/topology.h2
-rw-r--r--include/asm-i386/unistd.h12
-rw-r--r--include/asm-ia64/acpi-ext.h1
-rw-r--r--include/asm-ia64/iosapic.h4
-rw-r--r--include/asm-ia64/irq.h4
-rw-r--r--include/asm-ia64/mca.h102
-rw-r--r--include/asm-ia64/mca_asm.h125
-rw-r--r--include/asm-ia64/pci.h13
-rw-r--r--include/asm-ia64/ptrace.h4
-rw-r--r--include/asm-ia64/sn/sn_feature_sets.h57
-rw-r--r--include/asm-ia64/sn/sn_sal.h36
-rw-r--r--include/asm-ia64/spinlock.h69
-rw-r--r--include/asm-ia64/spinlock_types.h21
-rw-r--r--include/asm-ia64/system.h1
-rw-r--r--include/asm-ia64/thread_info.h4
-rw-r--r--include/asm-ia64/unwind.h7
-rw-r--r--include/asm-m32r/spinlock.h127
-rw-r--r--include/asm-m32r/spinlock_types.h23
-rw-r--r--include/asm-m68knommu/bitops.h2
-rw-r--r--include/asm-m68knommu/cacheflush.h29
-rw-r--r--include/asm-m68knommu/checksum.h7
-rw-r--r--include/asm-m68knommu/coldfire.h6
-rw-r--r--include/asm-m68knommu/m523xsim.h46
-rw-r--r--include/asm-m68knommu/m527xsim.h21
-rw-r--r--include/asm-m68knommu/m528xsim.h112
-rw-r--r--include/asm-m68knommu/mcfcache.h25
-rw-r--r--include/asm-m68knommu/mcfdma.h2
-rw-r--r--include/asm-m68knommu/mcfsim.h6
-rw-r--r--include/asm-m68knommu/mcfuart.h2
-rw-r--r--include/asm-m68knommu/scatterlist.h6
-rw-r--r--include/asm-m68knommu/system.h54
-rw-r--r--include/asm-mips/asmmacro-32.h2
-rw-r--r--include/asm-mips/asmmacro-64.h2
-rw-r--r--include/asm-mips/irq.h3
-rw-r--r--include/asm-mips/sim.h2
-rw-r--r--include/asm-mips/spinlock.h75
-rw-r--r--include/asm-mips/spinlock_types.h20
-rw-r--r--include/asm-mips/stackframe.h2
-rw-r--r--include/asm-mips/vr41xx/tb0287.h43
-rw-r--r--include/asm-parisc/assembly.h2
-rw-r--r--include/asm-parisc/atomic.h12
-rw-r--r--include/asm-parisc/bitops.h2
-rw-r--r--include/asm-parisc/cacheflush.h1
-rw-r--r--include/asm-parisc/pci.h13
-rw-r--r--include/asm-parisc/processor.h1
-rw-r--r--include/asm-parisc/spinlock.h163
-rw-r--r--include/asm-parisc/spinlock_types.h21
-rw-r--r--include/asm-parisc/system.h24
-rw-r--r--include/asm-powerpc/8253pit.h8
-rw-r--r--include/asm-powerpc/agp.h8
-rw-r--r--include/asm-powerpc/bugs.h8
-rw-r--r--include/asm-powerpc/errno.h6
-rw-r--r--include/asm-powerpc/ioctl.h6
-rw-r--r--include/asm-powerpc/ioctls.h6
-rw-r--r--include/asm-powerpc/linkage.h6
-rw-r--r--include/asm-powerpc/mc146818rtc.h6
-rw-r--r--include/asm-powerpc/mman.h6
-rw-r--r--include/asm-powerpc/module.h6
-rw-r--r--include/asm-powerpc/msgbuf.h (renamed from include/asm-ppc/msgbuf.h)16
-rw-r--r--include/asm-powerpc/namei.h14
-rw-r--r--include/asm-powerpc/param.h (renamed from include/asm-ppc/param.h)8
-rw-r--r--include/asm-powerpc/poll.h6
-rw-r--r--include/asm-powerpc/sembuf.h6
-rw-r--r--include/asm-powerpc/setup.h9
-rw-r--r--include/asm-powerpc/shmbuf.h14
-rw-r--r--include/asm-powerpc/shmparam.h6
-rw-r--r--include/asm-powerpc/siginfo.h14
-rw-r--r--include/asm-powerpc/socket.h6
-rw-r--r--include/asm-powerpc/sockios.h6
-rw-r--r--include/asm-powerpc/string.h6
-rw-r--r--include/asm-powerpc/termbits.h6
-rw-r--r--include/asm-powerpc/termios.h6
-rw-r--r--include/asm-powerpc/timex.h (renamed from include/asm-ppc/timex.h)37
-rw-r--r--include/asm-powerpc/topology.h (renamed from include/asm-ppc64/topology.h)9
-rw-r--r--include/asm-powerpc/unaligned.h9
-rw-r--r--include/asm-powerpc/user.h (renamed from include/asm-ppc/user.h)15
-rw-r--r--include/asm-ppc/irq.h4
-rw-r--r--include/asm-ppc/pci.h13
-rw-r--r--include/asm-ppc/ptrace.h7
-rw-r--r--include/asm-ppc/reg.h6
-rw-r--r--include/asm-ppc/setup.h14
-rw-r--r--include/asm-ppc/smp.h6
-rw-r--r--include/asm-ppc/spinlock.h91
-rw-r--r--include/asm-ppc/spinlock_types.h20
-rw-r--r--include/asm-ppc/system.h1
-rw-r--r--include/asm-ppc/topology.h6
-rw-r--r--include/asm-ppc64/eeh.h39
-rw-r--r--include/asm-ppc64/hvcall.h6
-rw-r--r--include/asm-ppc64/io.h42
-rw-r--r--include/asm-ppc64/machdep.h5
-rw-r--r--include/asm-ppc64/msgbuf.h27
-rw-r--r--include/asm-ppc64/param.h31
-rw-r--r--include/asm-ppc64/pci-bridge.h50
-rw-r--r--include/asm-ppc64/pci.h13
-rw-r--r--include/asm-ppc64/plpar_wrappers.h9
-rw-r--r--include/asm-ppc64/processor.h1
-rw-r--r--include/asm-ppc64/prom.h19
-rw-r--r--include/asm-ppc64/ptrace-common.h92
-rw-r--r--include/asm-ppc64/ptrace.h128
-rw-r--r--include/asm-ppc64/segment.h6
-rw-r--r--include/asm-ppc64/setup.h6
-rw-r--r--include/asm-ppc64/spinlock.h191
-rw-r--r--include/asm-ppc64/spinlock_types.h20
-rw-r--r--include/asm-ppc64/system.h3
-rw-r--r--include/asm-ppc64/timex.h26
-rw-r--r--include/asm-ppc64/user.h58
-rw-r--r--include/asm-s390/spinlock.h63
-rw-r--r--include/asm-s390/spinlock_types.h21
-rw-r--r--include/asm-sh/irq.h4
-rw-r--r--include/asm-sh/spinlock.h61
-rw-r--r--include/asm-sh/spinlock_types.h22
-rw-r--r--include/asm-sparc/ptrace.h4
-rw-r--r--include/asm-sparc/spinlock.h140
-rw-r--r--include/asm-sparc/spinlock_types.h20
-rw-r--r--include/asm-sparc64/pci.h2
-rw-r--r--include/asm-sparc64/spinlock.h160
-rw-r--r--include/asm-sparc64/spinlock_types.h20
-rw-r--r--include/asm-sparc64/system.h49
-rw-r--r--include/asm-um/page.h3
-rw-r--r--include/asm-um/pgtable.h16
-rw-r--r--include/asm-um/spinlock_types.h6
-rw-r--r--include/asm-x86_64/acpi.h27
-rw-r--r--include/asm-x86_64/apic.h3
-rw-r--r--include/asm-x86_64/apicdef.h1
-rw-r--r--include/asm-x86_64/bug.h10
-rw-r--r--include/asm-x86_64/calling.h23
-rw-r--r--include/asm-x86_64/current.h2
-rw-r--r--include/asm-x86_64/desc.h2
-rw-r--r--include/asm-x86_64/dma-mapping.h5
-rw-r--r--include/asm-x86_64/dwarf2.h8
-rw-r--r--include/asm-x86_64/fixmap.h2
-rw-r--r--include/asm-x86_64/hardirq.h9
-rw-r--r--include/asm-x86_64/hw_irq.h18
-rw-r--r--include/asm-x86_64/io.h14
-rw-r--r--include/asm-x86_64/io_apic.h2
-rw-r--r--include/asm-x86_64/ipi.h23
-rw-r--r--include/asm-x86_64/irq.h4
-rw-r--r--include/asm-x86_64/kdebug.h4
-rw-r--r--include/asm-x86_64/local.h4
-rw-r--r--include/asm-x86_64/mmzone.h4
-rw-r--r--include/asm-x86_64/mpspec.h2
-rw-r--r--include/asm-x86_64/msr.h49
-rw-r--r--include/asm-x86_64/numa.h3
-rw-r--r--include/asm-x86_64/page.h4
-rw-r--r--include/asm-x86_64/pci.h6
-rw-r--r--include/asm-x86_64/pda.h14
-rw-r--r--include/asm-x86_64/pgalloc.h8
-rw-r--r--include/asm-x86_64/pgtable.h6
-rw-r--r--include/asm-x86_64/processor.h12
-rw-r--r--include/asm-x86_64/proto.h6
-rw-r--r--include/asm-x86_64/signal.h10
-rw-r--r--include/asm-x86_64/smp.h2
-rw-r--r--include/asm-x86_64/spinlock.h164
-rw-r--r--include/asm-x86_64/spinlock_types.h20
-rw-r--r--include/asm-x86_64/system.h8
-rw-r--r--include/asm-x86_64/timex.h1
-rw-r--r--include/asm-x86_64/tlbflush.h4
-rw-r--r--include/asm-x86_64/topology.h3
-rw-r--r--include/asm-x86_64/vsyscall.h1
-rw-r--r--include/asm-xtensa/ptrace.h2
-rw-r--r--include/asm-xtensa/uaccess.h2
-rw-r--r--include/linux/acpi.h45
-rw-r--r--include/linux/bfs_fs.h23
-rw-r--r--include/linux/bio.h7
-rw-r--r--include/linux/bit_spinlock.h77
-rw-r--r--include/linux/blkdev.h2
-rw-r--r--include/linux/chio.h2
-rw-r--r--include/linux/connector.h158
-rw-r--r--include/linux/crc16.h30
-rw-r--r--include/linux/dccp.h3
-rw-r--r--include/linux/dmapool.h3
-rw-r--r--include/linux/dmi.h2
-rw-r--r--include/linux/fb.h28
-rw-r--r--include/linux/file.h30
-rw-r--r--include/linux/fs.h6
-rw-r--r--include/linux/fuse.h259
-rw-r--r--include/linux/i2c-pxa.h48
-rw-r--r--include/linux/in6.h52
-rw-r--r--include/linux/init_task.h18
-rw-r--r--include/linux/input.h8
-rw-r--r--include/linux/interrupt.h7
-rw-r--r--include/linux/ipv6.h17
-rw-r--r--include/linux/jbd.h1
-rw-r--r--include/linux/jiffies.h40
-rw-r--r--include/linux/mempolicy.h1
-rw-r--r--include/linux/mmc/host.h10
-rw-r--r--include/linux/netlink.h1
-rw-r--r--include/linux/pci.h519
-rw-r--r--include/linux/pci_regs.h448
-rw-r--r--include/linux/radix-tree.h4
-rw-r--r--include/linux/raid/bitmap.h15
-rw-r--r--include/linux/raid/linear.h4
-rw-r--r--include/linux/raid/md_k.h81
-rw-r--r--include/linux/raid/md_p.h16
-rw-r--r--include/linux/raid/raid1.h13
-rw-r--r--include/linux/raid/raid5.h14
-rw-r--r--include/linux/rcupdate.h4
-rw-r--r--include/linux/rcuref.h220
-rw-r--r--include/linux/reiserfs_fs.h6
-rw-r--r--include/linux/sched.h10
-rw-r--r--include/linux/security.h180
-rw-r--r--include/linux/serial_8250.h15
-rw-r--r--include/linux/serial_core.h3
-rw-r--r--include/linux/skbuff.h2
-rw-r--r--include/linux/slab.h3
-rw-r--r--include/linux/spinlock.h627
-rw-r--r--include/linux/spinlock_api_smp.h57
-rw-r--r--include/linux/spinlock_api_up.h80
-rw-r--r--include/linux/spinlock_types.h67
-rw-r--r--include/linux/spinlock_types_up.h51
-rw-r--r--include/linux/spinlock_up.h74
-rw-r--r--include/linux/sysctl.h3
-rw-r--r--include/linux/time.h9
-rw-r--r--include/linux/timer.h4
-rw-r--r--include/linux/tty.h3
-rw-r--r--include/linux/usb.h11
-rw-r--r--include/linux/usb_isp116x.h30
-rw-r--r--include/linux/usbdevice_fs.h2
-rw-r--r--include/linux/videodev.h3
-rw-r--r--include/linux/videodev2.h4
-rw-r--r--include/linux/writeback.h2
-rw-r--r--include/media/audiochip.h1
-rw-r--r--include/media/id.h1
-rw-r--r--include/media/ir-common.h4
-rw-r--r--include/media/saa7146.h13
-rw-r--r--include/media/tuner.h193
-rw-r--r--include/media/tveeprom.h9
-rw-r--r--include/media/video-buf.h1
-rw-r--r--include/net/ax25.h33
-rw-r--r--include/net/compat.h5
-rw-r--r--include/net/ipv6.h5
-rw-r--r--include/net/netrom.h32
-rw-r--r--include/net/transp_v6.h2
-rw-r--r--include/pcmcia/ds.h2
-rw-r--r--include/rdma/ib_cm.h1
-rw-r--r--include/rdma/ib_mad.h21
-rw-r--r--include/rdma/ib_sa.h31
-rw-r--r--include/rdma/ib_user_cm.h72
-rw-r--r--include/rdma/ib_user_verbs.h21
-rw-r--r--include/scsi/scsi_device.h4
-rw-r--r--include/scsi/scsi_transport_fc.h8
-rw-r--r--include/scsi/scsi_transport_sas.h100
-rw-r--r--include/sound/pcm.h5
-rw-r--r--include/sound/tea575x-tuner.h2
-rw-r--r--include/video/cyblafb.h171
-rw-r--r--include/video/sisfb.h188
317 files changed, 8665 insertions, 9244 deletions
diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h
index 2f6ab189fc6f..427cff1a3f83 100644
--- a/include/acpi/acconfig.h
+++ b/include/acpi/acconfig.h
@@ -44,7 +44,6 @@
44#ifndef _ACCONFIG_H 44#ifndef _ACCONFIG_H
45#define _ACCONFIG_H 45#define _ACCONFIG_H
46 46
47
48/****************************************************************************** 47/******************************************************************************
49 * 48 *
50 * Configuration options 49 * Configuration options
@@ -64,7 +63,7 @@
64 63
65/* Version string */ 64/* Version string */
66 65
67#define ACPI_CA_VERSION 0x20050408 66#define ACPI_CA_VERSION 0x20050902
68 67
69/* 68/*
70 * 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,
@@ -78,11 +77,10 @@
78 77
79/* Maximum objects in the various object caches */ 78/* Maximum objects in the various object caches */
80 79
81#define ACPI_MAX_STATE_CACHE_DEPTH 64 /* State objects */ 80#define ACPI_MAX_STATE_CACHE_DEPTH 96 /* State objects */
82#define ACPI_MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */ 81#define ACPI_MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */
83#define ACPI_MAX_EXTPARSE_CACHE_DEPTH 64 /* Parse tree objects */ 82#define ACPI_MAX_EXTPARSE_CACHE_DEPTH 96 /* Parse tree objects */
84#define ACPI_MAX_OBJECT_CACHE_DEPTH 64 /* Interpreter operand objects */ 83#define ACPI_MAX_OBJECT_CACHE_DEPTH 96 /* Interpreter operand objects */
85#define ACPI_MAX_WALK_CACHE_DEPTH 4 /* Objects for parse tree walks */
86 84
87/* 85/*
88 * Should the subystem abort the loading of an ACPI table if the 86 * Should the subystem abort the loading of an ACPI table if the
@@ -90,7 +88,6 @@
90 */ 88 */
91#define ACPI_CHECKSUM_ABORT FALSE 89#define ACPI_CHECKSUM_ABORT FALSE
92 90
93
94/****************************************************************************** 91/******************************************************************************
95 * 92 *
96 * Subsystem Constants 93 * Subsystem Constants
@@ -104,7 +101,7 @@
104/* String size constants */ 101/* String size constants */
105 102
106#define ACPI_MAX_STRING_LENGTH 512 103#define ACPI_MAX_STRING_LENGTH 512
107#define ACPI_PATHNAME_MAX 256 /* A full namespace pathname */ 104#define ACPI_PATHNAME_MAX 256 /* A full namespace pathname */
108 105
109/* Maximum count for a semaphore object */ 106/* Maximum count for a semaphore object */
110 107
@@ -118,7 +115,6 @@
118 115
119#define ACPI_SYSMEM_REGION_WINDOW_SIZE 4096 116#define ACPI_SYSMEM_REGION_WINDOW_SIZE 4096
120 117
121
122/****************************************************************************** 118/******************************************************************************
123 * 119 *
124 * ACPI Specification constants (Do not change unless the specification changes) 120 * ACPI Specification constants (Do not change unless the specification changes)
@@ -156,15 +152,15 @@
156/* Names within the namespace are 4 bytes long */ 152/* Names within the namespace are 4 bytes long */
157 153
158#define ACPI_NAME_SIZE 4 154#define ACPI_NAME_SIZE 4
159#define ACPI_PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 char for separator */ 155#define ACPI_PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 char for separator */
160#define ACPI_PATH_SEPARATOR '.' 156#define ACPI_PATH_SEPARATOR '.'
161 157
162/* Constants used in searching for the RSDP in low memory */ 158/* Constants used in searching for the RSDP in low memory */
163 159
164#define ACPI_EBDA_PTR_LOCATION 0x0000040E /* Physical Address */ 160#define ACPI_EBDA_PTR_LOCATION 0x0000040E /* Physical Address */
165#define ACPI_EBDA_PTR_LENGTH 2 161#define ACPI_EBDA_PTR_LENGTH 2
166#define ACPI_EBDA_WINDOW_SIZE 1024 162#define ACPI_EBDA_WINDOW_SIZE 1024
167#define ACPI_HI_RSDP_WINDOW_BASE 0x000E0000 /* Physical Address */ 163#define ACPI_HI_RSDP_WINDOW_BASE 0x000E0000 /* Physical Address */
168#define ACPI_HI_RSDP_WINDOW_SIZE 0x00020000 164#define ACPI_HI_RSDP_WINDOW_SIZE 0x00020000
169#define ACPI_RSDP_SCAN_STEP 16 165#define ACPI_RSDP_SCAN_STEP 16
170 166
@@ -199,18 +195,15 @@
199 195
200#define ACPI_NUM_OSI_STRINGS 10 196#define ACPI_NUM_OSI_STRINGS 10
201 197
202
203/****************************************************************************** 198/******************************************************************************
204 * 199 *
205 * ACPI AML Debugger 200 * ACPI AML Debugger
206 * 201 *
207 *****************************************************************************/ 202 *****************************************************************************/
208 203
209#define ACPI_DEBUGGER_MAX_ARGS 8 /* Must be max method args + 1 */ 204#define ACPI_DEBUGGER_MAX_ARGS 8 /* Must be max method args + 1 */
210 205
211#define ACPI_DEBUGGER_COMMAND_PROMPT '-' 206#define ACPI_DEBUGGER_COMMAND_PROMPT '-'
212#define ACPI_DEBUGGER_EXECUTE_PROMPT '%' 207#define ACPI_DEBUGGER_EXECUTE_PROMPT '%'
213 208
214 209#endif /* _ACCONFIG_H */
215#endif /* _ACCONFIG_H */
216
diff --git a/include/acpi/acdebug.h b/include/acpi/acdebug.h
index 8ba372b0f245..70ce3b4d006e 100644
--- a/include/acpi/acdebug.h
+++ b/include/acpi/acdebug.h
@@ -44,22 +44,17 @@
44#ifndef __ACDEBUG_H__ 44#ifndef __ACDEBUG_H__
45#define __ACDEBUG_H__ 45#define __ACDEBUG_H__
46 46
47
48#define ACPI_DEBUG_BUFFER_SIZE 4196 47#define ACPI_DEBUG_BUFFER_SIZE 4196
49 48
50struct command_info 49struct command_info {
51{ 50 char *name; /* Command Name */
52 char *name; /* Command Name */ 51 u8 min_args; /* Minimum arguments required */
53 u8 min_args; /* Minimum arguments required */
54}; 52};
55 53
56 54struct argument_info {
57struct argument_info 55 char *name; /* Argument Name */
58{
59 char *name; /* Argument Name */
60}; 56};
61 57
62
63#define PARAM_LIST(pl) pl 58#define PARAM_LIST(pl) pl
64#define DBTEST_OUTPUT_LEVEL(lvl) if (acpi_gbl_db_opt_verbose) 59#define DBTEST_OUTPUT_LEVEL(lvl) if (acpi_gbl_db_opt_verbose)
65#define VERBOSE_PRINT(fp) DBTEST_OUTPUT_LEVEL(lvl) {\ 60#define VERBOSE_PRINT(fp) DBTEST_OUTPUT_LEVEL(lvl) {\
@@ -68,275 +63,155 @@ struct argument_info
68#define EX_NO_SINGLE_STEP 1 63#define EX_NO_SINGLE_STEP 1
69#define EX_SINGLE_STEP 2 64#define EX_SINGLE_STEP 2
70 65
71
72/* 66/*
73 * dbxface - external debugger interfaces 67 * dbxface - external debugger interfaces
74 */ 68 */
75acpi_status 69acpi_status acpi_db_initialize(void);
76acpi_db_initialize (
77 void);
78 70
79void 71void acpi_db_terminate(void);
80acpi_db_terminate (
81 void);
82 72
83acpi_status 73acpi_status
84acpi_db_single_step ( 74acpi_db_single_step(struct acpi_walk_state *walk_state,
85 struct acpi_walk_state *walk_state, 75 union acpi_parse_object *op, u32 op_type);
86 union acpi_parse_object *op,
87 u32 op_type);
88
89 76
90/* 77/*
91 * dbcmds - debug commands and output routines 78 * dbcmds - debug commands and output routines
92 */ 79 */
93acpi_status 80acpi_status acpi_db_disassemble_method(char *name);
94acpi_db_disassemble_method (
95 char *name);
96 81
97void 82void acpi_db_display_table_info(char *table_arg);
98acpi_db_display_table_info (
99 char *table_arg);
100 83
101void 84void acpi_db_unload_acpi_table(char *table_arg, char *instance_arg);
102acpi_db_unload_acpi_table (
103 char *table_arg,
104 char *instance_arg);
105 85
106void 86void
107acpi_db_set_method_breakpoint ( 87acpi_db_set_method_breakpoint(char *location,
108 char *location, 88 struct acpi_walk_state *walk_state,
109 struct acpi_walk_state *walk_state, 89 union acpi_parse_object *op);
110 union acpi_parse_object *op);
111 90
112void 91void acpi_db_set_method_call_breakpoint(union acpi_parse_object *op);
113acpi_db_set_method_call_breakpoint (
114 union acpi_parse_object *op);
115 92
116void 93void acpi_db_get_bus_info(void);
117acpi_db_disassemble_aml (
118 char *statements,
119 union acpi_parse_object *op);
120 94
121void 95void acpi_db_disassemble_aml(char *statements, union acpi_parse_object *op);
122acpi_db_dump_namespace (
123 char *start_arg,
124 char *depth_arg);
125 96
126void 97void acpi_db_dump_namespace(char *start_arg, char *depth_arg);
127acpi_db_dump_namespace_by_owner (
128 char *owner_arg,
129 char *depth_arg);
130 98
131void 99void acpi_db_dump_namespace_by_owner(char *owner_arg, char *depth_arg);
132acpi_db_send_notify (
133 char *name,
134 u32 value);
135 100
136void 101void acpi_db_send_notify(char *name, u32 value);
137acpi_db_set_method_data (
138 char *type_arg,
139 char *index_arg,
140 char *value_arg);
141 102
142acpi_status 103void acpi_db_set_method_data(char *type_arg, char *index_arg, char *value_arg);
143acpi_db_display_objects (
144 char *obj_type_arg,
145 char *display_count_arg);
146 104
147acpi_status 105acpi_status
148acpi_db_find_name_in_namespace ( 106acpi_db_display_objects(char *obj_type_arg, char *display_count_arg);
149 char *name_arg);
150 107
151void 108acpi_status acpi_db_find_name_in_namespace(char *name_arg);
152acpi_db_set_scope (
153 char *name);
154 109
155acpi_status 110void acpi_db_set_scope(char *name);
156acpi_db_sleep (
157 char *object_arg);
158 111
159void 112acpi_status acpi_db_sleep(char *object_arg);
160acpi_db_find_references (
161 char *object_arg);
162 113
163void 114void acpi_db_find_references(char *object_arg);
164acpi_db_display_locks (
165 void);
166 115
167void 116void acpi_db_display_locks(void);
168acpi_db_display_resources (
169 char *object_arg);
170 117
171void 118void acpi_db_display_resources(char *object_arg);
172acpi_db_display_gpes (
173 void);
174 119
175void 120void acpi_db_display_gpes(void);
176acpi_db_check_integrity (
177 void);
178 121
179void 122void acpi_db_check_integrity(void);
180acpi_db_generate_gpe (
181 char *gpe_arg,
182 char *block_arg);
183 123
124void acpi_db_generate_gpe(char *gpe_arg, char *block_arg);
184 125
185/* 126/*
186 * dbdisply - debug display commands 127 * dbdisply - debug display commands
187 */ 128 */
188void 129void acpi_db_display_method_info(union acpi_parse_object *op);
189acpi_db_display_method_info (
190 union acpi_parse_object *op);
191 130
192void 131void acpi_db_decode_and_display_object(char *target, char *output_type);
193acpi_db_decode_and_display_object (
194 char *target,
195 char *output_type);
196 132
197void 133void
198acpi_db_display_result_object ( 134acpi_db_display_result_object(union acpi_operand_object *obj_desc,
199 union acpi_operand_object *obj_desc, 135 struct acpi_walk_state *walk_state);
200 struct acpi_walk_state *walk_state);
201 136
202acpi_status 137acpi_status acpi_db_display_all_methods(char *display_count_arg);
203acpi_db_display_all_methods (
204 char *display_count_arg);
205 138
206void 139void acpi_db_display_arguments(void);
207acpi_db_display_arguments (
208 void);
209 140
210void 141void acpi_db_display_locals(void);
211acpi_db_display_locals (
212 void);
213 142
214void 143void acpi_db_display_results(void);
215acpi_db_display_results (
216 void);
217 144
218void 145void acpi_db_display_calling_tree(void);
219acpi_db_display_calling_tree (
220 void);
221 146
222void 147void acpi_db_display_object_type(char *object_arg);
223acpi_db_display_object_type (
224 char *object_arg);
225 148
226void 149void
227acpi_db_display_argument_object ( 150acpi_db_display_argument_object(union acpi_operand_object *obj_desc,
228 union acpi_operand_object *obj_desc, 151 struct acpi_walk_state *walk_state);
229 struct acpi_walk_state *walk_state);
230
231 152
232/* 153/*
233 * dbexec - debugger control method execution 154 * dbexec - debugger control method execution
234 */ 155 */
235void 156void acpi_db_execute(char *name, char **args, u32 flags);
236acpi_db_execute (
237 char *name,
238 char **args,
239 u32 flags);
240 157
241void 158void
242acpi_db_create_execution_threads ( 159acpi_db_create_execution_threads(char *num_threads_arg,
243 char *num_threads_arg, 160 char *num_loops_arg, char *method_name_arg);
244 char *num_loops_arg,
245 char *method_name_arg);
246
247 161
248/* 162/*
249 * dbfileio - Debugger file I/O commands 163 * dbfileio - Debugger file I/O commands
250 */ 164 */
251acpi_object_type 165acpi_object_type
252acpi_db_match_argument ( 166acpi_db_match_argument(char *user_argument, struct argument_info *arguments);
253 char *user_argument,
254 struct argument_info *arguments);
255 167
256void 168void acpi_db_close_debug_file(void);
257acpi_db_close_debug_file (
258 void);
259 169
260void 170void acpi_db_open_debug_file(char *name);
261acpi_db_open_debug_file (
262 char *name);
263 171
264acpi_status 172acpi_status acpi_db_load_acpi_table(char *filename);
265acpi_db_load_acpi_table (
266 char *filename);
267 173
268acpi_status 174acpi_status
269acpi_db_get_table_from_file ( 175acpi_db_get_table_from_file(char *filename, struct acpi_table_header **table);
270 char *filename,
271 struct acpi_table_header **table);
272 176
273acpi_status 177acpi_status
274acpi_db_read_table_from_file ( 178acpi_db_read_table_from_file(char *filename, struct acpi_table_header **table);
275 char *filename,
276 struct acpi_table_header **table);
277
278 179
279/* 180/*
280 * dbhistry - debugger HISTORY command 181 * dbhistry - debugger HISTORY command
281 */ 182 */
282void 183void acpi_db_add_to_history(char *command_line);
283acpi_db_add_to_history (
284 char *command_line);
285 184
286void 185void acpi_db_display_history(void);
287acpi_db_display_history (
288 void);
289
290char *
291acpi_db_get_from_history (
292 char *command_num_arg);
293 186
187char *acpi_db_get_from_history(char *command_num_arg);
294 188
295/* 189/*
296 * dbinput - user front-end to the AML debugger 190 * dbinput - user front-end to the AML debugger
297 */ 191 */
298acpi_status 192acpi_status
299acpi_db_command_dispatch ( 193acpi_db_command_dispatch(char *input_buffer,
300 char *input_buffer, 194 struct acpi_walk_state *walk_state,
301 struct acpi_walk_state *walk_state, 195 union acpi_parse_object *op);
302 union acpi_parse_object *op);
303
304void ACPI_SYSTEM_XFACE
305acpi_db_execute_thread (
306 void *context);
307 196
197void ACPI_SYSTEM_XFACE acpi_db_execute_thread(void *context);
308 198
309/* 199/*
310 * dbstats - Generation and display of ACPI table statistics 200 * dbstats - Generation and display of ACPI table statistics
311 */ 201 */
312void 202void acpi_db_generate_statistics(union acpi_parse_object *root, u8 is_method);
313acpi_db_generate_statistics (
314 union acpi_parse_object *root,
315 u8 is_method);
316
317acpi_status
318acpi_db_display_statistics (
319 char *type_arg);
320 203
204acpi_status acpi_db_display_statistics(char *type_arg);
321 205
322/* 206/*
323 * dbutils - AML debugger utilities 207 * dbutils - AML debugger utilities
324 */ 208 */
325void 209void acpi_db_set_output_destination(u32 where);
326acpi_db_set_output_destination (
327 u32 where);
328 210
329void 211void acpi_db_dump_external_object(union acpi_object *obj_desc, u32 level);
330acpi_db_dump_object (
331 union acpi_object *obj_desc,
332 u32 level);
333 212
334void 213void acpi_db_prep_namestring(char *name);
335acpi_db_prep_namestring (
336 char *name);
337 214
338struct acpi_namespace_node * 215struct acpi_namespace_node *acpi_db_local_ns_lookup(char *name);
339acpi_db_local_ns_lookup (
340 char *name);
341 216
342#endif /* __ACDEBUG_H__ */ 217#endif /* __ACDEBUG_H__ */
diff --git a/include/acpi/acdisasm.h b/include/acpi/acdisasm.h
index dbfa877121ba..3d96dcb1bb4b 100644
--- a/include/acpi/acdisasm.h
+++ b/include/acpi/acdisasm.h
@@ -46,327 +46,219 @@
46 46
47#include "amlresrc.h" 47#include "amlresrc.h"
48 48
49
50#define BLOCK_NONE 0 49#define BLOCK_NONE 0
51#define BLOCK_PAREN 1 50#define BLOCK_PAREN 1
52#define BLOCK_BRACE 2 51#define BLOCK_BRACE 2
53#define BLOCK_COMMA_LIST 4 52#define BLOCK_COMMA_LIST 4
54 53
55struct acpi_external_list 54struct acpi_external_list {
56{ 55 char *path;
57 char *path; 56 struct acpi_external_list *next;
58 struct acpi_external_list *next;
59}; 57};
60 58
61extern struct acpi_external_list *acpi_gbl_external_list; 59extern struct acpi_external_list *acpi_gbl_external_list;
62extern const char *acpi_gbl_io_decode[2]; 60extern const char *acpi_gbl_io_decode[2];
63extern const char *acpi_gbl_word_decode[4]; 61extern const char *acpi_gbl_word_decode[4];
64extern const char *acpi_gbl_consume_decode[2]; 62extern const char *acpi_gbl_consume_decode[2];
65extern const char *acpi_gbl_min_decode[2]; 63extern const char *acpi_gbl_min_decode[2];
66extern const char *acpi_gbl_max_decode[2]; 64extern const char *acpi_gbl_max_decode[2];
67extern const char *acpi_gbl_DECdecode[2]; 65extern const char *acpi_gbl_DECdecode[2];
68extern const char *acpi_gbl_RNGdecode[4]; 66extern const char *acpi_gbl_RNGdecode[4];
69extern const char *acpi_gbl_MEMdecode[4]; 67extern const char *acpi_gbl_MEMdecode[4];
70extern const char *acpi_gbl_RWdecode[2]; 68extern const char *acpi_gbl_RWdecode[2];
71extern const char *acpi_gbl_irq_decode[2]; 69extern const char *acpi_gbl_irq_decode[2];
72extern const char *acpi_gbl_HEdecode[2]; 70extern const char *acpi_gbl_HEdecode[2];
73extern const char *acpi_gbl_LLdecode[2]; 71extern const char *acpi_gbl_LLdecode[2];
74extern const char *acpi_gbl_SHRdecode[2]; 72extern const char *acpi_gbl_SHRdecode[2];
75extern const char *acpi_gbl_TYPdecode[4]; 73extern const char *acpi_gbl_TYPdecode[4];
76extern const char *acpi_gbl_BMdecode[2]; 74extern const char *acpi_gbl_BMdecode[2];
77extern const char *acpi_gbl_SIZdecode[4]; 75extern const char *acpi_gbl_SIZdecode[4];
78extern const char *acpi_gbl_TTPdecode[2]; 76extern const char *acpi_gbl_TTPdecode[2];
79extern const char *acpi_gbl_MTPdecode[4]; 77extern const char *acpi_gbl_MTPdecode[4];
80extern const char *acpi_gbl_TRSdecode[2]; 78extern const char *acpi_gbl_TRSdecode[2];
81 79
82 80extern const char *acpi_gbl_lock_rule[ACPI_NUM_LOCK_RULES];
83extern const char *acpi_gbl_lock_rule[ACPI_NUM_LOCK_RULES]; 81extern const char *acpi_gbl_access_types[ACPI_NUM_ACCESS_TYPES];
84extern const char *acpi_gbl_access_types[ACPI_NUM_ACCESS_TYPES]; 82extern const char *acpi_gbl_update_rules[ACPI_NUM_UPDATE_RULES];
85extern const char *acpi_gbl_update_rules[ACPI_NUM_UPDATE_RULES]; 83extern const char *acpi_gbl_match_ops[ACPI_NUM_MATCH_OPS];
86extern const char *acpi_gbl_match_ops[ACPI_NUM_MATCH_OPS]; 84
87 85struct acpi_op_walk_info {
88 86 u32 level;
89struct acpi_op_walk_info 87 u32 bit_offset;
90{ 88 struct acpi_walk_state *walk_state;
91 u32 level;
92 u32 bit_offset;
93}; 89};
94 90
95typedef 91typedef
96acpi_status (*asl_walk_callback) ( 92acpi_status(*asl_walk_callback) (union acpi_parse_object * op,
97 union acpi_parse_object *op, 93 u32 level, void *context);
98 u32 level,
99 void *context);
100
101 94
102/* 95/*
103 * dmwalk 96 * dmwalk
104 */ 97 */
105void 98void
106acpi_dm_disassemble ( 99acpi_dm_disassemble(struct acpi_walk_state *walk_state,
107 struct acpi_walk_state *walk_state, 100 union acpi_parse_object *origin, u32 num_opcodes);
108 union acpi_parse_object *origin,
109 u32 num_opcodes);
110
111 101
112/* 102/*
113 * dmopcode 103 * dmopcode
114 */ 104 */
115void 105void
116acpi_dm_disassemble_one_op ( 106acpi_dm_disassemble_one_op(struct acpi_walk_state *walk_state,
117 struct acpi_walk_state *walk_state, 107 struct acpi_op_walk_info *info,
118 struct acpi_op_walk_info *info, 108 union acpi_parse_object *op);
119 union acpi_parse_object *op);
120 109
121void 110void acpi_dm_decode_internal_object(union acpi_operand_object *obj_desc);
122acpi_dm_decode_internal_object (
123 union acpi_operand_object *obj_desc);
124 111
125u32 112u32 acpi_dm_list_type(union acpi_parse_object *op);
126acpi_dm_list_type (
127 union acpi_parse_object *op);
128 113
129void 114void acpi_dm_method_flags(union acpi_parse_object *op);
130acpi_dm_method_flags (
131 union acpi_parse_object *op);
132
133void
134acpi_dm_field_flags (
135 union acpi_parse_object *op);
136 115
137void 116void acpi_dm_field_flags(union acpi_parse_object *op);
138acpi_dm_address_space (
139 u8 space_id);
140 117
141void 118void acpi_dm_address_space(u8 space_id);
142acpi_dm_region_flags (
143 union acpi_parse_object *op);
144 119
145void 120void acpi_dm_region_flags(union acpi_parse_object *op);
146acpi_dm_match_op (
147 union acpi_parse_object *op);
148 121
149u8 122void acpi_dm_match_op(union acpi_parse_object *op);
150acpi_dm_comma_if_list_member (
151 union acpi_parse_object *op);
152 123
153void 124u8 acpi_dm_comma_if_list_member(union acpi_parse_object *op);
154acpi_dm_comma_if_field_member (
155 union acpi_parse_object *op);
156 125
126void acpi_dm_comma_if_field_member(union acpi_parse_object *op);
157 127
158/* 128/*
159 * dmnames 129 * dmnames
160 */ 130 */
161u32 131u32 acpi_dm_dump_name(char *name);
162acpi_dm_dump_name (
163 char *name);
164 132
165acpi_status 133acpi_status
166acpi_ps_display_object_pathname ( 134acpi_ps_display_object_pathname(struct acpi_walk_state *walk_state,
167 struct acpi_walk_state *walk_state, 135 union acpi_parse_object *op);
168 union acpi_parse_object *op);
169
170void
171acpi_dm_namestring (
172 char *name);
173 136
137void acpi_dm_namestring(char *name);
174 138
175/* 139/*
176 * dmobject 140 * dmobject
177 */ 141 */
178void 142void
179acpi_dm_display_internal_object ( 143acpi_dm_display_internal_object(union acpi_operand_object *obj_desc,
180 union acpi_operand_object *obj_desc, 144 struct acpi_walk_state *walk_state);
181 struct acpi_walk_state *walk_state);
182 145
183void 146void acpi_dm_display_arguments(struct acpi_walk_state *walk_state);
184acpi_dm_display_arguments (
185 struct acpi_walk_state *walk_state);
186 147
187void 148void acpi_dm_display_locals(struct acpi_walk_state *walk_state);
188acpi_dm_display_locals (
189 struct acpi_walk_state *walk_state);
190 149
191void 150void
192acpi_dm_dump_method_info ( 151acpi_dm_dump_method_info(acpi_status status,
193 acpi_status status, 152 struct acpi_walk_state *walk_state,
194 struct acpi_walk_state *walk_state, 153 union acpi_parse_object *op);
195 union acpi_parse_object *op);
196
197 154
198/* 155/*
199 * dmbuffer 156 * dmbuffer
200 */ 157 */
201void 158void acpi_dm_disasm_byte_list(u32 level, u8 * byte_data, u32 byte_count);
202acpi_dm_disasm_byte_list (
203 u32 level,
204 u8 *byte_data,
205 u32 byte_count);
206 159
207void 160void
208acpi_dm_byte_list ( 161acpi_dm_byte_list(struct acpi_op_walk_info *info, union acpi_parse_object *op);
209 struct acpi_op_walk_info *info,
210 union acpi_parse_object *op);
211 162
212void 163void acpi_dm_is_eisa_id(union acpi_parse_object *op);
213acpi_is_eisa_id (
214 union acpi_parse_object *op);
215 164
216void 165void acpi_dm_eisa_id(u32 encoded_id);
217acpi_dm_eisa_id (
218 u32 encoded_id);
219
220u8
221acpi_dm_is_unicode_buffer (
222 union acpi_parse_object *op);
223 166
224u8 167u8 acpi_dm_is_unicode_buffer(union acpi_parse_object *op);
225acpi_dm_is_string_buffer (
226 union acpi_parse_object *op);
227 168
169u8 acpi_dm_is_string_buffer(union acpi_parse_object *op);
228 170
229/* 171/*
230 * dmresrc 172 * dmresrc
231 */ 173 */
232void 174void
233acpi_dm_resource_descriptor ( 175acpi_dm_resource_descriptor(struct acpi_op_walk_info *info,
234 struct acpi_op_walk_info *info, 176 u8 * byte_data, u32 byte_count);
235 u8 *byte_data,
236 u32 byte_count);
237 177
238u8 178u8 acpi_dm_is_resource_descriptor(union acpi_parse_object *op);
239acpi_dm_is_resource_descriptor (
240 union acpi_parse_object *op);
241 179
242void 180void acpi_dm_indent(u32 level);
243acpi_dm_indent (
244 u32 level);
245 181
246void 182void acpi_dm_bit_list(u16 mask);
247acpi_dm_bit_list (
248 u16 mask);
249
250void
251acpi_dm_decode_attribute (
252 u8 attribute);
253 183
184void acpi_dm_decode_attribute(u8 attribute);
254 185
255/* 186/*
256 * dmresrcl 187 * dmresrcl
257 */ 188 */
258void 189void
259acpi_dm_word_descriptor ( 190acpi_dm_word_descriptor(struct asl_word_address_desc *resource,
260 struct asl_word_address_desc *resource, 191 u32 length, u32 level);
261 u32 length,
262 u32 level);
263 192
264void 193void
265acpi_dm_dword_descriptor ( 194acpi_dm_dword_descriptor(struct asl_dword_address_desc *resource,
266 struct asl_dword_address_desc *resource, 195 u32 length, u32 level);
267 u32 length,
268 u32 level);
269 196
270void 197void
271acpi_dm_extended_descriptor ( 198acpi_dm_extended_descriptor(struct asl_extended_address_desc *resource,
272 struct asl_extended_address_desc *resource, 199 u32 length, u32 level);
273 u32 length,
274 u32 level);
275 200
276void 201void
277acpi_dm_qword_descriptor ( 202acpi_dm_qword_descriptor(struct asl_qword_address_desc *resource,
278 struct asl_qword_address_desc *resource, 203 u32 length, u32 level);
279 u32 length,
280 u32 level);
281 204
282void 205void
283acpi_dm_memory24_descriptor ( 206acpi_dm_memory24_descriptor(struct asl_memory_24_desc *resource,
284 struct asl_memory_24_desc *resource, 207 u32 length, u32 level);
285 u32 length,
286 u32 level);
287 208
288void 209void
289acpi_dm_memory32_descriptor ( 210acpi_dm_memory32_descriptor(struct asl_memory_32_desc *resource,
290 struct asl_memory_32_desc *resource, 211 u32 length, u32 level);
291 u32 length,
292 u32 level);
293 212
294void 213void
295acpi_dm_fixed_mem32_descriptor ( 214acpi_dm_fixed_mem32_descriptor(struct asl_fixed_memory_32_desc *resource,
296 struct asl_fixed_memory_32_desc *resource, 215 u32 length, u32 level);
297 u32 length,
298 u32 level);
299 216
300void 217void
301acpi_dm_generic_register_descriptor ( 218acpi_dm_generic_register_descriptor(struct asl_general_register_desc *resource,
302 struct asl_general_register_desc *resource, 219 u32 length, u32 level);
303 u32 length,
304 u32 level);
305 220
306void 221void
307acpi_dm_interrupt_descriptor ( 222acpi_dm_interrupt_descriptor(struct asl_extended_xrupt_desc *resource,
308 struct asl_extended_xrupt_desc *resource, 223 u32 length, u32 level);
309 u32 length,
310 u32 level);
311 224
312void 225void
313acpi_dm_vendor_large_descriptor ( 226acpi_dm_vendor_large_descriptor(struct asl_large_vendor_desc *resource,
314 struct asl_large_vendor_desc *resource, 227 u32 length, u32 level);
315 u32 length,
316 u32 level);
317
318 228
319/* 229/*
320 * dmresrcs 230 * dmresrcs
321 */ 231 */
322void 232void
323acpi_dm_irq_descriptor ( 233acpi_dm_irq_descriptor(struct asl_irq_format_desc *resource,
324 struct asl_irq_format_desc *resource, 234 u32 length, u32 level);
325 u32 length,
326 u32 level);
327 235
328void 236void
329acpi_dm_dma_descriptor ( 237acpi_dm_dma_descriptor(struct asl_dma_format_desc *resource,
330 struct asl_dma_format_desc *resource, 238 u32 length, u32 level);
331 u32 length,
332 u32 level);
333 239
334void 240void
335acpi_dm_io_descriptor ( 241acpi_dm_io_descriptor(struct asl_io_port_desc *resource, u32 length, u32 level);
336 struct asl_io_port_desc *resource,
337 u32 length,
338 u32 level);
339 242
340void 243void
341acpi_dm_fixed_io_descriptor ( 244acpi_dm_fixed_io_descriptor(struct asl_fixed_io_port_desc *resource,
342 struct asl_fixed_io_port_desc *resource, 245 u32 length, u32 level);
343 u32 length,
344 u32 level);
345 246
346void 247void
347acpi_dm_start_dependent_descriptor ( 248acpi_dm_start_dependent_descriptor(struct asl_start_dependent_desc *resource,
348 struct asl_start_dependent_desc *resource, 249 u32 length, u32 level);
349 u32 length,
350 u32 level);
351 250
352void 251void
353acpi_dm_end_dependent_descriptor ( 252acpi_dm_end_dependent_descriptor(struct asl_start_dependent_desc *resource,
354 struct asl_start_dependent_desc *resource, 253 u32 length, u32 level);
355 u32 length,
356 u32 level);
357 254
358void 255void
359acpi_dm_vendor_small_descriptor ( 256acpi_dm_vendor_small_descriptor(struct asl_small_vendor_desc *resource,
360 struct asl_small_vendor_desc *resource, 257 u32 length, u32 level);
361 u32 length,
362 u32 level);
363
364 258
365/* 259/*
366 * dmutils 260 * dmutils
367 */ 261 */
368void 262void acpi_dm_add_to_external_list(char *path);
369acpi_dm_add_to_external_list (
370 char *path);
371 263
372#endif /* __ACDISASM_H__ */ 264#endif /* __ACDISASM_H__ */
diff --git a/include/acpi/acdispat.h b/include/acpi/acdispat.h
index 8f5f2f71b1de..065f24a77cfc 100644
--- a/include/acpi/acdispat.h
+++ b/include/acpi/acdispat.h
@@ -41,419 +41,304 @@
41 * POSSIBILITY OF SUCH DAMAGES. 41 * POSSIBILITY OF SUCH DAMAGES.
42 */ 42 */
43 43
44
45#ifndef _ACDISPAT_H_ 44#ifndef _ACDISPAT_H_
46#define _ACDISPAT_H_ 45#define _ACDISPAT_H_
47 46
48
49#define NAMEOF_LOCAL_NTE "__L0" 47#define NAMEOF_LOCAL_NTE "__L0"
50#define NAMEOF_ARG_NTE "__A0" 48#define NAMEOF_ARG_NTE "__A0"
51 49
52
53/* 50/*
54 * dsopcode - support for late evaluation 51 * dsopcode - support for late evaluation
55 */ 52 */
56acpi_status 53acpi_status
57acpi_ds_get_buffer_field_arguments ( 54acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc);
58 union acpi_operand_object *obj_desc);
59
60acpi_status
61acpi_ds_get_region_arguments (
62 union acpi_operand_object *rgn_desc);
63 55
64acpi_status 56acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *rgn_desc);
65acpi_ds_get_buffer_arguments (
66 union acpi_operand_object *obj_desc);
67 57
68acpi_status 58acpi_status acpi_ds_get_buffer_arguments(union acpi_operand_object *obj_desc);
69acpi_ds_get_package_arguments (
70 union acpi_operand_object *obj_desc);
71 59
72acpi_status 60acpi_status acpi_ds_get_package_arguments(union acpi_operand_object *obj_desc);
73acpi_ds_eval_buffer_field_operands (
74 struct acpi_walk_state *walk_state,
75 union acpi_parse_object *op);
76 61
77acpi_status 62acpi_status
78acpi_ds_eval_region_operands ( 63acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state,
79 struct acpi_walk_state *walk_state, 64 union acpi_parse_object *op);
80 union acpi_parse_object *op);
81 65
82acpi_status 66acpi_status
83acpi_ds_eval_data_object_operands ( 67acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state,
84 struct acpi_walk_state *walk_state, 68 union acpi_parse_object *op);
85 union acpi_parse_object *op,
86 union acpi_operand_object *obj_desc);
87 69
88acpi_status 70acpi_status
89acpi_ds_initialize_region ( 71acpi_ds_eval_data_object_operands(struct acpi_walk_state *walk_state,
90 acpi_handle obj_handle); 72 union acpi_parse_object *op,
73 union acpi_operand_object *obj_desc);
91 74
75acpi_status acpi_ds_initialize_region(acpi_handle obj_handle);
92 76
93/* 77/*
94 * dsctrl - Parser/Interpreter interface, control stack routines 78 * dsctrl - Parser/Interpreter interface, control stack routines
95 */ 79 */
96acpi_status 80acpi_status
97acpi_ds_exec_begin_control_op ( 81acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state,
98 struct acpi_walk_state *walk_state, 82 union acpi_parse_object *op);
99 union acpi_parse_object *op);
100 83
101acpi_status 84acpi_status
102acpi_ds_exec_end_control_op ( 85acpi_ds_exec_end_control_op(struct acpi_walk_state *walk_state,
103 struct acpi_walk_state *walk_state, 86 union acpi_parse_object *op);
104 union acpi_parse_object *op);
105
106 87
107/* 88/*
108 * dsexec - Parser/Interpreter interface, method execution callbacks 89 * dsexec - Parser/Interpreter interface, method execution callbacks
109 */ 90 */
110acpi_status 91acpi_status
111acpi_ds_get_predicate_value ( 92acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state,
112 struct acpi_walk_state *walk_state, 93 union acpi_operand_object *result_obj);
113 union acpi_operand_object *result_obj);
114
115acpi_status
116acpi_ds_exec_begin_op (
117 struct acpi_walk_state *walk_state,
118 union acpi_parse_object **out_op);
119 94
120acpi_status 95acpi_status
121acpi_ds_exec_end_op ( 96acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state,
122 struct acpi_walk_state *state); 97 union acpi_parse_object **out_op);
123 98
99acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *state);
124 100
125/* 101/*
126 * dsfield - Parser/Interpreter interface for AML fields 102 * dsfield - Parser/Interpreter interface for AML fields
127 */ 103 */
128acpi_status 104acpi_status
129acpi_ds_create_field ( 105acpi_ds_create_field(union acpi_parse_object *op,
130 union acpi_parse_object *op, 106 struct acpi_namespace_node *region_node,
131 struct acpi_namespace_node *region_node, 107 struct acpi_walk_state *walk_state);
132 struct acpi_walk_state *walk_state);
133 108
134acpi_status 109acpi_status
135acpi_ds_create_bank_field ( 110acpi_ds_create_bank_field(union acpi_parse_object *op,
136 union acpi_parse_object *op, 111 struct acpi_namespace_node *region_node,
137 struct acpi_namespace_node *region_node, 112 struct acpi_walk_state *walk_state);
138 struct acpi_walk_state *walk_state);
139 113
140acpi_status 114acpi_status
141acpi_ds_create_index_field ( 115acpi_ds_create_index_field(union acpi_parse_object *op,
142 union acpi_parse_object *op, 116 struct acpi_namespace_node *region_node,
143 struct acpi_namespace_node *region_node, 117 struct acpi_walk_state *walk_state);
144 struct acpi_walk_state *walk_state);
145 118
146acpi_status 119acpi_status
147acpi_ds_create_buffer_field ( 120acpi_ds_create_buffer_field(union acpi_parse_object *op,
148 union acpi_parse_object *op, 121 struct acpi_walk_state *walk_state);
149 struct acpi_walk_state *walk_state);
150 122
151acpi_status 123acpi_status
152acpi_ds_init_field_objects ( 124acpi_ds_init_field_objects(union acpi_parse_object *op,
153 union acpi_parse_object *op, 125 struct acpi_walk_state *walk_state);
154 struct acpi_walk_state *walk_state);
155
156 126
157/* 127/*
158 * dsload - Parser/Interpreter interface, namespace load callbacks 128 * dsload - Parser/Interpreter interface, namespace load callbacks
159 */ 129 */
160acpi_status 130acpi_status
161acpi_ds_load1_begin_op ( 131acpi_ds_load1_begin_op(struct acpi_walk_state *walk_state,
162 struct acpi_walk_state *walk_state, 132 union acpi_parse_object **out_op);
163 union acpi_parse_object **out_op);
164 133
165acpi_status 134acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state);
166acpi_ds_load1_end_op (
167 struct acpi_walk_state *walk_state);
168 135
169acpi_status 136acpi_status
170acpi_ds_load2_begin_op ( 137acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
171 struct acpi_walk_state *walk_state, 138 union acpi_parse_object **out_op);
172 union acpi_parse_object **out_op);
173 139
174acpi_status 140acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state);
175acpi_ds_load2_end_op (
176 struct acpi_walk_state *walk_state);
177 141
178acpi_status 142acpi_status
179acpi_ds_init_callbacks ( 143acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number);
180 struct acpi_walk_state *walk_state,
181 u32 pass_number);
182
183 144
184/* 145/*
185 * dsmthdat - method data (locals/args) 146 * dsmthdat - method data (locals/args)
186 */ 147 */
187acpi_status 148acpi_status
188acpi_ds_store_object_to_local ( 149acpi_ds_store_object_to_local(u16 opcode,
189 u16 opcode, 150 u32 index,
190 u32 index, 151 union acpi_operand_object *src_desc,
191 union acpi_operand_object *src_desc, 152 struct acpi_walk_state *walk_state);
192 struct acpi_walk_state *walk_state);
193 153
194acpi_status 154acpi_status
195acpi_ds_method_data_get_entry ( 155acpi_ds_method_data_get_entry(u16 opcode,
196 u16 opcode, 156 u32 index,
197 u32 index, 157 struct acpi_walk_state *walk_state,
198 struct acpi_walk_state *walk_state, 158 union acpi_operand_object ***node);
199 union acpi_operand_object ***node);
200 159
201void 160void acpi_ds_method_data_delete_all(struct acpi_walk_state *walk_state);
202acpi_ds_method_data_delete_all (
203 struct acpi_walk_state *walk_state);
204 161
205u8 162u8 acpi_ds_is_method_value(union acpi_operand_object *obj_desc);
206acpi_ds_is_method_value (
207 union acpi_operand_object *obj_desc);
208 163
209acpi_status 164acpi_status
210acpi_ds_method_data_get_value ( 165acpi_ds_method_data_get_value(u16 opcode,
211 u16 opcode, 166 u32 index,
212 u32 index, 167 struct acpi_walk_state *walk_state,
213 struct acpi_walk_state *walk_state, 168 union acpi_operand_object **dest_desc);
214 union acpi_operand_object **dest_desc);
215 169
216acpi_status 170acpi_status
217acpi_ds_method_data_init_args ( 171acpi_ds_method_data_init_args(union acpi_operand_object **params,
218 union acpi_operand_object **params, 172 u32 max_param_count,
219 u32 max_param_count, 173 struct acpi_walk_state *walk_state);
220 struct acpi_walk_state *walk_state);
221 174
222acpi_status 175acpi_status
223acpi_ds_method_data_get_node ( 176acpi_ds_method_data_get_node(u16 opcode,
224 u16 opcode, 177 u32 index,
225 u32 index, 178 struct acpi_walk_state *walk_state,
226 struct acpi_walk_state *walk_state, 179 struct acpi_namespace_node **node);
227 struct acpi_namespace_node **node);
228
229void
230acpi_ds_method_data_init (
231 struct acpi_walk_state *walk_state);
232 180
181void acpi_ds_method_data_init(struct acpi_walk_state *walk_state);
233 182
234/* 183/*
235 * dsmethod - Parser/Interpreter interface - control method parsing 184 * dsmethod - Parser/Interpreter interface - control method parsing
236 */ 185 */
237acpi_status 186acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node);
238acpi_ds_parse_method (
239 acpi_handle obj_handle);
240 187
241acpi_status 188acpi_status
242acpi_ds_call_control_method ( 189acpi_ds_call_control_method(struct acpi_thread_state *thread,
243 struct acpi_thread_state *thread, 190 struct acpi_walk_state *walk_state,
244 struct acpi_walk_state *walk_state, 191 union acpi_parse_object *op);
245 union acpi_parse_object *op);
246 192
247acpi_status 193acpi_status
248acpi_ds_restart_control_method ( 194acpi_ds_restart_control_method(struct acpi_walk_state *walk_state,
249 struct acpi_walk_state *walk_state, 195 union acpi_operand_object *return_desc);
250 union acpi_operand_object *return_desc);
251 196
252acpi_status 197void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state);
253acpi_ds_terminate_control_method (
254 struct acpi_walk_state *walk_state);
255 198
256acpi_status 199acpi_status
257acpi_ds_begin_method_execution ( 200acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node,
258 struct acpi_namespace_node *method_node, 201 union acpi_operand_object *obj_desc,
259 union acpi_operand_object *obj_desc, 202 struct acpi_namespace_node *calling_method_node);
260 struct acpi_namespace_node *calling_method_node);
261
262 203
263/* 204/*
264 * dsinit 205 * dsinit
265 */ 206 */
266acpi_status 207acpi_status
267acpi_ds_initialize_objects ( 208acpi_ds_initialize_objects(struct acpi_table_desc *table_desc,
268 struct acpi_table_desc *table_desc, 209 struct acpi_namespace_node *start_node);
269 struct acpi_namespace_node *start_node);
270
271 210
272/* 211/*
273 * dsobject - Parser/Interpreter interface - object initialization and conversion 212 * dsobject - Parser/Interpreter interface - object initialization and conversion
274 */ 213 */
275acpi_status 214acpi_status
276acpi_ds_build_internal_buffer_obj ( 215acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state,
277 struct acpi_walk_state *walk_state, 216 union acpi_parse_object *op,
278 union acpi_parse_object *op, 217 u32 buffer_length,
279 u32 buffer_length, 218 union acpi_operand_object **obj_desc_ptr);
280 union acpi_operand_object **obj_desc_ptr);
281 219
282acpi_status 220acpi_status
283acpi_ds_build_internal_package_obj ( 221acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
284 struct acpi_walk_state *walk_state, 222 union acpi_parse_object *op,
285 union acpi_parse_object *op, 223 u32 package_length,
286 u32 package_length, 224 union acpi_operand_object **obj_desc);
287 union acpi_operand_object **obj_desc);
288 225
289acpi_status 226acpi_status
290acpi_ds_init_object_from_op ( 227acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
291 struct acpi_walk_state *walk_state, 228 union acpi_parse_object *op,
292 union acpi_parse_object *op, 229 u16 opcode, union acpi_operand_object **obj_desc);
293 u16 opcode,
294 union acpi_operand_object **obj_desc);
295 230
296acpi_status 231acpi_status
297acpi_ds_create_node ( 232acpi_ds_create_node(struct acpi_walk_state *walk_state,
298 struct acpi_walk_state *walk_state, 233 struct acpi_namespace_node *node,
299 struct acpi_namespace_node *node, 234 union acpi_parse_object *op);
300 union acpi_parse_object *op);
301
302 235
303/* 236/*
304 * dsutils - Parser/Interpreter interface utility routines 237 * dsutils - Parser/Interpreter interface utility routines
305 */ 238 */
306void 239void acpi_ds_clear_implicit_return(struct acpi_walk_state *walk_state);
307acpi_ds_clear_implicit_return (
308 struct acpi_walk_state *walk_state);
309 240
310u8 241u8
311acpi_ds_do_implicit_return ( 242acpi_ds_do_implicit_return(union acpi_operand_object *return_desc,
312 union acpi_operand_object *return_desc, 243 struct acpi_walk_state *walk_state,
313 struct acpi_walk_state *walk_state, 244 u8 add_reference);
314 u8 add_reference);
315 245
316u8 246u8
317acpi_ds_is_result_used ( 247acpi_ds_is_result_used(union acpi_parse_object *op,
318 union acpi_parse_object *op, 248 struct acpi_walk_state *walk_state);
319 struct acpi_walk_state *walk_state);
320 249
321void 250void
322acpi_ds_delete_result_if_not_used ( 251acpi_ds_delete_result_if_not_used(union acpi_parse_object *op,
323 union acpi_parse_object *op, 252 union acpi_operand_object *result_obj,
324 union acpi_operand_object *result_obj, 253 struct acpi_walk_state *walk_state);
325 struct acpi_walk_state *walk_state);
326 254
327acpi_status 255acpi_status
328acpi_ds_create_operand ( 256acpi_ds_create_operand(struct acpi_walk_state *walk_state,
329 struct acpi_walk_state *walk_state, 257 union acpi_parse_object *arg, u32 args_remaining);
330 union acpi_parse_object *arg,
331 u32 args_remaining);
332 258
333acpi_status 259acpi_status
334acpi_ds_create_operands ( 260acpi_ds_create_operands(struct acpi_walk_state *walk_state,
335 struct acpi_walk_state *walk_state, 261 union acpi_parse_object *first_arg);
336 union acpi_parse_object *first_arg);
337 262
338acpi_status 263acpi_status acpi_ds_resolve_operands(struct acpi_walk_state *walk_state);
339acpi_ds_resolve_operands (
340 struct acpi_walk_state *walk_state);
341
342void
343acpi_ds_clear_operands (
344 struct acpi_walk_state *walk_state);
345 264
265void acpi_ds_clear_operands(struct acpi_walk_state *walk_state);
346 266
347/* 267/*
348 * dswscope - Scope Stack manipulation 268 * dswscope - Scope Stack manipulation
349 */ 269 */
350acpi_status 270acpi_status
351acpi_ds_scope_stack_push ( 271acpi_ds_scope_stack_push(struct acpi_namespace_node *node,
352 struct acpi_namespace_node *node, 272 acpi_object_type type,
353 acpi_object_type type, 273 struct acpi_walk_state *walk_state);
354 struct acpi_walk_state *walk_state);
355 274
275acpi_status acpi_ds_scope_stack_pop(struct acpi_walk_state *walk_state);
356 276
357acpi_status 277void acpi_ds_scope_stack_clear(struct acpi_walk_state *walk_state);
358acpi_ds_scope_stack_pop (
359 struct acpi_walk_state *walk_state);
360
361void
362acpi_ds_scope_stack_clear (
363 struct acpi_walk_state *walk_state);
364
365 278
366/* 279/*
367 * dswstate - parser WALK_STATE management routines 280 * dswstate - parser WALK_STATE management routines
368 */ 281 */
369acpi_status 282acpi_status
370acpi_ds_obj_stack_push ( 283acpi_ds_obj_stack_push(void *object, struct acpi_walk_state *walk_state);
371 void *object,
372 struct acpi_walk_state *walk_state);
373 284
374acpi_status 285acpi_status
375acpi_ds_obj_stack_pop ( 286acpi_ds_obj_stack_pop(u32 pop_count, struct acpi_walk_state *walk_state);
376 u32 pop_count,
377 struct acpi_walk_state *walk_state);
378 287
379struct acpi_walk_state * 288struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id,
380acpi_ds_create_walk_state ( 289 union acpi_parse_object
381 acpi_owner_id owner_id, 290 *origin,
382 union acpi_parse_object *origin, 291 union acpi_operand_object
383 union acpi_operand_object *mth_desc, 292 *mth_desc,
384 struct acpi_thread_state *thread); 293 struct acpi_thread_state
294 *thread);
385 295
386acpi_status 296acpi_status
387acpi_ds_init_aml_walk ( 297acpi_ds_init_aml_walk(struct acpi_walk_state *walk_state,
388 struct acpi_walk_state *walk_state, 298 union acpi_parse_object *op,
389 union acpi_parse_object *op, 299 struct acpi_namespace_node *method_node,
390 struct acpi_namespace_node *method_node, 300 u8 * aml_start,
391 u8 *aml_start, 301 u32 aml_length,
392 u32 aml_length, 302 struct acpi_parameter_info *info, u8 pass_number);
393 struct acpi_parameter_info *info,
394 u32 pass_number);
395 303
396acpi_status 304acpi_status
397acpi_ds_obj_stack_pop_and_delete ( 305acpi_ds_obj_stack_pop_and_delete(u32 pop_count,
398 u32 pop_count, 306 struct acpi_walk_state *walk_state);
399 struct acpi_walk_state *walk_state);
400 307
401void 308void acpi_ds_delete_walk_state(struct acpi_walk_state *walk_state);
402acpi_ds_delete_walk_state (
403 struct acpi_walk_state *walk_state);
404 309
405struct acpi_walk_state * 310struct acpi_walk_state *acpi_ds_pop_walk_state(struct acpi_thread_state
406acpi_ds_pop_walk_state ( 311 *thread);
407 struct acpi_thread_state *thread);
408 312
409void 313void
410acpi_ds_push_walk_state ( 314acpi_ds_push_walk_state(struct acpi_walk_state *walk_state,
411 struct acpi_walk_state *walk_state, 315 struct acpi_thread_state *thread);
412 struct acpi_thread_state *thread);
413 316
414acpi_status 317acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state *walk_state);
415acpi_ds_result_stack_pop (
416 struct acpi_walk_state *walk_state);
417 318
418acpi_status 319acpi_status acpi_ds_result_stack_push(struct acpi_walk_state *walk_state);
419acpi_ds_result_stack_push (
420 struct acpi_walk_state *walk_state);
421 320
422acpi_status 321acpi_status acpi_ds_result_stack_clear(struct acpi_walk_state *walk_state);
423acpi_ds_result_stack_clear (
424 struct acpi_walk_state *walk_state);
425 322
426struct acpi_walk_state * 323struct acpi_walk_state *acpi_ds_get_current_walk_state(struct acpi_thread_state
427acpi_ds_get_current_walk_state ( 324 *thread);
428 struct acpi_thread_state *thread);
429 325
430#ifdef ACPI_FUTURE_USAGE 326#ifdef ACPI_FUTURE_USAGE
431acpi_status 327acpi_status
432acpi_ds_result_remove ( 328acpi_ds_result_remove(union acpi_operand_object **object,
433 union acpi_operand_object **object, 329 u32 index, struct acpi_walk_state *walk_state);
434 u32 index,
435 struct acpi_walk_state *walk_state);
436#endif 330#endif
437 331
438acpi_status 332acpi_status
439acpi_ds_result_pop ( 333acpi_ds_result_pop(union acpi_operand_object **object,
440 union acpi_operand_object **object, 334 struct acpi_walk_state *walk_state);
441 struct acpi_walk_state *walk_state);
442 335
443acpi_status 336acpi_status
444acpi_ds_result_push ( 337acpi_ds_result_push(union acpi_operand_object *object,
445 union acpi_operand_object *object, 338 struct acpi_walk_state *walk_state);
446 struct acpi_walk_state *walk_state);
447 339
448acpi_status 340acpi_status
449acpi_ds_result_pop_from_bottom ( 341acpi_ds_result_pop_from_bottom(union acpi_operand_object **object,
450 union acpi_operand_object **object, 342 struct acpi_walk_state *walk_state);
451 struct acpi_walk_state *walk_state);
452
453#ifdef ACPI_ENABLE_OBJECT_CACHE
454void
455acpi_ds_delete_walk_state_cache (
456 void);
457#endif
458 343
459#endif /* _ACDISPAT_H_ */ 344#endif /* _ACDISPAT_H_ */
diff --git a/include/acpi/acevents.h b/include/acpi/acevents.h
index 61a27c8c5079..bfa54600ecd9 100644
--- a/include/acpi/acevents.h
+++ b/include/acpi/acevents.h
@@ -44,250 +44,167 @@
44#ifndef __ACEVENTS_H__ 44#ifndef __ACEVENTS_H__
45#define __ACEVENTS_H__ 45#define __ACEVENTS_H__
46 46
47
48/* 47/*
49 * evevent 48 * evevent
50 */ 49 */
51acpi_status 50acpi_status acpi_ev_initialize_events(void);
52acpi_ev_initialize_events (
53 void);
54 51
55acpi_status 52acpi_status acpi_ev_install_xrupt_handlers(void);
56acpi_ev_install_xrupt_handlers (
57 void);
58
59u32
60acpi_ev_fixed_event_detect (
61 void);
62 53
54u32 acpi_ev_fixed_event_detect(void);
63 55
64/* 56/*
65 * evmisc 57 * evmisc
66 */ 58 */
67u8 59u8 acpi_ev_is_notify_object(struct acpi_namespace_node *node);
68acpi_ev_is_notify_object (
69 struct acpi_namespace_node *node);
70 60
71acpi_status 61acpi_status acpi_ev_acquire_global_lock(u16 timeout);
72acpi_ev_acquire_global_lock(
73 u16 timeout);
74 62
75acpi_status 63acpi_status acpi_ev_release_global_lock(void);
76acpi_ev_release_global_lock(
77 void);
78 64
79acpi_status 65acpi_status acpi_ev_init_global_lock_handler(void);
80acpi_ev_init_global_lock_handler (
81 void);
82 66
83u32 67u32 acpi_ev_get_gpe_number_index(u32 gpe_number);
84acpi_ev_get_gpe_number_index (
85 u32 gpe_number);
86 68
87acpi_status 69acpi_status
88acpi_ev_queue_notify_request ( 70acpi_ev_queue_notify_request(struct acpi_namespace_node *node,
89 struct acpi_namespace_node *node, 71 u32 notify_value);
90 u32 notify_value);
91
92 72
93/* 73/*
94 * evgpe - GPE handling and dispatch 74 * evgpe - GPE handling and dispatch
95 */ 75 */
96acpi_status 76acpi_status
97acpi_ev_update_gpe_enable_masks ( 77acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info,
98 struct acpi_gpe_event_info *gpe_event_info, 78 u8 type);
99 u8 type);
100 79
101acpi_status 80acpi_status
102acpi_ev_enable_gpe ( 81acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info,
103 struct acpi_gpe_event_info *gpe_event_info, 82 u8 write_to_hardware);
104 u8 write_to_hardware);
105 83
106acpi_status 84acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info);
107acpi_ev_disable_gpe (
108 struct acpi_gpe_event_info *gpe_event_info);
109
110struct acpi_gpe_event_info *
111acpi_ev_get_gpe_event_info (
112 acpi_handle gpe_device,
113 u32 gpe_number);
114 85
86struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device,
87 u32 gpe_number);
115 88
116/* 89/*
117 * evgpeblk 90 * evgpeblk
118 */ 91 */
119u8 92u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info);
120acpi_ev_valid_gpe_event (
121 struct acpi_gpe_event_info *gpe_event_info);
122
123acpi_status
124acpi_ev_walk_gpe_list (
125 ACPI_GPE_CALLBACK gpe_walk_callback,
126 u32 flags);
127 93
128acpi_status 94acpi_status acpi_ev_walk_gpe_list(ACPI_GPE_CALLBACK gpe_walk_callback);
129acpi_ev_delete_gpe_handlers (
130 struct acpi_gpe_xrupt_info *gpe_xrupt_info,
131 struct acpi_gpe_block_info *gpe_block);
132 95
133acpi_status 96acpi_status
134acpi_ev_create_gpe_block ( 97acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
135 struct acpi_namespace_node *gpe_device, 98 struct acpi_gpe_block_info *gpe_block);
136 struct acpi_generic_address *gpe_block_address,
137 u32 register_count,
138 u8 gpe_block_base_number,
139 u32 interrupt_level,
140 struct acpi_gpe_block_info **return_gpe_block);
141 99
142acpi_status 100acpi_status
143acpi_ev_delete_gpe_block ( 101acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
144 struct acpi_gpe_block_info *gpe_block); 102 struct acpi_generic_address *gpe_block_address,
103 u32 register_count,
104 u8 gpe_block_base_number,
105 u32 interrupt_number,
106 struct acpi_gpe_block_info **return_gpe_block);
145 107
146u32 108acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block);
147acpi_ev_gpe_dispatch (
148 struct acpi_gpe_event_info *gpe_event_info,
149 u32 gpe_number);
150 109
151u32 110u32
152acpi_ev_gpe_detect ( 111acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info,
153 struct acpi_gpe_xrupt_info *gpe_xrupt_list); 112 u32 gpe_number);
154 113
155acpi_status 114u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info *gpe_xrupt_list);
156acpi_ev_set_gpe_type (
157 struct acpi_gpe_event_info *gpe_event_info,
158 u8 type);
159 115
160acpi_status 116acpi_status
161acpi_ev_check_for_wake_only_gpe ( 117acpi_ev_set_gpe_type(struct acpi_gpe_event_info *gpe_event_info, u8 type);
162 struct acpi_gpe_event_info *gpe_event_info);
163 118
164acpi_status 119acpi_status
165acpi_ev_gpe_initialize ( 120acpi_ev_check_for_wake_only_gpe(struct acpi_gpe_event_info *gpe_event_info);
166 void);
167 121
122acpi_status acpi_ev_gpe_initialize(void);
168 123
169/* 124/*
170 * evregion - Address Space handling 125 * evregion - Address Space handling
171 */ 126 */
172acpi_status 127acpi_status acpi_ev_install_region_handlers(void);
173acpi_ev_install_region_handlers (
174 void);
175 128
176acpi_status 129acpi_status acpi_ev_initialize_op_regions(void);
177acpi_ev_initialize_op_regions (
178 void);
179 130
180acpi_status 131acpi_status
181acpi_ev_address_space_dispatch ( 132acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
182 union acpi_operand_object *region_obj, 133 u32 function,
183 u32 function, 134 acpi_physical_address address,
184 acpi_physical_address address, 135 u32 bit_width, void *value);
185 u32 bit_width,
186 void *value);
187 136
188acpi_status 137acpi_status
189acpi_ev_attach_region ( 138acpi_ev_attach_region(union acpi_operand_object *handler_obj,
190 union acpi_operand_object *handler_obj, 139 union acpi_operand_object *region_obj,
191 union acpi_operand_object *region_obj, 140 u8 acpi_ns_is_locked);
192 u8 acpi_ns_is_locked);
193 141
194void 142void
195acpi_ev_detach_region ( 143acpi_ev_detach_region(union acpi_operand_object *region_obj,
196 union acpi_operand_object *region_obj, 144 u8 acpi_ns_is_locked);
197 u8 acpi_ns_is_locked);
198 145
199acpi_status 146acpi_status
200acpi_ev_install_space_handler ( 147acpi_ev_install_space_handler(struct acpi_namespace_node *node,
201 struct acpi_namespace_node *node, 148 acpi_adr_space_type space_id,
202 acpi_adr_space_type space_id, 149 acpi_adr_space_handler handler,
203 acpi_adr_space_handler handler, 150 acpi_adr_space_setup setup, void *context);
204 acpi_adr_space_setup setup,
205 void *context);
206 151
207acpi_status 152acpi_status
208acpi_ev_execute_reg_methods ( 153acpi_ev_execute_reg_methods(struct acpi_namespace_node *node,
209 struct acpi_namespace_node *node, 154 acpi_adr_space_type space_id);
210 acpi_adr_space_type space_id);
211 155
212acpi_status 156acpi_status
213acpi_ev_execute_reg_method ( 157acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function);
214 union acpi_operand_object *region_obj,
215 u32 function);
216
217 158
218/* 159/*
219 * evregini - Region initialization and setup 160 * evregini - Region initialization and setup
220 */ 161 */
221acpi_status 162acpi_status
222acpi_ev_system_memory_region_setup ( 163acpi_ev_system_memory_region_setup(acpi_handle handle,
223 acpi_handle handle, 164 u32 function,
224 u32 function, 165 void *handler_context,
225 void *handler_context, 166 void **region_context);
226 void **region_context);
227 167
228acpi_status 168acpi_status
229acpi_ev_io_space_region_setup ( 169acpi_ev_io_space_region_setup(acpi_handle handle,
230 acpi_handle handle, 170 u32 function,
231 u32 function, 171 void *handler_context, void **region_context);
232 void *handler_context,
233 void **region_context);
234 172
235acpi_status 173acpi_status
236acpi_ev_pci_config_region_setup ( 174acpi_ev_pci_config_region_setup(acpi_handle handle,
237 acpi_handle handle, 175 u32 function,
238 u32 function, 176 void *handler_context, void **region_context);
239 void *handler_context,
240 void **region_context);
241 177
242acpi_status 178acpi_status
243acpi_ev_cmos_region_setup ( 179acpi_ev_cmos_region_setup(acpi_handle handle,
244 acpi_handle handle, 180 u32 function,
245 u32 function, 181 void *handler_context, void **region_context);
246 void *handler_context,
247 void **region_context);
248 182
249acpi_status 183acpi_status
250acpi_ev_pci_bar_region_setup ( 184acpi_ev_pci_bar_region_setup(acpi_handle handle,
251 acpi_handle handle, 185 u32 function,
252 u32 function, 186 void *handler_context, void **region_context);
253 void *handler_context,
254 void **region_context);
255 187
256acpi_status 188acpi_status
257acpi_ev_default_region_setup ( 189acpi_ev_default_region_setup(acpi_handle handle,
258 acpi_handle handle, 190 u32 function,
259 u32 function, 191 void *handler_context, void **region_context);
260 void *handler_context,
261 void **region_context);
262 192
263acpi_status 193acpi_status
264acpi_ev_initialize_region ( 194acpi_ev_initialize_region(union acpi_operand_object *region_obj,
265 union acpi_operand_object *region_obj, 195 u8 acpi_ns_locked);
266 u8 acpi_ns_locked);
267
268 196
269/* 197/*
270 * evsci - SCI (System Control Interrupt) handling/dispatch 198 * evsci - SCI (System Control Interrupt) handling/dispatch
271 */ 199 */
272u32 ACPI_SYSTEM_XFACE 200u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context);
273acpi_ev_gpe_xrupt_handler (
274 void *context);
275
276u32
277acpi_ev_install_sci_handler (
278 void);
279 201
280acpi_status 202u32 acpi_ev_install_sci_handler(void);
281acpi_ev_remove_sci_handler (
282 void);
283 203
284u32 204acpi_status acpi_ev_remove_sci_handler(void);
285acpi_ev_initialize_sCI (
286 u32 program_sCI);
287 205
288void 206u32 acpi_ev_initialize_sCI(u32 program_sCI);
289acpi_ev_terminate (
290 void);
291 207
208void acpi_ev_terminate(void);
292 209
293#endif /* __ACEVENTS_H__ */ 210#endif /* __ACEVENTS_H__ */
diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h
index 60d737b2d70f..4f005eb65928 100644
--- a/include/acpi/acexcep.h
+++ b/include/acpi/acexcep.h
@@ -44,7 +44,6 @@
44#ifndef __ACEXCEP_H__ 44#ifndef __ACEXCEP_H__
45#define __ACEXCEP_H__ 45#define __ACEXCEP_H__
46 46
47
48/* 47/*
49 * Exceptions returned by external ACPI interfaces 48 * Exceptions returned by external ACPI interfaces
50 */ 49 */
@@ -55,11 +54,9 @@
55#define AE_CODE_CONTROL 0x4000 54#define AE_CODE_CONTROL 0x4000
56#define AE_CODE_MASK 0xF000 55#define AE_CODE_MASK 0xF000
57 56
58
59#define ACPI_SUCCESS(a) (!(a)) 57#define ACPI_SUCCESS(a) (!(a))
60#define ACPI_FAILURE(a) (a) 58#define ACPI_FAILURE(a) (a)
61 59
62
63#define AE_OK (acpi_status) 0x0000 60#define AE_OK (acpi_status) 0x0000
64 61
65/* 62/*
@@ -95,9 +92,9 @@
95#define AE_ABORT_METHOD (acpi_status) (0x001C | AE_CODE_ENVIRONMENTAL) 92#define AE_ABORT_METHOD (acpi_status) (0x001C | AE_CODE_ENVIRONMENTAL)
96#define AE_SAME_HANDLER (acpi_status) (0x001D | AE_CODE_ENVIRONMENTAL) 93#define AE_SAME_HANDLER (acpi_status) (0x001D | AE_CODE_ENVIRONMENTAL)
97#define AE_WAKE_ONLY_GPE (acpi_status) (0x001E | AE_CODE_ENVIRONMENTAL) 94#define AE_WAKE_ONLY_GPE (acpi_status) (0x001E | AE_CODE_ENVIRONMENTAL)
95#define AE_OWNER_ID_LIMIT (acpi_status) (0x001F | AE_CODE_ENVIRONMENTAL)
98 96
99#define AE_CODE_ENV_MAX 0x001E 97#define AE_CODE_ENV_MAX 0x001F
100
101 98
102/* 99/*
103 * Programmer exceptions 100 * Programmer exceptions
@@ -114,7 +111,6 @@
114 111
115#define AE_CODE_PGM_MAX 0x0009 112#define AE_CODE_PGM_MAX 0x0009
116 113
117
118/* 114/*
119 * Acpi table exceptions 115 * Acpi table exceptions
120 */ 116 */
@@ -127,7 +123,6 @@
127 123
128#define AE_CODE_TBL_MAX 0x0006 124#define AE_CODE_TBL_MAX 0x0006
129 125
130
131/* 126/*
132 * AML exceptions. These are caused by problems with 127 * AML exceptions. These are caused by problems with
133 * the actual AML byte stream 128 * the actual AML byte stream
@@ -168,7 +163,6 @@
168 163
169#define AE_CODE_AML_MAX 0x0021 164#define AE_CODE_AML_MAX 0x0021
170 165
171
172/* 166/*
173 * Internal exceptions used for control 167 * Internal exceptions used for control
174 */ 168 */
@@ -186,16 +180,13 @@
186 180
187#define AE_CODE_CTRL_MAX 0x000B 181#define AE_CODE_CTRL_MAX 0x000B
188 182
189
190#ifdef DEFINE_ACPI_GLOBALS 183#ifdef DEFINE_ACPI_GLOBALS
191 184
192
193/* 185/*
194 * String versions of the exception codes above 186 * String versions of the exception codes above
195 * These strings must match the corresponding defines exactly 187 * These strings must match the corresponding defines exactly
196 */ 188 */
197char const *acpi_gbl_exception_names_env[] = 189char const *acpi_gbl_exception_names_env[] = {
198{
199 "AE_OK", 190 "AE_OK",
200 "AE_ERROR", 191 "AE_ERROR",
201 "AE_NO_ACPI_TABLES", 192 "AE_NO_ACPI_TABLES",
@@ -226,11 +217,11 @@ char const *acpi_gbl_exception_names_env[] =
226 "AE_LOGICAL_ADDRESS", 217 "AE_LOGICAL_ADDRESS",
227 "AE_ABORT_METHOD", 218 "AE_ABORT_METHOD",
228 "AE_SAME_HANDLER", 219 "AE_SAME_HANDLER",
229 "AE_WAKE_ONLY_GPE" 220 "AE_WAKE_ONLY_GPE",
221 "AE_OWNER_ID_LIMIT"
230}; 222};
231 223
232char const *acpi_gbl_exception_names_pgm[] = 224char const *acpi_gbl_exception_names_pgm[] = {
233{
234 "AE_BAD_PARAMETER", 225 "AE_BAD_PARAMETER",
235 "AE_BAD_CHARACTER", 226 "AE_BAD_CHARACTER",
236 "AE_BAD_PATHNAME", 227 "AE_BAD_PATHNAME",
@@ -242,8 +233,7 @@ char const *acpi_gbl_exception_names_pgm[] =
242 "AE_BAD_DECIMAL_CONSTANT" 233 "AE_BAD_DECIMAL_CONSTANT"
243}; 234};
244 235
245char const *acpi_gbl_exception_names_tbl[] = 236char const *acpi_gbl_exception_names_tbl[] = {
246{
247 "AE_BAD_SIGNATURE", 237 "AE_BAD_SIGNATURE",
248 "AE_BAD_HEADER", 238 "AE_BAD_HEADER",
249 "AE_BAD_CHECKSUM", 239 "AE_BAD_CHECKSUM",
@@ -252,8 +242,7 @@ char const *acpi_gbl_exception_names_tbl[] =
252 "AE_INVALID_TABLE_LENGTH" 242 "AE_INVALID_TABLE_LENGTH"
253}; 243};
254 244
255char const *acpi_gbl_exception_names_aml[] = 245char const *acpi_gbl_exception_names_aml[] = {
256{
257 "AE_AML_ERROR", 246 "AE_AML_ERROR",
258 "AE_AML_PARSE", 247 "AE_AML_PARSE",
259 "AE_AML_BAD_OPCODE", 248 "AE_AML_BAD_OPCODE",
@@ -289,8 +278,7 @@ char const *acpi_gbl_exception_names_aml[] =
289 "AE_AML_BAD_RESOURCE_LENGTH" 278 "AE_AML_BAD_RESOURCE_LENGTH"
290}; 279};
291 280
292char const *acpi_gbl_exception_names_ctrl[] = 281char const *acpi_gbl_exception_names_ctrl[] = {
293{
294 "AE_CTRL_RETURN_VALUE", 282 "AE_CTRL_RETURN_VALUE",
295 "AE_CTRL_PENDING", 283 "AE_CTRL_PENDING",
296 "AE_CTRL_TERMINATE", 284 "AE_CTRL_TERMINATE",
@@ -304,6 +292,6 @@ char const *acpi_gbl_exception_names_ctrl[] =
304 "AE_CTRL_SKIP" 292 "AE_CTRL_SKIP"
305}; 293};
306 294
307#endif /* ACPI GLOBALS */ 295#endif /* ACPI GLOBALS */
308 296
309#endif /* __ACEXCEP_H__ */ 297#endif /* __ACEXCEP_H__ */
diff --git a/include/acpi/acglobal.h b/include/acpi/acglobal.h
index 4946696088c3..e9c2790139ec 100644
--- a/include/acpi/acglobal.h
+++ b/include/acpi/acglobal.h
@@ -44,7 +44,6 @@
44#ifndef __ACGLOBAL_H__ 44#ifndef __ACGLOBAL_H__
45#define __ACGLOBAL_H__ 45#define __ACGLOBAL_H__
46 46
47
48/* 47/*
49 * Ensure that the globals are actually defined and initialized only once. 48 * Ensure that the globals are actually defined and initialized only once.
50 * 49 *
@@ -63,9 +62,8 @@
63 * Keep local copies of these FADT-based registers. NOTE: These globals 62 * Keep local copies of these FADT-based registers. NOTE: These globals
64 * are first in this file for alignment reasons on 64-bit systems. 63 * are first in this file for alignment reasons on 64-bit systems.
65 */ 64 */
66ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1a_enable; 65ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1a_enable;
67ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1b_enable; 66ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1b_enable;
68
69 67
70/***************************************************************************** 68/*****************************************************************************
71 * 69 *
@@ -75,13 +73,12 @@ ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1b_enable;
75 73
76/* Runtime configuration of debug print levels */ 74/* Runtime configuration of debug print levels */
77 75
78extern u32 acpi_dbg_level; 76extern u32 acpi_dbg_level;
79extern u32 acpi_dbg_layer; 77extern u32 acpi_dbg_layer;
80 78
81/* Procedure nesting level for debug output */ 79/* Procedure nesting level for debug output */
82 80
83extern u32 acpi_gbl_nesting_level; 81extern u32 acpi_gbl_nesting_level;
84
85 82
86/***************************************************************************** 83/*****************************************************************************
87 * 84 *
@@ -98,7 +95,7 @@ extern u32 acpi_gbl_nesting_level;
98 * 3) Allow access to uninitialized locals/args (auto-init to integer 0) 95 * 3) Allow access to uninitialized locals/args (auto-init to integer 0)
99 * 4) Allow ANY object type to be a source operand for the Store() operator 96 * 4) Allow ANY object type to be a source operand for the Store() operator
100 */ 97 */
101ACPI_EXTERN u8 ACPI_INIT_GLOBAL (acpi_gbl_enable_interpreter_slack, FALSE); 98ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_interpreter_slack, FALSE);
102 99
103/* 100/*
104 * Automatically serialize ALL control methods? Default is FALSE, meaning 101 * Automatically serialize ALL control methods? Default is FALSE, meaning
@@ -106,22 +103,21 @@ ACPI_EXTERN u8 ACPI_INIT_GLOBAL (acpi_gbl_enable_interpreter_slack, FALSE)
106 * Only change this if the ASL code is poorly written and cannot handle 103 * Only change this if the ASL code is poorly written and cannot handle
107 * reentrancy even though methods are marked "not_serialized". 104 * reentrancy even though methods are marked "not_serialized".
108 */ 105 */
109ACPI_EXTERN u8 ACPI_INIT_GLOBAL (acpi_gbl_all_methods_serialized, FALSE); 106ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_all_methods_serialized, FALSE);
110 107
111/* 108/*
112 * Create the predefined _OSI method in the namespace? Default is TRUE 109 * Create the predefined _OSI method in the namespace? Default is TRUE
113 * because ACPI CA is fully compatible with other ACPI implementations. 110 * because ACPI CA is fully compatible with other ACPI implementations.
114 * Changing this will revert ACPI CA (and machine ASL) to pre-OSI behavior. 111 * Changing this will revert ACPI CA (and machine ASL) to pre-OSI behavior.
115 */ 112 */
116ACPI_EXTERN u8 ACPI_INIT_GLOBAL (acpi_gbl_create_osi_method, TRUE); 113ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_create_osi_method, TRUE);
117 114
118/* 115/*
119 * Disable wakeup GPEs during runtime? Default is TRUE because WAKE and 116 * Disable wakeup GPEs during runtime? Default is TRUE because WAKE and
120 * RUNTIME GPEs should never be shared, and WAKE GPEs should typically only 117 * RUNTIME GPEs should never be shared, and WAKE GPEs should typically only
121 * be enabled just before going to sleep. 118 * be enabled just before going to sleep.
122 */ 119 */
123ACPI_EXTERN u8 ACPI_INIT_GLOBAL (acpi_gbl_leave_wake_gpes_disabled, TRUE); 120ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_leave_wake_gpes_disabled, TRUE);
124
125 121
126/***************************************************************************** 122/*****************************************************************************
127 * 123 *
@@ -137,42 +133,46 @@ ACPI_EXTERN u8 ACPI_INIT_GLOBAL (acpi_gbl_leave_wake_gpes_disabled, TRUE);
137 * These tables are single-table only; meaning that there can be at most one 133 * These tables are single-table only; meaning that there can be at most one
138 * of each in the system. Each global points to the actual table. 134 * of each in the system. Each global points to the actual table.
139 */ 135 */
140ACPI_EXTERN u32 acpi_gbl_table_flags; 136ACPI_EXTERN u32 acpi_gbl_table_flags;
141ACPI_EXTERN u32 acpi_gbl_rsdt_table_count; 137ACPI_EXTERN u32 acpi_gbl_rsdt_table_count;
142ACPI_EXTERN struct rsdp_descriptor *acpi_gbl_RSDP; 138ACPI_EXTERN struct rsdp_descriptor *acpi_gbl_RSDP;
143ACPI_EXTERN XSDT_DESCRIPTOR *acpi_gbl_XSDT; 139ACPI_EXTERN XSDT_DESCRIPTOR *acpi_gbl_XSDT;
144ACPI_EXTERN FADT_DESCRIPTOR *acpi_gbl_FADT; 140ACPI_EXTERN FADT_DESCRIPTOR *acpi_gbl_FADT;
145ACPI_EXTERN struct acpi_table_header *acpi_gbl_DSDT; 141ACPI_EXTERN struct acpi_table_header *acpi_gbl_DSDT;
146ACPI_EXTERN FACS_DESCRIPTOR *acpi_gbl_FACS; 142ACPI_EXTERN FACS_DESCRIPTOR *acpi_gbl_FACS;
147ACPI_EXTERN struct acpi_common_facs acpi_gbl_common_fACS; 143ACPI_EXTERN struct acpi_common_facs acpi_gbl_common_fACS;
148/* 144/*
149 * Since there may be multiple SSDTs and PSDTs, a single pointer is not 145 * Since there may be multiple SSDTs and PSDTs, a single pointer is not
150 * sufficient; Therefore, there isn't one! 146 * sufficient; Therefore, there isn't one!
151 */ 147 */
152 148
149/* The root table can be either an RSDT or an XSDT */
150
151ACPI_EXTERN u8 acpi_gbl_root_table_type;
152#define ACPI_TABLE_TYPE_RSDT 'R'
153#define ACPI_TABLE_TYPE_XSDT 'X'
153 154
154/* 155/*
155 * Handle both ACPI 1.0 and ACPI 2.0 Integer widths: 156 * Handle both ACPI 1.0 and ACPI 2.0 Integer widths:
156 * If we are executing a method that exists in a 32-bit ACPI table, 157 * If we are executing a method that exists in a 32-bit ACPI table,
157 * use only the lower 32 bits of the (internal) 64-bit Integer. 158 * use only the lower 32 bits of the (internal) 64-bit Integer.
158 */ 159 */
159ACPI_EXTERN u8 acpi_gbl_integer_bit_width; 160ACPI_EXTERN u8 acpi_gbl_integer_bit_width;
160ACPI_EXTERN u8 acpi_gbl_integer_byte_width; 161ACPI_EXTERN u8 acpi_gbl_integer_byte_width;
161ACPI_EXTERN u8 acpi_gbl_integer_nybble_width; 162ACPI_EXTERN u8 acpi_gbl_integer_nybble_width;
162 163
163/* 164/*
164 * ACPI Table info arrays 165 * ACPI Table info arrays
165 */ 166 */
166extern struct acpi_table_list acpi_gbl_table_lists[NUM_ACPI_TABLE_TYPES]; 167extern struct acpi_table_list acpi_gbl_table_lists[NUM_ACPI_TABLE_TYPES];
167extern struct acpi_table_support acpi_gbl_table_data[NUM_ACPI_TABLE_TYPES]; 168extern struct acpi_table_support acpi_gbl_table_data[NUM_ACPI_TABLE_TYPES];
168 169
169/* 170/*
170 * Predefined mutex objects. This array contains the 171 * Predefined mutex objects. This array contains the
171 * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs. 172 * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs.
172 * (The table maps local handles to the real OS handles) 173 * (The table maps local handles to the real OS handles)
173 */ 174 */
174ACPI_EXTERN struct acpi_mutex_info acpi_gbl_mutex_info[NUM_MUTEX]; 175ACPI_EXTERN struct acpi_mutex_info acpi_gbl_mutex_info[NUM_MUTEX];
175
176 176
177/***************************************************************************** 177/*****************************************************************************
178 * 178 *
@@ -180,41 +180,56 @@ ACPI_EXTERN struct acpi_mutex_info acpi_gbl_mutex_info[NUM_MUTEX];
180 * 180 *
181 ****************************************************************************/ 181 ****************************************************************************/
182 182
183#ifdef ACPI_DBG_TRACK_ALLOCATIONS
184
185/* Lists for tracking memory allocations */
183 186
184ACPI_EXTERN struct acpi_memory_list acpi_gbl_memory_lists[ACPI_NUM_MEM_LISTS]; 187ACPI_EXTERN struct acpi_memory_list *acpi_gbl_global_list;
185ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_device_notify; 188ACPI_EXTERN struct acpi_memory_list *acpi_gbl_ns_node_list;
186ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_system_notify; 189#endif
187ACPI_EXTERN acpi_exception_handler acpi_gbl_exception_handler;
188ACPI_EXTERN acpi_init_handler acpi_gbl_init_handler;
189ACPI_EXTERN struct acpi_walk_state *acpi_gbl_breakpoint_walk;
190ACPI_EXTERN acpi_handle acpi_gbl_global_lock_semaphore;
191
192ACPI_EXTERN u32 acpi_gbl_global_lock_thread_count;
193ACPI_EXTERN u32 acpi_gbl_original_mode;
194ACPI_EXTERN u32 acpi_gbl_rsdp_original_location;
195ACPI_EXTERN u32 acpi_gbl_ns_lookup_count;
196ACPI_EXTERN u32 acpi_gbl_ps_find_count;
197ACPI_EXTERN u16 acpi_gbl_pm1_enable_register_save;
198ACPI_EXTERN u16 acpi_gbl_next_table_owner_id;
199ACPI_EXTERN u16 acpi_gbl_next_method_owner_id;
200ACPI_EXTERN u16 acpi_gbl_global_lock_handle;
201ACPI_EXTERN u8 acpi_gbl_debugger_configuration;
202ACPI_EXTERN u8 acpi_gbl_global_lock_acquired;
203ACPI_EXTERN u8 acpi_gbl_step_to_next_call;
204ACPI_EXTERN u8 acpi_gbl_acpi_hardware_present;
205ACPI_EXTERN u8 acpi_gbl_global_lock_present;
206ACPI_EXTERN u8 acpi_gbl_events_initialized;
207ACPI_EXTERN u8 acpi_gbl_system_awake_and_running;
208
209extern u8 acpi_gbl_shutdown;
210extern u32 acpi_gbl_startup_flags;
211extern const u8 acpi_gbl_decode_to8bit[8];
212extern const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT];
213extern const char *acpi_gbl_highest_dstate_names[4];
214extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES];
215extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS];
216extern const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STRINGS];
217 190
191/* Object caches */
192
193ACPI_EXTERN acpi_cache_t *acpi_gbl_state_cache;
194ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_cache;
195ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_ext_cache;
196ACPI_EXTERN acpi_cache_t *acpi_gbl_operand_cache;
197
198/* Global handlers */
199
200ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_device_notify;
201ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_system_notify;
202ACPI_EXTERN acpi_exception_handler acpi_gbl_exception_handler;
203ACPI_EXTERN acpi_init_handler acpi_gbl_init_handler;
204ACPI_EXTERN struct acpi_walk_state *acpi_gbl_breakpoint_walk;
205ACPI_EXTERN acpi_handle acpi_gbl_global_lock_semaphore;
206
207/* Misc */
208
209ACPI_EXTERN u32 acpi_gbl_global_lock_thread_count;
210ACPI_EXTERN u32 acpi_gbl_original_mode;
211ACPI_EXTERN u32 acpi_gbl_rsdp_original_location;
212ACPI_EXTERN u32 acpi_gbl_ns_lookup_count;
213ACPI_EXTERN u32 acpi_gbl_ps_find_count;
214ACPI_EXTERN u32 acpi_gbl_owner_id_mask;
215ACPI_EXTERN u16 acpi_gbl_pm1_enable_register_save;
216ACPI_EXTERN u16 acpi_gbl_global_lock_handle;
217ACPI_EXTERN u8 acpi_gbl_debugger_configuration;
218ACPI_EXTERN u8 acpi_gbl_global_lock_acquired;
219ACPI_EXTERN u8 acpi_gbl_step_to_next_call;
220ACPI_EXTERN u8 acpi_gbl_acpi_hardware_present;
221ACPI_EXTERN u8 acpi_gbl_global_lock_present;
222ACPI_EXTERN u8 acpi_gbl_events_initialized;
223ACPI_EXTERN u8 acpi_gbl_system_awake_and_running;
224
225extern u8 acpi_gbl_shutdown;
226extern u32 acpi_gbl_startup_flags;
227extern const u8 acpi_gbl_decode_to8bit[8];
228extern const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT];
229extern const char *acpi_gbl_highest_dstate_names[4];
230extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES];
231extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS];
232extern const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STRINGS];
218 233
219/***************************************************************************** 234/*****************************************************************************
220 * 235 *
@@ -230,36 +245,34 @@ extern const char *acpi_gbl_valid_osi_strings[ACPI_
230#define NUM_PREDEFINED_NAMES 9 245#define NUM_PREDEFINED_NAMES 9
231#endif 246#endif
232 247
233ACPI_EXTERN struct acpi_namespace_node acpi_gbl_root_node_struct; 248ACPI_EXTERN struct acpi_namespace_node acpi_gbl_root_node_struct;
234ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_root_node; 249ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_root_node;
235ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_fadt_gpe_device; 250ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_fadt_gpe_device;
236 251
237extern const u8 acpi_gbl_ns_properties[NUM_NS_TYPES]; 252extern const u8 acpi_gbl_ns_properties[NUM_NS_TYPES];
238extern const struct acpi_predefined_names acpi_gbl_pre_defined_names [NUM_PREDEFINED_NAMES]; 253extern const struct acpi_predefined_names
254 acpi_gbl_pre_defined_names[NUM_PREDEFINED_NAMES];
239 255
240#ifdef ACPI_DEBUG_OUTPUT 256#ifdef ACPI_DEBUG_OUTPUT
241ACPI_EXTERN u32 acpi_gbl_current_node_count; 257ACPI_EXTERN u32 acpi_gbl_current_node_count;
242ACPI_EXTERN u32 acpi_gbl_current_node_size; 258ACPI_EXTERN u32 acpi_gbl_current_node_size;
243ACPI_EXTERN u32 acpi_gbl_max_concurrent_node_count; 259ACPI_EXTERN u32 acpi_gbl_max_concurrent_node_count;
244ACPI_EXTERN acpi_size acpi_gbl_entry_stack_pointer; 260ACPI_EXTERN acpi_size acpi_gbl_entry_stack_pointer;
245ACPI_EXTERN acpi_size acpi_gbl_lowest_stack_pointer; 261ACPI_EXTERN acpi_size acpi_gbl_lowest_stack_pointer;
246ACPI_EXTERN u32 acpi_gbl_deepest_nesting; 262ACPI_EXTERN u32 acpi_gbl_deepest_nesting;
247#endif 263#endif
248 264
249
250/***************************************************************************** 265/*****************************************************************************
251 * 266 *
252 * Interpreter globals 267 * Interpreter globals
253 * 268 *
254 ****************************************************************************/ 269 ****************************************************************************/
255 270
256 271ACPI_EXTERN struct acpi_thread_state *acpi_gbl_current_walk_list;
257ACPI_EXTERN struct acpi_thread_state *acpi_gbl_current_walk_list;
258 272
259/* Control method single step flag */ 273/* Control method single step flag */
260 274
261ACPI_EXTERN u8 acpi_gbl_cm_single_step; 275ACPI_EXTERN u8 acpi_gbl_cm_single_step;
262
263 276
264/***************************************************************************** 277/*****************************************************************************
265 * 278 *
@@ -267,8 +280,7 @@ ACPI_EXTERN u8 acpi_gbl_cm_single_step;
267 * 280 *
268 ****************************************************************************/ 281 ****************************************************************************/
269 282
270ACPI_EXTERN union acpi_parse_object *acpi_gbl_parsed_namespace_root; 283ACPI_EXTERN union acpi_parse_object *acpi_gbl_parsed_namespace_root;
271
272 284
273/***************************************************************************** 285/*****************************************************************************
274 * 286 *
@@ -276,10 +288,10 @@ ACPI_EXTERN union acpi_parse_object *acpi_gbl_parsed_namespace_root;
276 * 288 *
277 ****************************************************************************/ 289 ****************************************************************************/
278 290
279extern struct acpi_bit_register_info acpi_gbl_bit_register_info[ACPI_NUM_BITREG]; 291extern struct acpi_bit_register_info
280ACPI_EXTERN u8 acpi_gbl_sleep_type_a; 292 acpi_gbl_bit_register_info[ACPI_NUM_BITREG];
281ACPI_EXTERN u8 acpi_gbl_sleep_type_b; 293ACPI_EXTERN u8 acpi_gbl_sleep_type_a;
282 294ACPI_EXTERN u8 acpi_gbl_sleep_type_b;
283 295
284/***************************************************************************** 296/*****************************************************************************
285 * 297 *
@@ -287,12 +299,14 @@ ACPI_EXTERN u8 acpi_gbl_sleep_type_b;
287 * 299 *
288 ****************************************************************************/ 300 ****************************************************************************/
289 301
290extern struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS]; 302extern struct acpi_fixed_event_info
291ACPI_EXTERN struct acpi_fixed_event_handler acpi_gbl_fixed_event_handlers[ACPI_NUM_FIXED_EVENTS]; 303 acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS];
292ACPI_EXTERN struct acpi_gpe_xrupt_info *acpi_gbl_gpe_xrupt_list_head; 304ACPI_EXTERN struct acpi_fixed_event_handler
293ACPI_EXTERN struct acpi_gpe_block_info *acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS]; 305 acpi_gbl_fixed_event_handlers[ACPI_NUM_FIXED_EVENTS];
294ACPI_EXTERN acpi_handle acpi_gbl_gpe_lock; 306ACPI_EXTERN struct acpi_gpe_xrupt_info *acpi_gbl_gpe_xrupt_list_head;
295 307ACPI_EXTERN struct acpi_gpe_block_info
308 *acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS];
309ACPI_EXTERN acpi_handle acpi_gbl_gpe_lock;
296 310
297/***************************************************************************** 311/*****************************************************************************
298 * 312 *
@@ -300,58 +314,55 @@ ACPI_EXTERN acpi_handle acpi_gbl_gpe_lock;
300 * 314 *
301 ****************************************************************************/ 315 ****************************************************************************/
302 316
303ACPI_EXTERN u8 acpi_gbl_db_output_flags; 317ACPI_EXTERN u8 acpi_gbl_db_output_flags;
304 318
305#ifdef ACPI_DISASSEMBLER 319#ifdef ACPI_DISASSEMBLER
306 320
307ACPI_EXTERN u8 acpi_gbl_db_opt_disasm; 321ACPI_EXTERN u8 acpi_gbl_db_opt_disasm;
308ACPI_EXTERN u8 acpi_gbl_db_opt_verbose; 322ACPI_EXTERN u8 acpi_gbl_db_opt_verbose;
309#endif 323#endif
310 324
311
312#ifdef ACPI_DEBUGGER 325#ifdef ACPI_DEBUGGER
313 326
314extern u8 acpi_gbl_method_executing; 327extern u8 acpi_gbl_method_executing;
315extern u8 acpi_gbl_abort_method; 328extern u8 acpi_gbl_abort_method;
316extern u8 acpi_gbl_db_terminate_threads; 329extern u8 acpi_gbl_db_terminate_threads;
317 330
318ACPI_EXTERN int optind; 331ACPI_EXTERN int optind;
319ACPI_EXTERN char *optarg; 332ACPI_EXTERN char *optarg;
320 333
321ACPI_EXTERN u8 acpi_gbl_db_opt_tables; 334ACPI_EXTERN u8 acpi_gbl_db_opt_tables;
322ACPI_EXTERN u8 acpi_gbl_db_opt_stats; 335ACPI_EXTERN u8 acpi_gbl_db_opt_stats;
323ACPI_EXTERN u8 acpi_gbl_db_opt_ini_methods; 336ACPI_EXTERN u8 acpi_gbl_db_opt_ini_methods;
324 337
325 338ACPI_EXTERN char *acpi_gbl_db_args[ACPI_DEBUGGER_MAX_ARGS];
326ACPI_EXTERN char *acpi_gbl_db_args[ACPI_DEBUGGER_MAX_ARGS]; 339ACPI_EXTERN char acpi_gbl_db_line_buf[80];
327ACPI_EXTERN char acpi_gbl_db_line_buf[80]; 340ACPI_EXTERN char acpi_gbl_db_parsed_buf[80];
328ACPI_EXTERN char acpi_gbl_db_parsed_buf[80]; 341ACPI_EXTERN char acpi_gbl_db_scope_buf[40];
329ACPI_EXTERN char acpi_gbl_db_scope_buf[40]; 342ACPI_EXTERN char acpi_gbl_db_debug_filename[40];
330ACPI_EXTERN char acpi_gbl_db_debug_filename[40]; 343ACPI_EXTERN u8 acpi_gbl_db_output_to_file;
331ACPI_EXTERN u8 acpi_gbl_db_output_to_file; 344ACPI_EXTERN char *acpi_gbl_db_buffer;
332ACPI_EXTERN char *acpi_gbl_db_buffer; 345ACPI_EXTERN char *acpi_gbl_db_filename;
333ACPI_EXTERN char *acpi_gbl_db_filename; 346ACPI_EXTERN u32 acpi_gbl_db_debug_level;
334ACPI_EXTERN u32 acpi_gbl_db_debug_level; 347ACPI_EXTERN u32 acpi_gbl_db_console_debug_level;
335ACPI_EXTERN u32 acpi_gbl_db_console_debug_level; 348ACPI_EXTERN struct acpi_table_header *acpi_gbl_db_table_ptr;
336ACPI_EXTERN struct acpi_table_header *acpi_gbl_db_table_ptr; 349ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_db_scope_node;
337ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_db_scope_node;
338 350
339/* 351/*
340 * Statistic globals 352 * Statistic globals
341 */ 353 */
342ACPI_EXTERN u16 acpi_gbl_obj_type_count[ACPI_TYPE_NS_NODE_MAX+1]; 354ACPI_EXTERN u16 acpi_gbl_obj_type_count[ACPI_TYPE_NS_NODE_MAX + 1];
343ACPI_EXTERN u16 acpi_gbl_node_type_count[ACPI_TYPE_NS_NODE_MAX+1]; 355ACPI_EXTERN u16 acpi_gbl_node_type_count[ACPI_TYPE_NS_NODE_MAX + 1];
344ACPI_EXTERN u16 acpi_gbl_obj_type_count_misc; 356ACPI_EXTERN u16 acpi_gbl_obj_type_count_misc;
345ACPI_EXTERN u16 acpi_gbl_node_type_count_misc; 357ACPI_EXTERN u16 acpi_gbl_node_type_count_misc;
346ACPI_EXTERN u32 acpi_gbl_num_nodes; 358ACPI_EXTERN u32 acpi_gbl_num_nodes;
347ACPI_EXTERN u32 acpi_gbl_num_objects; 359ACPI_EXTERN u32 acpi_gbl_num_objects;
348
349 360
350ACPI_EXTERN u32 acpi_gbl_size_of_parse_tree; 361ACPI_EXTERN u32 acpi_gbl_size_of_parse_tree;
351ACPI_EXTERN u32 acpi_gbl_size_of_method_trees; 362ACPI_EXTERN u32 acpi_gbl_size_of_method_trees;
352ACPI_EXTERN u32 acpi_gbl_size_of_node_entries; 363ACPI_EXTERN u32 acpi_gbl_size_of_node_entries;
353ACPI_EXTERN u32 acpi_gbl_size_of_acpi_objects; 364ACPI_EXTERN u32 acpi_gbl_size_of_acpi_objects;
354 365
355#endif /* ACPI_DEBUGGER */ 366#endif /* ACPI_DEBUGGER */
356 367
357#endif /* __ACGLOBAL_H__ */ 368#endif /* __ACGLOBAL_H__ */
diff --git a/include/acpi/achware.h b/include/acpi/achware.h
index 9d63641b8e7d..3644d7248e7e 100644
--- a/include/acpi/achware.h
+++ b/include/acpi/achware.h
@@ -44,7 +44,6 @@
44#ifndef __ACHWARE_H__ 44#ifndef __ACHWARE_H__
45#define __ACHWARE_H__ 45#define __ACHWARE_H__
46 46
47
48/* PM Timer ticks per second (HZ) */ 47/* PM Timer ticks per second (HZ) */
49 48
50#define PM_TIMER_FREQUENCY 3579545 49#define PM_TIMER_FREQUENCY 3579545
@@ -57,126 +56,78 @@
57#define ACPI_SST_SLEEPING 3 56#define ACPI_SST_SLEEPING 3
58#define ACPI_SST_SLEEP_CONTEXT 4 57#define ACPI_SST_SLEEP_CONTEXT 4
59 58
60
61/* Prototypes */ 59/* Prototypes */
62 60
63
64/* 61/*
65 * hwacpi - high level functions 62 * hwacpi - high level functions
66 */ 63 */
67acpi_status 64acpi_status acpi_hw_initialize(void);
68acpi_hw_initialize (
69 void);
70 65
71acpi_status 66acpi_status acpi_hw_set_mode(u32 mode);
72acpi_hw_set_mode (
73 u32 mode);
74
75u32
76acpi_hw_get_mode (
77 void);
78 67
68u32 acpi_hw_get_mode(void);
79 69
80/* 70/*
81 * hwregs - ACPI Register I/O 71 * hwregs - ACPI Register I/O
82 */ 72 */
83struct acpi_bit_register_info * 73struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id);
84acpi_hw_get_bit_register_info (
85 u32 register_id);
86
87acpi_status
88acpi_hw_register_read (
89 u8 use_lock,
90 u32 register_id,
91 u32 *return_value);
92 74
93acpi_status 75acpi_status
94acpi_hw_register_write ( 76acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value);
95 u8 use_lock,
96 u32 register_id,
97 u32 value);
98 77
99acpi_status 78acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value);
100acpi_hw_low_level_read (
101 u32 width,
102 u32 *value,
103 struct acpi_generic_address *reg);
104 79
105acpi_status 80acpi_status
106acpi_hw_low_level_write ( 81acpi_hw_low_level_read(u32 width,
107 u32 width, 82 u32 * value, struct acpi_generic_address *reg);
108 u32 value,
109 struct acpi_generic_address *reg);
110 83
111acpi_status 84acpi_status
112acpi_hw_clear_acpi_status ( 85acpi_hw_low_level_write(u32 width, u32 value, struct acpi_generic_address *reg);
113 u32 flags);
114 86
87acpi_status acpi_hw_clear_acpi_status(u32 flags);
115 88
116/* 89/*
117 * hwgpe - GPE support 90 * hwgpe - GPE support
118 */ 91 */
119acpi_status 92acpi_status
120acpi_hw_write_gpe_enable_reg ( 93acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info *gpe_event_info);
121 struct acpi_gpe_event_info *gpe_event_info);
122 94
123acpi_status 95acpi_status
124acpi_hw_disable_gpe_block ( 96acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
125 struct acpi_gpe_xrupt_info *gpe_xrupt_info, 97 struct acpi_gpe_block_info *gpe_block);
126 struct acpi_gpe_block_info *gpe_block);
127 98
128acpi_status 99acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info *gpe_event_info);
129acpi_hw_clear_gpe (
130 struct acpi_gpe_event_info *gpe_event_info);
131 100
132acpi_status 101acpi_status
133acpi_hw_clear_gpe_block ( 102acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
134 struct acpi_gpe_xrupt_info *gpe_xrupt_info, 103 struct acpi_gpe_block_info *gpe_block);
135 struct acpi_gpe_block_info *gpe_block);
136 104
137#ifdef ACPI_FUTURE_USAGE 105#ifdef ACPI_FUTURE_USAGE
138acpi_status 106acpi_status
139acpi_hw_get_gpe_status ( 107acpi_hw_get_gpe_status(struct acpi_gpe_event_info *gpe_event_info,
140 struct acpi_gpe_event_info *gpe_event_info, 108 acpi_event_status * event_status);
141 acpi_event_status *event_status); 109#endif /* ACPI_FUTURE_USAGE */
142#endif /* ACPI_FUTURE_USAGE */
143 110
144acpi_status 111acpi_status acpi_hw_disable_all_gpes(void);
145acpi_hw_disable_all_gpes (
146 u32 flags);
147 112
148acpi_status 113acpi_status acpi_hw_enable_all_runtime_gpes(void);
149acpi_hw_enable_all_runtime_gpes (
150 u32 flags);
151 114
152acpi_status 115acpi_status acpi_hw_enable_all_wakeup_gpes(void);
153acpi_hw_enable_all_wakeup_gpes (
154 u32 flags);
155 116
156acpi_status 117acpi_status
157acpi_hw_enable_runtime_gpe_block ( 118acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
158 struct acpi_gpe_xrupt_info *gpe_xrupt_info, 119 struct acpi_gpe_block_info *gpe_block);
159 struct acpi_gpe_block_info *gpe_block);
160
161 120
162#ifdef ACPI_FUTURE_USAGE 121#ifdef ACPI_FUTURE_USAGE
163/* 122/*
164 * hwtimer - ACPI Timer prototypes 123 * hwtimer - ACPI Timer prototypes
165 */ 124 */
166acpi_status 125acpi_status acpi_get_timer_resolution(u32 * resolution);
167acpi_get_timer_resolution (
168 u32 *resolution);
169 126
170acpi_status 127acpi_status acpi_get_timer(u32 * ticks);
171acpi_get_timer (
172 u32 *ticks);
173 128
174acpi_status 129acpi_status
175acpi_get_timer_duration ( 130acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed);
176 u32 start_ticks, 131#endif /* ACPI_FUTURE_USAGE */
177 u32 end_ticks,
178 u32 *time_elapsed);
179#endif /* ACPI_FUTURE_USAGE */
180
181 132
182#endif /* __ACHWARE_H__ */ 133#endif /* __ACHWARE_H__ */
diff --git a/include/acpi/acinterp.h b/include/acpi/acinterp.h
index 5c7172477a0f..2c9c1a1d1b7f 100644
--- a/include/acpi/acinterp.h
+++ b/include/acpi/acinterp.h
@@ -44,29 +44,22 @@
44#ifndef __ACINTERP_H__ 44#ifndef __ACINTERP_H__
45#define __ACINTERP_H__ 45#define __ACINTERP_H__
46 46
47
48#define ACPI_WALK_OPERANDS (&(walk_state->operands [walk_state->num_operands -1])) 47#define ACPI_WALK_OPERANDS (&(walk_state->operands [walk_state->num_operands -1]))
49 48
50
51/* 49/*
52 * exconvrt - object conversion 50 * exconvrt - object conversion
53 */ 51 */
54acpi_status 52acpi_status
55acpi_ex_convert_to_integer ( 53acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
56 union acpi_operand_object *obj_desc, 54 union acpi_operand_object **result_desc, u32 flags);
57 union acpi_operand_object **result_desc,
58 u32 flags);
59 55
60acpi_status 56acpi_status
61acpi_ex_convert_to_buffer ( 57acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc,
62 union acpi_operand_object *obj_desc, 58 union acpi_operand_object **result_desc);
63 union acpi_operand_object **result_desc);
64 59
65acpi_status 60acpi_status
66acpi_ex_convert_to_string ( 61acpi_ex_convert_to_string(union acpi_operand_object *obj_desc,
67 union acpi_operand_object *obj_desc, 62 union acpi_operand_object **result_desc, u32 type);
68 union acpi_operand_object **result_desc,
69 u32 type);
70 63
71/* Types for ->String conversion */ 64/* Types for ->String conversion */
72 65
@@ -76,587 +69,412 @@ acpi_ex_convert_to_string (
76#define ACPI_EXPLICIT_CONVERT_DECIMAL 0x00000003 69#define ACPI_EXPLICIT_CONVERT_DECIMAL 0x00000003
77 70
78acpi_status 71acpi_status
79acpi_ex_convert_to_target_type ( 72acpi_ex_convert_to_target_type(acpi_object_type destination_type,
80 acpi_object_type destination_type, 73 union acpi_operand_object *source_desc,
81 union acpi_operand_object *source_desc, 74 union acpi_operand_object **result_desc,
82 union acpi_operand_object **result_desc, 75 struct acpi_walk_state *walk_state);
83 struct acpi_walk_state *walk_state);
84
85 76
86/* 77/*
87 * exfield - ACPI AML (p-code) execution - field manipulation 78 * exfield - ACPI AML (p-code) execution - field manipulation
88 */ 79 */
89acpi_status 80acpi_status
90acpi_ex_common_buffer_setup ( 81acpi_ex_common_buffer_setup(union acpi_operand_object *obj_desc,
91 union acpi_operand_object *obj_desc, 82 u32 buffer_length, u32 * datum_count);
92 u32 buffer_length,
93 u32 *datum_count);
94 83
95acpi_status 84acpi_status
96acpi_ex_write_with_update_rule ( 85acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc,
97 union acpi_operand_object *obj_desc, 86 acpi_integer mask,
98 acpi_integer mask, 87 acpi_integer field_value,
99 acpi_integer field_value, 88 u32 field_datum_byte_offset);
100 u32 field_datum_byte_offset);
101 89
102void 90void
103acpi_ex_get_buffer_datum( 91acpi_ex_get_buffer_datum(acpi_integer * datum,
104 acpi_integer *datum, 92 void *buffer,
105 void *buffer, 93 u32 buffer_length,
106 u32 buffer_length, 94 u32 byte_granularity, u32 buffer_offset);
107 u32 byte_granularity,
108 u32 buffer_offset);
109 95
110void 96void
111acpi_ex_set_buffer_datum ( 97acpi_ex_set_buffer_datum(acpi_integer merged_datum,
112 acpi_integer merged_datum, 98 void *buffer,
113 void *buffer, 99 u32 buffer_length,
114 u32 buffer_length, 100 u32 byte_granularity, u32 buffer_offset);
115 u32 byte_granularity,
116 u32 buffer_offset);
117 101
118acpi_status 102acpi_status
119acpi_ex_read_data_from_field ( 103acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
120 struct acpi_walk_state *walk_state, 104 union acpi_operand_object *obj_desc,
121 union acpi_operand_object *obj_desc, 105 union acpi_operand_object **ret_buffer_desc);
122 union acpi_operand_object **ret_buffer_desc);
123 106
124acpi_status 107acpi_status
125acpi_ex_write_data_to_field ( 108acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
126 union acpi_operand_object *source_desc, 109 union acpi_operand_object *obj_desc,
127 union acpi_operand_object *obj_desc, 110 union acpi_operand_object **result_desc);
128 union acpi_operand_object **result_desc);
129
130 111
131/* 112/*
132 * exfldio - low level field I/O 113 * exfldio - low level field I/O
133 */ 114 */
134acpi_status 115acpi_status
135acpi_ex_extract_from_field ( 116acpi_ex_extract_from_field(union acpi_operand_object *obj_desc,
136 union acpi_operand_object *obj_desc, 117 void *buffer, u32 buffer_length);
137 void *buffer,
138 u32 buffer_length);
139 118
140acpi_status 119acpi_status
141acpi_ex_insert_into_field ( 120acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
142 union acpi_operand_object *obj_desc, 121 void *buffer, u32 buffer_length);
143 void *buffer,
144 u32 buffer_length);
145 122
146acpi_status 123acpi_status
147acpi_ex_access_region ( 124acpi_ex_access_region(union acpi_operand_object *obj_desc,
148 union acpi_operand_object *obj_desc, 125 u32 field_datum_byte_offset,
149 u32 field_datum_byte_offset, 126 acpi_integer * value, u32 read_write);
150 acpi_integer *value,
151 u32 read_write);
152
153 127
154/* 128/*
155 * exmisc - misc support routines 129 * exmisc - misc support routines
156 */ 130 */
157acpi_status 131acpi_status
158acpi_ex_get_object_reference ( 132acpi_ex_get_object_reference(union acpi_operand_object *obj_desc,
159 union acpi_operand_object *obj_desc, 133 union acpi_operand_object **return_desc,
160 union acpi_operand_object **return_desc, 134 struct acpi_walk_state *walk_state);
161 struct acpi_walk_state *walk_state);
162 135
163acpi_status 136acpi_status
164acpi_ex_concat_template ( 137acpi_ex_concat_template(union acpi_operand_object *obj_desc,
165 union acpi_operand_object *obj_desc, 138 union acpi_operand_object *obj_desc2,
166 union acpi_operand_object *obj_desc2, 139 union acpi_operand_object **actual_return_desc,
167 union acpi_operand_object **actual_return_desc, 140 struct acpi_walk_state *walk_state);
168 struct acpi_walk_state *walk_state);
169 141
170acpi_status 142acpi_status
171acpi_ex_do_concatenate ( 143acpi_ex_do_concatenate(union acpi_operand_object *obj_desc,
172 union acpi_operand_object *obj_desc, 144 union acpi_operand_object *obj_desc2,
173 union acpi_operand_object *obj_desc2, 145 union acpi_operand_object **actual_return_desc,
174 union acpi_operand_object **actual_return_desc, 146 struct acpi_walk_state *walk_state);
175 struct acpi_walk_state *walk_state);
176 147
177acpi_status 148acpi_status
178acpi_ex_do_logical_numeric_op ( 149acpi_ex_do_logical_numeric_op(u16 opcode,
179 u16 opcode, 150 acpi_integer integer0,
180 acpi_integer integer0, 151 acpi_integer integer1, u8 * logical_result);
181 acpi_integer integer1,
182 u8 *logical_result);
183 152
184acpi_status 153acpi_status
185acpi_ex_do_logical_op ( 154acpi_ex_do_logical_op(u16 opcode,
186 u16 opcode, 155 union acpi_operand_object *operand0,
187 union acpi_operand_object *operand0, 156 union acpi_operand_object *operand1, u8 * logical_result);
188 union acpi_operand_object *operand1,
189 u8 *logical_result);
190 157
191acpi_integer 158acpi_integer
192acpi_ex_do_math_op ( 159acpi_ex_do_math_op(u16 opcode, acpi_integer operand0, acpi_integer operand1);
193 u16 opcode,
194 acpi_integer operand0,
195 acpi_integer operand1);
196 160
197acpi_status 161acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state);
198acpi_ex_create_mutex (
199 struct acpi_walk_state *walk_state);
200 162
201acpi_status 163acpi_status acpi_ex_create_processor(struct acpi_walk_state *walk_state);
202acpi_ex_create_processor (
203 struct acpi_walk_state *walk_state);
204 164
205acpi_status 165acpi_status acpi_ex_create_power_resource(struct acpi_walk_state *walk_state);
206acpi_ex_create_power_resource (
207 struct acpi_walk_state *walk_state);
208 166
209acpi_status 167acpi_status
210acpi_ex_create_region ( 168acpi_ex_create_region(u8 * aml_start,
211 u8 *aml_start, 169 u32 aml_length,
212 u32 aml_length, 170 u8 region_space, struct acpi_walk_state *walk_state);
213 u8 region_space,
214 struct acpi_walk_state *walk_state);
215 171
216acpi_status 172acpi_status acpi_ex_create_table_region(struct acpi_walk_state *walk_state);
217acpi_ex_create_table_region (
218 struct acpi_walk_state *walk_state);
219 173
220acpi_status 174acpi_status acpi_ex_create_event(struct acpi_walk_state *walk_state);
221acpi_ex_create_event (
222 struct acpi_walk_state *walk_state);
223 175
224acpi_status 176acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state);
225acpi_ex_create_alias (
226 struct acpi_walk_state *walk_state);
227 177
228acpi_status 178acpi_status
229acpi_ex_create_method ( 179acpi_ex_create_method(u8 * aml_start,
230 u8 *aml_start, 180 u32 aml_length, struct acpi_walk_state *walk_state);
231 u32 aml_length,
232 struct acpi_walk_state *walk_state);
233
234 181
235/* 182/*
236 * exconfig - dynamic table load/unload 183 * exconfig - dynamic table load/unload
237 */ 184 */
238acpi_status 185acpi_status
239acpi_ex_load_op ( 186acpi_ex_load_op(union acpi_operand_object *obj_desc,
240 union acpi_operand_object *obj_desc, 187 union acpi_operand_object *target,
241 union acpi_operand_object *target, 188 struct acpi_walk_state *walk_state);
242 struct acpi_walk_state *walk_state);
243 189
244acpi_status 190acpi_status
245acpi_ex_load_table_op ( 191acpi_ex_load_table_op(struct acpi_walk_state *walk_state,
246 struct acpi_walk_state *walk_state, 192 union acpi_operand_object **return_desc);
247 union acpi_operand_object **return_desc);
248
249acpi_status
250acpi_ex_unload_table (
251 union acpi_operand_object *ddb_handle);
252 193
194acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle);
253 195
254/* 196/*
255 * exmutex - mutex support 197 * exmutex - mutex support
256 */ 198 */
257acpi_status 199acpi_status
258acpi_ex_acquire_mutex ( 200acpi_ex_acquire_mutex(union acpi_operand_object *time_desc,
259 union acpi_operand_object *time_desc, 201 union acpi_operand_object *obj_desc,
260 union acpi_operand_object *obj_desc, 202 struct acpi_walk_state *walk_state);
261 struct acpi_walk_state *walk_state);
262 203
263acpi_status 204acpi_status
264acpi_ex_release_mutex ( 205acpi_ex_release_mutex(union acpi_operand_object *obj_desc,
265 union acpi_operand_object *obj_desc, 206 struct acpi_walk_state *walk_state);
266 struct acpi_walk_state *walk_state);
267 207
268void 208void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread);
269acpi_ex_release_all_mutexes (
270 struct acpi_thread_state *thread);
271
272void
273acpi_ex_unlink_mutex (
274 union acpi_operand_object *obj_desc);
275 209
210void acpi_ex_unlink_mutex(union acpi_operand_object *obj_desc);
276 211
277/* 212/*
278 * exprep - ACPI AML execution - prep utilities 213 * exprep - ACPI AML execution - prep utilities
279 */ 214 */
280acpi_status 215acpi_status
281acpi_ex_prep_common_field_object ( 216acpi_ex_prep_common_field_object(union acpi_operand_object *obj_desc,
282 union acpi_operand_object *obj_desc, 217 u8 field_flags,
283 u8 field_flags, 218 u8 field_attribute,
284 u8 field_attribute, 219 u32 field_bit_position, u32 field_bit_length);
285 u32 field_bit_position,
286 u32 field_bit_length);
287
288acpi_status
289acpi_ex_prep_field_value (
290 struct acpi_create_field_info *info);
291 220
221acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info);
292 222
293/* 223/*
294 * exsystem - Interface to OS services 224 * exsystem - Interface to OS services
295 */ 225 */
296acpi_status 226acpi_status
297acpi_ex_system_do_notify_op ( 227acpi_ex_system_do_notify_op(union acpi_operand_object *value,
298 union acpi_operand_object *value, 228 union acpi_operand_object *obj_desc);
299 union acpi_operand_object *obj_desc);
300 229
301acpi_status 230acpi_status acpi_ex_system_do_suspend(acpi_integer time);
302acpi_ex_system_do_suspend(
303 acpi_integer time);
304 231
305acpi_status 232acpi_status acpi_ex_system_do_stall(u32 time);
306acpi_ex_system_do_stall (
307 u32 time);
308 233
309acpi_status 234acpi_status
310acpi_ex_system_acquire_mutex( 235acpi_ex_system_acquire_mutex(union acpi_operand_object *time,
311 union acpi_operand_object *time, 236 union acpi_operand_object *obj_desc);
312 union acpi_operand_object *obj_desc);
313 237
314acpi_status 238acpi_status acpi_ex_system_release_mutex(union acpi_operand_object *obj_desc);
315acpi_ex_system_release_mutex(
316 union acpi_operand_object *obj_desc);
317 239
318acpi_status 240acpi_status acpi_ex_system_signal_event(union acpi_operand_object *obj_desc);
319acpi_ex_system_signal_event(
320 union acpi_operand_object *obj_desc);
321 241
322acpi_status 242acpi_status
323acpi_ex_system_wait_event( 243acpi_ex_system_wait_event(union acpi_operand_object *time,
324 union acpi_operand_object *time, 244 union acpi_operand_object *obj_desc);
325 union acpi_operand_object *obj_desc);
326 245
327acpi_status 246acpi_status acpi_ex_system_reset_event(union acpi_operand_object *obj_desc);
328acpi_ex_system_reset_event(
329 union acpi_operand_object *obj_desc);
330
331acpi_status
332acpi_ex_system_wait_semaphore (
333 acpi_handle semaphore,
334 u16 timeout);
335 247
248acpi_status acpi_ex_system_wait_semaphore(acpi_handle semaphore, u16 timeout);
336 249
337/* 250/*
338 * exoparg1 - ACPI AML execution, 1 operand 251 * exoparg1 - ACPI AML execution, 1 operand
339 */ 252 */
340acpi_status 253acpi_status acpi_ex_opcode_0A_0T_1R(struct acpi_walk_state *walk_state);
341acpi_ex_opcode_0A_0T_1R (
342 struct acpi_walk_state *walk_state);
343 254
344acpi_status 255acpi_status acpi_ex_opcode_1A_0T_0R(struct acpi_walk_state *walk_state);
345acpi_ex_opcode_1A_0T_0R (
346 struct acpi_walk_state *walk_state);
347 256
348acpi_status 257acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state);
349acpi_ex_opcode_1A_0T_1R (
350 struct acpi_walk_state *walk_state);
351 258
352acpi_status 259acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state);
353acpi_ex_opcode_1A_1T_1R (
354 struct acpi_walk_state *walk_state);
355 260
356acpi_status 261acpi_status acpi_ex_opcode_1A_1T_0R(struct acpi_walk_state *walk_state);
357acpi_ex_opcode_1A_1T_0R (
358 struct acpi_walk_state *walk_state);
359 262
360/* 263/*
361 * exoparg2 - ACPI AML execution, 2 operands 264 * exoparg2 - ACPI AML execution, 2 operands
362 */ 265 */
363acpi_status 266acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state);
364acpi_ex_opcode_2A_0T_0R (
365 struct acpi_walk_state *walk_state);
366 267
367acpi_status 268acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state);
368acpi_ex_opcode_2A_0T_1R (
369 struct acpi_walk_state *walk_state);
370 269
371acpi_status 270acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state);
372acpi_ex_opcode_2A_1T_1R (
373 struct acpi_walk_state *walk_state);
374
375acpi_status
376acpi_ex_opcode_2A_2T_1R (
377 struct acpi_walk_state *walk_state);
378 271
272acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state);
379 273
380/* 274/*
381 * exoparg3 - ACPI AML execution, 3 operands 275 * exoparg3 - ACPI AML execution, 3 operands
382 */ 276 */
383acpi_status 277acpi_status acpi_ex_opcode_3A_0T_0R(struct acpi_walk_state *walk_state);
384acpi_ex_opcode_3A_0T_0R (
385 struct acpi_walk_state *walk_state);
386
387acpi_status
388acpi_ex_opcode_3A_1T_1R (
389 struct acpi_walk_state *walk_state);
390 278
279acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state);
391 280
392/* 281/*
393 * exoparg6 - ACPI AML execution, 6 operands 282 * exoparg6 - ACPI AML execution, 6 operands
394 */ 283 */
395acpi_status 284acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state *walk_state);
396acpi_ex_opcode_6A_0T_1R (
397 struct acpi_walk_state *walk_state);
398
399 285
400/* 286/*
401 * exresolv - Object resolution and get value functions 287 * exresolv - Object resolution and get value functions
402 */ 288 */
403acpi_status 289acpi_status
404acpi_ex_resolve_to_value ( 290acpi_ex_resolve_to_value(union acpi_operand_object **stack_ptr,
405 union acpi_operand_object **stack_ptr, 291 struct acpi_walk_state *walk_state);
406 struct acpi_walk_state *walk_state);
407 292
408acpi_status 293acpi_status
409acpi_ex_resolve_multiple ( 294acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
410 struct acpi_walk_state *walk_state, 295 union acpi_operand_object *operand,
411 union acpi_operand_object *operand, 296 acpi_object_type * return_type,
412 acpi_object_type *return_type, 297 union acpi_operand_object **return_desc);
413 union acpi_operand_object **return_desc);
414
415 298
416/* 299/*
417 * exresnte - resolve namespace node 300 * exresnte - resolve namespace node
418 */ 301 */
419acpi_status 302acpi_status
420acpi_ex_resolve_node_to_value ( 303acpi_ex_resolve_node_to_value(struct acpi_namespace_node **stack_ptr,
421 struct acpi_namespace_node **stack_ptr, 304 struct acpi_walk_state *walk_state);
422 struct acpi_walk_state *walk_state);
423
424 305
425/* 306/*
426 * exresop - resolve operand to value 307 * exresop - resolve operand to value
427 */ 308 */
428acpi_status 309acpi_status
429acpi_ex_resolve_operands ( 310acpi_ex_resolve_operands(u16 opcode,
430 u16 opcode, 311 union acpi_operand_object **stack_ptr,
431 union acpi_operand_object **stack_ptr, 312 struct acpi_walk_state *walk_state);
432 struct acpi_walk_state *walk_state);
433
434 313
435/* 314/*
436 * exdump - Interpreter debug output routines 315 * exdump - Interpreter debug output routines
437 */ 316 */
438void 317void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth);
439acpi_ex_dump_operand (
440 union acpi_operand_object *obj_desc,
441 u32 depth);
442 318
443void 319void
444acpi_ex_dump_operands ( 320acpi_ex_dump_operands(union acpi_operand_object **operands,
445 union acpi_operand_object **operands, 321 acpi_interpreter_mode interpreter_mode,
446 acpi_interpreter_mode interpreter_mode, 322 char *ident,
447 char *ident, 323 u32 num_levels,
448 u32 num_levels, 324 char *note, char *module_name, u32 line_number);
449 char *note,
450 char *module_name,
451 u32 line_number);
452 325
453#ifdef ACPI_FUTURE_USAGE 326#ifdef ACPI_FUTURE_USAGE
454void 327void
455acpi_ex_dump_object_descriptor ( 328acpi_ex_dump_object_descriptor(union acpi_operand_object *object, u32 flags);
456 union acpi_operand_object *object,
457 u32 flags);
458
459void
460acpi_ex_dump_node (
461 struct acpi_namespace_node *node,
462 u32 flags);
463#endif /* ACPI_FUTURE_USAGE */
464 329
330void acpi_ex_dump_node(struct acpi_namespace_node *node, u32 flags);
331#endif /* ACPI_FUTURE_USAGE */
465 332
466/* 333/*
467 * exnames - AML namestring support 334 * exnames - AML namestring support
468 */ 335 */
469acpi_status 336acpi_status
470acpi_ex_get_name_string ( 337acpi_ex_get_name_string(acpi_object_type data_type,
471 acpi_object_type data_type, 338 u8 * in_aml_address,
472 u8 *in_aml_address, 339 char **out_name_string, u32 * out_name_length);
473 char **out_name_string,
474 u32 *out_name_length);
475
476 340
477/* 341/*
478 * exstore - Object store support 342 * exstore - Object store support
479 */ 343 */
480acpi_status 344acpi_status
481acpi_ex_store ( 345acpi_ex_store(union acpi_operand_object *val_desc,
482 union acpi_operand_object *val_desc, 346 union acpi_operand_object *dest_desc,
483 union acpi_operand_object *dest_desc, 347 struct acpi_walk_state *walk_state);
484 struct acpi_walk_state *walk_state);
485 348
486acpi_status 349acpi_status
487acpi_ex_store_object_to_node ( 350acpi_ex_store_object_to_node(union acpi_operand_object *source_desc,
488 union acpi_operand_object *source_desc, 351 struct acpi_namespace_node *node,
489 struct acpi_namespace_node *node, 352 struct acpi_walk_state *walk_state,
490 struct acpi_walk_state *walk_state, 353 u8 implicit_conversion);
491 u8 implicit_conversion);
492 354
493#define ACPI_IMPLICIT_CONVERSION TRUE 355#define ACPI_IMPLICIT_CONVERSION TRUE
494#define ACPI_NO_IMPLICIT_CONVERSION FALSE 356#define ACPI_NO_IMPLICIT_CONVERSION FALSE
495 357
496
497/* 358/*
498 * exstoren - resolve/store object 359 * exstoren - resolve/store object
499 */ 360 */
500acpi_status 361acpi_status
501acpi_ex_resolve_object ( 362acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,
502 union acpi_operand_object **source_desc_ptr, 363 acpi_object_type target_type,
503 acpi_object_type target_type, 364 struct acpi_walk_state *walk_state);
504 struct acpi_walk_state *walk_state);
505 365
506acpi_status 366acpi_status
507acpi_ex_store_object_to_object ( 367acpi_ex_store_object_to_object(union acpi_operand_object *source_desc,
508 union acpi_operand_object *source_desc, 368 union acpi_operand_object *dest_desc,
509 union acpi_operand_object *dest_desc, 369 union acpi_operand_object **new_desc,
510 union acpi_operand_object **new_desc, 370 struct acpi_walk_state *walk_state);
511 struct acpi_walk_state *walk_state);
512
513 371
514/* 372/*
515 * exstorob - store object - buffer/string 373 * exstorob - store object - buffer/string
516 */ 374 */
517acpi_status 375acpi_status
518acpi_ex_store_buffer_to_buffer ( 376acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc,
519 union acpi_operand_object *source_desc, 377 union acpi_operand_object *target_desc);
520 union acpi_operand_object *target_desc);
521 378
522acpi_status 379acpi_status
523acpi_ex_store_string_to_string ( 380acpi_ex_store_string_to_string(union acpi_operand_object *source_desc,
524 union acpi_operand_object *source_desc, 381 union acpi_operand_object *target_desc);
525 union acpi_operand_object *target_desc);
526
527 382
528/* 383/*
529 * excopy - object copy 384 * excopy - object copy
530 */ 385 */
531acpi_status 386acpi_status
532acpi_ex_copy_integer_to_index_field ( 387acpi_ex_copy_integer_to_index_field(union acpi_operand_object *source_desc,
533 union acpi_operand_object *source_desc, 388 union acpi_operand_object *target_desc);
534 union acpi_operand_object *target_desc);
535 389
536acpi_status 390acpi_status
537acpi_ex_copy_integer_to_bank_field ( 391acpi_ex_copy_integer_to_bank_field(union acpi_operand_object *source_desc,
538 union acpi_operand_object *source_desc, 392 union acpi_operand_object *target_desc);
539 union acpi_operand_object *target_desc);
540 393
541acpi_status 394acpi_status
542acpi_ex_copy_data_to_named_field ( 395acpi_ex_copy_data_to_named_field(union acpi_operand_object *source_desc,
543 union acpi_operand_object *source_desc, 396 struct acpi_namespace_node *node);
544 struct acpi_namespace_node *node);
545 397
546acpi_status 398acpi_status
547acpi_ex_copy_integer_to_buffer_field ( 399acpi_ex_copy_integer_to_buffer_field(union acpi_operand_object *source_desc,
548 union acpi_operand_object *source_desc, 400 union acpi_operand_object *target_desc);
549 union acpi_operand_object *target_desc);
550
551 401
552/* 402/*
553 * exutils - interpreter/scanner utilities 403 * exutils - interpreter/scanner utilities
554 */ 404 */
555acpi_status 405acpi_status acpi_ex_enter_interpreter(void);
556acpi_ex_enter_interpreter (
557 void);
558 406
559void 407void acpi_ex_exit_interpreter(void);
560acpi_ex_exit_interpreter (
561 void);
562 408
563void 409void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc);
564acpi_ex_truncate_for32bit_table (
565 union acpi_operand_object *obj_desc);
566 410
567u8 411u8 acpi_ex_acquire_global_lock(u32 rule);
568acpi_ex_acquire_global_lock (
569 u32 rule);
570 412
571void 413void acpi_ex_release_global_lock(u8 locked);
572acpi_ex_release_global_lock (
573 u8 locked);
574 414
575void 415void acpi_ex_eisa_id_to_string(u32 numeric_id, char *out_string);
576acpi_ex_eisa_id_to_string (
577 u32 numeric_id,
578 char *out_string);
579
580void
581acpi_ex_unsigned_integer_to_string (
582 acpi_integer value,
583 char *out_string);
584 416
417void acpi_ex_unsigned_integer_to_string(acpi_integer value, char *out_string);
585 418
586/* 419/*
587 * exregion - default op_region handlers 420 * exregion - default op_region handlers
588 */ 421 */
589acpi_status 422acpi_status
590acpi_ex_system_memory_space_handler ( 423acpi_ex_system_memory_space_handler(u32 function,
591 u32 function, 424 acpi_physical_address address,
592 acpi_physical_address address, 425 u32 bit_width,
593 u32 bit_width, 426 acpi_integer * value,
594 acpi_integer *value, 427 void *handler_context,
595 void *handler_context, 428 void *region_context);
596 void *region_context); 429
597 430acpi_status
598acpi_status 431acpi_ex_system_io_space_handler(u32 function,
599acpi_ex_system_io_space_handler ( 432 acpi_physical_address address,
600 u32 function, 433 u32 bit_width,
601 acpi_physical_address address, 434 acpi_integer * value,
602 u32 bit_width, 435 void *handler_context, void *region_context);
603 acpi_integer *value, 436
604 void *handler_context, 437acpi_status
605 void *region_context); 438acpi_ex_pci_config_space_handler(u32 function,
606 439 acpi_physical_address address,
607acpi_status 440 u32 bit_width,
608acpi_ex_pci_config_space_handler ( 441 acpi_integer * value,
609 u32 function, 442 void *handler_context, void *region_context);
610 acpi_physical_address address, 443
611 u32 bit_width, 444acpi_status
612 acpi_integer *value, 445acpi_ex_cmos_space_handler(u32 function,
613 void *handler_context, 446 acpi_physical_address address,
614 void *region_context); 447 u32 bit_width,
615 448 acpi_integer * value,
616acpi_status 449 void *handler_context, void *region_context);
617acpi_ex_cmos_space_handler ( 450
618 u32 function, 451acpi_status
619 acpi_physical_address address, 452acpi_ex_pci_bar_space_handler(u32 function,
620 u32 bit_width, 453 acpi_physical_address address,
621 acpi_integer *value, 454 u32 bit_width,
622 void *handler_context, 455 acpi_integer * value,
623 void *region_context); 456 void *handler_context, void *region_context);
624 457
625acpi_status 458acpi_status
626acpi_ex_pci_bar_space_handler ( 459acpi_ex_embedded_controller_space_handler(u32 function,
627 u32 function, 460 acpi_physical_address address,
628 acpi_physical_address address, 461 u32 bit_width,
629 u32 bit_width, 462 acpi_integer * value,
630 acpi_integer *value, 463 void *handler_context,
631 void *handler_context, 464 void *region_context);
632 void *region_context); 465
633 466acpi_status
634acpi_status 467acpi_ex_sm_bus_space_handler(u32 function,
635acpi_ex_embedded_controller_space_handler ( 468 acpi_physical_address address,
636 u32 function, 469 u32 bit_width,
637 acpi_physical_address address, 470 acpi_integer * value,
638 u32 bit_width, 471 void *handler_context, void *region_context);
639 acpi_integer *value, 472
640 void *handler_context, 473acpi_status
641 void *region_context); 474acpi_ex_data_table_space_handler(u32 function,
642 475 acpi_physical_address address,
643acpi_status 476 u32 bit_width,
644acpi_ex_sm_bus_space_handler ( 477 acpi_integer * value,
645 u32 function, 478 void *handler_context, void *region_context);
646 acpi_physical_address address, 479
647 u32 bit_width, 480#endif /* __INTERP_H__ */
648 acpi_integer *value,
649 void *handler_context,
650 void *region_context);
651
652
653acpi_status
654acpi_ex_data_table_space_handler (
655 u32 function,
656 acpi_physical_address address,
657 u32 bit_width,
658 acpi_integer *value,
659 void *handler_context,
660 void *region_context);
661
662#endif /* __INTERP_H__ */
diff --git a/include/acpi/aclocal.h b/include/acpi/aclocal.h
index 030e641115cb..9fba0fddda90 100644
--- a/include/acpi/aclocal.h
+++ b/include/acpi/aclocal.h
@@ -44,17 +44,20 @@
44#ifndef __ACLOCAL_H__ 44#ifndef __ACLOCAL_H__
45#define __ACLOCAL_H__ 45#define __ACLOCAL_H__
46 46
47#define ACPI_WAIT_FOREVER 0xFFFF /* u16, as per ACPI spec */
47 48
48#define ACPI_WAIT_FOREVER 0xFFFF /* u16, as per ACPI spec */ 49typedef void *acpi_mutex;
49 50typedef u32 acpi_mutex_handle;
50typedef void * acpi_mutex;
51typedef u32 acpi_mutex_handle;
52
53 51
54/* Total number of aml opcodes defined */ 52/* Total number of aml opcodes defined */
55 53
56#define AML_NUM_OPCODES 0x7F 54#define AML_NUM_OPCODES 0x7F
57 55
56/* Forward declarations */
57
58struct acpi_walk_state;
59struct acpi_obj_mutex;
60union acpi_parse_object;
58 61
59/***************************************************************************** 62/*****************************************************************************
60 * 63 *
@@ -62,7 +65,6 @@ typedef u32 acpi_mutex_handle;
62 * 65 *
63 ****************************************************************************/ 66 ****************************************************************************/
64 67
65
66/* 68/*
67 * Predefined handles for the mutex objects used within the subsystem 69 * Predefined handles for the mutex objects used within the subsystem
68 * All mutex objects are automatically created by acpi_ut_mutex_initialize. 70 * All mutex objects are automatically created by acpi_ut_mutex_initialize.
@@ -89,14 +91,12 @@ typedef u32 acpi_mutex_handle;
89#define MAX_MUTEX 12 91#define MAX_MUTEX 12
90#define NUM_MUTEX MAX_MUTEX+1 92#define NUM_MUTEX MAX_MUTEX+1
91 93
92
93#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) 94#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
94#ifdef DEFINE_ACPI_GLOBALS 95#ifdef DEFINE_ACPI_GLOBALS
95 96
96/* Names for the mutexes used in the subsystem */ 97/* Names for the mutexes used in the subsystem */
97 98
98static char *acpi_gbl_mutex_names[] = 99static char *acpi_gbl_mutex_names[] = {
99{
100 "ACPI_MTX_Execute", 100 "ACPI_MTX_Execute",
101 "ACPI_MTX_Interpreter", 101 "ACPI_MTX_Interpreter",
102 "ACPI_MTX_Parser", 102 "ACPI_MTX_Parser",
@@ -115,34 +115,28 @@ static char *acpi_gbl_mutex_names[] =
115#endif 115#endif
116#endif 116#endif
117 117
118/* Owner IDs are used to track namespace nodes for selective deletion */
118 119
119/* Table for the global mutexes */ 120typedef u8 acpi_owner_id;
121#define ACPI_OWNER_ID_MAX 0xFF
120 122
121struct acpi_mutex_info 123/* This Thread ID means that the mutex is not in use (unlocked) */
122{
123 acpi_mutex mutex;
124 u32 use_count;
125 u32 owner_id;
126};
127 124
128/* This owner ID means that the mutex is not in use (unlocked) */ 125#define ACPI_MUTEX_NOT_ACQUIRED (u32) -1
129 126
130#define ACPI_MUTEX_NOT_ACQUIRED (u32) (-1) 127/* Table for the global mutexes */
131 128
129struct acpi_mutex_info {
130 acpi_mutex mutex;
131 u32 use_count;
132 u32 thread_id;
133};
132 134
133/* Lock flag parameter for various interfaces */ 135/* Lock flag parameter for various interfaces */
134 136
135#define ACPI_MTX_DO_NOT_LOCK 0 137#define ACPI_MTX_DO_NOT_LOCK 0
136#define ACPI_MTX_LOCK 1 138#define ACPI_MTX_LOCK 1
137 139
138
139typedef u16 acpi_owner_id;
140#define ACPI_OWNER_TYPE_TABLE 0x0
141#define ACPI_OWNER_TYPE_METHOD 0x1
142#define ACPI_FIRST_METHOD_ID 0x0001
143#define ACPI_FIRST_TABLE_ID 0xF000
144
145
146/* Field access granularities */ 140/* Field access granularities */
147 141
148#define ACPI_FIELD_BYTE_GRANULARITY 1 142#define ACPI_FIELD_BYTE_GRANULARITY 1
@@ -150,7 +144,6 @@ typedef u16 acpi_owner_id;
150#define ACPI_FIELD_DWORD_GRANULARITY 4 144#define ACPI_FIELD_DWORD_GRANULARITY 4
151#define ACPI_FIELD_QWORD_GRANULARITY 8 145#define ACPI_FIELD_QWORD_GRANULARITY 8
152 146
153
154/***************************************************************************** 147/*****************************************************************************
155 * 148 *
156 * Namespace typedefs and structs 149 * Namespace typedefs and structs
@@ -159,15 +152,12 @@ typedef u16 acpi_owner_id;
159 152
160/* Operational modes of the AML interpreter/scanner */ 153/* Operational modes of the AML interpreter/scanner */
161 154
162typedef enum 155typedef enum {
163{ 156 ACPI_IMODE_LOAD_PASS1 = 0x01,
164 ACPI_IMODE_LOAD_PASS1 = 0x01, 157 ACPI_IMODE_LOAD_PASS2 = 0x02,
165 ACPI_IMODE_LOAD_PASS2 = 0x02, 158 ACPI_IMODE_EXECUTE = 0x0E
166 ACPI_IMODE_EXECUTE = 0x0E
167
168} acpi_interpreter_mode; 159} acpi_interpreter_mode;
169 160
170
171/* 161/*
172 * The Node describes a named object that appears in the AML 162 * The Node describes a named object that appears in the AML
173 * An acpi_node is used to store Nodes. 163 * An acpi_node is used to store Nodes.
@@ -175,34 +165,37 @@ typedef enum
175 * data_type is used to differentiate between internal descriptors, and MUST 165 * data_type is used to differentiate between internal descriptors, and MUST
176 * be the first byte in this structure. 166 * be the first byte in this structure.
177 */ 167 */
178union acpi_name_union 168union acpi_name_union {
179{ 169 u32 integer;
180 u32 integer; 170 char ascii[4];
181 char ascii[4]; 171};
182}; 172
183 173struct acpi_namespace_node {
184struct acpi_namespace_node 174 u8 descriptor; /* Used to differentiate object descriptor types */
185{ 175 u8 type; /* Type associated with this name */
186 u8 descriptor; /* Used to differentiate object descriptor types */ 176 u16 reference_count; /* Current count of references and children */
187 u8 type; /* Type associated with this name */ 177 union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */
188 u16 owner_id; 178 union acpi_operand_object *object; /* Pointer to attached ACPI object (optional) */
189 union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */ 179 struct acpi_namespace_node *child; /* First child */
190 union acpi_operand_object *object; /* Pointer to attached ACPI object (optional) */ 180 struct acpi_namespace_node *peer; /* Next peer */
191 struct acpi_namespace_node *child; /* First child */ 181 u8 owner_id; /* Who created this node */
192 struct acpi_namespace_node *peer; /* Next peer*/ 182 u8 flags;
193 u16 reference_count; /* Current count of references and children */ 183
194 u8 flags; 184 /* Fields used by the ASL compiler only */
185
186#ifdef ACPI_ASL_COMPILER
187 u32 value;
188 union acpi_parse_object *op;
189#endif
195}; 190};
196 191
197
198#define ACPI_ENTRY_NOT_FOUND NULL 192#define ACPI_ENTRY_NOT_FOUND NULL
199 193
200
201/* Node flags */ 194/* Node flags */
202 195
203#define ANOBJ_RESERVED 0x01 196#define ANOBJ_RESERVED 0x01
204#define ANOBJ_END_OF_PEER_LIST 0x02 197#define ANOBJ_END_OF_PEER_LIST 0x02
205#define ANOBJ_DATA_WIDTH_32 0x04 /* Parent table is 64-bits */ 198#define ANOBJ_DATA_WIDTH_32 0x04 /* Parent table is 64-bits */
206#define ANOBJ_METHOD_ARG 0x08 199#define ANOBJ_METHOD_ARG 0x08
207#define ANOBJ_METHOD_LOCAL 0x10 200#define ANOBJ_METHOD_LOCAL 0x10
208#define ANOBJ_METHOD_NO_RETVAL 0x20 201#define ANOBJ_METHOD_NO_RETVAL 0x20
@@ -212,91 +205,77 @@ struct acpi_namespace_node
212/* 205/*
213 * ACPI Table Descriptor. One per ACPI table 206 * ACPI Table Descriptor. One per ACPI table
214 */ 207 */
215struct acpi_table_desc 208struct acpi_table_desc {
216{ 209 struct acpi_table_desc *prev;
217 struct acpi_table_desc *prev; 210 struct acpi_table_desc *next;
218 struct acpi_table_desc *next; 211 struct acpi_table_desc *installed_desc;
219 struct acpi_table_desc *installed_desc; 212 struct acpi_table_header *pointer;
220 struct acpi_table_header *pointer; 213 u8 *aml_start;
221 u8 *aml_start; 214 u64 physical_address;
222 u64 physical_address; 215 u32 aml_length;
223 u32 aml_length; 216 acpi_size length;
224 acpi_size length; 217 acpi_owner_id owner_id;
225 acpi_owner_id table_id; 218 u8 type;
226 u8 type; 219 u8 allocation;
227 u8 allocation; 220 u8 loaded_into_namespace;
228 u8 loaded_into_namespace;
229}; 221};
230 222
231struct acpi_table_list 223struct acpi_table_list {
232{ 224 struct acpi_table_desc *next;
233 struct acpi_table_desc *next; 225 u32 count;
234 u32 count;
235}; 226};
236 227
237 228struct acpi_find_context {
238struct acpi_find_context 229 char *search_for;
239{ 230 acpi_handle *list;
240 char *search_for; 231 u32 *count;
241 acpi_handle *list;
242 u32 *count;
243}; 232};
244 233
245 234struct acpi_ns_search_data {
246struct acpi_ns_search_data 235 struct acpi_namespace_node *node;
247{
248 struct acpi_namespace_node *node;
249}; 236};
250 237
251
252/* 238/*
253 * Predefined Namespace items 239 * Predefined Namespace items
254 */ 240 */
255struct acpi_predefined_names 241struct acpi_predefined_names {
256{ 242 char *name;
257 char *name; 243 u8 type;
258 u8 type; 244 char *val;
259 char *val;
260}; 245};
261 246
262
263/* Object types used during package copies */ 247/* Object types used during package copies */
264 248
265
266#define ACPI_COPY_TYPE_SIMPLE 0 249#define ACPI_COPY_TYPE_SIMPLE 0
267#define ACPI_COPY_TYPE_PACKAGE 1 250#define ACPI_COPY_TYPE_PACKAGE 1
268 251
269/* Info structure used to convert external<->internal namestrings */ 252/* Info structure used to convert external<->internal namestrings */
270 253
271struct acpi_namestring_info 254struct acpi_namestring_info {
272{ 255 char *external_name;
273 char *external_name; 256 char *next_external_char;
274 char *next_external_char; 257 char *internal_name;
275 char *internal_name; 258 u32 length;
276 u32 length; 259 u32 num_segments;
277 u32 num_segments; 260 u32 num_carats;
278 u32 num_carats; 261 u8 fully_qualified;
279 u8 fully_qualified;
280}; 262};
281 263
282
283/* Field creation info */ 264/* Field creation info */
284 265
285struct acpi_create_field_info 266struct acpi_create_field_info {
286{ 267 struct acpi_namespace_node *region_node;
287 struct acpi_namespace_node *region_node; 268 struct acpi_namespace_node *field_node;
288 struct acpi_namespace_node *field_node; 269 struct acpi_namespace_node *register_node;
289 struct acpi_namespace_node *register_node; 270 struct acpi_namespace_node *data_register_node;
290 struct acpi_namespace_node *data_register_node; 271 u32 bank_value;
291 u32 bank_value; 272 u32 field_bit_position;
292 u32 field_bit_position; 273 u32 field_bit_length;
293 u32 field_bit_length; 274 u8 field_flags;
294 u8 field_flags; 275 u8 attribute;
295 u8 attribute; 276 u8 field_type;
296 u8 field_type;
297}; 277};
298 278
299
300/***************************************************************************** 279/*****************************************************************************
301 * 280 *
302 * Event typedefs and structs 281 * Event typedefs and structs
@@ -305,108 +284,95 @@ struct acpi_create_field_info
305 284
306/* Dispatch info for each GPE -- either a method or handler, cannot be both */ 285/* Dispatch info for each GPE -- either a method or handler, cannot be both */
307 286
308struct acpi_handler_info 287struct acpi_handler_info {
309{ 288 acpi_event_handler address; /* Address of handler, if any */
310 acpi_event_handler address; /* Address of handler, if any */ 289 void *context; /* Context to be passed to handler */
311 void *context; /* Context to be passed to handler */ 290 struct acpi_namespace_node *method_node; /* Method node for this GPE level (saved) */
312 struct acpi_namespace_node *method_node; /* Method node for this GPE level (saved) */
313}; 291};
314 292
315union acpi_gpe_dispatch_info 293union acpi_gpe_dispatch_info {
316{ 294 struct acpi_namespace_node *method_node; /* Method node for this GPE level */
317 struct acpi_namespace_node *method_node; /* Method node for this GPE level */ 295 struct acpi_handler_info *handler;
318 struct acpi_handler_info *handler;
319}; 296};
320 297
321/* 298/*
322 * Information about a GPE, one per each GPE in an array. 299 * Information about a GPE, one per each GPE in an array.
323 * NOTE: Important to keep this struct as small as possible. 300 * NOTE: Important to keep this struct as small as possible.
324 */ 301 */
325struct acpi_gpe_event_info 302struct acpi_gpe_event_info {
326{ 303 union acpi_gpe_dispatch_info dispatch; /* Either Method or Handler */
327 union acpi_gpe_dispatch_info dispatch; /* Either Method or Handler */ 304 struct acpi_gpe_register_info *register_info; /* Backpointer to register info */
328 struct acpi_gpe_register_info *register_info; /* Backpointer to register info */ 305 u8 flags; /* Misc info about this GPE */
329 u8 flags; /* Misc info about this GPE */ 306 u8 register_bit; /* This GPE bit within the register */
330 u8 register_bit; /* This GPE bit within the register */
331}; 307};
332 308
333/* Information about a GPE register pair, one per each status/enable pair in an array */ 309/* Information about a GPE register pair, one per each status/enable pair in an array */
334 310
335struct acpi_gpe_register_info 311struct acpi_gpe_register_info {
336{ 312 struct acpi_generic_address status_address; /* Address of status reg */
337 struct acpi_generic_address status_address; /* Address of status reg */ 313 struct acpi_generic_address enable_address; /* Address of enable reg */
338 struct acpi_generic_address enable_address; /* Address of enable reg */ 314 u8 enable_for_wake; /* GPEs to keep enabled when sleeping */
339 u8 enable_for_wake; /* GPEs to keep enabled when sleeping */ 315 u8 enable_for_run; /* GPEs to keep enabled when running */
340 u8 enable_for_run; /* GPEs to keep enabled when running */ 316 u8 base_gpe_number; /* Base GPE number for this register */
341 u8 base_gpe_number; /* Base GPE number for this register */
342}; 317};
343 318
344/* 319/*
345 * Information about a GPE register block, one per each installed block -- 320 * Information about a GPE register block, one per each installed block --
346 * GPE0, GPE1, and one per each installed GPE Block Device. 321 * GPE0, GPE1, and one per each installed GPE Block Device.
347 */ 322 */
348struct acpi_gpe_block_info 323struct acpi_gpe_block_info {
349{ 324 struct acpi_namespace_node *node;
350 struct acpi_namespace_node *node; 325 struct acpi_gpe_block_info *previous;
351 struct acpi_gpe_block_info *previous; 326 struct acpi_gpe_block_info *next;
352 struct acpi_gpe_block_info *next; 327 struct acpi_gpe_xrupt_info *xrupt_block; /* Backpointer to interrupt block */
353 struct acpi_gpe_xrupt_info *xrupt_block; /* Backpointer to interrupt block */ 328 struct acpi_gpe_register_info *register_info; /* One per GPE register pair */
354 struct acpi_gpe_register_info *register_info; /* One per GPE register pair */ 329 struct acpi_gpe_event_info *event_info; /* One for each GPE */
355 struct acpi_gpe_event_info *event_info; /* One for each GPE */ 330 struct acpi_generic_address block_address; /* Base address of the block */
356 struct acpi_generic_address block_address; /* Base address of the block */ 331 u32 register_count; /* Number of register pairs in block */
357 u32 register_count; /* Number of register pairs in block */ 332 u8 block_base_number; /* Base GPE number for this block */
358 u8 block_base_number;/* Base GPE number for this block */
359}; 333};
360 334
361/* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */ 335/* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */
362 336
363struct acpi_gpe_xrupt_info 337struct acpi_gpe_xrupt_info {
364{ 338 struct acpi_gpe_xrupt_info *previous;
365 struct acpi_gpe_xrupt_info *previous; 339 struct acpi_gpe_xrupt_info *next;
366 struct acpi_gpe_xrupt_info *next; 340 struct acpi_gpe_block_info *gpe_block_list_head; /* List of GPE blocks for this xrupt */
367 struct acpi_gpe_block_info *gpe_block_list_head; /* List of GPE blocks for this xrupt */ 341 u32 interrupt_number; /* System interrupt number */
368 u32 interrupt_level; /* System interrupt level */
369}; 342};
370 343
371 344struct acpi_gpe_walk_info {
372struct acpi_gpe_walk_info 345 struct acpi_namespace_node *gpe_device;
373{ 346 struct acpi_gpe_block_info *gpe_block;
374 struct acpi_namespace_node *gpe_device;
375 struct acpi_gpe_block_info *gpe_block;
376}; 347};
377 348
378 349typedef acpi_status(*ACPI_GPE_CALLBACK) (struct acpi_gpe_xrupt_info *
379typedef acpi_status (*ACPI_GPE_CALLBACK) ( 350 gpe_xrupt_info,
380 struct acpi_gpe_xrupt_info *gpe_xrupt_info, 351 struct acpi_gpe_block_info *
381 struct acpi_gpe_block_info *gpe_block); 352 gpe_block);
382
383 353
384/* Information about each particular fixed event */ 354/* Information about each particular fixed event */
385 355
386struct acpi_fixed_event_handler 356struct acpi_fixed_event_handler {
387{ 357 acpi_event_handler handler; /* Address of handler. */
388 acpi_event_handler handler; /* Address of handler. */ 358 void *context; /* Context to be passed to handler */
389 void *context; /* Context to be passed to handler */
390}; 359};
391 360
392struct acpi_fixed_event_info 361struct acpi_fixed_event_info {
393{ 362 u8 status_register_id;
394 u8 status_register_id; 363 u8 enable_register_id;
395 u8 enable_register_id; 364 u16 status_bit_mask;
396 u16 status_bit_mask; 365 u16 enable_bit_mask;
397 u16 enable_bit_mask;
398}; 366};
399 367
400/* Information used during field processing */ 368/* Information used during field processing */
401 369
402struct acpi_field_info 370struct acpi_field_info {
403{ 371 u8 skip_field;
404 u8 skip_field; 372 u8 field_flag;
405 u8 field_flag; 373 u32 pkg_length;
406 u32 pkg_length;
407}; 374};
408 375
409
410/***************************************************************************** 376/*****************************************************************************
411 * 377 *
412 * Generic "state" object for stacks 378 * Generic "state" object for stacks
@@ -419,14 +385,6 @@ struct acpi_field_info
419#define ACPI_CONTROL_PREDICATE_FALSE 0xC3 385#define ACPI_CONTROL_PREDICATE_FALSE 0xC3
420#define ACPI_CONTROL_PREDICATE_TRUE 0xC4 386#define ACPI_CONTROL_PREDICATE_TRUE 0xC4
421 387
422
423/* Forward declarations */
424
425struct acpi_walk_state ;
426struct acpi_obj_mutex;
427union acpi_parse_object ;
428
429
430#define ACPI_STATE_COMMON /* Two 32-bit fields and a pointer */\ 388#define ACPI_STATE_COMMON /* Two 32-bit fields and a pointer */\
431 u8 data_type; /* To differentiate various internal objs */\ 389 u8 data_type; /* To differentiate various internal objs */\
432 u8 flags; \ 390 u8 flags; \
@@ -435,147 +393,112 @@ union acpi_parse_object ;
435 u16 reserved; \ 393 u16 reserved; \
436 void *next; \ 394 void *next; \
437 395
438struct acpi_common_state 396struct acpi_common_state {
439{ 397ACPI_STATE_COMMON};
440 ACPI_STATE_COMMON
441};
442
443 398
444/* 399/*
445 * Update state - used to traverse complex objects such as packages 400 * Update state - used to traverse complex objects such as packages
446 */ 401 */
447struct acpi_update_state 402struct acpi_update_state {
448{ 403 ACPI_STATE_COMMON union acpi_operand_object *object;
449 ACPI_STATE_COMMON
450 union acpi_operand_object *object;
451}; 404};
452 405
453
454/* 406/*
455 * Pkg state - used to traverse nested package structures 407 * Pkg state - used to traverse nested package structures
456 */ 408 */
457struct acpi_pkg_state 409struct acpi_pkg_state {
458{ 410 ACPI_STATE_COMMON union acpi_operand_object *source_object;
459 ACPI_STATE_COMMON 411 union acpi_operand_object *dest_object;
460 union acpi_operand_object *source_object; 412 struct acpi_walk_state *walk_state;
461 union acpi_operand_object *dest_object; 413 void *this_target_obj;
462 struct acpi_walk_state *walk_state; 414 u32 num_packages;
463 void *this_target_obj; 415 u16 index;
464 u32 num_packages;
465 u16 index;
466}; 416};
467 417
468
469/* 418/*
470 * Control state - one per if/else and while constructs. 419 * Control state - one per if/else and while constructs.
471 * Allows nesting of these constructs 420 * Allows nesting of these constructs
472 */ 421 */
473struct acpi_control_state 422struct acpi_control_state {
474{ 423 ACPI_STATE_COMMON union acpi_parse_object *predicate_op;
475 ACPI_STATE_COMMON 424 u8 *aml_predicate_start; /* Start of if/while predicate */
476 union acpi_parse_object *predicate_op; 425 u8 *package_end; /* End of if/while block */
477 u8 *aml_predicate_start; /* Start of if/while predicate */ 426 u16 opcode;
478 u8 *package_end; /* End of if/while block */
479 u16 opcode;
480}; 427};
481 428
482
483/* 429/*
484 * Scope state - current scope during namespace lookups 430 * Scope state - current scope during namespace lookups
485 */ 431 */
486struct acpi_scope_state 432struct acpi_scope_state {
487{ 433 ACPI_STATE_COMMON struct acpi_namespace_node *node;
488 ACPI_STATE_COMMON
489 struct acpi_namespace_node *node;
490}; 434};
491 435
492 436struct acpi_pscope_state {
493struct acpi_pscope_state 437 ACPI_STATE_COMMON union acpi_parse_object *op; /* Current op being parsed */
494{ 438 u8 *arg_end; /* Current argument end */
495 ACPI_STATE_COMMON 439 u8 *pkg_end; /* Current package end */
496 union acpi_parse_object *op; /* Current op being parsed */ 440 u32 arg_list; /* Next argument to parse */
497 u8 *arg_end; /* Current argument end */ 441 u32 arg_count; /* Number of fixed arguments */
498 u8 *pkg_end; /* Current package end */
499 u32 arg_list; /* Next argument to parse */
500 u32 arg_count; /* Number of fixed arguments */
501}; 442};
502 443
503
504/* 444/*
505 * Thread state - one per thread across multiple walk states. Multiple walk 445 * Thread state - one per thread across multiple walk states. Multiple walk
506 * states are created when there are nested control methods executing. 446 * states are created when there are nested control methods executing.
507 */ 447 */
508struct acpi_thread_state 448struct acpi_thread_state {
509{ 449 ACPI_STATE_COMMON struct acpi_walk_state *walk_state_list; /* Head of list of walk_states for this thread */
510 ACPI_STATE_COMMON 450 union acpi_operand_object *acquired_mutex_list; /* List of all currently acquired mutexes */
511 struct acpi_walk_state *walk_state_list; /* Head of list of walk_states for this thread */ 451 u32 thread_id; /* Running thread ID */
512 union acpi_operand_object *acquired_mutex_list; /* List of all currently acquired mutexes */ 452 u8 current_sync_level; /* Mutex Sync (nested acquire) level */
513 u32 thread_id; /* Running thread ID */
514 u8 current_sync_level; /* Mutex Sync (nested acquire) level */
515}; 453};
516 454
517
518/* 455/*
519 * Result values - used to accumulate the results of nested 456 * Result values - used to accumulate the results of nested
520 * AML arguments 457 * AML arguments
521 */ 458 */
522struct acpi_result_values 459struct acpi_result_values {
523{
524 ACPI_STATE_COMMON 460 ACPI_STATE_COMMON
525 union acpi_operand_object *obj_desc [ACPI_OBJ_NUM_OPERANDS]; 461 union acpi_operand_object *obj_desc[ACPI_OBJ_NUM_OPERANDS];
526 u8 num_results; 462 u8 num_results;
527 u8 last_insert; 463 u8 last_insert;
528}; 464};
529 465
530
531typedef
532acpi_status (*acpi_parse_downwards) (
533 struct acpi_walk_state *walk_state,
534 union acpi_parse_object **out_op);
535
536typedef 466typedef
537acpi_status (*acpi_parse_upwards) ( 467acpi_status(*acpi_parse_downwards) (struct acpi_walk_state * walk_state,
538 struct acpi_walk_state *walk_state); 468 union acpi_parse_object ** out_op);
539 469
470typedef acpi_status(*acpi_parse_upwards) (struct acpi_walk_state * walk_state);
540 471
541/* 472/*
542 * Notify info - used to pass info to the deferred notify 473 * Notify info - used to pass info to the deferred notify
543 * handler/dispatcher. 474 * handler/dispatcher.
544 */ 475 */
545struct acpi_notify_info 476struct acpi_notify_info {
546{ 477 ACPI_STATE_COMMON struct acpi_namespace_node *node;
547 ACPI_STATE_COMMON 478 union acpi_operand_object *handler_obj;
548 struct acpi_namespace_node *node;
549 union acpi_operand_object *handler_obj;
550}; 479};
551 480
552
553/* Generic state is union of structs above */ 481/* Generic state is union of structs above */
554 482
555union acpi_generic_state 483union acpi_generic_state {
556{ 484 struct acpi_common_state common;
557 struct acpi_common_state common; 485 struct acpi_control_state control;
558 struct acpi_control_state control; 486 struct acpi_update_state update;
559 struct acpi_update_state update; 487 struct acpi_scope_state scope;
560 struct acpi_scope_state scope; 488 struct acpi_pscope_state parse_scope;
561 struct acpi_pscope_state parse_scope; 489 struct acpi_pkg_state pkg;
562 struct acpi_pkg_state pkg; 490 struct acpi_thread_state thread;
563 struct acpi_thread_state thread; 491 struct acpi_result_values results;
564 struct acpi_result_values results; 492 struct acpi_notify_info notify;
565 struct acpi_notify_info notify;
566}; 493};
567 494
568
569/***************************************************************************** 495/*****************************************************************************
570 * 496 *
571 * Interpreter typedefs and structs 497 * Interpreter typedefs and structs
572 * 498 *
573 ****************************************************************************/ 499 ****************************************************************************/
574 500
575typedef 501typedef acpi_status(*ACPI_EXECUTE_OP) (struct acpi_walk_state * walk_state);
576acpi_status (*ACPI_EXECUTE_OP) (
577 struct acpi_walk_state *walk_state);
578
579 502
580/***************************************************************************** 503/*****************************************************************************
581 * 504 *
@@ -586,28 +509,26 @@ acpi_status (*ACPI_EXECUTE_OP) (
586/* 509/*
587 * AML opcode, name, and argument layout 510 * AML opcode, name, and argument layout
588 */ 511 */
589struct acpi_opcode_info 512struct acpi_opcode_info {
590{
591#if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT) 513#if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)
592 char *name; /* Opcode name (disassembler/debug only) */ 514 char *name; /* Opcode name (disassembler/debug only) */
593#endif 515#endif
594 u32 parse_args; /* Grammar/Parse time arguments */ 516 u32 parse_args; /* Grammar/Parse time arguments */
595 u32 runtime_args; /* Interpret time arguments */ 517 u32 runtime_args; /* Interpret time arguments */
596 u32 flags; /* Misc flags */ 518 u32 flags; /* Misc flags */
597 u8 object_type; /* Corresponding internal object type */ 519 u8 object_type; /* Corresponding internal object type */
598 u8 class; /* Opcode class */ 520 u8 class; /* Opcode class */
599 u8 type; /* Opcode type */ 521 u8 type; /* Opcode type */
600}; 522};
601 523
602union acpi_parse_value 524union acpi_parse_value {
603{ 525 acpi_integer integer; /* Integer constant (Up to 64 bits) */
604 acpi_integer integer; /* Integer constant (Up to 64 bits) */ 526 struct uint64_struct integer64; /* Structure overlay for 2 32-bit Dwords */
605 struct uint64_struct integer64; /* Structure overlay for 2 32-bit Dwords */ 527 u32 size; /* bytelist or field size */
606 u32 size; /* bytelist or field size */ 528 char *string; /* NULL terminated string */
607 char *string; /* NULL terminated string */ 529 u8 *buffer; /* buffer or string */
608 u8 *buffer; /* buffer or string */ 530 char *name; /* NULL terminated string */
609 char *name; /* NULL terminated string */ 531 union acpi_parse_object *arg; /* arguments and contained ops */
610 union acpi_parse_object *arg; /* arguments and contained ops */
611}; 532};
612 533
613#define ACPI_PARSE_COMMON \ 534#define ACPI_PARSE_COMMON \
@@ -636,84 +557,72 @@ union acpi_parse_value
636/* 557/*
637 * generic operation (for example: If, While, Store) 558 * generic operation (for example: If, While, Store)
638 */ 559 */
639struct acpi_parse_obj_common 560struct acpi_parse_obj_common {
640{ 561ACPI_PARSE_COMMON};
641 ACPI_PARSE_COMMON
642};
643
644 562
645/* 563/*
646 * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and op_regions), 564 * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and op_regions),
647 * and bytelists. 565 * and bytelists.
648 */ 566 */
649struct acpi_parse_obj_named 567struct acpi_parse_obj_named {
650{ 568 ACPI_PARSE_COMMON u8 * path;
651 ACPI_PARSE_COMMON 569 u8 *data; /* AML body or bytelist data */
652 u8 *path; 570 u32 length; /* AML length */
653 u8 *data; /* AML body or bytelist data */ 571 u32 name; /* 4-byte name or zero if no name */
654 u32 length; /* AML length */
655 u32 name; /* 4-byte name or zero if no name */
656}; 572};
657 573
658
659/* The parse node is the fundamental element of the parse tree */ 574/* The parse node is the fundamental element of the parse tree */
660 575
661struct acpi_parse_obj_asl 576struct acpi_parse_obj_asl {
662{ 577 ACPI_PARSE_COMMON union acpi_parse_object *child;
663 ACPI_PARSE_COMMON 578 union acpi_parse_object *parent_method;
664 union acpi_parse_object *child; 579 char *filename;
665 union acpi_parse_object *parent_method; 580 char *external_name;
666 char *filename; 581 char *namepath;
667 char *external_name; 582 char name_seg[4];
668 char *namepath; 583 u32 extra_value;
669 char name_seg[4]; 584 u32 column;
670 u32 extra_value; 585 u32 line_number;
671 u32 column; 586 u32 logical_line_number;
672 u32 line_number; 587 u32 logical_byte_offset;
673 u32 logical_line_number; 588 u32 end_line;
674 u32 logical_byte_offset; 589 u32 end_logical_line;
675 u32 end_line; 590 u32 acpi_btype;
676 u32 end_logical_line; 591 u32 aml_length;
677 u32 acpi_btype; 592 u32 aml_subtree_length;
678 u32 aml_length; 593 u32 final_aml_length;
679 u32 aml_subtree_length; 594 u32 final_aml_offset;
680 u32 final_aml_length; 595 u32 compile_flags;
681 u32 final_aml_offset; 596 u16 parse_opcode;
682 u32 compile_flags; 597 u8 aml_opcode_length;
683 u16 parse_opcode; 598 u8 aml_pkg_len_bytes;
684 u8 aml_opcode_length; 599 u8 extra;
685 u8 aml_pkg_len_bytes; 600 char parse_op_name[12];
686 u8 extra; 601};
687 char parse_op_name[12]; 602
688}; 603union acpi_parse_object {
689 604 struct acpi_parse_obj_common common;
690union acpi_parse_object 605 struct acpi_parse_obj_named named;
691{ 606 struct acpi_parse_obj_asl asl;
692 struct acpi_parse_obj_common common;
693 struct acpi_parse_obj_named named;
694 struct acpi_parse_obj_asl asl;
695}; 607};
696 608
697
698/* 609/*
699 * Parse state - one state per parser invocation and each control 610 * Parse state - one state per parser invocation and each control
700 * method. 611 * method.
701 */ 612 */
702struct acpi_parse_state 613struct acpi_parse_state {
703{ 614 u32 aml_size;
704 u32 aml_size; 615 u8 *aml_start; /* First AML byte */
705 u8 *aml_start; /* First AML byte */ 616 u8 *aml; /* Next AML byte */
706 u8 *aml; /* Next AML byte */ 617 u8 *aml_end; /* (last + 1) AML byte */
707 u8 *aml_end; /* (last + 1) AML byte */ 618 u8 *pkg_start; /* Current package begin */
708 u8 *pkg_start; /* Current package begin */ 619 u8 *pkg_end; /* Current package end */
709 u8 *pkg_end; /* Current package end */ 620 union acpi_parse_object *start_op; /* Root of parse tree */
710 union acpi_parse_object *start_op; /* Root of parse tree */ 621 struct acpi_namespace_node *start_node;
711 struct acpi_namespace_node *start_node; 622 union acpi_generic_state *scope; /* Current scope */
712 union acpi_generic_state *scope; /* Current scope */ 623 union acpi_parse_object *start_scope;
713 union acpi_parse_object *start_scope;
714}; 624};
715 625
716
717/* Parse object flags */ 626/* Parse object flags */
718 627
719#define ACPI_PARSEOP_GENERIC 0x01 628#define ACPI_PARSEOP_GENERIC 0x01
@@ -729,7 +638,6 @@ struct acpi_parse_state
729#define ACPI_PARSEOP_EMPTY_TERMLIST 0x04 638#define ACPI_PARSEOP_EMPTY_TERMLIST 0x04
730#define ACPI_PARSEOP_SPECIAL 0x10 639#define ACPI_PARSEOP_SPECIAL 0x10
731 640
732
733/***************************************************************************** 641/*****************************************************************************
734 * 642 *
735 * Hardware (ACPI registers) and PNP 643 * Hardware (ACPI registers) and PNP
@@ -737,15 +645,14 @@ struct acpi_parse_state
737 ****************************************************************************/ 645 ****************************************************************************/
738 646
739#define PCI_ROOT_HID_STRING "PNP0A03" 647#define PCI_ROOT_HID_STRING "PNP0A03"
648#define PCI_EXPRESS_ROOT_HID_STRING "PNP0A08"
740 649
741struct acpi_bit_register_info 650struct acpi_bit_register_info {
742{ 651 u8 parent_register;
743 u8 parent_register; 652 u8 bit_position;
744 u8 bit_position; 653 u16 access_bit_mask;
745 u16 access_bit_mask;
746}; 654};
747 655
748
749/* 656/*
750 * Register IDs 657 * Register IDs
751 * These are the full ACPI registers 658 * These are the full ACPI registers
@@ -760,7 +667,6 @@ struct acpi_bit_register_info
760#define ACPI_REGISTER_PROCESSOR_BLOCK 0x08 667#define ACPI_REGISTER_PROCESSOR_BLOCK 0x08
761#define ACPI_REGISTER_SMI_COMMAND_BLOCK 0x09 668#define ACPI_REGISTER_SMI_COMMAND_BLOCK 0x09
762 669
763
764/* Masks used to access the bit_registers */ 670/* Masks used to access the bit_registers */
765 671
766#define ACPI_BITMASK_TIMER_STATUS 0x0001 672#define ACPI_BITMASK_TIMER_STATUS 0x0001
@@ -769,7 +675,7 @@ struct acpi_bit_register_info
769#define ACPI_BITMASK_POWER_BUTTON_STATUS 0x0100 675#define ACPI_BITMASK_POWER_BUTTON_STATUS 0x0100
770#define ACPI_BITMASK_SLEEP_BUTTON_STATUS 0x0200 676#define ACPI_BITMASK_SLEEP_BUTTON_STATUS 0x0200
771#define ACPI_BITMASK_RT_CLOCK_STATUS 0x0400 677#define ACPI_BITMASK_RT_CLOCK_STATUS 0x0400
772#define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */ 678#define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */
773#define ACPI_BITMASK_WAKE_STATUS 0x8000 679#define ACPI_BITMASK_WAKE_STATUS 0x8000
774 680
775#define ACPI_BITMASK_ALL_FIXED_STATUS (ACPI_BITMASK_TIMER_STATUS | \ 681#define ACPI_BITMASK_ALL_FIXED_STATUS (ACPI_BITMASK_TIMER_STATUS | \
@@ -785,7 +691,7 @@ struct acpi_bit_register_info
785#define ACPI_BITMASK_POWER_BUTTON_ENABLE 0x0100 691#define ACPI_BITMASK_POWER_BUTTON_ENABLE 0x0100
786#define ACPI_BITMASK_SLEEP_BUTTON_ENABLE 0x0200 692#define ACPI_BITMASK_SLEEP_BUTTON_ENABLE 0x0200
787#define ACPI_BITMASK_RT_CLOCK_ENABLE 0x0400 693#define ACPI_BITMASK_RT_CLOCK_ENABLE 0x0400
788#define ACPI_BITMASK_PCIEXP_WAKE_DISABLE 0x4000 /* ACPI 3.0 */ 694#define ACPI_BITMASK_PCIEXP_WAKE_DISABLE 0x4000 /* ACPI 3.0 */
789 695
790#define ACPI_BITMASK_SCI_ENABLE 0x0001 696#define ACPI_BITMASK_SCI_ENABLE 0x0001
791#define ACPI_BITMASK_BUS_MASTER_RLD 0x0002 697#define ACPI_BITMASK_BUS_MASTER_RLD 0x0002
@@ -795,7 +701,6 @@ struct acpi_bit_register_info
795 701
796#define ACPI_BITMASK_ARB_DISABLE 0x0001 702#define ACPI_BITMASK_ARB_DISABLE 0x0001
797 703
798
799/* Raw bit position of each bit_register */ 704/* Raw bit position of each bit_register */
800 705
801#define ACPI_BITPOSITION_TIMER_STATUS 0x00 706#define ACPI_BITPOSITION_TIMER_STATUS 0x00
@@ -804,7 +709,7 @@ struct acpi_bit_register_info
804#define ACPI_BITPOSITION_POWER_BUTTON_STATUS 0x08 709#define ACPI_BITPOSITION_POWER_BUTTON_STATUS 0x08
805#define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS 0x09 710#define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS 0x09
806#define ACPI_BITPOSITION_RT_CLOCK_STATUS 0x0A 711#define ACPI_BITPOSITION_RT_CLOCK_STATUS 0x0A
807#define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS 0x0E /* ACPI 3.0 */ 712#define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS 0x0E /* ACPI 3.0 */
808#define ACPI_BITPOSITION_WAKE_STATUS 0x0F 713#define ACPI_BITPOSITION_WAKE_STATUS 0x0F
809 714
810#define ACPI_BITPOSITION_TIMER_ENABLE 0x00 715#define ACPI_BITPOSITION_TIMER_ENABLE 0x00
@@ -812,7 +717,7 @@ struct acpi_bit_register_info
812#define ACPI_BITPOSITION_POWER_BUTTON_ENABLE 0x08 717#define ACPI_BITPOSITION_POWER_BUTTON_ENABLE 0x08
813#define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE 0x09 718#define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE 0x09
814#define ACPI_BITPOSITION_RT_CLOCK_ENABLE 0x0A 719#define ACPI_BITPOSITION_RT_CLOCK_ENABLE 0x0A
815#define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE 0x0E /* ACPI 3.0 */ 720#define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE 0x0E /* ACPI 3.0 */
816 721
817#define ACPI_BITPOSITION_SCI_ENABLE 0x00 722#define ACPI_BITPOSITION_SCI_ENABLE 0x00
818#define ACPI_BITPOSITION_BUS_MASTER_RLD 0x01 723#define ACPI_BITPOSITION_BUS_MASTER_RLD 0x01
@@ -822,7 +727,6 @@ struct acpi_bit_register_info
822 727
823#define ACPI_BITPOSITION_ARB_DISABLE 0x00 728#define ACPI_BITPOSITION_ARB_DISABLE 0x00
824 729
825
826/***************************************************************************** 730/*****************************************************************************
827 * 731 *
828 * Resource descriptors 732 * Resource descriptors
@@ -841,8 +745,7 @@ struct acpi_bit_register_info
841#define ACPI_RDESC_TYPE_SMALL 0x00 745#define ACPI_RDESC_TYPE_SMALL 0x00
842 746
843#define ACPI_RDESC_TYPE_MASK 0x80 747#define ACPI_RDESC_TYPE_MASK 0x80
844#define ACPI_RDESC_SMALL_MASK 0x78 /* Only bits 6:3 contain the type */ 748#define ACPI_RDESC_SMALL_MASK 0x78 /* Only bits 6:3 contain the type */
845
846 749
847/* 750/*
848 * Small resource descriptor types 751 * Small resource descriptor types
@@ -871,7 +774,6 @@ struct acpi_bit_register_info
871#define ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE 0x8A 774#define ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE 0x8A
872#define ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE 0x8B 775#define ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE 0x8B
873 776
874
875/***************************************************************************** 777/*****************************************************************************
876 * 778 *
877 * Miscellaneous 779 * Miscellaneous
@@ -880,49 +782,36 @@ struct acpi_bit_register_info
880 782
881#define ACPI_ASCII_ZERO 0x30 783#define ACPI_ASCII_ZERO 0x30
882 784
883
884/***************************************************************************** 785/*****************************************************************************
885 * 786 *
886 * Debugger 787 * Debugger
887 * 788 *
888 ****************************************************************************/ 789 ****************************************************************************/
889 790
890struct acpi_db_method_info 791struct acpi_db_method_info {
891{ 792 acpi_handle thread_gate;
892 acpi_handle thread_gate; 793 char *name;
893 char *name; 794 char **args;
894 char **args; 795 u32 flags;
895 u32 flags; 796 u32 num_loops;
896 u32 num_loops; 797 char pathname[128];
897 char pathname[128];
898}; 798};
899 799
900struct acpi_integrity_info 800struct acpi_integrity_info {
901{ 801 u32 nodes;
902 u32 nodes; 802 u32 objects;
903 u32 objects;
904}; 803};
905 804
906
907#define ACPI_DB_REDIRECTABLE_OUTPUT 0x01 805#define ACPI_DB_REDIRECTABLE_OUTPUT 0x01
908#define ACPI_DB_CONSOLE_OUTPUT 0x02 806#define ACPI_DB_CONSOLE_OUTPUT 0x02
909#define ACPI_DB_DUPLICATE_OUTPUT 0x03 807#define ACPI_DB_DUPLICATE_OUTPUT 0x03
910 808
911
912/***************************************************************************** 809/*****************************************************************************
913 * 810 *
914 * Debug 811 * Debug
915 * 812 *
916 ****************************************************************************/ 813 ****************************************************************************/
917 814
918struct acpi_debug_print_info
919{
920 u32 component_id;
921 char *proc_name;
922 char *module_name;
923};
924
925
926/* Entry for a memory allocation (debug only) */ 815/* Entry for a memory allocation (debug only) */
927 816
928#define ACPI_MEM_MALLOC 0 817#define ACPI_MEM_MALLOC 0
@@ -938,51 +827,36 @@ struct acpi_debug_print_info
938 char module[ACPI_MAX_MODULE_NAME]; \ 827 char module[ACPI_MAX_MODULE_NAME]; \
939 u8 alloc_type; 828 u8 alloc_type;
940 829
941struct acpi_debug_mem_header 830struct acpi_debug_mem_header {
942{ 831ACPI_COMMON_DEBUG_MEM_HEADER};
943 ACPI_COMMON_DEBUG_MEM_HEADER
944};
945 832
946struct acpi_debug_mem_block 833struct acpi_debug_mem_block {
947{ 834 ACPI_COMMON_DEBUG_MEM_HEADER u64 user_space;
948 ACPI_COMMON_DEBUG_MEM_HEADER
949 u64 user_space;
950}; 835};
951 836
952
953#define ACPI_MEM_LIST_GLOBAL 0 837#define ACPI_MEM_LIST_GLOBAL 0
954#define ACPI_MEM_LIST_NSNODE 1 838#define ACPI_MEM_LIST_NSNODE 1
839#define ACPI_MEM_LIST_MAX 1
840#define ACPI_NUM_MEM_LISTS 2
955 841
956#define ACPI_MEM_LIST_FIRST_CACHE_LIST 2 842struct acpi_memory_list {
957#define ACPI_MEM_LIST_STATE 2 843 char *list_name;
958#define ACPI_MEM_LIST_PSNODE 3 844 void *list_head;
959#define ACPI_MEM_LIST_PSNODE_EXT 4 845 u16 object_size;
960#define ACPI_MEM_LIST_OPERAND 5 846 u16 max_depth;
961#define ACPI_MEM_LIST_WALK 6 847 u16 current_depth;
962#define ACPI_MEM_LIST_MAX 6 848 u16 link_offset;
963#define ACPI_NUM_MEM_LISTS 7
964
965
966struct acpi_memory_list
967{
968 void *list_head;
969 u16 link_offset;
970 u16 max_cache_depth;
971 u16 cache_depth;
972 u16 object_size;
973 849
974#ifdef ACPI_DBG_TRACK_ALLOCATIONS 850#ifdef ACPI_DBG_TRACK_ALLOCATIONS
975 851
976 /* Statistics for debug memory tracking only */ 852 /* Statistics for debug memory tracking only */
977 853
978 u32 total_allocated; 854 u32 total_allocated;
979 u32 total_freed; 855 u32 total_freed;
980 u32 current_total_size; 856 u32 current_total_size;
981 u32 cache_requests; 857 u32 requests;
982 u32 cache_hits; 858 u32 hits;
983 char *list_name;
984#endif 859#endif
985}; 860};
986 861
987 862#endif /* __ACLOCAL_H__ */
988#endif /* __ACLOCAL_H__ */
diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h
index 09be937d2c39..702cc4e57f5f 100644
--- a/include/acpi/acmacros.h
+++ b/include/acpi/acmacros.h
@@ -44,7 +44,6 @@
44#ifndef __ACMACROS_H__ 44#ifndef __ACMACROS_H__
45#define __ACMACROS_H__ 45#define __ACMACROS_H__
46 46
47
48/* 47/*
49 * Data manipulation macros 48 * Data manipulation macros
50 */ 49 */
@@ -57,7 +56,6 @@
57#define ACPI_CLEAR_BIT(target,bit) ((target) &= ~(bit)) 56#define ACPI_CLEAR_BIT(target,bit) ((target) &= ~(bit))
58#define ACPI_MIN(a,b) (((a)<(b))?(a):(b)) 57#define ACPI_MIN(a,b) (((a)<(b))?(a):(b))
59 58
60
61#if ACPI_MACHINE_WIDTH == 16 59#if ACPI_MACHINE_WIDTH == 16
62 60
63/* 61/*
@@ -168,7 +166,7 @@
168 166
169/* 32-bit source, 16/32/64 destination */ 167/* 32-bit source, 16/32/64 destination */
170 168
171#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ 169#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */
172 170
173#define ACPI_MOVE_32_TO_32(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[3];\ 171#define ACPI_MOVE_32_TO_32(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[3];\
174 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[2];\ 172 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[2];\
@@ -183,9 +181,9 @@
183 181
184/* 64-bit source, 16/32/64 destination */ 182/* 64-bit source, 16/32/64 destination */
185 183
186#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ 184#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */
187 185
188#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ 186#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */
189 187
190#define ACPI_MOVE_64_TO_64(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[7];\ 188#define ACPI_MOVE_64_TO_64(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[7];\
191 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[6];\ 189 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[6];\
@@ -219,14 +217,14 @@
219 217
220/* 32-bit source, 16/32/64 destination */ 218/* 32-bit source, 16/32/64 destination */
221 219
222#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ 220#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */
223#define ACPI_MOVE_32_TO_32(d,s) *(u32 *)(void *)(d) = *(u32 *)(void *)(s) 221#define ACPI_MOVE_32_TO_32(d,s) *(u32 *)(void *)(d) = *(u32 *)(void *)(s)
224#define ACPI_MOVE_32_TO_64(d,s) ACPI_MOVE_32_TO_32(d,s) 222#define ACPI_MOVE_32_TO_64(d,s) ACPI_MOVE_32_TO_32(d,s)
225 223
226/* 64-bit source, 16/32/64 destination */ 224/* 64-bit source, 16/32/64 destination */
227 225
228#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ 226#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */
229#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ 227#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */
230#define ACPI_MOVE_64_TO_64(d,s) ACPI_MOVE_32_TO_32(d,s) 228#define ACPI_MOVE_64_TO_64(d,s) ACPI_MOVE_32_TO_32(d,s)
231 229
232#else 230#else
@@ -238,14 +236,14 @@
238 236
239/* 32-bit source, 16/32/64 destination */ 237/* 32-bit source, 16/32/64 destination */
240 238
241#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ 239#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */
242#define ACPI_MOVE_32_TO_32(d,s) *(u32 *)(void *)(d) = *(u32 *)(void *)(s) 240#define ACPI_MOVE_32_TO_32(d,s) *(u32 *)(void *)(d) = *(u32 *)(void *)(s)
243#define ACPI_MOVE_32_TO_64(d,s) *(u64 *)(void *)(d) = *(u32 *)(void *)(s) 241#define ACPI_MOVE_32_TO_64(d,s) *(u64 *)(void *)(d) = *(u32 *)(void *)(s)
244 242
245/* 64-bit source, 16/32/64 destination */ 243/* 64-bit source, 16/32/64 destination */
246 244
247#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ 245#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */
248#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ 246#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */
249#define ACPI_MOVE_64_TO_64(d,s) *(u64 *)(void *)(d) = *(u64 *)(void *)(s) 247#define ACPI_MOVE_64_TO_64(d,s) *(u64 *)(void *)(d) = *(u64 *)(void *)(s)
250#endif 248#endif
251 249
@@ -266,7 +264,7 @@
266 264
267/* 32-bit source, 16/32/64 destination */ 265/* 32-bit source, 16/32/64 destination */
268 266
269#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ 267#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */
270 268
271#define ACPI_MOVE_32_TO_32(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\ 269#define ACPI_MOVE_32_TO_32(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\
272 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];\ 270 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];\
@@ -277,8 +275,8 @@
277 275
278/* 64-bit source, 16/32/64 destination */ 276/* 64-bit source, 16/32/64 destination */
279 277
280#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ 278#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */
281#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ 279#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */
282#define ACPI_MOVE_64_TO_64(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\ 280#define ACPI_MOVE_64_TO_64(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\
283 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];\ 281 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];\
284 (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[2];\ 282 (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[2];\
@@ -305,7 +303,6 @@
305#error unknown ACPI_MACHINE_WIDTH 303#error unknown ACPI_MACHINE_WIDTH
306#endif 304#endif
307 305
308
309/* 306/*
310 * Fast power-of-two math macros for non-optimized compilers 307 * Fast power-of-two math macros for non-optimized compilers
311 */ 308 */
@@ -329,7 +326,6 @@
329#define ACPI_MUL_16(a) _ACPI_MUL(a,4) 326#define ACPI_MUL_16(a) _ACPI_MUL(a,4)
330#define ACPI_MOD_16(a) _ACPI_MOD(a,16) 327#define ACPI_MOD_16(a) _ACPI_MOD(a,16)
331 328
332
333/* 329/*
334 * Rounding macros (Power of two boundaries only) 330 * Rounding macros (Power of two boundaries only)
335 */ 331 */
@@ -344,7 +340,6 @@
344#define ACPI_ROUND_UP_to_64_bITS(a) ACPI_ROUND_UP(a,8) 340#define ACPI_ROUND_UP_to_64_bITS(a) ACPI_ROUND_UP(a,8)
345#define ACPI_ROUND_UP_TO_NATIVE_WORD(a) ACPI_ROUND_UP(a,ALIGNED_ADDRESS_BOUNDARY) 341#define ACPI_ROUND_UP_TO_NATIVE_WORD(a) ACPI_ROUND_UP(a,ALIGNED_ADDRESS_BOUNDARY)
346 342
347
348#define ACPI_ROUND_BITS_UP_TO_BYTES(a) ACPI_DIV_8((a) + 7) 343#define ACPI_ROUND_BITS_UP_TO_BYTES(a) ACPI_DIV_8((a) + 7)
349#define ACPI_ROUND_BITS_DOWN_TO_BYTES(a) ACPI_DIV_8((a)) 344#define ACPI_ROUND_BITS_DOWN_TO_BYTES(a) ACPI_DIV_8((a))
350 345
@@ -365,7 +360,6 @@
365 360
366#define ACPI_IS_OCTAL_DIGIT(d) (((char)(d) >= '0') && ((char)(d) <= '7')) 361#define ACPI_IS_OCTAL_DIGIT(d) (((char)(d) >= '0') && ((char)(d) <= '7'))
367 362
368
369/* Bitfields within ACPI registers */ 363/* Bitfields within ACPI registers */
370 364
371#define ACPI_REGISTER_PREPARE_BITS(val, pos, mask) ((val << pos) & mask) 365#define ACPI_REGISTER_PREPARE_BITS(val, pos, mask) ((val << pos) & mask)
@@ -381,7 +375,6 @@
381#define ACPI_GET_DESCRIPTOR_TYPE(d) (((union acpi_descriptor *)(void *)(d))->descriptor_id) 375#define ACPI_GET_DESCRIPTOR_TYPE(d) (((union acpi_descriptor *)(void *)(d))->descriptor_id)
382#define ACPI_SET_DESCRIPTOR_TYPE(d,t) (((union acpi_descriptor *)(void *)(d))->descriptor_id = t) 376#define ACPI_SET_DESCRIPTOR_TYPE(d,t) (((union acpi_descriptor *)(void *)(d))->descriptor_id = t)
383 377
384
385/* Macro to test the object type */ 378/* Macro to test the object type */
386 379
387#define ACPI_GET_OBJECT_TYPE(d) (((union acpi_operand_object *)(void *)(d))->common.type) 380#define ACPI_GET_OBJECT_TYPE(d) (((union acpi_operand_object *)(void *)(d))->common.type)
@@ -430,28 +423,28 @@
430#define GET_CURRENT_ARG_TYPE(list) (list & ((u32) 0x1F)) 423#define GET_CURRENT_ARG_TYPE(list) (list & ((u32) 0x1F))
431#define INCREMENT_ARG_LIST(list) (list >>= ((u32) ARG_TYPE_WIDTH)) 424#define INCREMENT_ARG_LIST(list) (list >>= ((u32) ARG_TYPE_WIDTH))
432 425
433
434/* 426/*
435 * Reporting macros that are never compiled out 427 * Reporting macros that are never compiled out
436 */ 428 */
437#define ACPI_PARAM_LIST(pl) pl 429#define ACPI_PARAM_LIST(pl) pl
438 430
439/* 431/*
440 * Error reporting. These versions add callers module and line#. Since 432 * Error reporting. These versions add callers module and line#.
441 * _THIS_MODULE gets compiled out when ACPI_DEBUG_OUTPUT isn't defined, only 433 *
442 * use it in debug mode. 434 * Since _acpi_module_name gets compiled out when ACPI_DEBUG_OUTPUT
435 * isn't defined, only use it in debug mode.
443 */ 436 */
444#ifdef ACPI_DEBUG_OUTPUT 437#ifdef ACPI_DEBUG_OUTPUT
445 438
446#define ACPI_REPORT_INFO(fp) {acpi_ut_report_info(_THIS_MODULE,__LINE__,_COMPONENT); \ 439#define ACPI_REPORT_INFO(fp) {acpi_ut_report_info(_acpi_module_name,__LINE__,_COMPONENT); \
447 acpi_os_printf ACPI_PARAM_LIST(fp);} 440 acpi_os_printf ACPI_PARAM_LIST(fp);}
448#define ACPI_REPORT_ERROR(fp) {acpi_ut_report_error(_THIS_MODULE,__LINE__,_COMPONENT); \ 441#define ACPI_REPORT_ERROR(fp) {acpi_ut_report_error(_acpi_module_name,__LINE__,_COMPONENT); \
449 acpi_os_printf ACPI_PARAM_LIST(fp);} 442 acpi_os_printf ACPI_PARAM_LIST(fp);}
450#define ACPI_REPORT_WARNING(fp) {acpi_ut_report_warning(_THIS_MODULE,__LINE__,_COMPONENT); \ 443#define ACPI_REPORT_WARNING(fp) {acpi_ut_report_warning(_acpi_module_name,__LINE__,_COMPONENT); \
451 acpi_os_printf ACPI_PARAM_LIST(fp);} 444 acpi_os_printf ACPI_PARAM_LIST(fp);}
452#define ACPI_REPORT_NSERROR(s,e) acpi_ns_report_error(_THIS_MODULE,__LINE__,_COMPONENT, s, e); 445#define ACPI_REPORT_NSERROR(s,e) acpi_ns_report_error(_acpi_module_name,__LINE__,_COMPONENT, s, e);
453 446
454#define ACPI_REPORT_METHOD_ERROR(s,n,p,e) acpi_ns_report_method_error(_THIS_MODULE,__LINE__,_COMPONENT, s, n, p, e); 447#define ACPI_REPORT_METHOD_ERROR(s,n,p,e) acpi_ns_report_method_error(_acpi_module_name,__LINE__,_COMPONENT, s, n, p, e);
455 448
456#else 449#else
457 450
@@ -480,36 +473,58 @@
480 * Debug macros that are conditionally compiled 473 * Debug macros that are conditionally compiled
481 */ 474 */
482#ifdef ACPI_DEBUG_OUTPUT 475#ifdef ACPI_DEBUG_OUTPUT
476#define ACPI_MODULE_NAME(name) static char ACPI_UNUSED_VAR *_acpi_module_name = name;
483 477
484#define ACPI_MODULE_NAME(name) static char ACPI_UNUSED_VAR *_THIS_MODULE = name; 478/*
479 * Common parameters used for debug output functions:
480 * line number, function name, module(file) name, component ID
481 */
482#define ACPI_DEBUG_PARAMETERS __LINE__, ACPI_GET_FUNCTION_NAME, _acpi_module_name, _COMPONENT
485 483
486/* 484/*
487 * Function entry tracing. 485 * Function entry tracing
488 * The first parameter should be the procedure name as a quoted string. This is declared 486 */
489 * as a local string ("_proc_name) so that it can be also used by the function exit macros below. 487
488/*
489 * If ACPI_GET_FUNCTION_NAME was not defined in the compiler-dependent header,
490 * define it now. This is the case where there the compiler does not support
491 * a __FUNCTION__ macro or equivalent. We save the function name on the
492 * local stack.
493 */
494#ifndef ACPI_GET_FUNCTION_NAME
495#define ACPI_GET_FUNCTION_NAME _acpi_function_name
496/*
497 * The Name parameter should be the procedure name as a quoted string.
498 * This is declared as a local string ("my_function_name") so that it can
499 * be also used by the function exit macros below.
500 * Note: (const char) is used to be compatible with the debug interfaces
501 * and macros such as __FUNCTION__.
490 */ 502 */
491#define ACPI_FUNCTION_NAME(a) struct acpi_debug_print_info _debug_info; \ 503#define ACPI_FUNCTION_NAME(name) const char *_acpi_function_name = name;
492 _debug_info.component_id = _COMPONENT; \ 504
493 _debug_info.proc_name = a; \ 505#else
494 _debug_info.module_name = _THIS_MODULE; 506/* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */
495 507
496#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \ 508#define ACPI_FUNCTION_NAME(name)
497 acpi_ut_trace(__LINE__,&_debug_info) 509#endif
498#define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \ 510
499 acpi_ut_trace_ptr(__LINE__,&_debug_info,(void *)b) 511#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \
500#define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a) \ 512 acpi_ut_trace(ACPI_DEBUG_PARAMETERS)
501 acpi_ut_trace_u32(__LINE__,&_debug_info,(u32)b) 513#define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \
502#define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a) \ 514 acpi_ut_trace_ptr(ACPI_DEBUG_PARAMETERS,(void *)b)
503 acpi_ut_trace_str(__LINE__,&_debug_info,(char *)b) 515#define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a) \
504 516 acpi_ut_trace_u32(ACPI_DEBUG_PARAMETERS,(u32)b)
505#define ACPI_FUNCTION_ENTRY() acpi_ut_track_stack_ptr() 517#define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a) \
518 acpi_ut_trace_str(ACPI_DEBUG_PARAMETERS,(char *)b)
519
520#define ACPI_FUNCTION_ENTRY() acpi_ut_track_stack_ptr()
506 521
507/* 522/*
508 * Function exit tracing. 523 * Function exit tracing.
509 * WARNING: These macros include a return statement. This is usually considered 524 * WARNING: These macros include a return statement. This is usually considered
510 * bad form, but having a separate exit macro is very ugly and difficult to maintain. 525 * bad form, but having a separate exit macro is very ugly and difficult to maintain.
511 * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros 526 * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros
512 * so that "_proc_name" is defined. 527 * so that "_acpi_function_name" is defined.
513 */ 528 */
514#ifdef ACPI_USE_DO_WHILE_0 529#ifdef ACPI_USE_DO_WHILE_0
515#define ACPI_DO_WHILE0(a) do a while(0) 530#define ACPI_DO_WHILE0(a) do a while(0)
@@ -517,10 +532,10 @@
517#define ACPI_DO_WHILE0(a) a 532#define ACPI_DO_WHILE0(a) a
518#endif 533#endif
519 534
520#define return_VOID ACPI_DO_WHILE0 ({acpi_ut_exit(__LINE__,&_debug_info);return;}) 535#define return_VOID ACPI_DO_WHILE0 ({acpi_ut_exit(ACPI_DEBUG_PARAMETERS);return;})
521#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({acpi_ut_status_exit(__LINE__,&_debug_info,(s));return((s));}) 536#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({acpi_ut_status_exit(ACPI_DEBUG_PARAMETERS,(s));return((s));})
522#define return_VALUE(s) ACPI_DO_WHILE0 ({acpi_ut_value_exit(__LINE__,&_debug_info,(acpi_integer)(s));return((s));}) 537#define return_VALUE(s) ACPI_DO_WHILE0 ({acpi_ut_value_exit(ACPI_DEBUG_PARAMETERS,(acpi_integer)(s));return((s));})
523#define return_PTR(s) ACPI_DO_WHILE0 ({acpi_ut_ptr_exit(__LINE__,&_debug_info,(u8 *)(s));return((s));}) 538#define return_PTR(s) ACPI_DO_WHILE0 ({acpi_ut_ptr_exit(ACPI_DEBUG_PARAMETERS,(u8 *)(s));return((s));})
524 539
525/* Conditional execution */ 540/* Conditional execution */
526 541
@@ -531,12 +546,10 @@
531#define ACPI_DEBUG_ONLY_MEMBERS(a) a; 546#define ACPI_DEBUG_ONLY_MEMBERS(a) a;
532#define _VERBOSE_STRUCTURES 547#define _VERBOSE_STRUCTURES
533 548
534
535/* Stack and buffer dumping */ 549/* Stack and buffer dumping */
536 550
537#define ACPI_DUMP_STACK_ENTRY(a) acpi_ex_dump_operand((a),0) 551#define ACPI_DUMP_STACK_ENTRY(a) acpi_ex_dump_operand((a),0)
538#define ACPI_DUMP_OPERANDS(a,b,c,d,e) acpi_ex_dump_operands(a,b,c,d,e,_THIS_MODULE,__LINE__) 552#define ACPI_DUMP_OPERANDS(a,b,c,d,e) acpi_ex_dump_operands(a,b,c,d,e,_acpi_module_name,__LINE__)
539
540 553
541#define ACPI_DUMP_ENTRY(a,b) acpi_ns_dump_entry (a,b) 554#define ACPI_DUMP_ENTRY(a,b) acpi_ns_dump_entry (a,b)
542#define ACPI_DUMP_PATHNAME(a,b,c,d) acpi_ns_dump_pathname(a,b,c,d) 555#define ACPI_DUMP_PATHNAME(a,b,c,d) acpi_ns_dump_pathname(a,b,c,d)
@@ -544,7 +557,6 @@
544#define ACPI_DUMP_BUFFER(a,b) acpi_ut_dump_buffer((u8 *)a,b,DB_BYTE_DISPLAY,_COMPONENT) 557#define ACPI_DUMP_BUFFER(a,b) acpi_ut_dump_buffer((u8 *)a,b,DB_BYTE_DISPLAY,_COMPONENT)
545#define ACPI_BREAK_MSG(a) acpi_os_signal (ACPI_SIGNAL_BREAKPOINT,(a)) 558#define ACPI_BREAK_MSG(a) acpi_os_signal (ACPI_SIGNAL_BREAKPOINT,(a))
546 559
547
548/* 560/*
549 * Generate INT3 on ACPI_ERROR (Debug only!) 561 * Generate INT3 on ACPI_ERROR (Debug only!)
550 */ 562 */
@@ -565,14 +577,13 @@
565#define ACPI_DEBUG_PRINT(pl) acpi_ut_debug_print ACPI_PARAM_LIST(pl) 577#define ACPI_DEBUG_PRINT(pl) acpi_ut_debug_print ACPI_PARAM_LIST(pl)
566#define ACPI_DEBUG_PRINT_RAW(pl) acpi_ut_debug_print_raw ACPI_PARAM_LIST(pl) 578#define ACPI_DEBUG_PRINT_RAW(pl) acpi_ut_debug_print_raw ACPI_PARAM_LIST(pl)
567 579
568
569#else 580#else
570/* 581/*
571 * This is the non-debug case -- make everything go away, 582 * This is the non-debug case -- make everything go away,
572 * leaving no executable debug code! 583 * leaving no executable debug code!
573 */ 584 */
574#define ACPI_MODULE_NAME(name) 585#define ACPI_MODULE_NAME(name)
575#define _THIS_MODULE "" 586#define _acpi_module_name ""
576 587
577#define ACPI_DEBUG_EXEC(a) 588#define ACPI_DEBUG_EXEC(a)
578#define ACPI_NORMAL_EXEC(a) a; 589#define ACPI_NORMAL_EXEC(a) a;
@@ -616,7 +627,6 @@
616#define ACPI_DEBUGGER_EXEC(a) 627#define ACPI_DEBUGGER_EXEC(a)
617#endif 628#endif
618 629
619
620/* 630/*
621 * For 16-bit code, we want to shrink some things even though 631 * For 16-bit code, we want to shrink some things even though
622 * we are using ACPI_DEBUG_OUTPUT to get the debug output 632 * we are using ACPI_DEBUG_OUTPUT to get the debug output
@@ -627,7 +637,6 @@
627#define ACPI_DEBUG_ONLY_MEMBERS(a) 637#define ACPI_DEBUG_ONLY_MEMBERS(a)
628#endif 638#endif
629 639
630
631#ifdef ACPI_DEBUG_OUTPUT 640#ifdef ACPI_DEBUG_OUTPUT
632/* 641/*
633 * 1) Set name to blanks 642 * 1) Set name to blanks
@@ -640,7 +649,6 @@
640#define ACPI_ADD_OBJECT_NAME(a,b) 649#define ACPI_ADD_OBJECT_NAME(a,b)
641#endif 650#endif
642 651
643
644/* 652/*
645 * Memory allocation tracking (DEBUG ONLY) 653 * Memory allocation tracking (DEBUG ONLY)
646 */ 654 */
@@ -648,21 +656,20 @@
648 656
649/* Memory allocation */ 657/* Memory allocation */
650 658
651#define ACPI_MEM_ALLOCATE(a) acpi_ut_allocate((acpi_size)(a),_COMPONENT,_THIS_MODULE,__LINE__) 659#define ACPI_MEM_ALLOCATE(a) acpi_ut_allocate((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__)
652#define ACPI_MEM_CALLOCATE(a) acpi_ut_callocate((acpi_size)(a), _COMPONENT,_THIS_MODULE,__LINE__) 660#define ACPI_MEM_CALLOCATE(a) acpi_ut_callocate((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__)
653#define ACPI_MEM_FREE(a) acpi_os_free(a) 661#define ACPI_MEM_FREE(a) acpi_os_free(a)
654#define ACPI_MEM_TRACKING(a) 662#define ACPI_MEM_TRACKING(a)
655 663
656
657#else 664#else
658 665
659/* Memory allocation */ 666/* Memory allocation */
660 667
661#define ACPI_MEM_ALLOCATE(a) acpi_ut_allocate_and_track((acpi_size)(a),_COMPONENT,_THIS_MODULE,__LINE__) 668#define ACPI_MEM_ALLOCATE(a) acpi_ut_allocate_and_track((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__)
662#define ACPI_MEM_CALLOCATE(a) acpi_ut_callocate_and_track((acpi_size)(a), _COMPONENT,_THIS_MODULE,__LINE__) 669#define ACPI_MEM_CALLOCATE(a) acpi_ut_callocate_and_track((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__)
663#define ACPI_MEM_FREE(a) acpi_ut_free_and_track(a,_COMPONENT,_THIS_MODULE,__LINE__) 670#define ACPI_MEM_FREE(a) acpi_ut_free_and_track(a,_COMPONENT,_acpi_module_name,__LINE__)
664#define ACPI_MEM_TRACKING(a) a 671#define ACPI_MEM_TRACKING(a) a
665 672
666#endif /* ACPI_DBG_TRACK_ALLOCATIONS */ 673#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
667 674
668#endif /* ACMACROS_H */ 675#endif /* ACMACROS_H */
diff --git a/include/acpi/acnames.h b/include/acpi/acnames.h
index deb7cb06f5f0..4f9063f3e951 100644
--- a/include/acpi/acnames.h
+++ b/include/acpi/acnames.h
@@ -71,14 +71,13 @@
71 71
72/* Definitions of the predefined namespace names */ 72/* Definitions of the predefined namespace names */
73 73
74#define ACPI_UNKNOWN_NAME (u32) 0x3F3F3F3F /* Unknown name is "????" */ 74#define ACPI_UNKNOWN_NAME (u32) 0x3F3F3F3F /* Unknown name is "????" */
75#define ACPI_ROOT_NAME (u32) 0x5F5F5F5C /* Root name is "\___" */ 75#define ACPI_ROOT_NAME (u32) 0x5F5F5F5C /* Root name is "\___" */
76#define ACPI_SYS_BUS_NAME (u32) 0x5F53425F /* Sys bus name is "_SB_" */ 76
77#define ACPI_PREFIX_MIXED (u32) 0x69706341 /* "Acpi" */
78#define ACPI_PREFIX_LOWER (u32) 0x69706361 /* "acpi" */
77 79
78#define ACPI_NS_ROOT_PATH "\\" 80#define ACPI_NS_ROOT_PATH "\\"
79#define ACPI_NS_SYSTEM_BUS "_SB_" 81#define ACPI_NS_SYSTEM_BUS "_SB_"
80 82
81 83#endif /* __ACNAMES_H__ */
82#endif /* __ACNAMES_H__ */
83
84
diff --git a/include/acpi/acnamesp.h b/include/acpi/acnamesp.h
index d1b3ce80056f..dd3501f7e5d6 100644
--- a/include/acpi/acnamesp.h
+++ b/include/acpi/acnamesp.h
@@ -44,7 +44,6 @@
44#ifndef __ACNAMESP_H__ 44#ifndef __ACNAMESP_H__
45#define __ACNAMESP_H__ 45#define __ACNAMESP_H__
46 46
47
48/* To search the entire name space, pass this as search_base */ 47/* To search the entire name space, pass this as search_base */
49 48
50#define ACPI_NS_ALL ((acpi_handle)0) 49#define ACPI_NS_ALL ((acpi_handle)0)
@@ -54,8 +53,8 @@
54 * and should be one-to-one with values of acpi_object_type 53 * and should be one-to-one with values of acpi_object_type
55 */ 54 */
56#define ACPI_NS_NORMAL 0 55#define ACPI_NS_NORMAL 0
57#define ACPI_NS_NEWSCOPE 1 /* a definition of this type opens a name scope */ 56#define ACPI_NS_NEWSCOPE 1 /* a definition of this type opens a name scope */
58#define ACPI_NS_LOCAL 2 /* suppress search of enclosing scopes */ 57#define ACPI_NS_LOCAL 2 /* suppress search of enclosing scopes */
59 58
60/* Flags for acpi_ns_lookup, acpi_ns_search_and_enter */ 59/* Flags for acpi_ns_lookup, acpi_ns_search_and_enter */
61 60
@@ -68,357 +67,237 @@
68#define ACPI_NS_WALK_UNLOCK TRUE 67#define ACPI_NS_WALK_UNLOCK TRUE
69#define ACPI_NS_WALK_NO_UNLOCK FALSE 68#define ACPI_NS_WALK_NO_UNLOCK FALSE
70 69
71
72/* 70/*
73 * nsinit - Namespace initialization 71 * nsinit - Namespace initialization
74 */ 72 */
75acpi_status 73acpi_status acpi_ns_initialize_objects(void);
76acpi_ns_initialize_objects (
77 void);
78
79acpi_status
80acpi_ns_initialize_devices (
81 void);
82 74
75acpi_status acpi_ns_initialize_devices(void);
83 76
84/* 77/*
85 * nsload - Namespace loading 78 * nsload - Namespace loading
86 */ 79 */
87acpi_status 80acpi_status acpi_ns_load_namespace(void);
88acpi_ns_load_namespace (
89 void);
90 81
91acpi_status 82acpi_status
92acpi_ns_load_table ( 83acpi_ns_load_table(struct acpi_table_desc *table_desc,
93 struct acpi_table_desc *table_desc, 84 struct acpi_namespace_node *node);
94 struct acpi_namespace_node *node);
95
96 85
97/* 86/*
98 * nswalk - walk the namespace 87 * nswalk - walk the namespace
99 */ 88 */
100acpi_status 89acpi_status
101acpi_ns_walk_namespace ( 90acpi_ns_walk_namespace(acpi_object_type type,
102 acpi_object_type type, 91 acpi_handle start_object,
103 acpi_handle start_object, 92 u32 max_depth,
104 u32 max_depth, 93 u8 unlock_before_callback,
105 u8 unlock_before_callback, 94 acpi_walk_callback user_function,
106 acpi_walk_callback user_function, 95 void *context, void **return_value);
107 void *context, 96
108 void **return_value); 97struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type,
109 98 struct acpi_namespace_node
110struct acpi_namespace_node * 99 *parent,
111acpi_ns_get_next_node ( 100 struct acpi_namespace_node
112 acpi_object_type type, 101 *child);
113 struct acpi_namespace_node *parent,
114 struct acpi_namespace_node *child);
115
116 102
117/* 103/*
118 * nsparse - table parsing 104 * nsparse - table parsing
119 */ 105 */
120acpi_status 106acpi_status
121acpi_ns_parse_table ( 107acpi_ns_parse_table(struct acpi_table_desc *table_desc,
122 struct acpi_table_desc *table_desc, 108 struct acpi_namespace_node *scope);
123 struct acpi_namespace_node *scope);
124 109
125acpi_status 110acpi_status
126acpi_ns_one_complete_parse ( 111acpi_ns_one_complete_parse(u8 pass_number, struct acpi_table_desc *table_desc);
127 u32 pass_number,
128 struct acpi_table_desc *table_desc);
129
130 112
131/* 113/*
132 * nsaccess - Top-level namespace access 114 * nsaccess - Top-level namespace access
133 */ 115 */
134acpi_status 116acpi_status acpi_ns_root_initialize(void);
135acpi_ns_root_initialize (
136 void);
137 117
138acpi_status 118acpi_status
139acpi_ns_lookup ( 119acpi_ns_lookup(union acpi_generic_state *scope_info,
140 union acpi_generic_state *scope_info, 120 char *name,
141 char *name, 121 acpi_object_type type,
142 acpi_object_type type, 122 acpi_interpreter_mode interpreter_mode,
143 acpi_interpreter_mode interpreter_mode, 123 u32 flags,
144 u32 flags, 124 struct acpi_walk_state *walk_state,
145 struct acpi_walk_state *walk_state, 125 struct acpi_namespace_node **ret_node);
146 struct acpi_namespace_node **ret_node);
147
148 126
149/* 127/*
150 * nsalloc - Named object allocation/deallocation 128 * nsalloc - Named object allocation/deallocation
151 */ 129 */
152struct acpi_namespace_node * 130struct acpi_namespace_node *acpi_ns_create_node(u32 name);
153acpi_ns_create_node (
154 u32 name);
155
156void
157acpi_ns_delete_node (
158 struct acpi_namespace_node *node);
159 131
160void 132void acpi_ns_delete_node(struct acpi_namespace_node *node);
161acpi_ns_delete_namespace_subtree (
162 struct acpi_namespace_node *parent_handle);
163 133
164void 134void
165acpi_ns_delete_namespace_by_owner ( 135acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_handle);
166 u16 table_id);
167 136
168void 137void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id);
169acpi_ns_detach_object (
170 struct acpi_namespace_node *node);
171 138
172void 139void acpi_ns_detach_object(struct acpi_namespace_node *node);
173acpi_ns_delete_children (
174 struct acpi_namespace_node *parent);
175 140
176int 141void acpi_ns_delete_children(struct acpi_namespace_node *parent);
177acpi_ns_compare_names (
178 char *name1,
179 char *name2);
180 142
143int acpi_ns_compare_names(char *name1, char *name2);
181 144
182/* 145/*
183 * nsdump - Namespace dump/print utilities 146 * nsdump - Namespace dump/print utilities
184 */ 147 */
185#ifdef ACPI_FUTURE_USAGE 148#ifdef ACPI_FUTURE_USAGE
186void 149void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth);
187acpi_ns_dump_tables ( 150#endif /* ACPI_FUTURE_USAGE */
188 acpi_handle search_base,
189 u32 max_depth);
190#endif /* ACPI_FUTURE_USAGE */
191 151
192void 152void acpi_ns_dump_entry(acpi_handle handle, u32 debug_level);
193acpi_ns_dump_entry (
194 acpi_handle handle,
195 u32 debug_level);
196 153
197void 154void
198acpi_ns_dump_pathname ( 155acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component);
199 acpi_handle handle,
200 char *msg,
201 u32 level,
202 u32 component);
203 156
204void 157void acpi_ns_print_pathname(u32 num_segments, char *pathname);
205acpi_ns_print_pathname (
206 u32 num_segments,
207 char *pathname);
208 158
209acpi_status 159acpi_status
210acpi_ns_dump_one_object ( 160acpi_ns_dump_one_object(acpi_handle obj_handle,
211 acpi_handle obj_handle, 161 u32 level, void *context, void **return_value);
212 u32 level,
213 void *context,
214 void **return_value);
215 162
216#ifdef ACPI_FUTURE_USAGE 163#ifdef ACPI_FUTURE_USAGE
217void 164void
218acpi_ns_dump_objects ( 165acpi_ns_dump_objects(acpi_object_type type,
219 acpi_object_type type, 166 u8 display_type,
220 u8 display_type, 167 u32 max_depth,
221 u32 max_depth, 168 acpi_owner_id owner_id, acpi_handle start_handle);
222 u32 ownder_id, 169#endif /* ACPI_FUTURE_USAGE */
223 acpi_handle start_handle);
224#endif /* ACPI_FUTURE_USAGE */
225
226 170
227/* 171/*
228 * nseval - Namespace evaluation functions 172 * nseval - Namespace evaluation functions
229 */ 173 */
230acpi_status 174acpi_status acpi_ns_evaluate_by_handle(struct acpi_parameter_info *info);
231acpi_ns_evaluate_by_handle (
232 struct acpi_parameter_info *info);
233 175
234acpi_status 176acpi_status
235acpi_ns_evaluate_by_name ( 177acpi_ns_evaluate_by_name(char *pathname, struct acpi_parameter_info *info);
236 char *pathname,
237 struct acpi_parameter_info *info);
238 178
239acpi_status 179acpi_status
240acpi_ns_evaluate_relative ( 180acpi_ns_evaluate_relative(char *pathname, struct acpi_parameter_info *info);
241 char *pathname,
242 struct acpi_parameter_info *info);
243
244 181
245/* 182/*
246 * nsnames - Name and Scope manipulation 183 * nsnames - Name and Scope manipulation
247 */ 184 */
248u32 185u32 acpi_ns_opens_scope(acpi_object_type type);
249acpi_ns_opens_scope (
250 acpi_object_type type);
251 186
252char * 187char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node);
253acpi_ns_get_external_pathname (
254 struct acpi_namespace_node *node);
255 188
256char * 189char *acpi_ns_name_of_current_scope(struct acpi_walk_state *walk_state);
257acpi_ns_name_of_current_scope (
258 struct acpi_walk_state *walk_state);
259 190
260acpi_status 191acpi_status
261acpi_ns_handle_to_pathname ( 192acpi_ns_handle_to_pathname(acpi_handle target_handle,
262 acpi_handle target_handle, 193 struct acpi_buffer *buffer);
263 struct acpi_buffer *buffer);
264 194
265u8 195u8
266acpi_ns_pattern_match ( 196acpi_ns_pattern_match(struct acpi_namespace_node *obj_node, char *search_for);
267 struct acpi_namespace_node *obj_node,
268 char *search_for);
269 197
270acpi_status 198acpi_status
271acpi_ns_get_node_by_path ( 199acpi_ns_get_node_by_path(char *external_pathname,
272 char *external_pathname, 200 struct acpi_namespace_node *in_prefix_node,
273 struct acpi_namespace_node *in_prefix_node, 201 u32 flags, struct acpi_namespace_node **out_node);
274 u32 flags,
275 struct acpi_namespace_node **out_node);
276
277acpi_size
278acpi_ns_get_pathname_length (
279 struct acpi_namespace_node *node);
280 202
203acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node);
281 204
282/* 205/*
283 * nsobject - Object management for namespace nodes 206 * nsobject - Object management for namespace nodes
284 */ 207 */
285acpi_status 208acpi_status
286acpi_ns_attach_object ( 209acpi_ns_attach_object(struct acpi_namespace_node *node,
287 struct acpi_namespace_node *node, 210 union acpi_operand_object *object, acpi_object_type type);
288 union acpi_operand_object *object,
289 acpi_object_type type);
290 211
291union acpi_operand_object * 212union acpi_operand_object *acpi_ns_get_attached_object(struct
292acpi_ns_get_attached_object ( 213 acpi_namespace_node
293 struct acpi_namespace_node *node); 214 *node);
294 215
295union acpi_operand_object * 216union acpi_operand_object *acpi_ns_get_secondary_object(union
296acpi_ns_get_secondary_object ( 217 acpi_operand_object
297 union acpi_operand_object *obj_desc); 218 *obj_desc);
298 219
299acpi_status 220acpi_status
300acpi_ns_attach_data ( 221acpi_ns_attach_data(struct acpi_namespace_node *node,
301 struct acpi_namespace_node *node, 222 acpi_object_handler handler, void *data);
302 acpi_object_handler handler,
303 void *data);
304 223
305acpi_status 224acpi_status
306acpi_ns_detach_data ( 225acpi_ns_detach_data(struct acpi_namespace_node *node,
307 struct acpi_namespace_node *node, 226 acpi_object_handler handler);
308 acpi_object_handler handler);
309 227
310acpi_status 228acpi_status
311acpi_ns_get_attached_data ( 229acpi_ns_get_attached_data(struct acpi_namespace_node *node,
312 struct acpi_namespace_node *node, 230 acpi_object_handler handler, void **data);
313 acpi_object_handler handler,
314 void **data);
315
316 231
317/* 232/*
318 * nssearch - Namespace searching and entry 233 * nssearch - Namespace searching and entry
319 */ 234 */
320acpi_status 235acpi_status
321acpi_ns_search_and_enter ( 236acpi_ns_search_and_enter(u32 entry_name,
322 u32 entry_name, 237 struct acpi_walk_state *walk_state,
323 struct acpi_walk_state *walk_state, 238 struct acpi_namespace_node *node,
324 struct acpi_namespace_node *node, 239 acpi_interpreter_mode interpreter_mode,
325 acpi_interpreter_mode interpreter_mode, 240 acpi_object_type type,
326 acpi_object_type type, 241 u32 flags, struct acpi_namespace_node **ret_node);
327 u32 flags,
328 struct acpi_namespace_node **ret_node);
329 242
330acpi_status 243acpi_status
331acpi_ns_search_node ( 244acpi_ns_search_node(u32 entry_name,
332 u32 entry_name, 245 struct acpi_namespace_node *node,
333 struct acpi_namespace_node *node, 246 acpi_object_type type,
334 acpi_object_type type, 247 struct acpi_namespace_node **ret_node);
335 struct acpi_namespace_node **ret_node);
336 248
337void 249void
338acpi_ns_install_node ( 250acpi_ns_install_node(struct acpi_walk_state *walk_state,
339 struct acpi_walk_state *walk_state, 251 struct acpi_namespace_node *parent_node,
340 struct acpi_namespace_node *parent_node, 252 struct acpi_namespace_node *node, acpi_object_type type);
341 struct acpi_namespace_node *node,
342 acpi_object_type type);
343
344 253
345/* 254/*
346 * nsutils - Utility functions 255 * nsutils - Utility functions
347 */ 256 */
348u8 257u8 acpi_ns_valid_root_prefix(char prefix);
349acpi_ns_valid_root_prefix (
350 char prefix);
351 258
352acpi_object_type 259acpi_object_type acpi_ns_get_type(struct acpi_namespace_node *node);
353acpi_ns_get_type (
354 struct acpi_namespace_node *node);
355 260
356u32 261u32 acpi_ns_local(acpi_object_type type);
357acpi_ns_local (
358 acpi_object_type type);
359 262
360void 263void
361acpi_ns_report_error ( 264acpi_ns_report_error(char *module_name,
362 char *module_name, 265 u32 line_number,
363 u32 line_number, 266 u32 component_id,
364 u32 component_id, 267 char *internal_name, acpi_status lookup_status);
365 char *internal_name,
366 acpi_status lookup_status);
367 268
368void 269void
369acpi_ns_report_method_error ( 270acpi_ns_report_method_error(char *module_name,
370 char *module_name, 271 u32 line_number,
371 u32 line_number, 272 u32 component_id,
372 u32 component_id, 273 char *message,
373 char *message, 274 struct acpi_namespace_node *node,
374 struct acpi_namespace_node *node, 275 char *path, acpi_status lookup_status);
375 char *path,
376 acpi_status lookup_status);
377 276
378void 277void acpi_ns_print_node_pathname(struct acpi_namespace_node *node, char *msg);
379acpi_ns_print_node_pathname (
380 struct acpi_namespace_node *node,
381 char *msg);
382 278
383acpi_status 279acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info);
384acpi_ns_build_internal_name (
385 struct acpi_namestring_info *info);
386 280
387void 281void acpi_ns_get_internal_name_length(struct acpi_namestring_info *info);
388acpi_ns_get_internal_name_length (
389 struct acpi_namestring_info *info);
390 282
391acpi_status 283acpi_status acpi_ns_internalize_name(char *dotted_name, char **converted_name);
392acpi_ns_internalize_name (
393 char *dotted_name,
394 char **converted_name);
395 284
396acpi_status 285acpi_status
397acpi_ns_externalize_name ( 286acpi_ns_externalize_name(u32 internal_name_length,
398 u32 internal_name_length, 287 char *internal_name,
399 char *internal_name, 288 u32 * converted_name_length, char **converted_name);
400 u32 *converted_name_length,
401 char **converted_name);
402 289
403struct acpi_namespace_node * 290struct acpi_namespace_node *acpi_ns_map_handle_to_node(acpi_handle handle);
404acpi_ns_map_handle_to_node (
405 acpi_handle handle);
406 291
407acpi_handle 292acpi_handle acpi_ns_convert_entry_to_handle(struct acpi_namespace_node *node);
408acpi_ns_convert_entry_to_handle(
409 struct acpi_namespace_node *node);
410
411void
412acpi_ns_terminate (
413 void);
414 293
415struct acpi_namespace_node * 294void acpi_ns_terminate(void);
416acpi_ns_get_parent_node (
417 struct acpi_namespace_node *node);
418 295
296struct acpi_namespace_node *acpi_ns_get_parent_node(struct acpi_namespace_node
297 *node);
419 298
420struct acpi_namespace_node * 299struct acpi_namespace_node *acpi_ns_get_next_valid_node(struct
421acpi_ns_get_next_valid_node ( 300 acpi_namespace_node
422 struct acpi_namespace_node *node); 301 *node);
423 302
424#endif /* __ACNAMESP_H__ */ 303#endif /* __ACNAMESP_H__ */
diff --git a/include/acpi/acobject.h b/include/acpi/acobject.h
index e079b94e4fce..4a326ba6d482 100644
--- a/include/acpi/acobject.h
+++ b/include/acpi/acobject.h
@@ -45,7 +45,6 @@
45#ifndef _ACOBJECT_H 45#ifndef _ACOBJECT_H
46#define _ACOBJECT_H 46#define _ACOBJECT_H
47 47
48
49/* 48/*
50 * The union acpi_operand_object is used to pass AML operands from the dispatcher 49 * The union acpi_operand_object is used to pass AML operands from the dispatcher
51 * to the interpreter, and to keep track of the various handlers such as 50 * to the interpreter, and to keep track of the various handlers such as
@@ -81,7 +80,6 @@
81#define AOPOBJ_SETUP_COMPLETE 0x10 80#define AOPOBJ_SETUP_COMPLETE 0x10
82#define AOPOBJ_SINGLE_DATUM 0x20 81#define AOPOBJ_SINGLE_DATUM 0x20
83 82
84
85/* 83/*
86 * Common bitfield for the field objects 84 * Common bitfield for the field objects
87 * "Field Datum" -- a datum from the actual field object 85 * "Field Datum" -- a datum from the actual field object
@@ -96,8 +94,7 @@
96 u8 start_field_bit_offset;/* Bit offset within first field datum (0-63) */\ 94 u8 start_field_bit_offset;/* Bit offset within first field datum (0-63) */\
97 u8 access_bit_width; /* Read/Write size in bits (8-64) */\ 95 u8 access_bit_width; /* Read/Write size in bits (8-64) */\
98 u32 value; /* Value to store into the Bank or Index register */\ 96 u32 value; /* Value to store into the Bank or Index register */\
99 struct acpi_namespace_node *node; /* Link back to parent node */ 97 struct acpi_namespace_node *node; /* Link back to parent node */
100
101 98
102/* 99/*
103 * Fields common to both Strings and Buffers 100 * Fields common to both Strings and Buffers
@@ -105,15 +102,13 @@
105#define ACPI_COMMON_BUFFER_INFO \ 102#define ACPI_COMMON_BUFFER_INFO \
106 u32 length; 103 u32 length;
107 104
108
109/* 105/*
110 * Common fields for objects that support ASL notifications 106 * Common fields for objects that support ASL notifications
111 */ 107 */
112#define ACPI_COMMON_NOTIFY_INFO \ 108#define ACPI_COMMON_NOTIFY_INFO \
113 union acpi_operand_object *system_notify; /* Handler for system notifies */\ 109 union acpi_operand_object *system_notify; /* Handler for system notifies */\
114 union acpi_operand_object *device_notify; /* Handler for driver notifies */\ 110 union acpi_operand_object *device_notify; /* Handler for driver notifies */\
115 union acpi_operand_object *handler; /* Handler for Address space */ 111 union acpi_operand_object *handler; /* Handler for Address space */
116
117 112
118/****************************************************************************** 113/******************************************************************************
119 * 114 *
@@ -121,161 +116,110 @@
121 * 116 *
122 *****************************************************************************/ 117 *****************************************************************************/
123 118
124struct acpi_object_common 119struct acpi_object_common {
125{ 120ACPI_OBJECT_COMMON_HEADER};
126 ACPI_OBJECT_COMMON_HEADER
127};
128 121
129 122struct acpi_object_integer {
130struct acpi_object_integer 123 ACPI_OBJECT_COMMON_HEADER acpi_integer value;
131{
132 ACPI_OBJECT_COMMON_HEADER
133 acpi_integer value;
134}; 124};
135 125
136
137/* 126/*
138 * Note: The String and Buffer object must be identical through the Pointer 127 * Note: The String and Buffer object must be identical through the Pointer
139 * element. There is code that depends on this. 128 * element. There is code that depends on this.
140 */ 129 */
141struct acpi_object_string /* Null terminated, ASCII characters only */ 130struct acpi_object_string { /* Null terminated, ASCII characters only */
142{ 131 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO char *pointer; /* String in AML stream or allocated string */
143 ACPI_OBJECT_COMMON_HEADER
144 ACPI_COMMON_BUFFER_INFO
145 char *pointer; /* String in AML stream or allocated string */
146}; 132};
147 133
148 134struct acpi_object_buffer {
149struct acpi_object_buffer 135 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO u8 * pointer; /* Buffer in AML stream or allocated buffer */
150{ 136 struct acpi_namespace_node *node; /* Link back to parent node */
151 ACPI_OBJECT_COMMON_HEADER 137 u8 *aml_start;
152 ACPI_COMMON_BUFFER_INFO 138 u32 aml_length;
153 u8 *pointer; /* Buffer in AML stream or allocated buffer */
154 struct acpi_namespace_node *node; /* Link back to parent node */
155 u8 *aml_start;
156 u32 aml_length;
157}; 139};
158 140
159 141struct acpi_object_package {
160struct acpi_object_package 142 ACPI_OBJECT_COMMON_HEADER u32 count; /* # of elements in package */
161{ 143 u32 aml_length;
162 ACPI_OBJECT_COMMON_HEADER 144 u8 *aml_start;
163 145 struct acpi_namespace_node *node; /* Link back to parent node */
164 u32 count; /* # of elements in package */ 146 union acpi_operand_object **elements; /* Array of pointers to acpi_objects */
165 u32 aml_length;
166 u8 *aml_start;
167 struct acpi_namespace_node *node; /* Link back to parent node */
168 union acpi_operand_object **elements; /* Array of pointers to acpi_objects */
169}; 147};
170 148
171
172/****************************************************************************** 149/******************************************************************************
173 * 150 *
174 * Complex data types 151 * Complex data types
175 * 152 *
176 *****************************************************************************/ 153 *****************************************************************************/
177 154
178struct acpi_object_event 155struct acpi_object_event {
179{ 156 ACPI_OBJECT_COMMON_HEADER void *semaphore;
180 ACPI_OBJECT_COMMON_HEADER
181 void *semaphore;
182}; 157};
183 158
184
185#define ACPI_INFINITE_CONCURRENCY 0xFF 159#define ACPI_INFINITE_CONCURRENCY 0xFF
186 160
187typedef 161typedef
188acpi_status (*ACPI_INTERNAL_METHOD) ( 162acpi_status(*ACPI_INTERNAL_METHOD) (struct acpi_walk_state * walk_state);
189 struct acpi_walk_state *walk_state); 163
190 164struct acpi_object_method {
191struct acpi_object_method 165 ACPI_OBJECT_COMMON_HEADER u8 method_flags;
192{ 166 u8 param_count;
193 ACPI_OBJECT_COMMON_HEADER 167 u32 aml_length;
194 u8 method_flags; 168 void *semaphore;
195 u8 param_count; 169 u8 *aml_start;
196 u32 aml_length; 170 ACPI_INTERNAL_METHOD implementation;
197 void *semaphore; 171 u8 concurrency;
198 u8 *aml_start; 172 u8 thread_count;
199 ACPI_INTERNAL_METHOD implementation; 173 acpi_owner_id owner_id;
200 u8 concurrency;
201 u8 thread_count;
202 acpi_owner_id owning_id;
203}; 174};
204 175
205 176struct acpi_object_mutex {
206struct acpi_object_mutex 177 ACPI_OBJECT_COMMON_HEADER u8 sync_level; /* 0-15, specified in Mutex() call */
207{ 178 u16 acquisition_depth; /* Allow multiple Acquires, same thread */
208 ACPI_OBJECT_COMMON_HEADER 179 struct acpi_thread_state *owner_thread; /* Current owner of the mutex */
209 u8 sync_level; /* 0-15, specified in Mutex() call */ 180 void *semaphore; /* Actual OS synchronization object */
210 u16 acquisition_depth; /* Allow multiple Acquires, same thread */ 181 union acpi_operand_object *prev; /* Link for list of acquired mutexes */
211 struct acpi_thread_state *owner_thread; /* Current owner of the mutex */ 182 union acpi_operand_object *next; /* Link for list of acquired mutexes */
212 void *semaphore; /* Actual OS synchronization object */ 183 struct acpi_namespace_node *node; /* Containing namespace node */
213 union acpi_operand_object *prev; /* Link for list of acquired mutexes */ 184 u8 original_sync_level; /* Owner's original sync level (0-15) */
214 union acpi_operand_object *next; /* Link for list of acquired mutexes */
215 struct acpi_namespace_node *node; /* Containing namespace node */
216 u8 original_sync_level; /* Owner's original sync level (0-15) */
217}; 185};
218 186
219 187struct acpi_object_region {
220struct acpi_object_region 188 ACPI_OBJECT_COMMON_HEADER u8 space_id;
221{ 189 union acpi_operand_object *handler; /* Handler for region access */
222 ACPI_OBJECT_COMMON_HEADER 190 struct acpi_namespace_node *node; /* Containing namespace node */
223 191 union acpi_operand_object *next;
224 u8 space_id; 192 u32 length;
225 union acpi_operand_object *handler; /* Handler for region access */ 193 acpi_physical_address address;
226 struct acpi_namespace_node *node; /* Containing namespace node */
227 union acpi_operand_object *next;
228 u32 length;
229 acpi_physical_address address;
230}; 194};
231 195
232
233/****************************************************************************** 196/******************************************************************************
234 * 197 *
235 * Objects that can be notified. All share a common notify_info area. 198 * Objects that can be notified. All share a common notify_info area.
236 * 199 *
237 *****************************************************************************/ 200 *****************************************************************************/
238 201
239struct acpi_object_notify_common /* COMMON NOTIFY for POWER, PROCESSOR, DEVICE, and THERMAL */ 202struct acpi_object_notify_common { /* COMMON NOTIFY for POWER, PROCESSOR, DEVICE, and THERMAL */
240{ 203ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO};
241 ACPI_OBJECT_COMMON_HEADER
242 ACPI_COMMON_NOTIFY_INFO
243};
244
245
246struct acpi_object_device
247{
248 ACPI_OBJECT_COMMON_HEADER
249 ACPI_COMMON_NOTIFY_INFO
250 struct acpi_gpe_block_info *gpe_block;
251};
252
253 204
254struct acpi_object_power_resource 205struct acpi_object_device {
255{
256 ACPI_OBJECT_COMMON_HEADER 206 ACPI_OBJECT_COMMON_HEADER
257 ACPI_COMMON_NOTIFY_INFO 207 ACPI_COMMON_NOTIFY_INFO struct acpi_gpe_block_info *gpe_block;
258 u32 system_level;
259 u32 resource_order;
260}; 208};
261 209
262 210struct acpi_object_power_resource {
263struct acpi_object_processor 211 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO u32 system_level;
264{ 212 u32 resource_order;
265 ACPI_OBJECT_COMMON_HEADER
266 ACPI_COMMON_NOTIFY_INFO
267 u32 proc_id;
268 u32 length;
269 acpi_io_address address;
270}; 213};
271 214
272 215struct acpi_object_processor {
273struct acpi_object_thermal_zone 216 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO u32 proc_id;
274{ 217 u32 length;
275 ACPI_OBJECT_COMMON_HEADER 218 acpi_io_address address;
276 ACPI_COMMON_NOTIFY_INFO
277}; 219};
278 220
221struct acpi_object_thermal_zone {
222ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO};
279 223
280/****************************************************************************** 224/******************************************************************************
281 * 225 *
@@ -283,90 +227,63 @@ struct acpi_object_thermal_zone
283 * 227 *
284 *****************************************************************************/ 228 *****************************************************************************/
285 229
286struct acpi_object_field_common /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */ 230struct acpi_object_field_common { /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */
287{ 231 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Containing Operation Region object */
288 ACPI_OBJECT_COMMON_HEADER 232 /* (REGION/BANK fields only) */
289 ACPI_COMMON_FIELD_INFO
290 union acpi_operand_object *region_obj; /* Containing Operation Region object */
291 /* (REGION/BANK fields only) */
292}; 233};
293 234
294 235struct acpi_object_region_field {
295struct acpi_object_region_field 236 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Containing op_region object */
296{
297 ACPI_OBJECT_COMMON_HEADER
298 ACPI_COMMON_FIELD_INFO
299 union acpi_operand_object *region_obj; /* Containing op_region object */
300}; 237};
301 238
302 239struct acpi_object_bank_field {
303struct acpi_object_bank_field 240 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Containing op_region object */
304{ 241 union acpi_operand_object *bank_obj; /* bank_select Register object */
305 ACPI_OBJECT_COMMON_HEADER
306 ACPI_COMMON_FIELD_INFO
307 union acpi_operand_object *region_obj; /* Containing op_region object */
308 union acpi_operand_object *bank_obj; /* bank_select Register object */
309}; 242};
310 243
311 244struct acpi_object_index_field {
312struct acpi_object_index_field 245 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO
313{ 246 /*
314 ACPI_OBJECT_COMMON_HEADER 247 * No "region_obj" pointer needed since the Index and Data registers
315 ACPI_COMMON_FIELD_INFO 248 * are each field definitions unto themselves.
316 249 */
317 /* 250 union acpi_operand_object *index_obj; /* Index register */
318 * No "region_obj" pointer needed since the Index and Data registers 251 union acpi_operand_object *data_obj; /* Data register */
319 * are each field definitions unto themselves.
320 */
321 union acpi_operand_object *index_obj; /* Index register */
322 union acpi_operand_object *data_obj; /* Data register */
323}; 252};
324 253
325
326/* The buffer_field is different in that it is part of a Buffer, not an op_region */ 254/* The buffer_field is different in that it is part of a Buffer, not an op_region */
327 255
328struct acpi_object_buffer_field 256struct acpi_object_buffer_field {
329{ 257 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *buffer_obj; /* Containing Buffer object */
330 ACPI_OBJECT_COMMON_HEADER
331 ACPI_COMMON_FIELD_INFO
332 union acpi_operand_object *buffer_obj; /* Containing Buffer object */
333}; 258};
334 259
335
336/****************************************************************************** 260/******************************************************************************
337 * 261 *
338 * Objects for handlers 262 * Objects for handlers
339 * 263 *
340 *****************************************************************************/ 264 *****************************************************************************/
341 265
342struct acpi_object_notify_handler 266struct acpi_object_notify_handler {
343{ 267 ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *node; /* Parent device */
344 ACPI_OBJECT_COMMON_HEADER 268 acpi_notify_handler handler;
345 struct acpi_namespace_node *node; /* Parent device */ 269 void *context;
346 acpi_notify_handler handler;
347 void *context;
348}; 270};
349 271
350
351/* Flags for address handler */ 272/* Flags for address handler */
352 273
353#define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED 0x1 274#define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED 0x1
354 275
355 276struct acpi_object_addr_handler {
356struct acpi_object_addr_handler 277 ACPI_OBJECT_COMMON_HEADER u8 space_id;
357{ 278 u16 hflags;
358 ACPI_OBJECT_COMMON_HEADER 279 acpi_adr_space_handler handler;
359 u8 space_id; 280 struct acpi_namespace_node *node; /* Parent device */
360 u16 hflags; 281 void *context;
361 acpi_adr_space_handler handler; 282 acpi_adr_space_setup setup;
362 struct acpi_namespace_node *node; /* Parent device */ 283 union acpi_operand_object *region_list; /* regions using this handler */
363 void *context; 284 union acpi_operand_object *next;
364 acpi_adr_space_setup setup;
365 union acpi_operand_object *region_list; /* regions using this handler */
366 union acpi_operand_object *next;
367}; 285};
368 286
369
370/****************************************************************************** 287/******************************************************************************
371 * 288 *
372 * Special internal objects 289 * Special internal objects
@@ -377,18 +294,15 @@ struct acpi_object_addr_handler
377 * The Reference object type is used for these opcodes: 294 * The Reference object type is used for these opcodes:
378 * Arg[0-6], Local[0-7], index_op, name_op, zero_op, one_op, ones_op, debug_op 295 * Arg[0-6], Local[0-7], index_op, name_op, zero_op, one_op, ones_op, debug_op
379 */ 296 */
380struct acpi_object_reference 297struct acpi_object_reference {
381{ 298 ACPI_OBJECT_COMMON_HEADER u8 target_type; /* Used for index_op */
382 ACPI_OBJECT_COMMON_HEADER 299 u16 opcode;
383 u8 target_type; /* Used for index_op */ 300 u32 offset; /* Used for arg_op, local_op, and index_op */
384 u16 opcode; 301 void *object; /* name_op=>HANDLE to obj, index_op=>union acpi_operand_object */
385 u32 offset; /* Used for arg_op, local_op, and index_op */ 302 struct acpi_namespace_node *node;
386 void *object; /* name_op=>HANDLE to obj, index_op=>union acpi_operand_object */ 303 union acpi_operand_object **where;
387 struct acpi_namespace_node *node;
388 union acpi_operand_object **where;
389}; 304};
390 305
391
392/* 306/*
393 * Extra object is used as additional storage for types that 307 * Extra object is used as additional storage for types that
394 * have AML code in their declarations (term_args) that must be 308 * have AML code in their declarations (term_args) that must be
@@ -396,73 +310,62 @@ struct acpi_object_reference
396 * 310 *
397 * Currently: Region and field_unit types 311 * Currently: Region and field_unit types
398 */ 312 */
399struct acpi_object_extra 313struct acpi_object_extra {
400{ 314 ACPI_OBJECT_COMMON_HEADER u8 byte_fill1;
401 ACPI_OBJECT_COMMON_HEADER 315 u16 word_fill1;
402 u8 byte_fill1; 316 u32 aml_length;
403 u16 word_fill1; 317 u8 *aml_start;
404 u32 aml_length; 318 struct acpi_namespace_node *method_REG; /* _REG method for this region (if any) */
405 u8 *aml_start; 319 void *region_context; /* Region-specific data */
406 struct acpi_namespace_node *method_REG; /* _REG method for this region (if any) */
407 void *region_context; /* Region-specific data */
408}; 320};
409 321
410
411/* Additional data that can be attached to namespace nodes */ 322/* Additional data that can be attached to namespace nodes */
412 323
413struct acpi_object_data 324struct acpi_object_data {
414{ 325 ACPI_OBJECT_COMMON_HEADER acpi_object_handler handler;
415 ACPI_OBJECT_COMMON_HEADER 326 void *pointer;
416 acpi_object_handler handler;
417 void *pointer;
418}; 327};
419 328
420
421/* Structure used when objects are cached for reuse */ 329/* Structure used when objects are cached for reuse */
422 330
423struct acpi_object_cache_list 331struct acpi_object_cache_list {
424{ 332 ACPI_OBJECT_COMMON_HEADER union acpi_operand_object *next; /* Link for object cache and internal lists */
425 ACPI_OBJECT_COMMON_HEADER
426 union acpi_operand_object *next; /* Link for object cache and internal lists*/
427}; 333};
428 334
429
430/****************************************************************************** 335/******************************************************************************
431 * 336 *
432 * union acpi_operand_object Descriptor - a giant union of all of the above 337 * union acpi_operand_object Descriptor - a giant union of all of the above
433 * 338 *
434 *****************************************************************************/ 339 *****************************************************************************/
435 340
436union acpi_operand_object 341union acpi_operand_object {
437{ 342 struct acpi_object_common common;
438 struct acpi_object_common common; 343 struct acpi_object_integer integer;
439 struct acpi_object_integer integer; 344 struct acpi_object_string string;
440 struct acpi_object_string string; 345 struct acpi_object_buffer buffer;
441 struct acpi_object_buffer buffer; 346 struct acpi_object_package package;
442 struct acpi_object_package package; 347 struct acpi_object_event event;
443 struct acpi_object_event event; 348 struct acpi_object_method method;
444 struct acpi_object_method method; 349 struct acpi_object_mutex mutex;
445 struct acpi_object_mutex mutex; 350 struct acpi_object_region region;
446 struct acpi_object_region region; 351 struct acpi_object_notify_common common_notify;
447 struct acpi_object_notify_common common_notify; 352 struct acpi_object_device device;
448 struct acpi_object_device device; 353 struct acpi_object_power_resource power_resource;
449 struct acpi_object_power_resource power_resource; 354 struct acpi_object_processor processor;
450 struct acpi_object_processor processor; 355 struct acpi_object_thermal_zone thermal_zone;
451 struct acpi_object_thermal_zone thermal_zone; 356 struct acpi_object_field_common common_field;
452 struct acpi_object_field_common common_field; 357 struct acpi_object_region_field field;
453 struct acpi_object_region_field field; 358 struct acpi_object_buffer_field buffer_field;
454 struct acpi_object_buffer_field buffer_field; 359 struct acpi_object_bank_field bank_field;
455 struct acpi_object_bank_field bank_field; 360 struct acpi_object_index_field index_field;
456 struct acpi_object_index_field index_field; 361 struct acpi_object_notify_handler notify;
457 struct acpi_object_notify_handler notify; 362 struct acpi_object_addr_handler address_space;
458 struct acpi_object_addr_handler address_space; 363 struct acpi_object_reference reference;
459 struct acpi_object_reference reference; 364 struct acpi_object_extra extra;
460 struct acpi_object_extra extra; 365 struct acpi_object_data data;
461 struct acpi_object_data data; 366 struct acpi_object_cache_list cache;
462 struct acpi_object_cache_list cache;
463}; 367};
464 368
465
466/****************************************************************************** 369/******************************************************************************
467 * 370 *
468 * union acpi_descriptor - objects that share a common descriptor identifier 371 * union acpi_descriptor - objects that share a common descriptor identifier
@@ -471,7 +374,7 @@ union acpi_operand_object
471 374
472/* Object descriptor types */ 375/* Object descriptor types */
473 376
474#define ACPI_DESC_TYPE_CACHED 0x01 /* Used only when object is cached */ 377#define ACPI_DESC_TYPE_CACHED 0x01 /* Used only when object is cached */
475#define ACPI_DESC_TYPE_STATE 0x02 378#define ACPI_DESC_TYPE_STATE 0x02
476#define ACPI_DESC_TYPE_STATE_UPDATE 0x03 379#define ACPI_DESC_TYPE_STATE_UPDATE 0x03
477#define ACPI_DESC_TYPE_STATE_PACKAGE 0x04 380#define ACPI_DESC_TYPE_STATE_PACKAGE 0x04
@@ -488,14 +391,11 @@ union acpi_operand_object
488#define ACPI_DESC_TYPE_NAMED 0x0F 391#define ACPI_DESC_TYPE_NAMED 0x0F
489#define ACPI_DESC_TYPE_MAX 0x0F 392#define ACPI_DESC_TYPE_MAX 0x0F
490 393
491 394union acpi_descriptor {
492union acpi_descriptor 395 u8 descriptor_id; /* To differentiate various internal objs */
493{ 396 union acpi_operand_object object;
494 u8 descriptor_id; /* To differentiate various internal objs */\ 397 struct acpi_namespace_node node;
495 union acpi_operand_object object; 398 union acpi_parse_object op;
496 struct acpi_namespace_node node;
497 union acpi_parse_object op;
498}; 399};
499 400
500 401#endif /* _ACOBJECT_H */
501#endif /* _ACOBJECT_H */
diff --git a/include/acpi/acopcode.h b/include/acpi/acopcode.h
index 118ecba4cf05..64da42992199 100644
--- a/include/acpi/acopcode.h
+++ b/include/acpi/acopcode.h
@@ -62,7 +62,6 @@
62#define _NAM 0x6C 62#define _NAM 0x6C
63#define _PFX 0x6D 63#define _PFX 0x6D
64 64
65
66/* 65/*
67 * All AML opcodes and the parse-time arguments for each. Used by the AML 66 * All AML opcodes and the parse-time arguments for each. Used by the AML
68 * parser Each list is compressed into a 32-bit number and stored in the 67 * parser Each list is compressed into a 32-bit number and stored in the
@@ -191,7 +190,6 @@
191#define ARGP_WORD_OP ARGP_LIST1 (ARGP_WORDDATA) 190#define ARGP_WORD_OP ARGP_LIST1 (ARGP_WORDDATA)
192#define ARGP_ZERO_OP ARG_NONE 191#define ARGP_ZERO_OP ARG_NONE
193 192
194
195/* 193/*
196 * All AML opcodes and the runtime arguments for each. Used by the AML 194 * All AML opcodes and the runtime arguments for each. Used by the AML
197 * interpreter Each list is compressed into a 32-bit number and stored 195 * interpreter Each list is compressed into a 32-bit number and stored
@@ -246,7 +244,7 @@
246#define ARGI_FIELD_OP ARGI_INVALID_OPCODE 244#define ARGI_FIELD_OP ARGI_INVALID_OPCODE
247#define ARGI_FIND_SET_LEFT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF) 245#define ARGI_FIND_SET_LEFT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
248#define ARGI_FIND_SET_RIGHT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF) 246#define ARGI_FIND_SET_RIGHT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
249#define ARGI_FROM_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF) 247#define ARGI_FROM_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_FIXED_TARGET)
250#define ARGI_IF_OP ARGI_INVALID_OPCODE 248#define ARGI_IF_OP ARGI_INVALID_OPCODE
251#define ARGI_INCREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF) 249#define ARGI_INCREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF)
252#define ARGI_INDEX_FIELD_OP ARGI_INVALID_OPCODE 250#define ARGI_INDEX_FIELD_OP ARGI_INVALID_OPCODE
@@ -322,4 +320,4 @@
322#define ARGI_WORD_OP ARGI_INVALID_OPCODE 320#define ARGI_WORD_OP ARGI_INVALID_OPCODE
323#define ARGI_ZERO_OP ARG_NONE 321#define ARGI_ZERO_OP ARG_NONE
324 322
325#endif /* __ACOPCODE_H__ */ 323#endif /* __ACOPCODE_H__ */
diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h
index 2fbe180fee6b..68d7edf0f697 100644
--- a/include/acpi/acoutput.h
+++ b/include/acpi/acoutput.h
@@ -73,12 +73,10 @@
73#define ACPI_ALL_COMPONENTS 0x00003FFF 73#define ACPI_ALL_COMPONENTS 0x00003FFF
74#define ACPI_COMPONENT_DEFAULT (ACPI_ALL_COMPONENTS) 74#define ACPI_COMPONENT_DEFAULT (ACPI_ALL_COMPONENTS)
75 75
76
77/* Component IDs reserved for ACPI drivers */ 76/* Component IDs reserved for ACPI drivers */
78 77
79#define ACPI_ALL_DRIVERS 0xFFFF0000 78#define ACPI_ALL_DRIVERS 0xFFFF0000
80 79
81
82/* 80/*
83 * Raw debug output levels, do not use these in the DEBUG_PRINT macros 81 * Raw debug output levels, do not use these in the DEBUG_PRINT macros
84 */ 82 */
@@ -132,11 +130,10 @@
132 130
133#define ACPI_LV_VERBOSE 0xF0000000 131#define ACPI_LV_VERBOSE 0xF0000000
134 132
135
136/* 133/*
137 * Debug level macros that are used in the DEBUG_PRINT macros 134 * Debug level macros that are used in the DEBUG_PRINT macros
138 */ 135 */
139#define ACPI_DEBUG_LEVEL(dl) (u32) dl,__LINE__,&_debug_info 136#define ACPI_DEBUG_LEVEL(dl) (u32) dl,ACPI_DEBUG_PARAMETERS
140 137
141/* Exception level -- used in the global "debug_level" */ 138/* Exception level -- used in the global "debug_level" */
142 139
@@ -147,7 +144,6 @@
147#define ACPI_DB_INFO ACPI_DEBUG_LEVEL (ACPI_LV_INFO) 144#define ACPI_DB_INFO ACPI_DEBUG_LEVEL (ACPI_LV_INFO)
148#define ACPI_DB_ALL_EXCEPTIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALL_EXCEPTIONS) 145#define ACPI_DB_ALL_EXCEPTIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALL_EXCEPTIONS)
149 146
150
151/* Trace level -- also used in the global "debug_level" */ 147/* Trace level -- also used in the global "debug_level" */
152 148
153#define ACPI_DB_INIT_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_INIT_NAMES) 149#define ACPI_DB_INIT_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_INIT_NAMES)
@@ -174,12 +170,10 @@
174 170
175#define ACPI_DB_ALL ACPI_DEBUG_LEVEL (ACPI_LV_ALL) 171#define ACPI_DB_ALL ACPI_DEBUG_LEVEL (ACPI_LV_ALL)
176 172
177
178/* Defaults for debug_level, debug and normal */ 173/* Defaults for debug_level, debug and normal */
179 174
180#define ACPI_DEBUG_DEFAULT (ACPI_LV_INIT | ACPI_LV_WARN | ACPI_LV_ERROR | ACPI_LV_DEBUG_OBJECT) 175#define ACPI_DEBUG_DEFAULT (ACPI_LV_INIT | ACPI_LV_WARN | ACPI_LV_ERROR | ACPI_LV_DEBUG_OBJECT)
181#define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_WARN | ACPI_LV_ERROR | ACPI_LV_DEBUG_OBJECT) 176#define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_WARN | ACPI_LV_ERROR | ACPI_LV_DEBUG_OBJECT)
182#define ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL) 177#define ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL)
183 178
184 179#endif /* __ACOUTPUT_H__ */
185#endif /* __ACOUTPUT_H__ */
diff --git a/include/acpi/acparser.h b/include/acpi/acparser.h
index 698276571818..d352d40de1f3 100644
--- a/include/acpi/acparser.h
+++ b/include/acpi/acparser.h
@@ -41,18 +41,15 @@
41 * POSSIBILITY OF SUCH DAMAGES. 41 * POSSIBILITY OF SUCH DAMAGES.
42 */ 42 */
43 43
44
45#ifndef __ACPARSER_H__ 44#ifndef __ACPARSER_H__
46#define __ACPARSER_H__ 45#define __ACPARSER_H__
47 46
48
49#define OP_HAS_RETURN_VALUE 1 47#define OP_HAS_RETURN_VALUE 1
50 48
51/* variable # arguments */ 49/* variable # arguments */
52 50
53#define ACPI_VAR_ARGS ACPI_UINT32_MAX 51#define ACPI_VAR_ARGS ACPI_UINT32_MAX
54 52
55
56#define ACPI_PARSE_DELETE_TREE 0x0001 53#define ACPI_PARSE_DELETE_TREE 0x0001
57#define ACPI_PARSE_NO_TREE_DELETE 0x0000 54#define ACPI_PARSE_NO_TREE_DELETE 0x0000
58#define ACPI_PARSE_TREE_MASK 0x0001 55#define ACPI_PARSE_TREE_MASK 0x0001
@@ -63,7 +60,7 @@
63#define ACPI_PARSE_MODE_MASK 0x0030 60#define ACPI_PARSE_MODE_MASK 0x0030
64 61
65#define ACPI_PARSE_DEFERRED_OP 0x0100 62#define ACPI_PARSE_DEFERRED_OP 0x0100
66 63#define ACPI_PARSE_DISASSEMBLE 0x0200
67 64
68/****************************************************************************** 65/******************************************************************************
69 * 66 *
@@ -71,251 +68,165 @@
71 * 68 *
72 *****************************************************************************/ 69 *****************************************************************************/
73 70
74
75/* 71/*
76 * psxface - Parser external interfaces 72 * psxface - Parser external interfaces
77 */ 73 */
78acpi_status 74acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info);
79acpi_psx_load_table (
80 u8 *pcode_addr,
81 u32 pcode_length);
82
83acpi_status
84acpi_psx_execute (
85 struct acpi_parameter_info *info);
86
87 75
88/* 76/*
89 * psargs - Parse AML opcode arguments 77 * psargs - Parse AML opcode arguments
90 */ 78 */
91u8 * 79u8 *acpi_ps_get_next_package_end(struct acpi_parse_state *parser_state);
92acpi_ps_get_next_package_end (
93 struct acpi_parse_state *parser_state);
94 80
95char * 81char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state);
96acpi_ps_get_next_namestring (
97 struct acpi_parse_state *parser_state);
98 82
99void 83void
100acpi_ps_get_next_simple_arg ( 84acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state,
101 struct acpi_parse_state *parser_state, 85 u32 arg_type, union acpi_parse_object *arg);
102 u32 arg_type,
103 union acpi_parse_object *arg);
104 86
105acpi_status 87acpi_status
106acpi_ps_get_next_namepath ( 88acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state,
107 struct acpi_walk_state *walk_state, 89 struct acpi_parse_state *parser_state,
108 struct acpi_parse_state *parser_state, 90 union acpi_parse_object *arg, u8 method_call);
109 union acpi_parse_object *arg,
110 u8 method_call);
111 91
112acpi_status 92acpi_status
113acpi_ps_get_next_arg ( 93acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
114 struct acpi_walk_state *walk_state, 94 struct acpi_parse_state *parser_state,
115 struct acpi_parse_state *parser_state, 95 u32 arg_type, union acpi_parse_object **return_arg);
116 u32 arg_type,
117 union acpi_parse_object **return_arg);
118
119 96
120/* 97/*
121 * psfind 98 * psfind
122 */ 99 */
123union acpi_parse_object * 100union acpi_parse_object *acpi_ps_find_name(union acpi_parse_object *scope,
124acpi_ps_find_name ( 101 u32 name, u32 opcode);
125 union acpi_parse_object *scope,
126 u32 name,
127 u32 opcode);
128
129union acpi_parse_object*
130acpi_ps_get_parent (
131 union acpi_parse_object *op);
132 102
103union acpi_parse_object *acpi_ps_get_parent(union acpi_parse_object *op);
133 104
134/* 105/*
135 * psopcode - AML Opcode information 106 * psopcode - AML Opcode information
136 */ 107 */
137const struct acpi_opcode_info * 108const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode);
138acpi_ps_get_opcode_info (
139 u16 opcode);
140
141char *
142acpi_ps_get_opcode_name (
143 u16 opcode);
144 109
110char *acpi_ps_get_opcode_name(u16 opcode);
145 111
146/* 112/*
147 * psparse - top level parsing routines 113 * psparse - top level parsing routines
148 */ 114 */
149acpi_status 115acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state);
150acpi_ps_parse_aml (
151 struct acpi_walk_state *walk_state);
152 116
153u32 117u32 acpi_ps_get_opcode_size(u32 opcode);
154acpi_ps_get_opcode_size (
155 u32 opcode);
156 118
157u16 119u16 acpi_ps_peek_opcode(struct acpi_parse_state *state);
158acpi_ps_peek_opcode (
159 struct acpi_parse_state *state);
160 120
121acpi_status
122acpi_ps_complete_this_op(struct acpi_walk_state *walk_state,
123 union acpi_parse_object *op);
124
125acpi_status
126acpi_ps_next_parse_state(struct acpi_walk_state *walk_state,
127 union acpi_parse_object *op,
128 acpi_status callback_status);
129
130/*
131 * psloop - main parse loop
132 */
133acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state);
161 134
162/* 135/*
163 * psscope - Scope stack management routines 136 * psscope - Scope stack management routines
164 */ 137 */
165acpi_status 138acpi_status
166acpi_ps_init_scope ( 139acpi_ps_init_scope(struct acpi_parse_state *parser_state,
167 struct acpi_parse_state *parser_state, 140 union acpi_parse_object *root);
168 union acpi_parse_object *root);
169 141
170union acpi_parse_object * 142union acpi_parse_object *acpi_ps_get_parent_scope(struct acpi_parse_state
171acpi_ps_get_parent_scope ( 143 *state);
172 struct acpi_parse_state *state);
173 144
174u8 145u8 acpi_ps_has_completed_scope(struct acpi_parse_state *parser_state);
175acpi_ps_has_completed_scope (
176 struct acpi_parse_state *parser_state);
177 146
178void 147void
179acpi_ps_pop_scope ( 148acpi_ps_pop_scope(struct acpi_parse_state *parser_state,
180 struct acpi_parse_state *parser_state, 149 union acpi_parse_object **op,
181 union acpi_parse_object **op, 150 u32 * arg_list, u32 * arg_count);
182 u32 *arg_list,
183 u32 *arg_count);
184 151
185acpi_status 152acpi_status
186acpi_ps_push_scope ( 153acpi_ps_push_scope(struct acpi_parse_state *parser_state,
187 struct acpi_parse_state *parser_state, 154 union acpi_parse_object *op,
188 union acpi_parse_object *op, 155 u32 remaining_args, u32 arg_count);
189 u32 remaining_args,
190 u32 arg_count);
191
192void
193acpi_ps_cleanup_scope (
194 struct acpi_parse_state *state);
195 156
157void acpi_ps_cleanup_scope(struct acpi_parse_state *state);
196 158
197/* 159/*
198 * pstree - parse tree manipulation routines 160 * pstree - parse tree manipulation routines
199 */ 161 */
200void 162void
201acpi_ps_append_arg( 163acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg);
202 union acpi_parse_object *op,
203 union acpi_parse_object *arg);
204
205union acpi_parse_object*
206acpi_ps_find (
207 union acpi_parse_object *scope,
208 char *path,
209 u16 opcode,
210 u32 create);
211
212union acpi_parse_object *
213acpi_ps_get_arg(
214 union acpi_parse_object *op,
215 u32 argn);
216 164
217#ifdef ACPI_FUTURE_USAGE 165union acpi_parse_object *acpi_ps_find(union acpi_parse_object *scope,
218union acpi_parse_object * 166 char *path, u16 opcode, u32 create);
219acpi_ps_get_depth_next (
220 union acpi_parse_object *origin,
221 union acpi_parse_object *op);
222#endif /* ACPI_FUTURE_USAGE */
223 167
168union acpi_parse_object *acpi_ps_get_arg(union acpi_parse_object *op, u32 argn);
169
170#ifdef ACPI_FUTURE_USAGE
171union acpi_parse_object *acpi_ps_get_depth_next(union acpi_parse_object *origin,
172 union acpi_parse_object *op);
173#endif /* ACPI_FUTURE_USAGE */
224 174
225/* 175/*
226 * pswalk - parse tree walk routines 176 * pswalk - parse tree walk routines
227 */ 177 */
228acpi_status 178acpi_status
229acpi_ps_walk_parsed_aml ( 179acpi_ps_walk_parsed_aml(union acpi_parse_object *start_op,
230 union acpi_parse_object *start_op, 180 union acpi_parse_object *end_op,
231 union acpi_parse_object *end_op, 181 union acpi_operand_object *mth_desc,
232 union acpi_operand_object *mth_desc, 182 struct acpi_namespace_node *start_node,
233 struct acpi_namespace_node *start_node, 183 union acpi_operand_object **params,
234 union acpi_operand_object **params, 184 union acpi_operand_object **caller_return_desc,
235 union acpi_operand_object **caller_return_desc, 185 acpi_owner_id owner_id,
236 acpi_owner_id owner_id, 186 acpi_parse_downwards descending_callback,
237 acpi_parse_downwards descending_callback, 187 acpi_parse_upwards ascending_callback);
238 acpi_parse_upwards ascending_callback);
239
240acpi_status
241acpi_ps_get_next_walk_op (
242 struct acpi_walk_state *walk_state,
243 union acpi_parse_object *op,
244 acpi_parse_upwards ascending_callback);
245 188
246acpi_status 189acpi_status
247acpi_ps_delete_completed_op ( 190acpi_ps_get_next_walk_op(struct acpi_walk_state *walk_state,
248 struct acpi_walk_state *walk_state); 191 union acpi_parse_object *op,
192 acpi_parse_upwards ascending_callback);
249 193
250void 194acpi_status acpi_ps_delete_completed_op(struct acpi_walk_state *walk_state);
251acpi_ps_delete_parse_tree (
252 union acpi_parse_object *root);
253 195
196void acpi_ps_delete_parse_tree(union acpi_parse_object *root);
254 197
255/* 198/*
256 * psutils - parser utilities 199 * psutils - parser utilities
257 */ 200 */
258union acpi_parse_object * 201union acpi_parse_object *acpi_ps_create_scope_op(void);
259acpi_ps_create_scope_op (
260 void);
261 202
262void 203void acpi_ps_init_op(union acpi_parse_object *op, u16 opcode);
263acpi_ps_init_op (
264 union acpi_parse_object *op,
265 u16 opcode);
266 204
267union acpi_parse_object * 205union acpi_parse_object *acpi_ps_alloc_op(u16 opcode);
268acpi_ps_alloc_op (
269 u16 opcode);
270 206
271void 207void acpi_ps_free_op(union acpi_parse_object *op);
272acpi_ps_free_op (
273 union acpi_parse_object *op);
274 208
275u8 209u8 acpi_ps_is_leading_char(u32 c);
276acpi_ps_is_leading_char (
277 u32 c);
278 210
279u8 211u8 acpi_ps_is_prefix_char(u32 c);
280acpi_ps_is_prefix_char (
281 u32 c);
282 212
283#ifdef ACPI_FUTURE_USAGE 213#ifdef ACPI_FUTURE_USAGE
284u32 214u32 acpi_ps_get_name(union acpi_parse_object *op);
285acpi_ps_get_name( 215#endif /* ACPI_FUTURE_USAGE */
286 union acpi_parse_object *op);
287#endif /* ACPI_FUTURE_USAGE */
288
289void
290acpi_ps_set_name(
291 union acpi_parse_object *op,
292 u32 name);
293
294#ifdef ACPI_ENABLE_OBJECT_CACHE
295void
296acpi_ps_delete_parse_cache (
297 void);
298#endif
299 216
217void acpi_ps_set_name(union acpi_parse_object *op, u32 name);
300 218
301/* 219/*
302 * psdump - display parser tree 220 * psdump - display parser tree
303 */ 221 */
304u32 222u32
305acpi_ps_sprint_path ( 223acpi_ps_sprint_path(char *buffer_start,
306 char *buffer_start, 224 u32 buffer_size, union acpi_parse_object *op);
307 u32 buffer_size,
308 union acpi_parse_object *op);
309 225
310u32 226u32
311acpi_ps_sprint_op ( 227acpi_ps_sprint_op(char *buffer_start,
312 char *buffer_start, 228 u32 buffer_size, union acpi_parse_object *op);
313 u32 buffer_size,
314 union acpi_parse_object *op);
315
316void
317acpi_ps_show (
318 union acpi_parse_object *op);
319 229
230void acpi_ps_show(union acpi_parse_object *op);
320 231
321#endif /* __ACPARSER_H__ */ 232#endif /* __ACPARSER_H__ */
diff --git a/include/acpi/acpi.h b/include/acpi/acpi.h
index a69d78942040..ccf34f9dac64 100644
--- a/include/acpi/acpi.h
+++ b/include/acpi/acpi.h
@@ -49,22 +49,21 @@
49 * We put them here because we don't want to duplicate them 49 * We put them here because we don't want to duplicate them
50 * in the rest of the source code again and again. 50 * in the rest of the source code again and again.
51 */ 51 */
52#include "acnames.h" /* Global ACPI names and strings */ 52#include "acnames.h" /* Global ACPI names and strings */
53#include "acconfig.h" /* Configuration constants */ 53#include "acconfig.h" /* Configuration constants */
54#include "platform/acenv.h" /* Target environment specific items */ 54#include "platform/acenv.h" /* Target environment specific items */
55#include "actypes.h" /* Fundamental common data types */ 55#include "actypes.h" /* Fundamental common data types */
56#include "acexcep.h" /* ACPI exception codes */ 56#include "acexcep.h" /* ACPI exception codes */
57#include "acmacros.h" /* C macros */ 57#include "acmacros.h" /* C macros */
58#include "actbl.h" /* ACPI table definitions */ 58#include "actbl.h" /* ACPI table definitions */
59#include "aclocal.h" /* Internal data types */ 59#include "aclocal.h" /* Internal data types */
60#include "acoutput.h" /* Error output and Debug macros */ 60#include "acoutput.h" /* Error output and Debug macros */
61#include "acpiosxf.h" /* Interfaces to the ACPI-to-OS layer*/ 61#include "acpiosxf.h" /* Interfaces to the ACPI-to-OS layer */
62#include "acpixf.h" /* ACPI core subsystem external interfaces */ 62#include "acpixf.h" /* ACPI core subsystem external interfaces */
63#include "acobject.h" /* ACPI internal object */ 63#include "acobject.h" /* ACPI internal object */
64#include "acstruct.h" /* Common structures */ 64#include "acstruct.h" /* Common structures */
65#include "acglobal.h" /* All global variables */ 65#include "acglobal.h" /* All global variables */
66#include "achware.h" /* Hardware defines and interfaces */ 66#include "achware.h" /* Hardware defines and interfaces */
67#include "acutils.h" /* Utility interfaces */ 67#include "acutils.h" /* Utility interfaces */
68 68
69 69#endif /* __ACPI_H__ */
70#endif /* __ACPI_H__ */
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 8d0e1290bc76..0b54e9a4a8a1 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -35,48 +35,41 @@
35/* TBD: Make dynamic */ 35/* TBD: Make dynamic */
36#define ACPI_MAX_HANDLES 10 36#define ACPI_MAX_HANDLES 10
37struct acpi_handle_list { 37struct acpi_handle_list {
38 u32 count; 38 u32 count;
39 acpi_handle handles[ACPI_MAX_HANDLES]; 39 acpi_handle handles[ACPI_MAX_HANDLES];
40}; 40};
41 41
42
43/* acpi_utils.h */ 42/* acpi_utils.h */
44acpi_status 43acpi_status
45acpi_extract_package ( 44acpi_extract_package(union acpi_object *package,
46 union acpi_object *package, 45 struct acpi_buffer *format, struct acpi_buffer *buffer);
47 struct acpi_buffer *format,
48 struct acpi_buffer *buffer);
49acpi_status 46acpi_status
50acpi_evaluate_integer ( 47acpi_evaluate_integer(acpi_handle handle,
51 acpi_handle handle, 48 acpi_string pathname,
52 acpi_string pathname, 49 struct acpi_object_list *arguments, unsigned long *data);
53 struct acpi_object_list *arguments,
54 unsigned long *data);
55acpi_status 50acpi_status
56acpi_evaluate_reference ( 51acpi_evaluate_reference(acpi_handle handle,
57 acpi_handle handle, 52 acpi_string pathname,
58 acpi_string pathname, 53 struct acpi_object_list *arguments,
59 struct acpi_object_list *arguments, 54 struct acpi_handle_list *list);
60 struct acpi_handle_list *list);
61
62 55
63#ifdef CONFIG_ACPI_BUS 56#ifdef CONFIG_ACPI
64 57
65#include <linux/proc_fs.h> 58#include <linux/proc_fs.h>
66 59
67#define ACPI_BUS_FILE_ROOT "acpi" 60#define ACPI_BUS_FILE_ROOT "acpi"
68extern struct proc_dir_entry *acpi_root_dir; 61extern struct proc_dir_entry *acpi_root_dir;
69extern FADT_DESCRIPTOR acpi_fadt; 62extern FADT_DESCRIPTOR acpi_fadt;
70 63
71enum acpi_bus_removal_type { 64enum acpi_bus_removal_type {
72 ACPI_BUS_REMOVAL_NORMAL = 0, 65 ACPI_BUS_REMOVAL_NORMAL = 0,
73 ACPI_BUS_REMOVAL_EJECT, 66 ACPI_BUS_REMOVAL_EJECT,
74 ACPI_BUS_REMOVAL_SUPRISE, 67 ACPI_BUS_REMOVAL_SUPRISE,
75 ACPI_BUS_REMOVAL_TYPE_COUNT 68 ACPI_BUS_REMOVAL_TYPE_COUNT
76}; 69};
77 70
78enum acpi_bus_device_type { 71enum acpi_bus_device_type {
79 ACPI_BUS_TYPE_DEVICE = 0, 72 ACPI_BUS_TYPE_DEVICE = 0,
80 ACPI_BUS_TYPE_POWER, 73 ACPI_BUS_TYPE_POWER,
81 ACPI_BUS_TYPE_PROCESSOR, 74 ACPI_BUS_TYPE_PROCESSOR,
82 ACPI_BUS_TYPE_THERMAL, 75 ACPI_BUS_TYPE_THERMAL,
@@ -89,61 +82,60 @@ enum acpi_bus_device_type {
89struct acpi_driver; 82struct acpi_driver;
90struct acpi_device; 83struct acpi_device;
91 84
92
93/* 85/*
94 * ACPI Driver 86 * ACPI Driver
95 * ----------- 87 * -----------
96 */ 88 */
97 89
98typedef int (*acpi_op_add) (struct acpi_device *device); 90typedef int (*acpi_op_add) (struct acpi_device * device);
99typedef int (*acpi_op_remove) (struct acpi_device *device, int type); 91typedef int (*acpi_op_remove) (struct acpi_device * device, int type);
100typedef int (*acpi_op_lock) (struct acpi_device *device, int type); 92typedef int (*acpi_op_lock) (struct acpi_device * device, int type);
101typedef int (*acpi_op_start) (struct acpi_device *device); 93typedef int (*acpi_op_start) (struct acpi_device * device);
102typedef int (*acpi_op_stop) (struct acpi_device *device, int type); 94typedef int (*acpi_op_stop) (struct acpi_device * device, int type);
103typedef int (*acpi_op_suspend) (struct acpi_device *device, int state); 95typedef int (*acpi_op_suspend) (struct acpi_device * device, int state);
104typedef int (*acpi_op_resume) (struct acpi_device *device, int state); 96typedef int (*acpi_op_resume) (struct acpi_device * device, int state);
105typedef int (*acpi_op_scan) (struct acpi_device *device); 97typedef int (*acpi_op_scan) (struct acpi_device * device);
106typedef int (*acpi_op_bind) (struct acpi_device *device); 98typedef int (*acpi_op_bind) (struct acpi_device * device);
107typedef int (*acpi_op_unbind) (struct acpi_device *device); 99typedef int (*acpi_op_unbind) (struct acpi_device * device);
108typedef int (*acpi_op_match) (struct acpi_device *device, 100typedef int (*acpi_op_match) (struct acpi_device * device,
109 struct acpi_driver *driver); 101 struct acpi_driver * driver);
110 102
111struct acpi_bus_ops { 103struct acpi_bus_ops {
112 u32 acpi_op_add:1; 104 u32 acpi_op_add:1;
113 u32 acpi_op_remove:1; 105 u32 acpi_op_remove:1;
114 u32 acpi_op_lock:1; 106 u32 acpi_op_lock:1;
115 u32 acpi_op_start:1; 107 u32 acpi_op_start:1;
116 u32 acpi_op_stop:1; 108 u32 acpi_op_stop:1;
117 u32 acpi_op_suspend:1; 109 u32 acpi_op_suspend:1;
118 u32 acpi_op_resume:1; 110 u32 acpi_op_resume:1;
119 u32 acpi_op_scan:1; 111 u32 acpi_op_scan:1;
120 u32 acpi_op_bind:1; 112 u32 acpi_op_bind:1;
121 u32 acpi_op_unbind:1; 113 u32 acpi_op_unbind:1;
122 u32 acpi_op_match:1; 114 u32 acpi_op_match:1;
123 u32 reserved:21; 115 u32 reserved:21;
124}; 116};
125 117
126struct acpi_device_ops { 118struct acpi_device_ops {
127 acpi_op_add add; 119 acpi_op_add add;
128 acpi_op_remove remove; 120 acpi_op_remove remove;
129 acpi_op_lock lock; 121 acpi_op_lock lock;
130 acpi_op_start start; 122 acpi_op_start start;
131 acpi_op_stop stop; 123 acpi_op_stop stop;
132 acpi_op_suspend suspend; 124 acpi_op_suspend suspend;
133 acpi_op_resume resume; 125 acpi_op_resume resume;
134 acpi_op_scan scan; 126 acpi_op_scan scan;
135 acpi_op_bind bind; 127 acpi_op_bind bind;
136 acpi_op_unbind unbind; 128 acpi_op_unbind unbind;
137 acpi_op_match match; 129 acpi_op_match match;
138}; 130};
139 131
140struct acpi_driver { 132struct acpi_driver {
141 struct list_head node; 133 struct list_head node;
142 char name[80]; 134 char name[80];
143 char class[80]; 135 char class[80];
144 atomic_t references; 136 atomic_t references;
145 char *ids; /* Supported Hardware IDs */ 137 char *ids; /* Supported Hardware IDs */
146 struct acpi_device_ops ops; 138 struct acpi_device_ops ops;
147}; 139};
148 140
149/* 141/*
@@ -154,60 +146,57 @@ struct acpi_driver {
154/* Status (_STA) */ 146/* Status (_STA) */
155 147
156struct acpi_device_status { 148struct acpi_device_status {
157 u32 present:1; 149 u32 present:1;
158 u32 enabled:1; 150 u32 enabled:1;
159 u32 show_in_ui:1; 151 u32 show_in_ui:1;
160 u32 functional:1; 152 u32 functional:1;
161 u32 battery_present:1; 153 u32 battery_present:1;
162 u32 reserved:27; 154 u32 reserved:27;
163}; 155};
164 156
165
166/* Flags */ 157/* Flags */
167 158
168struct acpi_device_flags { 159struct acpi_device_flags {
169 u32 dynamic_status:1; 160 u32 dynamic_status:1;
170 u32 hardware_id:1; 161 u32 hardware_id:1;
171 u32 compatible_ids:1; 162 u32 compatible_ids:1;
172 u32 bus_address:1; 163 u32 bus_address:1;
173 u32 unique_id:1; 164 u32 unique_id:1;
174 u32 removable:1; 165 u32 removable:1;
175 u32 ejectable:1; 166 u32 ejectable:1;
176 u32 lockable:1; 167 u32 lockable:1;
177 u32 suprise_removal_ok:1; 168 u32 suprise_removal_ok:1;
178 u32 power_manageable:1; 169 u32 power_manageable:1;
179 u32 performance_manageable:1; 170 u32 performance_manageable:1;
180 u32 wake_capable:1; /* Wakeup(_PRW) supported? */ 171 u32 wake_capable:1; /* Wakeup(_PRW) supported? */
181 u32 reserved:20; 172 u32 reserved:20;
182}; 173};
183 174
184
185/* File System */ 175/* File System */
186 176
187struct acpi_device_dir { 177struct acpi_device_dir {
188 struct proc_dir_entry *entry; 178 struct proc_dir_entry *entry;
189}; 179};
190 180
191#define acpi_device_dir(d) ((d)->dir.entry) 181#define acpi_device_dir(d) ((d)->dir.entry)
192 182
193
194/* Plug and Play */ 183/* Plug and Play */
195 184
196typedef char acpi_bus_id[5]; 185typedef char acpi_bus_id[5];
197typedef unsigned long acpi_bus_address; 186typedef unsigned long acpi_bus_address;
198typedef char acpi_hardware_id[9]; 187typedef char acpi_hardware_id[9];
199typedef char acpi_unique_id[9]; 188typedef char acpi_unique_id[9];
200typedef char acpi_device_name[40]; 189typedef char acpi_device_name[40];
201typedef char acpi_device_class[20]; 190typedef char acpi_device_class[20];
202 191
203struct acpi_device_pnp { 192struct acpi_device_pnp {
204 acpi_bus_id bus_id; /* Object name */ 193 acpi_bus_id bus_id; /* Object name */
205 acpi_bus_address bus_address; /* _ADR */ 194 acpi_bus_address bus_address; /* _ADR */
206 acpi_hardware_id hardware_id; /* _HID */ 195 acpi_hardware_id hardware_id; /* _HID */
207 struct acpi_compatible_id_list *cid_list; /* _CIDs */ 196 struct acpi_compatible_id_list *cid_list; /* _CIDs */
208 acpi_unique_id unique_id; /* _UID */ 197 acpi_unique_id unique_id; /* _UID */
209 acpi_device_name device_name; /* Driver-determined */ 198 acpi_device_name device_name; /* Driver-determined */
210 acpi_device_class device_class; /* " */ 199 acpi_device_class device_class; /* " */
211}; 200};
212 201
213#define acpi_device_bid(d) ((d)->pnp.bus_id) 202#define acpi_device_bid(d) ((d)->pnp.bus_id)
@@ -217,114 +206,111 @@ struct acpi_device_pnp {
217#define acpi_device_name(d) ((d)->pnp.device_name) 206#define acpi_device_name(d) ((d)->pnp.device_name)
218#define acpi_device_class(d) ((d)->pnp.device_class) 207#define acpi_device_class(d) ((d)->pnp.device_class)
219 208
220
221/* Power Management */ 209/* Power Management */
222 210
223struct acpi_device_power_flags { 211struct acpi_device_power_flags {
224 u32 explicit_get:1; /* _PSC present? */ 212 u32 explicit_get:1; /* _PSC present? */
225 u32 power_resources:1; /* Power resources */ 213 u32 power_resources:1; /* Power resources */
226 u32 inrush_current:1; /* Serialize Dx->D0 */ 214 u32 inrush_current:1; /* Serialize Dx->D0 */
227 u32 power_removed:1; /* Optimize Dx->D0 */ 215 u32 power_removed:1; /* Optimize Dx->D0 */
228 u32 reserved:28; 216 u32 reserved:28;
229}; 217};
230 218
231struct acpi_device_power_state { 219struct acpi_device_power_state {
232 struct { 220 struct {
233 u8 valid:1; 221 u8 valid:1;
234 u8 explicit_set:1; /* _PSx present? */ 222 u8 explicit_set:1; /* _PSx present? */
235 u8 reserved:6; 223 u8 reserved:6;
236 } flags; 224 } flags;
237 int power; /* % Power (compared to D0) */ 225 int power; /* % Power (compared to D0) */
238 int latency; /* Dx->D0 time (microseconds) */ 226 int latency; /* Dx->D0 time (microseconds) */
239 struct acpi_handle_list resources; /* Power resources referenced */ 227 struct acpi_handle_list resources; /* Power resources referenced */
240}; 228};
241 229
242struct acpi_device_power { 230struct acpi_device_power {
243 int state; /* Current state */ 231 int state; /* Current state */
244 struct acpi_device_power_flags flags; 232 struct acpi_device_power_flags flags;
245 struct acpi_device_power_state states[4]; /* Power states (D0-D3) */ 233 struct acpi_device_power_state states[4]; /* Power states (D0-D3) */
246}; 234};
247 235
248
249/* Performance Management */ 236/* Performance Management */
250 237
251struct acpi_device_perf_flags { 238struct acpi_device_perf_flags {
252 u8 reserved:8; 239 u8 reserved:8;
253}; 240};
254 241
255struct acpi_device_perf_state { 242struct acpi_device_perf_state {
256 struct { 243 struct {
257 u8 valid:1; 244 u8 valid:1;
258 u8 reserved:7; 245 u8 reserved:7;
259 } flags; 246 } flags;
260 u8 power; /* % Power (compared to P0) */ 247 u8 power; /* % Power (compared to P0) */
261 u8 performance; /* % Performance ( " ) */ 248 u8 performance; /* % Performance ( " ) */
262 int latency; /* Px->P0 time (microseconds) */ 249 int latency; /* Px->P0 time (microseconds) */
263}; 250};
264 251
265struct acpi_device_perf { 252struct acpi_device_perf {
266 int state; 253 int state;
267 struct acpi_device_perf_flags flags; 254 struct acpi_device_perf_flags flags;
268 int state_count; 255 int state_count;
269 struct acpi_device_perf_state *states; 256 struct acpi_device_perf_state *states;
270}; 257};
271 258
272/* Wakeup Management */ 259/* Wakeup Management */
273struct acpi_device_wakeup_flags { 260struct acpi_device_wakeup_flags {
274 u8 valid:1; /* Can successfully enable wakeup? */ 261 u8 valid:1; /* Can successfully enable wakeup? */
275 u8 run_wake:1; /* Run-Wake GPE devices */ 262 u8 run_wake:1; /* Run-Wake GPE devices */
276}; 263};
277 264
278struct acpi_device_wakeup_state { 265struct acpi_device_wakeup_state {
279 u8 enabled:1; 266 u8 enabled:1;
280 u8 active:1; 267 u8 active:1;
281}; 268};
282 269
283struct acpi_device_wakeup { 270struct acpi_device_wakeup {
284 acpi_handle gpe_device; 271 acpi_handle gpe_device;
285 acpi_integer gpe_number;; 272 acpi_integer gpe_number;;
286 acpi_integer sleep_state; 273 acpi_integer sleep_state;
287 struct acpi_handle_list resources; 274 struct acpi_handle_list resources;
288 struct acpi_device_wakeup_state state; 275 struct acpi_device_wakeup_state state;
289 struct acpi_device_wakeup_flags flags; 276 struct acpi_device_wakeup_flags flags;
290}; 277};
291 278
292/* Device */ 279/* Device */
293 280
294struct acpi_device { 281struct acpi_device {
295 acpi_handle handle; 282 acpi_handle handle;
296 struct acpi_device *parent; 283 struct acpi_device *parent;
297 struct list_head children; 284 struct list_head children;
298 struct list_head node; 285 struct list_head node;
299 struct list_head wakeup_list; 286 struct list_head wakeup_list;
300 struct list_head g_list; 287 struct list_head g_list;
301 struct acpi_device_status status; 288 struct acpi_device_status status;
302 struct acpi_device_flags flags; 289 struct acpi_device_flags flags;
303 struct acpi_device_pnp pnp; 290 struct acpi_device_pnp pnp;
304 struct acpi_device_power power; 291 struct acpi_device_power power;
305 struct acpi_device_wakeup wakeup; 292 struct acpi_device_wakeup wakeup;
306 struct acpi_device_perf performance; 293 struct acpi_device_perf performance;
307 struct acpi_device_dir dir; 294 struct acpi_device_dir dir;
308 struct acpi_device_ops ops; 295 struct acpi_device_ops ops;
309 struct acpi_driver *driver; 296 struct acpi_driver *driver;
310 void *driver_data; 297 void *driver_data;
311 struct kobject kobj; 298 struct kobject kobj;
312}; 299};
313 300
314#define acpi_driver_data(d) ((d)->driver_data) 301#define acpi_driver_data(d) ((d)->driver_data)
315 302
316
317/* 303/*
318 * Events 304 * Events
319 * ------ 305 * ------
320 */ 306 */
321 307
322struct acpi_bus_event { 308struct acpi_bus_event {
323 struct list_head node; 309 struct list_head node;
324 acpi_device_class device_class; 310 acpi_device_class device_class;
325 acpi_bus_id bus_id; 311 acpi_bus_id bus_id;
326 u32 type; 312 u32 type;
327 u32 data; 313 u32 data;
328}; 314};
329 315
330extern struct subsystem acpi_subsys; 316extern struct subsystem acpi_subsys;
@@ -335,34 +321,32 @@ extern struct subsystem acpi_subsys;
335 321
336int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device); 322int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device);
337void acpi_bus_data_handler(acpi_handle handle, u32 function, void *context); 323void acpi_bus_data_handler(acpi_handle handle, u32 function, void *context);
338int acpi_bus_get_status (struct acpi_device *device); 324int acpi_bus_get_status(struct acpi_device *device);
339int acpi_bus_get_power (acpi_handle handle, int *state); 325int acpi_bus_get_power(acpi_handle handle, int *state);
340int acpi_bus_set_power (acpi_handle handle, int state); 326int acpi_bus_set_power(acpi_handle handle, int state);
341int acpi_bus_generate_event (struct acpi_device *device, u8 type, int data); 327int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data);
342int acpi_bus_receive_event (struct acpi_bus_event *event); 328int acpi_bus_receive_event(struct acpi_bus_event *event);
343int acpi_bus_register_driver (struct acpi_driver *driver); 329int acpi_bus_register_driver(struct acpi_driver *driver);
344int acpi_bus_unregister_driver (struct acpi_driver *driver); 330int acpi_bus_unregister_driver(struct acpi_driver *driver);
345int acpi_bus_add (struct acpi_device **child, struct acpi_device *parent, 331int acpi_bus_add(struct acpi_device **child, struct acpi_device *parent,
346 acpi_handle handle, int type); 332 acpi_handle handle, int type);
347int acpi_bus_start (struct acpi_device *device); 333int acpi_bus_start(struct acpi_device *device);
348 334
349 335int acpi_match_ids(struct acpi_device *device, char *ids);
350int acpi_match_ids (struct acpi_device *device, char *ids);
351int acpi_create_dir(struct acpi_device *); 336int acpi_create_dir(struct acpi_device *);
352void acpi_remove_dir(struct acpi_device *); 337void acpi_remove_dir(struct acpi_device *);
353 338
354
355/* 339/*
356 * Bind physical devices with ACPI devices 340 * Bind physical devices with ACPI devices
357 */ 341 */
358#include <linux/device.h> 342#include <linux/device.h>
359struct acpi_bus_type { 343struct acpi_bus_type {
360 struct list_head list; 344 struct list_head list;
361 struct bus_type *bus; 345 struct bus_type *bus;
362 /* For general devices under the bus*/ 346 /* For general devices under the bus */
363 int (*find_device)(struct device *, acpi_handle*); 347 int (*find_device) (struct device *, acpi_handle *);
364 /* For bridges, such as PCI root bridge, IDE controller */ 348 /* For bridges, such as PCI root bridge, IDE controller */
365 int (*find_bridge)(struct device *, acpi_handle *); 349 int (*find_bridge) (struct device *, acpi_handle *);
366}; 350};
367int register_acpi_bus_type(struct acpi_bus_type *); 351int register_acpi_bus_type(struct acpi_bus_type *);
368int unregister_acpi_bus_type(struct acpi_bus_type *); 352int unregister_acpi_bus_type(struct acpi_bus_type *);
@@ -372,6 +356,6 @@ acpi_handle acpi_get_child(acpi_handle, acpi_integer);
372acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int); 356acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int);
373#define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->firmware_data)) 357#define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->firmware_data))
374 358
375#endif /*CONFIG_ACPI_BUS*/ 359#endif /* CONFIG_ACPI */
376 360
377#endif /*__ACPI_BUS_H__*/ 361#endif /*__ACPI_BUS_H__*/
diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h
index 579fe191b7e7..c1b4e1f882e4 100644
--- a/include/acpi/acpi_drivers.h
+++ b/include/acpi/acpi_drivers.h
@@ -29,7 +29,6 @@
29#include <linux/acpi.h> 29#include <linux/acpi.h>
30#include <acpi/acpi_bus.h> 30#include <acpi/acpi_bus.h>
31 31
32
33#define ACPI_MAX_STRING 80 32#define ACPI_MAX_STRING 80
34 33
35#define ACPI_BUS_COMPONENT 0x00010000 34#define ACPI_BUS_COMPONENT 0x00010000
@@ -44,60 +43,55 @@
44#define ACPI_BUTTON_HID_POWERF "ACPI_FPB" 43#define ACPI_BUTTON_HID_POWERF "ACPI_FPB"
45#define ACPI_BUTTON_HID_SLEEPF "ACPI_FSB" 44#define ACPI_BUTTON_HID_SLEEPF "ACPI_FSB"
46 45
47
48/* -------------------------------------------------------------------------- 46/* --------------------------------------------------------------------------
49 PCI 47 PCI
50 -------------------------------------------------------------------------- */ 48 -------------------------------------------------------------------------- */
51 49
52#ifdef CONFIG_ACPI_PCI
53
54#define ACPI_PCI_COMPONENT 0x00400000 50#define ACPI_PCI_COMPONENT 0x00400000
55 51
56/* ACPI PCI Interrupt Link (pci_link.c) */ 52/* ACPI PCI Interrupt Link (pci_link.c) */
57 53
58int acpi_irq_penalty_init (void); 54int acpi_irq_penalty_init(void);
59int acpi_pci_link_allocate_irq (acpi_handle handle, int index, int *edge_level, 55int acpi_pci_link_allocate_irq(acpi_handle handle, int index, int *edge_level,
60 int *active_high_low, char **name); 56 int *active_high_low, char **name);
61int acpi_pci_link_free_irq(acpi_handle handle); 57int acpi_pci_link_free_irq(acpi_handle handle);
62 58
63/* ACPI PCI Interrupt Routing (pci_irq.c) */ 59/* ACPI PCI Interrupt Routing (pci_irq.c) */
64 60
65int acpi_pci_irq_add_prt (acpi_handle handle, int segment, int bus); 61int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus);
66void acpi_pci_irq_del_prt (int segment, int bus); 62void acpi_pci_irq_del_prt(int segment, int bus);
67 63
68/* ACPI PCI Device Binding (pci_bind.c) */ 64/* ACPI PCI Device Binding (pci_bind.c) */
69 65
70struct pci_bus; 66struct pci_bus;
71 67
72acpi_status acpi_get_pci_id (acpi_handle handle, struct acpi_pci_id *id); 68acpi_status acpi_get_pci_id(acpi_handle handle, struct acpi_pci_id *id);
73int acpi_pci_bind (struct acpi_device *device); 69int acpi_pci_bind(struct acpi_device *device);
74int acpi_pci_unbind (struct acpi_device *device); 70int acpi_pci_unbind(struct acpi_device *device);
75int acpi_pci_bind_root (struct acpi_device *device, struct acpi_pci_id *id, struct pci_bus *bus); 71int acpi_pci_bind_root(struct acpi_device *device, struct acpi_pci_id *id,
72 struct pci_bus *bus);
76 73
77/* Arch-defined function to add a bus to the system */ 74/* Arch-defined function to add a bus to the system */
78 75
79struct pci_bus *pci_acpi_scan_root(struct acpi_device *device, int domain, int bus); 76struct pci_bus *pci_acpi_scan_root(struct acpi_device *device, int domain,
80 77 int bus);
81#endif /*CONFIG_ACPI_PCI*/
82
83 78
84/* -------------------------------------------------------------------------- 79/* --------------------------------------------------------------------------
85 Power Resource 80 Power Resource
86 -------------------------------------------------------------------------- */ 81 -------------------------------------------------------------------------- */
87 82
88#ifdef CONFIG_ACPI_POWER 83#ifdef CONFIG_ACPI_POWER
89int acpi_enable_wakeup_device_power (struct acpi_device *dev); 84int acpi_enable_wakeup_device_power(struct acpi_device *dev);
90int acpi_disable_wakeup_device_power (struct acpi_device *dev); 85int acpi_disable_wakeup_device_power(struct acpi_device *dev);
91int acpi_power_get_inferred_state (struct acpi_device *device); 86int acpi_power_get_inferred_state(struct acpi_device *device);
92int acpi_power_transition (struct acpi_device *device, int state); 87int acpi_power_transition(struct acpi_device *device, int state);
93#endif 88#endif
94 89
95
96/* -------------------------------------------------------------------------- 90/* --------------------------------------------------------------------------
97 Embedded Controller 91 Embedded Controller
98 -------------------------------------------------------------------------- */ 92 -------------------------------------------------------------------------- */
99#ifdef CONFIG_ACPI_EC 93#ifdef CONFIG_ACPI_EC
100int acpi_ec_ecdt_probe (void); 94int acpi_ec_ecdt_probe(void);
101#endif 95#endif
102 96
103/* -------------------------------------------------------------------------- 97/* --------------------------------------------------------------------------
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index ea489f235216..98e0b8cd14ed 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -7,7 +7,6 @@
7 * 7 *
8 *****************************************************************************/ 8 *****************************************************************************/
9 9
10
11/* 10/*
12 * Copyright (C) 2000 - 2005, R. Byron Moore 11 * Copyright (C) 2000 - 2005, R. Byron Moore
13 * All rights reserved. 12 * All rights reserved.
@@ -51,7 +50,6 @@
51#include "platform/acenv.h" 50#include "platform/acenv.h"
52#include "actypes.h" 51#include "actypes.h"
53 52
54
55/* Priorities for acpi_os_queue_for_execution */ 53/* Priorities for acpi_os_queue_for_execution */
56 54
57#define OSD_PRIORITY_GPE 1 55#define OSD_PRIORITY_GPE 1
@@ -62,200 +60,136 @@
62#define ACPI_NO_UNIT_LIMIT ((u32) -1) 60#define ACPI_NO_UNIT_LIMIT ((u32) -1)
63#define ACPI_MUTEX_SEM 1 61#define ACPI_MUTEX_SEM 1
64 62
65
66/* Functions for acpi_os_signal */ 63/* Functions for acpi_os_signal */
67 64
68#define ACPI_SIGNAL_FATAL 0 65#define ACPI_SIGNAL_FATAL 0
69#define ACPI_SIGNAL_BREAKPOINT 1 66#define ACPI_SIGNAL_BREAKPOINT 1
70 67
71struct acpi_signal_fatal_info 68struct acpi_signal_fatal_info {
72{ 69 u32 type;
73 u32 type; 70 u32 code;
74 u32 code; 71 u32 argument;
75 u32 argument;
76}; 72};
77 73
78
79/* 74/*
80 * OSL Initialization and shutdown primitives 75 * OSL Initialization and shutdown primitives
81 */ 76 */
82acpi_status 77acpi_status acpi_os_initialize(void);
83acpi_os_initialize (
84 void);
85
86acpi_status
87acpi_os_terminate (
88 void);
89 78
79acpi_status acpi_os_terminate(void);
90 80
91/* 81/*
92 * ACPI Table interfaces 82 * ACPI Table interfaces
93 */ 83 */
94acpi_status 84acpi_status acpi_os_get_root_pointer(u32 flags, struct acpi_pointer *address);
95acpi_os_get_root_pointer (
96 u32 flags,
97 struct acpi_pointer *address);
98 85
99acpi_status 86acpi_status
100acpi_os_predefined_override ( 87acpi_os_predefined_override(const struct acpi_predefined_names *init_val,
101 const struct acpi_predefined_names *init_val, 88 acpi_string * new_val);
102 acpi_string *new_val);
103 89
104acpi_status 90acpi_status
105acpi_os_table_override ( 91acpi_os_table_override(struct acpi_table_header *existing_table,
106 struct acpi_table_header *existing_table, 92 struct acpi_table_header **new_table);
107 struct acpi_table_header **new_table);
108
109 93
110/* 94/*
111 * Synchronization primitives 95 * Synchronization primitives
112 */ 96 */
113acpi_status 97acpi_status
114acpi_os_create_semaphore ( 98acpi_os_create_semaphore(u32 max_units,
115 u32 max_units, 99 u32 initial_units, acpi_handle * out_handle);
116 u32 initial_units,
117 acpi_handle *out_handle);
118
119acpi_status
120acpi_os_delete_semaphore (
121 acpi_handle handle);
122 100
123acpi_status 101acpi_status acpi_os_delete_semaphore(acpi_handle handle);
124acpi_os_wait_semaphore (
125 acpi_handle handle,
126 u32 units,
127 u16 timeout);
128 102
129acpi_status 103acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout);
130acpi_os_signal_semaphore (
131 acpi_handle handle,
132 u32 units);
133 104
134acpi_status 105acpi_status acpi_os_signal_semaphore(acpi_handle handle, u32 units);
135acpi_os_create_lock (
136 acpi_handle *out_handle);
137 106
138void 107acpi_status acpi_os_create_lock(acpi_handle * out_handle);
139acpi_os_delete_lock (
140 acpi_handle handle);
141 108
142void 109void acpi_os_delete_lock(acpi_handle handle);
143acpi_os_acquire_lock (
144 acpi_handle handle,
145 u32 flags);
146 110
147void 111unsigned long acpi_os_acquire_lock(acpi_handle handle);
148acpi_os_release_lock (
149 acpi_handle handle,
150 u32 flags);
151 112
113void acpi_os_release_lock(acpi_handle handle, unsigned long flags);
152 114
153/* 115/*
154 * Memory allocation and mapping 116 * Memory allocation and mapping
155 */ 117 */
156void * 118void *acpi_os_allocate(acpi_size size);
157acpi_os_allocate (
158 acpi_size size);
159 119
160void 120void acpi_os_free(void *memory);
161acpi_os_free (
162 void * memory);
163 121
164acpi_status 122acpi_status
165acpi_os_map_memory ( 123acpi_os_map_memory(acpi_physical_address physical_address,
166 acpi_physical_address physical_address, 124 acpi_size size, void __iomem ** logical_address);
167 acpi_size size,
168 void __iomem **logical_address);
169 125
170void 126void acpi_os_unmap_memory(void __iomem * logical_address, acpi_size size);
171acpi_os_unmap_memory (
172 void __iomem *logical_address,
173 acpi_size size);
174 127
175#ifdef ACPI_FUTURE_USAGE 128#ifdef ACPI_FUTURE_USAGE
176acpi_status 129acpi_status
177acpi_os_get_physical_address ( 130acpi_os_get_physical_address(void *logical_address,
178 void *logical_address, 131 acpi_physical_address * physical_address);
179 acpi_physical_address *physical_address);
180#endif 132#endif
181 133
134/*
135 * Memory/Object Cache
136 */
137acpi_status
138acpi_os_create_cache(char *cache_name,
139 u16 object_size,
140 u16 max_depth, acpi_cache_t ** return_cache);
141
142acpi_status acpi_os_delete_cache(acpi_cache_t * cache);
143
144acpi_status acpi_os_purge_cache(acpi_cache_t * cache);
145
146void *acpi_os_acquire_object(acpi_cache_t * cache);
147
148acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object);
182 149
183/* 150/*
184 * Interrupt handlers 151 * Interrupt handlers
185 */ 152 */
186acpi_status 153acpi_status
187acpi_os_install_interrupt_handler ( 154acpi_os_install_interrupt_handler(u32 gsi,
188 u32 gsi, 155 acpi_osd_handler service_routine,
189 acpi_osd_handler service_routine, 156 void *context);
190 void *context);
191 157
192acpi_status 158acpi_status
193acpi_os_remove_interrupt_handler ( 159acpi_os_remove_interrupt_handler(u32 gsi, acpi_osd_handler service_routine);
194 u32 gsi,
195 acpi_osd_handler service_routine);
196
197 160
198/* 161/*
199 * Threads and Scheduling 162 * Threads and Scheduling
200 */ 163 */
201u32 164u32 acpi_os_get_thread_id(void);
202acpi_os_get_thread_id (
203 void);
204 165
205acpi_status 166acpi_status
206acpi_os_queue_for_execution ( 167acpi_os_queue_for_execution(u32 priority,
207 u32 priority, 168 acpi_osd_exec_callback function, void *context);
208 acpi_osd_exec_callback function,
209 void *context);
210 169
211void 170void acpi_os_wait_events_complete(void *context);
212acpi_os_wait_events_complete(
213 void * context);
214 171
215void 172void acpi_os_wait_events_complete(void *context);
216acpi_os_wait_events_complete (
217 void *context);
218 173
219void 174void acpi_os_sleep(acpi_integer milliseconds);
220acpi_os_sleep (
221 acpi_integer milliseconds);
222
223void
224acpi_os_stall (
225 u32 microseconds);
226 175
176void acpi_os_stall(u32 microseconds);
227 177
228/* 178/*
229 * Platform and hardware-independent I/O interfaces 179 * Platform and hardware-independent I/O interfaces
230 */ 180 */
231acpi_status 181acpi_status acpi_os_read_port(acpi_io_address address, u32 * value, u32 width);
232acpi_os_read_port (
233 acpi_io_address address,
234 u32 *value,
235 u32 width);
236
237acpi_status
238acpi_os_write_port (
239 acpi_io_address address,
240 u32 value,
241 u32 width);
242 182
183acpi_status acpi_os_write_port(acpi_io_address address, u32 value, u32 width);
243 184
244/* 185/*
245 * Platform and hardware-independent physical memory interfaces 186 * Platform and hardware-independent physical memory interfaces
246 */ 187 */
247acpi_status 188acpi_status
248acpi_os_read_memory ( 189acpi_os_read_memory(acpi_physical_address address, u32 * value, u32 width);
249 acpi_physical_address address,
250 u32 *value,
251 u32 width);
252 190
253acpi_status 191acpi_status
254acpi_os_write_memory ( 192acpi_os_write_memory(acpi_physical_address address, u32 value, u32 width);
255 acpi_physical_address address,
256 u32 value,
257 u32 width);
258
259 193
260/* 194/*
261 * Platform and hardware-independent PCI configuration space access 195 * Platform and hardware-independent PCI configuration space access
@@ -263,111 +197,69 @@ acpi_os_write_memory (
263 * certain compilers complain. 197 * certain compilers complain.
264 */ 198 */
265acpi_status 199acpi_status
266acpi_os_read_pci_configuration ( 200acpi_os_read_pci_configuration(struct acpi_pci_id *pci_id,
267 struct acpi_pci_id *pci_id, 201 u32 reg, void *value, u32 width);
268 u32 reg,
269 void *value,
270 u32 width);
271 202
272acpi_status 203acpi_status
273acpi_os_write_pci_configuration ( 204acpi_os_write_pci_configuration(struct acpi_pci_id *pci_id,
274 struct acpi_pci_id *pci_id, 205 u32 reg, acpi_integer value, u32 width);
275 u32 reg,
276 acpi_integer value,
277 u32 width);
278 206
279/* 207/*
280 * Interim function needed for PCI IRQ routing 208 * Interim function needed for PCI IRQ routing
281 */ 209 */
282void 210void
283acpi_os_derive_pci_id( 211acpi_os_derive_pci_id(acpi_handle rhandle,
284 acpi_handle rhandle, 212 acpi_handle chandle, struct acpi_pci_id **pci_id);
285 acpi_handle chandle,
286 struct acpi_pci_id **pci_id);
287 213
288/* 214/*
289 * Miscellaneous 215 * Miscellaneous
290 */ 216 */
291u8 217u8 acpi_os_readable(void *pointer, acpi_size length);
292acpi_os_readable (
293 void *pointer,
294 acpi_size length);
295 218
296#ifdef ACPI_FUTURE_USAGE 219#ifdef ACPI_FUTURE_USAGE
297u8 220u8 acpi_os_writable(void *pointer, acpi_size length);
298acpi_os_writable (
299 void *pointer,
300 acpi_size length);
301#endif 221#endif
302 222
303u64 223u64 acpi_os_get_timer(void);
304acpi_os_get_timer (
305 void);
306 224
307acpi_status 225acpi_status acpi_os_signal(u32 function, void *info);
308acpi_os_signal (
309 u32 function,
310 void *info);
311 226
312/* 227/*
313 * Debug print routines 228 * Debug print routines
314 */ 229 */
315void ACPI_INTERNAL_VAR_XFACE 230void ACPI_INTERNAL_VAR_XFACE acpi_os_printf(const char *format, ...);
316acpi_os_printf (
317 const char *format,
318 ...);
319
320void
321acpi_os_vprintf (
322 const char *format,
323 va_list args);
324 231
325void 232void acpi_os_vprintf(const char *format, va_list args);
326acpi_os_redirect_output (
327 void *destination);
328 233
234void acpi_os_redirect_output(void *destination);
329 235
330#ifdef ACPI_FUTURE_USAGE 236#ifdef ACPI_FUTURE_USAGE
331/* 237/*
332 * Debug input 238 * Debug input
333 */ 239 */
334u32 240u32 acpi_os_get_line(char *buffer);
335acpi_os_get_line (
336 char *buffer);
337#endif 241#endif
338 242
339
340/* 243/*
341 * Directory manipulation 244 * Directory manipulation
342 */ 245 */
343void * 246void *acpi_os_open_directory(char *pathname,
344acpi_os_open_directory ( 247 char *wildcard_spec, char requested_file_type);
345 char *pathname,
346 char *wildcard_spec,
347 char requested_file_type);
348 248
349/* requeste_file_type values */ 249/* requeste_file_type values */
350 250
351#define REQUEST_FILE_ONLY 0 251#define REQUEST_FILE_ONLY 0
352#define REQUEST_DIR_ONLY 1 252#define REQUEST_DIR_ONLY 1
353 253
254char *acpi_os_get_next_filename(void *dir_handle);
354 255
355char * 256void acpi_os_close_directory(void *dir_handle);
356acpi_os_get_next_filename (
357 void *dir_handle);
358
359void
360acpi_os_close_directory (
361 void *dir_handle);
362 257
363/* 258/*
364 * Debug 259 * Debug
365 */ 260 */
366void 261void
367acpi_os_dbg_assert( 262acpi_os_dbg_assert(void *failed_assertion,
368 void *failed_assertion, 263 void *file_name, u32 line_number, char *message);
369 void *file_name,
370 u32 line_number,
371 char *message);
372 264
373#endif /* __ACPIOSXF_H__ */ 265#endif /* __ACPIOSXF_H__ */
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index f8f619f8e4f8..2a9dbc13b0f2 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -42,447 +42,283 @@
42 * POSSIBILITY OF SUCH DAMAGES. 42 * POSSIBILITY OF SUCH DAMAGES.
43 */ 43 */
44 44
45
46#ifndef __ACXFACE_H__ 45#ifndef __ACXFACE_H__
47#define __ACXFACE_H__ 46#define __ACXFACE_H__
48 47
49#include "actypes.h" 48#include "actypes.h"
50#include "actbl.h" 49#include "actbl.h"
51 50
52
53/* 51/*
54 * Global interfaces 52 * Global interfaces
55 */ 53 */
56acpi_status 54acpi_status acpi_initialize_subsystem(void);
57acpi_initialize_subsystem (
58 void);
59 55
60acpi_status 56acpi_status acpi_enable_subsystem(u32 flags);
61acpi_enable_subsystem (
62 u32 flags);
63 57
64acpi_status 58acpi_status acpi_initialize_objects(u32 flags);
65acpi_initialize_objects (
66 u32 flags);
67 59
68acpi_status 60acpi_status acpi_terminate(void);
69acpi_terminate (
70 void);
71 61
72#ifdef ACPI_FUTURE_USAGE 62#ifdef ACPI_FUTURE_USAGE
73acpi_status 63acpi_status acpi_subsystem_status(void);
74acpi_subsystem_status (
75 void);
76#endif 64#endif
77 65
78acpi_status 66acpi_status acpi_enable(void);
79acpi_enable (
80 void);
81 67
82acpi_status 68acpi_status acpi_disable(void);
83acpi_disable (
84 void);
85 69
86#ifdef ACPI_FUTURE_USAGE 70#ifdef ACPI_FUTURE_USAGE
87acpi_status 71acpi_status acpi_get_system_info(struct acpi_buffer *ret_buffer);
88acpi_get_system_info (
89 struct acpi_buffer *ret_buffer);
90#endif 72#endif
91 73
92const char * 74const char *acpi_format_exception(acpi_status exception);
93acpi_format_exception (
94 acpi_status exception);
95 75
96acpi_status 76acpi_status acpi_purge_cached_objects(void);
97acpi_purge_cached_objects (
98 void);
99 77
100#ifdef ACPI_FUTURE_USAGE 78#ifdef ACPI_FUTURE_USAGE
101acpi_status 79acpi_status
102acpi_install_initialization_handler ( 80acpi_install_initialization_handler(acpi_init_handler handler, u32 function);
103 acpi_init_handler handler,
104 u32 function);
105#endif 81#endif
106 82
107/* 83/*
108 * ACPI Memory managment 84 * ACPI Memory managment
109 */ 85 */
110void * 86void *acpi_allocate(u32 size);
111acpi_allocate (
112 u32 size);
113
114void *
115acpi_callocate (
116 u32 size);
117 87
118void 88void *acpi_callocate(u32 size);
119acpi_free (
120 void *address);
121 89
90void acpi_free(void *address);
122 91
123/* 92/*
124 * ACPI table manipulation interfaces 93 * ACPI table manipulation interfaces
125 */ 94 */
126acpi_status 95acpi_status
127acpi_find_root_pointer ( 96acpi_find_root_pointer(u32 flags, struct acpi_pointer *rsdp_address);
128 u32 flags,
129 struct acpi_pointer *rsdp_address);
130 97
131acpi_status 98acpi_status acpi_load_tables(void);
132acpi_load_tables (
133 void);
134 99
135#ifdef ACPI_FUTURE_USAGE 100#ifdef ACPI_FUTURE_USAGE
136acpi_status 101acpi_status acpi_load_table(struct acpi_table_header *table_ptr);
137acpi_load_table (
138 struct acpi_table_header *table_ptr);
139 102
140acpi_status 103acpi_status acpi_unload_table(acpi_table_type table_type);
141acpi_unload_table (
142 acpi_table_type table_type);
143 104
144acpi_status 105acpi_status
145acpi_get_table_header ( 106acpi_get_table_header(acpi_table_type table_type,
146 acpi_table_type table_type, 107 u32 instance, struct acpi_table_header *out_table_header);
147 u32 instance, 108#endif /* ACPI_FUTURE_USAGE */
148 struct acpi_table_header *out_table_header);
149#endif /* ACPI_FUTURE_USAGE */
150 109
151acpi_status 110acpi_status
152acpi_get_table ( 111acpi_get_table(acpi_table_type table_type,
153 acpi_table_type table_type, 112 u32 instance, struct acpi_buffer *ret_buffer);
154 u32 instance,
155 struct acpi_buffer *ret_buffer);
156 113
157acpi_status 114acpi_status
158acpi_get_firmware_table ( 115acpi_get_firmware_table(acpi_string signature,
159 acpi_string signature, 116 u32 instance,
160 u32 instance, 117 u32 flags, struct acpi_table_header **table_pointer);
161 u32 flags,
162 struct acpi_table_header **table_pointer);
163
164 118
165/* 119/*
166 * Namespace and name interfaces 120 * Namespace and name interfaces
167 */ 121 */
168acpi_status 122acpi_status
169acpi_walk_namespace ( 123acpi_walk_namespace(acpi_object_type type,
170 acpi_object_type type, 124 acpi_handle start_object,
171 acpi_handle start_object, 125 u32 max_depth,
172 u32 max_depth, 126 acpi_walk_callback user_function,
173 acpi_walk_callback user_function, 127 void *context, void **return_value);
174 void *context,
175 void **return_value);
176 128
177acpi_status 129acpi_status
178acpi_get_devices ( 130acpi_get_devices(char *HID,
179 char *HID, 131 acpi_walk_callback user_function,
180 acpi_walk_callback user_function, 132 void *context, void **return_value);
181 void *context,
182 void **return_value);
183 133
184acpi_status 134acpi_status
185acpi_get_name ( 135acpi_get_name(acpi_handle handle,
186 acpi_handle handle, 136 u32 name_type, struct acpi_buffer *ret_path_ptr);
187 u32 name_type,
188 struct acpi_buffer *ret_path_ptr);
189 137
190acpi_status 138acpi_status
191acpi_get_handle ( 139acpi_get_handle(acpi_handle parent,
192 acpi_handle parent, 140 acpi_string pathname, acpi_handle * ret_handle);
193 acpi_string pathname,
194 acpi_handle *ret_handle);
195 141
196acpi_status 142acpi_status
197acpi_attach_data ( 143acpi_attach_data(acpi_handle obj_handle,
198 acpi_handle obj_handle, 144 acpi_object_handler handler, void *data);
199 acpi_object_handler handler,
200 void *data);
201 145
202acpi_status 146acpi_status
203acpi_detach_data ( 147acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler);
204 acpi_handle obj_handle,
205 acpi_object_handler handler);
206 148
207acpi_status 149acpi_status
208acpi_get_data ( 150acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data);
209 acpi_handle obj_handle,
210 acpi_object_handler handler,
211 void **data);
212
213 151
214/* 152/*
215 * Object manipulation and enumeration 153 * Object manipulation and enumeration
216 */ 154 */
217acpi_status 155acpi_status
218acpi_evaluate_object ( 156acpi_evaluate_object(acpi_handle object,
219 acpi_handle object, 157 acpi_string pathname,
220 acpi_string pathname, 158 struct acpi_object_list *parameter_objects,
221 struct acpi_object_list *parameter_objects, 159 struct acpi_buffer *return_object_buffer);
222 struct acpi_buffer *return_object_buffer);
223 160
224#ifdef ACPI_FUTURE_USAGE 161#ifdef ACPI_FUTURE_USAGE
225acpi_status 162acpi_status
226acpi_evaluate_object_typed ( 163acpi_evaluate_object_typed(acpi_handle object,
227 acpi_handle object, 164 acpi_string pathname,
228 acpi_string pathname, 165 struct acpi_object_list *external_params,
229 struct acpi_object_list *external_params, 166 struct acpi_buffer *return_buffer,
230 struct acpi_buffer *return_buffer, 167 acpi_object_type return_type);
231 acpi_object_type return_type);
232#endif 168#endif
233 169
234acpi_status 170acpi_status
235acpi_get_object_info ( 171acpi_get_object_info(acpi_handle handle, struct acpi_buffer *return_buffer);
236 acpi_handle handle,
237 struct acpi_buffer *return_buffer);
238 172
239acpi_status 173acpi_status
240acpi_get_next_object ( 174acpi_get_next_object(acpi_object_type type,
241 acpi_object_type type, 175 acpi_handle parent,
242 acpi_handle parent, 176 acpi_handle child, acpi_handle * out_handle);
243 acpi_handle child,
244 acpi_handle *out_handle);
245 177
246acpi_status 178acpi_status acpi_get_type(acpi_handle object, acpi_object_type * out_type);
247acpi_get_type (
248 acpi_handle object,
249 acpi_object_type *out_type);
250
251acpi_status
252acpi_get_parent (
253 acpi_handle object,
254 acpi_handle *out_handle);
255 179
180acpi_status acpi_get_parent(acpi_handle object, acpi_handle * out_handle);
256 181
257/* 182/*
258 * Event handler interfaces 183 * Event handler interfaces
259 */ 184 */
260acpi_status 185acpi_status
261acpi_install_fixed_event_handler ( 186acpi_install_fixed_event_handler(u32 acpi_event,
262 u32 acpi_event, 187 acpi_event_handler handler, void *context);
263 acpi_event_handler handler,
264 void *context);
265 188
266acpi_status 189acpi_status
267acpi_remove_fixed_event_handler ( 190acpi_remove_fixed_event_handler(u32 acpi_event, acpi_event_handler handler);
268 u32 acpi_event,
269 acpi_event_handler handler);
270 191
271acpi_status 192acpi_status
272acpi_install_notify_handler ( 193acpi_install_notify_handler(acpi_handle device,
273 acpi_handle device, 194 u32 handler_type,
274 u32 handler_type, 195 acpi_notify_handler handler, void *context);
275 acpi_notify_handler handler,
276 void *context);
277 196
278acpi_status 197acpi_status
279acpi_remove_notify_handler ( 198acpi_remove_notify_handler(acpi_handle device,
280 acpi_handle device, 199 u32 handler_type, acpi_notify_handler handler);
281 u32 handler_type,
282 acpi_notify_handler handler);
283 200
284acpi_status 201acpi_status
285acpi_install_address_space_handler ( 202acpi_install_address_space_handler(acpi_handle device,
286 acpi_handle device, 203 acpi_adr_space_type space_id,
287 acpi_adr_space_type space_id, 204 acpi_adr_space_handler handler,
288 acpi_adr_space_handler handler, 205 acpi_adr_space_setup setup, void *context);
289 acpi_adr_space_setup setup,
290 void *context);
291 206
292acpi_status 207acpi_status
293acpi_remove_address_space_handler ( 208acpi_remove_address_space_handler(acpi_handle device,
294 acpi_handle device, 209 acpi_adr_space_type space_id,
295 acpi_adr_space_type space_id, 210 acpi_adr_space_handler handler);
296 acpi_adr_space_handler handler);
297 211
298acpi_status 212acpi_status
299acpi_install_gpe_handler ( 213acpi_install_gpe_handler(acpi_handle gpe_device,
300 acpi_handle gpe_device, 214 u32 gpe_number,
301 u32 gpe_number, 215 u32 type, acpi_event_handler address, void *context);
302 u32 type,
303 acpi_event_handler address,
304 void *context);
305 216
306#ifdef ACPI_FUTURE_USAGE 217#ifdef ACPI_FUTURE_USAGE
307acpi_status 218acpi_status acpi_install_exception_handler(acpi_exception_handler handler);
308acpi_install_exception_handler (
309 acpi_exception_handler handler);
310#endif 219#endif
311 220
312
313/* 221/*
314 * Event interfaces 222 * Event interfaces
315 */ 223 */
316acpi_status 224acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle);
317acpi_acquire_global_lock (
318 u16 timeout,
319 u32 *handle);
320 225
321acpi_status 226acpi_status acpi_release_global_lock(u32 handle);
322acpi_release_global_lock (
323 u32 handle);
324 227
325acpi_status 228acpi_status
326acpi_remove_gpe_handler ( 229acpi_remove_gpe_handler(acpi_handle gpe_device,
327 acpi_handle gpe_device, 230 u32 gpe_number, acpi_event_handler address);
328 u32 gpe_number,
329 acpi_event_handler address);
330 231
331acpi_status 232acpi_status acpi_enable_event(u32 event, u32 flags);
332acpi_enable_event (
333 u32 event,
334 u32 flags);
335 233
336acpi_status 234acpi_status acpi_disable_event(u32 event, u32 flags);
337acpi_disable_event (
338 u32 event,
339 u32 flags);
340 235
341acpi_status 236acpi_status acpi_clear_event(u32 event);
342acpi_clear_event (
343 u32 event);
344 237
345#ifdef ACPI_FUTURE_USAGE 238#ifdef ACPI_FUTURE_USAGE
346acpi_status 239acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status);
347acpi_get_event_status ( 240#endif /* ACPI_FUTURE_USAGE */
348 u32 event,
349 acpi_event_status *event_status);
350#endif /* ACPI_FUTURE_USAGE */
351 241
352acpi_status 242acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type);
353acpi_set_gpe_type (
354 acpi_handle gpe_device,
355 u32 gpe_number,
356 u8 type);
357 243
358acpi_status 244acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags);
359acpi_enable_gpe (
360 acpi_handle gpe_device,
361 u32 gpe_number,
362 u32 flags);
363 245
364acpi_status 246acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags);
365acpi_disable_gpe (
366 acpi_handle gpe_device,
367 u32 gpe_number,
368 u32 flags);
369 247
370acpi_status 248acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags);
371acpi_clear_gpe (
372 acpi_handle gpe_device,
373 u32 gpe_number,
374 u32 flags);
375 249
376#ifdef ACPI_FUTURE_USAGE 250#ifdef ACPI_FUTURE_USAGE
377acpi_status 251acpi_status
378acpi_get_gpe_status ( 252acpi_get_gpe_status(acpi_handle gpe_device,
379 acpi_handle gpe_device, 253 u32 gpe_number,
380 u32 gpe_number, 254 u32 flags, acpi_event_status * event_status);
381 u32 flags, 255#endif /* ACPI_FUTURE_USAGE */
382 acpi_event_status *event_status);
383#endif /* ACPI_FUTURE_USAGE */
384 256
385acpi_status 257acpi_status
386acpi_install_gpe_block ( 258acpi_install_gpe_block(acpi_handle gpe_device,
387 acpi_handle gpe_device, 259 struct acpi_generic_address *gpe_block_address,
388 struct acpi_generic_address *gpe_block_address, 260 u32 register_count, u32 interrupt_number);
389 u32 register_count,
390 u32 interrupt_level);
391
392acpi_status
393acpi_remove_gpe_block (
394 acpi_handle gpe_device);
395 261
262acpi_status acpi_remove_gpe_block(acpi_handle gpe_device);
396 263
397/* 264/*
398 * Resource interfaces 265 * Resource interfaces
399 */ 266 */
400typedef 267typedef
401acpi_status (*ACPI_WALK_RESOURCE_CALLBACK) ( 268acpi_status(*ACPI_WALK_RESOURCE_CALLBACK) (struct acpi_resource * resource,
402 struct acpi_resource *resource, 269 void *context);
403 void *context);
404
405 270
406acpi_status 271acpi_status
407acpi_get_current_resources( 272acpi_get_current_resources(acpi_handle device_handle,
408 acpi_handle device_handle, 273 struct acpi_buffer *ret_buffer);
409 struct acpi_buffer *ret_buffer);
410 274
411#ifdef ACPI_FUTURE_USAGE 275#ifdef ACPI_FUTURE_USAGE
412acpi_status 276acpi_status
413acpi_get_possible_resources( 277acpi_get_possible_resources(acpi_handle device_handle,
414 acpi_handle device_handle, 278 struct acpi_buffer *ret_buffer);
415 struct acpi_buffer *ret_buffer);
416#endif 279#endif
417 280
418acpi_status 281acpi_status
419acpi_walk_resources ( 282acpi_walk_resources(acpi_handle device_handle,
420 acpi_handle device_handle, 283 char *path,
421 char *path, 284 ACPI_WALK_RESOURCE_CALLBACK user_function, void *context);
422 ACPI_WALK_RESOURCE_CALLBACK user_function,
423 void *context);
424 285
425acpi_status 286acpi_status
426acpi_set_current_resources ( 287acpi_set_current_resources(acpi_handle device_handle,
427 acpi_handle device_handle, 288 struct acpi_buffer *in_buffer);
428 struct acpi_buffer *in_buffer);
429 289
430acpi_status 290acpi_status
431acpi_get_irq_routing_table ( 291acpi_get_irq_routing_table(acpi_handle bus_device_handle,
432 acpi_handle bus_device_handle, 292 struct acpi_buffer *ret_buffer);
433 struct acpi_buffer *ret_buffer);
434 293
435acpi_status 294acpi_status
436acpi_resource_to_address64 ( 295acpi_resource_to_address64(struct acpi_resource *resource,
437 struct acpi_resource *resource, 296 struct acpi_resource_address64 *out);
438 struct acpi_resource_address64 *out);
439 297
440/* 298/*
441 * Hardware (ACPI device) interfaces 299 * Hardware (ACPI device) interfaces
442 */ 300 */
443acpi_status 301acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags);
444acpi_get_register (
445 u32 register_id,
446 u32 *return_value,
447 u32 flags);
448 302
449acpi_status 303acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags);
450acpi_set_register (
451 u32 register_id,
452 u32 value,
453 u32 flags);
454 304
455acpi_status 305acpi_status
456acpi_set_firmware_waking_vector ( 306acpi_set_firmware_waking_vector(acpi_physical_address physical_address);
457 acpi_physical_address physical_address);
458 307
459#ifdef ACPI_FUTURE_USAGE 308#ifdef ACPI_FUTURE_USAGE
460acpi_status 309acpi_status
461acpi_get_firmware_waking_vector ( 310acpi_get_firmware_waking_vector(acpi_physical_address * physical_address);
462 acpi_physical_address *physical_address);
463#endif 311#endif
464 312
465acpi_status 313acpi_status
466acpi_get_sleep_type_data ( 314acpi_get_sleep_type_data(u8 sleep_state, u8 * slp_typ_a, u8 * slp_typ_b);
467 u8 sleep_state,
468 u8 *slp_typ_a,
469 u8 *slp_typ_b);
470 315
471acpi_status 316acpi_status acpi_enter_sleep_state_prep(u8 sleep_state);
472acpi_enter_sleep_state_prep (
473 u8 sleep_state);
474 317
475acpi_status asmlinkage 318acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state);
476acpi_enter_sleep_state (
477 u8 sleep_state);
478 319
479acpi_status asmlinkage 320acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void);
480acpi_enter_sleep_state_s4bios (
481 void);
482
483acpi_status
484acpi_leave_sleep_state (
485 u8 sleep_state);
486 321
322acpi_status acpi_leave_sleep_state(u8 sleep_state);
487 323
488#endif /* __ACXFACE_H__ */ 324#endif /* __ACXFACE_H__ */
diff --git a/include/acpi/acresrc.h b/include/acpi/acresrc.h
index ed679264c12c..38e798b05d08 100644
--- a/include/acpi/acresrc.h
+++ b/include/acpi/acresrc.h
@@ -44,303 +44,216 @@
44#ifndef __ACRESRC_H__ 44#ifndef __ACRESRC_H__
45#define __ACRESRC_H__ 45#define __ACRESRC_H__
46 46
47
48/* 47/*
49 * Function prototypes called from Acpi* APIs 48 * Function prototypes called from Acpi* APIs
50 */ 49 */
51acpi_status 50acpi_status
52acpi_rs_get_prt_method_data ( 51acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer);
53 acpi_handle handle,
54 struct acpi_buffer *ret_buffer);
55
56 52
57acpi_status 53acpi_status
58acpi_rs_get_crs_method_data ( 54acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer);
59 acpi_handle handle,
60 struct acpi_buffer *ret_buffer);
61 55
62#ifdef ACPI_FUTURE_USAGE 56#ifdef ACPI_FUTURE_USAGE
63acpi_status 57acpi_status
64acpi_rs_get_prs_method_data ( 58acpi_rs_get_prs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer);
65 acpi_handle handle, 59#endif /* ACPI_FUTURE_USAGE */
66 struct acpi_buffer *ret_buffer);
67#endif /* ACPI_FUTURE_USAGE */
68 60
69acpi_status 61acpi_status
70acpi_rs_get_method_data ( 62acpi_rs_get_method_data(acpi_handle handle,
71 acpi_handle handle, 63 char *path, struct acpi_buffer *ret_buffer);
72 char *path,
73 struct acpi_buffer *ret_buffer);
74 64
75acpi_status 65acpi_status
76acpi_rs_set_srs_method_data ( 66acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer);
77 acpi_handle handle,
78 struct acpi_buffer *ret_buffer);
79 67
80acpi_status 68acpi_status
81acpi_rs_create_resource_list ( 69acpi_rs_create_resource_list(union acpi_operand_object *byte_stream_buffer,
82 union acpi_operand_object *byte_stream_buffer, 70 struct acpi_buffer *output_buffer);
83 struct acpi_buffer *output_buffer);
84 71
85acpi_status 72acpi_status
86acpi_rs_create_byte_stream ( 73acpi_rs_create_byte_stream(struct acpi_resource *linked_list_buffer,
87 struct acpi_resource *linked_list_buffer, 74 struct acpi_buffer *output_buffer);
88 struct acpi_buffer *output_buffer);
89 75
90acpi_status 76acpi_status
91acpi_rs_create_pci_routing_table ( 77acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
92 union acpi_operand_object *package_object, 78 struct acpi_buffer *output_buffer);
93 struct acpi_buffer *output_buffer);
94
95 79
96/* 80/*
97 * rsdump 81 * rsdump
98 */ 82 */
99#ifdef ACPI_FUTURE_USAGE 83#ifdef ACPI_FUTURE_USAGE
100void 84void acpi_rs_dump_resource_list(struct acpi_resource *resource);
101acpi_rs_dump_resource_list (
102 struct acpi_resource *resource);
103
104void
105acpi_rs_dump_irq_list (
106 u8 *route_table);
107#endif /* ACPI_FUTURE_USAGE */
108 85
86void acpi_rs_dump_irq_list(u8 * route_table);
87#endif /* ACPI_FUTURE_USAGE */
109 88
110/* 89/*
111 * rscalc 90 * rscalc
112 */ 91 */
113acpi_status 92acpi_status
114acpi_rs_get_byte_stream_start ( 93acpi_rs_get_byte_stream_start(u8 * byte_stream_buffer,
115 u8 *byte_stream_buffer, 94 u8 ** byte_stream_start, u32 * size);
116 u8 **byte_stream_start,
117 u32 *size);
118 95
119acpi_status 96acpi_status
120acpi_rs_get_list_length ( 97acpi_rs_get_list_length(u8 * byte_stream_buffer,
121 u8 *byte_stream_buffer, 98 u32 byte_stream_buffer_length, acpi_size * size_needed);
122 u32 byte_stream_buffer_length,
123 acpi_size *size_needed);
124 99
125acpi_status 100acpi_status
126acpi_rs_get_byte_stream_length ( 101acpi_rs_get_byte_stream_length(struct acpi_resource *linked_list_buffer,
127 struct acpi_resource *linked_list_buffer, 102 acpi_size * size_needed);
128 acpi_size *size_needed);
129 103
130acpi_status 104acpi_status
131acpi_rs_get_pci_routing_table_length ( 105acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
132 union acpi_operand_object *package_object, 106 acpi_size * buffer_size_needed);
133 acpi_size *buffer_size_needed);
134 107
135acpi_status 108acpi_status
136acpi_rs_byte_stream_to_list ( 109acpi_rs_byte_stream_to_list(u8 * byte_stream_buffer,
137 u8 *byte_stream_buffer, 110 u32 byte_stream_buffer_length, u8 * output_buffer);
138 u32 byte_stream_buffer_length,
139 u8 *output_buffer);
140 111
141acpi_status 112acpi_status
142acpi_rs_list_to_byte_stream ( 113acpi_rs_list_to_byte_stream(struct acpi_resource *linked_list,
143 struct acpi_resource *linked_list, 114 acpi_size byte_stream_size_needed,
144 acpi_size byte_stream_size_needed, 115 u8 * output_buffer);
145 u8 *output_buffer);
146 116
147acpi_status 117acpi_status
148acpi_rs_io_resource ( 118acpi_rs_io_resource(u8 * byte_stream_buffer,
149 u8 *byte_stream_buffer, 119 acpi_size * bytes_consumed,
150 acpi_size *bytes_consumed, 120 u8 ** output_buffer, acpi_size * structure_size);
151 u8 **output_buffer,
152 acpi_size *structure_size);
153 121
154acpi_status 122acpi_status
155acpi_rs_fixed_io_resource ( 123acpi_rs_fixed_io_resource(u8 * byte_stream_buffer,
156 u8 *byte_stream_buffer, 124 acpi_size * bytes_consumed,
157 acpi_size *bytes_consumed, 125 u8 ** output_buffer, acpi_size * structure_size);
158 u8 **output_buffer,
159 acpi_size *structure_size);
160 126
161acpi_status 127acpi_status
162acpi_rs_io_stream ( 128acpi_rs_io_stream(struct acpi_resource *linked_list,
163 struct acpi_resource *linked_list, 129 u8 ** output_buffer, acpi_size * bytes_consumed);
164 u8 **output_buffer,
165 acpi_size *bytes_consumed);
166 130
167acpi_status 131acpi_status
168acpi_rs_fixed_io_stream ( 132acpi_rs_fixed_io_stream(struct acpi_resource *linked_list,
169 struct acpi_resource *linked_list, 133 u8 ** output_buffer, acpi_size * bytes_consumed);
170 u8 **output_buffer,
171 acpi_size *bytes_consumed);
172 134
173acpi_status 135acpi_status
174acpi_rs_irq_resource ( 136acpi_rs_irq_resource(u8 * byte_stream_buffer,
175 u8 *byte_stream_buffer, 137 acpi_size * bytes_consumed,
176 acpi_size *bytes_consumed, 138 u8 ** output_buffer, acpi_size * structure_size);
177 u8 **output_buffer,
178 acpi_size *structure_size);
179 139
180acpi_status 140acpi_status
181acpi_rs_irq_stream ( 141acpi_rs_irq_stream(struct acpi_resource *linked_list,
182 struct acpi_resource *linked_list, 142 u8 ** output_buffer, acpi_size * bytes_consumed);
183 u8 **output_buffer,
184 acpi_size *bytes_consumed);
185 143
186acpi_status 144acpi_status
187acpi_rs_dma_resource ( 145acpi_rs_dma_resource(u8 * byte_stream_buffer,
188 u8 *byte_stream_buffer, 146 acpi_size * bytes_consumed,
189 acpi_size *bytes_consumed, 147 u8 ** output_buffer, acpi_size * structure_size);
190 u8 **output_buffer,
191 acpi_size *structure_size);
192 148
193acpi_status 149acpi_status
194acpi_rs_dma_stream ( 150acpi_rs_dma_stream(struct acpi_resource *linked_list,
195 struct acpi_resource *linked_list, 151 u8 ** output_buffer, acpi_size * bytes_consumed);
196 u8 **output_buffer,
197 acpi_size *bytes_consumed);
198 152
199acpi_status 153acpi_status
200acpi_rs_address16_resource ( 154acpi_rs_address16_resource(u8 * byte_stream_buffer,
201 u8 *byte_stream_buffer, 155 acpi_size * bytes_consumed,
202 acpi_size *bytes_consumed, 156 u8 ** output_buffer, acpi_size * structure_size);
203 u8 **output_buffer,
204 acpi_size *structure_size);
205 157
206acpi_status 158acpi_status
207acpi_rs_address16_stream ( 159acpi_rs_address16_stream(struct acpi_resource *linked_list,
208 struct acpi_resource *linked_list, 160 u8 ** output_buffer, acpi_size * bytes_consumed);
209 u8 **output_buffer,
210 acpi_size *bytes_consumed);
211 161
212acpi_status 162acpi_status
213acpi_rs_address32_resource ( 163acpi_rs_address32_resource(u8 * byte_stream_buffer,
214 u8 *byte_stream_buffer, 164 acpi_size * bytes_consumed,
215 acpi_size *bytes_consumed, 165 u8 ** output_buffer, acpi_size * structure_size);
216 u8 **output_buffer,
217 acpi_size *structure_size);
218 166
219acpi_status 167acpi_status
220acpi_rs_address32_stream ( 168acpi_rs_address32_stream(struct acpi_resource *linked_list,
221 struct acpi_resource *linked_list, 169 u8 ** output_buffer, acpi_size * bytes_consumed);
222 u8 **output_buffer,
223 acpi_size *bytes_consumed);
224 170
225acpi_status 171acpi_status
226acpi_rs_address64_resource ( 172acpi_rs_address64_resource(u8 * byte_stream_buffer,
227 u8 *byte_stream_buffer, 173 acpi_size * bytes_consumed,
228 acpi_size *bytes_consumed, 174 u8 ** output_buffer, acpi_size * structure_size);
229 u8 **output_buffer,
230 acpi_size *structure_size);
231 175
232acpi_status 176acpi_status
233acpi_rs_address64_stream ( 177acpi_rs_address64_stream(struct acpi_resource *linked_list,
234 struct acpi_resource *linked_list, 178 u8 ** output_buffer, acpi_size * bytes_consumed);
235 u8 **output_buffer,
236 acpi_size *bytes_consumed);
237 179
238acpi_status 180acpi_status
239acpi_rs_start_depend_fns_resource ( 181acpi_rs_start_depend_fns_resource(u8 * byte_stream_buffer,
240 u8 *byte_stream_buffer, 182 acpi_size * bytes_consumed,
241 acpi_size *bytes_consumed, 183 u8 ** output_buffer,
242 u8 **output_buffer, 184 acpi_size * structure_size);
243 acpi_size *structure_size);
244 185
245acpi_status 186acpi_status
246acpi_rs_end_depend_fns_resource ( 187acpi_rs_end_depend_fns_resource(u8 * byte_stream_buffer,
247 u8 *byte_stream_buffer, 188 acpi_size * bytes_consumed,
248 acpi_size *bytes_consumed, 189 u8 ** output_buffer,
249 u8 **output_buffer, 190 acpi_size * structure_size);
250 acpi_size *structure_size);
251 191
252acpi_status 192acpi_status
253acpi_rs_start_depend_fns_stream ( 193acpi_rs_start_depend_fns_stream(struct acpi_resource *linked_list,
254 struct acpi_resource *linked_list, 194 u8 ** output_buffer,
255 u8 **output_buffer, 195 acpi_size * bytes_consumed);
256 acpi_size *bytes_consumed);
257 196
258acpi_status 197acpi_status
259acpi_rs_end_depend_fns_stream ( 198acpi_rs_end_depend_fns_stream(struct acpi_resource *linked_list,
260 struct acpi_resource *linked_list, 199 u8 ** output_buffer, acpi_size * bytes_consumed);
261 u8 **output_buffer,
262 acpi_size *bytes_consumed);
263 200
264acpi_status 201acpi_status
265acpi_rs_memory24_resource ( 202acpi_rs_memory24_resource(u8 * byte_stream_buffer,
266 u8 *byte_stream_buffer, 203 acpi_size * bytes_consumed,
267 acpi_size *bytes_consumed, 204 u8 ** output_buffer, acpi_size * structure_size);
268 u8 **output_buffer,
269 acpi_size *structure_size);
270 205
271acpi_status 206acpi_status
272acpi_rs_memory24_stream ( 207acpi_rs_memory24_stream(struct acpi_resource *linked_list,
273 struct acpi_resource *linked_list, 208 u8 ** output_buffer, acpi_size * bytes_consumed);
274 u8 **output_buffer,
275 acpi_size *bytes_consumed);
276 209
277acpi_status 210acpi_status
278acpi_rs_memory32_range_resource ( 211acpi_rs_memory32_range_resource(u8 * byte_stream_buffer,
279 u8 *byte_stream_buffer, 212 acpi_size * bytes_consumed,
280 acpi_size *bytes_consumed, 213 u8 ** output_buffer,
281 u8 **output_buffer, 214 acpi_size * structure_size);
282 acpi_size *structure_size);
283 215
284acpi_status 216acpi_status
285acpi_rs_fixed_memory32_resource ( 217acpi_rs_fixed_memory32_resource(u8 * byte_stream_buffer,
286 u8 *byte_stream_buffer, 218 acpi_size * bytes_consumed,
287 acpi_size *bytes_consumed, 219 u8 ** output_buffer,
288 u8 **output_buffer, 220 acpi_size * structure_size);
289 acpi_size *structure_size);
290 221
291acpi_status 222acpi_status
292acpi_rs_memory32_range_stream ( 223acpi_rs_memory32_range_stream(struct acpi_resource *linked_list,
293 struct acpi_resource *linked_list, 224 u8 ** output_buffer, acpi_size * bytes_consumed);
294 u8 **output_buffer,
295 acpi_size *bytes_consumed);
296 225
297acpi_status 226acpi_status
298acpi_rs_fixed_memory32_stream ( 227acpi_rs_fixed_memory32_stream(struct acpi_resource *linked_list,
299 struct acpi_resource *linked_list, 228 u8 ** output_buffer, acpi_size * bytes_consumed);
300 u8 **output_buffer,
301 acpi_size *bytes_consumed);
302 229
303acpi_status 230acpi_status
304acpi_rs_extended_irq_resource ( 231acpi_rs_extended_irq_resource(u8 * byte_stream_buffer,
305 u8 *byte_stream_buffer, 232 acpi_size * bytes_consumed,
306 acpi_size *bytes_consumed, 233 u8 ** output_buffer, acpi_size * structure_size);
307 u8 **output_buffer,
308 acpi_size *structure_size);
309 234
310acpi_status 235acpi_status
311acpi_rs_extended_irq_stream ( 236acpi_rs_extended_irq_stream(struct acpi_resource *linked_list,
312 struct acpi_resource *linked_list, 237 u8 ** output_buffer, acpi_size * bytes_consumed);
313 u8 **output_buffer,
314 acpi_size *bytes_consumed);
315 238
316acpi_status 239acpi_status
317acpi_rs_end_tag_resource ( 240acpi_rs_end_tag_resource(u8 * byte_stream_buffer,
318 u8 *byte_stream_buffer, 241 acpi_size * bytes_consumed,
319 acpi_size *bytes_consumed, 242 u8 ** output_buffer, acpi_size * structure_size);
320 u8 **output_buffer,
321 acpi_size *structure_size);
322 243
323acpi_status 244acpi_status
324acpi_rs_end_tag_stream ( 245acpi_rs_end_tag_stream(struct acpi_resource *linked_list,
325 struct acpi_resource *linked_list, 246 u8 ** output_buffer, acpi_size * bytes_consumed);
326 u8 **output_buffer,
327 acpi_size *bytes_consumed);
328 247
329acpi_status 248acpi_status
330acpi_rs_vendor_resource ( 249acpi_rs_vendor_resource(u8 * byte_stream_buffer,
331 u8 *byte_stream_buffer, 250 acpi_size * bytes_consumed,
332 acpi_size *bytes_consumed, 251 u8 ** output_buffer, acpi_size * structure_size);
333 u8 **output_buffer,
334 acpi_size *structure_size);
335 252
336acpi_status 253acpi_status
337acpi_rs_vendor_stream ( 254acpi_rs_vendor_stream(struct acpi_resource *linked_list,
338 struct acpi_resource *linked_list, 255 u8 ** output_buffer, acpi_size * bytes_consumed);
339 u8 **output_buffer,
340 acpi_size *bytes_consumed);
341 256
342u8 257u8 acpi_rs_get_resource_type(u8 resource_start_byte);
343acpi_rs_get_resource_type (
344 u8 resource_start_byte);
345 258
346#endif /* __ACRESRC_H__ */ 259#endif /* __ACRESRC_H__ */
diff --git a/include/acpi/acstruct.h b/include/acpi/acstruct.h
index e6b9e36a2eda..99d235339801 100644
--- a/include/acpi/acstruct.h
+++ b/include/acpi/acstruct.h
@@ -44,14 +44,12 @@
44#ifndef __ACSTRUCT_H__ 44#ifndef __ACSTRUCT_H__
45#define __ACSTRUCT_H__ 45#define __ACSTRUCT_H__
46 46
47
48/***************************************************************************** 47/*****************************************************************************
49 * 48 *
50 * Tree walking typedefs and structs 49 * Tree walking typedefs and structs
51 * 50 *
52 ****************************************************************************/ 51 ****************************************************************************/
53 52
54
55/* 53/*
56 * Walk state - current state of a parse tree walk. Used for both a leisurely stroll through 54 * Walk state - current state of a parse tree walk. Used for both a leisurely stroll through
57 * the tree (for whatever reason), and for control method execution. 55 * the tree (for whatever reason), and for control method execution.
@@ -65,152 +63,142 @@
65#define ACPI_WALK_CONST_REQUIRED 3 63#define ACPI_WALK_CONST_REQUIRED 3
66#define ACPI_WALK_CONST_OPTIONAL 4 64#define ACPI_WALK_CONST_OPTIONAL 4
67 65
68struct acpi_walk_state 66struct acpi_walk_state {
69{ 67 u8 data_type; /* To differentiate various internal objs MUST BE FIRST! */
70 u8 data_type; /* To differentiate various internal objs MUST BE FIRST!*/\ 68 u8 walk_type;
71 u8 walk_type; 69 acpi_owner_id owner_id; /* Owner of objects created during the walk */
72 acpi_owner_id owner_id; /* Owner of objects created during the walk */ 70 u8 last_predicate; /* Result of last predicate */
73 u8 last_predicate; /* Result of last predicate */ 71 u8 current_result; /* */
74 u8 reserved; /* For alignment */ 72 u8 next_op_info; /* Info about next_op */
75 u8 current_result; /* */ 73 u8 num_operands; /* Stack pointer for Operands[] array */
76 u8 next_op_info; /* Info about next_op */ 74 u8 return_used;
77 u8 num_operands; /* Stack pointer for Operands[] array */ 75 u16 opcode; /* Current AML opcode */
78 u8 return_used; 76 u8 scope_depth;
79 u16 opcode; /* Current AML opcode */ 77 u8 pass_number; /* Parse pass during table load */
80 u8 scope_depth; 78 u32 arg_count; /* push for fixed or var args */
81 u8 reserved1; 79 u32 aml_offset;
82 u32 arg_count; /* push for fixed or var args */ 80 u32 arg_types;
83 u32 aml_offset; 81 u32 method_breakpoint; /* For single stepping */
84 u32 arg_types; 82 u32 user_breakpoint; /* User AML breakpoint */
85 u32 method_breakpoint; /* For single stepping */ 83 u32 parse_flags;
86 u32 user_breakpoint; /* User AML breakpoint */ 84 u32 prev_arg_types;
87 u32 parse_flags; 85
88 u32 prev_arg_types; 86 u8 *aml_last_while;
89 87 struct acpi_namespace_node arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */
90 u8 *aml_last_while; 88 union acpi_operand_object **caller_return_desc;
91 struct acpi_namespace_node arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */ 89 union acpi_generic_state *control_state; /* List of control states (nested IFs) */
92 union acpi_operand_object **caller_return_desc; 90 struct acpi_namespace_node *deferred_node; /* Used when executing deferred opcodes */
93 union acpi_generic_state *control_state; /* List of control states (nested IFs) */ 91 struct acpi_gpe_event_info *gpe_event_info; /* Info for GPE (_Lxx/_Exx methods only */
94 struct acpi_namespace_node *deferred_node; /* Used when executing deferred opcodes */ 92 union acpi_operand_object *implicit_return_obj;
95 struct acpi_gpe_event_info *gpe_event_info; /* Info for GPE (_Lxx/_Exx methods only */ 93 struct acpi_namespace_node local_variables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */
96 union acpi_operand_object *implicit_return_obj; 94 struct acpi_namespace_node *method_call_node; /* Called method Node */
97 struct acpi_namespace_node local_variables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */ 95 union acpi_parse_object *method_call_op; /* method_call Op if running a method */
98 struct acpi_namespace_node *method_call_node; /* Called method Node*/ 96 union acpi_operand_object *method_desc; /* Method descriptor if running a method */
99 union acpi_parse_object *method_call_op; /* method_call Op if running a method */ 97 struct acpi_namespace_node *method_node; /* Method node if running a method. */
100 union acpi_operand_object *method_desc; /* Method descriptor if running a method */ 98 union acpi_parse_object *op; /* Current parser op */
101 struct acpi_namespace_node *method_node; /* Method node if running a method. */ 99 union acpi_operand_object *operands[ACPI_OBJ_NUM_OPERANDS + 1]; /* Operands passed to the interpreter (+1 for NULL terminator) */
102 union acpi_parse_object *op; /* Current parser op */ 100 const struct acpi_opcode_info *op_info; /* Info on current opcode */
103 union acpi_operand_object *operands[ACPI_OBJ_NUM_OPERANDS+1]; /* Operands passed to the interpreter (+1 for NULL terminator) */ 101 union acpi_parse_object *origin; /* Start of walk [Obsolete] */
104 const struct acpi_opcode_info *op_info; /* Info on current opcode */ 102 union acpi_operand_object **params;
105 union acpi_parse_object *origin; /* Start of walk [Obsolete] */ 103 struct acpi_parse_state parser_state; /* Current state of parser */
106 union acpi_operand_object **params; 104 union acpi_operand_object *result_obj;
107 struct acpi_parse_state parser_state; /* Current state of parser */ 105 union acpi_generic_state *results; /* Stack of accumulated results */
108 union acpi_operand_object *result_obj; 106 union acpi_operand_object *return_desc; /* Return object, if any */
109 union acpi_generic_state *results; /* Stack of accumulated results */ 107 union acpi_generic_state *scope_info; /* Stack of nested scopes */
110 union acpi_operand_object *return_desc; /* Return object, if any */ 108
111 union acpi_generic_state *scope_info; /* Stack of nested scopes */ 109 union acpi_parse_object *prev_op; /* Last op that was processed */
112 110 union acpi_parse_object *next_op; /* next op to be processed */
113 union acpi_parse_object *prev_op; /* Last op that was processed */ 111 acpi_parse_downwards descending_callback;
114 union acpi_parse_object *next_op; /* next op to be processed */ 112 acpi_parse_upwards ascending_callback;
115 acpi_parse_downwards descending_callback; 113 struct acpi_thread_state *thread;
116 acpi_parse_upwards ascending_callback; 114 struct acpi_walk_state *next; /* Next walk_state in list */
117 struct acpi_thread_state *thread;
118 struct acpi_walk_state *next; /* Next walk_state in list */
119}; 115};
120 116
121
122/* Info used by acpi_ps_init_objects */ 117/* Info used by acpi_ps_init_objects */
123 118
124struct acpi_init_walk_info 119struct acpi_init_walk_info {
125{ 120 u16 method_count;
126 u16 method_count; 121 u16 device_count;
127 u16 device_count; 122 u16 op_region_count;
128 u16 op_region_count; 123 u16 field_count;
129 u16 field_count; 124 u16 buffer_count;
130 u16 buffer_count; 125 u16 package_count;
131 u16 package_count; 126 u16 op_region_init;
132 u16 op_region_init; 127 u16 field_init;
133 u16 field_init; 128 u16 buffer_init;
134 u16 buffer_init; 129 u16 package_init;
135 u16 package_init; 130 u16 object_count;
136 u16 object_count; 131 struct acpi_table_desc *table_desc;
137 struct acpi_table_desc *table_desc;
138}; 132};
139 133
140
141/* Info used by acpi_ns_initialize_devices */ 134/* Info used by acpi_ns_initialize_devices */
142 135
143struct acpi_device_walk_info 136struct acpi_device_walk_info {
144{ 137 u16 device_count;
145 u16 device_count; 138 u16 num_STA;
146 u16 num_STA; 139 u16 num_INI;
147 u16 num_INI; 140 struct acpi_table_desc *table_desc;
148 struct acpi_table_desc *table_desc;
149}; 141};
150 142
151
152/* TBD: [Restructure] Merge with struct above */ 143/* TBD: [Restructure] Merge with struct above */
153 144
154struct acpi_walk_info 145struct acpi_walk_info {
155{ 146 u32 debug_level;
156 u32 debug_level; 147 u32 count;
157 u32 owner_id; 148 acpi_owner_id owner_id;
158 u8 display_type; 149 u8 display_type;
159}; 150};
160 151
161/* Display Types */ 152/* Display Types */
162 153
163#define ACPI_DISPLAY_SUMMARY 0 154#define ACPI_DISPLAY_SUMMARY (u8) 0
164#define ACPI_DISPLAY_OBJECTS 1 155#define ACPI_DISPLAY_OBJECTS (u8) 1
156#define ACPI_DISPLAY_MASK (u8) 1
165 157
166struct acpi_get_devices_info 158#define ACPI_DISPLAY_SHORT (u8) 2
167{
168 acpi_walk_callback user_function;
169 void *context;
170 char *hid;
171};
172 159
160struct acpi_get_devices_info {
161 acpi_walk_callback user_function;
162 void *context;
163 char *hid;
164};
173 165
174union acpi_aml_operands 166union acpi_aml_operands {
175{ 167 union acpi_operand_object *operands[7];
176 union acpi_operand_object *operands[7];
177 168
178 struct 169 struct {
179 { 170 struct acpi_object_integer *type;
180 struct acpi_object_integer *type; 171 struct acpi_object_integer *code;
181 struct acpi_object_integer *code; 172 struct acpi_object_integer *argument;
182 struct acpi_object_integer *argument;
183 173
184 } fatal; 174 } fatal;
185 175
186 struct 176 struct {
187 { 177 union acpi_operand_object *source;
188 union acpi_operand_object *source; 178 struct acpi_object_integer *index;
189 struct acpi_object_integer *index; 179 union acpi_operand_object *target;
190 union acpi_operand_object *target;
191 180
192 } index; 181 } index;
193 182
194 struct 183 struct {
195 { 184 union acpi_operand_object *source;
196 union acpi_operand_object *source; 185 struct acpi_object_integer *index;
197 struct acpi_object_integer *index; 186 struct acpi_object_integer *length;
198 struct acpi_object_integer *length; 187 union acpi_operand_object *target;
199 union acpi_operand_object *target;
200 188
201 } mid; 189 } mid;
202}; 190};
203 191
204
205/* Internal method parameter list */ 192/* Internal method parameter list */
206 193
207struct acpi_parameter_info 194struct acpi_parameter_info {
208{ 195 struct acpi_namespace_node *node;
209 struct acpi_namespace_node *node; 196 union acpi_operand_object *obj_desc;
210 union acpi_operand_object **parameters; 197 union acpi_operand_object **parameters;
211 union acpi_operand_object *return_object; 198 union acpi_operand_object *return_object;
212 u8 parameter_type; 199 u8 pass_number;
213 u8 return_object_type; 200 u8 parameter_type;
201 u8 return_object_type;
214}; 202};
215 203
216/* Types for parameter_type above */ 204/* Types for parameter_type above */
@@ -218,5 +206,4 @@ struct acpi_parameter_info
218#define ACPI_PARAM_ARGS 0 206#define ACPI_PARAM_ARGS 0
219#define ACPI_PARAM_GPE 1 207#define ACPI_PARAM_GPE 1
220 208
221
222#endif 209#endif
diff --git a/include/acpi/actables.h b/include/acpi/actables.h
index 39df92e21a0d..f92c1858b808 100644
--- a/include/acpi/actables.h
+++ b/include/acpi/actables.h
@@ -44,146 +44,101 @@
44#ifndef __ACTABLES_H__ 44#ifndef __ACTABLES_H__
45#define __ACTABLES_H__ 45#define __ACTABLES_H__
46 46
47
48/* Used in acpi_tb_map_acpi_table for size parameter if table header is to be used */ 47/* Used in acpi_tb_map_acpi_table for size parameter if table header is to be used */
49 48
50#define SIZE_IN_HEADER 0 49#define SIZE_IN_HEADER 0
51 50
52
53/* 51/*
54 * tbconvrt - Table conversion routines 52 * tbconvrt - Table conversion routines
55 */ 53 */
56acpi_status 54acpi_status acpi_tb_convert_to_xsdt(struct acpi_table_desc *table_info);
57acpi_tb_convert_to_xsdt (
58 struct acpi_table_desc *table_info);
59 55
60acpi_status 56acpi_status acpi_tb_convert_table_fadt(void);
61acpi_tb_convert_table_fadt (
62 void);
63 57
64acpi_status 58acpi_status acpi_tb_build_common_facs(struct acpi_table_desc *table_info);
65acpi_tb_build_common_facs (
66 struct acpi_table_desc *table_info);
67 59
68u32 60u32
69acpi_tb_get_table_count ( 61acpi_tb_get_table_count(struct rsdp_descriptor *RSDP,
70 struct rsdp_descriptor *RSDP, 62 struct acpi_table_header *RSDT);
71 struct acpi_table_header *RSDT);
72
73 63
74/* 64/*
75 * tbget - Table "get" routines 65 * tbget - Table "get" routines
76 */ 66 */
77acpi_status 67acpi_status
78acpi_tb_get_table ( 68acpi_tb_get_table(struct acpi_pointer *address,
79 struct acpi_pointer *address, 69 struct acpi_table_desc *table_info);
80 struct acpi_table_desc *table_info);
81
82acpi_status
83acpi_tb_get_table_header (
84 struct acpi_pointer *address,
85 struct acpi_table_header *return_header);
86 70
87acpi_status 71acpi_status
88acpi_tb_get_table_body ( 72acpi_tb_get_table_header(struct acpi_pointer *address,
89 struct acpi_pointer *address, 73 struct acpi_table_header *return_header);
90 struct acpi_table_header *header,
91 struct acpi_table_desc *table_info);
92 74
93acpi_status 75acpi_status
94acpi_tb_get_table_ptr ( 76acpi_tb_get_table_body(struct acpi_pointer *address,
95 acpi_table_type table_type, 77 struct acpi_table_header *header,
96 u32 instance, 78 struct acpi_table_desc *table_info);
97 struct acpi_table_header **table_ptr_loc);
98 79
99acpi_status 80acpi_status
100acpi_tb_verify_rsdp ( 81acpi_tb_get_table_ptr(acpi_table_type table_type,
101 struct acpi_pointer *address); 82 u32 instance, struct acpi_table_header **table_ptr_loc);
102 83
103void 84acpi_status acpi_tb_verify_rsdp(struct acpi_pointer *address);
104acpi_tb_get_rsdt_address (
105 struct acpi_pointer *out_address);
106 85
107acpi_status 86void acpi_tb_get_rsdt_address(struct acpi_pointer *out_address);
108acpi_tb_validate_rsdt (
109 struct acpi_table_header *table_ptr);
110 87
88acpi_status acpi_tb_validate_rsdt(struct acpi_table_header *table_ptr);
111 89
112/* 90/*
113 * tbgetall - get multiple required tables 91 * tbgetall - get multiple required tables
114 */ 92 */
115acpi_status 93acpi_status acpi_tb_get_required_tables(void);
116acpi_tb_get_required_tables (
117 void);
118
119 94
120/* 95/*
121 * tbinstall - Table installation 96 * tbinstall - Table installation
122 */ 97 */
123acpi_status 98acpi_status acpi_tb_install_table(struct acpi_table_desc *table_info);
124acpi_tb_install_table (
125 struct acpi_table_desc *table_info);
126 99
127acpi_status 100acpi_status
128acpi_tb_recognize_table ( 101acpi_tb_recognize_table(struct acpi_table_desc *table_info, u8 search_type);
129 struct acpi_table_desc *table_info,
130 u8 search_type);
131 102
132acpi_status 103acpi_status
133acpi_tb_init_table_descriptor ( 104acpi_tb_init_table_descriptor(acpi_table_type table_type,
134 acpi_table_type table_type, 105 struct acpi_table_desc *table_info);
135 struct acpi_table_desc *table_info);
136
137 106
138/* 107/*
139 * tbremove - Table removal and deletion 108 * tbremove - Table removal and deletion
140 */ 109 */
141void 110void acpi_tb_delete_all_tables(void);
142acpi_tb_delete_all_tables (
143 void);
144
145void
146acpi_tb_delete_tables_by_type (
147 acpi_table_type type);
148 111
149void 112void acpi_tb_delete_tables_by_type(acpi_table_type type);
150acpi_tb_delete_single_table (
151 struct acpi_table_desc *table_desc);
152 113
153struct acpi_table_desc * 114void acpi_tb_delete_single_table(struct acpi_table_desc *table_desc);
154acpi_tb_uninstall_table (
155 struct acpi_table_desc *table_desc);
156 115
116struct acpi_table_desc *acpi_tb_uninstall_table(struct acpi_table_desc
117 *table_desc);
157 118
158/* 119/*
159 * tbxfroot - RSDP, RSDT utilities 120 * tbxfroot - RSDP, RSDT utilities
160 */ 121 */
161acpi_status 122acpi_status
162acpi_tb_find_table ( 123acpi_tb_find_table(char *signature,
163 char *signature, 124 char *oem_id,
164 char *oem_id, 125 char *oem_table_id, struct acpi_table_header **table_ptr);
165 char *oem_table_id,
166 struct acpi_table_header **table_ptr);
167 126
168acpi_status 127acpi_status acpi_tb_get_table_rsdt(void);
169acpi_tb_get_table_rsdt (
170 void);
171 128
129acpi_status acpi_tb_validate_rsdp(struct rsdp_descriptor *rsdp);
172 130
173/* 131/*
174 * tbutils - common table utilities 132 * tbutils - common table utilities
175 */ 133 */
134acpi_status acpi_tb_is_table_installed(struct acpi_table_desc *new_table_desc);
135
176acpi_status 136acpi_status
177acpi_tb_verify_table_checksum ( 137acpi_tb_verify_table_checksum(struct acpi_table_header *table_header);
178 struct acpi_table_header *table_header);
179 138
180u8 139u8 acpi_tb_generate_checksum(void *buffer, u32 length);
181acpi_tb_checksum (
182 void *buffer,
183 u32 length);
184 140
185acpi_status 141acpi_status
186acpi_tb_validate_table_header ( 142acpi_tb_validate_table_header(struct acpi_table_header *table_header);
187 struct acpi_table_header *table_header);
188 143
189#endif /* __ACTABLES_H__ */ 144#endif /* __ACTABLES_H__ */
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index b5cdcca444c8..a46f406e1c94 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -44,27 +44,24 @@
44#ifndef __ACTBL_H__ 44#ifndef __ACTBL_H__
45#define __ACTBL_H__ 45#define __ACTBL_H__
46 46
47
48/* 47/*
49 * Values for description table header signatures 48 * Values for description table header signatures
50 */ 49 */
51#define RSDP_NAME "RSDP" 50#define RSDP_NAME "RSDP"
52#define RSDP_SIG "RSD PTR " /* RSDT Pointer signature */ 51#define RSDP_SIG "RSD PTR " /* RSDT Pointer signature */
53#define APIC_SIG "APIC" /* Multiple APIC Description Table */ 52#define APIC_SIG "APIC" /* Multiple APIC Description Table */
54#define DSDT_SIG "DSDT" /* Differentiated System Description Table */ 53#define DSDT_SIG "DSDT" /* Differentiated System Description Table */
55#define FADT_SIG "FACP" /* Fixed ACPI Description Table */ 54#define FADT_SIG "FACP" /* Fixed ACPI Description Table */
56#define FACS_SIG "FACS" /* Firmware ACPI Control Structure */ 55#define FACS_SIG "FACS" /* Firmware ACPI Control Structure */
57#define PSDT_SIG "PSDT" /* Persistent System Description Table */ 56#define PSDT_SIG "PSDT" /* Persistent System Description Table */
58#define RSDT_SIG "RSDT" /* Root System Description Table */ 57#define RSDT_SIG "RSDT" /* Root System Description Table */
59#define XSDT_SIG "XSDT" /* Extended System Description Table */ 58#define XSDT_SIG "XSDT" /* Extended System Description Table */
60#define SSDT_SIG "SSDT" /* Secondary System Description Table */ 59#define SSDT_SIG "SSDT" /* Secondary System Description Table */
61#define SBST_SIG "SBST" /* Smart Battery Specification Table */ 60#define SBST_SIG "SBST" /* Smart Battery Specification Table */
62#define SPIC_SIG "SPIC" /* IOSAPIC table */ 61#define SPIC_SIG "SPIC" /* IOSAPIC table */
63#define BOOT_SIG "BOOT" /* Boot table */ 62#define BOOT_SIG "BOOT" /* Boot table */
64 63
65 64#define GL_OWNED 0x02 /* Ownership of global lock is bit 1 */
66#define GL_OWNED 0x02 /* Ownership of global lock is bit 1 */
67
68 65
69/* 66/*
70 * Common table types. The base code can remain 67 * Common table types. The base code can remain
@@ -75,7 +72,6 @@
75#define FACS_DESCRIPTOR struct facs_descriptor_rev2 72#define FACS_DESCRIPTOR struct facs_descriptor_rev2
76#define FADT_DESCRIPTOR struct fadt_descriptor_rev2 73#define FADT_DESCRIPTOR struct fadt_descriptor_rev2
77 74
78
79#pragma pack(1) 75#pragma pack(1)
80 76
81/* 77/*
@@ -84,45 +80,37 @@
84 * NOTE: The tables that are specific to ACPI versions (1.0, 2.0, etc.) 80 * NOTE: The tables that are specific to ACPI versions (1.0, 2.0, etc.)
85 * are in separate files. 81 * are in separate files.
86 */ 82 */
87struct rsdp_descriptor /* Root System Descriptor Pointer */ 83struct rsdp_descriptor { /* Root System Descriptor Pointer */
88{ 84 char signature[8]; /* ACPI signature, contains "RSD PTR " */
89 char signature [8]; /* ACPI signature, contains "RSD PTR " */ 85 u8 checksum; /* ACPI 1.0 checksum */
90 u8 checksum; /* To make sum of struct == 0 */ 86 char oem_id[6]; /* OEM identification */
91 char oem_id [6]; /* OEM identification */ 87 u8 revision; /* Must be (0) for ACPI 1.0 or (2) for ACPI 2.0+ */
92 u8 revision; /* Must be 0 for 1.0, 2 for 2.0 */ 88 u32 rsdt_physical_address; /* 32-bit physical address of the RSDT */
93 u32 rsdt_physical_address; /* 32-bit physical address of RSDT */ 89 u32 length; /* XSDT Length in bytes, including header */
94 u32 length; /* XSDT Length in bytes including hdr */ 90 u64 xsdt_physical_address; /* 64-bit physical address of the XSDT */
95 u64 xsdt_physical_address; /* 64-bit physical address of XSDT */ 91 u8 extended_checksum; /* Checksum of entire table (ACPI 2.0) */
96 u8 extended_checksum; /* Checksum of entire table */ 92 char reserved[3]; /* Reserved, must be zero */
97 char reserved [3]; /* Reserved field must be 0 */
98}; 93};
99 94
100 95struct acpi_common_facs { /* Common FACS for internal use */
101struct acpi_common_facs /* Common FACS for internal use */ 96 u32 *global_lock;
102{ 97 u64 *firmware_waking_vector;
103 u32 *global_lock; 98 u8 vector_width;
104 u64 *firmware_waking_vector;
105 u8 vector_width;
106}; 99};
107 100
108
109#define ACPI_TABLE_HEADER_DEF /* ACPI common table header */ \ 101#define ACPI_TABLE_HEADER_DEF /* ACPI common table header */ \
110 char signature [4]; /* ACPI signature (4 ASCII characters) */\ 102 char signature[4]; /* ASCII table signature */\
111 u32 length; /* Length of table, in bytes, including header */\ 103 u32 length; /* Length of table in bytes, including this header */\
112 u8 revision; /* ACPI Specification minor version # */\ 104 u8 revision; /* ACPI Specification minor version # */\
113 u8 checksum; /* To make sum of entire table == 0 */\ 105 u8 checksum; /* To make sum of entire table == 0 */\
114 char oem_id [6]; /* OEM identification */\ 106 char oem_id[6]; /* ASCII OEM identification */\
115 char oem_table_id [8]; /* OEM table identification */\ 107 char oem_table_id[8]; /* ASCII OEM table identification */\
116 u32 oem_revision; /* OEM revision number */\ 108 u32 oem_revision; /* OEM revision number */\
117 char asl_compiler_id [4]; /* ASL compiler vendor ID */\ 109 char asl_compiler_id [4]; /* ASCII ASL compiler vendor ID */\
118 u32 asl_compiler_revision; /* ASL compiler revision number */ 110 u32 asl_compiler_revision; /* ASL compiler version */
119
120
121struct acpi_table_header /* ACPI common table header */
122{
123 ACPI_TABLE_HEADER_DEF
124};
125 111
112struct acpi_table_header { /* ACPI common table header */
113ACPI_TABLE_HEADER_DEF};
126 114
127/* 115/*
128 * MADT values and structures 116 * MADT values and structures
@@ -135,12 +123,15 @@ struct acpi_table_header /* ACPI common table header */
135 123
136/* Master MADT */ 124/* Master MADT */
137 125
138struct multiple_apic_table 126struct multiple_apic_table {
139{ 127 ACPI_TABLE_HEADER_DEF /* ACPI common table header */
140 ACPI_TABLE_HEADER_DEF /* ACPI common table header */ 128 u32 local_apic_address; /* Physical address of local APIC */
141 u32 local_apic_address; /* Physical address of local APIC */ 129
142 u32 PCATcompat : 1; /* A one indicates system also has dual 8259s */ 130 /* Flags (32 bits) */
143 u32 reserved1 : 31; 131
132 u8 PCATcompat:1; /* 00: System also has dual 8259s */
133 u8:7; /* 01-07: Reserved, must be zero */
134 u8 reserved1[3]; /* 08-31: Reserved, must be zero */
144}; 135};
145 136
146/* Values for Type in APIC_HEADER_DEF */ 137/* Values for Type in APIC_HEADER_DEF */
@@ -154,7 +145,7 @@ struct multiple_apic_table
154#define APIC_IO_SAPIC 6 145#define APIC_IO_SAPIC 6
155#define APIC_LOCAL_SAPIC 7 146#define APIC_LOCAL_SAPIC 7
156#define APIC_XRUPT_SOURCE 8 147#define APIC_XRUPT_SOURCE 8
157#define APIC_RESERVED 9 /* 9 and greater are reserved */ 148#define APIC_RESERVED 9 /* 9 and greater are reserved */
158 149
159/* 150/*
160 * MADT sub-structures (Follow MULTIPLE_APIC_DESCRIPTION_TABLE) 151 * MADT sub-structures (Follow MULTIPLE_APIC_DESCRIPTION_TABLE)
@@ -163,10 +154,8 @@ struct multiple_apic_table
163 u8 type; \ 154 u8 type; \
164 u8 length; 155 u8 length;
165 156
166struct apic_header 157struct apic_header {
167{ 158APIC_HEADER_DEF};
168 APIC_HEADER_DEF
169};
170 159
171/* Values for MPS INTI flags */ 160/* Values for MPS INTI flags */
172 161
@@ -180,117 +169,90 @@ struct apic_header
180#define TRIGGER_RESERVED 2 169#define TRIGGER_RESERVED 2
181#define TRIGGER_LEVEL 3 170#define TRIGGER_LEVEL 3
182 171
183/* Common flag definitions */ 172/* Common flag definitions (16 bits each) */
184 173
185#define MPS_INTI_FLAGS \ 174#define MPS_INTI_FLAGS \
186 u16 polarity : 2; /* Polarity of APIC I/O input signals */\ 175 u8 polarity : 2; /* 00-01: Polarity of APIC I/O input signals */\
187 u16 trigger_mode : 2; /* Trigger mode of APIC input signals */\ 176 u8 trigger_mode : 2; /* 02-03: Trigger mode of APIC input signals */\
188 u16 reserved1 : 12; /* Reserved, must be zero */ 177 u8 : 4; /* 04-07: Reserved, must be zero */\
178 u8 reserved1; /* 08-15: Reserved, must be zero */
189 179
190#define LOCAL_APIC_FLAGS \ 180#define LOCAL_APIC_FLAGS \
191 u32 processor_enabled: 1; /* Processor is usable if set */\ 181 u8 processor_enabled: 1; /* 00: Processor is usable if set */\
192 u32 reserved2 : 31; /* Reserved, must be zero */ 182 u8 : 7; /* 01-07: Reserved, must be zero */\
183 u8 reserved2; /* 08-15: Reserved, must be zero */
193 184
194/* Sub-structures for MADT */ 185/* Sub-structures for MADT */
195 186
196struct madt_processor_apic 187struct madt_processor_apic {
197{ 188 APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */
198 APIC_HEADER_DEF 189 u8 local_apic_id; /* Processor's local APIC id */
199 u8 processor_id; /* ACPI processor id */ 190 LOCAL_APIC_FLAGS};
200 u8 local_apic_id; /* Processor's local APIC id */ 191
201 LOCAL_APIC_FLAGS 192struct madt_io_apic {
202}; 193 APIC_HEADER_DEF u8 io_apic_id; /* I/O APIC ID */
203 194 u8 reserved; /* Reserved - must be zero */
204struct madt_io_apic 195 u32 address; /* APIC physical address */
205{ 196 u32 interrupt; /* Global system interrupt where INTI
206 APIC_HEADER_DEF 197 * lines start */
207 u8 io_apic_id; /* I/O APIC ID */
208 u8 reserved; /* Reserved - must be zero */
209 u32 address; /* APIC physical address */
210 u32 interrupt; /* Global system interrupt where INTI
211 * lines start */
212}; 198};
213 199
214struct madt_interrupt_override 200struct madt_interrupt_override {
215{ 201 APIC_HEADER_DEF u8 bus; /* 0 - ISA */
216 APIC_HEADER_DEF 202 u8 source; /* Interrupt source (IRQ) */
217 u8 bus; /* 0 - ISA */ 203 u32 interrupt; /* Global system interrupt */
218 u8 source; /* Interrupt source (IRQ) */ 204 MPS_INTI_FLAGS};
219 u32 interrupt; /* Global system interrupt */
220 MPS_INTI_FLAGS
221};
222 205
223struct madt_nmi_source 206struct madt_nmi_source {
224{ 207 APIC_HEADER_DEF MPS_INTI_FLAGS u32 interrupt; /* Global system interrupt */
225 APIC_HEADER_DEF
226 MPS_INTI_FLAGS
227 u32 interrupt; /* Global system interrupt */
228}; 208};
229 209
230struct madt_local_apic_nmi 210struct madt_local_apic_nmi {
231{ 211 APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */
232 APIC_HEADER_DEF 212 MPS_INTI_FLAGS u8 lint; /* LINTn to which NMI is connected */
233 u8 processor_id; /* ACPI processor id */
234 MPS_INTI_FLAGS
235 u8 lint; /* LINTn to which NMI is connected */
236}; 213};
237 214
238struct madt_address_override 215struct madt_address_override {
239{ 216 APIC_HEADER_DEF u16 reserved; /* Reserved, must be zero */
240 APIC_HEADER_DEF 217 u64 address; /* APIC physical address */
241 u16 reserved; /* Reserved - must be zero */
242 u64 address; /* APIC physical address */
243}; 218};
244 219
245struct madt_io_sapic 220struct madt_io_sapic {
246{ 221 APIC_HEADER_DEF u8 io_sapic_id; /* I/O SAPIC ID */
247 APIC_HEADER_DEF 222 u8 reserved; /* Reserved, must be zero */
248 u8 io_sapic_id; /* I/O SAPIC ID */ 223 u32 interrupt_base; /* Glocal interrupt for SAPIC start */
249 u8 reserved; /* Reserved - must be zero */ 224 u64 address; /* SAPIC physical address */
250 u32 interrupt_base; /* Glocal interrupt for SAPIC start */
251 u64 address; /* SAPIC physical address */
252}; 225};
253 226
254struct madt_local_sapic 227struct madt_local_sapic {
255{ 228 APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */
256 APIC_HEADER_DEF 229 u8 local_sapic_id; /* SAPIC ID */
257 u8 processor_id; /* ACPI processor id */ 230 u8 local_sapic_eid; /* SAPIC EID */
258 u8 local_sapic_id; /* SAPIC ID */ 231 u8 reserved[3]; /* Reserved, must be zero */
259 u8 local_sapic_eid; /* SAPIC EID */ 232 LOCAL_APIC_FLAGS u32 processor_uID; /* Numeric UID - ACPI 3.0 */
260 u8 reserved [3]; /* Reserved - must be zero */ 233 char processor_uIDstring[1]; /* String UID - ACPI 3.0 */
261 LOCAL_APIC_FLAGS
262 u32 processor_uID; /* Numeric UID - ACPI 3.0 */
263 char processor_uIDstring[1]; /* String UID - ACPI 3.0 */
264}; 234};
265 235
266struct madt_interrupt_source 236struct madt_interrupt_source {
267{ 237 APIC_HEADER_DEF MPS_INTI_FLAGS u8 interrupt_type; /* 1=PMI, 2=INIT, 3=corrected */
268 APIC_HEADER_DEF 238 u8 processor_id; /* Processor ID */
269 MPS_INTI_FLAGS 239 u8 processor_eid; /* Processor EID */
270 u8 interrupt_type; /* 1=PMI, 2=INIT, 3=corrected */ 240 u8 io_sapic_vector; /* Vector value for PMI interrupts */
271 u8 processor_id; /* Processor ID */ 241 u32 interrupt; /* Global system interrupt */
272 u8 processor_eid; /* Processor EID */ 242 u32 flags; /* Interrupt Source Flags */
273 u8 io_sapic_vector; /* Vector value for PMI interrupts */
274 u32 interrupt; /* Global system interrupt */
275 u32 flags; /* Interrupt Source Flags */
276}; 243};
277 244
278
279/* 245/*
280 * Smart Battery 246 * Smart Battery
281 */ 247 */
282struct smart_battery_table 248struct smart_battery_table {
283{ 249 ACPI_TABLE_HEADER_DEF u32 warning_level;
284 ACPI_TABLE_HEADER_DEF 250 u32 low_level;
285 u32 warning_level; 251 u32 critical_level;
286 u32 low_level;
287 u32 critical_level;
288}; 252};
289 253
290
291#pragma pack() 254#pragma pack()
292 255
293
294/* 256/*
295 * ACPI Table information. We save the table address, length, 257 * ACPI Table information. We save the table address, length,
296 * and type of memory allocation (mapped or allocated) for each 258 * and type of memory allocation (mapped or allocated) for each
@@ -314,39 +276,35 @@ struct smart_battery_table
314 276
315/* Data about each known table type */ 277/* Data about each known table type */
316 278
317struct acpi_table_support 279struct acpi_table_support {
318{ 280 char *name;
319 char *name; 281 char *signature;
320 char *signature; 282 void **global_ptr;
321 void **global_ptr; 283 u8 sig_length;
322 u8 sig_length; 284 u8 flags;
323 u8 flags;
324}; 285};
325 286
326
327/* 287/*
328 * Get the ACPI version-specific tables 288 * Get the ACPI version-specific tables
329 */ 289 */
330#include "actbl1.h" /* Acpi 1.0 table definitions */ 290#include "actbl1.h" /* Acpi 1.0 table definitions */
331#include "actbl2.h" /* Acpi 2.0 table definitions */ 291#include "actbl2.h" /* Acpi 2.0 table definitions */
332 292
333extern u8 acpi_fadt_is_v1; /* is set to 1 if FADT is revision 1, 293extern u8 acpi_fadt_is_v1; /* is set to 1 if FADT is revision 1,
334 * needed for certain workarounds */ 294 * needed for certain workarounds */
335 295
336#pragma pack(1) 296#pragma pack(1)
337/* 297/*
338 * High performance timer 298 * High performance timer
339 */ 299 */
340struct hpet_table 300struct hpet_table {
341{ 301 ACPI_TABLE_HEADER_DEF u32 hardware_id;
342 ACPI_TABLE_HEADER_DEF 302 struct acpi_generic_address base_address;
343 u32 hardware_id; 303 u8 hpet_number;
344 struct acpi_generic_address base_address; 304 u16 clock_tick;
345 u8 hpet_number; 305 u8 attributes;
346 u16 clock_tick;
347 u8 attributes;
348}; 306};
349 307
350#pragma pack() 308#pragma pack()
351 309
352#endif /* __ACTBL_H__ */ 310#endif /* __ACTBL_H__ */
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
index 33de5f4d2ccc..67312c3a915a 100644
--- a/include/acpi/actbl1.h
+++ b/include/acpi/actbl1.h
@@ -49,88 +49,87 @@
49/* 49/*
50 * ACPI 1.0 Root System Description Table (RSDT) 50 * ACPI 1.0 Root System Description Table (RSDT)
51 */ 51 */
52struct rsdt_descriptor_rev1 52struct rsdt_descriptor_rev1 {
53{ 53 ACPI_TABLE_HEADER_DEF /* ACPI common table header */
54 ACPI_TABLE_HEADER_DEF /* ACPI common table header */ 54 u32 table_offset_entry[1]; /* Array of pointers to ACPI tables */
55 u32 table_offset_entry [1]; /* Array of pointers to other */
56 /* ACPI tables */
57}; 55};
58 56
59
60/* 57/*
61 * ACPI 1.0 Firmware ACPI Control Structure (FACS) 58 * ACPI 1.0 Firmware ACPI Control Structure (FACS)
62 */ 59 */
63struct facs_descriptor_rev1 60struct facs_descriptor_rev1 {
64{ 61 char signature[4]; /* ASCII table signature */
65 char signature[4]; /* ACPI Signature */ 62 u32 length; /* Length of structure in bytes */
66 u32 length; /* Length of structure, in bytes */ 63 u32 hardware_signature; /* Hardware configuration signature */
67 u32 hardware_signature; /* Hardware configuration signature */ 64 u32 firmware_waking_vector; /* ACPI OS waking vector */
68 u32 firmware_waking_vector; /* ACPI OS waking vector */ 65 u32 global_lock; /* Global Lock */
69 u32 global_lock; /* Global Lock */ 66
70 u32 S4bios_f : 1; /* Indicates if S4BIOS support is present */ 67 /* Flags (32 bits) */
71 u32 reserved1 : 31; /* Must be 0 */
72 u8 resverved3 [40]; /* Reserved - must be zero */
73};
74 68
69 u8 S4bios_f:1; /* 00: S4BIOS support is present */
70 u8:7; /* 01-07: Reserved, must be zero */
71 u8 reserved1[3]; /* 08-31: Reserved, must be zero */
72
73 u8 reserved2[40]; /* Reserved, must be zero */
74};
75 75
76/* 76/*
77 * ACPI 1.0 Fixed ACPI Description Table (FADT) 77 * ACPI 1.0 Fixed ACPI Description Table (FADT)
78 */ 78 */
79struct fadt_descriptor_rev1 79struct fadt_descriptor_rev1 {
80{ 80 ACPI_TABLE_HEADER_DEF /* ACPI common table header */
81 ACPI_TABLE_HEADER_DEF /* ACPI common table header */ 81 u32 firmware_ctrl; /* Physical address of FACS */
82 u32 firmware_ctrl; /* Physical address of FACS */ 82 u32 dsdt; /* Physical address of DSDT */
83 u32 dsdt; /* Physical address of DSDT */ 83 u8 model; /* System Interrupt Model */
84 u8 model; /* System Interrupt Model */ 84 u8 reserved1; /* Reserved, must be zero */
85 u8 reserved1; /* Reserved */ 85 u16 sci_int; /* System vector of SCI interrupt */
86 u16 sci_int; /* System vector of SCI interrupt */ 86 u32 smi_cmd; /* Port address of SMI command port */
87 u32 smi_cmd; /* Port address of SMI command port */ 87 u8 acpi_enable; /* Value to write to smi_cmd to enable ACPI */
88 u8 acpi_enable; /* Value to write to smi_cmd to enable ACPI */ 88 u8 acpi_disable; /* Value to write to smi_cmd to disable ACPI */
89 u8 acpi_disable; /* Value to write to smi_cmd to disable ACPI */ 89 u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */
90 u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */ 90 u8 reserved2; /* Reserved, must be zero */
91 u8 reserved2; /* Reserved - must be zero */ 91 u32 pm1a_evt_blk; /* Port address of Power Mgt 1a acpi_event Reg Blk */
92 u32 pm1a_evt_blk; /* Port address of Power Mgt 1a acpi_event Reg Blk */ 92 u32 pm1b_evt_blk; /* Port address of Power Mgt 1b acpi_event Reg Blk */
93 u32 pm1b_evt_blk; /* Port address of Power Mgt 1b acpi_event Reg Blk */ 93 u32 pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */
94 u32 pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */ 94 u32 pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */
95 u32 pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */ 95 u32 pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */
96 u32 pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */ 96 u32 pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */
97 u32 pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ 97 u32 gpe0_blk; /* Port addr of General Purpose acpi_event 0 Reg Blk */
98 u32 gpe0_blk; /* Port addr of General Purpose acpi_event 0 Reg Blk */ 98 u32 gpe1_blk; /* Port addr of General Purpose acpi_event 1 Reg Blk */
99 u32 gpe1_blk; /* Port addr of General Purpose acpi_event 1 Reg Blk */ 99 u8 pm1_evt_len; /* Byte length of ports at pm1_x_evt_blk */
100 u8 pm1_evt_len; /* Byte length of ports at pm1_x_evt_blk */ 100 u8 pm1_cnt_len; /* Byte length of ports at pm1_x_cnt_blk */
101 u8 pm1_cnt_len; /* Byte length of ports at pm1_x_cnt_blk */ 101 u8 pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */
102 u8 pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */ 102 u8 pm_tm_len; /* Byte Length of ports at pm_tm_blk */
103 u8 pm_tm_len; /* Byte Length of ports at pm_tm_blk */ 103 u8 gpe0_blk_len; /* Byte Length of ports at gpe0_blk */
104 u8 gpe0_blk_len; /* Byte Length of ports at gpe0_blk */ 104 u8 gpe1_blk_len; /* Byte Length of ports at gpe1_blk */
105 u8 gpe1_blk_len; /* Byte Length of ports at gpe1_blk */ 105 u8 gpe1_base; /* Offset in gpe model where gpe1 events start */
106 u8 gpe1_base; /* Offset in gpe model where gpe1 events start */ 106 u8 reserved3; /* Reserved, must be zero */
107 u8 reserved3; /* Reserved */ 107 u16 plvl2_lat; /* Worst case HW latency to enter/exit C2 state */
108 u16 plvl2_lat; /* Worst case HW latency to enter/exit C2 state */ 108 u16 plvl3_lat; /* Worst case HW latency to enter/exit C3 state */
109 u16 plvl3_lat; /* Worst case HW latency to enter/exit C3 state */ 109 u16 flush_size; /* Size of area read to flush caches */
110 u16 flush_size; /* Size of area read to flush caches */ 110 u16 flush_stride; /* Stride used in flushing caches */
111 u16 flush_stride; /* Stride used in flushing caches */ 111 u8 duty_offset; /* Bit location of duty cycle field in p_cnt reg */
112 u8 duty_offset; /* Bit location of duty cycle field in p_cnt reg */ 112 u8 duty_width; /* Bit width of duty cycle field in p_cnt reg */
113 u8 duty_width; /* Bit width of duty cycle field in p_cnt reg */ 113 u8 day_alrm; /* Index to day-of-month alarm in RTC CMOS RAM */
114 u8 day_alrm; /* Index to day-of-month alarm in RTC CMOS RAM */ 114 u8 mon_alrm; /* Index to month-of-year alarm in RTC CMOS RAM */
115 u8 mon_alrm; /* Index to month-of-year alarm in RTC CMOS RAM */ 115 u8 century; /* Index to century in RTC CMOS RAM */
116 u8 century; /* Index to century in RTC CMOS RAM */ 116 u8 reserved4[3]; /* Reserved, must be zero */
117 u8 reserved4; /* Reserved */
118 u8 reserved4a; /* Reserved */
119 u8 reserved4b; /* Reserved */
120 u32 wb_invd : 1; /* The wbinvd instruction works properly */
121 u32 wb_invd_flush : 1; /* The wbinvd flushes but does not invalidate */
122 u32 proc_c1 : 1; /* All processors support C1 state */
123 u32 plvl2_up : 1; /* C2 state works on MP system */
124 u32 pwr_button : 1; /* Power button is handled as a generic feature */
125 u32 sleep_button : 1; /* Sleep button is handled as a generic feature, or not present */
126 u32 fixed_rTC : 1; /* RTC wakeup stat not in fixed register space */
127 u32 rtcs4 : 1; /* RTC wakeup stat not possible from S4 */
128 u32 tmr_val_ext : 1; /* The tmr_val width is 32 bits (0 = 24 bits) */
129 u32 reserved5 : 23; /* Reserved - must be zero */
130};
131 117
132#pragma pack() 118 /* Flags (32 bits) */
133 119
134#endif /* __ACTBL1_H__ */ 120 u8 wb_invd:1; /* 00: The wbinvd instruction works properly */
121 u8 wb_invd_flush:1; /* 01: The wbinvd flushes but does not invalidate */
122 u8 proc_c1:1; /* 02: All processors support C1 state */
123 u8 plvl2_up:1; /* 03: C2 state works on MP system */
124 u8 pwr_button:1; /* 04: Power button is handled as a generic feature */
125 u8 sleep_button:1; /* 05: Sleep button is handled as a generic feature, or not present */
126 u8 fixed_rTC:1; /* 06: RTC wakeup stat not in fixed register space */
127 u8 rtcs4:1; /* 07: RTC wakeup stat not possible from S4 */
128 u8 tmr_val_ext:1; /* 08: tmr_val width is 32 bits (0 = 24 bits) */
129 u8:7; /* 09-15: Reserved, must be zero */
130 u8 reserved5[2]; /* 16-31: Reserved, must be zero */
131};
135 132
133#pragma pack()
136 134
135#endif /* __ACTBL1_H__ */
diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index e1729c967e05..50305ce2681a 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -64,62 +64,56 @@
64#define FADT2_REVISION_ID 3 64#define FADT2_REVISION_ID 3
65#define FADT2_MINUS_REVISION_ID 2 65#define FADT2_MINUS_REVISION_ID 2
66 66
67
68#pragma pack(1) 67#pragma pack(1)
69 68
70/* 69/*
71 * ACPI 2.0 Root System Description Table (RSDT) 70 * ACPI 2.0 Root System Description Table (RSDT)
72 */ 71 */
73struct rsdt_descriptor_rev2 72struct rsdt_descriptor_rev2 {
74{ 73 ACPI_TABLE_HEADER_DEF /* ACPI common table header */
75 ACPI_TABLE_HEADER_DEF /* ACPI common table header */ 74 u32 table_offset_entry[1]; /* Array of pointers to ACPI tables */
76 u32 table_offset_entry [1]; /* Array of pointers to */
77 /* ACPI table headers */
78}; 75};
79 76
80
81/* 77/*
82 * ACPI 2.0 Extended System Description Table (XSDT) 78 * ACPI 2.0 Extended System Description Table (XSDT)
83 */ 79 */
84struct xsdt_descriptor_rev2 80struct xsdt_descriptor_rev2 {
85{ 81 ACPI_TABLE_HEADER_DEF /* ACPI common table header */
86 ACPI_TABLE_HEADER_DEF /* ACPI common table header */ 82 u64 table_offset_entry[1]; /* Array of pointers to ACPI tables */
87 u64 table_offset_entry [1]; /* Array of pointers to */
88 /* ACPI table headers */
89}; 83};
90 84
91
92/* 85/*
93 * ACPI 2.0 Firmware ACPI Control Structure (FACS) 86 * ACPI 2.0 Firmware ACPI Control Structure (FACS)
94 */ 87 */
95struct facs_descriptor_rev2 88struct facs_descriptor_rev2 {
96{ 89 char signature[4]; /* ASCII table signature */
97 char signature[4]; /* ACPI signature */ 90 u32 length; /* Length of structure, in bytes */
98 u32 length; /* Length of structure, in bytes */ 91 u32 hardware_signature; /* Hardware configuration signature */
99 u32 hardware_signature; /* Hardware configuration signature */ 92 u32 firmware_waking_vector; /* 32-bit physical address of the Firmware Waking Vector. */
100 u32 firmware_waking_vector; /* 32bit physical address of the Firmware Waking Vector. */ 93 u32 global_lock; /* Global Lock used to synchronize access to shared hardware resources */
101 u32 global_lock; /* Global Lock used to synchronize access to shared hardware resources */ 94
102 u32 S4bios_f : 1; /* S4Bios_f - Indicates if S4BIOS support is present */ 95 /* Flags (32 bits) */
103 u32 reserved1 : 31; /* Must be 0 */ 96
104 u64 xfirmware_waking_vector; /* 64bit physical address of the Firmware Waking Vector. */ 97 u8 S4bios_f:1; /* 00: S4BIOS support is present */
105 u8 version; /* Version of this table */ 98 u8:7; /* 01-07: Reserved, must be zero */
106 u8 reserved3 [31]; /* 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 */
107}; 104};
108 105
109
110/* 106/*
111 * ACPI 2.0+ Generic Address Structure (GAS) 107 * ACPI 2.0+ Generic Address Structure (GAS)
112 */ 108 */
113struct acpi_generic_address 109struct acpi_generic_address {
114{ 110 u8 address_space_id; /* Address space where struct or register exists. */
115 u8 address_space_id; /* Address space where struct or register exists. */ 111 u8 register_bit_width; /* Size in bits of given register */
116 u8 register_bit_width; /* Size in bits of given register */ 112 u8 register_bit_offset; /* Bit offset within the register */
117 u8 register_bit_offset; /* Bit offset within the register */ 113 u8 access_width; /* Minimum Access size (ACPI 3.0) */
118 u8 access_width; /* Minimum Access size (ACPI 3.0) */ 114 u64 address; /* 64-bit address of struct or register */
119 u64 address; /* 64-bit address of struct or register */
120}; 115};
121 116
122
123#define FADT_REV2_COMMON \ 117#define FADT_REV2_COMMON \
124 u32 V1_firmware_ctrl; /* 32-bit physical address of FACS */ \ 118 u32 V1_firmware_ctrl; /* 32-bit physical address of FACS */ \
125 u32 V1_dsdt; /* 32-bit physical address of DSDT */ \ 119 u32 V1_dsdt; /* 32-bit physical address of DSDT */ \
@@ -161,129 +155,123 @@ struct acpi_generic_address
161/* 155/*
162 * ACPI 2.0+ Fixed ACPI Description Table (FADT) 156 * ACPI 2.0+ Fixed ACPI Description Table (FADT)
163 */ 157 */
164struct fadt_descriptor_rev2 158struct fadt_descriptor_rev2 {
165{ 159 ACPI_TABLE_HEADER_DEF /* ACPI common table header */
166 ACPI_TABLE_HEADER_DEF /* ACPI common table header */ 160 FADT_REV2_COMMON u8 reserved2; /* Reserved, must be zero */
167 FADT_REV2_COMMON 161
168 u8 reserved2; /* Reserved */ 162 /* Flags (32 bits) */
169 u32 wb_invd : 1; /* The wbinvd instruction works properly */ 163
170 u32 wb_invd_flush : 1; /* The wbinvd flushes but does not invalidate */ 164 u8 wb_invd:1; /* 00: The wbinvd instruction works properly */
171 u32 proc_c1 : 1; /* All processors support C1 state */ 165 u8 wb_invd_flush:1; /* 01: The wbinvd flushes but does not invalidate */
172 u32 plvl2_up : 1; /* C2 state works on MP system */ 166 u8 proc_c1:1; /* 02: All processors support C1 state */
173 u32 pwr_button : 1; /* Power button is handled as a generic feature */ 167 u8 plvl2_up:1; /* 03: C2 state works on MP system */
174 u32 sleep_button : 1; /* Sleep button is handled as a generic feature, or not present */ 168 u8 pwr_button:1; /* 04: Power button is handled as a generic feature */
175 u32 fixed_rTC : 1; /* RTC wakeup stat not in fixed register space */ 169 u8 sleep_button:1; /* 05: Sleep button is handled as a generic feature, or not present */
176 u32 rtcs4 : 1; /* RTC wakeup stat not possible from S4 */ 170 u8 fixed_rTC:1; /* 06: RTC wakeup stat not in fixed register space */
177 u32 tmr_val_ext : 1; /* Indicates tmr_val is 32 bits 0=24-bits */ 171 u8 rtcs4:1; /* 07: RTC wakeup stat not possible from S4 */
178 u32 dock_cap : 1; /* Supports Docking */ 172 u8 tmr_val_ext:1; /* 08: tmr_val is 32 bits 0=24-bits */
179 u32 reset_reg_sup : 1; /* Indicates system supports system reset via the FADT RESET_REG */ 173 u8 dock_cap:1; /* 09: Docking supported */
180 u32 sealed_case : 1; /* Indicates system has no internal expansion capabilities and case is sealed */ 174 u8 reset_reg_sup:1; /* 10: System reset via the FADT RESET_REG supported */
181 u32 headless : 1; /* Indicates system does not have local video capabilities or local input devices */ 175 u8 sealed_case:1; /* 11: No internal expansion capabilities and case is sealed */
182 u32 cpu_sw_sleep : 1; /* Indicates to OSPM that a processor native instruction */ 176 u8 headless:1; /* 12: No local video capabilities or local input devices */
183 /* must be executed after writing the SLP_TYPx register */ 177 u8 cpu_sw_sleep:1; /* 13: Must execute native instruction after writing SLP_TYPx register */
184 /* ACPI 3.0 flag bits */ 178
185 179 u8 pci_exp_wak:1; /* 14: System supports PCIEXP_WAKE (STS/EN) bits (ACPI 3.0) */
186 u32 pci_exp_wak : 1; /* System supports PCIEXP_WAKE (STS/EN) bits */ 180 u8 use_platform_clock:1; /* 15: OSPM should use platform-provided timer (ACPI 3.0) */
187 u32 use_platform_clock : 1; /* OSPM should use platform-provided timer */ 181 u8 S4rtc_sts_valid:1; /* 16: Contents of RTC_STS valid after S4 wake (ACPI 3.0) */
188 u32 S4rtc_sts_valid : 1; /* Contents of RTC_STS valid after S4 wake */ 182 u8 remote_power_on_capable:1; /* 17: System is compatible with remote power on (ACPI 3.0) */
189 u32 remote_power_on_capable : 1; /* System is compatible with remote power on */ 183 u8 force_apic_cluster_model:1; /* 18: All local APICs must use cluster model (ACPI 3.0) */
190 u32 force_apic_cluster_model : 1; /* All local APICs must use cluster model */ 184 u8 force_apic_physical_destination_mode:1; /* 19: all local x_aPICs must use physical dest mode (ACPI 3.0) */
191 u32 force_apic_physical_destination_mode : 1; /* all local x_aPICs must use physical dest mode */ 185 u8:4; /* 20-23: Reserved, must be zero */
192 u32 reserved6 : 12;/* Reserved - must be zero */ 186 u8 reserved3; /* 24-31: Reserved, must be zero */
193 187
194 struct acpi_generic_address reset_register; /* Reset register address in GAS format */ 188 struct acpi_generic_address reset_register; /* Reset register address in GAS format */
195 u8 reset_value; /* Value to write to the reset_register port to reset the system */ 189 u8 reset_value; /* Value to write to the reset_register port to reset the system */
196 u8 reserved7[3]; /* These three bytes must be zero */ 190 u8 reserved4[3]; /* These three bytes must be zero */
197 u64 xfirmware_ctrl; /* 64-bit physical address of FACS */ 191 u64 xfirmware_ctrl; /* 64-bit physical address of FACS */
198 u64 Xdsdt; /* 64-bit physical address of DSDT */ 192 u64 Xdsdt; /* 64-bit physical address of DSDT */
199 struct acpi_generic_address xpm1a_evt_blk; /* Extended Power Mgt 1a acpi_event Reg Blk address */ 193 struct acpi_generic_address xpm1a_evt_blk; /* Extended Power Mgt 1a acpi_event Reg Blk address */
200 struct acpi_generic_address xpm1b_evt_blk; /* Extended Power Mgt 1b acpi_event Reg Blk address */ 194 struct acpi_generic_address xpm1b_evt_blk; /* Extended Power Mgt 1b acpi_event Reg Blk address */
201 struct acpi_generic_address xpm1a_cnt_blk; /* Extended Power Mgt 1a Control Reg Blk address */ 195 struct acpi_generic_address xpm1a_cnt_blk; /* Extended Power Mgt 1a Control Reg Blk address */
202 struct acpi_generic_address xpm1b_cnt_blk; /* Extended Power Mgt 1b Control Reg Blk address */ 196 struct acpi_generic_address xpm1b_cnt_blk; /* Extended Power Mgt 1b Control Reg Blk address */
203 struct acpi_generic_address xpm2_cnt_blk; /* Extended Power Mgt 2 Control Reg Blk address */ 197 struct acpi_generic_address xpm2_cnt_blk; /* Extended Power Mgt 2 Control Reg Blk address */
204 struct acpi_generic_address xpm_tmr_blk; /* Extended Power Mgt Timer Ctrl Reg Blk address */ 198 struct acpi_generic_address xpm_tmr_blk; /* Extended Power Mgt Timer Ctrl Reg Blk address */
205 struct acpi_generic_address xgpe0_blk; /* Extended General Purpose acpi_event 0 Reg Blk address */ 199 struct acpi_generic_address xgpe0_blk; /* Extended General Purpose acpi_event 0 Reg Blk address */
206 struct acpi_generic_address xgpe1_blk; /* Extended General Purpose acpi_event 1 Reg Blk address */ 200 struct acpi_generic_address xgpe1_blk; /* Extended General Purpose acpi_event 1 Reg Blk address */
207}; 201};
208 202
209
210/* "Down-revved" ACPI 2.0 FADT descriptor */ 203/* "Down-revved" ACPI 2.0 FADT descriptor */
211 204
212struct fadt_descriptor_rev2_minus 205struct fadt_descriptor_rev2_minus {
213{ 206 ACPI_TABLE_HEADER_DEF /* ACPI common table header */
214 ACPI_TABLE_HEADER_DEF /* ACPI common table header */ 207 FADT_REV2_COMMON u8 reserved2; /* Reserved, must be zero */
215 FADT_REV2_COMMON 208 u32 flags;
216 u8 reserved2; /* Reserved */ 209 struct acpi_generic_address reset_register; /* Reset register address in GAS format */
217 u32 flags; 210 u8 reset_value; /* Value to write to the reset_register port to reset the system. */
218 struct acpi_generic_address reset_register; /* Reset register address in GAS format */ 211 u8 reserved7[3]; /* Reserved, must be zero */
219 u8 reset_value; /* Value to write to the reset_register port to reset the system. */
220 u8 reserved7[3]; /* These three bytes must be zero */
221}; 212};
222 213
223
224/* ECDT - Embedded Controller Boot Resources Table */ 214/* ECDT - Embedded Controller Boot Resources Table */
225 215
226struct ec_boot_resources 216struct ec_boot_resources {
227{ 217 ACPI_TABLE_HEADER_DEF struct acpi_generic_address ec_control; /* Address of EC command/status register */
228 ACPI_TABLE_HEADER_DEF 218 struct acpi_generic_address ec_data; /* Address of EC data register */
229 struct acpi_generic_address ec_control; /* Address of EC command/status register */ 219 u32 uid; /* Unique ID - must be same as the EC _UID method */
230 struct acpi_generic_address ec_data; /* Address of EC data register */ 220 u8 gpe_bit; /* The GPE for the EC */
231 u32 uid; /* Unique ID - must be same as the EC _UID method */ 221 u8 ec_id[1]; /* Full namepath of the EC in the ACPI namespace */
232 u8 gpe_bit; /* The GPE for the EC */
233 u8 ec_id[1]; /* Full namepath of the EC in the ACPI namespace */
234}; 222};
235 223
236
237/* SRAT - System Resource Affinity Table */ 224/* SRAT - System Resource Affinity Table */
238 225
239struct static_resource_alloc 226struct static_resource_alloc {
240{ 227 u8 type;
241 u8 type; 228 u8 length;
242 u8 length; 229 u8 proximity_domain_lo;
243 u8 proximity_domain_lo; 230 u8 apic_id;
244 u8 apic_id;
245 u32 enabled :1;
246 u32 reserved3 :31;
247 u8 local_sapic_eid;
248 u8 proximity_domain_hi[3];
249 u32 reserved4;
250};
251 231
252struct memory_affinity 232 /* Flags (32 bits) */
253{ 233
254 u8 type; 234 u8 enabled:1; /* 00: Use affinity structure */
255 u8 length; 235 u8:7; /* 01-07: Reserved, must be zero */
256 u32 proximity_domain; 236 u8 reserved3[3]; /* 08-31: Reserved, must be zero */
257 u16 reserved3; 237
258 u64 base_address; 238 u8 local_sapic_eid;
259 u64 address_length; 239 u8 proximity_domain_hi[3];
260 u32 reserved4; 240 u32 reserved4; /* Reserved, must be zero */
261 u32 enabled :1;
262 u32 hot_pluggable :1;
263 u32 non_volatile :1;
264 u32 reserved5 :29;
265 u64 reserved6;
266}; 241};
267 242
268struct system_resource_affinity 243struct memory_affinity {
269{ 244 u8 type;
270 ACPI_TABLE_HEADER_DEF 245 u8 length;
271 u32 reserved1; /* Must be value '1' */ 246 u32 proximity_domain;
272 u64 reserved2; 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 */
273}; 261};
274 262
263struct system_resource_affinity {
264 ACPI_TABLE_HEADER_DEF u32 reserved1; /* Must be value '1' */
265 u64 reserved2; /* Reserved, must be zero */
266};
275 267
276/* SLIT - System Locality Distance Information Table */ 268/* SLIT - System Locality Distance Information Table */
277 269
278struct system_locality_info 270struct system_locality_info {
279{ 271 ACPI_TABLE_HEADER_DEF u64 locality_count;
280 ACPI_TABLE_HEADER_DEF 272 u8 entry[1][1];
281 u64 locality_count;
282 u8 entry[1][1];
283}; 273};
284 274
285
286#pragma pack() 275#pragma pack()
287 276
288#endif /* __ACTBL2_H__ */ 277#endif /* __ACTBL2_H__ */
289
diff --git a/include/acpi/actbl71.h b/include/acpi/actbl71.h
index 7b4fb44261f3..10ac05bb36bc 100644
--- a/include/acpi/actbl71.h
+++ b/include/acpi/actbl71.h
@@ -27,7 +27,6 @@
27#ifndef __ACTBL71_H__ 27#ifndef __ACTBL71_H__
28#define __ACTBL71_H__ 28#define __ACTBL71_H__
29 29
30
31/* 0.71 FADT address_space data item bitmasks defines */ 30/* 0.71 FADT address_space data item bitmasks defines */
32/* If the associated bit is zero then it is in memory space else in io space */ 31/* If the associated bit is zero then it is in memory space else in io space */
33 32
@@ -40,105 +39,96 @@
40 39
41/* Only for clarity in declarations */ 40/* Only for clarity in declarations */
42 41
43typedef u64 IO_ADDRESS; 42typedef u64 IO_ADDRESS;
44
45 43
46#pragma pack(1) 44#pragma pack(1)
47struct /* Root System Descriptor Pointer */ 45struct { /* Root System Descriptor Pointer */
48{ 46 NATIVE_CHAR signature[8]; /* contains "RSD PTR " */
49 NATIVE_CHAR signature [8]; /* contains "RSD PTR " */ 47 u8 checksum; /* to make sum of struct == 0 */
50 u8 checksum; /* to make sum of struct == 0 */ 48 NATIVE_CHAR oem_id[6]; /* OEM identification */
51 NATIVE_CHAR oem_id [6]; /* OEM identification */ 49 u8 reserved; /* Must be 0 for 1.0, 2 for 2.0 */
52 u8 reserved; /* Must be 0 for 1.0, 2 for 2.0 */ 50 u64 rsdt_physical_address; /* 64-bit physical address of RSDT */
53 u64 rsdt_physical_address; /* 64-bit physical address of RSDT */
54}; 51};
55 52
56
57/*****************************************/ 53/*****************************************/
58/* IA64 Extensions to ACPI Spec Rev 0.71 */ 54/* IA64 Extensions to ACPI Spec Rev 0.71 */
59/* for the Root System Description Table */ 55/* for the Root System Description Table */
60/*****************************************/ 56/*****************************************/
61struct 57struct {
62{ 58 struct acpi_table_header header; /* Table header */
63 struct acpi_table_header header; /* Table header */ 59 u32 reserved_pad; /* IA64 alignment, must be 0 */
64 u32 reserved_pad; /* IA64 alignment, must be 0 */ 60 u64 table_offset_entry[1]; /* Array of pointers to other */
65 u64 table_offset_entry [1]; /* Array of pointers to other */ 61 /* tables' headers */
66 /* tables' headers */
67}; 62};
68 63
69
70/*******************************************/ 64/*******************************************/
71/* IA64 Extensions to ACPI Spec Rev 0.71 */ 65/* IA64 Extensions to ACPI Spec Rev 0.71 */
72/* for the Firmware ACPI Control Structure */ 66/* for the Firmware ACPI Control Structure */
73/*******************************************/ 67/*******************************************/
74struct 68struct {
75{ 69 NATIVE_CHAR signature[4]; /* signature "FACS" */
76 NATIVE_CHAR signature[4]; /* signature "FACS" */ 70 u32 length; /* length of structure, in bytes */
77 u32 length; /* length of structure, in bytes */ 71 u32 hardware_signature; /* hardware configuration signature */
78 u32 hardware_signature; /* hardware configuration signature */ 72 u32 reserved4; /* must be 0 */
79 u32 reserved4; /* must be 0 */ 73 u64 firmware_waking_vector; /* ACPI OS waking vector */
80 u64 firmware_waking_vector; /* ACPI OS waking vector */ 74 u64 global_lock; /* Global Lock */
81 u64 global_lock; /* Global Lock */ 75 u32 S4bios_f:1; /* Indicates if S4BIOS support is present */
82 u32 S4bios_f : 1; /* Indicates if S4BIOS support is present */ 76 u32 reserved1:31; /* must be 0 */
83 u32 reserved1 : 31; /* must be 0 */ 77 u8 reserved3[28]; /* reserved - must be zero */
84 u8 reserved3 [28]; /* reserved - must be zero */
85}; 78};
86 79
87
88/******************************************/ 80/******************************************/
89/* IA64 Extensions to ACPI Spec Rev 0.71 */ 81/* IA64 Extensions to ACPI Spec Rev 0.71 */
90/* for the Fixed ACPI Description Table */ 82/* for the Fixed ACPI Description Table */
91/******************************************/ 83/******************************************/
92struct 84struct {
93{ 85 struct acpi_table_header header; /* table header */
94 struct acpi_table_header header; /* table header */ 86 u32 reserved_pad; /* IA64 alignment, must be 0 */
95 u32 reserved_pad; /* IA64 alignment, must be 0 */ 87 u64 firmware_ctrl; /* 64-bit Physical address of FACS */
96 u64 firmware_ctrl; /* 64-bit Physical address of FACS */ 88 u64 dsdt; /* 64-bit Physical address of DSDT */
97 u64 dsdt; /* 64-bit Physical address of DSDT */ 89 u8 model; /* System Interrupt Model */
98 u8 model; /* System Interrupt Model */ 90 u8 address_space; /* Address Space Bitmask */
99 u8 address_space; /* Address Space Bitmask */ 91 u16 sci_int; /* System vector of SCI interrupt */
100 u16 sci_int; /* System vector of SCI interrupt */ 92 u8 acpi_enable; /* value to write to smi_cmd to enable ACPI */
101 u8 acpi_enable; /* value to write to smi_cmd to enable ACPI */ 93 u8 acpi_disable; /* value to write to smi_cmd to disable ACPI */
102 u8 acpi_disable; /* value to write to smi_cmd to disable ACPI */ 94 u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */
103 u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */ 95 u8 reserved2; /* reserved - must be zero */
104 u8 reserved2; /* reserved - must be zero */ 96 u64 smi_cmd; /* Port address of SMI command port */
105 u64 smi_cmd; /* Port address of SMI command port */ 97 u64 pm1a_evt_blk; /* Port address of Power Mgt 1a acpi_event Reg Blk */
106 u64 pm1a_evt_blk; /* Port address of Power Mgt 1a acpi_event Reg Blk */ 98 u64 pm1b_evt_blk; /* Port address of Power Mgt 1b acpi_event Reg Blk */
107 u64 pm1b_evt_blk; /* Port address of Power Mgt 1b acpi_event Reg Blk */ 99 u64 pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */
108 u64 pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */ 100 u64 pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */
109 u64 pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */ 101 u64 pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */
110 u64 pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */ 102 u64 pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */
111 u64 pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ 103 u64 gpe0_blk; /* Port addr of General Purpose acpi_event 0 Reg Blk */
112 u64 gpe0_blk; /* Port addr of General Purpose acpi_event 0 Reg Blk */ 104 u64 gpe1_blk; /* Port addr of General Purpose acpi_event 1 Reg Blk */
113 u64 gpe1_blk; /* Port addr of General Purpose acpi_event 1 Reg Blk */ 105 u8 pm1_evt_len; /* Byte length of ports at pm1_x_evt_blk */
114 u8 pm1_evt_len; /* Byte length of ports at pm1_x_evt_blk */ 106 u8 pm1_cnt_len; /* Byte length of ports at pm1_x_cnt_blk */
115 u8 pm1_cnt_len; /* Byte length of ports at pm1_x_cnt_blk */ 107 u8 pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */
116 u8 pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */ 108 u8 pm_tm_len; /* Byte Length of ports at pm_tm_blk */
117 u8 pm_tm_len; /* Byte Length of ports at pm_tm_blk */ 109 u8 gpe0_blk_len; /* Byte Length of ports at gpe0_blk */
118 u8 gpe0_blk_len; /* Byte Length of ports at gpe0_blk */ 110 u8 gpe1_blk_len; /* Byte Length of ports at gpe1_blk */
119 u8 gpe1_blk_len; /* Byte Length of ports at gpe1_blk */ 111 u8 gpe1_base; /* offset in gpe model where gpe1 events start */
120 u8 gpe1_base; /* offset in gpe model where gpe1 events start */ 112 u8 reserved3; /* reserved */
121 u8 reserved3; /* reserved */ 113 u16 plvl2_lat; /* worst case HW latency to enter/exit C2 state */
122 u16 plvl2_lat; /* worst case HW latency to enter/exit C2 state */ 114 u16 plvl3_lat; /* worst case HW latency to enter/exit C3 state */
123 u16 plvl3_lat; /* worst case HW latency to enter/exit C3 state */ 115 u8 day_alrm; /* index to day-of-month alarm in RTC CMOS RAM */
124 u8 day_alrm; /* index to day-of-month alarm in RTC CMOS RAM */ 116 u8 mon_alrm; /* index to month-of-year alarm in RTC CMOS RAM */
125 u8 mon_alrm; /* index to month-of-year alarm in RTC CMOS RAM */ 117 u8 century; /* index to century in RTC CMOS RAM */
126 u8 century; /* index to century in RTC CMOS RAM */ 118 u8 reserved4; /* reserved */
127 u8 reserved4; /* reserved */ 119 u32 flush_cash:1; /* PAL_FLUSH_CACHE is correctly supported */
128 u32 flush_cash : 1; /* PAL_FLUSH_CACHE is correctly supported */ 120 u32 reserved5:1; /* reserved - must be zero */
129 u32 reserved5 : 1; /* reserved - must be zero */ 121 u32 proc_c1:1; /* all processors support C1 state */
130 u32 proc_c1 : 1; /* all processors support C1 state */ 122 u32 plvl2_up:1; /* C2 state works on MP system */
131 u32 plvl2_up : 1; /* C2 state works on MP system */ 123 u32 pwr_button:1; /* Power button is handled as a generic feature */
132 u32 pwr_button : 1; /* Power button is handled as a generic feature */ 124 u32 sleep_button:1; /* Sleep button is handled as a generic feature, or not present */
133 u32 sleep_button : 1; /* Sleep button is handled as a generic feature, or not present */ 125 u32 fixed_rTC:1; /* RTC wakeup stat not in fixed register space */
134 u32 fixed_rTC : 1; /* RTC wakeup stat not in fixed register space */ 126 u32 rtcs4:1; /* RTC wakeup stat not possible from S4 */
135 u32 rtcs4 : 1; /* RTC wakeup stat not possible from S4 */ 127 u32 tmr_val_ext:1; /* tmr_val is 32 bits */
136 u32 tmr_val_ext : 1; /* tmr_val is 32 bits */ 128 u32 dock_cap:1; /* Supports Docking */
137 u32 dock_cap : 1; /* Supports Docking */ 129 u32 reserved6:22; /* reserved - must be zero */
138 u32 reserved6 : 22; /* reserved - must be zero */
139}; 130};
140 131
141#pragma pack() 132#pragma pack()
142 133
143#endif /* __ACTBL71_H__ */ 134#endif /* __ACTBL71_H__ */
144
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 3a451dc48ac8..6213b27516e8 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -46,35 +46,31 @@
46 46
47/*! [Begin] no source code translation (keep the typedefs) */ 47/*! [Begin] no source code translation (keep the typedefs) */
48 48
49
50
51/* 49/*
52 * Data type ranges 50 * Data type ranges
53 * Note: These macros are designed to be compiler independent as well as 51 * Note: These macros are designed to be compiler independent as well as
54 * working around problems that some 32-bit compilers have with 64-bit 52 * working around problems that some 32-bit compilers have with 64-bit
55 * constants. 53 * constants.
56 */ 54 */
57#define ACPI_UINT8_MAX (UINT8) (~((UINT8) 0)) /* 0xFF */ 55#define ACPI_UINT8_MAX (UINT8) (~((UINT8) 0)) /* 0xFF */
58#define ACPI_UINT16_MAX (UINT16)(~((UINT16) 0)) /* 0xFFFF */ 56#define ACPI_UINT16_MAX (UINT16)(~((UINT16) 0)) /* 0xFFFF */
59#define ACPI_UINT32_MAX (UINT32)(~((UINT32) 0)) /* 0xFFFFFFFF */ 57#define ACPI_UINT32_MAX (UINT32)(~((UINT32) 0)) /* 0xFFFFFFFF */
60#define ACPI_UINT64_MAX (UINT64)(~((UINT64) 0)) /* 0xFFFFFFFFFFFFFFFF */ 58#define ACPI_UINT64_MAX (UINT64)(~((UINT64) 0)) /* 0xFFFFFFFFFFFFFFFF */
61#define ACPI_ASCII_MAX 0x7F 59#define ACPI_ASCII_MAX 0x7F
62 60
63
64#ifdef DEFINE_ALTERNATE_TYPES 61#ifdef DEFINE_ALTERNATE_TYPES
65/* 62/*
66 * Types used only in translated source, defined here to enable 63 * Types used only in translated source, defined here to enable
67 * cross-platform compilation only. 64 * cross-platform compilation only.
68 */ 65 */
69typedef int s32; 66typedef int s32;
70typedef unsigned char u8; 67typedef unsigned char u8;
71typedef unsigned short u16; 68typedef unsigned short u16;
72typedef unsigned int u32; 69typedef unsigned int u32;
73typedef COMPILER_DEPENDENT_UINT64 u64; 70typedef COMPILER_DEPENDENT_UINT64 u64;
74 71
75#endif 72#endif
76 73
77
78/* 74/*
79 * Data types - Fixed across all compilation models (16/32/64) 75 * Data types - Fixed across all compilation models (16/32/64)
80 * 76 *
@@ -102,30 +98,29 @@ typedef COMPILER_DEPENDENT_UINT64 u64;
102/* 98/*
103 * 64-bit type definitions 99 * 64-bit type definitions
104 */ 100 */
105typedef unsigned char UINT8; 101typedef unsigned char UINT8;
106typedef unsigned char BOOLEAN; 102typedef unsigned char BOOLEAN;
107typedef unsigned short UINT16; 103typedef unsigned short UINT16;
108typedef int INT32; 104typedef int INT32;
109typedef unsigned int UINT32; 105typedef unsigned int UINT32;
110typedef COMPILER_DEPENDENT_INT64 INT64; 106typedef COMPILER_DEPENDENT_INT64 INT64;
111typedef COMPILER_DEPENDENT_UINT64 UINT64; 107typedef COMPILER_DEPENDENT_UINT64 UINT64;
112 108
113/*! [End] no source code translation !*/ 109/*! [End] no source code translation !*/
114 110
115typedef s64 acpi_native_int; 111typedef s64 acpi_native_int;
116typedef u64 acpi_native_uint; 112typedef u64 acpi_native_uint;
117 113
118typedef u64 acpi_table_ptr; 114typedef u64 acpi_table_ptr;
119typedef u64 acpi_io_address; 115typedef u64 acpi_io_address;
120typedef u64 acpi_physical_address; 116typedef u64 acpi_physical_address;
121typedef u64 acpi_size; 117typedef u64 acpi_size;
122 118
123#define ALIGNED_ADDRESS_BOUNDARY 0x00000008 /* No hardware alignment support in IA64 */ 119#define ALIGNED_ADDRESS_BOUNDARY 0x00000008 /* No hardware alignment support in IA64 */
124#define ACPI_USE_NATIVE_DIVIDE /* Native 64-bit integer support */ 120#define ACPI_USE_NATIVE_DIVIDE /* Native 64-bit integer support */
125#define ACPI_MAX_PTR ACPI_UINT64_MAX 121#define ACPI_MAX_PTR ACPI_UINT64_MAX
126#define ACPI_SIZE_MAX ACPI_UINT64_MAX 122#define ACPI_SIZE_MAX ACPI_UINT64_MAX
127 123
128
129#elif ACPI_MACHINE_WIDTH == 16 124#elif ACPI_MACHINE_WIDTH == 16
130 125
131/*! [Begin] no source code translation (keep the typedefs) */ 126/*! [Begin] no source code translation (keep the typedefs) */
@@ -133,32 +128,31 @@ typedef u64 acpi_size;
133/* 128/*
134 * 16-bit type definitions 129 * 16-bit type definitions
135 */ 130 */
136typedef unsigned char UINT8; 131typedef unsigned char UINT8;
137typedef unsigned char BOOLEAN; 132typedef unsigned char BOOLEAN;
138typedef unsigned int UINT16; 133typedef unsigned int UINT16;
139typedef long INT32; 134typedef long INT32;
140typedef int INT16; 135typedef int INT16;
141typedef unsigned long UINT32; 136typedef unsigned long UINT32;
142 137
143struct 138struct {
144{ 139 UINT32 Lo;
145 UINT32 Lo; 140 UINT32 Hi;
146 UINT32 Hi;
147}; 141};
148 142
149/*! [End] no source code translation !*/ 143/*! [End] no source code translation !*/
150 144
151typedef u16 acpi_native_uint; 145typedef u16 acpi_native_uint;
152typedef s16 acpi_native_int; 146typedef s16 acpi_native_int;
153 147
154typedef u32 acpi_table_ptr; 148typedef u32 acpi_table_ptr;
155typedef u32 acpi_io_address; 149typedef u32 acpi_io_address;
156typedef char *acpi_physical_address; 150typedef char *acpi_physical_address;
157typedef u16 acpi_size; 151typedef u16 acpi_size;
158 152
159#define ALIGNED_ADDRESS_BOUNDARY 0x00000002 153#define ALIGNED_ADDRESS_BOUNDARY 0x00000002
160#define ACPI_MISALIGNED_TRANSFERS 154#define ACPI_MISALIGNED_TRANSFERS
161#define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */ 155#define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */
162#define ACPI_MAX_PTR ACPI_UINT16_MAX 156#define ACPI_MAX_PTR ACPI_UINT16_MAX
163#define ACPI_SIZE_MAX ACPI_UINT16_MAX 157#define ACPI_SIZE_MAX ACPI_UINT16_MAX
164 158
@@ -168,7 +162,6 @@ typedef u16 acpi_size;
168 */ 162 */
169#define ACPI_NO_INTEGER64_SUPPORT 163#define ACPI_NO_INTEGER64_SUPPORT
170 164
171
172#elif ACPI_MACHINE_WIDTH == 32 165#elif ACPI_MACHINE_WIDTH == 32
173 166
174/*! [Begin] no source code translation (keep the typedefs) */ 167/*! [Begin] no source code translation (keep the typedefs) */
@@ -176,23 +169,23 @@ typedef u16 acpi_size;
176/* 169/*
177 * 32-bit type definitions (default) 170 * 32-bit type definitions (default)
178 */ 171 */
179typedef unsigned char UINT8; 172typedef unsigned char UINT8;
180typedef unsigned char BOOLEAN; 173typedef unsigned char BOOLEAN;
181typedef unsigned short UINT16; 174typedef unsigned short UINT16;
182typedef int INT32; 175typedef int INT32;
183typedef unsigned int UINT32; 176typedef unsigned int UINT32;
184typedef COMPILER_DEPENDENT_INT64 INT64; 177typedef COMPILER_DEPENDENT_INT64 INT64;
185typedef COMPILER_DEPENDENT_UINT64 UINT64; 178typedef COMPILER_DEPENDENT_UINT64 UINT64;
186 179
187/*! [End] no source code translation !*/ 180/*! [End] no source code translation !*/
188 181
189typedef s32 acpi_native_int; 182typedef s32 acpi_native_int;
190typedef u32 acpi_native_uint; 183typedef u32 acpi_native_uint;
191 184
192typedef u64 acpi_table_ptr; 185typedef u64 acpi_table_ptr;
193typedef u32 acpi_io_address; 186typedef u32 acpi_io_address;
194typedef u64 acpi_physical_address; 187typedef u64 acpi_physical_address;
195typedef u32 acpi_size; 188typedef u32 acpi_size;
196 189
197#define ALIGNED_ADDRESS_BOUNDARY 0x00000004 190#define ALIGNED_ADDRESS_BOUNDARY 0x00000004
198#define ACPI_MISALIGNED_TRANSFERS 191#define ACPI_MISALIGNED_TRANSFERS
@@ -203,29 +196,27 @@ typedef u32 acpi_size;
203#error unknown ACPI_MACHINE_WIDTH 196#error unknown ACPI_MACHINE_WIDTH
204#endif 197#endif
205 198
206
207/* 199/*
208 * Miscellaneous common types 200 * This type is used for bitfields in ACPI tables. The only type that is
201 * even remotely portable is u8. Anything else is not portable, so
202 * do not add any more bitfield types.
209 */ 203 */
210typedef u16 UINT16_BIT; 204typedef u8 UINT8_BIT;
211typedef u32 UINT32_BIT; 205typedef acpi_native_uint ACPI_PTRDIFF;
212typedef acpi_native_uint ACPI_PTRDIFF;
213 206
214/* 207/*
215 * Pointer overlays to avoid lots of typecasting for 208 * Pointer overlays to avoid lots of typecasting for
216 * code that accepts both physical and logical pointers. 209 * code that accepts both physical and logical pointers.
217 */ 210 */
218union acpi_pointers 211union acpi_pointers {
219{ 212 acpi_physical_address physical;
220 acpi_physical_address physical; 213 void *logical;
221 void *logical; 214 acpi_table_ptr value;
222 acpi_table_ptr value;
223}; 215};
224 216
225struct acpi_pointer 217struct acpi_pointer {
226{ 218 u32 pointer_type;
227 u32 pointer_type; 219 union acpi_pointers pointer;
228 union acpi_pointers pointer;
229}; 220};
230 221
231/* pointer_types for above */ 222/* pointer_types for above */
@@ -243,6 +234,14 @@ struct acpi_pointer
243#define ACPI_LOGMODE_PHYSPTR ACPI_LOGICAL_ADDRESSING | ACPI_PHYSICAL_POINTER 234#define ACPI_LOGMODE_PHYSPTR ACPI_LOGICAL_ADDRESSING | ACPI_PHYSICAL_POINTER
244#define ACPI_LOGMODE_LOGPTR ACPI_LOGICAL_ADDRESSING | ACPI_LOGICAL_POINTER 235#define ACPI_LOGMODE_LOGPTR ACPI_LOGICAL_ADDRESSING | ACPI_LOGICAL_POINTER
245 236
237/*
238 * If acpi_cache_t was not defined in the OS-dependent header,
239 * define it now. This is typically the case where the local cache
240 * manager implementation is to be used (ACPI_USE_LOCAL_CACHE)
241 */
242#ifndef acpi_cache_t
243#define acpi_cache_t struct acpi_memory_list
244#endif
246 245
247/* 246/*
248 * Useful defines 247 * Useful defines
@@ -261,34 +260,29 @@ struct acpi_pointer
261#define NULL (void *) 0 260#define NULL (void *) 0
262#endif 261#endif
263 262
264
265/* 263/*
266 * Local datatypes 264 * Local datatypes
267 */ 265 */
268typedef u32 acpi_status; /* All ACPI Exceptions */ 266typedef u32 acpi_status; /* All ACPI Exceptions */
269typedef u32 acpi_name; /* 4-byte ACPI name */ 267typedef u32 acpi_name; /* 4-byte ACPI name */
270typedef char * acpi_string; /* Null terminated ASCII string */ 268typedef char *acpi_string; /* Null terminated ASCII string */
271typedef void * acpi_handle; /* Actually a ptr to an Node */ 269typedef void *acpi_handle; /* Actually a ptr to an Node */
272 270
273struct uint64_struct 271struct uint64_struct {
274{ 272 u32 lo;
275 u32 lo; 273 u32 hi;
276 u32 hi;
277}; 274};
278 275
279union uint64_overlay 276union uint64_overlay {
280{ 277 u64 full;
281 u64 full; 278 struct uint64_struct part;
282 struct uint64_struct part;
283}; 279};
284 280
285struct uint32_struct 281struct uint32_struct {
286{ 282 u32 lo;
287 u32 lo; 283 u32 hi;
288 u32 hi;
289}; 284};
290 285
291
292/* 286/*
293 * Acpi integer width. In ACPI version 1, integers are 287 * Acpi integer width. In ACPI version 1, integers are
294 * 32 bits. In ACPI version 2, integers are 64 bits. 288 * 32 bits. In ACPI version 2, integers are 64 bits.
@@ -300,26 +294,24 @@ struct uint32_struct
300 294
301/* 32-bit integers only, no 64-bit support */ 295/* 32-bit integers only, no 64-bit support */
302 296
303typedef u32 acpi_integer; 297typedef u32 acpi_integer;
304#define ACPI_INTEGER_MAX ACPI_UINT32_MAX 298#define ACPI_INTEGER_MAX ACPI_UINT32_MAX
305#define ACPI_INTEGER_BIT_SIZE 32 299#define ACPI_INTEGER_BIT_SIZE 32
306#define ACPI_MAX_DECIMAL_DIGITS 10 /* 2^32 = 4,294,967,296 */ 300#define ACPI_MAX_DECIMAL_DIGITS 10 /* 2^32 = 4,294,967,296 */
307
308#define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 32-bit divide */
309 301
302#define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 32-bit divide */
310 303
311#else 304#else
312 305
313/* 64-bit integers */ 306/* 64-bit integers */
314 307
315typedef u64 acpi_integer; 308typedef u64 acpi_integer;
316#define ACPI_INTEGER_MAX ACPI_UINT64_MAX 309#define ACPI_INTEGER_MAX ACPI_UINT64_MAX
317#define ACPI_INTEGER_BIT_SIZE 64 310#define ACPI_INTEGER_BIT_SIZE 64
318#define ACPI_MAX_DECIMAL_DIGITS 20 /* 2^64 = 18,446,744,073,709,551,616 */ 311#define ACPI_MAX_DECIMAL_DIGITS 20 /* 2^64 = 18,446,744,073,709,551,616 */
319
320 312
321#if ACPI_MACHINE_WIDTH == 64 313#if ACPI_MACHINE_WIDTH == 64
322#define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 64-bit divide */ 314#define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 64-bit divide */
323#endif 315#endif
324#endif 316#endif
325 317
@@ -333,7 +325,6 @@ typedef u64 acpi_integer;
333 */ 325 */
334#define ACPI_ROOT_OBJECT (acpi_handle) ACPI_PTR_ADD (char, NULL, ACPI_MAX_PTR) 326#define ACPI_ROOT_OBJECT (acpi_handle) ACPI_PTR_ADD (char, NULL, ACPI_MAX_PTR)
335 327
336
337/* 328/*
338 * Initialization sequence 329 * Initialization sequence
339 */ 330 */
@@ -400,7 +391,7 @@ typedef u64 acpi_integer;
400/* 391/*
401 * Table types. These values are passed to the table related APIs 392 * Table types. These values are passed to the table related APIs
402 */ 393 */
403typedef u32 acpi_table_type; 394typedef u32 acpi_table_type;
404 395
405#define ACPI_TABLE_RSDP (acpi_table_type) 0 396#define ACPI_TABLE_RSDP (acpi_table_type) 0
406#define ACPI_TABLE_DSDT (acpi_table_type) 1 397#define ACPI_TABLE_DSDT (acpi_table_type) 1
@@ -421,22 +412,22 @@ typedef u32 acpi_table_type;
421 * NOTE: Types must be kept in sync with the global acpi_ns_properties 412 * NOTE: Types must be kept in sync with the global acpi_ns_properties
422 * and acpi_ns_type_names arrays. 413 * and acpi_ns_type_names arrays.
423 */ 414 */
424typedef u32 acpi_object_type; 415typedef u32 acpi_object_type;
425 416
426#define ACPI_TYPE_ANY 0x00 417#define ACPI_TYPE_ANY 0x00
427#define ACPI_TYPE_INTEGER 0x01 /* Byte/Word/Dword/Zero/One/Ones */ 418#define ACPI_TYPE_INTEGER 0x01 /* Byte/Word/Dword/Zero/One/Ones */
428#define ACPI_TYPE_STRING 0x02 419#define ACPI_TYPE_STRING 0x02
429#define ACPI_TYPE_BUFFER 0x03 420#define ACPI_TYPE_BUFFER 0x03
430#define ACPI_TYPE_PACKAGE 0x04 /* byte_const, multiple data_term/Constant/super_name */ 421#define ACPI_TYPE_PACKAGE 0x04 /* byte_const, multiple data_term/Constant/super_name */
431#define ACPI_TYPE_FIELD_UNIT 0x05 422#define ACPI_TYPE_FIELD_UNIT 0x05
432#define ACPI_TYPE_DEVICE 0x06 /* Name, multiple Node */ 423#define ACPI_TYPE_DEVICE 0x06 /* Name, multiple Node */
433#define ACPI_TYPE_EVENT 0x07 424#define ACPI_TYPE_EVENT 0x07
434#define ACPI_TYPE_METHOD 0x08 /* Name, byte_const, multiple Code */ 425#define ACPI_TYPE_METHOD 0x08 /* Name, byte_const, multiple Code */
435#define ACPI_TYPE_MUTEX 0x09 426#define ACPI_TYPE_MUTEX 0x09
436#define ACPI_TYPE_REGION 0x0A 427#define ACPI_TYPE_REGION 0x0A
437#define ACPI_TYPE_POWER 0x0B /* Name,byte_const,word_const,multi Node */ 428#define ACPI_TYPE_POWER 0x0B /* Name,byte_const,word_const,multi Node */
438#define ACPI_TYPE_PROCESSOR 0x0C /* Name,byte_const,Dword_const,byte_const,multi nm_o */ 429#define ACPI_TYPE_PROCESSOR 0x0C /* Name,byte_const,Dword_const,byte_const,multi nm_o */
439#define ACPI_TYPE_THERMAL 0x0D /* Name, multiple Node */ 430#define ACPI_TYPE_THERMAL 0x0D /* Name, multiple Node */
440#define ACPI_TYPE_BUFFER_FIELD 0x0E 431#define ACPI_TYPE_BUFFER_FIELD 0x0E
441#define ACPI_TYPE_DDB_HANDLE 0x0F 432#define ACPI_TYPE_DDB_HANDLE 0x0F
442#define ACPI_TYPE_DEBUG_OBJECT 0x10 433#define ACPI_TYPE_DEBUG_OBJECT 0x10
@@ -453,16 +444,16 @@ typedef u32 acpi_object_type;
453#define ACPI_TYPE_LOCAL_REGION_FIELD 0x11 444#define ACPI_TYPE_LOCAL_REGION_FIELD 0x11
454#define ACPI_TYPE_LOCAL_BANK_FIELD 0x12 445#define ACPI_TYPE_LOCAL_BANK_FIELD 0x12
455#define ACPI_TYPE_LOCAL_INDEX_FIELD 0x13 446#define ACPI_TYPE_LOCAL_INDEX_FIELD 0x13
456#define ACPI_TYPE_LOCAL_REFERENCE 0x14 /* Arg#, Local#, Name, Debug, ref_of, Index */ 447#define ACPI_TYPE_LOCAL_REFERENCE 0x14 /* Arg#, Local#, Name, Debug, ref_of, Index */
457#define ACPI_TYPE_LOCAL_ALIAS 0x15 448#define ACPI_TYPE_LOCAL_ALIAS 0x15
458#define ACPI_TYPE_LOCAL_METHOD_ALIAS 0x16 449#define ACPI_TYPE_LOCAL_METHOD_ALIAS 0x16
459#define ACPI_TYPE_LOCAL_NOTIFY 0x17 450#define ACPI_TYPE_LOCAL_NOTIFY 0x17
460#define ACPI_TYPE_LOCAL_ADDRESS_HANDLER 0x18 451#define ACPI_TYPE_LOCAL_ADDRESS_HANDLER 0x18
461#define ACPI_TYPE_LOCAL_RESOURCE 0x19 452#define ACPI_TYPE_LOCAL_RESOURCE 0x19
462#define ACPI_TYPE_LOCAL_RESOURCE_FIELD 0x1A 453#define ACPI_TYPE_LOCAL_RESOURCE_FIELD 0x1A
463#define ACPI_TYPE_LOCAL_SCOPE 0x1B /* 1 Name, multiple object_list Nodes */ 454#define ACPI_TYPE_LOCAL_SCOPE 0x1B /* 1 Name, multiple object_list Nodes */
464 455
465#define ACPI_TYPE_NS_NODE_MAX 0x1B /* Last typecode used within a NS Node */ 456#define ACPI_TYPE_NS_NODE_MAX 0x1B /* Last typecode used within a NS Node */
466 457
467/* 458/*
468 * These are special object types that never appear in 459 * These are special object types that never appear in
@@ -506,7 +497,7 @@ typedef u32 acpi_object_type;
506#define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE) 497#define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE)
507#define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE) 498#define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE)
508#define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR) 499#define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)
509#define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */ 500#define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */
510#define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF 501#define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF
511 502
512/* 503/*
@@ -519,7 +510,7 @@ typedef u32 acpi_object_type;
519/* 510/*
520 * Event Types: Fixed & General Purpose 511 * Event Types: Fixed & General Purpose
521 */ 512 */
522typedef u32 acpi_event_type; 513typedef u32 acpi_event_type;
523 514
524/* 515/*
525 * Fixed events 516 * Fixed events
@@ -547,7 +538,7 @@ typedef u32 acpi_event_type;
547 * | +----- Set? 538 * | +----- Set?
548 * +----------- <Reserved> 539 * +----------- <Reserved>
549 */ 540 */
550typedef u32 acpi_event_status; 541typedef u32 acpi_event_status;
551 542
552#define ACPI_EVENT_FLAG_DISABLED (acpi_event_status) 0x00 543#define ACPI_EVENT_FLAG_DISABLED (acpi_event_status) 0x00
553#define ACPI_EVENT_FLAG_ENABLED (acpi_event_status) 0x01 544#define ACPI_EVENT_FLAG_ENABLED (acpi_event_status) 0x01
@@ -564,7 +555,6 @@ typedef u32 acpi_event_status;
564#define ACPI_GPE_ENABLE 0 555#define ACPI_GPE_ENABLE 0
565#define ACPI_GPE_DISABLE 1 556#define ACPI_GPE_DISABLE 1
566 557
567
568/* 558/*
569 * GPE info flags - Per GPE 559 * GPE info flags - Per GPE
570 * +-+-+-+---+---+-+ 560 * +-+-+-+---+---+-+
@@ -585,22 +575,22 @@ typedef u32 acpi_event_status;
585#define ACPI_GPE_TYPE_MASK (u8) 0x06 575#define ACPI_GPE_TYPE_MASK (u8) 0x06
586#define ACPI_GPE_TYPE_WAKE_RUN (u8) 0x06 576#define ACPI_GPE_TYPE_WAKE_RUN (u8) 0x06
587#define ACPI_GPE_TYPE_WAKE (u8) 0x02 577#define ACPI_GPE_TYPE_WAKE (u8) 0x02
588#define ACPI_GPE_TYPE_RUNTIME (u8) 0x04 /* Default */ 578#define ACPI_GPE_TYPE_RUNTIME (u8) 0x04 /* Default */
589 579
590#define ACPI_GPE_DISPATCH_MASK (u8) 0x18 580#define ACPI_GPE_DISPATCH_MASK (u8) 0x18
591#define ACPI_GPE_DISPATCH_HANDLER (u8) 0x08 581#define ACPI_GPE_DISPATCH_HANDLER (u8) 0x08
592#define ACPI_GPE_DISPATCH_METHOD (u8) 0x10 582#define ACPI_GPE_DISPATCH_METHOD (u8) 0x10
593#define ACPI_GPE_DISPATCH_NOT_USED (u8) 0x00 /* Default */ 583#define ACPI_GPE_DISPATCH_NOT_USED (u8) 0x00 /* Default */
594 584
595#define ACPI_GPE_RUN_ENABLE_MASK (u8) 0x20 585#define ACPI_GPE_RUN_ENABLE_MASK (u8) 0x20
596#define ACPI_GPE_RUN_ENABLED (u8) 0x20 586#define ACPI_GPE_RUN_ENABLED (u8) 0x20
597#define ACPI_GPE_RUN_DISABLED (u8) 0x00 /* Default */ 587#define ACPI_GPE_RUN_DISABLED (u8) 0x00 /* Default */
598 588
599#define ACPI_GPE_WAKE_ENABLE_MASK (u8) 0x40 589#define ACPI_GPE_WAKE_ENABLE_MASK (u8) 0x40
600#define ACPI_GPE_WAKE_ENABLED (u8) 0x40 590#define ACPI_GPE_WAKE_ENABLED (u8) 0x40
601#define ACPI_GPE_WAKE_DISABLED (u8) 0x00 /* Default */ 591#define ACPI_GPE_WAKE_DISABLED (u8) 0x00 /* Default */
602 592
603#define ACPI_GPE_ENABLE_MASK (u8) 0x60 /* Both run/wake */ 593#define ACPI_GPE_ENABLE_MASK (u8) 0x60 /* Both run/wake */
604 594
605#define ACPI_GPE_SYSTEM_MASK (u8) 0x80 595#define ACPI_GPE_SYSTEM_MASK (u8) 0x80
606#define ACPI_GPE_SYSTEM_RUNNING (u8) 0x80 596#define ACPI_GPE_SYSTEM_RUNNING (u8) 0x80
@@ -609,13 +599,12 @@ typedef u32 acpi_event_status;
609/* 599/*
610 * Flags for GPE and Lock interfaces 600 * Flags for GPE and Lock interfaces
611 */ 601 */
612#define ACPI_EVENT_WAKE_ENABLE 0x2 /* acpi_gpe_enable */ 602#define ACPI_EVENT_WAKE_ENABLE 0x2 /* acpi_gpe_enable */
613#define ACPI_EVENT_WAKE_DISABLE 0x2 /* acpi_gpe_disable */ 603#define ACPI_EVENT_WAKE_DISABLE 0x2 /* acpi_gpe_disable */
614 604
615#define ACPI_NOT_ISR 0x1 605#define ACPI_NOT_ISR 0x1
616#define ACPI_ISR 0x0 606#define ACPI_ISR 0x0
617 607
618
619/* Notify types */ 608/* Notify types */
620 609
621#define ACPI_SYSTEM_NOTIFY 0x1 610#define ACPI_SYSTEM_NOTIFY 0x1
@@ -625,10 +614,9 @@ typedef u32 acpi_event_status;
625 614
626#define ACPI_MAX_SYS_NOTIFY 0x7f 615#define ACPI_MAX_SYS_NOTIFY 0x7f
627 616
628
629/* Address Space (Operation Region) Types */ 617/* Address Space (Operation Region) Types */
630 618
631typedef u8 acpi_adr_space_type; 619typedef u8 acpi_adr_space_type;
632 620
633#define ACPI_ADR_SPACE_SYSTEM_MEMORY (acpi_adr_space_type) 0 621#define ACPI_ADR_SPACE_SYSTEM_MEMORY (acpi_adr_space_type) 0
634#define ACPI_ADR_SPACE_SYSTEM_IO (acpi_adr_space_type) 1 622#define ACPI_ADR_SPACE_SYSTEM_IO (acpi_adr_space_type) 1
@@ -640,7 +628,6 @@ typedef u8 acpi_adr_space_type;
640#define ACPI_ADR_SPACE_DATA_TABLE (acpi_adr_space_type) 7 628#define ACPI_ADR_SPACE_DATA_TABLE (acpi_adr_space_type) 7
641#define ACPI_ADR_SPACE_FIXED_HARDWARE (acpi_adr_space_type) 127 629#define ACPI_ADR_SPACE_FIXED_HARDWARE (acpi_adr_space_type) 127
642 630
643
644/* 631/*
645 * bit_register IDs 632 * bit_register IDs
646 * These are bitfields defined within the full ACPI registers 633 * These are bitfields defined within the full ACPI registers
@@ -674,74 +661,62 @@ typedef u8 acpi_adr_space_type;
674#define ACPI_BITREG_MAX 0x15 661#define ACPI_BITREG_MAX 0x15
675#define ACPI_NUM_BITREG ACPI_BITREG_MAX + 1 662#define ACPI_NUM_BITREG ACPI_BITREG_MAX + 1
676 663
677
678/* 664/*
679 * External ACPI object definition 665 * External ACPI object definition
680 */ 666 */
681union acpi_object 667union acpi_object {
682{ 668 acpi_object_type type; /* See definition of acpi_ns_type for values */
683 acpi_object_type type; /* See definition of acpi_ns_type for values */ 669 struct {
684 struct 670 acpi_object_type type;
685 { 671 acpi_integer value; /* The actual number */
686 acpi_object_type type;
687 acpi_integer value; /* The actual number */
688 } integer; 672 } integer;
689 673
690 struct 674 struct {
691 { 675 acpi_object_type type;
692 acpi_object_type type; 676 u32 length; /* # of bytes in string, excluding trailing null */
693 u32 length; /* # of bytes in string, excluding trailing null */ 677 char *pointer; /* points to the string value */
694 char *pointer; /* points to the string value */
695 } string; 678 } string;
696 679
697 struct 680 struct {
698 { 681 acpi_object_type type;
699 acpi_object_type type; 682 u32 length; /* # of bytes in buffer */
700 u32 length; /* # of bytes in buffer */ 683 u8 *pointer; /* points to the buffer */
701 u8 *pointer; /* points to the buffer */
702 } buffer; 684 } buffer;
703 685
704 struct 686 struct {
705 { 687 acpi_object_type type;
706 acpi_object_type type; 688 u32 fill1;
707 u32 fill1; 689 acpi_handle handle; /* object reference */
708 acpi_handle handle; /* object reference */
709 } reference; 690 } reference;
710 691
711 struct 692 struct {
712 { 693 acpi_object_type type;
713 acpi_object_type type; 694 u32 count; /* # of elements in package */
714 u32 count; /* # of elements in package */ 695 union acpi_object *elements; /* Pointer to an array of ACPI_OBJECTs */
715 union acpi_object *elements; /* Pointer to an array of ACPI_OBJECTs */
716 } package; 696 } package;
717 697
718 struct 698 struct {
719 { 699 acpi_object_type type;
720 acpi_object_type type; 700 u32 proc_id;
721 u32 proc_id; 701 acpi_io_address pblk_address;
722 acpi_io_address pblk_address; 702 u32 pblk_length;
723 u32 pblk_length;
724 } processor; 703 } processor;
725 704
726 struct 705 struct {
727 { 706 acpi_object_type type;
728 acpi_object_type type; 707 u32 system_level;
729 u32 system_level; 708 u32 resource_order;
730 u32 resource_order;
731 } power_resource; 709 } power_resource;
732}; 710};
733 711
734
735/* 712/*
736 * List of objects, used as a parameter list for control method evaluation 713 * List of objects, used as a parameter list for control method evaluation
737 */ 714 */
738struct acpi_object_list 715struct acpi_object_list {
739{ 716 u32 count;
740 u32 count; 717 union acpi_object *pointer;
741 union acpi_object *pointer;
742}; 718};
743 719
744
745/* 720/*
746 * Miscellaneous common Data Structures used by the interfaces 721 * Miscellaneous common Data Structures used by the interfaces
747 */ 722 */
@@ -749,13 +724,11 @@ struct acpi_object_list
749#define ACPI_ALLOCATE_BUFFER (acpi_size) (-1) 724#define ACPI_ALLOCATE_BUFFER (acpi_size) (-1)
750#define ACPI_ALLOCATE_LOCAL_BUFFER (acpi_size) (-2) 725#define ACPI_ALLOCATE_LOCAL_BUFFER (acpi_size) (-2)
751 726
752struct acpi_buffer 727struct acpi_buffer {
753{ 728 acpi_size length; /* Length in bytes of the buffer */
754 acpi_size length; /* Length in bytes of the buffer */ 729 void *pointer; /* pointer to buffer */
755 void *pointer; /* pointer to buffer */
756}; 730};
757 731
758
759/* 732/*
760 * name_type for acpi_get_name 733 * name_type for acpi_get_name
761 */ 734 */
@@ -763,7 +736,6 @@ struct acpi_buffer
763#define ACPI_SINGLE_NAME 1 736#define ACPI_SINGLE_NAME 1
764#define ACPI_NAME_TYPE_MAX 1 737#define ACPI_NAME_TYPE_MAX 1
765 738
766
767/* 739/*
768 * Structure and flags for acpi_get_system_info 740 * Structure and flags for acpi_get_system_info
769 */ 741 */
@@ -772,139 +744,106 @@ struct acpi_buffer
772#define ACPI_SYS_MODE_LEGACY 0x0002 744#define ACPI_SYS_MODE_LEGACY 0x0002
773#define ACPI_SYS_MODES_MASK 0x0003 745#define ACPI_SYS_MODES_MASK 0x0003
774 746
775
776/* 747/*
777 * ACPI Table Info. One per ACPI table _type_ 748 * ACPI Table Info. One per ACPI table _type_
778 */ 749 */
779struct acpi_table_info 750struct acpi_table_info {
780{ 751 u32 count;
781 u32 count;
782}; 752};
783 753
784
785/* 754/*
786 * System info returned by acpi_get_system_info() 755 * System info returned by acpi_get_system_info()
787 */ 756 */
788struct acpi_system_info 757struct acpi_system_info {
789{ 758 u32 acpi_ca_version;
790 u32 acpi_ca_version; 759 u32 flags;
791 u32 flags; 760 u32 timer_resolution;
792 u32 timer_resolution; 761 u32 reserved1;
793 u32 reserved1; 762 u32 reserved2;
794 u32 reserved2; 763 u32 debug_level;
795 u32 debug_level; 764 u32 debug_layer;
796 u32 debug_layer; 765 u32 num_table_types;
797 u32 num_table_types; 766 struct acpi_table_info table_info[NUM_ACPI_TABLE_TYPES];
798 struct acpi_table_info table_info [NUM_ACPI_TABLE_TYPES];
799}; 767};
800 768
801
802/* 769/*
803 * Types specific to the OS service interfaces 770 * Types specific to the OS service interfaces
804 */ 771 */
805typedef u32 772typedef u32(ACPI_SYSTEM_XFACE * acpi_osd_handler) (void *context);
806(ACPI_SYSTEM_XFACE *acpi_osd_handler) (
807 void *context);
808 773
809typedef void 774typedef void
810(ACPI_SYSTEM_XFACE *acpi_osd_exec_callback) ( 775 (ACPI_SYSTEM_XFACE * acpi_osd_exec_callback) (void *context);
811 void *context);
812 776
813/* 777/*
814 * Various handlers and callback procedures 778 * Various handlers and callback procedures
815 */ 779 */
816typedef 780typedef u32(*acpi_event_handler) (void *context);
817u32 (*acpi_event_handler) (
818 void *context);
819 781
820typedef 782typedef
821void (*acpi_notify_handler) ( 783void (*acpi_notify_handler) (acpi_handle device, u32 value, void *context);
822 acpi_handle device,
823 u32 value,
824 void *context);
825 784
826typedef 785typedef
827void (*acpi_object_handler) ( 786void (*acpi_object_handler) (acpi_handle object, u32 function, void *data);
828 acpi_handle object,
829 u32 function,
830 void *data);
831 787
832typedef 788typedef acpi_status(*acpi_init_handler) (acpi_handle object, u32 function);
833acpi_status (*acpi_init_handler) (
834 acpi_handle object,
835 u32 function);
836 789
837#define ACPI_INIT_DEVICE_INI 1 790#define ACPI_INIT_DEVICE_INI 1
838 791
839typedef 792typedef
840acpi_status (*acpi_exception_handler) ( 793acpi_status(*acpi_exception_handler) (acpi_status aml_status,
841 acpi_status aml_status, 794 acpi_name name,
842 acpi_name name, 795 u16 opcode,
843 u16 opcode, 796 u32 aml_offset, void *context);
844 u32 aml_offset,
845 void *context);
846
847 797
848/* Address Spaces (For Operation Regions) */ 798/* Address Spaces (For Operation Regions) */
849 799
850typedef 800typedef
851acpi_status (*acpi_adr_space_handler) ( 801acpi_status(*acpi_adr_space_handler) (u32 function,
852 u32 function, 802 acpi_physical_address address,
853 acpi_physical_address address, 803 u32 bit_width,
854 u32 bit_width, 804 acpi_integer * value,
855 acpi_integer *value, 805 void *handler_context,
856 void *handler_context, 806 void *region_context);
857 void *region_context);
858 807
859#define ACPI_DEFAULT_HANDLER NULL 808#define ACPI_DEFAULT_HANDLER NULL
860 809
861
862typedef 810typedef
863acpi_status (*acpi_adr_space_setup) ( 811acpi_status(*acpi_adr_space_setup) (acpi_handle region_handle,
864 acpi_handle region_handle, 812 u32 function,
865 u32 function, 813 void *handler_context,
866 void *handler_context, 814 void **region_context);
867 void **region_context);
868 815
869#define ACPI_REGION_ACTIVATE 0 816#define ACPI_REGION_ACTIVATE 0
870#define ACPI_REGION_DEACTIVATE 1 817#define ACPI_REGION_DEACTIVATE 1
871 818
872typedef 819typedef
873acpi_status (*acpi_walk_callback) ( 820acpi_status(*acpi_walk_callback) (acpi_handle obj_handle,
874 acpi_handle obj_handle, 821 u32 nesting_level,
875 u32 nesting_level, 822 void *context, void **return_value);
876 void *context,
877 void **return_value);
878
879 823
880/* Interrupt handler return values */ 824/* Interrupt handler return values */
881 825
882#define ACPI_INTERRUPT_NOT_HANDLED 0x00 826#define ACPI_INTERRUPT_NOT_HANDLED 0x00
883#define ACPI_INTERRUPT_HANDLED 0x01 827#define ACPI_INTERRUPT_HANDLED 0x01
884 828
885
886/* Common string version of device HIDs and UIDs */ 829/* Common string version of device HIDs and UIDs */
887 830
888struct acpi_device_id 831struct acpi_device_id {
889{ 832 char value[ACPI_DEVICE_ID_LENGTH];
890 char value[ACPI_DEVICE_ID_LENGTH];
891}; 833};
892 834
893/* Common string version of device CIDs */ 835/* Common string version of device CIDs */
894 836
895struct acpi_compatible_id 837struct acpi_compatible_id {
896{ 838 char value[ACPI_MAX_CID_LENGTH];
897 char value[ACPI_MAX_CID_LENGTH];
898}; 839};
899 840
900struct acpi_compatible_id_list 841struct acpi_compatible_id_list {
901{ 842 u32 count;
902 u32 count; 843 u32 size;
903 u32 size; 844 struct acpi_compatible_id id[1];
904 struct acpi_compatible_id id[1];
905}; 845};
906 846
907
908/* Structure and flags for acpi_get_object_info */ 847/* Structure and flags for acpi_get_object_info */
909 848
910#define ACPI_VALID_STA 0x0001 849#define ACPI_VALID_STA 0x0001
@@ -914,55 +853,45 @@ struct acpi_compatible_id_list
914#define ACPI_VALID_CID 0x0010 853#define ACPI_VALID_CID 0x0010
915#define ACPI_VALID_SXDS 0x0020 854#define ACPI_VALID_SXDS 0x0020
916 855
917
918#define ACPI_COMMON_OBJ_INFO \ 856#define ACPI_COMMON_OBJ_INFO \
919 acpi_object_type type; /* ACPI object type */ \ 857 acpi_object_type type; /* ACPI object type */ \
920 acpi_name name /* ACPI object Name */ 858 acpi_name name /* ACPI object Name */
921
922 859
923struct acpi_obj_info_header 860struct acpi_obj_info_header {
924{
925 ACPI_COMMON_OBJ_INFO; 861 ACPI_COMMON_OBJ_INFO;
926}; 862};
927 863
928
929/* Structure returned from Get Object Info */ 864/* Structure returned from Get Object Info */
930 865
931struct acpi_device_info 866struct acpi_device_info {
932{
933 ACPI_COMMON_OBJ_INFO; 867 ACPI_COMMON_OBJ_INFO;
934 868
935 u32 valid; /* Indicates which fields below are valid */ 869 u32 valid; /* Indicates which fields below are valid */
936 u32 current_status; /* _STA value */ 870 u32 current_status; /* _STA value */
937 acpi_integer address; /* _ADR value if any */ 871 acpi_integer address; /* _ADR value if any */
938 struct acpi_device_id hardware_id; /* _HID value if any */ 872 struct acpi_device_id hardware_id; /* _HID value if any */
939 struct acpi_device_id unique_id; /* _UID value if any */ 873 struct acpi_device_id unique_id; /* _UID value if any */
940 u8 highest_dstates[4]; /* _sx_d values: 0xFF indicates not valid */ 874 u8 highest_dstates[4]; /* _sx_d values: 0xFF indicates not valid */
941 struct acpi_compatible_id_list compatibility_id; /* List of _CIDs if any */ 875 struct acpi_compatible_id_list compatibility_id; /* List of _CIDs if any */
942}; 876};
943 877
944
945/* Context structs for address space handlers */ 878/* Context structs for address space handlers */
946 879
947struct acpi_pci_id 880struct acpi_pci_id {
948{ 881 u16 segment;
949 u16 segment; 882 u16 bus;
950 u16 bus; 883 u16 device;
951 u16 device; 884 u16 function;
952 u16 function;
953}; 885};
954 886
955 887struct acpi_mem_space_context {
956struct acpi_mem_space_context 888 u32 length;
957{ 889 acpi_physical_address address;
958 u32 length; 890 acpi_physical_address mapped_physical_address;
959 acpi_physical_address address; 891 u8 *mapped_logical_address;
960 acpi_physical_address mapped_physical_address; 892 acpi_size mapped_length;
961 u8 *mapped_logical_address;
962 acpi_size mapped_length;
963}; 893};
964 894
965
966/* 895/*
967 * Definitions for Resource Attributes 896 * Definitions for Resource Attributes
968 */ 897 */
@@ -992,8 +921,8 @@ struct acpi_mem_space_context
992/* 921/*
993 * IO Port Descriptor Decode 922 * IO Port Descriptor Decode
994 */ 923 */
995#define ACPI_DECODE_10 (u8) 0x00 /* 10-bit IO address decode */ 924#define ACPI_DECODE_10 (u8) 0x00 /* 10-bit IO address decode */
996#define ACPI_DECODE_16 (u8) 0x01 /* 16-bit IO address decode */ 925#define ACPI_DECODE_16 (u8) 0x01 /* 16-bit IO address decode */
997 926
998/* 927/*
999 * IRQ Attributes 928 * IRQ Attributes
@@ -1045,32 +974,28 @@ struct acpi_mem_space_context
1045#define ACPI_PRODUCER (u8) 0x00 974#define ACPI_PRODUCER (u8) 0x00
1046#define ACPI_CONSUMER (u8) 0x01 975#define ACPI_CONSUMER (u8) 0x01
1047 976
1048
1049/* 977/*
1050 * Structures used to describe device resources 978 * Structures used to describe device resources
1051 */ 979 */
1052struct acpi_resource_irq 980struct acpi_resource_irq {
1053{ 981 u32 edge_level;
1054 u32 edge_level; 982 u32 active_high_low;
1055 u32 active_high_low; 983 u32 shared_exclusive;
1056 u32 shared_exclusive; 984 u32 number_of_interrupts;
1057 u32 number_of_interrupts; 985 u32 interrupts[1];
1058 u32 interrupts[1];
1059}; 986};
1060 987
1061struct acpi_resource_dma 988struct acpi_resource_dma {
1062{ 989 u32 type;
1063 u32 type; 990 u32 bus_master;
1064 u32 bus_master; 991 u32 transfer;
1065 u32 transfer; 992 u32 number_of_channels;
1066 u32 number_of_channels; 993 u32 channels[1];
1067 u32 channels[1];
1068}; 994};
1069 995
1070struct acpi_resource_start_dpf 996struct acpi_resource_start_dpf {
1071{ 997 u32 compatibility_priority;
1072 u32 compatibility_priority; 998 u32 performance_robustness;
1073 u32 performance_robustness;
1074}; 999};
1075 1000
1076/* 1001/*
@@ -1078,149 +1003,127 @@ struct acpi_resource_start_dpf
1078 * needed because it has no fields 1003 * needed because it has no fields
1079 */ 1004 */
1080 1005
1081struct acpi_resource_io 1006struct acpi_resource_io {
1082{ 1007 u32 io_decode;
1083 u32 io_decode; 1008 u32 min_base_address;
1084 u32 min_base_address; 1009 u32 max_base_address;
1085 u32 max_base_address; 1010 u32 alignment;
1086 u32 alignment; 1011 u32 range_length;
1087 u32 range_length;
1088}; 1012};
1089 1013
1090struct acpi_resource_fixed_io 1014struct acpi_resource_fixed_io {
1091{ 1015 u32 base_address;
1092 u32 base_address; 1016 u32 range_length;
1093 u32 range_length;
1094}; 1017};
1095 1018
1096struct acpi_resource_vendor 1019struct acpi_resource_vendor {
1097{ 1020 u32 length;
1098 u32 length; 1021 u8 reserved[1];
1099 u8 reserved[1];
1100}; 1022};
1101 1023
1102struct acpi_resource_end_tag 1024struct acpi_resource_end_tag {
1103{ 1025 u8 checksum;
1104 u8 checksum;
1105}; 1026};
1106 1027
1107struct acpi_resource_mem24 1028struct acpi_resource_mem24 {
1108{ 1029 u32 read_write_attribute;
1109 u32 read_write_attribute; 1030 u32 min_base_address;
1110 u32 min_base_address; 1031 u32 max_base_address;
1111 u32 max_base_address; 1032 u32 alignment;
1112 u32 alignment; 1033 u32 range_length;
1113 u32 range_length;
1114}; 1034};
1115 1035
1116struct acpi_resource_mem32 1036struct acpi_resource_mem32 {
1117{ 1037 u32 read_write_attribute;
1118 u32 read_write_attribute; 1038 u32 min_base_address;
1119 u32 min_base_address; 1039 u32 max_base_address;
1120 u32 max_base_address; 1040 u32 alignment;
1121 u32 alignment; 1041 u32 range_length;
1122 u32 range_length;
1123}; 1042};
1124 1043
1125struct acpi_resource_fixed_mem32 1044struct acpi_resource_fixed_mem32 {
1126{ 1045 u32 read_write_attribute;
1127 u32 read_write_attribute; 1046 u32 range_base_address;
1128 u32 range_base_address; 1047 u32 range_length;
1129 u32 range_length;
1130}; 1048};
1131 1049
1132struct acpi_memory_attribute 1050struct acpi_memory_attribute {
1133{ 1051 u16 cache_attribute;
1134 u16 cache_attribute; 1052 u16 read_write_attribute;
1135 u16 read_write_attribute;
1136}; 1053};
1137 1054
1138struct acpi_io_attribute 1055struct acpi_io_attribute {
1139{ 1056 u16 range_attribute;
1140 u16 range_attribute; 1057 u16 translation_attribute;
1141 u16 translation_attribute;
1142}; 1058};
1143 1059
1144struct acpi_bus_attribute 1060struct acpi_bus_attribute {
1145{ 1061 u16 reserved1;
1146 u16 reserved1; 1062 u16 reserved2;
1147 u16 reserved2;
1148}; 1063};
1149 1064
1150union acpi_resource_attribute 1065union acpi_resource_attribute {
1151{ 1066 struct acpi_memory_attribute memory;
1152 struct acpi_memory_attribute memory; 1067 struct acpi_io_attribute io;
1153 struct acpi_io_attribute io; 1068 struct acpi_bus_attribute bus;
1154 struct acpi_bus_attribute bus;
1155}; 1069};
1156 1070
1157struct acpi_resource_source 1071struct acpi_resource_source {
1158{ 1072 u32 index;
1159 u32 index; 1073 u32 string_length;
1160 u32 string_length; 1074 char *string_ptr;
1161 char *string_ptr;
1162}; 1075};
1163 1076
1164struct acpi_resource_address16 1077/* Fields common to all address descriptors, 16/32/64 bit */
1165{
1166 u32 resource_type;
1167 u32 producer_consumer;
1168 u32 decode;
1169 u32 min_address_fixed;
1170 u32 max_address_fixed;
1171 union acpi_resource_attribute attribute;
1172 u32 granularity;
1173 u32 min_address_range;
1174 u32 max_address_range;
1175 u32 address_translation_offset;
1176 u32 address_length;
1177 struct acpi_resource_source resource_source;
1178};
1179 1078
1180struct acpi_resource_address32 1079#define ACPI_RESOURCE_ADDRESS_COMMON \
1181{ 1080 u32 resource_type; \
1182 u32 resource_type; 1081 u32 producer_consumer; \
1183 u32 producer_consumer; 1082 u32 decode; \
1184 u32 decode; 1083 u32 min_address_fixed; \
1185 u32 min_address_fixed; 1084 u32 max_address_fixed; \
1186 u32 max_address_fixed;
1187 union acpi_resource_attribute attribute; 1085 union acpi_resource_attribute attribute;
1188 u32 granularity; 1086
1189 u32 min_address_range; 1087struct acpi_resource_address {
1190 u32 max_address_range; 1088ACPI_RESOURCE_ADDRESS_COMMON};
1191 u32 address_translation_offset; 1089
1192 u32 address_length; 1090struct acpi_resource_address16 {
1193 struct acpi_resource_source resource_source; 1091 ACPI_RESOURCE_ADDRESS_COMMON u32 granularity;
1092 u32 min_address_range;
1093 u32 max_address_range;
1094 u32 address_translation_offset;
1095 u32 address_length;
1096 struct acpi_resource_source resource_source;
1194}; 1097};
1195 1098
1196struct acpi_resource_address64 1099struct acpi_resource_address32 {
1197{ 1100 ACPI_RESOURCE_ADDRESS_COMMON u32 granularity;
1198 u32 resource_type; 1101 u32 min_address_range;
1199 u32 producer_consumer; 1102 u32 max_address_range;
1200 u32 decode; 1103 u32 address_translation_offset;
1201 u32 min_address_fixed; 1104 u32 address_length;
1202 u32 max_address_fixed; 1105 struct acpi_resource_source resource_source;
1203 union acpi_resource_attribute attribute;
1204 u64 granularity;
1205 u64 min_address_range;
1206 u64 max_address_range;
1207 u64 address_translation_offset;
1208 u64 address_length;
1209 u64 type_specific_attributes;
1210 struct acpi_resource_source resource_source;
1211}; 1106};
1212 1107
1213struct acpi_resource_ext_irq 1108struct acpi_resource_address64 {
1214{ 1109 ACPI_RESOURCE_ADDRESS_COMMON u64 granularity;
1215 u32 producer_consumer; 1110 u64 min_address_range;
1216 u32 edge_level; 1111 u64 max_address_range;
1217 u32 active_high_low; 1112 u64 address_translation_offset;
1218 u32 shared_exclusive; 1113 u64 address_length;
1219 u32 number_of_interrupts; 1114 u64 type_specific_attributes;
1220 struct acpi_resource_source resource_source; 1115 struct acpi_resource_source resource_source;
1221 u32 interrupts[1];
1222}; 1116};
1223 1117
1118struct acpi_resource_ext_irq {
1119 u32 producer_consumer;
1120 u32 edge_level;
1121 u32 active_high_low;
1122 u32 shared_exclusive;
1123 u32 number_of_interrupts;
1124 struct acpi_resource_source resource_source;
1125 u32 interrupts[1];
1126};
1224 1127
1225/* ACPI_RESOURCE_TYPEs */ 1128/* ACPI_RESOURCE_TYPEs */
1226 1129
@@ -1240,35 +1143,34 @@ struct acpi_resource_ext_irq
1240#define ACPI_RSTYPE_ADDRESS64 13 1143#define ACPI_RSTYPE_ADDRESS64 13
1241#define ACPI_RSTYPE_EXT_IRQ 14 1144#define ACPI_RSTYPE_EXT_IRQ 14
1242 1145
1243typedef u32 acpi_resource_type; 1146typedef u32 acpi_resource_type;
1244 1147
1245union acpi_resource_data 1148union acpi_resource_data {
1246{ 1149 struct acpi_resource_irq irq;
1247 struct acpi_resource_irq irq; 1150 struct acpi_resource_dma dma;
1248 struct acpi_resource_dma dma; 1151 struct acpi_resource_start_dpf start_dpf;
1249 struct acpi_resource_start_dpf start_dpf; 1152 struct acpi_resource_io io;
1250 struct acpi_resource_io io; 1153 struct acpi_resource_fixed_io fixed_io;
1251 struct acpi_resource_fixed_io fixed_io; 1154 struct acpi_resource_vendor vendor_specific;
1252 struct acpi_resource_vendor vendor_specific; 1155 struct acpi_resource_end_tag end_tag;
1253 struct acpi_resource_end_tag end_tag; 1156 struct acpi_resource_mem24 memory24;
1254 struct acpi_resource_mem24 memory24; 1157 struct acpi_resource_mem32 memory32;
1255 struct acpi_resource_mem32 memory32; 1158 struct acpi_resource_fixed_mem32 fixed_memory32;
1256 struct acpi_resource_fixed_mem32 fixed_memory32; 1159 struct acpi_resource_address address; /* Common 16/32/64 address fields */
1257 struct acpi_resource_address16 address16; 1160 struct acpi_resource_address16 address16;
1258 struct acpi_resource_address32 address32; 1161 struct acpi_resource_address32 address32;
1259 struct acpi_resource_address64 address64; 1162 struct acpi_resource_address64 address64;
1260 struct acpi_resource_ext_irq extended_irq; 1163 struct acpi_resource_ext_irq extended_irq;
1261}; 1164};
1262 1165
1263struct acpi_resource 1166struct acpi_resource {
1264{ 1167 acpi_resource_type id;
1265 acpi_resource_type id; 1168 u32 length;
1266 u32 length; 1169 union acpi_resource_data data;
1267 union acpi_resource_data data;
1268}; 1170};
1269 1171
1270#define ACPI_RESOURCE_LENGTH 12 1172#define ACPI_RESOURCE_LENGTH 12
1271#define ACPI_RESOURCE_LENGTH_NO_DATA 8 /* Id + Length fields */ 1173#define ACPI_RESOURCE_LENGTH_NO_DATA 8 /* Id + Length fields */
1272 1174
1273#define ACPI_SIZEOF_RESOURCE(type) (ACPI_RESOURCE_LENGTH_NO_DATA + sizeof (type)) 1175#define ACPI_SIZEOF_RESOURCE(type) (ACPI_RESOURCE_LENGTH_NO_DATA + sizeof (type))
1274 1176
@@ -1284,19 +1186,16 @@ struct acpi_resource
1284 * END: of definitions for Resource Attributes 1186 * END: of definitions for Resource Attributes
1285 */ 1187 */
1286 1188
1287 1189struct acpi_pci_routing_table {
1288struct acpi_pci_routing_table 1190 u32 length;
1289{ 1191 u32 pin;
1290 u32 length; 1192 acpi_integer address; /* here for 64-bit alignment */
1291 u32 pin; 1193 u32 source_index;
1292 acpi_integer address; /* here for 64-bit alignment */ 1194 char source[4]; /* pad to 64 bits so sizeof() works in all cases */
1293 u32 source_index;
1294 char source[4]; /* pad to 64 bits so sizeof() works in all cases */
1295}; 1195};
1296 1196
1297/* 1197/*
1298 * END: of definitions for PCI Routing tables 1198 * END: of definitions for PCI Routing tables
1299 */ 1199 */
1300 1200
1301 1201#endif /* __ACTYPES_H__ */
1302#endif /* __ACTYPES_H__ */
diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h
index 192d0bea3884..c1086452696e 100644
--- a/include/acpi/acutils.h
+++ b/include/acpi/acutils.h
@@ -44,20 +44,17 @@
44#ifndef _ACUTILS_H 44#ifndef _ACUTILS_H
45#define _ACUTILS_H 45#define _ACUTILS_H
46 46
47
48typedef 47typedef
49acpi_status (*acpi_pkg_callback) ( 48acpi_status(*acpi_pkg_callback) (u8 object_type,
50 u8 object_type, 49 union acpi_operand_object * source_object,
51 union acpi_operand_object *source_object, 50 union acpi_generic_state * state,
52 union acpi_generic_state *state, 51 void *context);
53 void *context); 52
54 53struct acpi_pkg_info {
55struct acpi_pkg_info 54 u8 *free_space;
56{ 55 acpi_size length;
57 u8 *free_space; 56 u32 object_space;
58 acpi_size length; 57 u32 num_packages;
59 u32 object_space;
60 u32 num_packages;
61}; 58};
62 59
63#define REF_INCREMENT (u16) 0 60#define REF_INCREMENT (u16) 0
@@ -71,167 +68,89 @@ struct acpi_pkg_info
71#define DB_DWORD_DISPLAY 4 68#define DB_DWORD_DISPLAY 4
72#define DB_QWORD_DISPLAY 8 69#define DB_QWORD_DISPLAY 8
73 70
74
75/* 71/*
76 * utglobal - Global data structures and procedures 72 * utglobal - Global data structures and procedures
77 */ 73 */
78void 74void acpi_ut_init_globals(void);
79acpi_ut_init_globals (
80 void);
81 75
82#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) 76#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
83 77
84char * 78char *acpi_ut_get_mutex_name(u32 mutex_id);
85acpi_ut_get_mutex_name (
86 u32 mutex_id);
87 79
88#endif 80#endif
89 81
90char * 82char *acpi_ut_get_type_name(acpi_object_type type);
91acpi_ut_get_type_name (
92 acpi_object_type type);
93
94char *
95acpi_ut_get_node_name (
96 void *object);
97
98char *
99acpi_ut_get_descriptor_name (
100 void *object);
101 83
102char * 84char *acpi_ut_get_node_name(void *object);
103acpi_ut_get_object_type_name (
104 union acpi_operand_object *obj_desc);
105 85
106char * 86char *acpi_ut_get_descriptor_name(void *object);
107acpi_ut_get_region_name (
108 u8 space_id);
109 87
110char * 88char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc);
111acpi_ut_get_event_name (
112 u32 event_id);
113 89
114char 90char *acpi_ut_get_region_name(u8 space_id);
115acpi_ut_hex_to_ascii_char (
116 acpi_integer integer,
117 u32 position);
118 91
119u8 92char *acpi_ut_get_event_name(u32 event_id);
120acpi_ut_valid_object_type (
121 acpi_object_type type);
122 93
123acpi_owner_id 94char acpi_ut_hex_to_ascii_char(acpi_integer integer, u32 position);
124acpi_ut_allocate_owner_id (
125 u32 id_type);
126 95
96u8 acpi_ut_valid_object_type(acpi_object_type type);
127 97
128/* 98/*
129 * utinit - miscellaneous initialization and shutdown 99 * utinit - miscellaneous initialization and shutdown
130 */ 100 */
131acpi_status 101acpi_status acpi_ut_hardware_initialize(void);
132acpi_ut_hardware_initialize (
133 void);
134 102
135void 103void acpi_ut_subsystem_shutdown(void);
136acpi_ut_subsystem_shutdown (
137 void);
138
139acpi_status
140acpi_ut_validate_fadt (
141 void);
142 104
105acpi_status acpi_ut_validate_fadt(void);
143 106
144/* 107/*
145 * utclib - Local implementations of C library functions 108 * utclib - Local implementations of C library functions
146 */ 109 */
147#ifndef ACPI_USE_SYSTEM_CLIBRARY 110#ifndef ACPI_USE_SYSTEM_CLIBRARY
148 111
149acpi_size 112acpi_size acpi_ut_strlen(const char *string);
150acpi_ut_strlen ( 113
151 const char *string); 114char *acpi_ut_strcpy(char *dst_string, const char *src_string);
152 115
153char * 116char *acpi_ut_strncpy(char *dst_string,
154acpi_ut_strcpy ( 117 const char *src_string, acpi_size count);
155 char *dst_string, 118
156 const char *src_string); 119int acpi_ut_memcmp(const char *buffer1, const char *buffer2, acpi_size count);
157 120
158char * 121int acpi_ut_strncmp(const char *string1, const char *string2, acpi_size count);
159acpi_ut_strncpy ( 122
160 char *dst_string, 123int acpi_ut_strcmp(const char *string1, const char *string2);
161 const char *src_string, 124
162 acpi_size count); 125char *acpi_ut_strcat(char *dst_string, const char *src_string);
163 126
164int 127char *acpi_ut_strncat(char *dst_string,
165acpi_ut_memcmp ( 128 const char *src_string, acpi_size count);
166 const char *buffer1, 129
167 const char *buffer2, 130u32 acpi_ut_strtoul(const char *string, char **terminator, u32 base);
168 acpi_size count); 131
169 132char *acpi_ut_strstr(char *string1, char *string2);
170int 133
171acpi_ut_strncmp ( 134void *acpi_ut_memcpy(void *dest, const void *src, acpi_size count);
172 const char *string1, 135
173 const char *string2, 136void *acpi_ut_memset(void *dest, acpi_native_uint value, acpi_size count);
174 acpi_size count); 137
175 138int acpi_ut_to_upper(int c);
176int 139
177acpi_ut_strcmp ( 140int acpi_ut_to_lower(int c);
178 const char *string1,
179 const char *string2);
180
181char *
182acpi_ut_strcat (
183 char *dst_string,
184 const char *src_string);
185
186char *
187acpi_ut_strncat (
188 char *dst_string,
189 const char *src_string,
190 acpi_size count);
191
192u32
193acpi_ut_strtoul (
194 const char *string,
195 char **terminator,
196 u32 base);
197
198char *
199acpi_ut_strstr (
200 char *string1,
201 char *string2);
202
203void *
204acpi_ut_memcpy (
205 void *dest,
206 const void *src,
207 acpi_size count);
208
209void *
210acpi_ut_memset (
211 void *dest,
212 acpi_native_uint value,
213 acpi_size count);
214
215int
216acpi_ut_to_upper (
217 int c);
218
219int
220acpi_ut_to_lower (
221 int c);
222 141
223extern const u8 _acpi_ctype[]; 142extern const u8 _acpi_ctype[];
224 143
225#define _ACPI_XA 0x00 /* extra alphabetic - not supported */ 144#define _ACPI_XA 0x00 /* extra alphabetic - not supported */
226#define _ACPI_XS 0x40 /* extra space */ 145#define _ACPI_XS 0x40 /* extra space */
227#define _ACPI_BB 0x00 /* BEL, BS, etc. - not supported */ 146#define _ACPI_BB 0x00 /* BEL, BS, etc. - not supported */
228#define _ACPI_CN 0x20 /* CR, FF, HT, NL, VT */ 147#define _ACPI_CN 0x20 /* CR, FF, HT, NL, VT */
229#define _ACPI_DI 0x04 /* '0'-'9' */ 148#define _ACPI_DI 0x04 /* '0'-'9' */
230#define _ACPI_LO 0x02 /* 'a'-'z' */ 149#define _ACPI_LO 0x02 /* 'a'-'z' */
231#define _ACPI_PU 0x10 /* punctuation */ 150#define _ACPI_PU 0x10 /* punctuation */
232#define _ACPI_SP 0x08 /* space */ 151#define _ACPI_SP 0x08 /* space */
233#define _ACPI_UP 0x01 /* 'A'-'Z' */ 152#define _ACPI_UP 0x01 /* 'A'-'Z' */
234#define _ACPI_XD 0x80 /* '0'-'9', 'A'-'F', 'a'-'f' */ 153#define _ACPI_XD 0x80 /* '0'-'9', 'A'-'F', 'a'-'f' */
235 154
236#define ACPI_IS_DIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI)) 155#define ACPI_IS_DIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI))
237#define ACPI_IS_SPACE(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP)) 156#define ACPI_IS_SPACE(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP))
@@ -242,502 +161,323 @@ extern const u8 _acpi_ctype[];
242#define ACPI_IS_ALPHA(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP)) 161#define ACPI_IS_ALPHA(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP))
243#define ACPI_IS_ASCII(c) ((c) < 0x80) 162#define ACPI_IS_ASCII(c) ((c) < 0x80)
244 163
245#endif /* ACPI_USE_SYSTEM_CLIBRARY */ 164#endif /* ACPI_USE_SYSTEM_CLIBRARY */
246
247 165
248/* 166/*
249 * utcopy - Object construction and conversion interfaces 167 * utcopy - Object construction and conversion interfaces
250 */ 168 */
251acpi_status 169acpi_status
252acpi_ut_build_simple_object( 170acpi_ut_build_simple_object(union acpi_operand_object *obj,
253 union acpi_operand_object *obj, 171 union acpi_object *user_obj,
254 union acpi_object *user_obj, 172 u8 * data_space, u32 * buffer_space_used);
255 u8 *data_space,
256 u32 *buffer_space_used);
257 173
258acpi_status 174acpi_status
259acpi_ut_build_package_object ( 175acpi_ut_build_package_object(union acpi_operand_object *obj,
260 union acpi_operand_object *obj, 176 u8 * buffer, u32 * space_used);
261 u8 *buffer,
262 u32 *space_used);
263 177
264acpi_status 178acpi_status
265acpi_ut_copy_iobject_to_eobject ( 179acpi_ut_copy_iobject_to_eobject(union acpi_operand_object *obj,
266 union acpi_operand_object *obj, 180 struct acpi_buffer *ret_buffer);
267 struct acpi_buffer *ret_buffer);
268 181
269acpi_status 182acpi_status
270acpi_ut_copy_eobject_to_iobject ( 183acpi_ut_copy_eobject_to_iobject(union acpi_object *obj,
271 union acpi_object *obj, 184 union acpi_operand_object **internal_obj);
272 union acpi_operand_object **internal_obj);
273 185
274acpi_status 186acpi_status
275acpi_ut_copy_isimple_to_isimple ( 187acpi_ut_copy_isimple_to_isimple(union acpi_operand_object *source_obj,
276 union acpi_operand_object *source_obj, 188 union acpi_operand_object *dest_obj);
277 union acpi_operand_object *dest_obj);
278 189
279acpi_status 190acpi_status
280acpi_ut_copy_iobject_to_iobject ( 191acpi_ut_copy_iobject_to_iobject(union acpi_operand_object *source_desc,
281 union acpi_operand_object *source_desc, 192 union acpi_operand_object **dest_desc,
282 union acpi_operand_object **dest_desc, 193 struct acpi_walk_state *walk_state);
283 struct acpi_walk_state *walk_state);
284
285 194
286/* 195/*
287 * utcreate - Object creation 196 * utcreate - Object creation
288 */ 197 */
289acpi_status 198acpi_status
290acpi_ut_update_object_reference ( 199acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action);
291 union acpi_operand_object *object,
292 u16 action);
293
294 200
295/* 201/*
296 * utdebug - Debug interfaces 202 * utdebug - Debug interfaces
297 */ 203 */
298void 204void acpi_ut_init_stack_ptr_trace(void);
299acpi_ut_init_stack_ptr_trace (
300 void);
301 205
302void 206void acpi_ut_track_stack_ptr(void);
303acpi_ut_track_stack_ptr (
304 void);
305 207
306void 208void
307acpi_ut_trace ( 209acpi_ut_trace(u32 line_number,
308 u32 line_number, 210 const char *function_name, char *module_name, u32 component_id);
309 struct acpi_debug_print_info *dbg_info);
310 211
311void 212void
312acpi_ut_trace_ptr ( 213acpi_ut_trace_ptr(u32 line_number,
313 u32 line_number, 214 const char *function_name,
314 struct acpi_debug_print_info *dbg_info, 215 char *module_name, u32 component_id, void *pointer);
315 void *pointer);
316 216
317void 217void
318acpi_ut_trace_u32 ( 218acpi_ut_trace_u32(u32 line_number,
319 u32 line_number, 219 const char *function_name,
320 struct acpi_debug_print_info *dbg_info, 220 char *module_name, u32 component_id, u32 integer);
321 u32 integer);
322 221
323void 222void
324acpi_ut_trace_str ( 223acpi_ut_trace_str(u32 line_number,
325 u32 line_number, 224 const char *function_name,
326 struct acpi_debug_print_info *dbg_info, 225 char *module_name, u32 component_id, char *string);
327 char *string);
328 226
329void 227void
330acpi_ut_exit ( 228acpi_ut_exit(u32 line_number,
331 u32 line_number, 229 const char *function_name, char *module_name, u32 component_id);
332 struct acpi_debug_print_info *dbg_info);
333 230
334void 231void
335acpi_ut_status_exit ( 232acpi_ut_status_exit(u32 line_number,
336 u32 line_number, 233 const char *function_name,
337 struct acpi_debug_print_info *dbg_info, 234 char *module_name, u32 component_id, acpi_status status);
338 acpi_status status);
339 235
340void 236void
341acpi_ut_value_exit ( 237acpi_ut_value_exit(u32 line_number,
342 u32 line_number, 238 const char *function_name,
343 struct acpi_debug_print_info *dbg_info, 239 char *module_name, u32 component_id, acpi_integer value);
344 acpi_integer value);
345 240
346void 241void
347acpi_ut_ptr_exit ( 242acpi_ut_ptr_exit(u32 line_number,
348 u32 line_number, 243 const char *function_name,
349 struct acpi_debug_print_info *dbg_info, 244 char *module_name, u32 component_id, u8 * ptr);
350 u8 *ptr);
351 245
352void 246void acpi_ut_report_info(char *module_name, u32 line_number, u32 component_id);
353acpi_ut_report_info (
354 char *module_name,
355 u32 line_number,
356 u32 component_id);
357 247
358void 248void acpi_ut_report_error(char *module_name, u32 line_number, u32 component_id);
359acpi_ut_report_error (
360 char *module_name,
361 u32 line_number,
362 u32 component_id);
363 249
364void 250void
365acpi_ut_report_warning ( 251acpi_ut_report_warning(char *module_name, u32 line_number, u32 component_id);
366 char *module_name,
367 u32 line_number,
368 u32 component_id);
369 252
370void 253void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id);
371acpi_ut_dump_buffer (
372 u8 *buffer,
373 u32 count,
374 u32 display,
375 u32 component_id);
376 254
377void ACPI_INTERNAL_VAR_XFACE 255void ACPI_INTERNAL_VAR_XFACE
378acpi_ut_debug_print ( 256acpi_ut_debug_print(u32 requested_debug_level,
379 u32 requested_debug_level, 257 u32 line_number,
380 u32 line_number, 258 const char *function_name,
381 struct acpi_debug_print_info *dbg_info, 259 char *module_name,
382 char *format, 260 u32 component_id, char *format, ...) ACPI_PRINTF_LIKE_FUNC;
383 ...) ACPI_PRINTF_LIKE_FUNC;
384 261
385void ACPI_INTERNAL_VAR_XFACE 262void ACPI_INTERNAL_VAR_XFACE
386acpi_ut_debug_print_raw ( 263acpi_ut_debug_print_raw(u32 requested_debug_level,
387 u32 requested_debug_level, 264 u32 line_number,
388 u32 line_number, 265 const char *function_name,
389 struct acpi_debug_print_info *dbg_info, 266 char *module_name,
390 char *format, 267 u32 component_id,
391 ...) ACPI_PRINTF_LIKE_FUNC; 268 char *format, ...) ACPI_PRINTF_LIKE_FUNC;
392
393 269
394/* 270/*
395 * utdelete - Object deletion and reference counts 271 * utdelete - Object deletion and reference counts
396 */ 272 */
397void 273void acpi_ut_add_reference(union acpi_operand_object *object);
398acpi_ut_add_reference (
399 union acpi_operand_object *object);
400 274
401void 275void acpi_ut_remove_reference(union acpi_operand_object *object);
402acpi_ut_remove_reference (
403 union acpi_operand_object *object);
404 276
405void 277void acpi_ut_delete_internal_package_object(union acpi_operand_object *object);
406acpi_ut_delete_internal_package_object (
407 union acpi_operand_object *object);
408 278
409void 279void acpi_ut_delete_internal_simple_object(union acpi_operand_object *object);
410acpi_ut_delete_internal_simple_object (
411 union acpi_operand_object *object);
412
413void
414acpi_ut_delete_internal_object_list (
415 union acpi_operand_object **obj_list);
416 280
281void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list);
417 282
418/* 283/*
419 * uteval - object evaluation 284 * uteval - object evaluation
420 */ 285 */
421acpi_status 286acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state);
422acpi_ut_osi_implementation (
423 struct acpi_walk_state *walk_state);
424 287
425acpi_status 288acpi_status
426acpi_ut_evaluate_object ( 289acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
427 struct acpi_namespace_node *prefix_node, 290 char *path,
428 char *path, 291 u32 expected_return_btypes,
429 u32 expected_return_btypes, 292 union acpi_operand_object **return_desc);
430 union acpi_operand_object **return_desc);
431 293
432acpi_status 294acpi_status
433acpi_ut_evaluate_numeric_object ( 295acpi_ut_evaluate_numeric_object(char *object_name,
434 char *object_name, 296 struct acpi_namespace_node *device_node,
435 struct acpi_namespace_node *device_node, 297 acpi_integer * address);
436 acpi_integer *address);
437 298
438acpi_status 299acpi_status
439acpi_ut_execute_HID ( 300acpi_ut_execute_HID(struct acpi_namespace_node *device_node,
440 struct acpi_namespace_node *device_node, 301 struct acpi_device_id *hid);
441 struct acpi_device_id *hid);
442 302
443acpi_status 303acpi_status
444acpi_ut_execute_CID ( 304acpi_ut_execute_CID(struct acpi_namespace_node *device_node,
445 struct acpi_namespace_node *device_node, 305 struct acpi_compatible_id_list **return_cid_list);
446 struct acpi_compatible_id_list **return_cid_list);
447 306
448acpi_status 307acpi_status
449acpi_ut_execute_STA ( 308acpi_ut_execute_STA(struct acpi_namespace_node *device_node,
450 struct acpi_namespace_node *device_node, 309 u32 * status_flags);
451 u32 *status_flags);
452 310
453acpi_status 311acpi_status
454acpi_ut_execute_UID ( 312acpi_ut_execute_UID(struct acpi_namespace_node *device_node,
455 struct acpi_namespace_node *device_node, 313 struct acpi_device_id *uid);
456 struct acpi_device_id *uid);
457 314
458acpi_status 315acpi_status
459acpi_ut_execute_sxds ( 316acpi_ut_execute_sxds(struct acpi_namespace_node *device_node, u8 * highest);
460 struct acpi_namespace_node *device_node,
461 u8 *highest);
462
463 317
464/* 318/*
465 * utobject - internal object create/delete/cache routines 319 * utobject - internal object create/delete/cache routines
466 */ 320 */
467union acpi_operand_object * 321union acpi_operand_object *acpi_ut_create_internal_object_dbg(char *module_name,
468acpi_ut_create_internal_object_dbg ( 322 u32 line_number,
469 char *module_name, 323 u32 component_id,
470 u32 line_number, 324 acpi_object_type
471 u32 component_id, 325 type);
472 acpi_object_type type);
473
474void *
475acpi_ut_allocate_object_desc_dbg (
476 char *module_name,
477 u32 line_number,
478 u32 component_id);
479
480#define acpi_ut_create_internal_object(t) acpi_ut_create_internal_object_dbg (_THIS_MODULE,__LINE__,_COMPONENT,t)
481#define acpi_ut_allocate_object_desc() acpi_ut_allocate_object_desc_dbg (_THIS_MODULE,__LINE__,_COMPONENT)
482 326
483void 327void *acpi_ut_allocate_object_desc_dbg(char *module_name,
484acpi_ut_delete_object_desc ( 328 u32 line_number, u32 component_id);
485 union acpi_operand_object *object);
486 329
487u8 330#define acpi_ut_create_internal_object(t) acpi_ut_create_internal_object_dbg (_acpi_module_name,__LINE__,_COMPONENT,t)
488acpi_ut_valid_internal_object ( 331#define acpi_ut_allocate_object_desc() acpi_ut_allocate_object_desc_dbg (_acpi_module_name,__LINE__,_COMPONENT)
489 void *object);
490 332
491union acpi_operand_object * 333void acpi_ut_delete_object_desc(union acpi_operand_object *object);
492acpi_ut_create_buffer_object (
493 acpi_size buffer_size);
494 334
495union acpi_operand_object * 335u8 acpi_ut_valid_internal_object(void *object);
496acpi_ut_create_string_object (
497 acpi_size string_size);
498 336
499acpi_status 337union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size);
500acpi_ut_get_object_size(
501 union acpi_operand_object *obj,
502 acpi_size *obj_length);
503 338
339union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size);
340
341acpi_status
342acpi_ut_get_object_size(union acpi_operand_object *obj, acpi_size * obj_length);
504 343
505/* 344/*
506 * utstate - Generic state creation/cache routines 345 * utstate - Generic state creation/cache routines
507 */ 346 */
508void 347void
509acpi_ut_push_generic_state ( 348acpi_ut_push_generic_state(union acpi_generic_state **list_head,
510 union acpi_generic_state **list_head, 349 union acpi_generic_state *state);
511 union acpi_generic_state *state);
512 350
513union acpi_generic_state * 351union acpi_generic_state *acpi_ut_pop_generic_state(union acpi_generic_state
514acpi_ut_pop_generic_state ( 352 **list_head);
515 union acpi_generic_state **list_head);
516 353
354union acpi_generic_state *acpi_ut_create_generic_state(void);
517 355
518union acpi_generic_state * 356struct acpi_thread_state *acpi_ut_create_thread_state(void);
519acpi_ut_create_generic_state (
520 void);
521 357
522struct acpi_thread_state * 358union acpi_generic_state *acpi_ut_create_update_state(union acpi_operand_object
523acpi_ut_create_thread_state ( 359 *object, u16 action);
524 void);
525 360
526union acpi_generic_state * 361union acpi_generic_state *acpi_ut_create_pkg_state(void *internal_object,
527acpi_ut_create_update_state ( 362 void *external_object,
528 union acpi_operand_object *object, 363 u16 index);
529 u16 action);
530
531union acpi_generic_state *
532acpi_ut_create_pkg_state (
533 void *internal_object,
534 void *external_object,
535 u16 index);
536 364
537acpi_status 365acpi_status
538acpi_ut_create_update_state_and_push ( 366acpi_ut_create_update_state_and_push(union acpi_operand_object *object,
539 union acpi_operand_object *object, 367 u16 action,
540 u16 action, 368 union acpi_generic_state **state_list);
541 union acpi_generic_state **state_list);
542 369
543#ifdef ACPI_FUTURE_USAGE 370#ifdef ACPI_FUTURE_USAGE
544acpi_status 371acpi_status
545acpi_ut_create_pkg_state_and_push ( 372acpi_ut_create_pkg_state_and_push(void *internal_object,
546 void *internal_object, 373 void *external_object,
547 void *external_object, 374 u16 index,
548 u16 index, 375 union acpi_generic_state **state_list);
549 union acpi_generic_state **state_list); 376#endif /* ACPI_FUTURE_USAGE */
550#endif /* ACPI_FUTURE_USAGE */
551 377
552union acpi_generic_state * 378union acpi_generic_state *acpi_ut_create_control_state(void);
553acpi_ut_create_control_state (
554 void);
555
556void
557acpi_ut_delete_generic_state (
558 union acpi_generic_state *state);
559
560#ifdef ACPI_ENABLE_OBJECT_CACHE
561void
562acpi_ut_delete_generic_state_cache (
563 void);
564
565void
566acpi_ut_delete_object_cache (
567 void);
568#endif
569 379
380void acpi_ut_delete_generic_state(union acpi_generic_state *state);
570 381
571/* 382/*
572 * utmath 383 * utmath
573 */ 384 */
574acpi_status 385acpi_status
575acpi_ut_divide ( 386acpi_ut_divide(acpi_integer in_dividend,
576 acpi_integer in_dividend, 387 acpi_integer in_divisor,
577 acpi_integer in_divisor, 388 acpi_integer * out_quotient, acpi_integer * out_remainder);
578 acpi_integer *out_quotient,
579 acpi_integer *out_remainder);
580 389
581acpi_status 390acpi_status
582acpi_ut_short_divide ( 391acpi_ut_short_divide(acpi_integer in_dividend,
583 acpi_integer in_dividend, 392 u32 divisor,
584 u32 divisor, 393 acpi_integer * out_quotient, u32 * out_remainder);
585 acpi_integer *out_quotient,
586 u32 *out_remainder);
587 394
588/* 395/*
589 * utmisc 396 * utmisc
590 */ 397 */
398acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id);
399
400void acpi_ut_release_owner_id(acpi_owner_id * owner_id);
401
591acpi_status 402acpi_status
592acpi_ut_walk_package_tree ( 403acpi_ut_walk_package_tree(union acpi_operand_object *source_object,
593 union acpi_operand_object *source_object, 404 void *target_object,
594 void *target_object, 405 acpi_pkg_callback walk_callback, void *context);
595 acpi_pkg_callback walk_callback,
596 void *context);
597 406
598char * 407void acpi_ut_strupr(char *src_string);
599acpi_ut_strupr (
600 char *src_string);
601 408
602void 409void acpi_ut_print_string(char *string, u8 max_length);
603acpi_ut_print_string (
604 char *string,
605 u8 max_length);
606 410
607u8 411u8 acpi_ut_valid_acpi_name(u32 name);
608acpi_ut_valid_acpi_name (
609 u32 name);
610 412
611u8 413u8 acpi_ut_valid_acpi_character(char character);
612acpi_ut_valid_acpi_character (
613 char character);
614 414
615acpi_status 415acpi_status
616acpi_ut_strtoul64 ( 416acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer);
617 char *string,
618 u32 base,
619 acpi_integer *ret_integer);
620 417
621/* Values for Base above (16=Hex, 10=Decimal) */ 418/* Values for Base above (16=Hex, 10=Decimal) */
622 419
623#define ACPI_ANY_BASE 0 420#define ACPI_ANY_BASE 0
624 421
625acpi_status 422u8 *acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc);
626acpi_ut_mutex_initialize (
627 void);
628
629void
630acpi_ut_mutex_terminate (
631 void);
632
633acpi_status
634acpi_ut_acquire_mutex (
635 acpi_mutex_handle mutex_id);
636
637acpi_status
638acpi_ut_release_mutex (
639 acpi_mutex_handle mutex_id);
640
641u8 *
642acpi_ut_get_resource_end_tag (
643 union acpi_operand_object *obj_desc);
644 423
645u8 424u8 acpi_ut_generate_checksum(u8 * buffer, u32 length);
646acpi_ut_generate_checksum (
647 u8 *buffer,
648 u32 length);
649 425
650u32 426u32 acpi_ut_dword_byte_swap(u32 value);
651acpi_ut_dword_byte_swap (
652 u32 value);
653 427
654void 428void acpi_ut_set_integer_width(u8 revision);
655acpi_ut_set_integer_width (
656 u8 revision);
657 429
658#ifdef ACPI_DEBUG_OUTPUT 430#ifdef ACPI_DEBUG_OUTPUT
659void 431void
660acpi_ut_display_init_pathname ( 432acpi_ut_display_init_pathname(u8 type,
661 u8 type, 433 struct acpi_namespace_node *obj_handle,
662 struct acpi_namespace_node *obj_handle, 434 char *path);
663 char *path);
664 435
665#endif 436#endif
666 437
438/*
439 * utmutex - mutex support
440 */
441acpi_status acpi_ut_mutex_initialize(void);
442
443void acpi_ut_mutex_terminate(void);
444
445acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id);
446
447acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id);
667 448
668/* 449/*
669 * utalloc - memory allocation and object caching 450 * utalloc - memory allocation and object caching
670 */ 451 */
671void * 452acpi_status acpi_ut_create_caches(void);
672acpi_ut_acquire_from_cache (
673 u32 list_id);
674 453
675void 454acpi_status acpi_ut_delete_caches(void);
676acpi_ut_release_to_cache (
677 u32 list_id,
678 void *object);
679 455
680#ifdef ACPI_ENABLE_OBJECT_CACHE 456acpi_status acpi_ut_validate_buffer(struct acpi_buffer *buffer);
681void
682acpi_ut_delete_generic_cache (
683 u32 list_id);
684#endif
685 457
686acpi_status 458acpi_status
687acpi_ut_validate_buffer ( 459acpi_ut_initialize_buffer(struct acpi_buffer *buffer,
688 struct acpi_buffer *buffer); 460 acpi_size required_length);
689 461
690acpi_status 462void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line);
691acpi_ut_initialize_buffer ( 463
692 struct acpi_buffer *buffer, 464void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line);
693 acpi_size required_length);
694
695void *
696acpi_ut_allocate (
697 acpi_size size,
698 u32 component,
699 char *module,
700 u32 line);
701
702void *
703acpi_ut_callocate (
704 acpi_size size,
705 u32 component,
706 char *module,
707 u32 line);
708 465
709#ifdef ACPI_DBG_TRACK_ALLOCATIONS 466#ifdef ACPI_DBG_TRACK_ALLOCATIONS
710void * 467void *acpi_ut_allocate_and_track(acpi_size size,
711acpi_ut_allocate_and_track ( 468 u32 component, char *module, u32 line);
712 acpi_size size, 469
713 u32 component, 470void *acpi_ut_callocate_and_track(acpi_size size,
714 char *module, 471 u32 component, char *module, u32 line);
715 u32 line);
716
717void *
718acpi_ut_callocate_and_track (
719 acpi_size size,
720 u32 component,
721 char *module,
722 u32 line);
723 472
724void 473void
725acpi_ut_free_and_track ( 474acpi_ut_free_and_track(void *address, u32 component, char *module, u32 line);
726 void *address,
727 u32 component,
728 char *module,
729 u32 line);
730 475
731#ifdef ACPI_FUTURE_USAGE 476#ifdef ACPI_FUTURE_USAGE
732void 477void acpi_ut_dump_allocation_info(void);
733acpi_ut_dump_allocation_info ( 478#endif /* ACPI_FUTURE_USAGE */
734 void);
735#endif /* ACPI_FUTURE_USAGE */
736 479
737void 480void acpi_ut_dump_allocations(u32 component, char *module);
738acpi_ut_dump_allocations (
739 u32 component,
740 char *module);
741#endif 481#endif
742 482
743#endif /* _ACUTILS_H */ 483#endif /* _ACUTILS_H */
diff --git a/include/acpi/amlcode.h b/include/acpi/amlcode.h
index 55e97ed29190..7fdf5299f501 100644
--- a/include/acpi/amlcode.h
+++ b/include/acpi/amlcode.h
@@ -59,17 +59,17 @@
59#define AML_WORD_OP (u16) 0x0b 59#define AML_WORD_OP (u16) 0x0b
60#define AML_DWORD_OP (u16) 0x0c 60#define AML_DWORD_OP (u16) 0x0c
61#define AML_STRING_OP (u16) 0x0d 61#define AML_STRING_OP (u16) 0x0d
62#define AML_QWORD_OP (u16) 0x0e /* ACPI 2.0 */ 62#define AML_QWORD_OP (u16) 0x0e /* ACPI 2.0 */
63#define AML_SCOPE_OP (u16) 0x10 63#define AML_SCOPE_OP (u16) 0x10
64#define AML_BUFFER_OP (u16) 0x11 64#define AML_BUFFER_OP (u16) 0x11
65#define AML_PACKAGE_OP (u16) 0x12 65#define AML_PACKAGE_OP (u16) 0x12
66#define AML_VAR_PACKAGE_OP (u16) 0x13 /* ACPI 2.0 */ 66#define AML_VAR_PACKAGE_OP (u16) 0x13 /* ACPI 2.0 */
67#define AML_METHOD_OP (u16) 0x14 67#define AML_METHOD_OP (u16) 0x14
68#define AML_DUAL_NAME_PREFIX (u16) 0x2e 68#define AML_DUAL_NAME_PREFIX (u16) 0x2e
69#define AML_MULTI_NAME_PREFIX_OP (u16) 0x2f 69#define AML_MULTI_NAME_PREFIX_OP (u16) 0x2f
70#define AML_NAME_CHAR_SUBSEQ (u16) 0x30 70#define AML_NAME_CHAR_SUBSEQ (u16) 0x30
71#define AML_NAME_CHAR_FIRST (u16) 0x41 71#define AML_NAME_CHAR_FIRST (u16) 0x41
72#define AML_OP_PREFIX (u16) 0x5b 72#define AML_EXTENDED_OP_PREFIX (u16) 0x5b
73#define AML_ROOT_PREFIX (u16) 0x5c 73#define AML_ROOT_PREFIX (u16) 0x5c
74#define AML_PARENT_PREFIX (u16) 0x5e 74#define AML_PARENT_PREFIX (u16) 0x5e
75#define AML_LOCAL_OP (u16) 0x60 75#define AML_LOCAL_OP (u16) 0x60
@@ -109,8 +109,8 @@
109#define AML_FIND_SET_LEFT_BIT_OP (u16) 0x81 109#define AML_FIND_SET_LEFT_BIT_OP (u16) 0x81
110#define AML_FIND_SET_RIGHT_BIT_OP (u16) 0x82 110#define AML_FIND_SET_RIGHT_BIT_OP (u16) 0x82
111#define AML_DEREF_OF_OP (u16) 0x83 111#define AML_DEREF_OF_OP (u16) 0x83
112#define AML_CONCAT_RES_OP (u16) 0x84 /* ACPI 2.0 */ 112#define AML_CONCAT_RES_OP (u16) 0x84 /* ACPI 2.0 */
113#define AML_MOD_OP (u16) 0x85 /* ACPI 2.0 */ 113#define AML_MOD_OP (u16) 0x85 /* ACPI 2.0 */
114#define AML_NOTIFY_OP (u16) 0x86 114#define AML_NOTIFY_OP (u16) 0x86
115#define AML_SIZE_OF_OP (u16) 0x87 115#define AML_SIZE_OF_OP (u16) 0x87
116#define AML_INDEX_OP (u16) 0x88 116#define AML_INDEX_OP (u16) 0x88
@@ -120,21 +120,21 @@
120#define AML_CREATE_BYTE_FIELD_OP (u16) 0x8c 120#define AML_CREATE_BYTE_FIELD_OP (u16) 0x8c
121#define AML_CREATE_BIT_FIELD_OP (u16) 0x8d 121#define AML_CREATE_BIT_FIELD_OP (u16) 0x8d
122#define AML_TYPE_OP (u16) 0x8e 122#define AML_TYPE_OP (u16) 0x8e
123#define AML_CREATE_QWORD_FIELD_OP (u16) 0x8f /* ACPI 2.0 */ 123#define AML_CREATE_QWORD_FIELD_OP (u16) 0x8f /* ACPI 2.0 */
124#define AML_LAND_OP (u16) 0x90 124#define AML_LAND_OP (u16) 0x90
125#define AML_LOR_OP (u16) 0x91 125#define AML_LOR_OP (u16) 0x91
126#define AML_LNOT_OP (u16) 0x92 126#define AML_LNOT_OP (u16) 0x92
127#define AML_LEQUAL_OP (u16) 0x93 127#define AML_LEQUAL_OP (u16) 0x93
128#define AML_LGREATER_OP (u16) 0x94 128#define AML_LGREATER_OP (u16) 0x94
129#define AML_LLESS_OP (u16) 0x95 129#define AML_LLESS_OP (u16) 0x95
130#define AML_TO_BUFFER_OP (u16) 0x96 /* ACPI 2.0 */ 130#define AML_TO_BUFFER_OP (u16) 0x96 /* ACPI 2.0 */
131#define AML_TO_DECSTRING_OP (u16) 0x97 /* ACPI 2.0 */ 131#define AML_TO_DECSTRING_OP (u16) 0x97 /* ACPI 2.0 */
132#define AML_TO_HEXSTRING_OP (u16) 0x98 /* ACPI 2.0 */ 132#define AML_TO_HEXSTRING_OP (u16) 0x98 /* ACPI 2.0 */
133#define AML_TO_INTEGER_OP (u16) 0x99 /* ACPI 2.0 */ 133#define AML_TO_INTEGER_OP (u16) 0x99 /* ACPI 2.0 */
134#define AML_TO_STRING_OP (u16) 0x9c /* ACPI 2.0 */ 134#define AML_TO_STRING_OP (u16) 0x9c /* ACPI 2.0 */
135#define AML_COPY_OP (u16) 0x9d /* ACPI 2.0 */ 135#define AML_COPY_OP (u16) 0x9d /* ACPI 2.0 */
136#define AML_MID_OP (u16) 0x9e /* ACPI 2.0 */ 136#define AML_MID_OP (u16) 0x9e /* ACPI 2.0 */
137#define AML_CONTINUE_OP (u16) 0x9f /* ACPI 2.0 */ 137#define AML_CONTINUE_OP (u16) 0x9f /* ACPI 2.0 */
138#define AML_IF_OP (u16) 0xa0 138#define AML_IF_OP (u16) 0xa0
139#define AML_ELSE_OP (u16) 0xa1 139#define AML_ELSE_OP (u16) 0xa1
140#define AML_WHILE_OP (u16) 0xa2 140#define AML_WHILE_OP (u16) 0xa2
@@ -146,7 +146,7 @@
146 146
147/* prefixed opcodes */ 147/* prefixed opcodes */
148 148
149#define AML_EXTOP (u16) 0x005b /* prefix for 2-byte opcodes */ 149#define AML_EXTENDED_OPCODE (u16) 0x5b00 /* prefix for 2-byte opcodes */
150 150
151#define AML_MUTEX_OP (u16) 0x5b01 151#define AML_MUTEX_OP (u16) 0x5b01
152#define AML_EVENT_OP (u16) 0x5b02 152#define AML_EVENT_OP (u16) 0x5b02
@@ -154,7 +154,7 @@
154#define AML_SHIFT_LEFT_BIT_OP (u16) 0x5b11 154#define AML_SHIFT_LEFT_BIT_OP (u16) 0x5b11
155#define AML_COND_REF_OF_OP (u16) 0x5b12 155#define AML_COND_REF_OF_OP (u16) 0x5b12
156#define AML_CREATE_FIELD_OP (u16) 0x5b13 156#define AML_CREATE_FIELD_OP (u16) 0x5b13
157#define AML_LOAD_TABLE_OP (u16) 0x5b1f /* ACPI 2.0 */ 157#define AML_LOAD_TABLE_OP (u16) 0x5b1f /* ACPI 2.0 */
158#define AML_LOAD_OP (u16) 0x5b20 158#define AML_LOAD_OP (u16) 0x5b20
159#define AML_STALL_OP (u16) 0x5b21 159#define AML_STALL_OP (u16) 0x5b21
160#define AML_SLEEP_OP (u16) 0x5b22 160#define AML_SLEEP_OP (u16) 0x5b22
@@ -169,7 +169,7 @@
169#define AML_REVISION_OP (u16) 0x5b30 169#define AML_REVISION_OP (u16) 0x5b30
170#define AML_DEBUG_OP (u16) 0x5b31 170#define AML_DEBUG_OP (u16) 0x5b31
171#define AML_FATAL_OP (u16) 0x5b32 171#define AML_FATAL_OP (u16) 0x5b32
172#define AML_TIMER_OP (u16) 0x5b33 /* ACPI 3.0 */ 172#define AML_TIMER_OP (u16) 0x5b33 /* ACPI 3.0 */
173#define AML_REGION_OP (u16) 0x5b80 173#define AML_REGION_OP (u16) 0x5b80
174#define AML_FIELD_OP (u16) 0x5b81 174#define AML_FIELD_OP (u16) 0x5b81
175#define AML_DEVICE_OP (u16) 0x5b82 175#define AML_DEVICE_OP (u16) 0x5b82
@@ -178,8 +178,7 @@
178#define AML_THERMAL_ZONE_OP (u16) 0x5b85 178#define AML_THERMAL_ZONE_OP (u16) 0x5b85
179#define AML_INDEX_FIELD_OP (u16) 0x5b86 179#define AML_INDEX_FIELD_OP (u16) 0x5b86
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
183 182
184/* Bogus opcodes (they are actually two separate opcodes) */ 183/* Bogus opcodes (they are actually two separate opcodes) */
185 184
@@ -187,7 +186,6 @@
187#define AML_LLESSEQUAL_OP (u16) 0x9294 186#define AML_LLESSEQUAL_OP (u16) 0x9294
188#define AML_LNOTEQUAL_OP (u16) 0x9293 187#define AML_LNOTEQUAL_OP (u16) 0x9293
189 188
190
191/* 189/*
192 * Internal opcodes 190 * Internal opcodes
193 * Use only "Unknown" AML opcodes, don't attempt to use 191 * Use only "Unknown" AML opcodes, don't attempt to use
@@ -203,7 +201,6 @@
203#define AML_INT_RETURN_VALUE_OP (u16) 0x0036 201#define AML_INT_RETURN_VALUE_OP (u16) 0x0036
204#define AML_INT_EVAL_SUBTREE_OP (u16) 0x0037 202#define AML_INT_EVAL_SUBTREE_OP (u16) 0x0037
205 203
206
207#define ARG_NONE 0x0 204#define ARG_NONE 0x0
208 205
209/* 206/*
@@ -245,7 +242,7 @@
245 242
246/* Single, simple types */ 243/* Single, simple types */
247 244
248#define ARGI_ANYTYPE 0x01 /* Don't care */ 245#define ARGI_ANYTYPE 0x01 /* Don't care */
249#define ARGI_PACKAGE 0x02 246#define ARGI_PACKAGE 0x02
250#define ARGI_EVENT 0x03 247#define ARGI_EVENT 0x03
251#define ARGI_MUTEX 0x04 248#define ARGI_MUTEX 0x04
@@ -256,8 +253,8 @@
256#define ARGI_INTEGER 0x06 253#define ARGI_INTEGER 0x06
257#define ARGI_STRING 0x07 254#define ARGI_STRING 0x07
258#define ARGI_BUFFER 0x08 255#define ARGI_BUFFER 0x08
259#define ARGI_BUFFER_OR_STRING 0x09 /* Used by MID op only */ 256#define ARGI_BUFFER_OR_STRING 0x09 /* Used by MID op only */
260#define ARGI_COMPUTEDATA 0x0A /* Buffer, String, or Integer */ 257#define ARGI_COMPUTEDATA 0x0A /* Buffer, String, or Integer */
261 258
262/* Reference objects */ 259/* Reference objects */
263 260
@@ -265,30 +262,28 @@
265#define ARGI_OBJECT_REF 0x0C 262#define ARGI_OBJECT_REF 0x0C
266#define ARGI_DEVICE_REF 0x0D 263#define ARGI_DEVICE_REF 0x0D
267#define ARGI_REFERENCE 0x0E 264#define ARGI_REFERENCE 0x0E
268#define ARGI_TARGETREF 0x0F /* Target, subject to implicit conversion */ 265#define ARGI_TARGETREF 0x0F /* Target, subject to implicit conversion */
269#define ARGI_FIXED_TARGET 0x10 /* Target, no implicit conversion */ 266#define ARGI_FIXED_TARGET 0x10 /* Target, no implicit conversion */
270#define ARGI_SIMPLE_TARGET 0x11 /* Name, Local, Arg -- no implicit conversion */ 267#define ARGI_SIMPLE_TARGET 0x11 /* Name, Local, Arg -- no implicit conversion */
271 268
272/* Multiple/complex types */ 269/* Multiple/complex types */
273 270
274#define ARGI_DATAOBJECT 0x12 /* Buffer, String, package or reference to a Node - Used only by size_of operator*/ 271#define ARGI_DATAOBJECT 0x12 /* Buffer, String, package or reference to a Node - Used only by size_of operator */
275#define ARGI_COMPLEXOBJ 0x13 /* Buffer, String, or package (Used by INDEX op only) */ 272#define ARGI_COMPLEXOBJ 0x13 /* Buffer, String, or package (Used by INDEX op only) */
276#define ARGI_REF_OR_STRING 0x14 /* Reference or String (Used by DEREFOF op only) */ 273#define ARGI_REF_OR_STRING 0x14 /* Reference or String (Used by DEREFOF op only) */
277#define ARGI_REGION_OR_FIELD 0x15 /* Used by LOAD op only */ 274#define ARGI_REGION_OR_FIELD 0x15 /* Used by LOAD op only */
278#define ARGI_DATAREFOBJ 0x16 275#define ARGI_DATAREFOBJ 0x16
279 276
280/* Note: types above can expand to 0x1F maximum */ 277/* Note: types above can expand to 0x1F maximum */
281 278
282#define ARGI_INVALID_OPCODE 0xFFFFFFFF 279#define ARGI_INVALID_OPCODE 0xFFFFFFFF
283 280
284
285/* 281/*
286 * hash offsets 282 * hash offsets
287 */ 283 */
288#define AML_EXTOP_HASH_OFFSET 22 284#define AML_EXTOP_HASH_OFFSET 22
289#define AML_LNOT_HASH_OFFSET 19 285#define AML_LNOT_HASH_OFFSET 19
290 286
291
292/* 287/*
293 * opcode groups and types 288 * opcode groups and types
294 */ 289 */
@@ -296,7 +291,6 @@
296#define OPGRP_FIELD 0x02 291#define OPGRP_FIELD 0x02
297#define OPGRP_BYTELIST 0x04 292#define OPGRP_BYTELIST 0x04
298 293
299
300/* 294/*
301 * Opcode information 295 * Opcode information
302 */ 296 */
@@ -322,31 +316,30 @@
322/* Convenient flag groupings */ 316/* Convenient flag groupings */
323 317
324#define AML_FLAGS_EXEC_0A_0T_1R AML_HAS_RETVAL 318#define AML_FLAGS_EXEC_0A_0T_1R AML_HAS_RETVAL
325#define AML_FLAGS_EXEC_1A_0T_0R AML_HAS_ARGS /* Monadic1 */ 319#define AML_FLAGS_EXEC_1A_0T_0R AML_HAS_ARGS /* Monadic1 */
326#define AML_FLAGS_EXEC_1A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL /* Monadic2 */ 320#define AML_FLAGS_EXEC_1A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL /* Monadic2 */
327#define AML_FLAGS_EXEC_1A_1T_0R AML_HAS_ARGS | AML_HAS_TARGET 321#define AML_FLAGS_EXEC_1A_1T_0R AML_HAS_ARGS | AML_HAS_TARGET
328#define AML_FLAGS_EXEC_1A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* monadic2_r */ 322#define AML_FLAGS_EXEC_1A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* monadic2_r */
329#define AML_FLAGS_EXEC_2A_0T_0R AML_HAS_ARGS /* Dyadic1 */ 323#define AML_FLAGS_EXEC_2A_0T_0R AML_HAS_ARGS /* Dyadic1 */
330#define AML_FLAGS_EXEC_2A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL /* Dyadic2 */ 324#define AML_FLAGS_EXEC_2A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL /* Dyadic2 */
331#define AML_FLAGS_EXEC_2A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* dyadic2_r */ 325#define AML_FLAGS_EXEC_2A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* dyadic2_r */
332#define AML_FLAGS_EXEC_2A_2T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL 326#define AML_FLAGS_EXEC_2A_2T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL
333#define AML_FLAGS_EXEC_3A_0T_0R AML_HAS_ARGS 327#define AML_FLAGS_EXEC_3A_0T_0R AML_HAS_ARGS
334#define AML_FLAGS_EXEC_3A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL 328#define AML_FLAGS_EXEC_3A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL
335#define AML_FLAGS_EXEC_6A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL 329#define AML_FLAGS_EXEC_6A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL
336 330
337
338/* 331/*
339 * The opcode Type is used in a dispatch table, do not change 332 * The opcode Type is used in a dispatch table, do not change
340 * without updating the table. 333 * without updating the table.
341 */ 334 */
342#define AML_TYPE_EXEC_0A_0T_1R 0x00 335#define AML_TYPE_EXEC_0A_0T_1R 0x00
343#define AML_TYPE_EXEC_1A_0T_0R 0x01 /* Monadic1 */ 336#define AML_TYPE_EXEC_1A_0T_0R 0x01 /* Monadic1 */
344#define AML_TYPE_EXEC_1A_0T_1R 0x02 /* Monadic2 */ 337#define AML_TYPE_EXEC_1A_0T_1R 0x02 /* Monadic2 */
345#define AML_TYPE_EXEC_1A_1T_0R 0x03 338#define AML_TYPE_EXEC_1A_1T_0R 0x03
346#define AML_TYPE_EXEC_1A_1T_1R 0x04 /* monadic2_r */ 339#define AML_TYPE_EXEC_1A_1T_1R 0x04 /* monadic2_r */
347#define AML_TYPE_EXEC_2A_0T_0R 0x05 /* Dyadic1 */ 340#define AML_TYPE_EXEC_2A_0T_0R 0x05 /* Dyadic1 */
348#define AML_TYPE_EXEC_2A_0T_1R 0x06 /* Dyadic2 */ 341#define AML_TYPE_EXEC_2A_0T_1R 0x06 /* Dyadic2 */
349#define AML_TYPE_EXEC_2A_1T_1R 0x07 /* dyadic2_r */ 342#define AML_TYPE_EXEC_2A_1T_1R 0x07 /* dyadic2_r */
350#define AML_TYPE_EXEC_2A_2T_1R 0x08 343#define AML_TYPE_EXEC_2A_2T_1R 0x08
351#define AML_TYPE_EXEC_3A_0T_0R 0x09 344#define AML_TYPE_EXEC_3A_0T_0R 0x09
352#define AML_TYPE_EXEC_3A_1T_1R 0x0A 345#define AML_TYPE_EXEC_3A_1T_1R 0x0A
@@ -399,40 +392,33 @@
399#define AML_CLASS_METHOD_CALL 0x09 392#define AML_CLASS_METHOD_CALL 0x09
400#define AML_CLASS_UNKNOWN 0x0A 393#define AML_CLASS_UNKNOWN 0x0A
401 394
402
403/* Predefined Operation Region space_iDs */ 395/* Predefined Operation Region space_iDs */
404 396
405typedef enum 397typedef enum {
406{ 398 REGION_MEMORY = 0,
407 REGION_MEMORY = 0,
408 REGION_IO, 399 REGION_IO,
409 REGION_PCI_CONFIG, 400 REGION_PCI_CONFIG,
410 REGION_EC, 401 REGION_EC,
411 REGION_SMBUS, 402 REGION_SMBUS,
412 REGION_CMOS, 403 REGION_CMOS,
413 REGION_PCI_BAR, 404 REGION_PCI_BAR,
414 REGION_DATA_TABLE, /* Internal use only */ 405 REGION_DATA_TABLE, /* Internal use only */
415 REGION_FIXED_HW = 0x7F 406 REGION_FIXED_HW = 0x7F
416
417} AML_REGION_TYPES; 407} AML_REGION_TYPES;
418 408
419
420/* Comparison operation codes for match_op operator */ 409/* Comparison operation codes for match_op operator */
421 410
422typedef enum 411typedef enum {
423{ 412 MATCH_MTR = 0,
424 MATCH_MTR = 0, 413 MATCH_MEQ = 1,
425 MATCH_MEQ = 1, 414 MATCH_MLE = 2,
426 MATCH_MLE = 2, 415 MATCH_MLT = 3,
427 MATCH_MLT = 3, 416 MATCH_MGE = 4,
428 MATCH_MGE = 4, 417 MATCH_MGT = 5
429 MATCH_MGT = 5
430
431} AML_MATCH_OPERATOR; 418} AML_MATCH_OPERATOR;
432 419
433#define MAX_MATCH_OPERATOR 5 420#define MAX_MATCH_OPERATOR 5
434 421
435
436/* 422/*
437 * field_flags 423 * field_flags
438 * 424 *
@@ -450,60 +436,47 @@ typedef enum
450#define AML_FIELD_LOCK_RULE_MASK 0x10 436#define AML_FIELD_LOCK_RULE_MASK 0x10
451#define AML_FIELD_UPDATE_RULE_MASK 0x60 437#define AML_FIELD_UPDATE_RULE_MASK 0x60
452 438
453
454/* 1) Field Access Types */ 439/* 1) Field Access Types */
455 440
456typedef enum 441typedef enum {
457{ 442 AML_FIELD_ACCESS_ANY = 0x00,
458 AML_FIELD_ACCESS_ANY = 0x00, 443 AML_FIELD_ACCESS_BYTE = 0x01,
459 AML_FIELD_ACCESS_BYTE = 0x01, 444 AML_FIELD_ACCESS_WORD = 0x02,
460 AML_FIELD_ACCESS_WORD = 0x02, 445 AML_FIELD_ACCESS_DWORD = 0x03,
461 AML_FIELD_ACCESS_DWORD = 0x03, 446 AML_FIELD_ACCESS_QWORD = 0x04, /* ACPI 2.0 */
462 AML_FIELD_ACCESS_QWORD = 0x04, /* ACPI 2.0 */ 447 AML_FIELD_ACCESS_BUFFER = 0x05 /* ACPI 2.0 */
463 AML_FIELD_ACCESS_BUFFER = 0x05 /* ACPI 2.0 */
464
465} AML_ACCESS_TYPE; 448} AML_ACCESS_TYPE;
466 449
467
468/* 2) Field Lock Rules */ 450/* 2) Field Lock Rules */
469 451
470typedef enum 452typedef enum {
471{ 453 AML_FIELD_LOCK_NEVER = 0x00,
472 AML_FIELD_LOCK_NEVER = 0x00, 454 AML_FIELD_LOCK_ALWAYS = 0x10
473 AML_FIELD_LOCK_ALWAYS = 0x10
474
475} AML_LOCK_RULE; 455} AML_LOCK_RULE;
476 456
477
478/* 3) Field Update Rules */ 457/* 3) Field Update Rules */
479 458
480typedef enum 459typedef enum {
481{ 460 AML_FIELD_UPDATE_PRESERVE = 0x00,
482 AML_FIELD_UPDATE_PRESERVE = 0x00, 461 AML_FIELD_UPDATE_WRITE_AS_ONES = 0x20,
483 AML_FIELD_UPDATE_WRITE_AS_ONES = 0x20,
484 AML_FIELD_UPDATE_WRITE_AS_ZEROS = 0x40 462 AML_FIELD_UPDATE_WRITE_AS_ZEROS = 0x40
485
486} AML_UPDATE_RULE; 463} AML_UPDATE_RULE;
487 464
488
489/* 465/*
490 * Field Access Attributes. 466 * Field Access Attributes.
491 * This byte is extracted from the AML via the 467 * This byte is extracted from the AML via the
492 * access_as keyword 468 * access_as keyword
493 */ 469 */
494typedef enum 470typedef enum {
495{ 471 AML_FIELD_ATTRIB_SMB_QUICK = 0x02,
496 AML_FIELD_ATTRIB_SMB_QUICK = 0x02, 472 AML_FIELD_ATTRIB_SMB_SEND_RCV = 0x04,
497 AML_FIELD_ATTRIB_SMB_SEND_RCV = 0x04, 473 AML_FIELD_ATTRIB_SMB_BYTE = 0x06,
498 AML_FIELD_ATTRIB_SMB_BYTE = 0x06, 474 AML_FIELD_ATTRIB_SMB_WORD = 0x08,
499 AML_FIELD_ATTRIB_SMB_WORD = 0x08, 475 AML_FIELD_ATTRIB_SMB_BLOCK = 0x0A,
500 AML_FIELD_ATTRIB_SMB_BLOCK = 0x0A, 476 AML_FIELD_ATTRIB_SMB_WORD_CALL = 0x0C,
501 AML_FIELD_ATTRIB_SMB_WORD_CALL = 0x0C,
502 AML_FIELD_ATTRIB_SMB_BLOCK_CALL = 0x0D 477 AML_FIELD_ATTRIB_SMB_BLOCK_CALL = 0x0D
503
504} AML_ACCESS_ATTRIBUTE; 478} AML_ACCESS_ATTRIBUTE;
505 479
506
507/* Bit fields in method_flags byte */ 480/* Bit fields in method_flags byte */
508 481
509#define AML_METHOD_ARG_COUNT 0x07 482#define AML_METHOD_ARG_COUNT 0x07
@@ -516,5 +489,4 @@ typedef enum
516#define AML_METHOD_RESERVED1 0x02 489#define AML_METHOD_RESERVED1 0x02
517#define AML_METHOD_RESERVED2 0x04 490#define AML_METHOD_RESERVED2 0x04
518 491
519 492#endif /* __AMLCODE_H__ */
520#endif /* __AMLCODE_H__ */
diff --git a/include/acpi/amlresrc.h b/include/acpi/amlresrc.h
index b20ec303df07..051786e4b210 100644
--- a/include/acpi/amlresrc.h
+++ b/include/acpi/amlresrc.h
@@ -42,29 +42,27 @@
42 * POSSIBILITY OF SUCH DAMAGES. 42 * POSSIBILITY OF SUCH DAMAGES.
43 */ 43 */
44 44
45
46#ifndef __AMLRESRC_H 45#ifndef __AMLRESRC_H
47#define __AMLRESRC_H 46#define __AMLRESRC_H
48 47
49
50#define ASL_RESNAME_ADDRESS "_ADR" 48#define ASL_RESNAME_ADDRESS "_ADR"
51#define ASL_RESNAME_ALIGNMENT "_ALN" 49#define ASL_RESNAME_ALIGNMENT "_ALN"
52#define ASL_RESNAME_ADDRESSSPACE "_ASI" 50#define ASL_RESNAME_ADDRESSSPACE "_ASI"
53#define ASL_RESNAME_ACCESSSIZE "_ASZ" 51#define ASL_RESNAME_ACCESSSIZE "_ASZ"
54#define ASL_RESNAME_TYPESPECIFICATTRIBUTES "_ATT" 52#define ASL_RESNAME_TYPESPECIFICATTRIBUTES "_ATT"
55#define ASL_RESNAME_BASEADDRESS "_BAS" 53#define ASL_RESNAME_BASEADDRESS "_BAS"
56#define ASL_RESNAME_BUSMASTER "_BM_" /* Master(1), Slave(0) */ 54#define ASL_RESNAME_BUSMASTER "_BM_" /* Master(1), Slave(0) */
57#define ASL_RESNAME_DECODE "_DEC" 55#define ASL_RESNAME_DECODE "_DEC"
58#define ASL_RESNAME_DMA "_DMA" 56#define ASL_RESNAME_DMA "_DMA"
59#define ASL_RESNAME_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */ 57#define ASL_RESNAME_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */
60#define ASL_RESNAME_GRANULARITY "_GRA" 58#define ASL_RESNAME_GRANULARITY "_GRA"
61#define ASL_RESNAME_INTERRUPT "_INT" 59#define ASL_RESNAME_INTERRUPT "_INT"
62#define ASL_RESNAME_INTERRUPTLEVEL "_LL_" /* active_lo(1), active_hi(0) */ 60#define ASL_RESNAME_INTERRUPTLEVEL "_LL_" /* active_lo(1), active_hi(0) */
63#define ASL_RESNAME_INTERRUPTSHARE "_SHR" /* Shareable(1), no_share(0) */ 61#define ASL_RESNAME_INTERRUPTSHARE "_SHR" /* Shareable(1), no_share(0) */
64#define ASL_RESNAME_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */ 62#define ASL_RESNAME_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */
65#define ASL_RESNAME_LENGTH "_LEN" 63#define ASL_RESNAME_LENGTH "_LEN"
66#define ASL_RESNAME_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */ 64#define ASL_RESNAME_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */
67#define ASL_RESNAME_MEMTYPE "_MEM" /* non_cache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */ 65#define ASL_RESNAME_MEMTYPE "_MEM" /* non_cache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */
68#define ASL_RESNAME_MAXADDR "_MAX" 66#define ASL_RESNAME_MAXADDR "_MAX"
69#define ASL_RESNAME_MINADDR "_MIN" 67#define ASL_RESNAME_MINADDR "_MIN"
70#define ASL_RESNAME_MAXTYPE "_MAF" 68#define ASL_RESNAME_MAXTYPE "_MAF"
@@ -72,12 +70,11 @@
72#define ASL_RESNAME_REGISTERBITOFFSET "_RBO" 70#define ASL_RESNAME_REGISTERBITOFFSET "_RBO"
73#define ASL_RESNAME_REGISTERBITWIDTH "_RBW" 71#define ASL_RESNAME_REGISTERBITWIDTH "_RBW"
74#define ASL_RESNAME_RANGETYPE "_RNG" 72#define ASL_RESNAME_RANGETYPE "_RNG"
75#define ASL_RESNAME_READWRITETYPE "_RW_" /* read_only(0), Writeable (1) */ 73#define ASL_RESNAME_READWRITETYPE "_RW_" /* read_only(0), Writeable (1) */
76#define ASL_RESNAME_TRANSLATION "_TRA" 74#define ASL_RESNAME_TRANSLATION "_TRA"
77#define ASL_RESNAME_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */ 75#define ASL_RESNAME_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */
78#define ASL_RESNAME_TYPE "_TTP" /* Translation(1), Static (0) */ 76#define ASL_RESNAME_TYPE "_TTP" /* Translation(1), Static (0) */
79#define ASL_RESNAME_XFERTYPE "_SIz" /* 8(0), 8_and16(1), 16(2) */ 77#define ASL_RESNAME_XFERTYPE "_SIz" /* 8(0), 8_and16(1), 16(2) */
80
81 78
82/* Default sizes for "small" resource descriptors */ 79/* Default sizes for "small" resource descriptors */
83 80
@@ -89,15 +86,12 @@
89#define ASL_RDESC_FIXED_IO_SIZE 0x03 86#define ASL_RDESC_FIXED_IO_SIZE 0x03
90#define ASL_RDESC_END_TAG_SIZE 0x01 87#define ASL_RDESC_END_TAG_SIZE 0x01
91 88
92 89struct asl_resource_node {
93struct asl_resource_node 90 u32 buffer_length;
94{ 91 void *buffer;
95 u32 buffer_length; 92 struct asl_resource_node *next;
96 void *buffer;
97 struct asl_resource_node *next;
98}; 93};
99 94
100
101/* 95/*
102 * Resource descriptors defined in the ACPI specification. 96 * Resource descriptors defined in the ACPI specification.
103 * 97 *
@@ -106,214 +100,175 @@ struct asl_resource_node
106 */ 100 */
107#pragma pack(1) 101#pragma pack(1)
108 102
109struct asl_irq_format_desc 103struct asl_irq_format_desc {
110{ 104 u8 descriptor_type;
111 u8 descriptor_type; 105 u16 irq_mask;
112 u16 irq_mask; 106 u8 flags;
113 u8 flags;
114}; 107};
115 108
116 109struct asl_irq_noflags_desc {
117struct asl_irq_noflags_desc 110 u8 descriptor_type;
118{ 111 u16 irq_mask;
119 u8 descriptor_type;
120 u16 irq_mask;
121}; 112};
122 113
123 114struct asl_dma_format_desc {
124struct asl_dma_format_desc 115 u8 descriptor_type;
125{ 116 u8 dma_channel_mask;
126 u8 descriptor_type; 117 u8 flags;
127 u8 dma_channel_mask;
128 u8 flags;
129}; 118};
130 119
131 120struct asl_start_dependent_desc {
132struct asl_start_dependent_desc 121 u8 descriptor_type;
133{ 122 u8 flags;
134 u8 descriptor_type;
135 u8 flags;
136}; 123};
137 124
138 125struct asl_start_dependent_noprio_desc {
139struct asl_start_dependent_noprio_desc 126 u8 descriptor_type;
140{
141 u8 descriptor_type;
142}; 127};
143 128
144 129struct asl_end_dependent_desc {
145struct asl_end_dependent_desc 130 u8 descriptor_type;
146{
147 u8 descriptor_type;
148}; 131};
149 132
150 133struct asl_io_port_desc {
151struct asl_io_port_desc 134 u8 descriptor_type;
152{ 135 u8 information;
153 u8 descriptor_type; 136 u16 address_min;
154 u8 information; 137 u16 address_max;
155 u16 address_min; 138 u8 alignment;
156 u16 address_max; 139 u8 length;
157 u8 alignment;
158 u8 length;
159}; 140};
160 141
161 142struct asl_fixed_io_port_desc {
162struct asl_fixed_io_port_desc 143 u8 descriptor_type;
163{ 144 u16 base_address;
164 u8 descriptor_type; 145 u8 length;
165 u16 base_address;
166 u8 length;
167}; 146};
168 147
169 148struct asl_small_vendor_desc {
170struct asl_small_vendor_desc 149 u8 descriptor_type;
171{ 150 u8 vendor_defined[7];
172 u8 descriptor_type;
173 u8 vendor_defined[7];
174}; 151};
175 152
176 153struct asl_end_tag_desc {
177struct asl_end_tag_desc 154 u8 descriptor_type;
178{ 155 u8 checksum;
179 u8 descriptor_type;
180 u8 checksum;
181}; 156};
182 157
183
184/* LARGE descriptors */ 158/* LARGE descriptors */
185 159
186struct asl_memory_24_desc 160struct asl_memory_24_desc {
187{ 161 u8 descriptor_type;
188 u8 descriptor_type; 162 u16 length;
189 u16 length; 163 u8 information;
190 u8 information; 164 u16 address_min;
191 u16 address_min; 165 u16 address_max;
192 u16 address_max; 166 u16 alignment;
193 u16 alignment; 167 u16 range_length;
194 u16 range_length;
195}; 168};
196 169
197 170struct asl_large_vendor_desc {
198struct asl_large_vendor_desc 171 u8 descriptor_type;
199{ 172 u16 length;
200 u8 descriptor_type; 173 u8 vendor_defined[1];
201 u16 length;
202 u8 vendor_defined[1];
203}; 174};
204 175
205 176struct asl_memory_32_desc {
206struct asl_memory_32_desc 177 u8 descriptor_type;
207{ 178 u16 length;
208 u8 descriptor_type; 179 u8 information;
209 u16 length; 180 u32 address_min;
210 u8 information; 181 u32 address_max;
211 u32 address_min; 182 u32 alignment;
212 u32 address_max; 183 u32 range_length;
213 u32 alignment;
214 u32 range_length;
215}; 184};
216 185
217 186struct asl_fixed_memory_32_desc {
218struct asl_fixed_memory_32_desc 187 u8 descriptor_type;
219{ 188 u16 length;
220 u8 descriptor_type; 189 u8 information;
221 u16 length; 190 u32 base_address;
222 u8 information; 191 u32 range_length;
223 u32 base_address;
224 u32 range_length;
225}; 192};
226 193
227 194struct asl_extended_address_desc {
228struct asl_extended_address_desc 195 u8 descriptor_type;
229{ 196 u16 length;
230 u8 descriptor_type; 197 u8 resource_type;
231 u16 length; 198 u8 flags;
232 u8 resource_type; 199 u8 specific_flags;
233 u8 flags; 200 u8 revision_iD;
234 u8 specific_flags; 201 u8 reserved;
235 u8 revision_iD; 202 u64 granularity;
236 u8 reserved; 203 u64 address_min;
237 u64 granularity; 204 u64 address_max;
238 u64 address_min; 205 u64 translation_offset;
239 u64 address_max; 206 u64 address_length;
240 u64 translation_offset; 207 u64 type_specific_attributes;
241 u64 address_length; 208 u8 optional_fields[2]; /* Used for length calculation only */
242 u64 type_specific_attributes;
243 u8 optional_fields[2]; /* Used for length calculation only */
244}; 209};
245 210
246#define ASL_EXTENDED_ADDRESS_DESC_REVISION 1 /* ACPI 3.0 */ 211#define ASL_EXTENDED_ADDRESS_DESC_REVISION 1 /* ACPI 3.0 */
247 212
248 213struct asl_qword_address_desc {
249struct asl_qword_address_desc 214 u8 descriptor_type;
250{ 215 u16 length;
251 u8 descriptor_type; 216 u8 resource_type;
252 u16 length; 217 u8 flags;
253 u8 resource_type; 218 u8 specific_flags;
254 u8 flags; 219 u64 granularity;
255 u8 specific_flags; 220 u64 address_min;
256 u64 granularity; 221 u64 address_max;
257 u64 address_min; 222 u64 translation_offset;
258 u64 address_max; 223 u64 address_length;
259 u64 translation_offset; 224 u8 optional_fields[2];
260 u64 address_length;
261 u8 optional_fields[2];
262}; 225};
263 226
264 227struct asl_dword_address_desc {
265struct asl_dword_address_desc 228 u8 descriptor_type;
266{ 229 u16 length;
267 u8 descriptor_type; 230 u8 resource_type;
268 u16 length; 231 u8 flags;
269 u8 resource_type; 232 u8 specific_flags;
270 u8 flags; 233 u32 granularity;
271 u8 specific_flags; 234 u32 address_min;
272 u32 granularity; 235 u32 address_max;
273 u32 address_min; 236 u32 translation_offset;
274 u32 address_max; 237 u32 address_length;
275 u32 translation_offset; 238 u8 optional_fields[2];
276 u32 address_length;
277 u8 optional_fields[2];
278}; 239};
279 240
280 241struct asl_word_address_desc {
281struct asl_word_address_desc 242 u8 descriptor_type;
282{ 243 u16 length;
283 u8 descriptor_type; 244 u8 resource_type;
284 u16 length; 245 u8 flags;
285 u8 resource_type; 246 u8 specific_flags;
286 u8 flags; 247 u16 granularity;
287 u8 specific_flags; 248 u16 address_min;
288 u16 granularity; 249 u16 address_max;
289 u16 address_min; 250 u16 translation_offset;
290 u16 address_max; 251 u16 address_length;
291 u16 translation_offset; 252 u8 optional_fields[2];
292 u16 address_length;
293 u8 optional_fields[2];
294}; 253};
295 254
296 255struct asl_extended_xrupt_desc {
297struct asl_extended_xrupt_desc 256 u8 descriptor_type;
298{ 257 u16 length;
299 u8 descriptor_type; 258 u8 flags;
300 u16 length; 259 u8 table_length;
301 u8 flags; 260 u32 interrupt_number[1];
302 u8 table_length;
303 u32 interrupt_number[1];
304 /* res_source_index, res_source optional fields follow */ 261 /* res_source_index, res_source optional fields follow */
305}; 262};
306 263
307 264struct asl_general_register_desc {
308struct asl_general_register_desc 265 u8 descriptor_type;
309{ 266 u16 length;
310 u8 descriptor_type; 267 u8 address_space_id;
311 u16 length; 268 u8 bit_width;
312 u8 address_space_id; 269 u8 bit_offset;
313 u8 bit_width; 270 u8 access_size; /* ACPI 3.0, was Reserved */
314 u8 bit_offset; 271 u64 address;
315 u8 access_size; /* ACPI 3.0, was Reserved */
316 u64 address;
317}; 272};
318 273
319/* restore default alignment */ 274/* restore default alignment */
@@ -322,32 +277,29 @@ struct asl_general_register_desc
322 277
323/* Union of all resource descriptors, so we can allocate the worst case */ 278/* Union of all resource descriptors, so we can allocate the worst case */
324 279
325union asl_resource_desc 280union asl_resource_desc {
326{ 281 struct asl_irq_format_desc irq;
327 struct asl_irq_format_desc irq; 282 struct asl_dma_format_desc dma;
328 struct asl_dma_format_desc dma; 283 struct asl_start_dependent_desc std;
329 struct asl_start_dependent_desc std; 284 struct asl_end_dependent_desc end;
330 struct asl_end_dependent_desc end; 285 struct asl_io_port_desc iop;
331 struct asl_io_port_desc iop; 286 struct asl_fixed_io_port_desc fio;
332 struct asl_fixed_io_port_desc fio; 287 struct asl_small_vendor_desc smv;
333 struct asl_small_vendor_desc smv; 288 struct asl_end_tag_desc et;
334 struct asl_end_tag_desc et; 289
335 290 struct asl_memory_24_desc M24;
336 struct asl_memory_24_desc M24; 291 struct asl_large_vendor_desc lgv;
337 struct asl_large_vendor_desc lgv; 292 struct asl_memory_32_desc M32;
338 struct asl_memory_32_desc M32; 293 struct asl_fixed_memory_32_desc F32;
339 struct asl_fixed_memory_32_desc F32; 294 struct asl_qword_address_desc qas;
340 struct asl_qword_address_desc qas; 295 struct asl_dword_address_desc das;
341 struct asl_dword_address_desc das; 296 struct asl_word_address_desc was;
342 struct asl_word_address_desc was; 297 struct asl_extended_address_desc eas;
343 struct asl_extended_address_desc eas; 298 struct asl_extended_xrupt_desc exx;
344 struct asl_extended_xrupt_desc exx; 299 struct asl_general_register_desc grg;
345 struct asl_general_register_desc grg; 300 u32 u32_item;
346 u32 u32_item; 301 u16 u16_item;
347 u16 u16_item; 302 u8 U8item;
348 u8 U8item;
349}; 303};
350 304
351
352#endif 305#endif
353
diff --git a/include/acpi/container.h b/include/acpi/container.h
index d716df04d9dc..a703f14e049e 100644
--- a/include/acpi/container.h
+++ b/include/acpi/container.h
@@ -9,5 +9,4 @@ struct acpi_container {
9 int state; 9 int state;
10}; 10};
11 11
12#endif /* __ACPI_CONTAINER_H */ 12#endif /* __ACPI_CONTAINER_H */
13
diff --git a/include/acpi/pdc_intel.h b/include/acpi/pdc_intel.h
index fd6730e4e567..91f4a12a99a1 100644
--- a/include/acpi/pdc_intel.h
+++ b/include/acpi/pdc_intel.h
@@ -14,7 +14,6 @@
14#define ACPI_PDC_SMP_T_SWCOORD (0x0080) 14#define ACPI_PDC_SMP_T_SWCOORD (0x0080)
15#define ACPI_PDC_C_C1_FFH (0x0100) 15#define ACPI_PDC_C_C1_FFH (0x0100)
16 16
17
18#define ACPI_PDC_EST_CAPABILITY_SMP (ACPI_PDC_SMP_C1PT | \ 17#define ACPI_PDC_EST_CAPABILITY_SMP (ACPI_PDC_SMP_C1PT | \
19 ACPI_PDC_C_C1_HALT) 18 ACPI_PDC_C_C1_HALT)
20 19
@@ -25,5 +24,4 @@
25 ACPI_PDC_SMP_C1PT | \ 24 ACPI_PDC_SMP_C1PT | \
26 ACPI_PDC_C_C1_HALT) 25 ACPI_PDC_C_C1_HALT)
27 26
28#endif /* __PDC_INTEL_H__ */ 27#endif /* __PDC_INTEL_H__ */
29
diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h
index adf969efa510..16609c1ab2eb 100644
--- a/include/acpi/platform/acenv.h
+++ b/include/acpi/platform/acenv.h
@@ -44,40 +44,42 @@
44#ifndef __ACENV_H__ 44#ifndef __ACENV_H__
45#define __ACENV_H__ 45#define __ACENV_H__
46 46
47
48/* 47/*
49 * Configuration for ACPI tools and utilities 48 * Configuration for ACPI tools and utilities
50 */ 49 */
51 50
52#ifdef _ACPI_DUMP_APP 51#ifdef ACPI_LIBRARY
52#define ACPI_USE_LOCAL_CACHE
53#endif
54
55#ifdef ACPI_DUMP_APP
53#ifndef MSDOS 56#ifndef MSDOS
54#define ACPI_DEBUG_OUTPUT 57#define ACPI_DEBUG_OUTPUT
55#endif 58#endif
56#define ACPI_APPLICATION 59#define ACPI_APPLICATION
57#define ACPI_DISASSEMBLER 60#define ACPI_DISASSEMBLER
58#define ACPI_NO_METHOD_EXECUTION 61#define ACPI_NO_METHOD_EXECUTION
59#define ACPI_USE_SYSTEM_CLIBRARY
60#define ACPI_ENABLE_OBJECT_CACHE
61#endif 62#endif
62 63
63#ifdef _ACPI_EXEC_APP 64#ifdef ACPI_EXEC_APP
64#undef DEBUGGER_THREADING 65#undef DEBUGGER_THREADING
65#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED 66#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED
66#define ACPI_DEBUG_OUTPUT 67#define ACPI_DEBUG_OUTPUT
67#define ACPI_APPLICATION 68#define ACPI_APPLICATION
68#define ACPI_DEBUGGER 69#define ACPI_DEBUGGER
69#define ACPI_DISASSEMBLER 70#define ACPI_DISASSEMBLER
70#define ACPI_USE_SYSTEM_CLIBRARY
71#define ACPI_ENABLE_OBJECT_CACHE
72#endif 71#endif
73 72
74#ifdef _ACPI_ASL_COMPILER 73#ifdef ACPI_ASL_COMPILER
75#define ACPI_DEBUG_OUTPUT 74#define ACPI_DEBUG_OUTPUT
76#define ACPI_APPLICATION 75#define ACPI_APPLICATION
77#define ACPI_DISASSEMBLER 76#define ACPI_DISASSEMBLER
78#define ACPI_CONSTANT_EVAL_ONLY 77#define ACPI_CONSTANT_EVAL_ONLY
78#endif
79
80#ifdef ACPI_APPLICATION
79#define ACPI_USE_SYSTEM_CLIBRARY 81#define ACPI_USE_SYSTEM_CLIBRARY
80#define ACPI_ENABLE_OBJECT_CACHE 82#define ACPI_USE_LOCAL_CACHE
81#endif 83#endif
82 84
83/* 85/*
@@ -131,7 +133,7 @@
131#elif defined(WIN64) 133#elif defined(WIN64)
132#include "acwin64.h" 134#include "acwin64.h"
133 135
134#elif defined(MSDOS) /* Must appear after WIN32 and WIN64 check */ 136#elif defined(MSDOS) /* Must appear after WIN32 and WIN64 check */
135#include "acdos16.h" 137#include "acdos16.h"
136 138
137#elif defined(__FreeBSD__) 139#elif defined(__FreeBSD__)
@@ -177,7 +179,6 @@
177 179
178/*! [End] no source code translation !*/ 180/*! [End] no source code translation !*/
179 181
180
181/* 182/*
182 * Debugger threading model 183 * Debugger threading model
183 * Use single threaded if the entire subsystem is contained in an application 184 * Use single threaded if the entire subsystem is contained in an application
@@ -196,8 +197,7 @@
196#else 197#else
197#define DEBUGGER_THREADING DEBUGGER_MULTI_THREADED 198#define DEBUGGER_THREADING DEBUGGER_MULTI_THREADED
198#endif 199#endif
199#endif /* !DEBUGGER_THREADING */ 200#endif /* !DEBUGGER_THREADING */
200
201 201
202/****************************************************************************** 202/******************************************************************************
203 * 203 *
@@ -219,7 +219,7 @@
219#include <string.h> 219#include <string.h>
220#include <ctype.h> 220#include <ctype.h>
221 221
222#endif /* ACPI_USE_STANDARD_HEADERS */ 222#endif /* ACPI_USE_STANDARD_HEADERS */
223 223
224/* 224/*
225 * We will be linking to the standard Clib functions 225 * We will be linking to the standard Clib functions
@@ -238,15 +238,15 @@
238#define ACPI_MEMCPY(d,s,n) (void) memcpy((d), (s), (acpi_size)(n)) 238#define ACPI_MEMCPY(d,s,n) (void) memcpy((d), (s), (acpi_size)(n))
239#define ACPI_MEMSET(d,s,n) (void) memset((d), (s), (acpi_size)(n)) 239#define ACPI_MEMSET(d,s,n) (void) memset((d), (s), (acpi_size)(n))
240 240
241#define ACPI_TOUPPER toupper 241#define ACPI_TOUPPER(i) toupper((int) (i))
242#define ACPI_TOLOWER tolower 242#define ACPI_TOLOWER(i) tolower((int) (i))
243#define ACPI_IS_XDIGIT isxdigit 243#define ACPI_IS_XDIGIT(i) isxdigit((int) (i))
244#define ACPI_IS_DIGIT isdigit 244#define ACPI_IS_DIGIT(i) isdigit((int) (i))
245#define ACPI_IS_SPACE isspace 245#define ACPI_IS_SPACE(i) isspace((int) (i))
246#define ACPI_IS_UPPER isupper 246#define ACPI_IS_UPPER(i) isupper((int) (i))
247#define ACPI_IS_PRINT isprint 247#define ACPI_IS_PRINT(i) isprint((int) (i))
248#define ACPI_IS_ALPHA isalpha 248#define ACPI_IS_ALPHA(i) isalpha((int) (i))
249#define ACPI_IS_ASCII isascii 249#define ACPI_IS_ASCII(i) isascii((int) (i))
250 250
251#else 251#else
252 252
@@ -257,18 +257,18 @@
257 *****************************************************************************/ 257 *****************************************************************************/
258 258
259 /* 259 /*
260 * Use local definitions of C library macros and functions 260 * Use local definitions of C library macros and functions
261 * NOTE: The function implementations may not be as efficient 261 * NOTE: The function implementations may not be as efficient
262 * as an inline or assembly code implementation provided by a 262 * as an inline or assembly code implementation provided by a
263 * native C library. 263 * native C library.
264 */ 264 */
265 265
266#ifndef va_arg 266#ifndef va_arg
267 267
268#ifndef _VALIST 268#ifndef _VALIST
269#define _VALIST 269#define _VALIST
270typedef char *va_list; 270typedef char *va_list;
271#endif /* _VALIST */ 271#endif /* _VALIST */
272 272
273/* 273/*
274 * Storage alignment properties 274 * Storage alignment properties
@@ -284,8 +284,7 @@ typedef char *va_list;
284#define va_end(ap) (void) 0 284#define va_end(ap) (void) 0
285#define va_start(ap, A) (void) ((ap) = (((char *) &(A)) + (_bnd (A,_AUPBND)))) 285#define va_start(ap, A) (void) ((ap) = (((char *) &(A)) + (_bnd (A,_AUPBND))))
286 286
287#endif /* va_arg */ 287#endif /* va_arg */
288
289 288
290#define ACPI_STRSTR(s1,s2) acpi_ut_strstr ((s1), (s2)) 289#define ACPI_STRSTR(s1,s2) acpi_ut_strstr ((s1), (s2))
291#define ACPI_STRCHR(s1,c) acpi_ut_strchr ((s1), (c)) 290#define ACPI_STRCHR(s1,c) acpi_ut_strchr ((s1), (c))
@@ -303,8 +302,7 @@ typedef char *va_list;
303#define ACPI_TOUPPER acpi_ut_to_upper 302#define ACPI_TOUPPER acpi_ut_to_upper
304#define ACPI_TOLOWER acpi_ut_to_lower 303#define ACPI_TOLOWER acpi_ut_to_lower
305 304
306#endif /* ACPI_USE_SYSTEM_CLIBRARY */ 305#endif /* ACPI_USE_SYSTEM_CLIBRARY */
307
308 306
309/****************************************************************************** 307/******************************************************************************
310 * 308 *
@@ -345,8 +343,7 @@ typedef char *va_list;
345#define ACPI_ACQUIRE_GLOBAL_LOCK(Glptr, acq) 343#define ACPI_ACQUIRE_GLOBAL_LOCK(Glptr, acq)
346#define ACPI_RELEASE_GLOBAL_LOCK(Glptr, acq) 344#define ACPI_RELEASE_GLOBAL_LOCK(Glptr, acq)
347 345
348#endif /* ACPI_ASM_MACROS */ 346#endif /* ACPI_ASM_MACROS */
349
350 347
351#ifdef ACPI_APPLICATION 348#ifdef ACPI_APPLICATION
352 349
@@ -356,11 +353,10 @@ typedef char *va_list;
356#define BREAKPOINT3 353#define BREAKPOINT3
357#endif 354#endif
358 355
359
360/****************************************************************************** 356/******************************************************************************
361 * 357 *
362 * Compiler-specific information is contained in the compiler-specific 358 * Compiler-specific information is contained in the compiler-specific
363 * headers. 359 * headers.
364 * 360 *
365 *****************************************************************************/ 361 *****************************************************************************/
366#endif /* __ACENV_H__ */ 362#endif /* __ACENV_H__ */
diff --git a/include/acpi/platform/acgcc.h b/include/acpi/platform/acgcc.h
index 91fda36b042b..4c0e0ba09ba0 100644
--- a/include/acpi/platform/acgcc.h
+++ b/include/acpi/platform/acgcc.h
@@ -44,16 +44,20 @@
44#ifndef __ACGCC_H__ 44#ifndef __ACGCC_H__
45#define __ACGCC_H__ 45#define __ACGCC_H__
46 46
47/* Function name is used for debug output. Non-ANSI, compiler-dependent */
48
49#define ACPI_GET_FUNCTION_NAME __FUNCTION__
50
47/* This macro is used to tag functions as "printf-like" because 51/* This macro is used to tag functions as "printf-like" because
48 * some compilers (like GCC) can catch printf format string problems. 52 * some compilers (like GCC) can catch printf format string problems.
49 */ 53 */
50#define ACPI_PRINTF_LIKE_FUNC __attribute__ ((__format__ (__printf__, 4, 5))) 54#define ACPI_PRINTF_LIKE_FUNC __attribute__ ((__format__ (__printf__, 6, 7)))
51 55
52/* Some compilers complain about unused variables. Sometimes we don't want to 56/* Some compilers complain about unused variables. Sometimes we don't want to
53 * use all the variables (most specifically for _THIS_MODULE). This allow us 57 * use all the variables (for example, _acpi_module_name). This allows us
54 * to to tell the compiler warning in a per-variable manner that a variable 58 * to to tell the compiler warning in a per-variable manner that a variable
55 * is unused. 59 * is unused.
56 */ 60 */
57#define ACPI_UNUSED_VAR __attribute__ ((unused)) 61#define ACPI_UNUSED_VAR __attribute__ ((unused))
58 62
59#endif /* __ACGCC_H__ */ 63#endif /* __ACGCC_H__ */
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index a3de0db85694..c93e6562f0e1 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -62,7 +62,16 @@
62 62
63#define ACPI_MACHINE_WIDTH BITS_PER_LONG 63#define ACPI_MACHINE_WIDTH BITS_PER_LONG
64 64
65#else /* !__KERNEL__ */ 65/* Type(s) for the OSL */
66
67#ifdef ACPI_USE_LOCAL_CACHE
68#define acpi_cache_t struct acpi_memory_list
69#else
70#include <linux/slab.h>
71#define acpi_cache_t kmem_cache_t
72#endif
73
74#else /* !__KERNEL__ */
66 75
67#include <stdarg.h> 76#include <stdarg.h>
68#include <string.h> 77#include <string.h>
@@ -83,10 +92,10 @@
83 92
84#define __cdecl 93#define __cdecl
85#define ACPI_FLUSH_CPU_CACHE() 94#define ACPI_FLUSH_CPU_CACHE()
86#endif /* __KERNEL__ */ 95#endif /* __KERNEL__ */
87 96
88/* Linux uses GCC */ 97/* Linux uses GCC */
89 98
90#include "acgcc.h" 99#include "acgcc.h"
91 100
92#endif /* __ACLINUX_H__ */ 101#endif /* __ACLINUX_H__ */
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index 50cfea4ff6ca..7a00d5089de9 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -23,45 +23,44 @@
23struct acpi_processor_cx; 23struct acpi_processor_cx;
24 24
25struct acpi_power_register { 25struct acpi_power_register {
26 u8 descriptor; 26 u8 descriptor;
27 u16 length; 27 u16 length;
28 u8 space_id; 28 u8 space_id;
29 u8 bit_width; 29 u8 bit_width;
30 u8 bit_offset; 30 u8 bit_offset;
31 u8 reserved; 31 u8 reserved;
32 u64 address; 32 u64 address;
33} __attribute__ ((packed)); 33} __attribute__ ((packed));
34 34
35
36struct acpi_processor_cx_policy { 35struct acpi_processor_cx_policy {
37 u32 count; 36 u32 count;
38 struct acpi_processor_cx *state; 37 struct acpi_processor_cx *state;
39 struct { 38 struct {
40 u32 time; 39 u32 time;
41 u32 ticks; 40 u32 ticks;
42 u32 count; 41 u32 count;
43 u32 bm; 42 u32 bm;
44 } threshold; 43 } threshold;
45}; 44};
46 45
47struct acpi_processor_cx { 46struct acpi_processor_cx {
48 u8 valid; 47 u8 valid;
49 u8 type; 48 u8 type;
50 u32 address; 49 u32 address;
51 u32 latency; 50 u32 latency;
52 u32 latency_ticks; 51 u32 latency_ticks;
53 u32 power; 52 u32 power;
54 u32 usage; 53 u32 usage;
55 struct acpi_processor_cx_policy promotion; 54 struct acpi_processor_cx_policy promotion;
56 struct acpi_processor_cx_policy demotion; 55 struct acpi_processor_cx_policy demotion;
57}; 56};
58 57
59struct acpi_processor_power { 58struct acpi_processor_power {
60 struct acpi_processor_cx *state; 59 struct acpi_processor_cx *state;
61 unsigned long bm_check_timestamp; 60 unsigned long bm_check_timestamp;
62 u32 default_state; 61 u32 default_state;
63 u32 bm_activity; 62 u32 bm_activity;
64 int count; 63 int count;
65 struct acpi_processor_cx states[ACPI_PROCESSOR_MAX_POWER]; 64 struct acpi_processor_cx states[ACPI_PROCESSOR_MAX_POWER];
66 65
67 /* the _PDC objects passed by the driver, if any */ 66 /* the _PDC objects passed by the driver, if any */
@@ -71,85 +70,82 @@ struct acpi_processor_power {
71/* Performance Management */ 70/* Performance Management */
72 71
73struct acpi_pct_register { 72struct acpi_pct_register {
74 u8 descriptor; 73 u8 descriptor;
75 u16 length; 74 u16 length;
76 u8 space_id; 75 u8 space_id;
77 u8 bit_width; 76 u8 bit_width;
78 u8 bit_offset; 77 u8 bit_offset;
79 u8 reserved; 78 u8 reserved;
80 u64 address; 79 u64 address;
81} __attribute__ ((packed)); 80} __attribute__ ((packed));
82 81
83struct acpi_processor_px { 82struct acpi_processor_px {
84 acpi_integer core_frequency; /* megahertz */ 83 acpi_integer core_frequency; /* megahertz */
85 acpi_integer power; /* milliWatts */ 84 acpi_integer power; /* milliWatts */
86 acpi_integer transition_latency; /* microseconds */ 85 acpi_integer transition_latency; /* microseconds */
87 acpi_integer bus_master_latency; /* microseconds */ 86 acpi_integer bus_master_latency; /* microseconds */
88 acpi_integer control; /* control value */ 87 acpi_integer control; /* control value */
89 acpi_integer status; /* success indicator */ 88 acpi_integer status; /* success indicator */
90}; 89};
91 90
92struct acpi_processor_performance { 91struct acpi_processor_performance {
93 unsigned int state; 92 unsigned int state;
94 unsigned int platform_limit; 93 unsigned int platform_limit;
95 struct acpi_pct_register control_register; 94 struct acpi_pct_register control_register;
96 struct acpi_pct_register status_register; 95 struct acpi_pct_register status_register;
97 unsigned int state_count; 96 unsigned int state_count;
98 struct acpi_processor_px *states; 97 struct acpi_processor_px *states;
99 98
100 /* the _PDC objects passed by the driver, if any */ 99 /* the _PDC objects passed by the driver, if any */
101 struct acpi_object_list *pdc; 100 struct acpi_object_list *pdc;
102}; 101};
103 102
104
105
106/* Throttling Control */ 103/* Throttling Control */
107 104
108struct acpi_processor_tx { 105struct acpi_processor_tx {
109 u16 power; 106 u16 power;
110 u16 performance; 107 u16 performance;
111}; 108};
112 109
113struct acpi_processor_throttling { 110struct acpi_processor_throttling {
114 int state; 111 int state;
115 u32 address; 112 u32 address;
116 u8 duty_offset; 113 u8 duty_offset;
117 u8 duty_width; 114 u8 duty_width;
118 int state_count; 115 int state_count;
119 struct acpi_processor_tx states[ACPI_PROCESSOR_MAX_THROTTLING]; 116 struct acpi_processor_tx states[ACPI_PROCESSOR_MAX_THROTTLING];
120}; 117};
121 118
122/* Limit Interface */ 119/* Limit Interface */
123 120
124struct acpi_processor_lx { 121struct acpi_processor_lx {
125 int px; /* performace state */ 122 int px; /* performace state */
126 int tx; /* throttle level */ 123 int tx; /* throttle level */
127}; 124};
128 125
129struct acpi_processor_limit { 126struct acpi_processor_limit {
130 struct acpi_processor_lx state; /* current limit */ 127 struct acpi_processor_lx state; /* current limit */
131 struct acpi_processor_lx thermal; /* thermal limit */ 128 struct acpi_processor_lx thermal; /* thermal limit */
132 struct acpi_processor_lx user; /* user limit */ 129 struct acpi_processor_lx user; /* user limit */
133}; 130};
134 131
135
136struct acpi_processor_flags { 132struct acpi_processor_flags {
137 u8 power:1; 133 u8 power:1;
138 u8 performance:1; 134 u8 performance:1;
139 u8 throttling:1; 135 u8 throttling:1;
140 u8 limit:1; 136 u8 limit:1;
141 u8 bm_control:1; 137 u8 bm_control:1;
142 u8 bm_check:1; 138 u8 bm_check:1;
143 u8 has_cst:1; 139 u8 has_cst:1;
144 u8 power_setup_done:1; 140 u8 power_setup_done:1;
145}; 141};
146 142
147struct acpi_processor { 143struct acpi_processor {
148 acpi_handle handle; 144 acpi_handle handle;
149 u32 acpi_id; 145 u32 acpi_id;
150 u32 id; 146 u32 id;
151 u32 pblk; 147 u32 pblk;
152 int performance_platform_limit; 148 int performance_platform_limit;
153 struct acpi_processor_flags flags; 149 struct acpi_processor_flags flags;
154 struct acpi_processor_power power; 150 struct acpi_processor_power power;
155 struct acpi_processor_performance *performance; 151 struct acpi_processor_performance *performance;
@@ -158,50 +154,49 @@ struct acpi_processor {
158}; 154};
159 155
160struct acpi_processor_errata { 156struct acpi_processor_errata {
161 u8 smp; 157 u8 smp;
162 struct { 158 struct {
163 u8 throttle:1; 159 u8 throttle:1;
164 u8 fdma:1; 160 u8 fdma:1;
165 u8 reserved:6; 161 u8 reserved:6;
166 u32 bmisx; 162 u32 bmisx;
167 } piix4; 163 } piix4;
168}; 164};
169 165
170extern int acpi_processor_register_performance ( 166extern int acpi_processor_register_performance(struct acpi_processor_performance
171 struct acpi_processor_performance * performance, 167 *performance, unsigned int cpu);
172 unsigned int cpu); 168extern void acpi_processor_unregister_performance(struct
173extern void acpi_processor_unregister_performance ( 169 acpi_processor_performance
174 struct acpi_processor_performance * performance, 170 *performance,
175 unsigned int cpu); 171 unsigned int cpu);
176 172
177/* note: this locks both the calling module and the processor module 173/* note: this locks both the calling module and the processor module
178 if a _PPC object exists, rmmod is disallowed then */ 174 if a _PPC object exists, rmmod is disallowed then */
179int acpi_processor_notify_smm(struct module *calling_module); 175int acpi_processor_notify_smm(struct module *calling_module);
180 176
181
182
183/* for communication between multiple parts of the processor kernel module */ 177/* for communication between multiple parts of the processor kernel module */
184extern struct acpi_processor *processors[NR_CPUS]; 178extern struct acpi_processor *processors[NR_CPUS];
185extern struct acpi_processor_errata errata; 179extern struct acpi_processor_errata errata;
186 180
187int acpi_processor_set_pdc(struct acpi_processor *pr, 181int acpi_processor_set_pdc(struct acpi_processor *pr,
188 struct acpi_object_list *pdc_in); 182 struct acpi_object_list *pdc_in);
189 183
190#ifdef ARCH_HAS_POWER_PDC_INIT 184#ifdef ARCH_HAS_POWER_PDC_INIT
191void acpi_processor_power_init_pdc(struct acpi_processor_power *pow, 185void acpi_processor_power_init_pdc(struct acpi_processor_power *pow,
192 unsigned int cpu); 186 unsigned int cpu);
193void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags, 187void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags,
194 unsigned int cpu); 188 unsigned int cpu);
195#else 189#else
196static inline void acpi_processor_power_init_pdc( 190static inline void acpi_processor_power_init_pdc(struct acpi_processor_power
197 struct acpi_processor_power *pow, unsigned int cpu) 191 *pow, unsigned int cpu)
198{ 192{
199 pow->pdc = NULL; 193 pow->pdc = NULL;
200 return; 194 return;
201} 195}
202 196
203static inline void acpi_processor_power_init_bm_check( 197static inline void acpi_processor_power_init_bm_check(struct
204 struct acpi_processor_flags *flags, unsigned int cpu) 198 acpi_processor_flags
199 *flags, unsigned int cpu)
205{ 200{
206 flags->bm_check = 1; 201 flags->bm_check = 1;
207 return; 202 return;
@@ -215,51 +210,62 @@ void acpi_processor_ppc_init(void);
215void acpi_processor_ppc_exit(void); 210void acpi_processor_ppc_exit(void);
216int acpi_processor_ppc_has_changed(struct acpi_processor *pr); 211int acpi_processor_ppc_has_changed(struct acpi_processor *pr);
217#else 212#else
218static inline void acpi_processor_ppc_init(void) { return; } 213static inline void acpi_processor_ppc_init(void)
219static inline void acpi_processor_ppc_exit(void) { return; } 214{
220static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr) { 215 return;
216}
217static inline void acpi_processor_ppc_exit(void)
218{
219 return;
220}
221static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr)
222{
221 static unsigned int printout = 1; 223 static unsigned int printout = 1;
222 if (printout) { 224 if (printout) {
223 printk(KERN_WARNING "Warning: Processor Platform Limit event detected, but not handled.\n"); 225 printk(KERN_WARNING
224 printk(KERN_WARNING "Consider compiling CPUfreq support into your kernel.\n"); 226 "Warning: Processor Platform Limit event detected, but not handled.\n");
227 printk(KERN_WARNING
228 "Consider compiling CPUfreq support into your kernel.\n");
225 printout = 0; 229 printout = 0;
226 } 230 }
227 return 0; 231 return 0;
228} 232}
229#endif /* CONFIG_CPU_FREQ */ 233#endif /* CONFIG_CPU_FREQ */
230 234
231/* in processor_throttling.c */ 235/* in processor_throttling.c */
232int acpi_processor_get_throttling_info (struct acpi_processor *pr); 236int acpi_processor_get_throttling_info(struct acpi_processor *pr);
233int acpi_processor_set_throttling (struct acpi_processor *pr, int state); 237int acpi_processor_set_throttling(struct acpi_processor *pr, int state);
234ssize_t acpi_processor_write_throttling ( 238ssize_t acpi_processor_write_throttling(struct file *file,
235 struct file *file, 239 const char __user * buffer,
236 const char __user *buffer, 240 size_t count, loff_t * data);
237 size_t count,
238 loff_t *data);
239extern struct file_operations acpi_processor_throttling_fops; 241extern struct file_operations acpi_processor_throttling_fops;
240 242
241/* in processor_idle.c */ 243/* in processor_idle.c */
242int acpi_processor_power_init(struct acpi_processor *pr, struct acpi_device *device); 244int acpi_processor_power_init(struct acpi_processor *pr,
243int acpi_processor_cst_has_changed (struct acpi_processor *pr); 245 struct acpi_device *device);
244int acpi_processor_power_exit(struct acpi_processor *pr, struct acpi_device *device); 246int acpi_processor_cst_has_changed(struct acpi_processor *pr);
245 247int acpi_processor_power_exit(struct acpi_processor *pr,
248 struct acpi_device *device);
246 249
247/* in processor_thermal.c */ 250/* in processor_thermal.c */
248int acpi_processor_get_limit_info (struct acpi_processor *pr); 251int acpi_processor_get_limit_info(struct acpi_processor *pr);
249ssize_t acpi_processor_write_limit ( 252ssize_t acpi_processor_write_limit(struct file *file,
250 struct file *file, 253 const char __user * buffer,
251 const char __user *buffer, 254 size_t count, loff_t * data);
252 size_t count,
253 loff_t *data);
254extern struct file_operations acpi_processor_limit_fops; 255extern struct file_operations acpi_processor_limit_fops;
255 256
256#ifdef CONFIG_CPU_FREQ 257#ifdef CONFIG_CPU_FREQ
257void acpi_thermal_cpufreq_init(void); 258void acpi_thermal_cpufreq_init(void);
258void acpi_thermal_cpufreq_exit(void); 259void acpi_thermal_cpufreq_exit(void);
259#else 260#else
260static inline void acpi_thermal_cpufreq_init(void) { return; } 261static inline void acpi_thermal_cpufreq_init(void)
261static inline void acpi_thermal_cpufreq_exit(void) { return; } 262{
263 return;
264}
265static inline void acpi_thermal_cpufreq_exit(void)
266{
267 return;
268}
262#endif 269#endif
263 270
264
265#endif 271#endif
diff --git a/include/asm-alpha/pci.h b/include/asm-alpha/pci.h
index f681e675b823..4e115f368d5f 100644
--- a/include/asm-alpha/pci.h
+++ b/include/asm-alpha/pci.h
@@ -254,6 +254,19 @@ extern void pcibios_resource_to_bus(struct pci_dev *, struct pci_bus_region *,
254extern void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, 254extern void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
255 struct pci_bus_region *region); 255 struct pci_bus_region *region);
256 256
257static inline struct resource *
258pcibios_select_root(struct pci_dev *pdev, struct resource *res)
259{
260 struct resource *root = NULL;
261
262 if (res->flags & IORESOURCE_IO)
263 root = &ioport_resource;
264 if (res->flags & IORESOURCE_MEM)
265 root = &iomem_resource;
266
267 return root;
268}
269
257#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index 270#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
258 271
259static inline int pci_proc_domain(struct pci_bus *bus) 272static inline int pci_proc_domain(struct pci_bus *bus)
diff --git a/include/asm-alpha/spinlock.h b/include/asm-alpha/spinlock.h
index 80780dba9986..8197c69eff44 100644
--- a/include/asm-alpha/spinlock.h
+++ b/include/asm-alpha/spinlock.h
@@ -6,7 +6,6 @@
6#include <linux/kernel.h> 6#include <linux/kernel.h>
7#include <asm/current.h> 7#include <asm/current.h>
8 8
9
10/* 9/*
11 * Simple spin lock operations. There are two variants, one clears IRQ's 10 * Simple spin lock operations. There are two variants, one clears IRQ's
12 * on the local processor, one does not. 11 * on the local processor, one does not.
@@ -14,43 +13,18 @@
14 * We make no fairness assumptions. They have a cost. 13 * We make no fairness assumptions. They have a cost.
15 */ 14 */
16 15
17typedef struct { 16#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock)
18 volatile unsigned int lock; 17#define __raw_spin_is_locked(x) ((x)->lock != 0)
19#ifdef CONFIG_DEBUG_SPINLOCK 18#define __raw_spin_unlock_wait(x) \
20 int on_cpu; 19 do { cpu_relax(); } while ((x)->lock)
21 int line_no; 20
22 void *previous; 21static inline void __raw_spin_unlock(raw_spinlock_t * lock)
23 struct task_struct * task;
24 const char *base_file;
25#endif
26} spinlock_t;
27
28#ifdef CONFIG_DEBUG_SPINLOCK
29#define SPIN_LOCK_UNLOCKED (spinlock_t){ 0, -1, 0, NULL, NULL, NULL }
30#else
31#define SPIN_LOCK_UNLOCKED (spinlock_t){ 0 }
32#endif
33
34#define spin_lock_init(x) do { *(x) = SPIN_LOCK_UNLOCKED; } while(0)
35#define spin_is_locked(x) ((x)->lock != 0)
36#define spin_unlock_wait(x) do { barrier(); } while ((x)->lock)
37
38#ifdef CONFIG_DEBUG_SPINLOCK
39extern void _raw_spin_unlock(spinlock_t * lock);
40extern void debug_spin_lock(spinlock_t * lock, const char *, int);
41extern int debug_spin_trylock(spinlock_t * lock, const char *, int);
42#define _raw_spin_lock(LOCK) \
43 debug_spin_lock(LOCK, __BASE_FILE__, __LINE__)
44#define _raw_spin_trylock(LOCK) \
45 debug_spin_trylock(LOCK, __BASE_FILE__, __LINE__)
46#else
47static inline void _raw_spin_unlock(spinlock_t * lock)
48{ 22{
49 mb(); 23 mb();
50 lock->lock = 0; 24 lock->lock = 0;
51} 25}
52 26
53static inline void _raw_spin_lock(spinlock_t * lock) 27static inline void __raw_spin_lock(raw_spinlock_t * lock)
54{ 28{
55 long tmp; 29 long tmp;
56 30
@@ -70,80 +44,64 @@ static inline void _raw_spin_lock(spinlock_t * lock)
70 : "m"(lock->lock) : "memory"); 44 : "m"(lock->lock) : "memory");
71} 45}
72 46
73static inline int _raw_spin_trylock(spinlock_t *lock) 47static inline int __raw_spin_trylock(raw_spinlock_t *lock)
74{ 48{
75 return !test_and_set_bit(0, &lock->lock); 49 return !test_and_set_bit(0, &lock->lock);
76} 50}
77#endif /* CONFIG_DEBUG_SPINLOCK */
78
79#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock)
80 51
81/***********************************************************/ 52/***********************************************************/
82 53
83typedef struct { 54static inline int __raw_read_can_lock(raw_rwlock_t *lock)
84 volatile unsigned int lock;
85} rwlock_t;
86
87#define RW_LOCK_UNLOCKED (rwlock_t){ 0 }
88
89#define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while(0)
90
91static inline int read_can_lock(rwlock_t *lock)
92{ 55{
93 return (lock->lock & 1) == 0; 56 return (lock->lock & 1) == 0;
94} 57}
95 58
96static inline int write_can_lock(rwlock_t *lock) 59static inline int __raw_write_can_lock(raw_rwlock_t *lock)
97{ 60{
98 return lock->lock == 0; 61 return lock->lock == 0;
99} 62}
100 63
101#ifdef CONFIG_DEBUG_RWLOCK 64static inline void __raw_read_lock(raw_rwlock_t *lock)
102extern void _raw_write_lock(rwlock_t * lock);
103extern void _raw_read_lock(rwlock_t * lock);
104#else
105static inline void _raw_write_lock(rwlock_t * lock)
106{ 65{
107 long regx; 66 long regx;
108 67
109 __asm__ __volatile__( 68 __asm__ __volatile__(
110 "1: ldl_l %1,%0\n" 69 "1: ldl_l %1,%0\n"
111 " bne %1,6f\n" 70 " blbs %1,6f\n"
112 " lda %1,1\n" 71 " subl %1,2,%1\n"
113 " stl_c %1,%0\n" 72 " stl_c %1,%0\n"
114 " beq %1,6f\n" 73 " beq %1,6f\n"
115 " mb\n" 74 " mb\n"
116 ".subsection 2\n" 75 ".subsection 2\n"
117 "6: ldl %1,%0\n" 76 "6: ldl %1,%0\n"
118 " bne %1,6b\n" 77 " blbs %1,6b\n"
119 " br 1b\n" 78 " br 1b\n"
120 ".previous" 79 ".previous"
121 : "=m" (*lock), "=&r" (regx) 80 : "=m" (*lock), "=&r" (regx)
122 : "m" (*lock) : "memory"); 81 : "m" (*lock) : "memory");
123} 82}
124 83
125static inline void _raw_read_lock(rwlock_t * lock) 84static inline void __raw_write_lock(raw_rwlock_t *lock)
126{ 85{
127 long regx; 86 long regx;
128 87
129 __asm__ __volatile__( 88 __asm__ __volatile__(
130 "1: ldl_l %1,%0\n" 89 "1: ldl_l %1,%0\n"
131 " blbs %1,6f\n" 90 " bne %1,6f\n"
132 " subl %1,2,%1\n" 91 " lda %1,1\n"
133 " stl_c %1,%0\n" 92 " stl_c %1,%0\n"
134 " beq %1,6f\n" 93 " beq %1,6f\n"
135 " mb\n" 94 " mb\n"
136 ".subsection 2\n" 95 ".subsection 2\n"
137 "6: ldl %1,%0\n" 96 "6: ldl %1,%0\n"
138 " blbs %1,6b\n" 97 " bne %1,6b\n"
139 " br 1b\n" 98 " br 1b\n"
140 ".previous" 99 ".previous"
141 : "=m" (*lock), "=&r" (regx) 100 : "=m" (*lock), "=&r" (regx)
142 : "m" (*lock) : "memory"); 101 : "m" (*lock) : "memory");
143} 102}
144#endif /* CONFIG_DEBUG_RWLOCK */
145 103
146static inline int _raw_read_trylock(rwlock_t * lock) 104static inline int __raw_read_trylock(raw_rwlock_t * lock)
147{ 105{
148 long regx; 106 long regx;
149 int success; 107 int success;
@@ -165,7 +123,7 @@ static inline int _raw_read_trylock(rwlock_t * lock)
165 return success; 123 return success;
166} 124}
167 125
168static inline int _raw_write_trylock(rwlock_t * lock) 126static inline int __raw_write_trylock(raw_rwlock_t * lock)
169{ 127{
170 long regx; 128 long regx;
171 int success; 129 int success;
@@ -187,13 +145,7 @@ static inline int _raw_write_trylock(rwlock_t * lock)
187 return success; 145 return success;
188} 146}
189 147
190static inline void _raw_write_unlock(rwlock_t * lock) 148static inline void __raw_read_unlock(raw_rwlock_t * lock)
191{
192 mb();
193 lock->lock = 0;
194}
195
196static inline void _raw_read_unlock(rwlock_t * lock)
197{ 149{
198 long regx; 150 long regx;
199 __asm__ __volatile__( 151 __asm__ __volatile__(
@@ -209,4 +161,10 @@ static inline void _raw_read_unlock(rwlock_t * lock)
209 : "m" (*lock) : "memory"); 161 : "m" (*lock) : "memory");
210} 162}
211 163
164static inline void __raw_write_unlock(raw_rwlock_t * lock)
165{
166 mb();
167 lock->lock = 0;
168}
169
212#endif /* _ALPHA_SPINLOCK_H */ 170#endif /* _ALPHA_SPINLOCK_H */
diff --git a/include/asm-alpha/spinlock_types.h b/include/asm-alpha/spinlock_types.h
new file mode 100644
index 000000000000..8141eb5ebf0d
--- /dev/null
+++ b/include/asm-alpha/spinlock_types.h
@@ -0,0 +1,20 @@
1#ifndef _ALPHA_SPINLOCK_TYPES_H
2#define _ALPHA_SPINLOCK_TYPES_H
3
4#ifndef __LINUX_SPINLOCK_TYPES_H
5# error "please don't include this file directly"
6#endif
7
8typedef struct {
9 volatile unsigned int lock;
10} raw_spinlock_t;
11
12#define __RAW_SPIN_LOCK_UNLOCKED { 0 }
13
14typedef struct {
15 volatile unsigned int lock;
16} raw_rwlock_t;
17
18#define __RAW_RW_LOCK_UNLOCKED { 0 }
19
20#endif
diff --git a/include/asm-arm/arch-pxa/hardware.h b/include/asm-arm/arch-pxa/hardware.h
index 72b04d846a23..cf35721cfa45 100644
--- a/include/asm-arm/arch-pxa/hardware.h
+++ b/include/asm-arm/arch-pxa/hardware.h
@@ -44,24 +44,12 @@
44 44
45#ifndef __ASSEMBLY__ 45#ifndef __ASSEMBLY__
46 46
47#if 0 47# define __REG(x) (*((volatile unsigned long *)io_p2v(x)))
48# define __REG(x) (*((volatile u32 *)io_p2v(x)))
49#else
50/*
51 * This __REG() version gives the same results as the one above, except
52 * that we are fooling gcc somehow so it generates far better and smaller
53 * assembly code for access to contigous registers. It's a shame that gcc
54 * doesn't guess this by itself.
55 */
56#include <asm/types.h>
57typedef struct { volatile u32 offset[4096]; } __regbase;
58# define __REGP(x) ((__regbase *)((x)&~4095))->offset[((x)&4095)>>2]
59# define __REG(x) __REGP(io_p2v(x))
60#endif
61 48
62/* With indexed regs we don't want to feed the index through io_p2v() 49/* With indexed regs we don't want to feed the index through io_p2v()
63 especially if it is a variable, otherwise horrible code will result. */ 50 especially if it is a variable, otherwise horrible code will result. */
64# define __REG2(x,y) (*(volatile u32 *)((u32)&__REG(x) + (y))) 51# define __REG2(x,y) \
52 (*(volatile unsigned long *)((unsigned long)&__REG(x) + (y)))
65 53
66# define __PREG(x) (io_v2p((u32)&(x))) 54# define __PREG(x) (io_v2p((u32)&(x)))
67 55
diff --git a/include/asm-arm/arch-pxa/i2c.h b/include/asm-arm/arch-pxa/i2c.h
new file mode 100644
index 000000000000..46ec2243974a
--- /dev/null
+++ b/include/asm-arm/arch-pxa/i2c.h
@@ -0,0 +1,70 @@
1/*
2 * i2c_pxa.h
3 *
4 * Copyright (C) 2002 Intrinsyc Software Inc.
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 */
11#ifndef _I2C_PXA_H_
12#define _I2C_PXA_H_
13
14#if 0
15#define DEF_TIMEOUT 3
16#else
17/* need a longer timeout if we're dealing with the fact we may well be
18 * looking at a multi-master environment
19*/
20#define DEF_TIMEOUT 32
21#endif
22
23#define BUS_ERROR (-EREMOTEIO)
24#define XFER_NAKED (-ECONNREFUSED)
25#define I2C_RETRY (-2000) /* an error has occurred retry transmit */
26
27/* ICR initialize bit values
28*
29* 15. FM 0 (100 Khz operation)
30* 14. UR 0 (No unit reset)
31* 13. SADIE 0 (Disables the unit from interrupting on slave addresses
32* matching its slave address)
33* 12. ALDIE 0 (Disables the unit from interrupt when it loses arbitration
34* in master mode)
35* 11. SSDIE 0 (Disables interrupts from a slave stop detected, in slave mode)
36* 10. BEIE 1 (Enable interrupts from detected bus errors, no ACK sent)
37* 9. IRFIE 1 (Enable interrupts from full buffer received)
38* 8. ITEIE 1 (Enables the I2C unit to interrupt when transmit buffer empty)
39* 7. GCD 1 (Disables i2c unit response to general call messages as a slave)
40* 6. IUE 0 (Disable unit until we change settings)
41* 5. SCLE 1 (Enables the i2c clock output for master mode (drives SCL)
42* 4. MA 0 (Only send stop with the ICR stop bit)
43* 3. TB 0 (We are not transmitting a byte initially)
44* 2. ACKNAK 0 (Send an ACK after the unit receives a byte)
45* 1. STOP 0 (Do not send a STOP)
46* 0. START 0 (Do not send a START)
47*
48*/
49#define I2C_ICR_INIT (ICR_BEIE | ICR_IRFIE | ICR_ITEIE | ICR_GCD | ICR_SCLE)
50
51/* I2C status register init values
52 *
53 * 10. BED 1 (Clear bus error detected)
54 * 9. SAD 1 (Clear slave address detected)
55 * 7. IRF 1 (Clear IDBR Receive Full)
56 * 6. ITE 1 (Clear IDBR Transmit Empty)
57 * 5. ALD 1 (Clear Arbitration Loss Detected)
58 * 4. SSD 1 (Clear Slave Stop Detected)
59 */
60#define I2C_ISR_INIT 0x7FF /* status register init */
61
62struct i2c_slave_client;
63
64struct i2c_pxa_platform_data {
65 unsigned int slave_addr;
66 struct i2c_slave_client *slave;
67};
68
69extern void pxa_set_i2c_info(struct i2c_pxa_platform_data *info);
70#endif
diff --git a/include/asm-arm/arch-pxa/mmc.h b/include/asm-arm/arch-pxa/mmc.h
index 9718063a2119..88c17dd02ed2 100644
--- a/include/asm-arm/arch-pxa/mmc.h
+++ b/include/asm-arm/arch-pxa/mmc.h
@@ -9,6 +9,7 @@ struct mmc_host;
9 9
10struct pxamci_platform_data { 10struct pxamci_platform_data {
11 unsigned int ocr_mask; /* available voltages */ 11 unsigned int ocr_mask; /* available voltages */
12 unsigned long detect_delay; /* delay in jiffies before detecting cards after interrupt */
12 int (*init)(struct device *, irqreturn_t (*)(int, void *, struct pt_regs *), void *); 13 int (*init)(struct device *, irqreturn_t (*)(int, void *, struct pt_regs *), void *);
13 int (*get_ro)(struct device *); 14 int (*get_ro)(struct device *);
14 void (*setpower)(struct device *, unsigned int); 15 void (*setpower)(struct device *, unsigned int);
diff --git a/include/asm-arm/arch-pxa/pxafb.h b/include/asm-arm/arch-pxa/pxafb.h
index 27d71e9d413b..21c0e16dce5f 100644
--- a/include/asm-arm/arch-pxa/pxafb.h
+++ b/include/asm-arm/arch-pxa/pxafb.h
@@ -66,3 +66,4 @@ struct pxafb_mach_info {
66 66
67}; 67};
68void set_pxa_fb_info(struct pxafb_mach_info *hard_pxa_fb_info); 68void set_pxa_fb_info(struct pxafb_mach_info *hard_pxa_fb_info);
69unsigned long pxafb_get_hsync_time(struct device *dev);
diff --git a/include/asm-arm/arch-s3c2410/fb.h b/include/asm-arm/arch-s3c2410/fb.h
new file mode 100644
index 000000000000..ac57bc887d82
--- /dev/null
+++ b/include/asm-arm/arch-s3c2410/fb.h
@@ -0,0 +1,69 @@
1/* linux/include/asm/arch-s3c2410/fb.h
2 *
3 * Copyright (c) 2004 Arnaud Patard <arnaud.patard@rtp-net.org>
4 *
5 * Inspired by pxafb.h
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 version 2 as
9 * published by the Free Software Foundation.
10 *
11 *
12 * Changelog:
13 * 07-Sep-2004 RTP Created file
14 * 03-Nov-2004 BJD Updated and minor cleanups
15 * 03-Aug-2005 RTP Renamed to fb.h
16*/
17
18#ifndef __ASM_ARM_FB_H
19#define __ASM_ARM_FB_H
20
21#include <asm/arch/regs-lcd.h>
22
23struct s3c2410fb_val {
24 unsigned int defval;
25 unsigned int min;
26 unsigned int max;
27};
28
29struct s3c2410fb_hw {
30 unsigned long lcdcon1;
31 unsigned long lcdcon2;
32 unsigned long lcdcon3;
33 unsigned long lcdcon4;
34 unsigned long lcdcon5;
35};
36
37struct s3c2410fb_mach_info {
38 unsigned char fixed_syncs; /* do not update sync/border */
39
40 /* Screen size */
41 int width;
42 int height;
43
44 /* Screen info */
45 struct s3c2410fb_val xres;
46 struct s3c2410fb_val yres;
47 struct s3c2410fb_val bpp;
48
49 /* lcd configuration registers */
50 struct s3c2410fb_hw regs;
51
52 /* GPIOs */
53
54 unsigned long gpcup;
55 unsigned long gpcup_mask;
56 unsigned long gpccon;
57 unsigned long gpccon_mask;
58 unsigned long gpdup;
59 unsigned long gpdup_mask;
60 unsigned long gpdcon;
61 unsigned long gpdcon_mask;
62
63 /* lpc3600 control register */
64 unsigned long lpcsel;
65};
66
67void __init set_s3c2410fb_info(struct s3c2410fb_mach_info *hard_s3c2410fb_info);
68
69#endif /* __ASM_ARM_FB_H */
diff --git a/include/asm-arm/arch-s3c2410/regs-lcd.h b/include/asm-arm/arch-s3c2410/regs-lcd.h
index 7f882ea92b2a..b6b1b4e8bbeb 100644
--- a/include/asm-arm/arch-s3c2410/regs-lcd.h
+++ b/include/asm-arm/arch-s3c2410/regs-lcd.h
@@ -51,21 +51,32 @@
51 51
52#define S3C2410_LCDCON1_ENVID (1) 52#define S3C2410_LCDCON1_ENVID (1)
53 53
54#define S3C2410_LCDCON1_MODEMASK 0x1E
55
54#define S3C2410_LCDCON2_VBPD(x) ((x) << 24) 56#define S3C2410_LCDCON2_VBPD(x) ((x) << 24)
55#define S3C2410_LCDCON2_LINEVAL(x) ((x) << 14) 57#define S3C2410_LCDCON2_LINEVAL(x) ((x) << 14)
56#define S3C2410_LCDCON2_VFPD(x) ((x) << 6) 58#define S3C2410_LCDCON2_VFPD(x) ((x) << 6)
57#define S3C2410_LCDCON2_VSPW(x) ((x) << 0) 59#define S3C2410_LCDCON2_VSPW(x) ((x) << 0)
58 60
61#define S3C2410_LCDCON2_GET_VBPD(x) ( ((x) >> 24) & 0xFF)
62#define S3C2410_LCDCON2_GET_VFPD(x) ( ((x) >> 6) & 0xFF)
63#define S3C2410_LCDCON2_GET_VSPW(x) ( ((x) >> 0) & 0x3F)
64
59#define S3C2410_LCDCON3_HBPD(x) ((x) << 19) 65#define S3C2410_LCDCON3_HBPD(x) ((x) << 19)
60#define S3C2410_LCDCON3_WDLY(x) ((x) << 19) 66#define S3C2410_LCDCON3_WDLY(x) ((x) << 19)
61#define S3C2410_LCDCON3_HOZVAL(x) ((x) << 8) 67#define S3C2410_LCDCON3_HOZVAL(x) ((x) << 8)
62#define S3C2410_LCDCON3_HFPD(x) ((x) << 0) 68#define S3C2410_LCDCON3_HFPD(x) ((x) << 0)
63#define S3C2410_LCDCON3_LINEBLANK(x)((x) << 0) 69#define S3C2410_LCDCON3_LINEBLANK(x)((x) << 0)
64 70
71#define S3C2410_LCDCON3_GET_HBPD(x) ( ((x) >> 19) & 0x7F)
72#define S3C2410_LCDCON3_GET_HFPD(x) ( ((x) >> 0) & 0xFF)
73
65#define S3C2410_LCDCON4_MVAL(x) ((x) << 8) 74#define S3C2410_LCDCON4_MVAL(x) ((x) << 8)
66#define S3C2410_LCDCON4_HSPW(x) ((x) << 0) 75#define S3C2410_LCDCON4_HSPW(x) ((x) << 0)
67#define S3C2410_LCDCON4_WLH(x) ((x) << 0) 76#define S3C2410_LCDCON4_WLH(x) ((x) << 0)
68 77
78#define S3C2410_LCDCON4_GET_HSPW(x) ( ((x) >> 0) & 0xFF)
79
69#define S3C2410_LCDCON5_BPP24BL (1<<12) 80#define S3C2410_LCDCON5_BPP24BL (1<<12)
70#define S3C2410_LCDCON5_FRM565 (1<<11) 81#define S3C2410_LCDCON5_FRM565 (1<<11)
71#define S3C2410_LCDCON5_INVVCLK (1<<10) 82#define S3C2410_LCDCON5_INVVCLK (1<<10)
@@ -100,10 +111,16 @@
100#define S3C2410_DITHMODE S3C2410_LCDREG(0x4C) 111#define S3C2410_DITHMODE S3C2410_LCDREG(0x4C)
101#define S3C2410_TPAL S3C2410_LCDREG(0x50) 112#define S3C2410_TPAL S3C2410_LCDREG(0x50)
102 113
114#define S3C2410_TPAL_EN (1<<24)
115
103/* interrupt info */ 116/* interrupt info */
104#define S3C2410_LCDINTPND S3C2410_LCDREG(0x54) 117#define S3C2410_LCDINTPND S3C2410_LCDREG(0x54)
105#define S3C2410_LCDSRCPND S3C2410_LCDREG(0x58) 118#define S3C2410_LCDSRCPND S3C2410_LCDREG(0x58)
106#define S3C2410_LCDINTMSK S3C2410_LCDREG(0x5C) 119#define S3C2410_LCDINTMSK S3C2410_LCDREG(0x5C)
120#define S3C2410_LCDINT_FIWSEL (1<<2)
121#define S3C2410_LCDINT_FRSYNC (1<<1)
122#define S3C2410_LCDINT_FICNT (1<<0)
123
107#define S3C2410_LPCSEL S3C2410_LCDREG(0x60) 124#define S3C2410_LPCSEL S3C2410_LCDREG(0x60)
108 125
109#define S3C2410_TFTPAL(x) S3C2410_LCDREG((0x400 + (x)*4)) 126#define S3C2410_TFTPAL(x) S3C2410_LCDREG((0x400 + (x)*4))
diff --git a/include/asm-arm/arch-sa1100/hardware.h b/include/asm-arm/arch-sa1100/hardware.h
index 10c62db34362..19c3b1e186bb 100644
--- a/include/asm-arm/arch-sa1100/hardware.h
+++ b/include/asm-arm/arch-sa1100/hardware.h
@@ -49,23 +49,9 @@
49 ( (((x)&0x00ffffff) | (((x)&(0x30000000>>VIO_SHIFT))<<VIO_SHIFT)) + PIO_START ) 49 ( (((x)&0x00ffffff) | (((x)&(0x30000000>>VIO_SHIFT))<<VIO_SHIFT)) + PIO_START )
50 50
51#ifndef __ASSEMBLY__ 51#ifndef __ASSEMBLY__
52#include <asm/types.h>
53 52
54#if 0 53# define __REG(x) (*((volatile unsigned long *)io_p2v(x)))
55# define __REG(x) (*((volatile u32 *)io_p2v(x))) 54# define __PREG(x) (io_v2p((unsigned long)&(x)))
56#else
57/*
58 * This __REG() version gives the same results as the one above, except
59 * that we are fooling gcc somehow so it generates far better and smaller
60 * assembly code for access to contigous registers. It's a shame that gcc
61 * doesn't guess this by itself.
62 */
63typedef struct { volatile u32 offset[4096]; } __regbase;
64# define __REGP(x) ((__regbase *)((x)&~4095))->offset[((x)&4095)>>2]
65# define __REG(x) __REGP(io_p2v(x))
66#endif
67
68# define __PREG(x) (io_v2p((u32)&(x)))
69 55
70#else 56#else
71 57
diff --git a/include/asm-arm/cacheflush.h b/include/asm-arm/cacheflush.h
index 035cdcff43d2..e81baff4f54b 100644
--- a/include/asm-arm/cacheflush.h
+++ b/include/asm-arm/cacheflush.h
@@ -256,7 +256,7 @@ extern void dmac_flush_range(unsigned long, unsigned long);
256 * Convert calls to our calling convention. 256 * Convert calls to our calling convention.
257 */ 257 */
258#define flush_cache_all() __cpuc_flush_kern_all() 258#define flush_cache_all() __cpuc_flush_kern_all()
259 259#ifndef CONFIG_CPU_CACHE_VIPT
260static inline void flush_cache_mm(struct mm_struct *mm) 260static inline void flush_cache_mm(struct mm_struct *mm)
261{ 261{
262 if (cpu_isset(smp_processor_id(), mm->cpu_vm_mask)) 262 if (cpu_isset(smp_processor_id(), mm->cpu_vm_mask))
@@ -279,6 +279,11 @@ flush_cache_page(struct vm_area_struct *vma, unsigned long user_addr, unsigned l
279 __cpuc_flush_user_range(addr, addr + PAGE_SIZE, vma->vm_flags); 279 __cpuc_flush_user_range(addr, addr + PAGE_SIZE, vma->vm_flags);
280 } 280 }
281} 281}
282#else
283extern void flush_cache_mm(struct mm_struct *mm);
284extern void flush_cache_range(struct vm_area_struct *vma, unsigned long start, unsigned long end);
285extern void flush_cache_page(struct vm_area_struct *vma, unsigned long user_addr, unsigned long pfn);
286#endif
282 287
283/* 288/*
284 * flush_cache_user_range is used when we want to ensure that the 289 * flush_cache_user_range is used when we want to ensure that the
diff --git a/include/asm-arm/pci.h b/include/asm-arm/pci.h
index 38ea5899a580..ead3ced38cb8 100644
--- a/include/asm-arm/pci.h
+++ b/include/asm-arm/pci.h
@@ -64,6 +64,19 @@ extern void
64pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, 64pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
65 struct pci_bus_region *region); 65 struct pci_bus_region *region);
66 66
67static inline struct resource *
68pcibios_select_root(struct pci_dev *pdev, struct resource *res)
69{
70 struct resource *root = NULL;
71
72 if (res->flags & IORESOURCE_IO)
73 root = &ioport_resource;
74 if (res->flags & IORESOURCE_MEM)
75 root = &iomem_resource;
76
77 return root;
78}
79
67static inline void pcibios_add_platform_entries(struct pci_dev *dev) 80static inline void pcibios_add_platform_entries(struct pci_dev *dev)
68{ 81{
69} 82}
diff --git a/include/asm-arm/spinlock.h b/include/asm-arm/spinlock.h
index 1f906d09b688..cb4906b45555 100644
--- a/include/asm-arm/spinlock.h
+++ b/include/asm-arm/spinlock.h
@@ -16,21 +16,14 @@
16 * Unlocked value: 0 16 * Unlocked value: 0
17 * Locked value: 1 17 * Locked value: 1
18 */ 18 */
19typedef struct {
20 volatile unsigned int lock;
21#ifdef CONFIG_PREEMPT
22 unsigned int break_lock;
23#endif
24} spinlock_t;
25 19
26#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 } 20#define __raw_spin_is_locked(x) ((x)->lock != 0)
21#define __raw_spin_unlock_wait(lock) \
22 do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0)
27 23
28#define spin_lock_init(x) do { *(x) = SPIN_LOCK_UNLOCKED; } while (0) 24#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock)
29#define spin_is_locked(x) ((x)->lock != 0)
30#define spin_unlock_wait(x) do { barrier(); } while (spin_is_locked(x))
31#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock)
32 25
33static inline void _raw_spin_lock(spinlock_t *lock) 26static inline void __raw_spin_lock(raw_spinlock_t *lock)
34{ 27{
35 unsigned long tmp; 28 unsigned long tmp;
36 29
@@ -47,7 +40,7 @@ static inline void _raw_spin_lock(spinlock_t *lock)
47 smp_mb(); 40 smp_mb();
48} 41}
49 42
50static inline int _raw_spin_trylock(spinlock_t *lock) 43static inline int __raw_spin_trylock(raw_spinlock_t *lock)
51{ 44{
52 unsigned long tmp; 45 unsigned long tmp;
53 46
@@ -67,7 +60,7 @@ static inline int _raw_spin_trylock(spinlock_t *lock)
67 } 60 }
68} 61}
69 62
70static inline void _raw_spin_unlock(spinlock_t *lock) 63static inline void __raw_spin_unlock(raw_spinlock_t *lock)
71{ 64{
72 smp_mb(); 65 smp_mb();
73 66
@@ -80,23 +73,14 @@ static inline void _raw_spin_unlock(spinlock_t *lock)
80 73
81/* 74/*
82 * RWLOCKS 75 * RWLOCKS
83 */ 76 *
84typedef struct { 77 *
85 volatile unsigned int lock;
86#ifdef CONFIG_PREEMPT
87 unsigned int break_lock;
88#endif
89} rwlock_t;
90
91#define RW_LOCK_UNLOCKED (rwlock_t) { 0 }
92#define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while (0)
93#define rwlock_is_locked(x) (*((volatile unsigned int *)(x)) != 0)
94
95/*
96 * Write locks are easy - we just set bit 31. When unlocking, we can 78 * Write locks are easy - we just set bit 31. When unlocking, we can
97 * just write zero since the lock is exclusively held. 79 * just write zero since the lock is exclusively held.
98 */ 80 */
99static inline void _raw_write_lock(rwlock_t *rw) 81#define rwlock_is_locked(x) (*((volatile unsigned int *)(x)) != 0)
82
83static inline void __raw_write_lock(rwlock_t *rw)
100{ 84{
101 unsigned long tmp; 85 unsigned long tmp;
102 86
@@ -113,7 +97,7 @@ static inline void _raw_write_lock(rwlock_t *rw)
113 smp_mb(); 97 smp_mb();
114} 98}
115 99
116static inline int _raw_write_trylock(rwlock_t *rw) 100static inline int __raw_write_trylock(rwlock_t *rw)
117{ 101{
118 unsigned long tmp; 102 unsigned long tmp;
119 103
@@ -133,7 +117,7 @@ static inline int _raw_write_trylock(rwlock_t *rw)
133 } 117 }
134} 118}
135 119
136static inline void _raw_write_unlock(rwlock_t *rw) 120static inline void __raw_write_unlock(raw_rwlock_t *rw)
137{ 121{
138 smp_mb(); 122 smp_mb();
139 123
@@ -156,7 +140,7 @@ static inline void _raw_write_unlock(rwlock_t *rw)
156 * currently active. However, we know we won't have any write 140 * currently active. However, we know we won't have any write
157 * locks. 141 * locks.
158 */ 142 */
159static inline void _raw_read_lock(rwlock_t *rw) 143static inline void __raw_read_lock(raw_rwlock_t *rw)
160{ 144{
161 unsigned long tmp, tmp2; 145 unsigned long tmp, tmp2;
162 146
@@ -173,7 +157,7 @@ static inline void _raw_read_lock(rwlock_t *rw)
173 smp_mb(); 157 smp_mb();
174} 158}
175 159
176static inline void _raw_read_unlock(rwlock_t *rw) 160static inline void __raw_read_unlock(rwlock_t *rw)
177{ 161{
178 unsigned long tmp, tmp2; 162 unsigned long tmp, tmp2;
179 163
@@ -190,6 +174,6 @@ static inline void _raw_read_unlock(rwlock_t *rw)
190 : "cc"); 174 : "cc");
191} 175}
192 176
193#define _raw_read_trylock(lock) generic_raw_read_trylock(lock) 177#define __raw_read_trylock(lock) generic__raw_read_trylock(lock)
194 178
195#endif /* __ASM_SPINLOCK_H */ 179#endif /* __ASM_SPINLOCK_H */
diff --git a/include/asm-arm/spinlock_types.h b/include/asm-arm/spinlock_types.h
new file mode 100644
index 000000000000..43e83f6d2ee5
--- /dev/null
+++ b/include/asm-arm/spinlock_types.h
@@ -0,0 +1,20 @@
1#ifndef __ASM_SPINLOCK_TYPES_H
2#define __ASM_SPINLOCK_TYPES_H
3
4#ifndef __LINUX_SPINLOCK_TYPES_H
5# error "please don't include this file directly"
6#endif
7
8typedef struct {
9 volatile unsigned int lock;
10} raw_spinlock_t;
11
12#define __RAW_SPIN_LOCK_UNLOCKED { 0 }
13
14typedef struct {
15 volatile unsigned int lock;
16} raw_rwlock_t;
17
18#define __RAW_RW_LOCK_UNLOCKED { 0 }
19
20#endif
diff --git a/include/asm-arm/unistd.h b/include/asm-arm/unistd.h
index 278de61224d1..c49df635a80f 100644
--- a/include/asm-arm/unistd.h
+++ b/include/asm-arm/unistd.h
@@ -355,6 +355,9 @@
355#define __NR_inotify_init (__NR_SYSCALL_BASE+316) 355#define __NR_inotify_init (__NR_SYSCALL_BASE+316)
356#define __NR_inotify_add_watch (__NR_SYSCALL_BASE+317) 356#define __NR_inotify_add_watch (__NR_SYSCALL_BASE+317)
357#define __NR_inotify_rm_watch (__NR_SYSCALL_BASE+318) 357#define __NR_inotify_rm_watch (__NR_SYSCALL_BASE+318)
358#define __NR_mbind (__NR_SYSCALL_BASE+319)
359#define __NR_get_mempolicy (__NR_SYSCALL_BASE+320)
360#define __NR_set_mempolicy (__NR_SYSCALL_BASE+321)
358 361
359/* 362/*
360 * The following SWIs are ARM private. 363 * The following SWIs are ARM private.
diff --git a/include/asm-arm26/hardirq.h b/include/asm-arm26/hardirq.h
index 791ee1da9bfa..dc28daab8aa8 100644
--- a/include/asm-arm26/hardirq.h
+++ b/include/asm-arm26/hardirq.h
@@ -22,8 +22,6 @@ typedef struct {
22# error HARDIRQ_BITS is too low! 22# error HARDIRQ_BITS is too low!
23#endif 23#endif
24 24
25#define irq_enter() (preempt_count() += HARDIRQ_OFFSET)
26
27#ifndef CONFIG_SMP 25#ifndef CONFIG_SMP
28 26
29extern asmlinkage void __do_softirq(void); 27extern asmlinkage void __do_softirq(void);
diff --git a/include/asm-generic/pci.h b/include/asm-generic/pci.h
index ee1d8b5d8168..c36a77d3bf44 100644
--- a/include/asm-generic/pci.h
+++ b/include/asm-generic/pci.h
@@ -30,6 +30,19 @@ pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
30 res->end = region->end; 30 res->end = region->end;
31} 31}
32 32
33static inline struct resource *
34pcibios_select_root(struct pci_dev *pdev, struct resource *res)
35{
36 struct resource *root = NULL;
37
38 if (res->flags & IORESOURCE_IO)
39 root = &ioport_resource;
40 if (res->flags & IORESOURCE_MEM)
41 root = &iomem_resource;
42
43 return root;
44}
45
33#define pcibios_scan_all_fns(a, b) 0 46#define pcibios_scan_all_fns(a, b) 0
34 47
35#ifndef HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ 48#ifndef HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ
diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h
index faff403e1061..7d0298347ee7 100644
--- a/include/asm-generic/tlb.h
+++ b/include/asm-generic/tlb.h
@@ -23,7 +23,11 @@
23 * and page free order so much.. 23 * and page free order so much..
24 */ 24 */
25#ifdef CONFIG_SMP 25#ifdef CONFIG_SMP
26 #define FREE_PTE_NR 506 26 #ifdef ARCH_FREE_PTR_NR
27 #define FREE_PTR_NR ARCH_FREE_PTR_NR
28 #else
29 #define FREE_PTE_NR 506
30 #endif
27 #define tlb_fast_mode(tlb) ((tlb)->nr == ~0U) 31 #define tlb_fast_mode(tlb) ((tlb)->nr == ~0U)
28#else 32#else
29 #define FREE_PTE_NR 1 33 #define FREE_PTE_NR 1
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 6f857be2b644..a9c55490fb82 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -103,3 +103,41 @@
103 VMLINUX_SYMBOL(__kprobes_text_start) = .; \ 103 VMLINUX_SYMBOL(__kprobes_text_start) = .; \
104 *(.kprobes.text) \ 104 *(.kprobes.text) \
105 VMLINUX_SYMBOL(__kprobes_text_end) = .; 105 VMLINUX_SYMBOL(__kprobes_text_end) = .;
106
107 /* DWARF debug sections.
108 Symbols in the DWARF debugging sections are relative to
109 the beginning of the section so we begin them at 0. */
110#define DWARF_DEBUG \
111 /* DWARF 1 */ \
112 .debug 0 : { *(.debug) } \
113 .line 0 : { *(.line) } \
114 /* GNU DWARF 1 extensions */ \
115 .debug_srcinfo 0 : { *(.debug_srcinfo) } \
116 .debug_sfnames 0 : { *(.debug_sfnames) } \
117 /* DWARF 1.1 and DWARF 2 */ \
118 .debug_aranges 0 : { *(.debug_aranges) } \
119 .debug_pubnames 0 : { *(.debug_pubnames) } \
120 /* DWARF 2 */ \
121 .debug_info 0 : { *(.debug_info \
122 .gnu.linkonce.wi.*) } \
123 .debug_abbrev 0 : { *(.debug_abbrev) } \
124 .debug_line 0 : { *(.debug_line) } \
125 .debug_frame 0 : { *(.debug_frame) } \
126 .debug_str 0 : { *(.debug_str) } \
127 .debug_loc 0 : { *(.debug_loc) } \
128 .debug_macinfo 0 : { *(.debug_macinfo) } \
129 /* SGI/MIPS DWARF 2 extensions */ \
130 .debug_weaknames 0 : { *(.debug_weaknames) } \
131 .debug_funcnames 0 : { *(.debug_funcnames) } \
132 .debug_typenames 0 : { *(.debug_typenames) } \
133 .debug_varnames 0 : { *(.debug_varnames) } \
134
135 /* Stabs debugging sections. */
136#define STABS_DEBUG \
137 .stab 0 : { *(.stab) } \
138 .stabstr 0 : { *(.stabstr) } \
139 .stab.excl 0 : { *(.stab.excl) } \
140 .stab.exclstr 0 : { *(.stab.exclstr) } \
141 .stab.index 0 : { *(.stab.index) } \
142 .stab.indexstr 0 : { *(.stab.indexstr) } \
143 .comment 0 : { *(.comment) }
diff --git a/include/asm-i386/acpi.h b/include/asm-i386/acpi.h
index cf828ace13f9..df4ed323aa4d 100644
--- a/include/asm-i386/acpi.h
+++ b/include/asm-i386/acpi.h
@@ -103,7 +103,7 @@ __acpi_release_global_lock (unsigned int *lock)
103 :"=r"(n_hi), "=r"(n_lo) \ 103 :"=r"(n_hi), "=r"(n_lo) \
104 :"0"(n_hi), "1"(n_lo)) 104 :"0"(n_hi), "1"(n_lo))
105 105
106#ifdef CONFIG_ACPI_BOOT 106#ifdef CONFIG_ACPI
107extern int acpi_lapic; 107extern int acpi_lapic;
108extern int acpi_ioapic; 108extern int acpi_ioapic;
109extern int acpi_noirq; 109extern int acpi_noirq;
@@ -146,13 +146,6 @@ static inline void check_acpi_pci(void) { }
146 146
147#endif 147#endif
148 148
149#else /* CONFIG_ACPI_BOOT */
150# define acpi_lapic 0
151# define acpi_ioapic 0
152
153#endif
154
155#ifdef CONFIG_ACPI_PCI
156static inline void acpi_noirq_set(void) { acpi_noirq = 1; } 149static inline void acpi_noirq_set(void) { acpi_noirq = 1; }
157static inline void acpi_disable_pci(void) 150static inline void acpi_disable_pci(void)
158{ 151{
@@ -160,11 +153,16 @@ static inline void acpi_disable_pci(void)
160 acpi_noirq_set(); 153 acpi_noirq_set();
161} 154}
162extern int acpi_irq_balance_set(char *str); 155extern int acpi_irq_balance_set(char *str);
163#else 156
157#else /* !CONFIG_ACPI */
158
159#define acpi_lapic 0
160#define acpi_ioapic 0
164static inline void acpi_noirq_set(void) { } 161static inline void acpi_noirq_set(void) { }
165static inline void acpi_disable_pci(void) { } 162static inline void acpi_disable_pci(void) { }
166static inline int acpi_irq_balance_set(char *str) { return 0; } 163
167#endif 164#endif /* !CONFIG_ACPI */
165
168 166
169#ifdef CONFIG_ACPI_SLEEP 167#ifdef CONFIG_ACPI_SLEEP
170 168
diff --git a/include/asm-i386/apic.h b/include/asm-i386/apic.h
index 6a1b1882285c..8c454aa58ac6 100644
--- a/include/asm-i386/apic.h
+++ b/include/asm-i386/apic.h
@@ -130,6 +130,8 @@ extern unsigned int nmi_watchdog;
130#define NMI_LOCAL_APIC 2 130#define NMI_LOCAL_APIC 2
131#define NMI_INVALID 3 131#define NMI_INVALID 3
132 132
133extern int disable_timer_pin_1;
134
133#else /* !CONFIG_X86_LOCAL_APIC */ 135#else /* !CONFIG_X86_LOCAL_APIC */
134static inline void lapic_shutdown(void) { } 136static inline void lapic_shutdown(void) { }
135 137
diff --git a/include/asm-i386/div64.h b/include/asm-i386/div64.h
index 28ed8b296afc..75c67c785bb8 100644
--- a/include/asm-i386/div64.h
+++ b/include/asm-i386/div64.h
@@ -35,7 +35,7 @@
35 */ 35 */
36#define div_long_long_rem(a,b,c) div_ll_X_l_rem(a,b,c) 36#define div_long_long_rem(a,b,c) div_ll_X_l_rem(a,b,c)
37 37
38extern inline long 38static inline long
39div_ll_X_l_rem(long long divs, long div, long *rem) 39div_ll_X_l_rem(long long divs, long div, long *rem)
40{ 40{
41 long dum2; 41 long dum2;
diff --git a/include/asm-i386/fixmap.h b/include/asm-i386/fixmap.h
index c94cac958389..cfb1c61d3b9c 100644
--- a/include/asm-i386/fixmap.h
+++ b/include/asm-i386/fixmap.h
@@ -76,7 +76,7 @@ enum fixed_addresses {
76 FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */ 76 FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */
77 FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1, 77 FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1,
78#endif 78#endif
79#ifdef CONFIG_ACPI_BOOT 79#ifdef CONFIG_ACPI
80 FIX_ACPI_BEGIN, 80 FIX_ACPI_BEGIN,
81 FIX_ACPI_END = FIX_ACPI_BEGIN + FIX_ACPI_PAGES - 1, 81 FIX_ACPI_END = FIX_ACPI_BEGIN + FIX_ACPI_PAGES - 1,
82#endif 82#endif
diff --git a/include/asm-i386/io_apic.h b/include/asm-i386/io_apic.h
index 002c203ccd6a..51c4e5fe6062 100644
--- a/include/asm-i386/io_apic.h
+++ b/include/asm-i386/io_apic.h
@@ -195,12 +195,12 @@ extern int skip_ioapic_setup;
195 */ 195 */
196#define io_apic_assign_pci_irqs (mp_irq_entries && !skip_ioapic_setup && io_apic_irqs) 196#define io_apic_assign_pci_irqs (mp_irq_entries && !skip_ioapic_setup && io_apic_irqs)
197 197
198#ifdef CONFIG_ACPI_BOOT 198#ifdef CONFIG_ACPI
199extern int io_apic_get_unique_id (int ioapic, int apic_id); 199extern int io_apic_get_unique_id (int ioapic, int apic_id);
200extern int io_apic_get_version (int ioapic); 200extern int io_apic_get_version (int ioapic);
201extern int io_apic_get_redir_entries (int ioapic); 201extern int io_apic_get_redir_entries (int ioapic);
202extern int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int active_high_low); 202extern int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int active_high_low);
203#endif /*CONFIG_ACPI_BOOT*/ 203#endif /* CONFIG_ACPI */
204 204
205extern int (*ioapic_renumber_irq)(int ioapic, int irq); 205extern int (*ioapic_renumber_irq)(int ioapic, int irq);
206 206
diff --git a/include/asm-i386/mach-default/mach_reboot.h b/include/asm-i386/mach-default/mach_reboot.h
index 521e227db679..06ae4d81ba6a 100644
--- a/include/asm-i386/mach-default/mach_reboot.h
+++ b/include/asm-i386/mach-default/mach_reboot.h
@@ -22,7 +22,15 @@ static inline void mach_reboot(void)
22 for (i = 0; i < 100; i++) { 22 for (i = 0; i < 100; i++) {
23 kb_wait(); 23 kb_wait();
24 udelay(50); 24 udelay(50);
25 outb(0xfe, 0x64); /* pulse reset low */ 25 outb(0x60, 0x64); /* write Controller Command Byte */
26 udelay(50);
27 kb_wait();
28 udelay(50);
29 outb(0x14, 0x60); /* set "System flag" */
30 udelay(50);
31 kb_wait();
32 udelay(50);
33 outb(0xfe, 0x64); /* pulse reset low */
26 udelay(50); 34 udelay(50);
27 } 35 }
28} 36}
diff --git a/include/asm-i386/mmzone.h b/include/asm-i386/mmzone.h
index 516421300ea2..348fe3a4879d 100644
--- a/include/asm-i386/mmzone.h
+++ b/include/asm-i386/mmzone.h
@@ -29,7 +29,7 @@ static inline void get_memcfg_numa(void)
29#ifdef CONFIG_X86_NUMAQ 29#ifdef CONFIG_X86_NUMAQ
30 if (get_memcfg_numaq()) 30 if (get_memcfg_numaq())
31 return; 31 return;
32#elif CONFIG_ACPI_SRAT 32#elif defined(CONFIG_ACPI_SRAT)
33 if (get_memcfg_from_srat()) 33 if (get_memcfg_from_srat())
34 return; 34 return;
35#endif 35#endif
diff --git a/include/asm-i386/mpspec.h b/include/asm-i386/mpspec.h
index d84a9c326c22..64a0b8e6afeb 100644
--- a/include/asm-i386/mpspec.h
+++ b/include/asm-i386/mpspec.h
@@ -27,14 +27,14 @@ extern unsigned long mp_lapic_addr;
27extern int pic_mode; 27extern int pic_mode;
28extern int using_apic_timer; 28extern int using_apic_timer;
29 29
30#ifdef CONFIG_ACPI_BOOT 30#ifdef CONFIG_ACPI
31extern void mp_register_lapic (u8 id, u8 enabled); 31extern void mp_register_lapic (u8 id, u8 enabled);
32extern void mp_register_lapic_address (u64 address); 32extern void mp_register_lapic_address (u64 address);
33extern void mp_register_ioapic (u8 id, u32 address, u32 gsi_base); 33extern void mp_register_ioapic (u8 id, u32 address, u32 gsi_base);
34extern void mp_override_legacy_irq (u8 bus_irq, u8 polarity, u8 trigger, u32 gsi); 34extern void mp_override_legacy_irq (u8 bus_irq, u8 polarity, u8 trigger, u32 gsi);
35extern void mp_config_acpi_legacy_irqs (void); 35extern void mp_config_acpi_legacy_irqs (void);
36extern int mp_register_gsi (u32 gsi, int edge_level, int active_high_low); 36extern int mp_register_gsi (u32 gsi, int edge_level, int active_high_low);
37#endif /*CONFIG_ACPI_BOOT*/ 37#endif /* CONFIG_ACPI */
38 38
39#define PHYSID_ARRAY_SIZE BITS_TO_LONGS(MAX_APICS) 39#define PHYSID_ARRAY_SIZE BITS_TO_LONGS(MAX_APICS)
40 40
diff --git a/include/asm-i386/numa.h b/include/asm-i386/numa.h
new file mode 100644
index 000000000000..96fcb157db1d
--- /dev/null
+++ b/include/asm-i386/numa.h
@@ -0,0 +1,3 @@
1
2int pxm_to_nid(int pxm);
3
diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h
index 37bef8ed7bed..0a4ec764377c 100644
--- a/include/asm-i386/processor.h
+++ b/include/asm-i386/processor.h
@@ -679,7 +679,7 @@ static inline void rep_nop(void)
679 However we don't do prefetches for pre XP Athlons currently 679 However we don't do prefetches for pre XP Athlons currently
680 That should be fixed. */ 680 That should be fixed. */
681#define ARCH_HAS_PREFETCH 681#define ARCH_HAS_PREFETCH
682extern inline void prefetch(const void *x) 682static inline void prefetch(const void *x)
683{ 683{
684 alternative_input(ASM_NOP4, 684 alternative_input(ASM_NOP4,
685 "prefetchnta (%1)", 685 "prefetchnta (%1)",
@@ -693,7 +693,7 @@ extern inline void prefetch(const void *x)
693 693
694/* 3dnow! prefetch to get an exclusive cache line. Useful for 694/* 3dnow! prefetch to get an exclusive cache line. Useful for
695 spinlocks to avoid one state transition in the cache coherency protocol. */ 695 spinlocks to avoid one state transition in the cache coherency protocol. */
696extern inline void prefetchw(const void *x) 696static inline void prefetchw(const void *x)
697{ 697{
698 alternative_input(ASM_NOP4, 698 alternative_input(ASM_NOP4,
699 "prefetchw (%1)", 699 "prefetchw (%1)",
diff --git a/include/asm-i386/spinlock.h b/include/asm-i386/spinlock.h
index f9ff31f40036..23604350cdf4 100644
--- a/include/asm-i386/spinlock.h
+++ b/include/asm-i386/spinlock.h
@@ -7,46 +7,21 @@
7#include <linux/config.h> 7#include <linux/config.h>
8#include <linux/compiler.h> 8#include <linux/compiler.h>
9 9
10asmlinkage int printk(const char * fmt, ...)
11 __attribute__ ((format (printf, 1, 2)));
12
13/* 10/*
14 * Your basic SMP spinlocks, allowing only a single CPU anywhere 11 * Your basic SMP spinlocks, allowing only a single CPU anywhere
15 */ 12 *
16
17typedef struct {
18 volatile unsigned int slock;
19#ifdef CONFIG_DEBUG_SPINLOCK
20 unsigned magic;
21#endif
22#ifdef CONFIG_PREEMPT
23 unsigned int break_lock;
24#endif
25} spinlock_t;
26
27#define SPINLOCK_MAGIC 0xdead4ead
28
29#ifdef CONFIG_DEBUG_SPINLOCK
30#define SPINLOCK_MAGIC_INIT , SPINLOCK_MAGIC
31#else
32#define SPINLOCK_MAGIC_INIT /* */
33#endif
34
35#define SPIN_LOCK_UNLOCKED (spinlock_t) { 1 SPINLOCK_MAGIC_INIT }
36
37#define spin_lock_init(x) do { *(x) = SPIN_LOCK_UNLOCKED; } while(0)
38
39/*
40 * Simple spin lock operations. There are two variants, one clears IRQ's 13 * Simple spin lock operations. There are two variants, one clears IRQ's
41 * on the local processor, one does not. 14 * on the local processor, one does not.
42 * 15 *
43 * We make no fairness assumptions. They have a cost. 16 * We make no fairness assumptions. They have a cost.
17 *
18 * (the type definitions are in asm/spinlock_types.h)
44 */ 19 */
45 20
46#define spin_is_locked(x) (*(volatile signed char *)(&(x)->slock) <= 0) 21#define __raw_spin_is_locked(x) \
47#define spin_unlock_wait(x) do { barrier(); } while(spin_is_locked(x)) 22 (*(volatile signed char *)(&(x)->slock) <= 0)
48 23
49#define spin_lock_string \ 24#define __raw_spin_lock_string \
50 "\n1:\t" \ 25 "\n1:\t" \
51 "lock ; decb %0\n\t" \ 26 "lock ; decb %0\n\t" \
52 "jns 3f\n" \ 27 "jns 3f\n" \
@@ -57,7 +32,7 @@ typedef struct {
57 "jmp 1b\n" \ 32 "jmp 1b\n" \
58 "3:\n\t" 33 "3:\n\t"
59 34
60#define spin_lock_string_flags \ 35#define __raw_spin_lock_string_flags \
61 "\n1:\t" \ 36 "\n1:\t" \
62 "lock ; decb %0\n\t" \ 37 "lock ; decb %0\n\t" \
63 "jns 4f\n\t" \ 38 "jns 4f\n\t" \
@@ -73,86 +48,71 @@ typedef struct {
73 "jmp 1b\n" \ 48 "jmp 1b\n" \
74 "4:\n\t" 49 "4:\n\t"
75 50
51static inline void __raw_spin_lock(raw_spinlock_t *lock)
52{
53 __asm__ __volatile__(
54 __raw_spin_lock_string
55 :"=m" (lock->slock) : : "memory");
56}
57
58static inline void __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long flags)
59{
60 __asm__ __volatile__(
61 __raw_spin_lock_string_flags
62 :"=m" (lock->slock) : "r" (flags) : "memory");
63}
64
65static inline int __raw_spin_trylock(raw_spinlock_t *lock)
66{
67 char oldval;
68 __asm__ __volatile__(
69 "xchgb %b0,%1"
70 :"=q" (oldval), "=m" (lock->slock)
71 :"0" (0) : "memory");
72 return oldval > 0;
73}
74
76/* 75/*
77 * This works. Despite all the confusion. 76 * __raw_spin_unlock based on writing $1 to the low byte.
78 * (except on PPro SMP or if we are using OOSTORE) 77 * This method works. Despite all the confusion.
78 * (except on PPro SMP or if we are using OOSTORE, so we use xchgb there)
79 * (PPro errata 66, 92) 79 * (PPro errata 66, 92)
80 */ 80 */
81 81
82#if !defined(CONFIG_X86_OOSTORE) && !defined(CONFIG_X86_PPRO_FENCE) 82#if !defined(CONFIG_X86_OOSTORE) && !defined(CONFIG_X86_PPRO_FENCE)
83 83
84#define spin_unlock_string \ 84#define __raw_spin_unlock_string \
85 "movb $1,%0" \ 85 "movb $1,%0" \
86 :"=m" (lock->slock) : : "memory" 86 :"=m" (lock->slock) : : "memory"
87 87
88 88
89static inline void _raw_spin_unlock(spinlock_t *lock) 89static inline void __raw_spin_unlock(raw_spinlock_t *lock)
90{ 90{
91#ifdef CONFIG_DEBUG_SPINLOCK
92 BUG_ON(lock->magic != SPINLOCK_MAGIC);
93 BUG_ON(!spin_is_locked(lock));
94#endif
95 __asm__ __volatile__( 91 __asm__ __volatile__(
96 spin_unlock_string 92 __raw_spin_unlock_string
97 ); 93 );
98} 94}
99 95
100#else 96#else
101 97
102#define spin_unlock_string \ 98#define __raw_spin_unlock_string \
103 "xchgb %b0, %1" \ 99 "xchgb %b0, %1" \
104 :"=q" (oldval), "=m" (lock->slock) \ 100 :"=q" (oldval), "=m" (lock->slock) \
105 :"0" (oldval) : "memory" 101 :"0" (oldval) : "memory"
106 102
107static inline void _raw_spin_unlock(spinlock_t *lock) 103static inline void __raw_spin_unlock(raw_spinlock_t *lock)
108{ 104{
109 char oldval = 1; 105 char oldval = 1;
110#ifdef CONFIG_DEBUG_SPINLOCK
111 BUG_ON(lock->magic != SPINLOCK_MAGIC);
112 BUG_ON(!spin_is_locked(lock));
113#endif
114 __asm__ __volatile__(
115 spin_unlock_string
116 );
117}
118 106
119#endif
120
121static inline int _raw_spin_trylock(spinlock_t *lock)
122{
123 char oldval;
124 __asm__ __volatile__( 107 __asm__ __volatile__(
125 "xchgb %b0,%1" 108 __raw_spin_unlock_string
126 :"=q" (oldval), "=m" (lock->slock) 109 );
127 :"0" (0) : "memory");
128 return oldval > 0;
129} 110}
130 111
131static inline void _raw_spin_lock(spinlock_t *lock)
132{
133#ifdef CONFIG_DEBUG_SPINLOCK
134 if (unlikely(lock->magic != SPINLOCK_MAGIC)) {
135 printk("eip: %p\n", __builtin_return_address(0));
136 BUG();
137 }
138#endif 112#endif
139 __asm__ __volatile__(
140 spin_lock_string
141 :"=m" (lock->slock) : : "memory");
142}
143 113
144static inline void _raw_spin_lock_flags (spinlock_t *lock, unsigned long flags) 114#define __raw_spin_unlock_wait(lock) \
145{ 115 do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0)
146#ifdef CONFIG_DEBUG_SPINLOCK
147 if (unlikely(lock->magic != SPINLOCK_MAGIC)) {
148 printk("eip: %p\n", __builtin_return_address(0));
149 BUG();
150 }
151#endif
152 __asm__ __volatile__(
153 spin_lock_string_flags
154 :"=m" (lock->slock) : "r" (flags) : "memory");
155}
156 116
157/* 117/*
158 * Read-write spinlocks, allowing multiple readers 118 * Read-write spinlocks, allowing multiple readers
@@ -163,72 +123,41 @@ static inline void _raw_spin_lock_flags (spinlock_t *lock, unsigned long flags)
163 * can "mix" irq-safe locks - any writer needs to get a 123 * can "mix" irq-safe locks - any writer needs to get a
164 * irq-safe write-lock, but readers can get non-irqsafe 124 * irq-safe write-lock, but readers can get non-irqsafe
165 * read-locks. 125 * read-locks.
126 *
127 * On x86, we implement read-write locks as a 32-bit counter
128 * with the high bit (sign) being the "contended" bit.
129 *
130 * The inline assembly is non-obvious. Think about it.
131 *
132 * Changed to use the same technique as rw semaphores. See
133 * semaphore.h for details. -ben
134 *
135 * the helpers are in arch/i386/kernel/semaphore.c
166 */ 136 */
167typedef struct {
168 volatile unsigned int lock;
169#ifdef CONFIG_DEBUG_SPINLOCK
170 unsigned magic;
171#endif
172#ifdef CONFIG_PREEMPT
173 unsigned int break_lock;
174#endif
175} rwlock_t;
176
177#define RWLOCK_MAGIC 0xdeaf1eed
178
179#ifdef CONFIG_DEBUG_SPINLOCK
180#define RWLOCK_MAGIC_INIT , RWLOCK_MAGIC
181#else
182#define RWLOCK_MAGIC_INIT /* */
183#endif
184
185#define RW_LOCK_UNLOCKED (rwlock_t) { RW_LOCK_BIAS RWLOCK_MAGIC_INIT }
186
187#define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while(0)
188 137
189/** 138/**
190 * read_can_lock - would read_trylock() succeed? 139 * read_can_lock - would read_trylock() succeed?
191 * @lock: the rwlock in question. 140 * @lock: the rwlock in question.
192 */ 141 */
193#define read_can_lock(x) ((int)(x)->lock > 0) 142#define __raw_read_can_lock(x) ((int)(x)->lock > 0)
194 143
195/** 144/**
196 * write_can_lock - would write_trylock() succeed? 145 * write_can_lock - would write_trylock() succeed?
197 * @lock: the rwlock in question. 146 * @lock: the rwlock in question.
198 */ 147 */
199#define write_can_lock(x) ((x)->lock == RW_LOCK_BIAS) 148#define __raw_write_can_lock(x) ((x)->lock == RW_LOCK_BIAS)
200 149
201/* 150static inline void __raw_read_lock(raw_rwlock_t *rw)
202 * On x86, we implement read-write locks as a 32-bit counter
203 * with the high bit (sign) being the "contended" bit.
204 *
205 * The inline assembly is non-obvious. Think about it.
206 *
207 * Changed to use the same technique as rw semaphores. See
208 * semaphore.h for details. -ben
209 */
210/* the spinlock helpers are in arch/i386/kernel/semaphore.c */
211
212static inline void _raw_read_lock(rwlock_t *rw)
213{ 151{
214#ifdef CONFIG_DEBUG_SPINLOCK
215 BUG_ON(rw->magic != RWLOCK_MAGIC);
216#endif
217 __build_read_lock(rw, "__read_lock_failed"); 152 __build_read_lock(rw, "__read_lock_failed");
218} 153}
219 154
220static inline void _raw_write_lock(rwlock_t *rw) 155static inline void __raw_write_lock(raw_rwlock_t *rw)
221{ 156{
222#ifdef CONFIG_DEBUG_SPINLOCK
223 BUG_ON(rw->magic != RWLOCK_MAGIC);
224#endif
225 __build_write_lock(rw, "__write_lock_failed"); 157 __build_write_lock(rw, "__write_lock_failed");
226} 158}
227 159
228#define _raw_read_unlock(rw) asm volatile("lock ; incl %0" :"=m" ((rw)->lock) : : "memory") 160static inline int __raw_read_trylock(raw_rwlock_t *lock)
229#define _raw_write_unlock(rw) asm volatile("lock ; addl $" RW_LOCK_BIAS_STR ",%0":"=m" ((rw)->lock) : : "memory")
230
231static inline int _raw_read_trylock(rwlock_t *lock)
232{ 161{
233 atomic_t *count = (atomic_t *)lock; 162 atomic_t *count = (atomic_t *)lock;
234 atomic_dec(count); 163 atomic_dec(count);
@@ -238,7 +167,7 @@ static inline int _raw_read_trylock(rwlock_t *lock)
238 return 0; 167 return 0;
239} 168}
240 169
241static inline int _raw_write_trylock(rwlock_t *lock) 170static inline int __raw_write_trylock(raw_rwlock_t *lock)
242{ 171{
243 atomic_t *count = (atomic_t *)lock; 172 atomic_t *count = (atomic_t *)lock;
244 if (atomic_sub_and_test(RW_LOCK_BIAS, count)) 173 if (atomic_sub_and_test(RW_LOCK_BIAS, count))
@@ -247,4 +176,15 @@ static inline int _raw_write_trylock(rwlock_t *lock)
247 return 0; 176 return 0;
248} 177}
249 178
179static inline void __raw_read_unlock(raw_rwlock_t *rw)
180{
181 asm volatile("lock ; incl %0" :"=m" (rw->lock) : : "memory");
182}
183
184static inline void __raw_write_unlock(raw_rwlock_t *rw)
185{
186 asm volatile("lock ; addl $" RW_LOCK_BIAS_STR ", %0"
187 : "=m" (rw->lock) : : "memory");
188}
189
250#endif /* __ASM_SPINLOCK_H */ 190#endif /* __ASM_SPINLOCK_H */
diff --git a/include/asm-i386/spinlock_types.h b/include/asm-i386/spinlock_types.h
new file mode 100644
index 000000000000..59efe849f351
--- /dev/null
+++ b/include/asm-i386/spinlock_types.h
@@ -0,0 +1,20 @@
1#ifndef __ASM_SPINLOCK_TYPES_H
2#define __ASM_SPINLOCK_TYPES_H
3
4#ifndef __LINUX_SPINLOCK_TYPES_H
5# error "please don't include this file directly"
6#endif
7
8typedef struct {
9 volatile unsigned int slock;
10} raw_spinlock_t;
11
12#define __RAW_SPIN_LOCK_UNLOCKED { 1 }
13
14typedef struct {
15 volatile unsigned int lock;
16} raw_rwlock_t;
17
18#define __RAW_RW_LOCK_UNLOCKED { RW_LOCK_BIAS }
19
20#endif
diff --git a/include/asm-i386/thread_info.h b/include/asm-i386/thread_info.h
index e2cb9fa6f563..8fbf791651bf 100644
--- a/include/asm-i386/thread_info.h
+++ b/include/asm-i386/thread_info.h
@@ -48,7 +48,7 @@ struct thread_info {
48 48
49#else /* !__ASSEMBLY__ */ 49#else /* !__ASSEMBLY__ */
50 50
51#include <asm/asm_offsets.h> 51#include <asm/asm-offsets.h>
52 52
53#endif 53#endif
54 54
diff --git a/include/asm-i386/topology.h b/include/asm-i386/topology.h
index 2461b731781e..0ec27c9e8e45 100644
--- a/include/asm-i386/topology.h
+++ b/include/asm-i386/topology.h
@@ -60,7 +60,7 @@ static inline int node_to_first_cpu(int node)
60 return first_cpu(mask); 60 return first_cpu(mask);
61} 61}
62 62
63#define pcibus_to_node(bus) mp_bus_id_to_node[(bus)->number] 63#define pcibus_to_node(bus) ((long) (bus)->sysdata)
64#define pcibus_to_cpumask(bus) node_to_cpumask(pcibus_to_node(bus)) 64#define pcibus_to_cpumask(bus) node_to_cpumask(pcibus_to_node(bus))
65 65
66/* sched_domains SD_NODE_INIT for NUMAQ machines */ 66/* sched_domains SD_NODE_INIT for NUMAQ machines */
diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h
index a7cb377745bf..fbaf90a3968c 100644
--- a/include/asm-i386/unistd.h
+++ b/include/asm-i386/unistd.h
@@ -332,7 +332,7 @@ type name(type1 arg1) \
332long __res; \ 332long __res; \
333__asm__ volatile ("int $0x80" \ 333__asm__ volatile ("int $0x80" \
334 : "=a" (__res) \ 334 : "=a" (__res) \
335 : "0" (__NR_##name),"b" ((long)(arg1))); \ 335 : "0" (__NR_##name),"b" ((long)(arg1)) : "memory"); \
336__syscall_return(type,__res); \ 336__syscall_return(type,__res); \
337} 337}
338 338
@@ -342,7 +342,7 @@ type name(type1 arg1,type2 arg2) \
342long __res; \ 342long __res; \
343__asm__ volatile ("int $0x80" \ 343__asm__ volatile ("int $0x80" \
344 : "=a" (__res) \ 344 : "=a" (__res) \
345 : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2))); \ 345 : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)) : "memory"); \
346__syscall_return(type,__res); \ 346__syscall_return(type,__res); \
347} 347}
348 348
@@ -353,7 +353,7 @@ long __res; \
353__asm__ volatile ("int $0x80" \ 353__asm__ volatile ("int $0x80" \
354 : "=a" (__res) \ 354 : "=a" (__res) \
355 : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ 355 : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \
356 "d" ((long)(arg3))); \ 356 "d" ((long)(arg3)) : "memory"); \
357__syscall_return(type,__res); \ 357__syscall_return(type,__res); \
358} 358}
359 359
@@ -364,7 +364,7 @@ long __res; \
364__asm__ volatile ("int $0x80" \ 364__asm__ volatile ("int $0x80" \
365 : "=a" (__res) \ 365 : "=a" (__res) \
366 : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ 366 : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \
367 "d" ((long)(arg3)),"S" ((long)(arg4))); \ 367 "d" ((long)(arg3)),"S" ((long)(arg4)) : "memory"); \
368__syscall_return(type,__res); \ 368__syscall_return(type,__res); \
369} 369}
370 370
@@ -376,7 +376,7 @@ long __res; \
376__asm__ volatile ("int $0x80" \ 376__asm__ volatile ("int $0x80" \
377 : "=a" (__res) \ 377 : "=a" (__res) \
378 : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ 378 : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \
379 "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5))); \ 379 "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5)) : "memory"); \
380__syscall_return(type,__res); \ 380__syscall_return(type,__res); \
381} 381}
382 382
@@ -389,7 +389,7 @@ __asm__ volatile ("push %%ebp ; movl %%eax,%%ebp ; movl %1,%%eax ; int $0x80 ; p
389 : "=a" (__res) \ 389 : "=a" (__res) \
390 : "i" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ 390 : "i" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \
391 "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5)), \ 391 "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5)), \
392 "0" ((long)(arg6))); \ 392 "0" ((long)(arg6)) : "memory"); \
393__syscall_return(type,__res); \ 393__syscall_return(type,__res); \
394} 394}
395 395
diff --git a/include/asm-ia64/acpi-ext.h b/include/asm-ia64/acpi-ext.h
index 9271d74c64cc..56d2ddc97b30 100644
--- a/include/asm-ia64/acpi-ext.h
+++ b/include/asm-ia64/acpi-ext.h
@@ -11,6 +11,7 @@
11#define _ASM_IA64_ACPI_EXT_H 11#define _ASM_IA64_ACPI_EXT_H
12 12
13#include <linux/types.h> 13#include <linux/types.h>
14#include <acpi/actypes.h>
14 15
15extern acpi_status hp_acpi_csr_space (acpi_handle, u64 *base, u64 *length); 16extern acpi_status hp_acpi_csr_space (acpi_handle, u64 *base, u64 *length);
16 17
diff --git a/include/asm-ia64/iosapic.h b/include/asm-ia64/iosapic.h
index a429fe225b07..20f98f1751a1 100644
--- a/include/asm-ia64/iosapic.h
+++ b/include/asm-ia64/iosapic.h
@@ -80,12 +80,9 @@ extern int iosapic_remove (unsigned int gsi_base);
80#endif /* CONFIG_HOTPLUG */ 80#endif /* CONFIG_HOTPLUG */
81extern int gsi_to_vector (unsigned int gsi); 81extern int gsi_to_vector (unsigned int gsi);
82extern int gsi_to_irq (unsigned int gsi); 82extern int gsi_to_irq (unsigned int gsi);
83extern void iosapic_enable_intr (unsigned int vector);
84extern int iosapic_register_intr (unsigned int gsi, unsigned long polarity, 83extern int iosapic_register_intr (unsigned int gsi, unsigned long polarity,
85 unsigned long trigger); 84 unsigned long trigger);
86#ifdef CONFIG_ACPI_DEALLOCATE_IRQ
87extern void iosapic_unregister_intr (unsigned int irq); 85extern void iosapic_unregister_intr (unsigned int irq);
88#endif
89extern void __init iosapic_override_isa_irq (unsigned int isa_irq, unsigned int gsi, 86extern void __init iosapic_override_isa_irq (unsigned int isa_irq, unsigned int gsi,
90 unsigned long polarity, 87 unsigned long polarity,
91 unsigned long trigger); 88 unsigned long trigger);
@@ -97,7 +94,6 @@ extern int __init iosapic_register_platform_intr (u32 int_type,
97 unsigned long trigger); 94 unsigned long trigger);
98extern unsigned int iosapic_version (char __iomem *addr); 95extern unsigned int iosapic_version (char __iomem *addr);
99 96
100extern void iosapic_pci_fixup (int);
101#ifdef CONFIG_NUMA 97#ifdef CONFIG_NUMA
102extern void __devinit map_iosapic_to_node (unsigned int, int); 98extern void __devinit map_iosapic_to_node (unsigned int, int);
103#endif 99#endif
diff --git a/include/asm-ia64/irq.h b/include/asm-ia64/irq.h
index cd984d08fd15..dbe86c0bbce5 100644
--- a/include/asm-ia64/irq.h
+++ b/include/asm-ia64/irq.h
@@ -35,8 +35,4 @@ extern void disable_irq_nosync (unsigned int);
35extern void enable_irq (unsigned int); 35extern void enable_irq (unsigned int);
36extern void set_irq_affinity_info (unsigned int irq, int dest, int redir); 36extern void set_irq_affinity_info (unsigned int irq, int dest, int redir);
37 37
38struct irqaction;
39struct pt_regs;
40int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *);
41
42#endif /* _ASM_IA64_IRQ_H */ 38#endif /* _ASM_IA64_IRQ_H */
diff --git a/include/asm-ia64/mca.h b/include/asm-ia64/mca.h
index 149ad0118455..97a28b8b2ddd 100644
--- a/include/asm-ia64/mca.h
+++ b/include/asm-ia64/mca.h
@@ -11,8 +11,6 @@
11#ifndef _ASM_IA64_MCA_H 11#ifndef _ASM_IA64_MCA_H
12#define _ASM_IA64_MCA_H 12#define _ASM_IA64_MCA_H
13 13
14#define IA64_MCA_STACK_SIZE 8192
15
16#if !defined(__ASSEMBLY__) 14#if !defined(__ASSEMBLY__)
17 15
18#include <linux/interrupt.h> 16#include <linux/interrupt.h>
@@ -48,7 +46,8 @@ typedef union cmcv_reg_u {
48 46
49enum { 47enum {
50 IA64_MCA_RENDEZ_CHECKIN_NOTDONE = 0x0, 48 IA64_MCA_RENDEZ_CHECKIN_NOTDONE = 0x0,
51 IA64_MCA_RENDEZ_CHECKIN_DONE = 0x1 49 IA64_MCA_RENDEZ_CHECKIN_DONE = 0x1,
50 IA64_MCA_RENDEZ_CHECKIN_INIT = 0x2,
52}; 51};
53 52
54/* Information maintained by the MC infrastructure */ 53/* Information maintained by the MC infrastructure */
@@ -63,18 +62,42 @@ typedef struct ia64_mc_info_s {
63 62
64} ia64_mc_info_t; 63} ia64_mc_info_t;
65 64
66typedef struct ia64_mca_sal_to_os_state_s { 65/* Handover state from SAL to OS and vice versa, for both MCA and INIT events.
67 u64 imsto_os_gp; /* GP of the os registered with the SAL */ 66 * Besides the handover state, it also contains some saved registers from the
68 u64 imsto_pal_proc; /* PAL_PROC entry point - physical addr */ 67 * time of the event.
69 u64 imsto_sal_proc; /* SAL_PROC entry point - physical addr */ 68 * Note: mca_asm.S depends on the precise layout of this structure.
70 u64 imsto_sal_gp; /* GP of the SAL - physical */ 69 */
71 u64 imsto_rendez_state; /* Rendez state information */ 70
72 u64 imsto_sal_check_ra; /* Return address in SAL_CHECK while going 71struct ia64_sal_os_state {
73 * back to SAL from OS after MCA handling. 72 /* SAL to OS, must be at offset 0 */
74 */ 73 u64 os_gp; /* GP of the os registered with the SAL, physical */
75 u64 pal_min_state; /* from PAL in r17 */ 74 u64 pal_proc; /* PAL_PROC entry point, physical */
76 u64 proc_state_param; /* from PAL in r18. See SDV 2:268 11.3.2.1 */ 75 u64 sal_proc; /* SAL_PROC entry point, physical */
77} ia64_mca_sal_to_os_state_t; 76 u64 rv_rc; /* MCA - Rendezvous state, INIT - reason code */
77 u64 proc_state_param; /* from R18 */
78 u64 monarch; /* 1 for a monarch event, 0 for a slave */
79 /* common, must follow SAL to OS */
80 u64 sal_ra; /* Return address in SAL, physical */
81 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 */
83 u64 prev_IA64_KR_CURRENT; /* previous value of IA64_KR(CURRENT) */
84 struct task_struct *prev_task; /* previous task, NULL if it is not useful */
85 /* Some interrupt registers are not saved in minstate, pt_regs or
86 * switch_stack. Because MCA/INIT can occur when interrupts are
87 * disabled, we need to save the additional interrupt registers over
88 * MCA/INIT and resume.
89 */
90 u64 isr;
91 u64 ifa;
92 u64 itir;
93 u64 iipa;
94 u64 iim;
95 u64 iha;
96 /* OS to SAL, must follow common */
97 u64 os_status; /* OS status to SAL, enum below */
98 u64 context; /* 0 if return to same context
99 1 if return to new context */
100};
78 101
79enum { 102enum {
80 IA64_MCA_CORRECTED = 0x0, /* Error has been corrected by OS_MCA */ 103 IA64_MCA_CORRECTED = 0x0, /* Error has been corrected by OS_MCA */
@@ -84,35 +107,21 @@ enum {
84}; 107};
85 108
86enum { 109enum {
110 IA64_INIT_RESUME = 0x0, /* Resume after return from INIT */
111 IA64_INIT_WARM_BOOT = -1, /* Warm boot of the system need from SAL */
112};
113
114enum {
87 IA64_MCA_SAME_CONTEXT = 0x0, /* SAL to return to same context */ 115 IA64_MCA_SAME_CONTEXT = 0x0, /* SAL to return to same context */
88 IA64_MCA_NEW_CONTEXT = -1 /* SAL to return to new context */ 116 IA64_MCA_NEW_CONTEXT = -1 /* SAL to return to new context */
89}; 117};
90 118
91typedef struct ia64_mca_os_to_sal_state_s {
92 u64 imots_os_status; /* OS status to SAL as to what happened
93 * with the MCA handling.
94 */
95 u64 imots_sal_gp; /* GP of the SAL - physical */
96 u64 imots_context; /* 0 if return to same context
97 1 if return to new context */
98 u64 *imots_new_min_state; /* Pointer to structure containing
99 * new values of registers in the min state
100 * save area.
101 */
102 u64 imots_sal_check_ra; /* Return address in SAL_CHECK while going
103 * back to SAL from OS after MCA handling.
104 */
105} ia64_mca_os_to_sal_state_t;
106
107/* Per-CPU MCA state that is too big for normal per-CPU variables. */ 119/* Per-CPU MCA state that is too big for normal per-CPU variables. */
108 120
109struct ia64_mca_cpu { 121struct ia64_mca_cpu {
110 u64 stack[IA64_MCA_STACK_SIZE/8]; /* MCA memory-stack */ 122 u64 mca_stack[KERNEL_STACK_SIZE/8];
111 u64 proc_state_dump[512];
112 u64 stackframe[32];
113 u64 rbstore[IA64_MCA_STACK_SIZE/8]; /* MCA reg.-backing store */
114 u64 init_stack[KERNEL_STACK_SIZE/8]; 123 u64 init_stack[KERNEL_STACK_SIZE/8];
115} __attribute__ ((aligned(16))); 124};
116 125
117/* Array of physical addresses of each CPU's MCA area. */ 126/* Array of physical addresses of each CPU's MCA area. */
118extern unsigned long __per_cpu_mca[NR_CPUS]; 127extern unsigned long __per_cpu_mca[NR_CPUS];
@@ -121,12 +130,29 @@ extern void ia64_mca_init(void);
121extern void ia64_mca_cpu_init(void *); 130extern void ia64_mca_cpu_init(void *);
122extern void ia64_os_mca_dispatch(void); 131extern void ia64_os_mca_dispatch(void);
123extern void ia64_os_mca_dispatch_end(void); 132extern void ia64_os_mca_dispatch_end(void);
124extern void ia64_mca_ucmc_handler(void); 133extern void ia64_mca_ucmc_handler(struct pt_regs *, struct ia64_sal_os_state *);
134extern void ia64_init_handler(struct pt_regs *,
135 struct switch_stack *,
136 struct ia64_sal_os_state *);
125extern void ia64_monarch_init_handler(void); 137extern void ia64_monarch_init_handler(void);
126extern void ia64_slave_init_handler(void); 138extern void ia64_slave_init_handler(void);
127extern void ia64_mca_cmc_vector_setup(void); 139extern void ia64_mca_cmc_vector_setup(void);
128extern int ia64_reg_MCA_extension(void*); 140extern int ia64_reg_MCA_extension(int (*fn)(void *, struct ia64_sal_os_state *));
129extern void ia64_unreg_MCA_extension(void); 141extern void ia64_unreg_MCA_extension(void);
142extern u64 ia64_get_rnat(u64 *);
143
144#else /* __ASSEMBLY__ */
145
146#define IA64_MCA_CORRECTED 0x0 /* Error has been corrected by OS_MCA */
147#define IA64_MCA_WARM_BOOT -1 /* Warm boot of the system need from SAL */
148#define IA64_MCA_COLD_BOOT -2 /* Cold boot of the system need from SAL */
149#define IA64_MCA_HALT -3 /* System to be halted by SAL */
150
151#define IA64_INIT_RESUME 0x0 /* Resume after return from INIT */
152#define IA64_INIT_WARM_BOOT -1 /* Warm boot of the system need from SAL */
153
154#define IA64_MCA_SAME_CONTEXT 0x0 /* SAL to return to same context */
155#define IA64_MCA_NEW_CONTEXT -1 /* SAL to return to new context */
130 156
131#endif /* !__ASSEMBLY__ */ 157#endif /* !__ASSEMBLY__ */
132#endif /* _ASM_IA64_MCA_H */ 158#endif /* _ASM_IA64_MCA_H */
diff --git a/include/asm-ia64/mca_asm.h b/include/asm-ia64/mca_asm.h
index 836953e0f91f..27c9203d8ce3 100644
--- a/include/asm-ia64/mca_asm.h
+++ b/include/asm-ia64/mca_asm.h
@@ -8,6 +8,8 @@
8 * Copyright (C) 2000 David Mosberger-Tang <davidm@hpl.hp.com> 8 * Copyright (C) 2000 David Mosberger-Tang <davidm@hpl.hp.com>
9 * Copyright (C) 2002 Intel Corp. 9 * Copyright (C) 2002 Intel Corp.
10 * Copyright (C) 2002 Jenna Hall <jenna.s.hall@intel.com> 10 * Copyright (C) 2002 Jenna Hall <jenna.s.hall@intel.com>
11 * Copyright (C) 2005 Silicon Graphics, Inc
12 * Copyright (C) 2005 Keith Owens <kaos@sgi.com>
11 */ 13 */
12#ifndef _ASM_IA64_MCA_ASM_H 14#ifndef _ASM_IA64_MCA_ASM_H
13#define _ASM_IA64_MCA_ASM_H 15#define _ASM_IA64_MCA_ASM_H
@@ -207,106 +209,33 @@
207 ;; 209 ;;
208 210
209/* 211/*
210 * The following offsets capture the order in which the 212 * The MCA and INIT stacks in struct ia64_mca_cpu look like normal kernel
211 * RSE related registers from the old context are 213 * stacks, except that the SAL/OS state and a switch_stack are stored near the
212 * saved onto the new stack frame. 214 * top of the MCA/INIT stack. To support concurrent entry to MCA or INIT, as
215 * well as MCA over INIT, each event needs its own SAL/OS state. All entries
216 * are 16 byte aligned.
213 * 217 *
214 * +-----------------------+ 218 * +---------------------------+
215 * |NDIRTY [BSP - BSPSTORE]| 219 * | pt_regs |
216 * +-----------------------+ 220 * +---------------------------+
217 * | RNAT | 221 * | switch_stack |
218 * +-----------------------+ 222 * +---------------------------+
219 * | BSPSTORE | 223 * | SAL/OS state |
220 * +-----------------------+ 224 * +---------------------------+
221 * | IFS | 225 * | 16 byte scratch area |
222 * +-----------------------+ 226 * +---------------------------+ <-------- SP at start of C MCA handler
223 * | PFS | 227 * | ..... |
224 * +-----------------------+ 228 * +---------------------------+
225 * | RSC | 229 * | RBS for MCA/INIT handler |
226 * +-----------------------+ <-------- Bottom of new stack frame 230 * +---------------------------+
231 * | struct task for MCA/INIT |
232 * +---------------------------+ <-------- Bottom of MCA/INIT stack
227 */ 233 */
228#define rse_rsc_offset 0
229#define rse_pfs_offset (rse_rsc_offset+0x08)
230#define rse_ifs_offset (rse_pfs_offset+0x08)
231#define rse_bspstore_offset (rse_ifs_offset+0x08)
232#define rse_rnat_offset (rse_bspstore_offset+0x08)
233#define rse_ndirty_offset (rse_rnat_offset+0x08)
234 234
235/* 235#define ALIGN16(x) ((x)&~15)
236 * rse_switch_context 236#define MCA_PT_REGS_OFFSET ALIGN16(KERNEL_STACK_SIZE-IA64_PT_REGS_SIZE)
237 * 237#define MCA_SWITCH_STACK_OFFSET ALIGN16(MCA_PT_REGS_OFFSET-IA64_SWITCH_STACK_SIZE)
238 * 1. Save old RSC onto the new stack frame 238#define MCA_SOS_OFFSET ALIGN16(MCA_SWITCH_STACK_OFFSET-IA64_SAL_OS_STATE_SIZE)
239 * 2. Save PFS onto new stack frame 239#define MCA_SP_OFFSET ALIGN16(MCA_SOS_OFFSET-16)
240 * 3. Cover the old frame and start a new frame.
241 * 4. Save IFS onto new stack frame
242 * 5. Save the old BSPSTORE on the new stack frame
243 * 6. Save the old RNAT on the new stack frame
244 * 7. Write BSPSTORE with the new backing store pointer
245 * 8. Read and save the new BSP to calculate the #dirty registers
246 * NOTE: Look at pages 11-10, 11-11 in PRM Vol 2
247 */
248#define rse_switch_context(temp,p_stackframe,p_bspstore) \
249 ;; \
250 mov temp=ar.rsc;; \
251 st8 [p_stackframe]=temp,8;; \
252 mov temp=ar.pfs;; \
253 st8 [p_stackframe]=temp,8; \
254 cover ;; \
255 mov temp=cr.ifs;; \
256 st8 [p_stackframe]=temp,8;; \
257 mov temp=ar.bspstore;; \
258 st8 [p_stackframe]=temp,8;; \
259 mov temp=ar.rnat;; \
260 st8 [p_stackframe]=temp,8; \
261 mov ar.bspstore=p_bspstore;; \
262 mov temp=ar.bsp;; \
263 sub temp=temp,p_bspstore;; \
264 st8 [p_stackframe]=temp,8;;
265
266/*
267 * rse_return_context
268 * 1. Allocate a zero-sized frame
269 * 2. Store the number of dirty registers RSC.loadrs field
270 * 3. Issue a loadrs to insure that any registers from the interrupted
271 * context which were saved on the new stack frame have been loaded
272 * back into the stacked registers
273 * 4. Restore BSPSTORE
274 * 5. Restore RNAT
275 * 6. Restore PFS
276 * 7. Restore IFS
277 * 8. Restore RSC
278 * 9. Issue an RFI
279 */
280#define rse_return_context(psr_mask_reg,temp,p_stackframe) \
281 ;; \
282 alloc temp=ar.pfs,0,0,0,0; \
283 add p_stackframe=rse_ndirty_offset,p_stackframe;; \
284 ld8 temp=[p_stackframe];; \
285 shl temp=temp,16;; \
286 mov ar.rsc=temp;; \
287 loadrs;; \
288 add p_stackframe=-rse_ndirty_offset+rse_bspstore_offset,p_stackframe;;\
289 ld8 temp=[p_stackframe];; \
290 mov ar.bspstore=temp;; \
291 add p_stackframe=-rse_bspstore_offset+rse_rnat_offset,p_stackframe;;\
292 ld8 temp=[p_stackframe];; \
293 mov ar.rnat=temp;; \
294 add p_stackframe=-rse_rnat_offset+rse_pfs_offset,p_stackframe;; \
295 ld8 temp=[p_stackframe];; \
296 mov ar.pfs=temp;; \
297 add p_stackframe=-rse_pfs_offset+rse_ifs_offset,p_stackframe;; \
298 ld8 temp=[p_stackframe];; \
299 mov cr.ifs=temp;; \
300 add p_stackframe=-rse_ifs_offset+rse_rsc_offset,p_stackframe;; \
301 ld8 temp=[p_stackframe];; \
302 mov ar.rsc=temp ; \
303 mov temp=psr;; \
304 or temp=temp,psr_mask_reg;; \
305 mov cr.ipsr=temp;; \
306 mov temp=ip;; \
307 add temp=0x30,temp;; \
308 mov cr.iip=temp;; \
309 srlz.i;; \
310 rfi;;
311 240
312#endif /* _ASM_IA64_MCA_ASM_H */ 241#endif /* _ASM_IA64_MCA_ASM_H */
diff --git a/include/asm-ia64/pci.h b/include/asm-ia64/pci.h
index dba9f220be71..ef616fd4cb1b 100644
--- a/include/asm-ia64/pci.h
+++ b/include/asm-ia64/pci.h
@@ -156,6 +156,19 @@ extern void pcibios_resource_to_bus(struct pci_dev *dev,
156extern void pcibios_bus_to_resource(struct pci_dev *dev, 156extern void pcibios_bus_to_resource(struct pci_dev *dev,
157 struct resource *res, struct pci_bus_region *region); 157 struct resource *res, struct pci_bus_region *region);
158 158
159static inline struct resource *
160pcibios_select_root(struct pci_dev *pdev, struct resource *res)
161{
162 struct resource *root = NULL;
163
164 if (res->flags & IORESOURCE_IO)
165 root = &ioport_resource;
166 if (res->flags & IORESOURCE_MEM)
167 root = &iomem_resource;
168
169 return root;
170}
171
159#define pcibios_scan_all_fns(a, b) 0 172#define pcibios_scan_all_fns(a, b) 0
160 173
161#endif /* _ASM_IA64_PCI_H */ 174#endif /* _ASM_IA64_PCI_H */
diff --git a/include/asm-ia64/ptrace.h b/include/asm-ia64/ptrace.h
index 0bef19538406..fc544929ac34 100644
--- a/include/asm-ia64/ptrace.h
+++ b/include/asm-ia64/ptrace.h
@@ -57,7 +57,7 @@
57#include <linux/config.h> 57#include <linux/config.h>
58 58
59#include <asm/fpu.h> 59#include <asm/fpu.h>
60#include <asm/offsets.h> 60#include <asm/asm-offsets.h>
61 61
62/* 62/*
63 * Base-2 logarithm of number of pages to allocate per task structure 63 * Base-2 logarithm of number of pages to allocate per task structure
@@ -119,7 +119,7 @@ struct pt_regs {
119 unsigned long ar_unat; /* interrupted task's NaT register (preserved) */ 119 unsigned long ar_unat; /* interrupted task's NaT register (preserved) */
120 unsigned long ar_pfs; /* prev function state */ 120 unsigned long ar_pfs; /* prev function state */
121 unsigned long ar_rsc; /* RSE configuration */ 121 unsigned long ar_rsc; /* RSE configuration */
122 /* The following two are valid only if cr_ipsr.cpl > 0: */ 122 /* The following two are valid only if cr_ipsr.cpl > 0 || ti->flags & _TIF_MCA_INIT */
123 unsigned long ar_rnat; /* RSE NaT */ 123 unsigned long ar_rnat; /* RSE NaT */
124 unsigned long ar_bspstore; /* RSE bspstore */ 124 unsigned long ar_bspstore; /* RSE bspstore */
125 125
diff --git a/include/asm-ia64/sn/sn_feature_sets.h b/include/asm-ia64/sn/sn_feature_sets.h
new file mode 100644
index 000000000000..e68a80853d5d
--- /dev/null
+++ b/include/asm-ia64/sn/sn_feature_sets.h
@@ -0,0 +1,57 @@
1#ifndef _ASM_IA64_SN_FEATURE_SETS_H
2#define _ASM_IA64_SN_FEATURE_SETS_H
3
4/*
5 * SN PROM Features
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 *
11 * Copyright (c) 2005 Silicon Graphics, Inc. All rights reserved.
12 */
13
14
15#include <asm/types.h>
16#include <asm/bitops.h>
17
18/* --------------------- PROM Features -----------------------------*/
19extern int sn_prom_feature_available(int id);
20
21#define MAX_PROM_FEATURE_SETS 2
22
23/*
24 * The following defines features that may or may not be supported by the
25 * current PROM. The OS uses sn_prom_feature_available(feature) to test for
26 * the presence of a PROM feature. Down rev (old) PROMs will always test
27 * "false" for new features.
28 *
29 * Use:
30 * if (sn_prom_feature_available(PRF_FEATURE_XXX))
31 * ...
32 */
33
34/*
35 * Example: feature XXX
36 */
37#define PRF_FEATURE_XXX 0
38
39
40
41/* --------------------- OS Features -------------------------------*/
42
43/*
44 * The following defines OS features that are optionally present in
45 * the operating system.
46 * During boot, PROM is notified of these features via a series of calls:
47 *
48 * ia64_sn_set_os_feature(feature1);
49 *
50 * Once enabled, a feature cannot be disabled.
51 *
52 * By default, features are disabled unless explicitly enabled.
53 */
54#define OSF_MCA_SLV_TO_OS_INIT_SLV 0
55#define OSF_FEAT_LOG_SBES 1
56
57#endif /* _ASM_IA64_SN_FEATURE_SETS_H */
diff --git a/include/asm-ia64/sn/sn_sal.h b/include/asm-ia64/sn/sn_sal.h
index e67825ad1930..fea35b33d4e4 100644
--- a/include/asm-ia64/sn/sn_sal.h
+++ b/include/asm-ia64/sn/sn_sal.h
@@ -80,6 +80,9 @@
80#define SN_SAL_RESERVED_DO_NOT_USE 0x02000062 80#define SN_SAL_RESERVED_DO_NOT_USE 0x02000062
81#define SN_SAL_IOIF_GET_PCI_TOPOLOGY 0x02000064 81#define SN_SAL_IOIF_GET_PCI_TOPOLOGY 0x02000064
82 82
83#define SN_SAL_GET_PROM_FEATURE_SET 0x02000065
84#define SN_SAL_SET_OS_FEATURE_SET 0x02000066
85
83/* 86/*
84 * Service-specific constants 87 * Service-specific constants
85 */ 88 */
@@ -118,8 +121,8 @@
118/* 121/*
119 * Error Handling Features 122 * Error Handling Features
120 */ 123 */
121#define SAL_ERR_FEAT_MCA_SLV_TO_OS_INIT_SLV 0x1 124#define SAL_ERR_FEAT_MCA_SLV_TO_OS_INIT_SLV 0x1 // obsolete
122#define SAL_ERR_FEAT_LOG_SBES 0x2 125#define SAL_ERR_FEAT_LOG_SBES 0x2 // obsolete
123#define SAL_ERR_FEAT_MFR_OVERRIDE 0x4 126#define SAL_ERR_FEAT_MFR_OVERRIDE 0x4
124#define SAL_ERR_FEAT_SBE_THRESHOLD 0xffff0000 127#define SAL_ERR_FEAT_SBE_THRESHOLD 0xffff0000
125 128
@@ -152,12 +155,6 @@ sn_sal_rev(void)
152} 155}
153 156
154/* 157/*
155 * Specify the minimum PROM revsion required for this kernel.
156 * Note that they're stored in hex format...
157 */
158#define SN_SAL_MIN_VERSION 0x0404
159
160/*
161 * Returns the master console nasid, if the call fails, return an illegal 158 * Returns the master console nasid, if the call fails, return an illegal
162 * value. 159 * value.
163 */ 160 */
@@ -336,7 +333,7 @@ ia64_sn_plat_cpei_handler(void)
336} 333}
337 334
338/* 335/*
339 * Set Error Handling Features 336 * Set Error Handling Features (Obsolete)
340 */ 337 */
341static inline u64 338static inline u64
342ia64_sn_plat_set_error_handling_features(void) 339ia64_sn_plat_set_error_handling_features(void)
@@ -1052,4 +1049,25 @@ ia64_sn_is_fake_prom(void)
1052 return (rv.status == 0); 1049 return (rv.status == 0);
1053} 1050}
1054 1051
1052static inline int
1053ia64_sn_get_prom_feature_set(int set, unsigned long *feature_set)
1054{
1055 struct ia64_sal_retval rv;
1056
1057 SAL_CALL_NOLOCK(rv, SN_SAL_GET_PROM_FEATURE_SET, set, 0, 0, 0, 0, 0, 0);
1058 if (rv.status != 0)
1059 return rv.status;
1060 *feature_set = rv.v0;
1061 return 0;
1062}
1063
1064static inline int
1065ia64_sn_set_os_feature(int feature)
1066{
1067 struct ia64_sal_retval rv;
1068
1069 SAL_CALL_NOLOCK(rv, SN_SAL_SET_OS_FEATURE_SET, feature, 0, 0, 0, 0, 0, 0);
1070 return rv.status;
1071}
1072
1055#endif /* _ASM_IA64_SN_SN_SAL_H */ 1073#endif /* _ASM_IA64_SN_SN_SAL_H */
diff --git a/include/asm-ia64/spinlock.h b/include/asm-ia64/spinlock.h
index d2430aa0d49d..5b78611411c3 100644
--- a/include/asm-ia64/spinlock.h
+++ b/include/asm-ia64/spinlock.h
@@ -17,28 +17,20 @@
17#include <asm/intrinsics.h> 17#include <asm/intrinsics.h>
18#include <asm/system.h> 18#include <asm/system.h>
19 19
20typedef struct { 20#define __raw_spin_lock_init(x) ((x)->lock = 0)
21 volatile unsigned int lock;
22#ifdef CONFIG_PREEMPT
23 unsigned int break_lock;
24#endif
25} spinlock_t;
26
27#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 }
28#define spin_lock_init(x) ((x)->lock = 0)
29 21
30#ifdef ASM_SUPPORTED 22#ifdef ASM_SUPPORTED
31/* 23/*
32 * Try to get the lock. If we fail to get the lock, make a non-standard call to 24 * Try to get the lock. If we fail to get the lock, make a non-standard call to
33 * ia64_spinlock_contention(). We do not use a normal call because that would force all 25 * ia64_spinlock_contention(). We do not use a normal call because that would force all
34 * callers of spin_lock() to be non-leaf routines. Instead, ia64_spinlock_contention() is 26 * callers of __raw_spin_lock() to be non-leaf routines. Instead, ia64_spinlock_contention() is
35 * carefully coded to touch only those registers that spin_lock() marks "clobbered". 27 * carefully coded to touch only those registers that __raw_spin_lock() marks "clobbered".
36 */ 28 */
37 29
38#define IA64_SPINLOCK_CLOBBERS "ar.ccv", "ar.pfs", "p14", "p15", "r27", "r28", "r29", "r30", "b6", "memory" 30#define IA64_SPINLOCK_CLOBBERS "ar.ccv", "ar.pfs", "p14", "p15", "r27", "r28", "r29", "r30", "b6", "memory"
39 31
40static inline void 32static inline void
41_raw_spin_lock_flags (spinlock_t *lock, unsigned long flags) 33__raw_spin_lock_flags (raw_spinlock_t *lock, unsigned long flags)
42{ 34{
43 register volatile unsigned int *ptr asm ("r31") = &lock->lock; 35 register volatile unsigned int *ptr asm ("r31") = &lock->lock;
44 36
@@ -94,17 +86,17 @@ _raw_spin_lock_flags (spinlock_t *lock, unsigned long flags)
94#endif 86#endif
95} 87}
96 88
97#define _raw_spin_lock(lock) _raw_spin_lock_flags(lock, 0) 89#define __raw_spin_lock(lock) __raw_spin_lock_flags(lock, 0)
98 90
99/* Unlock by doing an ordered store and releasing the cacheline with nta */ 91/* Unlock by doing an ordered store and releasing the cacheline with nta */
100static inline void _raw_spin_unlock(spinlock_t *x) { 92static inline void __raw_spin_unlock(raw_spinlock_t *x) {
101 barrier(); 93 barrier();
102 asm volatile ("st4.rel.nta [%0] = r0\n\t" :: "r"(x)); 94 asm volatile ("st4.rel.nta [%0] = r0\n\t" :: "r"(x));
103} 95}
104 96
105#else /* !ASM_SUPPORTED */ 97#else /* !ASM_SUPPORTED */
106#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) 98#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock)
107# define _raw_spin_lock(x) \ 99# define __raw_spin_lock(x) \
108do { \ 100do { \
109 __u32 *ia64_spinlock_ptr = (__u32 *) (x); \ 101 __u32 *ia64_spinlock_ptr = (__u32 *) (x); \
110 __u64 ia64_spinlock_val; \ 102 __u64 ia64_spinlock_val; \
@@ -117,29 +109,20 @@ do { \
117 } while (ia64_spinlock_val); \ 109 } while (ia64_spinlock_val); \
118 } \ 110 } \
119} while (0) 111} while (0)
120#define _raw_spin_unlock(x) do { barrier(); ((spinlock_t *) x)->lock = 0; } while (0) 112#define __raw_spin_unlock(x) do { barrier(); ((raw_spinlock_t *) x)->lock = 0; } while (0)
121#endif /* !ASM_SUPPORTED */ 113#endif /* !ASM_SUPPORTED */
122 114
123#define spin_is_locked(x) ((x)->lock != 0) 115#define __raw_spin_is_locked(x) ((x)->lock != 0)
124#define _raw_spin_trylock(x) (cmpxchg_acq(&(x)->lock, 0, 1) == 0) 116#define __raw_spin_trylock(x) (cmpxchg_acq(&(x)->lock, 0, 1) == 0)
125#define spin_unlock_wait(x) do { barrier(); } while ((x)->lock) 117#define __raw_spin_unlock_wait(lock) \
126 118 do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0)
127typedef struct {
128 volatile unsigned int read_counter : 24;
129 volatile unsigned int write_lock : 8;
130#ifdef CONFIG_PREEMPT
131 unsigned int break_lock;
132#endif
133} rwlock_t;
134#define RW_LOCK_UNLOCKED (rwlock_t) { 0, 0 }
135 119
136#define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while(0) 120#define __raw_read_can_lock(rw) (*(volatile int *)(rw) >= 0)
137#define read_can_lock(rw) (*(volatile int *)(rw) >= 0) 121#define __raw_write_can_lock(rw) (*(volatile int *)(rw) == 0)
138#define write_can_lock(rw) (*(volatile int *)(rw) == 0)
139 122
140#define _raw_read_lock(rw) \ 123#define __raw_read_lock(rw) \
141do { \ 124do { \
142 rwlock_t *__read_lock_ptr = (rw); \ 125 raw_rwlock_t *__read_lock_ptr = (rw); \
143 \ 126 \
144 while (unlikely(ia64_fetchadd(1, (int *) __read_lock_ptr, acq) < 0)) { \ 127 while (unlikely(ia64_fetchadd(1, (int *) __read_lock_ptr, acq) < 0)) { \
145 ia64_fetchadd(-1, (int *) __read_lock_ptr, rel); \ 128 ia64_fetchadd(-1, (int *) __read_lock_ptr, rel); \
@@ -148,14 +131,14 @@ do { \
148 } \ 131 } \
149} while (0) 132} while (0)
150 133
151#define _raw_read_unlock(rw) \ 134#define __raw_read_unlock(rw) \
152do { \ 135do { \
153 rwlock_t *__read_lock_ptr = (rw); \ 136 raw_rwlock_t *__read_lock_ptr = (rw); \
154 ia64_fetchadd(-1, (int *) __read_lock_ptr, rel); \ 137 ia64_fetchadd(-1, (int *) __read_lock_ptr, rel); \
155} while (0) 138} while (0)
156 139
157#ifdef ASM_SUPPORTED 140#ifdef ASM_SUPPORTED
158#define _raw_write_lock(rw) \ 141#define __raw_write_lock(rw) \
159do { \ 142do { \
160 __asm__ __volatile__ ( \ 143 __asm__ __volatile__ ( \
161 "mov ar.ccv = r0\n" \ 144 "mov ar.ccv = r0\n" \
@@ -170,7 +153,7 @@ do { \
170 :: "r"(rw) : "ar.ccv", "p7", "r2", "r29", "memory"); \ 153 :: "r"(rw) : "ar.ccv", "p7", "r2", "r29", "memory"); \
171} while(0) 154} while(0)
172 155
173#define _raw_write_trylock(rw) \ 156#define __raw_write_trylock(rw) \
174({ \ 157({ \
175 register long result; \ 158 register long result; \
176 \ 159 \
@@ -182,7 +165,7 @@ do { \
182 (result == 0); \ 165 (result == 0); \
183}) 166})
184 167
185static inline void _raw_write_unlock(rwlock_t *x) 168static inline void __raw_write_unlock(raw_rwlock_t *x)
186{ 169{
187 u8 *y = (u8 *)x; 170 u8 *y = (u8 *)x;
188 barrier(); 171 barrier();
@@ -191,7 +174,7 @@ static inline void _raw_write_unlock(rwlock_t *x)
191 174
192#else /* !ASM_SUPPORTED */ 175#else /* !ASM_SUPPORTED */
193 176
194#define _raw_write_lock(l) \ 177#define __raw_write_lock(l) \
195({ \ 178({ \
196 __u64 ia64_val, ia64_set_val = ia64_dep_mi(-1, 0, 31, 1); \ 179 __u64 ia64_val, ia64_set_val = ia64_dep_mi(-1, 0, 31, 1); \
197 __u32 *ia64_write_lock_ptr = (__u32 *) (l); \ 180 __u32 *ia64_write_lock_ptr = (__u32 *) (l); \
@@ -202,7 +185,7 @@ static inline void _raw_write_unlock(rwlock_t *x)
202 } while (ia64_val); \ 185 } while (ia64_val); \
203}) 186})
204 187
205#define _raw_write_trylock(rw) \ 188#define __raw_write_trylock(rw) \
206({ \ 189({ \
207 __u64 ia64_val; \ 190 __u64 ia64_val; \
208 __u64 ia64_set_val = ia64_dep_mi(-1, 0, 31,1); \ 191 __u64 ia64_set_val = ia64_dep_mi(-1, 0, 31,1); \
@@ -210,7 +193,7 @@ static inline void _raw_write_unlock(rwlock_t *x)
210 (ia64_val == 0); \ 193 (ia64_val == 0); \
211}) 194})
212 195
213static inline void _raw_write_unlock(rwlock_t *x) 196static inline void __raw_write_unlock(raw_rwlock_t *x)
214{ 197{
215 barrier(); 198 barrier();
216 x->write_lock = 0; 199 x->write_lock = 0;
@@ -218,6 +201,6 @@ static inline void _raw_write_unlock(rwlock_t *x)
218 201
219#endif /* !ASM_SUPPORTED */ 202#endif /* !ASM_SUPPORTED */
220 203
221#define _raw_read_trylock(lock) generic_raw_read_trylock(lock) 204#define __raw_read_trylock(lock) generic__raw_read_trylock(lock)
222 205
223#endif /* _ASM_IA64_SPINLOCK_H */ 206#endif /* _ASM_IA64_SPINLOCK_H */
diff --git a/include/asm-ia64/spinlock_types.h b/include/asm-ia64/spinlock_types.h
new file mode 100644
index 000000000000..474e46f1ab4a
--- /dev/null
+++ b/include/asm-ia64/spinlock_types.h
@@ -0,0 +1,21 @@
1#ifndef _ASM_IA64_SPINLOCK_TYPES_H
2#define _ASM_IA64_SPINLOCK_TYPES_H
3
4#ifndef __LINUX_SPINLOCK_TYPES_H
5# error "please don't include this file directly"
6#endif
7
8typedef struct {
9 volatile unsigned int lock;
10} raw_spinlock_t;
11
12#define __RAW_SPIN_LOCK_UNLOCKED { 0 }
13
14typedef struct {
15 volatile unsigned int read_counter : 31;
16 volatile unsigned int write_lock : 1;
17} raw_rwlock_t;
18
19#define __RAW_RW_LOCK_UNLOCKED { 0, 0 }
20
21#endif
diff --git a/include/asm-ia64/system.h b/include/asm-ia64/system.h
index 33256db4a7cf..635235fa1e32 100644
--- a/include/asm-ia64/system.h
+++ b/include/asm-ia64/system.h
@@ -275,6 +275,7 @@ extern void ia64_load_extra (struct task_struct *task);
275 */ 275 */
276#define __ARCH_WANT_UNLOCKED_CTXSW 276#define __ARCH_WANT_UNLOCKED_CTXSW
277 277
278#define ARCH_HAS_PREFETCH_SWITCH_STACK
278#define ia64_platform_is(x) (strcmp(x, platform_name) == 0) 279#define ia64_platform_is(x) (strcmp(x, platform_name) == 0)
279 280
280void cpu_idle_wait(void); 281void cpu_idle_wait(void);
diff --git a/include/asm-ia64/thread_info.h b/include/asm-ia64/thread_info.h
index 7dc8951708a3..cf4a950a0f4f 100644
--- a/include/asm-ia64/thread_info.h
+++ b/include/asm-ia64/thread_info.h
@@ -5,7 +5,7 @@
5#ifndef _ASM_IA64_THREAD_INFO_H 5#ifndef _ASM_IA64_THREAD_INFO_H
6#define _ASM_IA64_THREAD_INFO_H 6#define _ASM_IA64_THREAD_INFO_H
7 7
8#include <asm/offsets.h> 8#include <asm/asm-offsets.h>
9#include <asm/processor.h> 9#include <asm/processor.h>
10#include <asm/ptrace.h> 10#include <asm/ptrace.h>
11 11
@@ -76,6 +76,7 @@ struct thread_info {
76#define TIF_SIGDELAYED 5 /* signal delayed from MCA/INIT/NMI/PMI context */ 76#define TIF_SIGDELAYED 5 /* signal delayed from MCA/INIT/NMI/PMI context */
77#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */ 77#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */
78#define TIF_MEMDIE 17 78#define TIF_MEMDIE 17
79#define TIF_MCA_INIT 18 /* this task is processing MCA or INIT */
79 80
80#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) 81#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
81#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) 82#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
@@ -85,6 +86,7 @@ struct thread_info {
85#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) 86#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
86#define _TIF_SIGDELAYED (1 << TIF_SIGDELAYED) 87#define _TIF_SIGDELAYED (1 << TIF_SIGDELAYED)
87#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) 88#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
89#define _TIF_MCA_INIT (1 << TIF_MCA_INIT)
88 90
89/* "work to do on user-return" bits */ 91/* "work to do on user-return" bits */
90#define TIF_ALLWORK_MASK (_TIF_NOTIFY_RESUME|_TIF_SIGPENDING|_TIF_NEED_RESCHED|_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SIGDELAYED) 92#define TIF_ALLWORK_MASK (_TIF_NOTIFY_RESUME|_TIF_SIGPENDING|_TIF_NEED_RESCHED|_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SIGDELAYED)
diff --git a/include/asm-ia64/unwind.h b/include/asm-ia64/unwind.h
index 61426ad3ecdb..5df0276b0493 100644
--- a/include/asm-ia64/unwind.h
+++ b/include/asm-ia64/unwind.h
@@ -114,13 +114,6 @@ extern void unw_remove_unwind_table (void *handle);
114 */ 114 */
115extern void unw_init_from_blocked_task (struct unw_frame_info *info, struct task_struct *t); 115extern void unw_init_from_blocked_task (struct unw_frame_info *info, struct task_struct *t);
116 116
117/*
118 * Prepare to unwind from interruption. The pt-regs and switch-stack structures must have
119 * be "adjacent" (no state modifications between pt-regs and switch-stack).
120 */
121extern void unw_init_from_interruption (struct unw_frame_info *info, struct task_struct *t,
122 struct pt_regs *pt, struct switch_stack *sw);
123
124extern void unw_init_frame_info (struct unw_frame_info *info, struct task_struct *t, 117extern void unw_init_frame_info (struct unw_frame_info *info, struct task_struct *t,
125 struct switch_stack *sw); 118 struct switch_stack *sw);
126 119
diff --git a/include/asm-m32r/spinlock.h b/include/asm-m32r/spinlock.h
index 6608d8371c50..7de7def28da9 100644
--- a/include/asm-m32r/spinlock.h
+++ b/include/asm-m32r/spinlock.h
@@ -14,57 +14,30 @@
14#include <asm/atomic.h> 14#include <asm/atomic.h>
15#include <asm/page.h> 15#include <asm/page.h>
16 16
17extern int printk(const char * fmt, ...)
18 __attribute__ ((format (printf, 1, 2)));
19
20#define RW_LOCK_BIAS 0x01000000
21#define RW_LOCK_BIAS_STR "0x01000000"
22
23/* 17/*
24 * Your basic SMP spinlocks, allowing only a single CPU anywhere 18 * Your basic SMP spinlocks, allowing only a single CPU anywhere
25 */ 19 *
26 20 * (the type definitions are in asm/spinlock_types.h)
27typedef struct { 21 *
28 volatile int slock;
29#ifdef CONFIG_DEBUG_SPINLOCK
30 unsigned magic;
31#endif
32#ifdef CONFIG_PREEMPT
33 unsigned int break_lock;
34#endif
35} spinlock_t;
36
37#define SPINLOCK_MAGIC 0xdead4ead
38
39#ifdef CONFIG_DEBUG_SPINLOCK
40#define SPINLOCK_MAGIC_INIT , SPINLOCK_MAGIC
41#else
42#define SPINLOCK_MAGIC_INIT /* */
43#endif
44
45#define SPIN_LOCK_UNLOCKED (spinlock_t) { 1 SPINLOCK_MAGIC_INIT }
46
47#define spin_lock_init(x) do { *(x) = SPIN_LOCK_UNLOCKED; } while(0)
48
49/*
50 * Simple spin lock operations. There are two variants, one clears IRQ's 22 * Simple spin lock operations. There are two variants, one clears IRQ's
51 * on the local processor, one does not. 23 * on the local processor, one does not.
52 * 24 *
53 * We make no fairness assumptions. They have a cost. 25 * We make no fairness assumptions. They have a cost.
54 */ 26 */
55 27
56#define spin_is_locked(x) (*(volatile int *)(&(x)->slock) <= 0) 28#define __raw_spin_is_locked(x) (*(volatile int *)(&(x)->slock) <= 0)
57#define spin_unlock_wait(x) do { barrier(); } while(spin_is_locked(x)) 29#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock)
58#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) 30#define __raw_spin_unlock_wait(x) \
31 do { cpu_relax(); } while (__raw_spin_is_locked(x))
59 32
60/** 33/**
61 * _raw_spin_trylock - Try spin lock and return a result 34 * __raw_spin_trylock - Try spin lock and return a result
62 * @lock: Pointer to the lock variable 35 * @lock: Pointer to the lock variable
63 * 36 *
64 * _raw_spin_trylock() tries to get the lock and returns a result. 37 * __raw_spin_trylock() tries to get the lock and returns a result.
65 * On the m32r, the result value is 1 (= Success) or 0 (= Failure). 38 * On the m32r, the result value is 1 (= Success) or 0 (= Failure).
66 */ 39 */
67static inline int _raw_spin_trylock(spinlock_t *lock) 40static inline int __raw_spin_trylock(raw_spinlock_t *lock)
68{ 41{
69 int oldval; 42 int oldval;
70 unsigned long tmp1, tmp2; 43 unsigned long tmp1, tmp2;
@@ -78,7 +51,7 @@ static inline int _raw_spin_trylock(spinlock_t *lock)
78 * } 51 * }
79 */ 52 */
80 __asm__ __volatile__ ( 53 __asm__ __volatile__ (
81 "# spin_trylock \n\t" 54 "# __raw_spin_trylock \n\t"
82 "ldi %1, #0; \n\t" 55 "ldi %1, #0; \n\t"
83 "mvfc %2, psw; \n\t" 56 "mvfc %2, psw; \n\t"
84 "clrpsw #0x40 -> nop; \n\t" 57 "clrpsw #0x40 -> nop; \n\t"
@@ -97,16 +70,10 @@ static inline int _raw_spin_trylock(spinlock_t *lock)
97 return (oldval > 0); 70 return (oldval > 0);
98} 71}
99 72
100static inline void _raw_spin_lock(spinlock_t *lock) 73static inline void __raw_spin_lock(raw_spinlock_t *lock)
101{ 74{
102 unsigned long tmp0, tmp1; 75 unsigned long tmp0, tmp1;
103 76
104#ifdef CONFIG_DEBUG_SPINLOCK
105 if (unlikely(lock->magic != SPINLOCK_MAGIC)) {
106 printk("pc: %p\n", __builtin_return_address(0));
107 BUG();
108 }
109#endif
110 /* 77 /*
111 * lock->slock : =1 : unlock 78 * lock->slock : =1 : unlock
112 * : <=0 : lock 79 * : <=0 : lock
@@ -118,7 +85,7 @@ static inline void _raw_spin_lock(spinlock_t *lock)
118 * } 85 * }
119 */ 86 */
120 __asm__ __volatile__ ( 87 __asm__ __volatile__ (
121 "# spin_lock \n\t" 88 "# __raw_spin_lock \n\t"
122 ".fillinsn \n" 89 ".fillinsn \n"
123 "1: \n\t" 90 "1: \n\t"
124 "mvfc %1, psw; \n\t" 91 "mvfc %1, psw; \n\t"
@@ -145,12 +112,8 @@ static inline void _raw_spin_lock(spinlock_t *lock)
145 ); 112 );
146} 113}
147 114
148static inline void _raw_spin_unlock(spinlock_t *lock) 115static inline void __raw_spin_unlock(raw_spinlock_t *lock)
149{ 116{
150#ifdef CONFIG_DEBUG_SPINLOCK
151 BUG_ON(lock->magic != SPINLOCK_MAGIC);
152 BUG_ON(!spin_is_locked(lock));
153#endif
154 mb(); 117 mb();
155 lock->slock = 1; 118 lock->slock = 1;
156} 119}
@@ -164,59 +127,32 @@ static inline void _raw_spin_unlock(spinlock_t *lock)
164 * can "mix" irq-safe locks - any writer needs to get a 127 * can "mix" irq-safe locks - any writer needs to get a
165 * irq-safe write-lock, but readers can get non-irqsafe 128 * irq-safe write-lock, but readers can get non-irqsafe
166 * read-locks. 129 * read-locks.
130 *
131 * On x86, we implement read-write locks as a 32-bit counter
132 * with the high bit (sign) being the "contended" bit.
133 *
134 * The inline assembly is non-obvious. Think about it.
135 *
136 * Changed to use the same technique as rw semaphores. See
137 * semaphore.h for details. -ben
167 */ 138 */
168typedef struct {
169 volatile int lock;
170#ifdef CONFIG_DEBUG_SPINLOCK
171 unsigned magic;
172#endif
173#ifdef CONFIG_PREEMPT
174 unsigned int break_lock;
175#endif
176} rwlock_t;
177
178#define RWLOCK_MAGIC 0xdeaf1eed
179
180#ifdef CONFIG_DEBUG_SPINLOCK
181#define RWLOCK_MAGIC_INIT , RWLOCK_MAGIC
182#else
183#define RWLOCK_MAGIC_INIT /* */
184#endif
185
186#define RW_LOCK_UNLOCKED (rwlock_t) { RW_LOCK_BIAS RWLOCK_MAGIC_INIT }
187
188#define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while(0)
189 139
190/** 140/**
191 * read_can_lock - would read_trylock() succeed? 141 * read_can_lock - would read_trylock() succeed?
192 * @lock: the rwlock in question. 142 * @lock: the rwlock in question.
193 */ 143 */
194#define read_can_lock(x) ((int)(x)->lock > 0) 144#define __raw_read_can_lock(x) ((int)(x)->lock > 0)
195 145
196/** 146/**
197 * write_can_lock - would write_trylock() succeed? 147 * write_can_lock - would write_trylock() succeed?
198 * @lock: the rwlock in question. 148 * @lock: the rwlock in question.
199 */ 149 */
200#define write_can_lock(x) ((x)->lock == RW_LOCK_BIAS) 150#define __raw_write_can_lock(x) ((x)->lock == RW_LOCK_BIAS)
201
202/*
203 * On x86, we implement read-write locks as a 32-bit counter
204 * with the high bit (sign) being the "contended" bit.
205 *
206 * The inline assembly is non-obvious. Think about it.
207 *
208 * Changed to use the same technique as rw semaphores. See
209 * semaphore.h for details. -ben
210 */
211/* the spinlock helpers are in arch/i386/kernel/semaphore.c */
212 151
213static inline void _raw_read_lock(rwlock_t *rw) 152static inline void __raw_read_lock(raw_rwlock_t *rw)
214{ 153{
215 unsigned long tmp0, tmp1; 154 unsigned long tmp0, tmp1;
216 155
217#ifdef CONFIG_DEBUG_SPINLOCK
218 BUG_ON(rw->magic != RWLOCK_MAGIC);
219#endif
220 /* 156 /*
221 * rw->lock : >0 : unlock 157 * rw->lock : >0 : unlock
222 * : <=0 : lock 158 * : <=0 : lock
@@ -264,13 +200,10 @@ static inline void _raw_read_lock(rwlock_t *rw)
264 ); 200 );
265} 201}
266 202
267static inline void _raw_write_lock(rwlock_t *rw) 203static inline void __raw_write_lock(raw_rwlock_t *rw)
268{ 204{
269 unsigned long tmp0, tmp1, tmp2; 205 unsigned long tmp0, tmp1, tmp2;
270 206
271#ifdef CONFIG_DEBUG_SPINLOCK
272 BUG_ON(rw->magic != RWLOCK_MAGIC);
273#endif
274 /* 207 /*
275 * rw->lock : =RW_LOCK_BIAS_STR : unlock 208 * rw->lock : =RW_LOCK_BIAS_STR : unlock
276 * : !=RW_LOCK_BIAS_STR : lock 209 * : !=RW_LOCK_BIAS_STR : lock
@@ -320,7 +253,7 @@ static inline void _raw_write_lock(rwlock_t *rw)
320 ); 253 );
321} 254}
322 255
323static inline void _raw_read_unlock(rwlock_t *rw) 256static inline void __raw_read_unlock(raw_rwlock_t *rw)
324{ 257{
325 unsigned long tmp0, tmp1; 258 unsigned long tmp0, tmp1;
326 259
@@ -342,7 +275,7 @@ static inline void _raw_read_unlock(rwlock_t *rw)
342 ); 275 );
343} 276}
344 277
345static inline void _raw_write_unlock(rwlock_t *rw) 278static inline void __raw_write_unlock(raw_rwlock_t *rw)
346{ 279{
347 unsigned long tmp0, tmp1, tmp2; 280 unsigned long tmp0, tmp1, tmp2;
348 281
@@ -366,9 +299,9 @@ static inline void _raw_write_unlock(rwlock_t *rw)
366 ); 299 );
367} 300}
368 301
369#define _raw_read_trylock(lock) generic_raw_read_trylock(lock) 302#define __raw_read_trylock(lock) generic__raw_read_trylock(lock)
370 303
371static inline int _raw_write_trylock(rwlock_t *lock) 304static inline int __raw_write_trylock(raw_rwlock_t *lock)
372{ 305{
373 atomic_t *count = (atomic_t *)lock; 306 atomic_t *count = (atomic_t *)lock;
374 if (atomic_sub_and_test(RW_LOCK_BIAS, count)) 307 if (atomic_sub_and_test(RW_LOCK_BIAS, count))
diff --git a/include/asm-m32r/spinlock_types.h b/include/asm-m32r/spinlock_types.h
new file mode 100644
index 000000000000..7e9941c45f40
--- /dev/null
+++ b/include/asm-m32r/spinlock_types.h
@@ -0,0 +1,23 @@
1#ifndef _ASM_M32R_SPINLOCK_TYPES_H
2#define _ASM_M32R_SPINLOCK_TYPES_H
3
4#ifndef __LINUX_SPINLOCK_TYPES_H
5# error "please don't include this file directly"
6#endif
7
8typedef struct {
9 volatile int slock;
10} raw_spinlock_t;
11
12#define __RAW_SPIN_LOCK_UNLOCKED { 1 }
13
14typedef struct {
15 volatile int lock;
16} raw_rwlock_t;
17
18#define RW_LOCK_BIAS 0x01000000
19#define RW_LOCK_BIAS_STR "0x01000000"
20
21#define __RAW_RW_LOCK_UNLOCKED { RW_LOCK_BIAS }
22
23#endif
diff --git a/include/asm-m68knommu/bitops.h b/include/asm-m68knommu/bitops.h
index f95e32b40425..c42f88a9b9f9 100644
--- a/include/asm-m68knommu/bitops.h
+++ b/include/asm-m68knommu/bitops.h
@@ -259,7 +259,7 @@ static __inline__ int __test_bit(int nr, const volatile unsigned long * addr)
259#define find_first_bit(addr, size) \ 259#define find_first_bit(addr, size) \
260 find_next_bit((addr), (size), 0) 260 find_next_bit((addr), (size), 0)
261 261
262static __inline__ int find_next_zero_bit (void * addr, int size, int offset) 262static __inline__ int find_next_zero_bit (const void * addr, int size, int offset)
263{ 263{
264 unsigned long *p = ((unsigned long *) addr) + (offset >> 5); 264 unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
265 unsigned long result = offset & ~31UL; 265 unsigned long result = offset & ~31UL;
diff --git a/include/asm-m68knommu/cacheflush.h b/include/asm-m68knommu/cacheflush.h
index aa7a2ffa41af..026bbc9565b4 100644
--- a/include/asm-m68knommu/cacheflush.h
+++ b/include/asm-m68knommu/cacheflush.h
@@ -2,23 +2,23 @@
2#define _M68KNOMMU_CACHEFLUSH_H 2#define _M68KNOMMU_CACHEFLUSH_H
3 3
4/* 4/*
5 * (C) Copyright 2000-2002, Greg Ungerer <gerg@snapgear.com> 5 * (C) Copyright 2000-2004, Greg Ungerer <gerg@snapgear.com>
6 */ 6 */
7#include <linux/mm.h> 7#include <linux/mm.h>
8 8
9#define flush_cache_all() __flush_cache_all() 9#define flush_cache_all() __flush_cache_all()
10#define flush_cache_mm(mm) do { } while (0) 10#define flush_cache_mm(mm) do { } while (0)
11#define flush_cache_range(vma, start, end) do { } while (0) 11#define flush_cache_range(vma, start, end) __flush_cache_all()
12#define flush_cache_page(vma, vmaddr, pfn) do { } while (0) 12#define flush_cache_page(vma, vmaddr) do { } while (0)
13#define flush_dcache_range(start,len) do { } while (0) 13#define flush_dcache_range(start,len) __flush_cache_all()
14#define flush_dcache_page(page) do { } while (0) 14#define flush_dcache_page(page) do { } while (0)
15#define flush_dcache_mmap_lock(mapping) do { } while (0) 15#define flush_dcache_mmap_lock(mapping) do { } while (0)
16#define flush_dcache_mmap_unlock(mapping) do { } while (0) 16#define flush_dcache_mmap_unlock(mapping) do { } while (0)
17#define flush_icache_range(start,len) __flush_cache_all() 17#define flush_icache_range(start,len) __flush_cache_all()
18#define flush_icache_page(vma,pg) do { } while (0) 18#define flush_icache_page(vma,pg) do { } while (0)
19#define flush_icache_user_range(vma,pg,adr,len) do { } while (0) 19#define flush_icache_user_range(vma,pg,adr,len) do { } while (0)
20#define flush_cache_vmap(start, end) flush_cache_all() 20#define flush_cache_vmap(start, end) do { } while (0)
21#define flush_cache_vunmap(start, end) flush_cache_all() 21#define flush_cache_vunmap(start, end) do { } while (0)
22 22
23#define copy_to_user_page(vma, page, vaddr, dst, src, len) \ 23#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
24 memcpy(dst, src, len) 24 memcpy(dst, src, len)
@@ -50,22 +50,23 @@ extern inline void __flush_cache_all(void)
50 "movec %%d0,%%CACR\n\t" 50 "movec %%d0,%%CACR\n\t"
51 : : : "d0", "a0" ); 51 : : : "d0", "a0" );
52#endif /* CONFIG_M5407 */ 52#endif /* CONFIG_M5407 */
53#ifdef CONFIG_M5272 53#if defined(CONFIG_M527x) || defined(CONFIG_M528x)
54 __asm__ __volatile__ ( 54 __asm__ __volatile__ (
55 "movel #0x01000000, %%d0\n\t" 55 "movel #0x81400100, %%d0\n\t"
56 "movec %%d0, %%CACR\n\t"
57 "nop\n\t"
58 "movel #0x80000100, %%d0\n\t"
59 "movec %%d0, %%CACR\n\t" 56 "movec %%d0, %%CACR\n\t"
60 "nop\n\t" 57 "nop\n\t"
61 : : : "d0" ); 58 : : : "d0" );
62#endif /* CONFIG_M5272 */ 59#endif /* CONFIG_M527x || CONFIG_M528x */
63#if 0 /* CONFIG_M5249 */ 60#ifdef CONFIG_M5272
64 __asm__ __volatile__ ( 61 __asm__ __volatile__ (
65 "movel #0x01000000, %%d0\n\t" 62 "movel #0x01000000, %%d0\n\t"
66 "movec %%d0, %%CACR\n\t" 63 "movec %%d0, %%CACR\n\t"
67 "nop\n\t" 64 "nop\n\t"
68 "movel #0xa0000200, %%d0\n\t" 65 : : : "d0" );
66#endif /* CONFIG_M5272 */
67#if CONFIG_M5249
68 __asm__ __volatile__ (
69 "movel #0xa1000200, %%d0\n\t"
69 "movec %%d0, %%CACR\n\t" 70 "movec %%d0, %%CACR\n\t"
70 "nop\n\t" 71 "nop\n\t"
71 : : : "d0" ); 72 : : : "d0" );
diff --git a/include/asm-m68knommu/checksum.h b/include/asm-m68knommu/checksum.h
index 92cf102c2534..294ec7583ac9 100644
--- a/include/asm-m68knommu/checksum.h
+++ b/include/asm-m68knommu/checksum.h
@@ -25,7 +25,8 @@ unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum)
25 * better 64-bit) boundary 25 * better 64-bit) boundary
26 */ 26 */
27 27
28unsigned int csum_partial_copy(const char *src, char *dst, int len, int sum); 28unsigned int csum_partial_copy(const unsigned char *src, unsigned char *dst,
29 int len, int sum);
29 30
30 31
31/* 32/*
@@ -35,8 +36,8 @@ unsigned int csum_partial_copy(const char *src, char *dst, int len, int sum);
35 * better 64-bit) boundary 36 * better 64-bit) boundary
36 */ 37 */
37 38
38extern unsigned int csum_partial_copy_from_user(const char *src, char *dst, 39extern unsigned int csum_partial_copy_from_user(const unsigned char *src,
39 int len, int sum, int *csum_err); 40 unsigned char *dst, int len, int sum, int *csum_err);
40 41
41#define csum_partial_copy_nocheck(src, dst, len, sum) \ 42#define csum_partial_copy_nocheck(src, dst, len, sum) \
42 csum_partial_copy((src), (dst), (len), (sum)) 43 csum_partial_copy((src), (dst), (len), (sum))
diff --git a/include/asm-m68knommu/coldfire.h b/include/asm-m68knommu/coldfire.h
index 16f32cc80c40..1df3f666a28e 100644
--- a/include/asm-m68knommu/coldfire.h
+++ b/include/asm-m68knommu/coldfire.h
@@ -22,7 +22,7 @@
22#define MCF_MBAR2 0x80000000 22#define MCF_MBAR2 0x80000000
23#define MCF_IPSBAR 0x40000000 23#define MCF_IPSBAR 0x40000000
24 24
25#if defined(CONFIG_M527x) || defined(CONFIG_M528x) 25#if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x)
26#undef MCF_MBAR 26#undef MCF_MBAR
27#define MCF_MBAR MCF_IPSBAR 27#define MCF_MBAR MCF_IPSBAR
28#endif 28#endif
@@ -54,6 +54,8 @@
54#define MCF_CLK 54000000 54#define MCF_CLK 54000000
55#elif defined(CONFIG_CLOCK_60MHz) 55#elif defined(CONFIG_CLOCK_60MHz)
56#define MCF_CLK 60000000 56#define MCF_CLK 60000000
57#elif defined(CONFIG_CLOCK_62_5MHz)
58#define MCF_CLK 62500000
57#elif defined(CONFIG_CLOCK_64MHz) 59#elif defined(CONFIG_CLOCK_64MHz)
58#define MCF_CLK 64000000 60#define MCF_CLK 64000000
59#elif defined(CONFIG_CLOCK_66MHz) 61#elif defined(CONFIG_CLOCK_66MHz)
@@ -76,7 +78,7 @@
76 * One some ColdFire family members the bus clock (used by internal 78 * One some ColdFire family members the bus clock (used by internal
77 * peripherals) is not the same as the CPU clock. 79 * peripherals) is not the same as the CPU clock.
78 */ 80 */
79#if defined(CONFIG_M5249) || defined(CONFIG_M527x) 81#if defined(CONFIG_M523x) || defined(CONFIG_M5249) || defined(CONFIG_M527x)
80#define MCF_BUSCLK (MCF_CLK / 2) 82#define MCF_BUSCLK (MCF_CLK / 2)
81#else 83#else
82#define MCF_BUSCLK MCF_CLK 84#define MCF_BUSCLK MCF_CLK
diff --git a/include/asm-m68knommu/m523xsim.h b/include/asm-m68knommu/m523xsim.h
new file mode 100644
index 000000000000..926cfb805df7
--- /dev/null
+++ b/include/asm-m68knommu/m523xsim.h
@@ -0,0 +1,46 @@
1/****************************************************************************/
2
3/*
4 * m523xsim.h -- ColdFire 523x System Integration Module support.
5 *
6 * (C) Copyright 2003-2005, Greg Ungerer <gerg@snapgear.com>
7 */
8
9/****************************************************************************/
10#ifndef m523xsim_h
11#define m523xsim_h
12/****************************************************************************/
13
14#include <linux/config.h>
15
16/*
17 * Define the 523x SIM register set addresses.
18 */
19#define MCFICM_INTC0 0x0c00 /* Base for Interrupt Ctrl 0 */
20#define MCFICM_INTC1 0x0d00 /* Base for Interrupt Ctrl 0 */
21#define MCFINTC_IPRH 0x00 /* Interrupt pending 32-63 */
22#define MCFINTC_IPRL 0x04 /* Interrupt pending 1-31 */
23#define MCFINTC_IMRH 0x08 /* Interrupt mask 32-63 */
24#define MCFINTC_IMRL 0x0c /* Interrupt mask 1-31 */
25#define MCFINTC_INTFRCH 0x10 /* Interrupt force 32-63 */
26#define MCFINTC_INTFRCL 0x14 /* Interrupt force 1-31 */
27#define MCFINTC_IRLR 0x18 /* */
28#define MCFINTC_IACKL 0x19 /* */
29#define MCFINTC_ICR0 0x40 /* Base ICR register */
30
31#define MCFINT_VECBASE 64 /* Vector base number */
32#define MCFINT_UART0 13 /* Interrupt number for UART0 */
33#define MCFINT_PIT1 36 /* Interrupt number for PIT1 */
34#define MCFINT_QSPI 18 /* Interrupt number for QSPI */
35
36/*
37 * SDRAM configuration registers.
38 */
39#define MCFSIM_DCR 0x44 /* SDRAM control */
40#define MCFSIM_DACR0 0x48 /* SDRAM base address 0 */
41#define MCFSIM_DMR0 0x4c /* SDRAM address mask 0 */
42#define MCFSIM_DACR1 0x50 /* SDRAM base address 1 */
43#define MCFSIM_DMR1 0x54 /* SDRAM address mask 1 */
44
45/****************************************************************************/
46#endif /* m523xsim_h */
diff --git a/include/asm-m68knommu/m527xsim.h b/include/asm-m68knommu/m527xsim.h
index d280d013da03..e7878d0f7d7a 100644
--- a/include/asm-m68knommu/m527xsim.h
+++ b/include/asm-m68knommu/m527xsim.h
@@ -37,13 +37,14 @@
37/* 37/*
38 * SDRAM configuration registers. 38 * SDRAM configuration registers.
39 */ 39 */
40#ifdef CONFIG_M5271EVB 40#ifdef CONFIG_M5271
41#define MCFSIM_DCR 0x40 /* SDRAM control */ 41#define MCFSIM_DCR 0x40 /* SDRAM control */
42#define MCFSIM_DACR0 0x48 /* SDRAM base address 0 */ 42#define MCFSIM_DACR0 0x48 /* SDRAM base address 0 */
43#define MCFSIM_DMR0 0x4c /* SDRAM address mask 0 */ 43#define MCFSIM_DMR0 0x4c /* SDRAM address mask 0 */
44#define MCFSIM_DACR1 0x50 /* SDRAM base address 1 */ 44#define MCFSIM_DACR1 0x50 /* SDRAM base address 1 */
45#define MCFSIM_DMR1 0x54 /* SDRAM address mask 1 */ 45#define MCFSIM_DMR1 0x54 /* SDRAM address mask 1 */
46#else 46#endif
47#ifdef CONFIG_M5275
47#define MCFSIM_DMR 0x40 /* SDRAM mode */ 48#define MCFSIM_DMR 0x40 /* SDRAM mode */
48#define MCFSIM_DCR 0x44 /* SDRAM control */ 49#define MCFSIM_DCR 0x44 /* SDRAM control */
49#define MCFSIM_DCFG1 0x48 /* SDRAM configuration 1 */ 50#define MCFSIM_DCFG1 0x48 /* SDRAM configuration 1 */
@@ -54,5 +55,21 @@
54#define MCFSIM_DMR1 0x5c /* SDRAM address mask 1 */ 55#define MCFSIM_DMR1 0x5c /* SDRAM address mask 1 */
55#endif 56#endif
56 57
58/*
59 * GPIO pins setups to enable the UARTs.
60 */
61#ifdef CONFIG_M5271
62#define MCF_GPIO_PAR_UART 0x100048 /* PAR UART address */
63#define UART0_ENABLE_MASK 0x000f
64#define UART1_ENABLE_MASK 0x0ff0
65#define UART2_ENABLE_MASK 0x3000
66#endif
67#ifdef CONFIG_M5275
68#define MCF_GPIO_PAR_UART 0x10007c /* PAR UART address */
69#define UART0_ENABLE_MASK 0x000f
70#define UART1_ENABLE_MASK 0x00f0
71#define UART2_ENABLE_MASK 0x3f00
72#endif
73
57/****************************************************************************/ 74/****************************************************************************/
58#endif /* m527xsim_h */ 75#endif /* m527xsim_h */
diff --git a/include/asm-m68knommu/m528xsim.h b/include/asm-m68knommu/m528xsim.h
index 371993a206ac..610774a17f70 100644
--- a/include/asm-m68knommu/m528xsim.h
+++ b/include/asm-m68knommu/m528xsim.h
@@ -41,5 +41,117 @@
41#define MCFSIM_DACR1 0x50 /* SDRAM base address 1 */ 41#define MCFSIM_DACR1 0x50 /* SDRAM base address 1 */
42#define MCFSIM_DMR1 0x54 /* SDRAM address mask 1 */ 42#define MCFSIM_DMR1 0x54 /* SDRAM address mask 1 */
43 43
44/*
45 * Derek Cheung - 6 Feb 2005
46 * add I2C and QSPI register definition using Freescale's MCF5282
47 */
48/* set Port AS pin for I2C or UART */
49#define MCF5282_GPIO_PASPAR (volatile u16 *) (MCF_IPSBAR + 0x00100056)
50
51/* Interrupt Mask Register Register Low */
52#define MCF5282_INTC0_IMRL (volatile u32 *) (MCF_IPSBAR + 0x0C0C)
53/* Interrupt Control Register 7 */
54#define MCF5282_INTC0_ICR17 (volatile u8 *) (MCF_IPSBAR + 0x0C51)
55
56
57
58/*********************************************************************
59*
60* Inter-IC (I2C) Module
61*
62*********************************************************************/
63/* Read/Write access macros for general use */
64#define MCF5282_I2C_I2ADR (volatile u8 *) (MCF_IPSBAR + 0x0300) // Address
65#define MCF5282_I2C_I2FDR (volatile u8 *) (MCF_IPSBAR + 0x0304) // Freq Divider
66#define MCF5282_I2C_I2CR (volatile u8 *) (MCF_IPSBAR + 0x0308) // Control
67#define MCF5282_I2C_I2SR (volatile u8 *) (MCF_IPSBAR + 0x030C) // Status
68#define MCF5282_I2C_I2DR (volatile u8 *) (MCF_IPSBAR + 0x0310) // Data I/O
69
70/* Bit level definitions and macros */
71#define MCF5282_I2C_I2ADR_ADDR(x) (((x)&0x7F)<<0x01)
72
73#define MCF5282_I2C_I2FDR_IC(x) (((x)&0x3F))
74
75#define MCF5282_I2C_I2CR_IEN (0x80) // I2C enable
76#define MCF5282_I2C_I2CR_IIEN (0x40) // interrupt enable
77#define MCF5282_I2C_I2CR_MSTA (0x20) // master/slave mode
78#define MCF5282_I2C_I2CR_MTX (0x10) // transmit/receive mode
79#define MCF5282_I2C_I2CR_TXAK (0x08) // transmit acknowledge enable
80#define MCF5282_I2C_I2CR_RSTA (0x04) // repeat start
81
82#define MCF5282_I2C_I2SR_ICF (0x80) // data transfer bit
83#define MCF5282_I2C_I2SR_IAAS (0x40) // I2C addressed as a slave
84#define MCF5282_I2C_I2SR_IBB (0x20) // I2C bus busy
85#define MCF5282_I2C_I2SR_IAL (0x10) // aribitration lost
86#define MCF5282_I2C_I2SR_SRW (0x04) // slave read/write
87#define MCF5282_I2C_I2SR_IIF (0x02) // I2C interrupt
88#define MCF5282_I2C_I2SR_RXAK (0x01) // received acknowledge
89
90
91
92/*********************************************************************
93*
94* Queued Serial Peripheral Interface (QSPI) Module
95*
96*********************************************************************/
97/* Derek - 21 Feb 2005 */
98/* change to the format used in I2C */
99/* Read/Write access macros for general use */
100#define MCF5282_QSPI_QMR MCF_IPSBAR + 0x0340
101#define MCF5282_QSPI_QDLYR MCF_IPSBAR + 0x0344
102#define MCF5282_QSPI_QWR MCF_IPSBAR + 0x0348
103#define MCF5282_QSPI_QIR MCF_IPSBAR + 0x034C
104#define MCF5282_QSPI_QAR MCF_IPSBAR + 0x0350
105#define MCF5282_QSPI_QDR MCF_IPSBAR + 0x0354
106#define MCF5282_QSPI_QCR MCF_IPSBAR + 0x0354
107
108/* Bit level definitions and macros */
109#define MCF5282_QSPI_QMR_MSTR (0x8000)
110#define MCF5282_QSPI_QMR_DOHIE (0x4000)
111#define MCF5282_QSPI_QMR_BITS_16 (0x0000)
112#define MCF5282_QSPI_QMR_BITS_8 (0x2000)
113#define MCF5282_QSPI_QMR_BITS_9 (0x2400)
114#define MCF5282_QSPI_QMR_BITS_10 (0x2800)
115#define MCF5282_QSPI_QMR_BITS_11 (0x2C00)
116#define MCF5282_QSPI_QMR_BITS_12 (0x3000)
117#define MCF5282_QSPI_QMR_BITS_13 (0x3400)
118#define MCF5282_QSPI_QMR_BITS_14 (0x3800)
119#define MCF5282_QSPI_QMR_BITS_15 (0x3C00)
120#define MCF5282_QSPI_QMR_CPOL (0x0200)
121#define MCF5282_QSPI_QMR_CPHA (0x0100)
122#define MCF5282_QSPI_QMR_BAUD(x) (((x)&0x00FF))
123
124#define MCF5282_QSPI_QDLYR_SPE (0x80)
125#define MCF5282_QSPI_QDLYR_QCD(x) (((x)&0x007F)<<8)
126#define MCF5282_QSPI_QDLYR_DTL(x) (((x)&0x00FF))
127
128#define MCF5282_QSPI_QWR_HALT (0x8000)
129#define MCF5282_QSPI_QWR_WREN (0x4000)
130#define MCF5282_QSPI_QWR_WRTO (0x2000)
131#define MCF5282_QSPI_QWR_CSIV (0x1000)
132#define MCF5282_QSPI_QWR_ENDQP(x) (((x)&0x000F)<<8)
133#define MCF5282_QSPI_QWR_CPTQP(x) (((x)&0x000F)<<4)
134#define MCF5282_QSPI_QWR_NEWQP(x) (((x)&0x000F))
135
136#define MCF5282_QSPI_QIR_WCEFB (0x8000)
137#define MCF5282_QSPI_QIR_ABRTB (0x4000)
138#define MCF5282_QSPI_QIR_ABRTL (0x1000)
139#define MCF5282_QSPI_QIR_WCEFE (0x0800)
140#define MCF5282_QSPI_QIR_ABRTE (0x0400)
141#define MCF5282_QSPI_QIR_SPIFE (0x0100)
142#define MCF5282_QSPI_QIR_WCEF (0x0008)
143#define MCF5282_QSPI_QIR_ABRT (0x0004)
144#define MCF5282_QSPI_QIR_SPIF (0x0001)
145
146#define MCF5282_QSPI_QAR_ADDR(x) (((x)&0x003F))
147
148#define MCF5282_QSPI_QDR_COMMAND(x) (((x)&0xFF00))
149#define MCF5282_QSPI_QCR_DATA(x) (((x)&0x00FF)<<8)
150#define MCF5282_QSPI_QCR_CONT (0x8000)
151#define MCF5282_QSPI_QCR_BITSE (0x4000)
152#define MCF5282_QSPI_QCR_DT (0x2000)
153#define MCF5282_QSPI_QCR_DSCK (0x1000)
154#define MCF5282_QSPI_QCR_CS (((x)&0x000F)<<8)
155
44/****************************************************************************/ 156/****************************************************************************/
45#endif /* m528xsim_h */ 157#endif /* m528xsim_h */
diff --git a/include/asm-m68knommu/mcfcache.h b/include/asm-m68knommu/mcfcache.h
index bdd8c53ef34c..b17cd920977f 100644
--- a/include/asm-m68knommu/mcfcache.h
+++ b/include/asm-m68knommu/mcfcache.h
@@ -33,7 +33,7 @@
33.endm 33.endm
34#endif /* CONFIG_M5206 || CONFIG_M5206e || CONFIG_M5272 */ 34#endif /* CONFIG_M5206 || CONFIG_M5206e || CONFIG_M5272 */
35 35
36#if defined(CONFIG_M527x) 36#if defined(CONFIG_M523x) || defined(CONFIG_M527x)
37/* 37/*
38 * New version 2 cores have a configurable split cache arrangement. 38 * New version 2 cores have a configurable split cache arrangement.
39 * For now I am just enabling instruction cache - but ultimately I 39 * For now I am just enabling instruction cache - but ultimately I
@@ -51,23 +51,20 @@
51 movec %d0,%CACR /* enable cache */ 51 movec %d0,%CACR /* enable cache */
52 nop 52 nop
53.endm 53.endm
54#endif /* CONFIG_M527x */ 54#endif /* CONFIG_M523x || CONFIG_M527x */
55 55
56#if defined(CONFIG_M528x) 56#if defined(CONFIG_M528x)
57/*
58 * Cache is totally broken on early 5282 silicon. So far now we
59 * disable its cache all together.
60 */
61.macro CACHE_ENABLE 57.macro CACHE_ENABLE
62 movel #0x01000000,%d0
63 movec %d0,%CACR /* invalidate cache */
64 nop 58 nop
65 movel #0x0000c000,%d0 /* set SDRAM cached only */ 59 movel #0x01000000, %d0
66 movec %d0,%ACR0 60 movec %d0, %CACR /* Invalidate cache */
67 movel #0x00000000,%d0 /* no other regions cached */ 61 nop
68 movec %d0,%ACR1 62 movel #0x0000c020, %d0 /* Set SDRAM cached only */
69 movel #0x00000000,%d0 /* configure cache */ 63 movec %d0, %ACR0
70 movec %d0,%CACR /* enable cache */ 64 movel #0xff00c000, %d0 /* Cache Flash also */
65 movec %d0, %ACR1
66 movel #0x80000200, %d0 /* Setup cache mask */
67 movec %d0, %CACR /* Enable cache */
71 nop 68 nop
72.endm 69.endm
73#endif /* CONFIG_M528x */ 70#endif /* CONFIG_M528x */
diff --git a/include/asm-m68knommu/mcfdma.h b/include/asm-m68knommu/mcfdma.h
index 350c6090b5c1..b93f8ba8a248 100644
--- a/include/asm-m68knommu/mcfdma.h
+++ b/include/asm-m68knommu/mcfdma.h
@@ -21,7 +21,7 @@
21#define MCFDMA_BASE1 0x240 /* Base address of DMA 1 */ 21#define MCFDMA_BASE1 0x240 /* Base address of DMA 1 */
22#elif defined(CONFIG_M5272) 22#elif defined(CONFIG_M5272)
23#define MCFDMA_BASE0 0x0e0 /* Base address of DMA 0 */ 23#define MCFDMA_BASE0 0x0e0 /* Base address of DMA 0 */
24#elif defined(CONFIG_M527x) || defined(CONFIG_M528x) 24#elif defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x)
25/* These are relative to the IPSBAR, not MBAR */ 25/* These are relative to the IPSBAR, not MBAR */
26#define MCFDMA_BASE0 0x100 /* Base address of DMA 0 */ 26#define MCFDMA_BASE0 0x100 /* Base address of DMA 0 */
27#define MCFDMA_BASE1 0x140 /* Base address of DMA 1 */ 27#define MCFDMA_BASE1 0x140 /* Base address of DMA 1 */
diff --git a/include/asm-m68knommu/mcfsim.h b/include/asm-m68knommu/mcfsim.h
index 522e513c2bc6..b0c7736f7a99 100644
--- a/include/asm-m68knommu/mcfsim.h
+++ b/include/asm-m68knommu/mcfsim.h
@@ -15,13 +15,15 @@
15#include <linux/config.h> 15#include <linux/config.h>
16 16
17/* 17/*
18 * Include 5204, 5206/e, 5249, 5270/5271, 5272, 5280/5282, 5307 or 18 * Include 5204, 5206/e, 5235, 5249, 5270/5271, 5272, 5280/5282,
19 * 5407 specific addresses. 19 * 5307 or 5407 specific addresses.
20 */ 20 */
21#if defined(CONFIG_M5204) 21#if defined(CONFIG_M5204)
22#include <asm/m5204sim.h> 22#include <asm/m5204sim.h>
23#elif defined(CONFIG_M5206) || defined(CONFIG_M5206e) 23#elif defined(CONFIG_M5206) || defined(CONFIG_M5206e)
24#include <asm/m5206sim.h> 24#include <asm/m5206sim.h>
25#elif defined(CONFIG_M523x)
26#include <asm/m523xsim.h>
25#elif defined(CONFIG_M5249) 27#elif defined(CONFIG_M5249)
26#include <asm/m5249sim.h> 28#include <asm/m5249sim.h>
27#elif defined(CONFIG_M527x) 29#elif defined(CONFIG_M527x)
diff --git a/include/asm-m68knommu/mcfuart.h b/include/asm-m68knommu/mcfuart.h
index 54d4a85f4fdf..9c1210613bc7 100644
--- a/include/asm-m68knommu/mcfuart.h
+++ b/include/asm-m68knommu/mcfuart.h
@@ -29,7 +29,7 @@
29#define MCFUART_BASE1 0x140 /* Base address of UART1 */ 29#define MCFUART_BASE1 0x140 /* Base address of UART1 */
30#define MCFUART_BASE2 0x180 /* Base address of UART2 */ 30#define MCFUART_BASE2 0x180 /* Base address of UART2 */
31#endif 31#endif
32#elif defined(CONFIG_M527x) || defined(CONFIG_M528x) 32#elif defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x)
33#define MCFUART_BASE1 0x200 /* Base address of UART1 */ 33#define MCFUART_BASE1 0x200 /* Base address of UART1 */
34#define MCFUART_BASE2 0x240 /* Base address of UART2 */ 34#define MCFUART_BASE2 0x240 /* Base address of UART2 */
35#define MCFUART_BASE3 0x280 /* Base address of UART3 */ 35#define MCFUART_BASE3 0x280 /* Base address of UART3 */
diff --git a/include/asm-m68knommu/scatterlist.h b/include/asm-m68knommu/scatterlist.h
index 230b8d56d17f..12309b181d29 100644
--- a/include/asm-m68knommu/scatterlist.h
+++ b/include/asm-m68knommu/scatterlist.h
@@ -1,6 +1,8 @@
1#ifndef _M68KNOMMU_SCATTERLIST_H 1#ifndef _M68KNOMMU_SCATTERLIST_H
2#define _M68KNOMMU_SCATTERLIST_H 2#define _M68KNOMMU_SCATTERLIST_H
3 3
4#include <linux/mm.h>
5
4struct scatterlist { 6struct scatterlist {
5 struct page *page; 7 struct page *page;
6 unsigned int offset; 8 unsigned int offset;
@@ -8,6 +10,10 @@ struct scatterlist {
8 unsigned int length; 10 unsigned int length;
9}; 11};
10 12
13#define sg_address(sg) (page_address((sg)->page) + (sg)->offset
14#define sg_dma_address(sg) ((sg)->dma_address)
15#define sg_dma_len(sg) ((sg)->length)
16
11#define ISA_DMA_THRESHOLD (0xffffffff) 17#define ISA_DMA_THRESHOLD (0xffffffff)
12 18
13#endif /* !(_M68KNOMMU_SCATTERLIST_H) */ 19#endif /* !(_M68KNOMMU_SCATTERLIST_H) */
diff --git a/include/asm-m68knommu/system.h b/include/asm-m68knommu/system.h
index c341b66c147b..53cbbad0f130 100644
--- a/include/asm-m68knommu/system.h
+++ b/include/asm-m68knommu/system.h
@@ -57,9 +57,18 @@ asmlinkage void resume(void);
57 : "cc", "%d0", "memory") 57 : "cc", "%d0", "memory")
58#define local_irq_disable() __asm__ __volatile__ ( \ 58#define local_irq_disable() __asm__ __volatile__ ( \
59 "move %/sr,%%d0\n\t" \ 59 "move %/sr,%%d0\n\t" \
60 "ori.l #0x0700,%%d0\n\t" \ 60 "ori.l #0x0700,%%d0\n\t" \
61 "move %%d0,%/sr\n" \ 61 "move %%d0,%/sr\n" \
62 : /* no inputs */ \ 62 : /* no outputs */ \
63 : \
64 : "cc", "%d0", "memory")
65/* For spinlocks etc */
66#define local_irq_save(x) __asm__ __volatile__ ( \
67 "movew %%sr,%0\n\t" \
68 "movew #0x0700,%%d0\n\t" \
69 "or.l %0,%%d0\n\t" \
70 "movew %%d0,%/sr" \
71 : "=d" (x) \
63 : \ 72 : \
64 : "cc", "%d0", "memory") 73 : "cc", "%d0", "memory")
65#else 74#else
@@ -75,7 +84,9 @@ asmlinkage void resume(void);
75#define local_irq_restore(x) asm volatile ("movew %0,%%sr": :"d" (x) : "memory") 84#define local_irq_restore(x) asm volatile ("movew %0,%%sr": :"d" (x) : "memory")
76 85
77/* For spinlocks etc */ 86/* For spinlocks etc */
87#ifndef local_irq_save
78#define local_irq_save(x) do { local_save_flags(x); local_irq_disable(); } while (0) 88#define local_irq_save(x) do { local_save_flags(x); local_irq_disable(); } while (0)
89#endif
79 90
80#define irqs_disabled() \ 91#define irqs_disabled() \
81({ \ 92({ \
@@ -234,9 +245,9 @@ cmpxchg(volatile int *p, int old, int new)
234#ifdef CONFIG_COLDFIRE 245#ifdef CONFIG_COLDFIRE
235#if defined(CONFIG_M5272) && defined(CONFIG_NETtel) 246#if defined(CONFIG_M5272) && defined(CONFIG_NETtel)
236/* 247/*
237 * Need to account for broken early mask of 5272 silicon. So don't 248 * Need to account for broken early mask of 5272 silicon. So don't
238 * jump through the original start address. Jump strait into the 249 * jump through the original start address. Jump strait into the
239 * known start of the FLASH code. 250 * known start of the FLASH code.
240 */ 251 */
241#define HARD_RESET_NOW() ({ \ 252#define HARD_RESET_NOW() ({ \
242 asm(" \ 253 asm(" \
@@ -244,7 +255,9 @@ cmpxchg(volatile int *p, int old, int new)
244 jmp 0xf0000400; \ 255 jmp 0xf0000400; \
245 "); \ 256 "); \
246}) 257})
247#elif defined(CONFIG_NETtel) || defined(CONFIG_eLIA) || defined(CONFIG_DISKtel) || defined(CONFIG_SECUREEDGEMP3) || defined(CONFIG_CLEOPATRA) 258#elif defined(CONFIG_NETtel) || defined(CONFIG_eLIA) || \
259 defined(CONFIG_DISKtel) || defined(CONFIG_SECUREEDGEMP3) || \
260 defined(CONFIG_CLEOPATRA)
248#define HARD_RESET_NOW() ({ \ 261#define HARD_RESET_NOW() ({ \
249 asm(" \ 262 asm(" \
250 movew #0x2700, %sr; \ 263 movew #0x2700, %sr; \
@@ -257,6 +270,26 @@ cmpxchg(volatile int *p, int old, int new)
257 jmp (%a0); \ 270 jmp (%a0); \
258 "); \ 271 "); \
259}) 272})
273#elif defined(CONFIG_M5272)
274/*
275 * Retrieve the boot address in flash using CSBR0 and CSOR0
276 * find the reset vector at flash_address + 4 (e.g. 0x400)
277 * remap it in the flash's current location (e.g. 0xf0000400)
278 * and jump there.
279 */
280#define HARD_RESET_NOW() ({ \
281 asm(" \
282 movew #0x2700, %%sr; \
283 move.l %0+0x40,%%d0; \
284 and.l %0+0x44,%%d0; \
285 andi.l #0xfffff000,%%d0; \
286 mov.l %%d0,%%a0; \
287 or.l 4(%%a0),%%d0; \
288 mov.l %%d0,%%a0; \
289 jmp (%%a0);" \
290 : /* No output */ \
291 : "o" (*(char *)MCF_MBAR) ); \
292})
260#elif defined(CONFIG_M528x) 293#elif defined(CONFIG_M528x)
261/* 294/*
262 * The MCF528x has a bit (SOFTRST) in memory (Reset Control Register RCR), 295 * The MCF528x has a bit (SOFTRST) in memory (Reset Control Register RCR),
@@ -270,6 +303,15 @@ cmpxchg(volatile int *p, int old, int new)
270 while(1) \ 303 while(1) \
271 *reset |= (0x01 << 7);\ 304 *reset |= (0x01 << 7);\
272}) 305})
306#elif defined(CONFIG_M523x)
307#define HARD_RESET_NOW() ({ \
308 asm(" \
309 movew #0x2700, %sr; \
310 movel #0x01000000, %sp; \
311 moveal #0x40110000, %a0; \
312 moveb #0x80, (%a0); \
313 "); \
314})
273#else 315#else
274#define HARD_RESET_NOW() ({ \ 316#define HARD_RESET_NOW() ({ \
275 asm(" \ 317 asm(" \
diff --git a/include/asm-mips/asmmacro-32.h b/include/asm-mips/asmmacro-32.h
index ac8823df2554..11daf5ceb7b4 100644
--- a/include/asm-mips/asmmacro-32.h
+++ b/include/asm-mips/asmmacro-32.h
@@ -7,7 +7,7 @@
7#ifndef _ASM_ASMMACRO_32_H 7#ifndef _ASM_ASMMACRO_32_H
8#define _ASM_ASMMACRO_32_H 8#define _ASM_ASMMACRO_32_H
9 9
10#include <asm/offset.h> 10#include <asm/asm-offsets.h>
11#include <asm/regdef.h> 11#include <asm/regdef.h>
12#include <asm/fpregdef.h> 12#include <asm/fpregdef.h>
13#include <asm/mipsregs.h> 13#include <asm/mipsregs.h>
diff --git a/include/asm-mips/asmmacro-64.h b/include/asm-mips/asmmacro-64.h
index bbed35511f5a..559c355b9b86 100644
--- a/include/asm-mips/asmmacro-64.h
+++ b/include/asm-mips/asmmacro-64.h
@@ -8,7 +8,7 @@
8#ifndef _ASM_ASMMACRO_64_H 8#ifndef _ASM_ASMMACRO_64_H
9#define _ASM_ASMMACRO_64_H 9#define _ASM_ASMMACRO_64_H
10 10
11#include <asm/offset.h> 11#include <asm/asm-offsets.h>
12#include <asm/regdef.h> 12#include <asm/regdef.h>
13#include <asm/fpregdef.h> 13#include <asm/fpregdef.h>
14#include <asm/mipsregs.h> 14#include <asm/mipsregs.h>
diff --git a/include/asm-mips/irq.h b/include/asm-mips/irq.h
index b90b11d0b886..3f2470e9e678 100644
--- a/include/asm-mips/irq.h
+++ b/include/asm-mips/irq.h
@@ -49,7 +49,4 @@ do { \
49 49
50extern void arch_init_irq(void); 50extern void arch_init_irq(void);
51 51
52struct irqaction;
53int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *);
54
55#endif /* _ASM_IRQ_H */ 52#endif /* _ASM_IRQ_H */
diff --git a/include/asm-mips/sim.h b/include/asm-mips/sim.h
index 3ccfe09fa744..9c2af1b00e19 100644
--- a/include/asm-mips/sim.h
+++ b/include/asm-mips/sim.h
@@ -11,7 +11,7 @@
11 11
12#include <linux/config.h> 12#include <linux/config.h>
13 13
14#include <asm/offset.h> 14#include <asm/asm-offsets.h>
15 15
16#define __str2(x) #x 16#define __str2(x) #x
17#define __str(x) __str2(x) 17#define __str(x) __str2(x)
diff --git a/include/asm-mips/spinlock.h b/include/asm-mips/spinlock.h
index 114d3eb98a6a..4d0135b11156 100644
--- a/include/asm-mips/spinlock.h
+++ b/include/asm-mips/spinlock.h
@@ -16,20 +16,10 @@
16 * Your basic SMP spinlocks, allowing only a single CPU anywhere 16 * Your basic SMP spinlocks, allowing only a single CPU anywhere
17 */ 17 */
18 18
19typedef struct { 19#define __raw_spin_is_locked(x) ((x)->lock != 0)
20 volatile unsigned int lock; 20#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock)
21#ifdef CONFIG_PREEMPT 21#define __raw_spin_unlock_wait(x) \
22 unsigned int break_lock; 22 do { cpu_relax(); } while ((x)->lock)
23#endif
24} spinlock_t;
25
26#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 }
27
28#define spin_lock_init(x) do { (x)->lock = 0; } while(0)
29
30#define spin_is_locked(x) ((x)->lock != 0)
31#define spin_unlock_wait(x) do { barrier(); } while ((x)->lock)
32#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock)
33 23
34/* 24/*
35 * Simple spin lock operations. There are two variants, one clears IRQ's 25 * Simple spin lock operations. There are two variants, one clears IRQ's
@@ -38,13 +28,13 @@ typedef struct {
38 * We make no fairness assumptions. They have a cost. 28 * We make no fairness assumptions. They have a cost.
39 */ 29 */
40 30
41static inline void _raw_spin_lock(spinlock_t *lock) 31static inline void __raw_spin_lock(raw_spinlock_t *lock)
42{ 32{
43 unsigned int tmp; 33 unsigned int tmp;
44 34
45 if (R10000_LLSC_WAR) { 35 if (R10000_LLSC_WAR) {
46 __asm__ __volatile__( 36 __asm__ __volatile__(
47 " .set noreorder # _raw_spin_lock \n" 37 " .set noreorder # __raw_spin_lock \n"
48 "1: ll %1, %2 \n" 38 "1: ll %1, %2 \n"
49 " bnez %1, 1b \n" 39 " bnez %1, 1b \n"
50 " li %1, 1 \n" 40 " li %1, 1 \n"
@@ -58,7 +48,7 @@ static inline void _raw_spin_lock(spinlock_t *lock)
58 : "memory"); 48 : "memory");
59 } else { 49 } else {
60 __asm__ __volatile__( 50 __asm__ __volatile__(
61 " .set noreorder # _raw_spin_lock \n" 51 " .set noreorder # __raw_spin_lock \n"
62 "1: ll %1, %2 \n" 52 "1: ll %1, %2 \n"
63 " bnez %1, 1b \n" 53 " bnez %1, 1b \n"
64 " li %1, 1 \n" 54 " li %1, 1 \n"
@@ -72,10 +62,10 @@ static inline void _raw_spin_lock(spinlock_t *lock)
72 } 62 }
73} 63}
74 64
75static inline void _raw_spin_unlock(spinlock_t *lock) 65static inline void __raw_spin_unlock(raw_spinlock_t *lock)
76{ 66{
77 __asm__ __volatile__( 67 __asm__ __volatile__(
78 " .set noreorder # _raw_spin_unlock \n" 68 " .set noreorder # __raw_spin_unlock \n"
79 " sync \n" 69 " sync \n"
80 " sw $0, %0 \n" 70 " sw $0, %0 \n"
81 " .set\treorder \n" 71 " .set\treorder \n"
@@ -84,13 +74,13 @@ static inline void _raw_spin_unlock(spinlock_t *lock)
84 : "memory"); 74 : "memory");
85} 75}
86 76
87static inline unsigned int _raw_spin_trylock(spinlock_t *lock) 77static inline unsigned int __raw_spin_trylock(raw_spinlock_t *lock)
88{ 78{
89 unsigned int temp, res; 79 unsigned int temp, res;
90 80
91 if (R10000_LLSC_WAR) { 81 if (R10000_LLSC_WAR) {
92 __asm__ __volatile__( 82 __asm__ __volatile__(
93 " .set noreorder # _raw_spin_trylock \n" 83 " .set noreorder # __raw_spin_trylock \n"
94 "1: ll %0, %3 \n" 84 "1: ll %0, %3 \n"
95 " ori %2, %0, 1 \n" 85 " ori %2, %0, 1 \n"
96 " sc %2, %1 \n" 86 " sc %2, %1 \n"
@@ -104,7 +94,7 @@ static inline unsigned int _raw_spin_trylock(spinlock_t *lock)
104 : "memory"); 94 : "memory");
105 } else { 95 } else {
106 __asm__ __volatile__( 96 __asm__ __volatile__(
107 " .set noreorder # _raw_spin_trylock \n" 97 " .set noreorder # __raw_spin_trylock \n"
108 "1: ll %0, %3 \n" 98 "1: ll %0, %3 \n"
109 " ori %2, %0, 1 \n" 99 " ori %2, %0, 1 \n"
110 " sc %2, %1 \n" 100 " sc %2, %1 \n"
@@ -129,24 +119,13 @@ static inline unsigned int _raw_spin_trylock(spinlock_t *lock)
129 * read-locks. 119 * read-locks.
130 */ 120 */
131 121
132typedef struct { 122static inline void __raw_read_lock(raw_rwlock_t *rw)
133 volatile unsigned int lock;
134#ifdef CONFIG_PREEMPT
135 unsigned int break_lock;
136#endif
137} rwlock_t;
138
139#define RW_LOCK_UNLOCKED (rwlock_t) { 0 }
140
141#define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while(0)
142
143static inline void _raw_read_lock(rwlock_t *rw)
144{ 123{
145 unsigned int tmp; 124 unsigned int tmp;
146 125
147 if (R10000_LLSC_WAR) { 126 if (R10000_LLSC_WAR) {
148 __asm__ __volatile__( 127 __asm__ __volatile__(
149 " .set noreorder # _raw_read_lock \n" 128 " .set noreorder # __raw_read_lock \n"
150 "1: ll %1, %2 \n" 129 "1: ll %1, %2 \n"
151 " bltz %1, 1b \n" 130 " bltz %1, 1b \n"
152 " addu %1, 1 \n" 131 " addu %1, 1 \n"
@@ -160,7 +139,7 @@ static inline void _raw_read_lock(rwlock_t *rw)
160 : "memory"); 139 : "memory");
161 } else { 140 } else {
162 __asm__ __volatile__( 141 __asm__ __volatile__(
163 " .set noreorder # _raw_read_lock \n" 142 " .set noreorder # __raw_read_lock \n"
164 "1: ll %1, %2 \n" 143 "1: ll %1, %2 \n"
165 " bltz %1, 1b \n" 144 " bltz %1, 1b \n"
166 " addu %1, 1 \n" 145 " addu %1, 1 \n"
@@ -177,13 +156,13 @@ static inline void _raw_read_lock(rwlock_t *rw)
177/* Note the use of sub, not subu which will make the kernel die with an 156/* Note the use of sub, not subu which will make the kernel die with an
178 overflow exception if we ever try to unlock an rwlock that is already 157 overflow exception if we ever try to unlock an rwlock that is already
179 unlocked or is being held by a writer. */ 158 unlocked or is being held by a writer. */
180static inline void _raw_read_unlock(rwlock_t *rw) 159static inline void __raw_read_unlock(raw_rwlock_t *rw)
181{ 160{
182 unsigned int tmp; 161 unsigned int tmp;
183 162
184 if (R10000_LLSC_WAR) { 163 if (R10000_LLSC_WAR) {
185 __asm__ __volatile__( 164 __asm__ __volatile__(
186 "1: ll %1, %2 # _raw_read_unlock \n" 165 "1: ll %1, %2 # __raw_read_unlock \n"
187 " sub %1, 1 \n" 166 " sub %1, 1 \n"
188 " sc %1, %0 \n" 167 " sc %1, %0 \n"
189 " beqzl %1, 1b \n" 168 " beqzl %1, 1b \n"
@@ -193,7 +172,7 @@ static inline void _raw_read_unlock(rwlock_t *rw)
193 : "memory"); 172 : "memory");
194 } else { 173 } else {
195 __asm__ __volatile__( 174 __asm__ __volatile__(
196 " .set noreorder # _raw_read_unlock \n" 175 " .set noreorder # __raw_read_unlock \n"
197 "1: ll %1, %2 \n" 176 "1: ll %1, %2 \n"
198 " sub %1, 1 \n" 177 " sub %1, 1 \n"
199 " sc %1, %0 \n" 178 " sc %1, %0 \n"
@@ -206,13 +185,13 @@ static inline void _raw_read_unlock(rwlock_t *rw)
206 } 185 }
207} 186}
208 187
209static inline void _raw_write_lock(rwlock_t *rw) 188static inline void __raw_write_lock(raw_rwlock_t *rw)
210{ 189{
211 unsigned int tmp; 190 unsigned int tmp;
212 191
213 if (R10000_LLSC_WAR) { 192 if (R10000_LLSC_WAR) {
214 __asm__ __volatile__( 193 __asm__ __volatile__(
215 " .set noreorder # _raw_write_lock \n" 194 " .set noreorder # __raw_write_lock \n"
216 "1: ll %1, %2 \n" 195 "1: ll %1, %2 \n"
217 " bnez %1, 1b \n" 196 " bnez %1, 1b \n"
218 " lui %1, 0x8000 \n" 197 " lui %1, 0x8000 \n"
@@ -226,7 +205,7 @@ static inline void _raw_write_lock(rwlock_t *rw)
226 : "memory"); 205 : "memory");
227 } else { 206 } else {
228 __asm__ __volatile__( 207 __asm__ __volatile__(
229 " .set noreorder # _raw_write_lock \n" 208 " .set noreorder # __raw_write_lock \n"
230 "1: ll %1, %2 \n" 209 "1: ll %1, %2 \n"
231 " bnez %1, 1b \n" 210 " bnez %1, 1b \n"
232 " lui %1, 0x8000 \n" 211 " lui %1, 0x8000 \n"
@@ -241,26 +220,26 @@ static inline void _raw_write_lock(rwlock_t *rw)
241 } 220 }
242} 221}
243 222
244static inline void _raw_write_unlock(rwlock_t *rw) 223static inline void __raw_write_unlock(raw_rwlock_t *rw)
245{ 224{
246 __asm__ __volatile__( 225 __asm__ __volatile__(
247 " sync # _raw_write_unlock \n" 226 " sync # __raw_write_unlock \n"
248 " sw $0, %0 \n" 227 " sw $0, %0 \n"
249 : "=m" (rw->lock) 228 : "=m" (rw->lock)
250 : "m" (rw->lock) 229 : "m" (rw->lock)
251 : "memory"); 230 : "memory");
252} 231}
253 232
254#define _raw_read_trylock(lock) generic_raw_read_trylock(lock) 233#define __raw_read_trylock(lock) generic__raw_read_trylock(lock)
255 234
256static inline int _raw_write_trylock(rwlock_t *rw) 235static inline int __raw_write_trylock(raw_rwlock_t *rw)
257{ 236{
258 unsigned int tmp; 237 unsigned int tmp;
259 int ret; 238 int ret;
260 239
261 if (R10000_LLSC_WAR) { 240 if (R10000_LLSC_WAR) {
262 __asm__ __volatile__( 241 __asm__ __volatile__(
263 " .set noreorder # _raw_write_trylock \n" 242 " .set noreorder # __raw_write_trylock \n"
264 " li %2, 0 \n" 243 " li %2, 0 \n"
265 "1: ll %1, %3 \n" 244 "1: ll %1, %3 \n"
266 " bnez %1, 2f \n" 245 " bnez %1, 2f \n"
@@ -277,7 +256,7 @@ static inline int _raw_write_trylock(rwlock_t *rw)
277 : "memory"); 256 : "memory");
278 } else { 257 } else {
279 __asm__ __volatile__( 258 __asm__ __volatile__(
280 " .set noreorder # _raw_write_trylock \n" 259 " .set noreorder # __raw_write_trylock \n"
281 " li %2, 0 \n" 260 " li %2, 0 \n"
282 "1: ll %1, %3 \n" 261 "1: ll %1, %3 \n"
283 " bnez %1, 2f \n" 262 " bnez %1, 2f \n"
diff --git a/include/asm-mips/spinlock_types.h b/include/asm-mips/spinlock_types.h
new file mode 100644
index 000000000000..ce26c5048b15
--- /dev/null
+++ b/include/asm-mips/spinlock_types.h
@@ -0,0 +1,20 @@
1#ifndef _ASM_SPINLOCK_TYPES_H
2#define _ASM_SPINLOCK_TYPES_H
3
4#ifndef __LINUX_SPINLOCK_TYPES_H
5# error "please don't include this file directly"
6#endif
7
8typedef struct {
9 volatile unsigned int lock;
10} raw_spinlock_t;
11
12#define __RAW_SPIN_LOCK_UNLOCKED { 0 }
13
14typedef struct {
15 volatile unsigned int lock;
16} raw_rwlock_t;
17
18#define __RAW_RW_LOCK_UNLOCKED { 0 }
19
20#endif
diff --git a/include/asm-mips/stackframe.h b/include/asm-mips/stackframe.h
index fb42f99f8527..7b5e64600bc8 100644
--- a/include/asm-mips/stackframe.h
+++ b/include/asm-mips/stackframe.h
@@ -15,7 +15,7 @@
15 15
16#include <asm/asm.h> 16#include <asm/asm.h>
17#include <asm/mipsregs.h> 17#include <asm/mipsregs.h>
18#include <asm/offset.h> 18#include <asm/asm-offsets.h>
19 19
20 .macro SAVE_AT 20 .macro SAVE_AT
21 .set push 21 .set push
diff --git a/include/asm-mips/vr41xx/tb0287.h b/include/asm-mips/vr41xx/tb0287.h
new file mode 100644
index 000000000000..dd9832313afe
--- /dev/null
+++ b/include/asm-mips/vr41xx/tb0287.h
@@ -0,0 +1,43 @@
1/*
2 * tb0287.h, Include file for TANBAC TB0287 mini-ITX board.
3 *
4 * Copyright (C) 2005 Media Lab Inc. <ito@mlb.co.jp>
5 *
6 * This code is largely based on tb0219.h.
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 as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22#ifndef __TANBAC_TB0287_H
23#define __TANBAC_TB0287_H
24
25#include <asm/vr41xx/vr41xx.h>
26
27/*
28 * General-Purpose I/O Pin Number
29 */
30#define TB0287_PCI_SLOT_PIN 2
31#define TB0287_SM501_PIN 3
32#define TB0287_SIL680A_PIN 8
33#define TB0287_RTL8110_PIN 13
34
35/*
36 * Interrupt Number
37 */
38#define TB0287_PCI_SLOT_IRQ GIU_IRQ(TB0287_PCI_SLOT_PIN)
39#define TB0287_SM501_IRQ GIU_IRQ(TB0287_SM501_PIN)
40#define TB0287_SIL680A_IRQ GIU_IRQ(TB0287_SIL680A_PIN)
41#define TB0287_RTL8110_IRQ GIU_IRQ(TB0287_RTL8110_PIN)
42
43#endif /* __TANBAC_TB0287_H */
diff --git a/include/asm-parisc/assembly.h b/include/asm-parisc/assembly.h
index cbc286f49b36..30b023411fef 100644
--- a/include/asm-parisc/assembly.h
+++ b/include/asm-parisc/assembly.h
@@ -63,7 +63,7 @@
63 .level 2.0w 63 .level 2.0w
64#endif 64#endif
65 65
66#include <asm/offsets.h> 66#include <asm/asm-offsets.h>
67#include <asm/page.h> 67#include <asm/page.h>
68 68
69#include <asm/asmregs.h> 69#include <asm/asmregs.h>
diff --git a/include/asm-parisc/atomic.h b/include/asm-parisc/atomic.h
index e24f7579adb0..048a2c7fd0c0 100644
--- a/include/asm-parisc/atomic.h
+++ b/include/asm-parisc/atomic.h
@@ -24,19 +24,19 @@
24# define ATOMIC_HASH_SIZE 4 24# define ATOMIC_HASH_SIZE 4
25# define ATOMIC_HASH(a) (&(__atomic_hash[ (((unsigned long) a)/L1_CACHE_BYTES) & (ATOMIC_HASH_SIZE-1) ])) 25# define ATOMIC_HASH(a) (&(__atomic_hash[ (((unsigned long) a)/L1_CACHE_BYTES) & (ATOMIC_HASH_SIZE-1) ]))
26 26
27extern spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] __lock_aligned; 27extern raw_spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] __lock_aligned;
28 28
29/* Can't use _raw_spin_lock_irq because of #include problems, so 29/* Can't use raw_spin_lock_irq because of #include problems, so
30 * this is the substitute */ 30 * this is the substitute */
31#define _atomic_spin_lock_irqsave(l,f) do { \ 31#define _atomic_spin_lock_irqsave(l,f) do { \
32 spinlock_t *s = ATOMIC_HASH(l); \ 32 raw_spinlock_t *s = ATOMIC_HASH(l); \
33 local_irq_save(f); \ 33 local_irq_save(f); \
34 _raw_spin_lock(s); \ 34 __raw_spin_lock(s); \
35} while(0) 35} while(0)
36 36
37#define _atomic_spin_unlock_irqrestore(l,f) do { \ 37#define _atomic_spin_unlock_irqrestore(l,f) do { \
38 spinlock_t *s = ATOMIC_HASH(l); \ 38 raw_spinlock_t *s = ATOMIC_HASH(l); \
39 _raw_spin_unlock(s); \ 39 __raw_spin_unlock(s); \
40 local_irq_restore(f); \ 40 local_irq_restore(f); \
41} while(0) 41} while(0)
42 42
diff --git a/include/asm-parisc/bitops.h b/include/asm-parisc/bitops.h
index 928e5ef850bd..af7db694b22d 100644
--- a/include/asm-parisc/bitops.h
+++ b/include/asm-parisc/bitops.h
@@ -2,7 +2,7 @@
2#define _PARISC_BITOPS_H 2#define _PARISC_BITOPS_H
3 3
4#include <linux/compiler.h> 4#include <linux/compiler.h>
5#include <asm/system.h> 5#include <asm/spinlock.h>
6#include <asm/byteorder.h> 6#include <asm/byteorder.h>
7#include <asm/atomic.h> 7#include <asm/atomic.h>
8 8
diff --git a/include/asm-parisc/cacheflush.h b/include/asm-parisc/cacheflush.h
index 06732719d927..aa592d8c0e39 100644
--- a/include/asm-parisc/cacheflush.h
+++ b/include/asm-parisc/cacheflush.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/config.h> 4#include <linux/config.h>
5#include <linux/mm.h> 5#include <linux/mm.h>
6#include <asm/cache.h> /* for flush_user_dcache_range_asm() proto */
6 7
7/* The usual comment is "Caches aren't brain-dead on the <architecture>". 8/* The usual comment is "Caches aren't brain-dead on the <architecture>".
8 * Unfortunately, that doesn't apply to PA-RISC. */ 9 * Unfortunately, that doesn't apply to PA-RISC. */
diff --git a/include/asm-parisc/pci.h b/include/asm-parisc/pci.h
index 98d79a3d54fa..d0b761f690b5 100644
--- a/include/asm-parisc/pci.h
+++ b/include/asm-parisc/pci.h
@@ -257,6 +257,19 @@ extern void
257pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, 257pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
258 struct pci_bus_region *region); 258 struct pci_bus_region *region);
259 259
260static inline struct resource *
261pcibios_select_root(struct pci_dev *pdev, struct resource *res)
262{
263 struct resource *root = NULL;
264
265 if (res->flags & IORESOURCE_IO)
266 root = &ioport_resource;
267 if (res->flags & IORESOURCE_MEM)
268 root = &iomem_resource;
269
270 return root;
271}
272
260static inline void pcibios_add_platform_entries(struct pci_dev *dev) 273static inline void pcibios_add_platform_entries(struct pci_dev *dev)
261{ 274{
262} 275}
diff --git a/include/asm-parisc/processor.h b/include/asm-parisc/processor.h
index 0b61f51d8467..a9dfadd05658 100644
--- a/include/asm-parisc/processor.h
+++ b/include/asm-parisc/processor.h
@@ -11,6 +11,7 @@
11#ifndef __ASSEMBLY__ 11#ifndef __ASSEMBLY__
12#include <linux/config.h> 12#include <linux/config.h>
13#include <linux/threads.h> 13#include <linux/threads.h>
14#include <linux/spinlock_types.h>
14 15
15#include <asm/hardware.h> 16#include <asm/hardware.h>
16#include <asm/page.h> 17#include <asm/page.h>
diff --git a/include/asm-parisc/spinlock.h b/include/asm-parisc/spinlock.h
index 679ea1c651ef..43eaa6e742e0 100644
--- a/include/asm-parisc/spinlock.h
+++ b/include/asm-parisc/spinlock.h
@@ -2,30 +2,25 @@
2#define __ASM_SPINLOCK_H 2#define __ASM_SPINLOCK_H
3 3
4#include <asm/system.h> 4#include <asm/system.h>
5#include <asm/processor.h>
6#include <asm/spinlock_types.h>
5 7
6/* Note that PA-RISC has to use `1' to mean unlocked and `0' to mean locked 8/* Note that PA-RISC has to use `1' to mean unlocked and `0' to mean locked
7 * since it only has load-and-zero. Moreover, at least on some PA processors, 9 * since it only has load-and-zero. Moreover, at least on some PA processors,
8 * the semaphore address has to be 16-byte aligned. 10 * the semaphore address has to be 16-byte aligned.
9 */ 11 */
10 12
11#ifndef CONFIG_DEBUG_SPINLOCK 13static inline int __raw_spin_is_locked(raw_spinlock_t *x)
12
13#define __SPIN_LOCK_UNLOCKED { { 1, 1, 1, 1 } }
14#undef SPIN_LOCK_UNLOCKED
15#define SPIN_LOCK_UNLOCKED (spinlock_t) __SPIN_LOCK_UNLOCKED
16
17#define spin_lock_init(x) do { *(x) = SPIN_LOCK_UNLOCKED; } while(0)
18
19static inline int spin_is_locked(spinlock_t *x)
20{ 14{
21 volatile unsigned int *a = __ldcw_align(x); 15 volatile unsigned int *a = __ldcw_align(x);
22 return *a == 0; 16 return *a == 0;
23} 17}
24 18
25#define spin_unlock_wait(x) do { barrier(); } while(spin_is_locked(x)) 19#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock)
26#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) 20#define __raw_spin_unlock_wait(x) \
21 do { cpu_relax(); } while (__raw_spin_is_locked(x))
27 22
28static inline void _raw_spin_lock(spinlock_t *x) 23static inline void __raw_spin_lock(raw_spinlock_t *x)
29{ 24{
30 volatile unsigned int *a; 25 volatile unsigned int *a;
31 26
@@ -36,7 +31,7 @@ static inline void _raw_spin_lock(spinlock_t *x)
36 mb(); 31 mb();
37} 32}
38 33
39static inline void _raw_spin_unlock(spinlock_t *x) 34static inline void __raw_spin_unlock(raw_spinlock_t *x)
40{ 35{
41 volatile unsigned int *a; 36 volatile unsigned int *a;
42 mb(); 37 mb();
@@ -45,7 +40,7 @@ static inline void _raw_spin_unlock(spinlock_t *x)
45 mb(); 40 mb();
46} 41}
47 42
48static inline int _raw_spin_trylock(spinlock_t *x) 43static inline int __raw_spin_trylock(raw_spinlock_t *x)
49{ 44{
50 volatile unsigned int *a; 45 volatile unsigned int *a;
51 int ret; 46 int ret;
@@ -57,131 +52,38 @@ static inline int _raw_spin_trylock(spinlock_t *x)
57 52
58 return ret; 53 return ret;
59} 54}
60
61#define spin_lock_own(LOCK, LOCATION) ((void)0)
62
63#else /* !(CONFIG_DEBUG_SPINLOCK) */
64
65#define SPINLOCK_MAGIC 0x1D244B3C
66
67#define __SPIN_LOCK_UNLOCKED { { 1, 1, 1, 1 }, SPINLOCK_MAGIC, 10, __FILE__ , NULL, 0, -1, NULL, NULL }
68#undef SPIN_LOCK_UNLOCKED
69#define SPIN_LOCK_UNLOCKED (spinlock_t) __SPIN_LOCK_UNLOCKED
70
71#define spin_lock_init(x) do { *(x) = SPIN_LOCK_UNLOCKED; } while(0)
72
73#define CHECK_LOCK(x) \
74 do { \
75 if (unlikely((x)->magic != SPINLOCK_MAGIC)) { \
76 printk(KERN_ERR "%s:%d: spin_is_locked" \
77 " on uninitialized spinlock %p.\n", \
78 __FILE__, __LINE__, (x)); \
79 } \
80 } while(0)
81
82#define spin_is_locked(x) \
83 ({ \
84 CHECK_LOCK(x); \
85 volatile unsigned int *a = __ldcw_align(x); \
86 if (unlikely((*a == 0) && (x)->babble)) { \
87 (x)->babble--; \
88 printk("KERN_WARNING \
89 %s:%d: spin_is_locked(%s/%p) already" \
90 " locked by %s:%d in %s at %p(%d)\n", \
91 __FILE__,__LINE__, (x)->module, (x), \
92 (x)->bfile, (x)->bline, (x)->task->comm,\
93 (x)->previous, (x)->oncpu); \
94 } \
95 *a == 0; \
96 })
97
98#define spin_unlock_wait(x) \
99 do { \
100 CHECK_LOCK(x); \
101 volatile unsigned int *a = __ldcw_align(x); \
102 if (unlikely((*a == 0) && (x)->babble)) { \
103 (x)->babble--; \
104 printk("KERN_WARNING \
105 %s:%d: spin_unlock_wait(%s/%p)" \
106 " owned by %s:%d in %s at %p(%d)\n", \
107 __FILE__,__LINE__, (x)->module, (x), \
108 (x)->bfile, (x)->bline, (x)->task->comm,\
109 (x)->previous, (x)->oncpu); \
110 } \
111 barrier(); \
112 } while (*((volatile unsigned char *)(__ldcw_align(x))) == 0)
113
114extern void _dbg_spin_lock(spinlock_t *lock, const char *base_file, int line_no);
115extern void _dbg_spin_unlock(spinlock_t *lock, const char *, int);
116extern int _dbg_spin_trylock(spinlock_t * lock, const char *, int);
117
118#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock)
119
120#define _raw_spin_unlock(lock) _dbg_spin_unlock(lock, __FILE__, __LINE__)
121#define _raw_spin_lock(lock) _dbg_spin_lock(lock, __FILE__, __LINE__)
122#define _raw_spin_trylock(lock) _dbg_spin_trylock(lock, __FILE__, __LINE__)
123
124/* just in case we need it */
125#define spin_lock_own(LOCK, LOCATION) \
126do { \
127 volatile unsigned int *a = __ldcw_align(LOCK); \
128 if (!((*a == 0) && ((LOCK)->oncpu == smp_processor_id()))) \
129 printk("KERN_WARNING \
130 %s: called on %d from %p but lock %s on %d\n", \
131 LOCATION, smp_processor_id(), \
132 __builtin_return_address(0), \
133 (*a == 0) ? "taken" : "freed", (LOCK)->on_cpu); \
134} while (0)
135
136#endif /* !(CONFIG_DEBUG_SPINLOCK) */
137 55
138/* 56/*
139 * Read-write spinlocks, allowing multiple readers 57 * Read-write spinlocks, allowing multiple readers
140 * but only one writer. 58 * but only one writer.
141 */ 59 */
142typedef struct {
143 spinlock_t lock;
144 volatile int counter;
145#ifdef CONFIG_PREEMPT
146 unsigned int break_lock;
147#endif
148} rwlock_t;
149
150#define RW_LOCK_UNLOCKED (rwlock_t) { __SPIN_LOCK_UNLOCKED, 0 }
151
152#define rwlock_init(lp) do { *(lp) = RW_LOCK_UNLOCKED; } while (0)
153 60
154#define _raw_read_trylock(lock) generic_raw_read_trylock(lock) 61#define __raw_read_trylock(lock) generic__raw_read_trylock(lock)
155 62
156/* read_lock, read_unlock are pretty straightforward. Of course it somehow 63/* read_lock, read_unlock are pretty straightforward. Of course it somehow
157 * sucks we end up saving/restoring flags twice for read_lock_irqsave aso. */ 64 * sucks we end up saving/restoring flags twice for read_lock_irqsave aso. */
158 65
159#ifdef CONFIG_DEBUG_RWLOCK 66static __inline__ void __raw_read_lock(raw_rwlock_t *rw)
160extern void _dbg_read_lock(rwlock_t * rw, const char *bfile, int bline);
161#define _raw_read_lock(rw) _dbg_read_lock(rw, __FILE__, __LINE__)
162#else
163static __inline__ void _raw_read_lock(rwlock_t *rw)
164{ 67{
165 unsigned long flags; 68 unsigned long flags;
166 local_irq_save(flags); 69 local_irq_save(flags);
167 _raw_spin_lock(&rw->lock); 70 __raw_spin_lock(&rw->lock);
168 71
169 rw->counter++; 72 rw->counter++;
170 73
171 _raw_spin_unlock(&rw->lock); 74 __raw_spin_unlock(&rw->lock);
172 local_irq_restore(flags); 75 local_irq_restore(flags);
173} 76}
174#endif /* CONFIG_DEBUG_RWLOCK */
175 77
176static __inline__ void _raw_read_unlock(rwlock_t *rw) 78static __inline__ void __raw_read_unlock(raw_rwlock_t *rw)
177{ 79{
178 unsigned long flags; 80 unsigned long flags;
179 local_irq_save(flags); 81 local_irq_save(flags);
180 _raw_spin_lock(&rw->lock); 82 __raw_spin_lock(&rw->lock);
181 83
182 rw->counter--; 84 rw->counter--;
183 85
184 _raw_spin_unlock(&rw->lock); 86 __raw_spin_unlock(&rw->lock);
185 local_irq_restore(flags); 87 local_irq_restore(flags);
186} 88}
187 89
@@ -194,20 +96,17 @@ static __inline__ void _raw_read_unlock(rwlock_t *rw)
194 * writers) in interrupt handlers someone fucked up and we'd dead-lock 96 * writers) in interrupt handlers someone fucked up and we'd dead-lock
195 * sooner or later anyway. prumpf */ 97 * sooner or later anyway. prumpf */
196 98
197#ifdef CONFIG_DEBUG_RWLOCK 99static __inline__ void __raw_write_lock(raw_rwlock_t *rw)
198extern void _dbg_write_lock(rwlock_t * rw, const char *bfile, int bline);
199#define _raw_write_lock(rw) _dbg_write_lock(rw, __FILE__, __LINE__)
200#else
201static __inline__ void _raw_write_lock(rwlock_t *rw)
202{ 100{
203retry: 101retry:
204 _raw_spin_lock(&rw->lock); 102 __raw_spin_lock(&rw->lock);
205 103
206 if(rw->counter != 0) { 104 if(rw->counter != 0) {
207 /* this basically never happens */ 105 /* this basically never happens */
208 _raw_spin_unlock(&rw->lock); 106 __raw_spin_unlock(&rw->lock);
209 107
210 while(rw->counter != 0); 108 while (rw->counter != 0)
109 cpu_relax();
211 110
212 goto retry; 111 goto retry;
213 } 112 }
@@ -215,26 +114,21 @@ retry:
215 /* got it. now leave without unlocking */ 114 /* got it. now leave without unlocking */
216 rw->counter = -1; /* remember we are locked */ 115 rw->counter = -1; /* remember we are locked */
217} 116}
218#endif /* CONFIG_DEBUG_RWLOCK */
219 117
220/* write_unlock is absolutely trivial - we don't have to wait for anything */ 118/* write_unlock is absolutely trivial - we don't have to wait for anything */
221 119
222static __inline__ void _raw_write_unlock(rwlock_t *rw) 120static __inline__ void __raw_write_unlock(raw_rwlock_t *rw)
223{ 121{
224 rw->counter = 0; 122 rw->counter = 0;
225 _raw_spin_unlock(&rw->lock); 123 __raw_spin_unlock(&rw->lock);
226} 124}
227 125
228#ifdef CONFIG_DEBUG_RWLOCK 126static __inline__ int __raw_write_trylock(raw_rwlock_t *rw)
229extern int _dbg_write_trylock(rwlock_t * rw, const char *bfile, int bline);
230#define _raw_write_trylock(rw) _dbg_write_trylock(rw, __FILE__, __LINE__)
231#else
232static __inline__ int _raw_write_trylock(rwlock_t *rw)
233{ 127{
234 _raw_spin_lock(&rw->lock); 128 __raw_spin_lock(&rw->lock);
235 if (rw->counter != 0) { 129 if (rw->counter != 0) {
236 /* this basically never happens */ 130 /* this basically never happens */
237 _raw_spin_unlock(&rw->lock); 131 __raw_spin_unlock(&rw->lock);
238 132
239 return 0; 133 return 0;
240 } 134 }
@@ -243,14 +137,13 @@ static __inline__ int _raw_write_trylock(rwlock_t *rw)
243 rw->counter = -1; /* remember we are locked */ 137 rw->counter = -1; /* remember we are locked */
244 return 1; 138 return 1;
245} 139}
246#endif /* CONFIG_DEBUG_RWLOCK */
247 140
248static __inline__ int is_read_locked(rwlock_t *rw) 141static __inline__ int __raw_is_read_locked(raw_rwlock_t *rw)
249{ 142{
250 return rw->counter > 0; 143 return rw->counter > 0;
251} 144}
252 145
253static __inline__ int is_write_locked(rwlock_t *rw) 146static __inline__ int __raw_is_write_locked(raw_rwlock_t *rw)
254{ 147{
255 return rw->counter < 0; 148 return rw->counter < 0;
256} 149}
diff --git a/include/asm-parisc/spinlock_types.h b/include/asm-parisc/spinlock_types.h
new file mode 100644
index 000000000000..785bba822fbf
--- /dev/null
+++ b/include/asm-parisc/spinlock_types.h
@@ -0,0 +1,21 @@
1#ifndef __ASM_SPINLOCK_TYPES_H
2#define __ASM_SPINLOCK_TYPES_H
3
4#ifndef __LINUX_SPINLOCK_TYPES_H
5# error "please don't include this file directly"
6#endif
7
8typedef struct {
9 volatile unsigned int lock[4];
10} raw_spinlock_t;
11
12#define __RAW_SPIN_LOCK_UNLOCKED { { 1, 1, 1, 1 } }
13
14typedef struct {
15 raw_spinlock_t lock;
16 volatile int counter;
17} raw_rwlock_t;
18
19#define __RAW_RW_LOCK_UNLOCKED { __RAW_SPIN_LOCK_UNLOCKED, 0 }
20
21#endif
diff --git a/include/asm-parisc/system.h b/include/asm-parisc/system.h
index 81c543339036..26ff844a21c1 100644
--- a/include/asm-parisc/system.h
+++ b/include/asm-parisc/system.h
@@ -160,29 +160,7 @@ static inline void set_eiem(unsigned long val)
160}) 160})
161 161
162#ifdef CONFIG_SMP 162#ifdef CONFIG_SMP
163/* 163# define __lock_aligned __attribute__((__section__(".data.lock_aligned")))
164 * Your basic SMP spinlocks, allowing only a single CPU anywhere
165 */
166
167typedef struct {
168 volatile unsigned int lock[4];
169#ifdef CONFIG_DEBUG_SPINLOCK
170 unsigned long magic;
171 volatile unsigned int babble;
172 const char *module;
173 char *bfile;
174 int bline;
175 int oncpu;
176 void *previous;
177 struct task_struct * task;
178#endif
179#ifdef CONFIG_PREEMPT
180 unsigned int break_lock;
181#endif
182} spinlock_t;
183
184#define __lock_aligned __attribute__((__section__(".data.lock_aligned")))
185
186#endif 164#endif
187 165
188#define KERNEL_START (0x10100000 - 0x1000) 166#define KERNEL_START (0x10100000 - 0x1000)
diff --git a/include/asm-powerpc/8253pit.h b/include/asm-powerpc/8253pit.h
index 862708a749b0..b70d6e53b303 100644
--- a/include/asm-powerpc/8253pit.h
+++ b/include/asm-powerpc/8253pit.h
@@ -1,10 +1,10 @@
1#ifndef _ASM_POWERPC_8253PIT_H
2#define _ASM_POWERPC_8253PIT_H
3
1/* 4/*
2 * 8253/8254 Programmable Interval Timer 5 * 8253/8254 Programmable Interval Timer
3 */ 6 */
4 7
5#ifndef _8253PIT_H
6#define _8253PIT_H
7
8#define PIT_TICK_RATE 1193182UL 8#define PIT_TICK_RATE 1193182UL
9 9
10#endif 10#endif /* _ASM_POWERPC_8253PIT_H */
diff --git a/include/asm-powerpc/agp.h b/include/asm-powerpc/agp.h
index ca9e423307f4..885b4631a6cf 100644
--- a/include/asm-powerpc/agp.h
+++ b/include/asm-powerpc/agp.h
@@ -1,10 +1,8 @@
1#ifndef AGP_H 1#ifndef _ASM_POWERPC_AGP_H
2#define AGP_H 1 2#define _ASM_POWERPC_AGP_H
3 3
4#include <asm/io.h> 4#include <asm/io.h>
5 5
6/* nothing much needed here */
7
8#define map_page_into_agp(page) 6#define map_page_into_agp(page)
9#define unmap_page_from_agp(page) 7#define unmap_page_from_agp(page)
10#define flush_agp_mappings() 8#define flush_agp_mappings()
@@ -20,4 +18,4 @@
20#define free_gatt_pages(table, order) \ 18#define free_gatt_pages(table, order) \
21 free_pages((unsigned long)(table), (order)) 19 free_pages((unsigned long)(table), (order))
22 20
23#endif 21#endif /* _ASM_POWERPC_AGP_H */
diff --git a/include/asm-powerpc/bugs.h b/include/asm-powerpc/bugs.h
index 310187d0e33a..42fdb73e3068 100644
--- a/include/asm-powerpc/bugs.h
+++ b/include/asm-powerpc/bugs.h
@@ -1,5 +1,5 @@
1#ifndef _POWERPC_BUGS_H 1#ifndef _ASM_POWERPC_BUGS_H
2#define _POWERPC_BUGS_H 2#define _ASM_POWERPC_BUGS_H
3 3
4/* 4/*
5 * This program is free software; you can redistribute it and/or 5 * This program is free software; you can redistribute it and/or
@@ -13,6 +13,6 @@
13 * architecture-dependent bugs. 13 * architecture-dependent bugs.
14 */ 14 */
15 15
16extern void check_bugs(void); 16static inline void check_bugs(void) { }
17 17
18#endif /* _POWERPC_BUGS_H */ 18#endif /* _ASM_POWERPC_BUGS_H */
diff --git a/include/asm-powerpc/errno.h b/include/asm-powerpc/errno.h
index 19f20bd41ae6..8c145fd17d86 100644
--- a/include/asm-powerpc/errno.h
+++ b/include/asm-powerpc/errno.h
@@ -1,5 +1,5 @@
1#ifndef _PPC_ERRNO_H 1#ifndef _ASM_POWERPC_ERRNO_H
2#define _PPC_ERRNO_H 2#define _ASM_POWERPC_ERRNO_H
3 3
4#include <asm-generic/errno.h> 4#include <asm-generic/errno.h>
5 5
@@ -8,4 +8,4 @@
8 8
9#define _LAST_ERRNO 516 9#define _LAST_ERRNO 516
10 10
11#endif 11#endif /* _ASM_POWERPC_ERRNO_H */
diff --git a/include/asm-powerpc/ioctl.h b/include/asm-powerpc/ioctl.h
index 93c6acfdd0fd..8eb99848c402 100644
--- a/include/asm-powerpc/ioctl.h
+++ b/include/asm-powerpc/ioctl.h
@@ -1,5 +1,5 @@
1#ifndef _PPC_IOCTL_H 1#ifndef _ASM_POWERPC_IOCTL_H
2#define _PPC_IOCTL_H 2#define _ASM_POWERPC_IOCTL_H
3 3
4 4
5/* 5/*
@@ -66,4 +66,4 @@ extern unsigned int __invalid_size_argument_for_IOC;
66#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) 66#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
67#define IOCSIZE_SHIFT (_IOC_SIZESHIFT) 67#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
68 68
69#endif 69#endif /* _ASM_POWERPC_IOCTL_H */
diff --git a/include/asm-powerpc/ioctls.h b/include/asm-powerpc/ioctls.h
index f5b7f2b055e7..5b94ff489b8b 100644
--- a/include/asm-powerpc/ioctls.h
+++ b/include/asm-powerpc/ioctls.h
@@ -1,5 +1,5 @@
1#ifndef _ASM_PPC_IOCTLS_H 1#ifndef _ASM_POWERPC_IOCTLS_H
2#define _ASM_PPC_IOCTLS_H 2#define _ASM_POWERPC_IOCTLS_H
3 3
4#include <asm/ioctl.h> 4#include <asm/ioctl.h>
5 5
@@ -104,4 +104,4 @@
104#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */ 104#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */
105#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */ 105#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
106 106
107#endif /* _ASM_PPC_IOCTLS_H */ 107#endif /* _ASM_POWERPC_IOCTLS_H */
diff --git a/include/asm-powerpc/linkage.h b/include/asm-powerpc/linkage.h
index 291c2d01c44f..e1c4ac1cc4ba 100644
--- a/include/asm-powerpc/linkage.h
+++ b/include/asm-powerpc/linkage.h
@@ -1,6 +1,6 @@
1#ifndef __ASM_LINKAGE_H 1#ifndef _ASM_POWERPC_LINKAGE_H
2#define __ASM_LINKAGE_H 2#define _ASM_POWERPC_LINKAGE_H
3 3
4/* Nothing to see here... */ 4/* Nothing to see here... */
5 5
6#endif 6#endif /* _ASM_POWERPC_LINKAGE_H */
diff --git a/include/asm-powerpc/mc146818rtc.h b/include/asm-powerpc/mc146818rtc.h
index a5619a2a1393..f2741c8b59a1 100644
--- a/include/asm-powerpc/mc146818rtc.h
+++ b/include/asm-powerpc/mc146818rtc.h
@@ -1,5 +1,5 @@
1#ifndef _POWERPC_MC146818RTC_H 1#ifndef _ASM_POWERPC_MC146818RTC_H
2#define _POWERPC_MC146818RTC_H 2#define _ASM_POWERPC_MC146818RTC_H
3 3
4/* 4/*
5 * Machine dependent access functions for RTC registers. 5 * Machine dependent access functions for RTC registers.
@@ -33,4 +33,4 @@ outb_p((val),RTC_PORT(1)); \
33}) 33})
34 34
35#endif /* __KERNEL__ */ 35#endif /* __KERNEL__ */
36#endif /* _POWERPC_MC146818RTC_H */ 36#endif /* _ASM_POWERPC_MC146818RTC_H */
diff --git a/include/asm-powerpc/mman.h b/include/asm-powerpc/mman.h
index f2d55988d749..f5e5342fcac5 100644
--- a/include/asm-powerpc/mman.h
+++ b/include/asm-powerpc/mman.h
@@ -1,5 +1,5 @@
1#ifndef _POWERPC_MMAN_H 1#ifndef _ASM_POWERPC_MMAN_H
2#define _POWERPC_MMAN_H 2#define _ASM_POWERPC_MMAN_H
3 3
4/* 4/*
5 * This program is free software; you can redistribute it and/or 5 * This program is free software; you can redistribute it and/or
@@ -49,4 +49,4 @@
49#define MAP_ANON MAP_ANONYMOUS 49#define MAP_ANON MAP_ANONYMOUS
50#define MAP_FILE 0 50#define MAP_FILE 0
51 51
52#endif /* _POWERPC_MMAN_H */ 52#endif /* _ASM_POWERPC_MMAN_H */
diff --git a/include/asm-powerpc/module.h b/include/asm-powerpc/module.h
index 4438f4fd6524..7ecd05e03051 100644
--- a/include/asm-powerpc/module.h
+++ b/include/asm-powerpc/module.h
@@ -1,5 +1,5 @@
1#ifndef _POWERPC_MODULE_H 1#ifndef _ASM_POWERPC_MODULE_H
2#define _POWERPC_MODULE_H 2#define _ASM_POWERPC_MODULE_H
3 3
4/* 4/*
5 * This program is free software; you can redistribute it and/or 5 * This program is free software; you can redistribute it and/or
@@ -74,4 +74,4 @@ struct exception_table_entry;
74void sort_ex_table(struct exception_table_entry *start, 74void sort_ex_table(struct exception_table_entry *start,
75 struct exception_table_entry *finish); 75 struct exception_table_entry *finish);
76 76
77#endif /* _POWERPC_MODULE_H */ 77#endif /* _ASM_POWERPC_MODULE_H */
diff --git a/include/asm-ppc/msgbuf.h b/include/asm-powerpc/msgbuf.h
index 1053452a9376..dd76743c7537 100644
--- a/include/asm-ppc/msgbuf.h
+++ b/include/asm-powerpc/msgbuf.h
@@ -1,17 +1,25 @@
1#ifndef _PPC_MSGBUF_H 1#ifndef _ASM_POWERPC_MSGBUF_H
2#define _PPC_MSGBUF_H 2#define _ASM_POWERPC_MSGBUF_H
3 3
4/* 4/*
5 * The msqid64_ds structure for the PPC architecture. 5 * The msqid64_ds structure for the PowerPC architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
6 */ 8 */
7 9
8struct msqid64_ds { 10struct msqid64_ds {
9 struct ipc64_perm msg_perm; 11 struct ipc64_perm msg_perm;
12#ifndef __powerpc64__
10 unsigned int __unused1; 13 unsigned int __unused1;
14#endif
11 __kernel_time_t msg_stime; /* last msgsnd time */ 15 __kernel_time_t msg_stime; /* last msgsnd time */
16#ifndef __powerpc64__
12 unsigned int __unused2; 17 unsigned int __unused2;
18#endif
13 __kernel_time_t msg_rtime; /* last msgrcv time */ 19 __kernel_time_t msg_rtime; /* last msgrcv time */
20#ifndef __powerpc64__
14 unsigned int __unused3; 21 unsigned int __unused3;
22#endif
15 __kernel_time_t msg_ctime; /* last change time */ 23 __kernel_time_t msg_ctime; /* last change time */
16 unsigned long msg_cbytes; /* current number of bytes on queue */ 24 unsigned long msg_cbytes; /* current number of bytes on queue */
17 unsigned long msg_qnum; /* number of messages in queue */ 25 unsigned long msg_qnum; /* number of messages in queue */
@@ -22,4 +30,4 @@ struct msqid64_ds {
22 unsigned long __unused5; 30 unsigned long __unused5;
23}; 31};
24 32
25#endif /* _PPC_MSGBUF_H */ 33#endif /* _ASM_POWERPC_MSGBUF_H */
diff --git a/include/asm-powerpc/namei.h b/include/asm-powerpc/namei.h
index 29c9ec832133..657443474a6a 100644
--- a/include/asm-powerpc/namei.h
+++ b/include/asm-powerpc/namei.h
@@ -1,14 +1,14 @@
1#ifndef _ASM_POWERPC_NAMEI_H
2#define _ASM_POWERPC_NAMEI_H
3
4#ifdef __KERNEL__
5
1/* 6/*
2 * include/asm-ppc/namei.h
3 * Adapted from include/asm-alpha/namei.h 7 * Adapted from include/asm-alpha/namei.h
4 * 8 *
5 * Included from fs/namei.c 9 * Included from fs/namei.c
6 */ 10 */
7 11
8#ifdef __KERNEL__
9#ifndef __PPC_NAMEI_H
10#define __PPC_NAMEI_H
11
12/* This dummy routine maybe changed to something useful 12/* This dummy routine maybe changed to something useful
13 * for /usr/gnemul/ emulation stuff. 13 * for /usr/gnemul/ emulation stuff.
14 * Look at asm-sparc/namei.h for details. 14 * Look at asm-sparc/namei.h for details.
@@ -16,5 +16,5 @@
16 16
17#define __emul_prefix() NULL 17#define __emul_prefix() NULL
18 18
19#endif /* __PPC_NAMEI_H */ 19#endif /* __KERNEL__ */
20#endif /* __KERNEL__ */ 20#endif /* _ASM_POWERPC_NAMEI_H */
diff --git a/include/asm-ppc/param.h b/include/asm-powerpc/param.h
index 6198b1657a45..bdc724f70884 100644
--- a/include/asm-ppc/param.h
+++ b/include/asm-powerpc/param.h
@@ -1,10 +1,10 @@
1#ifndef _ASM_PPC_PARAM_H 1#ifndef _ASM_POWERPC_PARAM_H
2#define _ASM_PPC_PARAM_H 2#define _ASM_POWERPC_PARAM_H
3 3
4#include <linux/config.h> 4#include <linux/config.h>
5 5
6#ifdef __KERNEL__ 6#ifdef __KERNEL__
7#define HZ CONFIG_HZ /* internal timer frequency */ 7#define HZ CONFIG_HZ /* internal kernel timer frequency */
8#define USER_HZ 100 /* for user interfaces in "ticks" */ 8#define USER_HZ 100 /* for user interfaces in "ticks" */
9#define CLOCKS_PER_SEC (USER_HZ) /* frequency at which times() counts */ 9#define CLOCKS_PER_SEC (USER_HZ) /* frequency at which times() counts */
10#endif /* __KERNEL__ */ 10#endif /* __KERNEL__ */
@@ -21,4 +21,4 @@
21 21
22#define MAXHOSTNAMELEN 64 /* max length of hostname */ 22#define MAXHOSTNAMELEN 64 /* max length of hostname */
23 23
24#endif 24#endif /* _ASM_POWERPC_PARAM_H */
diff --git a/include/asm-powerpc/poll.h b/include/asm-powerpc/poll.h
index be5024913c62..edd2054da86b 100644
--- a/include/asm-powerpc/poll.h
+++ b/include/asm-powerpc/poll.h
@@ -1,5 +1,5 @@
1#ifndef __PPC_POLL_H 1#ifndef _ASM_POWERPC_POLL_H
2#define __PPC_POLL_H 2#define _ASM_POWERPC_POLL_H
3 3
4#define POLLIN 0x0001 4#define POLLIN 0x0001
5#define POLLPRI 0x0002 5#define POLLPRI 0x0002
@@ -20,4 +20,4 @@ struct pollfd {
20 short revents; 20 short revents;
21}; 21};
22 22
23#endif 23#endif /* _ASM_POWERPC_POLL_H */
diff --git a/include/asm-powerpc/sembuf.h b/include/asm-powerpc/sembuf.h
index c98fc18fe805..99a41938ae3d 100644
--- a/include/asm-powerpc/sembuf.h
+++ b/include/asm-powerpc/sembuf.h
@@ -1,5 +1,5 @@
1#ifndef _POWERPC_SEMBUF_H 1#ifndef _ASM_POWERPC_SEMBUF_H
2#define _POWERPC_SEMBUF_H 2#define _ASM_POWERPC_SEMBUF_H
3 3
4/* 4/*
5 * This program is free software; you can redistribute it and/or 5 * This program is free software; you can redistribute it and/or
@@ -33,4 +33,4 @@ struct semid64_ds {
33 unsigned long __unused4; 33 unsigned long __unused4;
34}; 34};
35 35
36#endif /* _POWERPC_SEMBUF_H */ 36#endif /* _ASM_POWERPC_SEMBUF_H */
diff --git a/include/asm-powerpc/setup.h b/include/asm-powerpc/setup.h
new file mode 100644
index 000000000000..3d9740aae018
--- /dev/null
+++ b/include/asm-powerpc/setup.h
@@ -0,0 +1,9 @@
1#ifndef _ASM_POWERPC_SETUP_H
2#define _ASM_POWERPC_SETUP_H
3
4#ifdef __KERNEL__
5
6#define COMMAND_LINE_SIZE 512
7
8#endif /* __KERNEL__ */
9#endif /* _ASM_POWERPC_SETUP_H */
diff --git a/include/asm-powerpc/shmbuf.h b/include/asm-powerpc/shmbuf.h
index 29632db3b178..8efa39698b6c 100644
--- a/include/asm-powerpc/shmbuf.h
+++ b/include/asm-powerpc/shmbuf.h
@@ -1,5 +1,5 @@
1#ifndef _POWERPC_SHMBUF_H 1#ifndef _ASM_POWERPC_SHMBUF_H
2#define _POWERPC_SHMBUF_H 2#define _ASM_POWERPC_SHMBUF_H
3 3
4/* 4/*
5 * This program is free software; you can redistribute it and/or 5 * This program is free software; you can redistribute it and/or
@@ -21,19 +21,19 @@
21 21
22struct shmid64_ds { 22struct shmid64_ds {
23 struct ipc64_perm shm_perm; /* operation perms */ 23 struct ipc64_perm shm_perm; /* operation perms */
24#ifndef __power64__ 24#ifndef __powerpc64__
25 unsigned long __unused1; 25 unsigned long __unused1;
26#endif 26#endif
27 __kernel_time_t shm_atime; /* last attach time */ 27 __kernel_time_t shm_atime; /* last attach time */
28#ifndef __power64__ 28#ifndef __powerpc64__
29 unsigned long __unused2; 29 unsigned long __unused2;
30#endif 30#endif
31 __kernel_time_t shm_dtime; /* last detach time */ 31 __kernel_time_t shm_dtime; /* last detach time */
32#ifndef __power64__ 32#ifndef __powerpc64__
33 unsigned long __unused3; 33 unsigned long __unused3;
34#endif 34#endif
35 __kernel_time_t shm_ctime; /* last change time */ 35 __kernel_time_t shm_ctime; /* last change time */
36#ifndef __power64__ 36#ifndef __powerpc64__
37 unsigned long __unused4; 37 unsigned long __unused4;
38#endif 38#endif
39 size_t shm_segsz; /* size of segment (bytes) */ 39 size_t shm_segsz; /* size of segment (bytes) */
@@ -56,4 +56,4 @@ struct shminfo64 {
56 unsigned long __unused4; 56 unsigned long __unused4;
57}; 57};
58 58
59#endif /* _POWERPC_SHMBUF_H */ 59#endif /* _ASM_POWERPC_SHMBUF_H */
diff --git a/include/asm-powerpc/shmparam.h b/include/asm-powerpc/shmparam.h
index d6250602ae64..5cda42a6d39e 100644
--- a/include/asm-powerpc/shmparam.h
+++ b/include/asm-powerpc/shmparam.h
@@ -1,6 +1,6 @@
1#ifndef _PPC_SHMPARAM_H 1#ifndef _ASM_POWERPC_SHMPARAM_H
2#define _PPC_SHMPARAM_H 2#define _ASM_POWERPC_SHMPARAM_H
3 3
4#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */ 4#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */
5 5
6#endif /* _PPC_SHMPARAM_H */ 6#endif /* _ASM_POWERPC_SHMPARAM_H */
diff --git a/include/asm-powerpc/siginfo.h b/include/asm-powerpc/siginfo.h
index ae70b8010b19..12f1bce037be 100644
--- a/include/asm-powerpc/siginfo.h
+++ b/include/asm-powerpc/siginfo.h
@@ -1,5 +1,5 @@
1#ifndef _POWERPC_SIGINFO_H 1#ifndef _ASM_POWERPC_SIGINFO_H
2#define _POWERPC_SIGINFO_H 2#define _ASM_POWERPC_SIGINFO_H
3 3
4/* 4/*
5 * This program is free software; you can redistribute it and/or 5 * This program is free software; you can redistribute it and/or
@@ -15,4 +15,12 @@
15 15
16#include <asm-generic/siginfo.h> 16#include <asm-generic/siginfo.h>
17 17
18#endif /* _POWERPC_SIGINFO_H */ 18/*
19 * SIGTRAP si_codes
20 */
21#define TRAP_BRANCH (__SI_FAULT|3) /* process taken branch trap */
22#define TRAP_HWBKPT (__SI_FAULT|4) /* hardware breakpoint or watchpoint */
23#undef NSIGTRAP
24#define NSIGTRAP 4
25
26#endif /* _ASM_POWERPC_SIGINFO_H */
diff --git a/include/asm-powerpc/socket.h b/include/asm-powerpc/socket.h
index 51a0cf5ee9f0..e4b8177d4acc 100644
--- a/include/asm-powerpc/socket.h
+++ b/include/asm-powerpc/socket.h
@@ -1,5 +1,5 @@
1#ifndef _POWERPC_SOCKET_H 1#ifndef _ASM_POWERPC_SOCKET_H
2#define _POWERPC_SOCKET_H 2#define _ASM_POWERPC_SOCKET_H
3 3
4/* 4/*
5 * This program is free software; you can redistribute it and/or 5 * This program is free software; you can redistribute it and/or
@@ -56,4 +56,4 @@
56 56
57#define SO_PEERSEC 31 57#define SO_PEERSEC 31
58 58
59#endif /* _POWERPC_SOCKET_H */ 59#endif /* _ASM_POWERPC_SOCKET_H */
diff --git a/include/asm-powerpc/sockios.h b/include/asm-powerpc/sockios.h
index ef7ff664167e..590078d8ed28 100644
--- a/include/asm-powerpc/sockios.h
+++ b/include/asm-powerpc/sockios.h
@@ -1,5 +1,5 @@
1#ifndef _POWERPC_SOCKIOS_H 1#ifndef _ASM_POWERPC_SOCKIOS_H
2#define _POWERPC_SOCKIOS_H 2#define _ASM_POWERPC_SOCKIOS_H
3 3
4/* 4/*
5 * This program is free software; you can redistribute it and/or 5 * This program is free software; you can redistribute it and/or
@@ -16,4 +16,4 @@
16#define SIOCATMARK 0x8905 16#define SIOCATMARK 0x8905
17#define SIOCGSTAMP 0x8906 /* Get stamp */ 17#define SIOCGSTAMP 0x8906 /* Get stamp */
18 18
19#endif /* _POWERPC_SOCKIOS_H */ 19#endif /* _ASM_POWERPC_SOCKIOS_H */
diff --git a/include/asm-powerpc/string.h b/include/asm-powerpc/string.h
index 225575997392..8606a696c088 100644
--- a/include/asm-powerpc/string.h
+++ b/include/asm-powerpc/string.h
@@ -1,5 +1,5 @@
1#ifndef _PPC_STRING_H_ 1#ifndef _ASM_POWERPC_STRING_H
2#define _PPC_STRING_H_ 2#define _ASM_POWERPC_STRING_H
3 3
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5 5
@@ -29,4 +29,4 @@ extern void * memchr(const void *,int,__kernel_size_t);
29 29
30#endif /* __KERNEL__ */ 30#endif /* __KERNEL__ */
31 31
32#endif 32#endif /* _ASM_POWERPC_STRING_H */
diff --git a/include/asm-powerpc/termbits.h b/include/asm-powerpc/termbits.h
index 2c5bf85a8c3c..ebf6055481dc 100644
--- a/include/asm-powerpc/termbits.h
+++ b/include/asm-powerpc/termbits.h
@@ -1,5 +1,5 @@
1#ifndef _POWERPC_TERMBITS_H 1#ifndef _ASM_POWERPC_TERMBITS_H
2#define _POWERPC_TERMBITS_H 2#define _ASM_POWERPC_TERMBITS_H
3 3
4/* 4/*
5 * This program is free software; you can redistribute it and/or 5 * This program is free software; you can redistribute it and/or
@@ -188,4 +188,4 @@ struct termios {
188#define TCSADRAIN 1 188#define TCSADRAIN 1
189#define TCSAFLUSH 2 189#define TCSAFLUSH 2
190 190
191#endif /* _POWERPC_TERMBITS_H */ 191#endif /* _ASM_POWERPC_TERMBITS_H */
diff --git a/include/asm-powerpc/termios.h b/include/asm-powerpc/termios.h
index 237533bb0e9f..c5b8e5358f83 100644
--- a/include/asm-powerpc/termios.h
+++ b/include/asm-powerpc/termios.h
@@ -1,5 +1,5 @@
1#ifndef _POWERPC_TERMIOS_H 1#ifndef _ASM_POWERPC_TERMIOS_H
2#define _POWERPC_TERMIOS_H 2#define _ASM_POWERPC_TERMIOS_H
3 3
4/* 4/*
5 * Liberally adapted from alpha/termios.h. In particular, the c_cc[] 5 * Liberally adapted from alpha/termios.h. In particular, the c_cc[]
@@ -233,4 +233,4 @@ struct termio {
233 233
234#endif /* __KERNEL__ */ 234#endif /* __KERNEL__ */
235 235
236#endif /* _POWERPC_TERMIOS_H */ 236#endif /* _ASM_POWERPC_TERMIOS_H */
diff --git a/include/asm-ppc/timex.h b/include/asm-powerpc/timex.h
index cffc8712077c..51c5b316be55 100644
--- a/include/asm-ppc/timex.h
+++ b/include/asm-powerpc/timex.h
@@ -1,11 +1,11 @@
1#ifndef _ASM_POWERPC_TIMEX_H
2#define _ASM_POWERPC_TIMEX_H
3
4#ifdef __KERNEL__
5
1/* 6/*
2 * include/asm-ppc/timex.h 7 * PowerPC architecture timex specifications
3 *
4 * ppc architecture timex specifications
5 */ 8 */
6#ifdef __KERNEL__
7#ifndef _ASMppc_TIMEX_H
8#define _ASMppc_TIMEX_H
9 9
10#include <linux/config.h> 10#include <linux/config.h>
11#include <asm/cputable.h> 11#include <asm/cputable.h>
@@ -14,14 +14,21 @@
14 14
15typedef unsigned long cycles_t; 15typedef unsigned long cycles_t;
16 16
17/*
18 * For the "cycle" counter we use the timebase lower half.
19 * Currently only used on SMP.
20 */
21
22static inline cycles_t get_cycles(void) 17static inline cycles_t get_cycles(void)
23{ 18{
24 cycles_t ret = 0; 19 cycles_t ret;
20
21#ifdef __powerpc64__
22
23 __asm__ __volatile__("mftb %0" : "=r" (ret) : );
24
25#else
26 /*
27 * For the "cycle" counter we use the timebase lower half.
28 * Currently only used on SMP.
29 */
30
31 ret = 0;
25 32
26 __asm__ __volatile__( 33 __asm__ __volatile__(
27 "98: mftb %0\n" 34 "98: mftb %0\n"
@@ -33,8 +40,10 @@ static inline cycles_t get_cycles(void)
33 " .long 99b\n" 40 " .long 99b\n"
34 ".previous" 41 ".previous"
35 : "=r" (ret) : "i" (CPU_FTR_601)); 42 : "=r" (ret) : "i" (CPU_FTR_601));
43#endif
44
36 return ret; 45 return ret;
37} 46}
38 47
39#endif 48#endif /* __KERNEL__ */
40#endif /* __KERNEL__ */ 49#endif /* _ASM_POWERPC_TIMEX_H */
diff --git a/include/asm-ppc64/topology.h b/include/asm-powerpc/topology.h
index 1e9b19073230..2512e3836bf4 100644
--- a/include/asm-ppc64/topology.h
+++ b/include/asm-powerpc/topology.h
@@ -1,11 +1,12 @@
1#ifndef _ASM_PPC64_TOPOLOGY_H 1#ifndef _ASM_POWERPC_TOPOLOGY_H
2#define _ASM_PPC64_TOPOLOGY_H 2#define _ASM_POWERPC_TOPOLOGY_H
3 3
4#include <linux/config.h> 4#include <linux/config.h>
5#include <asm/mmzone.h>
6 5
7#ifdef CONFIG_NUMA 6#ifdef CONFIG_NUMA
8 7
8#include <asm/mmzone.h>
9
9static inline int cpu_to_node(int cpu) 10static inline int cpu_to_node(int cpu)
10{ 11{
11 int node; 12 int node;
@@ -66,4 +67,4 @@ static inline int node_to_first_cpu(int node)
66 67
67#endif /* CONFIG_NUMA */ 68#endif /* CONFIG_NUMA */
68 69
69#endif /* _ASM_PPC64_TOPOLOGY_H */ 70#endif /* _ASM_POWERPC_TOPOLOGY_H */
diff --git a/include/asm-powerpc/unaligned.h b/include/asm-powerpc/unaligned.h
index 45520d9b85d1..6c95dfa2652f 100644
--- a/include/asm-powerpc/unaligned.h
+++ b/include/asm-powerpc/unaligned.h
@@ -1,6 +1,7 @@
1#ifndef _ASM_POWERPC_UNALIGNED_H
2#define _ASM_POWERPC_UNALIGNED_H
3
1#ifdef __KERNEL__ 4#ifdef __KERNEL__
2#ifndef __PPC_UNALIGNED_H
3#define __PPC_UNALIGNED_H
4 5
5/* 6/*
6 * The PowerPC can do unaligned accesses itself in big endian mode. 7 * The PowerPC can do unaligned accesses itself in big endian mode.
@@ -14,5 +15,5 @@
14 15
15#define put_unaligned(val, ptr) ((void)( *(ptr) = (val) )) 16#define put_unaligned(val, ptr) ((void)( *(ptr) = (val) ))
16 17
17#endif 18#endif /* __KERNEL__ */
18#endif /* __KERNEL__ */ 19#endif /* _ASM_POWERPC_UNALIGNED_H */
diff --git a/include/asm-ppc/user.h b/include/asm-powerpc/user.h
index d662b2151370..e59ade4b3dfb 100644
--- a/include/asm-ppc/user.h
+++ b/include/asm-powerpc/user.h
@@ -1,13 +1,14 @@
1#ifdef __KERNEL__ 1#ifndef _ASM_POWERPC_USER_H
2#ifndef _PPC_USER_H 2#define _ASM_POWERPC_USER_H
3#define _PPC_USER_H
4 3
5/* Adapted from <asm-alpha/user.h> */ 4#ifdef __KERNEL__
6 5
7#include <linux/ptrace.h> 6#include <asm/ptrace.h>
8#include <asm/page.h> 7#include <asm/page.h>
9 8
10/* 9/*
10 * Adapted from <asm-alpha/user.h>
11 *
11 * Core file format: The core file is written in such a way that gdb 12 * Core file format: The core file is written in such a way that gdb
12 * can understand it and provide useful information to the user (under 13 * can understand it and provide useful information to the user (under
13 * linux we use the `trad-core' bfd, NOT the osf-core). The file contents 14 * linux we use the `trad-core' bfd, NOT the osf-core). The file contents
@@ -50,5 +51,5 @@ struct user {
50#define HOST_DATA_START_ADDR (u.start_data) 51#define HOST_DATA_START_ADDR (u.start_data)
51#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) 52#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
52 53
53#endif /* _PPC_USER_H */ 54#endif /* __KERNEL__ */
54#endif /* __KERNEL__ */ 55#endif /* _ASM_POWERPC_USER_H */
diff --git a/include/asm-ppc/irq.h b/include/asm-ppc/irq.h
index b4b270457edd..55752474d0d9 100644
--- a/include/asm-ppc/irq.h
+++ b/include/asm-ppc/irq.h
@@ -404,9 +404,5 @@ extern unsigned long ppc_cached_irq_mask[NR_MASK_WORDS];
404extern unsigned long ppc_lost_interrupts[NR_MASK_WORDS]; 404extern unsigned long ppc_lost_interrupts[NR_MASK_WORDS];
405extern atomic_t ppc_n_lost_interrupts; 405extern atomic_t ppc_n_lost_interrupts;
406 406
407struct irqaction;
408struct pt_regs;
409int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *);
410
411#endif /* _ASM_IRQ_H */ 407#endif /* _ASM_IRQ_H */
412#endif /* __KERNEL__ */ 408#endif /* __KERNEL__ */
diff --git a/include/asm-ppc/pci.h b/include/asm-ppc/pci.h
index a811e440c978..9dd06cd40096 100644
--- a/include/asm-ppc/pci.h
+++ b/include/asm-ppc/pci.h
@@ -109,6 +109,19 @@ extern void
109pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, 109pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
110 struct pci_bus_region *region); 110 struct pci_bus_region *region);
111 111
112static inline struct resource *
113pcibios_select_root(struct pci_dev *pdev, struct resource *res)
114{
115 struct resource *root = NULL;
116
117 if (res->flags & IORESOURCE_IO)
118 root = &ioport_resource;
119 if (res->flags & IORESOURCE_MEM)
120 root = &iomem_resource;
121
122 return root;
123}
124
112extern void pcibios_add_platform_entries(struct pci_dev *dev); 125extern void pcibios_add_platform_entries(struct pci_dev *dev);
113 126
114struct file; 127struct file;
diff --git a/include/asm-ppc/ptrace.h b/include/asm-ppc/ptrace.h
index 9d4e4ea530c3..7043c164b537 100644
--- a/include/asm-ppc/ptrace.h
+++ b/include/asm-ppc/ptrace.h
@@ -142,4 +142,11 @@ do { \
142#define PTRACE_GETEVRREGS 20 142#define PTRACE_GETEVRREGS 20
143#define PTRACE_SETEVRREGS 21 143#define PTRACE_SETEVRREGS 21
144 144
145/*
146 * Get or set a debug register. The first 16 are DABR registers and the
147 * second 16 are IABR registers.
148 */
149#define PTRACE_GET_DEBUGREG 25
150#define PTRACE_SET_DEBUGREG 26
151
145#endif 152#endif
diff --git a/include/asm-ppc/reg.h b/include/asm-ppc/reg.h
index 88b4222154d4..73c33e3ef9c6 100644
--- a/include/asm-ppc/reg.h
+++ b/include/asm-ppc/reg.h
@@ -366,12 +366,6 @@
366#define PVR_STB03XXX 0x40310000 366#define PVR_STB03XXX 0x40310000
367#define PVR_NP405H 0x41410000 367#define PVR_NP405H 0x41410000
368#define PVR_NP405L 0x41610000 368#define PVR_NP405L 0x41610000
369#define PVR_440GP_RB 0x40120440
370#define PVR_440GP_RC1 0x40120481
371#define PVR_440GP_RC2 0x40200481
372#define PVR_440GX_RA 0x51b21850
373#define PVR_440GX_RB 0x51b21851
374#define PVR_440GX_RC 0x51b21892
375#define PVR_601 0x00010000 369#define PVR_601 0x00010000
376#define PVR_602 0x00050000 370#define PVR_602 0x00050000
377#define PVR_603 0x00030000 371#define PVR_603 0x00030000
diff --git a/include/asm-ppc/setup.h b/include/asm-ppc/setup.h
deleted file mode 100644
index d2d19ee103df..000000000000
--- a/include/asm-ppc/setup.h
+++ /dev/null
@@ -1,14 +0,0 @@
1#ifdef __KERNEL__
2#ifndef _PPC_SETUP_H
3#define _PPC_SETUP_H
4
5#define m68k_num_memory num_memory
6#define m68k_memory memory
7
8#include <asm-m68k/setup.h>
9/* We have a bigger command line buffer. */
10#undef COMMAND_LINE_SIZE
11#define COMMAND_LINE_SIZE 512
12
13#endif /* _PPC_SETUP_H */
14#endif /* __KERNEL__ */
diff --git a/include/asm-ppc/smp.h b/include/asm-ppc/smp.h
index 17530c232c76..829481c0a9dc 100644
--- a/include/asm-ppc/smp.h
+++ b/include/asm-ppc/smp.h
@@ -41,6 +41,10 @@ extern void smp_send_xmon_break(int cpu);
41struct pt_regs; 41struct pt_regs;
42extern void smp_message_recv(int, struct pt_regs *); 42extern void smp_message_recv(int, struct pt_regs *);
43 43
44extern int __cpu_disable(void);
45extern void __cpu_die(unsigned int cpu);
46extern void cpu_die(void) __attribute__((noreturn));
47
44#define NO_PROC_ID 0xFF /* No processor magic marker */ 48#define NO_PROC_ID 0xFF /* No processor magic marker */
45#define PROC_CHANGE_PENALTY 20 49#define PROC_CHANGE_PENALTY 20
46 50
@@ -64,6 +68,8 @@ extern struct klock_info_struct klock_info;
64 68
65#else /* !(CONFIG_SMP) */ 69#else /* !(CONFIG_SMP) */
66 70
71static inline void cpu_die(void) { }
72
67#endif /* !(CONFIG_SMP) */ 73#endif /* !(CONFIG_SMP) */
68 74
69#endif /* !(_PPC_SMP_H) */ 75#endif /* !(_PPC_SMP_H) */
diff --git a/include/asm-ppc/spinlock.h b/include/asm-ppc/spinlock.h
index 909199aae104..20edcf2a6e0c 100644
--- a/include/asm-ppc/spinlock.h
+++ b/include/asm-ppc/spinlock.h
@@ -5,41 +5,21 @@
5 5
6/* 6/*
7 * Simple spin lock operations. 7 * Simple spin lock operations.
8 *
9 * (the type definitions are in asm/raw_spinlock_types.h)
8 */ 10 */
9 11
10typedef struct { 12#define __raw_spin_is_locked(x) ((x)->lock != 0)
11 volatile unsigned long lock; 13#define __raw_spin_unlock_wait(lock) \
12#ifdef CONFIG_DEBUG_SPINLOCK 14 do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0)
13 volatile unsigned long owner_pc; 15#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock)
14 volatile unsigned long owner_cpu; 16
15#endif 17static inline void __raw_spin_lock(raw_spinlock_t *lock)
16#ifdef CONFIG_PREEMPT
17 unsigned int break_lock;
18#endif
19} spinlock_t;
20
21#ifdef __KERNEL__
22#ifdef CONFIG_DEBUG_SPINLOCK
23#define SPINLOCK_DEBUG_INIT , 0, 0
24#else
25#define SPINLOCK_DEBUG_INIT /* */
26#endif
27
28#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 SPINLOCK_DEBUG_INIT }
29
30#define spin_lock_init(x) do { *(x) = SPIN_LOCK_UNLOCKED; } while(0)
31#define spin_is_locked(x) ((x)->lock != 0)
32#define spin_unlock_wait(x) do { barrier(); } while(spin_is_locked(x))
33#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock)
34
35#ifndef CONFIG_DEBUG_SPINLOCK
36
37static inline void _raw_spin_lock(spinlock_t *lock)
38{ 18{
39 unsigned long tmp; 19 unsigned long tmp;
40 20
41 __asm__ __volatile__( 21 __asm__ __volatile__(
42 "b 1f # spin_lock\n\ 22 "b 1f # __raw_spin_lock\n\
432: lwzx %0,0,%1\n\ 232: lwzx %0,0,%1\n\
44 cmpwi 0,%0,0\n\ 24 cmpwi 0,%0,0\n\
45 bne+ 2b\n\ 25 bne+ 2b\n\
@@ -55,21 +35,13 @@ static inline void _raw_spin_lock(spinlock_t *lock)
55 : "cr0", "memory"); 35 : "cr0", "memory");
56} 36}
57 37
58static inline void _raw_spin_unlock(spinlock_t *lock) 38static inline void __raw_spin_unlock(raw_spinlock_t *lock)
59{ 39{
60 __asm__ __volatile__("eieio # spin_unlock": : :"memory"); 40 __asm__ __volatile__("eieio # __raw_spin_unlock": : :"memory");
61 lock->lock = 0; 41 lock->lock = 0;
62} 42}
63 43
64#define _raw_spin_trylock(l) (!test_and_set_bit(0,&(l)->lock)) 44#define __raw_spin_trylock(l) (!test_and_set_bit(0,&(l)->lock))
65
66#else
67
68extern void _raw_spin_lock(spinlock_t *lock);
69extern void _raw_spin_unlock(spinlock_t *lock);
70extern int _raw_spin_trylock(spinlock_t *lock);
71
72#endif
73 45
74/* 46/*
75 * Read-write spinlocks, allowing multiple readers 47 * Read-write spinlocks, allowing multiple readers
@@ -81,22 +53,11 @@ extern int _raw_spin_trylock(spinlock_t *lock);
81 * irq-safe write-lock, but readers can get non-irqsafe 53 * irq-safe write-lock, but readers can get non-irqsafe
82 * read-locks. 54 * read-locks.
83 */ 55 */
84typedef struct {
85 volatile signed int lock;
86#ifdef CONFIG_PREEMPT
87 unsigned int break_lock;
88#endif
89} rwlock_t;
90 56
91#define RW_LOCK_UNLOCKED (rwlock_t) { 0 } 57#define __raw_read_can_lock(rw) ((rw)->lock >= 0)
92#define rwlock_init(lp) do { *(lp) = RW_LOCK_UNLOCKED; } while(0) 58#define __raw_write_can_lock(rw) (!(rw)->lock)
93 59
94#define read_can_lock(rw) ((rw)->lock >= 0) 60static __inline__ int __raw_read_trylock(raw_rwlock_t *rw)
95#define write_can_lock(rw) (!(rw)->lock)
96
97#ifndef CONFIG_DEBUG_SPINLOCK
98
99static __inline__ int _raw_read_trylock(rwlock_t *rw)
100{ 61{
101 signed int tmp; 62 signed int tmp;
102 63
@@ -116,7 +77,7 @@ static __inline__ int _raw_read_trylock(rwlock_t *rw)
116 return tmp > 0; 77 return tmp > 0;
117} 78}
118 79
119static __inline__ void _raw_read_lock(rwlock_t *rw) 80static __inline__ void __raw_read_lock(raw_rwlock_t *rw)
120{ 81{
121 signed int tmp; 82 signed int tmp;
122 83
@@ -137,7 +98,7 @@ static __inline__ void _raw_read_lock(rwlock_t *rw)
137 : "cr0", "memory"); 98 : "cr0", "memory");
138} 99}
139 100
140static __inline__ void _raw_read_unlock(rwlock_t *rw) 101static __inline__ void __raw_read_unlock(raw_rwlock_t *rw)
141{ 102{
142 signed int tmp; 103 signed int tmp;
143 104
@@ -153,7 +114,7 @@ static __inline__ void _raw_read_unlock(rwlock_t *rw)
153 : "cr0", "memory"); 114 : "cr0", "memory");
154} 115}
155 116
156static __inline__ int _raw_write_trylock(rwlock_t *rw) 117static __inline__ int __raw_write_trylock(raw_rwlock_t *rw)
157{ 118{
158 signed int tmp; 119 signed int tmp;
159 120
@@ -173,7 +134,7 @@ static __inline__ int _raw_write_trylock(rwlock_t *rw)
173 return tmp == 0; 134 return tmp == 0;
174} 135}
175 136
176static __inline__ void _raw_write_lock(rwlock_t *rw) 137static __inline__ void __raw_write_lock(raw_rwlock_t *rw)
177{ 138{
178 signed int tmp; 139 signed int tmp;
179 140
@@ -194,22 +155,10 @@ static __inline__ void _raw_write_lock(rwlock_t *rw)
194 : "cr0", "memory"); 155 : "cr0", "memory");
195} 156}
196 157
197static __inline__ void _raw_write_unlock(rwlock_t *rw) 158static __inline__ void __raw_write_unlock(raw_rwlock_t *rw)
198{ 159{
199 __asm__ __volatile__("eieio # write_unlock": : :"memory"); 160 __asm__ __volatile__("eieio # write_unlock": : :"memory");
200 rw->lock = 0; 161 rw->lock = 0;
201} 162}
202 163
203#else
204
205extern void _raw_read_lock(rwlock_t *rw);
206extern void _raw_read_unlock(rwlock_t *rw);
207extern void _raw_write_lock(rwlock_t *rw);
208extern void _raw_write_unlock(rwlock_t *rw);
209extern int _raw_read_trylock(rwlock_t *rw);
210extern int _raw_write_trylock(rwlock_t *rw);
211
212#endif
213
214#endif /* __ASM_SPINLOCK_H */ 164#endif /* __ASM_SPINLOCK_H */
215#endif /* __KERNEL__ */
diff --git a/include/asm-ppc/spinlock_types.h b/include/asm-ppc/spinlock_types.h
new file mode 100644
index 000000000000..7919ccc75b8a
--- /dev/null
+++ b/include/asm-ppc/spinlock_types.h
@@ -0,0 +1,20 @@
1#ifndef __ASM_SPINLOCK_TYPES_H
2#define __ASM_SPINLOCK_TYPES_H
3
4#ifndef __LINUX_SPINLOCK_TYPES_H
5# error "please don't include this file directly"
6#endif
7
8typedef struct {
9 volatile unsigned long lock;
10} raw_spinlock_t;
11
12#define __RAW_SPIN_LOCK_UNLOCKED { 0 }
13
14typedef struct {
15 volatile signed int lock;
16} raw_rwlock_t;
17
18#define __RAW_RW_LOCK_UNLOCKED { 0 }
19
20#endif
diff --git a/include/asm-ppc/system.h b/include/asm-ppc/system.h
index 513a334c5810..d754ab570fe0 100644
--- a/include/asm-ppc/system.h
+++ b/include/asm-ppc/system.h
@@ -88,6 +88,7 @@ extern void *cacheable_memcpy(void *, const void *, unsigned int);
88extern int do_page_fault(struct pt_regs *, unsigned long, unsigned long); 88extern int do_page_fault(struct pt_regs *, unsigned long, unsigned long);
89extern void bad_page_fault(struct pt_regs *, unsigned long, int); 89extern void bad_page_fault(struct pt_regs *, unsigned long, int);
90extern void die(const char *, struct pt_regs *, long); 90extern void die(const char *, struct pt_regs *, long);
91extern void _exception(int, struct pt_regs *, int, unsigned long);
91#ifdef CONFIG_BOOKE_WDT 92#ifdef CONFIG_BOOKE_WDT
92extern u32 booke_wdt_enabled; 93extern u32 booke_wdt_enabled;
93extern u32 booke_wdt_period; 94extern u32 booke_wdt_period;
diff --git a/include/asm-ppc/topology.h b/include/asm-ppc/topology.h
deleted file mode 100644
index 6a029bbba6e1..000000000000
--- a/include/asm-ppc/topology.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_PPC_TOPOLOGY_H
2#define _ASM_PPC_TOPOLOGY_H
3
4#include <asm-generic/topology.h>
5
6#endif /* _ASM_PPC_TOPOLOGY_H */
diff --git a/include/asm-ppc64/eeh.h b/include/asm-ppc64/eeh.h
index 94298b106a4b..40c8eb57493e 100644
--- a/include/asm-ppc64/eeh.h
+++ b/include/asm-ppc64/eeh.h
@@ -219,23 +219,24 @@ static inline void eeh_raw_writeq(u64 val, volatile void __iomem *addr)
219static inline void eeh_memset_io(volatile void __iomem *addr, int c, 219static inline void eeh_memset_io(volatile void __iomem *addr, int c,
220 unsigned long n) 220 unsigned long n)
221{ 221{
222 void *p = (void __force *)addr;
222 u32 lc = c; 223 u32 lc = c;
223 lc |= lc << 8; 224 lc |= lc << 8;
224 lc |= lc << 16; 225 lc |= lc << 16;
225 226
226 while(n && !EEH_CHECK_ALIGN(addr, 4)) { 227 while(n && !EEH_CHECK_ALIGN(p, 4)) {
227 *((volatile u8 *)addr) = c; 228 *((volatile u8 *)p) = c;
228 addr = (void *)((unsigned long)addr + 1); 229 p++;
229 n--; 230 n--;
230 } 231 }
231 while(n >= 4) { 232 while(n >= 4) {
232 *((volatile u32 *)addr) = lc; 233 *((volatile u32 *)p) = lc;
233 addr = (void *)((unsigned long)addr + 4); 234 p += 4;
234 n -= 4; 235 n -= 4;
235 } 236 }
236 while(n) { 237 while(n) {
237 *((volatile u8 *)addr) = c; 238 *((volatile u8 *)p) = c;
238 addr = (void *)((unsigned long)addr + 1); 239 p++;
239 n--; 240 n--;
240 } 241 }
241 __asm__ __volatile__ ("sync" : : : "memory"); 242 __asm__ __volatile__ ("sync" : : : "memory");
@@ -250,22 +251,22 @@ static inline void eeh_memcpy_fromio(void *dest, const volatile void __iomem *sr
250 while(n && (!EEH_CHECK_ALIGN(vsrc, 4) || !EEH_CHECK_ALIGN(dest, 4))) { 251 while(n && (!EEH_CHECK_ALIGN(vsrc, 4) || !EEH_CHECK_ALIGN(dest, 4))) {
251 *((u8 *)dest) = *((volatile u8 *)vsrc); 252 *((u8 *)dest) = *((volatile u8 *)vsrc);
252 __asm__ __volatile__ ("eieio" : : : "memory"); 253 __asm__ __volatile__ ("eieio" : : : "memory");
253 vsrc = (void *)((unsigned long)vsrc + 1); 254 vsrc++;
254 dest = (void *)((unsigned long)dest + 1); 255 dest++;
255 n--; 256 n--;
256 } 257 }
257 while(n > 4) { 258 while(n > 4) {
258 *((u32 *)dest) = *((volatile u32 *)vsrc); 259 *((u32 *)dest) = *((volatile u32 *)vsrc);
259 __asm__ __volatile__ ("eieio" : : : "memory"); 260 __asm__ __volatile__ ("eieio" : : : "memory");
260 vsrc = (void *)((unsigned long)vsrc + 4); 261 vsrc += 4;
261 dest = (void *)((unsigned long)dest + 4); 262 dest += 4;
262 n -= 4; 263 n -= 4;
263 } 264 }
264 while(n) { 265 while(n) {
265 *((u8 *)dest) = *((volatile u8 *)vsrc); 266 *((u8 *)dest) = *((volatile u8 *)vsrc);
266 __asm__ __volatile__ ("eieio" : : : "memory"); 267 __asm__ __volatile__ ("eieio" : : : "memory");
267 vsrc = (void *)((unsigned long)vsrc + 1); 268 vsrc++;
268 dest = (void *)((unsigned long)dest + 1); 269 dest++;
269 n--; 270 n--;
270 } 271 }
271 __asm__ __volatile__ ("sync" : : : "memory"); 272 __asm__ __volatile__ ("sync" : : : "memory");
@@ -286,20 +287,20 @@ static inline void eeh_memcpy_toio(volatile void __iomem *dest, const void *src,
286 287
287 while(n && (!EEH_CHECK_ALIGN(vdest, 4) || !EEH_CHECK_ALIGN(src, 4))) { 288 while(n && (!EEH_CHECK_ALIGN(vdest, 4) || !EEH_CHECK_ALIGN(src, 4))) {
288 *((volatile u8 *)vdest) = *((u8 *)src); 289 *((volatile u8 *)vdest) = *((u8 *)src);
289 src = (void *)((unsigned long)src + 1); 290 src++;
290 vdest = (void *)((unsigned long)vdest + 1); 291 vdest++;
291 n--; 292 n--;
292 } 293 }
293 while(n > 4) { 294 while(n > 4) {
294 *((volatile u32 *)vdest) = *((volatile u32 *)src); 295 *((volatile u32 *)vdest) = *((volatile u32 *)src);
295 src = (void *)((unsigned long)src + 4); 296 src += 4;
296 vdest = (void *)((unsigned long)vdest + 4); 297 vdest += 4;
297 n-=4; 298 n-=4;
298 } 299 }
299 while(n) { 300 while(n) {
300 *((volatile u8 *)vdest) = *((u8 *)src); 301 *((volatile u8 *)vdest) = *((u8 *)src);
301 src = (void *)((unsigned long)src + 1); 302 src++;
302 vdest = (void *)((unsigned long)vdest + 1); 303 vdest++;
303 n--; 304 n--;
304 } 305 }
305 __asm__ __volatile__ ("sync" : : : "memory"); 306 __asm__ __volatile__ ("sync" : : : "memory");
diff --git a/include/asm-ppc64/hvcall.h b/include/asm-ppc64/hvcall.h
index 4f668a4baff0..ab7c3cf24888 100644
--- a/include/asm-ppc64/hvcall.h
+++ b/include/asm-ppc64/hvcall.h
@@ -56,6 +56,11 @@
56#define H_PP1 (1UL<<(63-62)) 56#define H_PP1 (1UL<<(63-62))
57#define H_PP2 (1UL<<(63-63)) 57#define H_PP2 (1UL<<(63-63))
58 58
59/* DABRX flags */
60#define H_DABRX_HYPERVISOR (1UL<<(63-61))
61#define H_DABRX_KERNEL (1UL<<(63-62))
62#define H_DABRX_USER (1UL<<(63-63))
63
59/* pSeries hypervisor opcodes */ 64/* pSeries hypervisor opcodes */
60#define H_REMOVE 0x04 65#define H_REMOVE 0x04
61#define H_ENTER 0x08 66#define H_ENTER 0x08
@@ -101,6 +106,7 @@
101#define H_VIO_SIGNAL 0x104 106#define H_VIO_SIGNAL 0x104
102#define H_SEND_CRQ 0x108 107#define H_SEND_CRQ 0x108
103#define H_COPY_RDMA 0x110 108#define H_COPY_RDMA 0x110
109#define H_SET_XDABR 0x134
104#define H_STUFF_TCE 0x138 110#define H_STUFF_TCE 0x138
105#define H_PUT_TCE_INDIRECT 0x13C 111#define H_PUT_TCE_INDIRECT 0x13C
106#define H_VTERM_PARTNER_INFO 0x150 112#define H_VTERM_PARTNER_INFO 0x150
diff --git a/include/asm-ppc64/io.h b/include/asm-ppc64/io.h
index aba1dfa388ba..59c958aea4db 100644
--- a/include/asm-ppc64/io.h
+++ b/include/asm-ppc64/io.h
@@ -20,10 +20,10 @@
20 20
21#include <asm-generic/iomap.h> 21#include <asm-generic/iomap.h>
22 22
23#define __ide_mm_insw(p, a, c) _insw_ns((volatile u16 *)(p), (a), (c)) 23#define __ide_mm_insw(p, a, c) _insw_ns((volatile u16 __iomem *)(p), (a), (c))
24#define __ide_mm_insl(p, a, c) _insl_ns((volatile u32 *)(p), (a), (c)) 24#define __ide_mm_insl(p, a, c) _insl_ns((volatile u32 __iomem *)(p), (a), (c))
25#define __ide_mm_outsw(p, a, c) _outsw_ns((volatile u16 *)(p), (a), (c)) 25#define __ide_mm_outsw(p, a, c) _outsw_ns((volatile u16 __iomem *)(p), (a), (c))
26#define __ide_mm_outsl(p, a, c) _outsl_ns((volatile u32 *)(p), (a), (c)) 26#define __ide_mm_outsl(p, a, c) _outsl_ns((volatile u32 __iomem *)(p), (a), (c))
27 27
28 28
29#define SIO_CONFIG_RA 0x398 29#define SIO_CONFIG_RA 0x398
@@ -71,8 +71,8 @@ extern unsigned long io_page_mask;
71 * Neither do the standard versions now, these are just here 71 * Neither do the standard versions now, these are just here
72 * for older code. 72 * for older code.
73 */ 73 */
74#define insw_ns(port, buf, ns) _insw_ns((u16 *)((port)+pci_io_base), (buf), (ns)) 74#define insw_ns(port, buf, ns) _insw_ns((u16 __iomem *)((port)+pci_io_base), (buf), (ns))
75#define insl_ns(port, buf, nl) _insl_ns((u32 *)((port)+pci_io_base), (buf), (nl)) 75#define insl_ns(port, buf, nl) _insl_ns((u32 __iomem *)((port)+pci_io_base), (buf), (nl))
76#else 76#else
77 77
78static inline unsigned char __raw_readb(const volatile void __iomem *addr) 78static inline unsigned char __raw_readb(const volatile void __iomem *addr)
@@ -136,9 +136,9 @@ static inline void __raw_writeq(unsigned long v, volatile void __iomem *addr)
136#define insw_ns(port, buf, ns) eeh_insw_ns((port), (buf), (ns)) 136#define insw_ns(port, buf, ns) eeh_insw_ns((port), (buf), (ns))
137#define insl_ns(port, buf, nl) eeh_insl_ns((port), (buf), (nl)) 137#define insl_ns(port, buf, nl) eeh_insl_ns((port), (buf), (nl))
138 138
139#define outsb(port, buf, ns) _outsb((u8 *)((port)+pci_io_base), (buf), (ns)) 139#define outsb(port, buf, ns) _outsb((u8 __iomem *)((port)+pci_io_base), (buf), (ns))
140#define outsw(port, buf, ns) _outsw_ns((u16 *)((port)+pci_io_base), (buf), (ns)) 140#define outsw(port, buf, ns) _outsw_ns((u16 __iomem *)((port)+pci_io_base), (buf), (ns))
141#define outsl(port, buf, nl) _outsl_ns((u32 *)((port)+pci_io_base), (buf), (nl)) 141#define outsl(port, buf, nl) _outsl_ns((u32 __iomem *)((port)+pci_io_base), (buf), (nl))
142 142
143#endif 143#endif
144 144
@@ -147,16 +147,16 @@ static inline void __raw_writeq(unsigned long v, volatile void __iomem *addr)
147#define readl_relaxed(addr) readl(addr) 147#define readl_relaxed(addr) readl(addr)
148#define readq_relaxed(addr) readq(addr) 148#define readq_relaxed(addr) readq(addr)
149 149
150extern void _insb(volatile u8 *port, void *buf, int ns); 150extern void _insb(volatile u8 __iomem *port, void *buf, int ns);
151extern void _outsb(volatile u8 *port, const void *buf, int ns); 151extern void _outsb(volatile u8 __iomem *port, const void *buf, int ns);
152extern void _insw(volatile u16 *port, void *buf, int ns); 152extern void _insw(volatile u16 __iomem *port, void *buf, int ns);
153extern void _outsw(volatile u16 *port, const void *buf, int ns); 153extern void _outsw(volatile u16 __iomem *port, const void *buf, int ns);
154extern void _insl(volatile u32 *port, void *buf, int nl); 154extern void _insl(volatile u32 __iomem *port, void *buf, int nl);
155extern void _outsl(volatile u32 *port, const void *buf, int nl); 155extern void _outsl(volatile u32 __iomem *port, const void *buf, int nl);
156extern void _insw_ns(volatile u16 *port, void *buf, int ns); 156extern void _insw_ns(volatile u16 __iomem *port, void *buf, int ns);
157extern void _outsw_ns(volatile u16 *port, const void *buf, int ns); 157extern void _outsw_ns(volatile u16 __iomem *port, const void *buf, int ns);
158extern void _insl_ns(volatile u32 *port, void *buf, int nl); 158extern void _insl_ns(volatile u32 __iomem *port, void *buf, int nl);
159extern void _outsl_ns(volatile u32 *port, const void *buf, int nl); 159extern void _outsl_ns(volatile u32 __iomem *port, const void *buf, int nl);
160 160
161#define mmiowb() 161#define mmiowb()
162 162
@@ -176,8 +176,8 @@ extern void _outsl_ns(volatile u32 *port, const void *buf, int nl);
176 * Neither do the standard versions now, these are just here 176 * Neither do the standard versions now, these are just here
177 * for older code. 177 * for older code.
178 */ 178 */
179#define outsw_ns(port, buf, ns) _outsw_ns((u16 *)((port)+pci_io_base), (buf), (ns)) 179#define outsw_ns(port, buf, ns) _outsw_ns((u16 __iomem *)((port)+pci_io_base), (buf), (ns))
180#define outsl_ns(port, buf, nl) _outsl_ns((u32 *)((port)+pci_io_base), (buf), (nl)) 180#define outsl_ns(port, buf, nl) _outsl_ns((u32 __iomem *)((port)+pci_io_base), (buf), (nl))
181 181
182 182
183#define IO_SPACE_LIMIT ~(0UL) 183#define IO_SPACE_LIMIT ~(0UL)
diff --git a/include/asm-ppc64/machdep.h b/include/asm-ppc64/machdep.h
index 9a1ef4427ed2..8027160ec96d 100644
--- a/include/asm-ppc64/machdep.h
+++ b/include/asm-ppc64/machdep.h
@@ -88,6 +88,7 @@ struct machdep_calls {
88 88
89 /* PCI stuff */ 89 /* PCI stuff */
90 void (*pcibios_fixup)(void); 90 void (*pcibios_fixup)(void);
91 int (*pci_probe_mode)(struct pci_bus *);
91 92
92 void (*restart)(char *cmd); 93 void (*restart)(char *cmd);
93 void (*power_off)(void); 94 void (*power_off)(void);
@@ -173,10 +174,6 @@ extern sys_ctrler_t sys_ctrler;
173void ppc64_boot_msg(unsigned int src, const char *msg); 174void ppc64_boot_msg(unsigned int src, const char *msg);
174/* Print a termination message (print only -- does not stop the kernel) */ 175/* Print a termination message (print only -- does not stop the kernel) */
175void ppc64_terminate_msg(unsigned int src, const char *msg); 176void ppc64_terminate_msg(unsigned int src, const char *msg);
176/* Print something that needs attention (device error, etc) */
177void ppc64_attention_msg(unsigned int src, const char *msg);
178/* Print a dump progress message. */
179void ppc64_dump_msg(unsigned int src, const char *msg);
180 177
181static inline void log_error(char *buf, unsigned int err_type, int fatal) 178static inline void log_error(char *buf, unsigned int err_type, int fatal)
182{ 179{
diff --git a/include/asm-ppc64/msgbuf.h b/include/asm-ppc64/msgbuf.h
deleted file mode 100644
index 31c1cbf133cc..000000000000
--- a/include/asm-ppc64/msgbuf.h
+++ /dev/null
@@ -1,27 +0,0 @@
1#ifndef _PPC64_MSGBUF_H
2#define _PPC64_MSGBUF_H
3
4/*
5 * The msqid64_ds structure for the PPC architecture.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12
13struct msqid64_ds {
14 struct ipc64_perm msg_perm;
15 __kernel_time_t msg_stime; /* last msgsnd time */
16 __kernel_time_t msg_rtime; /* last msgrcv time */
17 __kernel_time_t msg_ctime; /* last change time */
18 unsigned long msg_cbytes; /* current number of bytes on queue */
19 unsigned long msg_qnum; /* number of messages in queue */
20 unsigned long msg_qbytes; /* max number of bytes on queue */
21 __kernel_pid_t msg_lspid; /* pid of last msgsnd */
22 __kernel_pid_t msg_lrpid; /* last receive pid */
23 unsigned long __unused1;
24 unsigned long __unused2;
25};
26
27#endif /* _PPC64_MSGBUF_H */
diff --git a/include/asm-ppc64/param.h b/include/asm-ppc64/param.h
deleted file mode 100644
index 76c212d475b3..000000000000
--- a/include/asm-ppc64/param.h
+++ /dev/null
@@ -1,31 +0,0 @@
1#ifndef _ASM_PPC64_PARAM_H
2#define _ASM_PPC64_PARAM_H
3
4#include <linux/config.h>
5
6/*
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12
13#ifdef __KERNEL__
14# define HZ CONFIG_HZ /* Internal kernel timer frequency */
15# define USER_HZ 100 /* .. some user interfaces are in "ticks" */
16# define CLOCKS_PER_SEC (USER_HZ) /* like times() */
17#endif
18
19#ifndef HZ
20#define HZ 100
21#endif
22
23#define EXEC_PAGESIZE 4096
24
25#ifndef NOGROUP
26#define NOGROUP (-1)
27#endif
28
29#define MAXHOSTNAMELEN 64 /* max length of hostname */
30
31#endif /* _ASM_PPC64_PARAM_H */
diff --git a/include/asm-ppc64/pci-bridge.h b/include/asm-ppc64/pci-bridge.h
index c4f9023ea5ed..d8991389ab39 100644
--- a/include/asm-ppc64/pci-bridge.h
+++ b/include/asm-ppc64/pci-bridge.h
@@ -48,19 +48,52 @@ struct pci_controller {
48 unsigned long dma_window_size; 48 unsigned long dma_window_size;
49}; 49};
50 50
51/*
52 * PCI stuff, for nodes representing PCI devices, pointed to
53 * by device_node->data.
54 */
55struct pci_controller;
56struct iommu_table;
57
58struct pci_dn {
59 int busno; /* for pci devices */
60 int bussubno; /* for pci devices */
61 int devfn; /* for pci devices */
62 int eeh_mode; /* See eeh.h for possible EEH_MODEs */
63 int eeh_config_addr;
64 int eeh_capable; /* from firmware */
65 int eeh_check_count; /* # times driver ignored error */
66 int eeh_freeze_count; /* # times this device froze up. */
67 int eeh_is_bridge; /* device is pci-to-pci bridge */
68
69 int pci_ext_config_space; /* for pci devices */
70 struct pci_controller *phb; /* for pci devices */
71 struct iommu_table *iommu_table; /* for phb's or bridges */
72 struct pci_dev *pcidev; /* back-pointer to the pci device */
73 struct device_node *node; /* back-pointer to the device_node */
74 u32 config_space[16]; /* saved PCI config space */
75};
76
77/* Get the pointer to a device_node's pci_dn */
78#define PCI_DN(dn) ((struct pci_dn *) (dn)->data)
79
51struct device_node *fetch_dev_dn(struct pci_dev *dev); 80struct device_node *fetch_dev_dn(struct pci_dev *dev);
52 81
53/* Get a device_node from a pci_dev. This code must be fast except in the case 82/* Get a device_node from a pci_dev. This code must be fast except
54 * where the sysdata is incorrect and needs to be fixed up (hopefully just once) 83 * in the case where the sysdata is incorrect and needs to be fixed
84 * up (this will only happen once).
85 * In this case the sysdata will have been inherited from a PCI host
86 * bridge or a PCI-PCI bridge further up the tree, so it will point
87 * to a valid struct pci_dn, just not the one we want.
55 */ 88 */
56static inline struct device_node *pci_device_to_OF_node(struct pci_dev *dev) 89static inline struct device_node *pci_device_to_OF_node(struct pci_dev *dev)
57{ 90{
58 struct device_node *dn = dev->sysdata; 91 struct device_node *dn = dev->sysdata;
92 struct pci_dn *pdn = dn->data;
59 93
60 if (dn->devfn == dev->devfn && dn->busno == dev->bus->number) 94 if (pdn && pdn->devfn == dev->devfn && pdn->busno == dev->bus->number)
61 return dn; /* fast path. sysdata is good */ 95 return dn; /* fast path. sysdata is good */
62 else 96 return fetch_dev_dn(dev);
63 return fetch_dev_dn(dev);
64} 97}
65 98
66static inline struct device_node *pci_bus_to_OF_node(struct pci_bus *bus) 99static inline struct device_node *pci_bus_to_OF_node(struct pci_bus *bus)
@@ -83,8 +116,13 @@ static inline struct pci_controller *pci_bus_to_host(struct pci_bus *bus)
83 struct device_node *busdn = bus->sysdata; 116 struct device_node *busdn = bus->sysdata;
84 117
85 BUG_ON(busdn == NULL); 118 BUG_ON(busdn == NULL);
86 return busdn->phb; 119 return PCI_DN(busdn)->phb;
87} 120}
88 121
122/* Return values for ppc_md.pci_probe_mode function */
123#define PCI_PROBE_NONE -1 /* Don't look at this bus at all */
124#define PCI_PROBE_NORMAL 0 /* Do normal PCI probing */
125#define PCI_PROBE_DEVTREE 1 /* Instantiate from device tree */
126
89#endif 127#endif
90#endif /* __KERNEL__ */ 128#endif /* __KERNEL__ */
diff --git a/include/asm-ppc64/pci.h b/include/asm-ppc64/pci.h
index 4d057452f59b..a88bbfc26967 100644
--- a/include/asm-ppc64/pci.h
+++ b/include/asm-ppc64/pci.h
@@ -138,6 +138,19 @@ extern void
138pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, 138pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
139 struct pci_bus_region *region); 139 struct pci_bus_region *region);
140 140
141static inline struct resource *
142pcibios_select_root(struct pci_dev *pdev, struct resource *res)
143{
144 struct resource *root = NULL;
145
146 if (res->flags & IORESOURCE_IO)
147 root = &ioport_resource;
148 if (res->flags & IORESOURCE_MEM)
149 root = &iomem_resource;
150
151 return root;
152}
153
141extern int 154extern int
142unmap_bus_range(struct pci_bus *bus); 155unmap_bus_range(struct pci_bus *bus);
143 156
diff --git a/include/asm-ppc64/plpar_wrappers.h b/include/asm-ppc64/plpar_wrappers.h
index f4a5fb7d67c7..72dd2449ee76 100644
--- a/include/asm-ppc64/plpar_wrappers.h
+++ b/include/asm-ppc64/plpar_wrappers.h
@@ -107,5 +107,14 @@ static inline long plpar_put_term_char(unsigned long termno,
107 lbuf[1]); 107 lbuf[1]);
108} 108}
109 109
110static inline long plpar_set_xdabr(unsigned long address, unsigned long flags)
111{
112 return plpar_hcall_norets(H_SET_XDABR, address, flags);
113}
114
115static inline long plpar_set_dabr(unsigned long val)
116{
117 return plpar_hcall_norets(H_SET_DABR, val);
118}
110 119
111#endif /* _PPC64_PLPAR_WRAPPERS_H */ 120#endif /* _PPC64_PLPAR_WRAPPERS_H */
diff --git a/include/asm-ppc64/processor.h b/include/asm-ppc64/processor.h
index 8bd7aa959385..4146189006e3 100644
--- a/include/asm-ppc64/processor.h
+++ b/include/asm-ppc64/processor.h
@@ -433,6 +433,7 @@ struct thread_struct {
433 unsigned long start_tb; /* Start purr when proc switched in */ 433 unsigned long start_tb; /* Start purr when proc switched in */
434 unsigned long accum_tb; /* Total accumilated purr for process */ 434 unsigned long accum_tb; /* Total accumilated purr for process */
435 unsigned long vdso_base; /* base of the vDSO library */ 435 unsigned long vdso_base; /* base of the vDSO library */
436 unsigned long dabr; /* Data address breakpoint register */
436#ifdef CONFIG_ALTIVEC 437#ifdef CONFIG_ALTIVEC
437 /* Complete AltiVec register set */ 438 /* Complete AltiVec register set */
438 vector128 vr[32] __attribute((aligned(16))); 439 vector128 vr[32] __attribute((aligned(16)));
diff --git a/include/asm-ppc64/prom.h b/include/asm-ppc64/prom.h
index dc5330b39509..c02ec1d6b909 100644
--- a/include/asm-ppc64/prom.h
+++ b/include/asm-ppc64/prom.h
@@ -116,14 +116,6 @@ struct property {
116 struct property *next; 116 struct property *next;
117}; 117};
118 118
119/* NOTE: the device_node contains PCI specific info for pci devices.
120 * This perhaps could be hung off the device_node with another struct,
121 * but for now it is directly in the node. The phb ptr is a good
122 * indication of a real PCI node. Other nodes leave these fields zeroed.
123 */
124struct pci_controller;
125struct iommu_table;
126
127struct device_node { 119struct device_node {
128 char *name; 120 char *name;
129 char *type; 121 char *type;
@@ -135,16 +127,6 @@ struct device_node {
135 struct interrupt_info *intrs; 127 struct interrupt_info *intrs;
136 char *full_name; 128 char *full_name;
137 129
138 /* PCI stuff probably doesn't belong here */
139 int busno; /* for pci devices */
140 int bussubno; /* for pci devices */
141 int devfn; /* for pci devices */
142 int eeh_mode; /* See eeh.h for possible EEH_MODEs */
143 int eeh_config_addr;
144 int pci_ext_config_space; /* for pci devices */
145 struct pci_controller *phb; /* for pci devices */
146 struct iommu_table *iommu_table; /* for phb's or bridges */
147
148 struct property *properties; 130 struct property *properties;
149 struct device_node *parent; 131 struct device_node *parent;
150 struct device_node *child; 132 struct device_node *child;
@@ -154,6 +136,7 @@ struct device_node {
154 struct proc_dir_entry *pde; /* this node's proc directory */ 136 struct proc_dir_entry *pde; /* this node's proc directory */
155 struct kref kref; 137 struct kref kref;
156 unsigned long _flags; 138 unsigned long _flags;
139 void *data;
157}; 140};
158 141
159extern struct device_node *of_chosen; 142extern struct device_node *of_chosen;
diff --git a/include/asm-ppc64/ptrace-common.h b/include/asm-ppc64/ptrace-common.h
index af03547f9c7e..b1babb729673 100644
--- a/include/asm-ppc64/ptrace-common.h
+++ b/include/asm-ppc64/ptrace-common.h
@@ -11,6 +11,10 @@
11 11
12#ifndef _PPC64_PTRACE_COMMON_H 12#ifndef _PPC64_PTRACE_COMMON_H
13#define _PPC64_PTRACE_COMMON_H 13#define _PPC64_PTRACE_COMMON_H
14
15#include <linux/config.h>
16#include <asm/system.h>
17
14/* 18/*
15 * Set of msr bits that gdb can change on behalf of a process. 19 * Set of msr bits that gdb can change on behalf of a process.
16 */ 20 */
@@ -69,4 +73,92 @@ static inline void clear_single_step(struct task_struct *task)
69 clear_ti_thread_flag(task->thread_info, TIF_SINGLESTEP); 73 clear_ti_thread_flag(task->thread_info, TIF_SINGLESTEP);
70} 74}
71 75
76#ifdef CONFIG_ALTIVEC
77/*
78 * Get/set all the altivec registers vr0..vr31, vscr, vrsave, in one go.
79 * The transfer totals 34 quadword. Quadwords 0-31 contain the
80 * corresponding vector registers. Quadword 32 contains the vscr as the
81 * last word (offset 12) within that quadword. Quadword 33 contains the
82 * vrsave as the first word (offset 0) within the quadword.
83 *
84 * This definition of the VMX state is compatible with the current PPC32
85 * ptrace interface. This allows signal handling and ptrace to use the
86 * same structures. This also simplifies the implementation of a bi-arch
87 * (combined (32- and 64-bit) gdb.
88 */
89
90/*
91 * Get contents of AltiVec register state in task TASK
92 */
93static inline int get_vrregs(unsigned long __user *data,
94 struct task_struct *task)
95{
96 unsigned long regsize;
97
98 /* copy AltiVec registers VR[0] .. VR[31] */
99 regsize = 32 * sizeof(vector128);
100 if (copy_to_user(data, task->thread.vr, regsize))
101 return -EFAULT;
102 data += (regsize / sizeof(unsigned long));
103
104 /* copy VSCR */
105 regsize = 1 * sizeof(vector128);
106 if (copy_to_user(data, &task->thread.vscr, regsize))
107 return -EFAULT;
108 data += (regsize / sizeof(unsigned long));
109
110 /* copy VRSAVE */
111 if (put_user(task->thread.vrsave, (u32 __user *)data))
112 return -EFAULT;
113
114 return 0;
115}
116
117/*
118 * Write contents of AltiVec register state into task TASK.
119 */
120static inline int set_vrregs(struct task_struct *task,
121 unsigned long __user *data)
122{
123 unsigned long regsize;
124
125 /* copy AltiVec registers VR[0] .. VR[31] */
126 regsize = 32 * sizeof(vector128);
127 if (copy_from_user(task->thread.vr, data, regsize))
128 return -EFAULT;
129 data += (regsize / sizeof(unsigned long));
130
131 /* copy VSCR */
132 regsize = 1 * sizeof(vector128);
133 if (copy_from_user(&task->thread.vscr, data, regsize))
134 return -EFAULT;
135 data += (regsize / sizeof(unsigned long));
136
137 /* copy VRSAVE */
138 if (get_user(task->thread.vrsave, (u32 __user *)data))
139 return -EFAULT;
140
141 return 0;
142}
143#endif
144
145static inline int ptrace_set_debugreg(struct task_struct *task,
146 unsigned long addr, unsigned long data)
147{
148 /* We only support one DABR and no IABRS at the moment */
149 if (addr > 0)
150 return -EINVAL;
151
152 /* The bottom 3 bits are flags */
153 if ((data & ~0x7UL) >= TASK_SIZE)
154 return -EIO;
155
156 /* Ensure translation is on */
157 if (data && !(data & DABR_TRANSLATION))
158 return -EIO;
159
160 task->thread.dabr = data;
161 return 0;
162}
163
72#endif /* _PPC64_PTRACE_COMMON_H */ 164#endif /* _PPC64_PTRACE_COMMON_H */
diff --git a/include/asm-ppc64/ptrace.h b/include/asm-ppc64/ptrace.h
index c96aad28fc08..3a55377f1fd3 100644
--- a/include/asm-ppc64/ptrace.h
+++ b/include/asm-ppc64/ptrace.h
@@ -25,56 +25,49 @@
25 */ 25 */
26 26
27#ifndef __ASSEMBLY__ 27#ifndef __ASSEMBLY__
28#define PPC_REG unsigned long 28
29struct pt_regs { 29struct pt_regs {
30 PPC_REG gpr[32]; 30 unsigned long gpr[32];
31 PPC_REG nip; 31 unsigned long nip;
32 PPC_REG msr; 32 unsigned long msr;
33 PPC_REG orig_gpr3; /* Used for restarting system calls */ 33 unsigned long orig_gpr3; /* Used for restarting system calls */
34 PPC_REG ctr; 34 unsigned long ctr;
35 PPC_REG link; 35 unsigned long link;
36 PPC_REG xer; 36 unsigned long xer;
37 PPC_REG ccr; 37 unsigned long ccr;
38 PPC_REG softe; /* Soft enabled/disabled */ 38 unsigned long softe; /* Soft enabled/disabled */
39 PPC_REG trap; /* Reason for being here */ 39 unsigned long trap; /* Reason for being here */
40 PPC_REG dar; /* Fault registers */ 40 unsigned long dar; /* Fault registers */
41 PPC_REG dsisr; 41 unsigned long dsisr;
42 PPC_REG result; /* Result of a system call */ 42 unsigned long result; /* Result of a system call */
43}; 43};
44 44
45#define PPC_REG_32 unsigned int
46struct pt_regs32 { 45struct pt_regs32 {
47 PPC_REG_32 gpr[32]; 46 unsigned int gpr[32];
48 PPC_REG_32 nip; 47 unsigned int nip;
49 PPC_REG_32 msr; 48 unsigned int msr;
50 PPC_REG_32 orig_gpr3; /* Used for restarting system calls */ 49 unsigned int orig_gpr3; /* Used for restarting system calls */
51 PPC_REG_32 ctr; 50 unsigned int ctr;
52 PPC_REG_32 link; 51 unsigned int link;
53 PPC_REG_32 xer; 52 unsigned int xer;
54 PPC_REG_32 ccr; 53 unsigned int ccr;
55 PPC_REG_32 mq; /* 601 only (not used at present) */ 54 unsigned int mq; /* 601 only (not used at present) */
56 /* Used on APUS to hold IPL value. */ 55 unsigned int trap; /* Reason for being here */
57 PPC_REG_32 trap; /* Reason for being here */ 56 unsigned int dar; /* Fault registers */
58 PPC_REG_32 dar; /* Fault registers */ 57 unsigned int dsisr;
59 PPC_REG_32 dsisr; 58 unsigned int result; /* Result of a system call */
60 PPC_REG_32 result; /* Result of a system call */
61}; 59};
62 60
61#ifdef __KERNEL__
62
63#define instruction_pointer(regs) ((regs)->nip) 63#define instruction_pointer(regs) ((regs)->nip)
64
64#ifdef CONFIG_SMP 65#ifdef CONFIG_SMP
65extern unsigned long profile_pc(struct pt_regs *regs); 66extern unsigned long profile_pc(struct pt_regs *regs);
66#else 67#else
67#define profile_pc(regs) instruction_pointer(regs) 68#define profile_pc(regs) instruction_pointer(regs)
68#endif 69#endif
69 70
70#endif /* __ASSEMBLY__ */
71
72#define STACK_FRAME_OVERHEAD 112 /* size of minimum stack frame */
73
74/* Size of dummy stack frame allocated when calling signal handler. */
75#define __SIGNAL_FRAMESIZE 128
76#define __SIGNAL_FRAMESIZE32 64
77
78#define user_mode(regs) ((((regs)->msr) >> MSR_PR_LG) & 0x1) 71#define user_mode(regs) ((((regs)->msr) >> MSR_PR_LG) & 0x1)
79 72
80#define force_successful_syscall_return() \ 73#define force_successful_syscall_return() \
@@ -89,6 +82,16 @@ extern unsigned long profile_pc(struct pt_regs *regs);
89#define TRAP(regs) ((regs)->trap & ~0xF) 82#define TRAP(regs) ((regs)->trap & ~0xF)
90#define CHECK_FULL_REGS(regs) BUG_ON(regs->trap & 1) 83#define CHECK_FULL_REGS(regs) BUG_ON(regs->trap & 1)
91 84
85#endif /* __KERNEL__ */
86
87#endif /* __ASSEMBLY__ */
88
89#define STACK_FRAME_OVERHEAD 112 /* size of minimum stack frame */
90
91/* Size of dummy stack frame allocated when calling signal handler. */
92#define __SIGNAL_FRAMESIZE 128
93#define __SIGNAL_FRAMESIZE32 64
94
92/* 95/*
93 * Offsets used by 'ptrace' system call interface. 96 * Offsets used by 'ptrace' system call interface.
94 */ 97 */
@@ -135,17 +138,21 @@ extern unsigned long profile_pc(struct pt_regs *regs);
135#define PT_XER 37 138#define PT_XER 37
136#define PT_CCR 38 139#define PT_CCR 38
137#define PT_SOFTE 39 140#define PT_SOFTE 39
141#define PT_TRAP 40
142#define PT_DAR 41
143#define PT_DSISR 42
138#define PT_RESULT 43 144#define PT_RESULT 43
139 145
140#define PT_FPR0 48 146#define PT_FPR0 48
141 147
142/* Kernel and userspace will both use this PT_FPSCR value. 32-bit apps will have 148/*
143 * visibility to the asm-ppc/ptrace.h header instead of this one. 149 * Kernel and userspace will both use this PT_FPSCR value. 32-bit apps will
150 * have visibility to the asm-ppc/ptrace.h header instead of this one.
144 */ 151 */
145#define PT_FPSCR (PT_FPR0 + 32) /* each FP reg occupies 1 slot in 64-bit space */ 152#define PT_FPSCR (PT_FPR0 + 32) /* each FP reg occupies 1 slot in 64-bit space */
146 153
147#ifdef __KERNEL__ 154#ifdef __KERNEL__
148#define PT_FPSCR32 (PT_FPR0 + 2*32 + 1) /* each FP reg occupies 2 32-bit userspace slots */ 155#define PT_FPSCR32 (PT_FPR0 + 2*32 + 1) /* each FP reg occupies 2 32-bit userspace slots */
149#endif 156#endif
150 157
151#define PT_VR0 82 /* each Vector reg occupies 2 slots in 64-bit */ 158#define PT_VR0 82 /* each Vector reg occupies 2 slots in 64-bit */
@@ -173,17 +180,34 @@ extern unsigned long profile_pc(struct pt_regs *regs);
173#define PTRACE_GETVRREGS 18 180#define PTRACE_GETVRREGS 18
174#define PTRACE_SETVRREGS 19 181#define PTRACE_SETVRREGS 19
175 182
176/* Additional PTRACE requests implemented on PowerPC. */ 183/*
177#define PPC_PTRACE_GETREGS 0x99 /* Get GPRs 0 - 31 */ 184 * While we dont have 64bit book E processors, we need to reserve the
178#define PPC_PTRACE_SETREGS 0x98 /* Set GPRs 0 - 31 */ 185 * relevant ptrace calls for 32bit compatibility.
179#define PPC_PTRACE_GETFPREGS 0x97 /* Get FPRs 0 - 31 */ 186 */
180#define PPC_PTRACE_SETFPREGS 0x96 /* Set FPRs 0 - 31 */ 187#if 0
181#define PPC_PTRACE_PEEKTEXT_3264 0x95 /* Read word at location ADDR on a 64-bit process from a 32-bit process. */ 188#define PTRACE_GETEVRREGS 20
182#define PPC_PTRACE_PEEKDATA_3264 0x94 /* Read word at location ADDR on a 64-bit process from a 32-bit process. */ 189#define PTRACE_SETEVRREGS 21
183#define PPC_PTRACE_POKETEXT_3264 0x93 /* Write word at location ADDR on a 64-bit process from a 32-bit process. */ 190#endif
184#define PPC_PTRACE_POKEDATA_3264 0x92 /* Write word at location ADDR on a 64-bit process from a 32-bit process. */
185#define PPC_PTRACE_PEEKUSR_3264 0x91 /* Read a register (specified by ADDR) out of the "user area" on a 64-bit process from a 32-bit process. */
186#define PPC_PTRACE_POKEUSR_3264 0x90 /* Write DATA into location ADDR within the "user area" on a 64-bit process from a 32-bit process. */
187 191
192/*
193 * Get or set a debug register. The first 16 are DABR registers and the
194 * second 16 are IABR registers.
195 */
196#define PTRACE_GET_DEBUGREG 25
197#define PTRACE_SET_DEBUGREG 26
198
199/* Additional PTRACE requests implemented on PowerPC. */
200#define PPC_PTRACE_GETREGS 0x99 /* Get GPRs 0 - 31 */
201#define PPC_PTRACE_SETREGS 0x98 /* Set GPRs 0 - 31 */
202#define PPC_PTRACE_GETFPREGS 0x97 /* Get FPRs 0 - 31 */
203#define PPC_PTRACE_SETFPREGS 0x96 /* Set FPRs 0 - 31 */
204
205/* Calls to trace a 64bit program from a 32bit program */
206#define PPC_PTRACE_PEEKTEXT_3264 0x95
207#define PPC_PTRACE_PEEKDATA_3264 0x94
208#define PPC_PTRACE_POKETEXT_3264 0x93
209#define PPC_PTRACE_POKEDATA_3264 0x92
210#define PPC_PTRACE_PEEKUSR_3264 0x91
211#define PPC_PTRACE_POKEUSR_3264 0x90
188 212
189#endif /* _PPC64_PTRACE_H */ 213#endif /* _PPC64_PTRACE_H */
diff --git a/include/asm-ppc64/segment.h b/include/asm-ppc64/segment.h
deleted file mode 100644
index d80fb68cc79e..000000000000
--- a/include/asm-ppc64/segment.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __PPC64_SEGMENT_H
2#define __PPC64_SEGMENT_H
3
4/* Only here because we have some old header files that expect it.. */
5
6#endif /* __PPC64_SEGMENT_H */
diff --git a/include/asm-ppc64/setup.h b/include/asm-ppc64/setup.h
deleted file mode 100644
index b257b8348c73..000000000000
--- a/include/asm-ppc64/setup.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _PPC_SETUP_H
2#define _PPC_SETUP_H
3
4#define COMMAND_LINE_SIZE 512
5
6#endif /* _PPC_SETUP_H */
diff --git a/include/asm-ppc64/spinlock.h b/include/asm-ppc64/spinlock.h
index acd11564dd75..14cb895bb607 100644
--- a/include/asm-ppc64/spinlock.h
+++ b/include/asm-ppc64/spinlock.h
@@ -15,36 +15,42 @@
15 * modify it under the terms of the GNU General Public License 15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 16 * as published by the Free Software Foundation; either version
17 * 2 of the License, or (at your option) any later version. 17 * 2 of the License, or (at your option) any later version.
18 *
19 * (the type definitions are in asm/spinlock_types.h)
18 */ 20 */
19#include <linux/config.h> 21#include <linux/config.h>
20#include <asm/paca.h> 22#include <asm/paca.h>
21#include <asm/hvcall.h> 23#include <asm/hvcall.h>
22#include <asm/iSeries/HvCall.h> 24#include <asm/iSeries/HvCall.h>
23 25
24typedef struct { 26#define __raw_spin_is_locked(x) ((x)->slock != 0)
25 volatile unsigned int lock;
26#ifdef CONFIG_PREEMPT
27 unsigned int break_lock;
28#endif
29} spinlock_t;
30 27
31typedef struct { 28/*
32 volatile signed int lock; 29 * This returns the old value in the lock, so we succeeded
33#ifdef CONFIG_PREEMPT 30 * in getting the lock if the return value is 0.
34 unsigned int break_lock; 31 */
35#endif 32static __inline__ unsigned long __spin_trylock(raw_spinlock_t *lock)
36} rwlock_t; 33{
34 unsigned long tmp, tmp2;
37 35
38#ifdef __KERNEL__ 36 __asm__ __volatile__(
39#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 } 37" lwz %1,%3(13) # __spin_trylock\n\
381: lwarx %0,0,%2\n\
39 cmpwi 0,%0,0\n\
40 bne- 2f\n\
41 stwcx. %1,0,%2\n\
42 bne- 1b\n\
43 isync\n\
442:" : "=&r" (tmp), "=&r" (tmp2)
45 : "r" (&lock->slock), "i" (offsetof(struct paca_struct, lock_token))
46 : "cr0", "memory");
40 47
41#define spin_is_locked(x) ((x)->lock != 0) 48 return tmp;
42#define spin_lock_init(x) do { *(x) = SPIN_LOCK_UNLOCKED; } while(0) 49}
43 50
44static __inline__ void _raw_spin_unlock(spinlock_t *lock) 51static int __inline__ __raw_spin_trylock(raw_spinlock_t *lock)
45{ 52{
46 __asm__ __volatile__("lwsync # spin_unlock": : :"memory"); 53 return __spin_trylock(lock) == 0;
47 lock->lock = 0;
48} 54}
49 55
50/* 56/*
@@ -64,44 +70,15 @@ static __inline__ void _raw_spin_unlock(spinlock_t *lock)
64#if defined(CONFIG_PPC_SPLPAR) || defined(CONFIG_PPC_ISERIES) 70#if defined(CONFIG_PPC_SPLPAR) || defined(CONFIG_PPC_ISERIES)
65/* We only yield to the hypervisor if we are in shared processor mode */ 71/* We only yield to the hypervisor if we are in shared processor mode */
66#define SHARED_PROCESSOR (get_paca()->lppaca.shared_proc) 72#define SHARED_PROCESSOR (get_paca()->lppaca.shared_proc)
67extern void __spin_yield(spinlock_t *lock); 73extern void __spin_yield(raw_spinlock_t *lock);
68extern void __rw_yield(rwlock_t *lock); 74extern void __rw_yield(raw_rwlock_t *lock);
69#else /* SPLPAR || ISERIES */ 75#else /* SPLPAR || ISERIES */
70#define __spin_yield(x) barrier() 76#define __spin_yield(x) barrier()
71#define __rw_yield(x) barrier() 77#define __rw_yield(x) barrier()
72#define SHARED_PROCESSOR 0 78#define SHARED_PROCESSOR 0
73#endif 79#endif
74extern void spin_unlock_wait(spinlock_t *lock);
75
76/*
77 * This returns the old value in the lock, so we succeeded
78 * in getting the lock if the return value is 0.
79 */
80static __inline__ unsigned long __spin_trylock(spinlock_t *lock)
81{
82 unsigned long tmp, tmp2;
83
84 __asm__ __volatile__(
85" lwz %1,%3(13) # __spin_trylock\n\
861: lwarx %0,0,%2\n\
87 cmpwi 0,%0,0\n\
88 bne- 2f\n\
89 stwcx. %1,0,%2\n\
90 bne- 1b\n\
91 isync\n\
922:" : "=&r" (tmp), "=&r" (tmp2)
93 : "r" (&lock->lock), "i" (offsetof(struct paca_struct, lock_token))
94 : "cr0", "memory");
95
96 return tmp;
97}
98
99static int __inline__ _raw_spin_trylock(spinlock_t *lock)
100{
101 return __spin_trylock(lock) == 0;
102}
103 80
104static void __inline__ _raw_spin_lock(spinlock_t *lock) 81static void __inline__ __raw_spin_lock(raw_spinlock_t *lock)
105{ 82{
106 while (1) { 83 while (1) {
107 if (likely(__spin_trylock(lock) == 0)) 84 if (likely(__spin_trylock(lock) == 0))
@@ -110,12 +87,12 @@ static void __inline__ _raw_spin_lock(spinlock_t *lock)
110 HMT_low(); 87 HMT_low();
111 if (SHARED_PROCESSOR) 88 if (SHARED_PROCESSOR)
112 __spin_yield(lock); 89 __spin_yield(lock);
113 } while (unlikely(lock->lock != 0)); 90 } while (unlikely(lock->slock != 0));
114 HMT_medium(); 91 HMT_medium();
115 } 92 }
116} 93}
117 94
118static void __inline__ _raw_spin_lock_flags(spinlock_t *lock, unsigned long flags) 95static void __inline__ __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long flags)
119{ 96{
120 unsigned long flags_dis; 97 unsigned long flags_dis;
121 98
@@ -128,12 +105,20 @@ static void __inline__ _raw_spin_lock_flags(spinlock_t *lock, unsigned long flag
128 HMT_low(); 105 HMT_low();
129 if (SHARED_PROCESSOR) 106 if (SHARED_PROCESSOR)
130 __spin_yield(lock); 107 __spin_yield(lock);
131 } while (unlikely(lock->lock != 0)); 108 } while (unlikely(lock->slock != 0));
132 HMT_medium(); 109 HMT_medium();
133 local_irq_restore(flags_dis); 110 local_irq_restore(flags_dis);
134 } 111 }
135} 112}
136 113
114static __inline__ void __raw_spin_unlock(raw_spinlock_t *lock)
115{
116 __asm__ __volatile__("lwsync # __raw_spin_unlock": : :"memory");
117 lock->slock = 0;
118}
119
120extern void __raw_spin_unlock_wait(raw_spinlock_t *lock);
121
137/* 122/*
138 * Read-write spinlocks, allowing multiple readers 123 * Read-write spinlocks, allowing multiple readers
139 * but only one writer. 124 * but only one writer.
@@ -144,24 +129,15 @@ static void __inline__ _raw_spin_lock_flags(spinlock_t *lock, unsigned long flag
144 * irq-safe write-lock, but readers can get non-irqsafe 129 * irq-safe write-lock, but readers can get non-irqsafe
145 * read-locks. 130 * read-locks.
146 */ 131 */
147#define RW_LOCK_UNLOCKED (rwlock_t) { 0 }
148 132
149#define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while(0) 133#define __raw_read_can_lock(rw) ((rw)->lock >= 0)
150 134#define __raw_write_can_lock(rw) (!(rw)->lock)
151#define read_can_lock(rw) ((rw)->lock >= 0)
152#define write_can_lock(rw) (!(rw)->lock)
153
154static __inline__ void _raw_write_unlock(rwlock_t *rw)
155{
156 __asm__ __volatile__("lwsync # write_unlock": : :"memory");
157 rw->lock = 0;
158}
159 135
160/* 136/*
161 * This returns the old value in the lock + 1, 137 * This returns the old value in the lock + 1,
162 * so we got a read lock if the return value is > 0. 138 * so we got a read lock if the return value is > 0.
163 */ 139 */
164static long __inline__ __read_trylock(rwlock_t *rw) 140static long __inline__ __read_trylock(raw_rwlock_t *rw)
165{ 141{
166 long tmp; 142 long tmp;
167 143
@@ -180,45 +156,11 @@ static long __inline__ __read_trylock(rwlock_t *rw)
180 return tmp; 156 return tmp;
181} 157}
182 158
183static int __inline__ _raw_read_trylock(rwlock_t *rw)
184{
185 return __read_trylock(rw) > 0;
186}
187
188static void __inline__ _raw_read_lock(rwlock_t *rw)
189{
190 while (1) {
191 if (likely(__read_trylock(rw) > 0))
192 break;
193 do {
194 HMT_low();
195 if (SHARED_PROCESSOR)
196 __rw_yield(rw);
197 } while (unlikely(rw->lock < 0));
198 HMT_medium();
199 }
200}
201
202static void __inline__ _raw_read_unlock(rwlock_t *rw)
203{
204 long tmp;
205
206 __asm__ __volatile__(
207 "eieio # read_unlock\n\
2081: lwarx %0,0,%1\n\
209 addic %0,%0,-1\n\
210 stwcx. %0,0,%1\n\
211 bne- 1b"
212 : "=&r"(tmp)
213 : "r"(&rw->lock)
214 : "cr0", "memory");
215}
216
217/* 159/*
218 * This returns the old value in the lock, 160 * This returns the old value in the lock,
219 * so we got the write lock if the return value is 0. 161 * so we got the write lock if the return value is 0.
220 */ 162 */
221static __inline__ long __write_trylock(rwlock_t *rw) 163static __inline__ long __write_trylock(raw_rwlock_t *rw)
222{ 164{
223 long tmp, tmp2; 165 long tmp, tmp2;
224 166
@@ -237,12 +179,21 @@ static __inline__ long __write_trylock(rwlock_t *rw)
237 return tmp; 179 return tmp;
238} 180}
239 181
240static int __inline__ _raw_write_trylock(rwlock_t *rw) 182static void __inline__ __raw_read_lock(raw_rwlock_t *rw)
241{ 183{
242 return __write_trylock(rw) == 0; 184 while (1) {
185 if (likely(__read_trylock(rw) > 0))
186 break;
187 do {
188 HMT_low();
189 if (SHARED_PROCESSOR)
190 __rw_yield(rw);
191 } while (unlikely(rw->lock < 0));
192 HMT_medium();
193 }
243} 194}
244 195
245static void __inline__ _raw_write_lock(rwlock_t *rw) 196static void __inline__ __raw_write_lock(raw_rwlock_t *rw)
246{ 197{
247 while (1) { 198 while (1) {
248 if (likely(__write_trylock(rw) == 0)) 199 if (likely(__write_trylock(rw) == 0))
@@ -256,5 +207,35 @@ static void __inline__ _raw_write_lock(rwlock_t *rw)
256 } 207 }
257} 208}
258 209
259#endif /* __KERNEL__ */ 210static int __inline__ __raw_read_trylock(raw_rwlock_t *rw)
211{
212 return __read_trylock(rw) > 0;
213}
214
215static int __inline__ __raw_write_trylock(raw_rwlock_t *rw)
216{
217 return __write_trylock(rw) == 0;
218}
219
220static void __inline__ __raw_read_unlock(raw_rwlock_t *rw)
221{
222 long tmp;
223
224 __asm__ __volatile__(
225 "eieio # read_unlock\n\
2261: lwarx %0,0,%1\n\
227 addic %0,%0,-1\n\
228 stwcx. %0,0,%1\n\
229 bne- 1b"
230 : "=&r"(tmp)
231 : "r"(&rw->lock)
232 : "cr0", "memory");
233}
234
235static __inline__ void __raw_write_unlock(raw_rwlock_t *rw)
236{
237 __asm__ __volatile__("lwsync # write_unlock": : :"memory");
238 rw->lock = 0;
239}
240
260#endif /* __ASM_SPINLOCK_H */ 241#endif /* __ASM_SPINLOCK_H */
diff --git a/include/asm-ppc64/spinlock_types.h b/include/asm-ppc64/spinlock_types.h
new file mode 100644
index 000000000000..a37c8eabb9f2
--- /dev/null
+++ b/include/asm-ppc64/spinlock_types.h
@@ -0,0 +1,20 @@
1#ifndef __ASM_SPINLOCK_TYPES_H
2#define __ASM_SPINLOCK_TYPES_H
3
4#ifndef __LINUX_SPINLOCK_TYPES_H
5# error "please don't include this file directly"
6#endif
7
8typedef struct {
9 volatile unsigned int slock;
10} raw_spinlock_t;
11
12#define __RAW_SPIN_LOCK_UNLOCKED { 0 }
13
14typedef struct {
15 volatile signed int lock;
16} raw_rwlock_t;
17
18#define __RAW_RW_LOCK_UNLOCKED { 0 }
19
20#endif
diff --git a/include/asm-ppc64/system.h b/include/asm-ppc64/system.h
index c0396428cc3c..375015c62f20 100644
--- a/include/asm-ppc64/system.h
+++ b/include/asm-ppc64/system.h
@@ -101,6 +101,9 @@ static inline int debugger_dabr_match(struct pt_regs *regs) { return 0; }
101static inline int debugger_fault_handler(struct pt_regs *regs) { return 0; } 101static inline int debugger_fault_handler(struct pt_regs *regs) { return 0; }
102#endif 102#endif
103 103
104extern int set_dabr(unsigned long dabr);
105extern void _exception(int signr, struct pt_regs *regs, int code,
106 unsigned long addr);
104extern int fix_alignment(struct pt_regs *regs); 107extern int fix_alignment(struct pt_regs *regs);
105extern void bad_page_fault(struct pt_regs *regs, unsigned long address, 108extern void bad_page_fault(struct pt_regs *regs, unsigned long address,
106 int sig); 109 int sig);
diff --git a/include/asm-ppc64/timex.h b/include/asm-ppc64/timex.h
deleted file mode 100644
index 8db4da4064cd..000000000000
--- a/include/asm-ppc64/timex.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * linux/include/asm-ppc/timex.h
3 *
4 * PPC64 architecture timex specifications
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11#ifndef _ASMPPC64_TIMEX_H
12#define _ASMPPC64_TIMEX_H
13
14#define CLOCK_TICK_RATE 1193180 /* Underlying HZ */
15
16typedef unsigned long cycles_t;
17
18static inline cycles_t get_cycles(void)
19{
20 cycles_t ret;
21
22 __asm__ __volatile__("mftb %0" : "=r" (ret) : );
23 return ret;
24}
25
26#endif
diff --git a/include/asm-ppc64/user.h b/include/asm-ppc64/user.h
deleted file mode 100644
index d7d6554a421f..000000000000
--- a/include/asm-ppc64/user.h
+++ /dev/null
@@ -1,58 +0,0 @@
1#ifndef _PPC_USER_H
2#define _PPC_USER_H
3
4/* Adapted from <asm-alpha/user.h>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#include <asm/ptrace.h>
13#include <asm/page.h>
14
15/*
16 * Core file format: The core file is written in such a way that gdb
17 * can understand it and provide useful information to the user (under
18 * linux we use the `trad-core' bfd, NOT the osf-core). The file contents
19 * are as follows:
20 *
21 * upage: 1 page consisting of a user struct that tells gdb
22 * what is present in the file. Directly after this is a
23 * copy of the task_struct, which is currently not used by gdb,
24 * but it may come in handy at some point. All of the registers
25 * are stored as part of the upage. The upage should always be
26 * only one page long.
27 * data: The data segment follows next. We use current->end_text to
28 * current->brk to pick up all of the user variables, plus any memory
29 * that may have been sbrk'ed. No attempt is made to determine if a
30 * page is demand-zero or if a page is totally unused, we just cover
31 * the entire range. All of the addresses are rounded in such a way
32 * that an integral number of pages is written.
33 * stack: We need the stack information in order to get a meaningful
34 * backtrace. We need to write the data from usp to
35 * current->start_stack, so we round each of these in order to be able
36 * to write an integer number of pages.
37 */
38struct user {
39 struct pt_regs regs; /* entire machine state */
40 size_t u_tsize; /* text size (pages) */
41 size_t u_dsize; /* data size (pages) */
42 size_t u_ssize; /* stack size (pages) */
43 unsigned long start_code; /* text starting address */
44 unsigned long start_data; /* data starting address */
45 unsigned long start_stack; /* stack starting address */
46 long int signal; /* signal causing core dump */
47 struct regs * u_ar0; /* help gdb find registers */
48 unsigned long magic; /* identifies a core file */
49 char u_comm[32]; /* user command name */
50};
51
52#define NBPG PAGE_SIZE
53#define UPAGES 1
54#define HOST_TEXT_START_ADDR (u.start_code)
55#define HOST_DATA_START_ADDR (u.start_data)
56#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
57
58#endif /* _PPC_USER_H */
diff --git a/include/asm-s390/spinlock.h b/include/asm-s390/spinlock.h
index 321b23bba1ec..273dbecf8ace 100644
--- a/include/asm-s390/spinlock.h
+++ b/include/asm-s390/spinlock.h
@@ -27,25 +27,19 @@ _raw_compare_and_swap(volatile unsigned int *lock,
27 * on the local processor, one does not. 27 * on the local processor, one does not.
28 * 28 *
29 * We make no fairness assumptions. They have a cost. 29 * We make no fairness assumptions. They have a cost.
30 *
31 * (the type definitions are in asm/spinlock_types.h)
30 */ 32 */
31 33
32typedef struct { 34#define __raw_spin_is_locked(x) ((x)->lock != 0)
33 volatile unsigned int lock; 35#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock)
34#ifdef CONFIG_PREEMPT 36#define __raw_spin_unlock_wait(lock) \
35 unsigned int break_lock; 37 do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0)
36#endif
37} __attribute__ ((aligned (4))) spinlock_t;
38
39#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 }
40#define spin_lock_init(lp) do { (lp)->lock = 0; } while(0)
41#define spin_unlock_wait(lp) do { barrier(); } while(((volatile spinlock_t *)(lp))->lock)
42#define spin_is_locked(x) ((x)->lock != 0)
43#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock)
44 38
45extern void _raw_spin_lock_wait(spinlock_t *lp, unsigned int pc); 39extern void _raw_spin_lock_wait(raw_spinlock_t *lp, unsigned int pc);
46extern int _raw_spin_trylock_retry(spinlock_t *lp, unsigned int pc); 40extern int _raw_spin_trylock_retry(raw_spinlock_t *lp, unsigned int pc);
47 41
48static inline void _raw_spin_lock(spinlock_t *lp) 42static inline void __raw_spin_lock(raw_spinlock_t *lp)
49{ 43{
50 unsigned long pc = 1 | (unsigned long) __builtin_return_address(0); 44 unsigned long pc = 1 | (unsigned long) __builtin_return_address(0);
51 45
@@ -53,7 +47,7 @@ static inline void _raw_spin_lock(spinlock_t *lp)
53 _raw_spin_lock_wait(lp, pc); 47 _raw_spin_lock_wait(lp, pc);
54} 48}
55 49
56static inline int _raw_spin_trylock(spinlock_t *lp) 50static inline int __raw_spin_trylock(raw_spinlock_t *lp)
57{ 51{
58 unsigned long pc = 1 | (unsigned long) __builtin_return_address(0); 52 unsigned long pc = 1 | (unsigned long) __builtin_return_address(0);
59 53
@@ -62,7 +56,7 @@ static inline int _raw_spin_trylock(spinlock_t *lp)
62 return _raw_spin_trylock_retry(lp, pc); 56 return _raw_spin_trylock_retry(lp, pc);
63} 57}
64 58
65static inline void _raw_spin_unlock(spinlock_t *lp) 59static inline void __raw_spin_unlock(raw_spinlock_t *lp)
66{ 60{
67 _raw_compare_and_swap(&lp->lock, lp->lock, 0); 61 _raw_compare_and_swap(&lp->lock, lp->lock, 0);
68} 62}
@@ -77,36 +71,25 @@ static inline void _raw_spin_unlock(spinlock_t *lp)
77 * irq-safe write-lock, but readers can get non-irqsafe 71 * irq-safe write-lock, but readers can get non-irqsafe
78 * read-locks. 72 * read-locks.
79 */ 73 */
80typedef struct {
81 volatile unsigned int lock;
82 volatile unsigned long owner_pc;
83#ifdef CONFIG_PREEMPT
84 unsigned int break_lock;
85#endif
86} rwlock_t;
87
88#define RW_LOCK_UNLOCKED (rwlock_t) { 0, 0 }
89
90#define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while(0)
91 74
92/** 75/**
93 * read_can_lock - would read_trylock() succeed? 76 * read_can_lock - would read_trylock() succeed?
94 * @lock: the rwlock in question. 77 * @lock: the rwlock in question.
95 */ 78 */
96#define read_can_lock(x) ((int)(x)->lock >= 0) 79#define __raw_read_can_lock(x) ((int)(x)->lock >= 0)
97 80
98/** 81/**
99 * write_can_lock - would write_trylock() succeed? 82 * write_can_lock - would write_trylock() succeed?
100 * @lock: the rwlock in question. 83 * @lock: the rwlock in question.
101 */ 84 */
102#define write_can_lock(x) ((x)->lock == 0) 85#define __raw_write_can_lock(x) ((x)->lock == 0)
103 86
104extern void _raw_read_lock_wait(rwlock_t *lp); 87extern void _raw_read_lock_wait(raw_rwlock_t *lp);
105extern int _raw_read_trylock_retry(rwlock_t *lp); 88extern int _raw_read_trylock_retry(raw_rwlock_t *lp);
106extern void _raw_write_lock_wait(rwlock_t *lp); 89extern void _raw_write_lock_wait(raw_rwlock_t *lp);
107extern int _raw_write_trylock_retry(rwlock_t *lp); 90extern int _raw_write_trylock_retry(raw_rwlock_t *lp);
108 91
109static inline void _raw_read_lock(rwlock_t *rw) 92static inline void __raw_read_lock(raw_rwlock_t *rw)
110{ 93{
111 unsigned int old; 94 unsigned int old;
112 old = rw->lock & 0x7fffffffU; 95 old = rw->lock & 0x7fffffffU;
@@ -114,7 +97,7 @@ static inline void _raw_read_lock(rwlock_t *rw)
114 _raw_read_lock_wait(rw); 97 _raw_read_lock_wait(rw);
115} 98}
116 99
117static inline void _raw_read_unlock(rwlock_t *rw) 100static inline void __raw_read_unlock(raw_rwlock_t *rw)
118{ 101{
119 unsigned int old, cmp; 102 unsigned int old, cmp;
120 103
@@ -125,18 +108,18 @@ static inline void _raw_read_unlock(rwlock_t *rw)
125 } while (cmp != old); 108 } while (cmp != old);
126} 109}
127 110
128static inline void _raw_write_lock(rwlock_t *rw) 111static inline void __raw_write_lock(raw_rwlock_t *rw)
129{ 112{
130 if (unlikely(_raw_compare_and_swap(&rw->lock, 0, 0x80000000) != 0)) 113 if (unlikely(_raw_compare_and_swap(&rw->lock, 0, 0x80000000) != 0))
131 _raw_write_lock_wait(rw); 114 _raw_write_lock_wait(rw);
132} 115}
133 116
134static inline void _raw_write_unlock(rwlock_t *rw) 117static inline void __raw_write_unlock(raw_rwlock_t *rw)
135{ 118{
136 _raw_compare_and_swap(&rw->lock, 0x80000000, 0); 119 _raw_compare_and_swap(&rw->lock, 0x80000000, 0);
137} 120}
138 121
139static inline int _raw_read_trylock(rwlock_t *rw) 122static inline int __raw_read_trylock(raw_rwlock_t *rw)
140{ 123{
141 unsigned int old; 124 unsigned int old;
142 old = rw->lock & 0x7fffffffU; 125 old = rw->lock & 0x7fffffffU;
@@ -145,7 +128,7 @@ static inline int _raw_read_trylock(rwlock_t *rw)
145 return _raw_read_trylock_retry(rw); 128 return _raw_read_trylock_retry(rw);
146} 129}
147 130
148static inline int _raw_write_trylock(rwlock_t *rw) 131static inline int __raw_write_trylock(raw_rwlock_t *rw)
149{ 132{
150 if (likely(_raw_compare_and_swap(&rw->lock, 0, 0x80000000) == 0)) 133 if (likely(_raw_compare_and_swap(&rw->lock, 0, 0x80000000) == 0))
151 return 1; 134 return 1;
diff --git a/include/asm-s390/spinlock_types.h b/include/asm-s390/spinlock_types.h
new file mode 100644
index 000000000000..f79a2216204f
--- /dev/null
+++ b/include/asm-s390/spinlock_types.h
@@ -0,0 +1,21 @@
1#ifndef __ASM_SPINLOCK_TYPES_H
2#define __ASM_SPINLOCK_TYPES_H
3
4#ifndef __LINUX_SPINLOCK_TYPES_H
5# error "please don't include this file directly"
6#endif
7
8typedef struct {
9 volatile unsigned int lock;
10} __attribute__ ((aligned (4))) raw_spinlock_t;
11
12#define __RAW_SPIN_LOCK_UNLOCKED { 0 }
13
14typedef struct {
15 volatile unsigned int lock;
16 volatile unsigned int owner_pc;
17} raw_rwlock_t;
18
19#define __RAW_RW_LOCK_UNLOCKED { 0, 0 }
20
21#endif
diff --git a/include/asm-sh/irq.h b/include/asm-sh/irq.h
index 831e52ee45b5..614a8c13b721 100644
--- a/include/asm-sh/irq.h
+++ b/include/asm-sh/irq.h
@@ -587,10 +587,6 @@ static inline int generic_irq_demux(int irq)
587#define irq_canonicalize(irq) (irq) 587#define irq_canonicalize(irq) (irq)
588#define irq_demux(irq) __irq_demux(sh_mv.mv_irq_demux(irq)) 588#define irq_demux(irq) __irq_demux(sh_mv.mv_irq_demux(irq))
589 589
590struct irqaction;
591struct pt_regs;
592int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *);
593
594#if defined(CONFIG_CPU_SUBTYPE_SH73180) 590#if defined(CONFIG_CPU_SUBTYPE_SH73180)
595#include <asm/irq-sh73180.h> 591#include <asm/irq-sh73180.h>
596#endif 592#endif
diff --git a/include/asm-sh/spinlock.h b/include/asm-sh/spinlock.h
index e770b55649eb..846322d4c35d 100644
--- a/include/asm-sh/spinlock.h
+++ b/include/asm-sh/spinlock.h
@@ -15,20 +15,11 @@
15/* 15/*
16 * Your basic SMP spinlocks, allowing only a single CPU anywhere 16 * Your basic SMP spinlocks, allowing only a single CPU anywhere
17 */ 17 */
18typedef struct {
19 volatile unsigned long lock;
20#ifdef CONFIG_PREEMPT
21 unsigned int break_lock;
22#endif
23} spinlock_t;
24 18
25#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 } 19#define __raw_spin_is_locked(x) ((x)->lock != 0)
26 20#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock)
27#define spin_lock_init(x) do { *(x) = SPIN_LOCK_UNLOCKED; } while(0) 21#define __raw_spin_unlock_wait(x) \
28 22 do { cpu_relax(); } while (__raw_spin_is_locked(x))
29#define spin_is_locked(x) ((x)->lock != 0)
30#define spin_unlock_wait(x) do { barrier(); } while (spin_is_locked(x))
31#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock)
32 23
33/* 24/*
34 * Simple spin lock operations. There are two variants, one clears IRQ's 25 * Simple spin lock operations. There are two variants, one clears IRQ's
@@ -36,7 +27,7 @@ typedef struct {
36 * 27 *
37 * We make no fairness assumptions. They have a cost. 28 * We make no fairness assumptions. They have a cost.
38 */ 29 */
39static inline void _raw_spin_lock(spinlock_t *lock) 30static inline void __raw_spin_lock(raw_spinlock_t *lock)
40{ 31{
41 __asm__ __volatile__ ( 32 __asm__ __volatile__ (
42 "1:\n\t" 33 "1:\n\t"
@@ -49,14 +40,14 @@ static inline void _raw_spin_lock(spinlock_t *lock)
49 ); 40 );
50} 41}
51 42
52static inline void _raw_spin_unlock(spinlock_t *lock) 43static inline void __raw_spin_unlock(raw_spinlock_t *lock)
53{ 44{
54 assert_spin_locked(lock); 45 assert_spin_locked(lock);
55 46
56 lock->lock = 0; 47 lock->lock = 0;
57} 48}
58 49
59#define _raw_spin_trylock(x) (!test_and_set_bit(0, &(x)->lock)) 50#define __raw_spin_trylock(x) (!test_and_set_bit(0, &(x)->lock))
60 51
61/* 52/*
62 * Read-write spinlocks, allowing multiple readers but only one writer. 53 * Read-write spinlocks, allowing multiple readers but only one writer.
@@ -66,51 +57,40 @@ static inline void _raw_spin_unlock(spinlock_t *lock)
66 * needs to get a irq-safe write-lock, but readers can get non-irqsafe 57 * needs to get a irq-safe write-lock, but readers can get non-irqsafe
67 * read-locks. 58 * read-locks.
68 */ 59 */
69typedef struct { 60
70 spinlock_t lock; 61static inline void __raw_read_lock(raw_rwlock_t *rw)
71 atomic_t counter;
72#ifdef CONFIG_PREEMPT
73 unsigned int break_lock;
74#endif
75} rwlock_t;
76
77#define RW_LOCK_BIAS 0x01000000
78#define RW_LOCK_UNLOCKED (rwlock_t) { { 0 }, { RW_LOCK_BIAS } }
79#define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while (0)
80
81static inline void _raw_read_lock(rwlock_t *rw)
82{ 62{
83 _raw_spin_lock(&rw->lock); 63 __raw_spin_lock(&rw->lock);
84 64
85 atomic_inc(&rw->counter); 65 atomic_inc(&rw->counter);
86 66
87 _raw_spin_unlock(&rw->lock); 67 __raw_spin_unlock(&rw->lock);
88} 68}
89 69
90static inline void _raw_read_unlock(rwlock_t *rw) 70static inline void __raw_read_unlock(raw_rwlock_t *rw)
91{ 71{
92 _raw_spin_lock(&rw->lock); 72 __raw_spin_lock(&rw->lock);
93 73
94 atomic_dec(&rw->counter); 74 atomic_dec(&rw->counter);
95 75
96 _raw_spin_unlock(&rw->lock); 76 __raw_spin_unlock(&rw->lock);
97} 77}
98 78
99static inline void _raw_write_lock(rwlock_t *rw) 79static inline void __raw_write_lock(raw_rwlock_t *rw)
100{ 80{
101 _raw_spin_lock(&rw->lock); 81 __raw_spin_lock(&rw->lock);
102 atomic_set(&rw->counter, -1); 82 atomic_set(&rw->counter, -1);
103} 83}
104 84
105static inline void _raw_write_unlock(rwlock_t *rw) 85static inline void __raw_write_unlock(raw_rwlock_t *rw)
106{ 86{
107 atomic_set(&rw->counter, 0); 87 atomic_set(&rw->counter, 0);
108 _raw_spin_unlock(&rw->lock); 88 __raw_spin_unlock(&rw->lock);
109} 89}
110 90
111#define _raw_read_trylock(lock) generic_raw_read_trylock(lock) 91#define __raw_read_trylock(lock) generic__raw_read_trylock(lock)
112 92
113static inline int _raw_write_trylock(rwlock_t *rw) 93static inline int __raw_write_trylock(raw_rwlock_t *rw)
114{ 94{
115 if (atomic_sub_and_test(RW_LOCK_BIAS, &rw->counter)) 95 if (atomic_sub_and_test(RW_LOCK_BIAS, &rw->counter))
116 return 1; 96 return 1;
@@ -121,4 +101,3 @@ static inline int _raw_write_trylock(rwlock_t *rw)
121} 101}
122 102
123#endif /* __ASM_SH_SPINLOCK_H */ 103#endif /* __ASM_SH_SPINLOCK_H */
124
diff --git a/include/asm-sh/spinlock_types.h b/include/asm-sh/spinlock_types.h
new file mode 100644
index 000000000000..8c41b6c3aac8
--- /dev/null
+++ b/include/asm-sh/spinlock_types.h
@@ -0,0 +1,22 @@
1#ifndef __ASM_SH_SPINLOCK_TYPES_H
2#define __ASM_SH_SPINLOCK_TYPES_H
3
4#ifndef __LINUX_SPINLOCK_TYPES_H
5# error "please don't include this file directly"
6#endif
7
8typedef struct {
9 volatile unsigned long lock;
10} raw_spinlock_t;
11
12#define __SPIN_LOCK_UNLOCKED { 0 }
13
14typedef struct {
15 raw_spinlock_t lock;
16 atomic_t counter;
17} raw_rwlock_t;
18
19#define RW_LOCK_BIAS 0x01000000
20#define __RAW_RW_LOCK_UNLOCKED { { 0 }, { RW_LOCK_BIAS } }
21
22#endif
diff --git a/include/asm-sparc/ptrace.h b/include/asm-sparc/ptrace.h
index dd9d94d7e0ae..a8ecb2d6977a 100644
--- a/include/asm-sparc/ptrace.h
+++ b/include/asm-sparc/ptrace.h
@@ -73,11 +73,11 @@ extern void show_regs(struct pt_regs *);
73#endif 73#endif
74 74
75/* 75/*
76 * The asm_offsets.h is a generated file, so we cannot include it. 76 * The asm-offsets.h is a generated file, so we cannot include it.
77 * It may be OK for glibc headers, but it's utterly pointless for C code. 77 * It may be OK for glibc headers, but it's utterly pointless for C code.
78 * The assembly code using those offsets has to include it explicitly. 78 * The assembly code using those offsets has to include it explicitly.
79 */ 79 */
80/* #include <asm/asm_offsets.h> */ 80/* #include <asm/asm-offsets.h> */
81 81
82/* These are for pt_regs. */ 82/* These are for pt_regs. */
83#define PT_PSR 0x0 83#define PT_PSR 0x0
diff --git a/include/asm-sparc/spinlock.h b/include/asm-sparc/spinlock.h
index 0cbd87ad4912..111727a2bb4e 100644
--- a/include/asm-sparc/spinlock.h
+++ b/include/asm-sparc/spinlock.h
@@ -12,96 +12,12 @@
12 12
13#include <asm/psr.h> 13#include <asm/psr.h>
14 14
15#ifdef CONFIG_DEBUG_SPINLOCK 15#define __raw_spin_is_locked(lock) (*((volatile unsigned char *)(lock)) != 0)
16struct _spinlock_debug {
17 unsigned char lock;
18 unsigned long owner_pc;
19#ifdef CONFIG_PREEMPT
20 unsigned int break_lock;
21#endif
22};
23typedef struct _spinlock_debug spinlock_t;
24
25#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0, 0 }
26#define spin_lock_init(lp) do { *(lp)= SPIN_LOCK_UNLOCKED; } while(0)
27#define spin_is_locked(lp) (*((volatile unsigned char *)(&((lp)->lock))) != 0)
28#define spin_unlock_wait(lp) do { barrier(); } while(*(volatile unsigned char *)(&(lp)->lock))
29
30extern void _do_spin_lock(spinlock_t *lock, char *str);
31extern int _spin_trylock(spinlock_t *lock);
32extern void _do_spin_unlock(spinlock_t *lock);
33
34#define _raw_spin_trylock(lp) _spin_trylock(lp)
35#define _raw_spin_lock(lock) _do_spin_lock(lock, "spin_lock")
36#define _raw_spin_unlock(lock) _do_spin_unlock(lock)
37
38struct _rwlock_debug {
39 volatile unsigned int lock;
40 unsigned long owner_pc;
41 unsigned long reader_pc[NR_CPUS];
42#ifdef CONFIG_PREEMPT
43 unsigned int break_lock;
44#endif
45};
46typedef struct _rwlock_debug rwlock_t;
47
48#define RW_LOCK_UNLOCKED (rwlock_t) { 0, 0, {0} }
49
50#define rwlock_init(lp) do { *(lp)= RW_LOCK_UNLOCKED; } while(0)
51
52extern void _do_read_lock(rwlock_t *rw, char *str);
53extern void _do_read_unlock(rwlock_t *rw, char *str);
54extern void _do_write_lock(rwlock_t *rw, char *str);
55extern void _do_write_unlock(rwlock_t *rw);
56
57#define _raw_read_lock(lock) \
58do { unsigned long flags; \
59 local_irq_save(flags); \
60 _do_read_lock(lock, "read_lock"); \
61 local_irq_restore(flags); \
62} while(0)
63
64#define _raw_read_unlock(lock) \
65do { unsigned long flags; \
66 local_irq_save(flags); \
67 _do_read_unlock(lock, "read_unlock"); \
68 local_irq_restore(flags); \
69} while(0)
70
71#define _raw_write_lock(lock) \
72do { unsigned long flags; \
73 local_irq_save(flags); \
74 _do_write_lock(lock, "write_lock"); \
75 local_irq_restore(flags); \
76} while(0)
77
78#define _raw_write_unlock(lock) \
79do { unsigned long flags; \
80 local_irq_save(flags); \
81 _do_write_unlock(lock); \
82 local_irq_restore(flags); \
83} while(0)
84
85#else /* !CONFIG_DEBUG_SPINLOCK */
86
87typedef struct {
88 unsigned char lock;
89#ifdef CONFIG_PREEMPT
90 unsigned int break_lock;
91#endif
92} spinlock_t;
93
94#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 }
95
96#define spin_lock_init(lock) (*((unsigned char *)(lock)) = 0)
97#define spin_is_locked(lock) (*((volatile unsigned char *)(lock)) != 0)
98 16
99#define spin_unlock_wait(lock) \ 17#define __raw_spin_unlock_wait(lock) \
100do { \ 18 do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0)
101 barrier(); \
102} while(*((volatile unsigned char *)lock))
103 19
104extern __inline__ void _raw_spin_lock(spinlock_t *lock) 20extern __inline__ void __raw_spin_lock(raw_spinlock_t *lock)
105{ 21{
106 __asm__ __volatile__( 22 __asm__ __volatile__(
107 "\n1:\n\t" 23 "\n1:\n\t"
@@ -121,7 +37,7 @@ extern __inline__ void _raw_spin_lock(spinlock_t *lock)
121 : "g2", "memory", "cc"); 37 : "g2", "memory", "cc");
122} 38}
123 39
124extern __inline__ int _raw_spin_trylock(spinlock_t *lock) 40extern __inline__ int __raw_spin_trylock(raw_spinlock_t *lock)
125{ 41{
126 unsigned int result; 42 unsigned int result;
127 __asm__ __volatile__("ldstub [%1], %0" 43 __asm__ __volatile__("ldstub [%1], %0"
@@ -131,7 +47,7 @@ extern __inline__ int _raw_spin_trylock(spinlock_t *lock)
131 return (result == 0); 47 return (result == 0);
132} 48}
133 49
134extern __inline__ void _raw_spin_unlock(spinlock_t *lock) 50extern __inline__ void __raw_spin_unlock(raw_spinlock_t *lock)
135{ 51{
136 __asm__ __volatile__("stb %%g0, [%0]" : : "r" (lock) : "memory"); 52 __asm__ __volatile__("stb %%g0, [%0]" : : "r" (lock) : "memory");
137} 53}
@@ -147,23 +63,11 @@ extern __inline__ void _raw_spin_unlock(spinlock_t *lock)
147 * 63 *
148 * XXX This might create some problems with my dual spinlock 64 * XXX This might create some problems with my dual spinlock
149 * XXX scheme, deadlocks etc. -DaveM 65 * XXX scheme, deadlocks etc. -DaveM
150 */ 66 *
151typedef struct { 67 * Sort of like atomic_t's on Sparc, but even more clever.
152 volatile unsigned int lock;
153#ifdef CONFIG_PREEMPT
154 unsigned int break_lock;
155#endif
156} rwlock_t;
157
158#define RW_LOCK_UNLOCKED (rwlock_t) { 0 }
159
160#define rwlock_init(lp) do { *(lp)= RW_LOCK_UNLOCKED; } while(0)
161
162
163/* Sort of like atomic_t's on Sparc, but even more clever.
164 * 68 *
165 * ------------------------------------ 69 * ------------------------------------
166 * | 24-bit counter | wlock | rwlock_t 70 * | 24-bit counter | wlock | raw_rwlock_t
167 * ------------------------------------ 71 * ------------------------------------
168 * 31 8 7 0 72 * 31 8 7 0
169 * 73 *
@@ -174,9 +78,9 @@ typedef struct {
174 * 78 *
175 * Unfortunately this scheme limits us to ~16,000,000 cpus. 79 * Unfortunately this scheme limits us to ~16,000,000 cpus.
176 */ 80 */
177extern __inline__ void _read_lock(rwlock_t *rw) 81extern __inline__ void __read_lock(raw_rwlock_t *rw)
178{ 82{
179 register rwlock_t *lp asm("g1"); 83 register raw_rwlock_t *lp asm("g1");
180 lp = rw; 84 lp = rw;
181 __asm__ __volatile__( 85 __asm__ __volatile__(
182 "mov %%o7, %%g4\n\t" 86 "mov %%o7, %%g4\n\t"
@@ -187,16 +91,16 @@ extern __inline__ void _read_lock(rwlock_t *rw)
187 : "g2", "g4", "memory", "cc"); 91 : "g2", "g4", "memory", "cc");
188} 92}
189 93
190#define _raw_read_lock(lock) \ 94#define __raw_read_lock(lock) \
191do { unsigned long flags; \ 95do { unsigned long flags; \
192 local_irq_save(flags); \ 96 local_irq_save(flags); \
193 _read_lock(lock); \ 97 __raw_read_lock(lock); \
194 local_irq_restore(flags); \ 98 local_irq_restore(flags); \
195} while(0) 99} while(0)
196 100
197extern __inline__ void _read_unlock(rwlock_t *rw) 101extern __inline__ void __read_unlock(raw_rwlock_t *rw)
198{ 102{
199 register rwlock_t *lp asm("g1"); 103 register raw_rwlock_t *lp asm("g1");
200 lp = rw; 104 lp = rw;
201 __asm__ __volatile__( 105 __asm__ __volatile__(
202 "mov %%o7, %%g4\n\t" 106 "mov %%o7, %%g4\n\t"
@@ -207,16 +111,16 @@ extern __inline__ void _read_unlock(rwlock_t *rw)
207 : "g2", "g4", "memory", "cc"); 111 : "g2", "g4", "memory", "cc");
208} 112}
209 113
210#define _raw_read_unlock(lock) \ 114#define __raw_read_unlock(lock) \
211do { unsigned long flags; \ 115do { unsigned long flags; \
212 local_irq_save(flags); \ 116 local_irq_save(flags); \
213 _read_unlock(lock); \ 117 __raw_read_unlock(lock); \
214 local_irq_restore(flags); \ 118 local_irq_restore(flags); \
215} while(0) 119} while(0)
216 120
217extern __inline__ void _raw_write_lock(rwlock_t *rw) 121extern __inline__ void __raw_write_lock(raw_rwlock_t *rw)
218{ 122{
219 register rwlock_t *lp asm("g1"); 123 register raw_rwlock_t *lp asm("g1");
220 lp = rw; 124 lp = rw;
221 __asm__ __volatile__( 125 __asm__ __volatile__(
222 "mov %%o7, %%g4\n\t" 126 "mov %%o7, %%g4\n\t"
@@ -227,11 +131,9 @@ extern __inline__ void _raw_write_lock(rwlock_t *rw)
227 : "g2", "g4", "memory", "cc"); 131 : "g2", "g4", "memory", "cc");
228} 132}
229 133
230#define _raw_write_unlock(rw) do { (rw)->lock = 0; } while(0) 134#define __raw_write_unlock(rw) do { (rw)->lock = 0; } while(0)
231
232#endif /* CONFIG_DEBUG_SPINLOCK */
233 135
234#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) 136#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock)
235 137
236#endif /* !(__ASSEMBLY__) */ 138#endif /* !(__ASSEMBLY__) */
237 139
diff --git a/include/asm-sparc/spinlock_types.h b/include/asm-sparc/spinlock_types.h
new file mode 100644
index 000000000000..0a0fb116c4ec
--- /dev/null
+++ b/include/asm-sparc/spinlock_types.h
@@ -0,0 +1,20 @@
1#ifndef __SPARC_SPINLOCK_TYPES_H
2#define __SPARC_SPINLOCK_TYPES_H
3
4#ifndef __LINUX_SPINLOCK_TYPES_H
5# error "please don't include this file directly"
6#endif
7
8typedef struct {
9 unsigned char lock;
10} raw_spinlock_t;
11
12#define __RAW_SPIN_LOCK_UNLOCKED { 0 }
13
14typedef struct {
15 volatile unsigned int lock;
16} raw_rwlock_t;
17
18#define __RAW_RW_LOCK_UNLOCKED { 0 }
19
20#endif
diff --git a/include/asm-sparc64/pci.h b/include/asm-sparc64/pci.h
index a4ab0ec7143a..89bd71b1c0d8 100644
--- a/include/asm-sparc64/pci.h
+++ b/include/asm-sparc64/pci.h
@@ -269,6 +269,8 @@ extern void
269pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, 269pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
270 struct pci_bus_region *region); 270 struct pci_bus_region *region);
271 271
272extern struct resource *pcibios_select_root(struct pci_dev *, struct resource *);
273
272static inline void pcibios_add_platform_entries(struct pci_dev *dev) 274static inline void pcibios_add_platform_entries(struct pci_dev *dev)
273{ 275{
274} 276}
diff --git a/include/asm-sparc64/spinlock.h b/include/asm-sparc64/spinlock.h
index a02c4370eb42..ec85d12d73b9 100644
--- a/include/asm-sparc64/spinlock.h
+++ b/include/asm-sparc64/spinlock.h
@@ -29,24 +29,13 @@
29 * must be pre-V9 branches. 29 * must be pre-V9 branches.
30 */ 30 */
31 31
32#ifndef CONFIG_DEBUG_SPINLOCK 32#define __raw_spin_is_locked(lp) ((lp)->lock != 0)
33 33
34typedef struct { 34#define __raw_spin_unlock_wait(lp) \
35 volatile unsigned char lock; 35 do { rmb(); \
36#ifdef CONFIG_PREEMPT 36 } while((lp)->lock)
37 unsigned int break_lock;
38#endif
39} spinlock_t;
40#define SPIN_LOCK_UNLOCKED (spinlock_t) {0,}
41 37
42#define spin_lock_init(lp) do { *(lp)= SPIN_LOCK_UNLOCKED; } while(0) 38static inline void __raw_spin_lock(raw_spinlock_t *lock)
43#define spin_is_locked(lp) ((lp)->lock != 0)
44
45#define spin_unlock_wait(lp) \
46do { rmb(); \
47} while((lp)->lock)
48
49static inline void _raw_spin_lock(spinlock_t *lock)
50{ 39{
51 unsigned long tmp; 40 unsigned long tmp;
52 41
@@ -67,7 +56,7 @@ static inline void _raw_spin_lock(spinlock_t *lock)
67 : "memory"); 56 : "memory");
68} 57}
69 58
70static inline int _raw_spin_trylock(spinlock_t *lock) 59static inline int __raw_spin_trylock(raw_spinlock_t *lock)
71{ 60{
72 unsigned long result; 61 unsigned long result;
73 62
@@ -81,7 +70,7 @@ static inline int _raw_spin_trylock(spinlock_t *lock)
81 return (result == 0UL); 70 return (result == 0UL);
82} 71}
83 72
84static inline void _raw_spin_unlock(spinlock_t *lock) 73static inline void __raw_spin_unlock(raw_spinlock_t *lock)
85{ 74{
86 __asm__ __volatile__( 75 __asm__ __volatile__(
87" membar #StoreStore | #LoadStore\n" 76" membar #StoreStore | #LoadStore\n"
@@ -91,7 +80,7 @@ static inline void _raw_spin_unlock(spinlock_t *lock)
91 : "memory"); 80 : "memory");
92} 81}
93 82
94static inline void _raw_spin_lock_flags(spinlock_t *lock, unsigned long flags) 83static inline void __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long flags)
95{ 84{
96 unsigned long tmp1, tmp2; 85 unsigned long tmp1, tmp2;
97 86
@@ -115,51 +104,9 @@ static inline void _raw_spin_lock_flags(spinlock_t *lock, unsigned long flags)
115 : "memory"); 104 : "memory");
116} 105}
117 106
118#else /* !(CONFIG_DEBUG_SPINLOCK) */
119
120typedef struct {
121 volatile unsigned char lock;
122 unsigned int owner_pc, owner_cpu;
123#ifdef CONFIG_PREEMPT
124 unsigned int break_lock;
125#endif
126} spinlock_t;
127#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0, 0, 0xff }
128#define spin_lock_init(lp) do { *(lp)= SPIN_LOCK_UNLOCKED; } while(0)
129#define spin_is_locked(__lock) ((__lock)->lock != 0)
130#define spin_unlock_wait(__lock) \
131do { \
132 rmb(); \
133} while((__lock)->lock)
134
135extern void _do_spin_lock(spinlock_t *lock, char *str, unsigned long caller);
136extern void _do_spin_unlock(spinlock_t *lock);
137extern int _do_spin_trylock(spinlock_t *lock, unsigned long caller);
138
139#define _raw_spin_trylock(lp) \
140 _do_spin_trylock(lp, (unsigned long) __builtin_return_address(0))
141#define _raw_spin_lock(lock) \
142 _do_spin_lock(lock, "spin_lock", \
143 (unsigned long) __builtin_return_address(0))
144#define _raw_spin_unlock(lock) _do_spin_unlock(lock)
145#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock)
146
147#endif /* CONFIG_DEBUG_SPINLOCK */
148
149/* Multi-reader locks, these are much saner than the 32-bit Sparc ones... */ 107/* Multi-reader locks, these are much saner than the 32-bit Sparc ones... */
150 108
151#ifndef CONFIG_DEBUG_SPINLOCK 109static void inline __read_lock(raw_rwlock_t *lock)
152
153typedef struct {
154 volatile unsigned int lock;
155#ifdef CONFIG_PREEMPT
156 unsigned int break_lock;
157#endif
158} rwlock_t;
159#define RW_LOCK_UNLOCKED (rwlock_t) {0,}
160#define rwlock_init(lp) do { *(lp) = RW_LOCK_UNLOCKED; } while(0)
161
162static void inline __read_lock(rwlock_t *lock)
163{ 110{
164 unsigned long tmp1, tmp2; 111 unsigned long tmp1, tmp2;
165 112
@@ -184,7 +131,7 @@ static void inline __read_lock(rwlock_t *lock)
184 : "memory"); 131 : "memory");
185} 132}
186 133
187static void inline __read_unlock(rwlock_t *lock) 134static void inline __read_unlock(raw_rwlock_t *lock)
188{ 135{
189 unsigned long tmp1, tmp2; 136 unsigned long tmp1, tmp2;
190 137
@@ -201,7 +148,7 @@ static void inline __read_unlock(rwlock_t *lock)
201 : "memory"); 148 : "memory");
202} 149}
203 150
204static void inline __write_lock(rwlock_t *lock) 151static void inline __write_lock(raw_rwlock_t *lock)
205{ 152{
206 unsigned long mask, tmp1, tmp2; 153 unsigned long mask, tmp1, tmp2;
207 154
@@ -228,7 +175,7 @@ static void inline __write_lock(rwlock_t *lock)
228 : "memory"); 175 : "memory");
229} 176}
230 177
231static void inline __write_unlock(rwlock_t *lock) 178static void inline __write_unlock(raw_rwlock_t *lock)
232{ 179{
233 __asm__ __volatile__( 180 __asm__ __volatile__(
234" membar #LoadStore | #StoreStore\n" 181" membar #LoadStore | #StoreStore\n"
@@ -238,7 +185,7 @@ static void inline __write_unlock(rwlock_t *lock)
238 : "memory"); 185 : "memory");
239} 186}
240 187
241static int inline __write_trylock(rwlock_t *lock) 188static int inline __write_trylock(raw_rwlock_t *lock)
242{ 189{
243 unsigned long mask, tmp1, tmp2, result; 190 unsigned long mask, tmp1, tmp2, result;
244 191
@@ -263,78 +210,15 @@ static int inline __write_trylock(rwlock_t *lock)
263 return result; 210 return result;
264} 211}
265 212
266#define _raw_read_lock(p) __read_lock(p) 213#define __raw_read_lock(p) __read_lock(p)
267#define _raw_read_unlock(p) __read_unlock(p) 214#define __raw_read_unlock(p) __read_unlock(p)
268#define _raw_write_lock(p) __write_lock(p) 215#define __raw_write_lock(p) __write_lock(p)
269#define _raw_write_unlock(p) __write_unlock(p) 216#define __raw_write_unlock(p) __write_unlock(p)
270#define _raw_write_trylock(p) __write_trylock(p) 217#define __raw_write_trylock(p) __write_trylock(p)
271 218
272#else /* !(CONFIG_DEBUG_SPINLOCK) */ 219#define __raw_read_trylock(lock) generic__raw_read_trylock(lock)
273 220#define __raw_read_can_lock(rw) (!((rw)->lock & 0x80000000UL))
274typedef struct { 221#define __raw_write_can_lock(rw) (!(rw)->lock)
275 volatile unsigned long lock;
276 unsigned int writer_pc, writer_cpu;
277 unsigned int reader_pc[NR_CPUS];
278#ifdef CONFIG_PREEMPT
279 unsigned int break_lock;
280#endif
281} rwlock_t;
282#define RW_LOCK_UNLOCKED (rwlock_t) { 0, 0, 0xff, { } }
283#define rwlock_init(lp) do { *(lp) = RW_LOCK_UNLOCKED; } while(0)
284
285extern void _do_read_lock(rwlock_t *rw, char *str, unsigned long caller);
286extern void _do_read_unlock(rwlock_t *rw, char *str, unsigned long caller);
287extern void _do_write_lock(rwlock_t *rw, char *str, unsigned long caller);
288extern void _do_write_unlock(rwlock_t *rw, unsigned long caller);
289extern int _do_write_trylock(rwlock_t *rw, char *str, unsigned long caller);
290
291#define _raw_read_lock(lock) \
292do { unsigned long flags; \
293 local_irq_save(flags); \
294 _do_read_lock(lock, "read_lock", \
295 (unsigned long) __builtin_return_address(0)); \
296 local_irq_restore(flags); \
297} while(0)
298
299#define _raw_read_unlock(lock) \
300do { unsigned long flags; \
301 local_irq_save(flags); \
302 _do_read_unlock(lock, "read_unlock", \
303 (unsigned long) __builtin_return_address(0)); \
304 local_irq_restore(flags); \
305} while(0)
306
307#define _raw_write_lock(lock) \
308do { unsigned long flags; \
309 local_irq_save(flags); \
310 _do_write_lock(lock, "write_lock", \
311 (unsigned long) __builtin_return_address(0)); \
312 local_irq_restore(flags); \
313} while(0)
314
315#define _raw_write_unlock(lock) \
316do { unsigned long flags; \
317 local_irq_save(flags); \
318 _do_write_unlock(lock, \
319 (unsigned long) __builtin_return_address(0)); \
320 local_irq_restore(flags); \
321} while(0)
322
323#define _raw_write_trylock(lock) \
324({ unsigned long flags; \
325 int val; \
326 local_irq_save(flags); \
327 val = _do_write_trylock(lock, "write_trylock", \
328 (unsigned long) __builtin_return_address(0)); \
329 local_irq_restore(flags); \
330 val; \
331})
332
333#endif /* CONFIG_DEBUG_SPINLOCK */
334
335#define _raw_read_trylock(lock) generic_raw_read_trylock(lock)
336#define read_can_lock(rw) (!((rw)->lock & 0x80000000UL))
337#define write_can_lock(rw) (!(rw)->lock)
338 222
339#endif /* !(__ASSEMBLY__) */ 223#endif /* !(__ASSEMBLY__) */
340 224
diff --git a/include/asm-sparc64/spinlock_types.h b/include/asm-sparc64/spinlock_types.h
new file mode 100644
index 000000000000..e128112a0d7c
--- /dev/null
+++ b/include/asm-sparc64/spinlock_types.h
@@ -0,0 +1,20 @@
1#ifndef __SPARC64_SPINLOCK_TYPES_H
2#define __SPARC64_SPINLOCK_TYPES_H
3
4#ifndef __LINUX_SPINLOCK_TYPES_H
5# error "please don't include this file directly"
6#endif
7
8typedef struct {
9 volatile unsigned char lock;
10} raw_spinlock_t;
11
12#define __RAW_SPIN_LOCK_UNLOCKED { 0 }
13
14typedef struct {
15 volatile unsigned int lock;
16} raw_rwlock_t;
17
18#define __RAW_RW_LOCK_UNLOCKED { 0 }
19
20#endif
diff --git a/include/asm-sparc64/system.h b/include/asm-sparc64/system.h
index 5e94c05dc2fc..b5417529f6f1 100644
--- a/include/asm-sparc64/system.h
+++ b/include/asm-sparc64/system.h
@@ -28,13 +28,48 @@ enum sparc_cpu {
28#define ARCH_SUN4C_SUN4 0 28#define ARCH_SUN4C_SUN4 0
29#define ARCH_SUN4 0 29#define ARCH_SUN4 0
30 30
31extern void mb(void); 31/* These are here in an effort to more fully work around Spitfire Errata
32extern void rmb(void); 32 * #51. Essentially, if a memory barrier occurs soon after a mispredicted
33extern void wmb(void); 33 * branch, the chip can stop executing instructions until a trap occurs.
34extern void membar_storeload(void); 34 * Therefore, if interrupts are disabled, the chip can hang forever.
35extern void membar_storeload_storestore(void); 35 *
36extern void membar_storeload_loadload(void); 36 * It used to be believed that the memory barrier had to be right in the
37extern void membar_storestore_loadstore(void); 37 * delay slot, but a case has been traced recently wherein the memory barrier
38 * was one instruction after the branch delay slot and the chip still hung.
39 * The offending sequence was the following in sym_wakeup_done() of the
40 * sym53c8xx_2 driver:
41 *
42 * call sym_ccb_from_dsa, 0
43 * movge %icc, 0, %l0
44 * brz,pn %o0, .LL1303
45 * mov %o0, %l2
46 * membar #LoadLoad
47 *
48 * The branch has to be mispredicted for the bug to occur. Therefore, we put
49 * the memory barrier explicitly into a "branch always, predicted taken"
50 * delay slot to avoid the problem case.
51 */
52#define membar_safe(type) \
53do { __asm__ __volatile__("ba,pt %%xcc, 1f\n\t" \
54 " membar " type "\n" \
55 "1:\n" \
56 : : : "memory"); \
57} while (0)
58
59#define mb() \
60 membar_safe("#LoadLoad | #LoadStore | #StoreStore | #StoreLoad")
61#define rmb() \
62 membar_safe("#LoadLoad")
63#define wmb() \
64 membar_safe("#StoreStore")
65#define membar_storeload() \
66 membar_safe("#StoreLoad")
67#define membar_storeload_storestore() \
68 membar_safe("#StoreLoad | #StoreStore")
69#define membar_storeload_loadload() \
70 membar_safe("#StoreLoad | #LoadLoad")
71#define membar_storestore_loadstore() \
72 membar_safe("#StoreStore | #LoadStore")
38 73
39#endif 74#endif
40 75
diff --git a/include/asm-um/page.h b/include/asm-um/page.h
index bd850a249183..2c192abe9aeb 100644
--- a/include/asm-um/page.h
+++ b/include/asm-um/page.h
@@ -96,8 +96,7 @@ extern unsigned long uml_physmem;
96 96
97#define __va_space (8*1024*1024) 97#define __va_space (8*1024*1024)
98 98
99extern unsigned long to_phys(void *virt); 99#include "mem.h"
100extern void *to_virt(unsigned long phys);
101 100
102/* Cast to unsigned long before casting to void * to avoid a warning from 101/* Cast to unsigned long before casting to void * to avoid a warning from
103 * mmap_kmem about cutting a long long down to a void *. Not sure that 102 * mmap_kmem about cutting a long long down to a void *. Not sure that
diff --git a/include/asm-um/pgtable.h b/include/asm-um/pgtable.h
index b48e0966ecd7..ed06170e0edd 100644
--- a/include/asm-um/pgtable.h
+++ b/include/asm-um/pgtable.h
@@ -326,14 +326,22 @@ static inline void set_pte(pte_t *pteptr, pte_t pteval)
326} 326}
327#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval) 327#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
328 328
329extern phys_t page_to_phys(struct page *page);
330
331/* 329/*
332 * Conversion functions: convert a page and protection to a page entry, 330 * Conversion functions: convert a page and protection to a page entry,
333 * and a page entry and page directory to the page they refer to. 331 * and a page entry and page directory to the page they refer to.
334 */ 332 */
335 333
336extern pte_t mk_pte(struct page *page, pgprot_t pgprot); 334#define phys_to_page(phys) pfn_to_page(phys_to_pfn(phys))
335#define __virt_to_page(virt) phys_to_page(__pa(virt))
336#define page_to_phys(page) pfn_to_phys(page_to_pfn(page))
337
338#define mk_pte(page, pgprot) \
339 ({ pte_t pte; \
340 \
341 pte_set_val(pte, page_to_phys(page), (pgprot)); \
342 if (pte_present(pte)) \
343 pte_mknewprot(pte_mknewpage(pte)); \
344 pte;})
337 345
338static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) 346static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
339{ 347{
@@ -410,8 +418,6 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
410#endif 418#endif
411#endif 419#endif
412 420
413extern struct page *phys_to_page(const unsigned long phys);
414extern struct page *__virt_to_page(const unsigned long virt);
415#define virt_to_page(addr) __virt_to_page((const unsigned long) addr) 421#define virt_to_page(addr) __virt_to_page((const unsigned long) addr)
416 422
417/* 423/*
diff --git a/include/asm-um/spinlock_types.h b/include/asm-um/spinlock_types.h
new file mode 100644
index 000000000000..e5a94294bf82
--- /dev/null
+++ b/include/asm-um/spinlock_types.h
@@ -0,0 +1,6 @@
1#ifndef __UM_SPINLOCK_TYPES_H
2#define __UM_SPINLOCK_TYPES_H
3
4#include "asm/arch/spinlock_types.h"
5
6#endif
diff --git a/include/asm-x86_64/acpi.h b/include/asm-x86_64/acpi.h
index dc8c981af27f..aa1c7b2e438c 100644
--- a/include/asm-x86_64/acpi.h
+++ b/include/asm-x86_64/acpi.h
@@ -101,7 +101,7 @@ __acpi_release_global_lock (unsigned int *lock)
101 :"=r"(n_hi), "=r"(n_lo) \ 101 :"=r"(n_hi), "=r"(n_lo) \
102 :"0"(n_hi), "1"(n_lo)) 102 :"0"(n_hi), "1"(n_lo))
103 103
104#ifdef CONFIG_ACPI_BOOT 104#ifdef CONFIG_ACPI
105extern int acpi_lapic; 105extern int acpi_lapic;
106extern int acpi_ioapic; 106extern int acpi_ioapic;
107extern int acpi_noirq; 107extern int acpi_noirq;
@@ -121,17 +121,6 @@ static inline void disable_acpi(void)
121#define FIX_ACPI_PAGES 4 121#define FIX_ACPI_PAGES 4
122 122
123extern int acpi_gsi_to_irq(u32 gsi, unsigned int *irq); 123extern int acpi_gsi_to_irq(u32 gsi, unsigned int *irq);
124
125#else /* !CONFIG_ACPI_BOOT */
126#define acpi_lapic 0
127#define acpi_ioapic 0
128#endif /* !CONFIG_ACPI_BOOT */
129
130extern int acpi_numa;
131extern int acpi_scan_nodes(unsigned long start, unsigned long end);
132#define NR_NODE_MEMBLKS (MAX_NUMNODES*2)
133
134#ifdef CONFIG_ACPI_PCI
135static inline void acpi_noirq_set(void) { acpi_noirq = 1; } 124static inline void acpi_noirq_set(void) { acpi_noirq = 1; }
136static inline void acpi_disable_pci(void) 125static inline void acpi_disable_pci(void)
137{ 126{
@@ -139,11 +128,19 @@ static inline void acpi_disable_pci(void)
139 acpi_noirq_set(); 128 acpi_noirq_set();
140} 129}
141extern int acpi_irq_balance_set(char *str); 130extern int acpi_irq_balance_set(char *str);
142#else 131
132#else /* !CONFIG_ACPI */
133
134#define acpi_lapic 0
135#define acpi_ioapic 0
143static inline void acpi_noirq_set(void) { } 136static inline void acpi_noirq_set(void) { }
144static inline void acpi_disable_pci(void) { } 137static inline void acpi_disable_pci(void) { }
145static inline int acpi_irq_balance_set(char *str) { return 0; } 138
146#endif 139#endif /* !CONFIG_ACPI */
140
141extern int acpi_numa;
142extern int acpi_scan_nodes(unsigned long start, unsigned long end);
143#define NR_NODE_MEMBLKS (MAX_NUMNODES*2)
147 144
148#ifdef CONFIG_ACPI_SLEEP 145#ifdef CONFIG_ACPI_SLEEP
149 146
diff --git a/include/asm-x86_64/apic.h b/include/asm-x86_64/apic.h
index 16ec82e16b21..6c5d5ca8383a 100644
--- a/include/asm-x86_64/apic.h
+++ b/include/asm-x86_64/apic.h
@@ -109,9 +109,10 @@ extern unsigned int nmi_watchdog;
109#define NMI_LOCAL_APIC 2 109#define NMI_LOCAL_APIC 2
110#define NMI_INVALID 3 110#define NMI_INVALID 3
111 111
112extern int disable_timer_pin_1;
113
112#endif /* CONFIG_X86_LOCAL_APIC */ 114#endif /* CONFIG_X86_LOCAL_APIC */
113 115
114#define esr_disable 0
115extern unsigned boot_cpu_id; 116extern unsigned boot_cpu_id;
116 117
117#endif /* __ASM_APIC_H */ 118#endif /* __ASM_APIC_H */
diff --git a/include/asm-x86_64/apicdef.h b/include/asm-x86_64/apicdef.h
index 9388062c4f6e..fb1c99ac669f 100644
--- a/include/asm-x86_64/apicdef.h
+++ b/include/asm-x86_64/apicdef.h
@@ -113,6 +113,7 @@
113#define APIC_BASE (fix_to_virt(FIX_APIC_BASE)) 113#define APIC_BASE (fix_to_virt(FIX_APIC_BASE))
114 114
115#define MAX_IO_APICS 128 115#define MAX_IO_APICS 128
116#define MAX_LOCAL_APIC 256
116 117
117/* 118/*
118 * All x86-64 systems are xAPIC compatible. 119 * All x86-64 systems are xAPIC compatible.
diff --git a/include/asm-x86_64/bug.h b/include/asm-x86_64/bug.h
index eed785667289..80ac1fe966ac 100644
--- a/include/asm-x86_64/bug.h
+++ b/include/asm-x86_64/bug.h
@@ -9,10 +9,8 @@
9 */ 9 */
10struct bug_frame { 10struct bug_frame {
11 unsigned char ud2[2]; 11 unsigned char ud2[2];
12 unsigned char mov; 12 unsigned char push;
13 /* should use 32bit offset instead, but the assembler doesn't 13 signed int filename;
14 like it */
15 char *filename;
16 unsigned char ret; 14 unsigned char ret;
17 unsigned short line; 15 unsigned short line;
18} __attribute__((packed)); 16} __attribute__((packed));
@@ -25,8 +23,8 @@ struct bug_frame {
25 The magic numbers generate mov $64bitimm,%eax ; ret $offset. */ 23 The magic numbers generate mov $64bitimm,%eax ; ret $offset. */
26#define BUG() \ 24#define BUG() \
27 asm volatile( \ 25 asm volatile( \
28 "ud2 ; .byte 0xa3 ; .quad %c1 ; .byte 0xc2 ; .short %c0" :: \ 26 "ud2 ; pushq $%c1 ; ret $%c0" :: \
29 "i"(__LINE__), "i" (__stringify(__FILE__))) 27 "i"(__LINE__), "i" (__FILE__))
30void out_of_line_bug(void); 28void out_of_line_bug(void);
31#else 29#else
32static inline void out_of_line_bug(void) { } 30static inline void out_of_line_bug(void) { }
diff --git a/include/asm-x86_64/calling.h b/include/asm-x86_64/calling.h
index 0bc12655fa5b..fc2c5a6c262a 100644
--- a/include/asm-x86_64/calling.h
+++ b/include/asm-x86_64/calling.h
@@ -65,27 +65,36 @@
65 .if \skipr11 65 .if \skipr11
66 .else 66 .else
67 movq (%rsp),%r11 67 movq (%rsp),%r11
68 CFI_RESTORE r11
68 .endif 69 .endif
69 .if \skipr8910 70 .if \skipr8910
70 .else 71 .else
71 movq 1*8(%rsp),%r10 72 movq 1*8(%rsp),%r10
73 CFI_RESTORE r10
72 movq 2*8(%rsp),%r9 74 movq 2*8(%rsp),%r9
75 CFI_RESTORE r9
73 movq 3*8(%rsp),%r8 76 movq 3*8(%rsp),%r8
77 CFI_RESTORE r8
74 .endif 78 .endif
75 .if \skiprax 79 .if \skiprax
76 .else 80 .else
77 movq 4*8(%rsp),%rax 81 movq 4*8(%rsp),%rax
82 CFI_RESTORE rax
78 .endif 83 .endif
79 .if \skiprcx 84 .if \skiprcx
80 .else 85 .else
81 movq 5*8(%rsp),%rcx 86 movq 5*8(%rsp),%rcx
87 CFI_RESTORE rcx
82 .endif 88 .endif
83 .if \skiprdx 89 .if \skiprdx
84 .else 90 .else
85 movq 6*8(%rsp),%rdx 91 movq 6*8(%rsp),%rdx
92 CFI_RESTORE rdx
86 .endif 93 .endif
87 movq 7*8(%rsp),%rsi 94 movq 7*8(%rsp),%rsi
95 CFI_RESTORE rsi
88 movq 8*8(%rsp),%rdi 96 movq 8*8(%rsp),%rdi
97 CFI_RESTORE rdi
89 .if ARG_SKIP+\addskip > 0 98 .if ARG_SKIP+\addskip > 0
90 addq $ARG_SKIP+\addskip,%rsp 99 addq $ARG_SKIP+\addskip,%rsp
91 CFI_ADJUST_CFA_OFFSET -(ARG_SKIP+\addskip) 100 CFI_ADJUST_CFA_OFFSET -(ARG_SKIP+\addskip)
@@ -124,11 +133,17 @@
124 133
125 .macro RESTORE_REST 134 .macro RESTORE_REST
126 movq (%rsp),%r15 135 movq (%rsp),%r15
136 CFI_RESTORE r15
127 movq 1*8(%rsp),%r14 137 movq 1*8(%rsp),%r14
138 CFI_RESTORE r14
128 movq 2*8(%rsp),%r13 139 movq 2*8(%rsp),%r13
140 CFI_RESTORE r13
129 movq 3*8(%rsp),%r12 141 movq 3*8(%rsp),%r12
142 CFI_RESTORE r12
130 movq 4*8(%rsp),%rbp 143 movq 4*8(%rsp),%rbp
144 CFI_RESTORE rbp
131 movq 5*8(%rsp),%rbx 145 movq 5*8(%rsp),%rbx
146 CFI_RESTORE rbx
132 addq $REST_SKIP,%rsp 147 addq $REST_SKIP,%rsp
133 CFI_ADJUST_CFA_OFFSET -(REST_SKIP) 148 CFI_ADJUST_CFA_OFFSET -(REST_SKIP)
134 .endm 149 .endm
@@ -146,11 +161,3 @@
146 .macro icebp 161 .macro icebp
147 .byte 0xf1 162 .byte 0xf1
148 .endm 163 .endm
149
150#ifdef CONFIG_FRAME_POINTER
151#define ENTER enter
152#define LEAVE leave
153#else
154#define ENTER
155#define LEAVE
156#endif
diff --git a/include/asm-x86_64/current.h b/include/asm-x86_64/current.h
index 7db560ee6f70..bc8adecee66d 100644
--- a/include/asm-x86_64/current.h
+++ b/include/asm-x86_64/current.h
@@ -17,7 +17,7 @@ static inline struct task_struct *get_current(void)
17#else 17#else
18 18
19#ifndef ASM_OFFSET_H 19#ifndef ASM_OFFSET_H
20#include <asm/offset.h> 20#include <asm/asm-offsets.h>
21#endif 21#endif
22 22
23#define GET_CURRENT(reg) movq %gs:(pda_pcurrent),reg 23#define GET_CURRENT(reg) movq %gs:(pda_pcurrent),reg
diff --git a/include/asm-x86_64/desc.h b/include/asm-x86_64/desc.h
index c89b58bebee2..594e610f4a1e 100644
--- a/include/asm-x86_64/desc.h
+++ b/include/asm-x86_64/desc.h
@@ -191,7 +191,7 @@ static inline void load_TLS(struct thread_struct *t, unsigned int cpu)
191/* 191/*
192 * load one particular LDT into the current CPU 192 * load one particular LDT into the current CPU
193 */ 193 */
194extern inline void load_LDT_nolock (mm_context_t *pc, int cpu) 194static inline void load_LDT_nolock (mm_context_t *pc, int cpu)
195{ 195{
196 int count = pc->size; 196 int count = pc->size;
197 197
diff --git a/include/asm-x86_64/dma-mapping.h b/include/asm-x86_64/dma-mapping.h
index a416dc31634a..e784fdc524f1 100644
--- a/include/asm-x86_64/dma-mapping.h
+++ b/include/asm-x86_64/dma-mapping.h
@@ -85,6 +85,11 @@ static inline void dma_sync_single_for_device(struct device *hwdev,
85 flush_write_buffers(); 85 flush_write_buffers();
86} 86}
87 87
88#define dma_sync_single_range_for_cpu(dev, dma_handle, offset, size, dir) \
89 dma_sync_single_for_cpu(dev, dma_handle, size, dir)
90#define dma_sync_single_range_for_device(dev, dma_handle, offset, size, dir) \
91 dma_sync_single_for_device(dev, dma_handle, size, dir)
92
88static inline void dma_sync_sg_for_cpu(struct device *hwdev, 93static inline void dma_sync_sg_for_cpu(struct device *hwdev,
89 struct scatterlist *sg, 94 struct scatterlist *sg,
90 int nelems, int direction) 95 int nelems, int direction)
diff --git a/include/asm-x86_64/dwarf2.h b/include/asm-x86_64/dwarf2.h
index afd4212e860b..582757fc0365 100644
--- a/include/asm-x86_64/dwarf2.h
+++ b/include/asm-x86_64/dwarf2.h
@@ -24,6 +24,10 @@
24#define CFI_ADJUST_CFA_OFFSET .cfi_adjust_cfa_offset 24#define CFI_ADJUST_CFA_OFFSET .cfi_adjust_cfa_offset
25#define CFI_OFFSET .cfi_offset 25#define CFI_OFFSET .cfi_offset
26#define CFI_REL_OFFSET .cfi_rel_offset 26#define CFI_REL_OFFSET .cfi_rel_offset
27#define CFI_REGISTER .cfi_register
28#define CFI_RESTORE .cfi_restore
29#define CFI_REMEMBER_STATE .cfi_remember_state
30#define CFI_RESTORE_STATE .cfi_restore_state
27 31
28#else 32#else
29 33
@@ -36,6 +40,10 @@
36#define CFI_ADJUST_CFA_OFFSET # 40#define CFI_ADJUST_CFA_OFFSET #
37#define CFI_OFFSET # 41#define CFI_OFFSET #
38#define CFI_REL_OFFSET # 42#define CFI_REL_OFFSET #
43#define CFI_REGISTER #
44#define CFI_RESTORE #
45#define CFI_REMEMBER_STATE #
46#define CFI_RESTORE_STATE #
39 47
40#endif 48#endif
41 49
diff --git a/include/asm-x86_64/fixmap.h b/include/asm-x86_64/fixmap.h
index cf8b16cbe8db..a582cfcf2231 100644
--- a/include/asm-x86_64/fixmap.h
+++ b/include/asm-x86_64/fixmap.h
@@ -76,7 +76,7 @@ extern void __this_fixmap_does_not_exist(void);
76 * directly without translation, we catch the bug with a NULL-deference 76 * directly without translation, we catch the bug with a NULL-deference
77 * kernel oops. Illegal ranges of incoming indices are caught too. 77 * kernel oops. Illegal ranges of incoming indices are caught too.
78 */ 78 */
79extern inline unsigned long fix_to_virt(const unsigned int idx) 79static inline unsigned long fix_to_virt(const unsigned int idx)
80{ 80{
81 /* 81 /*
82 * this branch gets completely eliminated after inlining, 82 * this branch gets completely eliminated after inlining,
diff --git a/include/asm-x86_64/hardirq.h b/include/asm-x86_64/hardirq.h
index 27c381fa1c9d..8661b476fb40 100644
--- a/include/asm-x86_64/hardirq.h
+++ b/include/asm-x86_64/hardirq.h
@@ -9,11 +9,12 @@
9 9
10#define __ARCH_IRQ_STAT 1 10#define __ARCH_IRQ_STAT 1
11 11
12/* Generate a lvalue for a pda member. Should fix softirq.c instead to use 12#define local_softirq_pending() read_pda(__softirq_pending)
13 special access macros. This would generate better code. */
14#define __IRQ_STAT(cpu,member) (read_pda(me)->member)
15 13
16#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */ 14#define __ARCH_SET_SOFTIRQ_PENDING 1
15
16#define set_softirq_pending(x) write_pda(__softirq_pending, (x))
17#define or_softirq_pending(x) or_pda(__softirq_pending, (x))
17 18
18/* 19/*
19 * 'what should we do if we get a hw irq event on an illegal vector'. 20 * 'what should we do if we get a hw irq event on an illegal vector'.
diff --git a/include/asm-x86_64/hw_irq.h b/include/asm-x86_64/hw_irq.h
index 2b5cb2865d21..dc97668ea0f9 100644
--- a/include/asm-x86_64/hw_irq.h
+++ b/include/asm-x86_64/hw_irq.h
@@ -26,6 +26,7 @@
26struct hw_interrupt_type; 26struct hw_interrupt_type;
27#endif 27#endif
28 28
29#define NMI_VECTOR 0x02
29/* 30/*
30 * IDT vectors usable for external interrupt sources start 31 * IDT vectors usable for external interrupt sources start
31 * at 0x20: 32 * at 0x20:
@@ -50,14 +51,15 @@ struct hw_interrupt_type;
50 */ 51 */
51#define SPURIOUS_APIC_VECTOR 0xff 52#define SPURIOUS_APIC_VECTOR 0xff
52#define ERROR_APIC_VECTOR 0xfe 53#define ERROR_APIC_VECTOR 0xfe
53#define INVALIDATE_TLB_VECTOR 0xfd 54#define RESCHEDULE_VECTOR 0xfd
54#define RESCHEDULE_VECTOR 0xfc 55#define CALL_FUNCTION_VECTOR 0xfc
55#define TASK_MIGRATION_VECTOR 0xfb 56#define KDB_VECTOR 0xfb /* reserved for KDB */
56#define CALL_FUNCTION_VECTOR 0xfa 57#define THERMAL_APIC_VECTOR 0xfa
57#define KDB_VECTOR 0xf9 58/* 0xf9 free */
58 59#define INVALIDATE_TLB_VECTOR_END 0xf8
59#define THERMAL_APIC_VECTOR 0xf0 60#define INVALIDATE_TLB_VECTOR_START 0xf0 /* f0-f8 used for TLB flush */
60 61
62#define NUM_INVALIDATE_TLB_VECTORS 8
61 63
62/* 64/*
63 * Local APIC timer IRQ vector is on a different priority level, 65 * Local APIC timer IRQ vector is on a different priority level,
diff --git a/include/asm-x86_64/io.h b/include/asm-x86_64/io.h
index 37fc3f149a5a..52ff269fe054 100644
--- a/include/asm-x86_64/io.h
+++ b/include/asm-x86_64/io.h
@@ -48,7 +48,7 @@
48 * Talk about misusing macros.. 48 * Talk about misusing macros..
49 */ 49 */
50#define __OUT1(s,x) \ 50#define __OUT1(s,x) \
51extern inline void out##s(unsigned x value, unsigned short port) { 51static inline void out##s(unsigned x value, unsigned short port) {
52 52
53#define __OUT2(s,s1,s2) \ 53#define __OUT2(s,s1,s2) \
54__asm__ __volatile__ ("out" #s " %" s1 "0,%" s2 "1" 54__asm__ __volatile__ ("out" #s " %" s1 "0,%" s2 "1"
@@ -58,7 +58,7 @@ __OUT1(s,x) __OUT2(s,s1,"w") : : "a" (value), "Nd" (port)); } \
58__OUT1(s##_p,x) __OUT2(s,s1,"w") __FULL_SLOW_DOWN_IO : : "a" (value), "Nd" (port));} \ 58__OUT1(s##_p,x) __OUT2(s,s1,"w") __FULL_SLOW_DOWN_IO : : "a" (value), "Nd" (port));} \
59 59
60#define __IN1(s) \ 60#define __IN1(s) \
61extern inline RETURN_TYPE in##s(unsigned short port) { RETURN_TYPE _v; 61static inline RETURN_TYPE in##s(unsigned short port) { RETURN_TYPE _v;
62 62
63#define __IN2(s,s1,s2) \ 63#define __IN2(s,s1,s2) \
64__asm__ __volatile__ ("in" #s " %" s2 "1,%" s1 "0" 64__asm__ __volatile__ ("in" #s " %" s2 "1,%" s1 "0"
@@ -68,12 +68,12 @@ __IN1(s) __IN2(s,s1,"w") : "=a" (_v) : "Nd" (port) ,##i ); return _v; } \
68__IN1(s##_p) __IN2(s,s1,"w") __FULL_SLOW_DOWN_IO : "=a" (_v) : "Nd" (port) ,##i ); return _v; } \ 68__IN1(s##_p) __IN2(s,s1,"w") __FULL_SLOW_DOWN_IO : "=a" (_v) : "Nd" (port) ,##i ); return _v; } \
69 69
70#define __INS(s) \ 70#define __INS(s) \
71extern inline void ins##s(unsigned short port, void * addr, unsigned long count) \ 71static inline void ins##s(unsigned short port, void * addr, unsigned long count) \
72{ __asm__ __volatile__ ("rep ; ins" #s \ 72{ __asm__ __volatile__ ("rep ; ins" #s \
73: "=D" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); } 73: "=D" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); }
74 74
75#define __OUTS(s) \ 75#define __OUTS(s) \
76extern inline void outs##s(unsigned short port, const void * addr, unsigned long count) \ 76static inline void outs##s(unsigned short port, const void * addr, unsigned long count) \
77{ __asm__ __volatile__ ("rep ; outs" #s \ 77{ __asm__ __volatile__ ("rep ; outs" #s \
78: "=S" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); } 78: "=S" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); }
79 79
@@ -110,12 +110,12 @@ __OUTS(l)
110 * Change virtual addresses to physical addresses and vv. 110 * Change virtual addresses to physical addresses and vv.
111 * These are pretty trivial 111 * These are pretty trivial
112 */ 112 */
113extern inline unsigned long virt_to_phys(volatile void * address) 113static inline unsigned long virt_to_phys(volatile void * address)
114{ 114{
115 return __pa(address); 115 return __pa(address);
116} 116}
117 117
118extern inline void * phys_to_virt(unsigned long address) 118static inline void * phys_to_virt(unsigned long address)
119{ 119{
120 return __va(address); 120 return __va(address);
121} 121}
@@ -130,7 +130,7 @@ extern inline void * phys_to_virt(unsigned long address)
130 130
131extern void __iomem *__ioremap(unsigned long offset, unsigned long size, unsigned long flags); 131extern void __iomem *__ioremap(unsigned long offset, unsigned long size, unsigned long flags);
132 132
133extern inline void __iomem * ioremap (unsigned long offset, unsigned long size) 133static inline void __iomem * ioremap (unsigned long offset, unsigned long size)
134{ 134{
135 return __ioremap(offset, size, 0); 135 return __ioremap(offset, size, 0);
136} 136}
diff --git a/include/asm-x86_64/io_apic.h b/include/asm-x86_64/io_apic.h
index a8babd2bbe84..ee1bc69aec9c 100644
--- a/include/asm-x86_64/io_apic.h
+++ b/include/asm-x86_64/io_apic.h
@@ -201,7 +201,7 @@ extern int skip_ioapic_setup;
201 */ 201 */
202#define io_apic_assign_pci_irqs (mp_irq_entries && !skip_ioapic_setup && io_apic_irqs) 202#define io_apic_assign_pci_irqs (mp_irq_entries && !skip_ioapic_setup && io_apic_irqs)
203 203
204#ifdef CONFIG_ACPI_BOOT 204#ifdef CONFIG_ACPI
205extern int io_apic_get_version (int ioapic); 205extern int io_apic_get_version (int ioapic);
206extern int io_apic_get_redir_entries (int ioapic); 206extern int io_apic_get_redir_entries (int ioapic);
207extern int io_apic_set_pci_routing (int ioapic, int pin, int irq, int, int); 207extern int io_apic_set_pci_routing (int ioapic, int pin, int irq, int, int);
diff --git a/include/asm-x86_64/ipi.h b/include/asm-x86_64/ipi.h
index 5e166b9d3bde..022e9d340ad7 100644
--- a/include/asm-x86_64/ipi.h
+++ b/include/asm-x86_64/ipi.h
@@ -31,9 +31,20 @@
31 31
32static inline unsigned int __prepare_ICR (unsigned int shortcut, int vector, unsigned int dest) 32static inline unsigned int __prepare_ICR (unsigned int shortcut, int vector, unsigned int dest)
33{ 33{
34 unsigned int icr = APIC_DM_FIXED | shortcut | vector | dest; 34 unsigned int icr = shortcut | dest;
35 if (vector == KDB_VECTOR) 35
36 icr = (icr & (~APIC_VECTOR_MASK)) | APIC_DM_NMI; 36 switch (vector) {
37 default:
38 icr |= APIC_DM_FIXED | vector;
39 break;
40 case NMI_VECTOR:
41 /*
42 * Setup KDB IPI to be delivered as an NMI
43 */
44 case KDB_VECTOR:
45 icr |= APIC_DM_NMI;
46 break;
47 }
37 return icr; 48 return icr;
38} 49}
39 50
@@ -66,7 +77,7 @@ static inline void __send_IPI_shortcut(unsigned int shortcut, int vector, unsign
66 /* 77 /*
67 * Send the IPI. The write to APIC_ICR fires this off. 78 * Send the IPI. The write to APIC_ICR fires this off.
68 */ 79 */
69 apic_write_around(APIC_ICR, cfg); 80 apic_write(APIC_ICR, cfg);
70} 81}
71 82
72 83
@@ -92,7 +103,7 @@ static inline void send_IPI_mask_sequence(cpumask_t mask, int vector)
92 * prepare target chip field 103 * prepare target chip field
93 */ 104 */
94 cfg = __prepare_ICR2(x86_cpu_to_apicid[query_cpu]); 105 cfg = __prepare_ICR2(x86_cpu_to_apicid[query_cpu]);
95 apic_write_around(APIC_ICR2, cfg); 106 apic_write(APIC_ICR2, cfg);
96 107
97 /* 108 /*
98 * program the ICR 109 * program the ICR
@@ -102,7 +113,7 @@ static inline void send_IPI_mask_sequence(cpumask_t mask, int vector)
102 /* 113 /*
103 * Send the IPI. The write to APIC_ICR fires this off. 114 * Send the IPI. The write to APIC_ICR fires this off.
104 */ 115 */
105 apic_write_around(APIC_ICR, cfg); 116 apic_write(APIC_ICR, cfg);
106 } 117 }
107 local_irq_restore(flags); 118 local_irq_restore(flags);
108} 119}
diff --git a/include/asm-x86_64/irq.h b/include/asm-x86_64/irq.h
index 4482657777bb..fb724ba37ae6 100644
--- a/include/asm-x86_64/irq.h
+++ b/include/asm-x86_64/irq.h
@@ -48,10 +48,6 @@ static __inline__ int irq_canonicalize(int irq)
48#define ARCH_HAS_NMI_WATCHDOG /* See include/linux/nmi.h */ 48#define ARCH_HAS_NMI_WATCHDOG /* See include/linux/nmi.h */
49#endif 49#endif
50 50
51struct irqaction;
52struct pt_regs;
53int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *);
54
55#ifdef CONFIG_HOTPLUG_CPU 51#ifdef CONFIG_HOTPLUG_CPU
56#include <linux/cpumask.h> 52#include <linux/cpumask.h>
57extern void fixup_irqs(cpumask_t map); 53extern void fixup_irqs(cpumask_t map);
diff --git a/include/asm-x86_64/kdebug.h b/include/asm-x86_64/kdebug.h
index b90341994d80..f604e84c5303 100644
--- a/include/asm-x86_64/kdebug.h
+++ b/include/asm-x86_64/kdebug.h
@@ -46,7 +46,7 @@ extern void die(const char *,struct pt_regs *,long);
46extern void __die(const char *,struct pt_regs *,long); 46extern void __die(const char *,struct pt_regs *,long);
47extern void show_registers(struct pt_regs *regs); 47extern void show_registers(struct pt_regs *regs);
48extern void dump_pagetable(unsigned long); 48extern void dump_pagetable(unsigned long);
49extern void oops_begin(void); 49extern unsigned long oops_begin(void);
50extern void oops_end(void); 50extern void oops_end(unsigned long);
51 51
52#endif 52#endif
diff --git a/include/asm-x86_64/local.h b/include/asm-x86_64/local.h
index c954f15c1a75..3e72c41727c5 100644
--- a/include/asm-x86_64/local.h
+++ b/include/asm-x86_64/local.h
@@ -29,7 +29,7 @@ static __inline__ void local_dec(local_t *v)
29 :"m" (v->counter)); 29 :"m" (v->counter));
30} 30}
31 31
32static __inline__ void local_add(unsigned long i, local_t *v) 32static __inline__ void local_add(unsigned int i, local_t *v)
33{ 33{
34 __asm__ __volatile__( 34 __asm__ __volatile__(
35 "addl %1,%0" 35 "addl %1,%0"
@@ -37,7 +37,7 @@ static __inline__ void local_add(unsigned long i, local_t *v)
37 :"ir" (i), "m" (v->counter)); 37 :"ir" (i), "m" (v->counter));
38} 38}
39 39
40static __inline__ void local_sub(unsigned long i, local_t *v) 40static __inline__ void local_sub(unsigned int i, local_t *v)
41{ 41{
42 __asm__ __volatile__( 42 __asm__ __volatile__(
43 "subl %1,%0" 43 "subl %1,%0"
diff --git a/include/asm-x86_64/mmzone.h b/include/asm-x86_64/mmzone.h
index 768413751b34..b40c661f111e 100644
--- a/include/asm-x86_64/mmzone.h
+++ b/include/asm-x86_64/mmzone.h
@@ -12,7 +12,7 @@
12 12
13#include <asm/smp.h> 13#include <asm/smp.h>
14 14
15#define NODEMAPSIZE 0xff 15#define NODEMAPSIZE 0xfff
16 16
17/* Simple perfect hash to map physical addresses to node numbers */ 17/* Simple perfect hash to map physical addresses to node numbers */
18extern int memnode_shift; 18extern int memnode_shift;
@@ -54,7 +54,7 @@ static inline __attribute__((pure)) int phys_to_nid(unsigned long addr)
54 54
55#define pfn_valid(pfn) ((pfn) >= num_physpages ? 0 : \ 55#define pfn_valid(pfn) ((pfn) >= num_physpages ? 0 : \
56 ({ u8 nid__ = pfn_to_nid(pfn); \ 56 ({ u8 nid__ = pfn_to_nid(pfn); \
57 nid__ != 0xff && (pfn) >= node_start_pfn(nid__) && (pfn) <= node_end_pfn(nid__); })) 57 nid__ != 0xff && (pfn) >= node_start_pfn(nid__) && (pfn) < node_end_pfn(nid__); }))
58#endif 58#endif
59 59
60#define local_mapnr(kvaddr) \ 60#define local_mapnr(kvaddr) \
diff --git a/include/asm-x86_64/mpspec.h b/include/asm-x86_64/mpspec.h
index 331f6a3c72a2..f267e10c023d 100644
--- a/include/asm-x86_64/mpspec.h
+++ b/include/asm-x86_64/mpspec.h
@@ -179,7 +179,7 @@ extern int mpc_default_type;
179extern unsigned long mp_lapic_addr; 179extern unsigned long mp_lapic_addr;
180extern int pic_mode; 180extern int pic_mode;
181 181
182#ifdef CONFIG_ACPI_BOOT 182#ifdef CONFIG_ACPI
183extern void mp_register_lapic (u8 id, u8 enabled); 183extern void mp_register_lapic (u8 id, u8 enabled);
184extern void mp_register_lapic_address (u64 address); 184extern void mp_register_lapic_address (u64 address);
185 185
diff --git a/include/asm-x86_64/msr.h b/include/asm-x86_64/msr.h
index ba15279a79d0..4d727f3f5550 100644
--- a/include/asm-x86_64/msr.h
+++ b/include/asm-x86_64/msr.h
@@ -29,22 +29,37 @@
29#define wrmsrl(msr,val) wrmsr(msr,(__u32)((__u64)(val)),((__u64)(val))>>32) 29#define wrmsrl(msr,val) wrmsr(msr,(__u32)((__u64)(val)),((__u64)(val))>>32)
30 30
31/* wrmsr with exception handling */ 31/* wrmsr with exception handling */
32#define wrmsr_safe(msr,a,b) ({ int ret__; \ 32#define wrmsr_safe(msr,a,b) ({ int ret__; \
33 asm volatile("2: wrmsr ; xorl %0,%0\n" \ 33 asm volatile("2: wrmsr ; xorl %0,%0\n" \
34 "1:\n\t" \ 34 "1:\n\t" \
35 ".section .fixup,\"ax\"\n\t" \ 35 ".section .fixup,\"ax\"\n\t" \
36 "3: movl %4,%0 ; jmp 1b\n\t" \ 36 "3: movl %4,%0 ; jmp 1b\n\t" \
37 ".previous\n\t" \ 37 ".previous\n\t" \
38 ".section __ex_table,\"a\"\n" \ 38 ".section __ex_table,\"a\"\n" \
39 " .align 8\n\t" \ 39 " .align 8\n\t" \
40 " .quad 2b,3b\n\t" \ 40 " .quad 2b,3b\n\t" \
41 ".previous" \ 41 ".previous" \
42 : "=a" (ret__) \ 42 : "=a" (ret__) \
43 : "c" (msr), "0" (a), "d" (b), "i" (-EFAULT));\ 43 : "c" (msr), "0" (a), "d" (b), "i" (-EFAULT)); \
44 ret__; }) 44 ret__; })
45 45
46#define checking_wrmsrl(msr,val) wrmsr_safe(msr,(u32)(val),(u32)((val)>>32)) 46#define checking_wrmsrl(msr,val) wrmsr_safe(msr,(u32)(val),(u32)((val)>>32))
47 47
48#define rdmsr_safe(msr,a,b) \
49 ({ int ret__; \
50 asm volatile ("1: rdmsr\n" \
51 "2:\n" \
52 ".section .fixup,\"ax\"\n" \
53 "3: movl %4,%0\n" \
54 " jmp 2b\n" \
55 ".previous\n" \
56 ".section __ex_table,\"a\"\n" \
57 " .align 8\n" \
58 " .quad 1b,3b\n" \
59 ".previous":"=&bDS" (ret__), "=a"(a), "=d"(b)\
60 :"c"(msr), "i"(-EIO), "0"(0)); \
61 ret__; })
62
48#define rdtsc(low,high) \ 63#define rdtsc(low,high) \
49 __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high)) 64 __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high))
50 65
@@ -64,7 +79,7 @@
64 : "=a" (low), "=d" (high) \ 79 : "=a" (low), "=d" (high) \
65 : "c" (counter)) 80 : "c" (counter))
66 81
67extern inline void cpuid(int op, unsigned int *eax, unsigned int *ebx, 82static inline void cpuid(int op, unsigned int *eax, unsigned int *ebx,
68 unsigned int *ecx, unsigned int *edx) 83 unsigned int *ecx, unsigned int *edx)
69{ 84{
70 __asm__("cpuid" 85 __asm__("cpuid"
@@ -90,7 +105,7 @@ static inline void cpuid_count(int op, int count, int *eax, int *ebx, int *ecx,
90/* 105/*
91 * CPUID functions returning a single datum 106 * CPUID functions returning a single datum
92 */ 107 */
93extern inline unsigned int cpuid_eax(unsigned int op) 108static inline unsigned int cpuid_eax(unsigned int op)
94{ 109{
95 unsigned int eax; 110 unsigned int eax;
96 111
@@ -100,7 +115,7 @@ extern inline unsigned int cpuid_eax(unsigned int op)
100 : "bx", "cx", "dx"); 115 : "bx", "cx", "dx");
101 return eax; 116 return eax;
102} 117}
103extern inline unsigned int cpuid_ebx(unsigned int op) 118static inline unsigned int cpuid_ebx(unsigned int op)
104{ 119{
105 unsigned int eax, ebx; 120 unsigned int eax, ebx;
106 121
@@ -110,7 +125,7 @@ extern inline unsigned int cpuid_ebx(unsigned int op)
110 : "cx", "dx" ); 125 : "cx", "dx" );
111 return ebx; 126 return ebx;
112} 127}
113extern inline unsigned int cpuid_ecx(unsigned int op) 128static inline unsigned int cpuid_ecx(unsigned int op)
114{ 129{
115 unsigned int eax, ecx; 130 unsigned int eax, ecx;
116 131
@@ -120,7 +135,7 @@ extern inline unsigned int cpuid_ecx(unsigned int op)
120 : "bx", "dx" ); 135 : "bx", "dx" );
121 return ecx; 136 return ecx;
122} 137}
123extern inline unsigned int cpuid_edx(unsigned int op) 138static inline unsigned int cpuid_edx(unsigned int op)
124{ 139{
125 unsigned int eax, edx; 140 unsigned int eax, edx;
126 141
diff --git a/include/asm-x86_64/numa.h b/include/asm-x86_64/numa.h
index 5c363a1482e4..bcf55c3f7f7f 100644
--- a/include/asm-x86_64/numa.h
+++ b/include/asm-x86_64/numa.h
@@ -9,6 +9,7 @@ struct node {
9}; 9};
10 10
11extern int compute_hash_shift(struct node *nodes, int numnodes); 11extern int compute_hash_shift(struct node *nodes, int numnodes);
12extern int pxm_to_node(int nid);
12 13
13#define ZONE_ALIGN (1UL << (MAX_ORDER+PAGE_SHIFT)) 14#define ZONE_ALIGN (1UL << (MAX_ORDER+PAGE_SHIFT))
14 15
@@ -16,6 +17,8 @@ extern void numa_add_cpu(int cpu);
16extern void numa_init_array(void); 17extern void numa_init_array(void);
17extern int numa_off; 18extern int numa_off;
18 19
20extern unsigned char apicid_to_node[256];
21
19#define NUMA_NO_NODE 0xff 22#define NUMA_NO_NODE 0xff
20 23
21#endif 24#endif
diff --git a/include/asm-x86_64/page.h b/include/asm-x86_64/page.h
index 135ffaa0393b..e5ab4d231f2c 100644
--- a/include/asm-x86_64/page.h
+++ b/include/asm-x86_64/page.h
@@ -32,6 +32,8 @@
32#ifdef __KERNEL__ 32#ifdef __KERNEL__
33#ifndef __ASSEMBLY__ 33#ifndef __ASSEMBLY__
34 34
35extern unsigned long end_pfn;
36
35void clear_page(void *); 37void clear_page(void *);
36void copy_page(void *, void *); 38void copy_page(void *, void *);
37 39
@@ -111,7 +113,7 @@ typedef struct { unsigned long pgprot; } pgprot_t;
111#ifdef CONFIG_FLATMEM 113#ifdef CONFIG_FLATMEM
112#define pfn_to_page(pfn) (mem_map + (pfn)) 114#define pfn_to_page(pfn) (mem_map + (pfn))
113#define page_to_pfn(page) ((unsigned long)((page) - mem_map)) 115#define page_to_pfn(page) ((unsigned long)((page) - mem_map))
114#define pfn_valid(pfn) ((pfn) < max_mapnr) 116#define pfn_valid(pfn) ((pfn) < end_pfn)
115#endif 117#endif
116 118
117#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) 119#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
diff --git a/include/asm-x86_64/pci.h b/include/asm-x86_64/pci.h
index eeb3088a1c9e..5a82a6762c21 100644
--- a/include/asm-x86_64/pci.h
+++ b/include/asm-x86_64/pci.h
@@ -50,10 +50,10 @@ extern int iommu_setup(char *opt);
50 * address space. The networking and block device layers use 50 * address space. The networking and block device layers use
51 * this boolean for bounce buffer decisions 51 * this boolean for bounce buffer decisions
52 * 52 *
53 * On AMD64 it mostly equals, but we set it to zero to tell some subsystems 53 * On x86-64 it mostly equals, but we set it to zero to tell some subsystems
54 * that an IOMMU is available. 54 * that an hard or soft IOMMU is available.
55 */ 55 */
56#define PCI_DMA_BUS_IS_PHYS (no_iommu ? 1 : 0) 56#define PCI_DMA_BUS_IS_PHYS 0
57 57
58/* 58/*
59 * x86-64 always supports DAC, but sometimes it is useful to force 59 * x86-64 always supports DAC, but sometimes it is useful to force
diff --git a/include/asm-x86_64/pda.h b/include/asm-x86_64/pda.h
index 36b766cfc4d5..bbf89aa8a1af 100644
--- a/include/asm-x86_64/pda.h
+++ b/include/asm-x86_64/pda.h
@@ -10,10 +10,8 @@
10struct x8664_pda { 10struct x8664_pda {
11 struct task_struct *pcurrent; /* Current process */ 11 struct task_struct *pcurrent; /* Current process */
12 unsigned long data_offset; /* Per cpu data offset from linker address */ 12 unsigned long data_offset; /* Per cpu data offset from linker address */
13 struct x8664_pda *me; /* Pointer to itself */
14 unsigned long kernelstack; /* top of kernel stack for current */ 13 unsigned long kernelstack; /* top of kernel stack for current */
15 unsigned long oldrsp; /* user rsp for system call */ 14 unsigned long oldrsp; /* user rsp for system call */
16 unsigned long irqrsp; /* Old rsp for interrupts. */
17 int irqcount; /* Irq nesting counter. Starts with -1 */ 15 int irqcount; /* Irq nesting counter. Starts with -1 */
18 int cpunumber; /* Logical CPU number */ 16 int cpunumber; /* Logical CPU number */
19 char *irqstackptr; /* top of irqstack */ 17 char *irqstackptr; /* top of irqstack */
@@ -22,7 +20,7 @@ struct x8664_pda {
22 struct mm_struct *active_mm; 20 struct mm_struct *active_mm;
23 int mmu_state; 21 int mmu_state;
24 unsigned apic_timer_irqs; 22 unsigned apic_timer_irqs;
25} ____cacheline_aligned; 23} ____cacheline_aligned_in_smp;
26 24
27 25
28#define IRQSTACK_ORDER 2 26#define IRQSTACK_ORDER 2
@@ -42,13 +40,14 @@ extern void __bad_pda_field(void);
42#define pda_offset(field) offsetof(struct x8664_pda, field) 40#define pda_offset(field) offsetof(struct x8664_pda, field)
43 41
44#define pda_to_op(op,field,val) do { \ 42#define pda_to_op(op,field,val) do { \
43 typedef typeof_field(struct x8664_pda, field) T__; \
45 switch (sizeof_field(struct x8664_pda, field)) { \ 44 switch (sizeof_field(struct x8664_pda, field)) { \
46case 2: \ 45case 2: \
47asm volatile(op "w %0,%%gs:%P1"::"r" (val),"i"(pda_offset(field)):"memory"); break; \ 46asm volatile(op "w %0,%%gs:%P1"::"ri" ((T__)val),"i"(pda_offset(field)):"memory"); break; \
48case 4: \ 47case 4: \
49asm volatile(op "l %0,%%gs:%P1"::"r" (val),"i"(pda_offset(field)):"memory"); break; \ 48asm volatile(op "l %0,%%gs:%P1"::"ri" ((T__)val),"i"(pda_offset(field)):"memory"); break; \
50case 8: \ 49case 8: \
51asm volatile(op "q %0,%%gs:%P1"::"r" (val),"i"(pda_offset(field)):"memory"); break; \ 50asm volatile(op "q %0,%%gs:%P1"::"ri" ((T__)val),"i"(pda_offset(field)):"memory"); break; \
52 default: __bad_pda_field(); \ 51 default: __bad_pda_field(); \
53 } \ 52 } \
54 } while (0) 53 } while (0)
@@ -58,7 +57,7 @@ asm volatile(op "q %0,%%gs:%P1"::"r" (val),"i"(pda_offset(field)):"memory"); bre
58 * Unfortunately removing them causes all hell to break lose currently. 57 * Unfortunately removing them causes all hell to break lose currently.
59 */ 58 */
60#define pda_from_op(op,field) ({ \ 59#define pda_from_op(op,field) ({ \
61 typedef typeof_field(struct x8664_pda, field) T__; T__ ret__; \ 60 typeof_field(struct x8664_pda, field) ret__; \
62 switch (sizeof_field(struct x8664_pda, field)) { \ 61 switch (sizeof_field(struct x8664_pda, field)) { \
63case 2: \ 62case 2: \
64asm volatile(op "w %%gs:%P1,%0":"=r" (ret__):"i"(pda_offset(field)):"memory"); break;\ 63asm volatile(op "w %%gs:%P1,%0":"=r" (ret__):"i"(pda_offset(field)):"memory"); break;\
@@ -75,6 +74,7 @@ asm volatile(op "q %%gs:%P1,%0":"=r" (ret__):"i"(pda_offset(field)):"memory"); b
75#define write_pda(field,val) pda_to_op("mov",field,val) 74#define write_pda(field,val) pda_to_op("mov",field,val)
76#define add_pda(field,val) pda_to_op("add",field,val) 75#define add_pda(field,val) pda_to_op("add",field,val)
77#define sub_pda(field,val) pda_to_op("sub",field,val) 76#define sub_pda(field,val) pda_to_op("sub",field,val)
77#define or_pda(field,val) pda_to_op("or",field,val)
78 78
79#endif 79#endif
80 80
diff --git a/include/asm-x86_64/pgalloc.h b/include/asm-x86_64/pgalloc.h
index deadd146978b..08cad2482bcb 100644
--- a/include/asm-x86_64/pgalloc.h
+++ b/include/asm-x86_64/pgalloc.h
@@ -18,12 +18,12 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *p
18 set_pmd(pmd, __pmd(_PAGE_TABLE | (page_to_pfn(pte) << PAGE_SHIFT))); 18 set_pmd(pmd, __pmd(_PAGE_TABLE | (page_to_pfn(pte) << PAGE_SHIFT)));
19} 19}
20 20
21extern __inline__ pmd_t *get_pmd(void) 21static inline pmd_t *get_pmd(void)
22{ 22{
23 return (pmd_t *)get_zeroed_page(GFP_KERNEL); 23 return (pmd_t *)get_zeroed_page(GFP_KERNEL);
24} 24}
25 25
26extern __inline__ void pmd_free(pmd_t *pmd) 26static inline void pmd_free(pmd_t *pmd)
27{ 27{
28 BUG_ON((unsigned long)pmd & (PAGE_SIZE-1)); 28 BUG_ON((unsigned long)pmd & (PAGE_SIZE-1));
29 free_page((unsigned long)pmd); 29 free_page((unsigned long)pmd);
@@ -86,13 +86,13 @@ static inline struct page *pte_alloc_one(struct mm_struct *mm, unsigned long add
86/* Should really implement gc for free page table pages. This could be 86/* Should really implement gc for free page table pages. This could be
87 done with a reference count in struct page. */ 87 done with a reference count in struct page. */
88 88
89extern __inline__ void pte_free_kernel(pte_t *pte) 89static inline void pte_free_kernel(pte_t *pte)
90{ 90{
91 BUG_ON((unsigned long)pte & (PAGE_SIZE-1)); 91 BUG_ON((unsigned long)pte & (PAGE_SIZE-1));
92 free_page((unsigned long)pte); 92 free_page((unsigned long)pte);
93} 93}
94 94
95extern inline void pte_free(struct page *pte) 95static inline void pte_free(struct page *pte)
96{ 96{
97 __free_page(pte); 97 __free_page(pte);
98} 98}
diff --git a/include/asm-x86_64/pgtable.h b/include/asm-x86_64/pgtable.h
index 5e0f2fdab0d3..1dc110ba82d6 100644
--- a/include/asm-x86_64/pgtable.h
+++ b/include/asm-x86_64/pgtable.h
@@ -85,7 +85,7 @@ static inline void set_pud(pud_t *dst, pud_t val)
85 pud_val(*dst) = pud_val(val); 85 pud_val(*dst) = pud_val(val);
86} 86}
87 87
88extern inline void pud_clear (pud_t *pud) 88static inline void pud_clear (pud_t *pud)
89{ 89{
90 set_pud(pud, __pud(0)); 90 set_pud(pud, __pud(0));
91} 91}
@@ -95,7 +95,7 @@ static inline void set_pgd(pgd_t *dst, pgd_t val)
95 pgd_val(*dst) = pgd_val(val); 95 pgd_val(*dst) = pgd_val(val);
96} 96}
97 97
98extern inline void pgd_clear (pgd_t * pgd) 98static inline void pgd_clear (pgd_t * pgd)
99{ 99{
100 set_pgd(pgd, __pgd(0)); 100 set_pgd(pgd, __pgd(0));
101} 101}
@@ -375,7 +375,7 @@ static inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot)
375} 375}
376 376
377/* Change flags of a PTE */ 377/* Change flags of a PTE */
378extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot) 378static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
379{ 379{
380 pte_val(pte) &= _PAGE_CHG_MASK; 380 pte_val(pte) &= _PAGE_CHG_MASK;
381 pte_val(pte) |= pgprot_val(newprot); 381 pte_val(pte) |= pgprot_val(newprot);
diff --git a/include/asm-x86_64/processor.h b/include/asm-x86_64/processor.h
index a8321999448f..03837d34fba0 100644
--- a/include/asm-x86_64/processor.h
+++ b/include/asm-x86_64/processor.h
@@ -254,7 +254,13 @@ struct thread_struct {
254 u64 tls_array[GDT_ENTRY_TLS_ENTRIES]; 254 u64 tls_array[GDT_ENTRY_TLS_ENTRIES];
255} __attribute__((aligned(16))); 255} __attribute__((aligned(16)));
256 256
257#define INIT_THREAD {} 257#define INIT_THREAD { \
258 .rsp0 = (unsigned long)&init_stack + sizeof(init_stack) \
259}
260
261#define INIT_TSS { \
262 .rsp0 = (unsigned long)&init_stack + sizeof(init_stack) \
263}
258 264
259#define INIT_MMAP \ 265#define INIT_MMAP \
260{ &init_mm, 0, 0, NULL, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL } 266{ &init_mm, 0, 0, NULL, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL }
@@ -375,13 +381,13 @@ struct extended_sigtable {
375#define ASM_NOP_MAX 8 381#define ASM_NOP_MAX 8
376 382
377/* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */ 383/* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */
378extern inline void rep_nop(void) 384static inline void rep_nop(void)
379{ 385{
380 __asm__ __volatile__("rep;nop": : :"memory"); 386 __asm__ __volatile__("rep;nop": : :"memory");
381} 387}
382 388
383/* Stop speculative execution */ 389/* Stop speculative execution */
384extern inline void sync_core(void) 390static inline void sync_core(void)
385{ 391{
386 int tmp; 392 int tmp;
387 asm volatile("cpuid" : "=a" (tmp) : "0" (1) : "ebx","ecx","edx","memory"); 393 asm volatile("cpuid" : "=a" (tmp) : "0" (1) : "ebx","ecx","edx","memory");
diff --git a/include/asm-x86_64/proto.h b/include/asm-x86_64/proto.h
index 6c813eb521f3..dbb37b0adb43 100644
--- a/include/asm-x86_64/proto.h
+++ b/include/asm-x86_64/proto.h
@@ -8,7 +8,6 @@
8struct cpuinfo_x86; 8struct cpuinfo_x86;
9struct pt_regs; 9struct pt_regs;
10 10
11extern void get_cpu_vendor(struct cpuinfo_x86*);
12extern void start_kernel(void); 11extern void start_kernel(void);
13extern void pda_init(int); 12extern void pda_init(int);
14 13
@@ -75,9 +74,6 @@ extern void acpi_reserve_bootmem(void);
75 74
76extern void swap_low_mappings(void); 75extern void swap_low_mappings(void);
77 76
78extern void oops_begin(void);
79extern void die(const char *,struct pt_regs *,long);
80extern void __die(const char * str, struct pt_regs * regs, long err);
81extern void __show_regs(struct pt_regs * regs); 77extern void __show_regs(struct pt_regs * regs);
82extern void show_regs(struct pt_regs * regs); 78extern void show_regs(struct pt_regs * regs);
83 79
@@ -94,8 +90,6 @@ extern int unhandled_signal(struct task_struct *tsk, int sig);
94extern void select_idle_routine(const struct cpuinfo_x86 *c); 90extern void select_idle_routine(const struct cpuinfo_x86 *c);
95extern void swiotlb_init(void); 91extern void swiotlb_init(void);
96 92
97extern unsigned long max_mapnr;
98extern unsigned long end_pfn;
99extern unsigned long table_start, table_end; 93extern unsigned long table_start, table_end;
100 94
101extern int exception_trace; 95extern int exception_trace;
diff --git a/include/asm-x86_64/signal.h b/include/asm-x86_64/signal.h
index fe9b96d94815..f8d55798535a 100644
--- a/include/asm-x86_64/signal.h
+++ b/include/asm-x86_64/signal.h
@@ -143,23 +143,23 @@ typedef struct sigaltstack {
143#undef __HAVE_ARCH_SIG_BITOPS 143#undef __HAVE_ARCH_SIG_BITOPS
144#if 0 144#if 0
145 145
146extern __inline__ void sigaddset(sigset_t *set, int _sig) 146static inline void sigaddset(sigset_t *set, int _sig)
147{ 147{
148 __asm__("btsq %1,%0" : "=m"(*set) : "Ir"(_sig - 1) : "cc"); 148 __asm__("btsq %1,%0" : "=m"(*set) : "Ir"(_sig - 1) : "cc");
149} 149}
150 150
151extern __inline__ void sigdelset(sigset_t *set, int _sig) 151static inline void sigdelset(sigset_t *set, int _sig)
152{ 152{
153 __asm__("btrq %1,%0" : "=m"(*set) : "Ir"(_sig - 1) : "cc"); 153 __asm__("btrq %1,%0" : "=m"(*set) : "Ir"(_sig - 1) : "cc");
154} 154}
155 155
156extern __inline__ int __const_sigismember(sigset_t *set, int _sig) 156static inline int __const_sigismember(sigset_t *set, int _sig)
157{ 157{
158 unsigned long sig = _sig - 1; 158 unsigned long sig = _sig - 1;
159 return 1 & (set->sig[sig / _NSIG_BPW] >> (sig & ~(_NSIG_BPW-1))); 159 return 1 & (set->sig[sig / _NSIG_BPW] >> (sig & ~(_NSIG_BPW-1)));
160} 160}
161 161
162extern __inline__ int __gen_sigismember(sigset_t *set, int _sig) 162static inline int __gen_sigismember(sigset_t *set, int _sig)
163{ 163{
164 int ret; 164 int ret;
165 __asm__("btq %2,%1\n\tsbbq %0,%0" 165 __asm__("btq %2,%1\n\tsbbq %0,%0"
@@ -172,7 +172,7 @@ extern __inline__ int __gen_sigismember(sigset_t *set, int _sig)
172 __const_sigismember((set),(sig)) : \ 172 __const_sigismember((set),(sig)) : \
173 __gen_sigismember((set),(sig))) 173 __gen_sigismember((set),(sig)))
174 174
175extern __inline__ int sigfindinword(unsigned long word) 175static inline int sigfindinword(unsigned long word)
176{ 176{
177 __asm__("bsfq %1,%0" : "=r"(word) : "rm"(word) : "cc"); 177 __asm__("bsfq %1,%0" : "=r"(word) : "rm"(word) : "cc");
178 return word; 178 return word;
diff --git a/include/asm-x86_64/smp.h b/include/asm-x86_64/smp.h
index de8b57b2b62b..24e32611f0bf 100644
--- a/include/asm-x86_64/smp.h
+++ b/include/asm-x86_64/smp.h
@@ -72,7 +72,7 @@ static inline int num_booting_cpus(void)
72 72
73#define raw_smp_processor_id() read_pda(cpunumber) 73#define raw_smp_processor_id() read_pda(cpunumber)
74 74
75extern __inline int hard_smp_processor_id(void) 75static inline int hard_smp_processor_id(void)
76{ 76{
77 /* we don't want to mark this access volatile - bad code generation */ 77 /* we don't want to mark this access volatile - bad code generation */
78 return GET_APIC_ID(*(unsigned int *)(APIC_BASE+APIC_ID)); 78 return GET_APIC_ID(*(unsigned int *)(APIC_BASE+APIC_ID));
diff --git a/include/asm-x86_64/spinlock.h b/include/asm-x86_64/spinlock.h
index 5aeb57a3baad..69636831ad2f 100644
--- a/include/asm-x86_64/spinlock.h
+++ b/include/asm-x86_64/spinlock.h
@@ -6,47 +6,21 @@
6#include <asm/page.h> 6#include <asm/page.h>
7#include <linux/config.h> 7#include <linux/config.h>
8 8
9extern int printk(const char * fmt, ...)
10 __attribute__ ((format (printf, 1, 2)));
11
12/* 9/*
13 * Your basic SMP spinlocks, allowing only a single CPU anywhere 10 * Your basic SMP spinlocks, allowing only a single CPU anywhere
14 */ 11 *
15
16typedef struct {
17 volatile unsigned int lock;
18#ifdef CONFIG_DEBUG_SPINLOCK
19 unsigned magic;
20#endif
21#ifdef CONFIG_PREEMPT
22 unsigned int break_lock;
23#endif
24} spinlock_t;
25
26#define SPINLOCK_MAGIC 0xdead4ead
27
28#ifdef CONFIG_DEBUG_SPINLOCK
29#define SPINLOCK_MAGIC_INIT , SPINLOCK_MAGIC
30#else
31#define SPINLOCK_MAGIC_INIT /* */
32#endif
33
34#define SPIN_LOCK_UNLOCKED (spinlock_t) { 1 SPINLOCK_MAGIC_INIT }
35
36#define spin_lock_init(x) do { *(x) = SPIN_LOCK_UNLOCKED; } while(0)
37
38/*
39 * Simple spin lock operations. There are two variants, one clears IRQ's 12 * Simple spin lock operations. There are two variants, one clears IRQ's
40 * on the local processor, one does not. 13 * on the local processor, one does not.
41 * 14 *
42 * We make no fairness assumptions. They have a cost. 15 * We make no fairness assumptions. They have a cost.
16 *
17 * (the type definitions are in asm/spinlock_types.h)
43 */ 18 */
44 19
45#define spin_is_locked(x) (*(volatile signed char *)(&(x)->lock) <= 0) 20#define __raw_spin_is_locked(x) \
46#define spin_unlock_wait(x) do { barrier(); } while(spin_is_locked(x)) 21 (*(volatile signed char *)(&(x)->slock) <= 0)
47#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock)
48 22
49#define spin_lock_string \ 23#define __raw_spin_lock_string \
50 "\n1:\t" \ 24 "\n1:\t" \
51 "lock ; decb %0\n\t" \ 25 "lock ; decb %0\n\t" \
52 "js 2f\n" \ 26 "js 2f\n" \
@@ -58,74 +32,40 @@ typedef struct {
58 "jmp 1b\n" \ 32 "jmp 1b\n" \
59 LOCK_SECTION_END 33 LOCK_SECTION_END
60 34
61/* 35#define __raw_spin_unlock_string \
62 * This works. Despite all the confusion.
63 * (except on PPro SMP or if we are using OOSTORE)
64 * (PPro errata 66, 92)
65 */
66
67#if !defined(CONFIG_X86_OOSTORE) && !defined(CONFIG_X86_PPRO_FENCE)
68
69#define spin_unlock_string \
70 "movb $1,%0" \ 36 "movb $1,%0" \
71 :"=m" (lock->lock) : : "memory" 37 :"=m" (lock->slock) : : "memory"
72
73
74static inline void _raw_spin_unlock(spinlock_t *lock)
75{
76#ifdef CONFIG_DEBUG_SPINLOCK
77 BUG_ON(lock->magic != SPINLOCK_MAGIC);
78 assert_spin_locked(lock);
79#endif
80 __asm__ __volatile__(
81 spin_unlock_string
82 );
83}
84
85#else
86
87#define spin_unlock_string \
88 "xchgb %b0, %1" \
89 :"=q" (oldval), "=m" (lock->lock) \
90 :"0" (oldval) : "memory"
91 38
92static inline void _raw_spin_unlock(spinlock_t *lock) 39static inline void __raw_spin_lock(raw_spinlock_t *lock)
93{ 40{
94 char oldval = 1;
95#ifdef CONFIG_DEBUG_SPINLOCK
96 BUG_ON(lock->magic != SPINLOCK_MAGIC);
97 assert_spin_locked(lock);
98#endif
99 __asm__ __volatile__( 41 __asm__ __volatile__(
100 spin_unlock_string 42 __raw_spin_lock_string
101 ); 43 :"=m" (lock->slock) : : "memory");
102} 44}
103 45
104#endif 46#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock)
105 47
106static inline int _raw_spin_trylock(spinlock_t *lock) 48static inline int __raw_spin_trylock(raw_spinlock_t *lock)
107{ 49{
108 char oldval; 50 char oldval;
51
109 __asm__ __volatile__( 52 __asm__ __volatile__(
110 "xchgb %b0,%1" 53 "xchgb %b0,%1"
111 :"=q" (oldval), "=m" (lock->lock) 54 :"=q" (oldval), "=m" (lock->slock)
112 :"0" (0) : "memory"); 55 :"0" (0) : "memory");
56
113 return oldval > 0; 57 return oldval > 0;
114} 58}
115 59
116static inline void _raw_spin_lock(spinlock_t *lock) 60static inline void __raw_spin_unlock(raw_spinlock_t *lock)
117{ 61{
118#ifdef CONFIG_DEBUG_SPINLOCK
119 if (lock->magic != SPINLOCK_MAGIC) {
120 printk("eip: %p\n", __builtin_return_address(0));
121 BUG();
122 }
123#endif
124 __asm__ __volatile__( 62 __asm__ __volatile__(
125 spin_lock_string 63 __raw_spin_unlock_string
126 :"=m" (lock->lock) : : "memory"); 64 );
127} 65}
128 66
67#define __raw_spin_unlock_wait(lock) \
68 do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0)
129 69
130/* 70/*
131 * Read-write spinlocks, allowing multiple readers 71 * Read-write spinlocks, allowing multiple readers
@@ -136,33 +76,7 @@ static inline void _raw_spin_lock(spinlock_t *lock)
136 * can "mix" irq-safe locks - any writer needs to get a 76 * can "mix" irq-safe locks - any writer needs to get a
137 * irq-safe write-lock, but readers can get non-irqsafe 77 * irq-safe write-lock, but readers can get non-irqsafe
138 * read-locks. 78 * read-locks.
139 */ 79 *
140typedef struct {
141 volatile unsigned int lock;
142#ifdef CONFIG_DEBUG_SPINLOCK
143 unsigned magic;
144#endif
145#ifdef CONFIG_PREEMPT
146 unsigned int break_lock;
147#endif
148} rwlock_t;
149
150#define RWLOCK_MAGIC 0xdeaf1eed
151
152#ifdef CONFIG_DEBUG_SPINLOCK
153#define RWLOCK_MAGIC_INIT , RWLOCK_MAGIC
154#else
155#define RWLOCK_MAGIC_INIT /* */
156#endif
157
158#define RW_LOCK_UNLOCKED (rwlock_t) { RW_LOCK_BIAS RWLOCK_MAGIC_INIT }
159
160#define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while(0)
161
162#define read_can_lock(x) ((int)(x)->lock > 0)
163#define write_can_lock(x) ((x)->lock == RW_LOCK_BIAS)
164
165/*
166 * On x86, we implement read-write locks as a 32-bit counter 80 * On x86, we implement read-write locks as a 32-bit counter
167 * with the high bit (sign) being the "contended" bit. 81 * with the high bit (sign) being the "contended" bit.
168 * 82 *
@@ -170,29 +84,24 @@ typedef struct {
170 * 84 *
171 * Changed to use the same technique as rw semaphores. See 85 * Changed to use the same technique as rw semaphores. See
172 * semaphore.h for details. -ben 86 * semaphore.h for details. -ben
87 *
88 * the helpers are in arch/i386/kernel/semaphore.c
173 */ 89 */
174/* the spinlock helpers are in arch/i386/kernel/semaphore.c */
175 90
176static inline void _raw_read_lock(rwlock_t *rw) 91#define __raw_read_can_lock(x) ((int)(x)->lock > 0)
92#define __raw_write_can_lock(x) ((x)->lock == RW_LOCK_BIAS)
93
94static inline void __raw_read_lock(raw_rwlock_t *rw)
177{ 95{
178#ifdef CONFIG_DEBUG_SPINLOCK
179 BUG_ON(rw->magic != RWLOCK_MAGIC);
180#endif
181 __build_read_lock(rw, "__read_lock_failed"); 96 __build_read_lock(rw, "__read_lock_failed");
182} 97}
183 98
184static inline void _raw_write_lock(rwlock_t *rw) 99static inline void __raw_write_lock(raw_rwlock_t *rw)
185{ 100{
186#ifdef CONFIG_DEBUG_SPINLOCK
187 BUG_ON(rw->magic != RWLOCK_MAGIC);
188#endif
189 __build_write_lock(rw, "__write_lock_failed"); 101 __build_write_lock(rw, "__write_lock_failed");
190} 102}
191 103
192#define _raw_read_unlock(rw) asm volatile("lock ; incl %0" :"=m" ((rw)->lock) : : "memory") 104static inline int __raw_read_trylock(raw_rwlock_t *lock)
193#define _raw_write_unlock(rw) asm volatile("lock ; addl $" RW_LOCK_BIAS_STR ",%0":"=m" ((rw)->lock) : : "memory")
194
195static inline int _raw_read_trylock(rwlock_t *lock)
196{ 105{
197 atomic_t *count = (atomic_t *)lock; 106 atomic_t *count = (atomic_t *)lock;
198 atomic_dec(count); 107 atomic_dec(count);
@@ -202,7 +111,7 @@ static inline int _raw_read_trylock(rwlock_t *lock)
202 return 0; 111 return 0;
203} 112}
204 113
205static inline int _raw_write_trylock(rwlock_t *lock) 114static inline int __raw_write_trylock(raw_rwlock_t *lock)
206{ 115{
207 atomic_t *count = (atomic_t *)lock; 116 atomic_t *count = (atomic_t *)lock;
208 if (atomic_sub_and_test(RW_LOCK_BIAS, count)) 117 if (atomic_sub_and_test(RW_LOCK_BIAS, count))
@@ -211,4 +120,15 @@ static inline int _raw_write_trylock(rwlock_t *lock)
211 return 0; 120 return 0;
212} 121}
213 122
123static inline void __raw_read_unlock(raw_rwlock_t *rw)
124{
125 asm volatile("lock ; incl %0" :"=m" (rw->lock) : : "memory");
126}
127
128static inline void __raw_write_unlock(raw_rwlock_t *rw)
129{
130 asm volatile("lock ; addl $" RW_LOCK_BIAS_STR ",%0"
131 : "=m" (rw->lock) : : "memory");
132}
133
214#endif /* __ASM_SPINLOCK_H */ 134#endif /* __ASM_SPINLOCK_H */
diff --git a/include/asm-x86_64/spinlock_types.h b/include/asm-x86_64/spinlock_types.h
new file mode 100644
index 000000000000..59efe849f351
--- /dev/null
+++ b/include/asm-x86_64/spinlock_types.h
@@ -0,0 +1,20 @@
1#ifndef __ASM_SPINLOCK_TYPES_H
2#define __ASM_SPINLOCK_TYPES_H
3
4#ifndef __LINUX_SPINLOCK_TYPES_H
5# error "please don't include this file directly"
6#endif
7
8typedef struct {
9 volatile unsigned int slock;
10} raw_spinlock_t;
11
12#define __RAW_SPIN_LOCK_UNLOCKED { 1 }
13
14typedef struct {
15 volatile unsigned int lock;
16} raw_rwlock_t;
17
18#define __RAW_RW_LOCK_UNLOCKED { RW_LOCK_BIAS }
19
20#endif
diff --git a/include/asm-x86_64/system.h b/include/asm-x86_64/system.h
index 8606e170a7dc..85348e02ad2e 100644
--- a/include/asm-x86_64/system.h
+++ b/include/asm-x86_64/system.h
@@ -188,7 +188,7 @@ static inline void write_cr4(unsigned long val)
188 188
189#define __xg(x) ((volatile long *)(x)) 189#define __xg(x) ((volatile long *)(x))
190 190
191extern inline void set_64bit(volatile unsigned long *ptr, unsigned long val) 191static inline void set_64bit(volatile unsigned long *ptr, unsigned long val)
192{ 192{
193 *ptr = val; 193 *ptr = val;
194} 194}
@@ -253,19 +253,19 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
253 case 2: 253 case 2:
254 __asm__ __volatile__(LOCK_PREFIX "cmpxchgw %w1,%2" 254 __asm__ __volatile__(LOCK_PREFIX "cmpxchgw %w1,%2"
255 : "=a"(prev) 255 : "=a"(prev)
256 : "q"(new), "m"(*__xg(ptr)), "0"(old) 256 : "r"(new), "m"(*__xg(ptr)), "0"(old)
257 : "memory"); 257 : "memory");
258 return prev; 258 return prev;
259 case 4: 259 case 4:
260 __asm__ __volatile__(LOCK_PREFIX "cmpxchgl %k1,%2" 260 __asm__ __volatile__(LOCK_PREFIX "cmpxchgl %k1,%2"
261 : "=a"(prev) 261 : "=a"(prev)
262 : "q"(new), "m"(*__xg(ptr)), "0"(old) 262 : "r"(new), "m"(*__xg(ptr)), "0"(old)
263 : "memory"); 263 : "memory");
264 return prev; 264 return prev;
265 case 8: 265 case 8:
266 __asm__ __volatile__(LOCK_PREFIX "cmpxchgq %1,%2" 266 __asm__ __volatile__(LOCK_PREFIX "cmpxchgq %1,%2"
267 : "=a"(prev) 267 : "=a"(prev)
268 : "q"(new), "m"(*__xg(ptr)), "0"(old) 268 : "r"(new), "m"(*__xg(ptr)), "0"(old)
269 : "memory"); 269 : "memory");
270 return prev; 270 return prev;
271 } 271 }
diff --git a/include/asm-x86_64/timex.h b/include/asm-x86_64/timex.h
index 24ecf6a637cb..f971f45d6d78 100644
--- a/include/asm-x86_64/timex.h
+++ b/include/asm-x86_64/timex.h
@@ -6,7 +6,6 @@
6#ifndef _ASMx8664_TIMEX_H 6#ifndef _ASMx8664_TIMEX_H
7#define _ASMx8664_TIMEX_H 7#define _ASMx8664_TIMEX_H
8 8
9#include <linux/config.h>
10#include <asm/8253pit.h> 9#include <asm/8253pit.h>
11#include <asm/msr.h> 10#include <asm/msr.h>
12#include <asm/vsyscall.h> 11#include <asm/vsyscall.h>
diff --git a/include/asm-x86_64/tlbflush.h b/include/asm-x86_64/tlbflush.h
index 505b0cf906de..4a9c20ea9b10 100644
--- a/include/asm-x86_64/tlbflush.h
+++ b/include/asm-x86_64/tlbflush.h
@@ -109,6 +109,10 @@ static inline void flush_tlb_range(struct vm_area_struct * vma, unsigned long st
109#define TLBSTATE_OK 1 109#define TLBSTATE_OK 1
110#define TLBSTATE_LAZY 2 110#define TLBSTATE_LAZY 2
111 111
112/* Roughly an IPI every 20MB with 4k pages for freeing page table
113 ranges. Cost is about 42k of memory for each CPU. */
114#define ARCH_FREE_PTE_NR 5350
115
112#endif 116#endif
113 117
114#define flush_tlb_kernel_range(start, end) flush_tlb_all() 118#define flush_tlb_kernel_range(start, end) flush_tlb_all()
diff --git a/include/asm-x86_64/topology.h b/include/asm-x86_64/topology.h
index c1bc3fad482e..1c603cd7e4d0 100644
--- a/include/asm-x86_64/topology.h
+++ b/include/asm-x86_64/topology.h
@@ -13,7 +13,6 @@
13extern cpumask_t cpu_online_map; 13extern cpumask_t cpu_online_map;
14 14
15extern unsigned char cpu_to_node[]; 15extern unsigned char cpu_to_node[];
16extern unsigned char pci_bus_to_node[];
17extern cpumask_t node_to_cpumask[]; 16extern cpumask_t node_to_cpumask[];
18 17
19#ifdef CONFIG_ACPI_NUMA 18#ifdef CONFIG_ACPI_NUMA
@@ -26,7 +25,7 @@ extern int __node_distance(int, int);
26#define parent_node(node) (node) 25#define parent_node(node) (node)
27#define node_to_first_cpu(node) (__ffs(node_to_cpumask[node])) 26#define node_to_first_cpu(node) (__ffs(node_to_cpumask[node]))
28#define node_to_cpumask(node) (node_to_cpumask[node]) 27#define node_to_cpumask(node) (node_to_cpumask[node])
29#define pcibus_to_node(bus) pci_bus_to_node[(bus)->number] 28#define pcibus_to_node(bus) ((long)(bus->sysdata))
30#define pcibus_to_cpumask(bus) node_to_cpumask(pcibus_to_node(bus)); 29#define pcibus_to_cpumask(bus) node_to_cpumask(pcibus_to_node(bus));
31 30
32/* sched_domains SD_NODE_INIT for x86_64 machines */ 31/* sched_domains SD_NODE_INIT for x86_64 machines */
diff --git a/include/asm-x86_64/vsyscall.h b/include/asm-x86_64/vsyscall.h
index 2872da23fc7e..438a3f52f839 100644
--- a/include/asm-x86_64/vsyscall.h
+++ b/include/asm-x86_64/vsyscall.h
@@ -29,7 +29,6 @@ enum vsyscall_num {
29 29
30struct vxtime_data { 30struct vxtime_data {
31 long hpet_address; /* HPET base address */ 31 long hpet_address; /* HPET base address */
32 unsigned long hz; /* HPET clocks / sec */
33 int last; 32 int last;
34 unsigned long last_tsc; 33 unsigned long last_tsc;
35 long quot; 34 long quot;
diff --git a/include/asm-xtensa/ptrace.h b/include/asm-xtensa/ptrace.h
index 2848a5ff8349..aa4fd7fb3ce7 100644
--- a/include/asm-xtensa/ptrace.h
+++ b/include/asm-xtensa/ptrace.h
@@ -127,7 +127,7 @@ extern void show_regs(struct pt_regs *);
127#else /* __ASSEMBLY__ */ 127#else /* __ASSEMBLY__ */
128 128
129#ifdef __KERNEL__ 129#ifdef __KERNEL__
130# include <asm/offsets.h> 130# include <asm/asm-offsets.h>
131#define PT_REGS_OFFSET (KERNEL_STACK_SIZE - PT_USER_SIZE) 131#define PT_REGS_OFFSET (KERNEL_STACK_SIZE - PT_USER_SIZE)
132#endif 132#endif
133 133
diff --git a/include/asm-xtensa/uaccess.h b/include/asm-xtensa/uaccess.h
index fc268ac923c0..06a22b83ba17 100644
--- a/include/asm-xtensa/uaccess.h
+++ b/include/asm-xtensa/uaccess.h
@@ -25,7 +25,7 @@
25 25
26#define _ASMLANGUAGE 26#define _ASMLANGUAGE
27#include <asm/current.h> 27#include <asm/current.h>
28#include <asm/offsets.h> 28#include <asm/asm-offsets.h>
29#include <asm/processor.h> 29#include <asm/processor.h>
30 30
31/* 31/*
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index b46a5205ee7b..026c3c011dc0 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -41,7 +41,7 @@
41#include <asm/acpi.h> 41#include <asm/acpi.h>
42 42
43 43
44#ifdef CONFIG_ACPI_BOOT 44#ifdef CONFIG_ACPI
45 45
46enum acpi_irq_model_id { 46enum acpi_irq_model_id {
47 ACPI_IRQ_MODEL_PIC = 0, 47 ACPI_IRQ_MODEL_PIC = 0,
@@ -429,23 +429,13 @@ extern int pci_mmcfg_config_num;
429 429
430extern int sbf_port ; 430extern int sbf_port ;
431 431
432#else /*!CONFIG_ACPI_BOOT*/ 432#else /* !CONFIG_ACPI */
433 433
434#define acpi_mp_config 0 434#define acpi_mp_config 0
435 435
436static inline int acpi_boot_init(void) 436#endif /* !CONFIG_ACPI */
437{
438 return 0;
439}
440
441static inline int acpi_boot_table_init(void)
442{
443 return 0;
444}
445 437
446#endif /*!CONFIG_ACPI_BOOT*/ 438int acpi_register_gsi (u32 gsi, int edge_level, int active_high_low);
447
448unsigned int acpi_register_gsi (u32 gsi, int edge_level, int active_high_low);
449int acpi_gsi_to_irq (u32 gsi, unsigned int *irq); 439int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
450 440
451/* 441/*
@@ -455,7 +445,7 @@ int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
455 */ 445 */
456void acpi_unregister_gsi (u32 gsi); 446void acpi_unregister_gsi (u32 gsi);
457 447
458#ifdef CONFIG_ACPI_PCI 448#ifdef CONFIG_ACPI
459 449
460struct acpi_prt_entry { 450struct acpi_prt_entry {
461 struct list_head node; 451 struct list_head node;
@@ -489,7 +479,7 @@ struct acpi_pci_driver {
489int acpi_pci_register_driver(struct acpi_pci_driver *driver); 479int acpi_pci_register_driver(struct acpi_pci_driver *driver);
490void acpi_pci_unregister_driver(struct acpi_pci_driver *driver); 480void acpi_pci_unregister_driver(struct acpi_pci_driver *driver);
491 481
492#endif /*CONFIG_ACPI_PCI*/ 482#endif /* CONFIG_ACPI */
493 483
494#ifdef CONFIG_ACPI_EC 484#ifdef CONFIG_ACPI_EC
495 485
@@ -498,20 +488,9 @@ extern int ec_write(u8 addr, u8 val);
498 488
499#endif /*CONFIG_ACPI_EC*/ 489#endif /*CONFIG_ACPI_EC*/
500 490
501#ifdef CONFIG_ACPI_INTERPRETER
502
503extern int acpi_blacklisted(void); 491extern int acpi_blacklisted(void);
504extern void acpi_bios_year(char *s); 492extern void acpi_bios_year(char *s);
505 493
506#else /*!CONFIG_ACPI_INTERPRETER*/
507
508static inline int acpi_blacklisted(void)
509{
510 return 0;
511}
512
513#endif /*!CONFIG_ACPI_INTERPRETER*/
514
515#define ACPI_CSTATE_LIMIT_DEFINED /* for driver builds */ 494#define ACPI_CSTATE_LIMIT_DEFINED /* for driver builds */
516#ifdef CONFIG_ACPI 495#ifdef CONFIG_ACPI
517 496
@@ -549,5 +528,17 @@ static inline int acpi_get_pxm(acpi_handle handle)
549 528
550extern int pnpacpi_disabled; 529extern int pnpacpi_disabled;
551 530
531#else /* CONFIG_ACPI */
532
533static inline int acpi_boot_init(void)
534{
535 return 0;
536}
537
538static inline int acpi_boot_table_init(void)
539{
540 return 0;
541}
542
552#endif /* CONFIG_ACPI */ 543#endif /* CONFIG_ACPI */
553#endif /*_LINUX_ACPI_H*/ 544#endif /*_LINUX_ACPI_H*/
diff --git a/include/linux/bfs_fs.h b/include/linux/bfs_fs.h
index f7f0913cd110..c1237aa92e38 100644
--- a/include/linux/bfs_fs.h
+++ b/include/linux/bfs_fs.h
@@ -14,8 +14,9 @@
14#define BFS_INODES_PER_BLOCK 8 14#define BFS_INODES_PER_BLOCK 8
15 15
16/* SVR4 vnode type values (bfs_inode->i_vtype) */ 16/* SVR4 vnode type values (bfs_inode->i_vtype) */
17#define BFS_VDIR 2 17#define BFS_VDIR 2L
18#define BFS_VREG 1 18#define BFS_VREG 1L
19
19 20
20/* BFS inode layout on disk */ 21/* BFS inode layout on disk */
21struct bfs_inode { 22struct bfs_inode {
@@ -58,22 +59,22 @@ struct bfs_super_block {
58 __u32 s_padding[118]; 59 __u32 s_padding[118];
59}; 60};
60 61
61#define BFS_NZFILESIZE(ip) \
62 (((ip)->i_eoffset + 1) - (ip)->i_sblock * BFS_BSIZE)
63
64#define BFS_FILESIZE(ip) \
65 ((ip)->i_sblock == 0 ? 0 : BFS_NZFILESIZE(ip))
66
67#define BFS_FILEBLOCKS(ip) \
68 ((ip)->i_sblock == 0 ? 0 : ((ip)->i_eblock + 1) - (ip)->i_sblock)
69 62
70#define BFS_OFF2INO(offset) \ 63#define BFS_OFF2INO(offset) \
71 ((((offset) - BFS_BSIZE) / sizeof(struct bfs_inode)) + BFS_ROOT_INO) 64 ((((offset) - BFS_BSIZE) / sizeof(struct bfs_inode)) + BFS_ROOT_INO)
72 65
73#define BFS_INO2OFF(ino) \ 66#define BFS_INO2OFF(ino) \
74 ((__u32)(((ino) - BFS_ROOT_INO) * sizeof(struct bfs_inode)) + BFS_BSIZE) 67 ((__u32)(((ino) - BFS_ROOT_INO) * sizeof(struct bfs_inode)) + BFS_BSIZE)
68#define BFS_NZFILESIZE(ip) \
69 ((cpu_to_le32((ip)->i_eoffset) + 1) - cpu_to_le32((ip)->i_sblock) * BFS_BSIZE)
70
71#define BFS_FILESIZE(ip) \
72 ((ip)->i_sblock == 0 ? 0 : BFS_NZFILESIZE(ip))
75 73
74#define BFS_FILEBLOCKS(ip) \
75 ((ip)->i_sblock == 0 ? 0 : (cpu_to_le32((ip)->i_eblock) + 1) - cpu_to_le32((ip)->i_sblock))
76#define BFS_UNCLEAN(bfs_sb, sb) \ 76#define BFS_UNCLEAN(bfs_sb, sb) \
77 ((bfs_sb->s_from != -1) && (bfs_sb->s_to != -1) && !(sb->s_flags & MS_RDONLY)) 77 ((cpu_to_le32(bfs_sb->s_from) != -1) && (cpu_to_le32(bfs_sb->s_to) != -1) && !(sb->s_flags & MS_RDONLY))
78
78 79
79#endif /* _LINUX_BFS_FS_H */ 80#endif /* _LINUX_BFS_FS_H */
diff --git a/include/linux/bio.h b/include/linux/bio.h
index cdaf03a14a51..6e1c79c8b6bf 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -314,9 +314,8 @@ void zero_fill_bio(struct bio *bio);
314 * bvec_kmap_irq and bvec_kunmap_irq!! 314 * bvec_kmap_irq and bvec_kunmap_irq!!
315 * 315 *
316 * This function MUST be inlined - it plays with the CPU interrupt flags. 316 * This function MUST be inlined - it plays with the CPU interrupt flags.
317 * Hence the `extern inline'.
318 */ 317 */
319extern inline char *bvec_kmap_irq(struct bio_vec *bvec, unsigned long *flags) 318static inline char *bvec_kmap_irq(struct bio_vec *bvec, unsigned long *flags)
320{ 319{
321 unsigned long addr; 320 unsigned long addr;
322 321
@@ -332,7 +331,7 @@ extern inline char *bvec_kmap_irq(struct bio_vec *bvec, unsigned long *flags)
332 return (char *) addr + bvec->bv_offset; 331 return (char *) addr + bvec->bv_offset;
333} 332}
334 333
335extern inline void bvec_kunmap_irq(char *buffer, unsigned long *flags) 334static inline void bvec_kunmap_irq(char *buffer, unsigned long *flags)
336{ 335{
337 unsigned long ptr = (unsigned long) buffer & PAGE_MASK; 336 unsigned long ptr = (unsigned long) buffer & PAGE_MASK;
338 337
@@ -345,7 +344,7 @@ extern inline void bvec_kunmap_irq(char *buffer, unsigned long *flags)
345#define bvec_kunmap_irq(buf, flags) do { *(flags) = 0; } while (0) 344#define bvec_kunmap_irq(buf, flags) do { *(flags) = 0; } while (0)
346#endif 345#endif
347 346
348extern inline char *__bio_kmap_irq(struct bio *bio, unsigned short idx, 347static inline char *__bio_kmap_irq(struct bio *bio, unsigned short idx,
349 unsigned long *flags) 348 unsigned long *flags)
350{ 349{
351 return bvec_kmap_irq(bio_iovec_idx(bio, idx), flags); 350 return bvec_kmap_irq(bio_iovec_idx(bio, idx), flags);
diff --git a/include/linux/bit_spinlock.h b/include/linux/bit_spinlock.h
new file mode 100644
index 000000000000..6b20af0bbb79
--- /dev/null
+++ b/include/linux/bit_spinlock.h
@@ -0,0 +1,77 @@
1#ifndef __LINUX_BIT_SPINLOCK_H
2#define __LINUX_BIT_SPINLOCK_H
3
4/*
5 * bit-based spin_lock()
6 *
7 * Don't use this unless you really need to: spin_lock() and spin_unlock()
8 * are significantly faster.
9 */
10static inline void bit_spin_lock(int bitnum, unsigned long *addr)
11{
12 /*
13 * Assuming the lock is uncontended, this never enters
14 * the body of the outer loop. If it is contended, then
15 * within the inner loop a non-atomic test is used to
16 * busywait with less bus contention for a good time to
17 * attempt to acquire the lock bit.
18 */
19 preempt_disable();
20#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
21 while (test_and_set_bit(bitnum, addr)) {
22 while (test_bit(bitnum, addr)) {
23 preempt_enable();
24 cpu_relax();
25 preempt_disable();
26 }
27 }
28#endif
29 __acquire(bitlock);
30}
31
32/*
33 * Return true if it was acquired
34 */
35static inline int bit_spin_trylock(int bitnum, unsigned long *addr)
36{
37 preempt_disable();
38#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
39 if (test_and_set_bit(bitnum, addr)) {
40 preempt_enable();
41 return 0;
42 }
43#endif
44 __acquire(bitlock);
45 return 1;
46}
47
48/*
49 * bit-based spin_unlock()
50 */
51static inline void bit_spin_unlock(int bitnum, unsigned long *addr)
52{
53#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
54 BUG_ON(!test_bit(bitnum, addr));
55 smp_mb__before_clear_bit();
56 clear_bit(bitnum, addr);
57#endif
58 preempt_enable();
59 __release(bitlock);
60}
61
62/*
63 * Return true if the lock is held.
64 */
65static inline int bit_spin_is_locked(int bitnum, unsigned long *addr)
66{
67#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
68 return test_bit(bitnum, addr);
69#elif defined CONFIG_PREEMPT
70 return preempt_count();
71#else
72 return 1;
73#endif
74}
75
76#endif /* __LINUX_BIT_SPINLOCK_H */
77
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index aefa26fbae8a..efdc9b5bc05c 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -728,7 +728,7 @@ static inline unsigned int blksize_bits(unsigned int size)
728 return bits; 728 return bits;
729} 729}
730 730
731extern inline unsigned int block_size(struct block_device *bdev) 731static inline unsigned int block_size(struct block_device *bdev)
732{ 732{
733 return bdev->bd_block_size; 733 return bdev->bd_block_size;
734} 734}
diff --git a/include/linux/chio.h b/include/linux/chio.h
index 63035ae67e63..a404c111c937 100644
--- a/include/linux/chio.h
+++ b/include/linux/chio.h
@@ -96,7 +96,7 @@ struct changer_position {
96 */ 96 */
97struct changer_element_status { 97struct changer_element_status {
98 int ces_type; 98 int ces_type;
99 unsigned char *ces_data; 99 unsigned char __user *ces_data;
100}; 100};
101#define CESTATUS_FULL 0x01 /* full */ 101#define CESTATUS_FULL 0x01 /* full */
102#define CESTATUS_IMPEXP 0x02 /* media was imported (inserted by sysop) */ 102#define CESTATUS_IMPEXP 0x02 /* media was imported (inserted by sysop) */
diff --git a/include/linux/connector.h b/include/linux/connector.h
new file mode 100644
index 000000000000..96de26301f84
--- /dev/null
+++ b/include/linux/connector.h
@@ -0,0 +1,158 @@
1/*
2 * connector.h
3 *
4 * 2004-2005 Copyright (c) Evgeniy Polyakov <johnpol@2ka.mipt.ru>
5 * All rights reserved.
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 Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#ifndef __CONNECTOR_H
23#define __CONNECTOR_H
24
25#include <asm/types.h>
26
27#define CN_IDX_CONNECTOR 0xffffffff
28#define CN_VAL_CONNECTOR 0xffffffff
29
30#define CN_NETLINK_USERS 1
31
32/*
33 * Maximum connector's message size.
34 */
35#define CONNECTOR_MAX_MSG_SIZE 1024
36
37/*
38 * idx and val are unique identifiers which
39 * are used for message routing and
40 * must be registered in connector.h for in-kernel usage.
41 */
42
43struct cb_id {
44 __u32 idx;
45 __u32 val;
46};
47
48struct cn_msg {
49 struct cb_id id;
50
51 __u32 seq;
52 __u32 ack;
53
54 __u16 len; /* Length of the following data */
55 __u16 flags;
56 __u8 data[0];
57};
58
59/*
60 * Notify structure - requests notification about
61 * registering/unregistering idx/val in range [first, first+range].
62 */
63struct cn_notify_req {
64 __u32 first;
65 __u32 range;
66};
67
68/*
69 * Main notification control message
70 * *_notify_num - number of appropriate cn_notify_req structures after
71 * this struct.
72 * group - notification receiver's idx.
73 * len - total length of the attached data.
74 */
75struct cn_ctl_msg {
76 __u32 idx_notify_num;
77 __u32 val_notify_num;
78 __u32 group;
79 __u32 len;
80 __u8 data[0];
81};
82
83#ifdef __KERNEL__
84
85#include <asm/atomic.h>
86
87#include <linux/list.h>
88#include <linux/workqueue.h>
89
90#include <net/sock.h>
91
92#define CN_CBQ_NAMELEN 32
93
94struct cn_queue_dev {
95 atomic_t refcnt;
96 unsigned char name[CN_CBQ_NAMELEN];
97
98 struct workqueue_struct *cn_queue;
99
100 struct list_head queue_list;
101 spinlock_t queue_lock;
102
103 int netlink_groups;
104 struct sock *nls;
105};
106
107struct cn_callback {
108 unsigned char name[CN_CBQ_NAMELEN];
109
110 struct cb_id id;
111 void (*callback) (void *);
112 void *priv;
113};
114
115struct cn_callback_entry {
116 struct list_head callback_entry;
117 struct cn_callback *cb;
118 struct work_struct work;
119 struct cn_queue_dev *pdev;
120
121 void (*destruct_data) (void *);
122 void *ddata;
123
124 int seq, group;
125 struct sock *nls;
126};
127
128struct cn_ctl_entry {
129 struct list_head notify_entry;
130 struct cn_ctl_msg *msg;
131};
132
133struct cn_dev {
134 struct cb_id id;
135
136 u32 seq, groups;
137 struct sock *nls;
138 void (*input) (struct sock * sk, int len);
139
140 struct cn_queue_dev *cbdev;
141};
142
143int cn_add_callback(struct cb_id *, char *, void (*callback) (void *));
144void cn_del_callback(struct cb_id *);
145int cn_netlink_send(struct cn_msg *, u32, int);
146
147int cn_queue_add_callback(struct cn_queue_dev *dev, struct cn_callback *cb);
148void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id);
149
150struct cn_queue_dev *cn_queue_alloc_dev(char *name, struct sock *);
151void cn_queue_free_dev(struct cn_queue_dev *dev);
152
153int cn_cb_equal(struct cb_id *, struct cb_id *);
154
155extern int cn_already_initialized;
156
157#endif /* __KERNEL__ */
158#endif /* __CONNECTOR_H */
diff --git a/include/linux/crc16.h b/include/linux/crc16.h
new file mode 100644
index 000000000000..9443c084f881
--- /dev/null
+++ b/include/linux/crc16.h
@@ -0,0 +1,30 @@
1/*
2 * crc16.h - CRC-16 routine
3 *
4 * Implements the standard CRC-16:
5 * Width 16
6 * Poly 0x8005 (x^16 + x^15 + x^2 + 1)
7 * Init 0
8 *
9 * Copyright (c) 2005 Ben Gardner <bgardner@wabtec.com>
10 *
11 * This source code is licensed under the GNU General Public License,
12 * Version 2. See the file COPYING for more details.
13 */
14
15#ifndef __CRC16_H
16#define __CRC16_H
17
18#include <linux/types.h>
19
20extern u16 const crc16_table[256];
21
22extern u16 crc16(u16 crc, const u8 *buffer, size_t len);
23
24static inline u16 crc16_byte(u16 crc, const u8 data)
25{
26 return (crc >> 8) ^ crc16_table[(crc ^ data) & 0xff];
27}
28
29#endif /* __CRC16_H */
30
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index 007c290f74d4..8bf4bacb5051 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -432,7 +432,10 @@ struct dccp_sock {
432 struct ccid *dccps_hc_rx_ccid; 432 struct ccid *dccps_hc_rx_ccid;
433 struct ccid *dccps_hc_tx_ccid; 433 struct ccid *dccps_hc_tx_ccid;
434 struct dccp_options_received dccps_options_received; 434 struct dccp_options_received dccps_options_received;
435 struct timeval dccps_epoch;
435 enum dccp_role dccps_role:2; 436 enum dccp_role dccps_role:2;
437 __u8 dccps_hc_rx_insert_options:1;
438 __u8 dccps_hc_tx_insert_options:1;
436}; 439};
437 440
438static inline struct dccp_sock *dccp_sk(const struct sock *sk) 441static inline struct dccp_sock *dccp_sk(const struct sock *sk)
diff --git a/include/linux/dmapool.h b/include/linux/dmapool.h
index e60bfdac348d..4932ee5c77f0 100644
--- a/include/linux/dmapool.h
+++ b/include/linux/dmapool.h
@@ -19,7 +19,8 @@ struct dma_pool *dma_pool_create(const char *name, struct device *dev,
19 19
20void dma_pool_destroy(struct dma_pool *pool); 20void dma_pool_destroy(struct dma_pool *pool);
21 21
22void *dma_pool_alloc(struct dma_pool *pool, int mem_flags, dma_addr_t *handle); 22void *dma_pool_alloc(struct dma_pool *pool, unsigned int __nocast mem_flags,
23 dma_addr_t *handle);
23 24
24void dma_pool_free(struct dma_pool *pool, void *vaddr, dma_addr_t addr); 25void dma_pool_free(struct dma_pool *pool, void *vaddr, dma_addr_t addr);
25 26
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index c30175e8dec6..a415f1d93e9a 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -70,7 +70,7 @@ extern struct dmi_device * dmi_find_device(int type, const char *name,
70 70
71static inline int dmi_check_system(struct dmi_system_id *list) { return 0; } 71static inline int dmi_check_system(struct dmi_system_id *list) { return 0; }
72static inline char * dmi_get_system_info(int field) { return NULL; } 72static inline char * dmi_get_system_info(int field) { return NULL; }
73static struct dmi_device * dmi_find_device(int type, const char *name, 73static inline struct dmi_device * dmi_find_device(int type, const char *name,
74 struct dmi_device *from) { return NULL; } 74 struct dmi_device *from) { return NULL; }
75 75
76#endif 76#endif
diff --git a/include/linux/fb.h b/include/linux/fb.h
index bc24beeed971..82e39cd0c4fb 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -107,6 +107,8 @@
107#define FB_ACCEL_NV_20 44 /* nVidia Arch 20 */ 107#define FB_ACCEL_NV_20 44 /* nVidia Arch 20 */
108#define FB_ACCEL_NV_30 45 /* nVidia Arch 30 */ 108#define FB_ACCEL_NV_30 45 /* nVidia Arch 30 */
109#define FB_ACCEL_NV_40 46 /* nVidia Arch 40 */ 109#define FB_ACCEL_NV_40 46 /* nVidia Arch 40 */
110#define FB_ACCEL_XGI_VOLARI_V 47 /* XGI Volari V3XT, V5, V8 */
111#define FB_ACCEL_XGI_VOLARI_Z 48 /* XGI Volari Z7 */
110#define FB_ACCEL_NEOMAGIC_NM2070 90 /* NeoMagic NM2070 */ 112#define FB_ACCEL_NEOMAGIC_NM2070 90 /* NeoMagic NM2070 */
111#define FB_ACCEL_NEOMAGIC_NM2090 91 /* NeoMagic NM2090 */ 113#define FB_ACCEL_NEOMAGIC_NM2090 91 /* NeoMagic NM2090 */
112#define FB_ACCEL_NEOMAGIC_NM2093 92 /* NeoMagic NM2093 */ 114#define FB_ACCEL_NEOMAGIC_NM2093 92 /* NeoMagic NM2093 */
@@ -495,6 +497,9 @@ struct fb_cursor_user {
495#define FB_EVENT_BLANK 0x08 497#define FB_EVENT_BLANK 0x08
496/* Private modelist is to be replaced */ 498/* Private modelist is to be replaced */
497#define FB_EVENT_NEW_MODELIST 0x09 499#define FB_EVENT_NEW_MODELIST 0x09
500/* The resolution of the passed in fb_info about to change and
501 all vc's should be changed */
502#define FB_EVENT_MODE_CHANGE_ALL 0x0A
498 503
499struct fb_event { 504struct fb_event {
500 struct fb_info *info; 505 struct fb_info *info;
@@ -820,13 +825,29 @@ extern void fb_pad_unaligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 idx,
820 u32 height, u32 shift_high, u32 shift_low, u32 mod); 825 u32 height, u32 shift_high, u32 shift_low, u32 mod);
821extern void fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, u32 height); 826extern void fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, u32 height);
822extern void fb_set_suspend(struct fb_info *info, int state); 827extern void fb_set_suspend(struct fb_info *info, int state);
823extern int fb_get_color_depth(struct fb_var_screeninfo *var); 828extern int fb_get_color_depth(struct fb_var_screeninfo *var,
829 struct fb_fix_screeninfo *fix);
824extern int fb_get_options(char *name, char **option); 830extern int fb_get_options(char *name, char **option);
825extern int fb_new_modelist(struct fb_info *info); 831extern int fb_new_modelist(struct fb_info *info);
826 832
827extern struct fb_info *registered_fb[FB_MAX]; 833extern struct fb_info *registered_fb[FB_MAX];
828extern int num_registered_fb; 834extern int num_registered_fb;
829 835
836static inline void __fb_pad_aligned_buffer(u8 *dst, u32 d_pitch,
837 u8 *src, u32 s_pitch, u32 height)
838{
839 int i, j;
840
841 d_pitch -= s_pitch;
842
843 for (i = height; i--; ) {
844 /* s_pitch is a few bytes at the most, memcpy is suboptimal */
845 for (j = 0; j < s_pitch; j++)
846 *dst++ = *src++;
847 dst += d_pitch;
848 }
849}
850
830/* drivers/video/fbsysfs.c */ 851/* drivers/video/fbsysfs.c */
831extern struct fb_info *framebuffer_alloc(size_t size, struct device *dev); 852extern struct fb_info *framebuffer_alloc(size_t size, struct device *dev);
832extern void framebuffer_release(struct fb_info *info); 853extern void framebuffer_release(struct fb_info *info);
@@ -856,8 +877,11 @@ extern int fb_get_mode(int flags, u32 val, struct fb_var_screeninfo *var,
856extern int fb_validate_mode(const struct fb_var_screeninfo *var, 877extern int fb_validate_mode(const struct fb_var_screeninfo *var,
857 struct fb_info *info); 878 struct fb_info *info);
858extern int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var); 879extern int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var);
859extern void fb_edid_to_monspecs(unsigned char *edid, struct fb_monspecs *specs); 880extern const unsigned char *fb_firmware_edid(struct device *device);
881extern void fb_edid_to_monspecs(unsigned char *edid,
882 struct fb_monspecs *specs);
860extern void fb_destroy_modedb(struct fb_videomode *modedb); 883extern void fb_destroy_modedb(struct fb_videomode *modedb);
884extern int fb_find_mode_cvt(struct fb_videomode *mode, int margins, int rb);
861 885
862/* drivers/video/modedb.c */ 886/* drivers/video/modedb.c */
863#define VESA_MODEDB_SIZE 34 887#define VESA_MODEDB_SIZE 34
diff --git a/include/linux/file.h b/include/linux/file.h
index 5206beb9a80e..f5bbd4c508b3 100644
--- a/include/linux/file.h
+++ b/include/linux/file.h
@@ -9,6 +9,7 @@
9#include <linux/posix_types.h> 9#include <linux/posix_types.h>
10#include <linux/compiler.h> 10#include <linux/compiler.h>
11#include <linux/spinlock.h> 11#include <linux/spinlock.h>
12#include <linux/rcupdate.h>
12 13
13/* 14/*
14 * The default fd array needs to be at least BITS_PER_LONG, 15 * The default fd array needs to be at least BITS_PER_LONG,
@@ -16,23 +17,33 @@
16 */ 17 */
17#define NR_OPEN_DEFAULT BITS_PER_LONG 18#define NR_OPEN_DEFAULT BITS_PER_LONG
18 19
20struct fdtable {
21 unsigned int max_fds;
22 int max_fdset;
23 int next_fd;
24 struct file ** fd; /* current fd array */
25 fd_set *close_on_exec;
26 fd_set *open_fds;
27 struct rcu_head rcu;
28 struct files_struct *free_files;
29 struct fdtable *next;
30};
31
19/* 32/*
20 * Open file table structure 33 * Open file table structure
21 */ 34 */
22struct files_struct { 35struct files_struct {
23 atomic_t count; 36 atomic_t count;
24 spinlock_t file_lock; /* Protects all the below members. Nests inside tsk->alloc_lock */ 37 spinlock_t file_lock; /* Protects all the below members. Nests inside tsk->alloc_lock */
25 int max_fds; 38 struct fdtable *fdt;
26 int max_fdset; 39 struct fdtable fdtab;
27 int next_fd;
28 struct file ** fd; /* current fd array */
29 fd_set *close_on_exec;
30 fd_set *open_fds;
31 fd_set close_on_exec_init; 40 fd_set close_on_exec_init;
32 fd_set open_fds_init; 41 fd_set open_fds_init;
33 struct file * fd_array[NR_OPEN_DEFAULT]; 42 struct file * fd_array[NR_OPEN_DEFAULT];
34}; 43};
35 44
45#define files_fdtable(files) (rcu_dereference((files)->fdt))
46
36extern void FASTCALL(__fput(struct file *)); 47extern void FASTCALL(__fput(struct file *));
37extern void FASTCALL(fput(struct file *)); 48extern void FASTCALL(fput(struct file *));
38 49
@@ -59,13 +70,16 @@ extern fd_set *alloc_fdset(int);
59extern void free_fdset(fd_set *, int); 70extern void free_fdset(fd_set *, int);
60 71
61extern int expand_files(struct files_struct *, int nr); 72extern int expand_files(struct files_struct *, int nr);
73extern void free_fdtable(struct fdtable *fdt);
74extern void __init files_defer_init(void);
62 75
63static inline struct file * fcheck_files(struct files_struct *files, unsigned int fd) 76static inline struct file * fcheck_files(struct files_struct *files, unsigned int fd)
64{ 77{
65 struct file * file = NULL; 78 struct file * file = NULL;
79 struct fdtable *fdt = files_fdtable(files);
66 80
67 if (fd < files->max_fds) 81 if (fd < fdt->max_fds)
68 file = files->fd[fd]; 82 file = rcu_dereference(fdt->fd[fd]);
69 return file; 83 return file;
70} 84}
71 85
diff --git a/include/linux/fs.h b/include/linux/fs.h
index fd93ab7da905..e0b77c5af9a0 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -9,6 +9,7 @@
9#include <linux/config.h> 9#include <linux/config.h>
10#include <linux/limits.h> 10#include <linux/limits.h>
11#include <linux/ioctl.h> 11#include <linux/ioctl.h>
12#include <linux/rcuref.h>
12 13
13/* 14/*
14 * It's silly to have NR_OPEN bigger than NR_FILE, but you can change 15 * It's silly to have NR_OPEN bigger than NR_FILE, but you can change
@@ -597,12 +598,13 @@ struct file {
597 spinlock_t f_ep_lock; 598 spinlock_t f_ep_lock;
598#endif /* #ifdef CONFIG_EPOLL */ 599#endif /* #ifdef CONFIG_EPOLL */
599 struct address_space *f_mapping; 600 struct address_space *f_mapping;
601 struct rcu_head f_rcuhead;
600}; 602};
601extern spinlock_t files_lock; 603extern spinlock_t files_lock;
602#define file_list_lock() spin_lock(&files_lock); 604#define file_list_lock() spin_lock(&files_lock);
603#define file_list_unlock() spin_unlock(&files_lock); 605#define file_list_unlock() spin_unlock(&files_lock);
604 606
605#define get_file(x) atomic_inc(&(x)->f_count) 607#define get_file(x) rcuref_inc(&(x)->f_count)
606#define file_count(x) atomic_read(&(x)->f_count) 608#define file_count(x) atomic_read(&(x)->f_count)
607 609
608#define MAX_NON_LFS ((1UL<<31) - 1) 610#define MAX_NON_LFS ((1UL<<31) - 1)
@@ -1507,8 +1509,6 @@ extern void do_generic_mapping_read(struct address_space *mapping,
1507 loff_t *, read_descriptor_t *, read_actor_t); 1509 loff_t *, read_descriptor_t *, read_actor_t);
1508extern void 1510extern void
1509file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping); 1511file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping);
1510extern ssize_t generic_file_direct_IO(int rw, struct kiocb *iocb,
1511 const struct iovec *iov, loff_t offset, unsigned long nr_segs);
1512extern ssize_t generic_file_readv(struct file *filp, const struct iovec *iov, 1512extern ssize_t generic_file_readv(struct file *filp, const struct iovec *iov,
1513 unsigned long nr_segs, loff_t *ppos); 1513 unsigned long nr_segs, loff_t *ppos);
1514ssize_t generic_file_writev(struct file *filp, const struct iovec *iov, 1514ssize_t generic_file_writev(struct file *filp, const struct iovec *iov,
diff --git a/include/linux/fuse.h b/include/linux/fuse.h
new file mode 100644
index 000000000000..acbeb96a3353
--- /dev/null
+++ b/include/linux/fuse.h
@@ -0,0 +1,259 @@
1/*
2 FUSE: Filesystem in Userspace
3 Copyright (C) 2001-2005 Miklos Szeredi <miklos@szeredi.hu>
4
5 This program can be distributed under the terms of the GNU GPL.
6 See the file COPYING.
7*/
8
9/* This file defines the kernel interface of FUSE */
10
11#include <asm/types.h>
12
13/** Version number of this interface */
14#define FUSE_KERNEL_VERSION 7
15
16/** Minor version number of this interface */
17#define FUSE_KERNEL_MINOR_VERSION 2
18
19/** The node ID of the root inode */
20#define FUSE_ROOT_ID 1
21
22/** The major number of the fuse character device */
23#define FUSE_MAJOR 10
24
25/** The minor number of the fuse character device */
26#define FUSE_MINOR 229
27
28/* Make sure all structures are padded to 64bit boundary, so 32bit
29 userspace works under 64bit kernels */
30
31struct fuse_attr {
32 __u64 ino;
33 __u64 size;
34 __u64 blocks;
35 __u64 atime;
36 __u64 mtime;
37 __u64 ctime;
38 __u32 atimensec;
39 __u32 mtimensec;
40 __u32 ctimensec;
41 __u32 mode;
42 __u32 nlink;
43 __u32 uid;
44 __u32 gid;
45 __u32 rdev;
46};
47
48struct fuse_kstatfs {
49 __u64 blocks;
50 __u64 bfree;
51 __u64 bavail;
52 __u64 files;
53 __u64 ffree;
54 __u32 bsize;
55 __u32 namelen;
56};
57
58#define FATTR_MODE (1 << 0)
59#define FATTR_UID (1 << 1)
60#define FATTR_GID (1 << 2)
61#define FATTR_SIZE (1 << 3)
62#define FATTR_ATIME (1 << 4)
63#define FATTR_MTIME (1 << 5)
64#define FATTR_CTIME (1 << 6)
65
66/**
67 * Flags returned by the OPEN request
68 *
69 * FOPEN_DIRECT_IO: bypass page cache for this open file
70 * FOPEN_KEEP_CACHE: don't invalidate the data cache on open
71 */
72#define FOPEN_DIRECT_IO (1 << 0)
73#define FOPEN_KEEP_CACHE (1 << 1)
74
75enum fuse_opcode {
76 FUSE_LOOKUP = 1,
77 FUSE_FORGET = 2, /* no reply */
78 FUSE_GETATTR = 3,
79 FUSE_SETATTR = 4,
80 FUSE_READLINK = 5,
81 FUSE_SYMLINK = 6,
82 FUSE_MKNOD = 8,
83 FUSE_MKDIR = 9,
84 FUSE_UNLINK = 10,
85 FUSE_RMDIR = 11,
86 FUSE_RENAME = 12,
87 FUSE_LINK = 13,
88 FUSE_OPEN = 14,
89 FUSE_READ = 15,
90 FUSE_WRITE = 16,
91 FUSE_STATFS = 17,
92 FUSE_RELEASE = 18,
93 FUSE_FSYNC = 20,
94 FUSE_SETXATTR = 21,
95 FUSE_GETXATTR = 22,
96 FUSE_LISTXATTR = 23,
97 FUSE_REMOVEXATTR = 24,
98 FUSE_FLUSH = 25,
99 FUSE_INIT = 26,
100 FUSE_OPENDIR = 27,
101 FUSE_READDIR = 28,
102 FUSE_RELEASEDIR = 29,
103 FUSE_FSYNCDIR = 30
104};
105
106/* Conservative buffer size for the client */
107#define FUSE_MAX_IN 8192
108
109#define FUSE_NAME_MAX 1024
110#define FUSE_SYMLINK_MAX 4096
111#define FUSE_XATTR_SIZE_MAX 4096
112
113struct fuse_entry_out {
114 __u64 nodeid; /* Inode ID */
115 __u64 generation; /* Inode generation: nodeid:gen must
116 be unique for the fs's lifetime */
117 __u64 entry_valid; /* Cache timeout for the name */
118 __u64 attr_valid; /* Cache timeout for the attributes */
119 __u32 entry_valid_nsec;
120 __u32 attr_valid_nsec;
121 struct fuse_attr attr;
122};
123
124struct fuse_forget_in {
125 __u64 nlookup;
126};
127
128struct fuse_attr_out {
129 __u64 attr_valid; /* Cache timeout for the attributes */
130 __u32 attr_valid_nsec;
131 __u32 dummy;
132 struct fuse_attr attr;
133};
134
135struct fuse_mknod_in {
136 __u32 mode;
137 __u32 rdev;
138};
139
140struct fuse_mkdir_in {
141 __u32 mode;
142 __u32 padding;
143};
144
145struct fuse_rename_in {
146 __u64 newdir;
147};
148
149struct fuse_link_in {
150 __u64 oldnodeid;
151};
152
153struct fuse_setattr_in {
154 __u32 valid;
155 __u32 padding;
156 struct fuse_attr attr;
157};
158
159struct fuse_open_in {
160 __u32 flags;
161 __u32 padding;
162};
163
164struct fuse_open_out {
165 __u64 fh;
166 __u32 open_flags;
167 __u32 padding;
168};
169
170struct fuse_release_in {
171 __u64 fh;
172 __u32 flags;
173 __u32 padding;
174};
175
176struct fuse_flush_in {
177 __u64 fh;
178 __u32 flush_flags;
179 __u32 padding;
180};
181
182struct fuse_read_in {
183 __u64 fh;
184 __u64 offset;
185 __u32 size;
186 __u32 padding;
187};
188
189struct fuse_write_in {
190 __u64 fh;
191 __u64 offset;
192 __u32 size;
193 __u32 write_flags;
194};
195
196struct fuse_write_out {
197 __u32 size;
198 __u32 padding;
199};
200
201struct fuse_statfs_out {
202 struct fuse_kstatfs st;
203};
204
205struct fuse_fsync_in {
206 __u64 fh;
207 __u32 fsync_flags;
208 __u32 padding;
209};
210
211struct fuse_setxattr_in {
212 __u32 size;
213 __u32 flags;
214};
215
216struct fuse_getxattr_in {
217 __u32 size;
218 __u32 padding;
219};
220
221struct fuse_getxattr_out {
222 __u32 size;
223 __u32 padding;
224};
225
226struct fuse_init_in_out {
227 __u32 major;
228 __u32 minor;
229};
230
231struct fuse_in_header {
232 __u32 len;
233 __u32 opcode;
234 __u64 unique;
235 __u64 nodeid;
236 __u32 uid;
237 __u32 gid;
238 __u32 pid;
239 __u32 padding;
240};
241
242struct fuse_out_header {
243 __u32 len;
244 __s32 error;
245 __u64 unique;
246};
247
248struct fuse_dirent {
249 __u64 ino;
250 __u64 off;
251 __u32 namelen;
252 __u32 type;
253 char name[0];
254};
255
256#define FUSE_NAME_OFFSET ((unsigned) ((struct fuse_dirent *) 0)->name)
257#define FUSE_DIRENT_ALIGN(x) (((x) + sizeof(__u64) - 1) & ~(sizeof(__u64) - 1))
258#define FUSE_DIRENT_SIZE(d) \
259 FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen)
diff --git a/include/linux/i2c-pxa.h b/include/linux/i2c-pxa.h
new file mode 100644
index 000000000000..5f3eaf802223
--- /dev/null
+++ b/include/linux/i2c-pxa.h
@@ -0,0 +1,48 @@
1#ifndef _LINUX_I2C_ALGO_PXA_H
2#define _LINUX_I2C_ALGO_PXA_H
3
4struct i2c_eeprom_emu_watcher {
5 void (*write)(void *, unsigned int addr, unsigned char newval);
6};
7
8struct i2c_eeprom_emu_watch {
9 struct list_head node;
10 unsigned int start;
11 unsigned int end;
12 struct i2c_eeprom_emu_watcher *ops;
13 void *data;
14};
15
16#define I2C_EEPROM_EMU_SIZE (256)
17
18struct i2c_eeprom_emu {
19 unsigned int size;
20 unsigned int ptr;
21 unsigned int seen_start;
22 struct list_head watch;
23
24 unsigned char bytes[I2C_EEPROM_EMU_SIZE];
25};
26
27typedef enum i2c_slave_event_e {
28 I2C_SLAVE_EVENT_START_READ,
29 I2C_SLAVE_EVENT_START_WRITE,
30 I2C_SLAVE_EVENT_STOP
31} i2c_slave_event_t;
32
33struct i2c_slave_client {
34 void *data;
35 void (*event)(void *ptr, i2c_slave_event_t event);
36 int (*read) (void *ptr);
37 void (*write)(void *ptr, unsigned int val);
38};
39
40extern int i2c_eeprom_emu_addwatcher(struct i2c_eeprom_emu *, void *data,
41 unsigned int addr, unsigned int size,
42 struct i2c_eeprom_emu_watcher *);
43
44extern void i2c_eeprom_emu_delwatcher(struct i2c_eeprom_emu *, void *data, struct i2c_eeprom_emu_watcher *watcher);
45
46extern struct i2c_eeprom_emu *i2c_pxa_get_eeprom(void);
47
48#endif /* _LINUX_I2C_ALGO_PXA_H */
diff --git a/include/linux/in6.h b/include/linux/in6.h
index dcf5720ffcbb..304aaedea305 100644
--- a/include/linux/in6.h
+++ b/include/linux/in6.h
@@ -148,13 +148,13 @@ struct in6_flowlabel_req
148 */ 148 */
149 149
150#define IPV6_ADDRFORM 1 150#define IPV6_ADDRFORM 1
151#define IPV6_PKTINFO 2 151#define IPV6_2292PKTINFO 2
152#define IPV6_HOPOPTS 3 152#define IPV6_2292HOPOPTS 3
153#define IPV6_DSTOPTS 4 153#define IPV6_2292DSTOPTS 4
154#define IPV6_RTHDR 5 154#define IPV6_2292RTHDR 5
155#define IPV6_PKTOPTIONS 6 155#define IPV6_2292PKTOPTIONS 6
156#define IPV6_CHECKSUM 7 156#define IPV6_CHECKSUM 7
157#define IPV6_HOPLIMIT 8 157#define IPV6_2292HOPLIMIT 8
158#define IPV6_NEXTHOP 9 158#define IPV6_NEXTHOP 9
159#define IPV6_AUTHHDR 10 /* obsolete */ 159#define IPV6_AUTHHDR 10 /* obsolete */
160#define IPV6_FLOWINFO 11 160#define IPV6_FLOWINFO 11
@@ -198,4 +198,44 @@ struct in6_flowlabel_req
198 * MCAST_MSFILTER 48 198 * MCAST_MSFILTER 48
199 */ 199 */
200 200
201/*
202 * Advanced API (RFC3542) (1)
203 *
204 * Note: IPV6_RECVRTHDRDSTOPTS does not exist. see net/ipv6/datagram.c.
205 */
206
207#define IPV6_RECVPKTINFO 49
208#define IPV6_PKTINFO 50
209#define IPV6_RECVHOPLIMIT 51
210#define IPV6_HOPLIMIT 52
211#define IPV6_RECVHOPOPTS 53
212#define IPV6_HOPOPTS 54
213#define IPV6_RTHDRDSTOPTS 55
214#define IPV6_RECVRTHDR 56
215#define IPV6_RTHDR 57
216#define IPV6_RECVDSTOPTS 58
217#define IPV6_DSTOPTS 59
218#if 0 /* not yet */
219#define IPV6_RECVPATHMTU 60
220#define IPV6_PATHMTU 61
221#define IPV6_DONTFRAG 62
222#define IPV6_USE_MIN_MTU 63
223#endif
224
225/*
226 * Netfilter
227 *
228 * Following socket options are used in ip6_tables;
229 * see include/linux/netfilter_ipv6/ip6_tables.h.
230 *
231 * IP6T_SO_SET_REPLACE / IP6T_SO_GET_INFO 64
232 * IP6T_SO_SET_ADD_COUNTERS / IP6T_SO_GET_ENTRIES 65
233 */
234
235/*
236 * Advanced API (RFC3542) (2)
237 */
238#define IPV6_RECVTCLASS 66
239#define IPV6_TCLASS 67
240
201#endif 241#endif
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index c727c195a91a..68ab5f2ab9cd 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -2,17 +2,27 @@
2#define _LINUX__INIT_TASK_H 2#define _LINUX__INIT_TASK_H
3 3
4#include <linux/file.h> 4#include <linux/file.h>
5#include <linux/rcupdate.h>
5 6
6#define INIT_FILES \ 7#define INIT_FDTABLE \
7{ \ 8{ \
8 .count = ATOMIC_INIT(1), \
9 .file_lock = SPIN_LOCK_UNLOCKED, \
10 .max_fds = NR_OPEN_DEFAULT, \ 9 .max_fds = NR_OPEN_DEFAULT, \
11 .max_fdset = __FD_SETSIZE, \ 10 .max_fdset = __FD_SETSIZE, \
12 .next_fd = 0, \ 11 .next_fd = 0, \
13 .fd = &init_files.fd_array[0], \ 12 .fd = &init_files.fd_array[0], \
14 .close_on_exec = &init_files.close_on_exec_init, \ 13 .close_on_exec = &init_files.close_on_exec_init, \
15 .open_fds = &init_files.open_fds_init, \ 14 .open_fds = &init_files.open_fds_init, \
15 .rcu = RCU_HEAD_INIT, \
16 .free_files = NULL, \
17 .next = NULL, \
18}
19
20#define INIT_FILES \
21{ \
22 .count = ATOMIC_INIT(1), \
23 .file_lock = SPIN_LOCK_UNLOCKED, \
24 .fdt = &init_files.fdtab, \
25 .fdtab = INIT_FDTABLE, \
16 .close_on_exec_init = { { 0, } }, \ 26 .close_on_exec_init = { { 0, } }, \
17 .open_fds_init = { { 0, } }, \ 27 .open_fds_init = { { 0, } }, \
18 .fd_array = { NULL, } \ 28 .fd_array = { NULL, } \
diff --git a/include/linux/input.h b/include/linux/input.h
index 4767e5429534..e8c296ff6257 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -289,6 +289,8 @@ struct input_absinfo {
289#define KEY_SCROLLDOWN 178 289#define KEY_SCROLLDOWN 178
290#define KEY_KPLEFTPAREN 179 290#define KEY_KPLEFTPAREN 179
291#define KEY_KPRIGHTPAREN 180 291#define KEY_KPRIGHTPAREN 180
292#define KEY_NEW 181
293#define KEY_REDO 182
292 294
293#define KEY_F13 183 295#define KEY_F13 183
294#define KEY_F14 184 296#define KEY_F14 184
@@ -335,6 +337,12 @@ struct input_absinfo {
335#define KEY_KBDILLUMDOWN 229 337#define KEY_KBDILLUMDOWN 229
336#define KEY_KBDILLUMUP 230 338#define KEY_KBDILLUMUP 230
337 339
340#define KEY_SEND 231
341#define KEY_REPLY 232
342#define KEY_FORWARDMAIL 233
343#define KEY_SAVE 234
344#define KEY_DOCUMENTS 235
345
338#define KEY_UNKNOWN 240 346#define KEY_UNKNOWN 240
339 347
340#define BTN_MISC 0x100 348#define BTN_MISC 0x100
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index d99e7aeb7d33..0a90205184b0 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -57,6 +57,11 @@ extern void disable_irq(unsigned int irq);
57extern void enable_irq(unsigned int irq); 57extern void enable_irq(unsigned int irq);
58#endif 58#endif
59 59
60#ifndef __ARCH_SET_SOFTIRQ_PENDING
61#define set_softirq_pending(x) (local_softirq_pending() = (x))
62#define or_softirq_pending(x) (local_softirq_pending() |= (x))
63#endif
64
60/* 65/*
61 * Temporary defines for UP kernels, until all code gets fixed. 66 * Temporary defines for UP kernels, until all code gets fixed.
62 */ 67 */
@@ -123,7 +128,7 @@ struct softirq_action
123asmlinkage void do_softirq(void); 128asmlinkage void do_softirq(void);
124extern void open_softirq(int nr, void (*action)(struct softirq_action*), void *data); 129extern void open_softirq(int nr, void (*action)(struct softirq_action*), void *data);
125extern void softirq_init(void); 130extern void softirq_init(void);
126#define __raise_softirq_irqoff(nr) do { local_softirq_pending() |= 1UL << (nr); } while (0) 131#define __raise_softirq_irqoff(nr) do { or_softirq_pending(1UL << (nr)); } while (0)
127extern void FASTCALL(raise_softirq_irqoff(unsigned int nr)); 132extern void FASTCALL(raise_softirq_irqoff(unsigned int nr));
128extern void FASTCALL(raise_softirq(unsigned int nr)); 133extern void FASTCALL(raise_softirq(unsigned int nr));
129 134
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 3c7dbc6a0a70..bb6f88e14061 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -68,7 +68,7 @@ struct ipv6_opt_hdr {
68 68
69struct rt0_hdr { 69struct rt0_hdr {
70 struct ipv6_rt_hdr rt_hdr; 70 struct ipv6_rt_hdr rt_hdr;
71 __u32 bitmap; /* strict/loose bit map */ 71 __u32 reserved;
72 struct in6_addr addr[0]; 72 struct in6_addr addr[0];
73 73
74#define rt0_type rt_hdr.type 74#define rt0_type rt_hdr.type
@@ -189,6 +189,7 @@ struct inet6_skb_parm {
189 __u16 dst0; 189 __u16 dst0;
190 __u16 srcrt; 190 __u16 srcrt;
191 __u16 dst1; 191 __u16 dst1;
192 __u16 lastopt;
192}; 193};
193 194
194#define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb)) 195#define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb))
@@ -234,14 +235,20 @@ struct ipv6_pinfo {
234 /* pktoption flags */ 235 /* pktoption flags */
235 union { 236 union {
236 struct { 237 struct {
237 __u8 srcrt:2, 238 __u16 srcrt:2,
239 osrcrt:2,
238 rxinfo:1, 240 rxinfo:1,
241 rxoinfo:1,
239 rxhlim:1, 242 rxhlim:1,
243 rxohlim:1,
240 hopopts:1, 244 hopopts:1,
245 ohopopts:1,
241 dstopts:1, 246 dstopts:1,
242 rxflow:1; 247 odstopts:1,
248 rxflow:1,
249 rxtclass:1;
243 } bits; 250 } bits;
244 __u8 all; 251 __u16 all;
245 } rxopt; 252 } rxopt;
246 253
247 /* sockopt flags */ 254 /* sockopt flags */
@@ -250,6 +257,7 @@ struct ipv6_pinfo {
250 sndflow:1, 257 sndflow:1,
251 pmtudisc:2, 258 pmtudisc:2,
252 ipv6only:1; 259 ipv6only:1;
260 __u8 tclass;
253 261
254 __u32 dst_cookie; 262 __u32 dst_cookie;
255 263
@@ -263,6 +271,7 @@ struct ipv6_pinfo {
263 struct ipv6_txoptions *opt; 271 struct ipv6_txoptions *opt;
264 struct rt6_info *rt; 272 struct rt6_info *rt;
265 int hop_limit; 273 int hop_limit;
274 int tclass;
266 } cork; 275 } cork;
267}; 276};
268 277
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index 84321a4cac93..de097269bd7f 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -28,6 +28,7 @@
28#include <linux/buffer_head.h> 28#include <linux/buffer_head.h>
29#include <linux/journal-head.h> 29#include <linux/journal-head.h>
30#include <linux/stddef.h> 30#include <linux/stddef.h>
31#include <linux/bit_spinlock.h>
31#include <asm/semaphore.h> 32#include <asm/semaphore.h>
32#endif 33#endif
33 34
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index d7a2555a886c..6acfdbba734b 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -254,23 +254,23 @@ static inline u64 get_jiffies_64(void)
254 */ 254 */
255static inline unsigned int jiffies_to_msecs(const unsigned long j) 255static inline unsigned int jiffies_to_msecs(const unsigned long j)
256{ 256{
257#if HZ <= 1000 && !(1000 % HZ) 257#if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ)
258 return (1000 / HZ) * j; 258 return (MSEC_PER_SEC / HZ) * j;
259#elif HZ > 1000 && !(HZ % 1000) 259#elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC)
260 return (j + (HZ / 1000) - 1)/(HZ / 1000); 260 return (j + (HZ / MSEC_PER_SEC) - 1)/(HZ / MSEC_PER_SEC);
261#else 261#else
262 return (j * 1000) / HZ; 262 return (j * MSEC_PER_SEC) / HZ;
263#endif 263#endif
264} 264}
265 265
266static inline unsigned int jiffies_to_usecs(const unsigned long j) 266static inline unsigned int jiffies_to_usecs(const unsigned long j)
267{ 267{
268#if HZ <= 1000000 && !(1000000 % HZ) 268#if HZ <= USEC_PER_SEC && !(USEC_PER_SEC % HZ)
269 return (1000000 / HZ) * j; 269 return (USEC_PER_SEC / HZ) * j;
270#elif HZ > 1000000 && !(HZ % 1000000) 270#elif HZ > USEC_PER_SEC && !(HZ % USEC_PER_SEC)
271 return (j + (HZ / 1000000) - 1)/(HZ / 1000000); 271 return (j + (HZ / USEC_PER_SEC) - 1)/(HZ / USEC_PER_SEC);
272#else 272#else
273 return (j * 1000000) / HZ; 273 return (j * USEC_PER_SEC) / HZ;
274#endif 274#endif
275} 275}
276 276
@@ -278,12 +278,12 @@ static inline unsigned long msecs_to_jiffies(const unsigned int m)
278{ 278{
279 if (m > jiffies_to_msecs(MAX_JIFFY_OFFSET)) 279 if (m > jiffies_to_msecs(MAX_JIFFY_OFFSET))
280 return MAX_JIFFY_OFFSET; 280 return MAX_JIFFY_OFFSET;
281#if HZ <= 1000 && !(1000 % HZ) 281#if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ)
282 return (m + (1000 / HZ) - 1) / (1000 / HZ); 282 return (m + (MSEC_PER_SEC / HZ) - 1) / (MSEC_PER_SEC / HZ);
283#elif HZ > 1000 && !(HZ % 1000) 283#elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC)
284 return m * (HZ / 1000); 284 return m * (HZ / MSEC_PER_SEC);
285#else 285#else
286 return (m * HZ + 999) / 1000; 286 return (m * HZ + MSEC_PER_SEC - 1) / MSEC_PER_SEC;
287#endif 287#endif
288} 288}
289 289
@@ -291,12 +291,12 @@ static inline unsigned long usecs_to_jiffies(const unsigned int u)
291{ 291{
292 if (u > jiffies_to_usecs(MAX_JIFFY_OFFSET)) 292 if (u > jiffies_to_usecs(MAX_JIFFY_OFFSET))
293 return MAX_JIFFY_OFFSET; 293 return MAX_JIFFY_OFFSET;
294#if HZ <= 1000000 && !(1000000 % HZ) 294#if HZ <= USEC_PER_SEC && !(USEC_PER_SEC % HZ)
295 return (u + (1000000 / HZ) - 1) / (1000000 / HZ); 295 return (u + (USEC_PER_SEC / HZ) - 1) / (USEC_PER_SEC / HZ);
296#elif HZ > 1000000 && !(HZ % 1000000) 296#elif HZ > USEC_PER_SEC && !(HZ % USEC_PER_SEC)
297 return u * (HZ / 1000000); 297 return u * (HZ / USEC_PER_SEC);
298#else 298#else
299 return (u * HZ + 999999) / 1000000; 299 return (u * HZ + USEC_PER_SEC - 1) / USEC_PER_SEC;
300#endif 300#endif
301} 301}
302 302
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index 94a46f38c532..58385ee1c0ac 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -155,6 +155,7 @@ struct mempolicy *get_vma_policy(struct task_struct *task,
155 155
156extern void numa_default_policy(void); 156extern void numa_default_policy(void);
157extern void numa_policy_init(void); 157extern void numa_policy_init(void);
158extern struct mempolicy default_policy;
158 159
159#else 160#else
160 161
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 6014160d9c06..c1f021eddffa 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -109,6 +109,8 @@ struct mmc_host {
109 struct mmc_card *card_selected; /* the selected MMC card */ 109 struct mmc_card *card_selected; /* the selected MMC card */
110 110
111 struct work_struct detect; 111 struct work_struct detect;
112
113 unsigned long private[0] ____cacheline_aligned;
112}; 114};
113 115
114extern struct mmc_host *mmc_alloc_host(int extra, struct device *); 116extern struct mmc_host *mmc_alloc_host(int extra, struct device *);
@@ -116,14 +118,18 @@ extern int mmc_add_host(struct mmc_host *);
116extern void mmc_remove_host(struct mmc_host *); 118extern void mmc_remove_host(struct mmc_host *);
117extern void mmc_free_host(struct mmc_host *); 119extern void mmc_free_host(struct mmc_host *);
118 120
119#define mmc_priv(x) ((void *)((x) + 1)) 121static inline void *mmc_priv(struct mmc_host *host)
122{
123 return (void *)host->private;
124}
125
120#define mmc_dev(x) ((x)->dev) 126#define mmc_dev(x) ((x)->dev)
121#define mmc_hostname(x) ((x)->class_dev.class_id) 127#define mmc_hostname(x) ((x)->class_dev.class_id)
122 128
123extern int mmc_suspend_host(struct mmc_host *, pm_message_t); 129extern int mmc_suspend_host(struct mmc_host *, pm_message_t);
124extern int mmc_resume_host(struct mmc_host *); 130extern int mmc_resume_host(struct mmc_host *);
125 131
126extern void mmc_detect_change(struct mmc_host *); 132extern void mmc_detect_change(struct mmc_host *, unsigned long delay);
127extern void mmc_request_done(struct mmc_host *, struct mmc_request *); 133extern void mmc_request_done(struct mmc_host *, struct mmc_request *);
128 134
129#endif 135#endif
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 167518668936..7bbd25970c9e 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -15,6 +15,7 @@
15#define NETLINK_ISCSI 8 /* Open-iSCSI */ 15#define NETLINK_ISCSI 8 /* Open-iSCSI */
16#define NETLINK_AUDIT 9 /* auditing */ 16#define NETLINK_AUDIT 9 /* auditing */
17#define NETLINK_FIB_LOOKUP 10 17#define NETLINK_FIB_LOOKUP 10
18#define NETLINK_CONNECTOR 11
18#define NETLINK_NETFILTER 12 /* netfilter subsystem */ 19#define NETLINK_NETFILTER 12 /* netfilter subsystem */
19#define NETLINK_IP6_FW 13 20#define NETLINK_IP6_FW 13
20#define NETLINK_DNRTMSG 14 /* DECnet routing messages */ 21#define NETLINK_DNRTMSG 14 /* DECnet routing messages */
diff --git a/include/linux/pci.h b/include/linux/pci.h
index bc4c40000c0d..7349058ed778 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -19,436 +19,10 @@
19 19
20#include <linux/mod_devicetable.h> 20#include <linux/mod_devicetable.h>
21 21
22/* 22/* Include the pci register defines */
23 * Under PCI, each device has 256 bytes of configuration address space, 23#include <linux/pci_regs.h>
24 * of which the first 64 bytes are standardized as follows:
25 */
26#define PCI_VENDOR_ID 0x00 /* 16 bits */
27#define PCI_DEVICE_ID 0x02 /* 16 bits */
28#define PCI_COMMAND 0x04 /* 16 bits */
29#define PCI_COMMAND_IO 0x1 /* Enable response in I/O space */
30#define PCI_COMMAND_MEMORY 0x2 /* Enable response in Memory space */
31#define PCI_COMMAND_MASTER 0x4 /* Enable bus mastering */
32#define PCI_COMMAND_SPECIAL 0x8 /* Enable response to special cycles */
33#define PCI_COMMAND_INVALIDATE 0x10 /* Use memory write and invalidate */
34#define PCI_COMMAND_VGA_PALETTE 0x20 /* Enable palette snooping */
35#define PCI_COMMAND_PARITY 0x40 /* Enable parity checking */
36#define PCI_COMMAND_WAIT 0x80 /* Enable address/data stepping */
37#define PCI_COMMAND_SERR 0x100 /* Enable SERR */
38#define PCI_COMMAND_FAST_BACK 0x200 /* Enable back-to-back writes */
39#define PCI_COMMAND_INTX_DISABLE 0x400 /* INTx Emulation Disable */
40
41#define PCI_STATUS 0x06 /* 16 bits */
42#define PCI_STATUS_CAP_LIST 0x10 /* Support Capability List */
43#define PCI_STATUS_66MHZ 0x20 /* Support 66 Mhz PCI 2.1 bus */
44#define PCI_STATUS_UDF 0x40 /* Support User Definable Features [obsolete] */
45#define PCI_STATUS_FAST_BACK 0x80 /* Accept fast-back to back */
46#define PCI_STATUS_PARITY 0x100 /* Detected parity error */
47#define PCI_STATUS_DEVSEL_MASK 0x600 /* DEVSEL timing */
48#define PCI_STATUS_DEVSEL_FAST 0x000
49#define PCI_STATUS_DEVSEL_MEDIUM 0x200
50#define PCI_STATUS_DEVSEL_SLOW 0x400
51#define PCI_STATUS_SIG_TARGET_ABORT 0x800 /* Set on target abort */
52#define PCI_STATUS_REC_TARGET_ABORT 0x1000 /* Master ack of " */
53#define PCI_STATUS_REC_MASTER_ABORT 0x2000 /* Set on master abort */
54#define PCI_STATUS_SIG_SYSTEM_ERROR 0x4000 /* Set when we drive SERR */
55#define PCI_STATUS_DETECTED_PARITY 0x8000 /* Set on parity error */
56
57#define PCI_CLASS_REVISION 0x08 /* High 24 bits are class, low 8
58 revision */
59#define PCI_REVISION_ID 0x08 /* Revision ID */
60#define PCI_CLASS_PROG 0x09 /* Reg. Level Programming Interface */
61#define PCI_CLASS_DEVICE 0x0a /* Device class */
62
63#define PCI_CACHE_LINE_SIZE 0x0c /* 8 bits */
64#define PCI_LATENCY_TIMER 0x0d /* 8 bits */
65#define PCI_HEADER_TYPE 0x0e /* 8 bits */
66#define PCI_HEADER_TYPE_NORMAL 0
67#define PCI_HEADER_TYPE_BRIDGE 1
68#define PCI_HEADER_TYPE_CARDBUS 2
69
70#define PCI_BIST 0x0f /* 8 bits */
71#define PCI_BIST_CODE_MASK 0x0f /* Return result */
72#define PCI_BIST_START 0x40 /* 1 to start BIST, 2 secs or less */
73#define PCI_BIST_CAPABLE 0x80 /* 1 if BIST capable */
74
75/*
76 * Base addresses specify locations in memory or I/O space.
77 * Decoded size can be determined by writing a value of
78 * 0xffffffff to the register, and reading it back. Only
79 * 1 bits are decoded.
80 */
81#define PCI_BASE_ADDRESS_0 0x10 /* 32 bits */
82#define PCI_BASE_ADDRESS_1 0x14 /* 32 bits [htype 0,1 only] */
83#define PCI_BASE_ADDRESS_2 0x18 /* 32 bits [htype 0 only] */
84#define PCI_BASE_ADDRESS_3 0x1c /* 32 bits */
85#define PCI_BASE_ADDRESS_4 0x20 /* 32 bits */
86#define PCI_BASE_ADDRESS_5 0x24 /* 32 bits */
87#define PCI_BASE_ADDRESS_SPACE 0x01 /* 0 = memory, 1 = I/O */
88#define PCI_BASE_ADDRESS_SPACE_IO 0x01
89#define PCI_BASE_ADDRESS_SPACE_MEMORY 0x00
90#define PCI_BASE_ADDRESS_MEM_TYPE_MASK 0x06
91#define PCI_BASE_ADDRESS_MEM_TYPE_32 0x00 /* 32 bit address */
92#define PCI_BASE_ADDRESS_MEM_TYPE_1M 0x02 /* Below 1M [obsolete] */
93#define PCI_BASE_ADDRESS_MEM_TYPE_64 0x04 /* 64 bit address */
94#define PCI_BASE_ADDRESS_MEM_PREFETCH 0x08 /* prefetchable? */
95#define PCI_BASE_ADDRESS_MEM_MASK (~0x0fUL)
96#define PCI_BASE_ADDRESS_IO_MASK (~0x03UL)
97/* bit 1 is reserved if address_space = 1 */
98
99/* Header type 0 (normal devices) */
100#define PCI_CARDBUS_CIS 0x28
101#define PCI_SUBSYSTEM_VENDOR_ID 0x2c
102#define PCI_SUBSYSTEM_ID 0x2e
103#define PCI_ROM_ADDRESS 0x30 /* Bits 31..11 are address, 10..1 reserved */
104#define PCI_ROM_ADDRESS_ENABLE 0x01
105#define PCI_ROM_ADDRESS_MASK (~0x7ffUL)
106
107#define PCI_CAPABILITY_LIST 0x34 /* Offset of first capability list entry */
108
109/* 0x35-0x3b are reserved */
110#define PCI_INTERRUPT_LINE 0x3c /* 8 bits */
111#define PCI_INTERRUPT_PIN 0x3d /* 8 bits */
112#define PCI_MIN_GNT 0x3e /* 8 bits */
113#define PCI_MAX_LAT 0x3f /* 8 bits */
114
115/* Header type 1 (PCI-to-PCI bridges) */
116#define PCI_PRIMARY_BUS 0x18 /* Primary bus number */
117#define PCI_SECONDARY_BUS 0x19 /* Secondary bus number */
118#define PCI_SUBORDINATE_BUS 0x1a /* Highest bus number behind the bridge */
119#define PCI_SEC_LATENCY_TIMER 0x1b /* Latency timer for secondary interface */
120#define PCI_IO_BASE 0x1c /* I/O range behind the bridge */
121#define PCI_IO_LIMIT 0x1d
122#define PCI_IO_RANGE_TYPE_MASK 0x0fUL /* I/O bridging type */
123#define PCI_IO_RANGE_TYPE_16 0x00
124#define PCI_IO_RANGE_TYPE_32 0x01
125#define PCI_IO_RANGE_MASK (~0x0fUL)
126#define PCI_SEC_STATUS 0x1e /* Secondary status register, only bit 14 used */
127#define PCI_MEMORY_BASE 0x20 /* Memory range behind */
128#define PCI_MEMORY_LIMIT 0x22
129#define PCI_MEMORY_RANGE_TYPE_MASK 0x0fUL
130#define PCI_MEMORY_RANGE_MASK (~0x0fUL)
131#define PCI_PREF_MEMORY_BASE 0x24 /* Prefetchable memory range behind */
132#define PCI_PREF_MEMORY_LIMIT 0x26
133#define PCI_PREF_RANGE_TYPE_MASK 0x0fUL
134#define PCI_PREF_RANGE_TYPE_32 0x00
135#define PCI_PREF_RANGE_TYPE_64 0x01
136#define PCI_PREF_RANGE_MASK (~0x0fUL)
137#define PCI_PREF_BASE_UPPER32 0x28 /* Upper half of prefetchable memory range */
138#define PCI_PREF_LIMIT_UPPER32 0x2c
139#define PCI_IO_BASE_UPPER16 0x30 /* Upper half of I/O addresses */
140#define PCI_IO_LIMIT_UPPER16 0x32
141/* 0x34 same as for htype 0 */
142/* 0x35-0x3b is reserved */
143#define PCI_ROM_ADDRESS1 0x38 /* Same as PCI_ROM_ADDRESS, but for htype 1 */
144/* 0x3c-0x3d are same as for htype 0 */
145#define PCI_BRIDGE_CONTROL 0x3e
146#define PCI_BRIDGE_CTL_PARITY 0x01 /* Enable parity detection on secondary interface */
147#define PCI_BRIDGE_CTL_SERR 0x02 /* The same for SERR forwarding */
148#define PCI_BRIDGE_CTL_NO_ISA 0x04 /* Disable bridging of ISA ports */
149#define PCI_BRIDGE_CTL_VGA 0x08 /* Forward VGA addresses */
150#define PCI_BRIDGE_CTL_MASTER_ABORT 0x20 /* Report master aborts */
151#define PCI_BRIDGE_CTL_BUS_RESET 0x40 /* Secondary bus reset */
152#define PCI_BRIDGE_CTL_FAST_BACK 0x80 /* Fast Back2Back enabled on secondary interface */
153
154/* Header type 2 (CardBus bridges) */
155#define PCI_CB_CAPABILITY_LIST 0x14
156/* 0x15 reserved */
157#define PCI_CB_SEC_STATUS 0x16 /* Secondary status */
158#define PCI_CB_PRIMARY_BUS 0x18 /* PCI bus number */
159#define PCI_CB_CARD_BUS 0x19 /* CardBus bus number */
160#define PCI_CB_SUBORDINATE_BUS 0x1a /* Subordinate bus number */
161#define PCI_CB_LATENCY_TIMER 0x1b /* CardBus latency timer */
162#define PCI_CB_MEMORY_BASE_0 0x1c
163#define PCI_CB_MEMORY_LIMIT_0 0x20
164#define PCI_CB_MEMORY_BASE_1 0x24
165#define PCI_CB_MEMORY_LIMIT_1 0x28
166#define PCI_CB_IO_BASE_0 0x2c
167#define PCI_CB_IO_BASE_0_HI 0x2e
168#define PCI_CB_IO_LIMIT_0 0x30
169#define PCI_CB_IO_LIMIT_0_HI 0x32
170#define PCI_CB_IO_BASE_1 0x34
171#define PCI_CB_IO_BASE_1_HI 0x36
172#define PCI_CB_IO_LIMIT_1 0x38
173#define PCI_CB_IO_LIMIT_1_HI 0x3a
174#define PCI_CB_IO_RANGE_MASK (~0x03UL)
175/* 0x3c-0x3d are same as for htype 0 */
176#define PCI_CB_BRIDGE_CONTROL 0x3e
177#define PCI_CB_BRIDGE_CTL_PARITY 0x01 /* Similar to standard bridge control register */
178#define PCI_CB_BRIDGE_CTL_SERR 0x02
179#define PCI_CB_BRIDGE_CTL_ISA 0x04
180#define PCI_CB_BRIDGE_CTL_VGA 0x08
181#define PCI_CB_BRIDGE_CTL_MASTER_ABORT 0x20
182#define PCI_CB_BRIDGE_CTL_CB_RESET 0x40 /* CardBus reset */
183#define PCI_CB_BRIDGE_CTL_16BIT_INT 0x80 /* Enable interrupt for 16-bit cards */
184#define PCI_CB_BRIDGE_CTL_PREFETCH_MEM0 0x100 /* Prefetch enable for both memory regions */
185#define PCI_CB_BRIDGE_CTL_PREFETCH_MEM1 0x200
186#define PCI_CB_BRIDGE_CTL_POST_WRITES 0x400
187#define PCI_CB_SUBSYSTEM_VENDOR_ID 0x40
188#define PCI_CB_SUBSYSTEM_ID 0x42
189#define PCI_CB_LEGACY_MODE_BASE 0x44 /* 16-bit PC Card legacy mode base address (ExCa) */
190/* 0x48-0x7f reserved */
191
192/* Capability lists */
193
194#define PCI_CAP_LIST_ID 0 /* Capability ID */
195#define PCI_CAP_ID_PM 0x01 /* Power Management */
196#define PCI_CAP_ID_AGP 0x02 /* Accelerated Graphics Port */
197#define PCI_CAP_ID_VPD 0x03 /* Vital Product Data */
198#define PCI_CAP_ID_SLOTID 0x04 /* Slot Identification */
199#define PCI_CAP_ID_MSI 0x05 /* Message Signalled Interrupts */
200#define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */
201#define PCI_CAP_ID_PCIX 0x07 /* PCI-X */
202#define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */
203#define PCI_CAP_ID_EXP 0x10 /* PCI Express */
204#define PCI_CAP_ID_MSIX 0x11 /* MSI-X */
205#define PCI_CAP_LIST_NEXT 1 /* Next capability in the list */
206#define PCI_CAP_FLAGS 2 /* Capability defined flags (16 bits) */
207#define PCI_CAP_SIZEOF 4
208
209/* Power Management Registers */
210
211#define PCI_PM_PMC 2 /* PM Capabilities Register */
212#define PCI_PM_CAP_VER_MASK 0x0007 /* Version */
213#define PCI_PM_CAP_PME_CLOCK 0x0008 /* PME clock required */
214#define PCI_PM_CAP_RESERVED 0x0010 /* Reserved field */
215#define PCI_PM_CAP_DSI 0x0020 /* Device specific initialization */
216#define PCI_PM_CAP_AUX_POWER 0x01C0 /* Auxilliary power support mask */
217#define PCI_PM_CAP_D1 0x0200 /* D1 power state support */
218#define PCI_PM_CAP_D2 0x0400 /* D2 power state support */
219#define PCI_PM_CAP_PME 0x0800 /* PME pin supported */
220#define PCI_PM_CAP_PME_MASK 0xF800 /* PME Mask of all supported states */
221#define PCI_PM_CAP_PME_D0 0x0800 /* PME# from D0 */
222#define PCI_PM_CAP_PME_D1 0x1000 /* PME# from D1 */
223#define PCI_PM_CAP_PME_D2 0x2000 /* PME# from D2 */
224#define PCI_PM_CAP_PME_D3 0x4000 /* PME# from D3 (hot) */
225#define PCI_PM_CAP_PME_D3cold 0x8000 /* PME# from D3 (cold) */
226#define PCI_PM_CTRL 4 /* PM control and status register */
227#define PCI_PM_CTRL_STATE_MASK 0x0003 /* Current power state (D0 to D3) */
228#define PCI_PM_CTRL_PME_ENABLE 0x0100 /* PME pin enable */
229#define PCI_PM_CTRL_DATA_SEL_MASK 0x1e00 /* Data select (??) */
230#define PCI_PM_CTRL_DATA_SCALE_MASK 0x6000 /* Data scale (??) */
231#define PCI_PM_CTRL_PME_STATUS 0x8000 /* PME pin status */
232#define PCI_PM_PPB_EXTENSIONS 6 /* PPB support extensions (??) */
233#define PCI_PM_PPB_B2_B3 0x40 /* Stop clock when in D3hot (??) */
234#define PCI_PM_BPCC_ENABLE 0x80 /* Bus power/clock control enable (??) */
235#define PCI_PM_DATA_REGISTER 7 /* (??) */
236#define PCI_PM_SIZEOF 8
237
238/* AGP registers */
239
240#define PCI_AGP_VERSION 2 /* BCD version number */
241#define PCI_AGP_RFU 3 /* Rest of capability flags */
242#define PCI_AGP_STATUS 4 /* Status register */
243#define PCI_AGP_STATUS_RQ_MASK 0xff000000 /* Maximum number of requests - 1 */
244#define PCI_AGP_STATUS_SBA 0x0200 /* Sideband addressing supported */
245#define PCI_AGP_STATUS_64BIT 0x0020 /* 64-bit addressing supported */
246#define PCI_AGP_STATUS_FW 0x0010 /* FW transfers supported */
247#define PCI_AGP_STATUS_RATE4 0x0004 /* 4x transfer rate supported */
248#define PCI_AGP_STATUS_RATE2 0x0002 /* 2x transfer rate supported */
249#define PCI_AGP_STATUS_RATE1 0x0001 /* 1x transfer rate supported */
250#define PCI_AGP_COMMAND 8 /* Control register */
251#define PCI_AGP_COMMAND_RQ_MASK 0xff000000 /* Master: Maximum number of requests */
252#define PCI_AGP_COMMAND_SBA 0x0200 /* Sideband addressing enabled */
253#define PCI_AGP_COMMAND_AGP 0x0100 /* Allow processing of AGP transactions */
254#define PCI_AGP_COMMAND_64BIT 0x0020 /* Allow processing of 64-bit addresses */
255#define PCI_AGP_COMMAND_FW 0x0010 /* Force FW transfers */
256#define PCI_AGP_COMMAND_RATE4 0x0004 /* Use 4x rate */
257#define PCI_AGP_COMMAND_RATE2 0x0002 /* Use 2x rate */
258#define PCI_AGP_COMMAND_RATE1 0x0001 /* Use 1x rate */
259#define PCI_AGP_SIZEOF 12
260
261/* Vital Product Data */
262
263#define PCI_VPD_ADDR 2 /* Address to access (15 bits!) */
264#define PCI_VPD_ADDR_MASK 0x7fff /* Address mask */
265#define PCI_VPD_ADDR_F 0x8000 /* Write 0, 1 indicates completion */
266#define PCI_VPD_DATA 4 /* 32-bits of data returned here */
267
268/* Slot Identification */
269
270#define PCI_SID_ESR 2 /* Expansion Slot Register */
271#define PCI_SID_ESR_NSLOTS 0x1f /* Number of expansion slots available */
272#define PCI_SID_ESR_FIC 0x20 /* First In Chassis Flag */
273#define PCI_SID_CHASSIS_NR 3 /* Chassis Number */
274
275/* Message Signalled Interrupts registers */
276
277#define PCI_MSI_FLAGS 2 /* Various flags */
278#define PCI_MSI_FLAGS_64BIT 0x80 /* 64-bit addresses allowed */
279#define PCI_MSI_FLAGS_QSIZE 0x70 /* Message queue size configured */
280#define PCI_MSI_FLAGS_QMASK 0x0e /* Maximum queue size available */
281#define PCI_MSI_FLAGS_ENABLE 0x01 /* MSI feature enabled */
282#define PCI_MSI_FLAGS_MASKBIT 0x100 /* 64-bit mask bits allowed */
283#define PCI_MSI_RFU 3 /* Rest of capability flags */
284#define PCI_MSI_ADDRESS_LO 4 /* Lower 32 bits */
285#define PCI_MSI_ADDRESS_HI 8 /* Upper 32 bits (if PCI_MSI_FLAGS_64BIT set) */
286#define PCI_MSI_DATA_32 8 /* 16 bits of data for 32-bit devices */
287#define PCI_MSI_DATA_64 12 /* 16 bits of data for 64-bit devices */
288#define PCI_MSI_MASK_BIT 16 /* Mask bits register */
289
290/* CompactPCI Hotswap Register */
291
292#define PCI_CHSWP_CSR 2 /* Control and Status Register */
293#define PCI_CHSWP_DHA 0x01 /* Device Hiding Arm */
294#define PCI_CHSWP_EIM 0x02 /* ENUM# Signal Mask */
295#define PCI_CHSWP_PIE 0x04 /* Pending Insert or Extract */
296#define PCI_CHSWP_LOO 0x08 /* LED On / Off */
297#define PCI_CHSWP_PI 0x30 /* Programming Interface */
298#define PCI_CHSWP_EXT 0x40 /* ENUM# status - extraction */
299#define PCI_CHSWP_INS 0x80 /* ENUM# status - insertion */
300
301/* PCI-X registers */
302
303#define PCI_X_CMD 2 /* Modes & Features */
304#define PCI_X_CMD_DPERR_E 0x0001 /* Data Parity Error Recovery Enable */
305#define PCI_X_CMD_ERO 0x0002 /* Enable Relaxed Ordering */
306#define PCI_X_CMD_MAX_READ 0x000c /* Max Memory Read Byte Count */
307#define PCI_X_CMD_MAX_SPLIT 0x0070 /* Max Outstanding Split Transactions */
308#define PCI_X_CMD_VERSION(x) (((x) >> 12) & 3) /* Version */
309#define PCI_X_STATUS 4 /* PCI-X capabilities */
310#define PCI_X_STATUS_DEVFN 0x000000ff /* A copy of devfn */
311#define PCI_X_STATUS_BUS 0x0000ff00 /* A copy of bus nr */
312#define PCI_X_STATUS_64BIT 0x00010000 /* 64-bit device */
313#define PCI_X_STATUS_133MHZ 0x00020000 /* 133 MHz capable */
314#define PCI_X_STATUS_SPL_DISC 0x00040000 /* Split Completion Discarded */
315#define PCI_X_STATUS_UNX_SPL 0x00080000 /* Unexpected Split Completion */
316#define PCI_X_STATUS_COMPLEX 0x00100000 /* Device Complexity */
317#define PCI_X_STATUS_MAX_READ 0x00600000 /* Designed Max Memory Read Count */
318#define PCI_X_STATUS_MAX_SPLIT 0x03800000 /* Designed Max Outstanding Split Transactions */
319#define PCI_X_STATUS_MAX_CUM 0x1c000000 /* Designed Max Cumulative Read Size */
320#define PCI_X_STATUS_SPL_ERR 0x20000000 /* Rcvd Split Completion Error Msg */
321#define PCI_X_STATUS_266MHZ 0x40000000 /* 266 MHz capable */
322#define PCI_X_STATUS_533MHZ 0x80000000 /* 533 MHz capable */
323
324/* PCI Express capability registers */
325
326#define PCI_EXP_FLAGS 2 /* Capabilities register */
327#define PCI_EXP_FLAGS_VERS 0x000f /* Capability version */
328#define PCI_EXP_FLAGS_TYPE 0x00f0 /* Device/Port type */
329#define PCI_EXP_TYPE_ENDPOINT 0x0 /* Express Endpoint */
330#define PCI_EXP_TYPE_LEG_END 0x1 /* Legacy Endpoint */
331#define PCI_EXP_TYPE_ROOT_PORT 0x4 /* Root Port */
332#define PCI_EXP_TYPE_UPSTREAM 0x5 /* Upstream Port */
333#define PCI_EXP_TYPE_DOWNSTREAM 0x6 /* Downstream Port */
334#define PCI_EXP_TYPE_PCI_BRIDGE 0x7 /* PCI/PCI-X Bridge */
335#define PCI_EXP_FLAGS_SLOT 0x0100 /* Slot implemented */
336#define PCI_EXP_FLAGS_IRQ 0x3e00 /* Interrupt message number */
337#define PCI_EXP_DEVCAP 4 /* Device capabilities */
338#define PCI_EXP_DEVCAP_PAYLOAD 0x07 /* Max_Payload_Size */
339#define PCI_EXP_DEVCAP_PHANTOM 0x18 /* Phantom functions */
340#define PCI_EXP_DEVCAP_EXT_TAG 0x20 /* Extended tags */
341#define PCI_EXP_DEVCAP_L0S 0x1c0 /* L0s Acceptable Latency */
342#define PCI_EXP_DEVCAP_L1 0xe00 /* L1 Acceptable Latency */
343#define PCI_EXP_DEVCAP_ATN_BUT 0x1000 /* Attention Button Present */
344#define PCI_EXP_DEVCAP_ATN_IND 0x2000 /* Attention Indicator Present */
345#define PCI_EXP_DEVCAP_PWR_IND 0x4000 /* Power Indicator Present */
346#define PCI_EXP_DEVCAP_PWR_VAL 0x3fc0000 /* Slot Power Limit Value */
347#define PCI_EXP_DEVCAP_PWR_SCL 0xc000000 /* Slot Power Limit Scale */
348#define PCI_EXP_DEVCTL 8 /* Device Control */
349#define PCI_EXP_DEVCTL_CERE 0x0001 /* Correctable Error Reporting En. */
350#define PCI_EXP_DEVCTL_NFERE 0x0002 /* Non-Fatal Error Reporting Enable */
351#define PCI_EXP_DEVCTL_FERE 0x0004 /* Fatal Error Reporting Enable */
352#define PCI_EXP_DEVCTL_URRE 0x0008 /* Unsupported Request Reporting En. */
353#define PCI_EXP_DEVCTL_RELAX_EN 0x0010 /* Enable relaxed ordering */
354#define PCI_EXP_DEVCTL_PAYLOAD 0x00e0 /* Max_Payload_Size */
355#define PCI_EXP_DEVCTL_EXT_TAG 0x0100 /* Extended Tag Field Enable */
356#define PCI_EXP_DEVCTL_PHANTOM 0x0200 /* Phantom Functions Enable */
357#define PCI_EXP_DEVCTL_AUX_PME 0x0400 /* Auxiliary Power PM Enable */
358#define PCI_EXP_DEVCTL_NOSNOOP_EN 0x0800 /* Enable No Snoop */
359#define PCI_EXP_DEVCTL_READRQ 0x7000 /* Max_Read_Request_Size */
360#define PCI_EXP_DEVSTA 10 /* Device Status */
361#define PCI_EXP_DEVSTA_CED 0x01 /* Correctable Error Detected */
362#define PCI_EXP_DEVSTA_NFED 0x02 /* Non-Fatal Error Detected */
363#define PCI_EXP_DEVSTA_FED 0x04 /* Fatal Error Detected */
364#define PCI_EXP_DEVSTA_URD 0x08 /* Unsupported Request Detected */
365#define PCI_EXP_DEVSTA_AUXPD 0x10 /* AUX Power Detected */
366#define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */
367#define PCI_EXP_LNKCAP 12 /* Link Capabilities */
368#define PCI_EXP_LNKCTL 16 /* Link Control */
369#define PCI_EXP_LNKSTA 18 /* Link Status */
370#define PCI_EXP_SLTCAP 20 /* Slot Capabilities */
371#define PCI_EXP_SLTCTL 24 /* Slot Control */
372#define PCI_EXP_SLTSTA 26 /* Slot Status */
373#define PCI_EXP_RTCTL 28 /* Root Control */
374#define PCI_EXP_RTCTL_SECEE 0x01 /* System Error on Correctable Error */
375#define PCI_EXP_RTCTL_SENFEE 0x02 /* System Error on Non-Fatal Error */
376#define PCI_EXP_RTCTL_SEFEE 0x04 /* System Error on Fatal Error */
377#define PCI_EXP_RTCTL_PMEIE 0x08 /* PME Interrupt Enable */
378#define PCI_EXP_RTCTL_CRSSVE 0x10 /* CRS Software Visibility Enable */
379#define PCI_EXP_RTCAP 30 /* Root Capabilities */
380#define PCI_EXP_RTSTA 32 /* Root Status */
381
382/* Extended Capabilities (PCI-X 2.0 and Express) */
383#define PCI_EXT_CAP_ID(header) (header & 0x0000ffff)
384#define PCI_EXT_CAP_VER(header) ((header >> 16) & 0xf)
385#define PCI_EXT_CAP_NEXT(header) ((header >> 20) & 0xffc)
386
387#define PCI_EXT_CAP_ID_ERR 1
388#define PCI_EXT_CAP_ID_VC 2
389#define PCI_EXT_CAP_ID_DSN 3
390#define PCI_EXT_CAP_ID_PWR 4
391
392/* Advanced Error Reporting */
393#define PCI_ERR_UNCOR_STATUS 4 /* Uncorrectable Error Status */
394#define PCI_ERR_UNC_TRAIN 0x00000001 /* Training */
395#define PCI_ERR_UNC_DLP 0x00000010 /* Data Link Protocol */
396#define PCI_ERR_UNC_POISON_TLP 0x00001000 /* Poisoned TLP */
397#define PCI_ERR_UNC_FCP 0x00002000 /* Flow Control Protocol */
398#define PCI_ERR_UNC_COMP_TIME 0x00004000 /* Completion Timeout */
399#define PCI_ERR_UNC_COMP_ABORT 0x00008000 /* Completer Abort */
400#define PCI_ERR_UNC_UNX_COMP 0x00010000 /* Unexpected Completion */
401#define PCI_ERR_UNC_RX_OVER 0x00020000 /* Receiver Overflow */
402#define PCI_ERR_UNC_MALF_TLP 0x00040000 /* Malformed TLP */
403#define PCI_ERR_UNC_ECRC 0x00080000 /* ECRC Error Status */
404#define PCI_ERR_UNC_UNSUP 0x00100000 /* Unsupported Request */
405#define PCI_ERR_UNCOR_MASK 8 /* Uncorrectable Error Mask */
406 /* Same bits as above */
407#define PCI_ERR_UNCOR_SEVER 12 /* Uncorrectable Error Severity */
408 /* Same bits as above */
409#define PCI_ERR_COR_STATUS 16 /* Correctable Error Status */
410#define PCI_ERR_COR_RCVR 0x00000001 /* Receiver Error Status */
411#define PCI_ERR_COR_BAD_TLP 0x00000040 /* Bad TLP Status */
412#define PCI_ERR_COR_BAD_DLLP 0x00000080 /* Bad DLLP Status */
413#define PCI_ERR_COR_REP_ROLL 0x00000100 /* REPLAY_NUM Rollover */
414#define PCI_ERR_COR_REP_TIMER 0x00001000 /* Replay Timer Timeout */
415#define PCI_ERR_COR_MASK 20 /* Correctable Error Mask */
416 /* Same bits as above */
417#define PCI_ERR_CAP 24 /* Advanced Error Capabilities */
418#define PCI_ERR_CAP_FEP(x) ((x) & 31) /* First Error Pointer */
419#define PCI_ERR_CAP_ECRC_GENC 0x00000020 /* ECRC Generation Capable */
420#define PCI_ERR_CAP_ECRC_GENE 0x00000040 /* ECRC Generation Enable */
421#define PCI_ERR_CAP_ECRC_CHKC 0x00000080 /* ECRC Check Capable */
422#define PCI_ERR_CAP_ECRC_CHKE 0x00000100 /* ECRC Check Enable */
423#define PCI_ERR_HEADER_LOG 28 /* Header Log Register (16 bytes) */
424#define PCI_ERR_ROOT_COMMAND 44 /* Root Error Command */
425#define PCI_ERR_ROOT_STATUS 48
426#define PCI_ERR_ROOT_COR_SRC 52
427#define PCI_ERR_ROOT_SRC 54
428
429/* Virtual Channel */
430#define PCI_VC_PORT_REG1 4
431#define PCI_VC_PORT_REG2 8
432#define PCI_VC_PORT_CTRL 12
433#define PCI_VC_PORT_STATUS 14
434#define PCI_VC_RES_CAP 16
435#define PCI_VC_RES_CTRL 20
436#define PCI_VC_RES_STATUS 26
437
438/* Power Budgeting */
439#define PCI_PWR_DSR 4 /* Data Select Register */
440#define PCI_PWR_DATA 8 /* Data Register */
441#define PCI_PWR_DATA_BASE(x) ((x) & 0xff) /* Base Power */
442#define PCI_PWR_DATA_SCALE(x) (((x) >> 8) & 3) /* Data Scale */
443#define PCI_PWR_DATA_PM_SUB(x) (((x) >> 10) & 7) /* PM Sub State */
444#define PCI_PWR_DATA_PM_STATE(x) (((x) >> 13) & 3) /* PM State */
445#define PCI_PWR_DATA_TYPE(x) (((x) >> 15) & 7) /* Type */
446#define PCI_PWR_DATA_RAIL(x) (((x) >> 18) & 7) /* Power Rail */
447#define PCI_PWR_CAP 12 /* Capability */
448#define PCI_PWR_CAP_BUDGET(x) ((x) & 1) /* Included in system budget */
449 24
450/* Include the ID list */ 25/* Include the ID list */
451
452#include <linux/pci_ids.h> 26#include <linux/pci_ids.h>
453 27
454/* 28/*
@@ -496,11 +70,12 @@ enum pci_mmap_state {
496 70
497typedef int __bitwise pci_power_t; 71typedef int __bitwise pci_power_t;
498 72
499#define PCI_D0 ((pci_power_t __force) 0) 73#define PCI_D0 ((pci_power_t __force) 0)
500#define PCI_D1 ((pci_power_t __force) 1) 74#define PCI_D1 ((pci_power_t __force) 1)
501#define PCI_D2 ((pci_power_t __force) 2) 75#define PCI_D2 ((pci_power_t __force) 2)
502#define PCI_D3hot ((pci_power_t __force) 3) 76#define PCI_D3hot ((pci_power_t __force) 3)
503#define PCI_D3cold ((pci_power_t __force) 4) 77#define PCI_D3cold ((pci_power_t __force) 4)
78#define PCI_UNKNOWN ((pci_power_t __force) 5)
504#define PCI_POWER_ERROR ((pci_power_t __force) -1) 79#define PCI_POWER_ERROR ((pci_power_t __force) -1)
505 80
506/* 81/*
@@ -562,11 +137,6 @@ struct pci_dev {
562 struct bin_attribute *rom_attr; /* attribute descriptor for sysfs ROM entry */ 137 struct bin_attribute *rom_attr; /* attribute descriptor for sysfs ROM entry */
563 int rom_attr_enabled; /* has display of the rom attribute been enabled? */ 138 int rom_attr_enabled; /* has display of the rom attribute been enabled? */
564 struct bin_attribute *res_attr[DEVICE_COUNT_RESOURCE]; /* sysfs file for resources */ 139 struct bin_attribute *res_attr[DEVICE_COUNT_RESOURCE]; /* sysfs file for resources */
565#ifdef CONFIG_PCI_NAMES
566#define PCI_NAME_SIZE 255
567#define PCI_NAME_HALF __stringify(43) /* less than half to handle slop */
568 char pretty_name[PCI_NAME_SIZE]; /* pretty name for users to see */
569#endif
570}; 140};
571 141
572#define pci_dev_g(n) list_entry(n, struct pci_dev, global_list) 142#define pci_dev_g(n) list_entry(n, struct pci_dev, global_list)
@@ -582,15 +152,15 @@ struct pci_dev {
582 * 7-10 bridges: address space assigned to buses behind the bridge 152 * 7-10 bridges: address space assigned to buses behind the bridge
583 */ 153 */
584 154
585#define PCI_ROM_RESOURCE 6 155#define PCI_ROM_RESOURCE 6
586#define PCI_BRIDGE_RESOURCES 7 156#define PCI_BRIDGE_RESOURCES 7
587#define PCI_NUM_RESOURCES 11 157#define PCI_NUM_RESOURCES 11
588 158
589#ifndef PCI_BUS_NUM_RESOURCES 159#ifndef PCI_BUS_NUM_RESOURCES
590#define PCI_BUS_NUM_RESOURCES 8 160#define PCI_BUS_NUM_RESOURCES 8
591#endif 161#endif
592 162
593#define PCI_REGION_FLAG_MASK 0x0fU /* These bits of resource flags tell us the PCI region flags */ 163#define PCI_REGION_FLAG_MASK 0x0fU /* These bits of resource flags tell us the PCI region flags */
594 164
595struct pci_bus { 165struct pci_bus {
596 struct list_head node; /* node in list of buses */ 166 struct list_head node; /* node in list of buses */
@@ -699,7 +269,7 @@ struct pci_driver {
699 * @dev_class_mask: the class mask for this device 269 * @dev_class_mask: the class mask for this device
700 * 270 *
701 * This macro is used to create a struct pci_device_id that matches a 271 * This macro is used to create a struct pci_device_id that matches a
702 * specific PCI class. The vendor, device, subvendor, and subdevice 272 * specific PCI class. The vendor, device, subvendor, and subdevice
703 * fields will be set to PCI_ANY_ID. 273 * fields will be set to PCI_ANY_ID.
704 */ 274 */
705#define PCI_DEVICE_CLASS(dev_class,dev_class_mask) \ 275#define PCI_DEVICE_CLASS(dev_class,dev_class_mask) \
@@ -707,7 +277,7 @@ struct pci_driver {
707 .vendor = PCI_ANY_ID, .device = PCI_ANY_ID, \ 277 .vendor = PCI_ANY_ID, .device = PCI_ANY_ID, \
708 .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID 278 .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
709 279
710/* 280/*
711 * pci_module_init is obsolete, this stays here till we fix up all usages of it 281 * pci_module_init is obsolete, this stays here till we fix up all usages of it
712 * in the tree. 282 * in the tree.
713 */ 283 */
@@ -745,12 +315,13 @@ static inline struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *s
745 pci_bus_add_devices(root_bus); 315 pci_bus_add_devices(root_bus);
746 return root_bus; 316 return root_bus;
747} 317}
318struct pci_bus *pci_create_bus(struct device *parent, int bus, struct pci_ops *ops, void *sysdata);
319struct pci_bus * pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, int busnr);
748int pci_scan_slot(struct pci_bus *bus, int devfn); 320int pci_scan_slot(struct pci_bus *bus, int devfn);
749struct pci_dev * pci_scan_single_device(struct pci_bus *bus, int devfn); 321struct pci_dev * pci_scan_single_device(struct pci_bus *bus, int devfn);
322void pci_device_add(struct pci_dev *dev, struct pci_bus *bus);
750unsigned int pci_scan_child_bus(struct pci_bus *bus); 323unsigned int pci_scan_child_bus(struct pci_bus *bus);
751void pci_bus_add_device(struct pci_dev *dev); 324void pci_bus_add_device(struct pci_dev *dev);
752void pci_name_device(struct pci_dev *dev);
753char *pci_class_name(u32 class);
754void pci_read_bridge_bases(struct pci_bus *child); 325void pci_read_bridge_bases(struct pci_bus *child);
755struct resource *pci_find_parent_resource(const struct pci_dev *dev, struct resource *res); 326struct resource *pci_find_parent_resource(const struct pci_dev *dev, struct resource *res);
756int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge); 327int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge);
@@ -758,6 +329,7 @@ extern struct pci_dev *pci_dev_get(struct pci_dev *dev);
758extern void pci_dev_put(struct pci_dev *dev); 329extern void pci_dev_put(struct pci_dev *dev);
759extern void pci_remove_bus(struct pci_bus *b); 330extern void pci_remove_bus(struct pci_bus *b);
760extern void pci_remove_bus_device(struct pci_dev *dev); 331extern void pci_remove_bus_device(struct pci_dev *dev);
332void pci_setup_cardbus(struct pci_bus *bus);
761 333
762/* Generic PCI functions exported to card drivers */ 334/* Generic PCI functions exported to card drivers */
763 335
@@ -815,13 +387,16 @@ void pci_set_master(struct pci_dev *dev);
815#define HAVE_PCI_SET_MWI 387#define HAVE_PCI_SET_MWI
816int pci_set_mwi(struct pci_dev *dev); 388int pci_set_mwi(struct pci_dev *dev);
817void pci_clear_mwi(struct pci_dev *dev); 389void pci_clear_mwi(struct pci_dev *dev);
390void pci_intx(struct pci_dev *dev, int enable);
818int pci_set_dma_mask(struct pci_dev *dev, u64 mask); 391int pci_set_dma_mask(struct pci_dev *dev, u64 mask);
819int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask); 392int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask);
393void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno);
820int pci_assign_resource(struct pci_dev *dev, int i); 394int pci_assign_resource(struct pci_dev *dev, int i);
395void pci_restore_bars(struct pci_dev *dev);
821 396
822/* ROM control related routines */ 397/* ROM control related routines */
823void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size); 398void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size);
824void __iomem *pci_map_rom_copy(struct pci_dev *pdev, size_t *size); 399void __iomem __must_check *pci_map_rom_copy(struct pci_dev *pdev, size_t *size);
825void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom); 400void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom);
826void pci_remove_rom(struct pci_dev *pdev); 401void pci_remove_rom(struct pci_dev *pdev);
827 402
@@ -865,6 +440,9 @@ const struct pci_device_id *pci_match_device(struct pci_driver *drv, struct pci_
865const struct pci_device_id *pci_match_id(const struct pci_device_id *ids, struct pci_dev *dev); 440const struct pci_device_id *pci_match_id(const struct pci_device_id *ids, struct pci_dev *dev);
866int pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass); 441int pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass);
867 442
443void pci_walk_bus(struct pci_bus *top, void (*cb)(struct pci_dev *, void *),
444 void *userdata);
445
868/* kmem_cache style wrapper around pci_alloc_consistent() */ 446/* kmem_cache style wrapper around pci_alloc_consistent() */
869 447
870#include <linux/dmapool.h> 448#include <linux/dmapool.h>
@@ -912,18 +490,26 @@ extern void pci_disable_msix(struct pci_dev *dev);
912extern void msi_remove_pci_irq_vectors(struct pci_dev *dev); 490extern void msi_remove_pci_irq_vectors(struct pci_dev *dev);
913#endif 491#endif
914 492
915#endif /* CONFIG_PCI */ 493/*
916 494 * PCI domain support. Sometimes called PCI segment (eg by ACPI),
917/* Include architecture-dependent settings and functions */ 495 * a PCI domain is defined to be a set of PCI busses which share
496 * configuration space.
497 */
498#ifndef CONFIG_PCI_DOMAINS
499static inline int pci_domain_nr(struct pci_bus *bus) { return 0; }
500static inline int pci_proc_domain(struct pci_bus *bus)
501{
502 return 0;
503}
504#endif
918 505
919#include <asm/pci.h> 506#else /* CONFIG_PCI is not enabled */
920 507
921/* 508/*
922 * If the system does not have PCI, clearly these return errors. Define 509 * If the system does not have PCI, clearly these return errors. Define
923 * these as simple inline functions to avoid hair in drivers. 510 * these as simple inline functions to avoid hair in drivers.
924 */ 511 */
925 512
926#ifndef CONFIG_PCI
927#define _PCI_NOP(o,s,t) \ 513#define _PCI_NOP(o,s,t) \
928 static inline int pci_##o##_config_##s (struct pci_dev *dev, int where, t val) \ 514 static inline int pci_##o##_config_##s (struct pci_dev *dev, int where, t val) \
929 { return PCIBIOS_FUNC_NOT_SUPPORTED; } 515 { return PCIBIOS_FUNC_NOT_SUPPORTED; }
@@ -974,21 +560,11 @@ static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int en
974 560
975#define pci_dma_burst_advice(pdev, strat, strategy_parameter) do { } while (0) 561#define pci_dma_burst_advice(pdev, strat, strategy_parameter) do { } while (0)
976 562
977#else 563#endif /* CONFIG_PCI */
978 564
979/* 565/* Include architecture-dependent settings and functions */
980 * PCI domain support. Sometimes called PCI segment (eg by ACPI), 566
981 * a PCI domain is defined to be a set of PCI busses which share 567#include <asm/pci.h>
982 * configuration space.
983 */
984#ifndef CONFIG_PCI_DOMAINS
985static inline int pci_domain_nr(struct pci_bus *bus) { return 0; }
986static inline int pci_proc_domain(struct pci_bus *bus)
987{
988 return 0;
989}
990#endif
991#endif /* !CONFIG_PCI */
992 568
993/* these helpers provide future and backwards compatibility 569/* these helpers provide future and backwards compatibility
994 * for accessing popular PCI BAR info */ 570 * for accessing popular PCI BAR info */
@@ -1025,13 +601,6 @@ static inline char *pci_name(struct pci_dev *pdev)
1025 return pdev->dev.bus_id; 601 return pdev->dev.bus_id;
1026} 602}
1027 603
1028/* Some archs want to see the pretty pci name, so use this macro */
1029#ifdef CONFIG_PCI_NAMES
1030#define pci_pretty_name(dev) ((dev)->pretty_name)
1031#else
1032#define pci_pretty_name(dev) ""
1033#endif
1034
1035 604
1036/* Some archs don't want to expose struct resource to userland as-is 605/* Some archs don't want to expose struct resource to userland as-is
1037 * in sysfs and /proc 606 * in sysfs and /proc
@@ -1067,7 +636,7 @@ enum pci_fixup_pass {
1067 636
1068/* Anonymous variables would be nice... */ 637/* Anonymous variables would be nice... */
1069#define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, hook) \ 638#define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, hook) \
1070 static struct pci_fixup __pci_fixup_##name __attribute_used__ \ 639 static const struct pci_fixup __pci_fixup_##name __attribute_used__ \
1071 __attribute__((__section__(#section))) = { vendor, device, hook }; 640 __attribute__((__section__(#section))) = { vendor, device, hook };
1072#define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \ 641#define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \
1073 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \ 642 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
new file mode 100644
index 000000000000..e2a089b051ed
--- /dev/null
+++ b/include/linux/pci_regs.h
@@ -0,0 +1,448 @@
1/*
2 * pci_regs.h
3 *
4 * PCI standard defines
5 * Copyright 1994, Drew Eckhardt
6 * Copyright 1997--1999 Martin Mares <mj@ucw.cz>
7 *
8 * For more information, please consult the following manuals (look at
9 * http://www.pcisig.com/ for how to get them):
10 *
11 * PCI BIOS Specification
12 * PCI Local Bus Specification
13 * PCI to PCI Bridge Specification
14 * PCI System Design Guide
15 */
16
17#ifndef LINUX_PCI_REGS_H
18#define LINUX_PCI_REGS_H
19
20/*
21 * Under PCI, each device has 256 bytes of configuration address space,
22 * of which the first 64 bytes are standardized as follows:
23 */
24#define PCI_VENDOR_ID 0x00 /* 16 bits */
25#define PCI_DEVICE_ID 0x02 /* 16 bits */
26#define PCI_COMMAND 0x04 /* 16 bits */
27#define PCI_COMMAND_IO 0x1 /* Enable response in I/O space */
28#define PCI_COMMAND_MEMORY 0x2 /* Enable response in Memory space */
29#define PCI_COMMAND_MASTER 0x4 /* Enable bus mastering */
30#define PCI_COMMAND_SPECIAL 0x8 /* Enable response to special cycles */
31#define PCI_COMMAND_INVALIDATE 0x10 /* Use memory write and invalidate */
32#define PCI_COMMAND_VGA_PALETTE 0x20 /* Enable palette snooping */
33#define PCI_COMMAND_PARITY 0x40 /* Enable parity checking */
34#define PCI_COMMAND_WAIT 0x80 /* Enable address/data stepping */
35#define PCI_COMMAND_SERR 0x100 /* Enable SERR */
36#define PCI_COMMAND_FAST_BACK 0x200 /* Enable back-to-back writes */
37#define PCI_COMMAND_INTX_DISABLE 0x400 /* INTx Emulation Disable */
38
39#define PCI_STATUS 0x06 /* 16 bits */
40#define PCI_STATUS_CAP_LIST 0x10 /* Support Capability List */
41#define PCI_STATUS_66MHZ 0x20 /* Support 66 Mhz PCI 2.1 bus */
42#define PCI_STATUS_UDF 0x40 /* Support User Definable Features [obsolete] */
43#define PCI_STATUS_FAST_BACK 0x80 /* Accept fast-back to back */
44#define PCI_STATUS_PARITY 0x100 /* Detected parity error */
45#define PCI_STATUS_DEVSEL_MASK 0x600 /* DEVSEL timing */
46#define PCI_STATUS_DEVSEL_FAST 0x000
47#define PCI_STATUS_DEVSEL_MEDIUM 0x200
48#define PCI_STATUS_DEVSEL_SLOW 0x400
49#define PCI_STATUS_SIG_TARGET_ABORT 0x800 /* Set on target abort */
50#define PCI_STATUS_REC_TARGET_ABORT 0x1000 /* Master ack of " */
51#define PCI_STATUS_REC_MASTER_ABORT 0x2000 /* Set on master abort */
52#define PCI_STATUS_SIG_SYSTEM_ERROR 0x4000 /* Set when we drive SERR */
53#define PCI_STATUS_DETECTED_PARITY 0x8000 /* Set on parity error */
54
55#define PCI_CLASS_REVISION 0x08 /* High 24 bits are class, low 8 revision */
56#define PCI_REVISION_ID 0x08 /* Revision ID */
57#define PCI_CLASS_PROG 0x09 /* Reg. Level Programming Interface */
58#define PCI_CLASS_DEVICE 0x0a /* Device class */
59
60#define PCI_CACHE_LINE_SIZE 0x0c /* 8 bits */
61#define PCI_LATENCY_TIMER 0x0d /* 8 bits */
62#define PCI_HEADER_TYPE 0x0e /* 8 bits */
63#define PCI_HEADER_TYPE_NORMAL 0
64#define PCI_HEADER_TYPE_BRIDGE 1
65#define PCI_HEADER_TYPE_CARDBUS 2
66
67#define PCI_BIST 0x0f /* 8 bits */
68#define PCI_BIST_CODE_MASK 0x0f /* Return result */
69#define PCI_BIST_START 0x40 /* 1 to start BIST, 2 secs or less */
70#define PCI_BIST_CAPABLE 0x80 /* 1 if BIST capable */
71
72/*
73 * Base addresses specify locations in memory or I/O space.
74 * Decoded size can be determined by writing a value of
75 * 0xffffffff to the register, and reading it back. Only
76 * 1 bits are decoded.
77 */
78#define PCI_BASE_ADDRESS_0 0x10 /* 32 bits */
79#define PCI_BASE_ADDRESS_1 0x14 /* 32 bits [htype 0,1 only] */
80#define PCI_BASE_ADDRESS_2 0x18 /* 32 bits [htype 0 only] */
81#define PCI_BASE_ADDRESS_3 0x1c /* 32 bits */
82#define PCI_BASE_ADDRESS_4 0x20 /* 32 bits */
83#define PCI_BASE_ADDRESS_5 0x24 /* 32 bits */
84#define PCI_BASE_ADDRESS_SPACE 0x01 /* 0 = memory, 1 = I/O */
85#define PCI_BASE_ADDRESS_SPACE_IO 0x01
86#define PCI_BASE_ADDRESS_SPACE_MEMORY 0x00
87#define PCI_BASE_ADDRESS_MEM_TYPE_MASK 0x06
88#define PCI_BASE_ADDRESS_MEM_TYPE_32 0x00 /* 32 bit address */
89#define PCI_BASE_ADDRESS_MEM_TYPE_1M 0x02 /* Below 1M [obsolete] */
90#define PCI_BASE_ADDRESS_MEM_TYPE_64 0x04 /* 64 bit address */
91#define PCI_BASE_ADDRESS_MEM_PREFETCH 0x08 /* prefetchable? */
92#define PCI_BASE_ADDRESS_MEM_MASK (~0x0fUL)
93#define PCI_BASE_ADDRESS_IO_MASK (~0x03UL)
94/* bit 1 is reserved if address_space = 1 */
95
96/* Header type 0 (normal devices) */
97#define PCI_CARDBUS_CIS 0x28
98#define PCI_SUBSYSTEM_VENDOR_ID 0x2c
99#define PCI_SUBSYSTEM_ID 0x2e
100#define PCI_ROM_ADDRESS 0x30 /* Bits 31..11 are address, 10..1 reserved */
101#define PCI_ROM_ADDRESS_ENABLE 0x01
102#define PCI_ROM_ADDRESS_MASK (~0x7ffUL)
103
104#define PCI_CAPABILITY_LIST 0x34 /* Offset of first capability list entry */
105
106/* 0x35-0x3b are reserved */
107#define PCI_INTERRUPT_LINE 0x3c /* 8 bits */
108#define PCI_INTERRUPT_PIN 0x3d /* 8 bits */
109#define PCI_MIN_GNT 0x3e /* 8 bits */
110#define PCI_MAX_LAT 0x3f /* 8 bits */
111
112/* Header type 1 (PCI-to-PCI bridges) */
113#define PCI_PRIMARY_BUS 0x18 /* Primary bus number */
114#define PCI_SECONDARY_BUS 0x19 /* Secondary bus number */
115#define PCI_SUBORDINATE_BUS 0x1a /* Highest bus number behind the bridge */
116#define PCI_SEC_LATENCY_TIMER 0x1b /* Latency timer for secondary interface */
117#define PCI_IO_BASE 0x1c /* I/O range behind the bridge */
118#define PCI_IO_LIMIT 0x1d
119#define PCI_IO_RANGE_TYPE_MASK 0x0fUL /* I/O bridging type */
120#define PCI_IO_RANGE_TYPE_16 0x00
121#define PCI_IO_RANGE_TYPE_32 0x01
122#define PCI_IO_RANGE_MASK (~0x0fUL)
123#define PCI_SEC_STATUS 0x1e /* Secondary status register, only bit 14 used */
124#define PCI_MEMORY_BASE 0x20 /* Memory range behind */
125#define PCI_MEMORY_LIMIT 0x22
126#define PCI_MEMORY_RANGE_TYPE_MASK 0x0fUL
127#define PCI_MEMORY_RANGE_MASK (~0x0fUL)
128#define PCI_PREF_MEMORY_BASE 0x24 /* Prefetchable memory range behind */
129#define PCI_PREF_MEMORY_LIMIT 0x26
130#define PCI_PREF_RANGE_TYPE_MASK 0x0fUL
131#define PCI_PREF_RANGE_TYPE_32 0x00
132#define PCI_PREF_RANGE_TYPE_64 0x01
133#define PCI_PREF_RANGE_MASK (~0x0fUL)
134#define PCI_PREF_BASE_UPPER32 0x28 /* Upper half of prefetchable memory range */
135#define PCI_PREF_LIMIT_UPPER32 0x2c
136#define PCI_IO_BASE_UPPER16 0x30 /* Upper half of I/O addresses */
137#define PCI_IO_LIMIT_UPPER16 0x32
138/* 0x34 same as for htype 0 */
139/* 0x35-0x3b is reserved */
140#define PCI_ROM_ADDRESS1 0x38 /* Same as PCI_ROM_ADDRESS, but for htype 1 */
141/* 0x3c-0x3d are same as for htype 0 */
142#define PCI_BRIDGE_CONTROL 0x3e
143#define PCI_BRIDGE_CTL_PARITY 0x01 /* Enable parity detection on secondary interface */
144#define PCI_BRIDGE_CTL_SERR 0x02 /* The same for SERR forwarding */
145#define PCI_BRIDGE_CTL_NO_ISA 0x04 /* Disable bridging of ISA ports */
146#define PCI_BRIDGE_CTL_VGA 0x08 /* Forward VGA addresses */
147#define PCI_BRIDGE_CTL_MASTER_ABORT 0x20 /* Report master aborts */
148#define PCI_BRIDGE_CTL_BUS_RESET 0x40 /* Secondary bus reset */
149#define PCI_BRIDGE_CTL_FAST_BACK 0x80 /* Fast Back2Back enabled on secondary interface */
150
151/* Header type 2 (CardBus bridges) */
152#define PCI_CB_CAPABILITY_LIST 0x14
153/* 0x15 reserved */
154#define PCI_CB_SEC_STATUS 0x16 /* Secondary status */
155#define PCI_CB_PRIMARY_BUS 0x18 /* PCI bus number */
156#define PCI_CB_CARD_BUS 0x19 /* CardBus bus number */
157#define PCI_CB_SUBORDINATE_BUS 0x1a /* Subordinate bus number */
158#define PCI_CB_LATENCY_TIMER 0x1b /* CardBus latency timer */
159#define PCI_CB_MEMORY_BASE_0 0x1c
160#define PCI_CB_MEMORY_LIMIT_0 0x20
161#define PCI_CB_MEMORY_BASE_1 0x24
162#define PCI_CB_MEMORY_LIMIT_1 0x28
163#define PCI_CB_IO_BASE_0 0x2c
164#define PCI_CB_IO_BASE_0_HI 0x2e
165#define PCI_CB_IO_LIMIT_0 0x30
166#define PCI_CB_IO_LIMIT_0_HI 0x32
167#define PCI_CB_IO_BASE_1 0x34
168#define PCI_CB_IO_BASE_1_HI 0x36
169#define PCI_CB_IO_LIMIT_1 0x38
170#define PCI_CB_IO_LIMIT_1_HI 0x3a
171#define PCI_CB_IO_RANGE_MASK (~0x03UL)
172/* 0x3c-0x3d are same as for htype 0 */
173#define PCI_CB_BRIDGE_CONTROL 0x3e
174#define PCI_CB_BRIDGE_CTL_PARITY 0x01 /* Similar to standard bridge control register */
175#define PCI_CB_BRIDGE_CTL_SERR 0x02
176#define PCI_CB_BRIDGE_CTL_ISA 0x04
177#define PCI_CB_BRIDGE_CTL_VGA 0x08
178#define PCI_CB_BRIDGE_CTL_MASTER_ABORT 0x20
179#define PCI_CB_BRIDGE_CTL_CB_RESET 0x40 /* CardBus reset */
180#define PCI_CB_BRIDGE_CTL_16BIT_INT 0x80 /* Enable interrupt for 16-bit cards */
181#define PCI_CB_BRIDGE_CTL_PREFETCH_MEM0 0x100 /* Prefetch enable for both memory regions */
182#define PCI_CB_BRIDGE_CTL_PREFETCH_MEM1 0x200
183#define PCI_CB_BRIDGE_CTL_POST_WRITES 0x400
184#define PCI_CB_SUBSYSTEM_VENDOR_ID 0x40
185#define PCI_CB_SUBSYSTEM_ID 0x42
186#define PCI_CB_LEGACY_MODE_BASE 0x44 /* 16-bit PC Card legacy mode base address (ExCa) */
187/* 0x48-0x7f reserved */
188
189/* Capability lists */
190
191#define PCI_CAP_LIST_ID 0 /* Capability ID */
192#define PCI_CAP_ID_PM 0x01 /* Power Management */
193#define PCI_CAP_ID_AGP 0x02 /* Accelerated Graphics Port */
194#define PCI_CAP_ID_VPD 0x03 /* Vital Product Data */
195#define PCI_CAP_ID_SLOTID 0x04 /* Slot Identification */
196#define PCI_CAP_ID_MSI 0x05 /* Message Signalled Interrupts */
197#define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */
198#define PCI_CAP_ID_PCIX 0x07 /* PCI-X */
199#define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */
200#define PCI_CAP_ID_EXP 0x10 /* PCI Express */
201#define PCI_CAP_ID_MSIX 0x11 /* MSI-X */
202#define PCI_CAP_LIST_NEXT 1 /* Next capability in the list */
203#define PCI_CAP_FLAGS 2 /* Capability defined flags (16 bits) */
204#define PCI_CAP_SIZEOF 4
205
206/* Power Management Registers */
207
208#define PCI_PM_PMC 2 /* PM Capabilities Register */
209#define PCI_PM_CAP_VER_MASK 0x0007 /* Version */
210#define PCI_PM_CAP_PME_CLOCK 0x0008 /* PME clock required */
211#define PCI_PM_CAP_RESERVED 0x0010 /* Reserved field */
212#define PCI_PM_CAP_DSI 0x0020 /* Device specific initialization */
213#define PCI_PM_CAP_AUX_POWER 0x01C0 /* Auxilliary power support mask */
214#define PCI_PM_CAP_D1 0x0200 /* D1 power state support */
215#define PCI_PM_CAP_D2 0x0400 /* D2 power state support */
216#define PCI_PM_CAP_PME 0x0800 /* PME pin supported */
217#define PCI_PM_CAP_PME_MASK 0xF800 /* PME Mask of all supported states */
218#define PCI_PM_CAP_PME_D0 0x0800 /* PME# from D0 */
219#define PCI_PM_CAP_PME_D1 0x1000 /* PME# from D1 */
220#define PCI_PM_CAP_PME_D2 0x2000 /* PME# from D2 */
221#define PCI_PM_CAP_PME_D3 0x4000 /* PME# from D3 (hot) */
222#define PCI_PM_CAP_PME_D3cold 0x8000 /* PME# from D3 (cold) */
223#define PCI_PM_CTRL 4 /* PM control and status register */
224#define PCI_PM_CTRL_STATE_MASK 0x0003 /* Current power state (D0 to D3) */
225#define PCI_PM_CTRL_NO_SOFT_RESET 0x0004 /* No reset for D3hot->D0 */
226#define PCI_PM_CTRL_PME_ENABLE 0x0100 /* PME pin enable */
227#define PCI_PM_CTRL_DATA_SEL_MASK 0x1e00 /* Data select (??) */
228#define PCI_PM_CTRL_DATA_SCALE_MASK 0x6000 /* Data scale (??) */
229#define PCI_PM_CTRL_PME_STATUS 0x8000 /* PME pin status */
230#define PCI_PM_PPB_EXTENSIONS 6 /* PPB support extensions (??) */
231#define PCI_PM_PPB_B2_B3 0x40 /* Stop clock when in D3hot (??) */
232#define PCI_PM_BPCC_ENABLE 0x80 /* Bus power/clock control enable (??) */
233#define PCI_PM_DATA_REGISTER 7 /* (??) */
234#define PCI_PM_SIZEOF 8
235
236/* AGP registers */
237
238#define PCI_AGP_VERSION 2 /* BCD version number */
239#define PCI_AGP_RFU 3 /* Rest of capability flags */
240#define PCI_AGP_STATUS 4 /* Status register */
241#define PCI_AGP_STATUS_RQ_MASK 0xff000000 /* Maximum number of requests - 1 */
242#define PCI_AGP_STATUS_SBA 0x0200 /* Sideband addressing supported */
243#define PCI_AGP_STATUS_64BIT 0x0020 /* 64-bit addressing supported */
244#define PCI_AGP_STATUS_FW 0x0010 /* FW transfers supported */
245#define PCI_AGP_STATUS_RATE4 0x0004 /* 4x transfer rate supported */
246#define PCI_AGP_STATUS_RATE2 0x0002 /* 2x transfer rate supported */
247#define PCI_AGP_STATUS_RATE1 0x0001 /* 1x transfer rate supported */
248#define PCI_AGP_COMMAND 8 /* Control register */
249#define PCI_AGP_COMMAND_RQ_MASK 0xff000000 /* Master: Maximum number of requests */
250#define PCI_AGP_COMMAND_SBA 0x0200 /* Sideband addressing enabled */
251#define PCI_AGP_COMMAND_AGP 0x0100 /* Allow processing of AGP transactions */
252#define PCI_AGP_COMMAND_64BIT 0x0020 /* Allow processing of 64-bit addresses */
253#define PCI_AGP_COMMAND_FW 0x0010 /* Force FW transfers */
254#define PCI_AGP_COMMAND_RATE4 0x0004 /* Use 4x rate */
255#define PCI_AGP_COMMAND_RATE2 0x0002 /* Use 2x rate */
256#define PCI_AGP_COMMAND_RATE1 0x0001 /* Use 1x rate */
257#define PCI_AGP_SIZEOF 12
258
259/* Vital Product Data */
260
261#define PCI_VPD_ADDR 2 /* Address to access (15 bits!) */
262#define PCI_VPD_ADDR_MASK 0x7fff /* Address mask */
263#define PCI_VPD_ADDR_F 0x8000 /* Write 0, 1 indicates completion */
264#define PCI_VPD_DATA 4 /* 32-bits of data returned here */
265
266/* Slot Identification */
267
268#define PCI_SID_ESR 2 /* Expansion Slot Register */
269#define PCI_SID_ESR_NSLOTS 0x1f /* Number of expansion slots available */
270#define PCI_SID_ESR_FIC 0x20 /* First In Chassis Flag */
271#define PCI_SID_CHASSIS_NR 3 /* Chassis Number */
272
273/* Message Signalled Interrupts registers */
274
275#define PCI_MSI_FLAGS 2 /* Various flags */
276#define PCI_MSI_FLAGS_64BIT 0x80 /* 64-bit addresses allowed */
277#define PCI_MSI_FLAGS_QSIZE 0x70 /* Message queue size configured */
278#define PCI_MSI_FLAGS_QMASK 0x0e /* Maximum queue size available */
279#define PCI_MSI_FLAGS_ENABLE 0x01 /* MSI feature enabled */
280#define PCI_MSI_FLAGS_MASKBIT 0x100 /* 64-bit mask bits allowed */
281#define PCI_MSI_RFU 3 /* Rest of capability flags */
282#define PCI_MSI_ADDRESS_LO 4 /* Lower 32 bits */
283#define PCI_MSI_ADDRESS_HI 8 /* Upper 32 bits (if PCI_MSI_FLAGS_64BIT set) */
284#define PCI_MSI_DATA_32 8 /* 16 bits of data for 32-bit devices */
285#define PCI_MSI_DATA_64 12 /* 16 bits of data for 64-bit devices */
286#define PCI_MSI_MASK_BIT 16 /* Mask bits register */
287
288/* CompactPCI Hotswap Register */
289
290#define PCI_CHSWP_CSR 2 /* Control and Status Register */
291#define PCI_CHSWP_DHA 0x01 /* Device Hiding Arm */
292#define PCI_CHSWP_EIM 0x02 /* ENUM# Signal Mask */
293#define PCI_CHSWP_PIE 0x04 /* Pending Insert or Extract */
294#define PCI_CHSWP_LOO 0x08 /* LED On / Off */
295#define PCI_CHSWP_PI 0x30 /* Programming Interface */
296#define PCI_CHSWP_EXT 0x40 /* ENUM# status - extraction */
297#define PCI_CHSWP_INS 0x80 /* ENUM# status - insertion */
298
299/* PCI-X registers */
300
301#define PCI_X_CMD 2 /* Modes & Features */
302#define PCI_X_CMD_DPERR_E 0x0001 /* Data Parity Error Recovery Enable */
303#define PCI_X_CMD_ERO 0x0002 /* Enable Relaxed Ordering */
304#define PCI_X_CMD_MAX_READ 0x000c /* Max Memory Read Byte Count */
305#define PCI_X_CMD_MAX_SPLIT 0x0070 /* Max Outstanding Split Transactions */
306#define PCI_X_CMD_VERSION(x) (((x) >> 12) & 3) /* Version */
307#define PCI_X_STATUS 4 /* PCI-X capabilities */
308#define PCI_X_STATUS_DEVFN 0x000000ff /* A copy of devfn */
309#define PCI_X_STATUS_BUS 0x0000ff00 /* A copy of bus nr */
310#define PCI_X_STATUS_64BIT 0x00010000 /* 64-bit device */
311#define PCI_X_STATUS_133MHZ 0x00020000 /* 133 MHz capable */
312#define PCI_X_STATUS_SPL_DISC 0x00040000 /* Split Completion Discarded */
313#define PCI_X_STATUS_UNX_SPL 0x00080000 /* Unexpected Split Completion */
314#define PCI_X_STATUS_COMPLEX 0x00100000 /* Device Complexity */
315#define PCI_X_STATUS_MAX_READ 0x00600000 /* Designed Max Memory Read Count */
316#define PCI_X_STATUS_MAX_SPLIT 0x03800000 /* Designed Max Outstanding Split Transactions */
317#define PCI_X_STATUS_MAX_CUM 0x1c000000 /* Designed Max Cumulative Read Size */
318#define PCI_X_STATUS_SPL_ERR 0x20000000 /* Rcvd Split Completion Error Msg */
319#define PCI_X_STATUS_266MHZ 0x40000000 /* 266 MHz capable */
320#define PCI_X_STATUS_533MHZ 0x80000000 /* 533 MHz capable */
321
322/* PCI Express capability registers */
323
324#define PCI_EXP_FLAGS 2 /* Capabilities register */
325#define PCI_EXP_FLAGS_VERS 0x000f /* Capability version */
326#define PCI_EXP_FLAGS_TYPE 0x00f0 /* Device/Port type */
327#define PCI_EXP_TYPE_ENDPOINT 0x0 /* Express Endpoint */
328#define PCI_EXP_TYPE_LEG_END 0x1 /* Legacy Endpoint */
329#define PCI_EXP_TYPE_ROOT_PORT 0x4 /* Root Port */
330#define PCI_EXP_TYPE_UPSTREAM 0x5 /* Upstream Port */
331#define PCI_EXP_TYPE_DOWNSTREAM 0x6 /* Downstream Port */
332#define PCI_EXP_TYPE_PCI_BRIDGE 0x7 /* PCI/PCI-X Bridge */
333#define PCI_EXP_FLAGS_SLOT 0x0100 /* Slot implemented */
334#define PCI_EXP_FLAGS_IRQ 0x3e00 /* Interrupt message number */
335#define PCI_EXP_DEVCAP 4 /* Device capabilities */
336#define PCI_EXP_DEVCAP_PAYLOAD 0x07 /* Max_Payload_Size */
337#define PCI_EXP_DEVCAP_PHANTOM 0x18 /* Phantom functions */
338#define PCI_EXP_DEVCAP_EXT_TAG 0x20 /* Extended tags */
339#define PCI_EXP_DEVCAP_L0S 0x1c0 /* L0s Acceptable Latency */
340#define PCI_EXP_DEVCAP_L1 0xe00 /* L1 Acceptable Latency */
341#define PCI_EXP_DEVCAP_ATN_BUT 0x1000 /* Attention Button Present */
342#define PCI_EXP_DEVCAP_ATN_IND 0x2000 /* Attention Indicator Present */
343#define PCI_EXP_DEVCAP_PWR_IND 0x4000 /* Power Indicator Present */
344#define PCI_EXP_DEVCAP_PWR_VAL 0x3fc0000 /* Slot Power Limit Value */
345#define PCI_EXP_DEVCAP_PWR_SCL 0xc000000 /* Slot Power Limit Scale */
346#define PCI_EXP_DEVCTL 8 /* Device Control */
347#define PCI_EXP_DEVCTL_CERE 0x0001 /* Correctable Error Reporting En. */
348#define PCI_EXP_DEVCTL_NFERE 0x0002 /* Non-Fatal Error Reporting Enable */
349#define PCI_EXP_DEVCTL_FERE 0x0004 /* Fatal Error Reporting Enable */
350#define PCI_EXP_DEVCTL_URRE 0x0008 /* Unsupported Request Reporting En. */
351#define PCI_EXP_DEVCTL_RELAX_EN 0x0010 /* Enable relaxed ordering */
352#define PCI_EXP_DEVCTL_PAYLOAD 0x00e0 /* Max_Payload_Size */
353#define PCI_EXP_DEVCTL_EXT_TAG 0x0100 /* Extended Tag Field Enable */
354#define PCI_EXP_DEVCTL_PHANTOM 0x0200 /* Phantom Functions Enable */
355#define PCI_EXP_DEVCTL_AUX_PME 0x0400 /* Auxiliary Power PM Enable */
356#define PCI_EXP_DEVCTL_NOSNOOP_EN 0x0800 /* Enable No Snoop */
357#define PCI_EXP_DEVCTL_READRQ 0x7000 /* Max_Read_Request_Size */
358#define PCI_EXP_DEVSTA 10 /* Device Status */
359#define PCI_EXP_DEVSTA_CED 0x01 /* Correctable Error Detected */
360#define PCI_EXP_DEVSTA_NFED 0x02 /* Non-Fatal Error Detected */
361#define PCI_EXP_DEVSTA_FED 0x04 /* Fatal Error Detected */
362#define PCI_EXP_DEVSTA_URD 0x08 /* Unsupported Request Detected */
363#define PCI_EXP_DEVSTA_AUXPD 0x10 /* AUX Power Detected */
364#define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */
365#define PCI_EXP_LNKCAP 12 /* Link Capabilities */
366#define PCI_EXP_LNKCTL 16 /* Link Control */
367#define PCI_EXP_LNKSTA 18 /* Link Status */
368#define PCI_EXP_SLTCAP 20 /* Slot Capabilities */
369#define PCI_EXP_SLTCTL 24 /* Slot Control */
370#define PCI_EXP_SLTSTA 26 /* Slot Status */
371#define PCI_EXP_RTCTL 28 /* Root Control */
372#define PCI_EXP_RTCTL_SECEE 0x01 /* System Error on Correctable Error */
373#define PCI_EXP_RTCTL_SENFEE 0x02 /* System Error on Non-Fatal Error */
374#define PCI_EXP_RTCTL_SEFEE 0x04 /* System Error on Fatal Error */
375#define PCI_EXP_RTCTL_PMEIE 0x08 /* PME Interrupt Enable */
376#define PCI_EXP_RTCTL_CRSSVE 0x10 /* CRS Software Visibility Enable */
377#define PCI_EXP_RTCAP 30 /* Root Capabilities */
378#define PCI_EXP_RTSTA 32 /* Root Status */
379
380/* Extended Capabilities (PCI-X 2.0 and Express) */
381#define PCI_EXT_CAP_ID(header) (header & 0x0000ffff)
382#define PCI_EXT_CAP_VER(header) ((header >> 16) & 0xf)
383#define PCI_EXT_CAP_NEXT(header) ((header >> 20) & 0xffc)
384
385#define PCI_EXT_CAP_ID_ERR 1
386#define PCI_EXT_CAP_ID_VC 2
387#define PCI_EXT_CAP_ID_DSN 3
388#define PCI_EXT_CAP_ID_PWR 4
389
390/* Advanced Error Reporting */
391#define PCI_ERR_UNCOR_STATUS 4 /* Uncorrectable Error Status */
392#define PCI_ERR_UNC_TRAIN 0x00000001 /* Training */
393#define PCI_ERR_UNC_DLP 0x00000010 /* Data Link Protocol */
394#define PCI_ERR_UNC_POISON_TLP 0x00001000 /* Poisoned TLP */
395#define PCI_ERR_UNC_FCP 0x00002000 /* Flow Control Protocol */
396#define PCI_ERR_UNC_COMP_TIME 0x00004000 /* Completion Timeout */
397#define PCI_ERR_UNC_COMP_ABORT 0x00008000 /* Completer Abort */
398#define PCI_ERR_UNC_UNX_COMP 0x00010000 /* Unexpected Completion */
399#define PCI_ERR_UNC_RX_OVER 0x00020000 /* Receiver Overflow */
400#define PCI_ERR_UNC_MALF_TLP 0x00040000 /* Malformed TLP */
401#define PCI_ERR_UNC_ECRC 0x00080000 /* ECRC Error Status */
402#define PCI_ERR_UNC_UNSUP 0x00100000 /* Unsupported Request */
403#define PCI_ERR_UNCOR_MASK 8 /* Uncorrectable Error Mask */
404 /* Same bits as above */
405#define PCI_ERR_UNCOR_SEVER 12 /* Uncorrectable Error Severity */
406 /* Same bits as above */
407#define PCI_ERR_COR_STATUS 16 /* Correctable Error Status */
408#define PCI_ERR_COR_RCVR 0x00000001 /* Receiver Error Status */
409#define PCI_ERR_COR_BAD_TLP 0x00000040 /* Bad TLP Status */
410#define PCI_ERR_COR_BAD_DLLP 0x00000080 /* Bad DLLP Status */
411#define PCI_ERR_COR_REP_ROLL 0x00000100 /* REPLAY_NUM Rollover */
412#define PCI_ERR_COR_REP_TIMER 0x00001000 /* Replay Timer Timeout */
413#define PCI_ERR_COR_MASK 20 /* Correctable Error Mask */
414 /* Same bits as above */
415#define PCI_ERR_CAP 24 /* Advanced Error Capabilities */
416#define PCI_ERR_CAP_FEP(x) ((x) & 31) /* First Error Pointer */
417#define PCI_ERR_CAP_ECRC_GENC 0x00000020 /* ECRC Generation Capable */
418#define PCI_ERR_CAP_ECRC_GENE 0x00000040 /* ECRC Generation Enable */
419#define PCI_ERR_CAP_ECRC_CHKC 0x00000080 /* ECRC Check Capable */
420#define PCI_ERR_CAP_ECRC_CHKE 0x00000100 /* ECRC Check Enable */
421#define PCI_ERR_HEADER_LOG 28 /* Header Log Register (16 bytes) */
422#define PCI_ERR_ROOT_COMMAND 44 /* Root Error Command */
423#define PCI_ERR_ROOT_STATUS 48
424#define PCI_ERR_ROOT_COR_SRC 52
425#define PCI_ERR_ROOT_SRC 54
426
427/* Virtual Channel */
428#define PCI_VC_PORT_REG1 4
429#define PCI_VC_PORT_REG2 8
430#define PCI_VC_PORT_CTRL 12
431#define PCI_VC_PORT_STATUS 14
432#define PCI_VC_RES_CAP 16
433#define PCI_VC_RES_CTRL 20
434#define PCI_VC_RES_STATUS 26
435
436/* Power Budgeting */
437#define PCI_PWR_DSR 4 /* Data Select Register */
438#define PCI_PWR_DATA 8 /* Data Register */
439#define PCI_PWR_DATA_BASE(x) ((x) & 0xff) /* Base Power */
440#define PCI_PWR_DATA_SCALE(x) (((x) >> 8) & 3) /* Data Scale */
441#define PCI_PWR_DATA_PM_SUB(x) (((x) >> 10) & 7) /* PM Sub State */
442#define PCI_PWR_DATA_PM_STATE(x) (((x) >> 13) & 3) /* PM State */
443#define PCI_PWR_DATA_TYPE(x) (((x) >> 15) & 7) /* Type */
444#define PCI_PWR_DATA_RAIL(x) (((x) >> 18) & 7) /* Power Rail */
445#define PCI_PWR_CAP 12 /* Capability */
446#define PCI_PWR_CAP_BUDGET(x) ((x) & 1) /* Included in system budget */
447
448#endif /* LINUX_PCI_REGS_H */
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index 8081a281fa5e..9c51917b1cce 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -24,7 +24,7 @@
24 24
25struct radix_tree_root { 25struct radix_tree_root {
26 unsigned int height; 26 unsigned int height;
27 int gfp_mask; 27 unsigned int gfp_mask;
28 struct radix_tree_node *rnode; 28 struct radix_tree_node *rnode;
29}; 29};
30 30
@@ -50,7 +50,7 @@ void *radix_tree_delete(struct radix_tree_root *, unsigned long);
50unsigned int 50unsigned int
51radix_tree_gang_lookup(struct radix_tree_root *root, void **results, 51radix_tree_gang_lookup(struct radix_tree_root *root, void **results,
52 unsigned long first_index, unsigned int max_items); 52 unsigned long first_index, unsigned int max_items);
53int radix_tree_preload(int gfp_mask); 53int radix_tree_preload(unsigned int __nocast gfp_mask);
54void radix_tree_init(void); 54void radix_tree_init(void);
55void *radix_tree_tag_set(struct radix_tree_root *root, 55void *radix_tree_tag_set(struct radix_tree_root *root,
56 unsigned long index, int tag); 56 unsigned long index, int tag);
diff --git a/include/linux/raid/bitmap.h b/include/linux/raid/bitmap.h
index 4bf1659f8aa8..9de99198caf1 100644
--- a/include/linux/raid/bitmap.h
+++ b/include/linux/raid/bitmap.h
@@ -7,7 +7,7 @@
7#define BITMAP_H 1 7#define BITMAP_H 1
8 8
9#define BITMAP_MAJOR 3 9#define BITMAP_MAJOR 3
10#define BITMAP_MINOR 38 10#define BITMAP_MINOR 39
11 11
12/* 12/*
13 * in-memory bitmap: 13 * in-memory bitmap:
@@ -147,8 +147,9 @@ typedef struct bitmap_super_s {
147 __u32 state; /* 48 bitmap state information */ 147 __u32 state; /* 48 bitmap state information */
148 __u32 chunksize; /* 52 the bitmap chunk size in bytes */ 148 __u32 chunksize; /* 52 the bitmap chunk size in bytes */
149 __u32 daemon_sleep; /* 56 seconds between disk flushes */ 149 __u32 daemon_sleep; /* 56 seconds between disk flushes */
150 __u32 write_behind; /* 60 number of outstanding write-behind writes */
150 151
151 __u8 pad[256 - 60]; /* set to zero */ 152 __u8 pad[256 - 64]; /* set to zero */
152} bitmap_super_t; 153} bitmap_super_t;
153 154
154/* notes: 155/* notes:
@@ -226,6 +227,9 @@ struct bitmap {
226 227
227 unsigned long flags; 228 unsigned long flags;
228 229
230 unsigned long max_write_behind; /* write-behind mode */
231 atomic_t behind_writes;
232
229 /* 233 /*
230 * the bitmap daemon - periodically wakes up and sweeps the bitmap 234 * the bitmap daemon - periodically wakes up and sweeps the bitmap
231 * file, cleaning up bits and flushing out pages to disk as necessary 235 * file, cleaning up bits and flushing out pages to disk as necessary
@@ -260,9 +264,10 @@ int bitmap_setallbits(struct bitmap *bitmap);
260void bitmap_write_all(struct bitmap *bitmap); 264void bitmap_write_all(struct bitmap *bitmap);
261 265
262/* these are exported */ 266/* these are exported */
263int bitmap_startwrite(struct bitmap *bitmap, sector_t offset, unsigned long sectors); 267int bitmap_startwrite(struct bitmap *bitmap, sector_t offset,
264void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, unsigned long sectors, 268 unsigned long sectors, int behind);
265 int success); 269void bitmap_endwrite(struct bitmap *bitmap, sector_t offset,
270 unsigned long sectors, int success, int behind);
266int bitmap_start_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int degraded); 271int bitmap_start_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int degraded);
267void bitmap_end_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int aborted); 272void bitmap_end_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int aborted);
268void bitmap_close_sync(struct bitmap *bitmap); 273void bitmap_close_sync(struct bitmap *bitmap);
diff --git a/include/linux/raid/linear.h b/include/linux/raid/linear.h
index e04c4fe45b53..7eaf290e10e7 100644
--- a/include/linux/raid/linear.h
+++ b/include/linux/raid/linear.h
@@ -14,8 +14,8 @@ typedef struct dev_info dev_info_t;
14struct linear_private_data 14struct linear_private_data
15{ 15{
16 dev_info_t **hash_table; 16 dev_info_t **hash_table;
17 dev_info_t *smallest; 17 sector_t hash_spacing;
18 int nr_zones; 18 int preshift; /* shift before dividing by hash_spacing */
19 dev_info_t disks[0]; 19 dev_info_t disks[0];
20}; 20};
21 21
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
index 8c14ba565a45..ebce949b1443 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -86,70 +86,6 @@ typedef struct mdk_rdev_s mdk_rdev_t;
86#define MAX_CHUNK_SIZE (4096*1024) 86#define MAX_CHUNK_SIZE (4096*1024)
87 87
88/* 88/*
89 * default readahead
90 */
91
92static inline int disk_faulty(mdp_disk_t * d)
93{
94 return d->state & (1 << MD_DISK_FAULTY);
95}
96
97static inline int disk_active(mdp_disk_t * d)
98{
99 return d->state & (1 << MD_DISK_ACTIVE);
100}
101
102static inline int disk_sync(mdp_disk_t * d)
103{
104 return d->state & (1 << MD_DISK_SYNC);
105}
106
107static inline int disk_spare(mdp_disk_t * d)
108{
109 return !disk_sync(d) && !disk_active(d) && !disk_faulty(d);
110}
111
112static inline int disk_removed(mdp_disk_t * d)
113{
114 return d->state & (1 << MD_DISK_REMOVED);
115}
116
117static inline void mark_disk_faulty(mdp_disk_t * d)
118{
119 d->state |= (1 << MD_DISK_FAULTY);
120}
121
122static inline void mark_disk_active(mdp_disk_t * d)
123{
124 d->state |= (1 << MD_DISK_ACTIVE);
125}
126
127static inline void mark_disk_sync(mdp_disk_t * d)
128{
129 d->state |= (1 << MD_DISK_SYNC);
130}
131
132static inline void mark_disk_spare(mdp_disk_t * d)
133{
134 d->state = 0;
135}
136
137static inline void mark_disk_removed(mdp_disk_t * d)
138{
139 d->state = (1 << MD_DISK_FAULTY) | (1 << MD_DISK_REMOVED);
140}
141
142static inline void mark_disk_inactive(mdp_disk_t * d)
143{
144 d->state &= ~(1 << MD_DISK_ACTIVE);
145}
146
147static inline void mark_disk_nonsync(mdp_disk_t * d)
148{
149 d->state &= ~(1 << MD_DISK_SYNC);
150}
151
152/*
153 * MD's 'extended' device 89 * MD's 'extended' device
154 */ 90 */
155struct mdk_rdev_s 91struct mdk_rdev_s
@@ -166,6 +102,7 @@ struct mdk_rdev_s
166 int sb_loaded; 102 int sb_loaded;
167 sector_t data_offset; /* start of data in array */ 103 sector_t data_offset; /* start of data in array */
168 sector_t sb_offset; 104 sector_t sb_offset;
105 int sb_size; /* bytes in the superblock */
169 int preferred_minor; /* autorun support */ 106 int preferred_minor; /* autorun support */
170 107
171 /* A device can be in one of three states based on two flags: 108 /* A device can be in one of three states based on two flags:
@@ -181,6 +118,9 @@ struct mdk_rdev_s
181 int faulty; /* if faulty do not issue IO requests */ 118 int faulty; /* if faulty do not issue IO requests */
182 int in_sync; /* device is a full member of the array */ 119 int in_sync; /* device is a full member of the array */
183 120
121 unsigned long flags; /* Should include faulty and in_sync here. */
122#define WriteMostly 4 /* Avoid reading if at all possible */
123
184 int desc_nr; /* descriptor index in the superblock */ 124 int desc_nr; /* descriptor index in the superblock */
185 int raid_disk; /* role of device in array */ 125 int raid_disk; /* role of device in array */
186 int saved_raid_disk; /* role that device used to have in the 126 int saved_raid_disk; /* role that device used to have in the
@@ -272,12 +212,19 @@ struct mddev_s
272 atomic_t writes_pending; 212 atomic_t writes_pending;
273 request_queue_t *queue; /* for plugging ... */ 213 request_queue_t *queue; /* for plugging ... */
274 214
215 atomic_t write_behind; /* outstanding async IO */
216 unsigned int max_write_behind; /* 0 = sync */
217
275 struct bitmap *bitmap; /* the bitmap for the device */ 218 struct bitmap *bitmap; /* the bitmap for the device */
276 struct file *bitmap_file; /* the bitmap file */ 219 struct file *bitmap_file; /* the bitmap file */
277 long bitmap_offset; /* offset from superblock of 220 long bitmap_offset; /* offset from superblock of
278 * start of bitmap. May be 221 * start of bitmap. May be
279 * negative, but not '0' 222 * negative, but not '0'
280 */ 223 */
224 long default_bitmap_offset; /* this is the offset to use when
225 * hot-adding a bitmap. It should
226 * eventually be settable by sysfs.
227 */
281 228
282 struct list_head all_mddevs; 229 struct list_head all_mddevs;
283}; 230};
@@ -314,6 +261,12 @@ struct mdk_personality_s
314 int (*resize) (mddev_t *mddev, sector_t sectors); 261 int (*resize) (mddev_t *mddev, sector_t sectors);
315 int (*reshape) (mddev_t *mddev, int raid_disks); 262 int (*reshape) (mddev_t *mddev, int raid_disks);
316 int (*reconfig) (mddev_t *mddev, int layout, int chunk_size); 263 int (*reconfig) (mddev_t *mddev, int layout, int chunk_size);
264 /* quiesce moves between quiescence states
265 * 0 - fully active
266 * 1 - no new requests allowed
267 * others - reserved
268 */
269 void (*quiesce) (mddev_t *mddev, int state);
317}; 270};
318 271
319 272
diff --git a/include/linux/raid/md_p.h b/include/linux/raid/md_p.h
index dc65cd435494..c100fa5d4bfa 100644
--- a/include/linux/raid/md_p.h
+++ b/include/linux/raid/md_p.h
@@ -79,6 +79,11 @@
79#define MD_DISK_SYNC 2 /* disk is in sync with the raid set */ 79#define MD_DISK_SYNC 2 /* disk is in sync with the raid set */
80#define MD_DISK_REMOVED 3 /* disk is in sync with the raid set */ 80#define MD_DISK_REMOVED 3 /* disk is in sync with the raid set */
81 81
82#define MD_DISK_WRITEMOSTLY 9 /* disk is "write-mostly" is RAID1 config.
83 * read requests will only be sent here in
84 * dire need
85 */
86
82typedef struct mdp_device_descriptor_s { 87typedef struct mdp_device_descriptor_s {
83 __u32 number; /* 0 Device number in the entire set */ 88 __u32 number; /* 0 Device number in the entire set */
84 __u32 major; /* 1 Device major number */ 89 __u32 major; /* 1 Device major number */
@@ -193,7 +198,7 @@ struct mdp_superblock_1 {
193 198
194 __u64 ctime; /* lo 40 bits are seconds, top 24 are microseconds or 0*/ 199 __u64 ctime; /* lo 40 bits are seconds, top 24 are microseconds or 0*/
195 __u32 level; /* -4 (multipath), -1 (linear), 0,1,4,5 */ 200 __u32 level; /* -4 (multipath), -1 (linear), 0,1,4,5 */
196 __u32 layout; /* only for raid5 currently */ 201 __u32 layout; /* only for raid5 and raid10 currently */
197 __u64 size; /* used size of component devices, in 512byte sectors */ 202 __u64 size; /* used size of component devices, in 512byte sectors */
198 203
199 __u32 chunksize; /* in 512byte sectors */ 204 __u32 chunksize; /* in 512byte sectors */
@@ -212,7 +217,9 @@ struct mdp_superblock_1 {
212 __u32 dev_number; /* permanent identifier of this device - not role in raid */ 217 __u32 dev_number; /* permanent identifier of this device - not role in raid */
213 __u32 cnt_corrected_read; /* number of read errors that were corrected by re-writing */ 218 __u32 cnt_corrected_read; /* number of read errors that were corrected by re-writing */
214 __u8 device_uuid[16]; /* user-space setable, ignored by kernel */ 219 __u8 device_uuid[16]; /* user-space setable, ignored by kernel */
215 __u8 pad2[64-56]; /* set to 0 when writing */ 220 __u8 devflags; /* per-device flags. Only one defined...*/
221#define WriteMostly1 1 /* mask for writemostly flag in above */
222 __u8 pad2[64-57]; /* set to 0 when writing */
216 223
217 /* array state information - 64 bytes */ 224 /* array state information - 64 bytes */
218 __u64 utime; /* 40 bits second, 24 btes microseconds */ 225 __u64 utime; /* 40 bits second, 24 btes microseconds */
@@ -231,5 +238,10 @@ struct mdp_superblock_1 {
231 __u16 dev_roles[0]; /* role in array, or 0xffff for a spare, or 0xfffe for faulty */ 238 __u16 dev_roles[0]; /* role in array, or 0xffff for a spare, or 0xfffe for faulty */
232}; 239};
233 240
241/* feature_map bits */
242#define MD_FEATURE_BITMAP_OFFSET 1
243
244#define MD_FEATURE_ALL 1
245
234#endif 246#endif
235 247
diff --git a/include/linux/raid/raid1.h b/include/linux/raid/raid1.h
index 9d93cf12e890..60e19b667548 100644
--- a/include/linux/raid/raid1.h
+++ b/include/linux/raid/raid1.h
@@ -80,6 +80,9 @@ struct r1bio_s {
80 atomic_t remaining; /* 'have we finished' count, 80 atomic_t remaining; /* 'have we finished' count,
81 * used from IRQ handlers 81 * used from IRQ handlers
82 */ 82 */
83 atomic_t behind_remaining; /* number of write-behind ios remaining
84 * in this BehindIO request
85 */
83 sector_t sector; 86 sector_t sector;
84 int sectors; 87 int sectors;
85 unsigned long state; 88 unsigned long state;
@@ -107,4 +110,14 @@ struct r1bio_s {
107#define R1BIO_Uptodate 0 110#define R1BIO_Uptodate 0
108#define R1BIO_IsSync 1 111#define R1BIO_IsSync 1
109#define R1BIO_Degraded 2 112#define R1BIO_Degraded 2
113#define R1BIO_BehindIO 3
114/* For write-behind requests, we call bi_end_io when
115 * the last non-write-behind device completes, providing
116 * any write was successful. Otherwise we call when
117 * any write-behind write succeeds, otherwise we call
118 * with failure when last write completes (and all failed).
119 * Record that bi_end_io was called with this flag...
120 */
121#define R1BIO_Returned 4
122
110#endif 123#endif
diff --git a/include/linux/raid/raid5.h b/include/linux/raid/raid5.h
index d63ddcb4afad..176fc653c284 100644
--- a/include/linux/raid/raid5.h
+++ b/include/linux/raid/raid5.h
@@ -134,6 +134,7 @@ struct stripe_head {
134 unsigned long state; /* state flags */ 134 unsigned long state; /* state flags */
135 atomic_t count; /* nr of active thread/requests */ 135 atomic_t count; /* nr of active thread/requests */
136 spinlock_t lock; 136 spinlock_t lock;
137 int bm_seq; /* sequence number for bitmap flushes */
137 struct r5dev { 138 struct r5dev {
138 struct bio req; 139 struct bio req;
139 struct bio_vec vec; 140 struct bio_vec vec;
@@ -165,12 +166,13 @@ struct stripe_head {
165/* 166/*
166 * Stripe state 167 * Stripe state
167 */ 168 */
168#define STRIPE_ERROR 1
169#define STRIPE_HANDLE 2 169#define STRIPE_HANDLE 2
170#define STRIPE_SYNCING 3 170#define STRIPE_SYNCING 3
171#define STRIPE_INSYNC 4 171#define STRIPE_INSYNC 4
172#define STRIPE_PREREAD_ACTIVE 5 172#define STRIPE_PREREAD_ACTIVE 5
173#define STRIPE_DELAYED 6 173#define STRIPE_DELAYED 6
174#define STRIPE_DEGRADED 7
175#define STRIPE_BIT_DELAY 8
174 176
175/* 177/*
176 * Plugging: 178 * Plugging:
@@ -210,10 +212,20 @@ struct raid5_private_data {
210 212
211 struct list_head handle_list; /* stripes needing handling */ 213 struct list_head handle_list; /* stripes needing handling */
212 struct list_head delayed_list; /* stripes that have plugged requests */ 214 struct list_head delayed_list; /* stripes that have plugged requests */
215 struct list_head bitmap_list; /* stripes delaying awaiting bitmap update */
213 atomic_t preread_active_stripes; /* stripes with scheduled io */ 216 atomic_t preread_active_stripes; /* stripes with scheduled io */
214 217
215 char cache_name[20]; 218 char cache_name[20];
216 kmem_cache_t *slab_cache; /* for allocating stripes */ 219 kmem_cache_t *slab_cache; /* for allocating stripes */
220
221 int seq_flush, seq_write;
222 int quiesce;
223
224 int fullsync; /* set to 1 if a full sync is needed,
225 * (fresh device added).
226 * Cleared when a sync completes.
227 */
228
217 /* 229 /*
218 * Free stripes pool 230 * Free stripes pool
219 */ 231 */
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index fd276adf0fd5..4e65eb44adfd 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -52,8 +52,8 @@ struct rcu_head {
52 void (*func)(struct rcu_head *head); 52 void (*func)(struct rcu_head *head);
53}; 53};
54 54
55#define RCU_HEAD_INIT(head) { .next = NULL, .func = NULL } 55#define RCU_HEAD_INIT { .next = NULL, .func = NULL }
56#define RCU_HEAD(head) struct rcu_head head = RCU_HEAD_INIT(head) 56#define RCU_HEAD(head) struct rcu_head head = RCU_HEAD_INIT
57#define INIT_RCU_HEAD(ptr) do { \ 57#define INIT_RCU_HEAD(ptr) do { \
58 (ptr)->next = NULL; (ptr)->func = NULL; \ 58 (ptr)->next = NULL; (ptr)->func = NULL; \
59} while (0) 59} while (0)
diff --git a/include/linux/rcuref.h b/include/linux/rcuref.h
new file mode 100644
index 000000000000..e1adbba14b67
--- /dev/null
+++ b/include/linux/rcuref.h
@@ -0,0 +1,220 @@
1/*
2 * rcuref.h
3 *
4 * Reference counting for elements of lists/arrays protected by
5 * RCU.
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 Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 *
21 * Copyright (C) IBM Corporation, 2005
22 *
23 * Author: Dipankar Sarma <dipankar@in.ibm.com>
24 * Ravikiran Thirumalai <kiran_th@gmail.com>
25 *
26 * See Documentation/RCU/rcuref.txt for detailed user guide.
27 *
28 */
29
30#ifndef _RCUREF_H_
31#define _RCUREF_H_
32
33#ifdef __KERNEL__
34
35#include <linux/types.h>
36#include <linux/interrupt.h>
37#include <linux/spinlock.h>
38#include <asm/atomic.h>
39
40/*
41 * These APIs work on traditional atomic_t counters used in the
42 * kernel for reference counting. Under special circumstances
43 * where a lock-free get() operation races with a put() operation
44 * these APIs can be used. See Documentation/RCU/rcuref.txt.
45 */
46
47#ifdef __HAVE_ARCH_CMPXCHG
48
49/**
50 * rcuref_inc - increment refcount for object.
51 * @rcuref: reference counter in the object in question.
52 *
53 * This should be used only for objects where we use RCU and
54 * use the rcuref_inc_lf() api to acquire a reference
55 * in a lock-free reader-side critical section.
56 */
57static inline void rcuref_inc(atomic_t *rcuref)
58{
59 atomic_inc(rcuref);
60}
61
62/**
63 * rcuref_dec - decrement refcount for object.
64 * @rcuref: reference counter in the object in question.
65 *
66 * This should be used only for objects where we use RCU and
67 * use the rcuref_inc_lf() api to acquire a reference
68 * in a lock-free reader-side critical section.
69 */
70static inline void rcuref_dec(atomic_t *rcuref)
71{
72 atomic_dec(rcuref);
73}
74
75/**
76 * rcuref_dec_and_test - decrement refcount for object and test
77 * @rcuref: reference counter in the object.
78 * @release: pointer to the function that will clean up the object
79 * when the last reference to the object is released.
80 * This pointer is required.
81 *
82 * Decrement the refcount, and if 0, return 1. Else return 0.
83 *
84 * This should be used only for objects where we use RCU and
85 * use the rcuref_inc_lf() api to acquire a reference
86 * in a lock-free reader-side critical section.
87 */
88static inline int rcuref_dec_and_test(atomic_t *rcuref)
89{
90 return atomic_dec_and_test(rcuref);
91}
92
93/*
94 * cmpxchg is needed on UP too, if deletions to the list/array can happen
95 * in interrupt context.
96 */
97
98/**
99 * rcuref_inc_lf - Take reference to an object in a read-side
100 * critical section protected by RCU.
101 * @rcuref: reference counter in the object in question.
102 *
103 * Try and increment the refcount by 1. The increment might fail if
104 * the reference counter has been through a 1 to 0 transition and
105 * is no longer part of the lock-free list.
106 * Returns non-zero on successful increment and zero otherwise.
107 */
108static inline int rcuref_inc_lf(atomic_t *rcuref)
109{
110 int c, old;
111 c = atomic_read(rcuref);
112 while (c && (old = cmpxchg(&rcuref->counter, c, c + 1)) != c)
113 c = old;
114 return c;
115}
116
117#else /* !__HAVE_ARCH_CMPXCHG */
118
119extern spinlock_t __rcuref_hash[];
120
121/*
122 * Use a hash table of locks to protect the reference count
123 * since cmpxchg is not available in this arch.
124 */
125#ifdef CONFIG_SMP
126#define RCUREF_HASH_SIZE 4
127#define RCUREF_HASH(k) \
128 (&__rcuref_hash[(((unsigned long)k)>>8) & (RCUREF_HASH_SIZE-1)])
129#else
130#define RCUREF_HASH_SIZE 1
131#define RCUREF_HASH(k) &__rcuref_hash[0]
132#endif /* CONFIG_SMP */
133
134/**
135 * rcuref_inc - increment refcount for object.
136 * @rcuref: reference counter in the object in question.
137 *
138 * This should be used only for objects where we use RCU and
139 * use the rcuref_inc_lf() api to acquire a reference in a lock-free
140 * reader-side critical section.
141 */
142static inline void rcuref_inc(atomic_t *rcuref)
143{
144 unsigned long flags;
145 spin_lock_irqsave(RCUREF_HASH(rcuref), flags);
146 rcuref->counter += 1;
147 spin_unlock_irqrestore(RCUREF_HASH(rcuref), flags);
148}
149
150/**
151 * rcuref_dec - decrement refcount for object.
152 * @rcuref: reference counter in the object in question.
153 *
154 * This should be used only for objects where we use RCU and
155 * use the rcuref_inc_lf() api to acquire a reference in a lock-free
156 * reader-side critical section.
157 */
158static inline void rcuref_dec(atomic_t *rcuref)
159{
160 unsigned long flags;
161 spin_lock_irqsave(RCUREF_HASH(rcuref), flags);
162 rcuref->counter -= 1;
163 spin_unlock_irqrestore(RCUREF_HASH(rcuref), flags);
164}
165
166/**
167 * rcuref_dec_and_test - decrement refcount for object and test
168 * @rcuref: reference counter in the object.
169 * @release: pointer to the function that will clean up the object
170 * when the last reference to the object is released.
171 * This pointer is required.
172 *
173 * Decrement the refcount, and if 0, return 1. Else return 0.
174 *
175 * This should be used only for objects where we use RCU and
176 * use the rcuref_inc_lf() api to acquire a reference in a lock-free
177 * reader-side critical section.
178 */
179static inline int rcuref_dec_and_test(atomic_t *rcuref)
180{
181 unsigned long flags;
182 spin_lock_irqsave(RCUREF_HASH(rcuref), flags);
183 rcuref->counter--;
184 if (!rcuref->counter) {
185 spin_unlock_irqrestore(RCUREF_HASH(rcuref), flags);
186 return 1;
187 } else {
188 spin_unlock_irqrestore(RCUREF_HASH(rcuref), flags);
189 return 0;
190 }
191}
192
193/**
194 * rcuref_inc_lf - Take reference to an object of a lock-free collection
195 * by traversing a lock-free list/array.
196 * @rcuref: reference counter in the object in question.
197 *
198 * Try and increment the refcount by 1. The increment might fail if
199 * the reference counter has been through a 1 to 0 transition and
200 * object is no longer part of the lock-free list.
201 * Returns non-zero on successful increment and zero otherwise.
202 */
203static inline int rcuref_inc_lf(atomic_t *rcuref)
204{
205 int ret;
206 unsigned long flags;
207 spin_lock_irqsave(RCUREF_HASH(rcuref), flags);
208 if (rcuref->counter)
209 ret = rcuref->counter++;
210 else
211 ret = 0;
212 spin_unlock_irqrestore(RCUREF_HASH(rcuref), flags);
213 return ret;
214}
215
216
217#endif /* !__HAVE_ARCH_CMPXCHG */
218
219#endif /* __KERNEL__ */
220#endif /* _RCUREF_H_ */
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index 17e458e17e2b..af00b10294cd 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -2097,7 +2097,7 @@ void reiserfs_free_block(struct reiserfs_transaction_handle *th, struct inode *,
2097 b_blocknr_t, int for_unformatted); 2097 b_blocknr_t, int for_unformatted);
2098int reiserfs_allocate_blocknrs(reiserfs_blocknr_hint_t *, b_blocknr_t *, int, 2098int reiserfs_allocate_blocknrs(reiserfs_blocknr_hint_t *, b_blocknr_t *, int,
2099 int); 2099 int);
2100extern inline int reiserfs_new_form_blocknrs(struct tree_balance *tb, 2100static inline int reiserfs_new_form_blocknrs(struct tree_balance *tb,
2101 b_blocknr_t * new_blocknrs, 2101 b_blocknr_t * new_blocknrs,
2102 int amount_needed) 2102 int amount_needed)
2103{ 2103{
@@ -2113,7 +2113,7 @@ extern inline int reiserfs_new_form_blocknrs(struct tree_balance *tb,
2113 0); 2113 0);
2114} 2114}
2115 2115
2116extern inline int reiserfs_new_unf_blocknrs(struct reiserfs_transaction_handle 2116static inline int reiserfs_new_unf_blocknrs(struct reiserfs_transaction_handle
2117 *th, struct inode *inode, 2117 *th, struct inode *inode,
2118 b_blocknr_t * new_blocknrs, 2118 b_blocknr_t * new_blocknrs,
2119 struct path *path, long block) 2119 struct path *path, long block)
@@ -2130,7 +2130,7 @@ extern inline int reiserfs_new_unf_blocknrs(struct reiserfs_transaction_handle
2130} 2130}
2131 2131
2132#ifdef REISERFS_PREALLOCATE 2132#ifdef REISERFS_PREALLOCATE
2133extern inline int reiserfs_new_unf_blocknrs2(struct reiserfs_transaction_handle 2133static inline int reiserfs_new_unf_blocknrs2(struct reiserfs_transaction_handle
2134 *th, struct inode *inode, 2134 *th, struct inode *inode,
2135 b_blocknr_t * new_blocknrs, 2135 b_blocknr_t * new_blocknrs,
2136 struct path *path, long block) 2136 struct path *path, long block)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index ea1b5f32ec5c..38c8654aaa96 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -114,6 +114,7 @@ extern unsigned long nr_iowait(void);
114#define TASK_TRACED 8 114#define TASK_TRACED 8
115#define EXIT_ZOMBIE 16 115#define EXIT_ZOMBIE 16
116#define EXIT_DEAD 32 116#define EXIT_DEAD 32
117#define TASK_NONINTERACTIVE 64
117 118
118#define __set_task_state(tsk, state_value) \ 119#define __set_task_state(tsk, state_value) \
119 do { (tsk)->state = (state_value); } while (0) 120 do { (tsk)->state = (state_value); } while (0)
@@ -202,6 +203,8 @@ extern int in_sched_functions(unsigned long addr);
202 203
203#define MAX_SCHEDULE_TIMEOUT LONG_MAX 204#define MAX_SCHEDULE_TIMEOUT LONG_MAX
204extern signed long FASTCALL(schedule_timeout(signed long timeout)); 205extern signed long FASTCALL(schedule_timeout(signed long timeout));
206extern signed long schedule_timeout_interruptible(signed long timeout);
207extern signed long schedule_timeout_uninterruptible(signed long timeout);
205asmlinkage void schedule(void); 208asmlinkage void schedule(void);
206 209
207struct namespace; 210struct namespace;
@@ -604,6 +607,11 @@ extern int groups_search(struct group_info *group_info, gid_t grp);
604#define GROUP_AT(gi, i) \ 607#define GROUP_AT(gi, i) \
605 ((gi)->blocks[(i)/NGROUPS_PER_BLOCK][(i)%NGROUPS_PER_BLOCK]) 608 ((gi)->blocks[(i)/NGROUPS_PER_BLOCK][(i)%NGROUPS_PER_BLOCK])
606 609
610#ifdef ARCH_HAS_PREFETCH_SWITCH_STACK
611extern void prefetch_stack(struct task_struct*);
612#else
613static inline void prefetch_stack(struct task_struct *t) { }
614#endif
607 615
608struct audit_context; /* See audit.c */ 616struct audit_context; /* See audit.c */
609struct mempolicy; 617struct mempolicy;
@@ -895,6 +903,8 @@ extern int task_curr(const task_t *p);
895extern int idle_cpu(int cpu); 903extern int idle_cpu(int cpu);
896extern int sched_setscheduler(struct task_struct *, int, struct sched_param *); 904extern int sched_setscheduler(struct task_struct *, int, struct sched_param *);
897extern task_t *idle_task(int cpu); 905extern task_t *idle_task(int cpu);
906extern task_t *curr_task(int cpu);
907extern void set_curr_task(int cpu, task_t *p);
898 908
899void yield(void); 909void yield(void);
900 910
diff --git a/include/linux/security.h b/include/linux/security.h
index 7aab6ab7c57f..55b02e1c73f4 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -250,29 +250,37 @@ struct swap_info_struct;
250 * @inode contains the inode structure. 250 * @inode contains the inode structure.
251 * Deallocate the inode security structure and set @inode->i_security to 251 * Deallocate the inode security structure and set @inode->i_security to
252 * NULL. 252 * NULL.
253 * @inode_init_security:
254 * Obtain the security attribute name suffix and value to set on a newly
255 * created inode and set up the incore security field for the new inode.
256 * This hook is called by the fs code as part of the inode creation
257 * transaction and provides for atomic labeling of the inode, unlike
258 * the post_create/mkdir/... hooks called by the VFS. The hook function
259 * is expected to allocate the name and value via kmalloc, with the caller
260 * being responsible for calling kfree after using them.
261 * If the security module does not use security attributes or does
262 * not wish to put a security attribute on this particular inode,
263 * then it should return -EOPNOTSUPP to skip this processing.
264 * @inode contains the inode structure of the newly created inode.
265 * @dir contains the inode structure of the parent directory.
266 * @name will be set to the allocated name suffix (e.g. selinux).
267 * @value will be set to the allocated attribute value.
268 * @len will be set to the length of the value.
269 * Returns 0 if @name and @value have been successfully set,
270 * -EOPNOTSUPP if no security attribute is needed, or
271 * -ENOMEM on memory allocation failure.
253 * @inode_create: 272 * @inode_create:
254 * Check permission to create a regular file. 273 * Check permission to create a regular file.
255 * @dir contains inode structure of the parent of the new file. 274 * @dir contains inode structure of the parent of the new file.
256 * @dentry contains the dentry structure for the file to be created. 275 * @dentry contains the dentry structure for the file to be created.
257 * @mode contains the file mode of the file to be created. 276 * @mode contains the file mode of the file to be created.
258 * Return 0 if permission is granted. 277 * Return 0 if permission is granted.
259 * @inode_post_create:
260 * Set the security attributes on a newly created regular file. This hook
261 * is called after a file has been successfully created.
262 * @dir contains the inode structure of the parent directory of the new file.
263 * @dentry contains the the dentry structure for the newly created file.
264 * @mode contains the file mode.
265 * @inode_link: 278 * @inode_link:
266 * Check permission before creating a new hard link to a file. 279 * Check permission before creating a new hard link to a file.
267 * @old_dentry contains the dentry structure for an existing link to the file. 280 * @old_dentry contains the dentry structure for an existing link to the file.
268 * @dir contains the inode structure of the parent directory of the new link. 281 * @dir contains the inode structure of the parent directory of the new link.
269 * @new_dentry contains the dentry structure for the new link. 282 * @new_dentry contains the dentry structure for the new link.
270 * Return 0 if permission is granted. 283 * Return 0 if permission is granted.
271 * @inode_post_link:
272 * Set security attributes for a new hard link to a file.
273 * @old_dentry contains the dentry structure for the existing link.
274 * @dir contains the inode structure of the parent directory of the new file.
275 * @new_dentry contains the dentry structure for the new file link.
276 * @inode_unlink: 284 * @inode_unlink:
277 * Check the permission to remove a hard link to a file. 285 * Check the permission to remove a hard link to a file.
278 * @dir contains the inode structure of parent directory of the file. 286 * @dir contains the inode structure of parent directory of the file.
@@ -284,13 +292,6 @@ struct swap_info_struct;
284 * @dentry contains the dentry structure of the symbolic link. 292 * @dentry contains the dentry structure of the symbolic link.
285 * @old_name contains the pathname of file. 293 * @old_name contains the pathname of file.
286 * Return 0 if permission is granted. 294 * Return 0 if permission is granted.
287 * @inode_post_symlink:
288 * @dir contains the inode structure of the parent directory of the new link.
289 * @dentry contains the dentry structure of new symbolic link.
290 * @old_name contains the pathname of file.
291 * Set security attributes for a newly created symbolic link. Note that
292 * @dentry->d_inode may be NULL, since the filesystem might not
293 * instantiate the dentry (e.g. NFS).
294 * @inode_mkdir: 295 * @inode_mkdir:
295 * Check permissions to create a new directory in the existing directory 296 * Check permissions to create a new directory in the existing directory
296 * associated with inode strcture @dir. 297 * associated with inode strcture @dir.
@@ -298,11 +299,6 @@ struct swap_info_struct;
298 * @dentry contains the dentry structure of new directory. 299 * @dentry contains the dentry structure of new directory.
299 * @mode contains the mode of new directory. 300 * @mode contains the mode of new directory.
300 * Return 0 if permission is granted. 301 * Return 0 if permission is granted.
301 * @inode_post_mkdir:
302 * Set security attributes on a newly created directory.
303 * @dir contains the inode structure of parent of the directory to be created.
304 * @dentry contains the dentry structure of new directory.
305 * @mode contains the mode of new directory.
306 * @inode_rmdir: 302 * @inode_rmdir:
307 * Check the permission to remove a directory. 303 * Check the permission to remove a directory.
308 * @dir contains the inode structure of parent of the directory to be removed. 304 * @dir contains the inode structure of parent of the directory to be removed.
@@ -318,13 +314,6 @@ struct swap_info_struct;
318 * @mode contains the mode of the new file. 314 * @mode contains the mode of the new file.
319 * @dev contains the the device number. 315 * @dev contains the the device number.
320 * Return 0 if permission is granted. 316 * Return 0 if permission is granted.
321 * @inode_post_mknod:
322 * Set security attributes on a newly created special file (or socket or
323 * fifo file created via the mknod system call).
324 * @dir contains the inode structure of parent of the new node.
325 * @dentry contains the dentry structure of the new node.
326 * @mode contains the mode of the new node.
327 * @dev contains the the device number.
328 * @inode_rename: 317 * @inode_rename:
329 * Check for permission to rename a file or directory. 318 * Check for permission to rename a file or directory.
330 * @old_dir contains the inode structure for parent of the old link. 319 * @old_dir contains the inode structure for parent of the old link.
@@ -332,12 +321,6 @@ struct swap_info_struct;
332 * @new_dir contains the inode structure for parent of the new link. 321 * @new_dir contains the inode structure for parent of the new link.
333 * @new_dentry contains the dentry structure of the new link. 322 * @new_dentry contains the dentry structure of the new link.
334 * Return 0 if permission is granted. 323 * Return 0 if permission is granted.
335 * @inode_post_rename:
336 * Set security attributes on a renamed file or directory.
337 * @old_dir contains the inode structure for parent of the old link.
338 * @old_dentry contains the dentry structure of the old link.
339 * @new_dir contains the inode structure for parent of the new link.
340 * @new_dentry contains the dentry structure of the new link.
341 * @inode_readlink: 324 * @inode_readlink:
342 * Check the permission to read the symbolic link. 325 * Check the permission to read the symbolic link.
343 * @dentry contains the dentry structure for the file link. 326 * @dentry contains the dentry structure for the file link.
@@ -1080,34 +1063,21 @@ struct security_operations {
1080 1063
1081 int (*inode_alloc_security) (struct inode *inode); 1064 int (*inode_alloc_security) (struct inode *inode);
1082 void (*inode_free_security) (struct inode *inode); 1065 void (*inode_free_security) (struct inode *inode);
1066 int (*inode_init_security) (struct inode *inode, struct inode *dir,
1067 char **name, void **value, size_t *len);
1083 int (*inode_create) (struct inode *dir, 1068 int (*inode_create) (struct inode *dir,
1084 struct dentry *dentry, int mode); 1069 struct dentry *dentry, int mode);
1085 void (*inode_post_create) (struct inode *dir,
1086 struct dentry *dentry, int mode);
1087 int (*inode_link) (struct dentry *old_dentry, 1070 int (*inode_link) (struct dentry *old_dentry,
1088 struct inode *dir, struct dentry *new_dentry); 1071 struct inode *dir, struct dentry *new_dentry);
1089 void (*inode_post_link) (struct dentry *old_dentry,
1090 struct inode *dir, struct dentry *new_dentry);
1091 int (*inode_unlink) (struct inode *dir, struct dentry *dentry); 1072 int (*inode_unlink) (struct inode *dir, struct dentry *dentry);
1092 int (*inode_symlink) (struct inode *dir, 1073 int (*inode_symlink) (struct inode *dir,
1093 struct dentry *dentry, const char *old_name); 1074 struct dentry *dentry, const char *old_name);
1094 void (*inode_post_symlink) (struct inode *dir,
1095 struct dentry *dentry,
1096 const char *old_name);
1097 int (*inode_mkdir) (struct inode *dir, struct dentry *dentry, int mode); 1075 int (*inode_mkdir) (struct inode *dir, struct dentry *dentry, int mode);
1098 void (*inode_post_mkdir) (struct inode *dir, struct dentry *dentry,
1099 int mode);
1100 int (*inode_rmdir) (struct inode *dir, struct dentry *dentry); 1076 int (*inode_rmdir) (struct inode *dir, struct dentry *dentry);
1101 int (*inode_mknod) (struct inode *dir, struct dentry *dentry, 1077 int (*inode_mknod) (struct inode *dir, struct dentry *dentry,
1102 int mode, dev_t dev); 1078 int mode, dev_t dev);
1103 void (*inode_post_mknod) (struct inode *dir, struct dentry *dentry,
1104 int mode, dev_t dev);
1105 int (*inode_rename) (struct inode *old_dir, struct dentry *old_dentry, 1079 int (*inode_rename) (struct inode *old_dir, struct dentry *old_dentry,
1106 struct inode *new_dir, struct dentry *new_dentry); 1080 struct inode *new_dir, struct dentry *new_dentry);
1107 void (*inode_post_rename) (struct inode *old_dir,
1108 struct dentry *old_dentry,
1109 struct inode *new_dir,
1110 struct dentry *new_dentry);
1111 int (*inode_readlink) (struct dentry *dentry); 1081 int (*inode_readlink) (struct dentry *dentry);
1112 int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd); 1082 int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd);
1113 int (*inode_permission) (struct inode *inode, int mask, struct nameidata *nd); 1083 int (*inode_permission) (struct inode *inode, int mask, struct nameidata *nd);
@@ -1442,6 +1412,17 @@ static inline void security_inode_free (struct inode *inode)
1442 return; 1412 return;
1443 security_ops->inode_free_security (inode); 1413 security_ops->inode_free_security (inode);
1444} 1414}
1415
1416static inline int security_inode_init_security (struct inode *inode,
1417 struct inode *dir,
1418 char **name,
1419 void **value,
1420 size_t *len)
1421{
1422 if (unlikely (IS_PRIVATE (inode)))
1423 return -EOPNOTSUPP;
1424 return security_ops->inode_init_security (inode, dir, name, value, len);
1425}
1445 1426
1446static inline int security_inode_create (struct inode *dir, 1427static inline int security_inode_create (struct inode *dir,
1447 struct dentry *dentry, 1428 struct dentry *dentry,
@@ -1452,15 +1433,6 @@ static inline int security_inode_create (struct inode *dir,
1452 return security_ops->inode_create (dir, dentry, mode); 1433 return security_ops->inode_create (dir, dentry, mode);
1453} 1434}
1454 1435
1455static inline void security_inode_post_create (struct inode *dir,
1456 struct dentry *dentry,
1457 int mode)
1458{
1459 if (dentry->d_inode && unlikely (IS_PRIVATE (dentry->d_inode)))
1460 return;
1461 security_ops->inode_post_create (dir, dentry, mode);
1462}
1463
1464static inline int security_inode_link (struct dentry *old_dentry, 1436static inline int security_inode_link (struct dentry *old_dentry,
1465 struct inode *dir, 1437 struct inode *dir,
1466 struct dentry *new_dentry) 1438 struct dentry *new_dentry)
@@ -1470,15 +1442,6 @@ static inline int security_inode_link (struct dentry *old_dentry,
1470 return security_ops->inode_link (old_dentry, dir, new_dentry); 1442 return security_ops->inode_link (old_dentry, dir, new_dentry);
1471} 1443}
1472 1444
1473static inline void security_inode_post_link (struct dentry *old_dentry,
1474 struct inode *dir,
1475 struct dentry *new_dentry)
1476{
1477 if (new_dentry->d_inode && unlikely (IS_PRIVATE (new_dentry->d_inode)))
1478 return;
1479 security_ops->inode_post_link (old_dentry, dir, new_dentry);
1480}
1481
1482static inline int security_inode_unlink (struct inode *dir, 1445static inline int security_inode_unlink (struct inode *dir,
1483 struct dentry *dentry) 1446 struct dentry *dentry)
1484{ 1447{
@@ -1496,15 +1459,6 @@ static inline int security_inode_symlink (struct inode *dir,
1496 return security_ops->inode_symlink (dir, dentry, old_name); 1459 return security_ops->inode_symlink (dir, dentry, old_name);
1497} 1460}
1498 1461
1499static inline void security_inode_post_symlink (struct inode *dir,
1500 struct dentry *dentry,
1501 const char *old_name)
1502{
1503 if (dentry->d_inode && unlikely (IS_PRIVATE (dentry->d_inode)))
1504 return;
1505 security_ops->inode_post_symlink (dir, dentry, old_name);
1506}
1507
1508static inline int security_inode_mkdir (struct inode *dir, 1462static inline int security_inode_mkdir (struct inode *dir,
1509 struct dentry *dentry, 1463 struct dentry *dentry,
1510 int mode) 1464 int mode)
@@ -1514,15 +1468,6 @@ static inline int security_inode_mkdir (struct inode *dir,
1514 return security_ops->inode_mkdir (dir, dentry, mode); 1468 return security_ops->inode_mkdir (dir, dentry, mode);
1515} 1469}
1516 1470
1517static inline void security_inode_post_mkdir (struct inode *dir,
1518 struct dentry *dentry,
1519 int mode)
1520{
1521 if (dentry->d_inode && unlikely (IS_PRIVATE (dentry->d_inode)))
1522 return;
1523 security_ops->inode_post_mkdir (dir, dentry, mode);
1524}
1525
1526static inline int security_inode_rmdir (struct inode *dir, 1471static inline int security_inode_rmdir (struct inode *dir,
1527 struct dentry *dentry) 1472 struct dentry *dentry)
1528{ 1473{
@@ -1540,15 +1485,6 @@ static inline int security_inode_mknod (struct inode *dir,
1540 return security_ops->inode_mknod (dir, dentry, mode, dev); 1485 return security_ops->inode_mknod (dir, dentry, mode, dev);
1541} 1486}
1542 1487
1543static inline void security_inode_post_mknod (struct inode *dir,
1544 struct dentry *dentry,
1545 int mode, dev_t dev)
1546{
1547 if (dentry->d_inode && unlikely (IS_PRIVATE (dentry->d_inode)))
1548 return;
1549 security_ops->inode_post_mknod (dir, dentry, mode, dev);
1550}
1551
1552static inline int security_inode_rename (struct inode *old_dir, 1488static inline int security_inode_rename (struct inode *old_dir,
1553 struct dentry *old_dentry, 1489 struct dentry *old_dentry,
1554 struct inode *new_dir, 1490 struct inode *new_dir,
@@ -1561,18 +1497,6 @@ static inline int security_inode_rename (struct inode *old_dir,
1561 new_dir, new_dentry); 1497 new_dir, new_dentry);
1562} 1498}
1563 1499
1564static inline void security_inode_post_rename (struct inode *old_dir,
1565 struct dentry *old_dentry,
1566 struct inode *new_dir,
1567 struct dentry *new_dentry)
1568{
1569 if (unlikely (IS_PRIVATE (old_dentry->d_inode) ||
1570 (new_dentry->d_inode && IS_PRIVATE (new_dentry->d_inode))))
1571 return;
1572 security_ops->inode_post_rename (old_dir, old_dentry,
1573 new_dir, new_dentry);
1574}
1575
1576static inline int security_inode_readlink (struct dentry *dentry) 1500static inline int security_inode_readlink (struct dentry *dentry)
1577{ 1501{
1578 if (unlikely (IS_PRIVATE (dentry->d_inode))) 1502 if (unlikely (IS_PRIVATE (dentry->d_inode)))
@@ -2171,6 +2095,15 @@ static inline int security_inode_alloc (struct inode *inode)
2171 2095
2172static inline void security_inode_free (struct inode *inode) 2096static inline void security_inode_free (struct inode *inode)
2173{ } 2097{ }
2098
2099static inline int security_inode_init_security (struct inode *inode,
2100 struct inode *dir,
2101 char **name,
2102 void **value,
2103 size_t *len)
2104{
2105 return -EOPNOTSUPP;
2106}
2174 2107
2175static inline int security_inode_create (struct inode *dir, 2108static inline int security_inode_create (struct inode *dir,
2176 struct dentry *dentry, 2109 struct dentry *dentry,
@@ -2179,11 +2112,6 @@ static inline int security_inode_create (struct inode *dir,
2179 return 0; 2112 return 0;
2180} 2113}
2181 2114
2182static inline void security_inode_post_create (struct inode *dir,
2183 struct dentry *dentry,
2184 int mode)
2185{ }
2186
2187static inline int security_inode_link (struct dentry *old_dentry, 2115static inline int security_inode_link (struct dentry *old_dentry,
2188 struct inode *dir, 2116 struct inode *dir,
2189 struct dentry *new_dentry) 2117 struct dentry *new_dentry)
@@ -2191,11 +2119,6 @@ static inline int security_inode_link (struct dentry *old_dentry,
2191 return 0; 2119 return 0;
2192} 2120}
2193 2121
2194static inline void security_inode_post_link (struct dentry *old_dentry,
2195 struct inode *dir,
2196 struct dentry *new_dentry)
2197{ }
2198
2199static inline int security_inode_unlink (struct inode *dir, 2122static inline int security_inode_unlink (struct inode *dir,
2200 struct dentry *dentry) 2123 struct dentry *dentry)
2201{ 2124{
@@ -2209,11 +2132,6 @@ static inline int security_inode_symlink (struct inode *dir,
2209 return 0; 2132 return 0;
2210} 2133}
2211 2134
2212static inline void security_inode_post_symlink (struct inode *dir,
2213 struct dentry *dentry,
2214 const char *old_name)
2215{ }
2216
2217static inline int security_inode_mkdir (struct inode *dir, 2135static inline int security_inode_mkdir (struct inode *dir,
2218 struct dentry *dentry, 2136 struct dentry *dentry,
2219 int mode) 2137 int mode)
@@ -2221,11 +2139,6 @@ static inline int security_inode_mkdir (struct inode *dir,
2221 return 0; 2139 return 0;
2222} 2140}
2223 2141
2224static inline void security_inode_post_mkdir (struct inode *dir,
2225 struct dentry *dentry,
2226 int mode)
2227{ }
2228
2229static inline int security_inode_rmdir (struct inode *dir, 2142static inline int security_inode_rmdir (struct inode *dir,
2230 struct dentry *dentry) 2143 struct dentry *dentry)
2231{ 2144{
@@ -2239,11 +2152,6 @@ static inline int security_inode_mknod (struct inode *dir,
2239 return 0; 2152 return 0;
2240} 2153}
2241 2154
2242static inline void security_inode_post_mknod (struct inode *dir,
2243 struct dentry *dentry,
2244 int mode, dev_t dev)
2245{ }
2246
2247static inline int security_inode_rename (struct inode *old_dir, 2155static inline int security_inode_rename (struct inode *old_dir,
2248 struct dentry *old_dentry, 2156 struct dentry *old_dentry,
2249 struct inode *new_dir, 2157 struct inode *new_dir,
@@ -2252,12 +2160,6 @@ static inline int security_inode_rename (struct inode *old_dir,
2252 return 0; 2160 return 0;
2253} 2161}
2254 2162
2255static inline void security_inode_post_rename (struct inode *old_dir,
2256 struct dentry *old_dentry,
2257 struct inode *new_dir,
2258 struct dentry *new_dentry)
2259{ }
2260
2261static inline int security_inode_readlink (struct dentry *dentry) 2163static inline int security_inode_readlink (struct dentry *dentry)
2262{ 2164{
2263 return 0; 2165 return 0;
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index d8a023d804d4..317a979b24de 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -30,6 +30,21 @@ struct plat_serial8250_port {
30}; 30};
31 31
32/* 32/*
33 * Allocate 8250 platform device IDs. Nothing is implied by
34 * the numbering here, except for the legacy entry being -1.
35 */
36enum {
37 PLAT8250_DEV_LEGACY = -1,
38 PLAT8250_DEV_PLATFORM,
39 PLAT8250_DEV_PLATFORM1,
40 PLAT8250_DEV_FOURPORT,
41 PLAT8250_DEV_ACCENT,
42 PLAT8250_DEV_BOCA,
43 PLAT8250_DEV_HUB6,
44 PLAT8250_DEV_MCA,
45};
46
47/*
33 * This should be used by drivers which want to register 48 * This should be used by drivers which want to register
34 * their own 8250 ports without registering their own 49 * their own 8250 ports without registering their own
35 * platform device. Using these will make your driver 50 * platform device. Using these will make your driver
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 9b12fe731612..27db8da43aa4 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -401,6 +401,9 @@ uart_handle_sysrq_char(struct uart_port *port, unsigned int ch,
401#endif 401#endif
402 return 0; 402 return 0;
403} 403}
404#ifndef SUPPORT_SYSRQ
405#define uart_handle_sysrq_char(port,ch,regs) uart_handle_sysrq_char(port, 0, NULL)
406#endif
404 407
405/* 408/*
406 * We do the SysRQ and SAK checking like this... 409 * We do the SysRQ and SAK checking like this...
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index da7da9c0ed1b..2741c0c55e83 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -1167,7 +1167,7 @@ static inline void skb_postpull_rcsum(struct sk_buff *skb,
1167 1167
1168static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len) 1168static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len)
1169{ 1169{
1170 if (len >= skb->len) 1170 if (likely(len >= skb->len))
1171 return 0; 1171 return 0;
1172 if (skb->ip_summed == CHECKSUM_HW) 1172 if (skb->ip_summed == CHECKSUM_HW)
1173 skb->ip_summed = CHECKSUM_NONE; 1173 skb->ip_summed = CHECKSUM_NONE;
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 42a6bea58af3..1f356f3bbc64 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -118,7 +118,8 @@ extern void kfree(const void *);
118extern unsigned int ksize(const void *); 118extern unsigned int ksize(const void *);
119 119
120#ifdef CONFIG_NUMA 120#ifdef CONFIG_NUMA
121extern void *kmem_cache_alloc_node(kmem_cache_t *, int flags, int node); 121extern void *kmem_cache_alloc_node(kmem_cache_t *,
122 unsigned int __nocast flags, int node);
122extern void *kmalloc_node(size_t size, unsigned int __nocast flags, int node); 123extern void *kmalloc_node(size_t size, unsigned int __nocast flags, int node);
123#else 124#else
124static inline void *kmem_cache_alloc_node(kmem_cache_t *cachep, int flags, int node) 125static inline void *kmem_cache_alloc_node(kmem_cache_t *cachep, int flags, int node)
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index d6ba068719b6..cdc99a27840d 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -2,7 +2,48 @@
2#define __LINUX_SPINLOCK_H 2#define __LINUX_SPINLOCK_H
3 3
4/* 4/*
5 * include/linux/spinlock.h - generic locking declarations 5 * include/linux/spinlock.h - generic spinlock/rwlock declarations
6 *
7 * here's the role of the various spinlock/rwlock related include files:
8 *
9 * on SMP builds:
10 *
11 * asm/spinlock_types.h: contains the raw_spinlock_t/raw_rwlock_t and the
12 * initializers
13 *
14 * linux/spinlock_types.h:
15 * defines the generic type and initializers
16 *
17 * asm/spinlock.h: contains the __raw_spin_*()/etc. lowlevel
18 * implementations, mostly inline assembly code
19 *
20 * (also included on UP-debug builds:)
21 *
22 * linux/spinlock_api_smp.h:
23 * contains the prototypes for the _spin_*() APIs.
24 *
25 * linux/spinlock.h: builds the final spin_*() APIs.
26 *
27 * on UP builds:
28 *
29 * linux/spinlock_type_up.h:
30 * contains the generic, simplified UP spinlock type.
31 * (which is an empty structure on non-debug builds)
32 *
33 * linux/spinlock_types.h:
34 * defines the generic type and initializers
35 *
36 * linux/spinlock_up.h:
37 * contains the __raw_spin_*()/etc. version of UP
38 * builds. (which are NOPs on non-debug, non-preempt
39 * builds)
40 *
41 * (included on UP-non-debug builds:)
42 *
43 * linux/spinlock_api_up.h:
44 * builds the _spin_*() APIs.
45 *
46 * linux/spinlock.h: builds the final spin_*() APIs.
6 */ 47 */
7 48
8#include <linux/config.h> 49#include <linux/config.h>
@@ -13,7 +54,6 @@
13#include <linux/kernel.h> 54#include <linux/kernel.h>
14#include <linux/stringify.h> 55#include <linux/stringify.h>
15 56
16#include <asm/processor.h> /* for cpu relax */
17#include <asm/system.h> 57#include <asm/system.h>
18 58
19/* 59/*
@@ -35,423 +75,84 @@
35#define __lockfunc fastcall __attribute__((section(".spinlock.text"))) 75#define __lockfunc fastcall __attribute__((section(".spinlock.text")))
36 76
37/* 77/*
38 * If CONFIG_SMP is set, pull in the _raw_* definitions 78 * Pull the raw_spinlock_t and raw_rwlock_t definitions:
39 */ 79 */
40#ifdef CONFIG_SMP 80#include <linux/spinlock_types.h>
41
42#define assert_spin_locked(x) BUG_ON(!spin_is_locked(x))
43#include <asm/spinlock.h>
44
45int __lockfunc _spin_trylock(spinlock_t *lock);
46int __lockfunc _read_trylock(rwlock_t *lock);
47int __lockfunc _write_trylock(rwlock_t *lock);
48
49void __lockfunc _spin_lock(spinlock_t *lock) __acquires(spinlock_t);
50void __lockfunc _read_lock(rwlock_t *lock) __acquires(rwlock_t);
51void __lockfunc _write_lock(rwlock_t *lock) __acquires(rwlock_t);
52
53void __lockfunc _spin_unlock(spinlock_t *lock) __releases(spinlock_t);
54void __lockfunc _read_unlock(rwlock_t *lock) __releases(rwlock_t);
55void __lockfunc _write_unlock(rwlock_t *lock) __releases(rwlock_t);
56
57unsigned long __lockfunc _spin_lock_irqsave(spinlock_t *lock) __acquires(spinlock_t);
58unsigned long __lockfunc _read_lock_irqsave(rwlock_t *lock) __acquires(rwlock_t);
59unsigned long __lockfunc _write_lock_irqsave(rwlock_t *lock) __acquires(rwlock_t);
60
61void __lockfunc _spin_lock_irq(spinlock_t *lock) __acquires(spinlock_t);
62void __lockfunc _spin_lock_bh(spinlock_t *lock) __acquires(spinlock_t);
63void __lockfunc _read_lock_irq(rwlock_t *lock) __acquires(rwlock_t);
64void __lockfunc _read_lock_bh(rwlock_t *lock) __acquires(rwlock_t);
65void __lockfunc _write_lock_irq(rwlock_t *lock) __acquires(rwlock_t);
66void __lockfunc _write_lock_bh(rwlock_t *lock) __acquires(rwlock_t);
67
68void __lockfunc _spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags) __releases(spinlock_t);
69void __lockfunc _spin_unlock_irq(spinlock_t *lock) __releases(spinlock_t);
70void __lockfunc _spin_unlock_bh(spinlock_t *lock) __releases(spinlock_t);
71void __lockfunc _read_unlock_irqrestore(rwlock_t *lock, unsigned long flags) __releases(rwlock_t);
72void __lockfunc _read_unlock_irq(rwlock_t *lock) __releases(rwlock_t);
73void __lockfunc _read_unlock_bh(rwlock_t *lock) __releases(rwlock_t);
74void __lockfunc _write_unlock_irqrestore(rwlock_t *lock, unsigned long flags) __releases(rwlock_t);
75void __lockfunc _write_unlock_irq(rwlock_t *lock) __releases(rwlock_t);
76void __lockfunc _write_unlock_bh(rwlock_t *lock) __releases(rwlock_t);
77
78int __lockfunc _spin_trylock_bh(spinlock_t *lock);
79int __lockfunc generic_raw_read_trylock(rwlock_t *lock);
80int in_lock_functions(unsigned long addr);
81
82#else
83 81
84#define in_lock_functions(ADDR) 0 82extern int __lockfunc generic__raw_read_trylock(raw_rwlock_t *lock);
85 83
86#if !defined(CONFIG_PREEMPT) && !defined(CONFIG_DEBUG_SPINLOCK)
87# define _atomic_dec_and_lock(atomic,lock) atomic_dec_and_test(atomic)
88# define ATOMIC_DEC_AND_LOCK
89#endif
90
91#ifdef CONFIG_DEBUG_SPINLOCK
92
93#define SPINLOCK_MAGIC 0x1D244B3C
94typedef struct {
95 unsigned long magic;
96 volatile unsigned long lock;
97 volatile unsigned int babble;
98 const char *module;
99 char *owner;
100 int oline;
101} spinlock_t;
102#define SPIN_LOCK_UNLOCKED (spinlock_t) { SPINLOCK_MAGIC, 0, 10, __FILE__ , NULL, 0}
103
104#define spin_lock_init(x) \
105 do { \
106 (x)->magic = SPINLOCK_MAGIC; \
107 (x)->lock = 0; \
108 (x)->babble = 5; \
109 (x)->module = __FILE__; \
110 (x)->owner = NULL; \
111 (x)->oline = 0; \
112 } while (0)
113
114#define CHECK_LOCK(x) \
115 do { \
116 if ((x)->magic != SPINLOCK_MAGIC) { \
117 printk(KERN_ERR "%s:%d: spin_is_locked on uninitialized spinlock %p.\n", \
118 __FILE__, __LINE__, (x)); \
119 } \
120 } while(0)
121
122#define _raw_spin_lock(x) \
123 do { \
124 CHECK_LOCK(x); \
125 if ((x)->lock&&(x)->babble) { \
126 (x)->babble--; \
127 printk("%s:%d: spin_lock(%s:%p) already locked by %s/%d\n", \
128 __FILE__,__LINE__, (x)->module, \
129 (x), (x)->owner, (x)->oline); \
130 } \
131 (x)->lock = 1; \
132 (x)->owner = __FILE__; \
133 (x)->oline = __LINE__; \
134 } while (0)
135
136/* without debugging, spin_is_locked on UP always says
137 * FALSE. --> printk if already locked. */
138#define spin_is_locked(x) \
139 ({ \
140 CHECK_LOCK(x); \
141 if ((x)->lock&&(x)->babble) { \
142 (x)->babble--; \
143 printk("%s:%d: spin_is_locked(%s:%p) already locked by %s/%d\n", \
144 __FILE__,__LINE__, (x)->module, \
145 (x), (x)->owner, (x)->oline); \
146 } \
147 0; \
148 })
149
150/* with debugging, assert_spin_locked() on UP does check
151 * the lock value properly */
152#define assert_spin_locked(x) \
153 ({ \
154 CHECK_LOCK(x); \
155 BUG_ON(!(x)->lock); \
156 })
157
158/* without debugging, spin_trylock on UP always says
159 * TRUE. --> printk if already locked. */
160#define _raw_spin_trylock(x) \
161 ({ \
162 CHECK_LOCK(x); \
163 if ((x)->lock&&(x)->babble) { \
164 (x)->babble--; \
165 printk("%s:%d: spin_trylock(%s:%p) already locked by %s/%d\n", \
166 __FILE__,__LINE__, (x)->module, \
167 (x), (x)->owner, (x)->oline); \
168 } \
169 (x)->lock = 1; \
170 (x)->owner = __FILE__; \
171 (x)->oline = __LINE__; \
172 1; \
173 })
174
175#define spin_unlock_wait(x) \
176 do { \
177 CHECK_LOCK(x); \
178 if ((x)->lock&&(x)->babble) { \
179 (x)->babble--; \
180 printk("%s:%d: spin_unlock_wait(%s:%p) owned by %s/%d\n", \
181 __FILE__,__LINE__, (x)->module, (x), \
182 (x)->owner, (x)->oline); \
183 }\
184 } while (0)
185
186#define _raw_spin_unlock(x) \
187 do { \
188 CHECK_LOCK(x); \
189 if (!(x)->lock&&(x)->babble) { \
190 (x)->babble--; \
191 printk("%s:%d: spin_unlock(%s:%p) not locked\n", \
192 __FILE__,__LINE__, (x)->module, (x));\
193 } \
194 (x)->lock = 0; \
195 } while (0)
196#else
197/* 84/*
198 * gcc versions before ~2.95 have a nasty bug with empty initializers. 85 * Pull the __raw*() functions/declarations (UP-nondebug doesnt need them):
199 */ 86 */
200#if (__GNUC__ > 2) 87#if defined(CONFIG_SMP)
201 typedef struct { } spinlock_t; 88# include <asm/spinlock.h>
202 #define SPIN_LOCK_UNLOCKED (spinlock_t) { }
203#else 89#else
204 typedef struct { int gcc_is_buggy; } spinlock_t; 90# include <linux/spinlock_up.h>
205 #define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 }
206#endif 91#endif
207 92
93#define spin_lock_init(lock) do { *(lock) = SPIN_LOCK_UNLOCKED; } while (0)
94#define rwlock_init(lock) do { *(lock) = RW_LOCK_UNLOCKED; } while (0)
95
96#define spin_is_locked(lock) __raw_spin_is_locked(&(lock)->raw_lock)
97
98/**
99 * spin_unlock_wait - wait until the spinlock gets unlocked
100 * @lock: the spinlock in question.
101 */
102#define spin_unlock_wait(lock) __raw_spin_unlock_wait(&(lock)->raw_lock)
103
208/* 104/*
209 * If CONFIG_SMP is unset, declare the _raw_* definitions as nops 105 * Pull the _spin_*()/_read_*()/_write_*() functions/declarations:
210 */ 106 */
211#define spin_lock_init(lock) do { (void)(lock); } while(0) 107#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
212#define _raw_spin_lock(lock) do { (void)(lock); } while(0) 108# include <linux/spinlock_api_smp.h>
213#define spin_is_locked(lock) ((void)(lock), 0)
214#define assert_spin_locked(lock) do { (void)(lock); } while(0)
215#define _raw_spin_trylock(lock) (((void)(lock), 1))
216#define spin_unlock_wait(lock) (void)(lock)
217#define _raw_spin_unlock(lock) do { (void)(lock); } while(0)
218#endif /* CONFIG_DEBUG_SPINLOCK */
219
220/* RW spinlocks: No debug version */
221
222#if (__GNUC__ > 2)
223 typedef struct { } rwlock_t;
224 #define RW_LOCK_UNLOCKED (rwlock_t) { }
225#else 109#else
226 typedef struct { int gcc_is_buggy; } rwlock_t; 110# include <linux/spinlock_api_up.h>
227 #define RW_LOCK_UNLOCKED (rwlock_t) { 0 }
228#endif 111#endif
229 112
230#define rwlock_init(lock) do { (void)(lock); } while(0) 113#ifdef CONFIG_DEBUG_SPINLOCK
231#define _raw_read_lock(lock) do { (void)(lock); } while(0) 114 extern void _raw_spin_lock(spinlock_t *lock);
232#define _raw_read_unlock(lock) do { (void)(lock); } while(0) 115#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock)
233#define _raw_write_lock(lock) do { (void)(lock); } while(0) 116 extern int _raw_spin_trylock(spinlock_t *lock);
234#define _raw_write_unlock(lock) do { (void)(lock); } while(0) 117 extern void _raw_spin_unlock(spinlock_t *lock);
235#define read_can_lock(lock) (((void)(lock), 1)) 118
236#define write_can_lock(lock) (((void)(lock), 1)) 119 extern void _raw_read_lock(rwlock_t *lock);
237#define _raw_read_trylock(lock) ({ (void)(lock); (1); }) 120 extern int _raw_read_trylock(rwlock_t *lock);
238#define _raw_write_trylock(lock) ({ (void)(lock); (1); }) 121 extern void _raw_read_unlock(rwlock_t *lock);
239 122 extern void _raw_write_lock(rwlock_t *lock);
240#define _spin_trylock(lock) ({preempt_disable(); _raw_spin_trylock(lock) ? \ 123 extern int _raw_write_trylock(rwlock_t *lock);
241 1 : ({preempt_enable(); 0;});}) 124 extern void _raw_write_unlock(rwlock_t *lock);
242 125#else
243#define _read_trylock(lock) ({preempt_disable();_raw_read_trylock(lock) ? \ 126# define _raw_spin_unlock(lock) __raw_spin_unlock(&(lock)->raw_lock)
244 1 : ({preempt_enable(); 0;});}) 127# define _raw_spin_trylock(lock) __raw_spin_trylock(&(lock)->raw_lock)
245 128# define _raw_spin_lock(lock) __raw_spin_lock(&(lock)->raw_lock)
246#define _write_trylock(lock) ({preempt_disable(); _raw_write_trylock(lock) ? \ 129# define _raw_spin_lock_flags(lock, flags) \
247 1 : ({preempt_enable(); 0;});}) 130 __raw_spin_lock_flags(&(lock)->raw_lock, *(flags))
248 131# define _raw_read_lock(rwlock) __raw_read_lock(&(rwlock)->raw_lock)
249#define _spin_trylock_bh(lock) ({preempt_disable(); local_bh_disable(); \ 132# define _raw_write_lock(rwlock) __raw_write_lock(&(rwlock)->raw_lock)
250 _raw_spin_trylock(lock) ? \ 133# define _raw_read_unlock(rwlock) __raw_read_unlock(&(rwlock)->raw_lock)
251 1 : ({preempt_enable_no_resched(); local_bh_enable(); 0;});}) 134# define _raw_write_unlock(rwlock) __raw_write_unlock(&(rwlock)->raw_lock)
252 135# define _raw_read_trylock(rwlock) __raw_read_trylock(&(rwlock)->raw_lock)
253#define _spin_lock(lock) \ 136# define _raw_write_trylock(rwlock) __raw_write_trylock(&(rwlock)->raw_lock)
254do { \ 137#endif
255 preempt_disable(); \
256 _raw_spin_lock(lock); \
257 __acquire(lock); \
258} while(0)
259
260#define _write_lock(lock) \
261do { \
262 preempt_disable(); \
263 _raw_write_lock(lock); \
264 __acquire(lock); \
265} while(0)
266
267#define _read_lock(lock) \
268do { \
269 preempt_disable(); \
270 _raw_read_lock(lock); \
271 __acquire(lock); \
272} while(0)
273
274#define _spin_unlock(lock) \
275do { \
276 _raw_spin_unlock(lock); \
277 preempt_enable(); \
278 __release(lock); \
279} while (0)
280
281#define _write_unlock(lock) \
282do { \
283 _raw_write_unlock(lock); \
284 preempt_enable(); \
285 __release(lock); \
286} while(0)
287
288#define _read_unlock(lock) \
289do { \
290 _raw_read_unlock(lock); \
291 preempt_enable(); \
292 __release(lock); \
293} while(0)
294
295#define _spin_lock_irqsave(lock, flags) \
296do { \
297 local_irq_save(flags); \
298 preempt_disable(); \
299 _raw_spin_lock(lock); \
300 __acquire(lock); \
301} while (0)
302
303#define _spin_lock_irq(lock) \
304do { \
305 local_irq_disable(); \
306 preempt_disable(); \
307 _raw_spin_lock(lock); \
308 __acquire(lock); \
309} while (0)
310
311#define _spin_lock_bh(lock) \
312do { \
313 local_bh_disable(); \
314 preempt_disable(); \
315 _raw_spin_lock(lock); \
316 __acquire(lock); \
317} while (0)
318
319#define _read_lock_irqsave(lock, flags) \
320do { \
321 local_irq_save(flags); \
322 preempt_disable(); \
323 _raw_read_lock(lock); \
324 __acquire(lock); \
325} while (0)
326
327#define _read_lock_irq(lock) \
328do { \
329 local_irq_disable(); \
330 preempt_disable(); \
331 _raw_read_lock(lock); \
332 __acquire(lock); \
333} while (0)
334
335#define _read_lock_bh(lock) \
336do { \
337 local_bh_disable(); \
338 preempt_disable(); \
339 _raw_read_lock(lock); \
340 __acquire(lock); \
341} while (0)
342
343#define _write_lock_irqsave(lock, flags) \
344do { \
345 local_irq_save(flags); \
346 preempt_disable(); \
347 _raw_write_lock(lock); \
348 __acquire(lock); \
349} while (0)
350 138
351#define _write_lock_irq(lock) \ 139#define read_can_lock(rwlock) __raw_read_can_lock(&(rwlock)->raw_lock)
352do { \ 140#define write_can_lock(rwlock) __raw_write_can_lock(&(rwlock)->raw_lock)
353 local_irq_disable(); \
354 preempt_disable(); \
355 _raw_write_lock(lock); \
356 __acquire(lock); \
357} while (0)
358
359#define _write_lock_bh(lock) \
360do { \
361 local_bh_disable(); \
362 preempt_disable(); \
363 _raw_write_lock(lock); \
364 __acquire(lock); \
365} while (0)
366
367#define _spin_unlock_irqrestore(lock, flags) \
368do { \
369 _raw_spin_unlock(lock); \
370 local_irq_restore(flags); \
371 preempt_enable(); \
372 __release(lock); \
373} while (0)
374
375#define _spin_unlock_irq(lock) \
376do { \
377 _raw_spin_unlock(lock); \
378 local_irq_enable(); \
379 preempt_enable(); \
380 __release(lock); \
381} while (0)
382
383#define _spin_unlock_bh(lock) \
384do { \
385 _raw_spin_unlock(lock); \
386 preempt_enable_no_resched(); \
387 local_bh_enable(); \
388 __release(lock); \
389} while (0)
390
391#define _write_unlock_bh(lock) \
392do { \
393 _raw_write_unlock(lock); \
394 preempt_enable_no_resched(); \
395 local_bh_enable(); \
396 __release(lock); \
397} while (0)
398
399#define _read_unlock_irqrestore(lock, flags) \
400do { \
401 _raw_read_unlock(lock); \
402 local_irq_restore(flags); \
403 preempt_enable(); \
404 __release(lock); \
405} while (0)
406
407#define _write_unlock_irqrestore(lock, flags) \
408do { \
409 _raw_write_unlock(lock); \
410 local_irq_restore(flags); \
411 preempt_enable(); \
412 __release(lock); \
413} while (0)
414
415#define _read_unlock_irq(lock) \
416do { \
417 _raw_read_unlock(lock); \
418 local_irq_enable(); \
419 preempt_enable(); \
420 __release(lock); \
421} while (0)
422
423#define _read_unlock_bh(lock) \
424do { \
425 _raw_read_unlock(lock); \
426 preempt_enable_no_resched(); \
427 local_bh_enable(); \
428 __release(lock); \
429} while (0)
430
431#define _write_unlock_irq(lock) \
432do { \
433 _raw_write_unlock(lock); \
434 local_irq_enable(); \
435 preempt_enable(); \
436 __release(lock); \
437} while (0)
438
439#endif /* !SMP */
440 141
441/* 142/*
442 * Define the various spin_lock and rw_lock methods. Note we define these 143 * Define the various spin_lock and rw_lock methods. Note we define these
443 * regardless of whether CONFIG_SMP or CONFIG_PREEMPT are set. The various 144 * regardless of whether CONFIG_SMP or CONFIG_PREEMPT are set. The various
444 * methods are defined as nops in the case they are not required. 145 * methods are defined as nops in the case they are not required.
445 */ 146 */
446#define spin_trylock(lock) __cond_lock(_spin_trylock(lock)) 147#define spin_trylock(lock) __cond_lock(_spin_trylock(lock))
447#define read_trylock(lock) __cond_lock(_read_trylock(lock)) 148#define read_trylock(lock) __cond_lock(_read_trylock(lock))
448#define write_trylock(lock) __cond_lock(_write_trylock(lock)) 149#define write_trylock(lock) __cond_lock(_write_trylock(lock))
449 150
450#define spin_lock(lock) _spin_lock(lock) 151#define spin_lock(lock) _spin_lock(lock)
451#define write_lock(lock) _write_lock(lock) 152#define write_lock(lock) _write_lock(lock)
452#define read_lock(lock) _read_lock(lock) 153#define read_lock(lock) _read_lock(lock)
453 154
454#ifdef CONFIG_SMP 155#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
455#define spin_lock_irqsave(lock, flags) flags = _spin_lock_irqsave(lock) 156#define spin_lock_irqsave(lock, flags) flags = _spin_lock_irqsave(lock)
456#define read_lock_irqsave(lock, flags) flags = _read_lock_irqsave(lock) 157#define read_lock_irqsave(lock, flags) flags = _read_lock_irqsave(lock)
457#define write_lock_irqsave(lock, flags) flags = _write_lock_irqsave(lock) 158#define write_lock_irqsave(lock, flags) flags = _write_lock_irqsave(lock)
@@ -470,137 +171,59 @@ do { \
470#define write_lock_irq(lock) _write_lock_irq(lock) 171#define write_lock_irq(lock) _write_lock_irq(lock)
471#define write_lock_bh(lock) _write_lock_bh(lock) 172#define write_lock_bh(lock) _write_lock_bh(lock)
472 173
473#define spin_unlock(lock) _spin_unlock(lock) 174#define spin_unlock(lock) _spin_unlock(lock)
474#define write_unlock(lock) _write_unlock(lock) 175#define write_unlock(lock) _write_unlock(lock)
475#define read_unlock(lock) _read_unlock(lock) 176#define read_unlock(lock) _read_unlock(lock)
476 177
477#define spin_unlock_irqrestore(lock, flags) _spin_unlock_irqrestore(lock, flags) 178#define spin_unlock_irqrestore(lock, flags) \
179 _spin_unlock_irqrestore(lock, flags)
478#define spin_unlock_irq(lock) _spin_unlock_irq(lock) 180#define spin_unlock_irq(lock) _spin_unlock_irq(lock)
479#define spin_unlock_bh(lock) _spin_unlock_bh(lock) 181#define spin_unlock_bh(lock) _spin_unlock_bh(lock)
480 182
481#define read_unlock_irqrestore(lock, flags) _read_unlock_irqrestore(lock, flags) 183#define read_unlock_irqrestore(lock, flags) \
482#define read_unlock_irq(lock) _read_unlock_irq(lock) 184 _read_unlock_irqrestore(lock, flags)
483#define read_unlock_bh(lock) _read_unlock_bh(lock) 185#define read_unlock_irq(lock) _read_unlock_irq(lock)
186#define read_unlock_bh(lock) _read_unlock_bh(lock)
484 187
485#define write_unlock_irqrestore(lock, flags) _write_unlock_irqrestore(lock, flags) 188#define write_unlock_irqrestore(lock, flags) \
486#define write_unlock_irq(lock) _write_unlock_irq(lock) 189 _write_unlock_irqrestore(lock, flags)
487#define write_unlock_bh(lock) _write_unlock_bh(lock) 190#define write_unlock_irq(lock) _write_unlock_irq(lock)
191#define write_unlock_bh(lock) _write_unlock_bh(lock)
488 192
489#define spin_trylock_bh(lock) __cond_lock(_spin_trylock_bh(lock)) 193#define spin_trylock_bh(lock) __cond_lock(_spin_trylock_bh(lock))
490 194
491#define spin_trylock_irq(lock) \ 195#define spin_trylock_irq(lock) \
492({ \ 196({ \
493 local_irq_disable(); \ 197 local_irq_disable(); \
494 _spin_trylock(lock) ? \ 198 _spin_trylock(lock) ? \
495 1 : ({local_irq_enable(); 0; }); \ 199 1 : ({ local_irq_enable(); 0; }); \
496}) 200})
497 201
498#define spin_trylock_irqsave(lock, flags) \ 202#define spin_trylock_irqsave(lock, flags) \
499({ \ 203({ \
500 local_irq_save(flags); \ 204 local_irq_save(flags); \
501 _spin_trylock(lock) ? \ 205 _spin_trylock(lock) ? \
502 1 : ({local_irq_restore(flags); 0;}); \ 206 1 : ({ local_irq_restore(flags); 0; }); \
503}) 207})
504 208
505#ifdef CONFIG_LOCKMETER
506extern void _metered_spin_lock (spinlock_t *lock);
507extern void _metered_spin_unlock (spinlock_t *lock);
508extern int _metered_spin_trylock(spinlock_t *lock);
509extern void _metered_read_lock (rwlock_t *lock);
510extern void _metered_read_unlock (rwlock_t *lock);
511extern void _metered_write_lock (rwlock_t *lock);
512extern void _metered_write_unlock (rwlock_t *lock);
513extern int _metered_read_trylock (rwlock_t *lock);
514extern int _metered_write_trylock(rwlock_t *lock);
515#endif
516
517/* "lock on reference count zero" */
518#ifndef ATOMIC_DEC_AND_LOCK
519#include <asm/atomic.h>
520extern int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock);
521#endif
522
523#define atomic_dec_and_lock(atomic,lock) __cond_lock(_atomic_dec_and_lock(atomic,lock))
524
525/*
526 * bit-based spin_lock()
527 *
528 * Don't use this unless you really need to: spin_lock() and spin_unlock()
529 * are significantly faster.
530 */
531static inline void bit_spin_lock(int bitnum, unsigned long *addr)
532{
533 /*
534 * Assuming the lock is uncontended, this never enters
535 * the body of the outer loop. If it is contended, then
536 * within the inner loop a non-atomic test is used to
537 * busywait with less bus contention for a good time to
538 * attempt to acquire the lock bit.
539 */
540 preempt_disable();
541#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
542 while (test_and_set_bit(bitnum, addr)) {
543 while (test_bit(bitnum, addr)) {
544 preempt_enable();
545 cpu_relax();
546 preempt_disable();
547 }
548 }
549#endif
550 __acquire(bitlock);
551}
552
553/* 209/*
554 * Return true if it was acquired 210 * Pull the atomic_t declaration:
211 * (asm-mips/atomic.h needs above definitions)
555 */ 212 */
556static inline int bit_spin_trylock(int bitnum, unsigned long *addr) 213#include <asm/atomic.h>
557{ 214/**
558 preempt_disable(); 215 * atomic_dec_and_lock - lock on reaching reference count zero
559#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) 216 * @atomic: the atomic counter
560 if (test_and_set_bit(bitnum, addr)) { 217 * @lock: the spinlock in question
561 preempt_enable();
562 return 0;
563 }
564#endif
565 __acquire(bitlock);
566 return 1;
567}
568
569/*
570 * bit-based spin_unlock()
571 */
572static inline void bit_spin_unlock(int bitnum, unsigned long *addr)
573{
574#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
575 BUG_ON(!test_bit(bitnum, addr));
576 smp_mb__before_clear_bit();
577 clear_bit(bitnum, addr);
578#endif
579 preempt_enable();
580 __release(bitlock);
581}
582
583/*
584 * Return true if the lock is held.
585 */ 218 */
586static inline int bit_spin_is_locked(int bitnum, unsigned long *addr) 219extern int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock);
587{ 220#define atomic_dec_and_lock(atomic, lock) \
588#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) 221 __cond_lock(_atomic_dec_and_lock(atomic, lock))
589 return test_bit(bitnum, addr);
590#elif defined CONFIG_PREEMPT
591 return preempt_count();
592#else
593 return 1;
594#endif
595}
596
597#define DEFINE_SPINLOCK(x) spinlock_t x = SPIN_LOCK_UNLOCKED
598#define DEFINE_RWLOCK(x) rwlock_t x = RW_LOCK_UNLOCKED
599 222
600/** 223/**
601 * spin_can_lock - would spin_trylock() succeed? 224 * spin_can_lock - would spin_trylock() succeed?
602 * @lock: the spinlock in question. 225 * @lock: the spinlock in question.
603 */ 226 */
604#define spin_can_lock(lock) (!spin_is_locked(lock)) 227#define spin_can_lock(lock) (!spin_is_locked(lock))
605 228
606#endif /* __LINUX_SPINLOCK_H */ 229#endif /* __LINUX_SPINLOCK_H */
diff --git a/include/linux/spinlock_api_smp.h b/include/linux/spinlock_api_smp.h
new file mode 100644
index 000000000000..78e6989ffb54
--- /dev/null
+++ b/include/linux/spinlock_api_smp.h
@@ -0,0 +1,57 @@
1#ifndef __LINUX_SPINLOCK_API_SMP_H
2#define __LINUX_SPINLOCK_API_SMP_H
3
4#ifndef __LINUX_SPINLOCK_H
5# error "please don't include this file directly"
6#endif
7
8/*
9 * include/linux/spinlock_api_smp.h
10 *
11 * spinlock API declarations on SMP (and debug)
12 * (implemented in kernel/spinlock.c)
13 *
14 * portions Copyright 2005, Red Hat, Inc., Ingo Molnar
15 * Released under the General Public License (GPL).
16 */
17
18int in_lock_functions(unsigned long addr);
19
20#define assert_spin_locked(x) BUG_ON(!spin_is_locked(x))
21
22void __lockfunc _spin_lock(spinlock_t *lock) __acquires(spinlock_t);
23void __lockfunc _read_lock(rwlock_t *lock) __acquires(rwlock_t);
24void __lockfunc _write_lock(rwlock_t *lock) __acquires(rwlock_t);
25void __lockfunc _spin_lock_bh(spinlock_t *lock) __acquires(spinlock_t);
26void __lockfunc _read_lock_bh(rwlock_t *lock) __acquires(rwlock_t);
27void __lockfunc _write_lock_bh(rwlock_t *lock) __acquires(rwlock_t);
28void __lockfunc _spin_lock_irq(spinlock_t *lock) __acquires(spinlock_t);
29void __lockfunc _read_lock_irq(rwlock_t *lock) __acquires(rwlock_t);
30void __lockfunc _write_lock_irq(rwlock_t *lock) __acquires(rwlock_t);
31unsigned long __lockfunc _spin_lock_irqsave(spinlock_t *lock)
32 __acquires(spinlock_t);
33unsigned long __lockfunc _read_lock_irqsave(rwlock_t *lock)
34 __acquires(rwlock_t);
35unsigned long __lockfunc _write_lock_irqsave(rwlock_t *lock)
36 __acquires(rwlock_t);
37int __lockfunc _spin_trylock(spinlock_t *lock);
38int __lockfunc _read_trylock(rwlock_t *lock);
39int __lockfunc _write_trylock(rwlock_t *lock);
40int __lockfunc _spin_trylock_bh(spinlock_t *lock);
41void __lockfunc _spin_unlock(spinlock_t *lock) __releases(spinlock_t);
42void __lockfunc _read_unlock(rwlock_t *lock) __releases(rwlock_t);
43void __lockfunc _write_unlock(rwlock_t *lock) __releases(rwlock_t);
44void __lockfunc _spin_unlock_bh(spinlock_t *lock) __releases(spinlock_t);
45void __lockfunc _read_unlock_bh(rwlock_t *lock) __releases(rwlock_t);
46void __lockfunc _write_unlock_bh(rwlock_t *lock) __releases(rwlock_t);
47void __lockfunc _spin_unlock_irq(spinlock_t *lock) __releases(spinlock_t);
48void __lockfunc _read_unlock_irq(rwlock_t *lock) __releases(rwlock_t);
49void __lockfunc _write_unlock_irq(rwlock_t *lock) __releases(rwlock_t);
50void __lockfunc _spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags)
51 __releases(spinlock_t);
52void __lockfunc _read_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
53 __releases(rwlock_t);
54void __lockfunc _write_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
55 __releases(rwlock_t);
56
57#endif /* __LINUX_SPINLOCK_API_SMP_H */
diff --git a/include/linux/spinlock_api_up.h b/include/linux/spinlock_api_up.h
new file mode 100644
index 000000000000..cd81cee566f4
--- /dev/null
+++ b/include/linux/spinlock_api_up.h
@@ -0,0 +1,80 @@
1#ifndef __LINUX_SPINLOCK_API_UP_H
2#define __LINUX_SPINLOCK_API_UP_H
3
4#ifndef __LINUX_SPINLOCK_H
5# error "please don't include this file directly"
6#endif
7
8/*
9 * include/linux/spinlock_api_up.h
10 *
11 * spinlock API implementation on UP-nondebug (inlined implementation)
12 *
13 * portions Copyright 2005, Red Hat, Inc., Ingo Molnar
14 * Released under the General Public License (GPL).
15 */
16
17#define in_lock_functions(ADDR) 0
18
19#define assert_spin_locked(lock) do { (void)(lock); } while (0)
20
21/*
22 * In the UP-nondebug case there's no real locking going on, so the
23 * only thing we have to do is to keep the preempt counts and irq
24 * flags straight, to supress compiler warnings of unused lock
25 * variables, and to add the proper checker annotations:
26 */
27#define __LOCK(lock) \
28 do { preempt_disable(); __acquire(lock); (void)(lock); } while (0)
29
30#define __LOCK_BH(lock) \
31 do { local_bh_disable(); __LOCK(lock); } while (0)
32
33#define __LOCK_IRQ(lock) \
34 do { local_irq_disable(); __LOCK(lock); } while (0)
35
36#define __LOCK_IRQSAVE(lock, flags) \
37 do { local_irq_save(flags); __LOCK(lock); } while (0)
38
39#define __UNLOCK(lock) \
40 do { preempt_enable(); __release(lock); (void)(lock); } while (0)
41
42#define __UNLOCK_BH(lock) \
43 do { preempt_enable_no_resched(); local_bh_enable(); __release(lock); (void)(lock); } while (0)
44
45#define __UNLOCK_IRQ(lock) \
46 do { local_irq_enable(); __UNLOCK(lock); } while (0)
47
48#define __UNLOCK_IRQRESTORE(lock, flags) \
49 do { local_irq_restore(flags); __UNLOCK(lock); } while (0)
50
51#define _spin_lock(lock) __LOCK(lock)
52#define _read_lock(lock) __LOCK(lock)
53#define _write_lock(lock) __LOCK(lock)
54#define _spin_lock_bh(lock) __LOCK_BH(lock)
55#define _read_lock_bh(lock) __LOCK_BH(lock)
56#define _write_lock_bh(lock) __LOCK_BH(lock)
57#define _spin_lock_irq(lock) __LOCK_IRQ(lock)
58#define _read_lock_irq(lock) __LOCK_IRQ(lock)
59#define _write_lock_irq(lock) __LOCK_IRQ(lock)
60#define _spin_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags)
61#define _read_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags)
62#define _write_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags)
63#define _spin_trylock(lock) ({ __LOCK(lock); 1; })
64#define _read_trylock(lock) ({ __LOCK(lock); 1; })
65#define _write_trylock(lock) ({ __LOCK(lock); 1; })
66#define _spin_trylock_bh(lock) ({ __LOCK_BH(lock); 1; })
67#define _spin_unlock(lock) __UNLOCK(lock)
68#define _read_unlock(lock) __UNLOCK(lock)
69#define _write_unlock(lock) __UNLOCK(lock)
70#define _spin_unlock_bh(lock) __UNLOCK_BH(lock)
71#define _write_unlock_bh(lock) __UNLOCK_BH(lock)
72#define _read_unlock_bh(lock) __UNLOCK_BH(lock)
73#define _spin_unlock_irq(lock) __UNLOCK_IRQ(lock)
74#define _read_unlock_irq(lock) __UNLOCK_IRQ(lock)
75#define _write_unlock_irq(lock) __UNLOCK_IRQ(lock)
76#define _spin_unlock_irqrestore(lock, flags) __UNLOCK_IRQRESTORE(lock, flags)
77#define _read_unlock_irqrestore(lock, flags) __UNLOCK_IRQRESTORE(lock, flags)
78#define _write_unlock_irqrestore(lock, flags) __UNLOCK_IRQRESTORE(lock, flags)
79
80#endif /* __LINUX_SPINLOCK_API_UP_H */
diff --git a/include/linux/spinlock_types.h b/include/linux/spinlock_types.h
new file mode 100644
index 000000000000..9cb51e070390
--- /dev/null
+++ b/include/linux/spinlock_types.h
@@ -0,0 +1,67 @@
1#ifndef __LINUX_SPINLOCK_TYPES_H
2#define __LINUX_SPINLOCK_TYPES_H
3
4/*
5 * include/linux/spinlock_types.h - generic spinlock type definitions
6 * and initializers
7 *
8 * portions Copyright 2005, Red Hat, Inc., Ingo Molnar
9 * Released under the General Public License (GPL).
10 */
11
12#if defined(CONFIG_SMP)
13# include <asm/spinlock_types.h>
14#else
15# include <linux/spinlock_types_up.h>
16#endif
17
18typedef struct {
19 raw_spinlock_t raw_lock;
20#if defined(CONFIG_PREEMPT) && defined(CONFIG_SMP)
21 unsigned int break_lock;
22#endif
23#ifdef CONFIG_DEBUG_SPINLOCK
24 unsigned int magic, owner_cpu;
25 void *owner;
26#endif
27} spinlock_t;
28
29#define SPINLOCK_MAGIC 0xdead4ead
30
31typedef struct {
32 raw_rwlock_t raw_lock;
33#if defined(CONFIG_PREEMPT) && defined(CONFIG_SMP)
34 unsigned int break_lock;
35#endif
36#ifdef CONFIG_DEBUG_SPINLOCK
37 unsigned int magic, owner_cpu;
38 void *owner;
39#endif
40} rwlock_t;
41
42#define RWLOCK_MAGIC 0xdeaf1eed
43
44#define SPINLOCK_OWNER_INIT ((void *)-1L)
45
46#ifdef CONFIG_DEBUG_SPINLOCK
47# define SPIN_LOCK_UNLOCKED \
48 (spinlock_t) { .raw_lock = __RAW_SPIN_LOCK_UNLOCKED, \
49 .magic = SPINLOCK_MAGIC, \
50 .owner = SPINLOCK_OWNER_INIT, \
51 .owner_cpu = -1 }
52#define RW_LOCK_UNLOCKED \
53 (rwlock_t) { .raw_lock = __RAW_RW_LOCK_UNLOCKED, \
54 .magic = RWLOCK_MAGIC, \
55 .owner = SPINLOCK_OWNER_INIT, \
56 .owner_cpu = -1 }
57#else
58# define SPIN_LOCK_UNLOCKED \
59 (spinlock_t) { .raw_lock = __RAW_SPIN_LOCK_UNLOCKED }
60#define RW_LOCK_UNLOCKED \
61 (rwlock_t) { .raw_lock = __RAW_RW_LOCK_UNLOCKED }
62#endif
63
64#define DEFINE_SPINLOCK(x) spinlock_t x = SPIN_LOCK_UNLOCKED
65#define DEFINE_RWLOCK(x) rwlock_t x = RW_LOCK_UNLOCKED
66
67#endif /* __LINUX_SPINLOCK_TYPES_H */
diff --git a/include/linux/spinlock_types_up.h b/include/linux/spinlock_types_up.h
new file mode 100644
index 000000000000..def2d173a8db
--- /dev/null
+++ b/include/linux/spinlock_types_up.h
@@ -0,0 +1,51 @@
1#ifndef __LINUX_SPINLOCK_TYPES_UP_H
2#define __LINUX_SPINLOCK_TYPES_UP_H
3
4#ifndef __LINUX_SPINLOCK_TYPES_H
5# error "please don't include this file directly"
6#endif
7
8/*
9 * include/linux/spinlock_types_up.h - spinlock type definitions for UP
10 *
11 * portions Copyright 2005, Red Hat, Inc., Ingo Molnar
12 * Released under the General Public License (GPL).
13 */
14
15#ifdef CONFIG_DEBUG_SPINLOCK
16
17typedef struct {
18 volatile unsigned int slock;
19} raw_spinlock_t;
20
21#define __RAW_SPIN_LOCK_UNLOCKED { 1 }
22
23#else
24
25/*
26 * All gcc 2.95 versions and early versions of 2.96 have a nasty bug
27 * with empty initializers.
28 */
29#if (__GNUC__ > 2)
30typedef struct { } raw_spinlock_t;
31
32#define __RAW_SPIN_LOCK_UNLOCKED { }
33#else
34typedef struct { int gcc_is_buggy; } raw_spinlock_t;
35#define __RAW_SPIN_LOCK_UNLOCKED (raw_spinlock_t) { 0 }
36#endif
37
38#endif
39
40#if (__GNUC__ > 2)
41typedef struct {
42 /* no debug version on UP */
43} raw_rwlock_t;
44
45#define __RAW_RW_LOCK_UNLOCKED { }
46#else
47typedef struct { int gcc_is_buggy; } raw_rwlock_t;
48#define __RAW_RW_LOCK_UNLOCKED (raw_rwlock_t) { 0 }
49#endif
50
51#endif /* __LINUX_SPINLOCK_TYPES_UP_H */
diff --git a/include/linux/spinlock_up.h b/include/linux/spinlock_up.h
new file mode 100644
index 000000000000..31accf2f0b13
--- /dev/null
+++ b/include/linux/spinlock_up.h
@@ -0,0 +1,74 @@
1#ifndef __LINUX_SPINLOCK_UP_H
2#define __LINUX_SPINLOCK_UP_H
3
4#ifndef __LINUX_SPINLOCK_H
5# error "please don't include this file directly"
6#endif
7
8/*
9 * include/linux/spinlock_up.h - UP-debug version of spinlocks.
10 *
11 * portions Copyright 2005, Red Hat, Inc., Ingo Molnar
12 * Released under the General Public License (GPL).
13 *
14 * In the debug case, 1 means unlocked, 0 means locked. (the values
15 * are inverted, to catch initialization bugs)
16 *
17 * No atomicity anywhere, we are on UP.
18 */
19
20#ifdef CONFIG_DEBUG_SPINLOCK
21
22#define __raw_spin_is_locked(x) ((x)->slock == 0)
23
24static inline void __raw_spin_lock(raw_spinlock_t *lock)
25{
26 lock->slock = 0;
27}
28
29static inline void
30__raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long flags)
31{
32 local_irq_save(flags);
33 lock->slock = 0;
34}
35
36static inline int __raw_spin_trylock(raw_spinlock_t *lock)
37{
38 char oldval = lock->slock;
39
40 lock->slock = 0;
41
42 return oldval > 0;
43}
44
45static inline void __raw_spin_unlock(raw_spinlock_t *lock)
46{
47 lock->slock = 1;
48}
49
50/*
51 * Read-write spinlocks. No debug version.
52 */
53#define __raw_read_lock(lock) do { (void)(lock); } while (0)
54#define __raw_write_lock(lock) do { (void)(lock); } while (0)
55#define __raw_read_trylock(lock) ({ (void)(lock); 1; })
56#define __raw_write_trylock(lock) ({ (void)(lock); 1; })
57#define __raw_read_unlock(lock) do { (void)(lock); } while (0)
58#define __raw_write_unlock(lock) do { (void)(lock); } while (0)
59
60#else /* DEBUG_SPINLOCK */
61#define __raw_spin_is_locked(lock) ((void)(lock), 0)
62/* for sched.c and kernel_lock.c: */
63# define __raw_spin_lock(lock) do { (void)(lock); } while (0)
64# define __raw_spin_unlock(lock) do { (void)(lock); } while (0)
65# define __raw_spin_trylock(lock) ({ (void)(lock); 1; })
66#endif /* DEBUG_SPINLOCK */
67
68#define __raw_read_can_lock(lock) (((void)(lock), 1))
69#define __raw_write_can_lock(lock) (((void)(lock), 1))
70
71#define __raw_spin_unlock_wait(lock) \
72 do { cpu_relax(); } while (__raw_spin_is_locked(lock))
73
74#endif /* __LINUX_SPINLOCK_UP_H */
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 532a6c5c24e9..3a29a9f9b451 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -544,7 +544,8 @@ enum {
544 NET_NETROM_TRANSPORT_REQUESTED_WINDOW_SIZE=8, 544 NET_NETROM_TRANSPORT_REQUESTED_WINDOW_SIZE=8,
545 NET_NETROM_TRANSPORT_NO_ACTIVITY_TIMEOUT=9, 545 NET_NETROM_TRANSPORT_NO_ACTIVITY_TIMEOUT=9,
546 NET_NETROM_ROUTING_CONTROL=10, 546 NET_NETROM_ROUTING_CONTROL=10,
547 NET_NETROM_LINK_FAILS_COUNT=11 547 NET_NETROM_LINK_FAILS_COUNT=11,
548 NET_NETROM_RESET=12
548}; 549};
549 550
550/* /proc/sys/net/ax25 */ 551/* /proc/sys/net/ax25 */
diff --git a/include/linux/time.h b/include/linux/time.h
index c10d4c21c183..8e83f4e778bb 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -28,17 +28,10 @@ struct timezone {
28#ifdef __KERNEL__ 28#ifdef __KERNEL__
29 29
30/* Parameters used to convert the timespec values */ 30/* Parameters used to convert the timespec values */
31#ifndef USEC_PER_SEC 31#define MSEC_PER_SEC (1000L)
32#define USEC_PER_SEC (1000000L) 32#define USEC_PER_SEC (1000000L)
33#endif
34
35#ifndef NSEC_PER_SEC
36#define NSEC_PER_SEC (1000000000L) 33#define NSEC_PER_SEC (1000000000L)
37#endif
38
39#ifndef NSEC_PER_USEC
40#define NSEC_PER_USEC (1000L) 34#define NSEC_PER_USEC (1000L)
41#endif
42 35
43static __inline__ int timespec_equal(struct timespec *a, struct timespec *b) 36static __inline__ int timespec_equal(struct timespec *a, struct timespec *b)
44{ 37{
diff --git a/include/linux/timer.h b/include/linux/timer.h
index 221f81ac2002..3340f3bd135d 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -32,6 +32,10 @@ extern struct timer_base_s __init_timer_base;
32 .magic = TIMER_MAGIC, \ 32 .magic = TIMER_MAGIC, \
33 } 33 }
34 34
35#define DEFINE_TIMER(_name, _function, _expires, _data) \
36 struct timer_list _name = \
37 TIMER_INITIALIZER(_function, _expires, _data)
38
35void fastcall init_timer(struct timer_list * timer); 39void fastcall init_timer(struct timer_list * timer);
36 40
37/*** 41/***
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 59ff42c629ec..1267f88ece6e 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -74,7 +74,8 @@ struct screen_info {
74 u16 vesapm_off; /* 0x30 */ 74 u16 vesapm_off; /* 0x30 */
75 u16 pages; /* 0x32 */ 75 u16 pages; /* 0x32 */
76 u16 vesa_attributes; /* 0x34 */ 76 u16 vesa_attributes; /* 0x34 */
77 /* 0x36 -- 0x3f reserved for future expansion */ 77 u32 capabilities; /* 0x36 */
78 /* 0x3a -- 0x3f reserved for future expansion */
78}; 79};
79 80
80extern struct screen_info screen_info; 81extern struct screen_info screen_info;
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 724637792996..4dbe580f9335 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -5,6 +5,7 @@
5#include <linux/usb_ch9.h> 5#include <linux/usb_ch9.h>
6 6
7#define USB_MAJOR 180 7#define USB_MAJOR 180
8#define USB_DEVICE_MAJOR 189
8 9
9 10
10#ifdef __KERNEL__ 11#ifdef __KERNEL__
@@ -349,6 +350,7 @@ struct usb_device {
349 char *manufacturer; 350 char *manufacturer;
350 char *serial; /* static strings from the device */ 351 char *serial; /* static strings from the device */
351 struct list_head filelist; 352 struct list_head filelist;
353 struct class_device *class_dev;
352 struct dentry *usbfs_dentry; /* usbfs dentry entry for the device */ 354 struct dentry *usbfs_dentry; /* usbfs dentry entry for the device */
353 355
354 /* 356 /*
@@ -614,7 +616,6 @@ extern int usb_disabled(void);
614#define URB_ISO_ASAP 0x0002 /* iso-only, urb->start_frame ignored */ 616#define URB_ISO_ASAP 0x0002 /* iso-only, urb->start_frame ignored */
615#define URB_NO_TRANSFER_DMA_MAP 0x0004 /* urb->transfer_dma valid on submit */ 617#define URB_NO_TRANSFER_DMA_MAP 0x0004 /* urb->transfer_dma valid on submit */
616#define URB_NO_SETUP_DMA_MAP 0x0008 /* urb->setup_dma valid on submit */ 618#define URB_NO_SETUP_DMA_MAP 0x0008 /* urb->setup_dma valid on submit */
617#define URB_ASYNC_UNLINK 0x0010 /* usb_unlink_urb() returns asap */
618#define URB_NO_FSBR 0x0020 /* UHCI-specific */ 619#define URB_NO_FSBR 0x0020 /* UHCI-specific */
619#define URB_ZERO_PACKET 0x0040 /* Finish bulk OUTs with short packet */ 620#define URB_ZERO_PACKET 0x0040 /* Finish bulk OUTs with short packet */
620#define URB_NO_INTERRUPT 0x0080 /* HINT: no non-error interrupt needed */ 621#define URB_NO_INTERRUPT 0x0080 /* HINT: no non-error interrupt needed */
@@ -722,13 +723,7 @@ typedef void (*usb_complete_t)(struct urb *, struct pt_regs *);
722 * Initialization: 723 * Initialization:
723 * 724 *
724 * All URBs submitted must initialize the dev, pipe, transfer_flags (may be 725 * All URBs submitted must initialize the dev, pipe, transfer_flags (may be
725 * zero), and complete fields. 726 * zero), and complete fields. All URBs must also initialize
726 * The URB_ASYNC_UNLINK transfer flag affects later invocations of
727 * the usb_unlink_urb() routine. Note: Failure to set URB_ASYNC_UNLINK
728 * with usb_unlink_urb() is deprecated. For synchronous unlinks use
729 * usb_kill_urb() instead.
730 *
731 * All URBs must also initialize
732 * transfer_buffer and transfer_buffer_length. They may provide the 727 * transfer_buffer and transfer_buffer_length. They may provide the
733 * URB_SHORT_NOT_OK transfer flag, indicating that short reads are 728 * URB_SHORT_NOT_OK transfer flag, indicating that short reads are
734 * to be treated as errors; that flag is invalid for write requests. 729 * to be treated as errors; that flag is invalid for write requests.
diff --git a/include/linux/usb_isp116x.h b/include/linux/usb_isp116x.h
index 5f5a9d9bd6c2..436dd8a2b64a 100644
--- a/include/linux/usb_isp116x.h
+++ b/include/linux/usb_isp116x.h
@@ -7,36 +7,18 @@
7struct isp116x_platform_data { 7struct isp116x_platform_data {
8 /* Enable internal resistors on downstream ports */ 8 /* Enable internal resistors on downstream ports */
9 unsigned sel15Kres:1; 9 unsigned sel15Kres:1;
10 /* Chip's internal clock won't be stopped in suspended state. 10 /* On-chip overcurrent detection */
11 Setting/unsetting this bit takes effect only if
12 'remote_wakeup_enable' below is not set. */
13 unsigned clknotstop:1;
14 /* On-chip overcurrent protection */
15 unsigned oc_enable:1; 11 unsigned oc_enable:1;
16 /* INT output polarity */ 12 /* INT output polarity */
17 unsigned int_act_high:1; 13 unsigned int_act_high:1;
18 /* INT edge or level triggered */ 14 /* INT edge or level triggered */
19 unsigned int_edge_triggered:1; 15 unsigned int_edge_triggered:1;
20 /* WAKEUP pin connected - NOT SUPPORTED */ 16 /* Enable wakeup by devices on usb bus (e.g. wakeup
21 /* unsigned remote_wakeup_connected:1; */ 17 by attachment/detachment or by device activity
22 /* Wakeup by devices on usb bus enabled */ 18 such as moving a mouse). When chosen, this option
19 prevents stopping internal clock, increasing
20 thereby power consumption in suspended state. */
23 unsigned remote_wakeup_enable:1; 21 unsigned remote_wakeup_enable:1;
24 /* Switch or not to switch (keep always powered) */
25 unsigned no_power_switching:1;
26 /* Ganged port power switching (0) or individual port
27 power switching (1) */
28 unsigned power_switching_mode:1;
29 /* Given port_power, msec/2 after power on till power good */
30 u8 potpg;
31 /* Hardware reset set/clear. If implemented, this function must:
32 if set == 0, deassert chip's HW reset pin
33 otherwise, assert chip's HW reset pin */
34 void (*reset) (struct device * dev, int set);
35 /* Hardware clock start/stop. If implemented, this function must:
36 if start == 0, stop the external clock
37 otherwise, start the external clock
38 */
39 void (*clock) (struct device * dev, int start);
40 /* Inter-io delay (ns). The chip is picky about access timings; it 22 /* Inter-io delay (ns). The chip is picky about access timings; it
41 expects at least: 23 expects at least:
42 150ns delay between consecutive accesses to DATA_REG, 24 150ns delay between consecutive accesses to DATA_REG,
diff --git a/include/linux/usbdevice_fs.h b/include/linux/usbdevice_fs.h
index fb57c2217468..9facf733800c 100644
--- a/include/linux/usbdevice_fs.h
+++ b/include/linux/usbdevice_fs.h
@@ -32,7 +32,6 @@
32#define _LINUX_USBDEVICE_FS_H 32#define _LINUX_USBDEVICE_FS_H
33 33
34#include <linux/types.h> 34#include <linux/types.h>
35#include <linux/compat.h>
36 35
37/* --------------------------------------------------------------------- */ 36/* --------------------------------------------------------------------- */
38 37
@@ -125,6 +124,7 @@ struct usbdevfs_hub_portinfo {
125}; 124};
126 125
127#ifdef CONFIG_COMPAT 126#ifdef CONFIG_COMPAT
127#include <linux/compat.h>
128struct usbdevfs_urb32 { 128struct usbdevfs_urb32 {
129 unsigned char type; 129 unsigned char type;
130 unsigned char endpoint; 130 unsigned char endpoint;
diff --git a/include/linux/videodev.h b/include/linux/videodev.h
index 9d6fbde3d29c..1cc8c31b7988 100644
--- a/include/linux/videodev.h
+++ b/include/linux/videodev.h
@@ -3,7 +3,6 @@
3 3
4#include <linux/compiler.h> 4#include <linux/compiler.h>
5#include <linux/types.h> 5#include <linux/types.h>
6#include <linux/version.h>
7 6
8#define HAVE_V4L2 1 7#define HAVE_V4L2 1
9#include <linux/videodev2.h> 8#include <linux/videodev2.h>
@@ -29,7 +28,6 @@ struct video_device
29 void (*release)(struct video_device *vfd); 28 void (*release)(struct video_device *vfd);
30 29
31 30
32#if 1 /* to be removed in 2.7.x */
33 /* obsolete -- fops->owner is used instead */ 31 /* obsolete -- fops->owner is used instead */
34 struct module *owner; 32 struct module *owner;
35 /* dev->driver_data will be used instead some day. 33 /* dev->driver_data will be used instead some day.
@@ -37,7 +35,6 @@ struct video_device
37 * so the switch over will be transparent for you. 35 * so the switch over will be transparent for you.
38 * Or use {pci|usb}_{get|set}_drvdata() directly. */ 36 * Or use {pci|usb}_{get|set}_drvdata() directly. */
39 void *priv; 37 void *priv;
40#endif
41 38
42 /* for videodev.c intenal usage -- please don't touch */ 39 /* for videodev.c intenal usage -- please don't touch */
43 int users; /* video_exclusive_{open|close} ... */ 40 int users; /* video_exclusive_{open|close} ... */
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index acbfc525576d..f623a33b9abe 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -270,7 +270,6 @@ struct v4l2_timecode
270/* The above is based on SMPTE timecodes */ 270/* The above is based on SMPTE timecodes */
271 271
272 272
273#if 1
274/* 273/*
275 * M P E G C O M P R E S S I O N P A R A M E T E R S 274 * M P E G C O M P R E S S I O N P A R A M E T E R S
276 * 275 *
@@ -357,7 +356,6 @@ struct v4l2_mpeg_compression {
357 /* I don't expect the above being perfect yet ;) */ 356 /* I don't expect the above being perfect yet ;) */
358 __u32 reserved_5[8]; 357 __u32 reserved_5[8];
359}; 358};
360#endif
361 359
362struct v4l2_jpegcompression 360struct v4l2_jpegcompression
363{ 361{
@@ -871,10 +869,8 @@ struct v4l2_streamparm
871#define VIDIOC_ENUM_FMT _IOWR ('V', 2, struct v4l2_fmtdesc) 869#define VIDIOC_ENUM_FMT _IOWR ('V', 2, struct v4l2_fmtdesc)
872#define VIDIOC_G_FMT _IOWR ('V', 4, struct v4l2_format) 870#define VIDIOC_G_FMT _IOWR ('V', 4, struct v4l2_format)
873#define VIDIOC_S_FMT _IOWR ('V', 5, struct v4l2_format) 871#define VIDIOC_S_FMT _IOWR ('V', 5, struct v4l2_format)
874#if 1 /* experimental */
875#define VIDIOC_G_MPEGCOMP _IOR ('V', 6, struct v4l2_mpeg_compression) 872#define VIDIOC_G_MPEGCOMP _IOR ('V', 6, struct v4l2_mpeg_compression)
876#define VIDIOC_S_MPEGCOMP _IOW ('V', 7, struct v4l2_mpeg_compression) 873#define VIDIOC_S_MPEGCOMP _IOW ('V', 7, struct v4l2_mpeg_compression)
877#endif
878#define VIDIOC_REQBUFS _IOWR ('V', 8, struct v4l2_requestbuffers) 874#define VIDIOC_REQBUFS _IOWR ('V', 8, struct v4l2_requestbuffers)
879#define VIDIOC_QUERYBUF _IOWR ('V', 9, struct v4l2_buffer) 875#define VIDIOC_QUERYBUF _IOWR ('V', 9, struct v4l2_buffer)
880#define VIDIOC_G_FBUF _IOR ('V', 10, struct v4l2_framebuffer) 876#define VIDIOC_G_FBUF _IOR ('V', 10, struct v4l2_framebuffer)
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 542dbaee6512..343d883d69c5 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -109,8 +109,6 @@ int pdflush_operation(void (*fn)(unsigned long), unsigned long arg0);
109int do_writepages(struct address_space *mapping, struct writeback_control *wbc); 109int do_writepages(struct address_space *mapping, struct writeback_control *wbc);
110int sync_page_range(struct inode *inode, struct address_space *mapping, 110int sync_page_range(struct inode *inode, struct address_space *mapping,
111 loff_t pos, size_t count); 111 loff_t pos, size_t count);
112int sync_page_range_nolock(struct inode *inode, struct address_space
113 *mapping, loff_t pos, size_t count);
114 112
115/* pdflush.c */ 113/* pdflush.c */
116extern int nr_pdflush_threads; /* Global so it can be exported to sysctl 114extern int nr_pdflush_threads; /* Global so it can be exported to sysctl
diff --git a/include/media/audiochip.h b/include/media/audiochip.h
index cd831168fdc1..a7ceee9fc5e9 100644
--- a/include/media/audiochip.h
+++ b/include/media/audiochip.h
@@ -1,5 +1,4 @@
1/* 1/*
2 * $Id: audiochip.h,v 1.5 2005/06/16 22:59:16 hhackmann Exp $
3 */ 2 */
4 3
5#ifndef AUDIOCHIP_H 4#ifndef AUDIOCHIP_H
diff --git a/include/media/id.h b/include/media/id.h
index 801ddef301aa..6d02c94cdc0d 100644
--- a/include/media/id.h
+++ b/include/media/id.h
@@ -1,5 +1,4 @@
1/* 1/*
2 * $Id: id.h,v 1.4 2005/06/12 04:19:19 mchehab Exp $
3 */ 2 */
4 3
5/* FIXME: this temporarely, until these are included in linux/i2c-id.h */ 4/* FIXME: this temporarely, until these are included in linux/i2c-id.h */
diff --git a/include/media/ir-common.h b/include/media/ir-common.h
index 698670547f16..01b56822df4d 100644
--- a/include/media/ir-common.h
+++ b/include/media/ir-common.h
@@ -1,5 +1,4 @@
1/* 1/*
2 * $Id: ir-common.h,v 1.9 2005/05/15 19:01:26 mchehab Exp $
3 * 2 *
4 * some common structs and functions to handle infrared remotes via 3 * some common structs and functions to handle infrared remotes via
5 * input layer ... 4 * input layer ...
@@ -21,11 +20,11 @@
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */ 21 */
23 22
24#include <linux/version.h>
25#include <linux/input.h> 23#include <linux/input.h>
26 24
27 25
28#define IR_TYPE_RC5 1 26#define IR_TYPE_RC5 1
27#define IR_TYPE_PD 2 /* Pulse distance encoded IR */
29#define IR_TYPE_OTHER 99 28#define IR_TYPE_OTHER 99
30 29
31#define IR_KEYTAB_TYPE u32 30#define IR_KEYTAB_TYPE u32
@@ -60,6 +59,7 @@ void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir,
60u32 ir_extract_bits(u32 data, u32 mask); 59u32 ir_extract_bits(u32 data, u32 mask);
61int ir_dump_samples(u32 *samples, int count); 60int ir_dump_samples(u32 *samples, int count);
62int ir_decode_biphase(u32 *samples, int count, int low, int high); 61int ir_decode_biphase(u32 *samples, int count, int low, int high);
62int ir_decode_pulsedistance(u32 *samples, int count, int low, int high);
63 63
64/* 64/*
65 * Local variables: 65 * Local variables:
diff --git a/include/media/saa7146.h b/include/media/saa7146.h
index 3dfb8d670eb7..2a897c3a6a9a 100644
--- a/include/media/saa7146.h
+++ b/include/media/saa7146.h
@@ -1,7 +1,6 @@
1#ifndef __SAA7146__ 1#ifndef __SAA7146__
2#define __SAA7146__ 2#define __SAA7146__
3 3
4#include <linux/version.h> /* for version macros */
5#include <linux/module.h> /* for module-version */ 4#include <linux/module.h> /* for module-version */
6#include <linux/delay.h> /* for delay-stuff */ 5#include <linux/delay.h> /* for delay-stuff */
7#include <linux/slab.h> /* for kmalloc/kfree */ 6#include <linux/slab.h> /* for kmalloc/kfree */
@@ -15,12 +14,7 @@
15#include <linux/vmalloc.h> /* for vmalloc() */ 14#include <linux/vmalloc.h> /* for vmalloc() */
16#include <linux/mm.h> /* for vmalloc_to_page() */ 15#include <linux/mm.h> /* for vmalloc_to_page() */
17 16
18/* ugly, but necessary to build the dvb stuff under 2.4. */ 17#define SAA7146_VERSION_CODE 0x000500 /* 0.5.0 */
19#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,51)
20 #include "dvb_functions.h"
21#endif
22
23#define SAA7146_VERSION_CODE KERNEL_VERSION(0,5,0)
24 18
25#define saa7146_write(sxy,adr,dat) writel((dat),(sxy->mem+(adr))) 19#define saa7146_write(sxy,adr,dat) writel((dat),(sxy->mem+(adr)))
26#define saa7146_read(sxy,adr) readl(sxy->mem+(adr)) 20#define saa7146_read(sxy,adr) readl(sxy->mem+(adr))
@@ -33,13 +27,8 @@ extern unsigned int saa7146_debug;
33 #define DEBUG_VARIABLE saa7146_debug 27 #define DEBUG_VARIABLE saa7146_debug
34#endif 28#endif
35 29
36#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,51)
37#define DEBUG_PROLOG printk("%s: %s(): ",__stringify(KBUILD_BASENAME),__FUNCTION__)
38#define INFO(x) { printk("%s: ",__stringify(KBUILD_BASENAME)); printk x; }
39#else
40#define DEBUG_PROLOG printk("%s: %s(): ",__stringify(KBUILD_MODNAME),__FUNCTION__) 30#define DEBUG_PROLOG printk("%s: %s(): ",__stringify(KBUILD_MODNAME),__FUNCTION__)
41#define INFO(x) { printk("%s: ",__stringify(KBUILD_MODNAME)); printk x; } 31#define INFO(x) { printk("%s: ",__stringify(KBUILD_MODNAME)); printk x; }
42#endif
43 32
44#define ERR(x) { DEBUG_PROLOG; printk x; } 33#define ERR(x) { DEBUG_PROLOG; printk x; }
45 34
diff --git a/include/media/tuner.h b/include/media/tuner.h
index eeaa15ddee85..4ad08e24a1aa 100644
--- a/include/media/tuner.h
+++ b/include/media/tuner.h
@@ -1,6 +1,4 @@
1 1/*
2/* $Id: tuner.h,v 1.45 2005/07/28 18:41:21 mchehab Exp $
3 *
4 tuner.h - definition for different tuners 2 tuner.h - definition for different tuners
5 3
6 Copyright (C) 1997 Markus Schroeder (schroedm@uni-duesseldorf.de) 4 Copyright (C) 1997 Markus Schroeder (schroedm@uni-duesseldorf.de)
@@ -28,88 +26,90 @@
28 26
29#define ADDR_UNSET (255) 27#define ADDR_UNSET (255)
30 28
31#define TUNER_TEMIC_PAL 0 /* 4002 FH5 (3X 7756, 9483) */ 29#define TUNER_TEMIC_PAL 0 /* 4002 FH5 (3X 7756, 9483) */
32#define TUNER_PHILIPS_PAL_I 1 30#define TUNER_PHILIPS_PAL_I 1
33#define TUNER_PHILIPS_NTSC 2 31#define TUNER_PHILIPS_NTSC 2
34#define TUNER_PHILIPS_SECAM 3 /* you must actively select B/G, L, L` */ 32#define TUNER_PHILIPS_SECAM 3 /* you must actively select B/G, L, L` */
35 33
36#define TUNER_ABSENT 4 34#define TUNER_ABSENT 4
37#define TUNER_PHILIPS_PAL 5 35#define TUNER_PHILIPS_PAL 5
38#define TUNER_TEMIC_NTSC 6 /* 4032 FY5 (3X 7004, 9498, 9789) */ 36#define TUNER_TEMIC_NTSC 6 /* 4032 FY5 (3X 7004, 9498, 9789) */
39#define TUNER_TEMIC_PAL_I 7 /* 4062 FY5 (3X 8501, 9957) */ 37#define TUNER_TEMIC_PAL_I 7 /* 4062 FY5 (3X 8501, 9957) */
40 38
41#define TUNER_TEMIC_4036FY5_NTSC 8 /* 4036 FY5 (3X 1223, 1981, 7686) */ 39#define TUNER_TEMIC_4036FY5_NTSC 8 /* 4036 FY5 (3X 1223, 1981, 7686) */
42#define TUNER_ALPS_TSBH1_NTSC 9 40#define TUNER_ALPS_TSBH1_NTSC 9
43#define TUNER_ALPS_TSBE1_PAL 10 41#define TUNER_ALPS_TSBE1_PAL 10
44#define TUNER_ALPS_TSBB5_PAL_I 11 42#define TUNER_ALPS_TSBB5_PAL_I 11
45 43
46#define TUNER_ALPS_TSBE5_PAL 12 44#define TUNER_ALPS_TSBE5_PAL 12
47#define TUNER_ALPS_TSBC5_PAL 13 45#define TUNER_ALPS_TSBC5_PAL 13
48#define TUNER_TEMIC_4006FH5_PAL 14 /* 4006 FH5 (3X 9500, 9501, 7291) */ 46#define TUNER_TEMIC_4006FH5_PAL 14 /* 4006 FH5 (3X 9500, 9501, 7291) */
49#define TUNER_ALPS_TSHC6_NTSC 15 47#define TUNER_ALPS_TSHC6_NTSC 15
50 48
51#define TUNER_TEMIC_PAL_DK 16 /* 4016 FY5 (3X 1392, 1393) */ 49#define TUNER_TEMIC_PAL_DK 16 /* 4016 FY5 (3X 1392, 1393) */
52#define TUNER_PHILIPS_NTSC_M 17 50#define TUNER_PHILIPS_NTSC_M 17
53#define TUNER_TEMIC_4066FY5_PAL_I 18 /* 4066 FY5 (3X 7032, 7035) */ 51#define TUNER_TEMIC_4066FY5_PAL_I 18 /* 4066 FY5 (3X 7032, 7035) */
54#define TUNER_TEMIC_4006FN5_MULTI_PAL 19 /* B/G, I and D/K autodetected (3X 7595, 7606, 7657)*/ 52#define TUNER_TEMIC_4006FN5_MULTI_PAL 19 /* B/G, I and D/K autodetected (3X 7595, 7606, 7657) */
55 53
56#define TUNER_TEMIC_4009FR5_PAL 20 /* incl. FM radio (3X 7607, 7488, 7711)*/ 54#define TUNER_TEMIC_4009FR5_PAL 20 /* incl. FM radio (3X 7607, 7488, 7711) */
57#define TUNER_TEMIC_4039FR5_NTSC 21 /* incl. FM radio (3X 7246, 7578, 7732)*/ 55#define TUNER_TEMIC_4039FR5_NTSC 21 /* incl. FM radio (3X 7246, 7578, 7732) */
58#define TUNER_TEMIC_4046FM5 22 /* you must actively select B/G, D/K, I, L, L` ! (3X 7804, 7806, 8103, 8104)*/ 56#define TUNER_TEMIC_4046FM5 22 /* you must actively select B/G, D/K, I, L, L` ! (3X 7804, 7806, 8103, 8104) */
59#define TUNER_PHILIPS_PAL_DK 23 57#define TUNER_PHILIPS_PAL_DK 23
60 58
61#define TUNER_PHILIPS_FQ1216ME 24 /* you must actively select B/G/D/K, I, L, L` */ 59#define TUNER_PHILIPS_FQ1216ME 24 /* you must actively select B/G/D/K, I, L, L` */
62#define TUNER_LG_PAL_I_FM 25 60#define TUNER_LG_PAL_I_FM 25
63#define TUNER_LG_PAL_I 26 61#define TUNER_LG_PAL_I 26
64#define TUNER_LG_NTSC_FM 27 62#define TUNER_LG_NTSC_FM 27
65 63
66#define TUNER_LG_PAL_FM 28 64#define TUNER_LG_PAL_FM 28
67#define TUNER_LG_PAL 29 65#define TUNER_LG_PAL 29
68#define TUNER_TEMIC_4009FN5_MULTI_PAL_FM 30 /* B/G, I and D/K autodetected (3X 8155, 8160, 8163)*/ 66#define TUNER_TEMIC_4009FN5_MULTI_PAL_FM 30 /* B/G, I and D/K autodetected (3X 8155, 8160, 8163) */
69#define TUNER_SHARP_2U5JF5540_NTSC 31 67#define TUNER_SHARP_2U5JF5540_NTSC 31
70 68
71#define TUNER_Samsung_PAL_TCPM9091PD27 32 69#define TUNER_Samsung_PAL_TCPM9091PD27 32
72#define TUNER_MT2032 33 70#define TUNER_MT2032 33
73#define TUNER_TEMIC_4106FH5 34 /* 4106 FH5 (3X 7808, 7865)*/ 71#define TUNER_TEMIC_4106FH5 34 /* 4106 FH5 (3X 7808, 7865) */
74#define TUNER_TEMIC_4012FY5 35 /* 4012 FY5 (3X 0971, 1099)*/ 72#define TUNER_TEMIC_4012FY5 35 /* 4012 FY5 (3X 0971, 1099) */
75 73
76#define TUNER_TEMIC_4136FY5 36 /* 4136 FY5 (3X 7708, 7746)*/ 74#define TUNER_TEMIC_4136FY5 36 /* 4136 FY5 (3X 7708, 7746) */
77#define TUNER_LG_PAL_NEW_TAPC 37 75#define TUNER_LG_PAL_NEW_TAPC 37
78#define TUNER_PHILIPS_FM1216ME_MK3 38 76#define TUNER_PHILIPS_FM1216ME_MK3 38
79#define TUNER_LG_NTSC_NEW_TAPC 39 77#define TUNER_LG_NTSC_NEW_TAPC 39
80 78
81#define TUNER_HITACHI_NTSC 40 79#define TUNER_HITACHI_NTSC 40
82#define TUNER_PHILIPS_PAL_MK 41 80#define TUNER_PHILIPS_PAL_MK 41
83#define TUNER_PHILIPS_ATSC 42 81#define TUNER_PHILIPS_ATSC 42
84#define TUNER_PHILIPS_FM1236_MK3 43 82#define TUNER_PHILIPS_FM1236_MK3 43
85 83
86#define TUNER_PHILIPS_4IN1 44 /* ATI TV Wonder Pro - Conexant */ 84#define TUNER_PHILIPS_4IN1 44 /* ATI TV Wonder Pro - Conexant */
87/* Microtune mergeged with Temic 12/31/1999 partially financed by Alps - these may be similar to Temic */ 85/* Microtune mergeged with Temic 12/31/1999 partially financed by Alps - these may be similar to Temic */
88#define TUNER_MICROTUNE_4049FM5 45 86#define TUNER_MICROTUNE_4049FM5 45
89#define TUNER_LG_NTSC_TAPE 47 87#define TUNER_MICROTUNE_4042_FI5 46
90 88#define TUNER_LG_NTSC_TAPE 47
91#define TUNER_TNF_8831BGFF 48 89
92#define TUNER_MICROTUNE_4042FI5 49 /* DViCO FusionHDTV 3 Gold-Q - 4042 FI5 (3X 8147) */ 90#define TUNER_TNF_8831BGFF 48
93#define TUNER_TCL_2002N 50 91#define TUNER_MICROTUNE_4042FI5 49 /* DViCO FusionHDTV 3 Gold-Q - 4042 FI5 (3X 8147) */
94#define TUNER_PHILIPS_FM1256_IH3 51 92#define TUNER_TCL_2002N 50
95 93#define TUNER_PHILIPS_FM1256_IH3 51
96#define TUNER_THOMSON_DTT7610 52 94
97#define TUNER_PHILIPS_FQ1286 53 95#define TUNER_THOMSON_DTT7610 52
98#define TUNER_PHILIPS_TDA8290 54 96#define TUNER_PHILIPS_FQ1286 53
99#define TUNER_LG_PAL_TAPE 55 /* Hauppauge PVR-150 PAL */ 97#define TUNER_PHILIPS_TDA8290 54
100 98#define TUNER_LG_PAL_TAPE 55 /* Hauppauge PVR-150 PAL */
101#define TUNER_PHILIPS_FQ1216AME_MK4 56 /* Hauppauge PVR-150 PAL */ 99
102#define TUNER_PHILIPS_FQ1236A_MK4 57 /* Hauppauge PVR-500MCE NTSC */ 100#define TUNER_PHILIPS_FQ1216AME_MK4 56 /* Hauppauge PVR-150 PAL */
103 101#define TUNER_PHILIPS_FQ1236A_MK4 57 /* Hauppauge PVR-500MCE NTSC */
104#define TUNER_YMEC_TVF_8531MF 58 102#define TUNER_YMEC_TVF_8531MF 58
105#define TUNER_YMEC_TVF_5533MF 59 /* Pixelview Pro Ultra NTSC */ 103#define TUNER_YMEC_TVF_5533MF 59 /* Pixelview Pro Ultra NTSC */
106#define TUNER_THOMSON_DTT7611 60 /* DViCO FusionHDTV 3 Gold-T */ 104
107#define TUNER_TENA_9533_DI 61 105#define TUNER_THOMSON_DTT7611 60 /* DViCO FusionHDTV 3 Gold-T */
108 106#define TUNER_TENA_9533_DI 61
109#define TUNER_TEA5767 62 /* Only FM Radio Tuner */ 107#define TUNER_TEA5767 62 /* Only FM Radio Tuner */
110#define TUNER_PHILIPS_FMD1216ME_MK3 63 108#define TUNER_PHILIPS_FMD1216ME_MK3 63
111#define TUNER_LG_TDVS_H062F 64 /* DViCO FusionHDTV 5 */ 109
112#define TUNER_YMEC_TVF66T5_B_DFF 65 /* Acorp Y878F */ 110#define TUNER_LG_TDVS_H062F 64 /* DViCO FusionHDTV 5 */
111#define TUNER_YMEC_TVF66T5_B_DFF 65 /* Acorp Y878F */
112#define TUNER_LG_NTSC_TALN_MINI 66
113 113
114#define NOTUNER 0 114#define NOTUNER 0
115#define PAL 1 /* PAL_BG */ 115#define PAL 1 /* PAL_BG */
@@ -117,7 +117,7 @@
117#define NTSC 3 117#define NTSC 3
118#define SECAM 4 118#define SECAM 4
119#define ATSC 5 119#define ATSC 5
120#define RADIO 6 120#define RADIO 6
121 121
122#define NoTuner 0 122#define NoTuner 0
123#define Philips 1 123#define Philips 1
@@ -134,6 +134,7 @@
134#define THOMSON 12 134#define THOMSON 12
135 135
136#define TUNER_SET_TYPE_ADDR _IOW('T',3,int) 136#define TUNER_SET_TYPE_ADDR _IOW('T',3,int)
137#define TUNER_SET_STANDBY _IOW('T',4,int)
137#define TDA9887_SET_CONFIG _IOW('t',5,int) 138#define TDA9887_SET_CONFIG _IOW('t',5,int)
138 139
139/* tv card specific */ 140/* tv card specific */
@@ -153,9 +154,6 @@
153 154
154#ifdef __KERNEL__ 155#ifdef __KERNEL__
155 156
156#define I2C_ADDR_TDA8290 0x4b
157#define I2C_ADDR_TDA8275 0x61
158
159enum tuner_mode { 157enum tuner_mode {
160 T_UNINITIALIZED = 0, 158 T_UNINITIALIZED = 0,
161 T_RADIO = 1 << V4L2_TUNER_RADIO, 159 T_RADIO = 1 << V4L2_TUNER_RADIO,
@@ -165,21 +163,21 @@ enum tuner_mode {
165}; 163};
166 164
167struct tuner_setup { 165struct tuner_setup {
168 unsigned short addr; 166 unsigned short addr;
169 unsigned int type; 167 unsigned int type;
170 unsigned int mode_mask; 168 unsigned int mode_mask;
171}; 169};
172 170
173struct tuner { 171struct tuner {
174 /* device */ 172 /* device */
175 struct i2c_client i2c; 173 struct i2c_client i2c;
176 174
177 unsigned int type; /* chip type */ 175 unsigned int type; /* chip type */
178 176
179 unsigned int mode; 177 unsigned int mode;
180 unsigned int mode_mask; /* Combination of allowable modes */ 178 unsigned int mode_mask; /* Combination of allowable modes */
181 179
182 unsigned int freq; /* keep track of the current settings */ 180 unsigned int freq; /* keep track of the current settings */
183 unsigned int audmode; 181 unsigned int audmode;
184 v4l2_std_id std; 182 v4l2_std_id std;
185 183
@@ -198,6 +196,7 @@ struct tuner {
198 void (*radio_freq)(struct i2c_client *c, unsigned int freq); 196 void (*radio_freq)(struct i2c_client *c, unsigned int freq);
199 int (*has_signal)(struct i2c_client *c); 197 int (*has_signal)(struct i2c_client *c);
200 int (*is_stereo)(struct i2c_client *c); 198 int (*is_stereo)(struct i2c_client *c);
199 void (*standby)(struct i2c_client *c);
201}; 200};
202 201
203extern unsigned int tuner_debug; 202extern unsigned int tuner_debug;
@@ -209,16 +208,20 @@ extern int tea5767_tuner_init(struct i2c_client *c);
209extern int default_tuner_init(struct i2c_client *c); 208extern int default_tuner_init(struct i2c_client *c);
210extern int tea5767_autodetection(struct i2c_client *c); 209extern int tea5767_autodetection(struct i2c_client *c);
211 210
212#define tuner_warn(fmt, arg...) \ 211#define tuner_warn(fmt, arg...) do {\
213 dev_printk(KERN_WARNING , &t->i2c.dev , fmt , ## arg) 212 printk(KERN_WARNING "%s %d-%04x: " fmt, t->i2c.driver->name, \
214#define tuner_info(fmt, arg...) \ 213 t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0)
215 dev_printk(KERN_INFO , &t->i2c.dev , fmt , ## arg) 214#define tuner_info(fmt, arg...) do {\
216#define tuner_dbg(fmt, arg...) \ 215 printk(KERN_INFO "%s %d-%04x: " fmt, t->i2c.driver->name, \
217 if (tuner_debug) dev_printk(KERN_DEBUG , &t->i2c.dev , fmt , ## arg) 216 t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0)
217#define tuner_dbg(fmt, arg...) do {\
218 if (tuner_debug) \
219 printk(KERN_DEBUG "%s %d-%04x: " fmt, t->i2c.driver->name, \
220 t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0)
218 221
219#endif /* __KERNEL__ */ 222#endif /* __KERNEL__ */
220 223
221#endif 224#endif /* _TUNER_H */
222 225
223/* 226/*
224 * Overrides for Emacs so that we follow Linus's tabbing style. 227 * Overrides for Emacs so that we follow Linus's tabbing style.
diff --git a/include/media/tveeprom.h b/include/media/tveeprom.h
index 854a2c2f105b..e2035c7da094 100644
--- a/include/media/tveeprom.h
+++ b/include/media/tveeprom.h
@@ -1,18 +1,21 @@
1/* 1/*
2 * $Id: tveeprom.h,v 1.2 2005/06/12 04:19:19 mchehab Exp $
3 */ 2 */
4 3
5struct tveeprom { 4struct tveeprom {
6 u32 has_radio; 5 u32 has_radio;
6 u32 has_ir; /* 0: no IR, 1: IR present, 2: unknown */
7 7
8 u32 tuner_type; 8 u32 tuner_type;
9 u32 tuner_formats; 9 u32 tuner_formats;
10 10
11 u32 tuner2_type;
12 u32 tuner2_formats;
13
11 u32 digitizer; 14 u32 digitizer;
12 u32 digitizer_formats; 15 u32 digitizer_formats;
13 16
14 u32 audio_processor; 17 u32 audio_processor;
15 /* a_p_fmts? */ 18 u32 decoder_processor;
16 19
17 u32 model; 20 u32 model;
18 u32 revision; 21 u32 revision;
@@ -20,7 +23,7 @@ struct tveeprom {
20 char rev_str[5]; 23 char rev_str[5];
21}; 24};
22 25
23void tveeprom_hauppauge_analog(struct tveeprom *tvee, 26void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
24 unsigned char *eeprom_data); 27 unsigned char *eeprom_data);
25 28
26int tveeprom_read(struct i2c_client *c, unsigned char *eedata, int len); 29int tveeprom_read(struct i2c_client *c, unsigned char *eedata, int len);
diff --git a/include/media/video-buf.h b/include/media/video-buf.h
index ae6da6de98de..ae8d7a000440 100644
--- a/include/media/video-buf.h
+++ b/include/media/video-buf.h
@@ -1,5 +1,4 @@
1/* 1/*
2 * $Id: video-buf.h,v 1.9 2004/11/07 13:17:15 kraxel Exp $
3 * 2 *
4 * generic helper functions for video4linux capture buffers, to handle 3 * generic helper functions for video4linux capture buffers, to handle
5 * memory management and PCI DMA. Right now bttv + saa7134 use it. 4 * memory management and PCI DMA. Right now bttv + saa7134 use it.
diff --git a/include/net/ax25.h b/include/net/ax25.h
index 364b046e9f47..9dbcd9e51c00 100644
--- a/include/net/ax25.h
+++ b/include/net/ax25.h
@@ -26,11 +26,20 @@
26 26
27/* AX.25 Protocol IDs */ 27/* AX.25 Protocol IDs */
28#define AX25_P_ROSE 0x01 28#define AX25_P_ROSE 0x01
29#define AX25_P_IP 0xCC 29#define AX25_P_VJCOMP 0x06 /* Compressed TCP/IP packet */
30#define AX25_P_ARP 0xCD 30 /* Van Jacobsen (RFC 1144) */
31#define AX25_P_TEXT 0xF0 31#define AX25_P_VJUNCOMP 0x07 /* Uncompressed TCP/IP packet */
32#define AX25_P_NETROM 0xCF 32 /* Van Jacobsen (RFC 1144) */
33#define AX25_P_SEGMENT 0x08 33#define AX25_P_SEGMENT 0x08 /* Segmentation fragment */
34#define AX25_P_TEXNET 0xc3 /* TEXTNET datagram protocol */
35#define AX25_P_LQ 0xc4 /* Link Quality Protocol */
36#define AX25_P_ATALK 0xca /* Appletalk */
37#define AX25_P_ATALK_ARP 0xcb /* Appletalk ARP */
38#define AX25_P_IP 0xcc /* ARPA Internet Protocol */
39#define AX25_P_ARP 0xcd /* ARPA Adress Resolution */
40#define AX25_P_FLEXNET 0xce /* FlexNet */
41#define AX25_P_NETROM 0xcf /* NET/ROM */
42#define AX25_P_TEXT 0xF0 /* No layer 3 protocol impl. */
34 43
35/* AX.25 Segment control values */ 44/* AX.25 Segment control values */
36#define AX25_SEG_REM 0x7F 45#define AX25_SEG_REM 0x7F
@@ -88,11 +97,11 @@
88/* Define Link State constants. */ 97/* Define Link State constants. */
89 98
90enum { 99enum {
91 AX25_STATE_0, 100 AX25_STATE_0, /* Listening */
92 AX25_STATE_1, 101 AX25_STATE_1, /* SABM sent */
93 AX25_STATE_2, 102 AX25_STATE_2, /* DISC sent */
94 AX25_STATE_3, 103 AX25_STATE_3, /* Established */
95 AX25_STATE_4 104 AX25_STATE_4 /* Recovery */
96}; 105};
97 106
98#define AX25_MODULUS 8 /* Standard AX.25 modulus */ 107#define AX25_MODULUS 8 /* Standard AX.25 modulus */
@@ -258,7 +267,7 @@ extern struct sock *ax25_make_new(struct sock *, struct ax25_dev *);
258/* ax25_addr.c */ 267/* ax25_addr.c */
259extern ax25_address null_ax25_address; 268extern ax25_address null_ax25_address;
260extern char *ax2asc(char *buf, ax25_address *); 269extern char *ax2asc(char *buf, ax25_address *);
261extern ax25_address *asc2ax(char *); 270extern void asc2ax(ax25_address *addr, char *callsign);
262extern int ax25cmp(ax25_address *, ax25_address *); 271extern int ax25cmp(ax25_address *, ax25_address *);
263extern int ax25digicmp(ax25_digi *, ax25_digi *); 272extern int ax25digicmp(ax25_digi *, ax25_digi *);
264extern unsigned char *ax25_addr_parse(unsigned char *, int, ax25_address *, ax25_address *, ax25_digi *, int *, int *); 273extern unsigned char *ax25_addr_parse(unsigned char *, int, ax25_address *, ax25_address *, ax25_digi *, int *, int *);
@@ -319,7 +328,7 @@ extern int ax25_rx_iframe(ax25_cb *, struct sk_buff *);
319extern int ax25_kiss_rcv(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *); 328extern int ax25_kiss_rcv(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *);
320 329
321/* ax25_ip.c */ 330/* ax25_ip.c */
322extern int ax25_encapsulate(struct sk_buff *, struct net_device *, unsigned short, void *, void *, unsigned int); 331extern int ax25_hard_header(struct sk_buff *, struct net_device *, unsigned short, void *, void *, unsigned int);
323extern int ax25_rebuild_header(struct sk_buff *); 332extern int ax25_rebuild_header(struct sk_buff *);
324 333
325/* ax25_out.c */ 334/* ax25_out.c */
diff --git a/include/net/compat.h b/include/net/compat.h
index 9983fd857804..290bab46d457 100644
--- a/include/net/compat.h
+++ b/include/net/compat.h
@@ -33,7 +33,8 @@ extern asmlinkage long compat_sys_sendmsg(int,struct compat_msghdr __user *,unsi
33extern asmlinkage long compat_sys_recvmsg(int,struct compat_msghdr __user *,unsigned); 33extern asmlinkage long compat_sys_recvmsg(int,struct compat_msghdr __user *,unsigned);
34extern asmlinkage long compat_sys_getsockopt(int, int, int, char __user *, int __user *); 34extern asmlinkage long compat_sys_getsockopt(int, int, int, char __user *, int __user *);
35extern int put_cmsg_compat(struct msghdr*, int, int, int, void *); 35extern int put_cmsg_compat(struct msghdr*, int, int, int, void *);
36extern int cmsghdr_from_user_compat_to_kern(struct msghdr *, unsigned char *, 36
37 int); 37struct sock;
38extern int cmsghdr_from_user_compat_to_kern(struct msghdr *, struct sock *, unsigned char *, int);
38 39
39#endif /* NET_COMPAT_H */ 40#endif /* NET_COMPAT_H */
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 3203eaff4bd4..65ec86678a08 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -233,6 +233,10 @@ extern int ip6_ra_control(struct sock *sk, int sel,
233extern int ipv6_parse_hopopts(struct sk_buff *skb, int); 233extern int ipv6_parse_hopopts(struct sk_buff *skb, int);
234 234
235extern struct ipv6_txoptions * ipv6_dup_options(struct sock *sk, struct ipv6_txoptions *opt); 235extern struct ipv6_txoptions * ipv6_dup_options(struct sock *sk, struct ipv6_txoptions *opt);
236extern struct ipv6_txoptions * ipv6_renew_options(struct sock *sk, struct ipv6_txoptions *opt,
237 int newtype,
238 struct ipv6_opt_hdr __user *newopt,
239 int newoptlen);
236 240
237extern int ip6_frag_nqueues; 241extern int ip6_frag_nqueues;
238extern atomic_t ip6_frag_mem; 242extern atomic_t ip6_frag_mem;
@@ -373,6 +377,7 @@ extern int ip6_append_data(struct sock *sk,
373 int length, 377 int length,
374 int transhdrlen, 378 int transhdrlen,
375 int hlimit, 379 int hlimit,
380 int tclass,
376 struct ipv6_txoptions *opt, 381 struct ipv6_txoptions *opt,
377 struct flowi *fl, 382 struct flowi *fl,
378 struct rt6_info *rt, 383 struct rt6_info *rt,
diff --git a/include/net/netrom.h b/include/net/netrom.h
index 45f2c7616d8b..a6bf6e0f606a 100644
--- a/include/net/netrom.h
+++ b/include/net/netrom.h
@@ -6,6 +6,7 @@
6 6
7#ifndef _NETROM_H 7#ifndef _NETROM_H
8#define _NETROM_H 8#define _NETROM_H
9
9#include <linux/netrom.h> 10#include <linux/netrom.h>
10#include <linux/list.h> 11#include <linux/list.h>
11#include <net/sock.h> 12#include <net/sock.h>
@@ -22,6 +23,7 @@
22#define NR_DISCACK 0x04 23#define NR_DISCACK 0x04
23#define NR_INFO 0x05 24#define NR_INFO 0x05
24#define NR_INFOACK 0x06 25#define NR_INFOACK 0x06
26#define NR_RESET 0x07
25 27
26#define NR_CHOKE_FLAG 0x80 28#define NR_CHOKE_FLAG 0x80
27#define NR_NAK_FLAG 0x40 29#define NR_NAK_FLAG 0x40
@@ -51,11 +53,16 @@ enum {
51#define NR_DEFAULT_TTL 16 /* Default Time To Live - 16 */ 53#define NR_DEFAULT_TTL 16 /* Default Time To Live - 16 */
52#define NR_DEFAULT_ROUTING 1 /* Is routing enabled ? */ 54#define NR_DEFAULT_ROUTING 1 /* Is routing enabled ? */
53#define NR_DEFAULT_FAILS 2 /* Link fails until route fails */ 55#define NR_DEFAULT_FAILS 2 /* Link fails until route fails */
56#define NR_DEFAULT_RESET 0 /* Sent / accept reset cmds? */
54 57
55#define NR_MODULUS 256 58#define NR_MODULUS 256
56#define NR_MAX_WINDOW_SIZE 127 /* Maximum Window Allowable - 127 */ 59#define NR_MAX_WINDOW_SIZE 127 /* Maximum Window Allowable - 127 */
57#define NR_MAX_PACKET_SIZE 236 /* Maximum Packet Length - 236 */ 60#define NR_MAX_PACKET_SIZE 236 /* Maximum Packet Length - 236 */
58 61
62struct nr_private {
63 struct net_device_stats stats;
64};
65
59struct nr_sock { 66struct nr_sock {
60 struct sock sock; 67 struct sock sock;
61 ax25_address user_addr, source_addr, dest_addr; 68 ax25_address user_addr, source_addr, dest_addr;
@@ -176,6 +183,8 @@ extern int sysctl_netrom_transport_requested_window_size;
176extern int sysctl_netrom_transport_no_activity_timeout; 183extern int sysctl_netrom_transport_no_activity_timeout;
177extern int sysctl_netrom_routing_control; 184extern int sysctl_netrom_routing_control;
178extern int sysctl_netrom_link_fails_count; 185extern int sysctl_netrom_link_fails_count;
186extern int sysctl_netrom_reset_circuit;
187
179extern int nr_rx_frame(struct sk_buff *, struct net_device *); 188extern int nr_rx_frame(struct sk_buff *, struct net_device *);
180extern void nr_destroy_socket(struct sock *); 189extern void nr_destroy_socket(struct sock *);
181 190
@@ -218,7 +227,28 @@ extern void nr_requeue_frames(struct sock *);
218extern int nr_validate_nr(struct sock *, unsigned short); 227extern int nr_validate_nr(struct sock *, unsigned short);
219extern int nr_in_rx_window(struct sock *, unsigned short); 228extern int nr_in_rx_window(struct sock *, unsigned short);
220extern void nr_write_internal(struct sock *, int); 229extern void nr_write_internal(struct sock *, int);
221extern void nr_transmit_refusal(struct sk_buff *, int); 230
231extern void __nr_transmit_reply(struct sk_buff *skb, int mine,
232 unsigned char cmdflags);
233
234/*
235 * This routine is called when a Connect Acknowledge with the Choke Flag
236 * set is needed to refuse a connection.
237 */
238#define nr_transmit_refusal(skb, mine) \
239do { \
240 __nr_transmit_reply((skb), (mine), NR_CONNACK | NR_CHOKE_FLAG); \
241} while (0)
242
243/*
244 * This routine is called when we don't have a circuit matching an incoming
245 * NET/ROM packet. This is an G8PZT Xrouter extension.
246 */
247#define nr_transmit_reset(skb, mine) \
248do { \
249 __nr_transmit_reply((skb), (mine), NR_RESET); \
250} while (0)
251
222extern void nr_disconnect(struct sock *, int); 252extern void nr_disconnect(struct sock *, int);
223 253
224/* nr_timer.c */ 254/* nr_timer.c */
diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h
index 8b075ab7a26c..4e86f2de6638 100644
--- a/include/net/transp_v6.h
+++ b/include/net/transp_v6.h
@@ -37,7 +37,7 @@ extern int datagram_recv_ctl(struct sock *sk,
37extern int datagram_send_ctl(struct msghdr *msg, 37extern int datagram_send_ctl(struct msghdr *msg,
38 struct flowi *fl, 38 struct flowi *fl,
39 struct ipv6_txoptions *opt, 39 struct ipv6_txoptions *opt,
40 int *hlimit); 40 int *hlimit, int *tclass);
41 41
42#define LOOPBACK4_IPV6 __constant_htonl(0x7f000006) 42#define LOOPBACK4_IPV6 __constant_htonl(0x7f000006)
43 43
diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h
index b707a603351b..cb8b6e6ce66c 100644
--- a/include/pcmcia/ds.h
+++ b/include/pcmcia/ds.h
@@ -151,6 +151,8 @@ struct pcmcia_device {
151 uniquely define a pcmcia_device */ 151 uniquely define a pcmcia_device */
152 struct pcmcia_socket *socket; 152 struct pcmcia_socket *socket;
153 153
154 char *devname;
155
154 u8 device_no; 156 u8 device_no;
155 157
156 /* the hardware "function" device; certain subdevices can 158 /* the hardware "function" device; certain subdevices can
diff --git a/include/rdma/ib_cm.h b/include/rdma/ib_cm.h
index 77fe9039209b..5308683c8c41 100644
--- a/include/rdma/ib_cm.h
+++ b/include/rdma/ib_cm.h
@@ -290,6 +290,7 @@ struct ib_cm_id {
290 enum ib_cm_lap_state lap_state; /* internal CM/debug use */ 290 enum ib_cm_lap_state lap_state; /* internal CM/debug use */
291 __be32 local_id; 291 __be32 local_id;
292 __be32 remote_id; 292 __be32 remote_id;
293 u32 remote_cm_qpn; /* 1 unless redirected */
293}; 294};
294 295
295/** 296/**
diff --git a/include/rdma/ib_mad.h b/include/rdma/ib_mad.h
index fc6b1c18ffc6..53184a38fdf6 100644
--- a/include/rdma/ib_mad.h
+++ b/include/rdma/ib_mad.h
@@ -173,6 +173,27 @@ struct ib_vendor_mad {
173 u8 data[216]; 173 u8 data[216];
174}; 174};
175 175
176struct ib_class_port_info
177{
178 u8 base_version;
179 u8 class_version;
180 __be16 capability_mask;
181 u8 reserved[3];
182 u8 resp_time_value;
183 u8 redirect_gid[16];
184 __be32 redirect_tcslfl;
185 __be16 redirect_lid;
186 __be16 redirect_pkey;
187 __be32 redirect_qp;
188 __be32 redirect_qkey;
189 u8 trap_gid[16];
190 __be32 trap_tcslfl;
191 __be16 trap_lid;
192 __be16 trap_pkey;
193 __be32 trap_hlqp;
194 __be32 trap_qkey;
195};
196
176/** 197/**
177 * ib_mad_send_buf - MAD data buffer and work request for sends. 198 * ib_mad_send_buf - MAD data buffer and work request for sends.
178 * @mad: References an allocated MAD data buffer. The size of the data 199 * @mad: References an allocated MAD data buffer. The size of the data
diff --git a/include/rdma/ib_sa.h b/include/rdma/ib_sa.h
index c022edfc49da..a7555c800ecf 100644
--- a/include/rdma/ib_sa.h
+++ b/include/rdma/ib_sa.h
@@ -46,7 +46,36 @@ enum {
46 46
47 IB_SA_METHOD_GET_TABLE = 0x12, 47 IB_SA_METHOD_GET_TABLE = 0x12,
48 IB_SA_METHOD_GET_TABLE_RESP = 0x92, 48 IB_SA_METHOD_GET_TABLE_RESP = 0x92,
49 IB_SA_METHOD_DELETE = 0x15 49 IB_SA_METHOD_DELETE = 0x15,
50 IB_SA_METHOD_DELETE_RESP = 0x95,
51 IB_SA_METHOD_GET_MULTI = 0x14,
52 IB_SA_METHOD_GET_MULTI_RESP = 0x94,
53 IB_SA_METHOD_GET_TRACE_TBL = 0x13
54};
55
56enum {
57 IB_SA_ATTR_CLASS_PORTINFO = 0x01,
58 IB_SA_ATTR_NOTICE = 0x02,
59 IB_SA_ATTR_INFORM_INFO = 0x03,
60 IB_SA_ATTR_NODE_REC = 0x11,
61 IB_SA_ATTR_PORT_INFO_REC = 0x12,
62 IB_SA_ATTR_SL2VL_REC = 0x13,
63 IB_SA_ATTR_SWITCH_REC = 0x14,
64 IB_SA_ATTR_LINEAR_FDB_REC = 0x15,
65 IB_SA_ATTR_RANDOM_FDB_REC = 0x16,
66 IB_SA_ATTR_MCAST_FDB_REC = 0x17,
67 IB_SA_ATTR_SM_INFO_REC = 0x18,
68 IB_SA_ATTR_LINK_REC = 0x20,
69 IB_SA_ATTR_GUID_INFO_REC = 0x30,
70 IB_SA_ATTR_SERVICE_REC = 0x31,
71 IB_SA_ATTR_PARTITION_REC = 0x33,
72 IB_SA_ATTR_PATH_REC = 0x35,
73 IB_SA_ATTR_VL_ARB_REC = 0x36,
74 IB_SA_ATTR_MC_MEMBER_REC = 0x38,
75 IB_SA_ATTR_TRACE_REC = 0x39,
76 IB_SA_ATTR_MULTI_PATH_REC = 0x3a,
77 IB_SA_ATTR_SERVICE_ASSOC_REC = 0x3b,
78 IB_SA_ATTR_INFORM_INFO_REC = 0xf3
50}; 79};
51 80
52enum ib_sa_selector { 81enum ib_sa_selector {
diff --git a/include/rdma/ib_user_cm.h b/include/rdma/ib_user_cm.h
index 72182d16778b..e4d1654276ad 100644
--- a/include/rdma/ib_user_cm.h
+++ b/include/rdma/ib_user_cm.h
@@ -1,5 +1,6 @@
1/* 1/*
2 * Copyright (c) 2005 Topspin Communications. All rights reserved. 2 * Copyright (c) 2005 Topspin Communications. All rights reserved.
3 * Copyright (c) 2005 Intel Corporation. All rights reserved.
3 * 4 *
4 * This software is available to you under a choice of one of two 5 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU 6 * licenses. You may choose to be licensed under the terms of the GNU
@@ -37,7 +38,7 @@
37 38
38#include <linux/types.h> 39#include <linux/types.h>
39 40
40#define IB_USER_CM_ABI_VERSION 1 41#define IB_USER_CM_ABI_VERSION 2
41 42
42enum { 43enum {
43 IB_USER_CM_CMD_CREATE_ID, 44 IB_USER_CM_CMD_CREATE_ID,
@@ -60,6 +61,7 @@ enum {
60 IB_USER_CM_CMD_SEND_SIDR_REP, 61 IB_USER_CM_CMD_SEND_SIDR_REP,
61 62
62 IB_USER_CM_CMD_EVENT, 63 IB_USER_CM_CMD_EVENT,
64 IB_USER_CM_CMD_INIT_QP_ATTR,
63}; 65};
64/* 66/*
65 * command ABI structures. 67 * command ABI structures.
@@ -71,6 +73,7 @@ struct ib_ucm_cmd_hdr {
71}; 73};
72 74
73struct ib_ucm_create_id { 75struct ib_ucm_create_id {
76 __u64 uid;
74 __u64 response; 77 __u64 response;
75}; 78};
76 79
@@ -79,9 +82,14 @@ struct ib_ucm_create_id_resp {
79}; 82};
80 83
81struct ib_ucm_destroy_id { 84struct ib_ucm_destroy_id {
85 __u64 response;
82 __u32 id; 86 __u32 id;
83}; 87};
84 88
89struct ib_ucm_destroy_id_resp {
90 __u32 events_reported;
91};
92
85struct ib_ucm_attr_id { 93struct ib_ucm_attr_id {
86 __u64 response; 94 __u64 response;
87 __u32 id; 95 __u32 id;
@@ -94,6 +102,64 @@ struct ib_ucm_attr_id_resp {
94 __be32 remote_id; 102 __be32 remote_id;
95}; 103};
96 104
105struct ib_ucm_init_qp_attr {
106 __u64 response;
107 __u32 id;
108 __u32 qp_state;
109};
110
111struct ib_ucm_ah_attr {
112 __u8 grh_dgid[16];
113 __u32 grh_flow_label;
114 __u16 dlid;
115 __u16 reserved;
116 __u8 grh_sgid_index;
117 __u8 grh_hop_limit;
118 __u8 grh_traffic_class;
119 __u8 sl;
120 __u8 src_path_bits;
121 __u8 static_rate;
122 __u8 is_global;
123 __u8 port_num;
124};
125
126struct ib_ucm_init_qp_attr_resp {
127 __u32 qp_attr_mask;
128 __u32 qp_state;
129 __u32 cur_qp_state;
130 __u32 path_mtu;
131 __u32 path_mig_state;
132 __u32 qkey;
133 __u32 rq_psn;
134 __u32 sq_psn;
135 __u32 dest_qp_num;
136 __u32 qp_access_flags;
137
138 struct ib_ucm_ah_attr ah_attr;
139 struct ib_ucm_ah_attr alt_ah_attr;
140
141 /* ib_qp_cap */
142 __u32 max_send_wr;
143 __u32 max_recv_wr;
144 __u32 max_send_sge;
145 __u32 max_recv_sge;
146 __u32 max_inline_data;
147
148 __u16 pkey_index;
149 __u16 alt_pkey_index;
150 __u8 en_sqd_async_notify;
151 __u8 sq_draining;
152 __u8 max_rd_atomic;
153 __u8 max_dest_rd_atomic;
154 __u8 min_rnr_timer;
155 __u8 port_num;
156 __u8 timeout;
157 __u8 retry_cnt;
158 __u8 rnr_retry;
159 __u8 alt_port_num;
160 __u8 alt_timeout;
161};
162
97struct ib_ucm_listen { 163struct ib_ucm_listen {
98 __be64 service_id; 164 __be64 service_id;
99 __be64 service_mask; 165 __be64 service_mask;
@@ -157,6 +223,7 @@ struct ib_ucm_req {
157}; 223};
158 224
159struct ib_ucm_rep { 225struct ib_ucm_rep {
226 __u64 uid;
160 __u64 data; 227 __u64 data;
161 __u32 id; 228 __u32 id;
162 __u32 qpn; 229 __u32 qpn;
@@ -232,7 +299,6 @@ struct ib_ucm_event_get {
232}; 299};
233 300
234struct ib_ucm_req_event_resp { 301struct ib_ucm_req_event_resp {
235 __u32 listen_id;
236 /* device */ 302 /* device */
237 /* port */ 303 /* port */
238 struct ib_ucm_path_rec primary_path; 304 struct ib_ucm_path_rec primary_path;
@@ -287,7 +353,6 @@ struct ib_ucm_apr_event_resp {
287}; 353};
288 354
289struct ib_ucm_sidr_req_event_resp { 355struct ib_ucm_sidr_req_event_resp {
290 __u32 listen_id;
291 /* device */ 356 /* device */
292 /* port */ 357 /* port */
293 __u16 pkey; 358 __u16 pkey;
@@ -307,6 +372,7 @@ struct ib_ucm_sidr_rep_event_resp {
307#define IB_UCM_PRES_ALTERNATE 0x08 372#define IB_UCM_PRES_ALTERNATE 0x08
308 373
309struct ib_ucm_event_resp { 374struct ib_ucm_event_resp {
375 __u64 uid;
310 __u32 id; 376 __u32 id;
311 __u32 event; 377 __u32 event;
312 __u32 present; 378 __u32 present;
diff --git a/include/rdma/ib_user_verbs.h b/include/rdma/ib_user_verbs.h
index 7ebb01c8f996..fd85725391a4 100644
--- a/include/rdma/ib_user_verbs.h
+++ b/include/rdma/ib_user_verbs.h
@@ -42,7 +42,7 @@
42 * Increment this value if any changes that break userspace ABI 42 * Increment this value if any changes that break userspace ABI
43 * compatibility are made. 43 * compatibility are made.
44 */ 44 */
45#define IB_USER_VERBS_ABI_VERSION 1 45#define IB_USER_VERBS_ABI_VERSION 2
46 46
47enum { 47enum {
48 IB_USER_VERBS_CMD_QUERY_PARAMS, 48 IB_USER_VERBS_CMD_QUERY_PARAMS,
@@ -292,7 +292,14 @@ struct ib_uverbs_create_cq_resp {
292}; 292};
293 293
294struct ib_uverbs_destroy_cq { 294struct ib_uverbs_destroy_cq {
295 __u64 response;
295 __u32 cq_handle; 296 __u32 cq_handle;
297 __u32 reserved;
298};
299
300struct ib_uverbs_destroy_cq_resp {
301 __u32 comp_events_reported;
302 __u32 async_events_reported;
296}; 303};
297 304
298struct ib_uverbs_create_qp { 305struct ib_uverbs_create_qp {
@@ -372,7 +379,13 @@ struct ib_uverbs_modify_qp_resp {
372}; 379};
373 380
374struct ib_uverbs_destroy_qp { 381struct ib_uverbs_destroy_qp {
382 __u64 response;
375 __u32 qp_handle; 383 __u32 qp_handle;
384 __u32 reserved;
385};
386
387struct ib_uverbs_destroy_qp_resp {
388 __u32 events_reported;
376}; 389};
377 390
378struct ib_uverbs_attach_mcast { 391struct ib_uverbs_attach_mcast {
@@ -416,7 +429,13 @@ struct ib_uverbs_modify_srq {
416}; 429};
417 430
418struct ib_uverbs_destroy_srq { 431struct ib_uverbs_destroy_srq {
432 __u64 response;
419 __u32 srq_handle; 433 __u32 srq_handle;
434 __u32 reserved;
435};
436
437struct ib_uverbs_destroy_srq_resp {
438 __u32 events_reported;
420}; 439};
421 440
422#endif /* IB_USER_VERBS_H */ 441#endif /* IB_USER_VERBS_H */
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index da63722c0123..c0e4c67d836f 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -178,8 +178,8 @@ static inline struct scsi_target *scsi_target(struct scsi_device *sdev)
178 178
179extern struct scsi_device *__scsi_add_device(struct Scsi_Host *, 179extern struct scsi_device *__scsi_add_device(struct Scsi_Host *,
180 uint, uint, uint, void *hostdata); 180 uint, uint, uint, void *hostdata);
181#define scsi_add_device(host, channel, target, lun) \ 181extern int scsi_add_device(struct Scsi_Host *host, uint channel,
182 __scsi_add_device(host, channel, target, lun, NULL) 182 uint target, uint lun);
183extern void scsi_remove_device(struct scsi_device *); 183extern void scsi_remove_device(struct scsi_device *);
184extern int scsi_device_cancel(struct scsi_device *, int); 184extern int scsi_device_cancel(struct scsi_device *, int);
185 185
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index 70ad16315a16..115db056dc6b 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -439,4 +439,12 @@ int fc_remote_port_block(struct fc_rport *rport);
439void fc_remote_port_unblock(struct fc_rport *rport); 439void fc_remote_port_unblock(struct fc_rport *rport);
440int scsi_is_fc_rport(const struct device *); 440int scsi_is_fc_rport(const struct device *);
441 441
442static inline u64 wwn_to_u64(u8 *wwn)
443{
444 return (u64)wwn[0] << 56 | (u64)wwn[1] << 48 |
445 (u64)wwn[2] << 40 | (u64)wwn[3] << 32 |
446 (u64)wwn[4] << 24 | (u64)wwn[5] << 16 |
447 (u64)wwn[6] << 8 | (u64)wwn[7];
448}
449
442#endif /* SCSI_TRANSPORT_FC_H */ 450#endif /* SCSI_TRANSPORT_FC_H */
diff --git a/include/scsi/scsi_transport_sas.h b/include/scsi/scsi_transport_sas.h
new file mode 100644
index 000000000000..bc4aeb660dd3
--- /dev/null
+++ b/include/scsi/scsi_transport_sas.h
@@ -0,0 +1,100 @@
1#ifndef SCSI_TRANSPORT_SAS_H
2#define SCSI_TRANSPORT_SAS_H
3
4#include <linux/transport_class.h>
5#include <linux/types.h>
6
7struct scsi_transport_template;
8struct sas_rphy;
9
10
11enum sas_device_type {
12 SAS_PHY_UNUSED,
13 SAS_END_DEVICE,
14 SAS_EDGE_EXPANDER_DEVICE,
15 SAS_FANOUT_EXPANDER_DEVICE,
16};
17
18enum sas_protocol {
19 SAS_PROTOCOL_SATA = 0x01,
20 SAS_PROTOCOL_SMP = 0x02,
21 SAS_PROTOCOL_STP = 0x04,
22 SAS_PROTOCOL_SSP = 0x08,
23};
24
25enum sas_linkrate {
26 SAS_LINK_RATE_UNKNOWN,
27 SAS_PHY_DISABLED,
28 SAS_LINK_RATE_FAILED,
29 SAS_SATA_SPINUP_HOLD,
30 SAS_SATA_PORT_SELECTOR,
31 SAS_LINK_RATE_1_5_GBPS,
32 SAS_LINK_RATE_3_0_GBPS,
33 SAS_LINK_VIRTUAL,
34};
35
36struct sas_identify {
37 enum sas_device_type device_type;
38 enum sas_protocol initiator_port_protocols;
39 enum sas_protocol target_port_protocols;
40 u64 sas_address;
41 u8 phy_identifier;
42};
43
44/* The functions by which the transport class and the driver communicate */
45struct sas_function_template {
46};
47
48struct sas_phy {
49 struct device dev;
50 int number;
51 struct sas_identify identify;
52 enum sas_linkrate negotiated_linkrate;
53 enum sas_linkrate minimum_linkrate_hw;
54 enum sas_linkrate minimum_linkrate;
55 enum sas_linkrate maximum_linkrate_hw;
56 enum sas_linkrate maximum_linkrate;
57 u8 port_identifier;
58 struct sas_rphy *rphy;
59};
60
61#define dev_to_phy(d) \
62 container_of((d), struct sas_phy, dev)
63#define transport_class_to_phy(cdev) \
64 dev_to_phy((cdev)->dev)
65#define phy_to_shost(phy) \
66 dev_to_shost((phy)->dev.parent)
67
68struct sas_rphy {
69 struct device dev;
70 struct sas_identify identify;
71 struct list_head list;
72 u32 scsi_target_id;
73};
74
75#define dev_to_rphy(d) \
76 container_of((d), struct sas_rphy, dev)
77#define transport_class_to_rphy(cdev) \
78 dev_to_rphy((cdev)->dev)
79#define rphy_to_shost(rphy) \
80 dev_to_shost((rphy)->dev.parent)
81
82extern void sas_remove_host(struct Scsi_Host *);
83
84extern struct sas_phy *sas_phy_alloc(struct device *, int);
85extern void sas_phy_free(struct sas_phy *);
86extern int sas_phy_add(struct sas_phy *);
87extern void sas_phy_delete(struct sas_phy *);
88extern int scsi_is_sas_phy(const struct device *);
89
90extern struct sas_rphy *sas_rphy_alloc(struct sas_phy *);
91void sas_rphy_free(struct sas_rphy *);
92extern int sas_rphy_add(struct sas_rphy *);
93extern void sas_rphy_delete(struct sas_rphy *);
94extern int scsi_is_sas_rphy(const struct device *);
95
96extern struct scsi_transport_template *
97sas_attach_transport(struct sas_function_template *);
98extern void sas_release_transport(struct scsi_transport_template *);
99
100#endif /* SCSI_TRANSPORT_SAS_H */
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 389e8ebe9c19..d6361dab0370 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -910,11 +910,10 @@ int snd_pcm_format_big_endian(snd_pcm_format_t format);
910 * Returns 1 if the given PCM format is CPU-endian, 0 if 910 * Returns 1 if the given PCM format is CPU-endian, 0 if
911 * opposite, or a negative error code if endian not specified. 911 * opposite, or a negative error code if endian not specified.
912 */ 912 */
913/* int snd_pcm_format_cpu_endian(snd_pcm_format_t format); */
914#ifdef SNDRV_LITTLE_ENDIAN 913#ifdef SNDRV_LITTLE_ENDIAN
915#define snd_pcm_format_cpu_endian snd_pcm_format_little_endian 914#define snd_pcm_format_cpu_endian(format) snd_pcm_format_little_endian(format)
916#else 915#else
917#define snd_pcm_format_cpu_endian snd_pcm_format_big_endian 916#define snd_pcm_format_cpu_endian(format) snd_pcm_format_big_endian(format)
918#endif 917#endif
919int snd_pcm_format_width(snd_pcm_format_t format); /* in bits */ 918int snd_pcm_format_width(snd_pcm_format_t format); /* in bits */
920int snd_pcm_format_physical_width(snd_pcm_format_t format); /* in bits */ 919int snd_pcm_format_physical_width(snd_pcm_format_t format); /* in bits */
diff --git a/include/sound/tea575x-tuner.h b/include/sound/tea575x-tuner.h
index ad3c3be33c03..b82e408e758f 100644
--- a/include/sound/tea575x-tuner.h
+++ b/include/sound/tea575x-tuner.h
@@ -34,9 +34,7 @@ struct snd_tea575x_ops {
34struct snd_tea575x { 34struct snd_tea575x {
35 snd_card_t *card; 35 snd_card_t *card;
36 struct video_device vd; /* video device */ 36 struct video_device vd; /* video device */
37#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 0)
38 struct file_operations fops; 37 struct file_operations fops;
39#endif
40 int dev_nr; /* requested device number + 1 */ 38 int dev_nr; /* requested device number + 1 */
41 int vd_registered; /* video device is registered */ 39 int vd_registered; /* video device is registered */
42 int tea5759; /* 5759 chip is present */ 40 int tea5759; /* 5759 chip is present */
diff --git a/include/video/cyblafb.h b/include/video/cyblafb.h
new file mode 100644
index 000000000000..a9948232b131
--- /dev/null
+++ b/include/video/cyblafb.h
@@ -0,0 +1,171 @@
1
2#ifndef CYBLAFB_DEBUG
3#define CYBLAFB_DEBUG 0
4#endif
5
6#if CYBLAFB_DEBUG
7#define debug(f,a...) printk("%s:" f, __FUNCTION__ , ## a);
8#else
9#define debug(f,a...)
10#endif
11
12#define output(f, a...) printk("cyblafb: " f, ## a)
13
14#define Kb (1024)
15#define Mb (Kb*Kb)
16
17/* PCI IDS of supported cards temporarily here */
18
19#define CYBERBLADEi1 0x8500
20
21/* these defines are for 'lcd' variable */
22#define LCD_STRETCH 0
23#define LCD_CENTER 1
24#define LCD_BIOS 2
25
26/* display types */
27#define DISPLAY_CRT 0
28#define DISPLAY_FP 1
29
30#define ROP_S 0xCC
31
32#define point(x,y) ((y)<<16|(x))
33
34//
35// Attribute Regs, ARxx, 3c0/3c1
36//
37#define AR00 0x00
38#define AR01 0x01
39#define AR02 0x02
40#define AR03 0x03
41#define AR04 0x04
42#define AR05 0x05
43#define AR06 0x06
44#define AR07 0x07
45#define AR08 0x08
46#define AR09 0x09
47#define AR0A 0x0A
48#define AR0B 0x0B
49#define AR0C 0x0C
50#define AR0D 0x0D
51#define AR0E 0x0E
52#define AR0F 0x0F
53#define AR10 0x10
54#define AR12 0x12
55#define AR13 0x13
56
57//
58// Sequencer Regs, SRxx, 3c4/3c5
59//
60#define SR00 0x00
61#define SR01 0x01
62#define SR02 0x02
63#define SR03 0x03
64#define SR04 0x04
65#define SR0D 0x0D
66#define SR0E 0x0E
67#define SR11 0x11
68#define SR18 0x18
69#define SR19 0x19
70
71//
72//
73//
74#define CR00 0x00
75#define CR01 0x01
76#define CR02 0x02
77#define CR03 0x03
78#define CR04 0x04
79#define CR05 0x05
80#define CR06 0x06
81#define CR07 0x07
82#define CR08 0x08
83#define CR09 0x09
84#define CR0A 0x0A
85#define CR0B 0x0B
86#define CR0C 0x0C
87#define CR0D 0x0D
88#define CR0E 0x0E
89#define CR0F 0x0F
90#define CR10 0x10
91#define CR11 0x11
92#define CR12 0x12
93#define CR13 0x13
94#define CR14 0x14
95#define CR15 0x15
96#define CR16 0x16
97#define CR17 0x17
98#define CR18 0x18
99#define CR19 0x19
100#define CR1A 0x1A
101#define CR1B 0x1B
102#define CR1C 0x1C
103#define CR1D 0x1D
104#define CR1E 0x1E
105#define CR1F 0x1F
106#define CR20 0x20
107#define CR21 0x21
108#define CR27 0x27
109#define CR29 0x29
110#define CR2A 0x2A
111#define CR2B 0x2B
112#define CR2D 0x2D
113#define CR2F 0x2F
114#define CR36 0x36
115#define CR38 0x38
116#define CR39 0x39
117#define CR3A 0x3A
118#define CR55 0x55
119#define CR56 0x56
120#define CR57 0x57
121#define CR58 0x58
122
123//
124//
125//
126
127#define GR00 0x01
128#define GR01 0x01
129#define GR02 0x02
130#define GR03 0x03
131#define GR04 0x04
132#define GR05 0x05
133#define GR06 0x06
134#define GR07 0x07
135#define GR08 0x08
136#define GR0F 0x0F
137#define GR20 0x20
138#define GR23 0x23
139#define GR2F 0x2F
140#define GR30 0x30
141#define GR31 0x31
142#define GR33 0x33
143#define GR52 0x52
144#define GR53 0x53
145#define GR5D 0x5d
146
147
148//
149// Graphics Engine
150//
151#define GEBase 0x2100 // could be mapped elsewhere if we like it
152#define GE00 (GEBase+0x00) // source 1, p 111
153#define GE04 (GEBase+0x04) // source 2, p 111
154#define GE08 (GEBase+0x08) // destination 1, p 111
155#define GE0C (GEBase+0x0C) // destination 2, p 112
156#define GE20 (GEBase+0x20) // engine status, p 113
157#define GE24 (GEBase+0x24) // reset all GE pointers
158#define GE44 (GEBase+0x44) // command register, p 126
159#define GE48 (GEBase+0x48) // raster operation, p 127
160#define GE60 (GEBase+0x60) // foreground color, p 128
161#define GE64 (GEBase+0x64) // background color, p 128
162#define GE6C (GEBase+0x6C) // Pattern and Style, p 129, ok
163#define GE9C (GEBase+0x9C) // pixel engine data port, p 125
164#define GEB8 (GEBase+0xB8) // Destination Stride / Buffer Base 0, p 133
165#define GEBC (GEBase+0xBC) // Destination Stride / Buffer Base 1, p 133
166#define GEC0 (GEBase+0xC0) // Destination Stride / Buffer Base 2, p 133
167#define GEC4 (GEBase+0xC4) // Destination Stride / Buffer Base 3, p 133
168#define GEC8 (GEBase+0xC8) // Source Stride / Buffer Base 0, p 133
169#define GECC (GEBase+0xCC) // Source Stride / Buffer Base 1, p 133
170#define GED0 (GEBase+0xD0) // Source Stride / Buffer Base 2, p 133
171#define GED4 (GEBase+0xD4) // Source Stride / Buffer Base 3, p 133
diff --git a/include/video/sisfb.h b/include/video/sisfb.h
index 136bf791643d..e402eb5b3c7a 100644
--- a/include/video/sisfb.h
+++ b/include/video/sisfb.h
@@ -1,5 +1,7 @@
1/* 1/*
2 * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria. 2 * sisfb.h - definitions for the SiS framebuffer driver
3 *
4 * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria.
3 * 5 *
4 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
@@ -16,8 +18,8 @@
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
17 */ 19 */
18 20
19#ifndef _LINUX_SISFB 21#ifndef _LINUX_SISFB_H_
20#define _LINUX_SISFB 22#define _LINUX_SISFB_H_
21 23
22#include <asm/ioctl.h> 24#include <asm/ioctl.h>
23#include <asm/types.h> 25#include <asm/types.h>
@@ -26,47 +28,35 @@
26/* PUBLIC */ 28/* PUBLIC */
27/**********************************************/ 29/**********************************************/
28 30
29/* vbflags */ 31/* vbflags, public (others in sis.h) */
30#define CRT2_DEFAULT 0x00000001 32#define CRT2_DEFAULT 0x00000001
31#define CRT2_LCD 0x00000002 /* TW: Never change the order of the CRT2_XXX entries */ 33#define CRT2_LCD 0x00000002
32#define CRT2_TV 0x00000004 /* (see SISCycleCRT2Type()) */ 34#define CRT2_TV 0x00000004
33#define CRT2_VGA 0x00000008 35#define CRT2_VGA 0x00000008
34#define TV_NTSC 0x00000010 36#define TV_NTSC 0x00000010
35#define TV_PAL 0x00000020 37#define TV_PAL 0x00000020
36#define TV_HIVISION 0x00000040 38#define TV_HIVISION 0x00000040
37#define TV_YPBPR 0x00000080 39#define TV_YPBPR 0x00000080
38#define TV_AVIDEO 0x00000100 40#define TV_AVIDEO 0x00000100
39#define TV_SVIDEO 0x00000200 41#define TV_SVIDEO 0x00000200
40#define TV_SCART 0x00000400 42#define TV_SCART 0x00000400
41#define VB_CONEXANT 0x00000800 /* 661 series only */ 43#define TV_PALM 0x00001000
42#define VB_TRUMPION VB_CONEXANT /* 300 series only */ 44#define TV_PALN 0x00002000
43#define TV_PALM 0x00001000
44#define TV_PALN 0x00002000
45#define TV_NTSCJ 0x00001000 45#define TV_NTSCJ 0x00001000
46#define VB_302ELV 0x00004000 46#define TV_CHSCART 0x00008000
47#define TV_CHSCART 0x00008000 47#define TV_CHYPBPR525I 0x00010000
48#define TV_CHYPBPR525I 0x00010000
49#define CRT1_VGA 0x00000000 48#define CRT1_VGA 0x00000000
50#define CRT1_LCDA 0x00020000 49#define CRT1_LCDA 0x00020000
51#define VGA2_CONNECTED 0x00040000 50#define VGA2_CONNECTED 0x00040000
52#define VB_DISPTYPE_CRT1 0x00080000 /* CRT1 connected and used */ 51#define VB_DISPTYPE_CRT1 0x00080000 /* CRT1 connected and used */
53#define VB_301 0x00100000 /* Video bridge type */ 52#define VB_SINGLE_MODE 0x20000000 /* CRT1 or CRT2; determined by DISPTYPE_CRTx */
54#define VB_301B 0x00200000 53#define VB_MIRROR_MODE 0x40000000 /* CRT1 + CRT2 identical (mirror mode) */
55#define VB_302B 0x00400000 54#define VB_DUALVIEW_MODE 0x80000000 /* CRT1 + CRT2 independent (dual head mode) */
56#define VB_30xBDH 0x00800000 /* 30xB DH version (w/o LCD support) */
57#define VB_LVDS 0x01000000
58#define VB_CHRONTEL 0x02000000
59#define VB_301LV 0x04000000
60#define VB_302LV 0x08000000
61#define VB_301C 0x10000000
62#define VB_SINGLE_MODE 0x20000000 /* CRT1 or CRT2; determined by DISPTYPE_CRTx */
63#define VB_MIRROR_MODE 0x40000000 /* CRT1 + CRT2 identical (mirror mode) */
64#define VB_DUALVIEW_MODE 0x80000000 /* CRT1 + CRT2 independent (dual head mode) */
65 55
66/* Aliases: */ 56/* Aliases: */
67#define CRT2_ENABLE (CRT2_LCD | CRT2_TV | CRT2_VGA) 57#define CRT2_ENABLE (CRT2_LCD | CRT2_TV | CRT2_VGA)
68#define TV_STANDARD (TV_NTSC | TV_PAL | TV_PALM | TV_PALN | TV_NTSCJ) 58#define TV_STANDARD (TV_NTSC | TV_PAL | TV_PALM | TV_PALN | TV_NTSCJ)
69#define TV_INTERFACE (TV_AVIDEO|TV_SVIDEO|TV_SCART|TV_HIVISION|TV_YPBPR|TV_CHSCART|TV_CHYPBPR525I) 59#define TV_INTERFACE (TV_AVIDEO|TV_SVIDEO|TV_SCART|TV_HIVISION|TV_YPBPR|TV_CHSCART|TV_CHYPBPR525I)
70 60
71/* Only if TV_YPBPR is set: */ 61/* Only if TV_YPBPR is set: */
72#define TV_YPBPR525I TV_NTSC 62#define TV_YPBPR525I TV_NTSC
@@ -75,89 +65,118 @@
75#define TV_YPBPR1080I TV_PALN 65#define TV_YPBPR1080I TV_PALN
76#define TV_YPBPRALL (TV_YPBPR525I | TV_YPBPR525P | TV_YPBPR750P | TV_YPBPR1080I) 66#define TV_YPBPRALL (TV_YPBPR525I | TV_YPBPR525P | TV_YPBPR750P | TV_YPBPR1080I)
77 67
78#define VB_SISBRIDGE (VB_301|VB_301B|VB_301C|VB_302B|VB_301LV|VB_302LV|VB_302ELV)
79#define VB_SISTVBRIDGE (VB_301|VB_301B|VB_301C|VB_302B|VB_301LV|VB_302LV)
80#define VB_VIDEOBRIDGE (VB_SISBRIDGE | VB_LVDS | VB_CHRONTEL | VB_CONEXANT)
81
82#define VB_DISPTYPE_DISP2 CRT2_ENABLE 68#define VB_DISPTYPE_DISP2 CRT2_ENABLE
83#define VB_DISPTYPE_CRT2 CRT2_ENABLE 69#define VB_DISPTYPE_CRT2 CRT2_ENABLE
84#define VB_DISPTYPE_DISP1 VB_DISPTYPE_CRT1 70#define VB_DISPTYPE_DISP1 VB_DISPTYPE_CRT1
85#define VB_DISPMODE_SINGLE VB_SINGLE_MODE 71#define VB_DISPMODE_SINGLE VB_SINGLE_MODE
86#define VB_DISPMODE_MIRROR VB_MIRROR_MODE 72#define VB_DISPMODE_MIRROR VB_MIRROR_MODE
87#define VB_DISPMODE_DUAL VB_DUALVIEW_MODE 73#define VB_DISPMODE_DUAL VB_DUALVIEW_MODE
88#define VB_DISPLAY_MODE (SINGLE_MODE | MIRROR_MODE | DUALVIEW_MODE) 74#define VB_DISPLAY_MODE (SINGLE_MODE | MIRROR_MODE | DUALVIEW_MODE)
89 75
90/* Structure argument for SISFB_GET_INFO ioctl */ 76/* Structure argument for SISFB_GET_INFO ioctl */
91typedef struct _SISFB_INFO sisfb_info, *psisfb_info; 77struct sisfb_info {
92 78 __u32 sisfb_id; /* for identifying sisfb */
93struct _SISFB_INFO {
94 __u32 sisfb_id; /* for identifying sisfb */
95#ifndef SISFB_ID 79#ifndef SISFB_ID
96#define SISFB_ID 0x53495346 /* Identify myself with 'SISF' */ 80#define SISFB_ID 0x53495346 /* Identify myself with 'SISF' */
97#endif 81#endif
98 __u32 chip_id; /* PCI-ID of detected chip */ 82 __u32 chip_id; /* PCI-ID of detected chip */
99 __u32 memory; /* video memory in KB which sisfb manages */ 83 __u32 memory; /* total video memory in KB */
100 __u32 heapstart; /* heap start (= sisfb "mem" argument) in KB */ 84 __u32 heapstart; /* heap start offset in KB */
101 __u8 fbvidmode; /* current sisfb mode */ 85 __u8 fbvidmode; /* current sisfb mode */
102 86
103 __u8 sisfb_version; 87 __u8 sisfb_version;
104 __u8 sisfb_revision; 88 __u8 sisfb_revision;
105 __u8 sisfb_patchlevel; 89 __u8 sisfb_patchlevel;
106 90
107 __u8 sisfb_caps; /* sisfb capabilities */ 91 __u8 sisfb_caps; /* sisfb capabilities */
108 92
109 __u32 sisfb_tqlen; /* turbo queue length (in KB) */ 93 __u32 sisfb_tqlen; /* turbo queue length (in KB) */
110 94
111 __u32 sisfb_pcibus; /* The card's PCI ID */ 95 __u32 sisfb_pcibus; /* The card's PCI ID */
112 __u32 sisfb_pcislot; 96 __u32 sisfb_pcislot;
113 __u32 sisfb_pcifunc; 97 __u32 sisfb_pcifunc;
98
99 __u8 sisfb_lcdpdc; /* PanelDelayCompensation */
100
101 __u8 sisfb_lcda; /* Detected status of LCDA for low res/text modes */
102
103 __u32 sisfb_vbflags;
104 __u32 sisfb_currentvbflags;
105
106 __u32 sisfb_scalelcd;
107 __u32 sisfb_specialtiming;
108
109 __u8 sisfb_haveemi;
110 __u8 sisfb_emi30,sisfb_emi31,sisfb_emi32,sisfb_emi33;
111 __u8 sisfb_haveemilcd;
114 112
115 __u8 sisfb_lcdpdc; /* PanelDelayCompensation */ 113 __u8 sisfb_lcdpdca; /* PanelDelayCompensation for LCD-via-CRT1 */
116 114
117 __u8 sisfb_lcda; /* Detected status of LCDA for low res/text modes */ 115 __u16 sisfb_tvxpos, sisfb_tvypos; /* Warning: Values + 32 ! */
118 116
119 __u32 sisfb_vbflags; 117 __u32 sisfb_heapsize; /* heap size (in KB) */
120 __u32 sisfb_currentvbflags; 118 __u32 sisfb_videooffset; /* Offset of viewport in video memory (in bytes) */
121 119
122 __u32 sisfb_scalelcd; 120 __u32 sisfb_curfstn; /* currently running FSTN/DSTN mode */
123 __u32 sisfb_specialtiming; 121 __u32 sisfb_curdstn;
124 122
125 __u8 sisfb_haveemi; 123 __u16 sisfb_pci_vendor; /* PCI vendor (SiS or XGI) */
126 __u8 sisfb_emi30,sisfb_emi31,sisfb_emi32,sisfb_emi33;
127 __u8 sisfb_haveemilcd;
128 124
129 __u8 sisfb_lcdpdca; /* PanelDelayCompensation for LCD-via-CRT1 */ 125 __u32 sisfb_vbflags2; /* ivideo->vbflags2 */
130 126
131 __u16 sisfb_tvxpos, sisfb_tvypos; /* Warning: Values + 32 ! */ 127 __u8 sisfb_can_post; /* sisfb can POST this card */
128 __u8 sisfb_card_posted; /* card is POSTED */
129 __u8 sisfb_was_boot_device; /* This card was the boot video device (ie is primary) */
132 130
133 __u8 reserved[208]; /* for future use */ 131 __u8 reserved[183]; /* for future use */
132};
133
134#define SISFB_CMD_GETVBFLAGS 0x55AA0001 /* no arg; result[1] = vbflags */
135#define SISFB_CMD_SWITCHCRT1 0x55AA0010 /* arg[0]: 99 = query, 0 = off, 1 = on */
136/* more to come */
137
138#define SISFB_CMD_ERR_OK 0x80000000 /* command succeeded */
139#define SISFB_CMD_ERR_LOCKED 0x80000001 /* sisfb is locked */
140#define SISFB_CMD_ERR_EARLY 0x80000002 /* request before sisfb took over gfx system */
141#define SISFB_CMD_ERR_NOVB 0x80000003 /* No video bridge */
142#define SISFB_CMD_ERR_NOCRT2 0x80000004 /* can't change CRT1 status, CRT2 disabled */
143/* more to come */
144#define SISFB_CMD_ERR_UNKNOWN 0x8000ffff /* Unknown command */
145#define SISFB_CMD_ERR_OTHER 0x80010000 /* Other error */
146
147/* Argument for SISFB_CMD ioctl */
148struct sisfb_cmd {
149 __u32 sisfb_cmd;
150 __u32 sisfb_arg[16];
151 __u32 sisfb_result[4];
134}; 152};
135 153
136/* Addtional IOCTLs for communication sisfb <> X driver */ 154/* Addtional IOCTLs for communication sisfb <> X driver */
137/* If changing this, vgatypes.h must also be changed (for X driver) */ 155/* If changing this, vgatypes.h must also be changed (for X driver) */
138 156
139/* ioctl for identifying and giving some info (esp. memory heap start) */ 157/* ioctl for identifying and giving some info (esp. memory heap start) */
140#define SISFB_GET_INFO_SIZE _IOR(0xF3,0x00,__u32) 158#define SISFB_GET_INFO_SIZE _IOR(0xF3,0x00,__u32)
141#define SISFB_GET_INFO _IOR(0xF3,0x01,struct _SISFB_INFO) 159#define SISFB_GET_INFO _IOR(0xF3,0x01,struct sisfb_info)
142 160
143/* ioctrl to get current vertical retrace status */ 161/* ioctrl to get current vertical retrace status */
144#define SISFB_GET_VBRSTATUS _IOR(0xF3,0x02,__u32) 162#define SISFB_GET_VBRSTATUS _IOR(0xF3,0x02,__u32)
145 163
146/* ioctl to enable/disable panning auto-maximize (like nomax parameter) */ 164/* ioctl to enable/disable panning auto-maximize (like nomax parameter) */
147#define SISFB_GET_AUTOMAXIMIZE _IOR(0xF3,0x03,__u32) 165#define SISFB_GET_AUTOMAXIMIZE _IOR(0xF3,0x03,__u32)
148#define SISFB_SET_AUTOMAXIMIZE _IOW(0xF3,0x03,__u32) 166#define SISFB_SET_AUTOMAXIMIZE _IOW(0xF3,0x03,__u32)
149 167
150/* ioctls to relocate TV output (x=D[31:16], y=D[15:0], + 32)*/ 168/* ioctls to relocate TV output (x=D[31:16], y=D[15:0], + 32)*/
151#define SISFB_GET_TVPOSOFFSET _IOR(0xF3,0x04,__u32) 169#define SISFB_GET_TVPOSOFFSET _IOR(0xF3,0x04,__u32)
152#define SISFB_SET_TVPOSOFFSET _IOW(0xF3,0x04,__u32) 170#define SISFB_SET_TVPOSOFFSET _IOW(0xF3,0x04,__u32)
171
172/* ioctl for internal sisfb commands (sisfbctrl) */
173#define SISFB_COMMAND _IOWR(0xF3,0x05,struct sisfb_cmd)
153 174
154/* ioctl for locking sisfb (no register access during lock) */ 175/* ioctl for locking sisfb (no register access during lock) */
155/* As of now, only used to avoid register access during 176/* As of now, only used to avoid register access during
156 * the ioctls listed above. 177 * the ioctls listed above.
157 */ 178 */
158#define SISFB_SET_LOCK _IOW(0xF3,0x06,__u32) 179#define SISFB_SET_LOCK _IOW(0xF3,0x06,__u32)
159
160/* more to come soon */
161 180
162/* ioctls 0xF3 up to 0x3F reserved for sisfb */ 181/* ioctls 0xF3 up to 0x3F reserved for sisfb */
163 182
@@ -165,7 +184,7 @@ struct _SISFB_INFO {
165/* The following are deprecated and should not be used anymore: */ 184/* The following are deprecated and should not be used anymore: */
166/****************************************************************/ 185/****************************************************************/
167/* ioctl for identifying and giving some info (esp. memory heap start) */ 186/* ioctl for identifying and giving some info (esp. memory heap start) */
168#define SISFB_GET_INFO_OLD _IOR('n',0xF8,__u32) 187#define SISFB_GET_INFO_OLD _IOR('n',0xF8,__u32)
169/* ioctrl to get current vertical retrace status */ 188/* ioctrl to get current vertical retrace status */
170#define SISFB_GET_VBRSTATUS_OLD _IOR('n',0xF9,__u32) 189#define SISFB_GET_VBRSTATUS_OLD _IOR('n',0xF9,__u32)
171/* ioctl to enable/disable panning auto-maximize (like nomax parameter) */ 190/* ioctl to enable/disable panning auto-maximize (like nomax parameter) */
@@ -177,8 +196,8 @@ struct _SISFB_INFO {
177 196
178/* For fb memory manager (FBIO_ALLOC, FBIO_FREE) */ 197/* For fb memory manager (FBIO_ALLOC, FBIO_FREE) */
179struct sis_memreq { 198struct sis_memreq {
180 __u32 offset; 199 __u32 offset;
181 __u32 size; 200 __u32 size;
182}; 201};
183 202
184/**********************************************/ 203/**********************************************/
@@ -187,12 +206,19 @@ struct sis_memreq {
187/**********************************************/ 206/**********************************************/
188 207
189#ifdef __KERNEL__ 208#ifdef __KERNEL__
209
210#include <linux/pci.h>
211
190#define UNKNOWN_VGA 0 212#define UNKNOWN_VGA 0
191#define SIS_300_VGA 1 213#define SIS_300_VGA 1
192#define SIS_315_VGA 2 214#define SIS_315_VGA 2
193 215
216#define SISFB_HAVE_MALLOC_NEW
194extern void sis_malloc(struct sis_memreq *req); 217extern void sis_malloc(struct sis_memreq *req);
218extern void sis_malloc_new(struct pci_dev *pdev, struct sis_memreq *req);
219
195extern void sis_free(u32 base); 220extern void sis_free(u32 base);
221extern void sis_free_new(struct pci_dev *pdev, u32 base);
196#endif 222#endif
197 223
198#endif 224#endif