aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-01-10 06:04:41 -0500
committerIngo Molnar <mingo@elte.hu>2009-01-10 06:04:41 -0500
commitb17304245f0db0ac69b795c411407808f3f2796d (patch)
tree63ed3915d9295bd08f640bf25c322064ba787fad /include
parent889c92d21db40be0b7d22a59395060237895bb85 (diff)
parent9a100a4464917b5ffff3a8ce1c2758088fd9bb32 (diff)
Merge branch 'linus' into x86/setup-lzma
Conflicts: init/do_mounts_rd.c
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acconfig.h217
-rw-r--r--include/acpi/acdebug.h231
-rw-r--r--include/acpi/acdisasm.h445
-rw-r--r--include/acpi/acdispat.h345
-rw-r--r--include/acpi/acevents.h216
-rw-r--r--include/acpi/acexcep.h6
-rw-r--r--include/acpi/acglobal.h387
-rw-r--r--include/acpi/achware.h131
-rw-r--r--include/acpi/acinterp.h529
-rw-r--r--include/acpi/aclocal.h1044
-rw-r--r--include/acpi/acmacros.h693
-rw-r--r--include/acpi/acnamesp.h321
-rw-r--r--include/acpi/acobject.h446
-rw-r--r--include/acpi/acopcode.h323
-rw-r--r--include/acpi/acoutput.h103
-rw-r--r--include/acpi/acparser.h234
-rw-r--r--include/acpi/acpi.h31
-rw-r--r--include/acpi/acpiosxf.h13
-rw-r--r--include/acpi/acpixf.h100
-rw-r--r--include/acpi/acpredef.h371
-rw-r--r--include/acpi/acresrc.h336
-rw-r--r--include/acpi/acrestyp.h405
-rw-r--r--include/acpi/acstruct.h228
-rw-r--r--include/acpi/actables.h115
-rw-r--r--include/acpi/actbl.h25
-rw-r--r--include/acpi/actbl1.h2
-rw-r--r--include/acpi/actypes.h559
-rw-r--r--include/acpi/acutils.h585
-rw-r--r--include/acpi/amlcode.h494
-rw-r--r--include/acpi/amlresrc.h311
-rw-r--r--include/acpi/platform/acenv.h45
-rw-r--r--include/acpi/platform/aclinux.h4
-rw-r--r--include/asm-frv/Kbuild1
-rw-r--r--include/asm-frv/atomic.h4
-rw-r--r--include/asm-frv/byteorder.h8
-rw-r--r--include/asm-frv/mmu.h1
-rw-r--r--include/asm-frv/swab.h10
-rw-r--r--include/asm-generic/bug.h17
-rw-r--r--include/asm-generic/local.h1
-rw-r--r--include/asm-generic/memory_model.h7
-rw-r--r--include/asm-m32r/Kbuild1
-rw-r--r--include/asm-m32r/atomic.h8
-rw-r--r--include/asm-m32r/byteorder.h7
-rw-r--r--include/asm-m32r/mmu.h1
-rw-r--r--include/asm-m32r/swab.h10
-rw-r--r--include/asm-m68k/Kbuild1
-rw-r--r--include/asm-m68k/atomic.h3
-rw-r--r--include/asm-m68k/byteorder.h16
-rw-r--r--include/asm-m68k/swab.h16
-rw-r--r--include/asm-mn10300/Kbuild1
-rw-r--r--include/asm-mn10300/atomic.h9
-rw-r--r--include/asm-mn10300/byteorder.h41
-rw-r--r--include/asm-mn10300/swab.h42
-rw-r--r--include/asm-xtensa/Kbuild1
-rw-r--r--include/asm-xtensa/asmmacro.h153
-rw-r--r--include/asm-xtensa/atomic.h300
-rw-r--r--include/asm-xtensa/auxvec.h4
-rw-r--r--include/asm-xtensa/bitops.h132
-rw-r--r--include/asm-xtensa/bootparam.h61
-rw-r--r--include/asm-xtensa/bug.h18
-rw-r--r--include/asm-xtensa/bugs.h18
-rw-r--r--include/asm-xtensa/byteorder.h82
-rw-r--r--include/asm-xtensa/cache.h33
-rw-r--r--include/asm-xtensa/cacheasm.h177
-rw-r--r--include/asm-xtensa/cacheflush.h155
-rw-r--r--include/asm-xtensa/checksum.h250
-rw-r--r--include/asm-xtensa/coprocessor.h177
-rw-r--r--include/asm-xtensa/cpumask.h16
-rw-r--r--include/asm-xtensa/cputime.h6
-rw-r--r--include/asm-xtensa/current.h38
-rw-r--r--include/asm-xtensa/delay.h49
-rw-r--r--include/asm-xtensa/device.h7
-rw-r--r--include/asm-xtensa/div64.h16
-rw-r--r--include/asm-xtensa/dma-mapping.h179
-rw-r--r--include/asm-xtensa/dma.h61
-rw-r--r--include/asm-xtensa/elf.h205
-rw-r--r--include/asm-xtensa/emergency-restart.h6
-rw-r--r--include/asm-xtensa/errno.h16
-rw-r--r--include/asm-xtensa/fb.h12
-rw-r--r--include/asm-xtensa/fcntl.h1
-rw-r--r--include/asm-xtensa/futex.h1
-rw-r--r--include/asm-xtensa/hardirq.h28
-rw-r--r--include/asm-xtensa/highmem.h17
-rw-r--r--include/asm-xtensa/hw_irq.h14
-rw-r--r--include/asm-xtensa/io.h200
-rw-r--r--include/asm-xtensa/ioctl.h1
-rw-r--r--include/asm-xtensa/ioctls.h116
-rw-r--r--include/asm-xtensa/ipcbuf.h37
-rw-r--r--include/asm-xtensa/irq.h30
-rw-r--r--include/asm-xtensa/irq_regs.h1
-rw-r--r--include/asm-xtensa/kdebug.h1
-rw-r--r--include/asm-xtensa/kmap_types.h31
-rw-r--r--include/asm-xtensa/linkage.h16
-rw-r--r--include/asm-xtensa/local.h16
-rw-r--r--include/asm-xtensa/mman.h84
-rw-r--r--include/asm-xtensa/mmu.h17
-rw-r--r--include/asm-xtensa/mmu_context.h136
-rw-r--r--include/asm-xtensa/module.h27
-rw-r--r--include/asm-xtensa/msgbuf.h48
-rw-r--r--include/asm-xtensa/mutex.h9
-rw-r--r--include/asm-xtensa/page.h174
-rw-r--r--include/asm-xtensa/param.h34
-rw-r--r--include/asm-xtensa/pci-bridge.h88
-rw-r--r--include/asm-xtensa/pci.h82
-rw-r--r--include/asm-xtensa/percpu.h16
-rw-r--r--include/asm-xtensa/pgalloc.h73
-rw-r--r--include/asm-xtensa/pgtable.h416
-rw-r--r--include/asm-xtensa/platform-iss/hardware.h29
-rw-r--r--include/asm-xtensa/platform-iss/simcall.h62
-rw-r--r--include/asm-xtensa/platform.h91
-rw-r--r--include/asm-xtensa/poll.h20
-rw-r--r--include/asm-xtensa/posix_types.h122
-rw-r--r--include/asm-xtensa/processor.h193
-rw-r--r--include/asm-xtensa/ptrace.h135
-rw-r--r--include/asm-xtensa/regs.h145
-rw-r--r--include/asm-xtensa/resource.h16
-rw-r--r--include/asm-xtensa/rmap.h16
-rw-r--r--include/asm-xtensa/rwsem.h168
-rw-r--r--include/asm-xtensa/scatterlist.h39
-rw-r--r--include/asm-xtensa/sections.h16
-rw-r--r--include/asm-xtensa/segment.h16
-rw-r--r--include/asm-xtensa/sembuf.h44
-rw-r--r--include/asm-xtensa/serial.h18
-rw-r--r--include/asm-xtensa/setup.h16
-rw-r--r--include/asm-xtensa/shmbuf.h71
-rw-r--r--include/asm-xtensa/shmparam.h21
-rw-r--r--include/asm-xtensa/sigcontext.h28
-rw-r--r--include/asm-xtensa/siginfo.h16
-rw-r--r--include/asm-xtensa/signal.h172
-rw-r--r--include/asm-xtensa/smp.h27
-rw-r--r--include/asm-xtensa/socket.h68
-rw-r--r--include/asm-xtensa/sockios.h31
-rw-r--r--include/asm-xtensa/spinlock.h16
-rw-r--r--include/asm-xtensa/stat.h59
-rw-r--r--include/asm-xtensa/statfs.h17
-rw-r--r--include/asm-xtensa/string.h124
-rw-r--r--include/asm-xtensa/syscall.h42
-rw-r--r--include/asm-xtensa/system.h215
-rw-r--r--include/asm-xtensa/termbits.h219
-rw-r--r--include/asm-xtensa/termios.h105
-rw-r--r--include/asm-xtensa/thread_info.h164
-rw-r--r--include/asm-xtensa/timex.h96
-rw-r--r--include/asm-xtensa/tlb.h47
-rw-r--r--include/asm-xtensa/tlbflush.h191
-rw-r--r--include/asm-xtensa/topology.h16
-rw-r--r--include/asm-xtensa/types.h42
-rw-r--r--include/asm-xtensa/uaccess.h500
-rw-r--r--include/asm-xtensa/ucontext.h22
-rw-r--r--include/asm-xtensa/unaligned.h29
-rw-r--r--include/asm-xtensa/unistd.h735
-rw-r--r--include/asm-xtensa/user.h20
-rw-r--r--include/asm-xtensa/variant-dc232b/core.h424
-rw-r--r--include/asm-xtensa/variant-dc232b/tie-asm.h122
-rw-r--r--include/asm-xtensa/variant-dc232b/tie.h131
-rw-r--r--include/asm-xtensa/variant-fsf/core.h359
-rw-r--r--include/asm-xtensa/variant-fsf/tie-asm.h70
-rw-r--r--include/asm-xtensa/variant-fsf/tie.h77
-rw-r--r--include/asm-xtensa/vga.h19
-rw-r--r--include/asm-xtensa/xor.h16
-rw-r--r--include/linux/Kbuild7
-rw-r--r--include/linux/acpi.h17
-rw-r--r--include/linux/async.h25
-rw-r--r--include/linux/async_tx.h17
-rw-r--r--include/linux/atmel-mci.h39
-rw-r--r--include/linux/audit.h98
-rw-r--r--include/linux/auto_dev-ioctl.h75
-rw-r--r--include/linux/auto_fs4.h62
-rw-r--r--include/linux/auxvec.h6
-rw-r--r--include/linux/backlight.h16
-rw-r--r--include/linux/binfmts.h3
-rw-r--r--include/linux/blkdev.h2
-rw-r--r--include/linux/blockgroup_lock.h7
-rw-r--r--include/linux/byteorder.h372
-rw-r--r--include/linux/byteorder/Kbuild2
-rw-r--r--include/linux/byteorder/big_endian.h3
-rw-r--r--include/linux/byteorder/little_endian.h3
-rw-r--r--include/linux/byteorder/swab.h222
-rw-r--r--include/linux/byteorder/swabb.h135
-rw-r--r--include/linux/can/core.h2
-rw-r--r--include/linux/capability.h17
-rw-r--r--include/linux/cgroup.h75
-rw-r--r--include/linux/cpufreq.h1
-rw-r--r--include/linux/cpuset.h16
-rw-r--r--include/linux/debugfs.h2
-rw-r--r--include/linux/device-mapper.h28
-rw-r--r--include/linux/device.h32
-rw-r--r--include/linux/dma_remapping.h8
-rw-r--r--include/linux/dmaengine.h181
-rw-r--r--include/linux/dqblk_qtree.h56
-rw-r--r--include/linux/dqblk_v1.h7
-rw-r--r--include/linux/dqblk_v2.h22
-rw-r--r--include/linux/dw_dmac.h31
-rw-r--r--include/linux/ext2_fs.h24
-rw-r--r--include/linux/ext2_fs_sb.h8
-rw-r--r--include/linux/ext3_fs.h52
-rw-r--r--include/linux/ext3_fs_sb.h9
-rw-r--r--include/linux/fs.h18
-rw-r--r--include/linux/fuse.h79
-rw-r--r--include/linux/gfp.h6
-rw-r--r--include/linux/gpio_keys.h1
-rw-r--r--include/linux/hid.h16
-rw-r--r--include/linux/hidraw.h2
-rw-r--r--include/linux/hugetlb.h6
-rw-r--r--include/linux/i2c.h4
-rw-r--r--include/linux/i2c/dm355evm_msp.h79
-rw-r--r--include/linux/i2c/tsc2007.h17
-rw-r--r--include/linux/i2c/twl4030.h90
-rw-r--r--include/linux/ide.h171
-rw-r--r--include/linux/if_vlan.h19
-rw-r--r--include/linux/interrupt.h4
-rw-r--r--include/linux/ioport.h11
-rw-r--r--include/linux/ioprio.h2
-rw-r--r--include/linux/irqnr.h7
-rw-r--r--include/linux/jbd.h15
-rw-r--r--include/linux/jbd2.h70
-rw-r--r--include/linux/journal-head.h8
-rw-r--r--include/linux/kernel.h20
-rw-r--r--include/linux/klist.h2
-rw-r--r--include/linux/kprobes.h15
-rw-r--r--include/linux/leds-pca9532.h2
-rw-r--r--include/linux/leds.h5
-rw-r--r--include/linux/libata.h3
-rw-r--r--include/linux/libps2.h2
-rw-r--r--include/linux/lockd/lockd.h68
-rw-r--r--include/linux/lockd/sm_inter.h48
-rw-r--r--include/linux/lockd/xdr.h15
-rw-r--r--include/linux/mISDNhw.h26
-rw-r--r--include/linux/mISDNif.h89
-rw-r--r--include/linux/magic.h1
-rw-r--r--include/linux/map_to_7segment.h2
-rw-r--r--include/linux/memcontrol.h154
-rw-r--r--include/linux/memory.h6
-rw-r--r--include/linux/memory_hotplug.h2
-rw-r--r--include/linux/mfd/da903x.h44
-rw-r--r--include/linux/mfd/wm8350/comparator.h8
-rw-r--r--include/linux/mfd/wm8350/core.h52
-rw-r--r--include/linux/mfd/wm8350/pmic.h40
-rw-r--r--include/linux/mfd/wm8350/supply.h25
-rw-r--r--include/linux/migrate.h4
-rw-r--r--include/linux/miscdevice.h42
-rw-r--r--include/linux/mm.h23
-rw-r--r--include/linux/mm_inline.h22
-rw-r--r--include/linux/mm_types.h19
-rw-r--r--include/linux/mmzone.h24
-rw-r--r--include/linux/module.h15
-rw-r--r--include/linux/moduleloader.h3
-rw-r--r--include/linux/mtd/cfi.h1
-rw-r--r--include/linux/mtd/concat.h2
-rw-r--r--include/linux/mtd/ftl.h38
-rw-r--r--include/linux/mtd/map.h1
-rw-r--r--include/linux/mtd/mtd.h77
-rw-r--r--include/linux/mtd/nand.h7
-rw-r--r--include/linux/mtd/partitions.h6
-rw-r--r--include/linux/mtd/pfow.h159
-rw-r--r--include/linux/mtd/physmap.h1
-rw-r--r--include/linux/mtd/qinfo.h91
-rw-r--r--include/linux/mtd/sharpsl.h20
-rw-r--r--include/linux/ncp_fs.h2
-rw-r--r--include/linux/netdevice.h25
-rw-r--r--include/linux/nfs4.h2
-rw-r--r--include/linux/nfsd/nfsd.h1
-rw-r--r--include/linux/nfsd/nfsfh.h4
-rw-r--r--include/linux/node.h13
-rw-r--r--include/linux/nwpserial.h18
-rw-r--r--include/linux/oprofile.h18
-rw-r--r--include/linux/oxu210hp.h7
-rw-r--r--include/linux/page-flags.h26
-rw-r--r--include/linux/page_cgroup.h52
-rw-r--r--include/linux/pagemap.h3
-rw-r--r--include/linux/pagevec.h7
-rw-r--r--include/linux/pci-acpi.h23
-rw-r--r--include/linux/pci.h91
-rw-r--r--include/linux/pci_hotplug.h3
-rw-r--r--include/linux/pci_ids.h1
-rw-r--r--include/linux/pci_regs.h76
-rw-r--r--include/linux/percpu_counter.h22
-rw-r--r--include/linux/pid.h18
-rw-r--r--include/linux/pid_namespace.h6
-rw-r--r--include/linux/platform_device.h1
-rw-r--r--include/linux/pm.h88
-rw-r--r--include/linux/poll.h15
-rw-r--r--include/linux/power_supply.h1
-rw-r--r--include/linux/qnx4_fs.h4
-rw-r--r--include/linux/qnxtypes.h5
-rw-r--r--include/linux/quota.h108
-rw-r--r--include/linux/quotaio_v1.h33
-rw-r--r--include/linux/quotaio_v2.h79
-rw-r--r--include/linux/quotaops.h96
-rw-r--r--include/linux/radix-tree.h2
-rw-r--r--include/linux/raid/md_k.h20
-rw-r--r--include/linux/raid/md_p.h2
-rw-r--r--include/linux/raid/raid0.h10
-rw-r--r--include/linux/rcupdate.h12
-rw-r--r--include/linux/regulator/consumer.h8
-rw-r--r--include/linux/regulator/driver.h37
-rw-r--r--include/linux/regulator/machine.h41
-rw-r--r--include/linux/res_counter.h8
-rw-r--r--include/linux/rio_drv.h1
-rw-r--r--include/linux/rmap.h5
-rw-r--r--include/linux/rtc.h8
-rw-r--r--include/linux/sched.h10
-rw-r--r--include/linux/security.h41
-rw-r--r--include/linux/serial_core.h3
-rw-r--r--include/linux/serio.h1
-rw-r--r--include/linux/spi/spi.h6
-rw-r--r--include/linux/spi/spi_gpio.h60
-rw-r--r--include/linux/spi/tdo24m.h13
-rw-r--r--include/linux/stop_machine.h22
-rw-r--r--include/linux/sunrpc/svc.h5
-rw-r--r--include/linux/suspend.h13
-rw-r--r--include/linux/swab.h52
-rw-r--r--include/linux/swap.h79
-rw-r--r--include/linux/swiotlb.h3
-rw-r--r--include/linux/syscalls.h2
-rw-r--r--include/linux/time.h1
-rw-r--r--include/linux/types.h13
-rw-r--r--include/linux/uio_driver.h30
-rw-r--r--include/linux/unwind.h68
-rw-r--r--include/linux/usb.h30
-rw-r--r--include/linux/usb/association.h22
-rw-r--r--include/linux/usb/gpio_vbus.h30
-rw-r--r--include/linux/usb/musb.h5
-rw-r--r--include/linux/usb/otg.h1
-rw-r--r--include/linux/usb_usual.h7
-rw-r--r--include/linux/vmalloc.h4
-rw-r--r--include/linux/wimax.h234
-rw-r--r--include/linux/wimax/Kbuild1
-rw-r--r--include/linux/wimax/debug.h453
-rw-r--r--include/linux/wimax/i2400m.h512
-rw-r--r--include/linux/writeback.h16
-rw-r--r--include/mtd/ubi-user.h2
-rw-r--r--include/net/cipso_ipv4.h6
-rw-r--r--include/net/ndisc.h4
-rw-r--r--include/net/netdma.h11
-rw-r--r--include/net/netlabel.h86
-rw-r--r--include/net/protocol.h3
-rw-r--r--include/net/wimax.h523
-rw-r--r--include/scsi/scsi_transport_fc.h1
-rw-r--r--include/sound/soc-dapm.h15
-rw-r--r--include/sound/soc.h30
-rw-r--r--include/xen/xenbus.h2
341 files changed, 5823 insertions, 19933 deletions
diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h
deleted file mode 100644
index 29feee27f0ea..000000000000
--- a/include/acpi/acconfig.h
+++ /dev/null
@@ -1,217 +0,0 @@
1/******************************************************************************
2 *
3 * Name: acconfig.h - Global configuration constants
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef _ACCONFIG_H
45#define _ACCONFIG_H
46
47/******************************************************************************
48 *
49 * Configuration options
50 *
51 *****************************************************************************/
52
53/*
54 * ACPI_DEBUG_OUTPUT - This switch enables all the debug facilities of the
55 * ACPI subsystem. This includes the DEBUG_PRINT output
56 * statements. When disabled, all DEBUG_PRINT
57 * statements are compiled out.
58 *
59 * ACPI_APPLICATION - Use this switch if the subsystem is going to be run
60 * at the application level.
61 *
62 */
63
64/* Current ACPICA subsystem version in YYYYMMDD format */
65
66#define ACPI_CA_VERSION 0x20080926
67
68/*
69 * OS name, used for the _OS object. The _OS object is essentially obsolete,
70 * but there is a large base of ASL/AML code in existing machines that check
71 * for the string below. The use of this string usually guarantees that
72 * the ASL will execute down the most tested code path. Also, there is some
73 * code that will not execute the _OSI method unless _OS matches the string
74 * below. Therefore, change this string at your own risk.
75 */
76#define ACPI_OS_NAME "Microsoft Windows NT"
77
78/* Maximum objects in the various object caches */
79
80#define ACPI_MAX_STATE_CACHE_DEPTH 96 /* State objects */
81#define ACPI_MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */
82#define ACPI_MAX_EXTPARSE_CACHE_DEPTH 96 /* Parse tree objects */
83#define ACPI_MAX_OBJECT_CACHE_DEPTH 96 /* Interpreter operand objects */
84#define ACPI_MAX_NAMESPACE_CACHE_DEPTH 96 /* Namespace objects */
85
86/*
87 * Should the subsystem abort the loading of an ACPI table if the
88 * table checksum is incorrect?
89 */
90#define ACPI_CHECKSUM_ABORT FALSE
91
92/******************************************************************************
93 *
94 * Subsystem Constants
95 *
96 *****************************************************************************/
97
98/* Version of ACPI supported */
99
100#define ACPI_CA_SUPPORT_LEVEL 3
101
102/* Maximum count for a semaphore object */
103
104#define ACPI_MAX_SEMAPHORE_COUNT 256
105
106/* Maximum object reference count (detects object deletion issues) */
107
108#define ACPI_MAX_REFERENCE_COUNT 0x1000
109
110/* Size of cached memory mapping for system memory operation region */
111
112#define ACPI_SYSMEM_REGION_WINDOW_SIZE 4096
113
114/* owner_id tracking. 8 entries allows for 255 owner_ids */
115
116#define ACPI_NUM_OWNERID_MASKS 8
117
118/* Size of the root table array is increased by this increment */
119
120#define ACPI_ROOT_TABLE_SIZE_INCREMENT 4
121
122/******************************************************************************
123 *
124 * ACPI Specification constants (Do not change unless the specification changes)
125 *
126 *****************************************************************************/
127
128/* Number of distinct GPE register blocks and register width */
129
130#define ACPI_MAX_GPE_BLOCKS 2
131#define ACPI_GPE_REGISTER_WIDTH 8
132
133/* Method info (in WALK_STATE), containing local variables and argumetns */
134
135#define ACPI_METHOD_NUM_LOCALS 8
136#define ACPI_METHOD_MAX_LOCAL 7
137
138#define ACPI_METHOD_NUM_ARGS 7
139#define ACPI_METHOD_MAX_ARG 6
140
141/* Length of _HID, _UID, _CID, and UUID values */
142
143#define ACPI_DEVICE_ID_LENGTH 0x09
144#define ACPI_MAX_CID_LENGTH 48
145#define ACPI_UUID_LENGTH 16
146
147/*
148 * Operand Stack (in WALK_STATE), Must be large enough to contain METHOD_MAX_ARG
149 */
150#define ACPI_OBJ_NUM_OPERANDS 8
151#define ACPI_OBJ_MAX_OPERAND 7
152
153/* Number of elements in the Result Stack frame, can be an arbitrary value */
154
155#define ACPI_RESULTS_FRAME_OBJ_NUM 8
156
157/*
158 * Maximal number of elements the Result Stack can contain,
159 * it may be an arbitray value not exceeding the types of
160 * result_size and result_count (now u8).
161 */
162#define ACPI_RESULTS_OBJ_NUM_MAX 255
163
164/* Names within the namespace are 4 bytes long */
165
166#define ACPI_NAME_SIZE 4
167#define ACPI_PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 char for separator */
168#define ACPI_PATH_SEPARATOR '.'
169
170/* Sizes for ACPI table headers */
171
172#define ACPI_OEM_ID_SIZE 6
173#define ACPI_OEM_TABLE_ID_SIZE 8
174
175/* Constants used in searching for the RSDP in low memory */
176
177#define ACPI_EBDA_PTR_LOCATION 0x0000040E /* Physical Address */
178#define ACPI_EBDA_PTR_LENGTH 2
179#define ACPI_EBDA_WINDOW_SIZE 1024
180#define ACPI_HI_RSDP_WINDOW_BASE 0x000E0000 /* Physical Address */
181#define ACPI_HI_RSDP_WINDOW_SIZE 0x00020000
182#define ACPI_RSDP_SCAN_STEP 16
183
184/* Operation regions */
185
186#define ACPI_NUM_PREDEFINED_REGIONS 8
187#define ACPI_USER_REGION_BEGIN 0x80
188
189/* Maximum space_ids for Operation Regions */
190
191#define ACPI_MAX_ADDRESS_SPACE 255
192
193/* Array sizes. Used for range checking also */
194
195#define ACPI_MAX_MATCH_OPCODE 5
196
197/* RSDP checksums */
198
199#define ACPI_RSDP_CHECKSUM_LENGTH 20
200#define ACPI_RSDP_XCHECKSUM_LENGTH 36
201
202/* SMBus bidirectional buffer size */
203
204#define ACPI_SMBUS_BUFFER_SIZE 34
205
206/******************************************************************************
207 *
208 * ACPI AML Debugger
209 *
210 *****************************************************************************/
211
212#define ACPI_DEBUGGER_MAX_ARGS 8 /* Must be max method args + 1 */
213
214#define ACPI_DEBUGGER_COMMAND_PROMPT '-'
215#define ACPI_DEBUGGER_EXECUTE_PROMPT '%'
216
217#endif /* _ACCONFIG_H */
diff --git a/include/acpi/acdebug.h b/include/acpi/acdebug.h
deleted file mode 100644
index 62c59df3b86c..000000000000
--- a/include/acpi/acdebug.h
+++ /dev/null
@@ -1,231 +0,0 @@
1/******************************************************************************
2 *
3 * Name: acdebug.h - ACPI/AML debugger
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACDEBUG_H__
45#define __ACDEBUG_H__
46
47#define ACPI_DEBUG_BUFFER_SIZE 4196
48
49struct command_info {
50 char *name; /* Command Name */
51 u8 min_args; /* Minimum arguments required */
52};
53
54struct argument_info {
55 char *name; /* Argument Name */
56};
57
58#define PARAM_LIST(pl) pl
59#define DBTEST_OUTPUT_LEVEL(lvl) if (acpi_gbl_db_opt_verbose)
60#define VERBOSE_PRINT(fp) DBTEST_OUTPUT_LEVEL(lvl) {\
61 acpi_os_printf PARAM_LIST(fp);}
62
63#define EX_NO_SINGLE_STEP 1
64#define EX_SINGLE_STEP 2
65
66/*
67 * dbxface - external debugger interfaces
68 */
69acpi_status acpi_db_initialize(void);
70
71void acpi_db_terminate(void);
72
73acpi_status
74acpi_db_single_step(struct acpi_walk_state *walk_state,
75 union acpi_parse_object *op, u32 op_type);
76
77/*
78 * dbcmds - debug commands and output routines
79 */
80acpi_status acpi_db_disassemble_method(char *name);
81
82void acpi_db_display_table_info(char *table_arg);
83
84void acpi_db_unload_acpi_table(char *table_arg, char *instance_arg);
85
86void
87acpi_db_set_method_breakpoint(char *location,
88 struct acpi_walk_state *walk_state,
89 union acpi_parse_object *op);
90
91void acpi_db_set_method_call_breakpoint(union acpi_parse_object *op);
92
93void acpi_db_get_bus_info(void);
94
95void acpi_db_disassemble_aml(char *statements, union acpi_parse_object *op);
96
97void acpi_db_dump_namespace(char *start_arg, char *depth_arg);
98
99void acpi_db_dump_namespace_by_owner(char *owner_arg, char *depth_arg);
100
101void acpi_db_send_notify(char *name, u32 value);
102
103void acpi_db_set_method_data(char *type_arg, char *index_arg, char *value_arg);
104
105acpi_status
106acpi_db_display_objects(char *obj_type_arg, char *display_count_arg);
107
108acpi_status acpi_db_find_name_in_namespace(char *name_arg);
109
110void acpi_db_set_scope(char *name);
111
112acpi_status acpi_db_sleep(char *object_arg);
113
114void acpi_db_find_references(char *object_arg);
115
116void acpi_db_display_locks(void);
117
118void acpi_db_display_resources(char *object_arg);
119
120void acpi_db_display_gpes(void);
121
122void acpi_db_check_integrity(void);
123
124void acpi_db_generate_gpe(char *gpe_arg, char *block_arg);
125
126void acpi_db_check_predefined_names(void);
127
128void acpi_db_batch_execute(void);
129
130/*
131 * dbdisply - debug display commands
132 */
133void acpi_db_display_method_info(union acpi_parse_object *op);
134
135void acpi_db_decode_and_display_object(char *target, char *output_type);
136
137void
138acpi_db_display_result_object(union acpi_operand_object *obj_desc,
139 struct acpi_walk_state *walk_state);
140
141acpi_status acpi_db_display_all_methods(char *display_count_arg);
142
143void acpi_db_display_arguments(void);
144
145void acpi_db_display_locals(void);
146
147void acpi_db_display_results(void);
148
149void acpi_db_display_calling_tree(void);
150
151void acpi_db_display_object_type(char *object_arg);
152
153void
154acpi_db_display_argument_object(union acpi_operand_object *obj_desc,
155 struct acpi_walk_state *walk_state);
156
157void acpi_db_check_predefined_names(void);
158
159void acpi_db_batch_execute(void);
160
161/*
162 * dbexec - debugger control method execution
163 */
164void acpi_db_execute(char *name, char **args, u32 flags);
165
166void
167acpi_db_create_execution_threads(char *num_threads_arg,
168 char *num_loops_arg, char *method_name_arg);
169
170#ifdef ACPI_DBG_TRACK_ALLOCATIONS
171u32 acpi_db_get_cache_info(struct acpi_memory_list *cache);
172#endif
173
174/*
175 * dbfileio - Debugger file I/O commands
176 */
177acpi_object_type
178acpi_db_match_argument(char *user_argument, struct argument_info *arguments);
179
180void acpi_db_close_debug_file(void);
181
182void acpi_db_open_debug_file(char *name);
183
184acpi_status acpi_db_load_acpi_table(char *filename);
185
186acpi_status
187acpi_db_get_table_from_file(char *filename, struct acpi_table_header **table);
188
189acpi_status
190acpi_db_read_table_from_file(char *filename, struct acpi_table_header **table);
191
192/*
193 * dbhistry - debugger HISTORY command
194 */
195void acpi_db_add_to_history(char *command_line);
196
197void acpi_db_display_history(void);
198
199char *acpi_db_get_from_history(char *command_num_arg);
200
201/*
202 * dbinput - user front-end to the AML debugger
203 */
204acpi_status
205acpi_db_command_dispatch(char *input_buffer,
206 struct acpi_walk_state *walk_state,
207 union acpi_parse_object *op);
208
209void ACPI_SYSTEM_XFACE acpi_db_execute_thread(void *context);
210
211/*
212 * dbstats - Generation and display of ACPI table statistics
213 */
214void acpi_db_generate_statistics(union acpi_parse_object *root, u8 is_method);
215
216acpi_status acpi_db_display_statistics(char *type_arg);
217
218/*
219 * dbutils - AML debugger utilities
220 */
221void acpi_db_set_output_destination(u32 where);
222
223void acpi_db_dump_external_object(union acpi_object *obj_desc, u32 level);
224
225void acpi_db_prep_namestring(char *name);
226
227struct acpi_namespace_node *acpi_db_local_ns_lookup(char *name);
228
229void acpi_db_uint32_to_hex_string(u32 value, char *buffer);
230
231#endif /* __ACDEBUG_H__ */
diff --git a/include/acpi/acdisasm.h b/include/acpi/acdisasm.h
deleted file mode 100644
index 0c1ed387073c..000000000000
--- a/include/acpi/acdisasm.h
+++ /dev/null
@@ -1,445 +0,0 @@
1/******************************************************************************
2 *
3 * Name: acdisasm.h - AML disassembler
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACDISASM_H__
45#define __ACDISASM_H__
46
47#include "amlresrc.h"
48
49#define BLOCK_NONE 0
50#define BLOCK_PAREN 1
51#define BLOCK_BRACE 2
52#define BLOCK_COMMA_LIST 4
53#define ACPI_DEFAULT_RESNAME *(u32 *) "__RD"
54
55struct acpi_external_list {
56 char *path;
57 char *internal_path;
58 struct acpi_external_list *next;
59 u32 value;
60 u16 length;
61 u8 type;
62};
63
64extern struct acpi_external_list *acpi_gbl_external_list;
65
66typedef const struct acpi_dmtable_info {
67 u8 opcode;
68 u8 offset;
69 char *name;
70
71} acpi_dmtable_info;
72
73/*
74 * Values for Opcode above.
75 * Note: 0-7 must not change, used as a flag shift value
76 */
77#define ACPI_DMT_FLAG0 0
78#define ACPI_DMT_FLAG1 1
79#define ACPI_DMT_FLAG2 2
80#define ACPI_DMT_FLAG3 3
81#define ACPI_DMT_FLAG4 4
82#define ACPI_DMT_FLAG5 5
83#define ACPI_DMT_FLAG6 6
84#define ACPI_DMT_FLAG7 7
85#define ACPI_DMT_FLAGS0 8
86#define ACPI_DMT_FLAGS2 9
87#define ACPI_DMT_UINT8 10
88#define ACPI_DMT_UINT16 11
89#define ACPI_DMT_UINT24 12
90#define ACPI_DMT_UINT32 13
91#define ACPI_DMT_UINT56 14
92#define ACPI_DMT_UINT64 15
93#define ACPI_DMT_STRING 16
94#define ACPI_DMT_NAME4 17
95#define ACPI_DMT_NAME6 18
96#define ACPI_DMT_NAME8 19
97#define ACPI_DMT_CHKSUM 20
98#define ACPI_DMT_SPACEID 21
99#define ACPI_DMT_GAS 22
100#define ACPI_DMT_ASF 23
101#define ACPI_DMT_DMAR 24
102#define ACPI_DMT_HEST 25
103#define ACPI_DMT_HESTNTFY 26
104#define ACPI_DMT_HESTNTYP 27
105#define ACPI_DMT_MADT 28
106#define ACPI_DMT_SRAT 29
107#define ACPI_DMT_EXIT 30
108#define ACPI_DMT_SIG 31
109
110typedef
111void (*acpi_dmtable_handler) (struct acpi_table_header * table);
112
113struct acpi_dmtable_data {
114 char *signature;
115 struct acpi_dmtable_info *table_info;
116 acpi_dmtable_handler table_handler;
117 char *name;
118};
119
120struct acpi_op_walk_info {
121 u32 level;
122 u32 last_level;
123 u32 count;
124 u32 bit_offset;
125 u32 flags;
126 struct acpi_walk_state *walk_state;
127};
128
129typedef
130acpi_status(*asl_walk_callback) (union acpi_parse_object * op,
131 u32 level, void *context);
132
133struct acpi_resource_tag {
134 u32 bit_index;
135 char *tag;
136};
137
138/* Strings used for decoding flags to ASL keywords */
139
140extern const char *acpi_gbl_word_decode[];
141extern const char *acpi_gbl_irq_decode[];
142extern const char *acpi_gbl_lock_rule[];
143extern const char *acpi_gbl_access_types[];
144extern const char *acpi_gbl_update_rules[];
145extern const char *acpi_gbl_match_ops[];
146
147extern struct acpi_dmtable_info acpi_dm_table_info_asf0[];
148extern struct acpi_dmtable_info acpi_dm_table_info_asf1[];
149extern struct acpi_dmtable_info acpi_dm_table_info_asf1a[];
150extern struct acpi_dmtable_info acpi_dm_table_info_asf2[];
151extern struct acpi_dmtable_info acpi_dm_table_info_asf2a[];
152extern struct acpi_dmtable_info acpi_dm_table_info_asf3[];
153extern struct acpi_dmtable_info acpi_dm_table_info_asf4[];
154extern struct acpi_dmtable_info acpi_dm_table_info_asf_hdr[];
155extern struct acpi_dmtable_info acpi_dm_table_info_boot[];
156extern struct acpi_dmtable_info acpi_dm_table_info_bert[];
157extern struct acpi_dmtable_info acpi_dm_table_info_cpep[];
158extern struct acpi_dmtable_info acpi_dm_table_info_cpep0[];
159extern struct acpi_dmtable_info acpi_dm_table_info_dbgp[];
160extern struct acpi_dmtable_info acpi_dm_table_info_dmar[];
161extern struct acpi_dmtable_info acpi_dm_table_info_dmar_hdr[];
162extern struct acpi_dmtable_info acpi_dm_table_info_dmar_scope[];
163extern struct acpi_dmtable_info acpi_dm_table_info_dmar0[];
164extern struct acpi_dmtable_info acpi_dm_table_info_dmar1[];
165extern struct acpi_dmtable_info acpi_dm_table_info_dmar2[];
166extern struct acpi_dmtable_info acpi_dm_table_info_ecdt[];
167extern struct acpi_dmtable_info acpi_dm_table_info_einj[];
168extern struct acpi_dmtable_info acpi_dm_table_info_einj0[];
169extern struct acpi_dmtable_info acpi_dm_table_info_erst[];
170extern struct acpi_dmtable_info acpi_dm_table_info_facs[];
171extern struct acpi_dmtable_info acpi_dm_table_info_fadt1[];
172extern struct acpi_dmtable_info acpi_dm_table_info_fadt2[];
173extern struct acpi_dmtable_info acpi_dm_table_info_gas[];
174extern struct acpi_dmtable_info acpi_dm_table_info_header[];
175extern struct acpi_dmtable_info acpi_dm_table_info_hest[];
176extern struct acpi_dmtable_info acpi_dm_table_info_hest9[];
177extern struct acpi_dmtable_info acpi_dm_table_info_hest_notify[];
178extern struct acpi_dmtable_info acpi_dm_table_info_hpet[];
179extern struct acpi_dmtable_info acpi_dm_table_info_madt[];
180extern struct acpi_dmtable_info acpi_dm_table_info_madt0[];
181extern struct acpi_dmtable_info acpi_dm_table_info_madt1[];
182extern struct acpi_dmtable_info acpi_dm_table_info_madt2[];
183extern struct acpi_dmtable_info acpi_dm_table_info_madt3[];
184extern struct acpi_dmtable_info acpi_dm_table_info_madt4[];
185extern struct acpi_dmtable_info acpi_dm_table_info_madt5[];
186extern struct acpi_dmtable_info acpi_dm_table_info_madt6[];
187extern struct acpi_dmtable_info acpi_dm_table_info_madt7[];
188extern struct acpi_dmtable_info acpi_dm_table_info_madt8[];
189extern struct acpi_dmtable_info acpi_dm_table_info_madt9[];
190extern struct acpi_dmtable_info acpi_dm_table_info_madt10[];
191extern struct acpi_dmtable_info acpi_dm_table_info_madt_hdr[];
192extern struct acpi_dmtable_info acpi_dm_table_info_mcfg[];
193extern struct acpi_dmtable_info acpi_dm_table_info_mcfg0[];
194extern struct acpi_dmtable_info acpi_dm_table_info_rsdp1[];
195extern struct acpi_dmtable_info acpi_dm_table_info_rsdp2[];
196extern struct acpi_dmtable_info acpi_dm_table_info_sbst[];
197extern struct acpi_dmtable_info acpi_dm_table_info_slic[];
198extern struct acpi_dmtable_info acpi_dm_table_info_slit[];
199extern struct acpi_dmtable_info acpi_dm_table_info_spcr[];
200extern struct acpi_dmtable_info acpi_dm_table_info_spmi[];
201extern struct acpi_dmtable_info acpi_dm_table_info_srat[];
202extern struct acpi_dmtable_info acpi_dm_table_info_srat_hdr[];
203extern struct acpi_dmtable_info acpi_dm_table_info_srat0[];
204extern struct acpi_dmtable_info acpi_dm_table_info_srat1[];
205extern struct acpi_dmtable_info acpi_dm_table_info_srat2[];
206extern struct acpi_dmtable_info acpi_dm_table_info_tcpa[];
207extern struct acpi_dmtable_info acpi_dm_table_info_wdrt[];
208
209/*
210 * dmtable
211 */
212void acpi_dm_dump_data_table(struct acpi_table_header *table);
213
214acpi_status
215acpi_dm_dump_table(u32 table_length,
216 u32 table_offset,
217 void *table,
218 u32 sub_table_length, struct acpi_dmtable_info *info);
219
220void acpi_dm_line_header(u32 offset, u32 byte_length, char *name);
221
222void acpi_dm_line_header2(u32 offset, u32 byte_length, char *name, u32 value);
223
224/*
225 * dmtbdump
226 */
227void acpi_dm_dump_asf(struct acpi_table_header *table);
228
229void acpi_dm_dump_cpep(struct acpi_table_header *table);
230
231void acpi_dm_dump_dmar(struct acpi_table_header *table);
232
233void acpi_dm_dump_einj(struct acpi_table_header *table);
234
235void acpi_dm_dump_erst(struct acpi_table_header *table);
236
237void acpi_dm_dump_fadt(struct acpi_table_header *table);
238
239void acpi_dm_dump_hest(struct acpi_table_header *table);
240
241void acpi_dm_dump_mcfg(struct acpi_table_header *table);
242
243void acpi_dm_dump_madt(struct acpi_table_header *table);
244
245u32 acpi_dm_dump_rsdp(struct acpi_table_header *table);
246
247void acpi_dm_dump_rsdt(struct acpi_table_header *table);
248
249void acpi_dm_dump_slit(struct acpi_table_header *table);
250
251void acpi_dm_dump_srat(struct acpi_table_header *table);
252
253void acpi_dm_dump_xsdt(struct acpi_table_header *table);
254
255/*
256 * dmwalk
257 */
258void
259acpi_dm_disassemble(struct acpi_walk_state *walk_state,
260 union acpi_parse_object *origin, u32 num_opcodes);
261
262void
263acpi_dm_walk_parse_tree(union acpi_parse_object *op,
264 asl_walk_callback descending_callback,
265 asl_walk_callback ascending_callback, void *context);
266
267/*
268 * dmopcode
269 */
270void
271acpi_dm_disassemble_one_op(struct acpi_walk_state *walk_state,
272 struct acpi_op_walk_info *info,
273 union acpi_parse_object *op);
274
275void acpi_dm_decode_internal_object(union acpi_operand_object *obj_desc);
276
277u32 acpi_dm_list_type(union acpi_parse_object *op);
278
279void acpi_dm_method_flags(union acpi_parse_object *op);
280
281void acpi_dm_field_flags(union acpi_parse_object *op);
282
283void acpi_dm_address_space(u8 space_id);
284
285void acpi_dm_region_flags(union acpi_parse_object *op);
286
287void acpi_dm_match_op(union acpi_parse_object *op);
288
289u8 acpi_dm_comma_if_list_member(union acpi_parse_object *op);
290
291void acpi_dm_comma_if_field_member(union acpi_parse_object *op);
292
293/*
294 * dmnames
295 */
296u32 acpi_dm_dump_name(char *name);
297
298acpi_status
299acpi_ps_display_object_pathname(struct acpi_walk_state *walk_state,
300 union acpi_parse_object *op);
301
302void acpi_dm_namestring(char *name);
303
304/*
305 * dmobject
306 */
307void
308acpi_dm_display_internal_object(union acpi_operand_object *obj_desc,
309 struct acpi_walk_state *walk_state);
310
311void acpi_dm_display_arguments(struct acpi_walk_state *walk_state);
312
313void acpi_dm_display_locals(struct acpi_walk_state *walk_state);
314
315void
316acpi_dm_dump_method_info(acpi_status status,
317 struct acpi_walk_state *walk_state,
318 union acpi_parse_object *op);
319
320/*
321 * dmbuffer
322 */
323void acpi_dm_disasm_byte_list(u32 level, u8 * byte_data, u32 byte_count);
324
325void
326acpi_dm_byte_list(struct acpi_op_walk_info *info, union acpi_parse_object *op);
327
328void acpi_dm_is_eisa_id(union acpi_parse_object *op);
329
330void acpi_dm_eisa_id(u32 encoded_id);
331
332u8 acpi_dm_is_unicode_buffer(union acpi_parse_object *op);
333
334u8 acpi_dm_is_string_buffer(union acpi_parse_object *op);
335
336/*
337 * dmresrc
338 */
339void acpi_dm_dump_integer8(u8 value, char *name);
340
341void acpi_dm_dump_integer16(u16 value, char *name);
342
343void acpi_dm_dump_integer32(u32 value, char *name);
344
345void acpi_dm_dump_integer64(u64 value, char *name);
346
347void
348acpi_dm_resource_template(struct acpi_op_walk_info *info,
349 union acpi_parse_object *op,
350 u8 * byte_data, u32 byte_count);
351
352acpi_status acpi_dm_is_resource_template(union acpi_parse_object *op);
353
354void acpi_dm_indent(u32 level);
355
356void acpi_dm_bit_list(u16 mask);
357
358void acpi_dm_decode_attribute(u8 attribute);
359
360void acpi_dm_descriptor_name(void);
361
362/*
363 * dmresrcl
364 */
365void
366acpi_dm_word_descriptor(union aml_resource *resource, u32 length, u32 level);
367
368void
369acpi_dm_dword_descriptor(union aml_resource *resource, u32 length, u32 level);
370
371void
372acpi_dm_extended_descriptor(union aml_resource *resource,
373 u32 length, u32 level);
374
375void
376acpi_dm_qword_descriptor(union aml_resource *resource, u32 length, u32 level);
377
378void
379acpi_dm_memory24_descriptor(union aml_resource *resource,
380 u32 length, u32 level);
381
382void
383acpi_dm_memory32_descriptor(union aml_resource *resource,
384 u32 length, u32 level);
385
386void
387acpi_dm_fixed_memory32_descriptor(union aml_resource *resource,
388 u32 length, u32 level);
389
390void
391acpi_dm_generic_register_descriptor(union aml_resource *resource,
392 u32 length, u32 level);
393
394void
395acpi_dm_interrupt_descriptor(union aml_resource *resource,
396 u32 length, u32 level);
397
398void
399acpi_dm_vendor_large_descriptor(union aml_resource *resource,
400 u32 length, u32 level);
401
402void acpi_dm_vendor_common(char *name, u8 * byte_data, u32 length, u32 level);
403
404/*
405 * dmresrcs
406 */
407void
408acpi_dm_irq_descriptor(union aml_resource *resource, u32 length, u32 level);
409
410void
411acpi_dm_dma_descriptor(union aml_resource *resource, u32 length, u32 level);
412
413void acpi_dm_io_descriptor(union aml_resource *resource, u32 length, u32 level);
414
415void
416acpi_dm_fixed_io_descriptor(union aml_resource *resource,
417 u32 length, u32 level);
418
419void
420acpi_dm_start_dependent_descriptor(union aml_resource *resource,
421 u32 length, u32 level);
422
423void
424acpi_dm_end_dependent_descriptor(union aml_resource *resource,
425 u32 length, u32 level);
426
427void
428acpi_dm_vendor_small_descriptor(union aml_resource *resource,
429 u32 length, u32 level);
430
431/*
432 * dmutils
433 */
434void acpi_dm_add_to_external_list(char *path, u8 type, u32 value);
435
436/*
437 * dmrestag
438 */
439void acpi_dm_find_resources(union acpi_parse_object *root);
440
441void
442acpi_dm_check_resource_reference(union acpi_parse_object *op,
443 struct acpi_walk_state *walk_state);
444
445#endif /* __ACDISASM_H__ */
diff --git a/include/acpi/acdispat.h b/include/acpi/acdispat.h
deleted file mode 100644
index 6291904be01e..000000000000
--- a/include/acpi/acdispat.h
+++ /dev/null
@@ -1,345 +0,0 @@
1/******************************************************************************
2 *
3 * Name: acdispat.h - dispatcher (parser to interpreter interface)
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef _ACDISPAT_H_
45#define _ACDISPAT_H_
46
47#define NAMEOF_LOCAL_NTE "__L0"
48#define NAMEOF_ARG_NTE "__A0"
49
50/*
51 * dsopcode - support for late evaluation
52 */
53acpi_status
54acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc);
55
56acpi_status
57acpi_ds_get_bank_field_arguments(union acpi_operand_object *obj_desc);
58
59acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *rgn_desc);
60
61acpi_status acpi_ds_get_buffer_arguments(union acpi_operand_object *obj_desc);
62
63acpi_status acpi_ds_get_package_arguments(union acpi_operand_object *obj_desc);
64
65acpi_status
66acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state,
67 union acpi_parse_object *op);
68
69acpi_status
70acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state,
71 union acpi_parse_object *op);
72
73acpi_status
74acpi_ds_eval_table_region_operands(struct acpi_walk_state *walk_state,
75 union acpi_parse_object *op);
76
77acpi_status
78acpi_ds_eval_data_object_operands(struct acpi_walk_state *walk_state,
79 union acpi_parse_object *op,
80 union acpi_operand_object *obj_desc);
81
82acpi_status
83acpi_ds_eval_bank_field_operands(struct acpi_walk_state *walk_state,
84 union acpi_parse_object *op);
85
86acpi_status acpi_ds_initialize_region(acpi_handle obj_handle);
87
88/*
89 * dsctrl - Parser/Interpreter interface, control stack routines
90 */
91acpi_status
92acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state,
93 union acpi_parse_object *op);
94
95acpi_status
96acpi_ds_exec_end_control_op(struct acpi_walk_state *walk_state,
97 union acpi_parse_object *op);
98
99/*
100 * dsexec - Parser/Interpreter interface, method execution callbacks
101 */
102acpi_status
103acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state,
104 union acpi_operand_object *result_obj);
105
106acpi_status
107acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state,
108 union acpi_parse_object **out_op);
109
110acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *state);
111
112/*
113 * dsfield - Parser/Interpreter interface for AML fields
114 */
115acpi_status
116acpi_ds_create_field(union acpi_parse_object *op,
117 struct acpi_namespace_node *region_node,
118 struct acpi_walk_state *walk_state);
119
120acpi_status
121acpi_ds_create_bank_field(union acpi_parse_object *op,
122 struct acpi_namespace_node *region_node,
123 struct acpi_walk_state *walk_state);
124
125acpi_status
126acpi_ds_create_index_field(union acpi_parse_object *op,
127 struct acpi_namespace_node *region_node,
128 struct acpi_walk_state *walk_state);
129
130acpi_status
131acpi_ds_create_buffer_field(union acpi_parse_object *op,
132 struct acpi_walk_state *walk_state);
133
134acpi_status
135acpi_ds_init_field_objects(union acpi_parse_object *op,
136 struct acpi_walk_state *walk_state);
137
138/*
139 * dsload - Parser/Interpreter interface, namespace load callbacks
140 */
141acpi_status
142acpi_ds_load1_begin_op(struct acpi_walk_state *walk_state,
143 union acpi_parse_object **out_op);
144
145acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state);
146
147acpi_status
148acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
149 union acpi_parse_object **out_op);
150
151acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state);
152
153acpi_status
154acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number);
155
156/*
157 * dsmthdat - method data (locals/args)
158 */
159acpi_status
160acpi_ds_store_object_to_local(u8 type,
161 u32 index,
162 union acpi_operand_object *src_desc,
163 struct acpi_walk_state *walk_state);
164
165acpi_status
166acpi_ds_method_data_get_entry(u16 opcode,
167 u32 index,
168 struct acpi_walk_state *walk_state,
169 union acpi_operand_object ***node);
170
171void acpi_ds_method_data_delete_all(struct acpi_walk_state *walk_state);
172
173u8 acpi_ds_is_method_value(union acpi_operand_object *obj_desc);
174
175acpi_status
176acpi_ds_method_data_get_value(u8 type,
177 u32 index,
178 struct acpi_walk_state *walk_state,
179 union acpi_operand_object **dest_desc);
180
181acpi_status
182acpi_ds_method_data_init_args(union acpi_operand_object **params,
183 u32 max_param_count,
184 struct acpi_walk_state *walk_state);
185
186acpi_status
187acpi_ds_method_data_get_node(u8 type,
188 u32 index,
189 struct acpi_walk_state *walk_state,
190 struct acpi_namespace_node **node);
191
192void acpi_ds_method_data_init(struct acpi_walk_state *walk_state);
193
194/*
195 * dsmethod - Parser/Interpreter interface - control method parsing
196 */
197acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node);
198
199acpi_status
200acpi_ds_call_control_method(struct acpi_thread_state *thread,
201 struct acpi_walk_state *walk_state,
202 union acpi_parse_object *op);
203
204acpi_status
205acpi_ds_restart_control_method(struct acpi_walk_state *walk_state,
206 union acpi_operand_object *return_desc);
207
208void
209acpi_ds_terminate_control_method(union acpi_operand_object *method_desc,
210 struct acpi_walk_state *walk_state);
211
212acpi_status
213acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node,
214 union acpi_operand_object *obj_desc,
215 struct acpi_walk_state *walk_state);
216
217acpi_status
218acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state);
219
220/*
221 * dsinit
222 */
223acpi_status
224acpi_ds_initialize_objects(u32 table_index,
225 struct acpi_namespace_node *start_node);
226
227/*
228 * dsobject - Parser/Interpreter interface - object initialization and conversion
229 */
230acpi_status
231acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state,
232 union acpi_parse_object *op,
233 u32 buffer_length,
234 union acpi_operand_object **obj_desc_ptr);
235
236acpi_status
237acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
238 union acpi_parse_object *op,
239 u32 package_length,
240 union acpi_operand_object **obj_desc);
241
242acpi_status
243acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
244 union acpi_parse_object *op,
245 u16 opcode, union acpi_operand_object **obj_desc);
246
247acpi_status
248acpi_ds_create_node(struct acpi_walk_state *walk_state,
249 struct acpi_namespace_node *node,
250 union acpi_parse_object *op);
251
252/*
253 * dsutils - Parser/Interpreter interface utility routines
254 */
255void acpi_ds_clear_implicit_return(struct acpi_walk_state *walk_state);
256
257u8
258acpi_ds_do_implicit_return(union acpi_operand_object *return_desc,
259 struct acpi_walk_state *walk_state,
260 u8 add_reference);
261
262u8
263acpi_ds_is_result_used(union acpi_parse_object *op,
264 struct acpi_walk_state *walk_state);
265
266void
267acpi_ds_delete_result_if_not_used(union acpi_parse_object *op,
268 union acpi_operand_object *result_obj,
269 struct acpi_walk_state *walk_state);
270
271acpi_status
272acpi_ds_create_operand(struct acpi_walk_state *walk_state,
273 union acpi_parse_object *arg, u32 args_remaining);
274
275acpi_status
276acpi_ds_create_operands(struct acpi_walk_state *walk_state,
277 union acpi_parse_object *first_arg);
278
279acpi_status acpi_ds_resolve_operands(struct acpi_walk_state *walk_state);
280
281void acpi_ds_clear_operands(struct acpi_walk_state *walk_state);
282
283acpi_status acpi_ds_evaluate_name_path(struct acpi_walk_state *walk_state);
284
285/*
286 * dswscope - Scope Stack manipulation
287 */
288acpi_status
289acpi_ds_scope_stack_push(struct acpi_namespace_node *node,
290 acpi_object_type type,
291 struct acpi_walk_state *walk_state);
292
293acpi_status acpi_ds_scope_stack_pop(struct acpi_walk_state *walk_state);
294
295void acpi_ds_scope_stack_clear(struct acpi_walk_state *walk_state);
296
297/*
298 * dswstate - parser WALK_STATE management routines
299 */
300acpi_status
301acpi_ds_obj_stack_push(void *object, struct acpi_walk_state *walk_state);
302
303acpi_status
304acpi_ds_obj_stack_pop(u32 pop_count, struct acpi_walk_state *walk_state);
305
306struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id, union acpi_parse_object
307 *origin, union acpi_operand_object
308 *mth_desc, struct acpi_thread_state
309 *thread);
310
311acpi_status
312acpi_ds_init_aml_walk(struct acpi_walk_state *walk_state,
313 union acpi_parse_object *op,
314 struct acpi_namespace_node *method_node,
315 u8 * aml_start,
316 u32 aml_length,
317 struct acpi_evaluate_info *info, u8 pass_number);
318
319void
320acpi_ds_obj_stack_pop_and_delete(u32 pop_count,
321 struct acpi_walk_state *walk_state);
322
323void acpi_ds_delete_walk_state(struct acpi_walk_state *walk_state);
324
325struct acpi_walk_state *acpi_ds_pop_walk_state(struct acpi_thread_state
326 *thread);
327
328void
329acpi_ds_push_walk_state(struct acpi_walk_state *walk_state,
330 struct acpi_thread_state *thread);
331
332acpi_status acpi_ds_result_stack_clear(struct acpi_walk_state *walk_state);
333
334struct acpi_walk_state *acpi_ds_get_current_walk_state(struct acpi_thread_state
335 *thread);
336
337acpi_status
338acpi_ds_result_pop(union acpi_operand_object **object,
339 struct acpi_walk_state *walk_state);
340
341acpi_status
342acpi_ds_result_push(union acpi_operand_object *object,
343 struct acpi_walk_state *walk_state);
344
345#endif /* _ACDISPAT_H_ */
diff --git a/include/acpi/acevents.h b/include/acpi/acevents.h
deleted file mode 100644
index d5d099bf349c..000000000000
--- a/include/acpi/acevents.h
+++ /dev/null
@@ -1,216 +0,0 @@
1/******************************************************************************
2 *
3 * Name: acevents.h - Event subcomponent prototypes and defines
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACEVENTS_H__
45#define __ACEVENTS_H__
46
47/*
48 * evevent
49 */
50acpi_status acpi_ev_initialize_events(void);
51
52acpi_status acpi_ev_install_xrupt_handlers(void);
53
54acpi_status acpi_ev_install_fadt_gpes(void);
55
56u32 acpi_ev_fixed_event_detect(void);
57
58/*
59 * evmisc
60 */
61u8 acpi_ev_is_notify_object(struct acpi_namespace_node *node);
62
63acpi_status acpi_ev_acquire_global_lock(u16 timeout);
64
65acpi_status acpi_ev_release_global_lock(void);
66
67acpi_status acpi_ev_init_global_lock_handler(void);
68
69u32 acpi_ev_get_gpe_number_index(u32 gpe_number);
70
71acpi_status
72acpi_ev_queue_notify_request(struct acpi_namespace_node *node,
73 u32 notify_value);
74
75/*
76 * evgpe - GPE handling and dispatch
77 */
78acpi_status
79acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info,
80 u8 type);
81
82acpi_status
83acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info,
84 u8 write_to_hardware);
85
86acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info);
87
88struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device,
89 u32 gpe_number);
90
91/*
92 * evgpeblk
93 */
94u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info);
95
96acpi_status acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback);
97
98acpi_status
99acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
100 struct acpi_gpe_block_info *gpe_block);
101
102acpi_status
103acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
104 struct acpi_generic_address *gpe_block_address,
105 u32 register_count,
106 u8 gpe_block_base_number,
107 u32 interrupt_number,
108 struct acpi_gpe_block_info **return_gpe_block);
109
110acpi_status
111acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device,
112 struct acpi_gpe_block_info *gpe_block);
113
114acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block);
115
116u32
117acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info,
118 u32 gpe_number);
119
120u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info *gpe_xrupt_list);
121
122acpi_status
123acpi_ev_set_gpe_type(struct acpi_gpe_event_info *gpe_event_info, u8 type);
124
125acpi_status
126acpi_ev_check_for_wake_only_gpe(struct acpi_gpe_event_info *gpe_event_info);
127
128acpi_status acpi_ev_gpe_initialize(void);
129
130/*
131 * evregion - Address Space handling
132 */
133acpi_status acpi_ev_install_region_handlers(void);
134
135acpi_status acpi_ev_initialize_op_regions(void);
136
137acpi_status
138acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
139 u32 function,
140 acpi_physical_address address,
141 u32 bit_width, acpi_integer * value);
142
143acpi_status
144acpi_ev_attach_region(union acpi_operand_object *handler_obj,
145 union acpi_operand_object *region_obj,
146 u8 acpi_ns_is_locked);
147
148void
149acpi_ev_detach_region(union acpi_operand_object *region_obj,
150 u8 acpi_ns_is_locked);
151
152acpi_status
153acpi_ev_install_space_handler(struct acpi_namespace_node *node,
154 acpi_adr_space_type space_id,
155 acpi_adr_space_handler handler,
156 acpi_adr_space_setup setup, void *context);
157
158acpi_status
159acpi_ev_execute_reg_methods(struct acpi_namespace_node *node,
160 acpi_adr_space_type space_id);
161
162acpi_status
163acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function);
164
165/*
166 * evregini - Region initialization and setup
167 */
168acpi_status
169acpi_ev_system_memory_region_setup(acpi_handle handle,
170 u32 function,
171 void *handler_context,
172 void **region_context);
173
174acpi_status
175acpi_ev_io_space_region_setup(acpi_handle handle,
176 u32 function,
177 void *handler_context, void **region_context);
178
179acpi_status
180acpi_ev_pci_config_region_setup(acpi_handle handle,
181 u32 function,
182 void *handler_context, void **region_context);
183
184acpi_status
185acpi_ev_cmos_region_setup(acpi_handle handle,
186 u32 function,
187 void *handler_context, void **region_context);
188
189acpi_status
190acpi_ev_pci_bar_region_setup(acpi_handle handle,
191 u32 function,
192 void *handler_context, void **region_context);
193
194acpi_status
195acpi_ev_default_region_setup(acpi_handle handle,
196 u32 function,
197 void *handler_context, void **region_context);
198
199acpi_status
200acpi_ev_initialize_region(union acpi_operand_object *region_obj,
201 u8 acpi_ns_locked);
202
203/*
204 * evsci - SCI (System Control Interrupt) handling/dispatch
205 */
206u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context);
207
208u32 acpi_ev_install_sci_handler(void);
209
210acpi_status acpi_ev_remove_sci_handler(void);
211
212u32 acpi_ev_initialize_sCI(u32 program_sCI);
213
214void acpi_ev_terminate(void);
215
216#endif /* __ACEVENTS_H__ */
diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h
index 84f5cb242863..eda04546cdf6 100644
--- a/include/acpi/acexcep.h
+++ b/include/acpi/acexcep.h
@@ -153,8 +153,9 @@
153#define AE_AML_CIRCULAR_REFERENCE (acpi_status) (0x001E | AE_CODE_AML) 153#define AE_AML_CIRCULAR_REFERENCE (acpi_status) (0x001E | AE_CODE_AML)
154#define AE_AML_BAD_RESOURCE_LENGTH (acpi_status) (0x001F | AE_CODE_AML) 154#define AE_AML_BAD_RESOURCE_LENGTH (acpi_status) (0x001F | AE_CODE_AML)
155#define AE_AML_ILLEGAL_ADDRESS (acpi_status) (0x0020 | AE_CODE_AML) 155#define AE_AML_ILLEGAL_ADDRESS (acpi_status) (0x0020 | AE_CODE_AML)
156#define AE_AML_INFINITE_LOOP (acpi_status) (0x0021 | AE_CODE_AML)
156 157
157#define AE_CODE_AML_MAX 0x0020 158#define AE_CODE_AML_MAX 0x0021
158 159
159/* 160/*
160 * Internal exceptions used for control 161 * Internal exceptions used for control
@@ -175,6 +176,8 @@
175 176
176#define AE_CODE_CTRL_MAX 0x000D 177#define AE_CODE_CTRL_MAX 0x000D
177 178
179/* Exception strings for acpi_format_exception */
180
178#ifdef DEFINE_ACPI_GLOBALS 181#ifdef DEFINE_ACPI_GLOBALS
179 182
180/* 183/*
@@ -267,6 +270,7 @@ char const *acpi_gbl_exception_names_aml[] = {
267 "AE_AML_CIRCULAR_REFERENCE", 270 "AE_AML_CIRCULAR_REFERENCE",
268 "AE_AML_BAD_RESOURCE_LENGTH", 271 "AE_AML_BAD_RESOURCE_LENGTH",
269 "AE_AML_ILLEGAL_ADDRESS", 272 "AE_AML_ILLEGAL_ADDRESS",
273 "AE_AML_INFINITE_LOOP"
270}; 274};
271 275
272char const *acpi_gbl_exception_names_ctrl[] = { 276char const *acpi_gbl_exception_names_ctrl[] = {
diff --git a/include/acpi/acglobal.h b/include/acpi/acglobal.h
deleted file mode 100644
index 15dda46b70d1..000000000000
--- a/include/acpi/acglobal.h
+++ /dev/null
@@ -1,387 +0,0 @@
1/******************************************************************************
2 *
3 * Name: acglobal.h - Declarations for global variables
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACGLOBAL_H__
45#define __ACGLOBAL_H__
46
47/*
48 * Ensure that the globals are actually defined and initialized only once.
49 *
50 * The use of these macros allows a single list of globals (here) in order
51 * to simplify maintenance of the code.
52 */
53#ifdef DEFINE_ACPI_GLOBALS
54#define ACPI_EXTERN
55#define ACPI_INIT_GLOBAL(a,b) a=b
56#else
57#define ACPI_EXTERN extern
58#define ACPI_INIT_GLOBAL(a,b) a
59#endif
60
61/*****************************************************************************
62 *
63 * Runtime configuration (static defaults that can be overriden at runtime)
64 *
65 ****************************************************************************/
66
67/*
68 * Enable "slack" in the AML interpreter? Default is FALSE, and the
69 * interpreter strictly follows the ACPI specification. Setting to TRUE
70 * allows the interpreter to ignore certain errors and/or bad AML constructs.
71 *
72 * Currently, these features are enabled by this flag:
73 *
74 * 1) Allow "implicit return" of last value in a control method
75 * 2) Allow access beyond the end of an operation region
76 * 3) Allow access to uninitialized locals/args (auto-init to integer 0)
77 * 4) Allow ANY object type to be a source operand for the Store() operator
78 * 5) Allow unresolved references (invalid target name) in package objects
79 * 6) Enable warning messages for behavior that is not ACPI spec compliant
80 */
81ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_interpreter_slack, FALSE);
82
83/*
84 * Automatically serialize ALL control methods? Default is FALSE, meaning
85 * to use the Serialized/not_serialized method flags on a per method basis.
86 * Only change this if the ASL code is poorly written and cannot handle
87 * reentrancy even though methods are marked "NotSerialized".
88 */
89ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_all_methods_serialized, FALSE);
90
91/*
92 * Create the predefined _OSI method in the namespace? Default is TRUE
93 * because ACPI CA is fully compatible with other ACPI implementations.
94 * Changing this will revert ACPI CA (and machine ASL) to pre-OSI behavior.
95 */
96ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_create_osi_method, TRUE);
97
98/*
99 * Disable wakeup GPEs during runtime? Default is TRUE because WAKE and
100 * RUNTIME GPEs should never be shared, and WAKE GPEs should typically only
101 * be enabled just before going to sleep.
102 */
103ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_leave_wake_gpes_disabled, TRUE);
104
105/*****************************************************************************
106 *
107 * Debug support
108 *
109 ****************************************************************************/
110
111/* Runtime configuration of debug print levels */
112
113extern u32 acpi_dbg_level;
114extern u32 acpi_dbg_layer;
115
116/* Procedure nesting level for debug output */
117
118extern u32 acpi_gbl_nesting_level;
119
120/* Support for dynamic control method tracing mechanism */
121
122ACPI_EXTERN u32 acpi_gbl_original_dbg_level;
123ACPI_EXTERN u32 acpi_gbl_original_dbg_layer;
124ACPI_EXTERN acpi_name acpi_gbl_trace_method_name;
125ACPI_EXTERN u32 acpi_gbl_trace_dbg_level;
126ACPI_EXTERN u32 acpi_gbl_trace_dbg_layer;
127ACPI_EXTERN u32 acpi_gbl_trace_flags;
128
129/*****************************************************************************
130 *
131 * ACPI Table globals
132 *
133 ****************************************************************************/
134
135/*
136 * acpi_gbl_root_table_list is the master list of ACPI tables found in the
137 * RSDT/XSDT.
138 *
139 * acpi_gbl_FADT is a local copy of the FADT, converted to a common format.
140 */
141ACPI_EXTERN struct acpi_internal_rsdt acpi_gbl_root_table_list;
142ACPI_EXTERN struct acpi_table_fadt acpi_gbl_FADT;
143extern u8 acpi_gbl_permanent_mmap;
144
145/* These addresses are calculated from FADT address values */
146
147ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1a_enable;
148ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1b_enable;
149
150/*
151 * Handle both ACPI 1.0 and ACPI 2.0 Integer widths. The integer width is
152 * determined by the revision of the DSDT: If the DSDT revision is less than
153 * 2, use only the lower 32 bits of the internal 64-bit Integer.
154 */
155ACPI_EXTERN u8 acpi_gbl_integer_bit_width;
156ACPI_EXTERN u8 acpi_gbl_integer_byte_width;
157ACPI_EXTERN u8 acpi_gbl_integer_nybble_width;
158
159/*****************************************************************************
160 *
161 * Mutual exlusion within ACPICA subsystem
162 *
163 ****************************************************************************/
164
165/*
166 * Predefined mutex objects. This array contains the
167 * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs.
168 * (The table maps local handles to the real OS handles)
169 */
170ACPI_EXTERN struct acpi_mutex_info acpi_gbl_mutex_info[ACPI_NUM_MUTEX];
171
172/*
173 * Global lock mutex is an actual AML mutex object
174 * Global lock semaphore works in conjunction with the HW global lock
175 */
176ACPI_EXTERN union acpi_operand_object *acpi_gbl_global_lock_mutex;
177ACPI_EXTERN acpi_semaphore acpi_gbl_global_lock_semaphore;
178ACPI_EXTERN u16 acpi_gbl_global_lock_handle;
179ACPI_EXTERN u8 acpi_gbl_global_lock_acquired;
180ACPI_EXTERN u8 acpi_gbl_global_lock_present;
181
182/*
183 * Spinlocks are used for interfaces that can be possibly called at
184 * interrupt level
185 */
186ACPI_EXTERN spinlock_t _acpi_gbl_gpe_lock; /* For GPE data structs and registers */
187ACPI_EXTERN spinlock_t _acpi_gbl_hardware_lock; /* For ACPI H/W except GPE registers */
188#define acpi_gbl_gpe_lock &_acpi_gbl_gpe_lock
189#define acpi_gbl_hardware_lock &_acpi_gbl_hardware_lock
190
191/*****************************************************************************
192 *
193 * Miscellaneous globals
194 *
195 ****************************************************************************/
196
197#ifdef ACPI_DBG_TRACK_ALLOCATIONS
198
199/* Lists for tracking memory allocations */
200
201ACPI_EXTERN struct acpi_memory_list *acpi_gbl_global_list;
202ACPI_EXTERN struct acpi_memory_list *acpi_gbl_ns_node_list;
203ACPI_EXTERN u8 acpi_gbl_display_final_mem_stats;
204#endif
205
206/* Object caches */
207
208ACPI_EXTERN acpi_cache_t *acpi_gbl_namespace_cache;
209ACPI_EXTERN acpi_cache_t *acpi_gbl_state_cache;
210ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_cache;
211ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_ext_cache;
212ACPI_EXTERN acpi_cache_t *acpi_gbl_operand_cache;
213
214/* Global handlers */
215
216ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_device_notify;
217ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_system_notify;
218ACPI_EXTERN acpi_exception_handler acpi_gbl_exception_handler;
219ACPI_EXTERN acpi_init_handler acpi_gbl_init_handler;
220ACPI_EXTERN acpi_tbl_handler acpi_gbl_table_handler;
221ACPI_EXTERN void *acpi_gbl_table_handler_context;
222ACPI_EXTERN struct acpi_walk_state *acpi_gbl_breakpoint_walk;
223
224/* Owner ID support */
225
226ACPI_EXTERN u32 acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS];
227ACPI_EXTERN u8 acpi_gbl_last_owner_id_index;
228ACPI_EXTERN u8 acpi_gbl_next_owner_id_offset;
229
230/* Misc */
231
232ACPI_EXTERN u32 acpi_gbl_original_mode;
233ACPI_EXTERN u32 acpi_gbl_rsdp_original_location;
234ACPI_EXTERN u32 acpi_gbl_ns_lookup_count;
235ACPI_EXTERN u32 acpi_gbl_ps_find_count;
236ACPI_EXTERN u16 acpi_gbl_pm1_enable_register_save;
237ACPI_EXTERN u8 acpi_gbl_debugger_configuration;
238ACPI_EXTERN u8 acpi_gbl_step_to_next_call;
239ACPI_EXTERN u8 acpi_gbl_acpi_hardware_present;
240ACPI_EXTERN u8 acpi_gbl_events_initialized;
241ACPI_EXTERN u8 acpi_gbl_system_awake_and_running;
242
243#ifndef DEFINE_ACPI_GLOBALS
244
245/* Other miscellaneous */
246
247extern u8 acpi_gbl_shutdown;
248extern u32 acpi_gbl_startup_flags;
249extern const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT];
250extern const char *acpi_gbl_highest_dstate_names[4];
251extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES];
252extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS];
253
254#endif
255
256/* Exception codes */
257
258extern char const *acpi_gbl_exception_names_env[];
259extern char const *acpi_gbl_exception_names_pgm[];
260extern char const *acpi_gbl_exception_names_tbl[];
261extern char const *acpi_gbl_exception_names_aml[];
262extern char const *acpi_gbl_exception_names_ctrl[];
263
264/*****************************************************************************
265 *
266 * Namespace globals
267 *
268 ****************************************************************************/
269
270#if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)
271#define NUM_PREDEFINED_NAMES 10
272#else
273#define NUM_PREDEFINED_NAMES 9
274#endif
275
276ACPI_EXTERN struct acpi_namespace_node acpi_gbl_root_node_struct;
277ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_root_node;
278ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_fadt_gpe_device;
279
280extern const u8 acpi_gbl_ns_properties[ACPI_NUM_NS_TYPES];
281extern const struct acpi_predefined_names
282 acpi_gbl_pre_defined_names[NUM_PREDEFINED_NAMES];
283
284#ifdef ACPI_DEBUG_OUTPUT
285ACPI_EXTERN u32 acpi_gbl_current_node_count;
286ACPI_EXTERN u32 acpi_gbl_current_node_size;
287ACPI_EXTERN u32 acpi_gbl_max_concurrent_node_count;
288ACPI_EXTERN acpi_size *acpi_gbl_entry_stack_pointer;
289ACPI_EXTERN acpi_size *acpi_gbl_lowest_stack_pointer;
290ACPI_EXTERN u32 acpi_gbl_deepest_nesting;
291#endif
292
293/*****************************************************************************
294 *
295 * Interpreter globals
296 *
297 ****************************************************************************/
298
299ACPI_EXTERN struct acpi_thread_state *acpi_gbl_current_walk_list;
300
301/* Control method single step flag */
302
303ACPI_EXTERN u8 acpi_gbl_cm_single_step;
304
305/*****************************************************************************
306 *
307 * Hardware globals
308 *
309 ****************************************************************************/
310
311extern struct acpi_bit_register_info
312 acpi_gbl_bit_register_info[ACPI_NUM_BITREG];
313ACPI_EXTERN u8 acpi_gbl_sleep_type_a;
314ACPI_EXTERN u8 acpi_gbl_sleep_type_b;
315
316/*****************************************************************************
317 *
318 * Event and GPE globals
319 *
320 ****************************************************************************/
321
322extern struct acpi_fixed_event_info
323 acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS];
324ACPI_EXTERN struct acpi_fixed_event_handler
325 acpi_gbl_fixed_event_handlers[ACPI_NUM_FIXED_EVENTS];
326ACPI_EXTERN struct acpi_gpe_xrupt_info *acpi_gbl_gpe_xrupt_list_head;
327ACPI_EXTERN struct acpi_gpe_block_info
328*acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS];
329
330/*****************************************************************************
331 *
332 * Debugger globals
333 *
334 ****************************************************************************/
335
336ACPI_EXTERN u8 acpi_gbl_db_output_flags;
337
338#ifdef ACPI_DISASSEMBLER
339
340ACPI_EXTERN u8 acpi_gbl_db_opt_disasm;
341ACPI_EXTERN u8 acpi_gbl_db_opt_verbose;
342#endif
343
344#ifdef ACPI_DEBUGGER
345
346extern u8 acpi_gbl_method_executing;
347extern u8 acpi_gbl_abort_method;
348extern u8 acpi_gbl_db_terminate_threads;
349
350ACPI_EXTERN int optind;
351ACPI_EXTERN char *optarg;
352
353ACPI_EXTERN u8 acpi_gbl_db_opt_tables;
354ACPI_EXTERN u8 acpi_gbl_db_opt_stats;
355ACPI_EXTERN u8 acpi_gbl_db_opt_ini_methods;
356
357ACPI_EXTERN char *acpi_gbl_db_args[ACPI_DEBUGGER_MAX_ARGS];
358ACPI_EXTERN char acpi_gbl_db_line_buf[80];
359ACPI_EXTERN char acpi_gbl_db_parsed_buf[80];
360ACPI_EXTERN char acpi_gbl_db_scope_buf[40];
361ACPI_EXTERN char acpi_gbl_db_debug_filename[40];
362ACPI_EXTERN u8 acpi_gbl_db_output_to_file;
363ACPI_EXTERN char *acpi_gbl_db_buffer;
364ACPI_EXTERN char *acpi_gbl_db_filename;
365ACPI_EXTERN u32 acpi_gbl_db_debug_level;
366ACPI_EXTERN u32 acpi_gbl_db_console_debug_level;
367ACPI_EXTERN struct acpi_table_header *acpi_gbl_db_table_ptr;
368ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_db_scope_node;
369
370/*
371 * Statistic globals
372 */
373ACPI_EXTERN u16 acpi_gbl_obj_type_count[ACPI_TYPE_NS_NODE_MAX + 1];
374ACPI_EXTERN u16 acpi_gbl_node_type_count[ACPI_TYPE_NS_NODE_MAX + 1];
375ACPI_EXTERN u16 acpi_gbl_obj_type_count_misc;
376ACPI_EXTERN u16 acpi_gbl_node_type_count_misc;
377ACPI_EXTERN u32 acpi_gbl_num_nodes;
378ACPI_EXTERN u32 acpi_gbl_num_objects;
379
380ACPI_EXTERN u32 acpi_gbl_size_of_parse_tree;
381ACPI_EXTERN u32 acpi_gbl_size_of_method_trees;
382ACPI_EXTERN u32 acpi_gbl_size_of_node_entries;
383ACPI_EXTERN u32 acpi_gbl_size_of_acpi_objects;
384
385#endif /* ACPI_DEBUGGER */
386
387#endif /* __ACGLOBAL_H__ */
diff --git a/include/acpi/achware.h b/include/acpi/achware.h
deleted file mode 100644
index 97a72b193276..000000000000
--- a/include/acpi/achware.h
+++ /dev/null
@@ -1,131 +0,0 @@
1/******************************************************************************
2 *
3 * Name: achware.h -- hardware specific interfaces
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACHWARE_H__
45#define __ACHWARE_H__
46
47/* PM Timer ticks per second (HZ) */
48
49#define PM_TIMER_FREQUENCY 3579545
50
51/* Values for the _SST reserved method */
52
53#define ACPI_SST_INDICATOR_OFF 0
54#define ACPI_SST_WORKING 1
55#define ACPI_SST_WAKING 2
56#define ACPI_SST_SLEEPING 3
57#define ACPI_SST_SLEEP_CONTEXT 4
58
59/* Prototypes */
60
61/*
62 * hwacpi - high level functions
63 */
64acpi_status acpi_hw_set_mode(u32 mode);
65
66u32 acpi_hw_get_mode(void);
67
68/*
69 * hwregs - ACPI Register I/O
70 */
71struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id);
72
73acpi_status
74acpi_hw_register_read(u32 register_id, u32 * return_value);
75
76acpi_status acpi_hw_register_write(u32 register_id, u32 value);
77
78acpi_status
79acpi_hw_low_level_read(u32 width,
80 u32 * value, struct acpi_generic_address *reg);
81
82acpi_status
83acpi_hw_low_level_write(u32 width, u32 value, struct acpi_generic_address *reg);
84
85acpi_status acpi_hw_clear_acpi_status(void);
86
87/*
88 * hwgpe - GPE support
89 */
90acpi_status acpi_hw_low_disable_gpe(struct acpi_gpe_event_info *gpe_event_info);
91
92acpi_status
93acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info *gpe_event_info);
94
95acpi_status
96acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
97 struct acpi_gpe_block_info *gpe_block);
98
99acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info *gpe_event_info);
100
101acpi_status
102acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
103 struct acpi_gpe_block_info *gpe_block);
104
105acpi_status
106acpi_hw_get_gpe_status(struct acpi_gpe_event_info *gpe_event_info,
107 acpi_event_status * event_status);
108
109acpi_status acpi_hw_disable_all_gpes(void);
110
111acpi_status acpi_hw_enable_all_runtime_gpes(void);
112
113acpi_status acpi_hw_enable_all_wakeup_gpes(void);
114
115acpi_status
116acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
117 struct acpi_gpe_block_info *gpe_block);
118
119#ifdef ACPI_FUTURE_USAGE
120/*
121 * hwtimer - ACPI Timer prototypes
122 */
123acpi_status acpi_get_timer_resolution(u32 * resolution);
124
125acpi_status acpi_get_timer(u32 * ticks);
126
127acpi_status
128acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed);
129#endif /* ACPI_FUTURE_USAGE */
130
131#endif /* __ACHWARE_H__ */
diff --git a/include/acpi/acinterp.h b/include/acpi/acinterp.h
deleted file mode 100644
index e8db7a3143a5..000000000000
--- a/include/acpi/acinterp.h
+++ /dev/null
@@ -1,529 +0,0 @@
1/******************************************************************************
2 *
3 * Name: acinterp.h - Interpreter subcomponent prototypes and defines
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACINTERP_H__
45#define __ACINTERP_H__
46
47#define ACPI_WALK_OPERANDS (&(walk_state->operands [walk_state->num_operands -1]))
48
49/* Macros for tables used for debug output */
50
51#define ACPI_EXD_OFFSET(f) (u8) ACPI_OFFSET (union acpi_operand_object,f)
52#define ACPI_EXD_NSOFFSET(f) (u8) ACPI_OFFSET (struct acpi_namespace_node,f)
53#define ACPI_EXD_TABLE_SIZE(name) (sizeof(name) / sizeof (struct acpi_exdump_info))
54
55/*
56 * If possible, pack the following structures to byte alignment, since we
57 * don't care about performance for debug output. Two cases where we cannot
58 * pack the structures:
59 *
60 * 1) Hardware does not support misaligned memory transfers
61 * 2) Compiler does not support pointers within packed structures
62 */
63#if (!defined(ACPI_MISALIGNMENT_NOT_SUPPORTED) && !defined(ACPI_PACKED_POINTERS_NOT_SUPPORTED))
64#pragma pack(1)
65#endif
66
67typedef const struct acpi_exdump_info {
68 u8 opcode;
69 u8 offset;
70 char *name;
71
72} acpi_exdump_info;
73
74/* Values for the Opcode field above */
75
76#define ACPI_EXD_INIT 0
77#define ACPI_EXD_TYPE 1
78#define ACPI_EXD_UINT8 2
79#define ACPI_EXD_UINT16 3
80#define ACPI_EXD_UINT32 4
81#define ACPI_EXD_UINT64 5
82#define ACPI_EXD_LITERAL 6
83#define ACPI_EXD_POINTER 7
84#define ACPI_EXD_ADDRESS 8
85#define ACPI_EXD_STRING 9
86#define ACPI_EXD_BUFFER 10
87#define ACPI_EXD_PACKAGE 11
88#define ACPI_EXD_FIELD 12
89#define ACPI_EXD_REFERENCE 13
90
91/* restore default alignment */
92
93#pragma pack()
94
95/*
96 * exconvrt - object conversion
97 */
98acpi_status
99acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
100 union acpi_operand_object **result_desc, u32 flags);
101
102acpi_status
103acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc,
104 union acpi_operand_object **result_desc);
105
106acpi_status
107acpi_ex_convert_to_string(union acpi_operand_object *obj_desc,
108 union acpi_operand_object **result_desc, u32 type);
109
110/* Types for ->String conversion */
111
112#define ACPI_EXPLICIT_BYTE_COPY 0x00000000
113#define ACPI_EXPLICIT_CONVERT_HEX 0x00000001
114#define ACPI_IMPLICIT_CONVERT_HEX 0x00000002
115#define ACPI_EXPLICIT_CONVERT_DECIMAL 0x00000003
116
117acpi_status
118acpi_ex_convert_to_target_type(acpi_object_type destination_type,
119 union acpi_operand_object *source_desc,
120 union acpi_operand_object **result_desc,
121 struct acpi_walk_state *walk_state);
122
123/*
124 * exfield - ACPI AML (p-code) execution - field manipulation
125 */
126acpi_status
127acpi_ex_common_buffer_setup(union acpi_operand_object *obj_desc,
128 u32 buffer_length, u32 * datum_count);
129
130acpi_status
131acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc,
132 acpi_integer mask,
133 acpi_integer field_value,
134 u32 field_datum_byte_offset);
135
136void
137acpi_ex_get_buffer_datum(acpi_integer * datum,
138 void *buffer,
139 u32 buffer_length,
140 u32 byte_granularity, u32 buffer_offset);
141
142void
143acpi_ex_set_buffer_datum(acpi_integer merged_datum,
144 void *buffer,
145 u32 buffer_length,
146 u32 byte_granularity, u32 buffer_offset);
147
148acpi_status
149acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
150 union acpi_operand_object *obj_desc,
151 union acpi_operand_object **ret_buffer_desc);
152
153acpi_status
154acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
155 union acpi_operand_object *obj_desc,
156 union acpi_operand_object **result_desc);
157
158/*
159 * exfldio - low level field I/O
160 */
161acpi_status
162acpi_ex_extract_from_field(union acpi_operand_object *obj_desc,
163 void *buffer, u32 buffer_length);
164
165acpi_status
166acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
167 void *buffer, u32 buffer_length);
168
169acpi_status
170acpi_ex_access_region(union acpi_operand_object *obj_desc,
171 u32 field_datum_byte_offset,
172 acpi_integer * value, u32 read_write);
173
174/*
175 * exmisc - misc support routines
176 */
177acpi_status
178acpi_ex_get_object_reference(union acpi_operand_object *obj_desc,
179 union acpi_operand_object **return_desc,
180 struct acpi_walk_state *walk_state);
181
182acpi_status
183acpi_ex_concat_template(union acpi_operand_object *obj_desc,
184 union acpi_operand_object *obj_desc2,
185 union acpi_operand_object **actual_return_desc,
186 struct acpi_walk_state *walk_state);
187
188acpi_status
189acpi_ex_do_concatenate(union acpi_operand_object *obj_desc,
190 union acpi_operand_object *obj_desc2,
191 union acpi_operand_object **actual_return_desc,
192 struct acpi_walk_state *walk_state);
193
194acpi_status
195acpi_ex_do_logical_numeric_op(u16 opcode,
196 acpi_integer integer0,
197 acpi_integer integer1, u8 * logical_result);
198
199acpi_status
200acpi_ex_do_logical_op(u16 opcode,
201 union acpi_operand_object *operand0,
202 union acpi_operand_object *operand1, u8 * logical_result);
203
204acpi_integer
205acpi_ex_do_math_op(u16 opcode, acpi_integer operand0, acpi_integer operand1);
206
207acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state);
208
209acpi_status acpi_ex_create_processor(struct acpi_walk_state *walk_state);
210
211acpi_status acpi_ex_create_power_resource(struct acpi_walk_state *walk_state);
212
213acpi_status
214acpi_ex_create_region(u8 * aml_start,
215 u32 aml_length,
216 u8 region_space, struct acpi_walk_state *walk_state);
217
218acpi_status acpi_ex_create_event(struct acpi_walk_state *walk_state);
219
220acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state);
221
222acpi_status
223acpi_ex_create_method(u8 * aml_start,
224 u32 aml_length, struct acpi_walk_state *walk_state);
225
226/*
227 * exconfig - dynamic table load/unload
228 */
229acpi_status
230acpi_ex_load_op(union acpi_operand_object *obj_desc,
231 union acpi_operand_object *target,
232 struct acpi_walk_state *walk_state);
233
234acpi_status
235acpi_ex_load_table_op(struct acpi_walk_state *walk_state,
236 union acpi_operand_object **return_desc);
237
238acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle);
239
240/*
241 * exmutex - mutex support
242 */
243acpi_status
244acpi_ex_acquire_mutex(union acpi_operand_object *time_desc,
245 union acpi_operand_object *obj_desc,
246 struct acpi_walk_state *walk_state);
247
248acpi_status
249acpi_ex_acquire_mutex_object(u16 timeout,
250 union acpi_operand_object *obj_desc,
251 acpi_thread_id thread_id);
252
253acpi_status
254acpi_ex_release_mutex(union acpi_operand_object *obj_desc,
255 struct acpi_walk_state *walk_state);
256
257acpi_status acpi_ex_release_mutex_object(union acpi_operand_object *obj_desc);
258
259void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread);
260
261void acpi_ex_unlink_mutex(union acpi_operand_object *obj_desc);
262
263/*
264 * exprep - ACPI AML execution - prep utilities
265 */
266acpi_status
267acpi_ex_prep_common_field_object(union acpi_operand_object *obj_desc,
268 u8 field_flags,
269 u8 field_attribute,
270 u32 field_bit_position, u32 field_bit_length);
271
272acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info);
273
274/*
275 * exsystem - Interface to OS services
276 */
277acpi_status
278acpi_ex_system_do_notify_op(union acpi_operand_object *value,
279 union acpi_operand_object *obj_desc);
280
281acpi_status acpi_ex_system_do_suspend(acpi_integer time);
282
283acpi_status acpi_ex_system_do_stall(u32 time);
284
285acpi_status acpi_ex_system_signal_event(union acpi_operand_object *obj_desc);
286
287acpi_status
288acpi_ex_system_wait_event(union acpi_operand_object *time,
289 union acpi_operand_object *obj_desc);
290
291acpi_status acpi_ex_system_reset_event(union acpi_operand_object *obj_desc);
292
293acpi_status
294acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout);
295
296acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout);
297
298/*
299 * exoparg1 - ACPI AML execution, 1 operand
300 */
301acpi_status acpi_ex_opcode_0A_0T_1R(struct acpi_walk_state *walk_state);
302
303acpi_status acpi_ex_opcode_1A_0T_0R(struct acpi_walk_state *walk_state);
304
305acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state);
306
307acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state);
308
309acpi_status acpi_ex_opcode_1A_1T_0R(struct acpi_walk_state *walk_state);
310
311/*
312 * exoparg2 - ACPI AML execution, 2 operands
313 */
314acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state);
315
316acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state);
317
318acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state);
319
320acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state);
321
322/*
323 * exoparg3 - ACPI AML execution, 3 operands
324 */
325acpi_status acpi_ex_opcode_3A_0T_0R(struct acpi_walk_state *walk_state);
326
327acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state);
328
329/*
330 * exoparg6 - ACPI AML execution, 6 operands
331 */
332acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state *walk_state);
333
334/*
335 * exresolv - Object resolution and get value functions
336 */
337acpi_status
338acpi_ex_resolve_to_value(union acpi_operand_object **stack_ptr,
339 struct acpi_walk_state *walk_state);
340
341acpi_status
342acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
343 union acpi_operand_object *operand,
344 acpi_object_type * return_type,
345 union acpi_operand_object **return_desc);
346
347/*
348 * exresnte - resolve namespace node
349 */
350acpi_status
351acpi_ex_resolve_node_to_value(struct acpi_namespace_node **stack_ptr,
352 struct acpi_walk_state *walk_state);
353
354/*
355 * exresop - resolve operand to value
356 */
357acpi_status
358acpi_ex_resolve_operands(u16 opcode,
359 union acpi_operand_object **stack_ptr,
360 struct acpi_walk_state *walk_state);
361
362/*
363 * exdump - Interpreter debug output routines
364 */
365void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth);
366
367void
368acpi_ex_dump_operands(union acpi_operand_object **operands,
369 const char *opcode_name, u32 num_opcodes);
370
371#ifdef ACPI_FUTURE_USAGE
372void
373acpi_ex_dump_object_descriptor(union acpi_operand_object *object, u32 flags);
374
375void acpi_ex_dump_namespace_node(struct acpi_namespace_node *node, u32 flags);
376#endif /* ACPI_FUTURE_USAGE */
377
378/*
379 * exnames - AML namestring support
380 */
381acpi_status
382acpi_ex_get_name_string(acpi_object_type data_type,
383 u8 * in_aml_address,
384 char **out_name_string, u32 * out_name_length);
385
386/*
387 * exstore - Object store support
388 */
389acpi_status
390acpi_ex_store(union acpi_operand_object *val_desc,
391 union acpi_operand_object *dest_desc,
392 struct acpi_walk_state *walk_state);
393
394acpi_status
395acpi_ex_store_object_to_node(union acpi_operand_object *source_desc,
396 struct acpi_namespace_node *node,
397 struct acpi_walk_state *walk_state,
398 u8 implicit_conversion);
399
400#define ACPI_IMPLICIT_CONVERSION TRUE
401#define ACPI_NO_IMPLICIT_CONVERSION FALSE
402
403/*
404 * exstoren - resolve/store object
405 */
406acpi_status
407acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,
408 acpi_object_type target_type,
409 struct acpi_walk_state *walk_state);
410
411acpi_status
412acpi_ex_store_object_to_object(union acpi_operand_object *source_desc,
413 union acpi_operand_object *dest_desc,
414 union acpi_operand_object **new_desc,
415 struct acpi_walk_state *walk_state);
416
417/*
418 * exstorob - store object - buffer/string
419 */
420acpi_status
421acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc,
422 union acpi_operand_object *target_desc);
423
424acpi_status
425acpi_ex_store_string_to_string(union acpi_operand_object *source_desc,
426 union acpi_operand_object *target_desc);
427
428/*
429 * excopy - object copy
430 */
431acpi_status
432acpi_ex_copy_integer_to_index_field(union acpi_operand_object *source_desc,
433 union acpi_operand_object *target_desc);
434
435acpi_status
436acpi_ex_copy_integer_to_bank_field(union acpi_operand_object *source_desc,
437 union acpi_operand_object *target_desc);
438
439acpi_status
440acpi_ex_copy_data_to_named_field(union acpi_operand_object *source_desc,
441 struct acpi_namespace_node *node);
442
443acpi_status
444acpi_ex_copy_integer_to_buffer_field(union acpi_operand_object *source_desc,
445 union acpi_operand_object *target_desc);
446
447/*
448 * exutils - interpreter/scanner utilities
449 */
450void acpi_ex_enter_interpreter(void);
451
452void acpi_ex_exit_interpreter(void);
453
454void acpi_ex_reacquire_interpreter(void);
455
456void acpi_ex_relinquish_interpreter(void);
457
458void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc);
459
460void acpi_ex_acquire_global_lock(u32 rule);
461
462void acpi_ex_release_global_lock(u32 rule);
463
464void acpi_ex_eisa_id_to_string(u32 numeric_id, char *out_string);
465
466void acpi_ex_unsigned_integer_to_string(acpi_integer value, char *out_string);
467
468/*
469 * exregion - default op_region handlers
470 */
471acpi_status
472acpi_ex_system_memory_space_handler(u32 function,
473 acpi_physical_address address,
474 u32 bit_width,
475 acpi_integer * value,
476 void *handler_context,
477 void *region_context);
478
479acpi_status
480acpi_ex_system_io_space_handler(u32 function,
481 acpi_physical_address address,
482 u32 bit_width,
483 acpi_integer * value,
484 void *handler_context, void *region_context);
485
486acpi_status
487acpi_ex_pci_config_space_handler(u32 function,
488 acpi_physical_address address,
489 u32 bit_width,
490 acpi_integer * value,
491 void *handler_context, void *region_context);
492
493acpi_status
494acpi_ex_cmos_space_handler(u32 function,
495 acpi_physical_address address,
496 u32 bit_width,
497 acpi_integer * value,
498 void *handler_context, void *region_context);
499
500acpi_status
501acpi_ex_pci_bar_space_handler(u32 function,
502 acpi_physical_address address,
503 u32 bit_width,
504 acpi_integer * value,
505 void *handler_context, void *region_context);
506
507acpi_status
508acpi_ex_embedded_controller_space_handler(u32 function,
509 acpi_physical_address address,
510 u32 bit_width,
511 acpi_integer * value,
512 void *handler_context,
513 void *region_context);
514
515acpi_status
516acpi_ex_sm_bus_space_handler(u32 function,
517 acpi_physical_address address,
518 u32 bit_width,
519 acpi_integer * value,
520 void *handler_context, void *region_context);
521
522acpi_status
523acpi_ex_data_table_space_handler(u32 function,
524 acpi_physical_address address,
525 u32 bit_width,
526 acpi_integer * value,
527 void *handler_context, void *region_context);
528
529#endif /* __INTERP_H__ */
diff --git a/include/acpi/aclocal.h b/include/acpi/aclocal.h
deleted file mode 100644
index ecab527cf78e..000000000000
--- a/include/acpi/aclocal.h
+++ /dev/null
@@ -1,1044 +0,0 @@
1/******************************************************************************
2 *
3 * Name: aclocal.h - Internal data types used across the ACPI subsystem
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACLOCAL_H__
45#define __ACLOCAL_H__
46
47/* acpisrc:struct_defs -- for acpisrc conversion */
48
49#define ACPI_WAIT_FOREVER 0xFFFF /* u16, as per ACPI spec */
50#define ACPI_DO_NOT_WAIT 0
51#define ACPI_SERIALIZED 0xFF
52
53typedef u32 acpi_mutex_handle;
54#define ACPI_GLOBAL_LOCK (acpi_semaphore) (-1)
55
56/* Total number of aml opcodes defined */
57
58#define AML_NUM_OPCODES 0x7F
59
60/* Forward declarations */
61
62struct acpi_walk_state;
63struct acpi_obj_mutex;
64union acpi_parse_object;
65
66/*****************************************************************************
67 *
68 * Mutex typedefs and structs
69 *
70 ****************************************************************************/
71
72/*
73 * Predefined handles for the mutex objects used within the subsystem
74 * All mutex objects are automatically created by acpi_ut_mutex_initialize.
75 *
76 * The acquire/release ordering protocol is implied via this list. Mutexes
77 * with a lower value must be acquired before mutexes with a higher value.
78 *
79 * NOTE: any changes here must be reflected in the acpi_gbl_mutex_names
80 * table below also!
81 */
82#define ACPI_MTX_INTERPRETER 0 /* AML Interpreter, main lock */
83#define ACPI_MTX_NAMESPACE 1 /* ACPI Namespace */
84#define ACPI_MTX_TABLES 2 /* Data for ACPI tables */
85#define ACPI_MTX_EVENTS 3 /* Data for ACPI events */
86#define ACPI_MTX_CACHES 4 /* Internal caches, general purposes */
87#define ACPI_MTX_MEMORY 5 /* Debug memory tracking lists */
88#define ACPI_MTX_DEBUG_CMD_COMPLETE 6 /* AML debugger */
89#define ACPI_MTX_DEBUG_CMD_READY 7 /* AML debugger */
90
91#define ACPI_MAX_MUTEX 7
92#define ACPI_NUM_MUTEX ACPI_MAX_MUTEX+1
93
94#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
95#ifdef DEFINE_ACPI_GLOBALS
96
97/* Debug names for the mutexes above */
98
99static char *acpi_gbl_mutex_names[ACPI_NUM_MUTEX] = {
100 "ACPI_MTX_Interpreter",
101 "ACPI_MTX_Namespace",
102 "ACPI_MTX_Tables",
103 "ACPI_MTX_Events",
104 "ACPI_MTX_Caches",
105 "ACPI_MTX_Memory",
106 "ACPI_MTX_CommandComplete",
107 "ACPI_MTX_CommandReady"
108};
109
110#endif
111#endif
112
113/*
114 * Predefined handles for spinlocks used within the subsystem.
115 * These spinlocks are created by acpi_ut_mutex_initialize
116 */
117#define ACPI_LOCK_GPES 0
118#define ACPI_LOCK_HARDWARE 1
119
120#define ACPI_MAX_LOCK 1
121#define ACPI_NUM_LOCK ACPI_MAX_LOCK+1
122
123/* Owner IDs are used to track namespace nodes for selective deletion */
124
125typedef u8 acpi_owner_id;
126#define ACPI_OWNER_ID_MAX 0xFF
127
128/* This Thread ID means that the mutex is not in use (unlocked) */
129
130#define ACPI_MUTEX_NOT_ACQUIRED (acpi_thread_id) 0
131
132/* Table for the global mutexes */
133
134struct acpi_mutex_info {
135 acpi_mutex mutex;
136 u32 use_count;
137 acpi_thread_id thread_id;
138};
139
140/* Lock flag parameter for various interfaces */
141
142#define ACPI_MTX_DO_NOT_LOCK 0
143#define ACPI_MTX_LOCK 1
144
145/* Field access granularities */
146
147#define ACPI_FIELD_BYTE_GRANULARITY 1
148#define ACPI_FIELD_WORD_GRANULARITY 2
149#define ACPI_FIELD_DWORD_GRANULARITY 4
150#define ACPI_FIELD_QWORD_GRANULARITY 8
151
152#define ACPI_ENTRY_NOT_FOUND NULL
153
154/*****************************************************************************
155 *
156 * Namespace typedefs and structs
157 *
158 ****************************************************************************/
159
160/* Operational modes of the AML interpreter/scanner */
161
162typedef enum {
163 ACPI_IMODE_LOAD_PASS1 = 0x01,
164 ACPI_IMODE_LOAD_PASS2 = 0x02,
165 ACPI_IMODE_EXECUTE = 0x03
166} acpi_interpreter_mode;
167
168union acpi_name_union {
169 u32 integer;
170 char ascii[4];
171};
172
173/*
174 * The Namespace Node describes a named object that appears in the AML.
175 * descriptor_type is used to differentiate between internal descriptors.
176 *
177 * The node is optimized for both 32-bit and 64-bit platforms:
178 * 20 bytes for the 32-bit case, 32 bytes for the 64-bit case.
179 *
180 * Note: The descriptor_type and Type fields must appear in the identical
181 * position in both the struct acpi_namespace_node and union acpi_operand_object
182 * structures.
183 */
184struct acpi_namespace_node {
185 union acpi_operand_object *object; /* Interpreter object */
186 u8 descriptor_type; /* Differentiate object descriptor types */
187 u8 type; /* ACPI Type associated with this name */
188 u8 flags; /* Miscellaneous flags */
189 acpi_owner_id owner_id; /* Node creator */
190 union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */
191 struct acpi_namespace_node *child; /* First child */
192 struct acpi_namespace_node *peer; /* Peer. Parent if ANOBJ_END_OF_PEER_LIST set */
193
194 /*
195 * The following fields are used by the ASL compiler and disassembler only
196 */
197#ifdef ACPI_LARGE_NAMESPACE_NODE
198 union acpi_parse_object *op;
199 u32 value;
200 u32 length;
201#endif
202};
203
204/* Namespace Node flags */
205
206#define ANOBJ_END_OF_PEER_LIST 0x01 /* End-of-list, Peer field points to parent */
207#define ANOBJ_TEMPORARY 0x02 /* Node is create by a method and is temporary */
208#define ANOBJ_METHOD_ARG 0x04 /* Node is a method argument */
209#define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */
210#define ANOBJ_SUBTREE_HAS_INI 0x10 /* Used to optimize device initialization */
211#define ANOBJ_EVALUATED 0x20 /* Set on first evaluation of node */
212
213#define ANOBJ_IS_EXTERNAL 0x08 /* i_aSL only: This object created via External() */
214#define ANOBJ_METHOD_NO_RETVAL 0x10 /* i_aSL only: Method has no return value */
215#define ANOBJ_METHOD_SOME_NO_RETVAL 0x20 /* i_aSL only: Method has at least one return value */
216#define ANOBJ_IS_BIT_OFFSET 0x40 /* i_aSL only: Reference is a bit offset */
217#define ANOBJ_IS_REFERENCED 0x80 /* i_aSL only: Object was referenced */
218
219/*
220 * ACPI Table Descriptor. One per ACPI table
221 */
222struct acpi_table_desc {
223 acpi_physical_address address;
224 struct acpi_table_header *pointer;
225 u32 length; /* Length fixed at 32 bits */
226 union acpi_name_union signature;
227 acpi_owner_id owner_id;
228 u8 flags;
229};
230
231/* Flags for above */
232
233#define ACPI_TABLE_ORIGIN_UNKNOWN (0)
234#define ACPI_TABLE_ORIGIN_MAPPED (1)
235#define ACPI_TABLE_ORIGIN_ALLOCATED (2)
236#define ACPI_TABLE_ORIGIN_MASK (3)
237#define ACPI_TABLE_IS_LOADED (4)
238
239/* One internal RSDT for table management */
240
241struct acpi_internal_rsdt {
242 struct acpi_table_desc *tables;
243 u32 count;
244 u32 size;
245 u8 flags;
246};
247
248/* Flags for above */
249
250#define ACPI_ROOT_ORIGIN_UNKNOWN (0) /* ~ORIGIN_ALLOCATED */
251#define ACPI_ROOT_ORIGIN_ALLOCATED (1)
252#define ACPI_ROOT_ALLOW_RESIZE (2)
253
254/* Predefined (fixed) table indexes */
255
256#define ACPI_TABLE_INDEX_DSDT (0)
257#define ACPI_TABLE_INDEX_FACS (1)
258
259struct acpi_find_context {
260 char *search_for;
261 acpi_handle *list;
262 u32 *count;
263};
264
265struct acpi_ns_search_data {
266 struct acpi_namespace_node *node;
267};
268
269/*
270 * Predefined Namespace items
271 */
272struct acpi_predefined_names {
273 char *name;
274 u8 type;
275 char *val;
276};
277
278/* Object types used during package copies */
279
280#define ACPI_COPY_TYPE_SIMPLE 0
281#define ACPI_COPY_TYPE_PACKAGE 1
282
283/* Info structure used to convert external<->internal namestrings */
284
285struct acpi_namestring_info {
286 const char *external_name;
287 const char *next_external_char;
288 char *internal_name;
289 u32 length;
290 u32 num_segments;
291 u32 num_carats;
292 u8 fully_qualified;
293};
294
295/* Field creation info */
296
297struct acpi_create_field_info {
298 struct acpi_namespace_node *region_node;
299 struct acpi_namespace_node *field_node;
300 struct acpi_namespace_node *register_node;
301 struct acpi_namespace_node *data_register_node;
302 u32 bank_value;
303 u32 field_bit_position;
304 u32 field_bit_length;
305 u8 field_flags;
306 u8 attribute;
307 u8 field_type;
308};
309
310typedef
311acpi_status(*ACPI_INTERNAL_METHOD) (struct acpi_walk_state * walk_state);
312
313/*
314 * Bitmapped ACPI types. Used internally only
315 */
316#define ACPI_BTYPE_ANY 0x00000000
317#define ACPI_BTYPE_INTEGER 0x00000001
318#define ACPI_BTYPE_STRING 0x00000002
319#define ACPI_BTYPE_BUFFER 0x00000004
320#define ACPI_BTYPE_PACKAGE 0x00000008
321#define ACPI_BTYPE_FIELD_UNIT 0x00000010
322#define ACPI_BTYPE_DEVICE 0x00000020
323#define ACPI_BTYPE_EVENT 0x00000040
324#define ACPI_BTYPE_METHOD 0x00000080
325#define ACPI_BTYPE_MUTEX 0x00000100
326#define ACPI_BTYPE_REGION 0x00000200
327#define ACPI_BTYPE_POWER 0x00000400
328#define ACPI_BTYPE_PROCESSOR 0x00000800
329#define ACPI_BTYPE_THERMAL 0x00001000
330#define ACPI_BTYPE_BUFFER_FIELD 0x00002000
331#define ACPI_BTYPE_DDB_HANDLE 0x00004000
332#define ACPI_BTYPE_DEBUG_OBJECT 0x00008000
333#define ACPI_BTYPE_REFERENCE 0x00010000
334#define ACPI_BTYPE_RESOURCE 0x00020000
335
336#define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)
337
338#define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE)
339#define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE)
340#define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)
341#define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */
342#define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF
343
344/*
345 * Information structure for ACPI predefined names.
346 * Each entry in the table contains the following items:
347 *
348 * Name - The ACPI reserved name
349 * param_count - Number of arguments to the method
350 * expected_return_btypes - Allowed type(s) for the return value
351 */
352struct acpi_name_info {
353 char name[ACPI_NAME_SIZE];
354 u8 param_count;
355 u8 expected_btypes;
356};
357
358/*
359 * Secondary information structures for ACPI predefined objects that return
360 * package objects. This structure appears as the next entry in the table
361 * after the NAME_INFO structure above.
362 *
363 * The reason for this is to minimize the size of the predefined name table.
364 */
365
366/*
367 * Used for ACPI_PTYPE1_FIXED, ACPI_PTYPE1_VAR, ACPI_PTYPE2,
368 * ACPI_PTYPE2_MIN, ACPI_PTYPE2_PKG_COUNT, ACPI_PTYPE2_COUNT
369 */
370struct acpi_package_info {
371 u8 type;
372 u8 object_type1;
373 u8 count1;
374 u8 object_type2;
375 u8 count2;
376 u8 reserved;
377};
378
379/* Used for ACPI_PTYPE2_FIXED */
380
381struct acpi_package_info2 {
382 u8 type;
383 u8 count;
384 u8 object_type[4];
385};
386
387/* Used for ACPI_PTYPE1_OPTION */
388
389struct acpi_package_info3 {
390 u8 type;
391 u8 count;
392 u8 object_type[2];
393 u8 tail_object_type;
394 u8 reserved;
395};
396
397union acpi_predefined_info {
398 struct acpi_name_info info;
399 struct acpi_package_info ret_info;
400 struct acpi_package_info2 ret_info2;
401 struct acpi_package_info3 ret_info3;
402};
403
404/*
405 * Bitmapped return value types
406 * Note: the actual data types must be contiguous, a loop in nspredef.c
407 * depends on this.
408 */
409#define ACPI_RTYPE_ANY 0x00
410#define ACPI_RTYPE_NONE 0x01
411#define ACPI_RTYPE_INTEGER 0x02
412#define ACPI_RTYPE_STRING 0x04
413#define ACPI_RTYPE_BUFFER 0x08
414#define ACPI_RTYPE_PACKAGE 0x10
415#define ACPI_RTYPE_REFERENCE 0x20
416#define ACPI_RTYPE_ALL 0x3F
417
418#define ACPI_NUM_RTYPES 5 /* Number of actual object types */
419
420/*****************************************************************************
421 *
422 * Event typedefs and structs
423 *
424 ****************************************************************************/
425
426/* Dispatch info for each GPE -- either a method or handler, cannot be both */
427
428struct acpi_handler_info {
429 acpi_event_handler address; /* Address of handler, if any */
430 void *context; /* Context to be passed to handler */
431 struct acpi_namespace_node *method_node; /* Method node for this GPE level (saved) */
432};
433
434union acpi_gpe_dispatch_info {
435 struct acpi_namespace_node *method_node; /* Method node for this GPE level */
436 struct acpi_handler_info *handler;
437};
438
439/*
440 * Information about a GPE, one per each GPE in an array.
441 * NOTE: Important to keep this struct as small as possible.
442 */
443struct acpi_gpe_event_info {
444 union acpi_gpe_dispatch_info dispatch; /* Either Method or Handler */
445 struct acpi_gpe_register_info *register_info; /* Backpointer to register info */
446 u8 flags; /* Misc info about this GPE */
447 u8 gpe_number; /* This GPE */
448};
449
450/* Information about a GPE register pair, one per each status/enable pair in an array */
451
452struct acpi_gpe_register_info {
453 struct acpi_generic_address status_address; /* Address of status reg */
454 struct acpi_generic_address enable_address; /* Address of enable reg */
455 u8 enable_for_wake; /* GPEs to keep enabled when sleeping */
456 u8 enable_for_run; /* GPEs to keep enabled when running */
457 u8 base_gpe_number; /* Base GPE number for this register */
458};
459
460/*
461 * Information about a GPE register block, one per each installed block --
462 * GPE0, GPE1, and one per each installed GPE Block Device.
463 */
464struct acpi_gpe_block_info {
465 struct acpi_namespace_node *node;
466 struct acpi_gpe_block_info *previous;
467 struct acpi_gpe_block_info *next;
468 struct acpi_gpe_xrupt_info *xrupt_block; /* Backpointer to interrupt block */
469 struct acpi_gpe_register_info *register_info; /* One per GPE register pair */
470 struct acpi_gpe_event_info *event_info; /* One for each GPE */
471 struct acpi_generic_address block_address; /* Base address of the block */
472 u32 register_count; /* Number of register pairs in block */
473 u8 block_base_number; /* Base GPE number for this block */
474};
475
476/* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */
477
478struct acpi_gpe_xrupt_info {
479 struct acpi_gpe_xrupt_info *previous;
480 struct acpi_gpe_xrupt_info *next;
481 struct acpi_gpe_block_info *gpe_block_list_head; /* List of GPE blocks for this xrupt */
482 u32 interrupt_number; /* System interrupt number */
483};
484
485struct acpi_gpe_walk_info {
486 struct acpi_namespace_node *gpe_device;
487 struct acpi_gpe_block_info *gpe_block;
488};
489
490typedef acpi_status(*acpi_gpe_callback) (struct acpi_gpe_xrupt_info *
491 gpe_xrupt_info,
492 struct acpi_gpe_block_info *
493 gpe_block);
494
495/* Information about each particular fixed event */
496
497struct acpi_fixed_event_handler {
498 acpi_event_handler handler; /* Address of handler. */
499 void *context; /* Context to be passed to handler */
500};
501
502struct acpi_fixed_event_info {
503 u8 status_register_id;
504 u8 enable_register_id;
505 u16 status_bit_mask;
506 u16 enable_bit_mask;
507};
508
509/* Information used during field processing */
510
511struct acpi_field_info {
512 u8 skip_field;
513 u8 field_flag;
514 u32 pkg_length;
515};
516
517/*****************************************************************************
518 *
519 * Generic "state" object for stacks
520 *
521 ****************************************************************************/
522
523#define ACPI_CONTROL_NORMAL 0xC0
524#define ACPI_CONTROL_CONDITIONAL_EXECUTING 0xC1
525#define ACPI_CONTROL_PREDICATE_EXECUTING 0xC2
526#define ACPI_CONTROL_PREDICATE_FALSE 0xC3
527#define ACPI_CONTROL_PREDICATE_TRUE 0xC4
528
529#define ACPI_STATE_COMMON \
530 void *next; \
531 u8 descriptor_type; /* To differentiate various internal objs */\
532 u8 flags; \
533 u16 value; \
534 u16 state;
535
536 /* There are 2 bytes available here until the next natural alignment boundary */
537
538struct acpi_common_state {
539ACPI_STATE_COMMON};
540
541/*
542 * Update state - used to traverse complex objects such as packages
543 */
544struct acpi_update_state {
545 ACPI_STATE_COMMON union acpi_operand_object *object;
546};
547
548/*
549 * Pkg state - used to traverse nested package structures
550 */
551struct acpi_pkg_state {
552 ACPI_STATE_COMMON u16 index;
553 union acpi_operand_object *source_object;
554 union acpi_operand_object *dest_object;
555 struct acpi_walk_state *walk_state;
556 void *this_target_obj;
557 u32 num_packages;
558};
559
560/*
561 * Control state - one per if/else and while constructs.
562 * Allows nesting of these constructs
563 */
564struct acpi_control_state {
565 ACPI_STATE_COMMON u16 opcode;
566 union acpi_parse_object *predicate_op;
567 u8 *aml_predicate_start; /* Start of if/while predicate */
568 u8 *package_end; /* End of if/while block */
569};
570
571/*
572 * Scope state - current scope during namespace lookups
573 */
574struct acpi_scope_state {
575 ACPI_STATE_COMMON struct acpi_namespace_node *node;
576};
577
578struct acpi_pscope_state {
579 ACPI_STATE_COMMON u32 arg_count; /* Number of fixed arguments */
580 union acpi_parse_object *op; /* Current op being parsed */
581 u8 *arg_end; /* Current argument end */
582 u8 *pkg_end; /* Current package end */
583 u32 arg_list; /* Next argument to parse */
584};
585
586/*
587 * Thread state - one per thread across multiple walk states. Multiple walk
588 * states are created when there are nested control methods executing.
589 */
590struct acpi_thread_state {
591 ACPI_STATE_COMMON u8 current_sync_level; /* Mutex Sync (nested acquire) level */
592 struct acpi_walk_state *walk_state_list; /* Head of list of walk_states for this thread */
593 union acpi_operand_object *acquired_mutex_list; /* List of all currently acquired mutexes */
594 acpi_thread_id thread_id; /* Running thread ID */
595};
596
597/*
598 * Result values - used to accumulate the results of nested
599 * AML arguments
600 */
601struct acpi_result_values {
602 ACPI_STATE_COMMON
603 union acpi_operand_object *obj_desc[ACPI_RESULTS_FRAME_OBJ_NUM];
604};
605
606typedef
607acpi_status(*acpi_parse_downwards) (struct acpi_walk_state * walk_state,
608 union acpi_parse_object ** out_op);
609
610typedef acpi_status(*acpi_parse_upwards) (struct acpi_walk_state * walk_state);
611
612/*
613 * Notify info - used to pass info to the deferred notify
614 * handler/dispatcher.
615 */
616struct acpi_notify_info {
617 ACPI_STATE_COMMON struct acpi_namespace_node *node;
618 union acpi_operand_object *handler_obj;
619};
620
621/* Generic state is union of structs above */
622
623union acpi_generic_state {
624 struct acpi_common_state common;
625 struct acpi_control_state control;
626 struct acpi_update_state update;
627 struct acpi_scope_state scope;
628 struct acpi_pscope_state parse_scope;
629 struct acpi_pkg_state pkg;
630 struct acpi_thread_state thread;
631 struct acpi_result_values results;
632 struct acpi_notify_info notify;
633};
634
635/*****************************************************************************
636 *
637 * Interpreter typedefs and structs
638 *
639 ****************************************************************************/
640
641typedef acpi_status(*ACPI_EXECUTE_OP) (struct acpi_walk_state * walk_state);
642
643/*****************************************************************************
644 *
645 * Parser typedefs and structs
646 *
647 ****************************************************************************/
648
649/*
650 * AML opcode, name, and argument layout
651 */
652struct acpi_opcode_info {
653#if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)
654 char *name; /* Opcode name (disassembler/debug only) */
655#endif
656 u32 parse_args; /* Grammar/Parse time arguments */
657 u32 runtime_args; /* Interpret time arguments */
658 u16 flags; /* Misc flags */
659 u8 object_type; /* Corresponding internal object type */
660 u8 class; /* Opcode class */
661 u8 type; /* Opcode type */
662};
663
664union acpi_parse_value {
665 acpi_integer integer; /* Integer constant (Up to 64 bits) */
666 struct uint64_struct integer64; /* Structure overlay for 2 32-bit Dwords */
667 u32 size; /* bytelist or field size */
668 char *string; /* NULL terminated string */
669 u8 *buffer; /* buffer or string */
670 char *name; /* NULL terminated string */
671 union acpi_parse_object *arg; /* arguments and contained ops */
672};
673
674#define ACPI_PARSE_COMMON \
675 union acpi_parse_object *parent; /* Parent op */\
676 u8 descriptor_type; /* To differentiate various internal objs */\
677 u8 flags; /* Type of Op */\
678 u16 aml_opcode; /* AML opcode */\
679 u32 aml_offset; /* Offset of declaration in AML */\
680 union acpi_parse_object *next; /* Next op */\
681 struct acpi_namespace_node *node; /* For use by interpreter */\
682 union acpi_parse_value value; /* Value or args associated with the opcode */\
683 u8 arg_list_length; /* Number of elements in the arg list */\
684 ACPI_DISASM_ONLY_MEMBERS (\
685 u8 disasm_flags; /* Used during AML disassembly */\
686 u8 disasm_opcode; /* Subtype used for disassembly */\
687 char aml_op_name[16]) /* Op name (debug only) */
688
689#define ACPI_DASM_BUFFER 0x00
690#define ACPI_DASM_RESOURCE 0x01
691#define ACPI_DASM_STRING 0x02
692#define ACPI_DASM_UNICODE 0x03
693#define ACPI_DASM_EISAID 0x04
694#define ACPI_DASM_MATCHOP 0x05
695#define ACPI_DASM_LNOT_PREFIX 0x06
696#define ACPI_DASM_LNOT_SUFFIX 0x07
697#define ACPI_DASM_IGNORE 0x08
698
699/*
700 * Generic operation (for example: If, While, Store)
701 */
702struct acpi_parse_obj_common {
703ACPI_PARSE_COMMON};
704
705/*
706 * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and op_regions),
707 * and bytelists.
708 */
709struct acpi_parse_obj_named {
710 ACPI_PARSE_COMMON u8 *path;
711 u8 *data; /* AML body or bytelist data */
712 u32 length; /* AML length */
713 u32 name; /* 4-byte name or zero if no name */
714};
715
716/* This version is used by the i_aSL compiler only */
717
718#define ACPI_MAX_PARSEOP_NAME 20
719
720struct acpi_parse_obj_asl {
721 ACPI_PARSE_COMMON union acpi_parse_object *child;
722 union acpi_parse_object *parent_method;
723 char *filename;
724 char *external_name;
725 char *namepath;
726 char name_seg[4];
727 u32 extra_value;
728 u32 column;
729 u32 line_number;
730 u32 logical_line_number;
731 u32 logical_byte_offset;
732 u32 end_line;
733 u32 end_logical_line;
734 u32 acpi_btype;
735 u32 aml_length;
736 u32 aml_subtree_length;
737 u32 final_aml_length;
738 u32 final_aml_offset;
739 u32 compile_flags;
740 u16 parse_opcode;
741 u8 aml_opcode_length;
742 u8 aml_pkg_len_bytes;
743 u8 extra;
744 char parse_op_name[ACPI_MAX_PARSEOP_NAME];
745};
746
747union acpi_parse_object {
748 struct acpi_parse_obj_common common;
749 struct acpi_parse_obj_named named;
750 struct acpi_parse_obj_asl asl;
751};
752
753/*
754 * Parse state - one state per parser invocation and each control
755 * method.
756 */
757struct acpi_parse_state {
758 u8 *aml_start; /* First AML byte */
759 u8 *aml; /* Next AML byte */
760 u8 *aml_end; /* (last + 1) AML byte */
761 u8 *pkg_start; /* Current package begin */
762 u8 *pkg_end; /* Current package end */
763 union acpi_parse_object *start_op; /* Root of parse tree */
764 struct acpi_namespace_node *start_node;
765 union acpi_generic_state *scope; /* Current scope */
766 union acpi_parse_object *start_scope;
767 u32 aml_size;
768};
769
770/* Parse object flags */
771
772#define ACPI_PARSEOP_GENERIC 0x01
773#define ACPI_PARSEOP_NAMED 0x02
774#define ACPI_PARSEOP_DEFERRED 0x04
775#define ACPI_PARSEOP_BYTELIST 0x08
776#define ACPI_PARSEOP_IN_STACK 0x10
777#define ACPI_PARSEOP_TARGET 0x20
778#define ACPI_PARSEOP_IN_CACHE 0x80
779
780/* Parse object disasm_flags */
781
782#define ACPI_PARSEOP_IGNORE 0x01
783#define ACPI_PARSEOP_PARAMLIST 0x02
784#define ACPI_PARSEOP_EMPTY_TERMLIST 0x04
785#define ACPI_PARSEOP_SPECIAL 0x10
786
787/*****************************************************************************
788 *
789 * Hardware (ACPI registers) and PNP
790 *
791 ****************************************************************************/
792
793#define PCI_ROOT_HID_STRING "PNP0A03"
794#define PCI_EXPRESS_ROOT_HID_STRING "PNP0A08"
795
796struct acpi_bit_register_info {
797 u8 parent_register;
798 u8 bit_position;
799 u16 access_bit_mask;
800};
801
802/*
803 * Some ACPI registers have bits that must be ignored -- meaning that they
804 * must be preserved.
805 */
806#define ACPI_PM1_STATUS_PRESERVED_BITS 0x0800 /* Bit 11 */
807#define ACPI_PM1_CONTROL_PRESERVED_BITS 0x0200 /* Bit 9 (whatever) */
808
809/*
810 * Register IDs
811 * These are the full ACPI registers
812 */
813#define ACPI_REGISTER_PM1_STATUS 0x01
814#define ACPI_REGISTER_PM1_ENABLE 0x02
815#define ACPI_REGISTER_PM1_CONTROL 0x03
816#define ACPI_REGISTER_PM1A_CONTROL 0x04
817#define ACPI_REGISTER_PM1B_CONTROL 0x05
818#define ACPI_REGISTER_PM2_CONTROL 0x06
819#define ACPI_REGISTER_PM_TIMER 0x07
820#define ACPI_REGISTER_PROCESSOR_BLOCK 0x08
821#define ACPI_REGISTER_SMI_COMMAND_BLOCK 0x09
822
823/* Masks used to access the bit_registers */
824
825#define ACPI_BITMASK_TIMER_STATUS 0x0001
826#define ACPI_BITMASK_BUS_MASTER_STATUS 0x0010
827#define ACPI_BITMASK_GLOBAL_LOCK_STATUS 0x0020
828#define ACPI_BITMASK_POWER_BUTTON_STATUS 0x0100
829#define ACPI_BITMASK_SLEEP_BUTTON_STATUS 0x0200
830#define ACPI_BITMASK_RT_CLOCK_STATUS 0x0400
831#define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */
832#define ACPI_BITMASK_WAKE_STATUS 0x8000
833
834#define ACPI_BITMASK_ALL_FIXED_STATUS (\
835 ACPI_BITMASK_TIMER_STATUS | \
836 ACPI_BITMASK_BUS_MASTER_STATUS | \
837 ACPI_BITMASK_GLOBAL_LOCK_STATUS | \
838 ACPI_BITMASK_POWER_BUTTON_STATUS | \
839 ACPI_BITMASK_SLEEP_BUTTON_STATUS | \
840 ACPI_BITMASK_RT_CLOCK_STATUS | \
841 ACPI_BITMASK_WAKE_STATUS)
842
843#define ACPI_BITMASK_TIMER_ENABLE 0x0001
844#define ACPI_BITMASK_GLOBAL_LOCK_ENABLE 0x0020
845#define ACPI_BITMASK_POWER_BUTTON_ENABLE 0x0100
846#define ACPI_BITMASK_SLEEP_BUTTON_ENABLE 0x0200
847#define ACPI_BITMASK_RT_CLOCK_ENABLE 0x0400
848#define ACPI_BITMASK_PCIEXP_WAKE_DISABLE 0x4000 /* ACPI 3.0 */
849
850#define ACPI_BITMASK_SCI_ENABLE 0x0001
851#define ACPI_BITMASK_BUS_MASTER_RLD 0x0002
852#define ACPI_BITMASK_GLOBAL_LOCK_RELEASE 0x0004
853#define ACPI_BITMASK_SLEEP_TYPE_X 0x1C00
854#define ACPI_BITMASK_SLEEP_ENABLE 0x2000
855
856#define ACPI_BITMASK_ARB_DISABLE 0x0001
857
858/* Raw bit position of each bit_register */
859
860#define ACPI_BITPOSITION_TIMER_STATUS 0x00
861#define ACPI_BITPOSITION_BUS_MASTER_STATUS 0x04
862#define ACPI_BITPOSITION_GLOBAL_LOCK_STATUS 0x05
863#define ACPI_BITPOSITION_POWER_BUTTON_STATUS 0x08
864#define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS 0x09
865#define ACPI_BITPOSITION_RT_CLOCK_STATUS 0x0A
866#define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS 0x0E /* ACPI 3.0 */
867#define ACPI_BITPOSITION_WAKE_STATUS 0x0F
868
869#define ACPI_BITPOSITION_TIMER_ENABLE 0x00
870#define ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE 0x05
871#define ACPI_BITPOSITION_POWER_BUTTON_ENABLE 0x08
872#define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE 0x09
873#define ACPI_BITPOSITION_RT_CLOCK_ENABLE 0x0A
874#define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE 0x0E /* ACPI 3.0 */
875
876#define ACPI_BITPOSITION_SCI_ENABLE 0x00
877#define ACPI_BITPOSITION_BUS_MASTER_RLD 0x01
878#define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE 0x02
879#define ACPI_BITPOSITION_SLEEP_TYPE_X 0x0A
880#define ACPI_BITPOSITION_SLEEP_ENABLE 0x0D
881
882#define ACPI_BITPOSITION_ARB_DISABLE 0x00
883
884/*****************************************************************************
885 *
886 * Resource descriptors
887 *
888 ****************************************************************************/
889
890/* resource_type values */
891
892#define ACPI_ADDRESS_TYPE_MEMORY_RANGE 0
893#define ACPI_ADDRESS_TYPE_IO_RANGE 1
894#define ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE 2
895
896/* Resource descriptor types and masks */
897
898#define ACPI_RESOURCE_NAME_LARGE 0x80
899#define ACPI_RESOURCE_NAME_SMALL 0x00
900
901#define ACPI_RESOURCE_NAME_SMALL_MASK 0x78 /* Bits 6:3 contain the type */
902#define ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK 0x07 /* Bits 2:0 contain the length */
903#define ACPI_RESOURCE_NAME_LARGE_MASK 0x7F /* Bits 6:0 contain the type */
904
905/*
906 * Small resource descriptor "names" as defined by the ACPI specification.
907 * Note: Bits 2:0 are used for the descriptor length
908 */
909#define ACPI_RESOURCE_NAME_IRQ 0x20
910#define ACPI_RESOURCE_NAME_DMA 0x28
911#define ACPI_RESOURCE_NAME_START_DEPENDENT 0x30
912#define ACPI_RESOURCE_NAME_END_DEPENDENT 0x38
913#define ACPI_RESOURCE_NAME_IO 0x40
914#define ACPI_RESOURCE_NAME_FIXED_IO 0x48
915#define ACPI_RESOURCE_NAME_RESERVED_S1 0x50
916#define ACPI_RESOURCE_NAME_RESERVED_S2 0x58
917#define ACPI_RESOURCE_NAME_RESERVED_S3 0x60
918#define ACPI_RESOURCE_NAME_RESERVED_S4 0x68
919#define ACPI_RESOURCE_NAME_VENDOR_SMALL 0x70
920#define ACPI_RESOURCE_NAME_END_TAG 0x78
921
922/*
923 * Large resource descriptor "names" as defined by the ACPI specification.
924 * Note: includes the Large Descriptor bit in bit[7]
925 */
926#define ACPI_RESOURCE_NAME_MEMORY24 0x81
927#define ACPI_RESOURCE_NAME_GENERIC_REGISTER 0x82
928#define ACPI_RESOURCE_NAME_RESERVED_L1 0x83
929#define ACPI_RESOURCE_NAME_VENDOR_LARGE 0x84
930#define ACPI_RESOURCE_NAME_MEMORY32 0x85
931#define ACPI_RESOURCE_NAME_FIXED_MEMORY32 0x86
932#define ACPI_RESOURCE_NAME_ADDRESS32 0x87
933#define ACPI_RESOURCE_NAME_ADDRESS16 0x88
934#define ACPI_RESOURCE_NAME_EXTENDED_IRQ 0x89
935#define ACPI_RESOURCE_NAME_ADDRESS64 0x8A
936#define ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 0x8B
937#define ACPI_RESOURCE_NAME_LARGE_MAX 0x8B
938
939/*****************************************************************************
940 *
941 * Miscellaneous
942 *
943 ****************************************************************************/
944
945#define ACPI_ASCII_ZERO 0x30
946
947/*****************************************************************************
948 *
949 * Debugger
950 *
951 ****************************************************************************/
952
953struct acpi_db_method_info {
954 acpi_handle main_thread_gate;
955 acpi_handle thread_complete_gate;
956 u32 *threads;
957 u32 num_threads;
958 u32 num_created;
959 u32 num_completed;
960
961 char *name;
962 u32 flags;
963 u32 num_loops;
964 char pathname[128];
965 char **args;
966
967 /*
968 * Arguments to be passed to method for the command
969 * Threads -
970 * the Number of threads, ID of current thread and
971 * Index of current thread inside all them created.
972 */
973 char init_args;
974 char *arguments[4];
975 char num_threads_str[11];
976 char id_of_thread_str[11];
977 char index_of_thread_str[11];
978};
979
980struct acpi_integrity_info {
981 u32 nodes;
982 u32 objects;
983};
984
985#define ACPI_DB_REDIRECTABLE_OUTPUT 0x01
986#define ACPI_DB_CONSOLE_OUTPUT 0x02
987#define ACPI_DB_DUPLICATE_OUTPUT 0x03
988
989/*****************************************************************************
990 *
991 * Debug
992 *
993 ****************************************************************************/
994
995/* Entry for a memory allocation (debug only) */
996
997#define ACPI_MEM_MALLOC 0
998#define ACPI_MEM_CALLOC 1
999#define ACPI_MAX_MODULE_NAME 16
1000
1001#define ACPI_COMMON_DEBUG_MEM_HEADER \
1002 struct acpi_debug_mem_block *previous; \
1003 struct acpi_debug_mem_block *next; \
1004 u32 size; \
1005 u32 component; \
1006 u32 line; \
1007 char module[ACPI_MAX_MODULE_NAME]; \
1008 u8 alloc_type;
1009
1010struct acpi_debug_mem_header {
1011ACPI_COMMON_DEBUG_MEM_HEADER};
1012
1013struct acpi_debug_mem_block {
1014 ACPI_COMMON_DEBUG_MEM_HEADER u64 user_space;
1015};
1016
1017#define ACPI_MEM_LIST_GLOBAL 0
1018#define ACPI_MEM_LIST_NSNODE 1
1019#define ACPI_MEM_LIST_MAX 1
1020#define ACPI_NUM_MEM_LISTS 2
1021
1022struct acpi_memory_list {
1023 char *list_name;
1024 void *list_head;
1025 u16 object_size;
1026 u16 max_depth;
1027 u16 current_depth;
1028 u16 link_offset;
1029
1030#ifdef ACPI_DBG_TRACK_ALLOCATIONS
1031
1032 /* Statistics for debug memory tracking only */
1033
1034 u32 total_allocated;
1035 u32 total_freed;
1036 u32 max_occupied;
1037 u32 total_size;
1038 u32 current_total_size;
1039 u32 requests;
1040 u32 hits;
1041#endif
1042};
1043
1044#endif /* __ACLOCAL_H__ */
diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h
deleted file mode 100644
index a597207e2835..000000000000
--- a/include/acpi/acmacros.h
+++ /dev/null
@@ -1,693 +0,0 @@
1/******************************************************************************
2 *
3 * Name: acmacros.h - C macros for the entire subsystem.
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACMACROS_H__
45#define __ACMACROS_H__
46
47/*
48 * Data manipulation macros
49 */
50#define ACPI_LOWORD(l) ((u16)(u32)(l))
51#define ACPI_HIWORD(l) ((u16)((((u32)(l)) >> 16) & 0xFFFF))
52#define ACPI_LOBYTE(l) ((u8)(u16)(l))
53#define ACPI_HIBYTE(l) ((u8)((((u16)(l)) >> 8) & 0xFF))
54
55#define ACPI_SET_BIT(target,bit) ((target) |= (bit))
56#define ACPI_CLEAR_BIT(target,bit) ((target) &= ~(bit))
57#define ACPI_MIN(a,b) (((a)<(b))?(a):(b))
58#define ACPI_MAX(a,b) (((a)>(b))?(a):(b))
59
60/* Size calculation */
61
62#define ACPI_ARRAY_LENGTH(x) (sizeof(x) / sizeof((x)[0]))
63
64/*
65 * Extract data using a pointer. Any more than a byte and we
66 * get into potential aligment issues -- see the STORE macros below.
67 * Use with care.
68 */
69#define ACPI_GET8(ptr) *ACPI_CAST_PTR (u8, ptr)
70#define ACPI_GET16(ptr) *ACPI_CAST_PTR (u16, ptr)
71#define ACPI_GET32(ptr) *ACPI_CAST_PTR (u32, ptr)
72#define ACPI_GET64(ptr) *ACPI_CAST_PTR (u64, ptr)
73#define ACPI_SET8(ptr) *ACPI_CAST_PTR (u8, ptr)
74#define ACPI_SET16(ptr) *ACPI_CAST_PTR (u16, ptr)
75#define ACPI_SET32(ptr) *ACPI_CAST_PTR (u32, ptr)
76#define ACPI_SET64(ptr) *ACPI_CAST_PTR (u64, ptr)
77
78/*
79 * Pointer manipulation
80 */
81#define ACPI_CAST_PTR(t, p) ((t *) (acpi_uintptr_t) (p))
82#define ACPI_CAST_INDIRECT_PTR(t, p) ((t **) (acpi_uintptr_t) (p))
83#define ACPI_ADD_PTR(t, a, b) ACPI_CAST_PTR (t, (ACPI_CAST_PTR (u8, (a)) + (acpi_size)(b)))
84#define ACPI_PTR_DIFF(a, b) (acpi_size) (ACPI_CAST_PTR (u8, (a)) - ACPI_CAST_PTR (u8, (b)))
85
86/* Pointer/Integer type conversions */
87
88#define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void, (void *) NULL, (acpi_size) i)
89#define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p, (void *) NULL)
90#define ACPI_OFFSET(d, f) (acpi_size) ACPI_PTR_DIFF (&(((d *)0)->f), (void *) NULL)
91#define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i)
92#define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i)
93
94#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
95#define ACPI_COMPARE_NAME(a, b) (*ACPI_CAST_PTR (u32, (a)) == *ACPI_CAST_PTR (u32, (b)))
96#else
97#define ACPI_COMPARE_NAME(a, b) (!ACPI_STRNCMP (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAME_SIZE))
98#endif
99
100/*
101 * Full 64-bit integer must be available on both 32-bit and 64-bit platforms
102 */
103struct acpi_integer_overlay {
104 u32 lo_dword;
105 u32 hi_dword;
106};
107
108#define ACPI_LODWORD(integer) (ACPI_CAST_PTR (struct acpi_integer_overlay, &integer)->lo_dword)
109#define ACPI_HIDWORD(integer) (ACPI_CAST_PTR (struct acpi_integer_overlay, &integer)->hi_dword)
110
111/*
112 * printf() format helpers
113 */
114
115/* Split 64-bit integer into two 32-bit values. Use with %8.8_x%8.8_x */
116
117#define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i), ACPI_LODWORD(i)
118
119#if ACPI_MACHINE_WIDTH == 64
120#define ACPI_FORMAT_NATIVE_UINT(i) ACPI_FORMAT_UINT64(i)
121#else
122#define ACPI_FORMAT_NATIVE_UINT(i) 0, (i)
123#endif
124
125/*
126 * Macros for moving data around to/from buffers that are possibly unaligned.
127 * If the hardware supports the transfer of unaligned data, just do the store.
128 * Otherwise, we have to move one byte at a time.
129 */
130#ifdef ACPI_BIG_ENDIAN
131/*
132 * Macros for big-endian machines
133 */
134
135/* These macros reverse the bytes during the move, converting little-endian to big endian */
136
137 /* Big Endian <== Little Endian */
138 /* Hi...Lo Lo...Hi */
139/* 16-bit source, 16/32/64 destination */
140
141#define ACPI_MOVE_16_TO_16(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[1];\
142 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[0];}
143
144#define ACPI_MOVE_16_TO_32(d, s) {(*(u32 *)(void *)(d))=0;\
145 ((u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\
146 ((u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];}
147
148#define ACPI_MOVE_16_TO_64(d, s) {(*(u64 *)(void *)(d))=0;\
149 ((u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\
150 ((u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[0];}
151
152/* 32-bit source, 16/32/64 destination */
153
154#define ACPI_MOVE_32_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */
155
156#define ACPI_MOVE_32_TO_32(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[3];\
157 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[2];\
158 (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\
159 (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];}
160
161#define ACPI_MOVE_32_TO_64(d, s) {(*(u64 *)(void *)(d))=0;\
162 ((u8 *)(void *)(d))[4] = ((u8 *)(void *)(s))[3];\
163 ((u8 *)(void *)(d))[5] = ((u8 *)(void *)(s))[2];\
164 ((u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\
165 ((u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[0];}
166
167/* 64-bit source, 16/32/64 destination */
168
169#define ACPI_MOVE_64_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */
170
171#define ACPI_MOVE_64_TO_32(d, s) ACPI_MOVE_32_TO_32(d, s) /* Truncate to 32 */
172
173#define ACPI_MOVE_64_TO_64(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[7];\
174 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[6];\
175 (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[5];\
176 (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[4];\
177 (( u8 *)(void *)(d))[4] = ((u8 *)(void *)(s))[3];\
178 (( u8 *)(void *)(d))[5] = ((u8 *)(void *)(s))[2];\
179 (( u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\
180 (( u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[0];}
181#else
182/*
183 * Macros for little-endian machines
184 */
185
186#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
187
188/* The hardware supports unaligned transfers, just do the little-endian move */
189
190/* 16-bit source, 16/32/64 destination */
191
192#define ACPI_MOVE_16_TO_16(d, s) *(u16 *)(void *)(d) = *(u16 *)(void *)(s)
193#define ACPI_MOVE_16_TO_32(d, s) *(u32 *)(void *)(d) = *(u16 *)(void *)(s)
194#define ACPI_MOVE_16_TO_64(d, s) *(u64 *)(void *)(d) = *(u16 *)(void *)(s)
195
196/* 32-bit source, 16/32/64 destination */
197
198#define ACPI_MOVE_32_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */
199#define ACPI_MOVE_32_TO_32(d, s) *(u32 *)(void *)(d) = *(u32 *)(void *)(s)
200#define ACPI_MOVE_32_TO_64(d, s) *(u64 *)(void *)(d) = *(u32 *)(void *)(s)
201
202/* 64-bit source, 16/32/64 destination */
203
204#define ACPI_MOVE_64_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */
205#define ACPI_MOVE_64_TO_32(d, s) ACPI_MOVE_32_TO_32(d, s) /* Truncate to 32 */
206#define ACPI_MOVE_64_TO_64(d, s) *(u64 *)(void *)(d) = *(u64 *)(void *)(s)
207
208#else
209/*
210 * The hardware does not support unaligned transfers. We must move the
211 * data one byte at a time. These macros work whether the source or
212 * the destination (or both) is/are unaligned. (Little-endian move)
213 */
214
215/* 16-bit source, 16/32/64 destination */
216
217#define ACPI_MOVE_16_TO_16(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\
218 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];}
219
220#define ACPI_MOVE_16_TO_32(d, s) {(*(u32 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d, s);}
221#define ACPI_MOVE_16_TO_64(d, s) {(*(u64 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d, s);}
222
223/* 32-bit source, 16/32/64 destination */
224
225#define ACPI_MOVE_32_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */
226
227#define ACPI_MOVE_32_TO_32(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\
228 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];\
229 (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[2];\
230 (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[3];}
231
232#define ACPI_MOVE_32_TO_64(d, s) {(*(u64 *)(void *)(d)) = 0; ACPI_MOVE_32_TO_32(d, s);}
233
234/* 64-bit source, 16/32/64 destination */
235
236#define ACPI_MOVE_64_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */
237#define ACPI_MOVE_64_TO_32(d, s) ACPI_MOVE_32_TO_32(d, s) /* Truncate to 32 */
238#define ACPI_MOVE_64_TO_64(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\
239 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];\
240 (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[2];\
241 (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[3];\
242 (( u8 *)(void *)(d))[4] = ((u8 *)(void *)(s))[4];\
243 (( u8 *)(void *)(d))[5] = ((u8 *)(void *)(s))[5];\
244 (( u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[6];\
245 (( u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[7];}
246#endif
247#endif
248
249/* Macros based on machine integer width */
250
251#if ACPI_MACHINE_WIDTH == 32
252#define ACPI_MOVE_SIZE_TO_16(d, s) ACPI_MOVE_32_TO_16(d, s)
253
254#elif ACPI_MACHINE_WIDTH == 64
255#define ACPI_MOVE_SIZE_TO_16(d, s) ACPI_MOVE_64_TO_16(d, s)
256
257#else
258#error unknown ACPI_MACHINE_WIDTH
259#endif
260
261/*
262 * Fast power-of-two math macros for non-optimized compilers
263 */
264#define _ACPI_DIV(value, power_of2) ((u32) ((value) >> (power_of2)))
265#define _ACPI_MUL(value, power_of2) ((u32) ((value) << (power_of2)))
266#define _ACPI_MOD(value, divisor) ((u32) ((value) & ((divisor) -1)))
267
268#define ACPI_DIV_2(a) _ACPI_DIV(a, 1)
269#define ACPI_MUL_2(a) _ACPI_MUL(a, 1)
270#define ACPI_MOD_2(a) _ACPI_MOD(a, 2)
271
272#define ACPI_DIV_4(a) _ACPI_DIV(a, 2)
273#define ACPI_MUL_4(a) _ACPI_MUL(a, 2)
274#define ACPI_MOD_4(a) _ACPI_MOD(a, 4)
275
276#define ACPI_DIV_8(a) _ACPI_DIV(a, 3)
277#define ACPI_MUL_8(a) _ACPI_MUL(a, 3)
278#define ACPI_MOD_8(a) _ACPI_MOD(a, 8)
279
280#define ACPI_DIV_16(a) _ACPI_DIV(a, 4)
281#define ACPI_MUL_16(a) _ACPI_MUL(a, 4)
282#define ACPI_MOD_16(a) _ACPI_MOD(a, 16)
283
284#define ACPI_DIV_32(a) _ACPI_DIV(a, 5)
285#define ACPI_MUL_32(a) _ACPI_MUL(a, 5)
286#define ACPI_MOD_32(a) _ACPI_MOD(a, 32)
287
288/*
289 * Rounding macros (Power of two boundaries only)
290 */
291#define ACPI_ROUND_DOWN(value, boundary) (((acpi_size)(value)) & \
292 (~(((acpi_size) boundary)-1)))
293
294#define ACPI_ROUND_UP(value, boundary) ((((acpi_size)(value)) + \
295 (((acpi_size) boundary)-1)) & \
296 (~(((acpi_size) boundary)-1)))
297
298/* Note: sizeof(acpi_size) evaluates to either 4 or 8 (32- vs 64-bit mode) */
299
300#define ACPI_ROUND_DOWN_TO_32BIT(a) ACPI_ROUND_DOWN(a, 4)
301#define ACPI_ROUND_DOWN_TO_64BIT(a) ACPI_ROUND_DOWN(a, 8)
302#define ACPI_ROUND_DOWN_TO_NATIVE_WORD(a) ACPI_ROUND_DOWN(a, sizeof(acpi_size))
303
304#define ACPI_ROUND_UP_TO_32BIT(a) ACPI_ROUND_UP(a, 4)
305#define ACPI_ROUND_UP_TO_64BIT(a) ACPI_ROUND_UP(a, 8)
306#define ACPI_ROUND_UP_TO_NATIVE_WORD(a) ACPI_ROUND_UP(a, sizeof(acpi_size))
307
308#define ACPI_ROUND_BITS_UP_TO_BYTES(a) ACPI_DIV_8((a) + 7)
309#define ACPI_ROUND_BITS_DOWN_TO_BYTES(a) ACPI_DIV_8((a))
310
311#define ACPI_ROUND_UP_TO_1K(a) (((a) + 1023) >> 10)
312
313/* Generic (non-power-of-two) rounding */
314
315#define ACPI_ROUND_UP_TO(value, boundary) (((value) + ((boundary)-1)) / (boundary))
316
317#define ACPI_IS_MISALIGNED(value) (((acpi_size) value) & (sizeof(acpi_size)-1))
318
319/*
320 * Bitmask creation
321 * Bit positions start at zero.
322 * MASK_BITS_ABOVE creates a mask starting AT the position and above
323 * MASK_BITS_BELOW creates a mask starting one bit BELOW the position
324 */
325#define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_INTEGER_MAX) << ((u32) (position))))
326#define ACPI_MASK_BITS_BELOW(position) ((ACPI_INTEGER_MAX) << ((u32) (position)))
327
328/* Bitfields within ACPI registers */
329
330#define ACPI_REGISTER_PREPARE_BITS(val, pos, mask) ((val << pos) & mask)
331#define ACPI_REGISTER_INSERT_VALUE(reg, pos, mask, val) reg = (reg & (~(mask))) | ACPI_REGISTER_PREPARE_BITS(val, pos, mask)
332
333#define ACPI_INSERT_BITS(target, mask, source) target = ((target & (~(mask))) | (source & mask))
334
335/*
336 * An struct acpi_namespace_node can appear in some contexts
337 * where a pointer to an union acpi_operand_object can also
338 * appear. This macro is used to distinguish them.
339 *
340 * The "Descriptor" field is the first field in both structures.
341 */
342#define ACPI_GET_DESCRIPTOR_TYPE(d) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type)
343#define ACPI_SET_DESCRIPTOR_TYPE(d, t) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type = t)
344
345/* Macro to test the object type */
346
347#define ACPI_GET_OBJECT_TYPE(d) (((union acpi_operand_object *)(void *)(d))->common.type)
348
349/*
350 * Macros for the master AML opcode table
351 */
352#if defined (ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT)
353#define ACPI_OP(name, Pargs, Iargs, obj_type, class, type, flags) \
354 {name, (u32)(Pargs), (u32)(Iargs), (u32)(flags), obj_type, class, type}
355#else
356#define ACPI_OP(name, Pargs, Iargs, obj_type, class, type, flags) \
357 {(u32)(Pargs), (u32)(Iargs), (u32)(flags), obj_type, class, type}
358#endif
359
360#ifdef ACPI_DISASSEMBLER
361#define ACPI_DISASM_ONLY_MEMBERS(a) a;
362#else
363#define ACPI_DISASM_ONLY_MEMBERS(a)
364#endif
365
366#define ARG_TYPE_WIDTH 5
367#define ARG_1(x) ((u32)(x))
368#define ARG_2(x) ((u32)(x) << (1 * ARG_TYPE_WIDTH))
369#define ARG_3(x) ((u32)(x) << (2 * ARG_TYPE_WIDTH))
370#define ARG_4(x) ((u32)(x) << (3 * ARG_TYPE_WIDTH))
371#define ARG_5(x) ((u32)(x) << (4 * ARG_TYPE_WIDTH))
372#define ARG_6(x) ((u32)(x) << (5 * ARG_TYPE_WIDTH))
373
374#define ARGI_LIST1(a) (ARG_1(a))
375#define ARGI_LIST2(a, b) (ARG_1(b)|ARG_2(a))
376#define ARGI_LIST3(a, b, c) (ARG_1(c)|ARG_2(b)|ARG_3(a))
377#define ARGI_LIST4(a, b, c, d) (ARG_1(d)|ARG_2(c)|ARG_3(b)|ARG_4(a))
378#define ARGI_LIST5(a, b, c, d, e) (ARG_1(e)|ARG_2(d)|ARG_3(c)|ARG_4(b)|ARG_5(a))
379#define ARGI_LIST6(a, b, c, d, e, f) (ARG_1(f)|ARG_2(e)|ARG_3(d)|ARG_4(c)|ARG_5(b)|ARG_6(a))
380
381#define ARGP_LIST1(a) (ARG_1(a))
382#define ARGP_LIST2(a, b) (ARG_1(a)|ARG_2(b))
383#define ARGP_LIST3(a, b, c) (ARG_1(a)|ARG_2(b)|ARG_3(c))
384#define ARGP_LIST4(a, b, c, d) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d))
385#define ARGP_LIST5(a, b, c, d, e) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e))
386#define ARGP_LIST6(a, b, c, d, e, f) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e)|ARG_6(f))
387
388#define GET_CURRENT_ARG_TYPE(list) (list & ((u32) 0x1F))
389#define INCREMENT_ARG_LIST(list) (list >>= ((u32) ARG_TYPE_WIDTH))
390
391#if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES)
392/*
393 * Module name is include in both debug and non-debug versions primarily for
394 * error messages. The __FILE__ macro is not very useful for this, because it
395 * often includes the entire pathname to the module
396 */
397#define ACPI_MODULE_NAME(name) static const char ACPI_UNUSED_VAR _acpi_module_name[] = name;
398#else
399#define ACPI_MODULE_NAME(name)
400#endif
401
402/*
403 * Ascii error messages can be configured out
404 */
405#ifndef ACPI_NO_ERROR_MESSAGES
406#define AE_INFO _acpi_module_name, __LINE__
407
408/*
409 * Error reporting. Callers module and line number are inserted by AE_INFO,
410 * the plist contains a set of parens to allow variable-length lists.
411 * These macros are used for both the debug and non-debug versions of the code.
412 */
413#define ACPI_INFO(plist) acpi_ut_info plist
414#define ACPI_WARNING(plist) acpi_ut_warning plist
415#define ACPI_EXCEPTION(plist) acpi_ut_exception plist
416#define ACPI_ERROR(plist) acpi_ut_error plist
417#define ACPI_ERROR_NAMESPACE(s, e) acpi_ns_report_error (AE_INFO, s, e);
418#define ACPI_ERROR_METHOD(s, n, p, e) acpi_ns_report_method_error (AE_INFO, s, n, p, e);
419
420#else
421
422/* No error messages */
423
424#define ACPI_INFO(plist)
425#define ACPI_WARNING(plist)
426#define ACPI_EXCEPTION(plist)
427#define ACPI_ERROR(plist)
428#define ACPI_ERROR_NAMESPACE(s, e)
429#define ACPI_ERROR_METHOD(s, n, p, e)
430#endif
431
432/*
433 * Debug macros that are conditionally compiled
434 */
435#ifdef ACPI_DEBUG_OUTPUT
436
437/*
438 * Common parameters used for debug output functions:
439 * line number, function name, module(file) name, component ID
440 */
441#define ACPI_DEBUG_PARAMETERS __LINE__, ACPI_GET_FUNCTION_NAME, _acpi_module_name, _COMPONENT
442
443/*
444 * Function entry tracing
445 */
446
447/*
448 * If ACPI_GET_FUNCTION_NAME was not defined in the compiler-dependent header,
449 * define it now. This is the case where there the compiler does not support
450 * a __func__ macro or equivalent.
451 */
452#ifndef ACPI_GET_FUNCTION_NAME
453#define ACPI_GET_FUNCTION_NAME _acpi_function_name
454/*
455 * The Name parameter should be the procedure name as a quoted string.
456 * The function name is also used by the function exit macros below.
457 * Note: (const char) is used to be compatible with the debug interfaces
458 * and macros such as __func__.
459 */
460#define ACPI_FUNCTION_NAME(name) static const char _acpi_function_name[] = #name;
461
462#else
463/* Compiler supports __func__ (or equivalent) -- Ignore this macro */
464
465#define ACPI_FUNCTION_NAME(name)
466#endif
467
468#ifdef CONFIG_ACPI_DEBUG_FUNC_TRACE
469
470#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \
471 acpi_ut_trace(ACPI_DEBUG_PARAMETERS)
472#define ACPI_FUNCTION_TRACE_PTR(a, b) ACPI_FUNCTION_NAME(a) \
473 acpi_ut_trace_ptr(ACPI_DEBUG_PARAMETERS, (void *)b)
474#define ACPI_FUNCTION_TRACE_U32(a, b) ACPI_FUNCTION_NAME(a) \
475 acpi_ut_trace_u32(ACPI_DEBUG_PARAMETERS, (u32)b)
476#define ACPI_FUNCTION_TRACE_STR(a, b) ACPI_FUNCTION_NAME(a) \
477 acpi_ut_trace_str(ACPI_DEBUG_PARAMETERS, (char *)b)
478
479#define ACPI_FUNCTION_ENTRY() acpi_ut_track_stack_ptr()
480
481/*
482 * Function exit tracing.
483 * WARNING: These macros include a return statement. This is usually considered
484 * bad form, but having a separate exit macro is very ugly and difficult to maintain.
485 * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros
486 * so that "_AcpiFunctionName" is defined.
487 *
488 * Note: the DO_WHILE0 macro is used to prevent some compilers from complaining
489 * about these constructs.
490 */
491#ifdef ACPI_USE_DO_WHILE_0
492#define ACPI_DO_WHILE0(a) do a while(0)
493#else
494#define ACPI_DO_WHILE0(a) a
495#endif
496
497#define return_VOID ACPI_DO_WHILE0 ({ \
498 acpi_ut_exit (ACPI_DEBUG_PARAMETERS); \
499 return;})
500/*
501 * There are two versions of most of the return macros. The default version is
502 * safer, since it avoids side-effects by guaranteeing that the argument will
503 * not be evaluated twice.
504 *
505 * A less-safe version of the macros is provided for optional use if the
506 * compiler uses excessive CPU stack (for example, this may happen in the
507 * debug case if code optimzation is disabled.)
508 */
509#ifndef ACPI_SIMPLE_RETURN_MACROS
510
511#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({ \
512 register acpi_status _s = (s); \
513 acpi_ut_status_exit (ACPI_DEBUG_PARAMETERS, _s); \
514 return (_s); })
515#define return_PTR(s) ACPI_DO_WHILE0 ({ \
516 register void *_s = (void *) (s); \
517 acpi_ut_ptr_exit (ACPI_DEBUG_PARAMETERS, (u8 *) _s); \
518 return (_s); })
519#define return_VALUE(s) ACPI_DO_WHILE0 ({ \
520 register acpi_integer _s = (s); \
521 acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, _s); \
522 return (_s); })
523#define return_UINT8(s) ACPI_DO_WHILE0 ({ \
524 register u8 _s = (u8) (s); \
525 acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (acpi_integer) _s); \
526 return (_s); })
527#define return_UINT32(s) ACPI_DO_WHILE0 ({ \
528 register u32 _s = (u32) (s); \
529 acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (acpi_integer) _s); \
530 return (_s); })
531#else /* Use original less-safe macros */
532
533#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({ \
534 acpi_ut_status_exit (ACPI_DEBUG_PARAMETERS, (s)); \
535 return((s)); })
536#define return_PTR(s) ACPI_DO_WHILE0 ({ \
537 acpi_ut_ptr_exit (ACPI_DEBUG_PARAMETERS, (u8 *) (s)); \
538 return((s)); })
539#define return_VALUE(s) ACPI_DO_WHILE0 ({ \
540 acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (acpi_integer) (s)); \
541 return((s)); })
542#define return_UINT8(s) return_VALUE(s)
543#define return_UINT32(s) return_VALUE(s)
544
545#endif /* ACPI_SIMPLE_RETURN_MACROS */
546
547#else /* !CONFIG_ACPI_DEBUG_FUNC_TRACE */
548
549#define ACPI_FUNCTION_TRACE(a)
550#define ACPI_FUNCTION_TRACE_PTR(a,b)
551#define ACPI_FUNCTION_TRACE_U32(a,b)
552#define ACPI_FUNCTION_TRACE_STR(a,b)
553#define ACPI_FUNCTION_EXIT
554#define ACPI_FUNCTION_STATUS_EXIT(s)
555#define ACPI_FUNCTION_VALUE_EXIT(s)
556#define ACPI_FUNCTION_TRACE(a)
557#define ACPI_FUNCTION_ENTRY()
558
559#define return_VOID return
560#define return_ACPI_STATUS(s) return(s)
561#define return_VALUE(s) return(s)
562#define return_UINT8(s) return(s)
563#define return_UINT32(s) return(s)
564#define return_PTR(s) return(s)
565
566#endif /* CONFIG_ACPI_DEBUG_FUNC_TRACE */
567
568/* Conditional execution */
569
570#define ACPI_DEBUG_EXEC(a) a
571#define ACPI_NORMAL_EXEC(a)
572
573#define ACPI_DEBUG_DEFINE(a) a;
574#define ACPI_DEBUG_ONLY_MEMBERS(a) a;
575#define _VERBOSE_STRUCTURES
576
577/* Stack and buffer dumping */
578
579#define ACPI_DUMP_STACK_ENTRY(a) acpi_ex_dump_operand((a), 0)
580#define ACPI_DUMP_OPERANDS(a, b, c) acpi_ex_dump_operands(a, b, c)
581
582#define ACPI_DUMP_ENTRY(a, b) acpi_ns_dump_entry (a, b)
583#define ACPI_DUMP_PATHNAME(a, b, c, d) acpi_ns_dump_pathname(a, b, c, d)
584#define ACPI_DUMP_RESOURCE_LIST(a) acpi_rs_dump_resource_list(a)
585#define ACPI_DUMP_BUFFER(a, b) acpi_ut_dump_buffer((u8 *) a, b, DB_BYTE_DISPLAY, _COMPONENT)
586
587/*
588 * Master debug print macros
589 * Print iff:
590 * 1) Debug print for the current component is enabled
591 * 2) Debug error level or trace level for the print statement is enabled
592 */
593#define ACPI_DEBUG_PRINT(plist) acpi_ut_debug_print plist
594#define ACPI_DEBUG_PRINT_RAW(plist) acpi_ut_debug_print_raw plist
595
596#else
597/*
598 * This is the non-debug case -- make everything go away,
599 * leaving no executable debug code!
600 */
601#define ACPI_DEBUG_EXEC(a)
602#define ACPI_NORMAL_EXEC(a) a;
603
604#define ACPI_DEBUG_DEFINE(a) do { } while(0)
605#define ACPI_DEBUG_ONLY_MEMBERS(a) do { } while(0)
606#define ACPI_FUNCTION_NAME(a) do { } while(0)
607#define ACPI_FUNCTION_TRACE(a) do { } while(0)
608#define ACPI_FUNCTION_TRACE_PTR(a, b) do { } while(0)
609#define ACPI_FUNCTION_TRACE_U32(a, b) do { } while(0)
610#define ACPI_FUNCTION_TRACE_STR(a, b) do { } while(0)
611#define ACPI_FUNCTION_EXIT do { } while(0)
612#define ACPI_FUNCTION_STATUS_EXIT(s) do { } while(0)
613#define ACPI_FUNCTION_VALUE_EXIT(s) do { } while(0)
614#define ACPI_FUNCTION_ENTRY() do { } while(0)
615#define ACPI_DUMP_STACK_ENTRY(a) do { } while(0)
616#define ACPI_DUMP_OPERANDS(a, b, c) do { } while(0)
617#define ACPI_DUMP_ENTRY(a, b) do { } while(0)
618#define ACPI_DUMP_TABLES(a, b) do { } while(0)
619#define ACPI_DUMP_PATHNAME(a, b, c, d) do { } while(0)
620#define ACPI_DUMP_RESOURCE_LIST(a) do { } while(0)
621#define ACPI_DUMP_BUFFER(a, b) do { } while(0)
622#define ACPI_DEBUG_PRINT(pl) do { } while(0)
623#define ACPI_DEBUG_PRINT_RAW(pl) do { } while(0)
624
625#define return_VOID return
626#define return_ACPI_STATUS(s) return(s)
627#define return_VALUE(s) return(s)
628#define return_UINT8(s) return(s)
629#define return_UINT32(s) return(s)
630#define return_PTR(s) return(s)
631
632#endif
633
634/*
635 * Some code only gets executed when the debugger is built in.
636 * Note that this is entirely independent of whether the
637 * DEBUG_PRINT stuff (set by ACPI_DEBUG_OUTPUT) is on, or not.
638 */
639#ifdef ACPI_DEBUGGER
640#define ACPI_DEBUGGER_EXEC(a) a
641#else
642#define ACPI_DEBUGGER_EXEC(a)
643#endif
644
645#ifdef ACPI_DEBUG_OUTPUT
646/*
647 * 1) Set name to blanks
648 * 2) Copy the object name
649 */
650#define ACPI_ADD_OBJECT_NAME(a,b) ACPI_MEMSET (a->common.name, ' ', sizeof (a->common.name));\
651 ACPI_STRNCPY (a->common.name, acpi_gbl_ns_type_names[b], sizeof (a->common.name))
652#else
653
654#define ACPI_ADD_OBJECT_NAME(a,b)
655#endif
656
657/*
658 * Memory allocation tracking (DEBUG ONLY)
659 */
660#define ACPI_MEM_PARAMETERS _COMPONENT, _acpi_module_name, __LINE__
661
662#ifndef ACPI_DBG_TRACK_ALLOCATIONS
663
664/* Memory allocation */
665
666#ifndef ACPI_ALLOCATE
667#define ACPI_ALLOCATE(a) acpi_ut_allocate((acpi_size)(a), ACPI_MEM_PARAMETERS)
668#endif
669#ifndef ACPI_ALLOCATE_ZEROED
670#define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed((acpi_size)(a), ACPI_MEM_PARAMETERS)
671#endif
672#ifndef ACPI_FREE
673#define ACPI_FREE(a) acpio_os_free(a)
674#endif
675#define ACPI_MEM_TRACKING(a)
676
677#else
678
679/* Memory allocation */
680
681#define ACPI_ALLOCATE(a) acpi_ut_allocate_and_track((acpi_size)(a), ACPI_MEM_PARAMETERS)
682#define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed_and_track((acpi_size)(a), ACPI_MEM_PARAMETERS)
683#define ACPI_FREE(a) acpi_ut_free_and_track(a, ACPI_MEM_PARAMETERS)
684#define ACPI_MEM_TRACKING(a) a
685
686#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
687
688/* Preemption point */
689#ifndef ACPI_PREEMPTION_POINT
690#define ACPI_PREEMPTION_POINT() /* no preemption */
691#endif
692
693#endif /* ACMACROS_H */
diff --git a/include/acpi/acnamesp.h b/include/acpi/acnamesp.h
deleted file mode 100644
index db4e6f677855..000000000000
--- a/include/acpi/acnamesp.h
+++ /dev/null
@@ -1,321 +0,0 @@
1/******************************************************************************
2 *
3 * Name: acnamesp.h - Namespace subcomponent prototypes and defines
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACNAMESP_H__
45#define __ACNAMESP_H__
46
47/* To search the entire name space, pass this as search_base */
48
49#define ACPI_NS_ALL ((acpi_handle)0)
50
51/*
52 * Elements of acpi_ns_properties are bit significant
53 * and should be one-to-one with values of acpi_object_type
54 */
55#define ACPI_NS_NORMAL 0
56#define ACPI_NS_NEWSCOPE 1 /* a definition of this type opens a name scope */
57#define ACPI_NS_LOCAL 2 /* suppress search of enclosing scopes */
58
59/* Flags for acpi_ns_lookup, acpi_ns_search_and_enter */
60
61#define ACPI_NS_NO_UPSEARCH 0
62#define ACPI_NS_SEARCH_PARENT 0x01
63#define ACPI_NS_DONT_OPEN_SCOPE 0x02
64#define ACPI_NS_NO_PEER_SEARCH 0x04
65#define ACPI_NS_ERROR_IF_FOUND 0x08
66#define ACPI_NS_PREFIX_IS_SCOPE 0x10
67#define ACPI_NS_EXTERNAL 0x20
68#define ACPI_NS_TEMPORARY 0x40
69
70/* Flags for acpi_ns_walk_namespace */
71
72#define ACPI_NS_WALK_NO_UNLOCK 0
73#define ACPI_NS_WALK_UNLOCK 0x01
74#define ACPI_NS_WALK_TEMP_NODES 0x02
75
76/*
77 * nsinit - Namespace initialization
78 */
79acpi_status acpi_ns_initialize_objects(void);
80
81acpi_status acpi_ns_initialize_devices(void);
82
83/*
84 * nsload - Namespace loading
85 */
86acpi_status acpi_ns_load_namespace(void);
87
88acpi_status
89acpi_ns_load_table(u32 table_index, struct acpi_namespace_node *node);
90
91/*
92 * nswalk - walk the namespace
93 */
94acpi_status
95acpi_ns_walk_namespace(acpi_object_type type,
96 acpi_handle start_object,
97 u32 max_depth,
98 u32 flags,
99 acpi_walk_callback user_function,
100 void *context, void **return_value);
101
102struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type, struct acpi_namespace_node
103 *parent, struct acpi_namespace_node
104 *child);
105
106/*
107 * nsparse - table parsing
108 */
109acpi_status
110acpi_ns_parse_table(u32 table_index, struct acpi_namespace_node *start_node);
111
112acpi_status
113acpi_ns_one_complete_parse(u32 pass_number,
114 u32 table_index,
115 struct acpi_namespace_node *start_node);
116
117/*
118 * nsaccess - Top-level namespace access
119 */
120acpi_status acpi_ns_root_initialize(void);
121
122acpi_status
123acpi_ns_lookup(union acpi_generic_state *scope_info,
124 char *name,
125 acpi_object_type type,
126 acpi_interpreter_mode interpreter_mode,
127 u32 flags,
128 struct acpi_walk_state *walk_state,
129 struct acpi_namespace_node **ret_node);
130
131/*
132 * nsalloc - Named object allocation/deallocation
133 */
134struct acpi_namespace_node *acpi_ns_create_node(u32 name);
135
136void acpi_ns_delete_node(struct acpi_namespace_node *node);
137
138void
139acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_handle);
140
141void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id);
142
143void acpi_ns_detach_object(struct acpi_namespace_node *node);
144
145void acpi_ns_delete_children(struct acpi_namespace_node *parent);
146
147int acpi_ns_compare_names(char *name1, char *name2);
148
149/*
150 * nsdump - Namespace dump/print utilities
151 */
152#ifdef ACPI_FUTURE_USAGE
153void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth);
154#endif /* ACPI_FUTURE_USAGE */
155
156void acpi_ns_dump_entry(acpi_handle handle, u32 debug_level);
157
158void
159acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component);
160
161void acpi_ns_print_pathname(u32 num_segments, char *pathname);
162
163acpi_status
164acpi_ns_dump_one_object(acpi_handle obj_handle,
165 u32 level, void *context, void **return_value);
166
167#ifdef ACPI_FUTURE_USAGE
168void
169acpi_ns_dump_objects(acpi_object_type type,
170 u8 display_type,
171 u32 max_depth,
172 acpi_owner_id owner_id, acpi_handle start_handle);
173#endif /* ACPI_FUTURE_USAGE */
174
175/*
176 * nseval - Namespace evaluation functions
177 */
178acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info);
179
180/*
181 * nspredef - Support for predefined/reserved names
182 */
183acpi_status
184acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
185 union acpi_operand_object *return_object);
186
187const union acpi_predefined_info *acpi_ns_check_for_predefined_name(struct
188 acpi_namespace_node
189 *node);
190
191void
192acpi_ns_check_parameter_count(char *pathname,
193 struct acpi_namespace_node *node,
194 const union acpi_predefined_info *info);
195
196/*
197 * nsnames - Name and Scope manipulation
198 */
199u32 acpi_ns_opens_scope(acpi_object_type type);
200
201acpi_status
202acpi_ns_build_external_path(struct acpi_namespace_node *node,
203 acpi_size size, char *name_buffer);
204
205char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node);
206
207char *acpi_ns_name_of_current_scope(struct acpi_walk_state *walk_state);
208
209acpi_status
210acpi_ns_handle_to_pathname(acpi_handle target_handle,
211 struct acpi_buffer *buffer);
212
213u8
214acpi_ns_pattern_match(struct acpi_namespace_node *obj_node, char *search_for);
215
216acpi_status
217acpi_ns_get_node(struct acpi_namespace_node *prefix_node,
218 const char *external_pathname,
219 u32 flags, struct acpi_namespace_node **out_node);
220
221acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node);
222
223/*
224 * nsobject - Object management for namespace nodes
225 */
226acpi_status
227acpi_ns_attach_object(struct acpi_namespace_node *node,
228 union acpi_operand_object *object, acpi_object_type type);
229
230union acpi_operand_object *acpi_ns_get_attached_object(struct
231 acpi_namespace_node
232 *node);
233
234union acpi_operand_object *acpi_ns_get_secondary_object(union
235 acpi_operand_object
236 *obj_desc);
237
238acpi_status
239acpi_ns_attach_data(struct acpi_namespace_node *node,
240 acpi_object_handler handler, void *data);
241
242acpi_status
243acpi_ns_detach_data(struct acpi_namespace_node *node,
244 acpi_object_handler handler);
245
246acpi_status
247acpi_ns_get_attached_data(struct acpi_namespace_node *node,
248 acpi_object_handler handler, void **data);
249
250/*
251 * nssearch - Namespace searching and entry
252 */
253acpi_status
254acpi_ns_search_and_enter(u32 entry_name,
255 struct acpi_walk_state *walk_state,
256 struct acpi_namespace_node *node,
257 acpi_interpreter_mode interpreter_mode,
258 acpi_object_type type,
259 u32 flags, struct acpi_namespace_node **ret_node);
260
261acpi_status
262acpi_ns_search_one_scope(u32 entry_name,
263 struct acpi_namespace_node *node,
264 acpi_object_type type,
265 struct acpi_namespace_node **ret_node);
266
267void
268acpi_ns_install_node(struct acpi_walk_state *walk_state,
269 struct acpi_namespace_node *parent_node,
270 struct acpi_namespace_node *node, acpi_object_type type);
271
272/*
273 * nsutils - Utility functions
274 */
275u8 acpi_ns_valid_root_prefix(char prefix);
276
277acpi_object_type acpi_ns_get_type(struct acpi_namespace_node *node);
278
279u32 acpi_ns_local(acpi_object_type type);
280
281void
282acpi_ns_report_error(const char *module_name,
283 u32 line_number,
284 const char *internal_name, acpi_status lookup_status);
285
286void
287acpi_ns_report_method_error(const char *module_name,
288 u32 line_number,
289 const char *message,
290 struct acpi_namespace_node *node,
291 const char *path, acpi_status lookup_status);
292
293void
294acpi_ns_print_node_pathname(struct acpi_namespace_node *node, const char *msg);
295
296acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info);
297
298void acpi_ns_get_internal_name_length(struct acpi_namestring_info *info);
299
300acpi_status
301acpi_ns_internalize_name(const char *dotted_name, char **converted_name);
302
303acpi_status
304acpi_ns_externalize_name(u32 internal_name_length,
305 const char *internal_name,
306 u32 * converted_name_length, char **converted_name);
307
308struct acpi_namespace_node *acpi_ns_map_handle_to_node(acpi_handle handle);
309
310acpi_handle acpi_ns_convert_entry_to_handle(struct acpi_namespace_node *node);
311
312void acpi_ns_terminate(void);
313
314struct acpi_namespace_node *acpi_ns_get_parent_node(struct acpi_namespace_node
315 *node);
316
317struct acpi_namespace_node *acpi_ns_get_next_valid_node(struct
318 acpi_namespace_node
319 *node);
320
321#endif /* __ACNAMESP_H__ */
diff --git a/include/acpi/acobject.h b/include/acpi/acobject.h
deleted file mode 100644
index eb6f038b03d9..000000000000
--- a/include/acpi/acobject.h
+++ /dev/null
@@ -1,446 +0,0 @@
1
2/******************************************************************************
3 *
4 * Name: acobject.h - Definition of union acpi_operand_object (Internal object only)
5 *
6 *****************************************************************************/
7
8/*
9 * Copyright (C) 2000 - 2008, Intel Corp.
10 * All rights reserved.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions, and the following disclaimer,
17 * without modification.
18 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19 * substantially similar to the "NO WARRANTY" disclaimer below
20 * ("Disclaimer") and any redistribution must be conditioned upon
21 * including a substantially similar Disclaimer requirement for further
22 * binary redistribution.
23 * 3. Neither the names of the above-listed copyright holders nor the names
24 * of any contributors may be used to endorse or promote products derived
25 * from this software without specific prior written permission.
26 *
27 * Alternatively, this software may be distributed under the terms of the
28 * GNU General Public License ("GPL") version 2 as published by the Free
29 * Software Foundation.
30 *
31 * NO WARRANTY
32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 * POSSIBILITY OF SUCH DAMAGES.
43 */
44
45#ifndef _ACOBJECT_H
46#define _ACOBJECT_H
47
48/* acpisrc:struct_defs -- for acpisrc conversion */
49
50/*
51 * The union acpi_operand_object is used to pass AML operands from the dispatcher
52 * to the interpreter, and to keep track of the various handlers such as
53 * address space handlers and notify handlers. The object is a constant
54 * size in order to allow it to be cached and reused.
55 *
56 * Note: The object is optimized to be aligned and will not work if it is
57 * byte-packed.
58 */
59#if ACPI_MACHINE_WIDTH == 64
60#pragma pack(8)
61#else
62#pragma pack(4)
63#endif
64
65/*******************************************************************************
66 *
67 * Common Descriptors
68 *
69 ******************************************************************************/
70
71/*
72 * Common area for all objects.
73 *
74 * descriptor_type is used to differentiate between internal descriptors, and
75 * must be in the same place across all descriptors
76 *
77 * Note: The descriptor_type and Type fields must appear in the identical
78 * position in both the struct acpi_namespace_node and union acpi_operand_object
79 * structures.
80 */
81#define ACPI_OBJECT_COMMON_HEADER \
82 union acpi_operand_object *next_object; /* Objects linked to parent NS node */\
83 u8 descriptor_type; /* To differentiate various internal objs */\
84 u8 type; /* acpi_object_type */\
85 u16 reference_count; /* For object deletion management */\
86 u8 flags;
87 /*
88 * Note: There are 3 bytes available here before the
89 * next natural alignment boundary (for both 32/64 cases)
90 */
91
92/* Values for Flag byte above */
93
94#define AOPOBJ_AML_CONSTANT 0x01
95#define AOPOBJ_STATIC_POINTER 0x02
96#define AOPOBJ_DATA_VALID 0x04
97#define AOPOBJ_OBJECT_INITIALIZED 0x08
98#define AOPOBJ_SETUP_COMPLETE 0x10
99#define AOPOBJ_SINGLE_DATUM 0x20
100#define AOPOBJ_INVALID 0x40 /* Used if host OS won't allow an op_region address */
101
102/******************************************************************************
103 *
104 * Basic data types
105 *
106 *****************************************************************************/
107
108struct acpi_object_common {
109ACPI_OBJECT_COMMON_HEADER};
110
111struct acpi_object_integer {
112 ACPI_OBJECT_COMMON_HEADER u8 fill[3]; /* Prevent warning on some compilers */
113 acpi_integer value;
114};
115
116/*
117 * Note: The String and Buffer object must be identical through the Pointer
118 * and length elements. There is code that depends on this.
119 *
120 * Fields common to both Strings and Buffers
121 */
122#define ACPI_COMMON_BUFFER_INFO(_type) \
123 _type *pointer; \
124 u32 length;
125
126struct acpi_object_string { /* Null terminated, ASCII characters only */
127 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO(char) /* String in AML stream or allocated string */
128};
129
130struct acpi_object_buffer {
131 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO(u8) /* Buffer in AML stream or allocated buffer */
132 u32 aml_length;
133 u8 *aml_start;
134 struct acpi_namespace_node *node; /* Link back to parent node */
135};
136
137struct acpi_object_package {
138 ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *node; /* Link back to parent node */
139 union acpi_operand_object **elements; /* Array of pointers to acpi_objects */
140 u8 *aml_start;
141 u32 aml_length;
142 u32 count; /* # of elements in package */
143};
144
145/******************************************************************************
146 *
147 * Complex data types
148 *
149 *****************************************************************************/
150
151struct acpi_object_event {
152 ACPI_OBJECT_COMMON_HEADER acpi_semaphore os_semaphore; /* Actual OS synchronization object */
153};
154
155struct acpi_object_mutex {
156 ACPI_OBJECT_COMMON_HEADER u8 sync_level; /* 0-15, specified in Mutex() call */
157 u16 acquisition_depth; /* Allow multiple Acquires, same thread */
158 acpi_mutex os_mutex; /* Actual OS synchronization object */
159 acpi_thread_id thread_id; /* Current owner of the mutex */
160 struct acpi_thread_state *owner_thread; /* Current owner of the mutex */
161 union acpi_operand_object *prev; /* Link for list of acquired mutexes */
162 union acpi_operand_object *next; /* Link for list of acquired mutexes */
163 struct acpi_namespace_node *node; /* Containing namespace node */
164 u8 original_sync_level; /* Owner's original sync level (0-15) */
165};
166
167struct acpi_object_region {
168 ACPI_OBJECT_COMMON_HEADER u8 space_id;
169 struct acpi_namespace_node *node; /* Containing namespace node */
170 union acpi_operand_object *handler; /* Handler for region access */
171 union acpi_operand_object *next;
172 acpi_physical_address address;
173 u32 length;
174};
175
176struct acpi_object_method {
177 ACPI_OBJECT_COMMON_HEADER u8 method_flags;
178 u8 param_count;
179 u8 sync_level;
180 union acpi_operand_object *mutex;
181 u8 *aml_start;
182 ACPI_INTERNAL_METHOD implementation;
183 u32 aml_length;
184 u8 thread_count;
185 acpi_owner_id owner_id;
186};
187
188/******************************************************************************
189 *
190 * Objects that can be notified. All share a common notify_info area.
191 *
192 *****************************************************************************/
193
194/*
195 * Common fields for objects that support ASL notifications
196 */
197#define ACPI_COMMON_NOTIFY_INFO \
198 union acpi_operand_object *system_notify; /* Handler for system notifies */\
199 union acpi_operand_object *device_notify; /* Handler for driver notifies */\
200 union acpi_operand_object *handler; /* Handler for Address space */
201
202struct acpi_object_notify_common { /* COMMON NOTIFY for POWER, PROCESSOR, DEVICE, and THERMAL */
203ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO};
204
205struct acpi_object_device {
206 ACPI_OBJECT_COMMON_HEADER
207 ACPI_COMMON_NOTIFY_INFO struct acpi_gpe_block_info *gpe_block;
208};
209
210struct acpi_object_power_resource {
211 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO u32 system_level;
212 u32 resource_order;
213};
214
215struct acpi_object_processor {
216 ACPI_OBJECT_COMMON_HEADER
217 /* The next two fields take advantage of the 3-byte space before NOTIFY_INFO */
218 u8 proc_id;
219 u8 length;
220 ACPI_COMMON_NOTIFY_INFO acpi_io_address address;
221};
222
223struct acpi_object_thermal_zone {
224ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO};
225
226/******************************************************************************
227 *
228 * Fields. All share a common header/info field.
229 *
230 *****************************************************************************/
231
232/*
233 * Common bitfield for the field objects
234 * "Field Datum" -- a datum from the actual field object
235 * "Buffer Datum" -- a datum from a user buffer, read from or to be written to the field
236 */
237#define ACPI_COMMON_FIELD_INFO \
238 u8 field_flags; /* Access, update, and lock bits */\
239 u8 attribute; /* From access_as keyword */\
240 u8 access_byte_width; /* Read/Write size in bytes */\
241 struct acpi_namespace_node *node; /* Link back to parent node */\
242 u32 bit_length; /* Length of field in bits */\
243 u32 base_byte_offset; /* Byte offset within containing object */\
244 u32 value; /* Value to store into the Bank or Index register */\
245 u8 start_field_bit_offset;/* Bit offset within first field datum (0-63) */\
246 u8 access_bit_width; /* Read/Write size in bits (8-64) */
247
248struct acpi_object_field_common { /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */
249 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Parent Operation Region object (REGION/BANK fields only) */
250};
251
252struct acpi_object_region_field {
253 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Containing op_region object */
254};
255
256struct acpi_object_bank_field {
257 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Containing op_region object */
258 union acpi_operand_object *bank_obj; /* bank_select Register object */
259};
260
261struct acpi_object_index_field {
262 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO
263 /*
264 * No "RegionObj" pointer needed since the Index and Data registers
265 * are each field definitions unto themselves.
266 */
267 union acpi_operand_object *index_obj; /* Index register */
268 union acpi_operand_object *data_obj; /* Data register */
269};
270
271/* The buffer_field is different in that it is part of a Buffer, not an op_region */
272
273struct acpi_object_buffer_field {
274 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *buffer_obj; /* Containing Buffer object */
275};
276
277/******************************************************************************
278 *
279 * Objects for handlers
280 *
281 *****************************************************************************/
282
283struct acpi_object_notify_handler {
284 ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *node; /* Parent device */
285 acpi_notify_handler handler;
286 void *context;
287};
288
289struct acpi_object_addr_handler {
290 ACPI_OBJECT_COMMON_HEADER u8 space_id;
291 u8 handler_flags;
292 acpi_adr_space_handler handler;
293 struct acpi_namespace_node *node; /* Parent device */
294 void *context;
295 acpi_adr_space_setup setup;
296 union acpi_operand_object *region_list; /* regions using this handler */
297 union acpi_operand_object *next;
298};
299
300/* Flags for address handler (handler_flags) */
301
302#define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED 0x01
303
304/******************************************************************************
305 *
306 * Special internal objects
307 *
308 *****************************************************************************/
309
310/*
311 * The Reference object is used for these opcodes:
312 * Arg[0-6], Local[0-7], index_op, name_op, ref_of_op, load_op, load_table_op, debug_op
313 * The Reference.Class differentiates these types.
314 */
315struct acpi_object_reference {
316 ACPI_OBJECT_COMMON_HEADER u8 class; /* Reference Class */
317 u8 target_type; /* Used for Index Op */
318 u8 reserved;
319 void *object; /* name_op=>HANDLE to obj, index_op=>union acpi_operand_object */
320 struct acpi_namespace_node *node; /* ref_of or Namepath */
321 union acpi_operand_object **where; /* Target of Index */
322 u32 value; /* Used for Local/Arg/Index/ddb_handle */
323};
324
325/* Values for Reference.Class above */
326
327typedef enum {
328 ACPI_REFCLASS_LOCAL = 0, /* Method local */
329 ACPI_REFCLASS_ARG = 1, /* Method argument */
330 ACPI_REFCLASS_REFOF = 2, /* Result of ref_of() TBD: Split to Ref/Node and Ref/operand_obj? */
331 ACPI_REFCLASS_INDEX = 3, /* Result of Index() */
332 ACPI_REFCLASS_TABLE = 4, /* ddb_handle - Load(), load_table() */
333 ACPI_REFCLASS_NAME = 5, /* Reference to a named object */
334 ACPI_REFCLASS_DEBUG = 6, /* Debug object */
335
336 ACPI_REFCLASS_MAX = 6
337} ACPI_REFERENCE_CLASSES;
338
339/*
340 * Extra object is used as additional storage for types that
341 * have AML code in their declarations (term_args) that must be
342 * evaluated at run time.
343 *
344 * Currently: Region and field_unit types
345 */
346struct acpi_object_extra {
347 ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *method_REG; /* _REG method for this region (if any) */
348 void *region_context; /* Region-specific data */
349 u8 *aml_start;
350 u32 aml_length;
351};
352
353/* Additional data that can be attached to namespace nodes */
354
355struct acpi_object_data {
356 ACPI_OBJECT_COMMON_HEADER acpi_object_handler handler;
357 void *pointer;
358};
359
360/* Structure used when objects are cached for reuse */
361
362struct acpi_object_cache_list {
363 ACPI_OBJECT_COMMON_HEADER union acpi_operand_object *next; /* Link for object cache and internal lists */
364};
365
366/******************************************************************************
367 *
368 * union acpi_operand_object Descriptor - a giant union of all of the above
369 *
370 *****************************************************************************/
371
372union acpi_operand_object {
373 struct acpi_object_common common;
374 struct acpi_object_integer integer;
375 struct acpi_object_string string;
376 struct acpi_object_buffer buffer;
377 struct acpi_object_package package;
378 struct acpi_object_event event;
379 struct acpi_object_method method;
380 struct acpi_object_mutex mutex;
381 struct acpi_object_region region;
382 struct acpi_object_notify_common common_notify;
383 struct acpi_object_device device;
384 struct acpi_object_power_resource power_resource;
385 struct acpi_object_processor processor;
386 struct acpi_object_thermal_zone thermal_zone;
387 struct acpi_object_field_common common_field;
388 struct acpi_object_region_field field;
389 struct acpi_object_buffer_field buffer_field;
390 struct acpi_object_bank_field bank_field;
391 struct acpi_object_index_field index_field;
392 struct acpi_object_notify_handler notify;
393 struct acpi_object_addr_handler address_space;
394 struct acpi_object_reference reference;
395 struct acpi_object_extra extra;
396 struct acpi_object_data data;
397 struct acpi_object_cache_list cache;
398
399 /*
400 * Add namespace node to union in order to simplify code that accepts both
401 * ACPI_OPERAND_OBJECTs and ACPI_NAMESPACE_NODEs. The structures share
402 * a common descriptor_type field in order to differentiate them.
403 */
404 struct acpi_namespace_node node;
405};
406
407/******************************************************************************
408 *
409 * union acpi_descriptor - objects that share a common descriptor identifier
410 *
411 *****************************************************************************/
412
413/* Object descriptor types */
414
415#define ACPI_DESC_TYPE_CACHED 0x01 /* Used only when object is cached */
416#define ACPI_DESC_TYPE_STATE 0x02
417#define ACPI_DESC_TYPE_STATE_UPDATE 0x03
418#define ACPI_DESC_TYPE_STATE_PACKAGE 0x04
419#define ACPI_DESC_TYPE_STATE_CONTROL 0x05
420#define ACPI_DESC_TYPE_STATE_RPSCOPE 0x06
421#define ACPI_DESC_TYPE_STATE_PSCOPE 0x07
422#define ACPI_DESC_TYPE_STATE_WSCOPE 0x08
423#define ACPI_DESC_TYPE_STATE_RESULT 0x09
424#define ACPI_DESC_TYPE_STATE_NOTIFY 0x0A
425#define ACPI_DESC_TYPE_STATE_THREAD 0x0B
426#define ACPI_DESC_TYPE_WALK 0x0C
427#define ACPI_DESC_TYPE_PARSER 0x0D
428#define ACPI_DESC_TYPE_OPERAND 0x0E
429#define ACPI_DESC_TYPE_NAMED 0x0F
430#define ACPI_DESC_TYPE_MAX 0x0F
431
432struct acpi_common_descriptor {
433 void *common_pointer;
434 u8 descriptor_type; /* To differentiate various internal objs */
435};
436
437union acpi_descriptor {
438 struct acpi_common_descriptor common;
439 union acpi_operand_object object;
440 struct acpi_namespace_node node;
441 union acpi_parse_object op;
442};
443
444#pragma pack()
445
446#endif /* _ACOBJECT_H */
diff --git a/include/acpi/acopcode.h b/include/acpi/acopcode.h
deleted file mode 100644
index dfdf63327885..000000000000
--- a/include/acpi/acopcode.h
+++ /dev/null
@@ -1,323 +0,0 @@
1/******************************************************************************
2 *
3 * Name: acopcode.h - AML opcode information for the AML parser and interpreter
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACOPCODE_H__
45#define __ACOPCODE_H__
46
47#define MAX_EXTENDED_OPCODE 0x88
48#define NUM_EXTENDED_OPCODE (MAX_EXTENDED_OPCODE + 1)
49#define MAX_INTERNAL_OPCODE
50#define NUM_INTERNAL_OPCODE (MAX_INTERNAL_OPCODE + 1)
51
52/* Used for non-assigned opcodes */
53
54#define _UNK 0x6B
55
56/*
57 * Reserved ASCII characters. Do not use any of these for
58 * internal opcodes, since they are used to differentiate
59 * name strings from AML opcodes
60 */
61#define _ASC 0x6C
62#define _NAM 0x6C
63#define _PFX 0x6D
64
65/*
66 * All AML opcodes and the parse-time arguments for each. Used by the AML
67 * parser Each list is compressed into a 32-bit number and stored in the
68 * master opcode table (in psopcode.c).
69 */
70#define ARGP_ACCESSFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING)
71#define ARGP_ACQUIRE_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_WORDDATA)
72#define ARGP_ADD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
73#define ARGP_ALIAS_OP ARGP_LIST2 (ARGP_NAMESTRING, ARGP_NAME)
74#define ARGP_ARG0 ARG_NONE
75#define ARGP_ARG1 ARG_NONE
76#define ARGP_ARG2 ARG_NONE
77#define ARGP_ARG3 ARG_NONE
78#define ARGP_ARG4 ARG_NONE
79#define ARGP_ARG5 ARG_NONE
80#define ARGP_ARG6 ARG_NONE
81#define ARGP_BANK_FIELD_OP ARGP_LIST6 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_NAMESTRING,ARGP_TERMARG, ARGP_BYTEDATA, ARGP_FIELDLIST)
82#define ARGP_BIT_AND_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
83#define ARGP_BIT_NAND_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
84#define ARGP_BIT_NOR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
85#define ARGP_BIT_NOT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
86#define ARGP_BIT_OR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
87#define ARGP_BIT_XOR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
88#define ARGP_BREAK_OP ARG_NONE
89#define ARGP_BREAK_POINT_OP ARG_NONE
90#define ARGP_BUFFER_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_BYTELIST)
91#define ARGP_BYTE_OP ARGP_LIST1 (ARGP_BYTEDATA)
92#define ARGP_BYTELIST_OP ARGP_LIST1 (ARGP_NAMESTRING)
93#define ARGP_CONCAT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
94#define ARGP_CONCAT_RES_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
95#define ARGP_COND_REF_OF_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SUPERNAME)
96#define ARGP_CONTINUE_OP ARG_NONE
97#define ARGP_COPY_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_SIMPLENAME)
98#define ARGP_CREATE_BIT_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
99#define ARGP_CREATE_BYTE_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
100#define ARGP_CREATE_DWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
101#define ARGP_CREATE_FIELD_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
102#define ARGP_CREATE_QWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
103#define ARGP_CREATE_WORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
104#define ARGP_DATA_REGION_OP ARGP_LIST4 (ARGP_NAME, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG)
105#define ARGP_DEBUG_OP ARG_NONE
106#define ARGP_DECREMENT_OP ARGP_LIST1 (ARGP_SUPERNAME)
107#define ARGP_DEREF_OF_OP ARGP_LIST1 (ARGP_TERMARG)
108#define ARGP_DEVICE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_OBJLIST)
109#define ARGP_DIVIDE_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET, ARGP_TARGET)
110#define ARGP_DWORD_OP ARGP_LIST1 (ARGP_DWORDDATA)
111#define ARGP_ELSE_OP ARGP_LIST2 (ARGP_PKGLENGTH, ARGP_TERMLIST)
112#define ARGP_EVENT_OP ARGP_LIST1 (ARGP_NAME)
113#define ARGP_FATAL_OP ARGP_LIST3 (ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_TERMARG)
114#define ARGP_FIELD_OP ARGP_LIST4 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_BYTEDATA, ARGP_FIELDLIST)
115#define ARGP_FIND_SET_LEFT_BIT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
116#define ARGP_FIND_SET_RIGHT_BIT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
117#define ARGP_FROM_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
118#define ARGP_IF_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_TERMLIST)
119#define ARGP_INCREMENT_OP ARGP_LIST1 (ARGP_SUPERNAME)
120#define ARGP_INDEX_FIELD_OP ARGP_LIST5 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_NAMESTRING,ARGP_BYTEDATA, ARGP_FIELDLIST)
121#define ARGP_INDEX_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
122#define ARGP_LAND_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
123#define ARGP_LEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
124#define ARGP_LGREATER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
125#define ARGP_LGREATEREQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
126#define ARGP_LLESS_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
127#define ARGP_LLESSEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
128#define ARGP_LNOT_OP ARGP_LIST1 (ARGP_TERMARG)
129#define ARGP_LNOTEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
130#define ARGP_LOAD_OP ARGP_LIST2 (ARGP_NAMESTRING, ARGP_SUPERNAME)
131#define ARGP_LOAD_TABLE_OP ARGP_LIST6 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG)
132#define ARGP_LOCAL0 ARG_NONE
133#define ARGP_LOCAL1 ARG_NONE
134#define ARGP_LOCAL2 ARG_NONE
135#define ARGP_LOCAL3 ARG_NONE
136#define ARGP_LOCAL4 ARG_NONE
137#define ARGP_LOCAL5 ARG_NONE
138#define ARGP_LOCAL6 ARG_NONE
139#define ARGP_LOCAL7 ARG_NONE
140#define ARGP_LOR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
141#define ARGP_MATCH_OP ARGP_LIST6 (ARGP_TERMARG, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_TERMARG)
142#define ARGP_METHOD_OP ARGP_LIST4 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_TERMLIST)
143#define ARGP_METHODCALL_OP ARGP_LIST1 (ARGP_NAMESTRING)
144#define ARGP_MID_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
145#define ARGP_MOD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
146#define ARGP_MULTIPLY_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
147#define ARGP_MUTEX_OP ARGP_LIST2 (ARGP_NAME, ARGP_BYTEDATA)
148#define ARGP_NAME_OP ARGP_LIST2 (ARGP_NAME, ARGP_DATAOBJ)
149#define ARGP_NAMEDFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING)
150#define ARGP_NAMEPATH_OP ARGP_LIST1 (ARGP_NAMESTRING)
151#define ARGP_NOOP_OP ARG_NONE
152#define ARGP_NOTIFY_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG)
153#define ARGP_ONE_OP ARG_NONE
154#define ARGP_ONES_OP ARG_NONE
155#define ARGP_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_BYTEDATA, ARGP_DATAOBJLIST)
156#define ARGP_POWER_RES_OP ARGP_LIST5 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_WORDDATA, ARGP_OBJLIST)
157#define ARGP_PROCESSOR_OP ARGP_LIST6 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_BYTEDATA, ARGP_OBJLIST)
158#define ARGP_QWORD_OP ARGP_LIST1 (ARGP_QWORDDATA)
159#define ARGP_REF_OF_OP ARGP_LIST1 (ARGP_SUPERNAME)
160#define ARGP_REGION_OP ARGP_LIST4 (ARGP_NAME, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_TERMARG)
161#define ARGP_RELEASE_OP ARGP_LIST1 (ARGP_SUPERNAME)
162#define ARGP_RESERVEDFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING)
163#define ARGP_RESET_OP ARGP_LIST1 (ARGP_SUPERNAME)
164#define ARGP_RETURN_OP ARGP_LIST1 (ARGP_TERMARG)
165#define ARGP_REVISION_OP ARG_NONE
166#define ARGP_SCOPE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_TERMLIST)
167#define ARGP_SHIFT_LEFT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
168#define ARGP_SHIFT_RIGHT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
169#define ARGP_SIGNAL_OP ARGP_LIST1 (ARGP_SUPERNAME)
170#define ARGP_SIZE_OF_OP ARGP_LIST1 (ARGP_SUPERNAME)
171#define ARGP_SLEEP_OP ARGP_LIST1 (ARGP_TERMARG)
172#define ARGP_STALL_OP ARGP_LIST1 (ARGP_TERMARG)
173#define ARGP_STATICSTRING_OP ARGP_LIST1 (ARGP_NAMESTRING)
174#define ARGP_STORE_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_SUPERNAME)
175#define ARGP_STRING_OP ARGP_LIST1 (ARGP_CHARLIST)
176#define ARGP_SUBTRACT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
177#define ARGP_THERMAL_ZONE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_OBJLIST)
178#define ARGP_TIMER_OP ARG_NONE
179#define ARGP_TO_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
180#define ARGP_TO_BUFFER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
181#define ARGP_TO_DEC_STR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
182#define ARGP_TO_HEX_STR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
183#define ARGP_TO_INTEGER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
184#define ARGP_TO_STRING_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
185#define ARGP_TYPE_OP ARGP_LIST1 (ARGP_SUPERNAME)
186#define ARGP_UNLOAD_OP ARGP_LIST1 (ARGP_SUPERNAME)
187#define ARGP_VAR_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_DATAOBJLIST)
188#define ARGP_WAIT_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG)
189#define ARGP_WHILE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_TERMLIST)
190#define ARGP_WORD_OP ARGP_LIST1 (ARGP_WORDDATA)
191#define ARGP_ZERO_OP ARG_NONE
192
193/*
194 * All AML opcodes and the runtime arguments for each. Used by the AML
195 * interpreter Each list is compressed into a 32-bit number and stored
196 * in the master opcode table (in psopcode.c).
197 *
198 * (Used by prep_operands procedure and the ASL Compiler)
199 */
200#define ARGI_ACCESSFIELD_OP ARGI_INVALID_OPCODE
201#define ARGI_ACQUIRE_OP ARGI_LIST2 (ARGI_MUTEX, ARGI_INTEGER)
202#define ARGI_ADD_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
203#define ARGI_ALIAS_OP ARGI_INVALID_OPCODE
204#define ARGI_ARG0 ARG_NONE
205#define ARGI_ARG1 ARG_NONE
206#define ARGI_ARG2 ARG_NONE
207#define ARGI_ARG3 ARG_NONE
208#define ARGI_ARG4 ARG_NONE
209#define ARGI_ARG5 ARG_NONE
210#define ARGI_ARG6 ARG_NONE
211#define ARGI_BANK_FIELD_OP ARGI_INVALID_OPCODE
212#define ARGI_BIT_AND_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
213#define ARGI_BIT_NAND_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
214#define ARGI_BIT_NOR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
215#define ARGI_BIT_NOT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
216#define ARGI_BIT_OR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
217#define ARGI_BIT_XOR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
218#define ARGI_BREAK_OP ARG_NONE
219#define ARGI_BREAK_POINT_OP ARG_NONE
220#define ARGI_BUFFER_OP ARGI_LIST1 (ARGI_INTEGER)
221#define ARGI_BYTE_OP ARGI_INVALID_OPCODE
222#define ARGI_BYTELIST_OP ARGI_INVALID_OPCODE
223#define ARGI_CONCAT_OP ARGI_LIST3 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA, ARGI_TARGETREF)
224#define ARGI_CONCAT_RES_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_BUFFER, ARGI_TARGETREF)
225#define ARGI_COND_REF_OF_OP ARGI_LIST2 (ARGI_OBJECT_REF, ARGI_TARGETREF)
226#define ARGI_CONTINUE_OP ARGI_INVALID_OPCODE
227#define ARGI_COPY_OP ARGI_LIST2 (ARGI_ANYTYPE, ARGI_SIMPLE_TARGET)
228#define ARGI_CREATE_BIT_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
229#define ARGI_CREATE_BYTE_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
230#define ARGI_CREATE_DWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
231#define ARGI_CREATE_FIELD_OP ARGI_LIST4 (ARGI_BUFFER, ARGI_INTEGER, ARGI_INTEGER, ARGI_REFERENCE)
232#define ARGI_CREATE_QWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
233#define ARGI_CREATE_WORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
234#define ARGI_DATA_REGION_OP ARGI_LIST3 (ARGI_STRING, ARGI_STRING, ARGI_STRING)
235#define ARGI_DEBUG_OP ARG_NONE
236#define ARGI_DECREMENT_OP ARGI_LIST1 (ARGI_TARGETREF)
237#define ARGI_DEREF_OF_OP ARGI_LIST1 (ARGI_REF_OR_STRING)
238#define ARGI_DEVICE_OP ARGI_INVALID_OPCODE
239#define ARGI_DIVIDE_OP ARGI_LIST4 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF, ARGI_TARGETREF)
240#define ARGI_DWORD_OP ARGI_INVALID_OPCODE
241#define ARGI_ELSE_OP ARGI_INVALID_OPCODE
242#define ARGI_EVENT_OP ARGI_INVALID_OPCODE
243#define ARGI_FATAL_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER)
244#define ARGI_FIELD_OP ARGI_INVALID_OPCODE
245#define ARGI_FIND_SET_LEFT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
246#define ARGI_FIND_SET_RIGHT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
247#define ARGI_FROM_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_FIXED_TARGET)
248#define ARGI_IF_OP ARGI_INVALID_OPCODE
249#define ARGI_INCREMENT_OP ARGI_LIST1 (ARGI_TARGETREF)
250#define ARGI_INDEX_FIELD_OP ARGI_INVALID_OPCODE
251#define ARGI_INDEX_OP ARGI_LIST3 (ARGI_COMPLEXOBJ, ARGI_INTEGER, ARGI_TARGETREF)
252#define ARGI_LAND_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
253#define ARGI_LEQUAL_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA)
254#define ARGI_LGREATER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA)
255#define ARGI_LGREATEREQUAL_OP ARGI_INVALID_OPCODE
256#define ARGI_LLESS_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA)
257#define ARGI_LLESSEQUAL_OP ARGI_INVALID_OPCODE
258#define ARGI_LNOT_OP ARGI_LIST1 (ARGI_INTEGER)
259#define ARGI_LNOTEQUAL_OP ARGI_INVALID_OPCODE
260#define ARGI_LOAD_OP ARGI_LIST2 (ARGI_REGION_OR_BUFFER,ARGI_TARGETREF)
261#define ARGI_LOAD_TABLE_OP ARGI_LIST6 (ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_ANYTYPE)
262#define ARGI_LOCAL0 ARG_NONE
263#define ARGI_LOCAL1 ARG_NONE
264#define ARGI_LOCAL2 ARG_NONE
265#define ARGI_LOCAL3 ARG_NONE
266#define ARGI_LOCAL4 ARG_NONE
267#define ARGI_LOCAL5 ARG_NONE
268#define ARGI_LOCAL6 ARG_NONE
269#define ARGI_LOCAL7 ARG_NONE
270#define ARGI_LOR_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
271#define ARGI_MATCH_OP ARGI_LIST6 (ARGI_PACKAGE, ARGI_INTEGER, ARGI_COMPUTEDATA, ARGI_INTEGER,ARGI_COMPUTEDATA,ARGI_INTEGER)
272#define ARGI_METHOD_OP ARGI_INVALID_OPCODE
273#define ARGI_METHODCALL_OP ARGI_INVALID_OPCODE
274#define ARGI_MID_OP ARGI_LIST4 (ARGI_BUFFER_OR_STRING,ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
275#define ARGI_MOD_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
276#define ARGI_MULTIPLY_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
277#define ARGI_MUTEX_OP ARGI_INVALID_OPCODE
278#define ARGI_NAME_OP ARGI_INVALID_OPCODE
279#define ARGI_NAMEDFIELD_OP ARGI_INVALID_OPCODE
280#define ARGI_NAMEPATH_OP ARGI_INVALID_OPCODE
281#define ARGI_NOOP_OP ARG_NONE
282#define ARGI_NOTIFY_OP ARGI_LIST2 (ARGI_DEVICE_REF, ARGI_INTEGER)
283#define ARGI_ONE_OP ARG_NONE
284#define ARGI_ONES_OP ARG_NONE
285#define ARGI_PACKAGE_OP ARGI_LIST1 (ARGI_INTEGER)
286#define ARGI_POWER_RES_OP ARGI_INVALID_OPCODE
287#define ARGI_PROCESSOR_OP ARGI_INVALID_OPCODE
288#define ARGI_QWORD_OP ARGI_INVALID_OPCODE
289#define ARGI_REF_OF_OP ARGI_LIST1 (ARGI_OBJECT_REF)
290#define ARGI_REGION_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
291#define ARGI_RELEASE_OP ARGI_LIST1 (ARGI_MUTEX)
292#define ARGI_RESERVEDFIELD_OP ARGI_INVALID_OPCODE
293#define ARGI_RESET_OP ARGI_LIST1 (ARGI_EVENT)
294#define ARGI_RETURN_OP ARGI_INVALID_OPCODE
295#define ARGI_REVISION_OP ARG_NONE
296#define ARGI_SCOPE_OP ARGI_INVALID_OPCODE
297#define ARGI_SHIFT_LEFT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
298#define ARGI_SHIFT_RIGHT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
299#define ARGI_SIGNAL_OP ARGI_LIST1 (ARGI_EVENT)
300#define ARGI_SIZE_OF_OP ARGI_LIST1 (ARGI_DATAOBJECT)
301#define ARGI_SLEEP_OP ARGI_LIST1 (ARGI_INTEGER)
302#define ARGI_STALL_OP ARGI_LIST1 (ARGI_INTEGER)
303#define ARGI_STATICSTRING_OP ARGI_INVALID_OPCODE
304#define ARGI_STORE_OP ARGI_LIST2 (ARGI_DATAREFOBJ, ARGI_TARGETREF)
305#define ARGI_STRING_OP ARGI_INVALID_OPCODE
306#define ARGI_SUBTRACT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
307#define ARGI_THERMAL_ZONE_OP ARGI_INVALID_OPCODE
308#define ARGI_TIMER_OP ARG_NONE
309#define ARGI_TO_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_FIXED_TARGET)
310#define ARGI_TO_BUFFER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
311#define ARGI_TO_DEC_STR_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
312#define ARGI_TO_HEX_STR_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
313#define ARGI_TO_INTEGER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
314#define ARGI_TO_STRING_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_FIXED_TARGET)
315#define ARGI_TYPE_OP ARGI_LIST1 (ARGI_ANYTYPE)
316#define ARGI_UNLOAD_OP ARGI_LIST1 (ARGI_DDBHANDLE)
317#define ARGI_VAR_PACKAGE_OP ARGI_LIST1 (ARGI_INTEGER)
318#define ARGI_WAIT_OP ARGI_LIST2 (ARGI_EVENT, ARGI_INTEGER)
319#define ARGI_WHILE_OP ARGI_INVALID_OPCODE
320#define ARGI_WORD_OP ARGI_INVALID_OPCODE
321#define ARGI_ZERO_OP ARG_NONE
322
323#endif /* __ACOPCODE_H__ */
diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h
index db8852d8bcf7..5c823d5ab783 100644
--- a/include/acpi/acoutput.h
+++ b/include/acpi/acoutput.h
@@ -45,9 +45,9 @@
45#define __ACOUTPUT_H__ 45#define __ACOUTPUT_H__
46 46
47/* 47/*
48 * Debug levels and component IDs. These are used to control the 48 * Debug levels and component IDs. These are used to control the
49 * granularity of the output of the DEBUG_PRINT macro -- on a per- 49 * granularity of the output of the ACPI_DEBUG_PRINT macro -- on a
50 * component basis and a per-exception-type basis. 50 * per-component basis and a per-exception-type basis.
51 */ 51 */
52 52
53/* Component IDs are used in the global "DebugLayer" */ 53/* Component IDs are used in the global "DebugLayer" */
@@ -69,8 +69,10 @@
69 69
70#define ACPI_COMPILER 0x00001000 70#define ACPI_COMPILER 0x00001000
71#define ACPI_TOOLS 0x00002000 71#define ACPI_TOOLS 0x00002000
72#define ACPI_EXAMPLE 0x00004000
73#define ACPI_DRIVER 0x00008000
72 74
73#define ACPI_ALL_COMPONENTS 0x00003FFF 75#define ACPI_ALL_COMPONENTS 0x0000FFFF
74#define ACPI_COMPONENT_DEFAULT (ACPI_ALL_COMPONENTS) 76#define ACPI_COMPONENT_DEFAULT (ACPI_ALL_COMPONENTS)
75 77
76/* Component IDs reserved for ACPI drivers */ 78/* Component IDs reserved for ACPI drivers */
@@ -78,7 +80,7 @@
78#define ACPI_ALL_DRIVERS 0xFFFF0000 80#define ACPI_ALL_DRIVERS 0xFFFF0000
79 81
80/* 82/*
81 * Raw debug output levels, do not use these in the DEBUG_PRINT macros 83 * Raw debug output levels, do not use these in the ACPI_DEBUG_PRINT macros
82 */ 84 */
83#define ACPI_LV_INIT 0x00000001 85#define ACPI_LV_INIT 0x00000001
84#define ACPI_LV_DEBUG_OBJECT 0x00000002 86#define ACPI_LV_DEBUG_OBJECT 0x00000002
@@ -176,4 +178,95 @@
176#define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT) 178#define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT)
177#define ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL) 179#define ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL)
178 180
181#if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES)
182/*
183 * Module name is included in both debug and non-debug versions primarily for
184 * error messages. The __FILE__ macro is not very useful for this, because it
185 * often includes the entire pathname to the module
186 */
187#define ACPI_MODULE_NAME(name) static const char ACPI_UNUSED_VAR _acpi_module_name[] = name;
188#else
189#define ACPI_MODULE_NAME(name)
190#endif
191
192/*
193 * Ascii error messages can be configured out
194 */
195#ifndef ACPI_NO_ERROR_MESSAGES
196#define AE_INFO _acpi_module_name, __LINE__
197
198/*
199 * Error reporting. Callers module and line number are inserted by AE_INFO,
200 * the plist contains a set of parens to allow variable-length lists.
201 * These macros are used for both the debug and non-debug versions of the code.
202 */
203#define ACPI_INFO(plist) acpi_info plist
204#define ACPI_WARNING(plist) acpi_warning plist
205#define ACPI_EXCEPTION(plist) acpi_exception plist
206#define ACPI_ERROR(plist) acpi_error plist
207
208#else
209
210/* No error messages */
211
212#define ACPI_INFO(plist)
213#define ACPI_WARNING(plist)
214#define ACPI_EXCEPTION(plist)
215#define ACPI_ERROR(plist)
216
217#endif /* ACPI_NO_ERROR_MESSAGES */
218
219/*
220 * Debug macros that are conditionally compiled
221 */
222#ifdef ACPI_DEBUG_OUTPUT
223
224/*
225 * If ACPI_GET_FUNCTION_NAME was not defined in the compiler-dependent header,
226 * define it now. This is the case where there the compiler does not support
227 * a __FUNCTION__ macro or equivalent.
228 */
229#ifndef ACPI_GET_FUNCTION_NAME
230#define ACPI_GET_FUNCTION_NAME _acpi_function_name
231
232/*
233 * The Name parameter should be the procedure name as a quoted string.
234 * The function name is also used by the function exit macros below.
235 * Note: (const char) is used to be compatible with the debug interfaces
236 * and macros such as __FUNCTION__.
237 */
238#define ACPI_FUNCTION_NAME(name) static const char _acpi_function_name[] = #name;
239
240#else
241/* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */
242
243#define ACPI_FUNCTION_NAME(name)
244#endif /* ACPI_GET_FUNCTION_NAME */
245
246/*
247 * Common parameters used for debug output functions:
248 * line number, function name, module(file) name, component ID
249 */
250#define ACPI_DEBUG_PARAMETERS __LINE__, ACPI_GET_FUNCTION_NAME, _acpi_module_name, _COMPONENT
251
252/*
253 * Master debug print macros
254 * Print message if and only if:
255 * 1) Debug print for the current component is enabled
256 * 2) Debug error level or trace level for the print statement is enabled
257 */
258#define ACPI_DEBUG_PRINT(plist) acpi_debug_print plist
259#define ACPI_DEBUG_PRINT_RAW(plist) acpi_debug_print_raw plist
260
261#else
262/*
263 * This is the non-debug case -- make everything go away,
264 * leaving no executable debug code!
265 */
266#define ACPI_FUNCTION_NAME(a)
267#define ACPI_DEBUG_PRINT(pl)
268#define ACPI_DEBUG_PRINT_RAW(pl)
269
270#endif /* ACPI_DEBUG_OUTPUT */
271
179#endif /* __ACOUTPUT_H__ */ 272#endif /* __ACOUTPUT_H__ */
diff --git a/include/acpi/acparser.h b/include/acpi/acparser.h
deleted file mode 100644
index 23ee0fbf5619..000000000000
--- a/include/acpi/acparser.h
+++ /dev/null
@@ -1,234 +0,0 @@
1/******************************************************************************
2 *
3 * Module Name: acparser.h - AML Parser subcomponent prototypes and defines
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACPARSER_H__
45#define __ACPARSER_H__
46
47#define OP_HAS_RETURN_VALUE 1
48
49/* Variable number of arguments. This field must be 32 bits */
50
51#define ACPI_VAR_ARGS ACPI_UINT32_MAX
52
53#define ACPI_PARSE_DELETE_TREE 0x0001
54#define ACPI_PARSE_NO_TREE_DELETE 0x0000
55#define ACPI_PARSE_TREE_MASK 0x0001
56
57#define ACPI_PARSE_LOAD_PASS1 0x0010
58#define ACPI_PARSE_LOAD_PASS2 0x0020
59#define ACPI_PARSE_EXECUTE 0x0030
60#define ACPI_PARSE_MODE_MASK 0x0030
61
62#define ACPI_PARSE_DEFERRED_OP 0x0100
63#define ACPI_PARSE_DISASSEMBLE 0x0200
64
65/******************************************************************************
66 *
67 * Parser interfaces
68 *
69 *****************************************************************************/
70
71/*
72 * psxface - Parser external interfaces
73 */
74acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info);
75
76/*
77 * psargs - Parse AML opcode arguments
78 */
79u8 *acpi_ps_get_next_package_end(struct acpi_parse_state *parser_state);
80
81char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state);
82
83void
84acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state,
85 u32 arg_type, union acpi_parse_object *arg);
86
87acpi_status
88acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state,
89 struct acpi_parse_state *parser_state,
90 union acpi_parse_object *arg, u8 method_call);
91
92acpi_status
93acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
94 struct acpi_parse_state *parser_state,
95 u32 arg_type, union acpi_parse_object **return_arg);
96
97/*
98 * psfind
99 */
100union acpi_parse_object *acpi_ps_find_name(union acpi_parse_object *scope,
101 u32 name, u32 opcode);
102
103union acpi_parse_object *acpi_ps_get_parent(union acpi_parse_object *op);
104
105/*
106 * psopcode - AML Opcode information
107 */
108const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode);
109
110char *acpi_ps_get_opcode_name(u16 opcode);
111
112u8 acpi_ps_get_argument_count(u32 op_type);
113
114/*
115 * psparse - top level parsing routines
116 */
117acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state);
118
119u32 acpi_ps_get_opcode_size(u32 opcode);
120
121u16 acpi_ps_peek_opcode(struct acpi_parse_state *state);
122
123acpi_status
124acpi_ps_complete_this_op(struct acpi_walk_state *walk_state,
125 union acpi_parse_object *op);
126
127acpi_status
128acpi_ps_next_parse_state(struct acpi_walk_state *walk_state,
129 union acpi_parse_object *op,
130 acpi_status callback_status);
131
132/*
133 * psloop - main parse loop
134 */
135acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state);
136
137/*
138 * psscope - Scope stack management routines
139 */
140acpi_status
141acpi_ps_init_scope(struct acpi_parse_state *parser_state,
142 union acpi_parse_object *root);
143
144union acpi_parse_object *acpi_ps_get_parent_scope(struct acpi_parse_state
145 *state);
146
147u8 acpi_ps_has_completed_scope(struct acpi_parse_state *parser_state);
148
149void
150acpi_ps_pop_scope(struct acpi_parse_state *parser_state,
151 union acpi_parse_object **op,
152 u32 * arg_list, u32 * arg_count);
153
154acpi_status
155acpi_ps_push_scope(struct acpi_parse_state *parser_state,
156 union acpi_parse_object *op,
157 u32 remaining_args, u32 arg_count);
158
159void acpi_ps_cleanup_scope(struct acpi_parse_state *state);
160
161/*
162 * pstree - parse tree manipulation routines
163 */
164void
165acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg);
166
167union acpi_parse_object *acpi_ps_find(union acpi_parse_object *scope,
168 char *path, u16 opcode, u32 create);
169
170union acpi_parse_object *acpi_ps_get_arg(union acpi_parse_object *op, u32 argn);
171
172#ifdef ACPI_FUTURE_USAGE
173union acpi_parse_object *acpi_ps_get_depth_next(union acpi_parse_object *origin,
174 union acpi_parse_object *op);
175#endif /* ACPI_FUTURE_USAGE */
176
177/*
178 * pswalk - parse tree walk routines
179 */
180acpi_status
181acpi_ps_walk_parsed_aml(union acpi_parse_object *start_op,
182 union acpi_parse_object *end_op,
183 union acpi_operand_object *mth_desc,
184 struct acpi_namespace_node *start_node,
185 union acpi_operand_object **params,
186 union acpi_operand_object **caller_return_desc,
187 acpi_owner_id owner_id,
188 acpi_parse_downwards descending_callback,
189 acpi_parse_upwards ascending_callback);
190
191acpi_status
192acpi_ps_get_next_walk_op(struct acpi_walk_state *walk_state,
193 union acpi_parse_object *op,
194 acpi_parse_upwards ascending_callback);
195
196acpi_status acpi_ps_delete_completed_op(struct acpi_walk_state *walk_state);
197
198void acpi_ps_delete_parse_tree(union acpi_parse_object *root);
199
200/*
201 * psutils - parser utilities
202 */
203union acpi_parse_object *acpi_ps_create_scope_op(void);
204
205void acpi_ps_init_op(union acpi_parse_object *op, u16 opcode);
206
207union acpi_parse_object *acpi_ps_alloc_op(u16 opcode);
208
209void acpi_ps_free_op(union acpi_parse_object *op);
210
211u8 acpi_ps_is_leading_char(u32 c);
212
213u8 acpi_ps_is_prefix_char(u32 c);
214
215#ifdef ACPI_FUTURE_USAGE
216u32 acpi_ps_get_name(union acpi_parse_object *op);
217#endif /* ACPI_FUTURE_USAGE */
218
219void acpi_ps_set_name(union acpi_parse_object *op, u32 name);
220
221/*
222 * psdump - display parser tree
223 */
224u32
225acpi_ps_sprint_path(char *buffer_start,
226 u32 buffer_size, union acpi_parse_object *op);
227
228u32
229acpi_ps_sprint_op(char *buffer_start,
230 u32 buffer_size, union acpi_parse_object *op);
231
232void acpi_ps_show(union acpi_parse_object *op);
233
234#endif /* __ACPARSER_H__ */
diff --git a/include/acpi/acpi.h b/include/acpi/acpi.h
index c515ef6cc89e..472b7bf0c5d4 100644
--- a/include/acpi/acpi.h
+++ b/include/acpi/acpi.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Name: acpi.h - Master include file, Publics and external data. 3 * Name: acpi.h - Master public include file used to interface to ACPICA
4 * 4 *
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
@@ -45,25 +45,22 @@
45#define __ACPI_H__ 45#define __ACPI_H__
46 46
47/* 47/*
48 * Common includes for all ACPI driver files 48 * Public include files for use by code that will interface to ACPICA.
49 * We put them here because we don't want to duplicate them 49 *
50 * in the rest of the source code again and again. 50 * Information includes the ACPICA data types, names, exceptions, and
51 * external interface prototypes. Also included are the definitions for
52 * all ACPI tables (FADT, MADT, etc.)
53 *
54 * Note: The order of these include files is important.
51 */ 55 */
52#include "acnames.h" /* Global ACPI names and strings */ 56#include "platform/acenv.h" /* Environment-specific items */
53#include "acconfig.h" /* Configuration constants */ 57#include "acnames.h" /* Common ACPI names and strings */
54#include "platform/acenv.h" /* Target environment specific items */ 58#include "actypes.h" /* ACPICA data types and structures */
55#include "actypes.h" /* Fundamental common data types */ 59#include "acexcep.h" /* ACPICA exceptions */
56#include "acexcep.h" /* ACPI exception codes */
57#include "acmacros.h" /* C macros */
58#include "actbl.h" /* ACPI table definitions */ 60#include "actbl.h" /* ACPI table definitions */
59#include "aclocal.h" /* Internal data types */
60#include "acoutput.h" /* Error output and Debug macros */ 61#include "acoutput.h" /* Error output and Debug macros */
61#include "acpiosxf.h" /* Interfaces to the ACPI-to-OS layer */ 62#include "acrestyp.h" /* Resource Descriptor structs */
63#include "acpiosxf.h" /* OSL interfaces (ACPICA-to-OS) */
62#include "acpixf.h" /* ACPI core subsystem external interfaces */ 64#include "acpixf.h" /* ACPI core subsystem external interfaces */
63#include "acobject.h" /* ACPI internal object */
64#include "acstruct.h" /* Common structures */
65#include "acglobal.h" /* All global variables */
66#include "achware.h" /* Hardware defines and interfaces */
67#include "acutils.h" /* Utility interfaces */
68 65
69#endif /* __ACPI_H__ */ 66#endif /* __ACPI_H__ */
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index b91440ac0d16..a62720a7edc0 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -121,8 +121,11 @@ acpi_os_wait_semaphore(acpi_semaphore handle, u32 units, u16 timeout);
121acpi_status acpi_os_signal_semaphore(acpi_semaphore handle, u32 units); 121acpi_status acpi_os_signal_semaphore(acpi_semaphore handle, u32 units);
122 122
123/* 123/*
124 * Mutex primitives 124 * Mutex primitives. May be configured to use semaphores instead via
125 * ACPI_MUTEX_TYPE (see platform/acenv.h)
125 */ 126 */
127#if (ACPI_MUTEX_TYPE != ACPI_BINARY_SEMAPHORE)
128
126acpi_status acpi_os_create_mutex(acpi_mutex * out_handle); 129acpi_status acpi_os_create_mutex(acpi_mutex * out_handle);
127 130
128void acpi_os_delete_mutex(acpi_mutex handle); 131void acpi_os_delete_mutex(acpi_mutex handle);
@@ -130,13 +133,7 @@ void acpi_os_delete_mutex(acpi_mutex handle);
130acpi_status acpi_os_acquire_mutex(acpi_mutex handle, u16 timeout); 133acpi_status acpi_os_acquire_mutex(acpi_mutex handle, u16 timeout);
131 134
132void acpi_os_release_mutex(acpi_mutex handle); 135void acpi_os_release_mutex(acpi_mutex handle);
133 136#endif
134/* Temporary macros for Mutex* interfaces, map to existing semaphore xfaces */
135
136#define acpi_os_create_mutex(out_handle) acpi_os_create_semaphore (1, 1, out_handle)
137#define acpi_os_delete_mutex(handle) (void) acpi_os_delete_semaphore (handle)
138#define acpi_os_acquire_mutex(handle,time) acpi_os_wait_semaphore (handle, 1, time)
139#define acpi_os_release_mutex(handle) (void) acpi_os_signal_semaphore (handle, 1)
140 137
141/* 138/*
142 * Memory allocation and mapping 139 * Memory allocation and mapping
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 33bc0e3b1954..c8e8cf45830f 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -45,9 +45,32 @@
45#ifndef __ACXFACE_H__ 45#ifndef __ACXFACE_H__
46#define __ACXFACE_H__ 46#define __ACXFACE_H__
47 47
48/* Current ACPICA subsystem version in YYYYMMDD format */
49
50#define ACPI_CA_VERSION 0x20081204
51
48#include "actypes.h" 52#include "actypes.h"
49#include "actbl.h" 53#include "actbl.h"
50 54
55extern u8 acpi_gbl_permanent_mmap;
56
57/*
58 * Globals that are publically available, allowing for
59 * run time configuration
60 */
61extern u32 acpi_dbg_level;
62extern u32 acpi_dbg_layer;
63extern u8 acpi_gbl_enable_interpreter_slack;
64extern u8 acpi_gbl_all_methods_serialized;
65extern u8 acpi_gbl_create_osi_method;
66extern u8 acpi_gbl_leave_wake_gpes_disabled;
67extern acpi_name acpi_gbl_trace_method_name;
68extern u32 acpi_gbl_trace_flags;
69
70extern u32 acpi_current_gpe_count;
71extern struct acpi_table_fadt acpi_gbl_FADT;
72
73extern u32 acpi_rsdt_forced;
51/* 74/*
52 * Global interfaces 75 * Global interfaces
53 */ 76 */
@@ -79,11 +102,6 @@ const char *acpi_format_exception(acpi_status exception);
79 102
80acpi_status acpi_purge_cached_objects(void); 103acpi_status acpi_purge_cached_objects(void);
81 104
82#ifdef ACPI_FUTURE_USAGE
83acpi_status
84acpi_install_initialization_handler(acpi_init_handler handler, u32 function);
85#endif
86
87/* 105/*
88 * ACPI Memory management 106 * ACPI Memory management
89 */ 107 */
@@ -193,9 +211,12 @@ acpi_status acpi_get_id(acpi_handle object, acpi_owner_id * out_type);
193acpi_status acpi_get_parent(acpi_handle object, acpi_handle * out_handle); 211acpi_status acpi_get_parent(acpi_handle object, acpi_handle * out_handle);
194 212
195/* 213/*
196 * Event handler interfaces 214 * Handler interfaces
197 */ 215 */
198acpi_status 216acpi_status
217acpi_install_initialization_handler(acpi_init_handler handler, u32 function);
218
219acpi_status
199acpi_install_fixed_event_handler(u32 acpi_event, 220acpi_install_fixed_event_handler(u32 acpi_event,
200 acpi_event_handler handler, void *context); 221 acpi_event_handler handler, void *context);
201 222
@@ -227,6 +248,10 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
227 u32 gpe_number, 248 u32 gpe_number,
228 u32 type, acpi_event_handler address, void *context); 249 u32 type, acpi_event_handler address, void *context);
229 250
251acpi_status
252acpi_remove_gpe_handler(acpi_handle gpe_device,
253 u32 gpe_number, acpi_event_handler address);
254
230#ifdef ACPI_FUTURE_USAGE 255#ifdef ACPI_FUTURE_USAGE
231acpi_status acpi_install_exception_handler(acpi_exception_handler handler); 256acpi_status acpi_install_exception_handler(acpi_exception_handler handler);
232#endif 257#endif
@@ -238,10 +263,6 @@ acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle);
238 263
239acpi_status acpi_release_global_lock(u32 handle); 264acpi_status acpi_release_global_lock(u32 handle);
240 265
241acpi_status
242acpi_remove_gpe_handler(acpi_handle gpe_device,
243 u32 gpe_number, acpi_event_handler address);
244
245acpi_status acpi_enable_event(u32 event, u32 flags); 266acpi_status acpi_enable_event(u32 event, u32 flags);
246 267
247acpi_status acpi_disable_event(u32 event, u32 flags); 268acpi_status acpi_disable_event(u32 event, u32 flags);
@@ -250,6 +271,9 @@ acpi_status acpi_clear_event(u32 event);
250 271
251acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status); 272acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status);
252 273
274/*
275 * GPE Interfaces
276 */
253acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type); 277acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type);
254 278
255acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number); 279acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number);
@@ -263,6 +287,12 @@ acpi_get_gpe_status(acpi_handle gpe_device,
263 u32 gpe_number, 287 u32 gpe_number,
264 u32 flags, acpi_event_status * event_status); 288 u32 flags, acpi_event_status * event_status);
265 289
290acpi_status acpi_disable_all_gpes(void);
291
292acpi_status acpi_enable_all_runtime_gpes(void);
293
294acpi_status acpi_get_gpe_device(u32 gpe_index, acpi_handle *gpe_device);
295
266acpi_status 296acpi_status
267acpi_install_gpe_block(acpi_handle gpe_device, 297acpi_install_gpe_block(acpi_handle gpe_device,
268 struct acpi_generic_address *gpe_block_address, 298 struct acpi_generic_address *gpe_block_address,
@@ -313,6 +343,8 @@ acpi_resource_to_address64(struct acpi_resource *resource,
313/* 343/*
314 * Hardware (ACPI device) interfaces 344 * Hardware (ACPI device) interfaces
315 */ 345 */
346acpi_status acpi_reset(void);
347
316acpi_status acpi_get_register(u32 register_id, u32 * return_value); 348acpi_status acpi_get_register(u32 register_id, u32 * return_value);
317 349
318acpi_status acpi_get_register_unlocked(u32 register_id, u32 *return_value); 350acpi_status acpi_get_register_unlocked(u32 register_id, u32 *return_value);
@@ -320,12 +352,14 @@ acpi_status acpi_get_register_unlocked(u32 register_id, u32 *return_value);
320acpi_status acpi_set_register(u32 register_id, u32 value); 352acpi_status acpi_set_register(u32 register_id, u32 value);
321 353
322acpi_status 354acpi_status
323acpi_set_firmware_waking_vector(acpi_physical_address physical_address); 355acpi_set_firmware_waking_vector(u32 physical_address);
324 356
325#ifdef ACPI_FUTURE_USAGE
326acpi_status 357acpi_status
327acpi_get_firmware_waking_vector(acpi_physical_address * physical_address); 358acpi_set_firmware_waking_vector64(u64 physical_address);
328#endif 359
360acpi_status acpi_read(u32 *value, struct acpi_generic_address *reg);
361
362acpi_status acpi_write(u32 value, struct acpi_generic_address *reg);
329 363
330acpi_status 364acpi_status
331acpi_get_sleep_type_data(u8 sleep_state, u8 * slp_typ_a, u8 * slp_typ_b); 365acpi_get_sleep_type_data(u8 sleep_state, u8 * slp_typ_a, u8 * slp_typ_b);
@@ -340,4 +374,42 @@ acpi_status acpi_leave_sleep_state_prep(u8 sleep_state);
340 374
341acpi_status acpi_leave_sleep_state(u8 sleep_state); 375acpi_status acpi_leave_sleep_state(u8 sleep_state);
342 376
377/*
378 * Debug output
379 */
380void ACPI_INTERNAL_VAR_XFACE
381acpi_error(const char *module_name,
382 u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3);
383
384void ACPI_INTERNAL_VAR_XFACE
385acpi_exception(const char *module_name,
386 u32 line_number,
387 acpi_status status, const char *format, ...) ACPI_PRINTF_LIKE(4);
388
389void ACPI_INTERNAL_VAR_XFACE
390acpi_warning(const char *module_name,
391 u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3);
392
393void ACPI_INTERNAL_VAR_XFACE
394acpi_info(const char *module_name,
395 u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3);
396
397#ifdef ACPI_DEBUG_OUTPUT
398
399void ACPI_INTERNAL_VAR_XFACE
400acpi_debug_print(u32 requested_debug_level,
401 u32 line_number,
402 const char *function_name,
403 const char *module_name,
404 u32 component_id, const char *format, ...) ACPI_PRINTF_LIKE(6);
405
406void ACPI_INTERNAL_VAR_XFACE
407acpi_debug_print_raw(u32 requested_debug_level,
408 u32 line_number,
409 const char *function_name,
410 const char *module_name,
411 u32 component_id,
412 const char *format, ...) ACPI_PRINTF_LIKE(6);
413#endif
414
343#endif /* __ACXFACE_H__ */ 415#endif /* __ACXFACE_H__ */
diff --git a/include/acpi/acpredef.h b/include/acpi/acpredef.h
deleted file mode 100644
index 16a9ca9a66e4..000000000000
--- a/include/acpi/acpredef.h
+++ /dev/null
@@ -1,371 +0,0 @@
1/******************************************************************************
2 *
3 * Name: acpredef - Information table for ACPI predefined methods and objects
4 * $Revision: 1.1 $
5 *
6 *****************************************************************************/
7
8/*
9 * Copyright (C) 2000 - 2008, Intel Corp.
10 * All rights reserved.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions, and the following disclaimer,
17 * without modification.
18 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19 * substantially similar to the "NO WARRANTY" disclaimer below
20 * ("Disclaimer") and any redistribution must be conditioned upon
21 * including a substantially similar Disclaimer requirement for further
22 * binary redistribution.
23 * 3. Neither the names of the above-listed copyright holders nor the names
24 * of any contributors may be used to endorse or promote products derived
25 * from this software without specific prior written permission.
26 *
27 * Alternatively, this software may be distributed under the terms of the
28 * GNU General Public License ("GPL") version 2 as published by the Free
29 * Software Foundation.
30 *
31 * NO WARRANTY
32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 * POSSIBILITY OF SUCH DAMAGES.
43 */
44
45#ifndef __ACPREDEF_H__
46#define __ACPREDEF_H__
47
48/******************************************************************************
49 *
50 * Return Package types
51 *
52 * 1) PTYPE1 packages do not contain sub-packages.
53 *
54 * ACPI_PTYPE1_FIXED: Fixed length, 1 or 2 object types:
55 * object type
56 * count
57 * object type
58 * count
59 *
60 * ACPI_PTYPE1_VAR: Variable length:
61 * object type (Int/Buf/Ref)
62 *
63 * ACPI_PTYPE1_OPTION: Package has some required and some optional elements:
64 * Used for _PRW
65 *
66 *
67 * 2) PTYPE2 packages contain a variable number of sub-packages. Each of the
68 * different types describe the contents of each of the sub-packages.
69 *
70 * ACPI_PTYPE2: Each subpackage contains 1 or 2 object types:
71 * object type
72 * count
73 * object type
74 * count
75 *
76 * ACPI_PTYPE2_COUNT: Each subpackage has a count as first element:
77 * object type
78 *
79 * ACPI_PTYPE2_PKG_COUNT: Count of subpackages at start, 1 or 2 object types:
80 * object type
81 * count
82 * object type
83 * count
84 *
85 * ACPI_PTYPE2_FIXED: Each subpackage is of fixed length:
86 * Used for _PRT
87 *
88 * ACPI_PTYPE2_MIN: Each subpackage has a variable but minimum length
89 * Used for _HPX
90 *
91 *****************************************************************************/
92
93enum acpi_return_package_types {
94 ACPI_PTYPE1_FIXED = 1,
95 ACPI_PTYPE1_VAR = 2,
96 ACPI_PTYPE1_OPTION = 3,
97 ACPI_PTYPE2 = 4,
98 ACPI_PTYPE2_COUNT = 5,
99 ACPI_PTYPE2_PKG_COUNT = 6,
100 ACPI_PTYPE2_FIXED = 7,
101 ACPI_PTYPE2_MIN = 8
102};
103
104/*
105 * Predefined method/object information table.
106 *
107 * These are the names that can actually be evaluated via acpi_evaluate_object.
108 * Not present in this table are the following:
109 *
110 * 1) Predefined/Reserved names that are never evaluated via acpi_evaluate_object:
111 * _Lxx and _Exx GPE methods
112 * _Qxx EC methods
113 * _T_x compiler temporary variables
114 *
115 * 2) Predefined names that never actually exist within the AML code:
116 * Predefined resource descriptor field names
117 *
118 * 3) Predefined names that are implemented within ACPICA:
119 * _OSI
120 *
121 * 4) Some predefined names that are not documented within the ACPI spec.
122 * _WDG, _WED
123 *
124 * The main entries in the table each contain the following items:
125 *
126 * Name - The ACPI reserved name
127 * param_count - Number of arguments to the method
128 * expected_btypes - Allowed type(s) for the return value.
129 * 0 means that no return value is expected.
130 *
131 * For methods that return packages, the next entry in the table contains
132 * information about the expected structure of the package. This information
133 * is saved here (rather than in a separate table) in order to minimize the
134 * overall size of the stored data.
135 */
136static const union acpi_predefined_info predefined_names[] = {
137 {.info = {"_AC0", 0, ACPI_RTYPE_INTEGER}},
138 {.info = {"_AC1", 0, ACPI_RTYPE_INTEGER}},
139 {.info = {"_AC2", 0, ACPI_RTYPE_INTEGER}},
140 {.info = {"_AC3", 0, ACPI_RTYPE_INTEGER}},
141 {.info = {"_AC4", 0, ACPI_RTYPE_INTEGER}},
142 {.info = {"_AC5", 0, ACPI_RTYPE_INTEGER}},
143 {.info = {"_AC6", 0, ACPI_RTYPE_INTEGER}},
144 {.info = {"_AC7", 0, ACPI_RTYPE_INTEGER}},
145 {.info = {"_AC8", 0, ACPI_RTYPE_INTEGER}},
146 {.info = {"_AC9", 0, ACPI_RTYPE_INTEGER}},
147 {.info = {"_ADR", 0, ACPI_RTYPE_INTEGER}},
148 {.info = {"_AL0", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
149 {.info = {"_AL1", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
150 {.info = {"_AL2", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
151 {.info = {"_AL3", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
152 {.info = {"_AL4", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
153 {.info = {"_AL5", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
154 {.info = {"_AL6", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
155 {.info = {"_AL7", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
156 {.info = {"_AL8", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
157 {.info = {"_AL9", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
158 {.info = {"_ALC", 0, ACPI_RTYPE_INTEGER}},
159 {.info = {"_ALI", 0, ACPI_RTYPE_INTEGER}},
160 {.info = {"_ALP", 0, ACPI_RTYPE_INTEGER}},
161 {.info = {"_ALR", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 2, 0, 0, 0}}, /* variable (Pkgs) each 2 (Ints) */
162 {.info = {"_ALT", 0, ACPI_RTYPE_INTEGER}},
163 {.info = {"_BBN", 0, ACPI_RTYPE_INTEGER}},
164 {.info = {"_BCL", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}}, /* variable (Ints) */
165 {.info = {"_BCM", 1, 0}},
166 {.info = {"_BDN", 0, ACPI_RTYPE_INTEGER}},
167 {.info = {"_BFS", 1, 0}},
168 {.info = {"_BIF", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER,
169 9,
170 ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER, 4, 0}}, /* fixed (9 Int),(4 Str) */
171 {.info = {"_BLT", 3, 0}},
172 {.info = {"_BMC", 1, 0}},
173 {.info = {"_BMD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 5, 0, 0, 0}}, /* fixed (5 Int) */
174 {.info = {"_BQC", 0, ACPI_RTYPE_INTEGER}},
175 {.info = {"_BST", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0, 0, 0}}, /* fixed (4 Int) */
176 {.info = {"_BTM", 1, ACPI_RTYPE_INTEGER}},
177 {.info = {"_BTP", 1, 0}},
178 {.info = {"_CBA", 0, ACPI_RTYPE_INTEGER}}, /* see PCI firmware spec 3.0 */
179 {.info = {"_CID", 0,
180 ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_PACKAGE}},
181 {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING, 0, 0, 0, 0}}, /* variable (Ints/Strs) */
182 {.info = {"_CRS", 0, ACPI_RTYPE_BUFFER}},
183 {.info = {"_CRT", 0, ACPI_RTYPE_INTEGER}},
184 {.info = {"_CSD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}}, /* variable (1 Int(n), n-1 Int) */
185 {.info = {"_CST", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_PKG_COUNT,
186 ACPI_RTYPE_BUFFER, 1,
187 ACPI_RTYPE_INTEGER, 3, 0}}, /* variable (1 Int(n), n Pkg (1 Buf/3 Int) */
188 {.info = {"_DCK", 1, ACPI_RTYPE_INTEGER}},
189 {.info = {"_DCS", 0, ACPI_RTYPE_INTEGER}},
190 {.info = {"_DDC", 1, ACPI_RTYPE_INTEGER | ACPI_RTYPE_BUFFER}},
191 {.info = {"_DDN", 0, ACPI_RTYPE_STRING}},
192 {.info = {"_DGS", 0, ACPI_RTYPE_INTEGER}},
193 {.info = {"_DIS", 0, 0}},
194 {.info = {"_DMA", 0, ACPI_RTYPE_BUFFER}},
195 {.info = {"_DOD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}}, /* variable (Ints) */
196 {.info = {"_DOS", 1, 0}},
197 {.info = {"_DSM", 4, ACPI_RTYPE_ALL}}, /* Must return a type, but it can be of any type */
198 {.info = {"_DSS", 1, 0}},
199 {.info = {"_DSW", 3, 0}},
200 {.info = {"_EC_", 0, ACPI_RTYPE_INTEGER}},
201 {.info = {"_EDL", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
202 {.info = {"_EJ0", 1, 0}},
203 {.info = {"_EJ1", 1, 0}},
204 {.info = {"_EJ2", 1, 0}},
205 {.info = {"_EJ3", 1, 0}},
206 {.info = {"_EJ4", 1, 0}},
207 {.info = {"_EJD", 0, ACPI_RTYPE_STRING}},
208 {.info = {"_FDE", 0, ACPI_RTYPE_BUFFER}},
209 {.info = {"_FDI", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16, 0, 0, 0}}, /* fixed (16 Int) */
210 {.info = {"_FDM", 1, 0}},
211 {.info = {"_FIX", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}}, /* variable (Ints) */
212 {.info = {"_GLK", 0, ACPI_RTYPE_INTEGER}},
213 {.info = {"_GPD", 0, ACPI_RTYPE_INTEGER}},
214 {.info = {"_GPE", 0, ACPI_RTYPE_INTEGER}}, /* _GPE method, not _GPE scope */
215 {.info = {"_GSB", 0, ACPI_RTYPE_INTEGER}},
216 {.info = {"_GTF", 0, ACPI_RTYPE_BUFFER}},
217 {.info = {"_GTM", 0, ACPI_RTYPE_BUFFER}},
218 {.info = {"_GTS", 1, 0}},
219 {.info = {"_HID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING}},
220 {.info = {"_HOT", 0, ACPI_RTYPE_INTEGER}},
221 {.info = {"_HPP", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0, 0, 0}}, /* fixed (4 Int) */
222
223 /*
224 * For _HPX, a single package is returned, containing a variable number of sub-packages.
225 * Each sub-package contains a PCI record setting. There are several different type of
226 * record settings, of different lengths, but all elements of all settings are Integers.
227 */
228 {.info = {"_HPX", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_MIN, ACPI_RTYPE_INTEGER, 5, 0, 0, 0}}, /* variable (Pkgs) each (var Ints) */
229 {.info = {"_IFT", 0, ACPI_RTYPE_INTEGER}}, /* see IPMI spec */
230 {.info = {"_INI", 0, 0}},
231 {.info = {"_IRC", 0, 0}},
232 {.info = {"_LCK", 1, 0}},
233 {.info = {"_LID", 0, ACPI_RTYPE_INTEGER}},
234 {.info = {"_MAT", 0, ACPI_RTYPE_BUFFER}},
235 {.info = {"_MLS", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_STRING, 2, 0, 0, 0}}, /* variable (Pkgs) each (2 Str) */
236 {.info = {"_MSG", 1, 0}},
237 {.info = {"_OFF", 0, 0}},
238 {.info = {"_ON_", 0, 0}},
239 {.info = {"_OS_", 0, ACPI_RTYPE_STRING}},
240 {.info = {"_OSC", 4, ACPI_RTYPE_BUFFER}},
241 {.info = {"_OST", 3, 0}},
242 {.info = {"_PCL", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
243 {.info = {"_PCT", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER, 2, 0, 0, 0}}, /* fixed (2 Buf) */
244 {.info = {"_PDC", 1, 0}},
245 {.info = {"_PIC", 1, 0}},
246 {.info = {"_PLD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_BUFFER, 0, 0, 0, 0}}, /* variable (Bufs) */
247 {.info = {"_PPC", 0, ACPI_RTYPE_INTEGER}},
248 {.info = {"_PPE", 0, ACPI_RTYPE_INTEGER}}, /* see dig64 spec */
249 {.info = {"_PR0", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
250 {.info = {"_PR1", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
251 {.info = {"_PR2", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
252 {.info = {"_PRS", 0, ACPI_RTYPE_BUFFER}},
253
254 /*
255 * For _PRT, many BIOSs reverse the 2nd and 3rd Package elements. This bug is so prevalent that there
256 * is code in the ACPICA Resource Manager to detect this and switch them back. For now, do not allow
257 * and issue a warning. To allow this and eliminate the warning, add the ACPI_RTYPE_REFERENCE
258 * type to the 2nd element (index 1) in the statement below.
259 */
260 {.info = {"_PRT", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_FIXED, 4,
261 ACPI_RTYPE_INTEGER,
262 ACPI_RTYPE_INTEGER,
263 ACPI_RTYPE_INTEGER | ACPI_RTYPE_REFERENCE, ACPI_RTYPE_INTEGER}}, /* variable (Pkgs) each (4): Int,Int,Int/Ref,Int */
264
265 {.info = {"_PRW", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_OPTION, 2,
266 ACPI_RTYPE_INTEGER |
267 ACPI_RTYPE_PACKAGE,
268 ACPI_RTYPE_INTEGER, ACPI_RTYPE_REFERENCE, 0}}, /* variable (Pkgs) each: Pkg/Int,Int,[variable Refs] (Pkg is Ref/Int) */
269
270 {.info = {"_PS0", 0, 0}},
271 {.info = {"_PS1", 0, 0}},
272 {.info = {"_PS2", 0, 0}},
273 {.info = {"_PS3", 0, 0}},
274 {.info = {"_PSC", 0, ACPI_RTYPE_INTEGER}},
275 {.info = {"_PSD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}}, /* variable (Pkgs) each (5 Int) with count */
276 {.info = {"_PSL", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
277 {.info = {"_PSR", 0, ACPI_RTYPE_INTEGER}},
278 {.info = {"_PSS", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 6, 0, 0, 0}}, /* variable (Pkgs) each (6 Int) */
279 {.info = {"_PSV", 0, ACPI_RTYPE_INTEGER}},
280 {.info = {"_PSW", 1, 0}},
281 {.info = {"_PTC", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER, 2, 0, 0, 0}}, /* fixed (2 Buf) */
282 {.info = {"_PTS", 1, 0}},
283 {.info = {"_PXM", 0, ACPI_RTYPE_INTEGER}},
284 {.info = {"_REG", 2, 0}},
285 {.info = {"_REV", 0, ACPI_RTYPE_INTEGER}},
286 {.info = {"_RMV", 0, ACPI_RTYPE_INTEGER}},
287 {.info = {"_ROM", 2, ACPI_RTYPE_BUFFER}},
288 {.info = {"_RTV", 0, ACPI_RTYPE_INTEGER}},
289
290 /*
291 * For _S0_ through _S5_, the ACPI spec defines a return Package containing 1 Integer,
292 * but most DSDTs have it wrong - 2,3, or 4 integers. Allow this by making the objects "variable length",
293 * but all elements must be Integers.
294 */
295 {.info = {"_S0_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}}, /* fixed (1 Int) */
296 {.info = {"_S1_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}}, /* fixed (1 Int) */
297 {.info = {"_S2_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}}, /* fixed (1 Int) */
298 {.info = {"_S3_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}}, /* fixed (1 Int) */
299 {.info = {"_S4_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}}, /* fixed (1 Int) */
300 {.info = {"_S5_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}}, /* fixed (1 Int) */
301
302 {.info = {"_S1D", 0, ACPI_RTYPE_INTEGER}},
303 {.info = {"_S2D", 0, ACPI_RTYPE_INTEGER}},
304 {.info = {"_S3D", 0, ACPI_RTYPE_INTEGER}},
305 {.info = {"_S4D", 0, ACPI_RTYPE_INTEGER}},
306 {.info = {"_S0W", 0, ACPI_RTYPE_INTEGER}},
307 {.info = {"_S1W", 0, ACPI_RTYPE_INTEGER}},
308 {.info = {"_S2W", 0, ACPI_RTYPE_INTEGER}},
309 {.info = {"_S3W", 0, ACPI_RTYPE_INTEGER}},
310 {.info = {"_S4W", 0, ACPI_RTYPE_INTEGER}},
311 {.info = {"_SBS", 0, ACPI_RTYPE_INTEGER}},
312 {.info = {"_SCP", 0x13, 0}}, /* Acpi 1.0 allowed 1 arg. Acpi 3.0 expanded to 3 args. Allow both. */
313 /* Note: the 3-arg definition may be removed for ACPI 4.0 */
314 {.info = {"_SDD", 1, 0}},
315 {.info = {"_SEG", 0, ACPI_RTYPE_INTEGER}},
316 {.info = {"_SLI", 0, ACPI_RTYPE_BUFFER}},
317 {.info = {"_SPD", 1, ACPI_RTYPE_INTEGER}},
318 {.info = {"_SRS", 1, 0}},
319 {.info = {"_SRV", 0, ACPI_RTYPE_INTEGER}}, /* see IPMI spec */
320 {.info = {"_SST", 1, 0}},
321 {.info = {"_STA", 0, ACPI_RTYPE_INTEGER}},
322 {.info = {"_STM", 3, 0}},
323 {.info = {"_STR", 0, ACPI_RTYPE_BUFFER}},
324 {.info = {"_SUN", 0, ACPI_RTYPE_INTEGER}},
325 {.info = {"_SWS", 0, ACPI_RTYPE_INTEGER}},
326 {.info = {"_TC1", 0, ACPI_RTYPE_INTEGER}},
327 {.info = {"_TC2", 0, ACPI_RTYPE_INTEGER}},
328 {.info = {"_TMP", 0, ACPI_RTYPE_INTEGER}},
329 {.info = {"_TPC", 0, ACPI_RTYPE_INTEGER}},
330 {.info = {"_TPT", 1, 0}},
331 {.info = {"_TRT", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_REFERENCE, 2,
332 ACPI_RTYPE_INTEGER, 6, 0}}, /* variable (Pkgs) each 2_ref/6_int */
333 {.info = {"_TSD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 5, 0, 0, 0}}, /* variable (Pkgs) each 5_int with count */
334 {.info = {"_TSP", 0, ACPI_RTYPE_INTEGER}},
335 {.info = {"_TSS", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 5, 0, 0, 0}}, /* variable (Pkgs) each 5_int */
336 {.info = {"_TST", 0, ACPI_RTYPE_INTEGER}},
337 {.info = {"_TTS", 1, 0}},
338 {.info = {"_TZD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
339 {.info = {"_TZM", 0, ACPI_RTYPE_REFERENCE}},
340 {.info = {"_TZP", 0, ACPI_RTYPE_INTEGER}},
341 {.info = {"_UID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING}},
342 {.info = {"_UPC", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0, 0, 0}}, /* fixed (4 Int) */
343 {.info = {"_UPD", 0, ACPI_RTYPE_INTEGER}},
344 {.info = {"_UPP", 0, ACPI_RTYPE_INTEGER}},
345 {.info = {"_VPO", 0, ACPI_RTYPE_INTEGER}},
346
347 /* Acpi 1.0 defined _WAK with no return value. Later, it was changed to return a package */
348
349 {.info = {"_WAK", 1, ACPI_RTYPE_NONE | ACPI_RTYPE_INTEGER | ACPI_RTYPE_PACKAGE}},
350 {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2, 0, 0, 0}}, /* fixed (2 Int), but is optional */
351 {.ret_info = {0, 0, 0, 0, 0, 0}} /* Table terminator */
352};
353
354#if 0
355 /* Not implemented */
356
357{
358"_WDG", 0, ACPI_RTYPE_BUFFER}, /* MS Extension */
359
360{
361"_WED", 1, ACPI_RTYPE_PACKAGE}, /* MS Extension */
362
363 /* This is an internally implemented control method, no need to check */
364{
365"_OSI", 1, ACPI_RTYPE_INTEGER},
366
367 /* TBD: */
368 _PRT - currently ignore reversed entries.attempt to fix here ?
369 think about code that attempts to fix package elements like _BIF, etc.
370#endif
371#endif
diff --git a/include/acpi/acresrc.h b/include/acpi/acresrc.h
deleted file mode 100644
index eef5bd7a59fa..000000000000
--- a/include/acpi/acresrc.h
+++ /dev/null
@@ -1,336 +0,0 @@
1/******************************************************************************
2 *
3 * Name: acresrc.h - Resource Manager function prototypes
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACRESRC_H__
45#define __ACRESRC_H__
46
47/* Need the AML resource descriptor structs */
48
49#include "amlresrc.h"
50
51/*
52 * If possible, pack the following structures to byte alignment, since we
53 * don't care about performance for debug output. Two cases where we cannot
54 * pack the structures:
55 *
56 * 1) Hardware does not support misaligned memory transfers
57 * 2) Compiler does not support pointers within packed structures
58 */
59#if (!defined(ACPI_MISALIGNMENT_NOT_SUPPORTED) && !defined(ACPI_PACKED_POINTERS_NOT_SUPPORTED))
60#pragma pack(1)
61#endif
62
63/*
64 * Individual entry for the resource conversion tables
65 */
66typedef const struct acpi_rsconvert_info {
67 u8 opcode;
68 u8 resource_offset;
69 u8 aml_offset;
70 u8 value;
71
72} acpi_rsconvert_info;
73
74/* Resource conversion opcodes */
75
76#define ACPI_RSC_INITGET 0
77#define ACPI_RSC_INITSET 1
78#define ACPI_RSC_FLAGINIT 2
79#define ACPI_RSC_1BITFLAG 3
80#define ACPI_RSC_2BITFLAG 4
81#define ACPI_RSC_COUNT 5
82#define ACPI_RSC_COUNT16 6
83#define ACPI_RSC_LENGTH 7
84#define ACPI_RSC_MOVE8 8
85#define ACPI_RSC_MOVE16 9
86#define ACPI_RSC_MOVE32 10
87#define ACPI_RSC_MOVE64 11
88#define ACPI_RSC_SET8 12
89#define ACPI_RSC_DATA8 13
90#define ACPI_RSC_ADDRESS 14
91#define ACPI_RSC_SOURCE 15
92#define ACPI_RSC_SOURCEX 16
93#define ACPI_RSC_BITMASK 17
94#define ACPI_RSC_BITMASK16 18
95#define ACPI_RSC_EXIT_NE 19
96#define ACPI_RSC_EXIT_LE 20
97#define ACPI_RSC_EXIT_EQ 21
98
99/* Resource Conversion sub-opcodes */
100
101#define ACPI_RSC_COMPARE_AML_LENGTH 0
102#define ACPI_RSC_COMPARE_VALUE 1
103
104#define ACPI_RSC_TABLE_SIZE(d) (sizeof (d) / sizeof (struct acpi_rsconvert_info))
105
106#define ACPI_RS_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_resource,f)
107#define AML_OFFSET(f) (u8) ACPI_OFFSET (union aml_resource,f)
108
109typedef const struct acpi_rsdump_info {
110 u8 opcode;
111 u8 offset;
112 char *name;
113 const char **pointer;
114
115} acpi_rsdump_info;
116
117/* Values for the Opcode field above */
118
119#define ACPI_RSD_TITLE 0
120#define ACPI_RSD_LITERAL 1
121#define ACPI_RSD_STRING 2
122#define ACPI_RSD_UINT8 3
123#define ACPI_RSD_UINT16 4
124#define ACPI_RSD_UINT32 5
125#define ACPI_RSD_UINT64 6
126#define ACPI_RSD_1BITFLAG 7
127#define ACPI_RSD_2BITFLAG 8
128#define ACPI_RSD_SHORTLIST 9
129#define ACPI_RSD_LONGLIST 10
130#define ACPI_RSD_DWORDLIST 11
131#define ACPI_RSD_ADDRESS 12
132#define ACPI_RSD_SOURCE 13
133
134/* restore default alignment */
135
136#pragma pack()
137
138/* Resource tables indexed by internal resource type */
139
140extern const u8 acpi_gbl_aml_resource_sizes[];
141extern struct acpi_rsconvert_info *acpi_gbl_set_resource_dispatch[];
142
143/* Resource tables indexed by raw AML resource descriptor type */
144
145extern const u8 acpi_gbl_resource_struct_sizes[];
146extern struct acpi_rsconvert_info *acpi_gbl_get_resource_dispatch[];
147
148struct acpi_vendor_walk_info {
149 struct acpi_vendor_uuid *uuid;
150 struct acpi_buffer *buffer;
151 acpi_status status;
152};
153
154/*
155 * rscreate
156 */
157acpi_status
158acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer,
159 struct acpi_buffer *output_buffer);
160
161acpi_status
162acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer,
163 struct acpi_buffer *output_buffer);
164
165acpi_status
166acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
167 struct acpi_buffer *output_buffer);
168
169/*
170 * rsutils
171 */
172
173acpi_status
174acpi_rs_get_prt_method_data(struct acpi_namespace_node *node,
175 struct acpi_buffer *ret_buffer);
176
177acpi_status
178acpi_rs_get_crs_method_data(struct acpi_namespace_node *node,
179 struct acpi_buffer *ret_buffer);
180
181acpi_status
182acpi_rs_get_prs_method_data(struct acpi_namespace_node *node,
183 struct acpi_buffer *ret_buffer);
184
185acpi_status
186acpi_rs_get_method_data(acpi_handle handle,
187 char *path, struct acpi_buffer *ret_buffer);
188
189acpi_status
190acpi_rs_set_srs_method_data(struct acpi_namespace_node *node,
191 struct acpi_buffer *ret_buffer);
192
193/*
194 * rscalc
195 */
196acpi_status
197acpi_rs_get_list_length(u8 * aml_buffer,
198 u32 aml_buffer_length, acpi_size * size_needed);
199
200acpi_status
201acpi_rs_get_aml_length(struct acpi_resource *linked_list_buffer,
202 acpi_size * size_needed);
203
204acpi_status
205acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
206 acpi_size * buffer_size_needed);
207
208acpi_status
209acpi_rs_convert_aml_to_resources(u8 * aml,
210 u32 length,
211 u32 offset, u8 resource_index, void **context);
212
213acpi_status
214acpi_rs_convert_resources_to_aml(struct acpi_resource *resource,
215 acpi_size aml_size_needed, u8 * output_buffer);
216
217/*
218 * rsaddr
219 */
220void
221acpi_rs_set_address_common(union aml_resource *aml,
222 struct acpi_resource *resource);
223
224u8
225acpi_rs_get_address_common(struct acpi_resource *resource,
226 union aml_resource *aml);
227
228/*
229 * rsmisc
230 */
231acpi_status
232acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
233 union aml_resource *aml,
234 struct acpi_rsconvert_info *info);
235
236acpi_status
237acpi_rs_convert_resource_to_aml(struct acpi_resource *resource,
238 union aml_resource *aml,
239 struct acpi_rsconvert_info *info);
240
241/*
242 * rsutils
243 */
244void
245acpi_rs_move_data(void *destination,
246 void *source, u16 item_count, u8 move_type);
247
248u8 acpi_rs_decode_bitmask(u16 mask, u8 * list);
249
250u16 acpi_rs_encode_bitmask(u8 * list, u8 count);
251
252acpi_rs_length
253acpi_rs_get_resource_source(acpi_rs_length resource_length,
254 acpi_rs_length minimum_length,
255 struct acpi_resource_source *resource_source,
256 union aml_resource *aml, char *string_ptr);
257
258acpi_rsdesc_size
259acpi_rs_set_resource_source(union aml_resource *aml,
260 acpi_rs_length minimum_length,
261 struct acpi_resource_source *resource_source);
262
263void
264acpi_rs_set_resource_header(u8 descriptor_type,
265 acpi_rsdesc_size total_length,
266 union aml_resource *aml);
267
268void
269acpi_rs_set_resource_length(acpi_rsdesc_size total_length,
270 union aml_resource *aml);
271
272/*
273 * rsdump
274 */
275void acpi_rs_dump_resource_list(struct acpi_resource *resource);
276
277void acpi_rs_dump_irq_list(u8 * route_table);
278
279/*
280 * Resource conversion tables
281 */
282extern struct acpi_rsconvert_info acpi_rs_convert_dma[];
283extern struct acpi_rsconvert_info acpi_rs_convert_end_dpf[];
284extern struct acpi_rsconvert_info acpi_rs_convert_io[];
285extern struct acpi_rsconvert_info acpi_rs_convert_fixed_io[];
286extern struct acpi_rsconvert_info acpi_rs_convert_end_tag[];
287extern struct acpi_rsconvert_info acpi_rs_convert_memory24[];
288extern struct acpi_rsconvert_info acpi_rs_convert_generic_reg[];
289extern struct acpi_rsconvert_info acpi_rs_convert_memory32[];
290extern struct acpi_rsconvert_info acpi_rs_convert_fixed_memory32[];
291extern struct acpi_rsconvert_info acpi_rs_convert_address32[];
292extern struct acpi_rsconvert_info acpi_rs_convert_address16[];
293extern struct acpi_rsconvert_info acpi_rs_convert_ext_irq[];
294extern struct acpi_rsconvert_info acpi_rs_convert_address64[];
295extern struct acpi_rsconvert_info acpi_rs_convert_ext_address64[];
296
297/* These resources require separate get/set tables */
298
299extern struct acpi_rsconvert_info acpi_rs_get_irq[];
300extern struct acpi_rsconvert_info acpi_rs_get_start_dpf[];
301extern struct acpi_rsconvert_info acpi_rs_get_vendor_small[];
302extern struct acpi_rsconvert_info acpi_rs_get_vendor_large[];
303
304extern struct acpi_rsconvert_info acpi_rs_set_irq[];
305extern struct acpi_rsconvert_info acpi_rs_set_start_dpf[];
306extern struct acpi_rsconvert_info acpi_rs_set_vendor[];
307
308#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
309/*
310 * rsinfo
311 */
312extern struct acpi_rsdump_info *acpi_gbl_dump_resource_dispatch[];
313
314/*
315 * rsdump
316 */
317extern struct acpi_rsdump_info acpi_rs_dump_irq[];
318extern struct acpi_rsdump_info acpi_rs_dump_dma[];
319extern struct acpi_rsdump_info acpi_rs_dump_start_dpf[];
320extern struct acpi_rsdump_info acpi_rs_dump_end_dpf[];
321extern struct acpi_rsdump_info acpi_rs_dump_io[];
322extern struct acpi_rsdump_info acpi_rs_dump_fixed_io[];
323extern struct acpi_rsdump_info acpi_rs_dump_vendor[];
324extern struct acpi_rsdump_info acpi_rs_dump_end_tag[];
325extern struct acpi_rsdump_info acpi_rs_dump_memory24[];
326extern struct acpi_rsdump_info acpi_rs_dump_memory32[];
327extern struct acpi_rsdump_info acpi_rs_dump_fixed_memory32[];
328extern struct acpi_rsdump_info acpi_rs_dump_address16[];
329extern struct acpi_rsdump_info acpi_rs_dump_address32[];
330extern struct acpi_rsdump_info acpi_rs_dump_address64[];
331extern struct acpi_rsdump_info acpi_rs_dump_ext_address64[];
332extern struct acpi_rsdump_info acpi_rs_dump_ext_irq[];
333extern struct acpi_rsdump_info acpi_rs_dump_generic_reg[];
334#endif
335
336#endif /* __ACRESRC_H__ */
diff --git a/include/acpi/acrestyp.h b/include/acpi/acrestyp.h
new file mode 100644
index 000000000000..9ffe00feada6
--- /dev/null
+++ b/include/acpi/acrestyp.h
@@ -0,0 +1,405 @@
1/******************************************************************************
2 *
3 * Name: acrestyp.h - Defines, types, and structures for resource descriptors
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACRESTYP_H__
45#define __ACRESTYP_H__
46
47/*
48 * Definitions for Resource Attributes
49 */
50typedef u16 acpi_rs_length; /* Resource Length field is fixed at 16 bits */
51typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (Length+3) = (64_k-1)+3 */
52
53/*
54 * Memory Attributes
55 */
56#define ACPI_READ_ONLY_MEMORY (u8) 0x00
57#define ACPI_READ_WRITE_MEMORY (u8) 0x01
58
59#define ACPI_NON_CACHEABLE_MEMORY (u8) 0x00
60#define ACPI_CACHABLE_MEMORY (u8) 0x01
61#define ACPI_WRITE_COMBINING_MEMORY (u8) 0x02
62#define ACPI_PREFETCHABLE_MEMORY (u8) 0x03
63
64/*
65 * IO Attributes
66 * The ISA IO ranges are: n000-n0_fFh, n400-n4_fFh, n800-n8_fFh, n_c00-n_cFFh.
67 * The non-ISA IO ranges are: n100-n3_fFh, n500-n7_fFh, n900-n_bFFh, n_cd0-n_fFFh.
68 */
69#define ACPI_NON_ISA_ONLY_RANGES (u8) 0x01
70#define ACPI_ISA_ONLY_RANGES (u8) 0x02
71#define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES)
72
73/* Type of translation - 1=Sparse, 0=Dense */
74
75#define ACPI_SPARSE_TRANSLATION (u8) 0x01
76
77/*
78 * IO Port Descriptor Decode
79 */
80#define ACPI_DECODE_10 (u8) 0x00 /* 10-bit IO address decode */
81#define ACPI_DECODE_16 (u8) 0x01 /* 16-bit IO address decode */
82
83/*
84 * IRQ Attributes
85 */
86#define ACPI_LEVEL_SENSITIVE (u8) 0x00
87#define ACPI_EDGE_SENSITIVE (u8) 0x01
88
89#define ACPI_ACTIVE_HIGH (u8) 0x00
90#define ACPI_ACTIVE_LOW (u8) 0x01
91
92#define ACPI_EXCLUSIVE (u8) 0x00
93#define ACPI_SHARED (u8) 0x01
94
95/*
96 * DMA Attributes
97 */
98#define ACPI_COMPATIBILITY (u8) 0x00
99#define ACPI_TYPE_A (u8) 0x01
100#define ACPI_TYPE_B (u8) 0x02
101#define ACPI_TYPE_F (u8) 0x03
102
103#define ACPI_NOT_BUS_MASTER (u8) 0x00
104#define ACPI_BUS_MASTER (u8) 0x01
105
106#define ACPI_TRANSFER_8 (u8) 0x00
107#define ACPI_TRANSFER_8_16 (u8) 0x01
108#define ACPI_TRANSFER_16 (u8) 0x02
109
110/*
111 * Start Dependent Functions Priority definitions
112 */
113#define ACPI_GOOD_CONFIGURATION (u8) 0x00
114#define ACPI_ACCEPTABLE_CONFIGURATION (u8) 0x01
115#define ACPI_SUB_OPTIMAL_CONFIGURATION (u8) 0x02
116
117/*
118 * 16, 32 and 64-bit Address Descriptor resource types
119 */
120#define ACPI_MEMORY_RANGE (u8) 0x00
121#define ACPI_IO_RANGE (u8) 0x01
122#define ACPI_BUS_NUMBER_RANGE (u8) 0x02
123
124#define ACPI_ADDRESS_NOT_FIXED (u8) 0x00
125#define ACPI_ADDRESS_FIXED (u8) 0x01
126
127#define ACPI_POS_DECODE (u8) 0x00
128#define ACPI_SUB_DECODE (u8) 0x01
129
130#define ACPI_PRODUCER (u8) 0x00
131#define ACPI_CONSUMER (u8) 0x01
132
133/*
134 * If possible, pack the following structures to byte alignment
135 */
136#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
137#pragma pack(1)
138#endif
139
140/* UUID data structures for use in vendor-defined resource descriptors */
141
142struct acpi_uuid {
143 u8 data[ACPI_UUID_LENGTH];
144};
145
146struct acpi_vendor_uuid {
147 u8 subtype;
148 u8 data[ACPI_UUID_LENGTH];
149};
150
151/*
152 * Structures used to describe device resources
153 */
154struct acpi_resource_irq {
155 u8 descriptor_length;
156 u8 triggering;
157 u8 polarity;
158 u8 sharable;
159 u8 interrupt_count;
160 u8 interrupts[1];
161};
162
163struct acpi_resource_dma {
164 u8 type;
165 u8 bus_master;
166 u8 transfer;
167 u8 channel_count;
168 u8 channels[1];
169};
170
171struct acpi_resource_start_dependent {
172 u8 descriptor_length;
173 u8 compatibility_priority;
174 u8 performance_robustness;
175};
176
177/*
178 * The END_DEPENDENT_FUNCTIONS_RESOURCE struct is not
179 * needed because it has no fields
180 */
181
182struct acpi_resource_io {
183 u8 io_decode;
184 u8 alignment;
185 u8 address_length;
186 u16 minimum;
187 u16 maximum;
188};
189
190struct acpi_resource_fixed_io {
191 u16 address;
192 u8 address_length;
193};
194
195struct acpi_resource_vendor {
196 u16 byte_length;
197 u8 byte_data[1];
198};
199
200/* Vendor resource with UUID info (introduced in ACPI 3.0) */
201
202struct acpi_resource_vendor_typed {
203 u16 byte_length;
204 u8 uuid_subtype;
205 u8 uuid[ACPI_UUID_LENGTH];
206 u8 byte_data[1];
207};
208
209struct acpi_resource_end_tag {
210 u8 checksum;
211};
212
213struct acpi_resource_memory24 {
214 u8 write_protect;
215 u16 minimum;
216 u16 maximum;
217 u16 alignment;
218 u16 address_length;
219};
220
221struct acpi_resource_memory32 {
222 u8 write_protect;
223 u32 minimum;
224 u32 maximum;
225 u32 alignment;
226 u32 address_length;
227};
228
229struct acpi_resource_fixed_memory32 {
230 u8 write_protect;
231 u32 address;
232 u32 address_length;
233};
234
235struct acpi_memory_attribute {
236 u8 write_protect;
237 u8 caching;
238 u8 range_type;
239 u8 translation;
240};
241
242struct acpi_io_attribute {
243 u8 range_type;
244 u8 translation;
245 u8 translation_type;
246 u8 reserved1;
247};
248
249union acpi_resource_attribute {
250 struct acpi_memory_attribute mem;
251 struct acpi_io_attribute io;
252
253 /* Used for the *word_space macros */
254
255 u8 type_specific;
256};
257
258struct acpi_resource_source {
259 u8 index;
260 u16 string_length;
261 char *string_ptr;
262};
263
264/* Fields common to all address descriptors, 16/32/64 bit */
265
266#define ACPI_RESOURCE_ADDRESS_COMMON \
267 u8 resource_type; \
268 u8 producer_consumer; \
269 u8 decode; \
270 u8 min_address_fixed; \
271 u8 max_address_fixed; \
272 union acpi_resource_attribute info;
273
274struct acpi_resource_address {
275ACPI_RESOURCE_ADDRESS_COMMON};
276
277struct acpi_resource_address16 {
278 ACPI_RESOURCE_ADDRESS_COMMON u16 granularity;
279 u16 minimum;
280 u16 maximum;
281 u16 translation_offset;
282 u16 address_length;
283 struct acpi_resource_source resource_source;
284};
285
286struct acpi_resource_address32 {
287 ACPI_RESOURCE_ADDRESS_COMMON u32 granularity;
288 u32 minimum;
289 u32 maximum;
290 u32 translation_offset;
291 u32 address_length;
292 struct acpi_resource_source resource_source;
293};
294
295struct acpi_resource_address64 {
296 ACPI_RESOURCE_ADDRESS_COMMON u64 granularity;
297 u64 minimum;
298 u64 maximum;
299 u64 translation_offset;
300 u64 address_length;
301 struct acpi_resource_source resource_source;
302};
303
304struct acpi_resource_extended_address64 {
305 ACPI_RESOURCE_ADDRESS_COMMON u8 revision_iD;
306 u64 granularity;
307 u64 minimum;
308 u64 maximum;
309 u64 translation_offset;
310 u64 address_length;
311 u64 type_specific;
312};
313
314struct acpi_resource_extended_irq {
315 u8 producer_consumer;
316 u8 triggering;
317 u8 polarity;
318 u8 sharable;
319 u8 interrupt_count;
320 struct acpi_resource_source resource_source;
321 u32 interrupts[1];
322};
323
324struct acpi_resource_generic_register {
325 u8 space_id;
326 u8 bit_width;
327 u8 bit_offset;
328 u8 access_size;
329 u64 address;
330};
331
332/* ACPI_RESOURCE_TYPEs */
333
334#define ACPI_RESOURCE_TYPE_IRQ 0
335#define ACPI_RESOURCE_TYPE_DMA 1
336#define ACPI_RESOURCE_TYPE_START_DEPENDENT 2
337#define ACPI_RESOURCE_TYPE_END_DEPENDENT 3
338#define ACPI_RESOURCE_TYPE_IO 4
339#define ACPI_RESOURCE_TYPE_FIXED_IO 5
340#define ACPI_RESOURCE_TYPE_VENDOR 6
341#define ACPI_RESOURCE_TYPE_END_TAG 7
342#define ACPI_RESOURCE_TYPE_MEMORY24 8
343#define ACPI_RESOURCE_TYPE_MEMORY32 9
344#define ACPI_RESOURCE_TYPE_FIXED_MEMORY32 10
345#define ACPI_RESOURCE_TYPE_ADDRESS16 11
346#define ACPI_RESOURCE_TYPE_ADDRESS32 12
347#define ACPI_RESOURCE_TYPE_ADDRESS64 13
348#define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 14 /* ACPI 3.0 */
349#define ACPI_RESOURCE_TYPE_EXTENDED_IRQ 15
350#define ACPI_RESOURCE_TYPE_GENERIC_REGISTER 16
351#define ACPI_RESOURCE_TYPE_MAX 16
352
353/* Master union for resource descriptors */
354
355union acpi_resource_data {
356 struct acpi_resource_irq irq;
357 struct acpi_resource_dma dma;
358 struct acpi_resource_start_dependent start_dpf;
359 struct acpi_resource_io io;
360 struct acpi_resource_fixed_io fixed_io;
361 struct acpi_resource_vendor vendor;
362 struct acpi_resource_vendor_typed vendor_typed;
363 struct acpi_resource_end_tag end_tag;
364 struct acpi_resource_memory24 memory24;
365 struct acpi_resource_memory32 memory32;
366 struct acpi_resource_fixed_memory32 fixed_memory32;
367 struct acpi_resource_address16 address16;
368 struct acpi_resource_address32 address32;
369 struct acpi_resource_address64 address64;
370 struct acpi_resource_extended_address64 ext_address64;
371 struct acpi_resource_extended_irq extended_irq;
372 struct acpi_resource_generic_register generic_reg;
373
374 /* Common fields */
375
376 struct acpi_resource_address address; /* Common 16/32/64 address fields */
377};
378
379/* Common resource header */
380
381struct acpi_resource {
382 u32 type;
383 u32 length;
384 union acpi_resource_data data;
385};
386
387/* restore default alignment */
388
389#pragma pack()
390
391#define ACPI_RS_SIZE_NO_DATA 8 /* Id + Length fields */
392#define ACPI_RS_SIZE_MIN (u32) ACPI_ROUND_UP_TO_NATIVE_WORD (12)
393#define ACPI_RS_SIZE(type) (u32) (ACPI_RS_SIZE_NO_DATA + sizeof (type))
394
395#define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length)
396
397struct acpi_pci_routing_table {
398 u32 length;
399 u32 pin;
400 acpi_integer address; /* here for 64-bit alignment */
401 u32 source_index;
402 char source[4]; /* pad to 64 bits so sizeof() works in all cases */
403};
404
405#endif /* __ACRESTYP_H__ */
diff --git a/include/acpi/acstruct.h b/include/acpi/acstruct.h
deleted file mode 100644
index 7980a26bad35..000000000000
--- a/include/acpi/acstruct.h
+++ /dev/null
@@ -1,228 +0,0 @@
1/******************************************************************************
2 *
3 * Name: acstruct.h - Internal structs
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACSTRUCT_H__
45#define __ACSTRUCT_H__
46
47/* acpisrc:struct_defs -- for acpisrc conversion */
48
49/*****************************************************************************
50 *
51 * Tree walking typedefs and structs
52 *
53 ****************************************************************************/
54
55/*
56 * Walk state - current state of a parse tree walk. Used for both a leisurely
57 * stroll through the tree (for whatever reason), and for control method
58 * execution.
59 */
60#define ACPI_NEXT_OP_DOWNWARD 1
61#define ACPI_NEXT_OP_UPWARD 2
62
63/*
64 * Groups of definitions for walk_type used for different implementations of
65 * walkers (never simultaneously) - flags for interpreter:
66 */
67#define ACPI_WALK_NON_METHOD 0
68#define ACPI_WALK_METHOD 0x01
69#define ACPI_WALK_METHOD_RESTART 0x02
70
71/* Flags for i_aSL compiler only */
72
73#define ACPI_WALK_CONST_REQUIRED 0x10
74#define ACPI_WALK_CONST_OPTIONAL 0x20
75
76struct acpi_walk_state {
77 struct acpi_walk_state *next; /* Next walk_state in list */
78 u8 descriptor_type; /* To differentiate various internal objs */
79 u8 walk_type;
80 u16 opcode; /* Current AML opcode */
81 u8 next_op_info; /* Info about next_op */
82 u8 num_operands; /* Stack pointer for Operands[] array */
83 u8 operand_index; /* Index into operand stack, to be used by acpi_ds_obj_stack_push */
84 acpi_owner_id owner_id; /* Owner of objects created during the walk */
85 u8 last_predicate; /* Result of last predicate */
86 u8 current_result;
87 u8 return_used;
88 u8 scope_depth;
89 u8 pass_number; /* Parse pass during table load */
90 u8 result_size; /* Total elements for the result stack */
91 u8 result_count; /* Current number of occupied elements of result stack */
92 u32 aml_offset;
93 u32 arg_types;
94 u32 method_breakpoint; /* For single stepping */
95 u32 user_breakpoint; /* User AML breakpoint */
96 u32 parse_flags;
97
98 struct acpi_parse_state parser_state; /* Current state of parser */
99 u32 prev_arg_types;
100 u32 arg_count; /* push for fixed or var args */
101
102 struct acpi_namespace_node arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */
103 struct acpi_namespace_node local_variables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */
104 union acpi_operand_object *operands[ACPI_OBJ_NUM_OPERANDS + 1]; /* Operands passed to the interpreter (+1 for NULL terminator) */
105 union acpi_operand_object **params;
106
107 u8 *aml_last_while;
108 union acpi_operand_object **caller_return_desc;
109 union acpi_generic_state *control_state; /* List of control states (nested IFs) */
110 struct acpi_namespace_node *deferred_node; /* Used when executing deferred opcodes */
111 union acpi_operand_object *implicit_return_obj;
112 struct acpi_namespace_node *method_call_node; /* Called method Node */
113 union acpi_parse_object *method_call_op; /* method_call Op if running a method */
114 union acpi_operand_object *method_desc; /* Method descriptor if running a method */
115 struct acpi_namespace_node *method_node; /* Method node if running a method. */
116 union acpi_parse_object *op; /* Current parser op */
117 const struct acpi_opcode_info *op_info; /* Info on current opcode */
118 union acpi_parse_object *origin; /* Start of walk [Obsolete] */
119 union acpi_operand_object *result_obj;
120 union acpi_generic_state *results; /* Stack of accumulated results */
121 union acpi_operand_object *return_desc; /* Return object, if any */
122 union acpi_generic_state *scope_info; /* Stack of nested scopes */
123 union acpi_parse_object *prev_op; /* Last op that was processed */
124 union acpi_parse_object *next_op; /* next op to be processed */
125 struct acpi_thread_state *thread;
126 acpi_parse_downwards descending_callback;
127 acpi_parse_upwards ascending_callback;
128};
129
130/* Info used by acpi_ps_init_objects */
131
132struct acpi_init_walk_info {
133 u16 method_count;
134 u16 device_count;
135 u16 op_region_count;
136 u16 field_count;
137 u16 buffer_count;
138 u16 package_count;
139 u16 op_region_init;
140 u16 field_init;
141 u16 buffer_init;
142 u16 package_init;
143 u16 object_count;
144 acpi_owner_id owner_id;
145 u32 table_index;
146};
147
148struct acpi_get_devices_info {
149 acpi_walk_callback user_function;
150 void *context;
151 const char *hid;
152};
153
154union acpi_aml_operands {
155 union acpi_operand_object *operands[7];
156
157 struct {
158 struct acpi_object_integer *type;
159 struct acpi_object_integer *code;
160 struct acpi_object_integer *argument;
161
162 } fatal;
163
164 struct {
165 union acpi_operand_object *source;
166 struct acpi_object_integer *index;
167 union acpi_operand_object *target;
168
169 } index;
170
171 struct {
172 union acpi_operand_object *source;
173 struct acpi_object_integer *index;
174 struct acpi_object_integer *length;
175 union acpi_operand_object *target;
176
177 } mid;
178};
179
180/*
181 * Structure used to pass object evaluation parameters.
182 * Purpose is to reduce CPU stack use.
183 */
184struct acpi_evaluate_info {
185 struct acpi_namespace_node *prefix_node;
186 char *pathname;
187 union acpi_operand_object *obj_desc;
188 union acpi_operand_object **parameters;
189 struct acpi_namespace_node *resolved_node;
190 union acpi_operand_object *return_object;
191 u8 param_count;
192 u8 pass_number;
193 u8 return_object_type;
194 u8 flags;
195};
196
197/* Values for Flags above */
198
199#define ACPI_IGNORE_RETURN_VALUE 1
200
201/* Info used by acpi_ns_initialize_devices */
202
203struct acpi_device_walk_info {
204 u16 device_count;
205 u16 num_STA;
206 u16 num_INI;
207 struct acpi_table_desc *table_desc;
208 struct acpi_evaluate_info *evaluate_info;
209};
210
211/* TBD: [Restructure] Merge with struct above */
212
213struct acpi_walk_info {
214 u32 debug_level;
215 u32 count;
216 acpi_owner_id owner_id;
217 u8 display_type;
218};
219
220/* Display Types */
221
222#define ACPI_DISPLAY_SUMMARY (u8) 0
223#define ACPI_DISPLAY_OBJECTS (u8) 1
224#define ACPI_DISPLAY_MASK (u8) 1
225
226#define ACPI_DISPLAY_SHORT (u8) 2
227
228#endif
diff --git a/include/acpi/actables.h b/include/acpi/actables.h
deleted file mode 100644
index 0cbe1b9ab522..000000000000
--- a/include/acpi/actables.h
+++ /dev/null
@@ -1,115 +0,0 @@
1/******************************************************************************
2 *
3 * Name: actables.h - ACPI table management
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACTABLES_H__
45#define __ACTABLES_H__
46
47acpi_status acpi_allocate_root_table(u32 initial_table_count);
48
49/*
50 * tbfadt - FADT parse/convert/validate
51 */
52void acpi_tb_parse_fadt(u32 table_index, u8 flags);
53
54void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length);
55
56/*
57 * tbfind - find ACPI table
58 */
59acpi_status
60acpi_tb_find_table(char *signature,
61 char *oem_id, char *oem_table_id, u32 *table_index);
62
63/*
64 * tbinstal - Table removal and deletion
65 */
66acpi_status acpi_tb_resize_root_table_list(void);
67
68acpi_status acpi_tb_verify_table(struct acpi_table_desc *table_desc);
69
70acpi_status
71acpi_tb_add_table(struct acpi_table_desc *table_desc, u32 *table_index);
72
73acpi_status
74acpi_tb_store_table(acpi_physical_address address,
75 struct acpi_table_header *table,
76 u32 length, u8 flags, u32 *table_index);
77
78void acpi_tb_delete_table(struct acpi_table_desc *table_desc);
79
80void acpi_tb_terminate(void);
81
82void acpi_tb_delete_namespace_by_owner(u32 table_index);
83
84acpi_status acpi_tb_allocate_owner_id(u32 table_index);
85
86acpi_status acpi_tb_release_owner_id(u32 table_index);
87
88acpi_status acpi_tb_get_owner_id(u32 table_index, acpi_owner_id *owner_id);
89
90u8 acpi_tb_is_table_loaded(u32 table_index);
91
92void acpi_tb_set_table_loaded_flag(u32 table_index, u8 is_loaded);
93
94/*
95 * tbutils - table manager utilities
96 */
97u8 acpi_tb_tables_loaded(void);
98
99void
100acpi_tb_print_table_header(acpi_physical_address address,
101 struct acpi_table_header *header);
102
103u8 acpi_tb_checksum(u8 *buffer, u32 length);
104
105acpi_status
106acpi_tb_verify_checksum(struct acpi_table_header *table, u32 length);
107
108void
109acpi_tb_install_table(acpi_physical_address address,
110 u8 flags, char *signature, u32 table_index);
111
112acpi_status
113acpi_tb_parse_root_table(acpi_physical_address rsdp_address, u8 flags);
114
115#endif /* __ACTABLES_H__ */
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index 13a3d9ad92db..813e4b6c2c0d 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -288,6 +288,31 @@ enum acpi_prefered_pm_profiles {
288 288
289#define ACPI_FADT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_fadt, f) 289#define ACPI_FADT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_fadt, f)
290 290
291union acpi_name_union {
292 u32 integer;
293 char ascii[4];
294};
295
296/*
297 * Internal ACPI Table Descriptor. One per ACPI table
298 */
299struct acpi_table_desc {
300 acpi_physical_address address;
301 struct acpi_table_header *pointer;
302 u32 length; /* Length fixed at 32 bits */
303 union acpi_name_union signature;
304 acpi_owner_id owner_id;
305 u8 flags;
306};
307
308/* Flags for above */
309
310#define ACPI_TABLE_ORIGIN_UNKNOWN (0)
311#define ACPI_TABLE_ORIGIN_MAPPED (1)
312#define ACPI_TABLE_ORIGIN_ALLOCATED (2)
313#define ACPI_TABLE_ORIGIN_MASK (3)
314#define ACPI_TABLE_IS_LOADED (4)
315
291/* 316/*
292 * Get the remaining ACPI tables 317 * Get the remaining ACPI tables
293 */ 318 */
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
index 63f5b4cf4de1..18963b968114 100644
--- a/include/acpi/actbl1.h
+++ b/include/acpi/actbl1.h
@@ -627,7 +627,7 @@ struct acpi_hest_aer_common {
627 u32 uncorrectable_error_mask; 627 u32 uncorrectable_error_mask;
628 u32 uncorrectable_error_severity; 628 u32 uncorrectable_error_severity;
629 u32 correctable_error_mask; 629 u32 correctable_error_mask;
630 u32 advanced_error_cababilities; 630 u32 advanced_error_capabilities;
631}; 631};
632 632
633/* Hardware Error Notification */ 633/* Hardware Error Notification */
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 7220361790b3..a20aab510173 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -204,11 +204,10 @@ typedef u32 acpi_physical_address;
204 204
205/******************************************************************************* 205/*******************************************************************************
206 * 206 *
207 * OS-dependent and compiler-dependent types 207 * OS-dependent types
208 * 208 *
209 * If the defaults below are not appropriate for the host system, they can 209 * If the defaults below are not appropriate for the host system, they can
210 * be defined in the compiler-specific or OS-specific header, and this will 210 * be defined in the OS-specific header, and this will take precedence.
211 * take precedence.
212 * 211 *
213 ******************************************************************************/ 212 ******************************************************************************/
214 213
@@ -218,12 +217,6 @@ typedef u32 acpi_physical_address;
218#define acpi_thread_id acpi_size 217#define acpi_thread_id acpi_size
219#endif 218#endif
220 219
221/* Object returned from acpi_os_create_lock */
222
223#ifndef acpi_spinlock
224#define acpi_spinlock void *
225#endif
226
227/* Flags for acpi_os_acquire_lock/acpi_os_release_lock */ 220/* Flags for acpi_os_acquire_lock/acpi_os_release_lock */
228 221
229#ifndef acpi_cpu_flags 222#ifndef acpi_cpu_flags
@@ -233,9 +226,51 @@ typedef u32 acpi_physical_address;
233/* Object returned from acpi_os_create_cache */ 226/* Object returned from acpi_os_create_cache */
234 227
235#ifndef acpi_cache_t 228#ifndef acpi_cache_t
229#ifdef ACPI_USE_LOCAL_CACHE
236#define acpi_cache_t struct acpi_memory_list 230#define acpi_cache_t struct acpi_memory_list
231#else
232#define acpi_cache_t void *
233#endif
234#endif
235
236/*
237 * Synchronization objects - Mutexes, Semaphores, and spin_locks
238 */
239#if (ACPI_MUTEX_TYPE == ACPI_BINARY_SEMAPHORE)
240/*
241 * These macros are used if the host OS does not support a mutex object.
242 * Map the OSL Mutex interfaces to binary semaphores.
243 */
244#define acpi_mutex acpi_semaphore
245#define acpi_os_create_mutex(out_handle) acpi_os_create_semaphore (1, 1, out_handle)
246#define acpi_os_delete_mutex(handle) (void) acpi_os_delete_semaphore (handle)
247#define acpi_os_acquire_mutex(handle,time) acpi_os_wait_semaphore (handle, 1, time)
248#define acpi_os_release_mutex(handle) (void) acpi_os_signal_semaphore (handle, 1)
249#endif
250
251/* Configurable types for synchronization objects */
252
253#ifndef acpi_spinlock
254#define acpi_spinlock void *
255#endif
256
257#ifndef acpi_semaphore
258#define acpi_semaphore void *
259#endif
260
261#ifndef acpi_mutex
262#define acpi_mutex void *
237#endif 263#endif
238 264
265/*******************************************************************************
266 *
267 * Compiler-dependent types
268 *
269 * If the defaults below are not appropriate for the host compiler, they can
270 * be defined in the compiler-specific header, and this will take precedence.
271 *
272 ******************************************************************************/
273
239/* Use C99 uintptr_t for pointer casting if available, "void *" otherwise */ 274/* Use C99 uintptr_t for pointer casting if available, "void *" otherwise */
240 275
241#ifndef acpi_uintptr_t 276#ifndef acpi_uintptr_t
@@ -268,6 +303,43 @@ typedef u32 acpi_physical_address;
268#define ACPI_EXPORT_SYMBOL(symbol) 303#define ACPI_EXPORT_SYMBOL(symbol)
269#endif 304#endif
270 305
306/******************************************************************************
307 *
308 * ACPI Specification constants (Do not change unless the specification changes)
309 *
310 *****************************************************************************/
311
312/* Number of distinct FADT-based GPE register blocks (GPE0 and GPE1) */
313
314#define ACPI_MAX_GPE_BLOCKS 2
315
316/* Default ACPI register widths */
317
318#define ACPI_GPE_REGISTER_WIDTH 8
319#define ACPI_PM1_REGISTER_WIDTH 16
320#define ACPI_PM2_REGISTER_WIDTH 8
321#define ACPI_PM_TIMER_WIDTH 32
322
323/* Names within the namespace are 4 bytes long */
324
325#define ACPI_NAME_SIZE 4
326#define ACPI_PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 char for separator */
327#define ACPI_PATH_SEPARATOR '.'
328
329/* Sizes for ACPI table headers */
330
331#define ACPI_OEM_ID_SIZE 6
332#define ACPI_OEM_TABLE_ID_SIZE 8
333
334/* ACPI/PNP hardware IDs */
335
336#define PCI_ROOT_HID_STRING "PNP0A03"
337#define PCI_EXPRESS_ROOT_HID_STRING "PNP0A08"
338
339/* PM Timer ticks per second (HZ) */
340
341#define PM_TIMER_FREQUENCY 3579545
342
271/******************************************************************************* 343/*******************************************************************************
272 * 344 *
273 * Independent types 345 * Independent types
@@ -291,13 +363,18 @@ typedef u32 acpi_physical_address;
291#endif 363#endif
292 364
293/* 365/*
294 * Mescellaneous types 366 * Miscellaneous types
295 */ 367 */
296typedef u32 acpi_status; /* All ACPI Exceptions */ 368typedef u32 acpi_status; /* All ACPI Exceptions */
297typedef u32 acpi_name; /* 4-byte ACPI name */ 369typedef u32 acpi_name; /* 4-byte ACPI name */
298typedef char *acpi_string; /* Null terminated ASCII string */ 370typedef char *acpi_string; /* Null terminated ASCII string */
299typedef void *acpi_handle; /* Actually a ptr to a NS Node */ 371typedef void *acpi_handle; /* Actually a ptr to a NS Node */
300 372
373/* Owner IDs are used to track namespace nodes for selective deletion */
374
375typedef u8 acpi_owner_id;
376#define ACPI_OWNER_ID_MAX 0xFF
377
301struct uint64_struct { 378struct uint64_struct {
302 u32 lo; 379 u32 lo;
303 u32 hi; 380 u32 hi;
@@ -313,13 +390,8 @@ struct uint32_struct {
313 u32 hi; 390 u32 hi;
314}; 391};
315 392
316/* Synchronization objects */
317
318#define acpi_mutex void *
319#define acpi_semaphore void *
320
321/* 393/*
322 * Acpi integer width. In ACPI version 1, integers are 32 bits. In ACPI 394 * Acpi integer width. In ACPI version 1, integers are 32 bits. In ACPI
323 * version 2, integers are 64 bits. Note that this pertains to the ACPI integer 395 * version 2, integers are 64 bits. Note that this pertains to the ACPI integer
324 * type only, not other integers used in the implementation of the ACPI CA 396 * type only, not other integers used in the implementation of the ACPI CA
325 * subsystem. 397 * subsystem.
@@ -338,10 +410,75 @@ typedef unsigned long long acpi_integer;
338#define ACPI_MAX16_DECIMAL_DIGITS 5 410#define ACPI_MAX16_DECIMAL_DIGITS 5
339#define ACPI_MAX8_DECIMAL_DIGITS 3 411#define ACPI_MAX8_DECIMAL_DIGITS 3
340 412
413/* PM Timer ticks per second (HZ) */
414
415#define PM_TIMER_FREQUENCY 3579545
416
341/* 417/*
342 * Constants with special meanings 418 * Constants with special meanings
343 */ 419 */
344#define ACPI_ROOT_OBJECT ACPI_ADD_PTR (acpi_handle, NULL, ACPI_MAX_PTR) 420#define ACPI_ROOT_OBJECT ACPI_ADD_PTR (acpi_handle, NULL, ACPI_MAX_PTR)
421#define ACPI_WAIT_FOREVER 0xFFFF /* u16, as per ACPI spec */
422#define ACPI_DO_NOT_WAIT 0
423
424/*******************************************************************************
425 *
426 * Commonly used macros
427 *
428 ******************************************************************************/
429
430/* Data manipulation */
431
432#define ACPI_LOWORD(l) ((u16)(u32)(l))
433#define ACPI_HIWORD(l) ((u16)((((u32)(l)) >> 16) & 0xFFFF))
434#define ACPI_LOBYTE(l) ((u8)(u16)(l))
435#define ACPI_HIBYTE(l) ((u8)((((u16)(l)) >> 8) & 0xFF))
436
437/* Full 64-bit integer must be available on both 32-bit and 64-bit platforms */
438
439struct acpi_integer_overlay {
440 u32 lo_dword;
441 u32 hi_dword;
442};
443
444#define ACPI_LODWORD(integer) (ACPI_CAST_PTR (struct acpi_integer_overlay, &integer)->lo_dword)
445#define ACPI_HIDWORD(integer) (ACPI_CAST_PTR (struct acpi_integer_overlay, &integer)->hi_dword)
446
447#define ACPI_SET_BIT(target,bit) ((target) |= (bit))
448#define ACPI_CLEAR_BIT(target,bit) ((target) &= ~(bit))
449#define ACPI_MIN(a,b) (((a)<(b))?(a):(b))
450#define ACPI_MAX(a,b) (((a)>(b))?(a):(b))
451
452/* Size calculation */
453
454#define ACPI_ARRAY_LENGTH(x) (sizeof(x) / sizeof((x)[0]))
455
456/* Pointer manipulation */
457
458#define ACPI_CAST_PTR(t, p) ((t *) (acpi_uintptr_t) (p))
459#define ACPI_CAST_INDIRECT_PTR(t, p) ((t **) (acpi_uintptr_t) (p))
460#define ACPI_ADD_PTR(t, a, b) ACPI_CAST_PTR (t, (ACPI_CAST_PTR (u8, (a)) + (acpi_size)(b)))
461#define ACPI_PTR_DIFF(a, b) (acpi_size) (ACPI_CAST_PTR (u8, (a)) - ACPI_CAST_PTR (u8, (b)))
462
463/* Pointer/Integer type conversions */
464
465#define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void, (void *) NULL,(acpi_size) i)
466#define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p, (void *) NULL)
467#define ACPI_OFFSET(d, f) (acpi_size) ACPI_PTR_DIFF (&(((d *)0)->f), (void *) NULL)
468#define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i)
469#define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i)
470
471#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
472#define ACPI_COMPARE_NAME(a,b) (*ACPI_CAST_PTR (u32, (a)) == *ACPI_CAST_PTR (u32, (b)))
473#else
474#define ACPI_COMPARE_NAME(a,b) (!ACPI_STRNCMP (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAME_SIZE))
475#endif
476
477/*******************************************************************************
478 *
479 * Miscellaneous constants
480 *
481 ******************************************************************************/
345 482
346/* 483/*
347 * Initialization sequence 484 * Initialization sequence
@@ -414,7 +551,7 @@ typedef unsigned long long acpi_integer;
414#define ACPI_NOTIFY_MAX 0x0B 551#define ACPI_NOTIFY_MAX 0x0B
415 552
416/* 553/*
417 * Types associated with ACPI names and objects. The first group of 554 * Types associated with ACPI names and objects. The first group of
418 * values (up to ACPI_TYPE_EXTERNAL_MAX) correspond to the definition 555 * values (up to ACPI_TYPE_EXTERNAL_MAX) correspond to the definition
419 * of the ACPI object_type() operator (See the ACPI Spec). Therefore, 556 * of the ACPI object_type() operator (See the ACPI Spec). Therefore,
420 * only add to the first group if the spec changes. 557 * only add to the first group if the spec changes.
@@ -467,7 +604,7 @@ typedef u32 acpi_object_type;
467 604
468/* 605/*
469 * These are special object types that never appear in 606 * These are special object types that never appear in
470 * a Namespace node, only in an union acpi_operand_object 607 * a Namespace node, only in a union acpi_operand_object
471 */ 608 */
472#define ACPI_TYPE_LOCAL_EXTRA 0x1C 609#define ACPI_TYPE_LOCAL_EXTRA 0x1C
473#define ACPI_TYPE_LOCAL_DATA 0x1D 610#define ACPI_TYPE_LOCAL_DATA 0x1D
@@ -732,6 +869,15 @@ struct acpi_buffer {
732#define ACPI_NAME_TYPE_MAX 1 869#define ACPI_NAME_TYPE_MAX 1
733 870
734/* 871/*
872 * Predefined Namespace items
873 */
874struct acpi_predefined_names {
875 char *name;
876 u8 type;
877 char *val;
878};
879
880/*
735 * Structure and flags for acpi_get_system_info 881 * Structure and flags for acpi_get_system_info
736 */ 882 */
737#define ACPI_SYS_MODE_UNKNOWN 0x0000 883#define ACPI_SYS_MODE_UNKNOWN 0x0000
@@ -787,7 +933,7 @@ acpi_status(*acpi_exception_handler) (acpi_status aml_status,
787 u16 opcode, 933 u16 opcode,
788 u32 aml_offset, void *context); 934 u32 aml_offset, void *context);
789 935
790/* Table Event handler (Load, load_table etc) and types */ 936/* Table Event handler (Load, load_table, etc.) and types */
791 937
792typedef 938typedef
793acpi_status(*acpi_tbl_handler) (u32 event, void *table, void *context); 939acpi_status(*acpi_tbl_handler) (u32 event, void *table, void *context);
@@ -823,6 +969,12 @@ acpi_status(*acpi_walk_callback) (acpi_handle obj_handle,
823#define ACPI_INTERRUPT_NOT_HANDLED 0x00 969#define ACPI_INTERRUPT_NOT_HANDLED 0x00
824#define ACPI_INTERRUPT_HANDLED 0x01 970#define ACPI_INTERRUPT_HANDLED 0x01
825 971
972/* Length of _HID, _UID, _CID, and UUID values */
973
974#define ACPI_DEVICE_ID_LENGTH 0x09
975#define ACPI_MAX_CID_LENGTH 48
976#define ACPI_UUID_LENGTH 16
977
826/* Common string version of device HIDs and UIDs */ 978/* Common string version of device HIDs and UIDs */
827 979
828struct acpica_device_id { 980struct acpica_device_id {
@@ -900,357 +1052,28 @@ struct acpi_mem_space_context {
900}; 1052};
901 1053
902/* 1054/*
903 * Definitions for Resource Attributes 1055 * struct acpi_memory_list is used only if the ACPICA local cache is enabled
904 */
905typedef u16 acpi_rs_length; /* Resource Length field is fixed at 16 bits */
906typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (Length+3) = (64_k-1)+3 */
907
908/*
909 * Memory Attributes
910 */
911#define ACPI_READ_ONLY_MEMORY (u8) 0x00
912#define ACPI_READ_WRITE_MEMORY (u8) 0x01
913
914#define ACPI_NON_CACHEABLE_MEMORY (u8) 0x00
915#define ACPI_CACHABLE_MEMORY (u8) 0x01
916#define ACPI_WRITE_COMBINING_MEMORY (u8) 0x02
917#define ACPI_PREFETCHABLE_MEMORY (u8) 0x03
918
919/*
920 * IO Attributes
921 * The ISA IO ranges are: n000-n0_fFh, n400-n4_fFh, n800-n8_fFh, n_c00-n_cFFh.
922 * The non-ISA IO ranges are: n100-n3_fFh, n500-n7_fFh, n900-n_bFFh, n_cd0-n_fFFh.
923 */ 1056 */
924#define ACPI_NON_ISA_ONLY_RANGES (u8) 0x01 1057struct acpi_memory_list {
925#define ACPI_ISA_ONLY_RANGES (u8) 0x02 1058 char *list_name;
926#define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES) 1059 void *list_head;
927 1060 u16 object_size;
928/* Type of translation - 1=Sparse, 0=Dense */ 1061 u16 max_depth;
929 1062 u16 current_depth;
930#define ACPI_SPARSE_TRANSLATION (u8) 0x01 1063 u16 link_offset;
931 1064
932/* 1065#ifdef ACPI_DBG_TRACK_ALLOCATIONS
933 * IO Port Descriptor Decode 1066
934 */ 1067 /* Statistics for debug memory tracking only */
935#define ACPI_DECODE_10 (u8) 0x00 /* 10-bit IO address decode */ 1068
936#define ACPI_DECODE_16 (u8) 0x01 /* 16-bit IO address decode */ 1069 u32 total_allocated;
937 1070 u32 total_freed;
938/* 1071 u32 max_occupied;
939 * IRQ Attributes 1072 u32 total_size;
940 */ 1073 u32 current_total_size;
941#define ACPI_LEVEL_SENSITIVE (u8) 0x00 1074 u32 requests;
942#define ACPI_EDGE_SENSITIVE (u8) 0x01 1075 u32 hits;
943
944#define ACPI_ACTIVE_HIGH (u8) 0x00
945#define ACPI_ACTIVE_LOW (u8) 0x01
946
947#define ACPI_EXCLUSIVE (u8) 0x00
948#define ACPI_SHARED (u8) 0x01
949
950/*
951 * DMA Attributes
952 */
953#define ACPI_COMPATIBILITY (u8) 0x00
954#define ACPI_TYPE_A (u8) 0x01
955#define ACPI_TYPE_B (u8) 0x02
956#define ACPI_TYPE_F (u8) 0x03
957
958#define ACPI_NOT_BUS_MASTER (u8) 0x00
959#define ACPI_BUS_MASTER (u8) 0x01
960
961#define ACPI_TRANSFER_8 (u8) 0x00
962#define ACPI_TRANSFER_8_16 (u8) 0x01
963#define ACPI_TRANSFER_16 (u8) 0x02
964
965/*
966 * Start Dependent Functions Priority definitions
967 */
968#define ACPI_GOOD_CONFIGURATION (u8) 0x00
969#define ACPI_ACCEPTABLE_CONFIGURATION (u8) 0x01
970#define ACPI_SUB_OPTIMAL_CONFIGURATION (u8) 0x02
971
972/*
973 * 16, 32 and 64-bit Address Descriptor resource types
974 */
975#define ACPI_MEMORY_RANGE (u8) 0x00
976#define ACPI_IO_RANGE (u8) 0x01
977#define ACPI_BUS_NUMBER_RANGE (u8) 0x02
978
979#define ACPI_ADDRESS_NOT_FIXED (u8) 0x00
980#define ACPI_ADDRESS_FIXED (u8) 0x01
981
982#define ACPI_POS_DECODE (u8) 0x00
983#define ACPI_SUB_DECODE (u8) 0x01
984
985#define ACPI_PRODUCER (u8) 0x00
986#define ACPI_CONSUMER (u8) 0x01
987
988/*
989 * If possible, pack the following structures to byte alignment
990 */
991#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
992#pragma pack(1)
993#endif 1076#endif
994
995/* UUID data structures for use in vendor-defined resource descriptors */
996
997struct acpi_uuid {
998 u8 data[ACPI_UUID_LENGTH];
999};
1000
1001struct acpi_vendor_uuid {
1002 u8 subtype;
1003 u8 data[ACPI_UUID_LENGTH];
1004};
1005
1006/*
1007 * Structures used to describe device resources
1008 */
1009struct acpi_resource_irq {
1010 u8 descriptor_length;
1011 u8 triggering;
1012 u8 polarity;
1013 u8 sharable;
1014 u8 interrupt_count;
1015 u8 interrupts[1];
1016};
1017
1018struct acpi_resource_dma {
1019 u8 type;
1020 u8 bus_master;
1021 u8 transfer;
1022 u8 channel_count;
1023 u8 channels[1];
1024};
1025
1026struct acpi_resource_start_dependent {
1027 u8 descriptor_length;
1028 u8 compatibility_priority;
1029 u8 performance_robustness;
1030};
1031
1032/*
1033 * END_DEPENDENT_FUNCTIONS_RESOURCE struct is not
1034 * needed because it has no fields
1035 */
1036
1037struct acpi_resource_io {
1038 u8 io_decode;
1039 u8 alignment;
1040 u8 address_length;
1041 u16 minimum;
1042 u16 maximum;
1043};
1044
1045struct acpi_resource_fixed_io {
1046 u16 address;
1047 u8 address_length;
1048};
1049
1050struct acpi_resource_vendor {
1051 u16 byte_length;
1052 u8 byte_data[1];
1053};
1054
1055/* Vendor resource with UUID info (introduced in ACPI 3.0) */
1056
1057struct acpi_resource_vendor_typed {
1058 u16 byte_length;
1059 u8 uuid_subtype;
1060 u8 uuid[ACPI_UUID_LENGTH];
1061 u8 byte_data[1];
1062};
1063
1064struct acpi_resource_end_tag {
1065 u8 checksum;
1066};
1067
1068struct acpi_resource_memory24 {
1069 u8 write_protect;
1070 u16 minimum;
1071 u16 maximum;
1072 u16 alignment;
1073 u16 address_length;
1074};
1075
1076struct acpi_resource_memory32 {
1077 u8 write_protect;
1078 u32 minimum;
1079 u32 maximum;
1080 u32 alignment;
1081 u32 address_length;
1082};
1083
1084struct acpi_resource_fixed_memory32 {
1085 u8 write_protect;
1086 u32 address;
1087 u32 address_length;
1088};
1089
1090struct acpi_memory_attribute {
1091 u8 write_protect;
1092 u8 caching;
1093 u8 range_type;
1094 u8 translation;
1095};
1096
1097struct acpi_io_attribute {
1098 u8 range_type;
1099 u8 translation;
1100 u8 translation_type;
1101 u8 reserved1;
1102};
1103
1104union acpi_resource_attribute {
1105 struct acpi_memory_attribute mem;
1106 struct acpi_io_attribute io;
1107
1108 /* Used for the *word_space macros */
1109
1110 u8 type_specific;
1111};
1112
1113struct acpi_resource_source {
1114 u8 index;
1115 u16 string_length;
1116 char *string_ptr;
1117};
1118
1119/* Fields common to all address descriptors, 16/32/64 bit */
1120
1121#define ACPI_RESOURCE_ADDRESS_COMMON \
1122 u8 resource_type; \
1123 u8 producer_consumer; \
1124 u8 decode; \
1125 u8 min_address_fixed; \
1126 u8 max_address_fixed; \
1127 union acpi_resource_attribute info;
1128
1129struct acpi_resource_address {
1130ACPI_RESOURCE_ADDRESS_COMMON};
1131
1132struct acpi_resource_address16 {
1133 ACPI_RESOURCE_ADDRESS_COMMON u16 granularity;
1134 u16 minimum;
1135 u16 maximum;
1136 u16 translation_offset;
1137 u16 address_length;
1138 struct acpi_resource_source resource_source;
1139};
1140
1141struct acpi_resource_address32 {
1142 ACPI_RESOURCE_ADDRESS_COMMON u32 granularity;
1143 u32 minimum;
1144 u32 maximum;
1145 u32 translation_offset;
1146 u32 address_length;
1147 struct acpi_resource_source resource_source;
1148};
1149
1150struct acpi_resource_address64 {
1151 ACPI_RESOURCE_ADDRESS_COMMON u64 granularity;
1152 u64 minimum;
1153 u64 maximum;
1154 u64 translation_offset;
1155 u64 address_length;
1156 struct acpi_resource_source resource_source;
1157};
1158
1159struct acpi_resource_extended_address64 {
1160 ACPI_RESOURCE_ADDRESS_COMMON u8 revision_iD;
1161 u64 granularity;
1162 u64 minimum;
1163 u64 maximum;
1164 u64 translation_offset;
1165 u64 address_length;
1166 u64 type_specific;
1167};
1168
1169struct acpi_resource_extended_irq {
1170 u8 producer_consumer;
1171 u8 triggering;
1172 u8 polarity;
1173 u8 sharable;
1174 u8 interrupt_count;
1175 struct acpi_resource_source resource_source;
1176 u32 interrupts[1];
1177};
1178
1179struct acpi_resource_generic_register {
1180 u8 space_id;
1181 u8 bit_width;
1182 u8 bit_offset;
1183 u8 access_size;
1184 u64 address;
1185};
1186
1187/* ACPI_RESOURCE_TYPEs */
1188
1189#define ACPI_RESOURCE_TYPE_IRQ 0
1190#define ACPI_RESOURCE_TYPE_DMA 1
1191#define ACPI_RESOURCE_TYPE_START_DEPENDENT 2
1192#define ACPI_RESOURCE_TYPE_END_DEPENDENT 3
1193#define ACPI_RESOURCE_TYPE_IO 4
1194#define ACPI_RESOURCE_TYPE_FIXED_IO 5
1195#define ACPI_RESOURCE_TYPE_VENDOR 6
1196#define ACPI_RESOURCE_TYPE_END_TAG 7
1197#define ACPI_RESOURCE_TYPE_MEMORY24 8
1198#define ACPI_RESOURCE_TYPE_MEMORY32 9
1199#define ACPI_RESOURCE_TYPE_FIXED_MEMORY32 10
1200#define ACPI_RESOURCE_TYPE_ADDRESS16 11
1201#define ACPI_RESOURCE_TYPE_ADDRESS32 12
1202#define ACPI_RESOURCE_TYPE_ADDRESS64 13
1203#define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 14 /* ACPI 3.0 */
1204#define ACPI_RESOURCE_TYPE_EXTENDED_IRQ 15
1205#define ACPI_RESOURCE_TYPE_GENERIC_REGISTER 16
1206#define ACPI_RESOURCE_TYPE_MAX 16
1207
1208union acpi_resource_data {
1209 struct acpi_resource_irq irq;
1210 struct acpi_resource_dma dma;
1211 struct acpi_resource_start_dependent start_dpf;
1212 struct acpi_resource_io io;
1213 struct acpi_resource_fixed_io fixed_io;
1214 struct acpi_resource_vendor vendor;
1215 struct acpi_resource_vendor_typed vendor_typed;
1216 struct acpi_resource_end_tag end_tag;
1217 struct acpi_resource_memory24 memory24;
1218 struct acpi_resource_memory32 memory32;
1219 struct acpi_resource_fixed_memory32 fixed_memory32;
1220 struct acpi_resource_address16 address16;
1221 struct acpi_resource_address32 address32;
1222 struct acpi_resource_address64 address64;
1223 struct acpi_resource_extended_address64 ext_address64;
1224 struct acpi_resource_extended_irq extended_irq;
1225 struct acpi_resource_generic_register generic_reg;
1226
1227 /* Common fields */
1228
1229 struct acpi_resource_address address; /* Common 16/32/64 address fields */
1230};
1231
1232struct acpi_resource {
1233 u32 type;
1234 u32 length;
1235 union acpi_resource_data data;
1236};
1237
1238/* restore default alignment */
1239
1240#pragma pack()
1241
1242#define ACPI_RS_SIZE_NO_DATA 8 /* Id + Length fields */
1243#define ACPI_RS_SIZE_MIN (u32) ACPI_ROUND_UP_TO_NATIVE_WORD (12)
1244#define ACPI_RS_SIZE(type) (u32) (ACPI_RS_SIZE_NO_DATA + sizeof (type))
1245
1246#define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length)
1247
1248struct acpi_pci_routing_table {
1249 u32 length;
1250 u32 pin;
1251 acpi_integer address; /* here for 64-bit alignment */
1252 u32 source_index;
1253 char source[4]; /* pad to 64 bits so sizeof() works in all cases */
1254}; 1077};
1255 1078
1256#endif /* __ACTYPES_H__ */ 1079#endif /* __ACTYPES_H__ */
diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h
deleted file mode 100644
index d8307b2987e3..000000000000
--- a/include/acpi/acutils.h
+++ /dev/null
@@ -1,585 +0,0 @@
1/******************************************************************************
2 *
3 * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef _ACUTILS_H
45#define _ACUTILS_H
46
47extern const u8 acpi_gbl_resource_aml_sizes[];
48
49/* Strings used by the disassembler and debugger resource dump routines */
50
51#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER)
52
53extern const char *acpi_gbl_bm_decode[];
54extern const char *acpi_gbl_config_decode[];
55extern const char *acpi_gbl_consume_decode[];
56extern const char *acpi_gbl_dec_decode[];
57extern const char *acpi_gbl_he_decode[];
58extern const char *acpi_gbl_io_decode[];
59extern const char *acpi_gbl_ll_decode[];
60extern const char *acpi_gbl_max_decode[];
61extern const char *acpi_gbl_mem_decode[];
62extern const char *acpi_gbl_min_decode[];
63extern const char *acpi_gbl_mtp_decode[];
64extern const char *acpi_gbl_rng_decode[];
65extern const char *acpi_gbl_rw_decode[];
66extern const char *acpi_gbl_shr_decode[];
67extern const char *acpi_gbl_siz_decode[];
68extern const char *acpi_gbl_trs_decode[];
69extern const char *acpi_gbl_ttp_decode[];
70extern const char *acpi_gbl_typ_decode[];
71#endif
72
73/* Types for Resource descriptor entries */
74
75#define ACPI_INVALID_RESOURCE 0
76#define ACPI_FIXED_LENGTH 1
77#define ACPI_VARIABLE_LENGTH 2
78#define ACPI_SMALL_VARIABLE_LENGTH 3
79
80typedef
81acpi_status(*acpi_walk_aml_callback) (u8 * aml,
82 u32 length,
83 u32 offset,
84 u8 resource_index, void **context);
85
86typedef
87acpi_status(*acpi_pkg_callback) (u8 object_type,
88 union acpi_operand_object * source_object,
89 union acpi_generic_state * state,
90 void *context);
91
92struct acpi_pkg_info {
93 u8 *free_space;
94 acpi_size length;
95 u32 object_space;
96 u32 num_packages;
97};
98
99#define REF_INCREMENT (u16) 0
100#define REF_DECREMENT (u16) 1
101#define REF_FORCE_DELETE (u16) 2
102
103/* acpi_ut_dump_buffer */
104
105#define DB_BYTE_DISPLAY 1
106#define DB_WORD_DISPLAY 2
107#define DB_DWORD_DISPLAY 4
108#define DB_QWORD_DISPLAY 8
109
110/*
111 * utglobal - Global data structures and procedures
112 */
113acpi_status acpi_ut_init_globals(void);
114
115#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
116
117char *acpi_ut_get_mutex_name(u32 mutex_id);
118
119const char *acpi_ut_get_notify_name(u32 notify_value);
120
121#endif
122
123char *acpi_ut_get_type_name(acpi_object_type type);
124
125char *acpi_ut_get_node_name(void *object);
126
127char *acpi_ut_get_descriptor_name(void *object);
128
129const char *acpi_ut_get_reference_name(union acpi_operand_object *object);
130
131char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc);
132
133char *acpi_ut_get_region_name(u8 space_id);
134
135char *acpi_ut_get_event_name(u32 event_id);
136
137char acpi_ut_hex_to_ascii_char(acpi_integer integer, u32 position);
138
139u8 acpi_ut_valid_object_type(acpi_object_type type);
140
141/*
142 * utinit - miscellaneous initialization and shutdown
143 */
144acpi_status acpi_ut_hardware_initialize(void);
145
146void acpi_ut_subsystem_shutdown(void);
147
148/*
149 * utclib - Local implementations of C library functions
150 */
151#ifndef ACPI_USE_SYSTEM_CLIBRARY
152
153acpi_size acpi_ut_strlen(const char *string);
154
155char *acpi_ut_strcpy(char *dst_string, const char *src_string);
156
157char *acpi_ut_strncpy(char *dst_string,
158 const char *src_string, acpi_size count);
159
160int acpi_ut_memcmp(const char *buffer1, const char *buffer2, acpi_size count);
161
162int acpi_ut_strncmp(const char *string1, const char *string2, acpi_size count);
163
164int acpi_ut_strcmp(const char *string1, const char *string2);
165
166char *acpi_ut_strcat(char *dst_string, const char *src_string);
167
168char *acpi_ut_strncat(char *dst_string,
169 const char *src_string, acpi_size count);
170
171u32 acpi_ut_strtoul(const char *string, char **terminator, u32 base);
172
173char *acpi_ut_strstr(char *string1, char *string2);
174
175void *acpi_ut_memcpy(void *dest, const void *src, acpi_size count);
176
177void *acpi_ut_memset(void *dest, u8 value, acpi_size count);
178
179int acpi_ut_to_upper(int c);
180
181int acpi_ut_to_lower(int c);
182
183extern const u8 _acpi_ctype[];
184
185#define _ACPI_XA 0x00 /* extra alphabetic - not supported */
186#define _ACPI_XS 0x40 /* extra space */
187#define _ACPI_BB 0x00 /* BEL, BS, etc. - not supported */
188#define _ACPI_CN 0x20 /* CR, FF, HT, NL, VT */
189#define _ACPI_DI 0x04 /* '0'-'9' */
190#define _ACPI_LO 0x02 /* 'a'-'z' */
191#define _ACPI_PU 0x10 /* punctuation */
192#define _ACPI_SP 0x08 /* space */
193#define _ACPI_UP 0x01 /* 'A'-'Z' */
194#define _ACPI_XD 0x80 /* '0'-'9', 'A'-'F', 'a'-'f' */
195
196#define ACPI_IS_DIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI))
197#define ACPI_IS_SPACE(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP))
198#define ACPI_IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD))
199#define ACPI_IS_UPPER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP))
200#define ACPI_IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO))
201#define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_SP | _ACPI_PU))
202#define ACPI_IS_ALPHA(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP))
203
204#endif /* ACPI_USE_SYSTEM_CLIBRARY */
205
206/*
207 * utcopy - Object construction and conversion interfaces
208 */
209acpi_status
210acpi_ut_build_simple_object(union acpi_operand_object *obj,
211 union acpi_object *user_obj,
212 u8 * data_space, u32 * buffer_space_used);
213
214acpi_status
215acpi_ut_build_package_object(union acpi_operand_object *obj,
216 u8 * buffer, u32 * space_used);
217
218acpi_status
219acpi_ut_copy_iobject_to_eobject(union acpi_operand_object *obj,
220 struct acpi_buffer *ret_buffer);
221
222acpi_status
223acpi_ut_copy_eobject_to_iobject(union acpi_object *obj,
224 union acpi_operand_object **internal_obj);
225
226acpi_status
227acpi_ut_copy_isimple_to_isimple(union acpi_operand_object *source_obj,
228 union acpi_operand_object *dest_obj);
229
230acpi_status
231acpi_ut_copy_iobject_to_iobject(union acpi_operand_object *source_desc,
232 union acpi_operand_object **dest_desc,
233 struct acpi_walk_state *walk_state);
234
235/*
236 * utcreate - Object creation
237 */
238acpi_status
239acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action);
240
241/*
242 * utdebug - Debug interfaces
243 */
244void acpi_ut_init_stack_ptr_trace(void);
245
246void acpi_ut_track_stack_ptr(void);
247
248void
249acpi_ut_trace(u32 line_number,
250 const char *function_name,
251 const char *module_name, u32 component_id);
252
253void
254acpi_ut_trace_ptr(u32 line_number,
255 const char *function_name,
256 const char *module_name, u32 component_id, void *pointer);
257
258void
259acpi_ut_trace_u32(u32 line_number,
260 const char *function_name,
261 const char *module_name, u32 component_id, u32 integer);
262
263void
264acpi_ut_trace_str(u32 line_number,
265 const char *function_name,
266 const char *module_name, u32 component_id, char *string);
267
268void
269acpi_ut_exit(u32 line_number,
270 const char *function_name,
271 const char *module_name, u32 component_id);
272
273void
274acpi_ut_status_exit(u32 line_number,
275 const char *function_name,
276 const char *module_name,
277 u32 component_id, acpi_status status);
278
279void
280acpi_ut_value_exit(u32 line_number,
281 const char *function_name,
282 const char *module_name,
283 u32 component_id, acpi_integer value);
284
285void
286acpi_ut_ptr_exit(u32 line_number,
287 const char *function_name,
288 const char *module_name, u32 component_id, u8 *ptr);
289
290void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id);
291
292void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display);
293
294void acpi_ut_report_error(char *module_name, u32 line_number);
295
296void acpi_ut_report_info(char *module_name, u32 line_number);
297
298void acpi_ut_report_warning(char *module_name, u32 line_number);
299
300/* Error and message reporting interfaces */
301
302void ACPI_INTERNAL_VAR_XFACE
303acpi_ut_debug_print(u32 requested_debug_level,
304 u32 line_number,
305 const char *function_name,
306 const char *module_name,
307 u32 component_id,
308 const char *format, ...) ACPI_PRINTF_LIKE(6);
309
310void ACPI_INTERNAL_VAR_XFACE
311acpi_ut_debug_print_raw(u32 requested_debug_level,
312 u32 line_number,
313 const char *function_name,
314 const char *module_name,
315 u32 component_id,
316 const char *format, ...) ACPI_PRINTF_LIKE(6);
317
318void ACPI_INTERNAL_VAR_XFACE
319acpi_ut_error(const char *module_name,
320 u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3);
321
322void ACPI_INTERNAL_VAR_XFACE
323acpi_ut_exception(const char *module_name,
324 u32 line_number,
325 acpi_status status,
326 const char *format, ...) ACPI_PRINTF_LIKE(4);
327
328void ACPI_INTERNAL_VAR_XFACE
329acpi_ut_warning(const char *module_name,
330 u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3);
331
332void ACPI_INTERNAL_VAR_XFACE
333acpi_ut_info(const char *module_name,
334 u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3);
335
336/*
337 * utdelete - Object deletion and reference counts
338 */
339void acpi_ut_add_reference(union acpi_operand_object *object);
340
341void acpi_ut_remove_reference(union acpi_operand_object *object);
342
343void acpi_ut_delete_internal_package_object(union acpi_operand_object *object);
344
345void acpi_ut_delete_internal_simple_object(union acpi_operand_object *object);
346
347void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list);
348
349/*
350 * uteval - object evaluation
351 */
352acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state);
353
354acpi_status
355acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
356 char *path,
357 u32 expected_return_btypes,
358 union acpi_operand_object **return_desc);
359
360acpi_status
361acpi_ut_evaluate_numeric_object(char *object_name,
362 struct acpi_namespace_node *device_node,
363 acpi_integer * address);
364
365acpi_status
366acpi_ut_execute_HID(struct acpi_namespace_node *device_node,
367 struct acpica_device_id *hid);
368
369acpi_status
370acpi_ut_execute_CID(struct acpi_namespace_node *device_node,
371 struct acpi_compatible_id_list **return_cid_list);
372
373acpi_status
374acpi_ut_execute_STA(struct acpi_namespace_node *device_node,
375 u32 * status_flags);
376
377acpi_status
378acpi_ut_execute_UID(struct acpi_namespace_node *device_node,
379 struct acpica_device_id *uid);
380
381acpi_status
382acpi_ut_execute_sxds(struct acpi_namespace_node *device_node, u8 * highest);
383
384/*
385 * utobject - internal object create/delete/cache routines
386 */
387union acpi_operand_object *acpi_ut_create_internal_object_dbg(const char
388 *module_name,
389 u32 line_number,
390 u32 component_id,
391 acpi_object_type
392 type);
393
394void *acpi_ut_allocate_object_desc_dbg(const char *module_name,
395 u32 line_number, u32 component_id);
396
397#define acpi_ut_create_internal_object(t) acpi_ut_create_internal_object_dbg (_acpi_module_name,__LINE__,_COMPONENT,t)
398#define acpi_ut_allocate_object_desc() acpi_ut_allocate_object_desc_dbg (_acpi_module_name,__LINE__,_COMPONENT)
399
400void acpi_ut_delete_object_desc(union acpi_operand_object *object);
401
402u8 acpi_ut_valid_internal_object(void *object);
403
404union acpi_operand_object *acpi_ut_create_package_object(u32 count);
405
406union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size);
407
408union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size);
409
410acpi_status
411acpi_ut_get_object_size(union acpi_operand_object *obj, acpi_size * obj_length);
412
413/*
414 * utstate - Generic state creation/cache routines
415 */
416void
417acpi_ut_push_generic_state(union acpi_generic_state **list_head,
418 union acpi_generic_state *state);
419
420union acpi_generic_state *acpi_ut_pop_generic_state(union acpi_generic_state
421 **list_head);
422
423union acpi_generic_state *acpi_ut_create_generic_state(void);
424
425struct acpi_thread_state *acpi_ut_create_thread_state(void);
426
427union acpi_generic_state *acpi_ut_create_update_state(union acpi_operand_object
428 *object, u16 action);
429
430union acpi_generic_state *acpi_ut_create_pkg_state(void *internal_object,
431 void *external_object,
432 u16 index);
433
434acpi_status
435acpi_ut_create_update_state_and_push(union acpi_operand_object *object,
436 u16 action,
437 union acpi_generic_state **state_list);
438
439#ifdef ACPI_FUTURE_USAGE
440acpi_status
441acpi_ut_create_pkg_state_and_push(void *internal_object,
442 void *external_object,
443 u16 index,
444 union acpi_generic_state **state_list);
445#endif /* ACPI_FUTURE_USAGE */
446
447union acpi_generic_state *acpi_ut_create_control_state(void);
448
449void acpi_ut_delete_generic_state(union acpi_generic_state *state);
450
451/*
452 * utmath
453 */
454acpi_status
455acpi_ut_divide(acpi_integer in_dividend,
456 acpi_integer in_divisor,
457 acpi_integer * out_quotient, acpi_integer * out_remainder);
458
459acpi_status
460acpi_ut_short_divide(acpi_integer in_dividend,
461 u32 divisor,
462 acpi_integer * out_quotient, u32 * out_remainder);
463
464/*
465 * utmisc
466 */
467const char *acpi_ut_validate_exception(acpi_status status);
468
469u8 acpi_ut_is_aml_table(struct acpi_table_header *table);
470
471acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id);
472
473void acpi_ut_release_owner_id(acpi_owner_id * owner_id);
474
475acpi_status
476acpi_ut_walk_package_tree(union acpi_operand_object *source_object,
477 void *target_object,
478 acpi_pkg_callback walk_callback, void *context);
479
480void acpi_ut_strupr(char *src_string);
481
482void acpi_ut_print_string(char *string, u8 max_length);
483
484u8 acpi_ut_valid_acpi_name(u32 name);
485
486acpi_name acpi_ut_repair_name(char *name);
487
488u8 acpi_ut_valid_acpi_char(char character, u32 position);
489
490acpi_status
491acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer);
492
493/* Values for Base above (16=Hex, 10=Decimal) */
494
495#define ACPI_ANY_BASE 0
496
497u32 acpi_ut_dword_byte_swap(u32 value);
498
499void acpi_ut_set_integer_width(u8 revision);
500
501#ifdef ACPI_DEBUG_OUTPUT
502void
503acpi_ut_display_init_pathname(u8 type,
504 struct acpi_namespace_node *obj_handle,
505 char *path);
506#endif
507
508/*
509 * utresrc
510 */
511acpi_status
512acpi_ut_walk_aml_resources(u8 * aml,
513 acpi_size aml_length,
514 acpi_walk_aml_callback user_function,
515 void **context);
516
517acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index);
518
519u32 acpi_ut_get_descriptor_length(void *aml);
520
521u16 acpi_ut_get_resource_length(void *aml);
522
523u8 acpi_ut_get_resource_header_length(void *aml);
524
525u8 acpi_ut_get_resource_type(void *aml);
526
527acpi_status
528acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc,
529 u8 ** end_tag);
530
531/*
532 * utmutex - mutex support
533 */
534acpi_status acpi_ut_mutex_initialize(void);
535
536void acpi_ut_mutex_terminate(void);
537
538acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id);
539
540acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id);
541
542/*
543 * utalloc - memory allocation and object caching
544 */
545acpi_status acpi_ut_create_caches(void);
546
547acpi_status acpi_ut_delete_caches(void);
548
549acpi_status acpi_ut_validate_buffer(struct acpi_buffer *buffer);
550
551acpi_status
552acpi_ut_initialize_buffer(struct acpi_buffer *buffer,
553 acpi_size required_length);
554
555void *acpi_ut_allocate(acpi_size size,
556 u32 component, const char *module, u32 line);
557
558void *acpi_ut_allocate_zeroed(acpi_size size,
559 u32 component, const char *module, u32 line);
560
561#ifdef ACPI_DBG_TRACK_ALLOCATIONS
562void *acpi_ut_allocate_and_track(acpi_size size,
563 u32 component, const char *module, u32 line);
564
565void *acpi_ut_allocate_zeroed_and_track(acpi_size size,
566 u32 component,
567 const char *module, u32 line);
568
569void
570acpi_ut_free_and_track(void *address,
571 u32 component, const char *module, u32 line);
572
573#ifdef ACPI_FUTURE_USAGE
574void acpi_ut_dump_allocation_info(void);
575#endif /* ACPI_FUTURE_USAGE */
576
577void acpi_ut_dump_allocations(u32 component, const char *module);
578
579acpi_status
580acpi_ut_create_list(char *list_name,
581 u16 object_size, struct acpi_memory_list **return_cache);
582
583#endif
584
585#endif /* _ACUTILS_H */
diff --git a/include/acpi/amlcode.h b/include/acpi/amlcode.h
deleted file mode 100644
index ff851c5df698..000000000000
--- a/include/acpi/amlcode.h
+++ /dev/null
@@ -1,494 +0,0 @@
1/******************************************************************************
2 *
3 * Name: amlcode.h - Definitions for AML, as included in "definition blocks"
4 * Declarations and definitions contained herein are derived
5 * directly from the ACPI specification.
6 *
7 *****************************************************************************/
8
9/*
10 * Copyright (C) 2000 - 2008, Intel Corp.
11 * All rights reserved.
12 *
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
15 * are met:
16 * 1. Redistributions of source code must retain the above copyright
17 * notice, this list of conditions, and the following disclaimer,
18 * without modification.
19 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
20 * substantially similar to the "NO WARRANTY" disclaimer below
21 * ("Disclaimer") and any redistribution must be conditioned upon
22 * including a substantially similar Disclaimer requirement for further
23 * binary redistribution.
24 * 3. Neither the names of the above-listed copyright holders nor the names
25 * of any contributors may be used to endorse or promote products derived
26 * from this software without specific prior written permission.
27 *
28 * Alternatively, this software may be distributed under the terms of the
29 * GNU General Public License ("GPL") version 2 as published by the Free
30 * Software Foundation.
31 *
32 * NO WARRANTY
33 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
34 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
35 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
36 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
37 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
38 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
39 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
40 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
41 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
42 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
43 * POSSIBILITY OF SUCH DAMAGES.
44 */
45
46#ifndef __AMLCODE_H__
47#define __AMLCODE_H__
48
49/* primary opcodes */
50
51#define AML_NULL_CHAR (u16) 0x00
52
53#define AML_ZERO_OP (u16) 0x00
54#define AML_ONE_OP (u16) 0x01
55#define AML_UNASSIGNED (u16) 0x02
56#define AML_ALIAS_OP (u16) 0x06
57#define AML_NAME_OP (u16) 0x08
58#define AML_BYTE_OP (u16) 0x0a
59#define AML_WORD_OP (u16) 0x0b
60#define AML_DWORD_OP (u16) 0x0c
61#define AML_STRING_OP (u16) 0x0d
62#define AML_QWORD_OP (u16) 0x0e /* ACPI 2.0 */
63#define AML_SCOPE_OP (u16) 0x10
64#define AML_BUFFER_OP (u16) 0x11
65#define AML_PACKAGE_OP (u16) 0x12
66#define AML_VAR_PACKAGE_OP (u16) 0x13 /* ACPI 2.0 */
67#define AML_METHOD_OP (u16) 0x14
68#define AML_DUAL_NAME_PREFIX (u16) 0x2e
69#define AML_MULTI_NAME_PREFIX_OP (u16) 0x2f
70#define AML_NAME_CHAR_SUBSEQ (u16) 0x30
71#define AML_NAME_CHAR_FIRST (u16) 0x41
72#define AML_EXTENDED_OP_PREFIX (u16) 0x5b
73#define AML_ROOT_PREFIX (u16) 0x5c
74#define AML_PARENT_PREFIX (u16) 0x5e
75#define AML_LOCAL_OP (u16) 0x60
76#define AML_LOCAL0 (u16) 0x60
77#define AML_LOCAL1 (u16) 0x61
78#define AML_LOCAL2 (u16) 0x62
79#define AML_LOCAL3 (u16) 0x63
80#define AML_LOCAL4 (u16) 0x64
81#define AML_LOCAL5 (u16) 0x65
82#define AML_LOCAL6 (u16) 0x66
83#define AML_LOCAL7 (u16) 0x67
84#define AML_ARG_OP (u16) 0x68
85#define AML_ARG0 (u16) 0x68
86#define AML_ARG1 (u16) 0x69
87#define AML_ARG2 (u16) 0x6a
88#define AML_ARG3 (u16) 0x6b
89#define AML_ARG4 (u16) 0x6c
90#define AML_ARG5 (u16) 0x6d
91#define AML_ARG6 (u16) 0x6e
92#define AML_STORE_OP (u16) 0x70
93#define AML_REF_OF_OP (u16) 0x71
94#define AML_ADD_OP (u16) 0x72
95#define AML_CONCAT_OP (u16) 0x73
96#define AML_SUBTRACT_OP (u16) 0x74
97#define AML_INCREMENT_OP (u16) 0x75
98#define AML_DECREMENT_OP (u16) 0x76
99#define AML_MULTIPLY_OP (u16) 0x77
100#define AML_DIVIDE_OP (u16) 0x78
101#define AML_SHIFT_LEFT_OP (u16) 0x79
102#define AML_SHIFT_RIGHT_OP (u16) 0x7a
103#define AML_BIT_AND_OP (u16) 0x7b
104#define AML_BIT_NAND_OP (u16) 0x7c
105#define AML_BIT_OR_OP (u16) 0x7d
106#define AML_BIT_NOR_OP (u16) 0x7e
107#define AML_BIT_XOR_OP (u16) 0x7f
108#define AML_BIT_NOT_OP (u16) 0x80
109#define AML_FIND_SET_LEFT_BIT_OP (u16) 0x81
110#define AML_FIND_SET_RIGHT_BIT_OP (u16) 0x82
111#define AML_DEREF_OF_OP (u16) 0x83
112#define AML_CONCAT_RES_OP (u16) 0x84 /* ACPI 2.0 */
113#define AML_MOD_OP (u16) 0x85 /* ACPI 2.0 */
114#define AML_NOTIFY_OP (u16) 0x86
115#define AML_SIZE_OF_OP (u16) 0x87
116#define AML_INDEX_OP (u16) 0x88
117#define AML_MATCH_OP (u16) 0x89
118#define AML_CREATE_DWORD_FIELD_OP (u16) 0x8a
119#define AML_CREATE_WORD_FIELD_OP (u16) 0x8b
120#define AML_CREATE_BYTE_FIELD_OP (u16) 0x8c
121#define AML_CREATE_BIT_FIELD_OP (u16) 0x8d
122#define AML_TYPE_OP (u16) 0x8e
123#define AML_CREATE_QWORD_FIELD_OP (u16) 0x8f /* ACPI 2.0 */
124#define AML_LAND_OP (u16) 0x90
125#define AML_LOR_OP (u16) 0x91
126#define AML_LNOT_OP (u16) 0x92
127#define AML_LEQUAL_OP (u16) 0x93
128#define AML_LGREATER_OP (u16) 0x94
129#define AML_LLESS_OP (u16) 0x95
130#define AML_TO_BUFFER_OP (u16) 0x96 /* 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 */
133#define AML_TO_INTEGER_OP (u16) 0x99 /* ACPI 2.0 */
134#define AML_TO_STRING_OP (u16) 0x9c /* ACPI 2.0 */
135#define AML_COPY_OP (u16) 0x9d /* ACPI 2.0 */
136#define AML_MID_OP (u16) 0x9e /* ACPI 2.0 */
137#define AML_CONTINUE_OP (u16) 0x9f /* ACPI 2.0 */
138#define AML_IF_OP (u16) 0xa0
139#define AML_ELSE_OP (u16) 0xa1
140#define AML_WHILE_OP (u16) 0xa2
141#define AML_NOOP_OP (u16) 0xa3
142#define AML_RETURN_OP (u16) 0xa4
143#define AML_BREAK_OP (u16) 0xa5
144#define AML_BREAK_POINT_OP (u16) 0xcc
145#define AML_ONES_OP (u16) 0xff
146
147/* prefixed opcodes */
148
149#define AML_EXTENDED_OPCODE (u16) 0x5b00 /* prefix for 2-byte opcodes */
150
151#define AML_MUTEX_OP (u16) 0x5b01
152#define AML_EVENT_OP (u16) 0x5b02
153#define AML_SHIFT_RIGHT_BIT_OP (u16) 0x5b10
154#define AML_SHIFT_LEFT_BIT_OP (u16) 0x5b11
155#define AML_COND_REF_OF_OP (u16) 0x5b12
156#define AML_CREATE_FIELD_OP (u16) 0x5b13
157#define AML_LOAD_TABLE_OP (u16) 0x5b1f /* ACPI 2.0 */
158#define AML_LOAD_OP (u16) 0x5b20
159#define AML_STALL_OP (u16) 0x5b21
160#define AML_SLEEP_OP (u16) 0x5b22
161#define AML_ACQUIRE_OP (u16) 0x5b23
162#define AML_SIGNAL_OP (u16) 0x5b24
163#define AML_WAIT_OP (u16) 0x5b25
164#define AML_RESET_OP (u16) 0x5b26
165#define AML_RELEASE_OP (u16) 0x5b27
166#define AML_FROM_BCD_OP (u16) 0x5b28
167#define AML_TO_BCD_OP (u16) 0x5b29
168#define AML_UNLOAD_OP (u16) 0x5b2a
169#define AML_REVISION_OP (u16) 0x5b30
170#define AML_DEBUG_OP (u16) 0x5b31
171#define AML_FATAL_OP (u16) 0x5b32
172#define AML_TIMER_OP (u16) 0x5b33 /* ACPI 3.0 */
173#define AML_REGION_OP (u16) 0x5b80
174#define AML_FIELD_OP (u16) 0x5b81
175#define AML_DEVICE_OP (u16) 0x5b82
176#define AML_PROCESSOR_OP (u16) 0x5b83
177#define AML_POWER_RES_OP (u16) 0x5b84
178#define AML_THERMAL_ZONE_OP (u16) 0x5b85
179#define AML_INDEX_FIELD_OP (u16) 0x5b86
180#define AML_BANK_FIELD_OP (u16) 0x5b87
181#define AML_DATA_REGION_OP (u16) 0x5b88 /* ACPI 2.0 */
182
183/*
184 * Combination opcodes (actually two one-byte opcodes)
185 * Used by the disassembler and i_aSL compiler
186 */
187#define AML_LGREATEREQUAL_OP (u16) 0x9295
188#define AML_LLESSEQUAL_OP (u16) 0x9294
189#define AML_LNOTEQUAL_OP (u16) 0x9293
190
191/*
192 * Internal opcodes
193 * Use only "Unknown" AML opcodes, don't attempt to use
194 * any valid ACPI ASCII values (A-Z, 0-9, '-')
195 */
196#define AML_INT_NAMEPATH_OP (u16) 0x002d
197#define AML_INT_NAMEDFIELD_OP (u16) 0x0030
198#define AML_INT_RESERVEDFIELD_OP (u16) 0x0031
199#define AML_INT_ACCESSFIELD_OP (u16) 0x0032
200#define AML_INT_BYTELIST_OP (u16) 0x0033
201#define AML_INT_STATICSTRING_OP (u16) 0x0034
202#define AML_INT_METHODCALL_OP (u16) 0x0035
203#define AML_INT_RETURN_VALUE_OP (u16) 0x0036
204#define AML_INT_EVAL_SUBTREE_OP (u16) 0x0037
205
206#define ARG_NONE 0x0
207
208/*
209 * Argument types for the AML Parser
210 * Each field in the arg_types u32 is 5 bits, allowing for a maximum of 6 arguments.
211 * There can be up to 31 unique argument types
212 * Zero is reserved as end-of-list indicator
213 */
214#define ARGP_BYTEDATA 0x01
215#define ARGP_BYTELIST 0x02
216#define ARGP_CHARLIST 0x03
217#define ARGP_DATAOBJ 0x04
218#define ARGP_DATAOBJLIST 0x05
219#define ARGP_DWORDDATA 0x06
220#define ARGP_FIELDLIST 0x07
221#define ARGP_NAME 0x08
222#define ARGP_NAMESTRING 0x09
223#define ARGP_OBJLIST 0x0A
224#define ARGP_PKGLENGTH 0x0B
225#define ARGP_SUPERNAME 0x0C
226#define ARGP_TARGET 0x0D
227#define ARGP_TERMARG 0x0E
228#define ARGP_TERMLIST 0x0F
229#define ARGP_WORDDATA 0x10
230#define ARGP_QWORDDATA 0x11
231#define ARGP_SIMPLENAME 0x12
232
233/*
234 * Resolved argument types for the AML Interpreter
235 * Each field in the arg_types u32 is 5 bits, allowing for a maximum of 6 arguments.
236 * There can be up to 31 unique argument types (0 is end-of-arg-list indicator)
237 *
238 * Note1: These values are completely independent from the ACPI_TYPEs
239 * i.e., ARGI_INTEGER != ACPI_TYPE_INTEGER
240 *
241 * Note2: If and when 5 bits becomes insufficient, it would probably be best
242 * to convert to a 6-byte array of argument types, allowing 8 bits per argument.
243 */
244
245/* Single, simple types */
246
247#define ARGI_ANYTYPE 0x01 /* Don't care */
248#define ARGI_PACKAGE 0x02
249#define ARGI_EVENT 0x03
250#define ARGI_MUTEX 0x04
251#define ARGI_DDBHANDLE 0x05
252
253/* Interchangeable types (via implicit conversion) */
254
255#define ARGI_INTEGER 0x06
256#define ARGI_STRING 0x07
257#define ARGI_BUFFER 0x08
258#define ARGI_BUFFER_OR_STRING 0x09 /* Used by MID op only */
259#define ARGI_COMPUTEDATA 0x0A /* Buffer, String, or Integer */
260
261/* Reference objects */
262
263#define ARGI_INTEGER_REF 0x0B
264#define ARGI_OBJECT_REF 0x0C
265#define ARGI_DEVICE_REF 0x0D
266#define ARGI_REFERENCE 0x0E
267#define ARGI_TARGETREF 0x0F /* Target, subject to implicit conversion */
268#define ARGI_FIXED_TARGET 0x10 /* Target, no implicit conversion */
269#define ARGI_SIMPLE_TARGET 0x11 /* Name, Local, Arg -- no implicit conversion */
270
271/* Multiple/complex types */
272
273#define ARGI_DATAOBJECT 0x12 /* Buffer, String, package or reference to a Node - Used only by size_of operator */
274#define ARGI_COMPLEXOBJ 0x13 /* Buffer, String, or package (Used by INDEX op only) */
275#define ARGI_REF_OR_STRING 0x14 /* Reference or String (Used by DEREFOF op only) */
276#define ARGI_REGION_OR_BUFFER 0x15 /* Used by LOAD op only */
277#define ARGI_DATAREFOBJ 0x16
278
279/* Note: types above can expand to 0x1F maximum */
280
281#define ARGI_INVALID_OPCODE 0xFFFFFFFF
282
283/*
284 * hash offsets
285 */
286#define AML_EXTOP_HASH_OFFSET 22
287#define AML_LNOT_HASH_OFFSET 19
288
289/*
290 * opcode groups and types
291 */
292#define OPGRP_NAMED 0x01
293#define OPGRP_FIELD 0x02
294#define OPGRP_BYTELIST 0x04
295
296/*
297 * Opcode information
298 */
299
300/* Opcode flags */
301
302#define AML_LOGICAL 0x0001
303#define AML_LOGICAL_NUMERIC 0x0002
304#define AML_MATH 0x0004
305#define AML_CREATE 0x0008
306#define AML_FIELD 0x0010
307#define AML_DEFER 0x0020
308#define AML_NAMED 0x0040
309#define AML_NSNODE 0x0080
310#define AML_NSOPCODE 0x0100
311#define AML_NSOBJECT 0x0200
312#define AML_HAS_RETVAL 0x0400
313#define AML_HAS_TARGET 0x0800
314#define AML_HAS_ARGS 0x1000
315#define AML_CONSTANT 0x2000
316#define AML_NO_OPERAND_RESOLVE 0x4000
317
318/* Convenient flag groupings */
319
320#define AML_FLAGS_EXEC_0A_0T_1R AML_HAS_RETVAL
321#define AML_FLAGS_EXEC_1A_0T_0R AML_HAS_ARGS /* Monadic1 */
322#define AML_FLAGS_EXEC_1A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL /* Monadic2 */
323#define AML_FLAGS_EXEC_1A_1T_0R AML_HAS_ARGS | AML_HAS_TARGET
324#define AML_FLAGS_EXEC_1A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* monadic2_r */
325#define AML_FLAGS_EXEC_2A_0T_0R AML_HAS_ARGS /* Dyadic1 */
326#define AML_FLAGS_EXEC_2A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL /* Dyadic2 */
327#define AML_FLAGS_EXEC_2A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* dyadic2_r */
328#define AML_FLAGS_EXEC_2A_2T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL
329#define AML_FLAGS_EXEC_3A_0T_0R AML_HAS_ARGS
330#define AML_FLAGS_EXEC_3A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL
331#define AML_FLAGS_EXEC_6A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL
332
333/*
334 * The opcode Type is used in a dispatch table, do not change
335 * without updating the table.
336 */
337#define AML_TYPE_EXEC_0A_0T_1R 0x00
338#define AML_TYPE_EXEC_1A_0T_0R 0x01 /* Monadic1 */
339#define AML_TYPE_EXEC_1A_0T_1R 0x02 /* Monadic2 */
340#define AML_TYPE_EXEC_1A_1T_0R 0x03
341#define AML_TYPE_EXEC_1A_1T_1R 0x04 /* monadic2_r */
342#define AML_TYPE_EXEC_2A_0T_0R 0x05 /* Dyadic1 */
343#define AML_TYPE_EXEC_2A_0T_1R 0x06 /* Dyadic2 */
344#define AML_TYPE_EXEC_2A_1T_1R 0x07 /* dyadic2_r */
345#define AML_TYPE_EXEC_2A_2T_1R 0x08
346#define AML_TYPE_EXEC_3A_0T_0R 0x09
347#define AML_TYPE_EXEC_3A_1T_1R 0x0A
348#define AML_TYPE_EXEC_6A_0T_1R 0x0B
349/* End of types used in dispatch table */
350
351#define AML_TYPE_LITERAL 0x0B
352#define AML_TYPE_CONSTANT 0x0C
353#define AML_TYPE_METHOD_ARGUMENT 0x0D
354#define AML_TYPE_LOCAL_VARIABLE 0x0E
355#define AML_TYPE_DATA_TERM 0x0F
356
357/* Generic for an op that returns a value */
358
359#define AML_TYPE_METHOD_CALL 0x10
360
361/* Misc */
362
363#define AML_TYPE_CREATE_FIELD 0x11
364#define AML_TYPE_CREATE_OBJECT 0x12
365#define AML_TYPE_CONTROL 0x13
366#define AML_TYPE_NAMED_NO_OBJ 0x14
367#define AML_TYPE_NAMED_FIELD 0x15
368#define AML_TYPE_NAMED_SIMPLE 0x16
369#define AML_TYPE_NAMED_COMPLEX 0x17
370#define AML_TYPE_RETURN 0x18
371
372#define AML_TYPE_UNDEFINED 0x19
373#define AML_TYPE_BOGUS 0x1A
374
375/* AML Package Length encodings */
376
377#define ACPI_AML_PACKAGE_TYPE1 0x40
378#define ACPI_AML_PACKAGE_TYPE2 0x4000
379#define ACPI_AML_PACKAGE_TYPE3 0x400000
380#define ACPI_AML_PACKAGE_TYPE4 0x40000000
381
382/*
383 * Opcode classes
384 */
385#define AML_CLASS_EXECUTE 0x00
386#define AML_CLASS_CREATE 0x01
387#define AML_CLASS_ARGUMENT 0x02
388#define AML_CLASS_NAMED_OBJECT 0x03
389#define AML_CLASS_CONTROL 0x04
390#define AML_CLASS_ASCII 0x05
391#define AML_CLASS_PREFIX 0x06
392#define AML_CLASS_INTERNAL 0x07
393#define AML_CLASS_RETURN_VALUE 0x08
394#define AML_CLASS_METHOD_CALL 0x09
395#define AML_CLASS_UNKNOWN 0x0A
396
397/* Predefined Operation Region space_iDs */
398
399typedef enum {
400 REGION_MEMORY = 0,
401 REGION_IO,
402 REGION_PCI_CONFIG,
403 REGION_EC,
404 REGION_SMBUS,
405 REGION_CMOS,
406 REGION_PCI_BAR,
407 REGION_DATA_TABLE, /* Internal use only */
408 REGION_FIXED_HW = 0x7F
409} AML_REGION_TYPES;
410
411/* Comparison operation codes for match_op operator */
412
413typedef enum {
414 MATCH_MTR = 0,
415 MATCH_MEQ = 1,
416 MATCH_MLE = 2,
417 MATCH_MLT = 3,
418 MATCH_MGE = 4,
419 MATCH_MGT = 5
420} AML_MATCH_OPERATOR;
421
422#define MAX_MATCH_OPERATOR 5
423
424/*
425 * field_flags
426 *
427 * This byte is extracted from the AML and includes three separate
428 * pieces of information about the field:
429 * 1) The field access type
430 * 2) The field update rule
431 * 3) The lock rule for the field
432 *
433 * Bits 00 - 03 : access_type (any_acc, byte_acc, etc.)
434 * 04 : lock_rule (1 == Lock)
435 * 05 - 06 : update_rule
436 */
437#define AML_FIELD_ACCESS_TYPE_MASK 0x0F
438#define AML_FIELD_LOCK_RULE_MASK 0x10
439#define AML_FIELD_UPDATE_RULE_MASK 0x60
440
441/* 1) Field Access Types */
442
443typedef enum {
444 AML_FIELD_ACCESS_ANY = 0x00,
445 AML_FIELD_ACCESS_BYTE = 0x01,
446 AML_FIELD_ACCESS_WORD = 0x02,
447 AML_FIELD_ACCESS_DWORD = 0x03,
448 AML_FIELD_ACCESS_QWORD = 0x04, /* ACPI 2.0 */
449 AML_FIELD_ACCESS_BUFFER = 0x05 /* ACPI 2.0 */
450} AML_ACCESS_TYPE;
451
452/* 2) Field Lock Rules */
453
454typedef enum {
455 AML_FIELD_LOCK_NEVER = 0x00,
456 AML_FIELD_LOCK_ALWAYS = 0x10
457} AML_LOCK_RULE;
458
459/* 3) Field Update Rules */
460
461typedef enum {
462 AML_FIELD_UPDATE_PRESERVE = 0x00,
463 AML_FIELD_UPDATE_WRITE_AS_ONES = 0x20,
464 AML_FIELD_UPDATE_WRITE_AS_ZEROS = 0x40
465} AML_UPDATE_RULE;
466
467/*
468 * Field Access Attributes.
469 * This byte is extracted from the AML via the
470 * access_as keyword
471 */
472typedef enum {
473 AML_FIELD_ATTRIB_SMB_QUICK = 0x02,
474 AML_FIELD_ATTRIB_SMB_SEND_RCV = 0x04,
475 AML_FIELD_ATTRIB_SMB_BYTE = 0x06,
476 AML_FIELD_ATTRIB_SMB_WORD = 0x08,
477 AML_FIELD_ATTRIB_SMB_BLOCK = 0x0A,
478 AML_FIELD_ATTRIB_SMB_WORD_CALL = 0x0C,
479 AML_FIELD_ATTRIB_SMB_BLOCK_CALL = 0x0D
480} AML_ACCESS_ATTRIBUTE;
481
482/* Bit fields in method_flags byte */
483
484#define AML_METHOD_ARG_COUNT 0x07
485#define AML_METHOD_SERIALIZED 0x08
486#define AML_METHOD_SYNCH_LEVEL 0xF0
487
488/* METHOD_FLAGS_ARG_COUNT is not used internally, define additional flags */
489
490#define AML_METHOD_INTERNAL_ONLY 0x01
491#define AML_METHOD_RESERVED1 0x02
492#define AML_METHOD_RESERVED2 0x04
493
494#endif /* __AMLCODE_H__ */
diff --git a/include/acpi/amlresrc.h b/include/acpi/amlresrc.h
deleted file mode 100644
index 7b070e42b7c5..000000000000
--- a/include/acpi/amlresrc.h
+++ /dev/null
@@ -1,311 +0,0 @@
1
2/******************************************************************************
3 *
4 * Module Name: amlresrc.h - AML resource descriptors
5 *
6 *****************************************************************************/
7
8/*
9 * Copyright (C) 2000 - 2008, Intel Corp.
10 * All rights reserved.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions, and the following disclaimer,
17 * without modification.
18 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19 * substantially similar to the "NO WARRANTY" disclaimer below
20 * ("Disclaimer") and any redistribution must be conditioned upon
21 * including a substantially similar Disclaimer requirement for further
22 * binary redistribution.
23 * 3. Neither the names of the above-listed copyright holders nor the names
24 * of any contributors may be used to endorse or promote products derived
25 * from this software without specific prior written permission.
26 *
27 * Alternatively, this software may be distributed under the terms of the
28 * GNU General Public License ("GPL") version 2 as published by the Free
29 * Software Foundation.
30 *
31 * NO WARRANTY
32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 * POSSIBILITY OF SUCH DAMAGES.
43 */
44
45/* acpisrc:struct_defs -- for acpisrc conversion */
46
47#ifndef __AMLRESRC_H
48#define __AMLRESRC_H
49
50/*
51 * Resource descriptor tags, as defined in the ACPI specification.
52 * Used to symbolically reference fields within a descriptor.
53 */
54#define ACPI_RESTAG_ADDRESS "_ADR"
55#define ACPI_RESTAG_ALIGNMENT "_ALN"
56#define ACPI_RESTAG_ADDRESSSPACE "_ASI"
57#define ACPI_RESTAG_ACCESSSIZE "_ASZ"
58#define ACPI_RESTAG_TYPESPECIFICATTRIBUTES "_ATT"
59#define ACPI_RESTAG_BASEADDRESS "_BAS"
60#define ACPI_RESTAG_BUSMASTER "_BM_" /* Master(1), Slave(0) */
61#define ACPI_RESTAG_DECODE "_DEC"
62#define ACPI_RESTAG_DMA "_DMA"
63#define ACPI_RESTAG_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */
64#define ACPI_RESTAG_GRANULARITY "_GRA"
65#define ACPI_RESTAG_INTERRUPT "_INT"
66#define ACPI_RESTAG_INTERRUPTLEVEL "_LL_" /* active_lo(1), active_hi(0) */
67#define ACPI_RESTAG_INTERRUPTSHARE "_SHR" /* Shareable(1), no_share(0) */
68#define ACPI_RESTAG_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */
69#define ACPI_RESTAG_LENGTH "_LEN"
70#define ACPI_RESTAG_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */
71#define ACPI_RESTAG_MEMTYPE "_MEM" /* non_cache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */
72#define ACPI_RESTAG_MAXADDR "_MAX"
73#define ACPI_RESTAG_MINADDR "_MIN"
74#define ACPI_RESTAG_MAXTYPE "_MAF"
75#define ACPI_RESTAG_MINTYPE "_MIF"
76#define ACPI_RESTAG_REGISTERBITOFFSET "_RBO"
77#define ACPI_RESTAG_REGISTERBITWIDTH "_RBW"
78#define ACPI_RESTAG_RANGETYPE "_RNG"
79#define ACPI_RESTAG_READWRITETYPE "_RW_" /* read_only(0), Writeable (1) */
80#define ACPI_RESTAG_TRANSLATION "_TRA"
81#define ACPI_RESTAG_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */
82#define ACPI_RESTAG_TYPE "_TTP" /* Translation(1), Static (0) */
83#define ACPI_RESTAG_XFERTYPE "_SIZ" /* 8(0), 8_and16(1), 16(2) */
84
85/* Default sizes for "small" resource descriptors */
86
87#define ASL_RDESC_IRQ_SIZE 0x02
88#define ASL_RDESC_DMA_SIZE 0x02
89#define ASL_RDESC_ST_DEPEND_SIZE 0x00
90#define ASL_RDESC_END_DEPEND_SIZE 0x00
91#define ASL_RDESC_IO_SIZE 0x07
92#define ASL_RDESC_FIXED_IO_SIZE 0x03
93#define ASL_RDESC_END_TAG_SIZE 0x01
94
95struct asl_resource_node {
96 u32 buffer_length;
97 void *buffer;
98 struct asl_resource_node *next;
99};
100
101/* Macros used to generate AML resource length fields */
102
103#define ACPI_AML_SIZE_LARGE(r) (sizeof (r) - sizeof (struct aml_resource_large_header))
104#define ACPI_AML_SIZE_SMALL(r) (sizeof (r) - sizeof (struct aml_resource_small_header))
105
106/*
107 * Resource descriptors defined in the ACPI specification.
108 *
109 * Packing/alignment must be BYTE because these descriptors
110 * are used to overlay the raw AML byte stream.
111 */
112#pragma pack(1)
113
114/*
115 * SMALL descriptors
116 */
117#define AML_RESOURCE_SMALL_HEADER_COMMON \
118 u8 descriptor_type;
119
120struct aml_resource_small_header {
121AML_RESOURCE_SMALL_HEADER_COMMON};
122
123struct aml_resource_irq {
124 AML_RESOURCE_SMALL_HEADER_COMMON u16 irq_mask;
125 u8 flags;
126};
127
128struct aml_resource_irq_noflags {
129 AML_RESOURCE_SMALL_HEADER_COMMON u16 irq_mask;
130};
131
132struct aml_resource_dma {
133 AML_RESOURCE_SMALL_HEADER_COMMON u8 dma_channel_mask;
134 u8 flags;
135};
136
137struct aml_resource_start_dependent {
138 AML_RESOURCE_SMALL_HEADER_COMMON u8 flags;
139};
140
141struct aml_resource_start_dependent_noprio {
142AML_RESOURCE_SMALL_HEADER_COMMON};
143
144struct aml_resource_end_dependent {
145AML_RESOURCE_SMALL_HEADER_COMMON};
146
147struct aml_resource_io {
148 AML_RESOURCE_SMALL_HEADER_COMMON u8 flags;
149 u16 minimum;
150 u16 maximum;
151 u8 alignment;
152 u8 address_length;
153};
154
155struct aml_resource_fixed_io {
156 AML_RESOURCE_SMALL_HEADER_COMMON u16 address;
157 u8 address_length;
158};
159
160struct aml_resource_vendor_small {
161AML_RESOURCE_SMALL_HEADER_COMMON};
162
163struct aml_resource_end_tag {
164 AML_RESOURCE_SMALL_HEADER_COMMON u8 checksum;
165};
166
167/*
168 * LARGE descriptors
169 */
170#define AML_RESOURCE_LARGE_HEADER_COMMON \
171 u8 descriptor_type;\
172 u16 resource_length;
173
174struct aml_resource_large_header {
175AML_RESOURCE_LARGE_HEADER_COMMON};
176
177struct aml_resource_memory24 {
178 AML_RESOURCE_LARGE_HEADER_COMMON u8 flags;
179 u16 minimum;
180 u16 maximum;
181 u16 alignment;
182 u16 address_length;
183};
184
185struct aml_resource_vendor_large {
186AML_RESOURCE_LARGE_HEADER_COMMON};
187
188struct aml_resource_memory32 {
189 AML_RESOURCE_LARGE_HEADER_COMMON u8 flags;
190 u32 minimum;
191 u32 maximum;
192 u32 alignment;
193 u32 address_length;
194};
195
196struct aml_resource_fixed_memory32 {
197 AML_RESOURCE_LARGE_HEADER_COMMON u8 flags;
198 u32 address;
199 u32 address_length;
200};
201
202#define AML_RESOURCE_ADDRESS_COMMON \
203 u8 resource_type; \
204 u8 flags; \
205 u8 specific_flags;
206
207struct aml_resource_address {
208AML_RESOURCE_LARGE_HEADER_COMMON AML_RESOURCE_ADDRESS_COMMON};
209
210struct aml_resource_extended_address64 {
211 AML_RESOURCE_LARGE_HEADER_COMMON
212 AML_RESOURCE_ADDRESS_COMMON u8 revision_iD;
213 u8 reserved;
214 u64 granularity;
215 u64 minimum;
216 u64 maximum;
217 u64 translation_offset;
218 u64 address_length;
219 u64 type_specific;
220};
221
222#define AML_RESOURCE_EXTENDED_ADDRESS_REVISION 1 /* ACPI 3.0 */
223
224struct aml_resource_address64 {
225 AML_RESOURCE_LARGE_HEADER_COMMON
226 AML_RESOURCE_ADDRESS_COMMON u64 granularity;
227 u64 minimum;
228 u64 maximum;
229 u64 translation_offset;
230 u64 address_length;
231};
232
233struct aml_resource_address32 {
234 AML_RESOURCE_LARGE_HEADER_COMMON
235 AML_RESOURCE_ADDRESS_COMMON u32 granularity;
236 u32 minimum;
237 u32 maximum;
238 u32 translation_offset;
239 u32 address_length;
240};
241
242struct aml_resource_address16 {
243 AML_RESOURCE_LARGE_HEADER_COMMON
244 AML_RESOURCE_ADDRESS_COMMON u16 granularity;
245 u16 minimum;
246 u16 maximum;
247 u16 translation_offset;
248 u16 address_length;
249};
250
251struct aml_resource_extended_irq {
252 AML_RESOURCE_LARGE_HEADER_COMMON u8 flags;
253 u8 interrupt_count;
254 u32 interrupts[1];
255 /* res_source_index, res_source optional fields follow */
256};
257
258struct aml_resource_generic_register {
259 AML_RESOURCE_LARGE_HEADER_COMMON u8 address_space_id;
260 u8 bit_width;
261 u8 bit_offset;
262 u8 access_size; /* ACPI 3.0, was previously Reserved */
263 u64 address;
264};
265
266/* restore default alignment */
267
268#pragma pack()
269
270/* Union of all resource descriptors, so we can allocate the worst case */
271
272union aml_resource {
273 /* Descriptor headers */
274
275 u8 descriptor_type;
276 struct aml_resource_small_header small_header;
277 struct aml_resource_large_header large_header;
278
279 /* Small resource descriptors */
280
281 struct aml_resource_irq irq;
282 struct aml_resource_dma dma;
283 struct aml_resource_start_dependent start_dpf;
284 struct aml_resource_end_dependent end_dpf;
285 struct aml_resource_io io;
286 struct aml_resource_fixed_io fixed_io;
287 struct aml_resource_vendor_small vendor_small;
288 struct aml_resource_end_tag end_tag;
289
290 /* Large resource descriptors */
291
292 struct aml_resource_memory24 memory24;
293 struct aml_resource_generic_register generic_reg;
294 struct aml_resource_vendor_large vendor_large;
295 struct aml_resource_memory32 memory32;
296 struct aml_resource_fixed_memory32 fixed_memory32;
297 struct aml_resource_address16 address16;
298 struct aml_resource_address32 address32;
299 struct aml_resource_address64 address64;
300 struct aml_resource_extended_address64 ext_address64;
301 struct aml_resource_extended_irq extended_irq;
302
303 /* Utility overlays */
304
305 struct aml_resource_address address;
306 u32 dword_item;
307 u16 word_item;
308 u8 byte_item;
309};
310
311#endif
diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h
index fcd2572e428c..e62f10d9a7d8 100644
--- a/include/acpi/platform/acenv.h
+++ b/include/acpi/platform/acenv.h
@@ -44,14 +44,26 @@
44#ifndef __ACENV_H__ 44#ifndef __ACENV_H__
45#define __ACENV_H__ 45#define __ACENV_H__
46 46
47/* 47/* Types for ACPI_MUTEX_TYPE */
48
49#define ACPI_BINARY_SEMAPHORE 0
50#define ACPI_OSL_MUTEX 1
51
52/* Types for DEBUGGER_THREADING */
53
54#define DEBUGGER_SINGLE_THREADED 0
55#define DEBUGGER_MULTI_THREADED 1
56
57/******************************************************************************
58 *
48 * Configuration for ACPI tools and utilities 59 * Configuration for ACPI tools and utilities
49 */ 60 *
61 *****************************************************************************/
50 62
51#ifdef ACPI_LIBRARY 63#ifdef ACPI_LIBRARY
52/* 64/*
53 * Note: The non-debug version of the acpi_library does not contain any 65 * Note: The non-debug version of the acpi_library does not contain any
54 * debug support, for minimimal size. The debug version uses ACPI_FULL_DEBUG 66 * debug support, for minimal size. The debug version uses ACPI_FULL_DEBUG
55 */ 67 */
56#define ACPI_USE_LOCAL_CACHE 68#define ACPI_USE_LOCAL_CACHE
57#endif 69#endif
@@ -75,17 +87,6 @@
75#define ACPI_DBG_TRACK_ALLOCATIONS 87#define ACPI_DBG_TRACK_ALLOCATIONS
76#endif 88#endif
77 89
78#ifdef ACPI_DASM_APP
79#ifndef MSDOS
80#define ACPI_DEBUG_OUTPUT
81#endif
82#define ACPI_APPLICATION
83#define ACPI_DISASSEMBLER
84#define ACPI_NO_METHOD_EXECUTION
85#define ACPI_LARGE_NAMESPACE_NODE
86#define ACPI_DATA_TABLE_DISASSEMBLY
87#endif
88
89#ifdef ACPI_APPLICATION 90#ifdef ACPI_APPLICATION
90#define ACPI_USE_SYSTEM_CLIBRARY 91#define ACPI_USE_SYSTEM_CLIBRARY
91#define ACPI_USE_LOCAL_CACHE 92#define ACPI_USE_LOCAL_CACHE
@@ -179,6 +180,19 @@
179 180
180/*! [End] no source code translation !*/ 181/*! [End] no source code translation !*/
181 182
183/******************************************************************************
184 *
185 * Miscellaneous configuration
186 *
187 *****************************************************************************/
188
189/*
190 * Are mutexes supported by the host? default is no, use binary semaphores.
191 */
192#ifndef ACPI_MUTEX_TYPE
193#define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE
194#endif
195
182/* 196/*
183 * Debugger threading model 197 * Debugger threading model
184 * Use single threaded if the entire subsystem is contained in an application 198 * Use single threaded if the entire subsystem is contained in an application
@@ -187,9 +201,6 @@
187 * By default the model is single threaded if ACPI_APPLICATION is set, 201 * By default the model is single threaded if ACPI_APPLICATION is set,
188 * multi-threaded if ACPI_APPLICATION is not set. 202 * multi-threaded if ACPI_APPLICATION is not set.
189 */ 203 */
190#define DEBUGGER_SINGLE_THREADED 0
191#define DEBUGGER_MULTI_THREADED 1
192
193#ifndef DEBUGGER_THREADING 204#ifndef DEBUGGER_THREADING
194#ifdef ACPI_APPLICATION 205#ifdef ACPI_APPLICATION
195#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED 206#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 0515e754449d..6d49b2a498c4 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -46,6 +46,7 @@
46 46
47#define ACPI_USE_SYSTEM_CLIBRARY 47#define ACPI_USE_SYSTEM_CLIBRARY
48#define ACPI_USE_DO_WHILE_0 48#define ACPI_USE_DO_WHILE_0
49#define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE
49 50
50#ifdef __KERNEL__ 51#ifdef __KERNEL__
51 52
@@ -70,9 +71,6 @@
70#define ACPI_EXPORT_SYMBOL(symbol) EXPORT_SYMBOL(symbol); 71#define ACPI_EXPORT_SYMBOL(symbol) EXPORT_SYMBOL(symbol);
71#define strtoul simple_strtoul 72#define strtoul simple_strtoul
72 73
73/* Full namespace pathname length limit - arbitrary */
74#define ACPI_PATHNAME_MAX 256
75
76#else /* !__KERNEL__ */ 74#else /* !__KERNEL__ */
77 75
78#include <stdarg.h> 76#include <stdarg.h>
diff --git a/include/asm-frv/Kbuild b/include/asm-frv/Kbuild
index 0f8956def738..1f44e7c76995 100644
--- a/include/asm-frv/Kbuild
+++ b/include/asm-frv/Kbuild
@@ -3,3 +3,4 @@ include include/asm-generic/Kbuild.asm
3header-y += registers.h 3header-y += registers.h
4 4
5unifdef-y += termios.h 5unifdef-y += termios.h
6unifdef-y += swab.h
diff --git a/include/asm-frv/atomic.h b/include/asm-frv/atomic.h
index 46d696b331e7..296c35cfb207 100644
--- a/include/asm-frv/atomic.h
+++ b/include/asm-frv/atomic.h
@@ -35,10 +35,6 @@
35#define smp_mb__before_atomic_inc() barrier() 35#define smp_mb__before_atomic_inc() barrier()
36#define smp_mb__after_atomic_inc() barrier() 36#define smp_mb__after_atomic_inc() barrier()
37 37
38typedef struct {
39 int counter;
40} atomic_t;
41
42#define ATOMIC_INIT(i) { (i) } 38#define ATOMIC_INIT(i) { (i) }
43#define atomic_read(v) ((v)->counter) 39#define atomic_read(v) ((v)->counter)
44#define atomic_set(v, i) (((v)->counter) = (i)) 40#define atomic_set(v, i) (((v)->counter) = (i))
diff --git a/include/asm-frv/byteorder.h b/include/asm-frv/byteorder.h
index 411bec3cc1fc..1187e51ecd13 100644
--- a/include/asm-frv/byteorder.h
+++ b/include/asm-frv/byteorder.h
@@ -1,13 +1,7 @@
1#ifndef _ASM_BYTEORDER_H 1#ifndef _ASM_BYTEORDER_H
2#define _ASM_BYTEORDER_H 2#define _ASM_BYTEORDER_H
3 3
4#include <asm/types.h> 4#include <asm/swab.h>
5
6#if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__)
7# define __BYTEORDER_HAS_U64__
8# define __SWAB_64_THRU_32__
9#endif
10
11#include <linux/byteorder/big_endian.h> 5#include <linux/byteorder/big_endian.h>
12 6
13#endif /* _ASM_BYTEORDER_H */ 7#endif /* _ASM_BYTEORDER_H */
diff --git a/include/asm-frv/mmu.h b/include/asm-frv/mmu.h
index 22c03714fb14..86ca0e86e7d2 100644
--- a/include/asm-frv/mmu.h
+++ b/include/asm-frv/mmu.h
@@ -22,7 +22,6 @@ typedef struct {
22 unsigned long dtlb_ptd_mapping; /* [DAMR5] PTD mapping for dtlb cached PGE */ 22 unsigned long dtlb_ptd_mapping; /* [DAMR5] PTD mapping for dtlb cached PGE */
23 23
24#else 24#else
25 struct vm_list_struct *vmlist;
26 unsigned long end_brk; 25 unsigned long end_brk;
27 26
28#endif 27#endif
diff --git a/include/asm-frv/swab.h b/include/asm-frv/swab.h
new file mode 100644
index 000000000000..afb3396ba5ed
--- /dev/null
+++ b/include/asm-frv/swab.h
@@ -0,0 +1,10 @@
1#ifndef _ASM_SWAB_H
2#define _ASM_SWAB_H
3
4#include <asm/types.h>
5
6#if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__)
7# define __SWAB_64_THRU_32__
8#endif
9
10#endif /* _ASM_SWAB_H */
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 8af276361bf2..37b82cb96c89 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -28,6 +28,17 @@ struct bug_entry {
28#define BUGFLAG_WARNING (1<<0) 28#define BUGFLAG_WARNING (1<<0)
29#endif /* CONFIG_GENERIC_BUG */ 29#endif /* CONFIG_GENERIC_BUG */
30 30
31/*
32 * Don't use BUG() or BUG_ON() unless there's really no way out; one
33 * example might be detecting data structure corruption in the middle
34 * of an operation that can't be backed out of. If the (sub)system
35 * can somehow continue operating, perhaps with reduced functionality,
36 * it's probably not BUG-worthy.
37 *
38 * If you're tempted to BUG(), think again: is completely giving up
39 * really the *only* solution? There are usually better options, where
40 * users don't need to reboot ASAP and can mostly shut down cleanly.
41 */
31#ifndef HAVE_ARCH_BUG 42#ifndef HAVE_ARCH_BUG
32#define BUG() do { \ 43#define BUG() do { \
33 printk("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __func__); \ 44 printk("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __func__); \
@@ -39,6 +50,12 @@ struct bug_entry {
39#define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while(0) 50#define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while(0)
40#endif 51#endif
41 52
53/*
54 * WARN(), WARN_ON(), WARN_ON_ONCE, and so on can be used to report
55 * significant issues that need prompt attention if they should ever
56 * appear at runtime. Use the versions with printk format strings
57 * to provide better diagnostics.
58 */
42#ifndef __WARN 59#ifndef __WARN
43#ifndef __ASSEMBLY__ 60#ifndef __ASSEMBLY__
44extern void warn_slowpath(const char *file, const int line, 61extern void warn_slowpath(const char *file, const int line,
diff --git a/include/asm-generic/local.h b/include/asm-generic/local.h
index 33d7d04e4119..dbd6150763e9 100644
--- a/include/asm-generic/local.h
+++ b/include/asm-generic/local.h
@@ -2,7 +2,6 @@
2#define _ASM_GENERIC_LOCAL_H 2#define _ASM_GENERIC_LOCAL_H
3 3
4#include <linux/percpu.h> 4#include <linux/percpu.h>
5#include <linux/hardirq.h>
6#include <asm/atomic.h> 5#include <asm/atomic.h>
7#include <asm/types.h> 6#include <asm/types.h>
8 7
diff --git a/include/asm-generic/memory_model.h b/include/asm-generic/memory_model.h
index 36fa286adad5..4c8d0afae711 100644
--- a/include/asm-generic/memory_model.h
+++ b/include/asm-generic/memory_model.h
@@ -69,15 +69,8 @@
69}) 69})
70#endif /* CONFIG_FLATMEM/DISCONTIGMEM/SPARSEMEM */ 70#endif /* CONFIG_FLATMEM/DISCONTIGMEM/SPARSEMEM */
71 71
72#ifdef CONFIG_OUT_OF_LINE_PFN_TO_PAGE
73struct page;
74/* this is useful when inlined pfn_to_page is too big */
75extern struct page *pfn_to_page(unsigned long pfn);
76extern unsigned long page_to_pfn(struct page *page);
77#else
78#define page_to_pfn __page_to_pfn 72#define page_to_pfn __page_to_pfn
79#define pfn_to_page __pfn_to_page 73#define pfn_to_page __pfn_to_page
80#endif /* CONFIG_OUT_OF_LINE_PFN_TO_PAGE */
81 74
82#endif /* __ASSEMBLY__ */ 75#endif /* __ASSEMBLY__ */
83 76
diff --git a/include/asm-m32r/Kbuild b/include/asm-m32r/Kbuild
index c68e1680da01..27b108a86b39 100644
--- a/include/asm-m32r/Kbuild
+++ b/include/asm-m32r/Kbuild
@@ -1 +1,2 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2unifdef-y += swab.h
diff --git a/include/asm-m32r/atomic.h b/include/asm-m32r/atomic.h
index 3a38ffe4a4f4..2eed30f84080 100644
--- a/include/asm-m32r/atomic.h
+++ b/include/asm-m32r/atomic.h
@@ -9,6 +9,7 @@
9 * Copyright (C) 2004 Hirokazu Takata <takata at linux-m32r.org> 9 * Copyright (C) 2004 Hirokazu Takata <takata at linux-m32r.org>
10 */ 10 */
11 11
12#include <linux/types.h>
12#include <asm/assembler.h> 13#include <asm/assembler.h>
13#include <asm/system.h> 14#include <asm/system.h>
14 15
@@ -17,13 +18,6 @@
17 * resource counting etc.. 18 * resource counting etc..
18 */ 19 */
19 20
20/*
21 * Make sure gcc doesn't try to be clever and move things around
22 * on us. We need to use _exactly_ the address the user gave us,
23 * not some alias that contains the same information.
24 */
25typedef struct { volatile int counter; } atomic_t;
26
27#define ATOMIC_INIT(i) { (i) } 21#define ATOMIC_INIT(i) { (i) }
28 22
29/** 23/**
diff --git a/include/asm-m32r/byteorder.h b/include/asm-m32r/byteorder.h
index 10b2c1d11614..61ff9cfd8451 100644
--- a/include/asm-m32r/byteorder.h
+++ b/include/asm-m32r/byteorder.h
@@ -1,12 +1,7 @@
1#ifndef _ASM_M32R_BYTEORDER_H 1#ifndef _ASM_M32R_BYTEORDER_H
2#define _ASM_M32R_BYTEORDER_H 2#define _ASM_M32R_BYTEORDER_H
3 3
4#include <asm/types.h> 4#include <asm/swab.h>
5
6#if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
7# define __BYTEORDER_HAS_U64__
8# define __SWAB_64_THRU_32__
9#endif
10 5
11#if defined(__LITTLE_ENDIAN__) 6#if defined(__LITTLE_ENDIAN__)
12# include <linux/byteorder/little_endian.h> 7# include <linux/byteorder/little_endian.h>
diff --git a/include/asm-m32r/mmu.h b/include/asm-m32r/mmu.h
index d9bd724479cf..150cb92bb666 100644
--- a/include/asm-m32r/mmu.h
+++ b/include/asm-m32r/mmu.h
@@ -4,7 +4,6 @@
4#if !defined(CONFIG_MMU) 4#if !defined(CONFIG_MMU)
5 5
6typedef struct { 6typedef struct {
7 struct vm_list_struct *vmlist;
8 unsigned long end_brk; 7 unsigned long end_brk;
9} mm_context_t; 8} mm_context_t;
10 9
diff --git a/include/asm-m32r/swab.h b/include/asm-m32r/swab.h
new file mode 100644
index 000000000000..97973e101825
--- /dev/null
+++ b/include/asm-m32r/swab.h
@@ -0,0 +1,10 @@
1#ifndef _ASM_M32R_SWAB_H
2#define _ASM_M32R_SWAB_H
3
4#include <asm/types.h>
5
6#if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
7# define __SWAB_64_THRU_32__
8#endif
9
10#endif /* _ASM_M32R_SWAB_H */
diff --git a/include/asm-m68k/Kbuild b/include/asm-m68k/Kbuild
index 1a922fad76f7..52fd96b4142a 100644
--- a/include/asm-m68k/Kbuild
+++ b/include/asm-m68k/Kbuild
@@ -1,2 +1,3 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2header-y += cachectl.h 2header-y += cachectl.h
3unifdef-y += swab.h
diff --git a/include/asm-m68k/atomic.h b/include/asm-m68k/atomic.h
index 4915294fea63..eb0ab9d4ee77 100644
--- a/include/asm-m68k/atomic.h
+++ b/include/asm-m68k/atomic.h
@@ -1,7 +1,7 @@
1#ifndef __ARCH_M68K_ATOMIC__ 1#ifndef __ARCH_M68K_ATOMIC__
2#define __ARCH_M68K_ATOMIC__ 2#define __ARCH_M68K_ATOMIC__
3 3
4 4#include <linux/types.h>
5#include <asm/system.h> 5#include <asm/system.h>
6 6
7/* 7/*
@@ -13,7 +13,6 @@
13 * We do not have SMP m68k systems, so we don't have to deal with that. 13 * We do not have SMP m68k systems, so we don't have to deal with that.
14 */ 14 */
15 15
16typedef struct { int counter; } atomic_t;
17#define ATOMIC_INIT(i) { (i) } 16#define ATOMIC_INIT(i) { (i) }
18 17
19#define atomic_read(v) ((v)->counter) 18#define atomic_read(v) ((v)->counter)
diff --git a/include/asm-m68k/byteorder.h b/include/asm-m68k/byteorder.h
index b354acdafec8..300866523b86 100644
--- a/include/asm-m68k/byteorder.h
+++ b/include/asm-m68k/byteorder.h
@@ -1,19 +1,7 @@
1#ifndef _M68K_BYTEORDER_H 1#ifndef _M68K_BYTEORDER_H
2#define _M68K_BYTEORDER_H 2#define _M68K_BYTEORDER_H
3 3
4#include <asm/types.h> 4#include <asm/swab.h>
5#include <linux/compiler.h> 5#include <linux/byteorder/big_endian.h>
6
7#define __BIG_ENDIAN
8#define __SWAB_64_THRU_32__
9
10static inline __attribute_const__ __u32 __arch_swab32(__u32 val)
11{
12 __asm__("rolw #8,%0; swap %0; rolw #8,%0" : "=d" (val) : "0" (val));
13 return val;
14}
15#define __arch_swab32 __arch_swab32
16
17#include <linux/byteorder.h>
18 6
19#endif /* _M68K_BYTEORDER_H */ 7#endif /* _M68K_BYTEORDER_H */
diff --git a/include/asm-m68k/swab.h b/include/asm-m68k/swab.h
new file mode 100644
index 000000000000..7221e3066825
--- /dev/null
+++ b/include/asm-m68k/swab.h
@@ -0,0 +1,16 @@
1#ifndef _M68K_SWAB_H
2#define _M68K_SWAB_H
3
4#include <asm/types.h>
5#include <linux/compiler.h>
6
7#define __SWAB_64_THRU_32__
8
9static inline __attribute_const__ __u32 __arch_swab32(__u32 val)
10{
11 __asm__("rolw #8,%0; swap %0; rolw #8,%0" : "=d" (val) : "0" (val));
12 return val;
13}
14#define __arch_swab32 __arch_swab32
15
16#endif /* _M68K_SWAB_H */
diff --git a/include/asm-mn10300/Kbuild b/include/asm-mn10300/Kbuild
index c68e1680da01..27b108a86b39 100644
--- a/include/asm-mn10300/Kbuild
+++ b/include/asm-mn10300/Kbuild
@@ -1 +1,2 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2unifdef-y += swab.h
diff --git a/include/asm-mn10300/atomic.h b/include/asm-mn10300/atomic.h
index 27c9690b9574..bc064825f9b1 100644
--- a/include/asm-mn10300/atomic.h
+++ b/include/asm-mn10300/atomic.h
@@ -20,15 +20,6 @@
20 * resource counting etc.. 20 * resource counting etc..
21 */ 21 */
22 22
23/*
24 * Make sure gcc doesn't try to be clever and move things around
25 * on us. We need to use _exactly_ the address the user gave us,
26 * not some alias that contains the same information.
27 */
28typedef struct {
29 int counter;
30} atomic_t;
31
32#define ATOMIC_INIT(i) { (i) } 23#define ATOMIC_INIT(i) { (i) }
33 24
34#ifdef __KERNEL__ 25#ifdef __KERNEL__
diff --git a/include/asm-mn10300/byteorder.h b/include/asm-mn10300/byteorder.h
index 3c993cc625f8..45b18ded19e6 100644
--- a/include/asm-mn10300/byteorder.h
+++ b/include/asm-mn10300/byteorder.h
@@ -1,46 +1,7 @@
1/* MN10300 Byte-order primitive construction
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_BYTEORDER_H 1#ifndef _ASM_BYTEORDER_H
12#define _ASM_BYTEORDER_H 2#define _ASM_BYTEORDER_H
13 3
14#include <asm/types.h> 4#include <asm/swab.h>
15
16#ifdef __GNUC__
17
18static inline __attribute__((const))
19__u32 ___arch__swab32(__u32 x)
20{
21 __u32 ret;
22 asm("swap %1,%0" : "=r" (ret) : "r" (x));
23 return ret;
24}
25
26static inline __attribute__((const))
27__u16 ___arch__swab16(__u16 x)
28{
29 __u16 ret;
30 asm("swaph %1,%0" : "=r" (ret) : "r" (x));
31 return ret;
32}
33
34#define __arch__swab32(x) ___arch__swab32(x)
35#define __arch__swab16(x) ___arch__swab16(x)
36
37#if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
38# define __BYTEORDER_HAS_U64__
39# define __SWAB_64_THRU_32__
40#endif
41
42#endif /* __GNUC__ */
43
44#include <linux/byteorder/little_endian.h> 5#include <linux/byteorder/little_endian.h>
45 6
46#endif /* _ASM_BYTEORDER_H */ 7#endif /* _ASM_BYTEORDER_H */
diff --git a/include/asm-mn10300/swab.h b/include/asm-mn10300/swab.h
new file mode 100644
index 000000000000..4504d1b4b477
--- /dev/null
+++ b/include/asm-mn10300/swab.h
@@ -0,0 +1,42 @@
1/* MN10300 Byte-order primitive construction
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_SWAB_H
12#define _ASM_SWAB_H
13
14#include <asm/types.h>
15
16#ifdef __GNUC__
17
18static inline __attribute__((const))
19__u32 __arch_swab32(__u32 x)
20{
21 __u32 ret;
22 asm("swap %1,%0" : "=r" (ret) : "r" (x));
23 return ret;
24}
25#define __arch_swab32 __arch_swab32
26
27static inline __attribute__((const))
28__u16 __arch_swab16(__u16 x)
29{
30 __u16 ret;
31 asm("swaph %1,%0" : "=r" (ret) : "r" (x));
32 return ret;
33}
34#define __arch_swab32 __arch_swab32
35
36#if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
37# define __SWAB_64_THRU_32__
38#endif
39
40#endif /* __GNUC__ */
41
42#endif /* _ASM_SWAB_H */
diff --git a/include/asm-xtensa/Kbuild b/include/asm-xtensa/Kbuild
deleted file mode 100644
index c68e1680da01..000000000000
--- a/include/asm-xtensa/Kbuild
+++ /dev/null
@@ -1 +0,0 @@
1include include/asm-generic/Kbuild.asm
diff --git a/include/asm-xtensa/asmmacro.h b/include/asm-xtensa/asmmacro.h
deleted file mode 100644
index 76915cabad17..000000000000
--- a/include/asm-xtensa/asmmacro.h
+++ /dev/null
@@ -1,153 +0,0 @@
1/*
2 * include/asm-xtensa/asmmacro.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_ASMMACRO_H
12#define _XTENSA_ASMMACRO_H
13
14#include <asm/variant/core.h>
15
16/*
17 * Some little helpers for loops. Use zero-overhead-loops
18 * where applicable and if supported by the processor.
19 *
20 * __loopi ar, at, size, inc
21 * ar register initialized with the start address
22 * at scratch register used by macro
23 * size size immediate value
24 * inc increment
25 *
26 * __loops ar, as, at, inc_log2[, mask_log2][, cond][, ncond]
27 * ar register initialized with the start address
28 * as register initialized with the size
29 * at scratch register use by macro
30 * inc_log2 increment [in log2]
31 * mask_log2 mask [in log2]
32 * cond true condition (used in loop'cond')
33 * ncond false condition (used in b'ncond')
34 *
35 * __loop as
36 * restart loop. 'as' register must not have been modified!
37 *
38 * __endla ar, at, incr
39 * ar start address (modified)
40 * as scratch register used by macro
41 * inc increment
42 */
43
44/*
45 * loop for given size as immediate
46 */
47
48 .macro __loopi ar, at, size, incr
49
50#if XCHAL_HAVE_LOOPS
51 movi \at, ((\size + \incr - 1) / (\incr))
52 loop \at, 99f
53#else
54 addi \at, \ar, \size
55 98:
56#endif
57
58 .endm
59
60/*
61 * loop for given size in register
62 */
63
64 .macro __loops ar, as, at, incr_log2, mask_log2, cond, ncond
65
66#if XCHAL_HAVE_LOOPS
67 .ifgt \incr_log2 - 1
68 addi \at, \as, (1 << \incr_log2) - 1
69 .ifnc \mask_log2,
70 extui \at, \at, \incr_log2, \mask_log2
71 .else
72 srli \at, \at, \incr_log2
73 .endif
74 .endif
75 loop\cond \at, 99f
76#else
77 .ifnc \mask_log2,
78 extui \at, \as, \incr_log2, \mask_log2
79 .else
80 .ifnc \ncond,
81 srli \at, \as, \incr_log2
82 .endif
83 .endif
84 .ifnc \ncond,
85 b\ncond \at, 99f
86
87 .endif
88 .ifnc \mask_log2,
89 slli \at, \at, \incr_log2
90 add \at, \ar, \at
91 .else
92 add \at, \ar, \as
93 .endif
94#endif
95 98:
96
97 .endm
98
99/*
100 * loop from ar to ax
101 */
102
103 .macro __loopt ar, as, at, incr_log2
104
105#if XCHAL_HAVE_LOOPS
106 sub \at, \as, \ar
107 .ifgt \incr_log2 - 1
108 addi \at, \at, (1 << \incr_log2) - 1
109 srli \at, \at, \incr_log2
110 .endif
111 loop \at, 99f
112#else
113 98:
114#endif
115
116 .endm
117
118/*
119 * restart loop. registers must be unchanged
120 */
121
122 .macro __loop as
123
124#if XCHAL_HAVE_LOOPS
125 loop \as, 99f
126#else
127 98:
128#endif
129
130 .endm
131
132/*
133 * end of loop with no increment of the address.
134 */
135
136 .macro __endl ar, as
137#if !XCHAL_HAVE_LOOPS
138 bltu \ar, \as, 98b
139#endif
140 99:
141 .endm
142
143/*
144 * end of loop with increment of the address.
145 */
146
147 .macro __endla ar, as, incr
148 addi \ar, \ar, \incr
149 __endl \ar \as
150 .endm
151
152
153#endif /* _XTENSA_ASMMACRO_H */
diff --git a/include/asm-xtensa/atomic.h b/include/asm-xtensa/atomic.h
deleted file mode 100644
index b3b23540f14d..000000000000
--- a/include/asm-xtensa/atomic.h
+++ /dev/null
@@ -1,300 +0,0 @@
1/*
2 * include/asm-xtensa/atomic.h
3 *
4 * Atomic operations that C can't guarantee us. Useful for resource counting..
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 *
10 * Copyright (C) 2001 - 2005 Tensilica Inc.
11 */
12
13#ifndef _XTENSA_ATOMIC_H
14#define _XTENSA_ATOMIC_H
15
16#include <linux/stringify.h>
17
18typedef struct { volatile int counter; } atomic_t;
19
20#ifdef __KERNEL__
21#include <asm/processor.h>
22#include <asm/system.h>
23
24#define ATOMIC_INIT(i) { (i) }
25
26/*
27 * This Xtensa implementation assumes that the right mechanism
28 * for exclusion is for locking interrupts to level 1.
29 *
30 * Locking interrupts looks like this:
31 *
32 * rsil a15, 1
33 * <code>
34 * wsr a15, PS
35 * rsync
36 *
37 * Note that a15 is used here because the register allocation
38 * done by the compiler is not guaranteed and a window overflow
39 * may not occur between the rsil and wsr instructions. By using
40 * a15 in the rsil, the machine is guaranteed to be in a state
41 * where no register reference will cause an overflow.
42 */
43
44/**
45 * atomic_read - read atomic variable
46 * @v: pointer of type atomic_t
47 *
48 * Atomically reads the value of @v.
49 */
50#define atomic_read(v) ((v)->counter)
51
52/**
53 * atomic_set - set atomic variable
54 * @v: pointer of type atomic_t
55 * @i: required value
56 *
57 * Atomically sets the value of @v to @i.
58 */
59#define atomic_set(v,i) ((v)->counter = (i))
60
61/**
62 * atomic_add - add integer to atomic variable
63 * @i: integer value to add
64 * @v: pointer of type atomic_t
65 *
66 * Atomically adds @i to @v.
67 */
68static inline void atomic_add(int i, atomic_t * v)
69{
70 unsigned int vval;
71
72 __asm__ __volatile__(
73 "rsil a15, "__stringify(LOCKLEVEL)"\n\t"
74 "l32i %0, %2, 0 \n\t"
75 "add %0, %0, %1 \n\t"
76 "s32i %0, %2, 0 \n\t"
77 "wsr a15, "__stringify(PS)" \n\t"
78 "rsync \n"
79 : "=&a" (vval)
80 : "a" (i), "a" (v)
81 : "a15", "memory"
82 );
83}
84
85/**
86 * atomic_sub - subtract the atomic variable
87 * @i: integer value to subtract
88 * @v: pointer of type atomic_t
89 *
90 * Atomically subtracts @i from @v.
91 */
92static inline void atomic_sub(int i, atomic_t *v)
93{
94 unsigned int vval;
95
96 __asm__ __volatile__(
97 "rsil a15, "__stringify(LOCKLEVEL)"\n\t"
98 "l32i %0, %2, 0 \n\t"
99 "sub %0, %0, %1 \n\t"
100 "s32i %0, %2, 0 \n\t"
101 "wsr a15, "__stringify(PS)" \n\t"
102 "rsync \n"
103 : "=&a" (vval)
104 : "a" (i), "a" (v)
105 : "a15", "memory"
106 );
107}
108
109/*
110 * We use atomic_{add|sub}_return to define other functions.
111 */
112
113static inline int atomic_add_return(int i, atomic_t * v)
114{
115 unsigned int vval;
116
117 __asm__ __volatile__(
118 "rsil a15,"__stringify(LOCKLEVEL)"\n\t"
119 "l32i %0, %2, 0 \n\t"
120 "add %0, %0, %1 \n\t"
121 "s32i %0, %2, 0 \n\t"
122 "wsr a15, "__stringify(PS)" \n\t"
123 "rsync \n"
124 : "=&a" (vval)
125 : "a" (i), "a" (v)
126 : "a15", "memory"
127 );
128
129 return vval;
130}
131
132static inline int atomic_sub_return(int i, atomic_t * v)
133{
134 unsigned int vval;
135
136 __asm__ __volatile__(
137 "rsil a15,"__stringify(LOCKLEVEL)"\n\t"
138 "l32i %0, %2, 0 \n\t"
139 "sub %0, %0, %1 \n\t"
140 "s32i %0, %2, 0 \n\t"
141 "wsr a15, "__stringify(PS)" \n\t"
142 "rsync \n"
143 : "=&a" (vval)
144 : "a" (i), "a" (v)
145 : "a15", "memory"
146 );
147
148 return vval;
149}
150
151/**
152 * atomic_sub_and_test - subtract value from variable and test result
153 * @i: integer value to subtract
154 * @v: pointer of type atomic_t
155 *
156 * Atomically subtracts @i from @v and returns
157 * true if the result is zero, or false for all
158 * other cases.
159 */
160#define atomic_sub_and_test(i,v) (atomic_sub_return((i),(v)) == 0)
161
162/**
163 * atomic_inc - increment atomic variable
164 * @v: pointer of type atomic_t
165 *
166 * Atomically increments @v by 1.
167 */
168#define atomic_inc(v) atomic_add(1,(v))
169
170/**
171 * atomic_inc - increment atomic variable
172 * @v: pointer of type atomic_t
173 *
174 * Atomically increments @v by 1.
175 */
176#define atomic_inc_return(v) atomic_add_return(1,(v))
177
178/**
179 * atomic_dec - decrement atomic variable
180 * @v: pointer of type atomic_t
181 *
182 * Atomically decrements @v by 1.
183 */
184#define atomic_dec(v) atomic_sub(1,(v))
185
186/**
187 * atomic_dec_return - decrement atomic variable
188 * @v: pointer of type atomic_t
189 *
190 * Atomically decrements @v by 1.
191 */
192#define atomic_dec_return(v) atomic_sub_return(1,(v))
193
194/**
195 * atomic_dec_and_test - decrement and test
196 * @v: pointer of type atomic_t
197 *
198 * Atomically decrements @v by 1 and
199 * returns true if the result is 0, or false for all other
200 * cases.
201 */
202#define atomic_dec_and_test(v) (atomic_sub_return(1,(v)) == 0)
203
204/**
205 * atomic_inc_and_test - increment and test
206 * @v: pointer of type atomic_t
207 *
208 * Atomically increments @v by 1
209 * and returns true if the result is zero, or false for all
210 * other cases.
211 */
212#define atomic_inc_and_test(v) (atomic_add_return(1,(v)) == 0)
213
214/**
215 * atomic_add_negative - add and test if negative
216 * @v: pointer of type atomic_t
217 * @i: integer value to add
218 *
219 * Atomically adds @i to @v and returns true
220 * if the result is negative, or false when
221 * result is greater than or equal to zero.
222 */
223#define atomic_add_negative(i,v) (atomic_add_return((i),(v)) < 0)
224
225#define atomic_cmpxchg(v, o, n) ((int)cmpxchg(&((v)->counter), (o), (n)))
226#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
227
228/**
229 * atomic_add_unless - add unless the number is a given value
230 * @v: pointer of type atomic_t
231 * @a: the amount to add to v...
232 * @u: ...unless v is equal to u.
233 *
234 * Atomically adds @a to @v, so long as it was not @u.
235 * Returns non-zero if @v was not @u, and zero otherwise.
236 */
237static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
238{
239 int c, old;
240 c = atomic_read(v);
241 for (;;) {
242 if (unlikely(c == (u)))
243 break;
244 old = atomic_cmpxchg((v), c, c + (a));
245 if (likely(old == c))
246 break;
247 c = old;
248 }
249 return c != (u);
250}
251
252#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
253
254static inline void atomic_clear_mask(unsigned int mask, atomic_t *v)
255{
256 unsigned int all_f = -1;
257 unsigned int vval;
258
259 __asm__ __volatile__(
260 "rsil a15,"__stringify(LOCKLEVEL)"\n\t"
261 "l32i %0, %2, 0 \n\t"
262 "xor %1, %4, %3 \n\t"
263 "and %0, %0, %4 \n\t"
264 "s32i %0, %2, 0 \n\t"
265 "wsr a15, "__stringify(PS)" \n\t"
266 "rsync \n"
267 : "=&a" (vval), "=a" (mask)
268 : "a" (v), "a" (all_f), "1" (mask)
269 : "a15", "memory"
270 );
271}
272
273static inline void atomic_set_mask(unsigned int mask, atomic_t *v)
274{
275 unsigned int vval;
276
277 __asm__ __volatile__(
278 "rsil a15,"__stringify(LOCKLEVEL)"\n\t"
279 "l32i %0, %2, 0 \n\t"
280 "or %0, %0, %1 \n\t"
281 "s32i %0, %2, 0 \n\t"
282 "wsr a15, "__stringify(PS)" \n\t"
283 "rsync \n"
284 : "=&a" (vval)
285 : "a" (mask), "a" (v)
286 : "a15", "memory"
287 );
288}
289
290/* Atomic operations are already serializing */
291#define smp_mb__before_atomic_dec() barrier()
292#define smp_mb__after_atomic_dec() barrier()
293#define smp_mb__before_atomic_inc() barrier()
294#define smp_mb__after_atomic_inc() barrier()
295
296#include <asm-generic/atomic.h>
297#endif /* __KERNEL__ */
298
299#endif /* _XTENSA_ATOMIC_H */
300
diff --git a/include/asm-xtensa/auxvec.h b/include/asm-xtensa/auxvec.h
deleted file mode 100644
index 257dec75c5af..000000000000
--- a/include/asm-xtensa/auxvec.h
+++ /dev/null
@@ -1,4 +0,0 @@
1#ifndef __XTENSA_AUXVEC_H
2#define __XTENSA_AUXVEC_H
3
4#endif
diff --git a/include/asm-xtensa/bitops.h b/include/asm-xtensa/bitops.h
deleted file mode 100644
index 6c3930397bd3..000000000000
--- a/include/asm-xtensa/bitops.h
+++ /dev/null
@@ -1,132 +0,0 @@
1/*
2 * include/asm-xtensa/bitops.h
3 *
4 * Atomic operations that C can't guarantee us.Useful for resource counting etc.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 *
10 * Copyright (C) 2001 - 2007 Tensilica Inc.
11 */
12
13#ifndef _XTENSA_BITOPS_H
14#define _XTENSA_BITOPS_H
15
16#ifdef __KERNEL__
17
18#ifndef _LINUX_BITOPS_H
19#error only <linux/bitops.h> can be included directly
20#endif
21
22#include <asm/processor.h>
23#include <asm/byteorder.h>
24#include <asm/system.h>
25
26#ifdef CONFIG_SMP
27# error SMP not supported on this architecture
28#endif
29
30#define smp_mb__before_clear_bit() barrier()
31#define smp_mb__after_clear_bit() barrier()
32
33#include <asm-generic/bitops/atomic.h>
34#include <asm-generic/bitops/non-atomic.h>
35
36#if XCHAL_HAVE_NSA
37
38static inline unsigned long __cntlz (unsigned long x)
39{
40 int lz;
41 asm ("nsau %0, %1" : "=r" (lz) : "r" (x));
42 return lz;
43}
44
45/*
46 * ffz: Find first zero in word. Undefined if no zero exists.
47 * bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1).
48 */
49
50static inline int ffz(unsigned long x)
51{
52 return 31 - __cntlz(~x & -~x);
53}
54
55/*
56 * __ffs: Find first bit set in word. Return 0 for bit 0
57 */
58
59static inline int __ffs(unsigned long x)
60{
61 return 31 - __cntlz(x & -x);
62}
63
64/*
65 * ffs: Find first bit set in word. This is defined the same way as
66 * the libc and compiler builtin ffs routines, therefore
67 * differs in spirit from the above ffz (man ffs).
68 */
69
70static inline int ffs(unsigned long x)
71{
72 return 32 - __cntlz(x & -x);
73}
74
75/*
76 * fls: Find last (most-significant) bit set in word.
77 * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
78 */
79
80static inline int fls (unsigned int x)
81{
82 return 32 - __cntlz(x);
83}
84
85/**
86 * __fls - find last (most-significant) set bit in a long word
87 * @word: the word to search
88 *
89 * Undefined if no set bit exists, so code should check against 0 first.
90 */
91static inline unsigned long __fls(unsigned long word)
92{
93 return 31 - __cntlz(word);
94}
95#else
96
97/* Use the generic implementation if we don't have the nsa/nsau instructions. */
98
99# include <asm-generic/bitops/ffs.h>
100# include <asm-generic/bitops/__ffs.h>
101# include <asm-generic/bitops/ffz.h>
102# include <asm-generic/bitops/fls.h>
103# include <asm-generic/bitops/__fls.h>
104
105#endif
106
107#include <asm-generic/bitops/fls64.h>
108#include <asm-generic/bitops/find.h>
109#include <asm-generic/bitops/ext2-non-atomic.h>
110
111#ifdef __XTENSA_EL__
112# define ext2_set_bit_atomic(lock,nr,addr) \
113 test_and_set_bit((nr), (unsigned long*)(addr))
114# define ext2_clear_bit_atomic(lock,nr,addr) \
115 test_and_clear_bit((nr), (unsigned long*)(addr))
116#elif defined(__XTENSA_EB__)
117# define ext2_set_bit_atomic(lock,nr,addr) \
118 test_and_set_bit((nr) ^ 0x18, (unsigned long*)(addr))
119# define ext2_clear_bit_atomic(lock,nr,addr) \
120 test_and_clear_bit((nr) ^ 0x18, (unsigned long*)(addr))
121#else
122# error processor byte order undefined!
123#endif
124
125#include <asm-generic/bitops/hweight.h>
126#include <asm-generic/bitops/lock.h>
127#include <asm-generic/bitops/sched.h>
128#include <asm-generic/bitops/minix.h>
129
130#endif /* __KERNEL__ */
131
132#endif /* _XTENSA_BITOPS_H */
diff --git a/include/asm-xtensa/bootparam.h b/include/asm-xtensa/bootparam.h
deleted file mode 100644
index 9983f2c1b7ee..000000000000
--- a/include/asm-xtensa/bootparam.h
+++ /dev/null
@@ -1,61 +0,0 @@
1/*
2 * include/asm-xtensa/bootparam.h
3 *
4 * Definition of the Linux/Xtensa boot parameter structure
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 *
10 * Copyright (C) 2001 - 2005 Tensilica Inc.
11 *
12 * (Concept borrowed from the 68K port)
13 */
14
15#ifndef _XTENSA_BOOTPARAM_H
16#define _XTENSA_BOOTPARAM_H
17
18#define BP_VERSION 0x0001
19
20#define BP_TAG_COMMAND_LINE 0x1001 /* command line (0-terminated string)*/
21#define BP_TAG_INITRD 0x1002 /* ramdisk addr and size (bp_meminfo) */
22#define BP_TAG_MEMORY 0x1003 /* memory addr and size (bp_meminfo) */
23#define BP_TAG_SERIAL_BAUSRATE 0x1004 /* baud rate of current console. */
24#define BP_TAG_SERIAL_PORT 0x1005 /* serial device of current console */
25
26#define BP_TAG_FIRST 0x7B0B /* first tag with a version number */
27#define BP_TAG_LAST 0x7E0B /* last tag */
28
29#ifndef __ASSEMBLY__
30
31/* All records are aligned to 4 bytes */
32
33typedef struct bp_tag {
34 unsigned short id; /* tag id */
35 unsigned short size; /* size of this record excluding the structure*/
36 unsigned long data[0]; /* data */
37} bp_tag_t;
38
39typedef struct meminfo {
40 unsigned long type;
41 unsigned long start;
42 unsigned long end;
43} meminfo_t;
44
45#define SYSMEM_BANKS_MAX 5
46
47#define MEMORY_TYPE_CONVENTIONAL 0x1000
48#define MEMORY_TYPE_NONE 0x2000
49
50typedef struct sysmem_info {
51 int nr_banks;
52 meminfo_t bank[SYSMEM_BANKS_MAX];
53} sysmem_info_t;
54
55extern sysmem_info_t sysmem;
56
57#endif
58#endif
59
60
61
diff --git a/include/asm-xtensa/bug.h b/include/asm-xtensa/bug.h
deleted file mode 100644
index 3e52d72712f1..000000000000
--- a/include/asm-xtensa/bug.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/*
2 * include/asm-xtensa/bug.h
3 *
4 * Macros to cause a 'bug' message.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 *
10 * Copyright (C) 2001 - 2005 Tensilica Inc.
11 */
12
13#ifndef _XTENSA_BUG_H
14#define _XTENSA_BUG_H
15
16#include <asm-generic/bug.h>
17
18#endif /* _XTENSA_BUG_H */
diff --git a/include/asm-xtensa/bugs.h b/include/asm-xtensa/bugs.h
deleted file mode 100644
index 69b29d198249..000000000000
--- a/include/asm-xtensa/bugs.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/*
2 * include/asm-xtensa/bugs.h
3 *
4 * This is included by init/main.c to check for architecture-dependent bugs.
5 *
6 * Xtensa processors don't have any bugs. :)
7 *
8 * This file is subject to the terms and conditions of the GNU General
9 * Public License. See the file "COPYING" in the main directory of
10 * this archive for more details.
11 */
12
13#ifndef _XTENSA_BUGS_H
14#define _XTENSA_BUGS_H
15
16static void check_bugs(void) { }
17
18#endif /* _XTENSA_BUGS_H */
diff --git a/include/asm-xtensa/byteorder.h b/include/asm-xtensa/byteorder.h
deleted file mode 100644
index 765edf17a9a4..000000000000
--- a/include/asm-xtensa/byteorder.h
+++ /dev/null
@@ -1,82 +0,0 @@
1/*
2 * include/asm-xtensa/byteorder.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_BYTEORDER_H
12#define _XTENSA_BYTEORDER_H
13
14#include <asm/types.h>
15#include <linux/compiler.h>
16
17static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x)
18{
19 __u32 res;
20 /* instruction sequence from Xtensa ISA release 2/2000 */
21 __asm__("ssai 8 \n\t"
22 "srli %0, %1, 16 \n\t"
23 "src %0, %0, %1 \n\t"
24 "src %0, %0, %0 \n\t"
25 "src %0, %1, %0 \n"
26 : "=&a" (res)
27 : "a" (x)
28 );
29 return res;
30}
31
32static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 x)
33{
34 /* Given that 'short' values are signed (i.e., can be negative),
35 * we cannot assume that the upper 16-bits of the register are
36 * zero. We are careful to mask values after shifting.
37 */
38
39 /* There exists an anomaly between xt-gcc and xt-xcc. xt-gcc
40 * inserts an extui instruction after putting this function inline
41 * to ensure that it uses only the least-significant 16 bits of
42 * the result. xt-xcc doesn't use an extui, but assumes the
43 * __asm__ macro follows convention that the upper 16 bits of an
44 * 'unsigned short' result are still zero. This macro doesn't
45 * follow convention; indeed, it leaves garbage in the upport 16
46 * bits of the register.
47
48 * Declaring the temporary variables 'res' and 'tmp' to be 32-bit
49 * types while the return type of the function is a 16-bit type
50 * forces both compilers to insert exactly one extui instruction
51 * (or equivalent) to mask off the upper 16 bits. */
52
53 __u32 res;
54 __u32 tmp;
55
56 __asm__("extui %1, %2, 8, 8\n\t"
57 "slli %0, %2, 8 \n\t"
58 "or %0, %0, %1 \n"
59 : "=&a" (res), "=&a" (tmp)
60 : "a" (x)
61 );
62
63 return res;
64}
65
66#define __arch__swab32(x) ___arch__swab32(x)
67#define __arch__swab16(x) ___arch__swab16(x)
68
69#if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
70# define __BYTEORDER_HAS_U64__
71# define __SWAB_64_THRU_32__
72#endif
73
74#ifdef __XTENSA_EL__
75# include <linux/byteorder/little_endian.h>
76#elif defined(__XTENSA_EB__)
77# include <linux/byteorder/big_endian.h>
78#else
79# error processor byte order undefined!
80#endif
81
82#endif /* _XTENSA_BYTEORDER_H */
diff --git a/include/asm-xtensa/cache.h b/include/asm-xtensa/cache.h
deleted file mode 100644
index 3bba2a540cf0..000000000000
--- a/include/asm-xtensa/cache.h
+++ /dev/null
@@ -1,33 +0,0 @@
1/*
2 * include/asm-xtensa/cache.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_CACHE_H
12#define _XTENSA_CACHE_H
13
14#include <asm/variant/core.h>
15
16#define L1_CACHE_SHIFT XCHAL_DCACHE_LINEWIDTH
17#define L1_CACHE_BYTES XCHAL_DCACHE_LINESIZE
18#define SMP_CACHE_BYTES L1_CACHE_BYTES
19
20#define DCACHE_WAY_SIZE (XCHAL_DCACHE_SIZE/XCHAL_DCACHE_WAYS)
21#define ICACHE_WAY_SIZE (XCHAL_ICACHE_SIZE/XCHAL_ICACHE_WAYS)
22#define DCACHE_WAY_SHIFT (XCHAL_DCACHE_SETWIDTH + XCHAL_DCACHE_LINEWIDTH)
23#define ICACHE_WAY_SHIFT (XCHAL_ICACHE_SETWIDTH + XCHAL_ICACHE_LINEWIDTH)
24
25/* Maximum cache size per way. */
26#if DCACHE_WAY_SIZE >= ICACHE_WAY_SIZE
27# define CACHE_WAY_SIZE DCACHE_WAY_SIZE
28#else
29# define CACHE_WAY_SIZE ICACHE_WAY_SIZE
30#endif
31
32
33#endif /* _XTENSA_CACHE_H */
diff --git a/include/asm-xtensa/cacheasm.h b/include/asm-xtensa/cacheasm.h
deleted file mode 100644
index 2c20a58f94cd..000000000000
--- a/include/asm-xtensa/cacheasm.h
+++ /dev/null
@@ -1,177 +0,0 @@
1/*
2 * include/asm-xtensa/cacheasm.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2006 Tensilica Inc.
9 */
10
11#include <asm/cache.h>
12#include <asm/asmmacro.h>
13#include <linux/stringify.h>
14
15/*
16 * Define cache functions as macros here so that they can be used
17 * by the kernel and boot loader. We should consider moving them to a
18 * library that can be linked by both.
19 *
20 * Locking
21 *
22 * ___unlock_dcache_all
23 * ___unlock_icache_all
24 *
25 * Flush and invaldating
26 *
27 * ___flush_invalidate_dcache_{all|range|page}
28 * ___flush_dcache_{all|range|page}
29 * ___invalidate_dcache_{all|range|page}
30 * ___invalidate_icache_{all|range|page}
31 *
32 */
33
34 .macro __loop_cache_all ar at insn size line_width
35
36 movi \ar, 0
37
38 __loopi \ar, \at, \size, (4 << (\line_width))
39 \insn \ar, 0 << (\line_width)
40 \insn \ar, 1 << (\line_width)
41 \insn \ar, 2 << (\line_width)
42 \insn \ar, 3 << (\line_width)
43 __endla \ar, \at, 4 << (\line_width)
44
45 .endm
46
47
48 .macro __loop_cache_range ar as at insn line_width
49
50 extui \at, \ar, 0, \line_width
51 add \as, \as, \at
52
53 __loops \ar, \as, \at, \line_width
54 \insn \ar, 0
55 __endla \ar, \at, (1 << (\line_width))
56
57 .endm
58
59
60 .macro __loop_cache_page ar at insn line_width
61
62 __loopi \ar, \at, PAGE_SIZE, 4 << (\line_width)
63 \insn \ar, 0 << (\line_width)
64 \insn \ar, 1 << (\line_width)
65 \insn \ar, 2 << (\line_width)
66 \insn \ar, 3 << (\line_width)
67 __endla \ar, \at, 4 << (\line_width)
68
69 .endm
70
71
72#if XCHAL_DCACHE_LINE_LOCKABLE
73
74 .macro ___unlock_dcache_all ar at
75
76 __loop_cache_all \ar \at diu XCHAL_DCACHE_SIZE XCHAL_DCACHE_LINEWIDTH
77
78 .endm
79
80#endif
81
82#if XCHAL_ICACHE_LINE_LOCKABLE
83
84 .macro ___unlock_icache_all ar at
85
86 __loop_cache_all \ar \at iiu XCHAL_ICACHE_SIZE XCHAL_ICACHE_LINEWIDTH
87
88 .endm
89#endif
90
91 .macro ___flush_invalidate_dcache_all ar at
92
93 __loop_cache_all \ar \at diwbi XCHAL_DCACHE_SIZE XCHAL_DCACHE_LINEWIDTH
94
95 .endm
96
97
98 .macro ___flush_dcache_all ar at
99
100 __loop_cache_all \ar \at diwb XCHAL_DCACHE_SIZE XCHAL_DCACHE_LINEWIDTH
101
102 .endm
103
104
105 .macro ___invalidate_dcache_all ar at
106
107 __loop_cache_all \ar \at dii __stringify(DCACHE_WAY_SIZE) \
108 XCHAL_DCACHE_LINEWIDTH
109
110 .endm
111
112
113 .macro ___invalidate_icache_all ar at
114
115 __loop_cache_all \ar \at iii __stringify(ICACHE_WAY_SIZE) \
116 XCHAL_ICACHE_LINEWIDTH
117
118 .endm
119
120
121
122 .macro ___flush_invalidate_dcache_range ar as at
123
124 __loop_cache_range \ar \as \at dhwbi XCHAL_DCACHE_LINEWIDTH
125
126 .endm
127
128
129 .macro ___flush_dcache_range ar as at
130
131 __loop_cache_range \ar \as \at dhwb XCHAL_DCACHE_LINEWIDTH
132
133 .endm
134
135
136 .macro ___invalidate_dcache_range ar as at
137
138 __loop_cache_range \ar \as \at dhi XCHAL_DCACHE_LINEWIDTH
139
140 .endm
141
142
143 .macro ___invalidate_icache_range ar as at
144
145 __loop_cache_range \ar \as \at ihi XCHAL_ICACHE_LINEWIDTH
146
147 .endm
148
149
150
151 .macro ___flush_invalidate_dcache_page ar as
152
153 __loop_cache_page \ar \as dhwbi XCHAL_DCACHE_LINEWIDTH
154
155 .endm
156
157
158 .macro ___flush_dcache_page ar as
159
160 __loop_cache_page \ar \as dhwb XCHAL_DCACHE_LINEWIDTH
161
162 .endm
163
164
165 .macro ___invalidate_dcache_page ar as
166
167 __loop_cache_page \ar \as dhi XCHAL_DCACHE_LINEWIDTH
168
169 .endm
170
171
172 .macro ___invalidate_icache_page ar as
173
174 __loop_cache_page \ar \as ihi XCHAL_ICACHE_LINEWIDTH
175
176 .endm
177
diff --git a/include/asm-xtensa/cacheflush.h b/include/asm-xtensa/cacheflush.h
deleted file mode 100644
index 94c4c53a099e..000000000000
--- a/include/asm-xtensa/cacheflush.h
+++ /dev/null
@@ -1,155 +0,0 @@
1/*
2 * include/asm-xtensa/cacheflush.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * (C) 2001 - 2007 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_CACHEFLUSH_H
12#define _XTENSA_CACHEFLUSH_H
13
14#ifdef __KERNEL__
15
16#include <linux/mm.h>
17#include <asm/processor.h>
18#include <asm/page.h>
19
20/*
21 * Lo-level routines for cache flushing.
22 *
23 * invalidate data or instruction cache:
24 *
25 * __invalidate_icache_all()
26 * __invalidate_icache_page(adr)
27 * __invalidate_dcache_page(adr)
28 * __invalidate_icache_range(from,size)
29 * __invalidate_dcache_range(from,size)
30 *
31 * flush data cache:
32 *
33 * __flush_dcache_page(adr)
34 *
35 * flush and invalidate data cache:
36 *
37 * __flush_invalidate_dcache_all()
38 * __flush_invalidate_dcache_page(adr)
39 * __flush_invalidate_dcache_range(from,size)
40 *
41 * specials for cache aliasing:
42 *
43 * __flush_invalidate_dcache_page_alias(vaddr,paddr)
44 * __invalidate_icache_page_alias(vaddr,paddr)
45 */
46
47extern void __invalidate_dcache_all(void);
48extern void __invalidate_icache_all(void);
49extern void __invalidate_dcache_page(unsigned long);
50extern void __invalidate_icache_page(unsigned long);
51extern void __invalidate_icache_range(unsigned long, unsigned long);
52extern void __invalidate_dcache_range(unsigned long, unsigned long);
53
54
55#if XCHAL_DCACHE_IS_WRITEBACK
56extern void __flush_invalidate_dcache_all(void);
57extern void __flush_dcache_page(unsigned long);
58extern void __flush_dcache_range(unsigned long, unsigned long);
59extern void __flush_invalidate_dcache_page(unsigned long);
60extern void __flush_invalidate_dcache_range(unsigned long, unsigned long);
61#else
62# define __flush_dcache_range(p,s) do { } while(0)
63# define __flush_dcache_page(p) do { } while(0)
64# define __flush_invalidate_dcache_page(p) __invalidate_dcache_page(p)
65# define __flush_invalidate_dcache_range(p,s) __invalidate_dcache_range(p,s)
66#endif
67
68#if (DCACHE_WAY_SIZE > PAGE_SIZE)
69extern void __flush_invalidate_dcache_page_alias(unsigned long, unsigned long);
70#endif
71#if (ICACHE_WAY_SIZE > PAGE_SIZE)
72extern void __invalidate_icache_page_alias(unsigned long, unsigned long);
73#else
74# define __invalidate_icache_page_alias(v,p) do { } while(0)
75#endif
76
77/*
78 * We have physically tagged caches - nothing to do here -
79 * unless we have cache aliasing.
80 *
81 * Pages can get remapped. Because this might change the 'color' of that page,
82 * we have to flush the cache before the PTE is changed.
83 * (see also Documentation/cachetlb.txt)
84 */
85
86#if (DCACHE_WAY_SIZE > PAGE_SIZE)
87
88#define flush_cache_all() \
89 do { \
90 __flush_invalidate_dcache_all(); \
91 __invalidate_icache_all(); \
92 } while (0)
93
94#define flush_cache_mm(mm) flush_cache_all()
95#define flush_cache_dup_mm(mm) flush_cache_mm(mm)
96
97#define flush_cache_vmap(start,end) flush_cache_all()
98#define flush_cache_vunmap(start,end) flush_cache_all()
99
100extern void flush_dcache_page(struct page*);
101extern void flush_cache_range(struct vm_area_struct*, ulong, ulong);
102extern void flush_cache_page(struct vm_area_struct*, unsigned long, unsigned long);
103
104#else
105
106#define flush_cache_all() do { } while (0)
107#define flush_cache_mm(mm) do { } while (0)
108#define flush_cache_dup_mm(mm) do { } while (0)
109
110#define flush_cache_vmap(start,end) do { } while (0)
111#define flush_cache_vunmap(start,end) do { } while (0)
112
113#define flush_dcache_page(page) do { } while (0)
114
115#define flush_cache_page(vma,addr,pfn) do { } while (0)
116#define flush_cache_range(vma,start,end) do { } while (0)
117
118#endif
119
120/* Ensure consistency between data and instruction cache. */
121#define flush_icache_range(start,end) \
122 do { \
123 __flush_dcache_range(start, (end) - (start)); \
124 __invalidate_icache_range(start,(end) - (start)); \
125 } while (0)
126
127/* This is not required, see Documentation/cachetlb.txt */
128#define flush_icache_page(vma,page) do { } while (0)
129
130#define flush_dcache_mmap_lock(mapping) do { } while (0)
131#define flush_dcache_mmap_unlock(mapping) do { } while (0)
132
133#if (DCACHE_WAY_SIZE > PAGE_SIZE)
134
135extern void copy_to_user_page(struct vm_area_struct*, struct page*,
136 unsigned long, void*, const void*, unsigned long);
137extern void copy_from_user_page(struct vm_area_struct*, struct page*,
138 unsigned long, void*, const void*, unsigned long);
139
140#else
141
142#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
143 do { \
144 memcpy(dst, src, len); \
145 __flush_dcache_range((unsigned long) dst, len); \
146 __invalidate_icache_range((unsigned long) dst, len); \
147 } while (0)
148
149#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
150 memcpy(dst, src, len)
151
152#endif
153
154#endif /* __KERNEL__ */
155#endif /* _XTENSA_CACHEFLUSH_H */
diff --git a/include/asm-xtensa/checksum.h b/include/asm-xtensa/checksum.h
deleted file mode 100644
index 23534c60b3a4..000000000000
--- a/include/asm-xtensa/checksum.h
+++ /dev/null
@@ -1,250 +0,0 @@
1/*
2 * include/asm-xtensa/checksum.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_CHECKSUM_H
12#define _XTENSA_CHECKSUM_H
13
14#include <linux/in6.h>
15#include <asm/variant/core.h>
16
17/*
18 * computes the checksum of a memory block at buff, length len,
19 * and adds in "sum" (32-bit)
20 *
21 * returns a 32-bit number suitable for feeding into itself
22 * or csum_tcpudp_magic
23 *
24 * this function must be called with even lengths, except
25 * for the last fragment, which may be odd
26 *
27 * it's best to have buff aligned on a 32-bit boundary
28 */
29asmlinkage __wsum csum_partial(const void *buff, int len, __wsum sum);
30
31/*
32 * the same as csum_partial, but copies from src while it
33 * checksums, and handles user-space pointer exceptions correctly, when needed.
34 *
35 * here even more important to align src and dst on a 32-bit (or even
36 * better 64-bit) boundary
37 */
38
39asmlinkage __wsum csum_partial_copy_generic(const void *src, void *dst, int len, __wsum sum,
40 int *src_err_ptr, int *dst_err_ptr);
41
42/*
43 * Note: when you get a NULL pointer exception here this means someone
44 * passed in an incorrect kernel address to one of these functions.
45 *
46 * If you use these functions directly please don't forget the access_ok().
47 */
48static inline
49__wsum csum_partial_copy_nocheck(const void *src, void *dst,
50 int len, __wsum sum)
51{
52 return csum_partial_copy_generic(src, dst, len, sum, NULL, NULL);
53}
54
55static inline
56__wsum csum_partial_copy_from_user(const void __user *src, void *dst,
57 int len, __wsum sum, int *err_ptr)
58{
59 return csum_partial_copy_generic((__force const void *)src, dst,
60 len, sum, err_ptr, NULL);
61}
62
63/*
64 * Fold a partial checksum
65 */
66
67static __inline__ __sum16 csum_fold(__wsum sum)
68{
69 unsigned int __dummy;
70 __asm__("extui %1, %0, 16, 16\n\t"
71 "extui %0 ,%0, 0, 16\n\t"
72 "add %0, %0, %1\n\t"
73 "slli %1, %0, 16\n\t"
74 "add %0, %0, %1\n\t"
75 "extui %0, %0, 16, 16\n\t"
76 "neg %0, %0\n\t"
77 "addi %0, %0, -1\n\t"
78 "extui %0, %0, 0, 16\n\t"
79 : "=r" (sum), "=&r" (__dummy)
80 : "0" (sum));
81 return (__force __sum16)sum;
82}
83
84/*
85 * This is a version of ip_compute_csum() optimized for IP headers,
86 * which always checksum on 4 octet boundaries.
87 */
88static __inline__ __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
89{
90 unsigned int sum, tmp, endaddr;
91
92 __asm__ __volatile__(
93 "sub %0, %0, %0\n\t"
94#if XCHAL_HAVE_LOOPS
95 "loopgtz %2, 2f\n\t"
96#else
97 "beqz %2, 2f\n\t"
98 "slli %4, %2, 2\n\t"
99 "add %4, %4, %1\n\t"
100 "0:\t"
101#endif
102 "l32i %3, %1, 0\n\t"
103 "add %0, %0, %3\n\t"
104 "bgeu %0, %3, 1f\n\t"
105 "addi %0, %0, 1\n\t"
106 "1:\t"
107 "addi %1, %1, 4\n\t"
108#if !XCHAL_HAVE_LOOPS
109 "blt %1, %4, 0b\n\t"
110#endif
111 "2:\t"
112 /* Since the input registers which are loaded with iph and ihl
113 are modified, we must also specify them as outputs, or gcc
114 will assume they contain their original values. */
115 : "=r" (sum), "=r" (iph), "=r" (ihl), "=&r" (tmp), "=&r" (endaddr)
116 : "1" (iph), "2" (ihl));
117
118 return csum_fold(sum);
119}
120
121static __inline__ __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
122 unsigned short len,
123 unsigned short proto,
124 __wsum sum)
125{
126
127#ifdef __XTENSA_EL__
128 unsigned long len_proto = (len + proto) << 8;
129#elif defined(__XTENSA_EB__)
130 unsigned long len_proto = len + proto;
131#else
132# error processor byte order undefined!
133#endif
134 __asm__("add %0, %0, %1\n\t"
135 "bgeu %0, %1, 1f\n\t"
136 "addi %0, %0, 1\n\t"
137 "1:\t"
138 "add %0, %0, %2\n\t"
139 "bgeu %0, %2, 1f\n\t"
140 "addi %0, %0, 1\n\t"
141 "1:\t"
142 "add %0, %0, %3\n\t"
143 "bgeu %0, %3, 1f\n\t"
144 "addi %0, %0, 1\n\t"
145 "1:\t"
146 : "=r" (sum), "=r" (len_proto)
147 : "r" (daddr), "r" (saddr), "1" (len_proto), "0" (sum));
148 return sum;
149}
150
151/*
152 * computes the checksum of the TCP/UDP pseudo-header
153 * returns a 16-bit checksum, already complemented
154 */
155static __inline__ __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
156 unsigned short len,
157 unsigned short proto,
158 __wsum sum)
159{
160 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
161}
162
163/*
164 * this routine is used for miscellaneous IP-like checksums, mainly
165 * in icmp.c
166 */
167
168static __inline__ __sum16 ip_compute_csum(const void *buff, int len)
169{
170 return csum_fold (csum_partial(buff, len, 0));
171}
172
173#define _HAVE_ARCH_IPV6_CSUM
174static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
175 const struct in6_addr *daddr,
176 __u32 len, unsigned short proto,
177 __wsum sum)
178{
179 unsigned int __dummy;
180 __asm__("l32i %1, %2, 0\n\t"
181 "add %0, %0, %1\n\t"
182 "bgeu %0, %1, 1f\n\t"
183 "addi %0, %0, 1\n\t"
184 "1:\t"
185 "l32i %1, %2, 4\n\t"
186 "add %0, %0, %1\n\t"
187 "bgeu %0, %1, 1f\n\t"
188 "addi %0, %0, 1\n\t"
189 "1:\t"
190 "l32i %1, %2, 8\n\t"
191 "add %0, %0, %1\n\t"
192 "bgeu %0, %1, 1f\n\t"
193 "addi %0, %0, 1\n\t"
194 "1:\t"
195 "l32i %1, %2, 12\n\t"
196 "add %0, %0, %1\n\t"
197 "bgeu %0, %1, 1f\n\t"
198 "addi %0, %0, 1\n\t"
199 "1:\t"
200 "l32i %1, %3, 0\n\t"
201 "add %0, %0, %1\n\t"
202 "bgeu %0, %1, 1f\n\t"
203 "addi %0, %0, 1\n\t"
204 "1:\t"
205 "l32i %1, %3, 4\n\t"
206 "add %0, %0, %1\n\t"
207 "bgeu %0, %1, 1f\n\t"
208 "addi %0, %0, 1\n\t"
209 "1:\t"
210 "l32i %1, %3, 8\n\t"
211 "add %0, %0, %1\n\t"
212 "bgeu %0, %1, 1f\n\t"
213 "addi %0, %0, 1\n\t"
214 "1:\t"
215 "l32i %1, %3, 12\n\t"
216 "add %0, %0, %1\n\t"
217 "bgeu %0, %1, 1f\n\t"
218 "addi %0, %0, 1\n\t"
219 "1:\t"
220 "add %0, %0, %4\n\t"
221 "bgeu %0, %4, 1f\n\t"
222 "addi %0, %0, 1\n\t"
223 "1:\t"
224 "add %0, %0, %5\n\t"
225 "bgeu %0, %5, 1f\n\t"
226 "addi %0, %0, 1\n\t"
227 "1:\t"
228 : "=r" (sum), "=&r" (__dummy)
229 : "r" (saddr), "r" (daddr),
230 "r" (htonl(len)), "r" (htonl(proto)), "0" (sum));
231
232 return csum_fold(sum);
233}
234
235/*
236 * Copy and checksum to user
237 */
238#define HAVE_CSUM_COPY_USER
239static __inline__ __wsum csum_and_copy_to_user(const void *src, void __user *dst,
240 int len, __wsum sum, int *err_ptr)
241{
242 if (access_ok(VERIFY_WRITE, dst, len))
243 return csum_partial_copy_generic(src, dst, len, sum, NULL, err_ptr);
244
245 if (len)
246 *err_ptr = -EFAULT;
247
248 return (__force __wsum)-1; /* invalid checksum */
249}
250#endif
diff --git a/include/asm-xtensa/coprocessor.h b/include/asm-xtensa/coprocessor.h
deleted file mode 100644
index 1cbcf9001a41..000000000000
--- a/include/asm-xtensa/coprocessor.h
+++ /dev/null
@@ -1,177 +0,0 @@
1/*
2 * include/asm-xtensa/coprocessor.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2003 - 2007 Tensilica Inc.
9 */
10
11
12#ifndef _XTENSA_COPROCESSOR_H
13#define _XTENSA_COPROCESSOR_H
14
15#include <linux/stringify.h>
16#include <asm/variant/tie.h>
17#include <asm/types.h>
18
19#ifdef __ASSEMBLY__
20# include <asm/variant/tie-asm.h>
21
22.macro xchal_sa_start a b
23 .set .Lxchal_pofs_, 0
24 .set .Lxchal_ofs_, 0
25.endm
26
27.macro xchal_sa_align ptr minofs maxofs ofsalign totalign
28 .set .Lxchal_ofs_, .Lxchal_ofs_ + .Lxchal_pofs_ + \totalign - 1
29 .set .Lxchal_ofs_, (.Lxchal_ofs_ & -\totalign) - .Lxchal_pofs_
30.endm
31
32#define _SELECT ( XTHAL_SAS_TIE | XTHAL_SAS_OPT \
33 | XTHAL_SAS_CC \
34 | XTHAL_SAS_CALR | XTHAL_SAS_CALE )
35
36.macro save_xtregs_opt ptr clb at1 at2 at3 at4 offset
37 .if XTREGS_OPT_SIZE > 0
38 addi \clb, \ptr, \offset
39 xchal_ncp_store \clb \at1 \at2 \at3 \at4 select=_SELECT
40 .endif
41.endm
42
43.macro load_xtregs_opt ptr clb at1 at2 at3 at4 offset
44 .if XTREGS_OPT_SIZE > 0
45 addi \clb, \ptr, \offset
46 xchal_ncp_load \clb \at1 \at2 \at3 \at4 select=_SELECT
47 .endif
48.endm
49#undef _SELECT
50
51#define _SELECT ( XTHAL_SAS_TIE | XTHAL_SAS_OPT \
52 | XTHAL_SAS_NOCC \
53 | XTHAL_SAS_CALR | XTHAL_SAS_CALE | XTHAL_SAS_GLOB )
54
55.macro save_xtregs_user ptr clb at1 at2 at3 at4 offset
56 .if XTREGS_USER_SIZE > 0
57 addi \clb, \ptr, \offset
58 xchal_ncp_store \clb \at1 \at2 \at3 \at4 select=_SELECT
59 .endif
60.endm
61
62.macro load_xtregs_user ptr clb at1 at2 at3 at4 offset
63 .if XTREGS_USER_SIZE > 0
64 addi \clb, \ptr, \offset
65 xchal_ncp_load \clb \at1 \at2 \at3 \at4 select=_SELECT
66 .endif
67.endm
68#undef _SELECT
69
70
71
72#endif /* __ASSEMBLY__ */
73
74/*
75 * XTENSA_HAVE_COPROCESSOR(x) returns 1 if coprocessor x is configured.
76 *
77 * XTENSA_HAVE_IO_PORT(x) returns 1 if io-port x is configured.
78 *
79 */
80
81#define XTENSA_HAVE_COPROCESSOR(x) \
82 ((XCHAL_CP_MASK ^ XCHAL_CP_PORT_MASK) & (1 << (x)))
83#define XTENSA_HAVE_COPROCESSORS \
84 (XCHAL_CP_MASK ^ XCHAL_CP_PORT_MASK)
85#define XTENSA_HAVE_IO_PORT(x) \
86 (XCHAL_CP_PORT_MASK & (1 << (x)))
87#define XTENSA_HAVE_IO_PORTS \
88 XCHAL_CP_PORT_MASK
89
90#ifndef __ASSEMBLY__
91
92
93#if XCHAL_HAVE_CP
94
95#define RSR_CPENABLE(x) do { \
96 __asm__ __volatile__("rsr %0," __stringify(CPENABLE) : "=a" (x)); \
97 } while(0);
98#define WSR_CPENABLE(x) do { \
99 __asm__ __volatile__("wsr %0," __stringify(CPENABLE) "; rsync" \
100 :: "a" (x)); \
101 } while(0);
102
103#endif /* XCHAL_HAVE_CP */
104
105
106/*
107 * Additional registers.
108 * We define three types of additional registers:
109 * ext: extra registers that are used by the compiler
110 * cpn: optional registers that can be used by a user application
111 * cpX: coprocessor registers that can only be used if the corresponding
112 * CPENABLE bit is set.
113 */
114
115#define XCHAL_SA_REG(list,cc,abi,type,y,name,z,align,size,...) \
116 __REG ## list (cc, abi, type, name, size, align)
117
118#define __REG0(cc,abi,t,name,s,a) __REG0_ ## cc (abi,name)
119#define __REG1(cc,abi,t,name,s,a) __REG1_ ## cc (name)
120#define __REG2(cc,abi,type,...) __REG2_ ## type (__VA_ARGS__)
121
122#define __REG0_0(abi,name)
123#define __REG0_1(abi,name) __REG0_1 ## abi (name)
124#define __REG0_10(name) __u32 name;
125#define __REG0_11(name) __u32 name;
126#define __REG0_12(name)
127
128#define __REG1_0(name) __u32 name;
129#define __REG1_1(name)
130
131#define __REG2_0(n,s,a) __u32 name;
132#define __REG2_1(n,s,a) unsigned char n[s] __attribute__ ((aligned(a)));
133#define __REG2_2(n,s,a) unsigned char n[s] __attribute__ ((aligned(a)));
134
135typedef struct { XCHAL_NCP_SA_LIST(0) } xtregs_opt_t
136 __attribute__ ((aligned (XCHAL_NCP_SA_ALIGN)));
137typedef struct { XCHAL_NCP_SA_LIST(1) } xtregs_user_t
138 __attribute__ ((aligned (XCHAL_NCP_SA_ALIGN)));
139
140#if XTENSA_HAVE_COPROCESSORS
141
142typedef struct { XCHAL_CP0_SA_LIST(2) } xtregs_cp0_t
143 __attribute__ ((aligned (XCHAL_CP0_SA_ALIGN)));
144typedef struct { XCHAL_CP1_SA_LIST(2) } xtregs_cp1_t
145 __attribute__ ((aligned (XCHAL_CP1_SA_ALIGN)));
146typedef struct { XCHAL_CP2_SA_LIST(2) } xtregs_cp2_t
147 __attribute__ ((aligned (XCHAL_CP2_SA_ALIGN)));
148typedef struct { XCHAL_CP3_SA_LIST(2) } xtregs_cp3_t
149 __attribute__ ((aligned (XCHAL_CP3_SA_ALIGN)));
150typedef struct { XCHAL_CP4_SA_LIST(2) } xtregs_cp4_t
151 __attribute__ ((aligned (XCHAL_CP4_SA_ALIGN)));
152typedef struct { XCHAL_CP5_SA_LIST(2) } xtregs_cp5_t
153 __attribute__ ((aligned (XCHAL_CP5_SA_ALIGN)));
154typedef struct { XCHAL_CP6_SA_LIST(2) } xtregs_cp6_t
155 __attribute__ ((aligned (XCHAL_CP6_SA_ALIGN)));
156typedef struct { XCHAL_CP7_SA_LIST(2) } xtregs_cp7_t
157 __attribute__ ((aligned (XCHAL_CP7_SA_ALIGN)));
158
159extern struct thread_info* coprocessor_owner[XCHAL_CP_MAX];
160extern void coprocessor_save(void*, int);
161extern void coprocessor_load(void*, int);
162extern void coprocessor_flush(struct thread_info*, int);
163extern void coprocessor_restore(struct thread_info*, int);
164
165extern void coprocessor_release_all(struct thread_info*);
166extern void coprocessor_flush_all(struct thread_info*);
167
168static inline void coprocessor_clear_cpenable(void)
169{
170 unsigned long i = 0;
171 WSR_CPENABLE(i);
172}
173
174#endif /* XTENSA_HAVE_COPROCESSORS */
175
176#endif /* !__ASSEMBLY__ */
177#endif /* _XTENSA_COPROCESSOR_H */
diff --git a/include/asm-xtensa/cpumask.h b/include/asm-xtensa/cpumask.h
deleted file mode 100644
index ebeede397db3..000000000000
--- a/include/asm-xtensa/cpumask.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * include/asm-xtensa/cpumask.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_CPUMASK_H
12#define _XTENSA_CPUMASK_H
13
14#include <asm-generic/cpumask.h>
15
16#endif /* _XTENSA_CPUMASK_H */
diff --git a/include/asm-xtensa/cputime.h b/include/asm-xtensa/cputime.h
deleted file mode 100644
index a7fb864a50ae..000000000000
--- a/include/asm-xtensa/cputime.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _XTENSA_CPUTIME_H
2#define _XTENSA_CPUTIME_H
3
4#include <asm-generic/cputime.h>
5
6#endif /* _XTENSA_CPUTIME_H */
diff --git a/include/asm-xtensa/current.h b/include/asm-xtensa/current.h
deleted file mode 100644
index 8d1eb5d78649..000000000000
--- a/include/asm-xtensa/current.h
+++ /dev/null
@@ -1,38 +0,0 @@
1/*
2 * include/asm-xtensa/current.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_CURRENT_H
12#define _XTENSA_CURRENT_H
13
14#ifndef __ASSEMBLY__
15
16#include <linux/thread_info.h>
17
18struct task_struct;
19
20static inline struct task_struct *get_current(void)
21{
22 return current_thread_info()->task;
23}
24
25#define current get_current()
26
27#else
28
29#define CURRENT_SHIFT 13
30
31#define GET_CURRENT(reg,sp) \
32 GET_THREAD_INFO(reg,sp); \
33 l32i reg, reg, TI_TASK \
34
35#endif
36
37
38#endif /* XTENSA_CURRENT_H */
diff --git a/include/asm-xtensa/delay.h b/include/asm-xtensa/delay.h
deleted file mode 100644
index e1d8c9e010c1..000000000000
--- a/include/asm-xtensa/delay.h
+++ /dev/null
@@ -1,49 +0,0 @@
1/*
2 * include/asm-xtensa/delay.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 *
10 */
11
12#ifndef _XTENSA_DELAY_H
13#define _XTENSA_DELAY_H
14
15#include <asm/processor.h>
16#include <asm/param.h>
17
18extern unsigned long loops_per_jiffy;
19
20static inline void __delay(unsigned long loops)
21{
22 /* 2 cycles per loop. */
23 __asm__ __volatile__ ("1: addi %0, %0, -2; bgeui %0, 2, 1b"
24 : "=r" (loops) : "0" (loops));
25}
26
27static __inline__ u32 xtensa_get_ccount(void)
28{
29 u32 ccount;
30 asm volatile ("rsr %0, 234; # CCOUNT\n" : "=r" (ccount));
31 return ccount;
32}
33
34/* For SMP/NUMA systems, change boot_cpu_data to something like
35 * local_cpu_data->... where local_cpu_data points to the current
36 * cpu. */
37
38static __inline__ void udelay (unsigned long usecs)
39{
40 unsigned long start = xtensa_get_ccount();
41 unsigned long cycles = usecs * (loops_per_jiffy / (1000000UL / HZ));
42
43 /* Note: all variables are unsigned (can wrap around)! */
44 while (((unsigned long)xtensa_get_ccount()) - start < cycles)
45 ;
46}
47
48#endif
49
diff --git a/include/asm-xtensa/device.h b/include/asm-xtensa/device.h
deleted file mode 100644
index d8f9872b0e2d..000000000000
--- a/include/asm-xtensa/device.h
+++ /dev/null
@@ -1,7 +0,0 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-xtensa/div64.h b/include/asm-xtensa/div64.h
deleted file mode 100644
index f35678cb0a9b..000000000000
--- a/include/asm-xtensa/div64.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * include/asm-xtensa/div64.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2007 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_DIV64_H
12#define _XTENSA_DIV64_H
13
14#include <asm-generic/div64.h>
15
16#endif /* _XTENSA_DIV64_H */
diff --git a/include/asm-xtensa/dma-mapping.h b/include/asm-xtensa/dma-mapping.h
deleted file mode 100644
index 51882ae3db4d..000000000000
--- a/include/asm-xtensa/dma-mapping.h
+++ /dev/null
@@ -1,179 +0,0 @@
1/*
2 * include/asm-xtensa/dma-mapping.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2003 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_DMA_MAPPING_H
12#define _XTENSA_DMA_MAPPING_H
13
14#include <asm/cache.h>
15#include <asm/io.h>
16#include <linux/mm.h>
17#include <linux/scatterlist.h>
18
19/*
20 * DMA-consistent mapping functions.
21 */
22
23extern void *consistent_alloc(int, size_t, dma_addr_t, unsigned long);
24extern void consistent_free(void*, size_t, dma_addr_t);
25extern void consistent_sync(void*, size_t, int);
26
27#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
28#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
29
30void *dma_alloc_coherent(struct device *dev, size_t size,
31 dma_addr_t *dma_handle, gfp_t flag);
32
33void dma_free_coherent(struct device *dev, size_t size,
34 void *vaddr, dma_addr_t dma_handle);
35
36static inline dma_addr_t
37dma_map_single(struct device *dev, void *ptr, size_t size,
38 enum dma_data_direction direction)
39{
40 BUG_ON(direction == DMA_NONE);
41 consistent_sync(ptr, size, direction);
42 return virt_to_phys(ptr);
43}
44
45static inline void
46dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
47 enum dma_data_direction direction)
48{
49 BUG_ON(direction == DMA_NONE);
50}
51
52static inline int
53dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
54 enum dma_data_direction direction)
55{
56 int i;
57
58 BUG_ON(direction == DMA_NONE);
59
60 for (i = 0; i < nents; i++, sg++ ) {
61 BUG_ON(!sg_page(sg));
62
63 sg->dma_address = sg_phys(sg);
64 consistent_sync(sg_virt(sg), sg->length, direction);
65 }
66
67 return nents;
68}
69
70static inline dma_addr_t
71dma_map_page(struct device *dev, struct page *page, unsigned long offset,
72 size_t size, enum dma_data_direction direction)
73{
74 BUG_ON(direction == DMA_NONE);
75 return (dma_addr_t)(page_to_pfn(page)) * PAGE_SIZE + offset;
76}
77
78static inline void
79dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
80 enum dma_data_direction direction)
81{
82 BUG_ON(direction == DMA_NONE);
83}
84
85
86static inline void
87dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
88 enum dma_data_direction direction)
89{
90 BUG_ON(direction == DMA_NONE);
91}
92
93static inline void
94dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size,
95 enum dma_data_direction direction)
96{
97 consistent_sync((void *)bus_to_virt(dma_handle), size, direction);
98}
99
100static inline void
101dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t size,
102 enum dma_data_direction direction)
103{
104 consistent_sync((void *)bus_to_virt(dma_handle), size, direction);
105}
106
107static inline void
108dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle,
109 unsigned long offset, size_t size,
110 enum dma_data_direction direction)
111{
112
113 consistent_sync((void *)bus_to_virt(dma_handle)+offset,size,direction);
114}
115
116static inline void
117dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle,
118 unsigned long offset, size_t size,
119 enum dma_data_direction direction)
120{
121
122 consistent_sync((void *)bus_to_virt(dma_handle)+offset,size,direction);
123}
124static inline void
125dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
126 enum dma_data_direction dir)
127{
128 int i;
129 for (i = 0; i < nelems; i++, sg++)
130 consistent_sync(sg_virt(sg), sg->length, dir);
131}
132
133static inline void
134dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems,
135 enum dma_data_direction dir)
136{
137 int i;
138 for (i = 0; i < nelems; i++, sg++)
139 consistent_sync(sg_virt(sg), sg->length, dir);
140}
141static inline int
142dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
143{
144 return 0;
145}
146
147static inline int
148dma_supported(struct device *dev, u64 mask)
149{
150 return 1;
151}
152
153static inline int
154dma_set_mask(struct device *dev, u64 mask)
155{
156 if(!dev->dma_mask || !dma_supported(dev, mask))
157 return -EIO;
158
159 *dev->dma_mask = mask;
160
161 return 0;
162}
163
164static inline int
165dma_get_cache_alignment(void)
166{
167 return L1_CACHE_BYTES;
168}
169
170#define dma_is_consistent(d, h) (1)
171
172static inline void
173dma_cache_sync(struct device *dev, void *vaddr, size_t size,
174 enum dma_data_direction direction)
175{
176 consistent_sync(vaddr, size, direction);
177}
178
179#endif /* _XTENSA_DMA_MAPPING_H */
diff --git a/include/asm-xtensa/dma.h b/include/asm-xtensa/dma.h
deleted file mode 100644
index e30f3abf48f0..000000000000
--- a/include/asm-xtensa/dma.h
+++ /dev/null
@@ -1,61 +0,0 @@
1/*
2 * include/asm-xtensa/dma.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2003 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_DMA_H
12#define _XTENSA_DMA_H
13
14#include <asm/io.h> /* need byte IO */
15
16/*
17 * This is only to be defined if we have PC-like DMA.
18 * By default this is not true on an Xtensa processor,
19 * however on boards with a PCI bus, such functionality
20 * might be emulated externally.
21 *
22 * NOTE: there still exists driver code that assumes
23 * this is defined, eg. drivers/sound/soundcard.c (as of 2.4).
24 */
25#define MAX_DMA_CHANNELS 8
26
27/*
28 * The maximum virtual address to which DMA transfers
29 * can be performed on this platform.
30 *
31 * NOTE: This is board (platform) specific, not processor-specific!
32 *
33 * NOTE: This assumes DMA transfers can only be performed on
34 * the section of physical memory contiguously mapped in virtual
35 * space for the kernel. For the Xtensa architecture, this
36 * means the maximum possible size of this DMA area is
37 * the size of the statically mapped kernel segment
38 * (XCHAL_KSEG_{CACHED,BYPASS}_SIZE), ie. 128 MB.
39 *
40 * NOTE: When the entire KSEG area is DMA capable, we substract
41 * one from the max address so that the virt_to_phys() macro
42 * works correctly on the address (otherwise the address
43 * enters another area, and virt_to_phys() may not return
44 * the value desired).
45 */
46
47#define MAX_DMA_ADDRESS (PAGE_OFFSET + XCHAL_KIO_SIZE - 1)
48
49
50/* Reserve and release a DMA channel */
51extern int request_dma(unsigned int dmanr, const char * device_id);
52extern void free_dma(unsigned int dmanr);
53
54#ifdef CONFIG_PCI
55extern int isa_dma_bridge_buggy;
56#else
57#define isa_dma_bridge_buggy (0)
58#endif
59
60
61#endif
diff --git a/include/asm-xtensa/elf.h b/include/asm-xtensa/elf.h
deleted file mode 100644
index c3f53e755ca5..000000000000
--- a/include/asm-xtensa/elf.h
+++ /dev/null
@@ -1,205 +0,0 @@
1/*
2 * include/asm-xtensa/elf.h
3 *
4 * ELF register definitions
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 *
10 * Copyright (C) 2001 - 2005 Tensilica Inc.
11 */
12
13#ifndef _XTENSA_ELF_H
14#define _XTENSA_ELF_H
15
16#include <asm/ptrace.h>
17
18/* Xtensa processor ELF architecture-magic number */
19
20#define EM_XTENSA 94
21#define EM_XTENSA_OLD 0xABC7
22
23/* Xtensa relocations defined by the ABIs */
24
25#define R_XTENSA_NONE 0
26#define R_XTENSA_32 1
27#define R_XTENSA_RTLD 2
28#define R_XTENSA_GLOB_DAT 3
29#define R_XTENSA_JMP_SLOT 4
30#define R_XTENSA_RELATIVE 5
31#define R_XTENSA_PLT 6
32#define R_XTENSA_OP0 8
33#define R_XTENSA_OP1 9
34#define R_XTENSA_OP2 10
35#define R_XTENSA_ASM_EXPAND 11
36#define R_XTENSA_ASM_SIMPLIFY 12
37#define R_XTENSA_GNU_VTINHERIT 15
38#define R_XTENSA_GNU_VTENTRY 16
39#define R_XTENSA_DIFF8 17
40#define R_XTENSA_DIFF16 18
41#define R_XTENSA_DIFF32 19
42#define R_XTENSA_SLOT0_OP 20
43#define R_XTENSA_SLOT1_OP 21
44#define R_XTENSA_SLOT2_OP 22
45#define R_XTENSA_SLOT3_OP 23
46#define R_XTENSA_SLOT4_OP 24
47#define R_XTENSA_SLOT5_OP 25
48#define R_XTENSA_SLOT6_OP 26
49#define R_XTENSA_SLOT7_OP 27
50#define R_XTENSA_SLOT8_OP 28
51#define R_XTENSA_SLOT9_OP 29
52#define R_XTENSA_SLOT10_OP 30
53#define R_XTENSA_SLOT11_OP 31
54#define R_XTENSA_SLOT12_OP 32
55#define R_XTENSA_SLOT13_OP 33
56#define R_XTENSA_SLOT14_OP 34
57#define R_XTENSA_SLOT0_ALT 35
58#define R_XTENSA_SLOT1_ALT 36
59#define R_XTENSA_SLOT2_ALT 37
60#define R_XTENSA_SLOT3_ALT 38
61#define R_XTENSA_SLOT4_ALT 39
62#define R_XTENSA_SLOT5_ALT 40
63#define R_XTENSA_SLOT6_ALT 41
64#define R_XTENSA_SLOT7_ALT 42
65#define R_XTENSA_SLOT8_ALT 43
66#define R_XTENSA_SLOT9_ALT 44
67#define R_XTENSA_SLOT10_ALT 45
68#define R_XTENSA_SLOT11_ALT 46
69#define R_XTENSA_SLOT12_ALT 47
70#define R_XTENSA_SLOT13_ALT 48
71#define R_XTENSA_SLOT14_ALT 49
72
73/* ELF register definitions. This is needed for core dump support. */
74
75typedef unsigned long elf_greg_t;
76
77typedef struct {
78 elf_greg_t pc;
79 elf_greg_t ps;
80 elf_greg_t lbeg;
81 elf_greg_t lend;
82 elf_greg_t lcount;
83 elf_greg_t sar;
84 elf_greg_t windowstart;
85 elf_greg_t windowbase;
86 elf_greg_t reserved[8+48];
87 elf_greg_t a[64];
88} xtensa_gregset_t;
89
90#define ELF_NGREG (sizeof(xtensa_gregset_t) / sizeof(elf_greg_t))
91
92typedef elf_greg_t elf_gregset_t[ELF_NGREG];
93
94#define ELF_NFPREG 18
95
96typedef unsigned int elf_fpreg_t;
97typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
98
99#define ELF_CORE_COPY_REGS(_eregs, _pregs) \
100 xtensa_elf_core_copy_regs ((xtensa_gregset_t*)&(_eregs), _pregs);
101
102extern void xtensa_elf_core_copy_regs (xtensa_gregset_t *, struct pt_regs *);
103
104/*
105 * This is used to ensure we don't load something for the wrong architecture.
106 */
107
108#define elf_check_arch(x) ( ( (x)->e_machine == EM_XTENSA ) || \
109 ( (x)->e_machine == EM_XTENSA_OLD ) )
110
111/*
112 * These are used to set parameters in the core dumps.
113 */
114
115#ifdef __XTENSA_EL__
116# define ELF_DATA ELFDATA2LSB
117#elif defined(__XTENSA_EB__)
118# define ELF_DATA ELFDATA2MSB
119#else
120# error processor byte order undefined!
121#endif
122
123#define ELF_CLASS ELFCLASS32
124#define ELF_ARCH EM_XTENSA
125
126#define USE_ELF_CORE_DUMP
127#define ELF_EXEC_PAGESIZE PAGE_SIZE
128
129/*
130 * This is the location that an ET_DYN program is loaded if exec'ed. Typical
131 * use of this is to invoke "./ld.so someprog" to test out a new version of
132 * the loader. We need to make sure that it is out of the way of the program
133 * that it will "exec", and that there is sufficient room for the brk.
134 */
135
136#define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3)
137
138/*
139 * This yields a mask that user programs can use to figure out what
140 * instruction set this CPU supports. This could be done in user space,
141 * but it's not easy, and we've already done it here.
142 */
143
144#define ELF_HWCAP (0)
145
146/*
147 * This yields a string that ld.so will use to load implementation
148 * specific libraries for optimization. This is more specific in
149 * intent than poking at uname or /proc/cpuinfo.
150 * For the moment, we have only optimizations for the Intel generations,
151 * but that could change...
152 */
153
154#define ELF_PLATFORM (NULL)
155
156/*
157 * The Xtensa processor ABI says that when the program starts, a2
158 * contains a pointer to a function which might be registered using
159 * `atexit'. This provides a mean for the dynamic linker to call
160 * DT_FINI functions for shared libraries that have been loaded before
161 * the code runs.
162 *
163 * A value of 0 tells we have no such handler.
164 *
165 * We might as well make sure everything else is cleared too (except
166 * for the stack pointer in a1), just to make things more
167 * deterministic. Also, clearing a0 terminates debugger backtraces.
168 */
169
170#define ELF_PLAT_INIT(_r, load_addr) \
171 do { _r->areg[0]=0; /*_r->areg[1]=0;*/ _r->areg[2]=0; _r->areg[3]=0; \
172 _r->areg[4]=0; _r->areg[5]=0; _r->areg[6]=0; _r->areg[7]=0; \
173 _r->areg[8]=0; _r->areg[9]=0; _r->areg[10]=0; _r->areg[11]=0; \
174 _r->areg[12]=0; _r->areg[13]=0; _r->areg[14]=0; _r->areg[15]=0; \
175 } while (0)
176
177typedef struct {
178 xtregs_opt_t opt;
179 xtregs_user_t user;
180#if XTENSA_HAVE_COPROCESSORS
181 xtregs_cp0_t cp0;
182 xtregs_cp1_t cp1;
183 xtregs_cp2_t cp2;
184 xtregs_cp3_t cp3;
185 xtregs_cp4_t cp4;
186 xtregs_cp5_t cp5;
187 xtregs_cp6_t cp6;
188 xtregs_cp7_t cp7;
189#endif
190} elf_xtregs_t;
191
192#define SET_PERSONALITY(ex) set_personality(PER_LINUX_32BIT)
193
194struct task_struct;
195
196extern void do_copy_regs (xtensa_gregset_t*, struct pt_regs*,
197 struct task_struct*);
198extern void do_restore_regs (xtensa_gregset_t*, struct pt_regs*,
199 struct task_struct*);
200extern void do_save_fpregs (elf_fpregset_t*, struct pt_regs*,
201 struct task_struct*);
202extern int do_restore_fpregs (elf_fpregset_t*, struct pt_regs*,
203 struct task_struct*);
204
205#endif /* _XTENSA_ELF_H */
diff --git a/include/asm-xtensa/emergency-restart.h b/include/asm-xtensa/emergency-restart.h
deleted file mode 100644
index 108d8c48e42e..000000000000
--- a/include/asm-xtensa/emergency-restart.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_EMERGENCY_RESTART_H
2#define _ASM_EMERGENCY_RESTART_H
3
4#include <asm-generic/emergency-restart.h>
5
6#endif /* _ASM_EMERGENCY_RESTART_H */
diff --git a/include/asm-xtensa/errno.h b/include/asm-xtensa/errno.h
deleted file mode 100644
index a0f3b96b79b4..000000000000
--- a/include/asm-xtensa/errno.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * include/asm-xtensa/errno.h
3 *
4 * This file is subject to the terms and conditions of the GNU General
5 * Public License. See the file "COPYING" in the main directory of
6 * this archive for more details.
7 *
8 * Copyright (C) 2002 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_ERRNO_H
12#define _XTENSA_ERRNO_H
13
14#include <asm-generic/errno.h>
15
16#endif /* _XTENSA_ERRNO_H */
diff --git a/include/asm-xtensa/fb.h b/include/asm-xtensa/fb.h
deleted file mode 100644
index c7df38030992..000000000000
--- a/include/asm-xtensa/fb.h
+++ /dev/null
@@ -1,12 +0,0 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3#include <linux/fb.h>
4
5#define fb_pgprotect(...) do {} while (0)
6
7static inline int fb_is_primary_device(struct fb_info *info)
8{
9 return 0;
10}
11
12#endif /* _ASM_FB_H_ */
diff --git a/include/asm-xtensa/fcntl.h b/include/asm-xtensa/fcntl.h
deleted file mode 100644
index 46ab12db5739..000000000000
--- a/include/asm-xtensa/fcntl.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/fcntl.h>
diff --git a/include/asm-xtensa/futex.h b/include/asm-xtensa/futex.h
deleted file mode 100644
index 0b745828f42b..000000000000
--- a/include/asm-xtensa/futex.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/futex.h>
diff --git a/include/asm-xtensa/hardirq.h b/include/asm-xtensa/hardirq.h
deleted file mode 100644
index 87cb19d1b10c..000000000000
--- a/include/asm-xtensa/hardirq.h
+++ /dev/null
@@ -1,28 +0,0 @@
1/*
2 * include/asm-xtensa/hardirq.h
3 *
4 * This file is subject to the terms and conditions of the GNU General
5 * Public License. See the file "COPYING" in the main directory of
6 * this archive for more details.
7 *
8 * Copyright (C) 2002 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_HARDIRQ_H
12#define _XTENSA_HARDIRQ_H
13
14#include <linux/cache.h>
15#include <asm/irq.h>
16
17/* headers.S is sensitive to the offsets of these fields */
18typedef struct {
19 unsigned int __softirq_pending;
20 unsigned int __syscall_count;
21 struct task_struct * __ksoftirqd_task; /* waitqueue is too large */
22 unsigned int __nmi_count; /* arch dependent */
23} ____cacheline_aligned irq_cpustat_t;
24
25void ack_bad_irq(unsigned int irq);
26#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
27
28#endif /* _XTENSA_HARDIRQ_H */
diff --git a/include/asm-xtensa/highmem.h b/include/asm-xtensa/highmem.h
deleted file mode 100644
index 0a046ca5a687..000000000000
--- a/include/asm-xtensa/highmem.h
+++ /dev/null
@@ -1,17 +0,0 @@
1/*
2 * include/asm-xtensa/highmem.h
3 *
4 * This file is subject to the terms and conditions of the GNU General
5 * Public License. See the file "COPYING" in the main directory of
6 * this archive for more details.
7 *
8 * Copyright (C) 2003 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_HIGHMEM_H
12#define _XTENSA_HIGHMEM_H
13
14extern void flush_cache_kmaps(void);
15
16#endif
17
diff --git a/include/asm-xtensa/hw_irq.h b/include/asm-xtensa/hw_irq.h
deleted file mode 100644
index 3ddbea759b2b..000000000000
--- a/include/asm-xtensa/hw_irq.h
+++ /dev/null
@@ -1,14 +0,0 @@
1/*
2 * include/asm-xtensa/hw_irq.h
3 *
4 * This file is subject to the terms and conditions of the GNU General
5 * Public License. See the file "COPYING" in the main directory of
6 * this archive for more details.
7 *
8 * Copyright (C) 2002 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_HW_IRQ_H
12#define _XTENSA_HW_IRQ_H
13
14#endif
diff --git a/include/asm-xtensa/io.h b/include/asm-xtensa/io.h
deleted file mode 100644
index 07b7299dab20..000000000000
--- a/include/asm-xtensa/io.h
+++ /dev/null
@@ -1,200 +0,0 @@
1/*
2 * include/asm-xtensa/io.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_IO_H
12#define _XTENSA_IO_H
13
14#ifdef __KERNEL__
15#include <asm/byteorder.h>
16#include <asm/page.h>
17#include <linux/kernel.h>
18
19#include <linux/types.h>
20
21#define XCHAL_KIO_CACHED_VADDR 0xe0000000
22#define XCHAL_KIO_BYPASS_VADDR 0xf0000000
23#define XCHAL_KIO_PADDR 0xf0000000
24#define XCHAL_KIO_SIZE 0x10000000
25
26#define IOADDR(x) (XCHAL_KIO_BYPASS_VADDR + (x))
27
28/*
29 * swap functions to change byte order from little-endian to big-endian and
30 * vice versa.
31 */
32
33static inline unsigned short _swapw (unsigned short v)
34{
35 return (v << 8) | (v >> 8);
36}
37
38static inline unsigned int _swapl (unsigned int v)
39{
40 return (v << 24) | ((v & 0xff00) << 8) | ((v >> 8) & 0xff00) | (v >> 24);
41}
42
43/*
44 * Change virtual addresses to physical addresses and vv.
45 * These are trivial on the 1:1 Linux/Xtensa mapping
46 */
47
48static inline unsigned long virt_to_phys(volatile void * address)
49{
50 return __pa(address);
51}
52
53static inline void * phys_to_virt(unsigned long address)
54{
55 return __va(address);
56}
57
58/*
59 * virt_to_bus and bus_to_virt are deprecated.
60 */
61
62#define virt_to_bus(x) virt_to_phys(x)
63#define bus_to_virt(x) phys_to_virt(x)
64
65/*
66 * Return the virtual (cached) address for the specified bus memory.
67 * Note that we currently don't support any address outside the KIO segment.
68 */
69
70static inline void *ioremap(unsigned long offset, unsigned long size)
71{
72 if (offset >= XCHAL_KIO_PADDR
73 && offset < XCHAL_KIO_PADDR + XCHAL_KIO_SIZE)
74 return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_BYPASS_VADDR);
75
76 else
77 BUG();
78}
79
80static inline void *ioremap_nocache(unsigned long offset, unsigned long size)
81{
82 if (offset >= XCHAL_KIO_PADDR
83 && offset < XCHAL_KIO_PADDR + XCHAL_KIO_SIZE)
84 return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_CACHED_VADDR);
85 else
86 BUG();
87}
88
89static inline void iounmap(void *addr)
90{
91}
92
93/*
94 * Generic I/O
95 */
96
97#define readb(addr) \
98 ({ unsigned char __v = (*(volatile unsigned char *)(addr)); __v; })
99#define readw(addr) \
100 ({ unsigned short __v = (*(volatile unsigned short *)(addr)); __v; })
101#define readl(addr) \
102 ({ unsigned int __v = (*(volatile unsigned int *)(addr)); __v; })
103#define writeb(b, addr) (void)((*(volatile unsigned char *)(addr)) = (b))
104#define writew(b, addr) (void)((*(volatile unsigned short *)(addr)) = (b))
105#define writel(b, addr) (void)((*(volatile unsigned int *)(addr)) = (b))
106
107static inline __u8 __raw_readb(const volatile void __iomem *addr)
108{
109 return *(__force volatile __u8 *)(addr);
110}
111static inline __u16 __raw_readw(const volatile void __iomem *addr)
112{
113 return *(__force volatile __u16 *)(addr);
114}
115static inline __u32 __raw_readl(const volatile void __iomem *addr)
116{
117 return *(__force volatile __u32 *)(addr);
118}
119static inline void __raw_writeb(__u8 b, volatile void __iomem *addr)
120{
121 *(__force volatile __u8 *)(addr) = b;
122}
123static inline void __raw_writew(__u16 b, volatile void __iomem *addr)
124{
125 *(__force volatile __u16 *)(addr) = b;
126}
127static inline void __raw_writel(__u32 b, volatile void __iomem *addr)
128{
129 *(__force volatile __u32 *)(addr) = b;
130}
131
132/* These are the definitions for the x86 IO instructions
133 * inb/inw/inl/outb/outw/outl, the "string" versions
134 * insb/insw/insl/outsb/outsw/outsl, and the "pausing" versions
135 * inb_p/inw_p/...
136 * The macros don't do byte-swapping.
137 */
138
139#define inb(port) readb((u8 *)((port)))
140#define outb(val, port) writeb((val),(u8 *)((unsigned long)(port)))
141#define inw(port) readw((u16 *)((port)))
142#define outw(val, port) writew((val),(u16 *)((unsigned long)(port)))
143#define inl(port) readl((u32 *)((port)))
144#define outl(val, port) writel((val),(u32 *)((unsigned long)(port)))
145
146#define inb_p(port) inb((port))
147#define outb_p(val, port) outb((val), (port))
148#define inw_p(port) inw((port))
149#define outw_p(val, port) outw((val), (port))
150#define inl_p(port) inl((port))
151#define outl_p(val, port) outl((val), (port))
152
153extern void insb (unsigned long port, void *dst, unsigned long count);
154extern void insw (unsigned long port, void *dst, unsigned long count);
155extern void insl (unsigned long port, void *dst, unsigned long count);
156extern void outsb (unsigned long port, const void *src, unsigned long count);
157extern void outsw (unsigned long port, const void *src, unsigned long count);
158extern void outsl (unsigned long port, const void *src, unsigned long count);
159
160#define IO_SPACE_LIMIT ~0
161
162#define memset_io(a,b,c) memset((void *)(a),(b),(c))
163#define memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c))
164#define memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c))
165
166/* At this point the Xtensa doesn't provide byte swap instructions */
167
168#ifdef __XTENSA_EB__
169# define in_8(addr) (*(u8*)(addr))
170# define in_le16(addr) _swapw(*(u16*)(addr))
171# define in_le32(addr) _swapl(*(u32*)(addr))
172# define out_8(b, addr) *(u8*)(addr) = (b)
173# define out_le16(b, addr) *(u16*)(addr) = _swapw(b)
174# define out_le32(b, addr) *(u32*)(addr) = _swapl(b)
175#elif defined(__XTENSA_EL__)
176# define in_8(addr) (*(u8*)(addr))
177# define in_le16(addr) (*(u16*)(addr))
178# define in_le32(addr) (*(u32*)(addr))
179# define out_8(b, addr) *(u8*)(addr) = (b)
180# define out_le16(b, addr) *(u16*)(addr) = (b)
181# define out_le32(b, addr) *(u32*)(addr) = (b)
182#else
183# error processor byte order undefined!
184#endif
185
186
187/*
188 * Convert a physical pointer to a virtual kernel pointer for /dev/mem access
189 */
190#define xlate_dev_mem_ptr(p) __va(p)
191
192/*
193 * Convert a virtual cached pointer to an uncached pointer
194 */
195#define xlate_dev_kmem_ptr(p) p
196
197
198#endif /* __KERNEL__ */
199
200#endif /* _XTENSA_IO_H */
diff --git a/include/asm-xtensa/ioctl.h b/include/asm-xtensa/ioctl.h
deleted file mode 100644
index b279fe06dfe5..000000000000
--- a/include/asm-xtensa/ioctl.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/ioctl.h>
diff --git a/include/asm-xtensa/ioctls.h b/include/asm-xtensa/ioctls.h
deleted file mode 100644
index 0ffa942954b9..000000000000
--- a/include/asm-xtensa/ioctls.h
+++ /dev/null
@@ -1,116 +0,0 @@
1/*
2 * include/asm-xtensa/ioctls.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2003 - 2005 Tensilica Inc.
9 *
10 * Derived from "include/asm-i386/ioctls.h"
11 */
12
13#ifndef _XTENSA_IOCTLS_H
14#define _XTENSA_IOCTLS_H
15
16#include <asm/ioctl.h>
17
18#define FIOCLEX _IO('f', 1)
19#define FIONCLEX _IO('f', 2)
20#define FIOASYNC _IOW('f', 125, int)
21#define FIONBIO _IOW('f', 126, int)
22#define FIONREAD _IOR('f', 127, int)
23#define TIOCINQ FIONREAD
24#define FIOQSIZE _IOR('f', 128, loff_t)
25
26#define TCGETS 0x5401
27#define TCSETS 0x5402
28#define TCSETSW 0x5403
29#define TCSETSF 0x5404
30
31#define TCGETA _IOR('t', 23, struct termio)
32#define TCSETA _IOW('t', 24, struct termio)
33#define TCSETAW _IOW('t', 25, struct termio)
34#define TCSETAF _IOW('t', 28, struct termio)
35
36#define TCSBRK _IO('t', 29)
37#define TCXONC _IO('t', 30)
38#define TCFLSH _IO('t', 31)
39
40#define TIOCSWINSZ _IOW('t', 103, struct winsize)
41#define TIOCGWINSZ _IOR('t', 104, struct winsize)
42#define TIOCSTART _IO('t', 110) /* start output, like ^Q */
43#define TIOCSTOP _IO('t', 111) /* stop output, like ^S */
44#define TIOCOUTQ _IOR('t', 115, int) /* output queue size */
45
46#define TIOCSPGRP _IOW('t', 118, int)
47#define TIOCGPGRP _IOR('t', 119, int)
48
49#define TIOCEXCL _IO('T', 12)
50#define TIOCNXCL _IO('T', 13)
51#define TIOCSCTTY _IO('T', 14)
52
53#define TIOCSTI _IOW('T', 18, char)
54#define TIOCMGET _IOR('T', 21, unsigned int)
55#define TIOCMBIS _IOW('T', 22, unsigned int)
56#define TIOCMBIC _IOW('T', 23, unsigned int)
57#define TIOCMSET _IOW('T', 24, unsigned int)
58# define TIOCM_LE 0x001
59# define TIOCM_DTR 0x002
60# define TIOCM_RTS 0x004
61# define TIOCM_ST 0x008
62# define TIOCM_SR 0x010
63# define TIOCM_CTS 0x020
64# define TIOCM_CAR 0x040
65# define TIOCM_RNG 0x080
66# define TIOCM_DSR 0x100
67# define TIOCM_CD TIOCM_CAR
68# define TIOCM_RI TIOCM_RNG
69
70#define TIOCGSOFTCAR _IOR('T', 25, unsigned int)
71#define TIOCSSOFTCAR _IOW('T', 26, unsigned int)
72#define TIOCLINUX _IOW('T', 28, char)
73#define TIOCCONS _IO('T', 29)
74#define TIOCGSERIAL _IOR('T', 30, struct serial_struct)
75#define TIOCSSERIAL _IOW('T', 31, struct serial_struct)
76#define TIOCPKT _IOW('T', 32, int)
77# define TIOCPKT_DATA 0
78# define TIOCPKT_FLUSHREAD 1
79# define TIOCPKT_FLUSHWRITE 2
80# define TIOCPKT_STOP 4
81# define TIOCPKT_START 8
82# define TIOCPKT_NOSTOP 16
83# define TIOCPKT_DOSTOP 32
84
85
86#define TIOCNOTTY _IO('T', 34)
87#define TIOCSETD _IOW('T', 35, int)
88#define TIOCGETD _IOR('T', 36, int)
89#define TCSBRKP _IOW('T', 37, int) /* Needed for POSIX tcsendbreak()*/
90#define TIOCTTYGSTRUCT _IOR('T', 38, struct tty_struct) /* For debugging only*/
91#define TIOCSBRK _IO('T', 39) /* BSD compatibility */
92#define TIOCCBRK _IO('T', 40) /* BSD compatibility */
93#define TIOCGSID _IOR('T', 41, pid_t) /* Return the session ID of FD*/
94#define TCGETS2 _IOR('T', 42, struct termios2)
95#define TCSETS2 _IOW('T', 43, struct termios2)
96#define TCSETSW2 _IOW('T', 44, struct termios2)
97#define TCSETSF2 _IOW('T', 45, struct termios2)
98#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
99#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
100
101#define TIOCSERCONFIG _IO('T', 83)
102#define TIOCSERGWILD _IOR('T', 84, int)
103#define TIOCSERSWILD _IOW('T', 85, int)
104#define TIOCGLCKTRMIOS 0x5456
105#define TIOCSLCKTRMIOS 0x5457
106#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
107#define TIOCSERGETLSR _IOR('T', 89, unsigned int) /* Get line status reg. */
108 /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
109# define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
110#define TIOCSERGETMULTI _IOR('T', 90, struct serial_multiport_struct) /* Get multiport config */
111#define TIOCSERSETMULTI _IOW('T', 91, struct serial_multiport_struct) /* Set multiport config */
112
113#define TIOCMIWAIT _IO('T', 92) /* wait for a change on serial input line(s) */
114#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
115
116#endif /* _XTENSA_IOCTLS_H */
diff --git a/include/asm-xtensa/ipcbuf.h b/include/asm-xtensa/ipcbuf.h
deleted file mode 100644
index c33aa6a42145..000000000000
--- a/include/asm-xtensa/ipcbuf.h
+++ /dev/null
@@ -1,37 +0,0 @@
1/*
2 * include/asm-xtensa/ipcbuf.h
3 *
4 * The ipc64_perm structure for the Xtensa architecture.
5 * Note extra padding because this structure is passed back and forth
6 * between kernel and user space.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_IPCBUF_H
12#define _XTENSA_IPCBUF_H
13
14/*
15 * Pad space is left for:
16 * - 32-bit mode_t and seq
17 * - 2 miscellaneous 32-bit values
18 *
19 * This file is subject to the terms and conditions of the GNU General
20 * Public License. See the file "COPYING" in the main directory of
21 * this archive for more details.
22 */
23
24struct ipc64_perm
25{
26 __kernel_key_t key;
27 __kernel_uid32_t uid;
28 __kernel_gid32_t gid;
29 __kernel_uid32_t cuid;
30 __kernel_gid32_t cgid;
31 __kernel_mode_t mode;
32 unsigned long seq;
33 unsigned long __unused1;
34 unsigned long __unused2;
35};
36
37#endif /* _XTENSA_IPCBUF_H */
diff --git a/include/asm-xtensa/irq.h b/include/asm-xtensa/irq.h
deleted file mode 100644
index fc73b7f11aff..000000000000
--- a/include/asm-xtensa/irq.h
+++ /dev/null
@@ -1,30 +0,0 @@
1/*
2 * include/asm-xtensa/irq.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_IRQ_H
12#define _XTENSA_IRQ_H
13
14#include <asm/platform/hardware.h>
15#include <asm/variant/core.h>
16
17#ifndef PLATFORM_NR_IRQS
18# define PLATFORM_NR_IRQS 0
19#endif
20#define XTENSA_NR_IRQS XCHAL_NUM_INTERRUPTS
21#define NR_IRQS (XTENSA_NR_IRQS + PLATFORM_NR_IRQS)
22
23static __inline__ int irq_canonicalize(int irq)
24{
25 return (irq);
26}
27
28struct irqaction;
29
30#endif /* _XTENSA_IRQ_H */
diff --git a/include/asm-xtensa/irq_regs.h b/include/asm-xtensa/irq_regs.h
deleted file mode 100644
index 3dd9c0b70270..000000000000
--- a/include/asm-xtensa/irq_regs.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/irq_regs.h>
diff --git a/include/asm-xtensa/kdebug.h b/include/asm-xtensa/kdebug.h
deleted file mode 100644
index 6ece1b037665..000000000000
--- a/include/asm-xtensa/kdebug.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/kdebug.h>
diff --git a/include/asm-xtensa/kmap_types.h b/include/asm-xtensa/kmap_types.h
deleted file mode 100644
index 9e822d2e3bce..000000000000
--- a/include/asm-xtensa/kmap_types.h
+++ /dev/null
@@ -1,31 +0,0 @@
1/*
2 * include/asm-xtensa/kmap_types.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_KMAP_TYPES_H
12#define _XTENSA_KMAP_TYPES_H
13
14enum km_type {
15 KM_BOUNCE_READ,
16 KM_SKB_SUNRPC_DATA,
17 KM_SKB_DATA_SOFTIRQ,
18 KM_USER0,
19 KM_USER1,
20 KM_BIO_SRC_IRQ,
21 KM_BIO_DST_IRQ,
22 KM_PTE0,
23 KM_PTE1,
24 KM_IRQ0,
25 KM_IRQ1,
26 KM_SOFTIRQ0,
27 KM_SOFTIRQ1,
28 KM_TYPE_NR
29};
30
31#endif /* _XTENSA_KMAP_TYPES_H */
diff --git a/include/asm-xtensa/linkage.h b/include/asm-xtensa/linkage.h
deleted file mode 100644
index bf2128a99d79..000000000000
--- a/include/asm-xtensa/linkage.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * include/asm-xtensa/linkage.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_LINKAGE_H
12#define _XTENSA_LINKAGE_H
13
14/* Nothing to do here ... */
15
16#endif /* _XTENSA_LINKAGE_H */
diff --git a/include/asm-xtensa/local.h b/include/asm-xtensa/local.h
deleted file mode 100644
index 48723e550d14..000000000000
--- a/include/asm-xtensa/local.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * include/asm-xtensa/local.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_LOCAL_H
12#define _XTENSA_LOCAL_H
13
14#include <asm-generic/local.h>
15
16#endif /* _XTENSA_LOCAL_H */
diff --git a/include/asm-xtensa/mman.h b/include/asm-xtensa/mman.h
deleted file mode 100644
index 9b92620c8a1e..000000000000
--- a/include/asm-xtensa/mman.h
+++ /dev/null
@@ -1,84 +0,0 @@
1/*
2 * include/asm-xtensa/mman.h
3 *
4 * Xtensa Processor memory-manager definitions
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 *
10 * Copyright (C) 1995 by Ralf Baechle
11 * Copyright (C) 2001 - 2005 Tensilica Inc.
12 */
13
14#ifndef _XTENSA_MMAN_H
15#define _XTENSA_MMAN_H
16
17/*
18 * Protections are chosen from these bits, OR'd together. The
19 * implementation does not necessarily support PROT_EXEC or PROT_WRITE
20 * without PROT_READ. The only guarantees are that no writing will be
21 * allowed without PROT_WRITE and no access will be allowed for PROT_NONE.
22 */
23
24#define PROT_NONE 0x0 /* page can not be accessed */
25#define PROT_READ 0x1 /* page can be read */
26#define PROT_WRITE 0x2 /* page can be written */
27#define PROT_EXEC 0x4 /* page can be executed */
28
29#define PROT_SEM 0x10 /* page may be used for atomic ops */
30#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */
31#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end fo growsup vma */
32
33/*
34 * Flags for mmap
35 */
36#define MAP_SHARED 0x001 /* Share changes */
37#define MAP_PRIVATE 0x002 /* Changes are private */
38#define MAP_TYPE 0x00f /* Mask for type of mapping */
39#define MAP_FIXED 0x010 /* Interpret addr exactly */
40
41/* not used by linux, but here to make sure we don't clash with ABI defines */
42#define MAP_RENAME 0x020 /* Assign page to file */
43#define MAP_AUTOGROW 0x040 /* File may grow by writing */
44#define MAP_LOCAL 0x080 /* Copy on fork/sproc */
45#define MAP_AUTORSRV 0x100 /* Logical swap reserved on demand */
46
47/* These are linux-specific */
48#define MAP_NORESERVE 0x0400 /* don't check for reservations */
49#define MAP_ANONYMOUS 0x0800 /* don't use a file */
50#define MAP_GROWSDOWN 0x1000 /* stack-like segment */
51#define MAP_DENYWRITE 0x2000 /* ETXTBSY */
52#define MAP_EXECUTABLE 0x4000 /* mark it as an executable */
53#define MAP_LOCKED 0x8000 /* pages are locked */
54#define MAP_POPULATE 0x10000 /* populate (prefault) pagetables */
55#define MAP_NONBLOCK 0x20000 /* do not block on IO */
56
57/*
58 * Flags for msync
59 */
60#define MS_ASYNC 0x0001 /* sync memory asynchronously */
61#define MS_INVALIDATE 0x0002 /* invalidate mappings & caches */
62#define MS_SYNC 0x0004 /* synchronous memory sync */
63
64/*
65 * Flags for mlockall
66 */
67#define MCL_CURRENT 1 /* lock all current mappings */
68#define MCL_FUTURE 2 /* lock all future mappings */
69
70#define MADV_NORMAL 0 /* no further special treatment */
71#define MADV_RANDOM 1 /* expect random page references */
72#define MADV_SEQUENTIAL 2 /* expect sequential page references */
73#define MADV_WILLNEED 3 /* will need these pages */
74#define MADV_DONTNEED 4 /* don't need these pages */
75
76/* common parameters: try to keep these consistent across architectures */
77#define MADV_REMOVE 9 /* remove these pages & resources */
78#define MADV_DONTFORK 10 /* don't inherit across fork */
79#define MADV_DOFORK 11 /* do inherit across fork */
80
81/* compatibility flags */
82#define MAP_FILE 0
83
84#endif /* _XTENSA_MMAN_H */
diff --git a/include/asm-xtensa/mmu.h b/include/asm-xtensa/mmu.h
deleted file mode 100644
index 44c5bb04c55c..000000000000
--- a/include/asm-xtensa/mmu.h
+++ /dev/null
@@ -1,17 +0,0 @@
1/*
2 * include/asm-xtensa/mmu.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_MMU_H
12#define _XTENSA_MMU_H
13
14/* Default "unsigned long" context */
15typedef unsigned long mm_context_t;
16
17#endif /* _XTENSA_MMU_H */
diff --git a/include/asm-xtensa/mmu_context.h b/include/asm-xtensa/mmu_context.h
deleted file mode 100644
index c0fd8e5b4513..000000000000
--- a/include/asm-xtensa/mmu_context.h
+++ /dev/null
@@ -1,136 +0,0 @@
1/*
2 * include/asm-xtensa/mmu_context.h
3 *
4 * Switch an MMU context.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 *
10 * Copyright (C) 2001 - 2005 Tensilica Inc.
11 */
12
13#ifndef _XTENSA_MMU_CONTEXT_H
14#define _XTENSA_MMU_CONTEXT_H
15
16#include <linux/stringify.h>
17#include <linux/sched.h>
18
19#include <asm/pgtable.h>
20#include <asm/cacheflush.h>
21#include <asm/tlbflush.h>
22#include <asm-generic/mm_hooks.h>
23
24#define XCHAL_MMU_ASID_BITS 8
25
26#if (XCHAL_HAVE_TLBS != 1)
27# error "Linux must have an MMU!"
28#endif
29
30extern unsigned long asid_cache;
31
32/*
33 * NO_CONTEXT is the invalid ASID value that we don't ever assign to
34 * any user or kernel context.
35 *
36 * 0 invalid
37 * 1 kernel
38 * 2 reserved
39 * 3 reserved
40 * 4...255 available
41 */
42
43#define NO_CONTEXT 0
44#define ASID_USER_FIRST 4
45#define ASID_MASK ((1 << XCHAL_MMU_ASID_BITS) - 1)
46#define ASID_INSERT(x) (0x03020001 | (((x) & ASID_MASK) << 8))
47
48static inline void set_rasid_register (unsigned long val)
49{
50 __asm__ __volatile__ (" wsr %0, "__stringify(RASID)"\n\t"
51 " isync\n" : : "a" (val));
52}
53
54static inline unsigned long get_rasid_register (void)
55{
56 unsigned long tmp;
57 __asm__ __volatile__ (" rsr %0,"__stringify(RASID)"\n\t" : "=a" (tmp));
58 return tmp;
59}
60
61static inline void
62__get_new_mmu_context(struct mm_struct *mm)
63{
64 extern void flush_tlb_all(void);
65 if (! (++asid_cache & ASID_MASK) ) {
66 flush_tlb_all(); /* start new asid cycle */
67 asid_cache += ASID_USER_FIRST;
68 }
69 mm->context = asid_cache;
70}
71
72static inline void
73__load_mmu_context(struct mm_struct *mm)
74{
75 set_rasid_register(ASID_INSERT(mm->context));
76 invalidate_page_directory();
77}
78
79/*
80 * Initialize the context related info for a new mm_struct
81 * instance.
82 */
83
84static inline int
85init_new_context(struct task_struct *tsk, struct mm_struct *mm)
86{
87 mm->context = NO_CONTEXT;
88 return 0;
89}
90
91/*
92 * After we have set current->mm to a new value, this activates
93 * the context for the new mm so we see the new mappings.
94 */
95static inline void
96activate_mm(struct mm_struct *prev, struct mm_struct *next)
97{
98 /* Unconditionally get a new ASID. */
99
100 __get_new_mmu_context(next);
101 __load_mmu_context(next);
102}
103
104
105static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
106 struct task_struct *tsk)
107{
108 unsigned long asid = asid_cache;
109
110 /* Check if our ASID is of an older version and thus invalid */
111
112 if (next->context == NO_CONTEXT || ((next->context^asid) & ~ASID_MASK))
113 __get_new_mmu_context(next);
114
115 __load_mmu_context(next);
116}
117
118#define deactivate_mm(tsk, mm) do { } while(0)
119
120/*
121 * Destroy context related info for an mm_struct that is about
122 * to be put to rest.
123 */
124static inline void destroy_context(struct mm_struct *mm)
125{
126 invalidate_page_directory();
127}
128
129
130static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
131{
132 /* Nothing to do. */
133
134}
135
136#endif /* _XTENSA_MMU_CONTEXT_H */
diff --git a/include/asm-xtensa/module.h b/include/asm-xtensa/module.h
deleted file mode 100644
index d9b34bee4d42..000000000000
--- a/include/asm-xtensa/module.h
+++ /dev/null
@@ -1,27 +0,0 @@
1/*
2 * include/asm-xtensa/module.h
3 *
4 * This file contains the module code specific to the Xtensa architecture.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 *
10 * Copyright (C) 2001 - 2005 Tensilica Inc.
11 */
12
13#ifndef _XTENSA_MODULE_H
14#define _XTENSA_MODULE_H
15
16struct mod_arch_specific
17{
18 /* No special elements, yet. */
19};
20
21#define MODULE_ARCH_VERMAGIC "xtensa-" __stringify(XCHAL_CORE_ID) " "
22
23#define Elf_Shdr Elf32_Shdr
24#define Elf_Sym Elf32_Sym
25#define Elf_Ehdr Elf32_Ehdr
26
27#endif /* _XTENSA_MODULE_H */
diff --git a/include/asm-xtensa/msgbuf.h b/include/asm-xtensa/msgbuf.h
deleted file mode 100644
index 693c96755280..000000000000
--- a/include/asm-xtensa/msgbuf.h
+++ /dev/null
@@ -1,48 +0,0 @@
1/*
2 * include/asm-xtensa/msgbuf.h
3 *
4 * The msqid64_ds structure for the Xtensa architecture.
5 * Note extra padding because this structure is passed back and forth
6 * between kernel and user space.
7 *
8 * Pad space is left for:
9 * - 64-bit time_t to solve y2038 problem
10 * - 2 miscellaneous 32-bit values
11 *
12 * This file is subject to the terms and conditions of the GNU General
13 * Public License. See the file "COPYING" in the main directory of
14 * this archive for more details.
15 */
16
17#ifndef _XTENSA_MSGBUF_H
18#define _XTENSA_MSGBUF_H
19
20struct msqid64_ds {
21 struct ipc64_perm msg_perm;
22#ifdef __XTENSA_EB__
23 unsigned int __unused1;
24 __kernel_time_t msg_stime; /* last msgsnd time */
25 unsigned int __unused2;
26 __kernel_time_t msg_rtime; /* last msgrcv time */
27 unsigned int __unused3;
28 __kernel_time_t msg_ctime; /* last change time */
29#elif defined(__XTENSA_EL__)
30 __kernel_time_t msg_stime; /* last msgsnd time */
31 unsigned int __unused1;
32 __kernel_time_t msg_rtime; /* last msgrcv time */
33 unsigned int __unused2;
34 __kernel_time_t msg_ctime; /* last change time */
35 unsigned int __unused3;
36#else
37# error processor byte order undefined!
38#endif
39 unsigned long msg_cbytes; /* current number of bytes on queue */
40 unsigned long msg_qnum; /* number of messages in queue */
41 unsigned long msg_qbytes; /* max number of bytes on queue */
42 __kernel_pid_t msg_lspid; /* pid of last msgsnd */
43 __kernel_pid_t msg_lrpid; /* last receive pid */
44 unsigned long __unused4;
45 unsigned long __unused5;
46};
47
48#endif /* _XTENSA_MSGBUF_H */
diff --git a/include/asm-xtensa/mutex.h b/include/asm-xtensa/mutex.h
deleted file mode 100644
index 458c1f7fbc18..000000000000
--- a/include/asm-xtensa/mutex.h
+++ /dev/null
@@ -1,9 +0,0 @@
1/*
2 * Pull in the generic implementation for the mutex fastpath.
3 *
4 * TODO: implement optimized primitives instead, or leave the generic
5 * implementation in place, or pick the atomic_xchg() based generic
6 * implementation. (see asm-generic/mutex-xchg.h for details)
7 */
8
9#include <asm-generic/mutex-dec.h>
diff --git a/include/asm-xtensa/page.h b/include/asm-xtensa/page.h
deleted file mode 100644
index 11f7dc2dbec7..000000000000
--- a/include/asm-xtensa/page.h
+++ /dev/null
@@ -1,174 +0,0 @@
1/*
2 * include/asm-xtensa/page.h
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version2 as
6 * published by the Free Software Foundation.
7 *
8 * Copyright (C) 2001 - 2007 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_PAGE_H
12#define _XTENSA_PAGE_H
13
14#include <asm/processor.h>
15#include <asm/types.h>
16#include <asm/cache.h>
17
18/*
19 * Fixed TLB translations in the processor.
20 */
21
22#define XCHAL_KSEG_CACHED_VADDR 0xd0000000
23#define XCHAL_KSEG_BYPASS_VADDR 0xd8000000
24#define XCHAL_KSEG_PADDR 0x00000000
25#define XCHAL_KSEG_SIZE 0x08000000
26
27/*
28 * PAGE_SHIFT determines the page size
29 */
30
31#define PAGE_SHIFT 12
32#define PAGE_SIZE (__XTENSA_UL_CONST(1) << PAGE_SHIFT)
33#define PAGE_MASK (~(PAGE_SIZE-1))
34
35#define PAGE_OFFSET XCHAL_KSEG_CACHED_VADDR
36#define MAX_MEM_PFN XCHAL_KSEG_SIZE
37#define PGTABLE_START 0x80000000
38
39/*
40 * Cache aliasing:
41 *
42 * If the cache size for one way is greater than the page size, we have to
43 * deal with cache aliasing. The cache index is wider than the page size:
44 *
45 * | |cache| cache index
46 * | pfn |off| virtual address
47 * |xxxx:X|zzz|
48 * | : | |
49 * | \ / | |
50 * |trans.| |
51 * | / \ | |
52 * |yyyy:Y|zzz| physical address
53 *
54 * When the page number is translated to the physical page address, the lowest
55 * bit(s) (X) that are part of the cache index are also translated (Y).
56 * If this translation changes bit(s) (X), the cache index is also afected,
57 * thus resulting in a different cache line than before.
58 * The kernel does not provide a mechanism to ensure that the page color
59 * (represented by this bit) remains the same when allocated or when pages
60 * are remapped. When user pages are mapped into kernel space, the color of
61 * the page might also change.
62 *
63 * We use the address space VMALLOC_END ... VMALLOC_END + DCACHE_WAY_SIZE * 2
64 * to temporarily map a patch so we can match the color.
65 */
66
67#if DCACHE_WAY_SIZE > PAGE_SIZE
68# define DCACHE_ALIAS_ORDER (DCACHE_WAY_SHIFT - PAGE_SHIFT)
69# define DCACHE_ALIAS_MASK (PAGE_MASK & (DCACHE_WAY_SIZE - 1))
70# define DCACHE_ALIAS(a) (((a) & DCACHE_ALIAS_MASK) >> PAGE_SHIFT)
71# define DCACHE_ALIAS_EQ(a,b) ((((a) ^ (b)) & DCACHE_ALIAS_MASK) == 0)
72#else
73# define DCACHE_ALIAS_ORDER 0
74#endif
75
76#if ICACHE_WAY_SIZE > PAGE_SIZE
77# define ICACHE_ALIAS_ORDER (ICACHE_WAY_SHIFT - PAGE_SHIFT)
78# define ICACHE_ALIAS_MASK (PAGE_MASK & (ICACHE_WAY_SIZE - 1))
79# define ICACHE_ALIAS(a) (((a) & ICACHE_ALIAS_MASK) >> PAGE_SHIFT)
80# define ICACHE_ALIAS_EQ(a,b) ((((a) ^ (b)) & ICACHE_ALIAS_MASK) == 0)
81#else
82# define ICACHE_ALIAS_ORDER 0
83#endif
84
85
86#ifdef __ASSEMBLY__
87
88#define __pgprot(x) (x)
89
90#else
91
92/*
93 * These are used to make use of C type-checking..
94 */
95
96typedef struct { unsigned long pte; } pte_t; /* page table entry */
97typedef struct { unsigned long pgd; } pgd_t; /* PGD table entry */
98typedef struct { unsigned long pgprot; } pgprot_t;
99typedef struct page *pgtable_t;
100
101#define pte_val(x) ((x).pte)
102#define pgd_val(x) ((x).pgd)
103#define pgprot_val(x) ((x).pgprot)
104
105#define __pte(x) ((pte_t) { (x) } )
106#define __pgd(x) ((pgd_t) { (x) } )
107#define __pgprot(x) ((pgprot_t) { (x) } )
108
109/*
110 * Pure 2^n version of get_order
111 * Use 'nsau' instructions if supported by the processor or the generic version.
112 */
113
114#if XCHAL_HAVE_NSA
115
116static inline __attribute_const__ int get_order(unsigned long size)
117{
118 int lz;
119 asm ("nsau %0, %1" : "=r" (lz) : "r" ((size - 1) >> PAGE_SHIFT));
120 return 32 - lz;
121}
122
123#else
124
125# include <asm-generic/page.h>
126
127#endif
128
129struct page;
130extern void clear_page(void *page);
131extern void copy_page(void *to, void *from);
132
133/*
134 * If we have cache aliasing and writeback caches, we might have to do
135 * some extra work
136 */
137
138#if DCACHE_WAY_SIZE > PAGE_SIZE
139extern void clear_user_page(void*, unsigned long, struct page*);
140extern void copy_user_page(void*, void*, unsigned long, struct page*);
141#else
142# define clear_user_page(page, vaddr, pg) clear_page(page)
143# define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
144#endif
145
146/*
147 * This handles the memory map. We handle pages at
148 * XCHAL_KSEG_CACHED_VADDR for kernels with 32 bit address space.
149 * These macros are for conversion of kernel address, not user
150 * addresses.
151 */
152
153#define __pa(x) ((unsigned long) (x) - PAGE_OFFSET)
154#define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET))
155#define pfn_valid(pfn) ((unsigned long)pfn < max_mapnr)
156#ifdef CONFIG_DISCONTIGMEM
157# error CONFIG_DISCONTIGMEM not supported
158#endif
159
160#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
161#define page_to_virt(page) __va(page_to_pfn(page) << PAGE_SHIFT)
162#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
163#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
164
165#define WANT_PAGE_VIRTUAL
166
167
168#endif /* __ASSEMBLY__ */
169
170#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
171 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
172
173#include <asm-generic/memory_model.h>
174#endif /* _XTENSA_PAGE_H */
diff --git a/include/asm-xtensa/param.h b/include/asm-xtensa/param.h
deleted file mode 100644
index ba03d5aeab6b..000000000000
--- a/include/asm-xtensa/param.h
+++ /dev/null
@@ -1,34 +0,0 @@
1/*
2 * include/asm-xtensa/param.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_PARAM_H
12#define _XTENSA_PARAM_H
13
14#ifdef __KERNEL__
15# define HZ CONFIG_HZ /* internal timer frequency */
16# define USER_HZ 100 /* for user interfaces in "ticks" */
17# define CLOCKS_PER_SEC (USER_HZ) /* frequnzy at which times() counts */
18#else
19# define HZ 100
20#endif
21
22#define EXEC_PAGESIZE 4096
23
24#ifndef NGROUPS
25#define NGROUPS 32
26#endif
27
28#ifndef NOGROUP
29#define NOGROUP (-1)
30#endif
31
32#define MAXHOSTNAMELEN 64 /* max length of hostname */
33
34#endif /* _XTENSA_PARAM_H */
diff --git a/include/asm-xtensa/pci-bridge.h b/include/asm-xtensa/pci-bridge.h
deleted file mode 100644
index 00fcbd7c534a..000000000000
--- a/include/asm-xtensa/pci-bridge.h
+++ /dev/null
@@ -1,88 +0,0 @@
1/*
2 * include/asm-xtensa/pci-bridge.h
3 *
4 * This file is subject to the terms and conditions of the GNU General
5 * Public License. See the file "COPYING" in the main directory of
6 * this archive for more details.
7 *
8 * Copyright (C) 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_PCI_BRIDGE_H
12#define _XTENSA_PCI_BRIDGE_H
13
14#ifdef __KERNEL__
15
16struct device_node;
17struct pci_controller;
18
19/*
20 * pciauto_bus_scan() enumerates the pci space.
21 */
22
23extern int pciauto_bus_scan(struct pci_controller *, int);
24
25struct pci_space {
26 unsigned long start;
27 unsigned long end;
28 unsigned long base;
29};
30
31/*
32 * Structure of a PCI controller (host bridge)
33 */
34
35struct pci_controller {
36 int index; /* used for pci_controller_num */
37 struct pci_controller *next;
38 struct pci_bus *bus;
39 void *arch_data;
40
41 int first_busno;
42 int last_busno;
43
44 struct pci_ops *ops;
45 volatile unsigned int *cfg_addr;
46 volatile unsigned char *cfg_data;
47
48 /* Currently, we limit ourselves to 1 IO range and 3 mem
49 * ranges since the common pci_bus structure can't handle more
50 */
51 struct resource io_resource;
52 struct resource mem_resources[3];
53 int mem_resource_count;
54
55 /* Host bridge I/O and Memory space
56 * Used for BAR placement algorithms
57 */
58 struct pci_space io_space;
59 struct pci_space mem_space;
60
61 /* Return the interrupt number fo a device. */
62 int (*map_irq)(struct pci_dev*, u8, u8);
63
64};
65
66static inline void pcibios_init_resource(struct resource *res,
67 unsigned long start, unsigned long end, int flags, char *name)
68{
69 res->start = start;
70 res->end = end;
71 res->flags = flags;
72 res->name = name;
73 res->parent = NULL;
74 res->sibling = NULL;
75 res->child = NULL;
76}
77
78
79/* These are used for config access before all the PCI probing has been done. */
80int early_read_config_byte(struct pci_controller*, int, int, int, u8*);
81int early_read_config_word(struct pci_controller*, int, int, int, u16*);
82int early_read_config_dword(struct pci_controller*, int, int, int, u32*);
83int early_write_config_byte(struct pci_controller*, int, int, int, u8);
84int early_write_config_word(struct pci_controller*, int, int, int, u16);
85int early_write_config_dword(struct pci_controller*, int, int, int, u32);
86
87#endif /* __KERNEL__ */
88#endif /* _XTENSA_PCI_BRIDGE_H */
diff --git a/include/asm-xtensa/pci.h b/include/asm-xtensa/pci.h
deleted file mode 100644
index 66410acf18b4..000000000000
--- a/include/asm-xtensa/pci.h
+++ /dev/null
@@ -1,82 +0,0 @@
1/*
2 * linux/include/asm-xtensa/pci.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_PCI_H
12#define _XTENSA_PCI_H
13
14#ifdef __KERNEL__
15
16/* Can be used to override the logic in pci_scan_bus for skipping
17 * already-configured bus numbers - to be used for buggy BIOSes
18 * or architectures with incomplete PCI setup by the loader
19 */
20
21#define pcibios_assign_all_busses() 0
22
23extern struct pci_controller* pcibios_alloc_controller(void);
24
25static inline void pcibios_set_master(struct pci_dev *dev)
26{
27 /* No special bus mastering setup handling */
28}
29
30static inline void pcibios_penalize_isa_irq(int irq)
31{
32 /* We don't do dynamic PCI IRQ allocation */
33}
34
35/* Assume some values. (We should revise them, if necessary) */
36
37#define PCIBIOS_MIN_IO 0x2000
38#define PCIBIOS_MIN_MEM 0x10000000
39
40/* Dynamic DMA mapping stuff.
41 * Xtensa has everything mapped statically like x86.
42 */
43
44#include <linux/types.h>
45#include <linux/slab.h>
46#include <asm/scatterlist.h>
47#include <linux/string.h>
48#include <asm/io.h>
49
50struct pci_dev;
51
52/* The PCI address space does equal the physical memory address space.
53 * The networking and block device layers use this boolean for bounce buffer
54 * decisions.
55 */
56
57#define PCI_DMA_BUS_IS_PHYS (1)
58
59/* pci_unmap_{page,single} is a no-op, so */
60#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
61#define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
62#define pci_unmap_addr(PTR, ADDR_NAME) (0)
63#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0)
64#define pci_ubnmap_len(PTR, LEN_NAME) (0)
65#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
66
67/* Map a range of PCI memory or I/O space for a device into user space */
68int pci_mmap_page_range(struct pci_dev *pdev, struct vm_area_struct *vma,
69 enum pci_mmap_state mmap_state, int write_combine);
70
71/* Tell drivers/pci/proc.c that we have pci_mmap_page_range() */
72#define HAVE_PCI_MMAP 1
73
74#endif /* __KERNEL__ */
75
76/* Implement the pci_ DMA API in terms of the generic device dma_ one */
77#include <asm-generic/pci-dma-compat.h>
78
79/* Generic PCI */
80#include <asm-generic/pci.h>
81
82#endif /* _XTENSA_PCI_H */
diff --git a/include/asm-xtensa/percpu.h b/include/asm-xtensa/percpu.h
deleted file mode 100644
index 6d2bc2ada9d1..000000000000
--- a/include/asm-xtensa/percpu.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * linux/include/asm-xtensa/percpu.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_PERCPU__
12#define _XTENSA_PERCPU__
13
14#include <asm-generic/percpu.h>
15
16#endif /* _XTENSA_PERCPU__ */
diff --git a/include/asm-xtensa/pgalloc.h b/include/asm-xtensa/pgalloc.h
deleted file mode 100644
index 4f4a7987eded..000000000000
--- a/include/asm-xtensa/pgalloc.h
+++ /dev/null
@@ -1,73 +0,0 @@
1/*
2 * include/asm-xtensa/pgalloc.h
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * Copyright (C) 2001-2007 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_PGALLOC_H
12#define _XTENSA_PGALLOC_H
13
14#ifdef __KERNEL__
15
16#include <linux/highmem.h>
17
18/*
19 * Allocating and freeing a pmd is trivial: the 1-entry pmd is
20 * inside the pgd, so has no extra memory associated with it.
21 */
22
23#define pmd_populate_kernel(mm, pmdp, ptep) \
24 (pmd_val(*(pmdp)) = ((unsigned long)ptep))
25#define pmd_populate(mm, pmdp, page) \
26 (pmd_val(*(pmdp)) = ((unsigned long)page_to_virt(page)))
27#define pmd_pgtable(pmd) pmd_page(pmd)
28
29static inline pgd_t*
30pgd_alloc(struct mm_struct *mm)
31{
32 return (pgd_t*) __get_free_pages(GFP_KERNEL | __GFP_ZERO, PGD_ORDER);
33}
34
35static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
36{
37 free_page((unsigned long)pgd);
38}
39
40/* Use a slab cache for the pte pages (see also sparc64 implementation) */
41
42extern struct kmem_cache *pgtable_cache;
43
44static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
45 unsigned long address)
46{
47 return kmem_cache_alloc(pgtable_cache, GFP_KERNEL|__GFP_REPEAT);
48}
49
50static inline pgtable_t pte_alloc_one(struct mm_struct *mm,
51 unsigned long addr)
52{
53 struct page *page;
54
55 page = virt_to_page(pte_alloc_one_kernel(mm, addr));
56 pgtable_page_ctor(page);
57 return page;
58}
59
60static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
61{
62 kmem_cache_free(pgtable_cache, pte);
63}
64
65static inline void pte_free(struct mm_struct *mm, pgtable_t pte)
66{
67 pgtable_page_dtor(pte);
68 kmem_cache_free(pgtable_cache, page_address(pte));
69}
70#define pmd_pgtable(pmd) pmd_page(pmd)
71
72#endif /* __KERNEL__ */
73#endif /* _XTENSA_PGALLOC_H */
diff --git a/include/asm-xtensa/pgtable.h b/include/asm-xtensa/pgtable.h
deleted file mode 100644
index 8014d96b21f1..000000000000
--- a/include/asm-xtensa/pgtable.h
+++ /dev/null
@@ -1,416 +0,0 @@
1/*
2 * include/asm-xtensa/pgtable.h
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * Copyright (C) 2001 - 2007 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_PGTABLE_H
12#define _XTENSA_PGTABLE_H
13
14#include <asm-generic/pgtable-nopmd.h>
15#include <asm/page.h>
16
17/*
18 * We only use two ring levels, user and kernel space.
19 */
20
21#define USER_RING 1 /* user ring level */
22#define KERNEL_RING 0 /* kernel ring level */
23
24/*
25 * The Xtensa architecture port of Linux has a two-level page table system,
26 * i.e. the logical three-level Linux page table layout is folded.
27 * Each task has the following memory page tables:
28 *
29 * PGD table (page directory), ie. 3rd-level page table:
30 * One page (4 kB) of 1024 (PTRS_PER_PGD) pointers to PTE tables
31 * (Architectures that don't have the PMD folded point to the PMD tables)
32 *
33 * The pointer to the PGD table for a given task can be retrieved from
34 * the task structure (struct task_struct*) t, e.g. current():
35 * (t->mm ? t->mm : t->active_mm)->pgd
36 *
37 * PMD tables (page middle-directory), ie. 2nd-level page tables:
38 * Absent for the Xtensa architecture (folded, PTRS_PER_PMD == 1).
39 *
40 * PTE tables (page table entry), ie. 1st-level page tables:
41 * One page (4 kB) of 1024 (PTRS_PER_PTE) PTEs with a special PTE
42 * invalid_pte_table for absent mappings.
43 *
44 * The individual pages are 4 kB big with special pages for the empty_zero_page.
45 */
46
47#define PGDIR_SHIFT 22
48#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
49#define PGDIR_MASK (~(PGDIR_SIZE-1))
50
51/*
52 * Entries per page directory level: we use two-level, so
53 * we don't really have any PMD directory physically.
54 */
55#define PTRS_PER_PTE 1024
56#define PTRS_PER_PTE_SHIFT 10
57#define PTRS_PER_PGD 1024
58#define PGD_ORDER 0
59#define USER_PTRS_PER_PGD (TASK_SIZE/PGDIR_SIZE)
60#define FIRST_USER_ADDRESS 0
61#define FIRST_USER_PGD_NR (FIRST_USER_ADDRESS >> PGDIR_SHIFT)
62
63/*
64 * Virtual memory area. We keep a distance to other memory regions to be
65 * on the safe side. We also use this area for cache aliasing.
66 */
67
68#define VMALLOC_START 0xC0000000
69#define VMALLOC_END 0xC7FEFFFF
70#define TLBTEMP_BASE_1 0xC7FF0000
71#define TLBTEMP_BASE_2 0xC7FF8000
72
73/*
74 * Xtensa Linux config PTE layout (when present):
75 * 31-12: PPN
76 * 11-6: Software
77 * 5-4: RING
78 * 3-0: CA
79 *
80 * Similar to the Alpha and MIPS ports, we need to keep track of the ref
81 * and mod bits in software. We have a software "you can read
82 * from this page" bit, and a hardware one which actually lets the
83 * process read from the page. On the same token we have a software
84 * writable bit and the real hardware one which actually lets the
85 * process write to the page.
86 *
87 * See further below for PTE layout for swapped-out pages.
88 */
89
90#define _PAGE_HW_EXEC (1<<0) /* hardware: page is executable */
91#define _PAGE_HW_WRITE (1<<1) /* hardware: page is writable */
92
93#define _PAGE_FILE (1<<1) /* non-linear mapping, if !present */
94#define _PAGE_PROTNONE (3<<0) /* special case for VM_PROT_NONE */
95
96/* None of these cache modes include MP coherency: */
97#define _PAGE_CA_BYPASS (0<<2) /* bypass, non-speculative */
98#define _PAGE_CA_WB (1<<2) /* write-back */
99#define _PAGE_CA_WT (2<<2) /* write-through */
100#define _PAGE_CA_MASK (3<<2)
101#define _PAGE_INVALID (3<<2)
102
103#define _PAGE_USER (1<<4) /* user access (ring=1) */
104
105/* Software */
106#define _PAGE_WRITABLE_BIT 6
107#define _PAGE_WRITABLE (1<<6) /* software: page writable */
108#define _PAGE_DIRTY (1<<7) /* software: page dirty */
109#define _PAGE_ACCESSED (1<<8) /* software: page accessed (read) */
110
111/* On older HW revisions, we always have to set bit 0 */
112#if XCHAL_HW_VERSION_MAJOR < 2000
113# define _PAGE_VALID (1<<0)
114#else
115# define _PAGE_VALID 0
116#endif
117
118#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY)
119#define _PAGE_PRESENT (_PAGE_VALID | _PAGE_CA_WB | _PAGE_ACCESSED)
120
121#ifdef CONFIG_MMU
122
123#define PAGE_NONE __pgprot(_PAGE_INVALID | _PAGE_USER | _PAGE_PROTNONE)
124#define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_USER)
125#define PAGE_COPY_EXEC __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_HW_EXEC)
126#define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_USER)
127#define PAGE_READONLY_EXEC __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_HW_EXEC)
128#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_WRITABLE)
129#define PAGE_SHARED_EXEC \
130 __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_WRITABLE | _PAGE_HW_EXEC)
131#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_HW_WRITE)
132#define PAGE_KERNEL_EXEC __pgprot(_PAGE_PRESENT|_PAGE_HW_WRITE|_PAGE_HW_EXEC)
133
134#if (DCACHE_WAY_SIZE > PAGE_SIZE)
135# define _PAGE_DIRECTORY (_PAGE_VALID | _PAGE_ACCESSED)
136#else
137# define _PAGE_DIRECTORY (_PAGE_VALID | _PAGE_ACCESSED | _PAGE_CA_WB)
138#endif
139
140#else /* no mmu */
141
142# define PAGE_NONE __pgprot(0)
143# define PAGE_SHARED __pgprot(0)
144# define PAGE_COPY __pgprot(0)
145# define PAGE_READONLY __pgprot(0)
146# define PAGE_KERNEL __pgprot(0)
147
148#endif
149
150/*
151 * On certain configurations of Xtensa MMUs (eg. the initial Linux config),
152 * the MMU can't do page protection for execute, and considers that the same as
153 * read. Also, write permissions may imply read permissions.
154 * What follows is the closest we can get by reasonable means..
155 * See linux/mm/mmap.c for protection_map[] array that uses these definitions.
156 */
157#define __P000 PAGE_NONE /* private --- */
158#define __P001 PAGE_READONLY /* private --r */
159#define __P010 PAGE_COPY /* private -w- */
160#define __P011 PAGE_COPY /* private -wr */
161#define __P100 PAGE_READONLY_EXEC /* private x-- */
162#define __P101 PAGE_READONLY_EXEC /* private x-r */
163#define __P110 PAGE_COPY_EXEC /* private xw- */
164#define __P111 PAGE_COPY_EXEC /* private xwr */
165
166#define __S000 PAGE_NONE /* shared --- */
167#define __S001 PAGE_READONLY /* shared --r */
168#define __S010 PAGE_SHARED /* shared -w- */
169#define __S011 PAGE_SHARED /* shared -wr */
170#define __S100 PAGE_READONLY_EXEC /* shared x-- */
171#define __S101 PAGE_READONLY_EXEC /* shared x-r */
172#define __S110 PAGE_SHARED_EXEC /* shared xw- */
173#define __S111 PAGE_SHARED_EXEC /* shared xwr */
174
175#ifndef __ASSEMBLY__
176
177#define pte_ERROR(e) \
178 printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e))
179#define pgd_ERROR(e) \
180 printk("%s:%d: bad pgd entry %08lx.\n", __FILE__, __LINE__, pgd_val(e))
181
182extern unsigned long empty_zero_page[1024];
183
184#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page))
185
186extern pgd_t swapper_pg_dir[PAGE_SIZE/sizeof(pgd_t)];
187
188/*
189 * The pmd contains the kernel virtual address of the pte page.
190 */
191#define pmd_page_vaddr(pmd) ((unsigned long)(pmd_val(pmd) & PAGE_MASK))
192#define pmd_page(pmd) virt_to_page(pmd_val(pmd))
193
194/*
195 * pte status.
196 */
197#define pte_none(pte) (pte_val(pte) == _PAGE_INVALID)
198#define pte_present(pte) \
199 (((pte_val(pte) & _PAGE_CA_MASK) != _PAGE_INVALID) \
200 || ((pte_val(pte) & _PAGE_PROTNONE) == _PAGE_PROTNONE))
201#define pte_clear(mm,addr,ptep) \
202 do { update_pte(ptep, __pte(_PAGE_INVALID)); } while(0)
203
204#define pmd_none(pmd) (!pmd_val(pmd))
205#define pmd_present(pmd) (pmd_val(pmd) & PAGE_MASK)
206#define pmd_bad(pmd) (pmd_val(pmd) & ~PAGE_MASK)
207#define pmd_clear(pmdp) do { set_pmd(pmdp, __pmd(0)); } while (0)
208
209static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITABLE; }
210static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
211static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
212static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
213static inline int pte_special(pte_t pte) { return 0; }
214
215static inline pte_t pte_wrprotect(pte_t pte)
216 { pte_val(pte) &= ~(_PAGE_WRITABLE | _PAGE_HW_WRITE); return pte; }
217static inline pte_t pte_mkclean(pte_t pte)
218 { pte_val(pte) &= ~(_PAGE_DIRTY | _PAGE_HW_WRITE); return pte; }
219static inline pte_t pte_mkold(pte_t pte)
220 { pte_val(pte) &= ~_PAGE_ACCESSED; return pte; }
221static inline pte_t pte_mkdirty(pte_t pte)
222 { pte_val(pte) |= _PAGE_DIRTY; return pte; }
223static inline pte_t pte_mkyoung(pte_t pte)
224 { pte_val(pte) |= _PAGE_ACCESSED; return pte; }
225static inline pte_t pte_mkwrite(pte_t pte)
226 { pte_val(pte) |= _PAGE_WRITABLE; return pte; }
227static inline pte_t pte_mkspecial(pte_t pte)
228 { return pte; }
229
230/*
231 * Conversion functions: convert a page and protection to a page entry,
232 * and a page entry and page directory to the page they refer to.
233 */
234
235#define pte_pfn(pte) (pte_val(pte) >> PAGE_SHIFT)
236#define pte_same(a,b) (pte_val(a) == pte_val(b))
237#define pte_page(x) pfn_to_page(pte_pfn(x))
238#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
239#define mk_pte(page, prot) pfn_pte(page_to_pfn(page), prot)
240
241static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
242{
243 return __pte((pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot));
244}
245
246/*
247 * Certain architectures need to do special things when pte's
248 * within a page table are directly modified. Thus, the following
249 * hook is made available.
250 */
251static inline void update_pte(pte_t *ptep, pte_t pteval)
252{
253 *ptep = pteval;
254#if (DCACHE_WAY_SIZE > PAGE_SIZE) && XCHAL_DCACHE_IS_WRITEBACK
255 __asm__ __volatile__ ("dhwb %0, 0" :: "a" (ptep));
256#endif
257
258}
259
260struct mm_struct;
261
262static inline void
263set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pteval)
264{
265 update_pte(ptep, pteval);
266}
267
268
269static inline void
270set_pmd(pmd_t *pmdp, pmd_t pmdval)
271{
272 *pmdp = pmdval;
273}
274
275struct vm_area_struct;
276
277static inline int
278ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr,
279 pte_t *ptep)
280{
281 pte_t pte = *ptep;
282 if (!pte_young(pte))
283 return 0;
284 update_pte(ptep, pte_mkold(pte));
285 return 1;
286}
287
288static inline pte_t
289ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
290{
291 pte_t pte = *ptep;
292 pte_clear(mm, addr, ptep);
293 return pte;
294}
295
296static inline void
297ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
298{
299 pte_t pte = *ptep;
300 update_pte(ptep, pte_wrprotect(pte));
301}
302
303/* to find an entry in a kernel page-table-directory */
304#define pgd_offset_k(address) pgd_offset(&init_mm, address)
305
306/* to find an entry in a page-table-directory */
307#define pgd_offset(mm,address) ((mm)->pgd + pgd_index(address))
308
309#define pgd_index(address) ((address) >> PGDIR_SHIFT)
310
311/* Find an entry in the second-level page table.. */
312#define pmd_offset(dir,address) ((pmd_t*)(dir))
313
314/* Find an entry in the third-level page table.. */
315#define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
316#define pte_offset_kernel(dir,addr) \
317 ((pte_t*) pmd_page_vaddr(*(dir)) + pte_index(addr))
318#define pte_offset_map(dir,addr) pte_offset_kernel((dir),(addr))
319#define pte_offset_map_nested(dir,addr) pte_offset_kernel((dir),(addr))
320
321#define pte_unmap(pte) do { } while (0)
322#define pte_unmap_nested(pte) do { } while (0)
323
324
325/*
326 * Encode and decode a swap entry.
327 *
328 * Format of swap pte:
329 * bit 0 MBZ
330 * bit 1 page-file (must be zero)
331 * bits 2 - 3 page hw access mode (must be 11: _PAGE_INVALID)
332 * bits 4 - 5 ring protection (must be 01: _PAGE_USER)
333 * bits 6 - 10 swap type (5 bits -> 32 types)
334 * bits 11 - 31 swap offset / PAGE_SIZE (21 bits -> 8GB)
335
336 * Format of file pte:
337 * bit 0 MBZ
338 * bit 1 page-file (must be one: _PAGE_FILE)
339 * bits 2 - 3 page hw access mode (must be 11: _PAGE_INVALID)
340 * bits 4 - 5 ring protection (must be 01: _PAGE_USER)
341 * bits 6 - 31 file offset / PAGE_SIZE
342 */
343
344#define __swp_type(entry) (((entry).val >> 6) & 0x1f)
345#define __swp_offset(entry) ((entry).val >> 11)
346#define __swp_entry(type,offs) \
347 ((swp_entry_t) {((type) << 6) | ((offs) << 11) | _PAGE_INVALID})
348#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
349#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
350
351#define PTE_FILE_MAX_BITS 28
352#define pte_to_pgoff(pte) (pte_val(pte) >> 4)
353#define pgoff_to_pte(off) \
354 ((pte_t) { ((off) << 4) | _PAGE_INVALID | _PAGE_FILE })
355
356#endif /* !defined (__ASSEMBLY__) */
357
358
359#ifdef __ASSEMBLY__
360
361/* Assembly macro _PGD_INDEX is the same as C pgd_index(unsigned long),
362 * _PGD_OFFSET as C pgd_offset(struct mm_struct*, unsigned long),
363 * _PMD_OFFSET as C pmd_offset(pgd_t*, unsigned long)
364 * _PTE_OFFSET as C pte_offset(pmd_t*, unsigned long)
365 *
366 * Note: We require an additional temporary register which can be the same as
367 * the register that holds the address.
368 *
369 * ((pte_t*) ((unsigned long)(pmd_val(*pmd) & PAGE_MASK)) + pte_index(addr))
370 *
371 */
372#define _PGD_INDEX(rt,rs) extui rt, rs, PGDIR_SHIFT, 32-PGDIR_SHIFT
373#define _PTE_INDEX(rt,rs) extui rt, rs, PAGE_SHIFT, PTRS_PER_PTE_SHIFT
374
375#define _PGD_OFFSET(mm,adr,tmp) l32i mm, mm, MM_PGD; \
376 _PGD_INDEX(tmp, adr); \
377 addx4 mm, tmp, mm
378
379#define _PTE_OFFSET(pmd,adr,tmp) _PTE_INDEX(tmp, adr); \
380 srli pmd, pmd, PAGE_SHIFT; \
381 slli pmd, pmd, PAGE_SHIFT; \
382 addx4 pmd, tmp, pmd
383
384#else
385
386extern void paging_init(void);
387
388#define kern_addr_valid(addr) (1)
389
390extern void update_mmu_cache(struct vm_area_struct * vma,
391 unsigned long address, pte_t pte);
392
393/*
394 * remap a physical page `pfn' of size `size' with page protection `prot'
395 * into virtual address `from'
396 */
397
398#define io_remap_pfn_range(vma,from,pfn,size,prot) \
399 remap_pfn_range(vma, from, pfn, size, prot)
400
401
402extern void pgtable_cache_init(void);
403
404typedef pte_t *pte_addr_t;
405
406#endif /* !defined (__ASSEMBLY__) */
407
408#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
409#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
410#define __HAVE_ARCH_PTEP_SET_WRPROTECT
411#define __HAVE_ARCH_PTEP_MKDIRTY
412#define __HAVE_ARCH_PTE_SAME
413
414#include <asm-generic/pgtable.h>
415
416#endif /* _XTENSA_PGTABLE_H */
diff --git a/include/asm-xtensa/platform-iss/hardware.h b/include/asm-xtensa/platform-iss/hardware.h
deleted file mode 100644
index 6930c12adc16..000000000000
--- a/include/asm-xtensa/platform-iss/hardware.h
+++ /dev/null
@@ -1,29 +0,0 @@
1/*
2 * include/asm-xtensa/platform-iss/hardware.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 Tensilica Inc.
9 */
10
11/*
12 * This file contains the default configuration of ISS.
13 */
14
15#ifndef _XTENSA_PLATFORM_ISS_HARDWARE_H
16#define _XTENSA_PLATFORM_ISS_HARDWARE_H
17
18/*
19 * Memory configuration.
20 */
21
22#define PLATFORM_DEFAULT_MEM_START 0x00000000
23#define PLATFORM_DEFAULT_MEM_SIZE 0x08000000
24
25/*
26 * Interrupt configuration.
27 */
28
29#endif /* _XTENSA_PLATFORM_ISS_HARDWARE_H */
diff --git a/include/asm-xtensa/platform-iss/simcall.h b/include/asm-xtensa/platform-iss/simcall.h
deleted file mode 100644
index b7952c06a2b7..000000000000
--- a/include/asm-xtensa/platform-iss/simcall.h
+++ /dev/null
@@ -1,62 +0,0 @@
1/*
2 * include/asm-xtensa/platform-iss/simcall.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_PLATFORM_ISS_SIMCALL_H
12#define _XTENSA_PLATFORM_ISS_SIMCALL_H
13
14
15/*
16 * System call like services offered by the simulator host.
17 */
18
19#define SYS_nop 0 /* unused */
20#define SYS_exit 1 /*x*/
21#define SYS_fork 2
22#define SYS_read 3 /*x*/
23#define SYS_write 4 /*x*/
24#define SYS_open 5 /*x*/
25#define SYS_close 6 /*x*/
26#define SYS_rename 7 /*x 38 - waitpid */
27#define SYS_creat 8 /*x*/
28#define SYS_link 9 /*x (not implemented on WIN32) */
29#define SYS_unlink 10 /*x*/
30#define SYS_execv 11 /* n/a - execve */
31#define SYS_execve 12 /* 11 - chdir */
32#define SYS_pipe 13 /* 42 - time */
33#define SYS_stat 14 /* 106 - mknod */
34#define SYS_chmod 15
35#define SYS_chown 16 /* 202 - lchown */
36#define SYS_utime 17 /* 30 - break */
37#define SYS_wait 18 /* n/a - oldstat */
38#define SYS_lseek 19 /*x*/
39#define SYS_getpid 20
40#define SYS_isatty 21 /* n/a - mount */
41#define SYS_fstat 22 /* 108 - oldumount */
42#define SYS_time 23 /* 13 - setuid */
43#define SYS_gettimeofday 24 /*x 78 - getuid (not implemented on WIN32) */
44#define SYS_times 25 /*X 43 - stime (Xtensa-specific implementation) */
45#define SYS_socket 26
46#define SYS_sendto 27
47#define SYS_recvfrom 28
48#define SYS_select_one 29 /* not compitible select, one file descriptor at the time */
49#define SYS_bind 30
50#define SYS_ioctl 31
51
52/*
53 * SYS_select_one specifiers
54 */
55
56#define XTISS_SELECT_ONE_READ 1
57#define XTISS_SELECT_ONE_WRITE 2
58#define XTISS_SELECT_ONE_EXCEPT 3
59
60
61#endif /* _XTENSA_PLATFORM_ISS_SIMCALL_H */
62
diff --git a/include/asm-xtensa/platform.h b/include/asm-xtensa/platform.h
deleted file mode 100644
index 48135a9718b0..000000000000
--- a/include/asm-xtensa/platform.h
+++ /dev/null
@@ -1,91 +0,0 @@
1/*
2 * include/asm-xtensa/platform.h
3 *
4 * Platform specific functions
5 *
6 * This file is subject to the terms and conditions of the GNU General
7 * Public License. See the file "COPYING" in the main directory of
8 * this archive for more details.
9 *
10 * Copyright (C) 2001 - 2005 Tensilica Inc.
11 */
12
13#ifndef _XTENSA_PLATFORM_H
14#define _XTENSA_PLATFORM_H
15
16#include <linux/types.h>
17#include <linux/pci.h>
18
19#include <asm/bootparam.h>
20
21/*
22 * platform_init is called before the mmu is initialized to give the
23 * platform a early hook-up. bp_tag_t is a list of configuration tags
24 * passed from the boot-loader.
25 */
26extern void platform_init(bp_tag_t*);
27
28/*
29 * platform_setup is called from setup_arch with a pointer to the command-line
30 * string.
31 */
32extern void platform_setup (char **);
33
34/*
35 * platform_init_irq is called from init_IRQ.
36 */
37extern void platform_init_irq (void);
38
39/*
40 * platform_restart is called to restart the system.
41 */
42extern void platform_restart (void);
43
44/*
45 * platform_halt is called to stop the system and halt.
46 */
47extern void platform_halt (void);
48
49/*
50 * platform_power_off is called to stop the system and power it off.
51 */
52extern void platform_power_off (void);
53
54/*
55 * platform_idle is called from the idle function.
56 */
57extern void platform_idle (void);
58
59/*
60 * platform_heartbeat is called every HZ
61 */
62extern void platform_heartbeat (void);
63
64/*
65 * platform_pcibios_init is called to allow the platform to setup the pci bus.
66 */
67extern void platform_pcibios_init (void);
68
69/*
70 * platform_pcibios_fixup allows to modify the PCI configuration.
71 */
72extern int platform_pcibios_fixup (void);
73
74/*
75 * platform_calibrate_ccount calibrates cpu clock freq (CONFIG_XTENSA_CALIBRATE)
76 */
77extern void platform_calibrate_ccount (void);
78
79/*
80 * platform_get_rtc_time returns RTC seconds (returns 0 for no error)
81 */
82extern int platform_get_rtc_time(time_t*);
83
84/*
85 * platform_set_rtc_time set RTC seconds (returns 0 for no error)
86 */
87extern int platform_set_rtc_time(time_t);
88
89
90#endif /* _XTENSA_PLATFORM_H */
91
diff --git a/include/asm-xtensa/poll.h b/include/asm-xtensa/poll.h
deleted file mode 100644
index 9d2d5993f068..000000000000
--- a/include/asm-xtensa/poll.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/*
2 * include/asm-xtensa/poll.h
3 *
4 * This file is subject to the terms and conditions of the GNU General
5 * Public License. See the file "COPYING" in the main directory of
6 * this archive for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_POLL_H
12#define _XTENSA_POLL_H
13
14#define POLLWRNORM POLLOUT
15#define POLLWRBAND 0x0100
16#define POLLREMOVE 0x0800
17
18#include <asm-generic/poll.h>
19
20#endif /* _XTENSA_POLL_H */
diff --git a/include/asm-xtensa/posix_types.h b/include/asm-xtensa/posix_types.h
deleted file mode 100644
index 43f9dd1126a4..000000000000
--- a/include/asm-xtensa/posix_types.h
+++ /dev/null
@@ -1,122 +0,0 @@
1/*
2 * include/asm-xtensa/posix_types.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Largely copied from include/asm-ppc/posix_types.h
9 *
10 * Copyright (C) 2001 - 2005 Tensilica Inc.
11 */
12
13#ifndef _XTENSA_POSIX_TYPES_H
14#define _XTENSA_POSIX_TYPES_H
15
16/*
17 * This file is generally used by user-level software, so you need to
18 * be a little careful about namespace pollution etc. Also, we cannot
19 * assume GCC is being used.
20 */
21
22typedef unsigned long __kernel_ino_t;
23typedef unsigned int __kernel_mode_t;
24typedef unsigned long __kernel_nlink_t;
25typedef long __kernel_off_t;
26typedef int __kernel_pid_t;
27typedef unsigned short __kernel_ipc_pid_t;
28typedef unsigned int __kernel_uid_t;
29typedef unsigned int __kernel_gid_t;
30typedef unsigned int __kernel_size_t;
31typedef int __kernel_ssize_t;
32typedef long __kernel_ptrdiff_t;
33typedef long __kernel_time_t;
34typedef long __kernel_suseconds_t;
35typedef long __kernel_clock_t;
36typedef int __kernel_timer_t;
37typedef int __kernel_clockid_t;
38typedef int __kernel_daddr_t;
39typedef char * __kernel_caddr_t;
40typedef unsigned short __kernel_uid16_t;
41typedef unsigned short __kernel_gid16_t;
42typedef unsigned int __kernel_uid32_t;
43typedef unsigned int __kernel_gid32_t;
44
45typedef unsigned short __kernel_old_uid_t;
46typedef unsigned short __kernel_old_gid_t;
47typedef unsigned short __kernel_old_dev_t;
48
49#ifdef __GNUC__
50typedef long long __kernel_loff_t;
51#endif
52
53typedef struct {
54 int val[2];
55} __kernel_fsid_t;
56
57#ifndef __GNUC__
58
59#define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d))
60#define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d))
61#define __FD_ISSET(d, set) ((set)->fds_bits[__FDELT(d)] & __FDMASK(d))
62#define __FD_ZERO(set) \
63 ((void) memset ((void *) (set), 0, sizeof (__kernel_fd_set)))
64
65#else /* __GNUC__ */
66
67#if defined(__KERNEL__)
68/* With GNU C, use inline functions instead so args are evaluated only once: */
69
70#undef __FD_SET
71static __inline__ void __FD_SET(unsigned long fd, __kernel_fd_set *fdsetp)
72{
73 unsigned long _tmp = fd / __NFDBITS;
74 unsigned long _rem = fd % __NFDBITS;
75 fdsetp->fds_bits[_tmp] |= (1UL<<_rem);
76}
77
78#undef __FD_CLR
79static __inline__ void __FD_CLR(unsigned long fd, __kernel_fd_set *fdsetp)
80{
81 unsigned long _tmp = fd / __NFDBITS;
82 unsigned long _rem = fd % __NFDBITS;
83 fdsetp->fds_bits[_tmp] &= ~(1UL<<_rem);
84}
85
86#undef __FD_ISSET
87static __inline__ int __FD_ISSET(unsigned long fd, __kernel_fd_set *p)
88{
89 unsigned long _tmp = fd / __NFDBITS;
90 unsigned long _rem = fd % __NFDBITS;
91 return (p->fds_bits[_tmp] & (1UL<<_rem)) != 0;
92}
93
94/*
95 * This will unroll the loop for the normal constant case (8 ints,
96 * for a 256-bit fd_set)
97 */
98#undef __FD_ZERO
99static __inline__ void __FD_ZERO(__kernel_fd_set *p)
100{
101 unsigned int *tmp = (unsigned int *)p->fds_bits;
102 int i;
103
104 if (__builtin_constant_p(__FDSET_LONGS)) {
105 switch (__FDSET_LONGS) {
106 case 8:
107 tmp[0] = 0; tmp[1] = 0; tmp[2] = 0; tmp[3] = 0;
108 tmp[4] = 0; tmp[5] = 0; tmp[6] = 0; tmp[7] = 0;
109 return;
110 }
111 }
112 i = __FDSET_LONGS;
113 while (i) {
114 i--;
115 *tmp = 0;
116 tmp++;
117 }
118}
119
120#endif /* defined(__KERNEL__) */
121#endif /* __GNUC__ */
122#endif /* _XTENSA_POSIX_TYPES_H */
diff --git a/include/asm-xtensa/processor.h b/include/asm-xtensa/processor.h
deleted file mode 100644
index 4918a4e96d42..000000000000
--- a/include/asm-xtensa/processor.h
+++ /dev/null
@@ -1,193 +0,0 @@
1/*
2 * include/asm-xtensa/processor.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_PROCESSOR_H
12#define _XTENSA_PROCESSOR_H
13
14#include <asm/variant/core.h>
15#include <asm/coprocessor.h>
16
17#include <linux/compiler.h>
18#include <asm/ptrace.h>
19#include <asm/types.h>
20#include <asm/regs.h>
21
22/* Assertions. */
23
24#if (XCHAL_HAVE_WINDOWED != 1)
25# error Linux requires the Xtensa Windowed Registers Option.
26#endif
27
28/*
29 * User space process size: 1 GB.
30 * Windowed call ABI requires caller and callee to be located within the same
31 * 1 GB region. The C compiler places trampoline code on the stack for sources
32 * that take the address of a nested C function (a feature used by glibc), so
33 * the 1 GB requirement applies to the stack as well.
34 */
35
36#define TASK_SIZE __XTENSA_UL_CONST(0x40000000)
37#define STACK_TOP TASK_SIZE
38#define STACK_TOP_MAX STACK_TOP
39
40/*
41 * General exception cause assigned to debug exceptions. Debug exceptions go
42 * to their own vector, rather than the general exception vectors (user,
43 * kernel, double); and their specific causes are reported via DEBUGCAUSE
44 * rather than EXCCAUSE. However it is sometimes convenient to redirect debug
45 * exceptions to the general exception mechanism. To do this, an otherwise
46 * unused EXCCAUSE value was assigned to debug exceptions for this purpose.
47 */
48
49#define EXCCAUSE_MAPPED_DEBUG 63
50
51/*
52 * We use DEPC also as a flag to distinguish between double and regular
53 * exceptions. For performance reasons, DEPC might contain the value of
54 * EXCCAUSE for regular exceptions, so we use this definition to mark a
55 * valid double exception address.
56 * (Note: We use it in bgeui, so it should be 64, 128, or 256)
57 */
58
59#define VALID_DOUBLE_EXCEPTION_ADDRESS 64
60
61/* LOCKLEVEL defines the interrupt level that masks all
62 * general-purpose interrupts.
63 */
64#define LOCKLEVEL 1
65
66/* WSBITS and WBBITS are the width of the WINDOWSTART and WINDOWBASE
67 * registers
68 */
69#define WSBITS (XCHAL_NUM_AREGS / 4) /* width of WINDOWSTART in bits */
70#define WBBITS (XCHAL_NUM_AREGS_LOG2 - 2) /* width of WINDOWBASE in bits */
71
72#ifndef __ASSEMBLY__
73
74/* Build a valid return address for the specified call winsize.
75 * winsize must be 1 (call4), 2 (call8), or 3 (call12)
76 */
77#define MAKE_RA_FOR_CALL(ra,ws) (((ra) & 0x3fffffff) | (ws) << 30)
78
79/* Convert return address to a valid pc
80 * Note: We assume that the stack pointer is in the same 1GB ranges as the ra
81 */
82#define MAKE_PC_FROM_RA(ra,sp) (((ra) & 0x3fffffff) | ((sp) & 0xc0000000))
83
84typedef struct {
85 unsigned long seg;
86} mm_segment_t;
87
88struct thread_struct {
89
90 /* kernel's return address and stack pointer for context switching */
91 unsigned long ra; /* kernel's a0: return address and window call size */
92 unsigned long sp; /* kernel's a1: stack pointer */
93
94 mm_segment_t current_ds; /* see uaccess.h for example uses */
95
96 /* struct xtensa_cpuinfo info; */
97
98 unsigned long bad_vaddr; /* last user fault */
99 unsigned long bad_uaddr; /* last kernel fault accessing user space */
100 unsigned long error_code;
101
102 unsigned long ibreak[XCHAL_NUM_IBREAK];
103 unsigned long dbreaka[XCHAL_NUM_DBREAK];
104 unsigned long dbreakc[XCHAL_NUM_DBREAK];
105
106 /* Make structure 16 bytes aligned. */
107 int align[0] __attribute__ ((aligned(16)));
108};
109
110
111/*
112 * Default implementation of macro that returns current
113 * instruction pointer ("program counter").
114 */
115#define current_text_addr() ({ __label__ _l; _l: &&_l;})
116
117
118/* This decides where the kernel will search for a free chunk of vm
119 * space during mmap's.
120 */
121#define TASK_UNMAPPED_BASE (TASK_SIZE / 2)
122
123#define INIT_THREAD \
124{ \
125 ra: 0, \
126 sp: sizeof(init_stack) + (long) &init_stack, \
127 current_ds: {0}, \
128 /*info: {0}, */ \
129 bad_vaddr: 0, \
130 bad_uaddr: 0, \
131 error_code: 0, \
132}
133
134
135/*
136 * Do necessary setup to start up a newly executed thread.
137 * Note: We set-up ps as if we did a call4 to the new pc.
138 * set_thread_state in signal.c depends on it.
139 */
140#define USER_PS_VALUE ((1 << PS_WOE_BIT) | \
141 (1 << PS_CALLINC_SHIFT) | \
142 (USER_RING << PS_RING_SHIFT) | \
143 (1 << PS_UM_BIT) | \
144 (1 << PS_EXCM_BIT))
145
146/* Clearing a0 terminates the backtrace. */
147#define start_thread(regs, new_pc, new_sp) \
148 regs->pc = new_pc; \
149 regs->ps = USER_PS_VALUE; \
150 regs->areg[1] = new_sp; \
151 regs->areg[0] = 0; \
152 regs->wmask = 1; \
153 regs->depc = 0; \
154 regs->windowbase = 0; \
155 regs->windowstart = 1;
156
157/* Forward declaration */
158struct task_struct;
159struct mm_struct;
160
161/* Free all resources held by a thread. */
162#define release_thread(thread) do { } while(0)
163
164/* Prepare to copy thread state - unlazy all lazy status */
165extern void prepare_to_copy(struct task_struct*);
166
167/* Create a kernel thread without removing it from tasklists */
168extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
169
170/* Copy and release all segment info associated with a VM */
171#define copy_segments(p, mm) do { } while(0)
172#define release_segments(mm) do { } while(0)
173#define forget_segments() do { } while (0)
174
175#define thread_saved_pc(tsk) (task_pt_regs(tsk)->pc)
176
177extern unsigned long get_wchan(struct task_struct *p);
178
179#define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc)
180#define KSTK_ESP(tsk) (task_pt_regs(tsk)->areg[1])
181
182#define cpu_relax() barrier()
183
184/* Special register access. */
185
186#define WSR(v,sr) __asm__ __volatile__ ("wsr %0,"__stringify(sr) :: "a"(v));
187#define RSR(v,sr) __asm__ __volatile__ ("rsr %0,"__stringify(sr) : "=a"(v));
188
189#define set_sr(x,sr) ({unsigned int v=(unsigned int)x; WSR(v,sr);})
190#define get_sr(sr) ({unsigned int v; RSR(v,sr); v; })
191
192#endif /* __ASSEMBLY__ */
193#endif /* _XTENSA_PROCESSOR_H */
diff --git a/include/asm-xtensa/ptrace.h b/include/asm-xtensa/ptrace.h
deleted file mode 100644
index 089b0db44816..000000000000
--- a/include/asm-xtensa/ptrace.h
+++ /dev/null
@@ -1,135 +0,0 @@
1/*
2 * include/asm-xtensa/ptrace.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_PTRACE_H
12#define _XTENSA_PTRACE_H
13
14/*
15 * Kernel stack
16 *
17 * +-----------------------+ -------- STACK_SIZE
18 * | register file | |
19 * +-----------------------+ |
20 * | struct pt_regs | |
21 * +-----------------------+ | ------ PT_REGS_OFFSET
22 * double : 16 bytes spill area : | ^
23 * excetion :- - - - - - - - - - - -: | |
24 * frame : struct pt_regs : | |
25 * :- - - - - - - - - - - -: | |
26 * | | | |
27 * | memory stack | | |
28 * | | | |
29 * ~ ~ ~ ~
30 * ~ ~ ~ ~
31 * | | | |
32 * | | | |
33 * +-----------------------+ | | --- STACK_BIAS
34 * | struct task_struct | | | ^
35 * current --> +-----------------------+ | | |
36 * | struct thread_info | | | |
37 * +-----------------------+ --------
38 */
39
40#define KERNEL_STACK_SIZE (2 * PAGE_SIZE)
41
42/* Offsets for exception_handlers[] (3 x 64-entries x 4-byte tables). */
43
44#define EXC_TABLE_KSTK 0x004 /* Kernel Stack */
45#define EXC_TABLE_DOUBLE_SAVE 0x008 /* Double exception save area for a0 */
46#define EXC_TABLE_FIXUP 0x00c /* Fixup handler */
47#define EXC_TABLE_PARAM 0x010 /* For passing a parameter to fixup */
48#define EXC_TABLE_SYSCALL_SAVE 0x014 /* For fast syscall handler */
49#define EXC_TABLE_FAST_USER 0x100 /* Fast user exception handler */
50#define EXC_TABLE_FAST_KERNEL 0x200 /* Fast kernel exception handler */
51#define EXC_TABLE_DEFAULT 0x300 /* Default C-Handler */
52#define EXC_TABLE_SIZE 0x400
53
54/* Registers used by strace */
55
56#define REG_A_BASE 0x0000
57#define REG_AR_BASE 0x0100
58#define REG_PC 0x0020
59#define REG_PS 0x02e6
60#define REG_WB 0x0248
61#define REG_WS 0x0249
62#define REG_LBEG 0x0200
63#define REG_LEND 0x0201
64#define REG_LCOUNT 0x0202
65#define REG_SAR 0x0203
66
67#define SYSCALL_NR 0x00ff
68
69/* Other PTRACE_ values defined in <linux/ptrace.h> using values 0-9,16,17,24 */
70
71#define PTRACE_GETREGS 12
72#define PTRACE_SETREGS 13
73#define PTRACE_GETXTREGS 18
74#define PTRACE_SETXTREGS 19
75
76#ifdef __KERNEL__
77
78#ifndef __ASSEMBLY__
79
80/*
81 * This struct defines the way the registers are stored on the
82 * kernel stack during a system call or other kernel entry.
83 */
84struct pt_regs {
85 unsigned long pc; /* 4 */
86 unsigned long ps; /* 8 */
87 unsigned long depc; /* 12 */
88 unsigned long exccause; /* 16 */
89 unsigned long excvaddr; /* 20 */
90 unsigned long debugcause; /* 24 */
91 unsigned long wmask; /* 28 */
92 unsigned long lbeg; /* 32 */
93 unsigned long lend; /* 36 */
94 unsigned long lcount; /* 40 */
95 unsigned long sar; /* 44 */
96 unsigned long windowbase; /* 48 */
97 unsigned long windowstart; /* 52 */
98 unsigned long syscall; /* 56 */
99 unsigned long icountlevel; /* 60 */
100 int reserved[1]; /* 64 */
101
102 /* Additional configurable registers that are used by the compiler. */
103 xtregs_opt_t xtregs_opt;
104
105 /* Make sure the areg field is 16 bytes aligned. */
106 int align[0] __attribute__ ((aligned(16)));
107
108 /* current register frame.
109 * Note: The ESF for kernel exceptions ends after 16 registers!
110 */
111 unsigned long areg[16]; /* 128 (64) */
112};
113
114#include <asm/variant/core.h>
115
116# define task_pt_regs(tsk) ((struct pt_regs*) \
117 (task_stack_page(tsk) + KERNEL_STACK_SIZE - (XCHAL_NUM_AREGS-16)*4) - 1)
118# define user_mode(regs) (((regs)->ps & 0x00000020)!=0)
119# define instruction_pointer(regs) ((regs)->pc)
120extern void show_regs(struct pt_regs *);
121
122# ifndef CONFIG_SMP
123# define profile_pc(regs) instruction_pointer(regs)
124# endif
125
126#else /* __ASSEMBLY__ */
127
128# include <asm/asm-offsets.h>
129#define PT_REGS_OFFSET (KERNEL_STACK_SIZE - PT_USER_SIZE)
130
131#endif /* !__ASSEMBLY__ */
132
133#endif /* __KERNEL__ */
134
135#endif /* _XTENSA_PTRACE_H */
diff --git a/include/asm-xtensa/regs.h b/include/asm-xtensa/regs.h
deleted file mode 100644
index d4baed246928..000000000000
--- a/include/asm-xtensa/regs.h
+++ /dev/null
@@ -1,145 +0,0 @@
1/*
2 * Copyright (c) 2006 Tensilica, Inc. All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of version 2.1 of the GNU Lesser General Public
6 * License as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it would be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 *
12 * Further, this software is distributed without any warranty that it is
13 * free of the rightful claim of any third person regarding infringement
14 * or the like. Any license provided herein, whether implied or
15 * otherwise, applies only to this software file. Patent licenses, if
16 * any, provided herein do not apply to combinations of this program with
17 * other software, or any other product whatsoever.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this program; if not, write the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307,
22 * USA.
23 */
24
25#ifndef _XTENSA_REGS_H
26#define _XTENSA_REGS_H
27
28/* Special registers. */
29
30#define LBEG 0
31#define LEND 1
32#define LCOUNT 2
33#define SAR 3
34#define BR 4
35#define SCOMPARE1 12
36#define ACCHI 16
37#define ACCLO 17
38#define MR 32
39#define WINDOWBASE 72
40#define WINDOWSTART 73
41#define PTEVADDR 83
42#define RASID 90
43#define ITLBCFG 91
44#define DTLBCFG 92
45#define IBREAKENABLE 96
46#define DDR 104
47#define IBREAKA 128
48#define DBREAKA 144
49#define DBREAKC 160
50#define EPC 176
51#define EPC_1 177
52#define DEPC 192
53#define EPS 192
54#define EPS_1 193
55#define EXCSAVE 208
56#define EXCSAVE_1 209
57#define INTERRUPT 226
58#define INTENABLE 228
59#define PS 230
60#define THREADPTR 231
61#define EXCCAUSE 232
62#define DEBUGCAUSE 233
63#define CCOUNT 234
64#define PRID 235
65#define ICOUNT 236
66#define ICOUNTLEVEL 237
67#define EXCVADDR 238
68#define CCOMPARE 240
69#define MISC 244
70
71/* Special names for read-only and write-only interrupt registers. */
72
73#define INTREAD 226
74#define INTSET 226
75#define INTCLEAR 227
76
77/* EXCCAUSE register fields */
78
79#define EXCCAUSE_EXCCAUSE_SHIFT 0
80#define EXCCAUSE_EXCCAUSE_MASK 0x3F
81
82#define EXCCAUSE_ILLEGAL_INSTRUCTION 0
83#define EXCCAUSE_SYSTEM_CALL 1
84#define EXCCAUSE_INSTRUCTION_FETCH_ERROR 2
85#define EXCCAUSE_LOAD_STORE_ERROR 3
86#define EXCCAUSE_LEVEL1_INTERRUPT 4
87#define EXCCAUSE_ALLOCA 5
88#define EXCCAUSE_INTEGER_DIVIDE_BY_ZERO 6
89#define EXCCAUSE_SPECULATION 7
90#define EXCCAUSE_PRIVILEGED 8
91#define EXCCAUSE_UNALIGNED 9
92#define EXCCAUSE_ITLB_MISS 16
93#define EXCCAUSE_ITLB_MULTIHIT 17
94#define EXCCAUSE_ITLB_PRIVILEGE 18
95#define EXCCAUSE_ITLB_SIZE_RESTRICTION 19
96#define EXCCAUSE_FETCH_CACHE_ATTRIBUTE 20
97#define EXCCAUSE_DTLB_MISS 24
98#define EXCCAUSE_DTLB_MULTIHIT 25
99#define EXCCAUSE_DTLB_PRIVILEGE 26
100#define EXCCAUSE_DTLB_SIZE_RESTRICTION 27
101#define EXCCAUSE_LOAD_CACHE_ATTRIBUTE 28
102#define EXCCAUSE_STORE_CACHE_ATTRIBUTE 29
103#define EXCCAUSE_COPROCESSOR0_DISABLED 32
104#define EXCCAUSE_COPROCESSOR1_DISABLED 33
105#define EXCCAUSE_COPROCESSOR2_DISABLED 34
106#define EXCCAUSE_COPROCESSOR3_DISABLED 35
107#define EXCCAUSE_COPROCESSOR4_DISABLED 36
108#define EXCCAUSE_COPROCESSOR5_DISABLED 37
109#define EXCCAUSE_COPROCESSOR6_DISABLED 38
110#define EXCCAUSE_COPROCESSOR7_DISABLED 39
111
112/* PS register fields. */
113
114#define PS_WOE_BIT 18
115#define PS_CALLINC_SHIFT 16
116#define PS_CALLINC_MASK 0x00030000
117#define PS_OWB_SHIFT 8
118#define PS_OWB_MASK 0x00000F00
119#define PS_RING_SHIFT 6
120#define PS_RING_MASK 0x000000C0
121#define PS_UM_BIT 5
122#define PS_EXCM_BIT 4
123#define PS_INTLEVEL_SHIFT 0
124#define PS_INTLEVEL_MASK 0x0000000F
125
126/* DBREAKCn register fields. */
127
128#define DBREAKC_MASK_BIT 0
129#define DBREAKC_MASK_MASK 0x0000003F
130#define DBREAKC_LOAD_BIT 30
131#define DBREAKC_LOAD_MASK 0x40000000
132#define DBREAKC_STOR_BIT 31
133#define DBREAKC_STOR_MASK 0x80000000
134
135/* DEBUGCAUSE register fields. */
136
137#define DEBUGCAUSE_DEBUGINT_BIT 5 /* External debug interrupt */
138#define DEBUGCAUSE_BREAKN_BIT 4 /* BREAK.N instruction */
139#define DEBUGCAUSE_BREAK_BIT 3 /* BREAK instruction */
140#define DEBUGCAUSE_DBREAK_BIT 2 /* DBREAK match */
141#define DEBUGCAUSE_IBREAK_BIT 1 /* IBREAK match */
142#define DEBUGCAUSE_ICOUNT_BIT 0 /* ICOUNT would incr. to zero */
143
144#endif /* _XTENSA_SPECREG_H */
145
diff --git a/include/asm-xtensa/resource.h b/include/asm-xtensa/resource.h
deleted file mode 100644
index 17b5ab311771..000000000000
--- a/include/asm-xtensa/resource.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * include/asm-xtensa/resource.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_RESOURCE_H
12#define _XTENSA_RESOURCE_H
13
14#include <asm-generic/resource.h>
15
16#endif /* _XTENSA_RESOURCE_H */
diff --git a/include/asm-xtensa/rmap.h b/include/asm-xtensa/rmap.h
deleted file mode 100644
index 649588b7e9ad..000000000000
--- a/include/asm-xtensa/rmap.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * include/asm-xtensa/rmap.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_RMAP_H
12#define _XTENSA_RMAP_H
13
14#include <asm-generic/rmap.h>
15
16#endif
diff --git a/include/asm-xtensa/rwsem.h b/include/asm-xtensa/rwsem.h
deleted file mode 100644
index e39edf5c86f2..000000000000
--- a/include/asm-xtensa/rwsem.h
+++ /dev/null
@@ -1,168 +0,0 @@
1/*
2 * include/asm-xtensa/rwsem.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Largely copied from include/asm-ppc/rwsem.h
9 *
10 * Copyright (C) 2001 - 2005 Tensilica Inc.
11 */
12
13#ifndef _XTENSA_RWSEM_H
14#define _XTENSA_RWSEM_H
15
16#ifndef _LINUX_RWSEM_H
17#error "Please don't include <asm/rwsem.h> directly, use <linux/rwsem.h> instead."
18#endif
19
20#include <linux/list.h>
21#include <linux/spinlock.h>
22#include <asm/atomic.h>
23#include <asm/system.h>
24
25/*
26 * the semaphore definition
27 */
28struct rw_semaphore {
29 signed long count;
30#define RWSEM_UNLOCKED_VALUE 0x00000000
31#define RWSEM_ACTIVE_BIAS 0x00000001
32#define RWSEM_ACTIVE_MASK 0x0000ffff
33#define RWSEM_WAITING_BIAS (-0x00010000)
34#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS
35#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
36 spinlock_t wait_lock;
37 struct list_head wait_list;
38};
39
40#define __RWSEM_INITIALIZER(name) \
41 { RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, \
42 LIST_HEAD_INIT((name).wait_list) }
43
44#define DECLARE_RWSEM(name) \
45 struct rw_semaphore name = __RWSEM_INITIALIZER(name)
46
47extern struct rw_semaphore *rwsem_down_read_failed(struct rw_semaphore *sem);
48extern struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *sem);
49extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem);
50extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem);
51
52static inline void init_rwsem(struct rw_semaphore *sem)
53{
54 sem->count = RWSEM_UNLOCKED_VALUE;
55 spin_lock_init(&sem->wait_lock);
56 INIT_LIST_HEAD(&sem->wait_list);
57}
58
59/*
60 * lock for reading
61 */
62static inline void __down_read(struct rw_semaphore *sem)
63{
64 if (atomic_add_return(1,(atomic_t *)(&sem->count)) > 0)
65 smp_wmb();
66 else
67 rwsem_down_read_failed(sem);
68}
69
70static inline int __down_read_trylock(struct rw_semaphore *sem)
71{
72 int tmp;
73
74 while ((tmp = sem->count) >= 0) {
75 if (tmp == cmpxchg(&sem->count, tmp,
76 tmp + RWSEM_ACTIVE_READ_BIAS)) {
77 smp_wmb();
78 return 1;
79 }
80 }
81 return 0;
82}
83
84/*
85 * lock for writing
86 */
87static inline void __down_write(struct rw_semaphore *sem)
88{
89 int tmp;
90
91 tmp = atomic_add_return(RWSEM_ACTIVE_WRITE_BIAS,
92 (atomic_t *)(&sem->count));
93 if (tmp == RWSEM_ACTIVE_WRITE_BIAS)
94 smp_wmb();
95 else
96 rwsem_down_write_failed(sem);
97}
98
99static inline int __down_write_trylock(struct rw_semaphore *sem)
100{
101 int tmp;
102
103 tmp = cmpxchg(&sem->count, RWSEM_UNLOCKED_VALUE,
104 RWSEM_ACTIVE_WRITE_BIAS);
105 smp_wmb();
106 return tmp == RWSEM_UNLOCKED_VALUE;
107}
108
109/*
110 * unlock after reading
111 */
112static inline void __up_read(struct rw_semaphore *sem)
113{
114 int tmp;
115
116 smp_wmb();
117 tmp = atomic_sub_return(1,(atomic_t *)(&sem->count));
118 if (tmp < -1 && (tmp & RWSEM_ACTIVE_MASK) == 0)
119 rwsem_wake(sem);
120}
121
122/*
123 * unlock after writing
124 */
125static inline void __up_write(struct rw_semaphore *sem)
126{
127 smp_wmb();
128 if (atomic_sub_return(RWSEM_ACTIVE_WRITE_BIAS,
129 (atomic_t *)(&sem->count)) < 0)
130 rwsem_wake(sem);
131}
132
133/*
134 * implement atomic add functionality
135 */
136static inline void rwsem_atomic_add(int delta, struct rw_semaphore *sem)
137{
138 atomic_add(delta, (atomic_t *)(&sem->count));
139}
140
141/*
142 * downgrade write lock to read lock
143 */
144static inline void __downgrade_write(struct rw_semaphore *sem)
145{
146 int tmp;
147
148 smp_wmb();
149 tmp = atomic_add_return(-RWSEM_WAITING_BIAS, (atomic_t *)(&sem->count));
150 if (tmp < 0)
151 rwsem_downgrade_wake(sem);
152}
153
154/*
155 * implement exchange and add functionality
156 */
157static inline int rwsem_atomic_update(int delta, struct rw_semaphore *sem)
158{
159 smp_mb();
160 return atomic_add_return(delta, (atomic_t *)(&sem->count));
161}
162
163static inline int rwsem_is_locked(struct rw_semaphore *sem)
164{
165 return (sem->count != 0);
166}
167
168#endif /* _XTENSA_RWSEM_H */
diff --git a/include/asm-xtensa/scatterlist.h b/include/asm-xtensa/scatterlist.h
deleted file mode 100644
index 810080bb0a2b..000000000000
--- a/include/asm-xtensa/scatterlist.h
+++ /dev/null
@@ -1,39 +0,0 @@
1/*
2 * include/asm-xtensa/scatterlist.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_SCATTERLIST_H
12#define _XTENSA_SCATTERLIST_H
13
14#include <asm/types.h>
15
16struct scatterlist {
17#ifdef CONFIG_DEBUG_SG
18 unsigned long sg_magic;
19#endif
20 unsigned long page_link;
21 unsigned int offset;
22 dma_addr_t dma_address;
23 unsigned int length;
24};
25
26/*
27 * These macros should be used after a pci_map_sg call has been done
28 * to get bus addresses of each of the SG entries and their lengths.
29 * You should only work with the number of sg entries pci_map_sg
30 * returns, or alternatively stop on the first sg_dma_len(sg) which
31 * is 0.
32 */
33#define sg_dma_address(sg) ((sg)->dma_address)
34#define sg_dma_len(sg) ((sg)->length)
35
36
37#define ISA_DMA_THRESHOLD (~0UL)
38
39#endif /* _XTENSA_SCATTERLIST_H */
diff --git a/include/asm-xtensa/sections.h b/include/asm-xtensa/sections.h
deleted file mode 100644
index 40b5191b55a2..000000000000
--- a/include/asm-xtensa/sections.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * include/asm-xtensa/sections.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_SECTIONS_H
12#define _XTENSA_SECTIONS_H
13
14#include <asm-generic/sections.h>
15
16#endif /* _XTENSA_SECTIONS_H */
diff --git a/include/asm-xtensa/segment.h b/include/asm-xtensa/segment.h
deleted file mode 100644
index a2eb547a1a75..000000000000
--- a/include/asm-xtensa/segment.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * include/asm-xtensa/segment.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_SEGMENT_H
12#define _XTENSA_SEGMENT_H
13
14#include <asm/uaccess.h>
15
16#endif /* _XTENSA_SEGEMENT_H */
diff --git a/include/asm-xtensa/sembuf.h b/include/asm-xtensa/sembuf.h
deleted file mode 100644
index c15870493b33..000000000000
--- a/include/asm-xtensa/sembuf.h
+++ /dev/null
@@ -1,44 +0,0 @@
1/*
2 * include/asm-xtensa/sembuf.h
3 *
4 * The semid64_ds structure for Xtensa architecture.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 *
10 * Copyright (C) 2001 - 2005 Tensilica Inc.
11 *
12 * Note extra padding because this structure is passed back and forth
13 * between kernel and user space.
14 *
15 * Pad space is left for:
16 * - 64-bit time_t to solve y2038 problem
17 * - 2 miscellaneous 32-bit values
18 *
19 */
20
21#ifndef _XTENSA_SEMBUF_H
22#define _XTENSA_SEMBUF_H
23
24#include <asm/byteorder.h>
25
26struct semid64_ds {
27 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
28#ifdef __XTENSA_EL__
29 __kernel_time_t sem_otime; /* last semop time */
30 unsigned long __unused1;
31 __kernel_time_t sem_ctime; /* last change time */
32 unsigned long __unused2;
33#else
34 unsigned long __unused1;
35 __kernel_time_t sem_otime; /* last semop time */
36 unsigned long __unused2;
37 __kernel_time_t sem_ctime; /* last change time */
38#endif
39 unsigned long sem_nsems; /* no. of semaphores in array */
40 unsigned long __unused3;
41 unsigned long __unused4;
42};
43
44#endif /* __ASM_XTENSA_SEMBUF_H */
diff --git a/include/asm-xtensa/serial.h b/include/asm-xtensa/serial.h
deleted file mode 100644
index ec04114fcf0b..000000000000
--- a/include/asm-xtensa/serial.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/*
2 * include/asm-xtensa/serial.h
3 *
4 * Configuration details for 8250, 16450, 16550, etc. serial ports
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 *
10 * Copyright (C) 2001 - 2005 Tensilica Inc.
11 */
12
13#ifndef _XTENSA_SERIAL_H
14#define _XTENSA_SERIAL_H
15
16#include <asm/platform/serial.h>
17
18#endif /* _XTENSA_SERIAL_H */
diff --git a/include/asm-xtensa/setup.h b/include/asm-xtensa/setup.h
deleted file mode 100644
index e3636520d8cc..000000000000
--- a/include/asm-xtensa/setup.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * include/asm-xtensa/setup.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_SETUP_H
12#define _XTENSA_SETUP_H
13
14#define COMMAND_LINE_SIZE 256
15
16#endif
diff --git a/include/asm-xtensa/shmbuf.h b/include/asm-xtensa/shmbuf.h
deleted file mode 100644
index ad4b0121782c..000000000000
--- a/include/asm-xtensa/shmbuf.h
+++ /dev/null
@@ -1,71 +0,0 @@
1/*
2 * include/asm-xtensa/shmbuf.h
3 *
4 * The shmid64_ds structure for Xtensa architecture.
5 * Note extra padding because this structure is passed back and forth
6 * between kernel and user space.
7 *
8 * Pad space is left for:
9 * - 64-bit time_t to solve y2038 problem
10 * - 2 miscellaneous 32-bit values
11 *
12 * This file is subject to the terms and conditions of the GNU General Public
13 * License. See the file "COPYING" in the main directory of this archive
14 * for more details.
15 *
16 * Copyright (C) 2001 - 2005 Tensilica Inc.
17 */
18
19#ifndef _XTENSA_SHMBUF_H
20#define _XTENSA_SHMBUF_H
21
22#if defined (__XTENSA_EL__)
23struct shmid64_ds {
24 struct ipc64_perm shm_perm; /* operation perms */
25 size_t shm_segsz; /* size of segment (bytes) */
26 __kernel_time_t shm_atime; /* last attach time */
27 unsigned long __unused1;
28 __kernel_time_t shm_dtime; /* last detach time */
29 unsigned long __unused2;
30 __kernel_time_t shm_ctime; /* last change time */
31 unsigned long __unused3;
32 __kernel_pid_t shm_cpid; /* pid of creator */
33 __kernel_pid_t shm_lpid; /* pid of last operator */
34 unsigned long shm_nattch; /* no. of current attaches */
35 unsigned long __unused4;
36 unsigned long __unused5;
37};
38#elif defined (__XTENSA_EB__)
39struct shmid64_ds {
40 struct ipc64_perm shm_perm; /* operation perms */
41 size_t shm_segsz; /* size of segment (bytes) */
42 __kernel_time_t shm_atime; /* last attach time */
43 unsigned long __unused1;
44 __kernel_time_t shm_dtime; /* last detach time */
45 unsigned long __unused2;
46 __kernel_time_t shm_ctime; /* last change time */
47 unsigned long __unused3;
48 __kernel_pid_t shm_cpid; /* pid of creator */
49 __kernel_pid_t shm_lpid; /* pid of last operator */
50 unsigned long shm_nattch; /* no. of current attaches */
51 unsigned long __unused4;
52 unsigned long __unused5;
53};
54#else
55# error endian order not defined
56#endif
57
58
59struct shminfo64 {
60 unsigned long shmmax;
61 unsigned long shmmin;
62 unsigned long shmmni;
63 unsigned long shmseg;
64 unsigned long shmall;
65 unsigned long __unused1;
66 unsigned long __unused2;
67 unsigned long __unused3;
68 unsigned long __unused4;
69};
70
71#endif /* _XTENSA_SHMBUF_H */
diff --git a/include/asm-xtensa/shmparam.h b/include/asm-xtensa/shmparam.h
deleted file mode 100644
index c8cc16c3da9e..000000000000
--- a/include/asm-xtensa/shmparam.h
+++ /dev/null
@@ -1,21 +0,0 @@
1/*
2 * include/asm-xtensa/shmparam.h
3 *
4 * This file is subject to the terms and conditions of the GNU General
5 * Public License. See the file "COPYING" in the main directory of
6 * this archive for more details.
7 */
8
9#ifndef _XTENSA_SHMPARAM_H
10#define _XTENSA_SHMPARAM_H
11
12/*
13 * Xtensa can have variable size caches, and if
14 * the size of single way is larger than the page size,
15 * then we have to start worrying about cache aliasing
16 * problems.
17 */
18
19#define SHMLBA ((PAGE_SIZE > DCACHE_WAY_SIZE)? PAGE_SIZE : DCACHE_WAY_SIZE)
20
21#endif /* _XTENSA_SHMPARAM_H */
diff --git a/include/asm-xtensa/sigcontext.h b/include/asm-xtensa/sigcontext.h
deleted file mode 100644
index 03383af8c3b7..000000000000
--- a/include/asm-xtensa/sigcontext.h
+++ /dev/null
@@ -1,28 +0,0 @@
1/*
2 * include/asm-xtensa/sigcontext.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2007 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_SIGCONTEXT_H
12#define _XTENSA_SIGCONTEXT_H
13
14
15struct sigcontext {
16 unsigned long sc_pc;
17 unsigned long sc_ps;
18 unsigned long sc_lbeg;
19 unsigned long sc_lend;
20 unsigned long sc_lcount;
21 unsigned long sc_sar;
22 unsigned long sc_acclo;
23 unsigned long sc_acchi;
24 unsigned long sc_a[16];
25 void *sc_xtregs;
26};
27
28#endif /* _XTENSA_SIGCONTEXT_H */
diff --git a/include/asm-xtensa/siginfo.h b/include/asm-xtensa/siginfo.h
deleted file mode 100644
index 6916248295df..000000000000
--- a/include/asm-xtensa/siginfo.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * include/asm-xtensa/siginfo.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_SIGINFO_H
12#define _XTENSA_SIGINFO_H
13
14#include <asm-generic/siginfo.h>
15
16#endif /* _XTENSA_SIGINFO_H */
diff --git a/include/asm-xtensa/signal.h b/include/asm-xtensa/signal.h
deleted file mode 100644
index 633ba73bc4d2..000000000000
--- a/include/asm-xtensa/signal.h
+++ /dev/null
@@ -1,172 +0,0 @@
1/*
2 * include/asm-xtensa/signal.h
3 *
4 * Swiped from SH.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 *
10 * Copyright (C) 2001 - 2005 Tensilica Inc.
11 */
12
13#ifndef _XTENSA_SIGNAL_H
14#define _XTENSA_SIGNAL_H
15
16
17#define _NSIG 64
18#define _NSIG_BPW 32
19#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
20
21#ifndef __ASSEMBLY__
22
23#include <linux/types.h>
24
25/* Avoid too many header ordering problems. */
26struct siginfo;
27typedef unsigned long old_sigset_t; /* at least 32 bits */
28typedef struct {
29 unsigned long sig[_NSIG_WORDS];
30} sigset_t;
31
32#endif
33
34#define SIGHUP 1
35#define SIGINT 2
36#define SIGQUIT 3
37#define SIGILL 4
38#define SIGTRAP 5
39#define SIGABRT 6
40#define SIGIOT 6
41#define SIGBUS 7
42#define SIGFPE 8
43#define SIGKILL 9
44#define SIGUSR1 10
45#define SIGSEGV 11
46#define SIGUSR2 12
47#define SIGPIPE 13
48#define SIGALRM 14
49#define SIGTERM 15
50#define SIGSTKFLT 16
51#define SIGCHLD 17
52#define SIGCONT 18
53#define SIGSTOP 19
54#define SIGTSTP 20
55#define SIGTTIN 21
56#define SIGTTOU 22
57#define SIGURG 23
58#define SIGXCPU 24
59#define SIGXFSZ 25
60#define SIGVTALRM 26
61#define SIGPROF 27
62#define SIGWINCH 28
63#define SIGIO 29
64#define SIGPOLL SIGIO
65/* #define SIGLOST 29 */
66#define SIGPWR 30
67#define SIGSYS 31
68#define SIGUNUSED 31
69
70/* These should not be considered constants from userland. */
71#define SIGRTMIN 32
72#define SIGRTMAX (_NSIG-1)
73
74/*
75 * SA_FLAGS values:
76 *
77 * SA_ONSTACK indicates that a registered stack_t will be used.
78 * SA_RESTART flag to get restarting signals (which were the default long ago)
79 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
80 * SA_RESETHAND clears the handler when the signal is delivered.
81 * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
82 * SA_NODEFER prevents the current signal from being masked in the handler.
83 *
84 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
85 * Unix names RESETHAND and NODEFER respectively.
86 */
87#define SA_NOCLDSTOP 0x00000001
88#define SA_NOCLDWAIT 0x00000002 /* not supported yet */
89#define SA_SIGINFO 0x00000004
90#define SA_ONSTACK 0x08000000
91#define SA_RESTART 0x10000000
92#define SA_NODEFER 0x40000000
93#define SA_RESETHAND 0x80000000
94
95#define SA_NOMASK SA_NODEFER
96#define SA_ONESHOT SA_RESETHAND
97
98#define SA_RESTORER 0x04000000
99
100/*
101 * sigaltstack controls
102 */
103#define SS_ONSTACK 1
104#define SS_DISABLE 2
105
106#define MINSIGSTKSZ 2048
107#define SIGSTKSZ 8192
108
109#ifndef __ASSEMBLY__
110
111#define SIG_BLOCK 0 /* for blocking signals */
112#define SIG_UNBLOCK 1 /* for unblocking signals */
113#define SIG_SETMASK 2 /* for setting the signal mask */
114
115/* Type of a signal handler. */
116typedef void (*__sighandler_t)(int);
117
118#define SIG_DFL ((__sighandler_t)0) /* default signal handling */
119#define SIG_IGN ((__sighandler_t)1) /* ignore signal */
120#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */
121
122#ifdef __KERNEL__
123struct old_sigaction {
124 __sighandler_t sa_handler;
125 old_sigset_t sa_mask;
126 unsigned long sa_flags;
127 void (*sa_restorer)(void);
128};
129
130struct sigaction {
131 __sighandler_t sa_handler;
132 unsigned long sa_flags;
133 void (*sa_restorer)(void);
134 sigset_t sa_mask; /* mask last for extensibility */
135};
136
137struct k_sigaction {
138 struct sigaction sa;
139};
140
141#else
142
143/* Here we must cater to libcs that poke about in kernel headers. */
144
145struct sigaction {
146 union {
147 __sighandler_t _sa_handler;
148 void (*_sa_sigaction)(int, struct siginfo *, void *);
149 } _u;
150 sigset_t sa_mask;
151 unsigned long sa_flags;
152 void (*sa_restorer)(void);
153};
154
155#define sa_handler _u._sa_handler
156#define sa_sigaction _u._sa_sigaction
157
158#endif /* __KERNEL__ */
159
160typedef struct sigaltstack {
161 void *ss_sp;
162 int ss_flags;
163 size_t ss_size;
164} stack_t;
165
166#ifdef __KERNEL__
167#include <asm/sigcontext.h>
168#define ptrace_signal_deliver(regs, cookie) do { } while (0)
169
170#endif /* __KERNEL__ */
171#endif /* __ASSEMBLY__ */
172#endif /* _XTENSA_SIGNAL_H */
diff --git a/include/asm-xtensa/smp.h b/include/asm-xtensa/smp.h
deleted file mode 100644
index 83c569e3bdbd..000000000000
--- a/include/asm-xtensa/smp.h
+++ /dev/null
@@ -1,27 +0,0 @@
1/*
2 * include/asm-xtensa/smp.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_SMP_H
12#define _XTENSA_SMP_H
13
14extern struct xtensa_cpuinfo boot_cpu_data;
15
16#define cpu_data (&boot_cpu_data)
17#define current_cpu_data boot_cpu_data
18
19struct xtensa_cpuinfo {
20 unsigned long *pgd_cache;
21 unsigned long *pte_cache;
22 unsigned long pgtable_cache_sz;
23};
24
25#define cpu_logical_map(cpu) (cpu)
26
27#endif /* _XTENSA_SMP_H */
diff --git a/include/asm-xtensa/socket.h b/include/asm-xtensa/socket.h
deleted file mode 100644
index 6100682b1da2..000000000000
--- a/include/asm-xtensa/socket.h
+++ /dev/null
@@ -1,68 +0,0 @@
1/*
2 * include/asm-xtensa/socket.h
3 *
4 * Copied from i386.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10
11#ifndef _XTENSA_SOCKET_H
12#define _XTENSA_SOCKET_H
13
14#include <asm/sockios.h>
15
16/* For setsockoptions(2) */
17#define SOL_SOCKET 1
18
19#define SO_DEBUG 1
20#define SO_REUSEADDR 2
21#define SO_TYPE 3
22#define SO_ERROR 4
23#define SO_DONTROUTE 5
24#define SO_BROADCAST 6
25#define SO_SNDBUF 7
26#define SO_RCVBUF 8
27#define SO_SNDBUFFORCE 32
28#define SO_RCVBUFFORCE 33
29#define SO_KEEPALIVE 9
30#define SO_OOBINLINE 10
31#define SO_NO_CHECK 11
32#define SO_PRIORITY 12
33#define SO_LINGER 13
34#define SO_BSDCOMPAT 14
35/* To add :#define SO_REUSEPORT 15 */
36#define SO_PASSCRED 16
37#define SO_PEERCRED 17
38#define SO_RCVLOWAT 18
39#define SO_SNDLOWAT 19
40#define SO_RCVTIMEO 20
41#define SO_SNDTIMEO 21
42
43/* Security levels - as per NRL IPv6 - don't actually do anything */
44
45#define SO_SECURITY_AUTHENTICATION 22
46#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
47#define SO_SECURITY_ENCRYPTION_NETWORK 24
48
49#define SO_BINDTODEVICE 25
50
51/* Socket filtering */
52
53#define SO_ATTACH_FILTER 26
54#define SO_DETACH_FILTER 27
55
56#define SO_PEERNAME 28
57#define SO_TIMESTAMP 29
58#define SCM_TIMESTAMP SO_TIMESTAMP
59
60#define SO_ACCEPTCONN 30
61#define SO_PEERSEC 31
62#define SO_PASSSEC 34
63#define SO_TIMESTAMPNS 35
64#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
65
66#define SO_MARK 36
67
68#endif /* _XTENSA_SOCKET_H */
diff --git a/include/asm-xtensa/sockios.h b/include/asm-xtensa/sockios.h
deleted file mode 100644
index efe0af379f01..000000000000
--- a/include/asm-xtensa/sockios.h
+++ /dev/null
@@ -1,31 +0,0 @@
1/*
2 * include/asm-xtensa/sockios.h
3 *
4 * Socket-level I/O control calls. Copied from MIPS.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 *
10 * Copyright (C) 1995 by Ralf Baechle
11 * Copyright (C) 2001 Tensilica Inc.
12 */
13
14#ifndef _XTENSA_SOCKIOS_H
15#define _XTENSA_SOCKIOS_H
16
17#include <asm/ioctl.h>
18
19/* Socket-level I/O control calls. */
20
21#define FIOGETOWN _IOR('f', 123, int)
22#define FIOSETOWN _IOW('f', 124, int)
23
24#define SIOCATMARK _IOR('s', 7, int)
25#define SIOCSPGRP _IOW('s', 8, pid_t)
26#define SIOCGPGRP _IOR('s', 9, pid_t)
27
28#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
29#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
30
31#endif /* _XTENSA_SOCKIOS_H */
diff --git a/include/asm-xtensa/spinlock.h b/include/asm-xtensa/spinlock.h
deleted file mode 100644
index 8ff23649581b..000000000000
--- a/include/asm-xtensa/spinlock.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * include/asm-xtensa/spinlock.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_SPINLOCK_H
12#define _XTENSA_SPINLOCK_H
13
14#include <linux/spinlock.h>
15
16#endif /* _XTENSA_SPINLOCK_H */
diff --git a/include/asm-xtensa/stat.h b/include/asm-xtensa/stat.h
deleted file mode 100644
index c4992038cee0..000000000000
--- a/include/asm-xtensa/stat.h
+++ /dev/null
@@ -1,59 +0,0 @@
1/*
2 * include/asm-xtensa/stat.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2007 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_STAT_H
12#define _XTENSA_STAT_H
13
14#define STAT_HAVE_NSEC 1
15
16struct stat {
17 unsigned long st_dev;
18 unsigned long st_ino;
19 unsigned int st_mode;
20 unsigned int st_nlink;
21 unsigned int st_uid;
22 unsigned int st_gid;
23 unsigned long st_rdev;
24 long st_size;
25 unsigned long st_blksize;
26 unsigned long st_blocks;
27 unsigned long st_atime;
28 unsigned long st_atime_nsec;
29 unsigned long st_mtime;
30 unsigned long st_mtime_nsec;
31 unsigned long st_ctime;
32 unsigned long st_ctime_nsec;
33 unsigned long __unused4;
34 unsigned long __unused5;
35};
36
37struct stat64 {
38 unsigned long long st_dev; /* Device */
39 unsigned long long st_ino; /* File serial number */
40 unsigned int st_mode; /* File mode. */
41 unsigned int st_nlink; /* Link count. */
42 unsigned int st_uid; /* User ID of the file's owner. */
43 unsigned int st_gid; /* Group ID of the file's group. */
44 unsigned long long st_rdev; /* Device number, if device. */
45 long long st_size; /* Size of file, in bytes. */
46 unsigned long st_blksize; /* Optimal block size for I/O. */
47 unsigned long __unused2;
48 unsigned long long st_blocks; /* Number 512-byte blocks allocated. */
49 unsigned long st_atime; /* Time of last access. */
50 unsigned long st_atime_nsec;
51 unsigned long st_mtime; /* Time of last modification. */
52 unsigned long st_mtime_nsec;
53 unsigned long st_ctime; /* Time of last status change. */
54 unsigned long st_ctime_nsec;
55 unsigned long __unused4;
56 unsigned long __unused5;
57};
58
59#endif /* _XTENSA_STAT_H */
diff --git a/include/asm-xtensa/statfs.h b/include/asm-xtensa/statfs.h
deleted file mode 100644
index 9c3d1a213136..000000000000
--- a/include/asm-xtensa/statfs.h
+++ /dev/null
@@ -1,17 +0,0 @@
1/*
2 * include/asm-xtensa/statfs.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_STATFS_H
12#define _XTENSA_STATFS_H
13
14#include <asm-generic/statfs.h>
15
16#endif /* _XTENSA_STATFS_H */
17
diff --git a/include/asm-xtensa/string.h b/include/asm-xtensa/string.h
deleted file mode 100644
index 5fb8c27cbef5..000000000000
--- a/include/asm-xtensa/string.h
+++ /dev/null
@@ -1,124 +0,0 @@
1/*
2 * include/asm-xtensa/string.h
3 *
4 * These trivial string functions are considered part of the public domain.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 *
10 * Copyright (C) 2001 - 2005 Tensilica Inc.
11 */
12
13/* We should optimize these. See arch/xtensa/lib/strncpy_user.S */
14
15#ifndef _XTENSA_STRING_H
16#define _XTENSA_STRING_H
17
18#define __HAVE_ARCH_STRCPY
19static inline char *strcpy(char *__dest, const char *__src)
20{
21 register char *__xdest = __dest;
22 unsigned long __dummy;
23
24 __asm__ __volatile__("1:\n\t"
25 "l8ui %2, %1, 0\n\t"
26 "s8i %2, %0, 0\n\t"
27 "addi %1, %1, 1\n\t"
28 "addi %0, %0, 1\n\t"
29 "bnez %2, 1b\n\t"
30 : "=r" (__dest), "=r" (__src), "=&r" (__dummy)
31 : "0" (__dest), "1" (__src)
32 : "memory");
33
34 return __xdest;
35}
36
37#define __HAVE_ARCH_STRNCPY
38static inline char *strncpy(char *__dest, const char *__src, size_t __n)
39{
40 register char *__xdest = __dest;
41 unsigned long __dummy;
42
43 if (__n == 0)
44 return __xdest;
45
46 __asm__ __volatile__(
47 "1:\n\t"
48 "l8ui %2, %1, 0\n\t"
49 "s8i %2, %0, 0\n\t"
50 "addi %1, %1, 1\n\t"
51 "addi %0, %0, 1\n\t"
52 "beqz %2, 2f\n\t"
53 "bne %1, %5, 1b\n"
54 "2:"
55 : "=r" (__dest), "=r" (__src), "=&r" (__dummy)
56 : "0" (__dest), "1" (__src), "r" (__src+__n)
57 : "memory");
58
59 return __xdest;
60}
61
62#define __HAVE_ARCH_STRCMP
63static inline int strcmp(const char *__cs, const char *__ct)
64{
65 register int __res;
66 unsigned long __dummy;
67
68 __asm__ __volatile__(
69 "1:\n\t"
70 "l8ui %3, %1, 0\n\t"
71 "addi %1, %1, 1\n\t"
72 "l8ui %2, %0, 0\n\t"
73 "addi %0, %0, 1\n\t"
74 "beqz %2, 2f\n\t"
75 "beq %2, %3, 1b\n"
76 "2:\n\t"
77 "sub %2, %3, %2"
78 : "=r" (__cs), "=r" (__ct), "=&r" (__res), "=&r" (__dummy)
79 : "0" (__cs), "1" (__ct));
80
81 return __res;
82}
83
84#define __HAVE_ARCH_STRNCMP
85static inline int strncmp(const char *__cs, const char *__ct, size_t __n)
86{
87 register int __res;
88 unsigned long __dummy;
89
90 __asm__ __volatile__(
91 "mov %2, %3\n"
92 "1:\n\t"
93 "beq %0, %6, 2f\n\t"
94 "l8ui %3, %1, 0\n\t"
95 "addi %1, %1, 1\n\t"
96 "l8ui %2, %0, 0\n\t"
97 "addi %0, %0, 1\n\t"
98 "beqz %2, 2f\n\t"
99 "beqz %3, 2f\n\t"
100 "beq %2, %3, 1b\n"
101 "2:\n\t"
102 "sub %2, %3, %2"
103 : "=r" (__cs), "=r" (__ct), "=&r" (__res), "=&r" (__dummy)
104 : "0" (__cs), "1" (__ct), "r" (__cs+__n));
105
106 return __res;
107}
108
109#define __HAVE_ARCH_MEMSET
110extern void *memset(void *__s, int __c, size_t __count);
111
112#define __HAVE_ARCH_MEMCPY
113extern void *memcpy(void *__to, __const__ void *__from, size_t __n);
114
115#define __HAVE_ARCH_MEMMOVE
116extern void *memmove(void *__dest, __const__ void *__src, size_t __n);
117
118/* Don't build bcopy at all ... */
119#define __HAVE_ARCH_BCOPY
120
121#define __HAVE_ARCH_MEMSCAN
122#define memscan memchr
123
124#endif /* _XTENSA_STRING_H */
diff --git a/include/asm-xtensa/syscall.h b/include/asm-xtensa/syscall.h
deleted file mode 100644
index 05cebf8f62b1..000000000000
--- a/include/asm-xtensa/syscall.h
+++ /dev/null
@@ -1,42 +0,0 @@
1/*
2 * include/asm-xtensa/syscall.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2007 Tensilica Inc.
9 */
10
11struct pt_regs;
12struct sigaction;
13asmlinkage long xtensa_execve(char*, char**, char**, struct pt_regs*);
14asmlinkage long xtensa_clone(unsigned long, unsigned long, struct pt_regs*);
15asmlinkage long xtensa_pipe(int __user *);
16asmlinkage long xtensa_mmap2(unsigned long, unsigned long, unsigned long,
17 unsigned long, unsigned long, unsigned long);
18asmlinkage long xtensa_ptrace(long, long, long, long);
19asmlinkage long xtensa_sigreturn(struct pt_regs*);
20asmlinkage long xtensa_rt_sigreturn(struct pt_regs*);
21asmlinkage long xtensa_sigsuspend(struct pt_regs*);
22asmlinkage long xtensa_rt_sigsuspend(struct pt_regs*);
23asmlinkage long xtensa_sigaction(int, const struct old_sigaction*,
24 struct old_sigaction*);
25asmlinkage long xtensa_sigaltstack(struct pt_regs *regs);
26asmlinkage long sys_rt_sigaction(int,
27 const struct sigaction __user *,
28 struct sigaction __user *,
29 size_t);
30asmlinkage long xtensa_shmat(int, char __user *, int);
31asmlinkage long xtensa_fadvise64_64(int, int,
32 unsigned long long, unsigned long long);
33
34/* Should probably move to linux/syscalls.h */
35struct pollfd;
36asmlinkage long sys_pselect6(int n, fd_set __user *inp, fd_set __user *outp,
37 fd_set __user *exp, struct timespec __user *tsp, void __user *sig);
38asmlinkage long sys_ppoll(struct pollfd __user *ufds, unsigned int nfds,
39 struct timespec __user *tsp, const sigset_t __user *sigmask,
40 size_t sigsetsize);
41
42
diff --git a/include/asm-xtensa/system.h b/include/asm-xtensa/system.h
deleted file mode 100644
index 62b1e8f3c13c..000000000000
--- a/include/asm-xtensa/system.h
+++ /dev/null
@@ -1,215 +0,0 @@
1/*
2 * include/asm-xtensa/system.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_SYSTEM_H
12#define _XTENSA_SYSTEM_H
13
14#include <linux/stringify.h>
15
16#include <asm/processor.h>
17
18/* interrupt control */
19
20#define local_save_flags(x) \
21 __asm__ __volatile__ ("rsr %0,"__stringify(PS) : "=a" (x));
22#define local_irq_restore(x) do { \
23 __asm__ __volatile__ ("wsr %0, "__stringify(PS)" ; rsync" \
24 :: "a" (x) : "memory"); } while(0);
25#define local_irq_save(x) do { \
26 __asm__ __volatile__ ("rsil %0, "__stringify(LOCKLEVEL) \
27 : "=a" (x) :: "memory");} while(0);
28
29static inline void local_irq_disable(void)
30{
31 unsigned long flags;
32 __asm__ __volatile__ ("rsil %0, "__stringify(LOCKLEVEL)
33 : "=a" (flags) :: "memory");
34}
35static inline void local_irq_enable(void)
36{
37 unsigned long flags;
38 __asm__ __volatile__ ("rsil %0, 0" : "=a" (flags) :: "memory");
39
40}
41
42static inline int irqs_disabled(void)
43{
44 unsigned long flags;
45 local_save_flags(flags);
46 return flags & 0xf;
47}
48
49
50#define smp_read_barrier_depends() do { } while(0)
51#define read_barrier_depends() do { } while(0)
52
53#define mb() barrier()
54#define rmb() mb()
55#define wmb() mb()
56
57#ifdef CONFIG_SMP
58#error smp_* not defined
59#else
60#define smp_mb() barrier()
61#define smp_rmb() barrier()
62#define smp_wmb() barrier()
63#endif
64
65#define set_mb(var, value) do { var = value; mb(); } while (0)
66
67#if !defined (__ASSEMBLY__)
68
69/* * switch_to(n) should switch tasks to task nr n, first
70 * checking that n isn't the current task, in which case it does nothing.
71 */
72extern void *_switch_to(void *last, void *next);
73
74#endif /* __ASSEMBLY__ */
75
76#define switch_to(prev,next,last) \
77do { \
78 (last) = _switch_to(prev, next); \
79} while(0)
80
81/*
82 * cmpxchg
83 */
84
85static inline unsigned long
86__cmpxchg_u32(volatile int *p, int old, int new)
87{
88 __asm__ __volatile__("rsil a15, "__stringify(LOCKLEVEL)"\n\t"
89 "l32i %0, %1, 0 \n\t"
90 "bne %0, %2, 1f \n\t"
91 "s32i %3, %1, 0 \n\t"
92 "1: \n\t"
93 "wsr a15, "__stringify(PS)" \n\t"
94 "rsync \n\t"
95 : "=&a" (old)
96 : "a" (p), "a" (old), "r" (new)
97 : "a15", "memory");
98 return old;
99}
100/* This function doesn't exist, so you'll get a linker error
101 * if something tries to do an invalid cmpxchg(). */
102
103extern void __cmpxchg_called_with_bad_pointer(void);
104
105static __inline__ unsigned long
106__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
107{
108 switch (size) {
109 case 4: return __cmpxchg_u32(ptr, old, new);
110 default: __cmpxchg_called_with_bad_pointer();
111 return old;
112 }
113}
114
115#define cmpxchg(ptr,o,n) \
116 ({ __typeof__(*(ptr)) _o_ = (o); \
117 __typeof__(*(ptr)) _n_ = (n); \
118 (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \
119 (unsigned long)_n_, sizeof (*(ptr))); \
120 })
121
122#include <asm-generic/cmpxchg-local.h>
123
124static inline unsigned long __cmpxchg_local(volatile void *ptr,
125 unsigned long old,
126 unsigned long new, int size)
127{
128 switch (size) {
129 case 4:
130 return __cmpxchg_u32(ptr, old, new);
131 default:
132 return __cmpxchg_local_generic(ptr, old, new, size);
133 }
134
135 return old;
136}
137
138/*
139 * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make
140 * them available.
141 */
142#define cmpxchg_local(ptr, o, n) \
143 ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\
144 (unsigned long)(n), sizeof(*(ptr))))
145#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
146
147/*
148 * xchg_u32
149 *
150 * Note that a15 is used here because the register allocation
151 * done by the compiler is not guaranteed and a window overflow
152 * may not occur between the rsil and wsr instructions. By using
153 * a15 in the rsil, the machine is guaranteed to be in a state
154 * where no register reference will cause an overflow.
155 */
156
157static inline unsigned long xchg_u32(volatile int * m, unsigned long val)
158{
159 unsigned long tmp;
160 __asm__ __volatile__("rsil a15, "__stringify(LOCKLEVEL)"\n\t"
161 "l32i %0, %1, 0 \n\t"
162 "s32i %2, %1, 0 \n\t"
163 "wsr a15, "__stringify(PS)" \n\t"
164 "rsync \n\t"
165 : "=&a" (tmp)
166 : "a" (m), "a" (val)
167 : "a15", "memory");
168 return tmp;
169}
170
171#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
172
173/*
174 * This only works if the compiler isn't horribly bad at optimizing.
175 * gcc-2.5.8 reportedly can't handle this, but I define that one to
176 * be dead anyway.
177 */
178
179extern void __xchg_called_with_bad_pointer(void);
180
181static __inline__ unsigned long
182__xchg(unsigned long x, volatile void * ptr, int size)
183{
184 switch (size) {
185 case 4:
186 return xchg_u32(ptr, x);
187 }
188 __xchg_called_with_bad_pointer();
189 return x;
190}
191
192extern void set_except_vector(int n, void *addr);
193
194static inline void spill_registers(void)
195{
196 unsigned int a0, ps;
197
198 __asm__ __volatile__ (
199 "movi a14," __stringify (PS_EXCM_BIT) " | 1\n\t"
200 "mov a12, a0\n\t"
201 "rsr a13," __stringify(SAR) "\n\t"
202 "xsr a14," __stringify(PS) "\n\t"
203 "movi a0, _spill_registers\n\t"
204 "rsync\n\t"
205 "callx0 a0\n\t"
206 "mov a0, a12\n\t"
207 "wsr a13," __stringify(SAR) "\n\t"
208 "wsr a14," __stringify(PS) "\n\t"
209 :: "a" (&a0), "a" (&ps)
210 : "a2", "a3", "a4", "a7", "a11", "a12", "a13", "a14", "a15", "memory");
211}
212
213#define arch_align_stack(x) (x)
214
215#endif /* _XTENSA_SYSTEM_H */
diff --git a/include/asm-xtensa/termbits.h b/include/asm-xtensa/termbits.h
deleted file mode 100644
index 85aa6a3c0b6e..000000000000
--- a/include/asm-xtensa/termbits.h
+++ /dev/null
@@ -1,219 +0,0 @@
1/*
2 * include/asm-xtensa/termbits.h
3 *
4 * Copied from SH.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 *
10 * Copyright (C) 2001 - 2005 Tensilica Inc.
11 */
12
13#ifndef _XTENSA_TERMBITS_H
14#define _XTENSA_TERMBITS_H
15
16
17#include <linux/posix_types.h>
18
19typedef unsigned char cc_t;
20typedef unsigned int speed_t;
21typedef unsigned int tcflag_t;
22
23#define NCCS 19
24struct termios {
25 tcflag_t c_iflag; /* input mode flags */
26 tcflag_t c_oflag; /* output mode flags */
27 tcflag_t c_cflag; /* control mode flags */
28 tcflag_t c_lflag; /* local mode flags */
29 cc_t c_line; /* line discipline */
30 cc_t c_cc[NCCS]; /* control characters */
31};
32
33struct termios2 {
34 tcflag_t c_iflag; /* input mode flags */
35 tcflag_t c_oflag; /* output mode flags */
36 tcflag_t c_cflag; /* control mode flags */
37 tcflag_t c_lflag; /* local mode flags */
38 cc_t c_line; /* line discipline */
39 cc_t c_cc[NCCS]; /* control characters */
40 speed_t c_ispeed; /* input speed */
41 speed_t c_ospeed; /* output speed */
42};
43
44struct ktermios {
45 tcflag_t c_iflag; /* input mode flags */
46 tcflag_t c_oflag; /* output mode flags */
47 tcflag_t c_cflag; /* control mode flags */
48 tcflag_t c_lflag; /* local mode flags */
49 cc_t c_line; /* line discipline */
50 cc_t c_cc[NCCS]; /* control characters */
51 speed_t c_ispeed; /* input speed */
52 speed_t c_ospeed; /* output speed */
53};
54
55/* c_cc characters */
56
57#define VINTR 0
58#define VQUIT 1
59#define VERASE 2
60#define VKILL 3
61#define VEOF 4
62#define VTIME 5
63#define VMIN 6
64#define VSWTC 7
65#define VSTART 8
66#define VSTOP 9
67#define VSUSP 10
68#define VEOL 11
69#define VREPRINT 12
70#define VDISCARD 13
71#define VWERASE 14
72#define VLNEXT 15
73#define VEOL2 16
74
75/* c_iflag bits */
76
77#define IGNBRK 0000001
78#define BRKINT 0000002
79#define IGNPAR 0000004
80#define PARMRK 0000010
81#define INPCK 0000020
82#define ISTRIP 0000040
83#define INLCR 0000100
84#define IGNCR 0000200
85#define ICRNL 0000400
86#define IUCLC 0001000
87#define IXON 0002000
88#define IXANY 0004000
89#define IXOFF 0010000
90#define IMAXBEL 0020000
91#define IUTF8 0040000
92
93/* c_oflag bits */
94
95#define OPOST 0000001
96#define OLCUC 0000002
97#define ONLCR 0000004
98#define OCRNL 0000010
99#define ONOCR 0000020
100#define ONLRET 0000040
101#define OFILL 0000100
102#define OFDEL 0000200
103#define NLDLY 0000400
104#define NL0 0000000
105#define NL1 0000400
106#define CRDLY 0003000
107#define CR0 0000000
108#define CR1 0001000
109#define CR2 0002000
110#define CR3 0003000
111#define TABDLY 0014000
112#define TAB0 0000000
113#define TAB1 0004000
114#define TAB2 0010000
115#define TAB3 0014000
116#define XTABS 0014000
117#define BSDLY 0020000
118#define BS0 0000000
119#define BS1 0020000
120#define VTDLY 0040000
121#define VT0 0000000
122#define VT1 0040000
123#define FFDLY 0100000
124#define FF0 0000000
125#define FF1 0100000
126
127/* c_cflag bit meaning */
128
129#define CBAUD 0010017
130#define B0 0000000 /* hang up */
131#define B50 0000001
132#define B75 0000002
133#define B110 0000003
134#define B134 0000004
135#define B150 0000005
136#define B200 0000006
137#define B300 0000007
138#define B600 0000010
139#define B1200 0000011
140#define B1800 0000012
141#define B2400 0000013
142#define B4800 0000014
143#define B9600 0000015
144#define B19200 0000016
145#define B38400 0000017
146#define EXTA B19200
147#define EXTB B38400
148#define CSIZE 0000060
149#define CS5 0000000
150#define CS6 0000020
151#define CS7 0000040
152#define CS8 0000060
153#define CSTOPB 0000100
154#define CREAD 0000200
155#define PARENB 0000400
156#define PARODD 0001000
157#define HUPCL 0002000
158#define CLOCAL 0004000
159#define CBAUDEX 0010000
160#define BOTHER 0010000
161#define B57600 0010001
162#define B115200 0010002
163#define B230400 0010003
164#define B460800 0010004
165#define B500000 0010005
166#define B576000 0010006
167#define B921600 0010007
168#define B1000000 0010010
169#define B1152000 0010011
170#define B1500000 0010012
171#define B2000000 0010013
172#define B2500000 0010014
173#define B3000000 0010015
174#define B3500000 0010016
175#define B4000000 0010017
176#define CIBAUD 002003600000 /* input baud rate */
177#define CMSPAR 010000000000 /* mark or space (stick) parity */
178#define CRTSCTS 020000000000 /* flow control */
179
180#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */
181
182/* c_lflag bits */
183
184#define ISIG 0000001
185#define ICANON 0000002
186#define XCASE 0000004
187#define ECHO 0000010
188#define ECHOE 0000020
189#define ECHOK 0000040
190#define ECHONL 0000100
191#define NOFLSH 0000200
192#define TOSTOP 0000400
193#define ECHOCTL 0001000
194#define ECHOPRT 0002000
195#define ECHOKE 0004000
196#define FLUSHO 0010000
197#define PENDIN 0040000
198#define IEXTEN 0100000
199
200/* tcflow() and TCXONC use these */
201
202#define TCOOFF 0
203#define TCOON 1
204#define TCIOFF 2
205#define TCION 3
206
207/* tcflush() and TCFLSH use these */
208
209#define TCIFLUSH 0
210#define TCOFLUSH 1
211#define TCIOFLUSH 2
212
213/* tcsetattr uses these */
214
215#define TCSANOW 0
216#define TCSADRAIN 1
217#define TCSAFLUSH 2
218
219#endif /* _XTENSA_TERMBITS_H */
diff --git a/include/asm-xtensa/termios.h b/include/asm-xtensa/termios.h
deleted file mode 100644
index 4673f42f88a7..000000000000
--- a/include/asm-xtensa/termios.h
+++ /dev/null
@@ -1,105 +0,0 @@
1/*
2 * include/asm-xtensa/termios.h
3 *
4 * Copied from SH.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 *
10 * Copyright (C) 2001 - 2005 Tensilica Inc.
11 */
12
13#ifndef _XTENSA_TERMIOS_H
14#define _XTENSA_TERMIOS_H
15
16#include <asm/termbits.h>
17#include <asm/ioctls.h>
18
19struct winsize {
20 unsigned short ws_row;
21 unsigned short ws_col;
22 unsigned short ws_xpixel;
23 unsigned short ws_ypixel;
24};
25
26#define NCC 8
27struct termio {
28 unsigned short c_iflag; /* input mode flags */
29 unsigned short c_oflag; /* output mode flags */
30 unsigned short c_cflag; /* control mode flags */
31 unsigned short c_lflag; /* local mode flags */
32 unsigned char c_line; /* line discipline */
33 unsigned char c_cc[NCC]; /* control characters */
34};
35
36/* Modem lines */
37
38#define TIOCM_LE 0x001
39#define TIOCM_DTR 0x002
40#define TIOCM_RTS 0x004
41#define TIOCM_ST 0x008
42#define TIOCM_SR 0x010
43#define TIOCM_CTS 0x020
44#define TIOCM_CAR 0x040
45#define TIOCM_RNG 0x080
46#define TIOCM_DSR 0x100
47#define TIOCM_CD TIOCM_CAR
48#define TIOCM_RI TIOCM_RNG
49#define TIOCM_OUT1 0x2000
50#define TIOCM_OUT2 0x4000
51#define TIOCM_LOOP 0x8000
52
53/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
54
55#ifdef __KERNEL__
56
57/* intr=^C quit=^\ erase=del kill=^U
58 eof=^D vtime=\0 vmin=\1 sxtc=\0
59 start=^Q stop=^S susp=^Z eol=\0
60 reprint=^R discard=^U werase=^W lnext=^V
61 eol2=\0
62*/
63#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
64
65/*
66 * Translate a "termio" structure into a "termios". Ugh.
67 */
68
69#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \
70 unsigned short __tmp; \
71 get_user(__tmp,&(termio)->x); \
72 *(unsigned short *) &(termios)->x = __tmp; \
73}
74
75#define user_termio_to_kernel_termios(termios, termio) \
76({ \
77 SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \
78 SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \
79 SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \
80 SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \
81 copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
82})
83
84/*
85 * Translate a "termios" structure into a "termio". Ugh.
86 */
87
88#define kernel_termios_to_user_termio(termio, termios) \
89({ \
90 put_user((termios)->c_iflag, &(termio)->c_iflag); \
91 put_user((termios)->c_oflag, &(termio)->c_oflag); \
92 put_user((termios)->c_cflag, &(termio)->c_cflag); \
93 put_user((termios)->c_lflag, &(termio)->c_lflag); \
94 put_user((termios)->c_line, &(termio)->c_line); \
95 copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
96})
97
98#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios2))
99#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios2))
100#define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios))
101#define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios))
102
103#endif /* __KERNEL__ */
104
105#endif /* _XTENSA_TERMIOS_H */
diff --git a/include/asm-xtensa/thread_info.h b/include/asm-xtensa/thread_info.h
deleted file mode 100644
index 0f4fe1faf9ba..000000000000
--- a/include/asm-xtensa/thread_info.h
+++ /dev/null
@@ -1,164 +0,0 @@
1/*
2 * include/asm-xtensa/thread_info.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_THREAD_INFO_H
12#define _XTENSA_THREAD_INFO_H
13
14#ifdef __KERNEL__
15
16#ifndef __ASSEMBLY__
17# include <asm/processor.h>
18#endif
19
20/*
21 * low level task data that entry.S needs immediate access to
22 * - this struct should fit entirely inside of one cache line
23 * - this struct shares the supervisor stack pages
24 * - if the contents of this structure are changed, the assembly constants
25 * must also be changed
26 */
27
28#ifndef __ASSEMBLY__
29
30#if XTENSA_HAVE_COPROCESSORS
31
32typedef struct xtregs_coprocessor {
33 xtregs_cp0_t cp0;
34 xtregs_cp1_t cp1;
35 xtregs_cp2_t cp2;
36 xtregs_cp3_t cp3;
37 xtregs_cp4_t cp4;
38 xtregs_cp5_t cp5;
39 xtregs_cp6_t cp6;
40 xtregs_cp7_t cp7;
41} xtregs_coprocessor_t;
42
43#endif
44
45struct thread_info {
46 struct task_struct *task; /* main task structure */
47 struct exec_domain *exec_domain; /* execution domain */
48 unsigned long flags; /* low level flags */
49 unsigned long status; /* thread-synchronous flags */
50 __u32 cpu; /* current CPU */
51 __s32 preempt_count; /* 0 => preemptable,< 0 => BUG*/
52
53 mm_segment_t addr_limit; /* thread address space */
54 struct restart_block restart_block;
55
56 unsigned long cpenable;
57
58 /* Allocate storage for extra user states and coprocessor states. */
59#if XTENSA_HAVE_COPROCESSORS
60 xtregs_coprocessor_t xtregs_cp;
61#endif
62 xtregs_user_t xtregs_user;
63};
64
65#else /* !__ASSEMBLY__ */
66
67/* offsets into the thread_info struct for assembly code access */
68#define TI_TASK 0x00000000
69#define TI_EXEC_DOMAIN 0x00000004
70#define TI_FLAGS 0x00000008
71#define TI_STATUS 0x0000000C
72#define TI_CPU 0x00000010
73#define TI_PRE_COUNT 0x00000014
74#define TI_ADDR_LIMIT 0x00000018
75#define TI_RESTART_BLOCK 0x000001C
76
77#endif
78
79#define PREEMPT_ACTIVE 0x10000000
80
81/*
82 * macros/functions for gaining access to the thread information structure
83 *
84 * preempt_count needs to be 1 initially, until the scheduler is functional.
85 */
86
87#ifndef __ASSEMBLY__
88
89#define INIT_THREAD_INFO(tsk) \
90{ \
91 .task = &tsk, \
92 .exec_domain = &default_exec_domain, \
93 .flags = 0, \
94 .cpu = 0, \
95 .preempt_count = 1, \
96 .addr_limit = KERNEL_DS, \
97 .restart_block = { \
98 .fn = do_no_restart_syscall, \
99 }, \
100}
101
102#define init_thread_info (init_thread_union.thread_info)
103#define init_stack (init_thread_union.stack)
104
105/* how to get the thread information struct from C */
106static inline struct thread_info *current_thread_info(void)
107{
108 struct thread_info *ti;
109 __asm__("extui %0,a1,0,13\n\t"
110 "xor %0, a1, %0" : "=&r" (ti) : );
111 return ti;
112}
113
114#else /* !__ASSEMBLY__ */
115
116/* how to get the thread information struct from ASM */
117#define GET_THREAD_INFO(reg,sp) \
118 extui reg, sp, 0, 13; \
119 xor reg, sp, reg
120#endif
121
122
123/*
124 * thread information flags
125 * - these are process state flags that various assembly files may need to access
126 * - pending work-to-be-done flags are in LSW
127 * - other flags in MSW
128 */
129#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
130#define TIF_SIGPENDING 1 /* signal pending */
131#define TIF_NEED_RESCHED 2 /* rescheduling necessary */
132#define TIF_SINGLESTEP 3 /* restore singlestep on return to user mode */
133#define TIF_IRET 4 /* return with iret */
134#define TIF_MEMDIE 5
135#define TIF_RESTORE_SIGMASK 6 /* restore signal mask in do_signal() */
136#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */
137#define TIF_FREEZE 17 /* is freezing for suspend */
138
139#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
140#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
141#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
142#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
143#define _TIF_IRET (1<<TIF_IRET)
144#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
145#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
146#define _TIF_FREEZE (1<<TIF_FREEZE)
147
148#define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */
149#define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */
150
151/*
152 * Thread-synchronous status.
153 *
154 * This is different from the flags in that nobody else
155 * ever touches our thread-synchronous status, so we don't
156 * have to worry about atomic accesses.
157 */
158#define TS_USEDFPU 0x0001 /* FPU was used by this task this quantum (SMP) */
159
160#define THREAD_SIZE 8192 //(2*PAGE_SIZE)
161#define THREAD_SIZE_ORDER 1
162
163#endif /* __KERNEL__ */
164#endif /* _XTENSA_THREAD_INFO */
diff --git a/include/asm-xtensa/timex.h b/include/asm-xtensa/timex.h
deleted file mode 100644
index b83a8181d448..000000000000
--- a/include/asm-xtensa/timex.h
+++ /dev/null
@@ -1,96 +0,0 @@
1/*
2 * include/asm-xtensa/timex.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_TIMEX_H
12#define _XTENSA_TIMEX_H
13
14#ifdef __KERNEL__
15
16#include <asm/processor.h>
17#include <linux/stringify.h>
18
19#define _INTLEVEL(x) XCHAL_INT ## x ## _LEVEL
20#define INTLEVEL(x) _INTLEVEL(x)
21
22#if INTLEVEL(XCHAL_TIMER0_INTERRUPT) == 1
23# define LINUX_TIMER 0
24# define LINUX_TIMER_INT XCHAL_TIMER0_INTERRUPT
25#elif INTLEVEL(XCHAL_TIMER1_INTERRUPT) == 1
26# define LINUX_TIMER 1
27# define LINUX_TIMER_INT XCHAL_TIMER1_INTERRUPT
28#elif INTLEVEL(XCHAL_TIMER2_INTERRUPT) == 1
29# define LINUX_TIMER 2
30# define LINUX_TIMER_INT XCHAL_TIMER2_INTERRUPT
31#else
32# error "Bad timer number for Linux configurations!"
33#endif
34
35#define LINUX_TIMER_MASK (1L << LINUX_TIMER_INT)
36
37#define CLOCK_TICK_RATE 1193180 /* (everyone is using this value) */
38#define CLOCK_TICK_FACTOR 20 /* Factor of both 10^6 and CLOCK_TICK_RATE */
39
40#ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT
41extern unsigned long ccount_per_jiffy;
42extern unsigned long ccount_nsec;
43#define CCOUNT_PER_JIFFY ccount_per_jiffy
44#define NSEC_PER_CCOUNT ccount_nsec
45#else
46#define CCOUNT_PER_JIFFY (CONFIG_XTENSA_CPU_CLOCK*(1000000UL/HZ))
47#define NSEC_PER_CCOUNT (1000UL / CONFIG_XTENSA_CPU_CLOCK)
48#endif
49
50
51typedef unsigned long long cycles_t;
52
53/*
54 * Only used for SMP.
55 */
56
57extern cycles_t cacheflush_time;
58
59#define get_cycles() (0)
60
61
62/*
63 * Register access.
64 */
65
66#define WSR_CCOUNT(r) asm volatile ("wsr %0,"__stringify(CCOUNT) :: "a" (r))
67#define RSR_CCOUNT(r) asm volatile ("rsr %0,"__stringify(CCOUNT) : "=a" (r))
68#define WSR_CCOMPARE(x,r) asm volatile ("wsr %0,"__stringify(CCOMPARE)"+"__stringify(x) :: "a"(r))
69#define RSR_CCOMPARE(x,r) asm volatile ("rsr %0,"__stringify(CCOMPARE)"+"__stringify(x) : "=a"(r))
70
71static inline unsigned long get_ccount (void)
72{
73 unsigned long ccount;
74 RSR_CCOUNT(ccount);
75 return ccount;
76}
77
78static inline void set_ccount (unsigned long ccount)
79{
80 WSR_CCOUNT(ccount);
81}
82
83static inline unsigned long get_linux_timer (void)
84{
85 unsigned ccompare;
86 RSR_CCOMPARE(LINUX_TIMER, ccompare);
87 return ccompare;
88}
89
90static inline void set_linux_timer (unsigned long ccompare)
91{
92 WSR_CCOMPARE(LINUX_TIMER, ccompare);
93}
94
95#endif /* __KERNEL__ */
96#endif /* _XTENSA_TIMEX_H */
diff --git a/include/asm-xtensa/tlb.h b/include/asm-xtensa/tlb.h
deleted file mode 100644
index 31c220faca02..000000000000
--- a/include/asm-xtensa/tlb.h
+++ /dev/null
@@ -1,47 +0,0 @@
1/*
2 * include/asm-xtensa/tlb.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_TLB_H
12#define _XTENSA_TLB_H
13
14#include <asm/cache.h>
15#include <asm/page.h>
16
17#if (DCACHE_WAY_SIZE <= PAGE_SIZE)
18
19/* Note, read http://lkml.org/lkml/2004/1/15/6 */
20
21# define tlb_start_vma(tlb,vma) do { } while (0)
22# define tlb_end_vma(tlb,vma) do { } while (0)
23
24#else
25
26# define tlb_start_vma(tlb, vma) \
27 do { \
28 if (!tlb->fullmm) \
29 flush_cache_range(vma, vma->vm_start, vma->vm_end); \
30 } while(0)
31
32# define tlb_end_vma(tlb, vma) \
33 do { \
34 if (!tlb->fullmm) \
35 flush_tlb_range(vma, vma->vm_start, vma->vm_end); \
36 } while(0)
37
38#endif
39
40#define __tlb_remove_tlb_entry(tlb,pte,addr) do { } while (0)
41#define tlb_flush(tlb) flush_tlb_mm((tlb)->mm)
42
43#include <asm-generic/tlb.h>
44
45#define __pte_free_tlb(tlb, pte) pte_free((tlb)->mm, pte)
46
47#endif /* _XTENSA_TLB_H */
diff --git a/include/asm-xtensa/tlbflush.h b/include/asm-xtensa/tlbflush.h
deleted file mode 100644
index 46d240074f74..000000000000
--- a/include/asm-xtensa/tlbflush.h
+++ /dev/null
@@ -1,191 +0,0 @@
1/*
2 * include/asm-xtensa/tlbflush.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_TLBFLUSH_H
12#define _XTENSA_TLBFLUSH_H
13
14#ifdef __KERNEL__
15
16#include <linux/stringify.h>
17#include <asm/processor.h>
18
19#define DTLB_WAY_PGD 7
20
21#define ITLB_ARF_WAYS 4
22#define DTLB_ARF_WAYS 4
23
24#define ITLB_HIT_BIT 3
25#define DTLB_HIT_BIT 4
26
27#ifndef __ASSEMBLY__
28
29/* TLB flushing:
30 *
31 * - flush_tlb_all() flushes all processes TLB entries
32 * - flush_tlb_mm(mm) flushes the specified mm context TLB entries
33 * - flush_tlb_page(mm, vmaddr) flushes a single page
34 * - flush_tlb_range(mm, start, end) flushes a range of pages
35 */
36
37extern void flush_tlb_all(void);
38extern void flush_tlb_mm(struct mm_struct*);
39extern void flush_tlb_page(struct vm_area_struct*,unsigned long);
40extern void flush_tlb_range(struct vm_area_struct*,unsigned long,unsigned long);
41
42#define flush_tlb_kernel_range(start,end) flush_tlb_all()
43
44/* TLB operations. */
45
46static inline unsigned long itlb_probe(unsigned long addr)
47{
48 unsigned long tmp;
49 __asm__ __volatile__("pitlb %0, %1\n\t" : "=a" (tmp) : "a" (addr));
50 return tmp;
51}
52
53static inline unsigned long dtlb_probe(unsigned long addr)
54{
55 unsigned long tmp;
56 __asm__ __volatile__("pdtlb %0, %1\n\t" : "=a" (tmp) : "a" (addr));
57 return tmp;
58}
59
60static inline void invalidate_itlb_entry (unsigned long probe)
61{
62 __asm__ __volatile__("iitlb %0; isync\n\t" : : "a" (probe));
63}
64
65static inline void invalidate_dtlb_entry (unsigned long probe)
66{
67 __asm__ __volatile__("idtlb %0; dsync\n\t" : : "a" (probe));
68}
69
70/* Use the .._no_isync functions with caution. Generally, these are
71 * handy for bulk invalidates followed by a single 'isync'. The
72 * caller must follow up with an 'isync', which can be relatively
73 * expensive on some Xtensa implementations.
74 */
75static inline void invalidate_itlb_entry_no_isync (unsigned entry)
76{
77 /* Caller must follow up with 'isync'. */
78 __asm__ __volatile__ ("iitlb %0\n" : : "a" (entry) );
79}
80
81static inline void invalidate_dtlb_entry_no_isync (unsigned entry)
82{
83 /* Caller must follow up with 'isync'. */
84 __asm__ __volatile__ ("idtlb %0\n" : : "a" (entry) );
85}
86
87static inline void set_itlbcfg_register (unsigned long val)
88{
89 __asm__ __volatile__("wsr %0, "__stringify(ITLBCFG)"\n\t" "isync\n\t"
90 : : "a" (val));
91}
92
93static inline void set_dtlbcfg_register (unsigned long val)
94{
95 __asm__ __volatile__("wsr %0, "__stringify(DTLBCFG)"; dsync\n\t"
96 : : "a" (val));
97}
98
99static inline void set_ptevaddr_register (unsigned long val)
100{
101 __asm__ __volatile__(" wsr %0, "__stringify(PTEVADDR)"; isync\n"
102 : : "a" (val));
103}
104
105static inline unsigned long read_ptevaddr_register (void)
106{
107 unsigned long tmp;
108 __asm__ __volatile__("rsr %0, "__stringify(PTEVADDR)"\n\t" : "=a" (tmp));
109 return tmp;
110}
111
112static inline void write_dtlb_entry (pte_t entry, int way)
113{
114 __asm__ __volatile__("wdtlb %1, %0; dsync\n\t"
115 : : "r" (way), "r" (entry) );
116}
117
118static inline void write_itlb_entry (pte_t entry, int way)
119{
120 __asm__ __volatile__("witlb %1, %0; isync\n\t"
121 : : "r" (way), "r" (entry) );
122}
123
124static inline void invalidate_page_directory (void)
125{
126 invalidate_dtlb_entry (DTLB_WAY_PGD);
127 invalidate_dtlb_entry (DTLB_WAY_PGD+1);
128 invalidate_dtlb_entry (DTLB_WAY_PGD+2);
129}
130
131static inline void invalidate_itlb_mapping (unsigned address)
132{
133 unsigned long tlb_entry;
134 if (((tlb_entry = itlb_probe(address)) & (1 << ITLB_HIT_BIT)) != 0)
135 invalidate_itlb_entry(tlb_entry);
136}
137
138static inline void invalidate_dtlb_mapping (unsigned address)
139{
140 unsigned long tlb_entry;
141 if (((tlb_entry = dtlb_probe(address)) & (1 << DTLB_HIT_BIT)) != 0)
142 invalidate_dtlb_entry(tlb_entry);
143}
144
145#define check_pgt_cache() do { } while (0)
146
147
148/*
149 * DO NOT USE THESE FUNCTIONS. These instructions aren't part of the Xtensa
150 * ISA and exist only for test purposes..
151 * You may find it helpful for MMU debugging, however.
152 *
153 * 'at' is the unmodified input register
154 * 'as' is the output register, as follows (specific to the Linux config):
155 *
156 * as[31..12] contain the virtual address
157 * as[11..08] are meaningless
158 * as[07..00] contain the asid
159 */
160
161static inline unsigned long read_dtlb_virtual (int way)
162{
163 unsigned long tmp;
164 __asm__ __volatile__("rdtlb0 %0, %1\n\t" : "=a" (tmp), "+a" (way));
165 return tmp;
166}
167
168static inline unsigned long read_dtlb_translation (int way)
169{
170 unsigned long tmp;
171 __asm__ __volatile__("rdtlb1 %0, %1\n\t" : "=a" (tmp), "+a" (way));
172 return tmp;
173}
174
175static inline unsigned long read_itlb_virtual (int way)
176{
177 unsigned long tmp;
178 __asm__ __volatile__("ritlb0 %0, %1\n\t" : "=a" (tmp), "+a" (way));
179 return tmp;
180}
181
182static inline unsigned long read_itlb_translation (int way)
183{
184 unsigned long tmp;
185 __asm__ __volatile__("ritlb1 %0, %1\n\t" : "=a" (tmp), "+a" (way));
186 return tmp;
187}
188
189#endif /* __ASSEMBLY__ */
190#endif /* __KERNEL__ */
191#endif /* _XTENSA_TLBFLUSH_H */
diff --git a/include/asm-xtensa/topology.h b/include/asm-xtensa/topology.h
deleted file mode 100644
index 7309e38a0ccb..000000000000
--- a/include/asm-xtensa/topology.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * include/asm-xtensa/topology.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_TOPOLOGY_H
12#define _XTENSA_TOPOLOGY_H
13
14#include <asm-generic/topology.h>
15
16#endif /* _XTENSA_TOPOLOGY_H */
diff --git a/include/asm-xtensa/types.h b/include/asm-xtensa/types.h
deleted file mode 100644
index c89569a8da0c..000000000000
--- a/include/asm-xtensa/types.h
+++ /dev/null
@@ -1,42 +0,0 @@
1/*
2 * include/asm-xtensa/types.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_TYPES_H
12#define _XTENSA_TYPES_H
13
14#include <asm-generic/int-ll64.h>
15
16#ifdef __ASSEMBLY__
17# define __XTENSA_UL(x) (x)
18# define __XTENSA_UL_CONST(x) x
19#else
20# define __XTENSA_UL(x) ((unsigned long)(x))
21# define __XTENSA_UL_CONST(x) x##UL
22#endif
23
24#ifndef __ASSEMBLY__
25
26typedef unsigned short umode_t;
27
28/*
29 * These aren't exported outside the kernel to avoid name space clashes
30 */
31#ifdef __KERNEL__
32
33#define BITS_PER_LONG 32
34
35/* Dma addresses are 32-bits wide. */
36
37typedef u32 dma_addr_t;
38
39#endif /* __KERNEL__ */
40#endif
41
42#endif /* _XTENSA_TYPES_H */
diff --git a/include/asm-xtensa/uaccess.h b/include/asm-xtensa/uaccess.h
deleted file mode 100644
index b8528426ab1f..000000000000
--- a/include/asm-xtensa/uaccess.h
+++ /dev/null
@@ -1,500 +0,0 @@
1/*
2 * include/asm-xtensa/uaccess.h
3 *
4 * User space memory access functions
5 *
6 * These routines provide basic accessing functions to the user memory
7 * space for the kernel. This header file provides fuctions such as:
8 *
9 * This file is subject to the terms and conditions of the GNU General Public
10 * License. See the file "COPYING" in the main directory of this archive
11 * for more details.
12 *
13 * Copyright (C) 2001 - 2005 Tensilica Inc.
14 */
15
16#ifndef _XTENSA_UACCESS_H
17#define _XTENSA_UACCESS_H
18
19#include <linux/errno.h>
20
21#define VERIFY_READ 0
22#define VERIFY_WRITE 1
23
24#ifdef __ASSEMBLY__
25
26#include <asm/current.h>
27#include <asm/asm-offsets.h>
28#include <asm/processor.h>
29#include <asm/types.h>
30
31/*
32 * These assembly macros mirror the C macros that follow below. They
33 * should always have identical functionality. See
34 * arch/xtensa/kernel/sys.S for usage.
35 */
36
37#define KERNEL_DS 0
38#define USER_DS 1
39
40#define get_ds (KERNEL_DS)
41
42/*
43 * get_fs reads current->thread.current_ds into a register.
44 * On Entry:
45 * <ad> anything
46 * <sp> stack
47 * On Exit:
48 * <ad> contains current->thread.current_ds
49 */
50 .macro get_fs ad, sp
51 GET_CURRENT(\ad,\sp)
52 l32i \ad, \ad, THREAD_CURRENT_DS
53 .endm
54
55/*
56 * set_fs sets current->thread.current_ds to some value.
57 * On Entry:
58 * <at> anything (temp register)
59 * <av> value to write
60 * <sp> stack
61 * On Exit:
62 * <at> destroyed (actually, current)
63 * <av> preserved, value to write
64 */
65 .macro set_fs at, av, sp
66 GET_CURRENT(\at,\sp)
67 s32i \av, \at, THREAD_CURRENT_DS
68 .endm
69
70/*
71 * kernel_ok determines whether we should bypass addr/size checking.
72 * See the equivalent C-macro version below for clarity.
73 * On success, kernel_ok branches to a label indicated by parameter
74 * <success>. This implies that the macro falls through to the next
75 * insruction on an error.
76 *
77 * Note that while this macro can be used independently, we designed
78 * in for optimal use in the access_ok macro below (i.e., we fall
79 * through on error).
80 *
81 * On Entry:
82 * <at> anything (temp register)
83 * <success> label to branch to on success; implies
84 * fall-through macro on error
85 * <sp> stack pointer
86 * On Exit:
87 * <at> destroyed (actually, current->thread.current_ds)
88 */
89
90#if ((KERNEL_DS != 0) || (USER_DS == 0))
91# error Assembly macro kernel_ok fails
92#endif
93 .macro kernel_ok at, sp, success
94 get_fs \at, \sp
95 beqz \at, \success
96 .endm
97
98/*
99 * user_ok determines whether the access to user-space memory is allowed.
100 * See the equivalent C-macro version below for clarity.
101 *
102 * On error, user_ok branches to a label indicated by parameter
103 * <error>. This implies that the macro falls through to the next
104 * instruction on success.
105 *
106 * Note that while this macro can be used independently, we designed
107 * in for optimal use in the access_ok macro below (i.e., we fall
108 * through on success).
109 *
110 * On Entry:
111 * <aa> register containing memory address
112 * <as> register containing memory size
113 * <at> temp register
114 * <error> label to branch to on error; implies fall-through
115 * macro on success
116 * On Exit:
117 * <aa> preserved
118 * <as> preserved
119 * <at> destroyed (actually, (TASK_SIZE + 1 - size))
120 */
121 .macro user_ok aa, as, at, error
122 movi \at, __XTENSA_UL_CONST(TASK_SIZE)
123 bgeu \as, \at, \error
124 sub \at, \at, \as
125 bgeu \aa, \at, \error
126 .endm
127
128/*
129 * access_ok determines whether a memory access is allowed. See the
130 * equivalent C-macro version below for clarity.
131 *
132 * On error, access_ok branches to a label indicated by parameter
133 * <error>. This implies that the macro falls through to the next
134 * instruction on success.
135 *
136 * Note that we assume success is the common case, and we optimize the
137 * branch fall-through case on success.
138 *
139 * On Entry:
140 * <aa> register containing memory address
141 * <as> register containing memory size
142 * <at> temp register
143 * <sp>
144 * <error> label to branch to on error; implies fall-through
145 * macro on success
146 * On Exit:
147 * <aa> preserved
148 * <as> preserved
149 * <at> destroyed
150 */
151 .macro access_ok aa, as, at, sp, error
152 kernel_ok \at, \sp, .Laccess_ok_\@
153 user_ok \aa, \as, \at, \error
154.Laccess_ok_\@:
155 .endm
156
157#else /* __ASSEMBLY__ not defined */
158
159#include <linux/sched.h>
160#include <asm/types.h>
161
162/*
163 * The fs value determines whether argument validity checking should
164 * be performed or not. If get_fs() == USER_DS, checking is
165 * performed, with get_fs() == KERNEL_DS, checking is bypassed.
166 *
167 * For historical reasons (Data Segment Register?), these macros are
168 * grossly misnamed.
169 */
170
171#define KERNEL_DS ((mm_segment_t) { 0 })
172#define USER_DS ((mm_segment_t) { 1 })
173
174#define get_ds() (KERNEL_DS)
175#define get_fs() (current->thread.current_ds)
176#define set_fs(val) (current->thread.current_ds = (val))
177
178#define segment_eq(a,b) ((a).seg == (b).seg)
179
180#define __kernel_ok (segment_eq(get_fs(), KERNEL_DS))
181#define __user_ok(addr,size) (((size) <= TASK_SIZE)&&((addr) <= TASK_SIZE-(size)))
182#define __access_ok(addr,size) (__kernel_ok || __user_ok((addr),(size)))
183#define access_ok(type,addr,size) __access_ok((unsigned long)(addr),(size))
184
185/*
186 * These are the main single-value transfer routines. They
187 * automatically use the right size if we just have the right pointer
188 * type.
189 *
190 * This gets kind of ugly. We want to return _two_ values in
191 * "get_user()" and yet we don't want to do any pointers, because that
192 * is too much of a performance impact. Thus we have a few rather ugly
193 * macros here, and hide all the uglyness from the user.
194 *
195 * Careful to not
196 * (a) re-use the arguments for side effects (sizeof is ok)
197 * (b) require any knowledge of processes at this stage
198 */
199#define put_user(x,ptr) __put_user_check((x),(ptr),sizeof(*(ptr)))
200#define get_user(x,ptr) __get_user_check((x),(ptr),sizeof(*(ptr)))
201
202/*
203 * The "__xxx" versions of the user access functions are versions that
204 * do not verify the address space, that must have been done previously
205 * with a separate "access_ok()" call (this is used when we do multiple
206 * accesses to the same area of user memory).
207 */
208#define __put_user(x,ptr) __put_user_nocheck((x),(ptr),sizeof(*(ptr)))
209#define __get_user(x,ptr) __get_user_nocheck((x),(ptr),sizeof(*(ptr)))
210
211
212extern long __put_user_bad(void);
213
214#define __put_user_nocheck(x,ptr,size) \
215({ \
216 long __pu_err; \
217 __put_user_size((x),(ptr),(size),__pu_err); \
218 __pu_err; \
219})
220
221#define __put_user_check(x,ptr,size) \
222({ \
223 long __pu_err = -EFAULT; \
224 __typeof__(*(ptr)) *__pu_addr = (ptr); \
225 if (access_ok(VERIFY_WRITE,__pu_addr,size)) \
226 __put_user_size((x),__pu_addr,(size),__pu_err); \
227 __pu_err; \
228})
229
230#define __put_user_size(x,ptr,size,retval) \
231do { \
232 int __cb; \
233 retval = 0; \
234 switch (size) { \
235 case 1: __put_user_asm(x,ptr,retval,1,"s8i",__cb); break; \
236 case 2: __put_user_asm(x,ptr,retval,2,"s16i",__cb); break; \
237 case 4: __put_user_asm(x,ptr,retval,4,"s32i",__cb); break; \
238 case 8: { \
239 __typeof__(*ptr) __v64 = x; \
240 retval = __copy_to_user(ptr,&__v64,8); \
241 break; \
242 } \
243 default: __put_user_bad(); \
244 } \
245} while (0)
246
247
248/*
249 * Consider a case of a user single load/store would cause both an
250 * unaligned exception and an MMU-related exception (unaligned
251 * exceptions happen first):
252 *
253 * User code passes a bad variable ptr to a system call.
254 * Kernel tries to access the variable.
255 * Unaligned exception occurs.
256 * Unaligned exception handler tries to make aligned accesses.
257 * Double exception occurs for MMU-related cause (e.g., page not mapped).
258 * do_page_fault() thinks the fault address belongs to the kernel, not the
259 * user, and panics.
260 *
261 * The kernel currently prohibits user unaligned accesses. We use the
262 * __check_align_* macros to check for unaligned addresses before
263 * accessing user space so we don't crash the kernel. Both
264 * __put_user_asm and __get_user_asm use these alignment macros, so
265 * macro-specific labels such as 0f, 1f, %0, %2, and %3 must stay in
266 * sync.
267 */
268
269#define __check_align_1 ""
270
271#define __check_align_2 \
272 " _bbci.l %3, 0, 1f \n" \
273 " movi %0, %4 \n" \
274 " _j 2f \n"
275
276#define __check_align_4 \
277 " _bbsi.l %3, 0, 0f \n" \
278 " _bbci.l %3, 1, 1f \n" \
279 "0: movi %0, %4 \n" \
280 " _j 2f \n"
281
282
283/*
284 * We don't tell gcc that we are accessing memory, but this is OK
285 * because we do not write to any memory gcc knows about, so there
286 * are no aliasing issues.
287 *
288 * WARNING: If you modify this macro at all, verify that the
289 * __check_align_* macros still work.
290 */
291#define __put_user_asm(x, addr, err, align, insn, cb) \
292 __asm__ __volatile__( \
293 __check_align_##align \
294 "1: "insn" %2, %3, 0 \n" \
295 "2: \n" \
296 " .section .fixup,\"ax\" \n" \
297 " .align 4 \n" \
298 "4: \n" \
299 " .long 2b \n" \
300 "5: \n" \
301 " l32r %1, 4b \n" \
302 " movi %0, %4 \n" \
303 " jx %1 \n" \
304 " .previous \n" \
305 " .section __ex_table,\"a\" \n" \
306 " .long 1b, 5b \n" \
307 " .previous" \
308 :"=r" (err), "=r" (cb) \
309 :"r" ((int)(x)), "r" (addr), "i" (-EFAULT), "0" (err))
310
311#define __get_user_nocheck(x,ptr,size) \
312({ \
313 long __gu_err, __gu_val; \
314 __get_user_size(__gu_val,(ptr),(size),__gu_err); \
315 (x) = (__typeof__(*(ptr)))__gu_val; \
316 __gu_err; \
317})
318
319#define __get_user_check(x,ptr,size) \
320({ \
321 long __gu_err = -EFAULT, __gu_val = 0; \
322 const __typeof__(*(ptr)) *__gu_addr = (ptr); \
323 if (access_ok(VERIFY_READ,__gu_addr,size)) \
324 __get_user_size(__gu_val,__gu_addr,(size),__gu_err); \
325 (x) = (__typeof__(*(ptr)))__gu_val; \
326 __gu_err; \
327})
328
329extern long __get_user_bad(void);
330
331#define __get_user_size(x,ptr,size,retval) \
332do { \
333 int __cb; \
334 retval = 0; \
335 switch (size) { \
336 case 1: __get_user_asm(x,ptr,retval,1,"l8ui",__cb); break; \
337 case 2: __get_user_asm(x,ptr,retval,2,"l16ui",__cb); break; \
338 case 4: __get_user_asm(x,ptr,retval,4,"l32i",__cb); break; \
339 case 8: retval = __copy_from_user(&x,ptr,8); break; \
340 default: (x) = __get_user_bad(); \
341 } \
342} while (0)
343
344
345/*
346 * WARNING: If you modify this macro at all, verify that the
347 * __check_align_* macros still work.
348 */
349#define __get_user_asm(x, addr, err, align, insn, cb) \
350 __asm__ __volatile__( \
351 __check_align_##align \
352 "1: "insn" %2, %3, 0 \n" \
353 "2: \n" \
354 " .section .fixup,\"ax\" \n" \
355 " .align 4 \n" \
356 "4: \n" \
357 " .long 2b \n" \
358 "5: \n" \
359 " l32r %1, 4b \n" \
360 " movi %2, 0 \n" \
361 " movi %0, %4 \n" \
362 " jx %1 \n" \
363 " .previous \n" \
364 " .section __ex_table,\"a\" \n" \
365 " .long 1b, 5b \n" \
366 " .previous" \
367 :"=r" (err), "=r" (cb), "=r" (x) \
368 :"r" (addr), "i" (-EFAULT), "0" (err))
369
370
371/*
372 * Copy to/from user space
373 */
374
375/*
376 * We use a generic, arbitrary-sized copy subroutine. The Xtensa
377 * architecture would cause heavy code bloat if we tried to inline
378 * these functions and provide __constant_copy_* equivalents like the
379 * i386 versions. __xtensa_copy_user is quite efficient. See the
380 * .fixup section of __xtensa_copy_user for a discussion on the
381 * X_zeroing equivalents for Xtensa.
382 */
383
384extern unsigned __xtensa_copy_user(void *to, const void *from, unsigned n);
385#define __copy_user(to,from,size) __xtensa_copy_user(to,from,size)
386
387
388static inline unsigned long
389__generic_copy_from_user_nocheck(void *to, const void *from, unsigned long n)
390{
391 return __copy_user(to,from,n);
392}
393
394static inline unsigned long
395__generic_copy_to_user_nocheck(void *to, const void *from, unsigned long n)
396{
397 return __copy_user(to,from,n);
398}
399
400static inline unsigned long
401__generic_copy_to_user(void *to, const void *from, unsigned long n)
402{
403 prefetch(from);
404 if (access_ok(VERIFY_WRITE, to, n))
405 return __copy_user(to,from,n);
406 return n;
407}
408
409static inline unsigned long
410__generic_copy_from_user(void *to, const void *from, unsigned long n)
411{
412 prefetchw(to);
413 if (access_ok(VERIFY_READ, from, n))
414 return __copy_user(to,from,n);
415 else
416 memset(to, 0, n);
417 return n;
418}
419
420#define copy_to_user(to,from,n) __generic_copy_to_user((to),(from),(n))
421#define copy_from_user(to,from,n) __generic_copy_from_user((to),(from),(n))
422#define __copy_to_user(to,from,n) __generic_copy_to_user_nocheck((to),(from),(n))
423#define __copy_from_user(to,from,n) __generic_copy_from_user_nocheck((to),(from),(n))
424#define __copy_to_user_inatomic __copy_to_user
425#define __copy_from_user_inatomic __copy_from_user
426
427
428/*
429 * We need to return the number of bytes not cleared. Our memset()
430 * returns zero if a problem occurs while accessing user-space memory.
431 * In that event, return no memory cleared. Otherwise, zero for
432 * success.
433 */
434
435static inline unsigned long
436__xtensa_clear_user(void *addr, unsigned long size)
437{
438 if ( ! memset(addr, 0, size) )
439 return size;
440 return 0;
441}
442
443static inline unsigned long
444clear_user(void *addr, unsigned long size)
445{
446 if (access_ok(VERIFY_WRITE, addr, size))
447 return __xtensa_clear_user(addr, size);
448 return size ? -EFAULT : 0;
449}
450
451#define __clear_user __xtensa_clear_user
452
453
454extern long __strncpy_user(char *, const char *, long);
455#define __strncpy_from_user __strncpy_user
456
457static inline long
458strncpy_from_user(char *dst, const char *src, long count)
459{
460 if (access_ok(VERIFY_READ, src, 1))
461 return __strncpy_from_user(dst, src, count);
462 return -EFAULT;
463}
464
465
466#define strlen_user(str) strnlen_user((str), TASK_SIZE - 1)
467
468/*
469 * Return the size of a string (including the ending 0!)
470 */
471extern long __strnlen_user(const char *, long);
472
473static inline long strnlen_user(const char *str, long len)
474{
475 unsigned long top = __kernel_ok ? ~0UL : TASK_SIZE - 1;
476
477 if ((unsigned long)str > top)
478 return 0;
479 return __strnlen_user(str, len);
480}
481
482
483struct exception_table_entry
484{
485 unsigned long insn, fixup;
486};
487
488/* Returns 0 if exception not found and fixup.unit otherwise. */
489
490extern unsigned long search_exception_table(unsigned long addr);
491extern void sort_exception_table(void);
492
493/* Returns the new pc */
494#define fixup_exception(map_reg, fixup_unit, pc) \
495({ \
496 fixup_unit; \
497})
498
499#endif /* __ASSEMBLY__ */
500#endif /* _XTENSA_UACCESS_H */
diff --git a/include/asm-xtensa/ucontext.h b/include/asm-xtensa/ucontext.h
deleted file mode 100644
index 94c94ed3e00a..000000000000
--- a/include/asm-xtensa/ucontext.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * include/asm-xtensa/ucontext.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_UCONTEXT_H
12#define _XTENSA_UCONTEXT_H
13
14struct ucontext {
15 unsigned long uc_flags;
16 struct ucontext *uc_link;
17 stack_t uc_stack;
18 struct sigcontext uc_mcontext;
19 sigset_t uc_sigmask; /* mask last for extensibility */
20};
21
22#endif /* _XTENSA_UCONTEXT_H */
diff --git a/include/asm-xtensa/unaligned.h b/include/asm-xtensa/unaligned.h
deleted file mode 100644
index 8f3424fc5d18..000000000000
--- a/include/asm-xtensa/unaligned.h
+++ /dev/null
@@ -1,29 +0,0 @@
1/*
2 * Xtensa doesn't handle unaligned accesses efficiently.
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10#ifndef _ASM_XTENSA_UNALIGNED_H
11#define _ASM_XTENSA_UNALIGNED_H
12
13#ifdef __XTENSA_EL__
14# include <linux/unaligned/le_memmove.h>
15# include <linux/unaligned/be_byteshift.h>
16# include <linux/unaligned/generic.h>
17# define get_unaligned __get_unaligned_le
18# define put_unaligned __put_unaligned_le
19#elif defined(__XTENSA_EB__)
20# include <linux/unaligned/be_memmove.h>
21# include <linux/unaligned/le_byteshift.h>
22# include <linux/unaligned/generic.h>
23# define get_unaligned __get_unaligned_be
24# define put_unaligned __put_unaligned_be
25#else
26# error processor byte order undefined!
27#endif
28
29#endif /* _ASM_XTENSA_UNALIGNED_H */
diff --git a/include/asm-xtensa/unistd.h b/include/asm-xtensa/unistd.h
deleted file mode 100644
index c092c8fbb2cf..000000000000
--- a/include/asm-xtensa/unistd.h
+++ /dev/null
@@ -1,735 +0,0 @@
1/*
2 * include/asm-xtensa/unistd.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_UNISTD_H
12#define _XTENSA_UNISTD_H
13
14#ifndef __SYSCALL
15# define __SYSCALL(nr,func,nargs)
16#endif
17
18#define __NR_spill 0
19__SYSCALL( 0, sys_ni_syscall, 0)
20#define __NR_xtensa 1
21__SYSCALL( 1, sys_ni_syscall, 0)
22#define __NR_available4 2
23__SYSCALL( 2, sys_ni_syscall, 0)
24#define __NR_available5 3
25__SYSCALL( 3, sys_ni_syscall, 0)
26#define __NR_available6 4
27__SYSCALL( 4, sys_ni_syscall, 0)
28#define __NR_available7 5
29__SYSCALL( 5, sys_ni_syscall, 0)
30#define __NR_available8 6
31__SYSCALL( 6, sys_ni_syscall, 0)
32#define __NR_available9 7
33__SYSCALL( 7, sys_ni_syscall, 0)
34
35/* File Operations */
36
37#define __NR_open 8
38__SYSCALL( 8, sys_open, 3)
39#define __NR_close 9
40__SYSCALL( 9, sys_close, 1)
41#define __NR_dup 10
42__SYSCALL( 10, sys_dup, 1)
43#define __NR_dup2 11
44__SYSCALL( 11, sys_dup2, 2)
45#define __NR_read 12
46__SYSCALL( 12, sys_read, 3)
47#define __NR_write 13
48__SYSCALL( 13, sys_write, 3)
49#define __NR_select 14
50__SYSCALL( 14, sys_select, 5)
51#define __NR_lseek 15
52__SYSCALL( 15, sys_lseek, 3)
53#define __NR_poll 16
54__SYSCALL( 16, sys_poll, 3)
55#define __NR__llseek 17
56__SYSCALL( 17, sys_llseek, 5)
57#define __NR_epoll_wait 18
58__SYSCALL( 18, sys_epoll_wait, 4)
59#define __NR_epoll_ctl 19
60__SYSCALL( 19, sys_epoll_ctl, 4)
61#define __NR_epoll_create 20
62__SYSCALL( 20, sys_epoll_create, 1)
63#define __NR_creat 21
64__SYSCALL( 21, sys_creat, 2)
65#define __NR_truncate 22
66__SYSCALL( 22, sys_truncate, 2)
67#define __NR_ftruncate 23
68__SYSCALL( 23, sys_ftruncate, 2)
69#define __NR_readv 24
70__SYSCALL( 24, sys_readv, 3)
71#define __NR_writev 25
72__SYSCALL( 25, sys_writev, 3)
73#define __NR_fsync 26
74__SYSCALL( 26, sys_fsync, 1)
75#define __NR_fdatasync 27
76__SYSCALL( 27, sys_fdatasync, 1)
77#define __NR_truncate64 28
78__SYSCALL( 28, sys_truncate64, 2)
79#define __NR_ftruncate64 29
80__SYSCALL( 29, sys_ftruncate64, 2)
81#define __NR_pread64 30
82__SYSCALL( 30, sys_pread64, 6)
83#define __NR_pwrite64 31
84__SYSCALL( 31, sys_pwrite64, 6)
85
86#define __NR_link 32
87__SYSCALL( 32, sys_link, 2)
88#define __NR_rename 33
89__SYSCALL( 33, sys_rename, 2)
90#define __NR_symlink 34
91__SYSCALL( 34, sys_symlink, 2)
92#define __NR_readlink 35
93__SYSCALL( 35, sys_readlink, 3)
94#define __NR_mknod 36
95__SYSCALL( 36, sys_mknod, 3)
96#define __NR_pipe 37
97__SYSCALL( 37, xtensa_pipe, 1)
98#define __NR_unlink 38
99__SYSCALL( 38, sys_unlink, 1)
100#define __NR_rmdir 39
101__SYSCALL( 39, sys_rmdir, 1)
102
103#define __NR_mkdir 40
104__SYSCALL( 40, sys_mkdir, 2)
105#define __NR_chdir 41
106__SYSCALL( 41, sys_chdir, 1)
107#define __NR_fchdir 42
108__SYSCALL( 42, sys_fchdir, 1)
109#define __NR_getcwd 43
110__SYSCALL( 43, sys_getcwd, 2)
111
112#define __NR_chmod 44
113__SYSCALL( 44, sys_chmod, 2)
114#define __NR_chown 45
115__SYSCALL( 45, sys_chown, 3)
116#define __NR_stat 46
117__SYSCALL( 46, sys_newstat, 2)
118#define __NR_stat64 47
119__SYSCALL( 47, sys_stat64, 2)
120
121#define __NR_lchown 48
122__SYSCALL( 48, sys_lchown, 3)
123#define __NR_lstat 49
124__SYSCALL( 49, sys_newlstat, 2)
125#define __NR_lstat64 50
126__SYSCALL( 50, sys_lstat64, 2)
127#define __NR_available51 51
128__SYSCALL( 51, sys_ni_syscall, 0)
129
130#define __NR_fchmod 52
131__SYSCALL( 52, sys_fchmod, 2)
132#define __NR_fchown 53
133__SYSCALL( 53, sys_fchown, 3)
134#define __NR_fstat 54
135__SYSCALL( 54, sys_newfstat, 2)
136#define __NR_fstat64 55
137__SYSCALL( 55, sys_fstat64, 2)
138
139#define __NR_flock 56
140__SYSCALL( 56, sys_flock, 2)
141#define __NR_access 57
142__SYSCALL( 57, sys_access, 2)
143#define __NR_umask 58
144__SYSCALL( 58, sys_umask, 1)
145#define __NR_getdents 59
146__SYSCALL( 59, sys_getdents, 3)
147#define __NR_getdents64 60
148__SYSCALL( 60, sys_getdents64, 3)
149#define __NR_fcntl64 61
150__SYSCALL( 61, sys_fcntl64, 3)
151#define __NR_available62 62
152__SYSCALL( 62, sys_ni_syscall, 0)
153#define __NR_fadvise64_64 63
154__SYSCALL( 63, xtensa_fadvise64_64, 6)
155#define __NR_utime 64 /* glibc 2.3.3 ?? */
156__SYSCALL( 64, sys_utime, 2)
157#define __NR_utimes 65
158__SYSCALL( 65, sys_utimes, 2)
159#define __NR_ioctl 66
160__SYSCALL( 66, sys_ioctl, 3)
161#define __NR_fcntl 67
162__SYSCALL( 67, sys_fcntl, 3)
163
164#define __NR_setxattr 68
165__SYSCALL( 68, sys_setxattr, 5)
166#define __NR_getxattr 69
167__SYSCALL( 69, sys_getxattr, 4)
168#define __NR_listxattr 70
169__SYSCALL( 70, sys_listxattr, 3)
170#define __NR_removexattr 71
171__SYSCALL( 71, sys_removexattr, 2)
172#define __NR_lsetxattr 72
173__SYSCALL( 72, sys_lsetxattr, 5)
174#define __NR_lgetxattr 73
175__SYSCALL( 73, sys_lgetxattr, 4)
176#define __NR_llistxattr 74
177__SYSCALL( 74, sys_llistxattr, 3)
178#define __NR_lremovexattr 75
179__SYSCALL( 75, sys_lremovexattr, 2)
180#define __NR_fsetxattr 76
181__SYSCALL( 76, sys_fsetxattr, 5)
182#define __NR_fgetxattr 77
183__SYSCALL( 77, sys_fgetxattr, 4)
184#define __NR_flistxattr 78
185__SYSCALL( 78, sys_flistxattr, 3)
186#define __NR_fremovexattr 79
187__SYSCALL( 79, sys_fremovexattr, 2)
188
189/* File Map / Shared Memory Operations */
190
191#define __NR_mmap2 80
192__SYSCALL( 80, xtensa_mmap2, 6)
193#define __NR_munmap 81
194__SYSCALL( 81, sys_munmap, 2)
195#define __NR_mprotect 82
196__SYSCALL( 82, sys_mprotect, 3)
197#define __NR_brk 83
198__SYSCALL( 83, sys_brk, 1)
199#define __NR_mlock 84
200__SYSCALL( 84, sys_mlock, 2)
201#define __NR_munlock 85
202__SYSCALL( 85, sys_munlock, 2)
203#define __NR_mlockall 86
204__SYSCALL( 86, sys_mlockall, 1)
205#define __NR_munlockall 87
206__SYSCALL( 87, sys_munlockall, 0)
207#define __NR_mremap 88
208__SYSCALL( 88, sys_mremap, 4)
209#define __NR_msync 89
210__SYSCALL( 89, sys_msync, 3)
211#define __NR_mincore 90
212__SYSCALL( 90, sys_mincore, 3)
213#define __NR_madvise 91
214__SYSCALL( 91, sys_madvise, 3)
215#define __NR_shmget 92
216__SYSCALL( 92, sys_shmget, 4)
217#define __NR_shmat 93
218__SYSCALL( 93, xtensa_shmat, 4)
219#define __NR_shmctl 94
220__SYSCALL( 94, sys_shmctl, 4)
221#define __NR_shmdt 95
222__SYSCALL( 95, sys_shmdt, 4)
223
224/* Socket Operations */
225
226#define __NR_socket 96
227__SYSCALL( 96, sys_socket, 3)
228#define __NR_setsockopt 97
229__SYSCALL( 97, sys_setsockopt, 5)
230#define __NR_getsockopt 98
231__SYSCALL( 98, sys_getsockopt, 5)
232#define __NR_shutdown 99
233__SYSCALL( 99, sys_shutdown, 2)
234
235#define __NR_bind 100
236__SYSCALL(100, sys_bind, 3)
237#define __NR_connect 101
238__SYSCALL(101, sys_connect, 3)
239#define __NR_listen 102
240__SYSCALL(102, sys_listen, 2)
241#define __NR_accept 103
242__SYSCALL(103, sys_accept, 3)
243
244#define __NR_getsockname 104
245__SYSCALL(104, sys_getsockname, 3)
246#define __NR_getpeername 105
247__SYSCALL(105, sys_getpeername, 3)
248#define __NR_sendmsg 106
249__SYSCALL(106, sys_sendmsg, 3)
250#define __NR_recvmsg 107
251__SYSCALL(107, sys_recvmsg, 3)
252#define __NR_send 108
253__SYSCALL(108, sys_send, 4)
254#define __NR_recv 109
255__SYSCALL(109, sys_recv, 4)
256#define __NR_sendto 110
257__SYSCALL(110, sys_sendto, 6)
258#define __NR_recvfrom 111
259__SYSCALL(111, sys_recvfrom, 6)
260
261#define __NR_socketpair 112
262__SYSCALL(112, sys_socketpair, 4)
263#define __NR_sendfile 113
264__SYSCALL(113, sys_sendfile, 4)
265#define __NR_sendfile64 114
266__SYSCALL(114, sys_sendfile64, 4)
267#define __NR_available115 115
268__SYSCALL(115, sys_ni_syscall, 0)
269
270/* Process Operations */
271
272#define __NR_clone 116
273__SYSCALL(116, xtensa_clone, 5)
274#define __NR_execve 117
275__SYSCALL(117, xtensa_execve, 3)
276#define __NR_exit 118
277__SYSCALL(118, sys_exit, 1)
278#define __NR_exit_group 119
279__SYSCALL(119, sys_exit_group, 1)
280#define __NR_getpid 120
281__SYSCALL(120, sys_getpid, 0)
282#define __NR_wait4 121
283__SYSCALL(121, sys_wait4, 4)
284#define __NR_waitid 122
285__SYSCALL(122, sys_waitid, 5)
286#define __NR_kill 123
287__SYSCALL(123, sys_kill, 2)
288#define __NR_tkill 124
289__SYSCALL(124, sys_tkill, 2)
290#define __NR_tgkill 125
291__SYSCALL(125, sys_tgkill, 3)
292#define __NR_set_tid_address 126
293__SYSCALL(126, sys_set_tid_address, 1)
294#define __NR_gettid 127
295__SYSCALL(127, sys_gettid, 0)
296#define __NR_setsid 128
297__SYSCALL(128, sys_setsid, 0)
298#define __NR_getsid 129
299__SYSCALL(129, sys_getsid, 1)
300#define __NR_prctl 130
301__SYSCALL(130, sys_prctl, 5)
302#define __NR_personality 131
303__SYSCALL(131, sys_personality, 1)
304#define __NR_getpriority 132
305__SYSCALL(132, sys_getpriority, 2)
306#define __NR_setpriority 133
307__SYSCALL(133, sys_setpriority, 3)
308#define __NR_setitimer 134
309__SYSCALL(134, sys_setitimer, 3)
310#define __NR_getitimer 135
311__SYSCALL(135, sys_getitimer, 2)
312#define __NR_setuid 136
313__SYSCALL(136, sys_setuid, 1)
314#define __NR_getuid 137
315__SYSCALL(137, sys_getuid, 0)
316#define __NR_setgid 138
317__SYSCALL(138, sys_setgid, 1)
318#define __NR_getgid 139
319__SYSCALL(139, sys_getgid, 0)
320#define __NR_geteuid 140
321__SYSCALL(140, sys_geteuid, 0)
322#define __NR_getegid 141
323__SYSCALL(141, sys_getegid, 0)
324#define __NR_setreuid 142
325__SYSCALL(142, sys_setreuid, 2)
326#define __NR_setregid 143
327__SYSCALL(143, sys_setregid, 2)
328#define __NR_setresuid 144
329__SYSCALL(144, sys_setresuid, 3)
330#define __NR_getresuid 145
331__SYSCALL(145, sys_getresuid, 3)
332#define __NR_setresgid 146
333__SYSCALL(146, sys_setresgid, 3)
334#define __NR_getresgid 147
335__SYSCALL(147, sys_getresgid, 3)
336#define __NR_setpgid 148
337__SYSCALL(148, sys_setpgid, 2)
338#define __NR_getpgid 149
339__SYSCALL(149, sys_getpgid, 1)
340#define __NR_getppid 150
341__SYSCALL(150, sys_getppid, 0)
342#define __NR_getpgrp 151
343__SYSCALL(151, sys_getpgrp, 0)
344
345#define __NR_reserved152 152 /* set_thread_area */
346__SYSCALL(152, sys_ni_syscall, 0)
347#define __NR_reserved153 153 /* get_thread_area */
348__SYSCALL(153, sys_ni_syscall, 0)
349#define __NR_times 154
350__SYSCALL(154, sys_times, 1)
351#define __NR_acct 155
352__SYSCALL(155, sys_acct, 1)
353#define __NR_sched_setaffinity 156
354__SYSCALL(156, sys_sched_setaffinity, 3)
355#define __NR_sched_getaffinity 157
356__SYSCALL(157, sys_sched_getaffinity, 3)
357#define __NR_capget 158
358__SYSCALL(158, sys_capget, 2)
359#define __NR_capset 159
360__SYSCALL(159, sys_capset, 2)
361#define __NR_ptrace 160
362__SYSCALL(160, sys_ptrace, 4)
363#define __NR_semtimedop 161
364__SYSCALL(161, sys_semtimedop, 5)
365#define __NR_semget 162
366__SYSCALL(162, sys_semget, 4)
367#define __NR_semop 163
368__SYSCALL(163, sys_semop, 4)
369#define __NR_semctl 164
370__SYSCALL(164, sys_semctl, 4)
371#define __NR_available165 165
372__SYSCALL(165, sys_ni_syscall, 0)
373#define __NR_msgget 166
374__SYSCALL(166, sys_msgget, 4)
375#define __NR_msgsnd 167
376__SYSCALL(167, sys_msgsnd, 4)
377#define __NR_msgrcv 168
378__SYSCALL(168, sys_msgrcv, 4)
379#define __NR_msgctl 169
380__SYSCALL(169, sys_msgctl, 4)
381#define __NR_available170 170
382__SYSCALL(170, sys_ni_syscall, 0)
383#define __NR_available171 171
384__SYSCALL(171, sys_ni_syscall, 0)
385
386/* File System */
387
388#define __NR_mount 172
389__SYSCALL(172, sys_mount, 5)
390#define __NR_swapon 173
391__SYSCALL(173, sys_swapon, 2)
392#define __NR_chroot 174
393__SYSCALL(174, sys_chroot, 1)
394#define __NR_pivot_root 175
395__SYSCALL(175, sys_pivot_root, 2)
396#define __NR_umount 176
397__SYSCALL(176, sys_umount, 2)
398#define __NR_swapoff 177
399__SYSCALL(177, sys_swapoff, 1)
400#define __NR_sync 178
401__SYSCALL(178, sys_sync, 0)
402#define __NR_available179 179
403__SYSCALL(179, sys_ni_syscall, 0)
404#define __NR_setfsuid 180
405__SYSCALL(180, sys_setfsuid, 1)
406#define __NR_setfsgid 181
407__SYSCALL(181, sys_setfsgid, 1)
408#define __NR_sysfs 182
409__SYSCALL(182, sys_sysfs, 3)
410#define __NR_ustat 183
411__SYSCALL(183, sys_ustat, 2)
412#define __NR_statfs 184
413__SYSCALL(184, sys_statfs, 2)
414#define __NR_fstatfs 185
415__SYSCALL(185, sys_fstatfs, 2)
416#define __NR_statfs64 186
417__SYSCALL(186, sys_statfs64, 3)
418#define __NR_fstatfs64 187
419__SYSCALL(187, sys_fstatfs64, 3)
420
421/* System */
422
423#define __NR_setrlimit 188
424__SYSCALL(188, sys_setrlimit, 2)
425#define __NR_getrlimit 189
426__SYSCALL(189, sys_getrlimit, 2)
427#define __NR_getrusage 190
428__SYSCALL(190, sys_getrusage, 2)
429#define __NR_futex 191
430__SYSCALL(191, sys_futex, 5)
431#define __NR_gettimeofday 192
432__SYSCALL(192, sys_gettimeofday, 2)
433#define __NR_settimeofday 193
434__SYSCALL(193, sys_settimeofday, 2)
435#define __NR_adjtimex 194
436__SYSCALL(194, sys_adjtimex, 1)
437#define __NR_nanosleep 195
438__SYSCALL(195, sys_nanosleep, 2)
439#define __NR_getgroups 196
440__SYSCALL(196, sys_getgroups, 2)
441#define __NR_setgroups 197
442__SYSCALL(197, sys_setgroups, 2)
443#define __NR_sethostname 198
444__SYSCALL(198, sys_sethostname, 2)
445#define __NR_setdomainname 199
446__SYSCALL(199, sys_setdomainname, 2)
447#define __NR_syslog 200
448__SYSCALL(200, sys_syslog, 3)
449#define __NR_vhangup 201
450__SYSCALL(201, sys_vhangup, 0)
451#define __NR_uselib 202
452__SYSCALL(202, sys_uselib, 1)
453#define __NR_reboot 203
454__SYSCALL(203, sys_reboot, 3)
455#define __NR_quotactl 204
456__SYSCALL(204, sys_quotactl, 4)
457#define __NR_nfsservctl 205
458__SYSCALL(205, sys_nfsservctl, 3)
459#define __NR__sysctl 206
460__SYSCALL(206, sys_sysctl, 1)
461#define __NR_bdflush 207
462__SYSCALL(207, sys_bdflush, 2)
463#define __NR_uname 208
464__SYSCALL(208, sys_newuname, 1)
465#define __NR_sysinfo 209
466__SYSCALL(209, sys_sysinfo, 1)
467#define __NR_init_module 210
468__SYSCALL(210, sys_init_module, 2)
469#define __NR_delete_module 211
470__SYSCALL(211, sys_delete_module, 1)
471
472#define __NR_sched_setparam 212
473__SYSCALL(212, sys_sched_setparam, 2)
474#define __NR_sched_getparam 213
475__SYSCALL(213, sys_sched_getparam, 2)
476#define __NR_sched_setscheduler 214
477__SYSCALL(214, sys_sched_setscheduler, 3)
478#define __NR_sched_getscheduler 215
479__SYSCALL(215, sys_sched_getscheduler, 1)
480#define __NR_sched_get_priority_max 216
481__SYSCALL(216, sys_sched_get_priority_max, 1)
482#define __NR_sched_get_priority_min 217
483__SYSCALL(217, sys_sched_get_priority_min, 1)
484#define __NR_sched_rr_get_interval 218
485__SYSCALL(218, sys_sched_rr_get_interval, 2)
486#define __NR_sched_yield 219
487__SYSCALL(219, sys_sched_yield, 0)
488#define __NR_available222 222
489__SYSCALL(222, sys_ni_syscall, 0)
490
491/* Signal Handling */
492
493#define __NR_restart_syscall 223
494__SYSCALL(223, sys_restart_syscall, 0)
495#define __NR_sigaltstack 224
496__SYSCALL(224, xtensa_sigaltstack, 2)
497#define __NR_rt_sigreturn 225
498__SYSCALL(225, xtensa_rt_sigreturn, 1)
499#define __NR_rt_sigaction 226
500__SYSCALL(226, sys_rt_sigaction, 4)
501#define __NR_rt_sigprocmask 227
502__SYSCALL(227, sys_rt_sigprocmask, 4)
503#define __NR_rt_sigpending 228
504__SYSCALL(228, sys_rt_sigpending, 2)
505#define __NR_rt_sigtimedwait 229
506__SYSCALL(229, sys_rt_sigtimedwait, 4)
507#define __NR_rt_sigqueueinfo 230
508__SYSCALL(230, sys_rt_sigqueueinfo, 3)
509#define __NR_rt_sigsuspend 231
510__SYSCALL(231, xtensa_rt_sigsuspend, 2)
511
512/* Message */
513
514#define __NR_mq_open 232
515__SYSCALL(232, sys_mq_open, 4)
516#define __NR_mq_unlink 233
517__SYSCALL(233, sys_mq_unlink, 1)
518#define __NR_mq_timedsend 234
519__SYSCALL(234, sys_mq_timedsend, 5)
520#define __NR_mq_timedreceive 235
521__SYSCALL(235, sys_mq_timedreceive, 5)
522#define __NR_mq_notify 236
523__SYSCALL(236, sys_mq_notify, 2)
524#define __NR_mq_getsetattr 237
525__SYSCALL(237, sys_mq_getsetattr, 3)
526#define __NR_available238 238
527__SYSCALL(238, sys_ni_syscall, 0)
528
529/* IO */
530
531#define __NR_io_setup 239
532__SYSCALL(239, sys_io_setup, 2)
533#define __NR_io_destroy 240
534__SYSCALL(240, sys_io_destroy, 1)
535#define __NR_io_submit 241
536__SYSCALL(241, sys_io_submit, 3)
537#define __NR_io_getevents 242
538__SYSCALL(242, sys_io_getevents, 5)
539#define __NR_io_cancel 243
540__SYSCALL(243, sys_io_cancel, 3)
541#define __NR_clock_settime 244
542__SYSCALL(244, sys_clock_settime, 2)
543#define __NR_clock_gettime 245
544__SYSCALL(245, sys_clock_gettime, 2)
545#define __NR_clock_getres 246
546__SYSCALL(246, sys_clock_getres, 2)
547#define __NR_clock_nanosleep 247
548__SYSCALL(247, sys_clock_nanosleep, 4)
549
550/* Timer */
551
552#define __NR_timer_create 248
553__SYSCALL(248, sys_timer_create, 3)
554#define __NR_timer_delete 249
555__SYSCALL(249, sys_timer_delete, 1)
556#define __NR_timer_settime 250
557__SYSCALL(250, sys_timer_settime, 4)
558#define __NR_timer_gettime 251
559__SYSCALL(251, sys_timer_gettime, 2)
560#define __NR_timer_getoverrun 252
561__SYSCALL(252, sys_timer_getoverrun, 1)
562
563/* System */
564
565#define __NR_reserved244 253
566__SYSCALL(253, sys_ni_syscall, 0)
567#define __NR_lookup_dcookie 254
568__SYSCALL(254, sys_lookup_dcookie, 4)
569#define __NR_available255 255
570__SYSCALL(255, sys_ni_syscall, 0)
571#define __NR_add_key 256
572__SYSCALL(256, sys_add_key, 5)
573#define __NR_request_key 257
574__SYSCALL(257, sys_request_key, 5)
575#define __NR_keyctl 258
576__SYSCALL(258, sys_keyctl, 5)
577#define __NR_available259 259
578__SYSCALL(259, sys_ni_syscall, 0)
579
580
581#define __NR_readahead 260
582__SYSCALL(260, sys_readahead, 5)
583#define __NR_remap_file_pages 261
584__SYSCALL(261, sys_remap_file_pages, 5)
585#define __NR_migrate_pages 262
586__SYSCALL(262, sys_migrate_pages, 0)
587#define __NR_mbind 263
588__SYSCALL(263, sys_mbind, 6)
589#define __NR_get_mempolicy 264
590__SYSCALL(264, sys_get_mempolicy, 5)
591#define __NR_set_mempolicy 265
592__SYSCALL(265, sys_set_mempolicy, 3)
593#define __NR_unshare 266
594__SYSCALL(266, sys_unshare, 1)
595#define __NR_move_pages 267
596__SYSCALL(267, sys_move_pages, 0)
597#define __NR_splice 268
598__SYSCALL(268, sys_splice, 0)
599#define __NR_tee 269
600__SYSCALL(269, sys_tee, 0)
601#define __NR_vmsplice 270
602__SYSCALL(270, sys_vmsplice, 0)
603#define __NR_available271 271
604__SYSCALL(271, sys_ni_syscall, 0)
605
606#define __NR_pselect6 272
607__SYSCALL(272, sys_pselect6, 0)
608#define __NR_ppoll 273
609__SYSCALL(273, sys_ppoll, 0)
610#define __NR_epoll_pwait 274
611__SYSCALL(274, sys_epoll_pwait, 0)
612#define __NR_available275 275
613__SYSCALL(275, sys_ni_syscall, 0)
614
615#define __NR_inotify_init 276
616__SYSCALL(276, sys_inotify_init, 0)
617#define __NR_inotify_add_watch 277
618__SYSCALL(277, sys_inotify_add_watch, 3)
619#define __NR_inotify_rm_watch 278
620__SYSCALL(278, sys_inotify_rm_watch, 2)
621#define __NR_available279 279
622__SYSCALL(279, sys_ni_syscall, 0)
623
624#define __NR_getcpu 280
625__SYSCALL(280, sys_getcpu, 0)
626#define __NR_kexec_load 281
627__SYSCALL(281, sys_ni_syscall, 0)
628
629#define __NR_ioprio_set 282
630__SYSCALL(282, sys_ioprio_set, 2)
631#define __NR_ioprio_get 283
632__SYSCALL(283, sys_ioprio_get, 3)
633
634#define __NR_set_robust_list 284
635__SYSCALL(284, sys_set_robust_list, 3)
636#define __NR_get_robust_list 285
637__SYSCALL(285, sys_get_robust_list, 3)
638#define __NR_reserved286 286 /* sync_file_rangeX */
639__SYSCALL(286, sys_ni_syscall, 3)
640#define __NR_available287 287
641__SYSCALL(287, sys_faccessat, 0)
642
643/* Relative File Operations */
644
645#define __NR_openat 288
646__SYSCALL(288, sys_openat, 4)
647#define __NR_mkdirat 289
648__SYSCALL(289, sys_mkdirat, 3)
649#define __NR_mknodat 290
650__SYSCALL(290, sys_mknodat, 4)
651#define __NR_unlinkat 291
652__SYSCALL(291, sys_unlinkat, 3)
653#define __NR_renameat 292
654__SYSCALL(292, sys_renameat, 4)
655#define __NR_linkat 293
656__SYSCALL(293, sys_linkat, 5)
657#define __NR_symlinkat 294
658__SYSCALL(294, sys_symlinkat, 3)
659#define __NR_readlinkat 295
660__SYSCALL(295, sys_readlinkat, 4)
661#define __NR_utimensat 296
662__SYSCALL(296, sys_utimensat, 0)
663#define __NR_fchownat 297
664__SYSCALL(297, sys_fchownat, 5)
665#define __NR_futimesat 298
666__SYSCALL(298, sys_futimesat, 4)
667#define __NR_fstatat64 299
668__SYSCALL(299, sys_fstatat64, 0)
669#define __NR_fchmodat 300
670__SYSCALL(300, sys_fchmodat, 4)
671#define __NR_faccessat 301
672__SYSCALL(301, sys_faccessat, 4)
673#define __NR_available302 302
674__SYSCALL(302, sys_ni_syscall, 0)
675#define __NR_available303 303
676__SYSCALL(303, sys_ni_syscall, 0)
677
678#define __NR_signalfd 304
679__SYSCALL(304, sys_signalfd, 3)
680/* 305 was __NR_timerfd */
681__SYSCALL(305, sys_ni_syscall, 0)
682#define __NR_eventfd 306
683__SYSCALL(306, sys_eventfd, 1)
684
685#define __NR_syscall_count 307
686
687/*
688 * sysxtensa syscall handler
689 *
690 * int sysxtensa (SYS_XTENSA_ATOMIC_SET, ptr, val, unused);
691 * int sysxtensa (SYS_XTENSA_ATOMIC_ADD, ptr, val, unused);
692 * int sysxtensa (SYS_XTENSA_ATOMIC_EXG_ADD, ptr, val, unused);
693 * int sysxtensa (SYS_XTENSA_ATOMIC_CMP_SWP, ptr, oldval, newval);
694 * a2 a6 a3 a4 a5
695 */
696
697#define SYS_XTENSA_RESERVED 0 /* don't use this */
698#define SYS_XTENSA_ATOMIC_SET 1 /* set variable */
699#define SYS_XTENSA_ATOMIC_EXG_ADD 2 /* exchange memory and add */
700#define SYS_XTENSA_ATOMIC_ADD 3 /* add to memory */
701#define SYS_XTENSA_ATOMIC_CMP_SWP 4 /* compare and swap */
702
703#define SYS_XTENSA_COUNT 5 /* count */
704
705#ifdef __KERNEL__
706
707/*
708 * "Conditional" syscalls
709 *
710 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
711 * but it doesn't work on all toolchains, so we just do it by hand
712 */
713#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall");
714
715#define __ARCH_WANT_STAT64
716#define __ARCH_WANT_SYS_UTIME
717#define __ARCH_WANT_SYS_LLSEEK
718#define __ARCH_WANT_SYS_RT_SIGACTION
719#define __ARCH_WANT_SYS_RT_SIGSUSPEND
720#define __ARCH_WANT_SYS_GETPGRP
721
722/*
723 * Ignore legacy system calls in the checksyscalls.sh script
724 */
725
726#define __IGNORE_fork /* use clone */
727#define __IGNORE_time
728#define __IGNORE_alarm /* use setitimer */
729#define __IGNORE_pause
730#define __IGNORE_mmap /* use mmap2 */
731#define __IGNORE_vfork /* use clone */
732#define __IGNORE_fadvise64 /* use fadvise64_64 */
733
734#endif /* __KERNEL__ */
735#endif /* _XTENSA_UNISTD_H */
diff --git a/include/asm-xtensa/user.h b/include/asm-xtensa/user.h
deleted file mode 100644
index 2c3ed23354a8..000000000000
--- a/include/asm-xtensa/user.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/*
2 * include/asm-xtensa/user.h
3 *
4 * Xtensa Processor version.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 *
10 * Copyright (C) 2001 - 2005 Tensilica Inc.
11 */
12
13#ifndef _XTENSA_USER_H
14#define _XTENSA_USER_H
15
16/* This file usually defines a 'struct user' structure. However, it it only
17 * used for a.out file, which are not supported on Xtensa.
18 */
19
20#endif /* _XTENSA_USER_H */
diff --git a/include/asm-xtensa/variant-dc232b/core.h b/include/asm-xtensa/variant-dc232b/core.h
deleted file mode 100644
index 525bd3d90154..000000000000
--- a/include/asm-xtensa/variant-dc232b/core.h
+++ /dev/null
@@ -1,424 +0,0 @@
1/*
2 * Xtensa processor core configuration information.
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (c) 1999-2007 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_CORE_CONFIGURATION_H
12#define _XTENSA_CORE_CONFIGURATION_H
13
14
15/****************************************************************************
16 Parameters Useful for Any Code, USER or PRIVILEGED
17 ****************************************************************************/
18
19/*
20 * Note: Macros of the form XCHAL_HAVE_*** have a value of 1 if the option is
21 * configured, and a value of 0 otherwise. These macros are always defined.
22 */
23
24
25/*----------------------------------------------------------------------
26 ISA
27 ----------------------------------------------------------------------*/
28
29#define XCHAL_HAVE_BE 0 /* big-endian byte ordering */
30#define XCHAL_HAVE_WINDOWED 1 /* windowed registers option */
31#define XCHAL_NUM_AREGS 32 /* num of physical addr regs */
32#define XCHAL_NUM_AREGS_LOG2 5 /* log2(XCHAL_NUM_AREGS) */
33#define XCHAL_MAX_INSTRUCTION_SIZE 3 /* max instr bytes (3..8) */
34#define XCHAL_HAVE_DEBUG 1 /* debug option */
35#define XCHAL_HAVE_DENSITY 1 /* 16-bit instructions */
36#define XCHAL_HAVE_LOOPS 1 /* zero-overhead loops */
37#define XCHAL_HAVE_NSA 1 /* NSA/NSAU instructions */
38#define XCHAL_HAVE_MINMAX 1 /* MIN/MAX instructions */
39#define XCHAL_HAVE_SEXT 1 /* SEXT instruction */
40#define XCHAL_HAVE_CLAMPS 1 /* CLAMPS instruction */
41#define XCHAL_HAVE_MUL16 1 /* MUL16S/MUL16U instructions */
42#define XCHAL_HAVE_MUL32 1 /* MULL instruction */
43#define XCHAL_HAVE_MUL32_HIGH 0 /* MULUH/MULSH instructions */
44#define XCHAL_HAVE_DIV32 1 /* QUOS/QUOU/REMS/REMU instructions */
45#define XCHAL_HAVE_L32R 1 /* L32R instruction */
46#define XCHAL_HAVE_ABSOLUTE_LITERALS 1 /* non-PC-rel (extended) L32R */
47#define XCHAL_HAVE_CONST16 0 /* CONST16 instruction */
48#define XCHAL_HAVE_ADDX 1 /* ADDX#/SUBX# instructions */
49#define XCHAL_HAVE_WIDE_BRANCHES 0 /* B*.W18 or B*.W15 instr's */
50#define XCHAL_HAVE_PREDICTED_BRANCHES 0 /* B[EQ/EQZ/NE/NEZ]T instr's */
51#define XCHAL_HAVE_CALL4AND12 1 /* (obsolete option) */
52#define XCHAL_HAVE_ABS 1 /* ABS instruction */
53/*#define XCHAL_HAVE_POPC 0*/ /* POPC instruction */
54/*#define XCHAL_HAVE_CRC 0*/ /* CRC instruction */
55#define XCHAL_HAVE_RELEASE_SYNC 1 /* L32AI/S32RI instructions */
56#define XCHAL_HAVE_S32C1I 1 /* S32C1I instruction */
57#define XCHAL_HAVE_SPECULATION 0 /* speculation */
58#define XCHAL_HAVE_FULL_RESET 1 /* all regs/state reset */
59#define XCHAL_NUM_CONTEXTS 1 /* */
60#define XCHAL_NUM_MISC_REGS 2 /* num of scratch regs (0..4) */
61#define XCHAL_HAVE_TAP_MASTER 0 /* JTAG TAP control instr's */
62#define XCHAL_HAVE_PRID 1 /* processor ID register */
63#define XCHAL_HAVE_THREADPTR 1 /* THREADPTR register */
64#define XCHAL_HAVE_BOOLEANS 0 /* boolean registers */
65#define XCHAL_HAVE_CP 1 /* CPENABLE reg (coprocessor) */
66#define XCHAL_CP_MAXCFG 8 /* max allowed cp id plus one */
67#define XCHAL_HAVE_MAC16 1 /* MAC16 package */
68#define XCHAL_HAVE_VECTORFPU2005 0 /* vector floating-point pkg */
69#define XCHAL_HAVE_FP 0 /* floating point pkg */
70#define XCHAL_HAVE_VECTRA1 0 /* Vectra I pkg */
71#define XCHAL_HAVE_VECTRALX 0 /* Vectra LX pkg */
72#define XCHAL_HAVE_HIFI2 0 /* HiFi2 Audio Engine pkg */
73
74
75/*----------------------------------------------------------------------
76 MISC
77 ----------------------------------------------------------------------*/
78
79#define XCHAL_NUM_WRITEBUFFER_ENTRIES 8 /* size of write buffer */
80#define XCHAL_INST_FETCH_WIDTH 4 /* instr-fetch width in bytes */
81#define XCHAL_DATA_WIDTH 4 /* data width in bytes */
82/* In T1050, applies to selected core load and store instructions (see ISA): */
83#define XCHAL_UNALIGNED_LOAD_EXCEPTION 1 /* unaligned loads cause exc. */
84#define XCHAL_UNALIGNED_STORE_EXCEPTION 1 /* unaligned stores cause exc.*/
85
86#define XCHAL_SW_VERSION 701001 /* sw version of this header */
87
88#define XCHAL_CORE_ID "dc232b" /* alphanum core name
89 (CoreID) set in the Xtensa
90 Processor Generator */
91
92#define XCHAL_CORE_DESCRIPTION "Diamond 232L Standard Core Rev.B (LE)"
93#define XCHAL_BUILD_UNIQUE_ID 0x0000BEEF /* 22-bit sw build ID */
94
95/*
96 * These definitions describe the hardware targeted by this software.
97 */
98#define XCHAL_HW_CONFIGID0 0xC56307FE /* ConfigID hi 32 bits*/
99#define XCHAL_HW_CONFIGID1 0x0D40BEEF /* ConfigID lo 32 bits*/
100#define XCHAL_HW_VERSION_NAME "LX2.1.1" /* full version name */
101#define XCHAL_HW_VERSION_MAJOR 2210 /* major ver# of targeted hw */
102#define XCHAL_HW_VERSION_MINOR 1 /* minor ver# of targeted hw */
103#define XCHAL_HW_VERSION 221001 /* major*100+minor */
104#define XCHAL_HW_REL_LX2 1
105#define XCHAL_HW_REL_LX2_1 1
106#define XCHAL_HW_REL_LX2_1_1 1
107#define XCHAL_HW_CONFIGID_RELIABLE 1
108/* If software targets a *range* of hardware versions, these are the bounds: */
109#define XCHAL_HW_MIN_VERSION_MAJOR 2210 /* major v of earliest tgt hw */
110#define XCHAL_HW_MIN_VERSION_MINOR 1 /* minor v of earliest tgt hw */
111#define XCHAL_HW_MIN_VERSION 221001 /* earliest targeted hw */
112#define XCHAL_HW_MAX_VERSION_MAJOR 2210 /* major v of latest tgt hw */
113#define XCHAL_HW_MAX_VERSION_MINOR 1 /* minor v of latest tgt hw */
114#define XCHAL_HW_MAX_VERSION 221001 /* latest targeted hw */
115
116
117/*----------------------------------------------------------------------
118 CACHE
119 ----------------------------------------------------------------------*/
120
121#define XCHAL_ICACHE_LINESIZE 32 /* I-cache line size in bytes */
122#define XCHAL_DCACHE_LINESIZE 32 /* D-cache line size in bytes */
123#define XCHAL_ICACHE_LINEWIDTH 5 /* log2(I line size in bytes) */
124#define XCHAL_DCACHE_LINEWIDTH 5 /* log2(D line size in bytes) */
125
126#define XCHAL_ICACHE_SIZE 16384 /* I-cache size in bytes or 0 */
127#define XCHAL_DCACHE_SIZE 16384 /* D-cache size in bytes or 0 */
128
129#define XCHAL_DCACHE_IS_WRITEBACK 1 /* writeback feature */
130
131
132
133
134/****************************************************************************
135 Parameters Useful for PRIVILEGED (Supervisory or Non-Virtualized) Code
136 ****************************************************************************/
137
138
139#ifndef XTENSA_HAL_NON_PRIVILEGED_ONLY
140
141/*----------------------------------------------------------------------
142 CACHE
143 ----------------------------------------------------------------------*/
144
145#define XCHAL_HAVE_PIF 1 /* any outbound PIF present */
146
147/* If present, cache size in bytes == (ways * 2^(linewidth + setwidth)). */
148
149/* Number of cache sets in log2(lines per way): */
150#define XCHAL_ICACHE_SETWIDTH 7
151#define XCHAL_DCACHE_SETWIDTH 7
152
153/* Cache set associativity (number of ways): */
154#define XCHAL_ICACHE_WAYS 4
155#define XCHAL_DCACHE_WAYS 4
156
157/* Cache features: */
158#define XCHAL_ICACHE_LINE_LOCKABLE 1
159#define XCHAL_DCACHE_LINE_LOCKABLE 1
160#define XCHAL_ICACHE_ECC_PARITY 0
161#define XCHAL_DCACHE_ECC_PARITY 0
162
163/* Number of encoded cache attr bits (see <xtensa/hal.h> for decoded bits): */
164#define XCHAL_CA_BITS 4
165
166
167/*----------------------------------------------------------------------
168 INTERNAL I/D RAM/ROMs and XLMI
169 ----------------------------------------------------------------------*/
170
171#define XCHAL_NUM_INSTROM 0 /* number of core instr. ROMs */
172#define XCHAL_NUM_INSTRAM 0 /* number of core instr. RAMs */
173#define XCHAL_NUM_DATAROM 0 /* number of core data ROMs */
174#define XCHAL_NUM_DATARAM 0 /* number of core data RAMs */
175#define XCHAL_NUM_URAM 0 /* number of core unified RAMs*/
176#define XCHAL_NUM_XLMI 0 /* number of core XLMI ports */
177
178
179/*----------------------------------------------------------------------
180 INTERRUPTS and TIMERS
181 ----------------------------------------------------------------------*/
182
183#define XCHAL_HAVE_INTERRUPTS 1 /* interrupt option */
184#define XCHAL_HAVE_HIGHPRI_INTERRUPTS 1 /* med/high-pri. interrupts */
185#define XCHAL_HAVE_NMI 1 /* non-maskable interrupt */
186#define XCHAL_HAVE_CCOUNT 1 /* CCOUNT reg. (timer option) */
187#define XCHAL_NUM_TIMERS 3 /* number of CCOMPAREn regs */
188#define XCHAL_NUM_INTERRUPTS 22 /* number of interrupts */
189#define XCHAL_NUM_INTERRUPTS_LOG2 5 /* ceil(log2(NUM_INTERRUPTS)) */
190#define XCHAL_NUM_EXTINTERRUPTS 17 /* num of external interrupts */
191#define XCHAL_NUM_INTLEVELS 6 /* number of interrupt levels
192 (not including level zero) */
193#define XCHAL_EXCM_LEVEL 3 /* level masked by PS.EXCM */
194 /* (always 1 in XEA1; levels 2 .. EXCM_LEVEL are "medium priority") */
195
196/* Masks of interrupts at each interrupt level: */
197#define XCHAL_INTLEVEL1_MASK 0x001F80FF
198#define XCHAL_INTLEVEL2_MASK 0x00000100
199#define XCHAL_INTLEVEL3_MASK 0x00200E00
200#define XCHAL_INTLEVEL4_MASK 0x00001000
201#define XCHAL_INTLEVEL5_MASK 0x00002000
202#define XCHAL_INTLEVEL6_MASK 0x00000000
203#define XCHAL_INTLEVEL7_MASK 0x00004000
204
205/* Masks of interrupts at each range 1..n of interrupt levels: */
206#define XCHAL_INTLEVEL1_ANDBELOW_MASK 0x001F80FF
207#define XCHAL_INTLEVEL2_ANDBELOW_MASK 0x001F81FF
208#define XCHAL_INTLEVEL3_ANDBELOW_MASK 0x003F8FFF
209#define XCHAL_INTLEVEL4_ANDBELOW_MASK 0x003F9FFF
210#define XCHAL_INTLEVEL5_ANDBELOW_MASK 0x003FBFFF
211#define XCHAL_INTLEVEL6_ANDBELOW_MASK 0x003FBFFF
212#define XCHAL_INTLEVEL7_ANDBELOW_MASK 0x003FFFFF
213
214/* Level of each interrupt: */
215#define XCHAL_INT0_LEVEL 1
216#define XCHAL_INT1_LEVEL 1
217#define XCHAL_INT2_LEVEL 1
218#define XCHAL_INT3_LEVEL 1
219#define XCHAL_INT4_LEVEL 1
220#define XCHAL_INT5_LEVEL 1
221#define XCHAL_INT6_LEVEL 1
222#define XCHAL_INT7_LEVEL 1
223#define XCHAL_INT8_LEVEL 2
224#define XCHAL_INT9_LEVEL 3
225#define XCHAL_INT10_LEVEL 3
226#define XCHAL_INT11_LEVEL 3
227#define XCHAL_INT12_LEVEL 4
228#define XCHAL_INT13_LEVEL 5
229#define XCHAL_INT14_LEVEL 7
230#define XCHAL_INT15_LEVEL 1
231#define XCHAL_INT16_LEVEL 1
232#define XCHAL_INT17_LEVEL 1
233#define XCHAL_INT18_LEVEL 1
234#define XCHAL_INT19_LEVEL 1
235#define XCHAL_INT20_LEVEL 1
236#define XCHAL_INT21_LEVEL 3
237#define XCHAL_DEBUGLEVEL 6 /* debug interrupt level */
238#define XCHAL_HAVE_DEBUG_EXTERN_INT 1 /* OCD external db interrupt */
239#define XCHAL_NMILEVEL 7 /* NMI "level" (for use with
240 EXCSAVE/EPS/EPC_n, RFI n) */
241
242/* Type of each interrupt: */
243#define XCHAL_INT0_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
244#define XCHAL_INT1_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
245#define XCHAL_INT2_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
246#define XCHAL_INT3_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
247#define XCHAL_INT4_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
248#define XCHAL_INT5_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
249#define XCHAL_INT6_TYPE XTHAL_INTTYPE_TIMER
250#define XCHAL_INT7_TYPE XTHAL_INTTYPE_SOFTWARE
251#define XCHAL_INT8_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
252#define XCHAL_INT9_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
253#define XCHAL_INT10_TYPE XTHAL_INTTYPE_TIMER
254#define XCHAL_INT11_TYPE XTHAL_INTTYPE_SOFTWARE
255#define XCHAL_INT12_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
256#define XCHAL_INT13_TYPE XTHAL_INTTYPE_TIMER
257#define XCHAL_INT14_TYPE XTHAL_INTTYPE_NMI
258#define XCHAL_INT15_TYPE XTHAL_INTTYPE_EXTERN_EDGE
259#define XCHAL_INT16_TYPE XTHAL_INTTYPE_EXTERN_EDGE
260#define XCHAL_INT17_TYPE XTHAL_INTTYPE_EXTERN_EDGE
261#define XCHAL_INT18_TYPE XTHAL_INTTYPE_EXTERN_EDGE
262#define XCHAL_INT19_TYPE XTHAL_INTTYPE_EXTERN_EDGE
263#define XCHAL_INT20_TYPE XTHAL_INTTYPE_EXTERN_EDGE
264#define XCHAL_INT21_TYPE XTHAL_INTTYPE_EXTERN_EDGE
265
266/* Masks of interrupts for each type of interrupt: */
267#define XCHAL_INTTYPE_MASK_UNCONFIGURED 0xFFC00000
268#define XCHAL_INTTYPE_MASK_SOFTWARE 0x00000880
269#define XCHAL_INTTYPE_MASK_EXTERN_EDGE 0x003F8000
270#define XCHAL_INTTYPE_MASK_EXTERN_LEVEL 0x0000133F
271#define XCHAL_INTTYPE_MASK_TIMER 0x00002440
272#define XCHAL_INTTYPE_MASK_NMI 0x00004000
273#define XCHAL_INTTYPE_MASK_WRITE_ERROR 0x00000000
274
275/* Interrupt numbers assigned to specific interrupt sources: */
276#define XCHAL_TIMER0_INTERRUPT 6 /* CCOMPARE0 */
277#define XCHAL_TIMER1_INTERRUPT 10 /* CCOMPARE1 */
278#define XCHAL_TIMER2_INTERRUPT 13 /* CCOMPARE2 */
279#define XCHAL_TIMER3_INTERRUPT XTHAL_TIMER_UNCONFIGURED
280#define XCHAL_NMI_INTERRUPT 14 /* non-maskable interrupt */
281
282/* Interrupt numbers for levels at which only one interrupt is configured: */
283#define XCHAL_INTLEVEL2_NUM 8
284#define XCHAL_INTLEVEL4_NUM 12
285#define XCHAL_INTLEVEL5_NUM 13
286#define XCHAL_INTLEVEL7_NUM 14
287/* (There are many interrupts each at level(s) 1, 3.) */
288
289
290/*
291 * External interrupt vectors/levels.
292 * These macros describe how Xtensa processor interrupt numbers
293 * (as numbered internally, eg. in INTERRUPT and INTENABLE registers)
294 * map to external BInterrupt<n> pins, for those interrupts
295 * configured as external (level-triggered, edge-triggered, or NMI).
296 * See the Xtensa processor databook for more details.
297 */
298
299/* Core interrupt numbers mapped to each EXTERNAL interrupt number: */
300#define XCHAL_EXTINT0_NUM 0 /* (intlevel 1) */
301#define XCHAL_EXTINT1_NUM 1 /* (intlevel 1) */
302#define XCHAL_EXTINT2_NUM 2 /* (intlevel 1) */
303#define XCHAL_EXTINT3_NUM 3 /* (intlevel 1) */
304#define XCHAL_EXTINT4_NUM 4 /* (intlevel 1) */
305#define XCHAL_EXTINT5_NUM 5 /* (intlevel 1) */
306#define XCHAL_EXTINT6_NUM 8 /* (intlevel 2) */
307#define XCHAL_EXTINT7_NUM 9 /* (intlevel 3) */
308#define XCHAL_EXTINT8_NUM 12 /* (intlevel 4) */
309#define XCHAL_EXTINT9_NUM 14 /* (intlevel 7) */
310#define XCHAL_EXTINT10_NUM 15 /* (intlevel 1) */
311#define XCHAL_EXTINT11_NUM 16 /* (intlevel 1) */
312#define XCHAL_EXTINT12_NUM 17 /* (intlevel 1) */
313#define XCHAL_EXTINT13_NUM 18 /* (intlevel 1) */
314#define XCHAL_EXTINT14_NUM 19 /* (intlevel 1) */
315#define XCHAL_EXTINT15_NUM 20 /* (intlevel 1) */
316#define XCHAL_EXTINT16_NUM 21 /* (intlevel 3) */
317
318
319/*----------------------------------------------------------------------
320 EXCEPTIONS and VECTORS
321 ----------------------------------------------------------------------*/
322
323#define XCHAL_XEA_VERSION 2 /* Xtensa Exception Architecture
324 number: 1 == XEA1 (old)
325 2 == XEA2 (new)
326 0 == XEAX (extern) */
327#define XCHAL_HAVE_XEA1 0 /* Exception Architecture 1 */
328#define XCHAL_HAVE_XEA2 1 /* Exception Architecture 2 */
329#define XCHAL_HAVE_XEAX 0 /* External Exception Arch. */
330#define XCHAL_HAVE_EXCEPTIONS 1 /* exception option */
331#define XCHAL_HAVE_MEM_ECC_PARITY 0 /* local memory ECC/parity */
332#define XCHAL_HAVE_VECTOR_SELECT 1 /* relocatable vectors */
333#define XCHAL_HAVE_VECBASE 1 /* relocatable vectors */
334#define XCHAL_VECBASE_RESET_VADDR 0xD0000000 /* VECBASE reset value */
335#define XCHAL_VECBASE_RESET_PADDR 0x00000000
336#define XCHAL_RESET_VECBASE_OVERLAP 0
337
338#define XCHAL_RESET_VECTOR0_VADDR 0xFE000000
339#define XCHAL_RESET_VECTOR0_PADDR 0xFE000000
340#define XCHAL_RESET_VECTOR1_VADDR 0xD8000500
341#define XCHAL_RESET_VECTOR1_PADDR 0x00000500
342#define XCHAL_RESET_VECTOR_VADDR 0xFE000000
343#define XCHAL_RESET_VECTOR_PADDR 0xFE000000
344#define XCHAL_USER_VECOFS 0x00000340
345#define XCHAL_USER_VECTOR_VADDR 0xD0000340
346#define XCHAL_USER_VECTOR_PADDR 0x00000340
347#define XCHAL_KERNEL_VECOFS 0x00000300
348#define XCHAL_KERNEL_VECTOR_VADDR 0xD0000300
349#define XCHAL_KERNEL_VECTOR_PADDR 0x00000300
350#define XCHAL_DOUBLEEXC_VECOFS 0x000003C0
351#define XCHAL_DOUBLEEXC_VECTOR_VADDR 0xD00003C0
352#define XCHAL_DOUBLEEXC_VECTOR_PADDR 0x000003C0
353#define XCHAL_WINDOW_OF4_VECOFS 0x00000000
354#define XCHAL_WINDOW_UF4_VECOFS 0x00000040
355#define XCHAL_WINDOW_OF8_VECOFS 0x00000080
356#define XCHAL_WINDOW_UF8_VECOFS 0x000000C0
357#define XCHAL_WINDOW_OF12_VECOFS 0x00000100
358#define XCHAL_WINDOW_UF12_VECOFS 0x00000140
359#define XCHAL_WINDOW_VECTORS_VADDR 0xD0000000
360#define XCHAL_WINDOW_VECTORS_PADDR 0x00000000
361#define XCHAL_INTLEVEL2_VECOFS 0x00000180
362#define XCHAL_INTLEVEL2_VECTOR_VADDR 0xD0000180
363#define XCHAL_INTLEVEL2_VECTOR_PADDR 0x00000180
364#define XCHAL_INTLEVEL3_VECOFS 0x000001C0
365#define XCHAL_INTLEVEL3_VECTOR_VADDR 0xD00001C0
366#define XCHAL_INTLEVEL3_VECTOR_PADDR 0x000001C0
367#define XCHAL_INTLEVEL4_VECOFS 0x00000200
368#define XCHAL_INTLEVEL4_VECTOR_VADDR 0xD0000200
369#define XCHAL_INTLEVEL4_VECTOR_PADDR 0x00000200
370#define XCHAL_INTLEVEL5_VECOFS 0x00000240
371#define XCHAL_INTLEVEL5_VECTOR_VADDR 0xD0000240
372#define XCHAL_INTLEVEL5_VECTOR_PADDR 0x00000240
373#define XCHAL_INTLEVEL6_VECOFS 0x00000280
374#define XCHAL_INTLEVEL6_VECTOR_VADDR 0xD0000280
375#define XCHAL_INTLEVEL6_VECTOR_PADDR 0x00000280
376#define XCHAL_DEBUG_VECOFS XCHAL_INTLEVEL6_VECOFS
377#define XCHAL_DEBUG_VECTOR_VADDR XCHAL_INTLEVEL6_VECTOR_VADDR
378#define XCHAL_DEBUG_VECTOR_PADDR XCHAL_INTLEVEL6_VECTOR_PADDR
379#define XCHAL_NMI_VECOFS 0x000002C0
380#define XCHAL_NMI_VECTOR_VADDR 0xD00002C0
381#define XCHAL_NMI_VECTOR_PADDR 0x000002C0
382#define XCHAL_INTLEVEL7_VECOFS XCHAL_NMI_VECOFS
383#define XCHAL_INTLEVEL7_VECTOR_VADDR XCHAL_NMI_VECTOR_VADDR
384#define XCHAL_INTLEVEL7_VECTOR_PADDR XCHAL_NMI_VECTOR_PADDR
385
386
387/*----------------------------------------------------------------------
388 DEBUG
389 ----------------------------------------------------------------------*/
390
391#define XCHAL_HAVE_OCD 1 /* OnChipDebug option */
392#define XCHAL_NUM_IBREAK 2 /* number of IBREAKn regs */
393#define XCHAL_NUM_DBREAK 2 /* number of DBREAKn regs */
394#define XCHAL_HAVE_OCD_DIR_ARRAY 1 /* faster OCD option */
395
396
397/*----------------------------------------------------------------------
398 MMU
399 ----------------------------------------------------------------------*/
400
401/* See core-matmap.h header file for more details. */
402
403#define XCHAL_HAVE_TLBS 1 /* inverse of HAVE_CACHEATTR */
404#define XCHAL_HAVE_SPANNING_WAY 0 /* one way maps I+D 4GB vaddr */
405#define XCHAL_HAVE_IDENTITY_MAP 0 /* vaddr == paddr always */
406#define XCHAL_HAVE_CACHEATTR 0 /* CACHEATTR register present */
407#define XCHAL_HAVE_MIMIC_CACHEATTR 0 /* region protection */
408#define XCHAL_HAVE_XLT_CACHEATTR 0 /* region prot. w/translation */
409#define XCHAL_HAVE_PTP_MMU 1 /* full MMU (with page table
410 [autorefill] and protection)
411 usable for an MMU-based OS */
412/* If none of the above last 4 are set, it's a custom TLB configuration. */
413#define XCHAL_ITLB_ARF_ENTRIES_LOG2 2 /* log2(autorefill way size) */
414#define XCHAL_DTLB_ARF_ENTRIES_LOG2 2 /* log2(autorefill way size) */
415
416#define XCHAL_MMU_ASID_BITS 8 /* number of bits in ASIDs */
417#define XCHAL_MMU_RINGS 4 /* number of rings (1..4) */
418#define XCHAL_MMU_RING_BITS 2 /* num of bits in RING field */
419
420#endif /* !XTENSA_HAL_NON_PRIVILEGED_ONLY */
421
422
423#endif /* _XTENSA_CORE_CONFIGURATION_H */
424
diff --git a/include/asm-xtensa/variant-dc232b/tie-asm.h b/include/asm-xtensa/variant-dc232b/tie-asm.h
deleted file mode 100644
index ed4f53f529db..000000000000
--- a/include/asm-xtensa/variant-dc232b/tie-asm.h
+++ /dev/null
@@ -1,122 +0,0 @@
1/*
2 * This header file contains assembly-language definitions (assembly
3 * macros, etc.) for this specific Xtensa processor's TIE extensions
4 * and options. It is customized to this Xtensa processor configuration.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 *
10 * Copyright (C) 1999-2007 Tensilica Inc.
11 */
12
13#ifndef _XTENSA_CORE_TIE_ASM_H
14#define _XTENSA_CORE_TIE_ASM_H
15
16/* Selection parameter values for save-area save/restore macros: */
17/* Option vs. TIE: */
18#define XTHAL_SAS_TIE 0x0001 /* custom extension or coprocessor */
19#define XTHAL_SAS_OPT 0x0002 /* optional (and not a coprocessor) */
20/* Whether used automatically by compiler: */
21#define XTHAL_SAS_NOCC 0x0004 /* not used by compiler w/o special opts/code */
22#define XTHAL_SAS_CC 0x0008 /* used by compiler without special opts/code */
23/* ABI handling across function calls: */
24#define XTHAL_SAS_CALR 0x0010 /* caller-saved */
25#define XTHAL_SAS_CALE 0x0020 /* callee-saved */
26#define XTHAL_SAS_GLOB 0x0040 /* global across function calls (in thread) */
27/* Misc */
28#define XTHAL_SAS_ALL 0xFFFF /* include all default NCP contents */
29
30
31
32/* Macro to save all non-coprocessor (extra) custom TIE and optional state
33 * (not including zero-overhead loop registers).
34 * Save area ptr (clobbered): ptr (1 byte aligned)
35 * Scratch regs (clobbered): at1..at4 (only first XCHAL_NCP_NUM_ATMPS needed)
36 */
37 .macro xchal_ncp_store ptr at1 at2 at3 at4 continue=0 ofs=-1 select=XTHAL_SAS_ALL
38 xchal_sa_start \continue, \ofs
39 .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_CC | XTHAL_SAS_CALR) & ~\select
40 xchal_sa_align \ptr, 0, 1024-8, 4, 4
41 rsr \at1, ACCLO // MAC16 accumulator
42 rsr \at2, ACCHI
43 s32i \at1, \ptr, .Lxchal_ofs_ + 0
44 s32i \at2, \ptr, .Lxchal_ofs_ + 4
45 .set .Lxchal_ofs_, .Lxchal_ofs_ + 8
46 .endif
47 .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~\select
48 xchal_sa_align \ptr, 0, 1024-16, 4, 4
49 rsr \at1, M0 // MAC16 registers
50 rsr \at2, M1
51 s32i \at1, \ptr, .Lxchal_ofs_ + 0
52 s32i \at2, \ptr, .Lxchal_ofs_ + 4
53 rsr \at1, M2
54 rsr \at2, M3
55 s32i \at1, \ptr, .Lxchal_ofs_ + 8
56 s32i \at2, \ptr, .Lxchal_ofs_ + 12
57 .set .Lxchal_ofs_, .Lxchal_ofs_ + 16
58 .endif
59 .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~\select
60 xchal_sa_align \ptr, 0, 1024-4, 4, 4
61 rsr \at1, SCOMPARE1 // conditional store option
62 s32i \at1, \ptr, .Lxchal_ofs_ + 0
63 .set .Lxchal_ofs_, .Lxchal_ofs_ + 4
64 .endif
65 .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_CC | XTHAL_SAS_GLOB) & ~\select
66 xchal_sa_align \ptr, 0, 1024-4, 4, 4
67 rur \at1, THREADPTR // threadptr option
68 s32i \at1, \ptr, .Lxchal_ofs_ + 0
69 .set .Lxchal_ofs_, .Lxchal_ofs_ + 4
70 .endif
71 .endm // xchal_ncp_store
72
73/* Macro to save all non-coprocessor (extra) custom TIE and optional state
74 * (not including zero-overhead loop registers).
75 * Save area ptr (clobbered): ptr (1 byte aligned)
76 * Scratch regs (clobbered): at1..at4 (only first XCHAL_NCP_NUM_ATMPS needed)
77 */
78 .macro xchal_ncp_load ptr at1 at2 at3 at4 continue=0 ofs=-1 select=XTHAL_SAS_ALL
79 xchal_sa_start \continue, \ofs
80 .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_CC | XTHAL_SAS_CALR) & ~\select
81 xchal_sa_align \ptr, 0, 1024-8, 4, 4
82 l32i \at1, \ptr, .Lxchal_ofs_ + 0
83 l32i \at2, \ptr, .Lxchal_ofs_ + 4
84 wsr \at1, ACCLO // MAC16 accumulator
85 wsr \at2, ACCHI
86 .set .Lxchal_ofs_, .Lxchal_ofs_ + 8
87 .endif
88 .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~\select
89 xchal_sa_align \ptr, 0, 1024-16, 4, 4
90 l32i \at1, \ptr, .Lxchal_ofs_ + 0
91 l32i \at2, \ptr, .Lxchal_ofs_ + 4
92 wsr \at1, M0 // MAC16 registers
93 wsr \at2, M1
94 l32i \at1, \ptr, .Lxchal_ofs_ + 8
95 l32i \at2, \ptr, .Lxchal_ofs_ + 12
96 wsr \at1, M2
97 wsr \at2, M3
98 .set .Lxchal_ofs_, .Lxchal_ofs_ + 16
99 .endif
100 .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~\select
101 xchal_sa_align \ptr, 0, 1024-4, 4, 4
102 l32i \at1, \ptr, .Lxchal_ofs_ + 0
103 wsr \at1, SCOMPARE1 // conditional store option
104 .set .Lxchal_ofs_, .Lxchal_ofs_ + 4
105 .endif
106 .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_CC | XTHAL_SAS_GLOB) & ~\select
107 xchal_sa_align \ptr, 0, 1024-4, 4, 4
108 l32i \at1, \ptr, .Lxchal_ofs_ + 0
109 wur \at1, THREADPTR // threadptr option
110 .set .Lxchal_ofs_, .Lxchal_ofs_ + 4
111 .endif
112 .endm // xchal_ncp_load
113
114
115
116#define XCHAL_NCP_NUM_ATMPS 2
117
118
119#define XCHAL_SA_NUM_ATMPS 2
120
121#endif /*_XTENSA_CORE_TIE_ASM_H*/
122
diff --git a/include/asm-xtensa/variant-dc232b/tie.h b/include/asm-xtensa/variant-dc232b/tie.h
deleted file mode 100644
index 018e81af4393..000000000000
--- a/include/asm-xtensa/variant-dc232b/tie.h
+++ /dev/null
@@ -1,131 +0,0 @@
1/*
2 * This header file describes this specific Xtensa processor's TIE extensions
3 * that extend basic Xtensa core functionality. It is customized to this
4 * Xtensa processor configuration.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 *
10 * Copyright (C) 1999-2007 Tensilica Inc.
11 */
12
13#ifndef _XTENSA_CORE_TIE_H
14#define _XTENSA_CORE_TIE_H
15
16#define XCHAL_CP_NUM 1 /* number of coprocessors */
17#define XCHAL_CP_MAX 8 /* max CP ID + 1 (0 if none) */
18#define XCHAL_CP_MASK 0x80 /* bitmask of all CPs by ID */
19#define XCHAL_CP_PORT_MASK 0x80 /* bitmask of only port CPs */
20
21/* Basic parameters of each coprocessor: */
22#define XCHAL_CP7_NAME "XTIOP"
23#define XCHAL_CP7_IDENT XTIOP
24#define XCHAL_CP7_SA_SIZE 0 /* size of state save area */
25#define XCHAL_CP7_SA_ALIGN 1 /* min alignment of save area */
26#define XCHAL_CP_ID_XTIOP 7 /* coprocessor ID (0..7) */
27
28/* Filler info for unassigned coprocessors, to simplify arrays etc: */
29#define XCHAL_CP0_SA_SIZE 0
30#define XCHAL_CP0_SA_ALIGN 1
31#define XCHAL_CP1_SA_SIZE 0
32#define XCHAL_CP1_SA_ALIGN 1
33#define XCHAL_CP2_SA_SIZE 0
34#define XCHAL_CP2_SA_ALIGN 1
35#define XCHAL_CP3_SA_SIZE 0
36#define XCHAL_CP3_SA_ALIGN 1
37#define XCHAL_CP4_SA_SIZE 0
38#define XCHAL_CP4_SA_ALIGN 1
39#define XCHAL_CP5_SA_SIZE 0
40#define XCHAL_CP5_SA_ALIGN 1
41#define XCHAL_CP6_SA_SIZE 0
42#define XCHAL_CP6_SA_ALIGN 1
43
44/* Save area for non-coprocessor optional and custom (TIE) state: */
45#define XCHAL_NCP_SA_SIZE 32
46#define XCHAL_NCP_SA_ALIGN 4
47
48/* Total save area for optional and custom state (NCP + CPn): */
49#define XCHAL_TOTAL_SA_SIZE 32 /* with 16-byte align padding */
50#define XCHAL_TOTAL_SA_ALIGN 4 /* actual minimum alignment */
51
52/*
53 * Detailed contents of save areas.
54 * NOTE: caller must define the XCHAL_SA_REG macro (not defined here)
55 * before expanding the XCHAL_xxx_SA_LIST() macros.
56 *
57 * XCHAL_SA_REG(s,ccused,abikind,kind,opt,name,galign,align,asize,
58 * dbnum,base,regnum,bitsz,gapsz,reset,x...)
59 *
60 * s = passed from XCHAL_*_LIST(s), eg. to select how to expand
61 * ccused = set if used by compiler without special options or code
62 * abikind = 0 (caller-saved), 1 (callee-saved), or 2 (thread-global)
63 * kind = 0 (special reg), 1 (TIE user reg), or 2 (TIE regfile reg)
64 * opt = 0 (custom TIE extension or coprocessor), or 1 (optional reg)
65 * name = lowercase reg name (no quotes)
66 * galign = group byte alignment (power of 2) (galign >= align)
67 * align = register byte alignment (power of 2)
68 * asize = allocated size in bytes (asize*8 == bitsz + gapsz + padsz)
69 * (not including any pad bytes required to galign this or next reg)
70 * dbnum = unique target number f/debug (see <xtensa-libdb-macros.h>)
71 * base = reg shortname w/o index (or sr=special, ur=TIE user reg)
72 * regnum = reg index in regfile, or special/TIE-user reg number
73 * bitsz = number of significant bits (regfile width, or ur/sr mask bits)
74 * gapsz = intervening bits, if bitsz bits not stored contiguously
75 * (padsz = pad bits at end [TIE regfile] or at msbits [ur,sr] of asize)
76 * reset = register reset value (or 0 if undefined at reset)
77 * x = reserved for future use (0 until then)
78 *
79 * To filter out certain registers, e.g. to expand only the non-global
80 * registers used by the compiler, you can do something like this:
81 *
82 * #define XCHAL_SA_REG(s,ccused,p...) SELCC##ccused(p)
83 * #define SELCC0(p...)
84 * #define SELCC1(abikind,p...) SELAK##abikind(p)
85 * #define SELAK0(p...) REG(p)
86 * #define SELAK1(p...) REG(p)
87 * #define SELAK2(p...)
88 * #define REG(kind,tie,name,galn,aln,asz,csz,dbnum,base,rnum,bsz,rst,x...) \
89 * ...what you want to expand...
90 */
91
92#define XCHAL_NCP_SA_NUM 8
93#define XCHAL_NCP_SA_LIST(s) \
94 XCHAL_SA_REG(s,1,0,0,1, acclo, 4, 4, 4,0x0210, sr,16 , 32,0,0,0) \
95 XCHAL_SA_REG(s,1,0,0,1, acchi, 4, 4, 4,0x0211, sr,17 , 8,0,0,0) \
96 XCHAL_SA_REG(s,0,0,0,1, m0, 4, 4, 4,0x0220, sr,32 , 32,0,0,0) \
97 XCHAL_SA_REG(s,0,0,0,1, m1, 4, 4, 4,0x0221, sr,33 , 32,0,0,0) \
98 XCHAL_SA_REG(s,0,0,0,1, m2, 4, 4, 4,0x0222, sr,34 , 32,0,0,0) \
99 XCHAL_SA_REG(s,0,0,0,1, m3, 4, 4, 4,0x0223, sr,35 , 32,0,0,0) \
100 XCHAL_SA_REG(s,0,0,0,1, scompare1, 4, 4, 4,0x020C, sr,12 , 32,0,0,0) \
101 XCHAL_SA_REG(s,1,2,1,1, threadptr, 4, 4, 4,0x03E7, ur,231, 32,0,0,0)
102
103#define XCHAL_CP0_SA_NUM 0
104#define XCHAL_CP0_SA_LIST(s) /* empty */
105
106#define XCHAL_CP1_SA_NUM 0
107#define XCHAL_CP1_SA_LIST(s) /* empty */
108
109#define XCHAL_CP2_SA_NUM 0
110#define XCHAL_CP2_SA_LIST(s) /* empty */
111
112#define XCHAL_CP3_SA_NUM 0
113#define XCHAL_CP3_SA_LIST(s) /* empty */
114
115#define XCHAL_CP4_SA_NUM 0
116#define XCHAL_CP4_SA_LIST(s) /* empty */
117
118#define XCHAL_CP5_SA_NUM 0
119#define XCHAL_CP5_SA_LIST(s) /* empty */
120
121#define XCHAL_CP6_SA_NUM 0
122#define XCHAL_CP6_SA_LIST(s) /* empty */
123
124#define XCHAL_CP7_SA_NUM 0
125#define XCHAL_CP7_SA_LIST(s) /* empty */
126
127/* Byte length of instruction from its first nibble (op0 field), per FLIX. */
128#define XCHAL_OP0_FORMAT_LENGTHS 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3
129
130#endif /*_XTENSA_CORE_TIE_H*/
131
diff --git a/include/asm-xtensa/variant-fsf/core.h b/include/asm-xtensa/variant-fsf/core.h
deleted file mode 100644
index 2f337605c744..000000000000
--- a/include/asm-xtensa/variant-fsf/core.h
+++ /dev/null
@@ -1,359 +0,0 @@
1/*
2 * Xtensa processor core configuration information.
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 1999-2006 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_CORE_H
12#define _XTENSA_CORE_H
13
14
15/****************************************************************************
16 Parameters Useful for Any Code, USER or PRIVILEGED
17 ****************************************************************************/
18
19/*
20 * Note: Macros of the form XCHAL_HAVE_*** have a value of 1 if the option is
21 * configured, and a value of 0 otherwise. These macros are always defined.
22 */
23
24
25/*----------------------------------------------------------------------
26 ISA
27 ----------------------------------------------------------------------*/
28
29#define XCHAL_HAVE_BE 1 /* big-endian byte ordering */
30#define XCHAL_HAVE_WINDOWED 1 /* windowed registers option */
31#define XCHAL_NUM_AREGS 64 /* num of physical addr regs */
32#define XCHAL_NUM_AREGS_LOG2 6 /* log2(XCHAL_NUM_AREGS) */
33#define XCHAL_MAX_INSTRUCTION_SIZE 3 /* max instr bytes (3..8) */
34#define XCHAL_HAVE_DEBUG 1 /* debug option */
35#define XCHAL_HAVE_DENSITY 1 /* 16-bit instructions */
36#define XCHAL_HAVE_LOOPS 1 /* zero-overhead loops */
37#define XCHAL_HAVE_NSA 1 /* NSA/NSAU instructions */
38#define XCHAL_HAVE_MINMAX 0 /* MIN/MAX instructions */
39#define XCHAL_HAVE_SEXT 0 /* SEXT instruction */
40#define XCHAL_HAVE_CLAMPS 0 /* CLAMPS instruction */
41#define XCHAL_HAVE_MUL16 0 /* MUL16S/MUL16U instructions */
42#define XCHAL_HAVE_MUL32 0 /* MULL instruction */
43#define XCHAL_HAVE_MUL32_HIGH 0 /* MULUH/MULSH instructions */
44#define XCHAL_HAVE_L32R 1 /* L32R instruction */
45#define XCHAL_HAVE_ABSOLUTE_LITERALS 1 /* non-PC-rel (extended) L32R */
46#define XCHAL_HAVE_CONST16 0 /* CONST16 instruction */
47#define XCHAL_HAVE_ADDX 1 /* ADDX#/SUBX# instructions */
48#define XCHAL_HAVE_WIDE_BRANCHES 0 /* B*.W18 or B*.W15 instr's */
49#define XCHAL_HAVE_PREDICTED_BRANCHES 0 /* B[EQ/EQZ/NE/NEZ]T instr's */
50#define XCHAL_HAVE_CALL4AND12 1 /* (obsolete option) */
51#define XCHAL_HAVE_ABS 1 /* ABS instruction */
52/*#define XCHAL_HAVE_POPC 0*/ /* POPC instruction */
53/*#define XCHAL_HAVE_CRC 0*/ /* CRC instruction */
54#define XCHAL_HAVE_RELEASE_SYNC 0 /* L32AI/S32RI instructions */
55#define XCHAL_HAVE_S32C1I 0 /* S32C1I instruction */
56#define XCHAL_HAVE_SPECULATION 0 /* speculation */
57#define XCHAL_HAVE_FULL_RESET 1 /* all regs/state reset */
58#define XCHAL_NUM_CONTEXTS 1 /* */
59#define XCHAL_NUM_MISC_REGS 2 /* num of scratch regs (0..4) */
60#define XCHAL_HAVE_TAP_MASTER 0 /* JTAG TAP control instr's */
61#define XCHAL_HAVE_PRID 1 /* processor ID register */
62#define XCHAL_HAVE_THREADPTR 1 /* THREADPTR register */
63#define XCHAL_HAVE_BOOLEANS 0 /* boolean registers */
64#define XCHAL_HAVE_CP 0 /* CPENABLE reg (coprocessor) */
65#define XCHAL_CP_MAXCFG 0 /* max allowed cp id plus one */
66#define XCHAL_HAVE_MAC16 0 /* MAC16 package */
67#define XCHAL_HAVE_VECTORFPU2005 0 /* vector floating-point pkg */
68#define XCHAL_HAVE_FP 0 /* floating point pkg */
69#define XCHAL_HAVE_VECTRA1 0 /* Vectra I pkg */
70#define XCHAL_HAVE_VECTRALX 0 /* Vectra LX pkg */
71#define XCHAL_HAVE_HIFI2 0 /* HiFi2 Audio Engine pkg */
72
73
74/*----------------------------------------------------------------------
75 MISC
76 ----------------------------------------------------------------------*/
77
78#define XCHAL_NUM_WRITEBUFFER_ENTRIES 4 /* size of write buffer */
79#define XCHAL_INST_FETCH_WIDTH 4 /* instr-fetch width in bytes */
80#define XCHAL_DATA_WIDTH 4 /* data width in bytes */
81/* In T1050, applies to selected core load and store instructions (see ISA): */
82#define XCHAL_UNALIGNED_LOAD_EXCEPTION 1 /* unaligned loads cause exc. */
83#define XCHAL_UNALIGNED_STORE_EXCEPTION 1 /* unaligned stores cause exc.*/
84
85#define XCHAL_CORE_ID "fsf" /* alphanum core name
86 (CoreID) set in the Xtensa
87 Processor Generator */
88
89#define XCHAL_BUILD_UNIQUE_ID 0x00006700 /* 22-bit sw build ID */
90
91/*
92 * These definitions describe the hardware targeted by this software.
93 */
94#define XCHAL_HW_CONFIGID0 0xC103C3FF /* ConfigID hi 32 bits*/
95#define XCHAL_HW_CONFIGID1 0x0C006700 /* ConfigID lo 32 bits*/
96#define XCHAL_HW_VERSION_NAME "LX2.0.0" /* full version name */
97#define XCHAL_HW_VERSION_MAJOR 2200 /* major ver# of targeted hw */
98#define XCHAL_HW_VERSION_MINOR 0 /* minor ver# of targeted hw */
99#define XTHAL_HW_REL_LX2 1
100#define XTHAL_HW_REL_LX2_0 1
101#define XTHAL_HW_REL_LX2_0_0 1
102#define XCHAL_HW_CONFIGID_RELIABLE 1
103/* If software targets a *range* of hardware versions, these are the bounds: */
104#define XCHAL_HW_MIN_VERSION_MAJOR 2200 /* major v of earliest tgt hw */
105#define XCHAL_HW_MIN_VERSION_MINOR 0 /* minor v of earliest tgt hw */
106#define XCHAL_HW_MAX_VERSION_MAJOR 2200 /* major v of latest tgt hw */
107#define XCHAL_HW_MAX_VERSION_MINOR 0 /* minor v of latest tgt hw */
108
109
110/*----------------------------------------------------------------------
111 CACHE
112 ----------------------------------------------------------------------*/
113
114#define XCHAL_ICACHE_LINESIZE 16 /* I-cache line size in bytes */
115#define XCHAL_DCACHE_LINESIZE 16 /* D-cache line size in bytes */
116#define XCHAL_ICACHE_LINEWIDTH 4 /* log2(I line size in bytes) */
117#define XCHAL_DCACHE_LINEWIDTH 4 /* log2(D line size in bytes) */
118
119#define XCHAL_ICACHE_SIZE 8192 /* I-cache size in bytes or 0 */
120#define XCHAL_DCACHE_SIZE 8192 /* D-cache size in bytes or 0 */
121
122#define XCHAL_DCACHE_IS_WRITEBACK 0 /* writeback feature */
123
124
125
126
127/****************************************************************************
128 Parameters Useful for PRIVILEGED (Supervisory or Non-Virtualized) Code
129 ****************************************************************************/
130
131
132#ifndef XTENSA_HAL_NON_PRIVILEGED_ONLY
133
134/*----------------------------------------------------------------------
135 CACHE
136 ----------------------------------------------------------------------*/
137
138#define XCHAL_HAVE_PIF 1 /* any outbound PIF present */
139
140/* If present, cache size in bytes == (ways * 2^(linewidth + setwidth)). */
141
142/* Number of cache sets in log2(lines per way): */
143#define XCHAL_ICACHE_SETWIDTH 8
144#define XCHAL_DCACHE_SETWIDTH 8
145
146/* Cache set associativity (number of ways): */
147#define XCHAL_ICACHE_WAYS 2
148#define XCHAL_DCACHE_WAYS 2
149
150/* Cache features: */
151#define XCHAL_ICACHE_LINE_LOCKABLE 0
152#define XCHAL_DCACHE_LINE_LOCKABLE 0
153#define XCHAL_ICACHE_ECC_PARITY 0
154#define XCHAL_DCACHE_ECC_PARITY 0
155
156/* Number of encoded cache attr bits (see <xtensa/hal.h> for decoded bits): */
157#define XCHAL_CA_BITS 4
158
159
160/*----------------------------------------------------------------------
161 INTERNAL I/D RAM/ROMs and XLMI
162 ----------------------------------------------------------------------*/
163
164#define XCHAL_NUM_INSTROM 0 /* number of core instr. ROMs */
165#define XCHAL_NUM_INSTRAM 0 /* number of core instr. RAMs */
166#define XCHAL_NUM_DATAROM 0 /* number of core data ROMs */
167#define XCHAL_NUM_DATARAM 0 /* number of core data RAMs */
168#define XCHAL_NUM_URAM 0 /* number of core unified RAMs*/
169#define XCHAL_NUM_XLMI 0 /* number of core XLMI ports */
170
171
172/*----------------------------------------------------------------------
173 INTERRUPTS and TIMERS
174 ----------------------------------------------------------------------*/
175
176#define XCHAL_HAVE_INTERRUPTS 1 /* interrupt option */
177#define XCHAL_HAVE_HIGHPRI_INTERRUPTS 1 /* med/high-pri. interrupts */
178#define XCHAL_HAVE_NMI 0 /* non-maskable interrupt */
179#define XCHAL_HAVE_CCOUNT 1 /* CCOUNT reg. (timer option) */
180#define XCHAL_NUM_TIMERS 3 /* number of CCOMPAREn regs */
181#define XCHAL_NUM_INTERRUPTS 17 /* number of interrupts */
182#define XCHAL_NUM_INTERRUPTS_LOG2 5 /* ceil(log2(NUM_INTERRUPTS)) */
183#define XCHAL_NUM_EXTINTERRUPTS 10 /* num of external interrupts */
184#define XCHAL_NUM_INTLEVELS 4 /* number of interrupt levels
185 (not including level zero) */
186#define XCHAL_EXCM_LEVEL 1 /* level masked by PS.EXCM */
187 /* (always 1 in XEA1; levels 2 .. EXCM_LEVEL are "medium priority") */
188
189/* Masks of interrupts at each interrupt level: */
190#define XCHAL_INTLEVEL1_MASK 0x000064F9
191#define XCHAL_INTLEVEL2_MASK 0x00008902
192#define XCHAL_INTLEVEL3_MASK 0x00011204
193#define XCHAL_INTLEVEL4_MASK 0x00000000
194#define XCHAL_INTLEVEL5_MASK 0x00000000
195#define XCHAL_INTLEVEL6_MASK 0x00000000
196#define XCHAL_INTLEVEL7_MASK 0x00000000
197
198/* Masks of interrupts at each range 1..n of interrupt levels: */
199#define XCHAL_INTLEVEL1_ANDBELOW_MASK 0x000064F9
200#define XCHAL_INTLEVEL2_ANDBELOW_MASK 0x0000EDFB
201#define XCHAL_INTLEVEL3_ANDBELOW_MASK 0x0001FFFF
202#define XCHAL_INTLEVEL4_ANDBELOW_MASK 0x0001FFFF
203#define XCHAL_INTLEVEL5_ANDBELOW_MASK 0x0001FFFF
204#define XCHAL_INTLEVEL6_ANDBELOW_MASK 0x0001FFFF
205#define XCHAL_INTLEVEL7_ANDBELOW_MASK 0x0001FFFF
206
207/* Level of each interrupt: */
208#define XCHAL_INT0_LEVEL 1
209#define XCHAL_INT1_LEVEL 2
210#define XCHAL_INT2_LEVEL 3
211#define XCHAL_INT3_LEVEL 1
212#define XCHAL_INT4_LEVEL 1
213#define XCHAL_INT5_LEVEL 1
214#define XCHAL_INT6_LEVEL 1
215#define XCHAL_INT7_LEVEL 1
216#define XCHAL_INT8_LEVEL 2
217#define XCHAL_INT9_LEVEL 3
218#define XCHAL_INT10_LEVEL 1
219#define XCHAL_INT11_LEVEL 2
220#define XCHAL_INT12_LEVEL 3
221#define XCHAL_INT13_LEVEL 1
222#define XCHAL_INT14_LEVEL 1
223#define XCHAL_INT15_LEVEL 2
224#define XCHAL_INT16_LEVEL 3
225#define XCHAL_DEBUGLEVEL 4 /* debug interrupt level */
226#define XCHAL_HAVE_DEBUG_EXTERN_INT 0 /* OCD external db interrupt */
227
228/* Type of each interrupt: */
229#define XCHAL_INT0_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
230#define XCHAL_INT1_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
231#define XCHAL_INT2_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
232#define XCHAL_INT3_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
233#define XCHAL_INT4_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
234#define XCHAL_INT5_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
235#define XCHAL_INT6_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
236#define XCHAL_INT7_TYPE XTHAL_INTTYPE_EXTERN_EDGE
237#define XCHAL_INT8_TYPE XTHAL_INTTYPE_EXTERN_EDGE
238#define XCHAL_INT9_TYPE XTHAL_INTTYPE_EXTERN_EDGE
239#define XCHAL_INT10_TYPE XTHAL_INTTYPE_TIMER
240#define XCHAL_INT11_TYPE XTHAL_INTTYPE_TIMER
241#define XCHAL_INT12_TYPE XTHAL_INTTYPE_TIMER
242#define XCHAL_INT13_TYPE XTHAL_INTTYPE_SOFTWARE
243#define XCHAL_INT14_TYPE XTHAL_INTTYPE_SOFTWARE
244#define XCHAL_INT15_TYPE XTHAL_INTTYPE_SOFTWARE
245#define XCHAL_INT16_TYPE XTHAL_INTTYPE_SOFTWARE
246
247/* Masks of interrupts for each type of interrupt: */
248#define XCHAL_INTTYPE_MASK_UNCONFIGURED 0xFFFE0000
249#define XCHAL_INTTYPE_MASK_SOFTWARE 0x0001E000
250#define XCHAL_INTTYPE_MASK_EXTERN_EDGE 0x00000380
251#define XCHAL_INTTYPE_MASK_EXTERN_LEVEL 0x0000007F
252#define XCHAL_INTTYPE_MASK_TIMER 0x00001C00
253#define XCHAL_INTTYPE_MASK_NMI 0x00000000
254#define XCHAL_INTTYPE_MASK_WRITE_ERROR 0x00000000
255
256/* Interrupt numbers assigned to specific interrupt sources: */
257#define XCHAL_TIMER0_INTERRUPT 10 /* CCOMPARE0 */
258#define XCHAL_TIMER1_INTERRUPT 11 /* CCOMPARE1 */
259#define XCHAL_TIMER2_INTERRUPT 12 /* CCOMPARE2 */
260#define XCHAL_TIMER3_INTERRUPT XTHAL_TIMER_UNCONFIGURED
261
262/* Interrupt numbers for levels at which only one interrupt is configured: */
263/* (There are many interrupts each at level(s) 1, 2, 3.) */
264
265
266/*
267 * External interrupt vectors/levels.
268 * These macros describe how Xtensa processor interrupt numbers
269 * (as numbered internally, eg. in INTERRUPT and INTENABLE registers)
270 * map to external BInterrupt<n> pins, for those interrupts
271 * configured as external (level-triggered, edge-triggered, or NMI).
272 * See the Xtensa processor databook for more details.
273 */
274
275/* Core interrupt numbers mapped to each EXTERNAL interrupt number: */
276#define XCHAL_EXTINT0_NUM 0 /* (intlevel 1) */
277#define XCHAL_EXTINT1_NUM 1 /* (intlevel 2) */
278#define XCHAL_EXTINT2_NUM 2 /* (intlevel 3) */
279#define XCHAL_EXTINT3_NUM 3 /* (intlevel 1) */
280#define XCHAL_EXTINT4_NUM 4 /* (intlevel 1) */
281#define XCHAL_EXTINT5_NUM 5 /* (intlevel 1) */
282#define XCHAL_EXTINT6_NUM 6 /* (intlevel 1) */
283#define XCHAL_EXTINT7_NUM 7 /* (intlevel 1) */
284#define XCHAL_EXTINT8_NUM 8 /* (intlevel 2) */
285#define XCHAL_EXTINT9_NUM 9 /* (intlevel 3) */
286
287
288/*----------------------------------------------------------------------
289 EXCEPTIONS and VECTORS
290 ----------------------------------------------------------------------*/
291
292#define XCHAL_XEA_VERSION 2 /* Xtensa Exception Architecture
293 number: 1 == XEA1 (old)
294 2 == XEA2 (new)
295 0 == XEAX (extern) */
296#define XCHAL_HAVE_XEA1 0 /* Exception Architecture 1 */
297#define XCHAL_HAVE_XEA2 1 /* Exception Architecture 2 */
298#define XCHAL_HAVE_XEAX 0 /* External Exception Arch. */
299#define XCHAL_HAVE_EXCEPTIONS 1 /* exception option */
300#define XCHAL_HAVE_MEM_ECC_PARITY 0 /* local memory ECC/parity */
301
302#define XCHAL_RESET_VECTOR_VADDR 0xFE000020
303#define XCHAL_RESET_VECTOR_PADDR 0xFE000020
304#define XCHAL_USER_VECTOR_VADDR 0xD0000220
305#define XCHAL_USER_VECTOR_PADDR 0x00000220
306#define XCHAL_KERNEL_VECTOR_VADDR 0xD0000200
307#define XCHAL_KERNEL_VECTOR_PADDR 0x00000200
308#define XCHAL_DOUBLEEXC_VECTOR_VADDR 0xD0000290
309#define XCHAL_DOUBLEEXC_VECTOR_PADDR 0x00000290
310#define XCHAL_WINDOW_VECTORS_VADDR 0xD0000000
311#define XCHAL_WINDOW_VECTORS_PADDR 0x00000000
312#define XCHAL_INTLEVEL2_VECTOR_VADDR 0xD0000240
313#define XCHAL_INTLEVEL2_VECTOR_PADDR 0x00000240
314#define XCHAL_INTLEVEL3_VECTOR_VADDR 0xD0000250
315#define XCHAL_INTLEVEL3_VECTOR_PADDR 0x00000250
316#define XCHAL_INTLEVEL4_VECTOR_VADDR 0xFE000520
317#define XCHAL_INTLEVEL4_VECTOR_PADDR 0xFE000520
318#define XCHAL_DEBUG_VECTOR_VADDR XCHAL_INTLEVEL4_VECTOR_VADDR
319#define XCHAL_DEBUG_VECTOR_PADDR XCHAL_INTLEVEL4_VECTOR_PADDR
320
321
322/*----------------------------------------------------------------------
323 DEBUG
324 ----------------------------------------------------------------------*/
325
326#define XCHAL_HAVE_OCD 1 /* OnChipDebug option */
327#define XCHAL_NUM_IBREAK 2 /* number of IBREAKn regs */
328#define XCHAL_NUM_DBREAK 2 /* number of DBREAKn regs */
329#define XCHAL_HAVE_OCD_DIR_ARRAY 1 /* faster OCD option */
330
331
332/*----------------------------------------------------------------------
333 MMU
334 ----------------------------------------------------------------------*/
335
336/* See <xtensa/config/core-matmap.h> header file for more details. */
337
338#define XCHAL_HAVE_TLBS 1 /* inverse of HAVE_CACHEATTR */
339#define XCHAL_HAVE_SPANNING_WAY 0 /* one way maps I+D 4GB vaddr */
340#define XCHAL_HAVE_IDENTITY_MAP 0 /* vaddr == paddr always */
341#define XCHAL_HAVE_CACHEATTR 0 /* CACHEATTR register present */
342#define XCHAL_HAVE_MIMIC_CACHEATTR 0 /* region protection */
343#define XCHAL_HAVE_XLT_CACHEATTR 0 /* region prot. w/translation */
344#define XCHAL_HAVE_PTP_MMU 1 /* full MMU (with page table
345 [autorefill] and protection)
346 usable for an MMU-based OS */
347/* If none of the above last 4 are set, it's a custom TLB configuration. */
348#define XCHAL_ITLB_ARF_ENTRIES_LOG2 2 /* log2(autorefill way size) */
349#define XCHAL_DTLB_ARF_ENTRIES_LOG2 2 /* log2(autorefill way size) */
350
351#define XCHAL_MMU_ASID_BITS 8 /* number of bits in ASIDs */
352#define XCHAL_MMU_RINGS 4 /* number of rings (1..4) */
353#define XCHAL_MMU_RING_BITS 2 /* num of bits in RING field */
354
355#endif /* !XTENSA_HAL_NON_PRIVILEGED_ONLY */
356
357
358#endif /* _XTENSA_CORE_CONFIGURATION_H */
359
diff --git a/include/asm-xtensa/variant-fsf/tie-asm.h b/include/asm-xtensa/variant-fsf/tie-asm.h
deleted file mode 100644
index 68a73bf4ffc5..000000000000
--- a/include/asm-xtensa/variant-fsf/tie-asm.h
+++ /dev/null
@@ -1,70 +0,0 @@
1/*
2 * This header file contains assembly-language definitions (assembly
3 * macros, etc.) for this specific Xtensa processor's TIE extensions
4 * and options. It is customized to this Xtensa processor configuration.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 *
10 * Copyright (C) 1999-2008 Tensilica Inc.
11 */
12
13#ifndef _XTENSA_CORE_TIE_ASM_H
14#define _XTENSA_CORE_TIE_ASM_H
15
16/* Selection parameter values for save-area save/restore macros: */
17/* Option vs. TIE: */
18#define XTHAL_SAS_TIE 0x0001 /* custom extension or coprocessor */
19#define XTHAL_SAS_OPT 0x0002 /* optional (and not a coprocessor) */
20/* Whether used automatically by compiler: */
21#define XTHAL_SAS_NOCC 0x0004 /* not used by compiler w/o special opts/code */
22#define XTHAL_SAS_CC 0x0008 /* used by compiler without special opts/code */
23/* ABI handling across function calls: */
24#define XTHAL_SAS_CALR 0x0010 /* caller-saved */
25#define XTHAL_SAS_CALE 0x0020 /* callee-saved */
26#define XTHAL_SAS_GLOB 0x0040 /* global across function calls (in thread) */
27/* Misc */
28#define XTHAL_SAS_ALL 0xFFFF /* include all default NCP contents */
29
30
31
32/* Macro to save all non-coprocessor (extra) custom TIE and optional state
33 * (not including zero-overhead loop registers).
34 * Save area ptr (clobbered): ptr (1 byte aligned)
35 * Scratch regs (clobbered): at1..at4 (only first XCHAL_NCP_NUM_ATMPS needed)
36 */
37 .macro xchal_ncp_store ptr at1 at2 at3 at4 continue=0 ofs=-1 select=XTHAL_SAS_ALL
38 xchal_sa_start \continue, \ofs
39 .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_CC | XTHAL_SAS_GLOB) & ~\select
40 xchal_sa_align \ptr, 0, 1024-4, 4, 4
41 rur \at1, THREADPTR // threadptr option
42 s32i \at1, \ptr, .Lxchal_ofs_ + 0
43 .set .Lxchal_ofs_, .Lxchal_ofs_ + 4
44 .endif
45 .endm // xchal_ncp_store
46
47/* Macro to save all non-coprocessor (extra) custom TIE and optional state
48 * (not including zero-overhead loop registers).
49 * Save area ptr (clobbered): ptr (1 byte aligned)
50 * Scratch regs (clobbered): at1..at4 (only first XCHAL_NCP_NUM_ATMPS needed)
51 */
52 .macro xchal_ncp_load ptr at1 at2 at3 at4 continue=0 ofs=-1 select=XTHAL_SAS_ALL
53 xchal_sa_start \continue, \ofs
54 .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_CC | XTHAL_SAS_GLOB) & ~\select
55 xchal_sa_align \ptr, 0, 1024-4, 4, 4
56 l32i \at1, \ptr, .Lxchal_ofs_ + 0
57 wur \at1, THREADPTR // threadptr option
58 .set .Lxchal_ofs_, .Lxchal_ofs_ + 4
59 .endif
60 .endm // xchal_ncp_load
61
62
63
64#define XCHAL_NCP_NUM_ATMPS 1
65
66
67#define XCHAL_SA_NUM_ATMPS 1
68
69#endif /*_XTENSA_CORE_TIE_ASM_H*/
70
diff --git a/include/asm-xtensa/variant-fsf/tie.h b/include/asm-xtensa/variant-fsf/tie.h
deleted file mode 100644
index bf4020116df5..000000000000
--- a/include/asm-xtensa/variant-fsf/tie.h
+++ /dev/null
@@ -1,77 +0,0 @@
1/*
2 * This header file describes this specific Xtensa processor's TIE extensions
3 * that extend basic Xtensa core functionality. It is customized to this
4 * Xtensa processor configuration.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 *
10 * Copyright (C) 1999-2007 Tensilica Inc.
11 */
12
13#ifndef _XTENSA_CORE_TIE_H
14#define _XTENSA_CORE_TIE_H
15
16#define XCHAL_CP_NUM 0 /* number of coprocessors */
17#define XCHAL_CP_MAX 0 /* max CP ID + 1 (0 if none) */
18#define XCHAL_CP_MASK 0x00 /* bitmask of all CPs by ID */
19#define XCHAL_CP_PORT_MASK 0x00 /* bitmask of only port CPs */
20
21/* Basic parameters of each coprocessor: */
22#define XCHAL_CP7_NAME "XTIOP"
23#define XCHAL_CP7_IDENT XTIOP
24#define XCHAL_CP7_SA_SIZE 0 /* size of state save area */
25#define XCHAL_CP7_SA_ALIGN 1 /* min alignment of save area */
26#define XCHAL_CP_ID_XTIOP 7 /* coprocessor ID (0..7) */
27
28/* Filler info for unassigned coprocessors, to simplify arrays etc: */
29#define XCHAL_NCP_SA_SIZE 0
30#define XCHAL_NCP_SA_ALIGN 1
31#define XCHAL_CP0_SA_SIZE 0
32#define XCHAL_CP0_SA_ALIGN 1
33#define XCHAL_CP1_SA_SIZE 0
34#define XCHAL_CP1_SA_ALIGN 1
35#define XCHAL_CP2_SA_SIZE 0
36#define XCHAL_CP2_SA_ALIGN 1
37#define XCHAL_CP3_SA_SIZE 0
38#define XCHAL_CP3_SA_ALIGN 1
39#define XCHAL_CP4_SA_SIZE 0
40#define XCHAL_CP4_SA_ALIGN 1
41#define XCHAL_CP5_SA_SIZE 0
42#define XCHAL_CP5_SA_ALIGN 1
43#define XCHAL_CP6_SA_SIZE 0
44#define XCHAL_CP6_SA_ALIGN 1
45
46/* Save area for non-coprocessor optional and custom (TIE) state: */
47#define XCHAL_NCP_SA_SIZE 0
48#define XCHAL_NCP_SA_ALIGN 1
49
50/* Total save area for optional and custom state (NCP + CPn): */
51#define XCHAL_TOTAL_SA_SIZE 0 /* with 16-byte align padding */
52#define XCHAL_TOTAL_SA_ALIGN 1 /* actual minimum alignment */
53
54#define XCHAL_NCP_SA_NUM 0
55#define XCHAL_NCP_SA_LIST(s)
56#define XCHAL_CP0_SA_NUM 0
57#define XCHAL_CP0_SA_LIST(s)
58#define XCHAL_CP1_SA_NUM 0
59#define XCHAL_CP1_SA_LIST(s)
60#define XCHAL_CP2_SA_NUM 0
61#define XCHAL_CP2_SA_LIST(s)
62#define XCHAL_CP3_SA_NUM 0
63#define XCHAL_CP3_SA_LIST(s)
64#define XCHAL_CP4_SA_NUM 0
65#define XCHAL_CP4_SA_LIST(s)
66#define XCHAL_CP5_SA_NUM 0
67#define XCHAL_CP5_SA_LIST(s)
68#define XCHAL_CP6_SA_NUM 0
69#define XCHAL_CP6_SA_LIST(s)
70#define XCHAL_CP7_SA_NUM 0
71#define XCHAL_CP7_SA_LIST(s)
72
73/* Byte length of instruction from its first nibble (op0 field), per FLIX. */
74#define XCHAL_OP0_FORMAT_LENGTHS 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3
75
76#endif /*_XTENSA_CORE_TIE_H*/
77
diff --git a/include/asm-xtensa/vga.h b/include/asm-xtensa/vga.h
deleted file mode 100644
index 1fd8cab3a297..000000000000
--- a/include/asm-xtensa/vga.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * include/asm-xtensa/vga.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_VGA_H
12#define _XTENSA_VGA_H
13
14#define VGA_MAP_MEM(x,s) (unsigned long)phys_to_virt(x)
15
16#define vga_readb(x) (*(x))
17#define vga_writeb(x,y) (*(y) = (x))
18
19#endif
diff --git a/include/asm-xtensa/xor.h b/include/asm-xtensa/xor.h
deleted file mode 100644
index e7b1f083991d..000000000000
--- a/include/asm-xtensa/xor.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * include/asm-xtensa/xor.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_XOR_H
12#define _XTENSA_XOR_H
13
14#include <asm-generic/xor.h>
15
16#endif
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 95ac82340c3b..12e9a2957caf 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -56,8 +56,6 @@ header-y += dlm_device.h
56header-y += dlm_netlink.h 56header-y += dlm_netlink.h
57header-y += dm-ioctl.h 57header-y += dm-ioctl.h
58header-y += dn.h 58header-y += dn.h
59header-y += dqblk_v1.h
60header-y += dqblk_v2.h
61header-y += dqblk_xfs.h 59header-y += dqblk_xfs.h
62header-y += efs_fs_sb.h 60header-y += efs_fs_sb.h
63header-y += elf-fdpic.h 61header-y += elf-fdpic.h
@@ -134,8 +132,6 @@ header-y += posix_types.h
134header-y += ppdev.h 132header-y += ppdev.h
135header-y += prctl.h 133header-y += prctl.h
136header-y += qnxtypes.h 134header-y += qnxtypes.h
137header-y += quotaio_v1.h
138header-y += quotaio_v2.h
139header-y += radeonfb.h 135header-y += radeonfb.h
140header-y += raw.h 136header-y += raw.h
141header-y += resource.h 137header-y += resource.h
@@ -183,7 +179,6 @@ unifdef-y += auto_fs.h
183unifdef-y += auxvec.h 179unifdef-y += auxvec.h
184unifdef-y += binfmts.h 180unifdef-y += binfmts.h
185unifdef-y += blktrace_api.h 181unifdef-y += blktrace_api.h
186unifdef-y += byteorder.h
187unifdef-y += capability.h 182unifdef-y += capability.h
188unifdef-y += capi.h 183unifdef-y += capi.h
189unifdef-y += cciss_ioctl.h 184unifdef-y += cciss_ioctl.h
@@ -376,3 +371,5 @@ unifdef-y += xattr.h
376unifdef-y += xfrm.h 371unifdef-y += xfrm.h
377 372
378objhdr-y += version.h 373objhdr-y += version.h
374header-y += wimax.h
375header-y += wimax/
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index fba8051fb297..6fce2fc2d124 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -131,22 +131,6 @@ extern int acpi_get_override_irq(int bus_irq, int *trigger, int *polarity);
131 */ 131 */
132void acpi_unregister_gsi (u32 gsi); 132void acpi_unregister_gsi (u32 gsi);
133 133
134struct acpi_prt_entry {
135 struct list_head node;
136 struct acpi_pci_id id;
137 u8 pin;
138 struct {
139 acpi_handle handle;
140 u32 index;
141 } link;
142 u32 irq;
143};
144
145struct acpi_prt_list {
146 int count;
147 struct list_head entries;
148};
149
150struct pci_dev; 134struct pci_dev;
151 135
152int acpi_pci_irq_enable (struct pci_dev *dev); 136int acpi_pci_irq_enable (struct pci_dev *dev);
@@ -270,6 +254,7 @@ int acpi_check_mem_region(resource_size_t start, resource_size_t n,
270#ifdef CONFIG_PM_SLEEP 254#ifdef CONFIG_PM_SLEEP
271void __init acpi_no_s4_hw_signature(void); 255void __init acpi_no_s4_hw_signature(void);
272void __init acpi_old_suspend_ordering(void); 256void __init acpi_old_suspend_ordering(void);
257void __init acpi_s4_no_nvs(void);
273#endif /* CONFIG_PM_SLEEP */ 258#endif /* CONFIG_PM_SLEEP */
274#else /* CONFIG_ACPI */ 259#else /* CONFIG_ACPI */
275 260
diff --git a/include/linux/async.h b/include/linux/async.h
new file mode 100644
index 000000000000..c4ecacd0b327
--- /dev/null
+++ b/include/linux/async.h
@@ -0,0 +1,25 @@
1/*
2 * async.h: Asynchronous function calls for boot performance
3 *
4 * (C) Copyright 2009 Intel Corporation
5 * Author: Arjan van de Ven <arjan@linux.intel.com>
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; version 2
10 * of the License.
11 */
12
13#include <linux/types.h>
14#include <linux/list.h>
15
16typedef u64 async_cookie_t;
17typedef void (async_func_ptr) (void *data, async_cookie_t cookie);
18
19extern async_cookie_t async_schedule(async_func_ptr *ptr, void *data);
20extern async_cookie_t async_schedule_special(async_func_ptr *ptr, void *data, struct list_head *list);
21extern void async_synchronize_full(void);
22extern void async_synchronize_full_special(struct list_head *list);
23extern void async_synchronize_cookie(async_cookie_t cookie);
24extern void async_synchronize_cookie_special(async_cookie_t cookie, struct list_head *list);
25
diff --git a/include/linux/async_tx.h b/include/linux/async_tx.h
index 0f50d4cc4360..45f6297821bd 100644
--- a/include/linux/async_tx.h
+++ b/include/linux/async_tx.h
@@ -59,9 +59,7 @@ enum async_tx_flags {
59}; 59};
60 60
61#ifdef CONFIG_DMA_ENGINE 61#ifdef CONFIG_DMA_ENGINE
62void async_tx_issue_pending_all(void); 62#define async_tx_issue_pending_all dma_issue_pending_all
63enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx);
64void async_tx_run_dependencies(struct dma_async_tx_descriptor *tx);
65#ifdef CONFIG_ARCH_HAS_ASYNC_TX_FIND_CHANNEL 63#ifdef CONFIG_ARCH_HAS_ASYNC_TX_FIND_CHANNEL
66#include <asm/async_tx.h> 64#include <asm/async_tx.h>
67#else 65#else
@@ -77,19 +75,6 @@ static inline void async_tx_issue_pending_all(void)
77 do { } while (0); 75 do { } while (0);
78} 76}
79 77
80static inline enum dma_status
81dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx)
82{
83 return DMA_SUCCESS;
84}
85
86static inline void
87async_tx_run_dependencies(struct dma_async_tx_descriptor *tx,
88 struct dma_chan *host_chan)
89{
90 do { } while (0);
91}
92
93static inline struct dma_chan * 78static inline struct dma_chan *
94async_tx_find_channel(struct dma_async_tx_descriptor *depend_tx, 79async_tx_find_channel(struct dma_async_tx_descriptor *depend_tx,
95 enum dma_transaction_type tx_type, struct page **dst, int dst_count, 80 enum dma_transaction_type tx_type, struct page **dst, int dst_count,
diff --git a/include/linux/atmel-mci.h b/include/linux/atmel-mci.h
new file mode 100644
index 000000000000..2f1f95737acb
--- /dev/null
+++ b/include/linux/atmel-mci.h
@@ -0,0 +1,39 @@
1#ifndef __LINUX_ATMEL_MCI_H
2#define __LINUX_ATMEL_MCI_H
3
4#define ATMEL_MCI_MAX_NR_SLOTS 2
5
6#include <linux/dw_dmac.h>
7
8/**
9 * struct mci_slot_pdata - board-specific per-slot configuration
10 * @bus_width: Number of data lines wired up the slot
11 * @detect_pin: GPIO pin wired to the card detect switch
12 * @wp_pin: GPIO pin wired to the write protect sensor
13 *
14 * If a given slot is not present on the board, @bus_width should be
15 * set to 0. The other fields are ignored in this case.
16 *
17 * Any pins that aren't available should be set to a negative value.
18 *
19 * Note that support for multiple slots is experimental -- some cards
20 * might get upset if we don't get the clock management exactly right.
21 * But in most cases, it should work just fine.
22 */
23struct mci_slot_pdata {
24 unsigned int bus_width;
25 int detect_pin;
26 int wp_pin;
27};
28
29/**
30 * struct mci_platform_data - board-specific MMC/SDcard configuration
31 * @dma_slave: DMA slave interface to use in data transfers.
32 * @slot: Per-slot configuration data.
33 */
34struct mci_platform_data {
35 struct dw_dma_slave dma_slave;
36 struct mci_slot_pdata slot[ATMEL_MCI_MAX_NR_SLOTS];
37};
38
39#endif /* __LINUX_ATMEL_MCI_H */
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 26c4f6f65a46..67e5dbfc2961 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -247,6 +247,18 @@
247#define AUDIT_GREATER_THAN_OR_EQUAL (AUDIT_GREATER_THAN|AUDIT_EQUAL) 247#define AUDIT_GREATER_THAN_OR_EQUAL (AUDIT_GREATER_THAN|AUDIT_EQUAL)
248#define AUDIT_OPERATORS (AUDIT_EQUAL|AUDIT_NOT_EQUAL|AUDIT_BIT_MASK) 248#define AUDIT_OPERATORS (AUDIT_EQUAL|AUDIT_NOT_EQUAL|AUDIT_BIT_MASK)
249 249
250enum {
251 Audit_equal,
252 Audit_not_equal,
253 Audit_bitmask,
254 Audit_bittest,
255 Audit_lt,
256 Audit_gt,
257 Audit_le,
258 Audit_ge,
259 Audit_bad
260};
261
250/* Status symbols */ 262/* Status symbols */
251 /* Mask values */ 263 /* Mask values */
252#define AUDIT_STATUS_ENABLED 0x0001 264#define AUDIT_STATUS_ENABLED 0x0001
@@ -373,6 +385,8 @@ struct audit_krule {
373 struct audit_watch *watch; /* associated watch */ 385 struct audit_watch *watch; /* associated watch */
374 struct audit_tree *tree; /* associated watched tree */ 386 struct audit_tree *tree; /* associated watched tree */
375 struct list_head rlist; /* entry in audit_{watch,tree}.rules list */ 387 struct list_head rlist; /* entry in audit_{watch,tree}.rules list */
388 struct list_head list; /* for AUDIT_LIST* purposes only */
389 u64 prio;
376}; 390};
377 391
378struct audit_field { 392struct audit_field {
@@ -443,70 +457,56 @@ extern int audit_set_loginuid(struct task_struct *task, uid_t loginuid);
443#define audit_get_loginuid(t) ((t)->loginuid) 457#define audit_get_loginuid(t) ((t)->loginuid)
444#define audit_get_sessionid(t) ((t)->sessionid) 458#define audit_get_sessionid(t) ((t)->sessionid)
445extern void audit_log_task_context(struct audit_buffer *ab); 459extern void audit_log_task_context(struct audit_buffer *ab);
446extern int __audit_ipc_obj(struct kern_ipc_perm *ipcp); 460extern void __audit_ipc_obj(struct kern_ipc_perm *ipcp);
447extern int __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode); 461extern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode);
448extern int audit_bprm(struct linux_binprm *bprm); 462extern int audit_bprm(struct linux_binprm *bprm);
449extern int audit_socketcall(int nargs, unsigned long *args); 463extern void audit_socketcall(int nargs, unsigned long *args);
450extern int audit_sockaddr(int len, void *addr); 464extern int audit_sockaddr(int len, void *addr);
451extern int __audit_fd_pair(int fd1, int fd2); 465extern void __audit_fd_pair(int fd1, int fd2);
452extern int audit_set_macxattr(const char *name); 466extern int audit_set_macxattr(const char *name);
453extern int __audit_mq_open(int oflag, mode_t mode, struct mq_attr __user *u_attr); 467extern void __audit_mq_open(int oflag, mode_t mode, struct mq_attr *attr);
454extern int __audit_mq_timedsend(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec __user *u_abs_timeout); 468extern void __audit_mq_sendrecv(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec *abs_timeout);
455extern int __audit_mq_timedreceive(mqd_t mqdes, size_t msg_len, unsigned int __user *u_msg_prio, const struct timespec __user *u_abs_timeout); 469extern void __audit_mq_notify(mqd_t mqdes, const struct sigevent *notification);
456extern int __audit_mq_notify(mqd_t mqdes, const struct sigevent __user *u_notification); 470extern void __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat);
457extern int __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat);
458extern int __audit_log_bprm_fcaps(struct linux_binprm *bprm, 471extern int __audit_log_bprm_fcaps(struct linux_binprm *bprm,
459 const struct cred *new, 472 const struct cred *new,
460 const struct cred *old); 473 const struct cred *old);
461extern int __audit_log_capset(pid_t pid, const struct cred *new, const struct cred *old); 474extern void __audit_log_capset(pid_t pid, const struct cred *new, const struct cred *old);
462 475
463static inline int audit_ipc_obj(struct kern_ipc_perm *ipcp) 476static inline void audit_ipc_obj(struct kern_ipc_perm *ipcp)
464{ 477{
465 if (unlikely(!audit_dummy_context())) 478 if (unlikely(!audit_dummy_context()))
466 return __audit_ipc_obj(ipcp); 479 __audit_ipc_obj(ipcp);
467 return 0;
468}
469static inline int audit_fd_pair(int fd1, int fd2)
470{
471 if (unlikely(!audit_dummy_context()))
472 return __audit_fd_pair(fd1, fd2);
473 return 0;
474} 480}
475static inline int audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode) 481static inline void audit_fd_pair(int fd1, int fd2)
476{ 482{
477 if (unlikely(!audit_dummy_context())) 483 if (unlikely(!audit_dummy_context()))
478 return __audit_ipc_set_perm(qbytes, uid, gid, mode); 484 __audit_fd_pair(fd1, fd2);
479 return 0;
480} 485}
481static inline int audit_mq_open(int oflag, mode_t mode, struct mq_attr __user *u_attr) 486static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode)
482{ 487{
483 if (unlikely(!audit_dummy_context())) 488 if (unlikely(!audit_dummy_context()))
484 return __audit_mq_open(oflag, mode, u_attr); 489 __audit_ipc_set_perm(qbytes, uid, gid, mode);
485 return 0;
486} 490}
487static inline int audit_mq_timedsend(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec __user *u_abs_timeout) 491static inline void audit_mq_open(int oflag, mode_t mode, struct mq_attr *attr)
488{ 492{
489 if (unlikely(!audit_dummy_context())) 493 if (unlikely(!audit_dummy_context()))
490 return __audit_mq_timedsend(mqdes, msg_len, msg_prio, u_abs_timeout); 494 __audit_mq_open(oflag, mode, attr);
491 return 0;
492} 495}
493static inline int audit_mq_timedreceive(mqd_t mqdes, size_t msg_len, unsigned int __user *u_msg_prio, const struct timespec __user *u_abs_timeout) 496static inline void audit_mq_sendrecv(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec *abs_timeout)
494{ 497{
495 if (unlikely(!audit_dummy_context())) 498 if (unlikely(!audit_dummy_context()))
496 return __audit_mq_timedreceive(mqdes, msg_len, u_msg_prio, u_abs_timeout); 499 __audit_mq_sendrecv(mqdes, msg_len, msg_prio, abs_timeout);
497 return 0;
498} 500}
499static inline int audit_mq_notify(mqd_t mqdes, const struct sigevent __user *u_notification) 501static inline void audit_mq_notify(mqd_t mqdes, const struct sigevent *notification)
500{ 502{
501 if (unlikely(!audit_dummy_context())) 503 if (unlikely(!audit_dummy_context()))
502 return __audit_mq_notify(mqdes, u_notification); 504 __audit_mq_notify(mqdes, notification);
503 return 0;
504} 505}
505static inline int audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat) 506static inline void audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat)
506{ 507{
507 if (unlikely(!audit_dummy_context())) 508 if (unlikely(!audit_dummy_context()))
508 return __audit_mq_getsetattr(mqdes, mqstat); 509 __audit_mq_getsetattr(mqdes, mqstat);
509 return 0;
510} 510}
511 511
512static inline int audit_log_bprm_fcaps(struct linux_binprm *bprm, 512static inline int audit_log_bprm_fcaps(struct linux_binprm *bprm,
@@ -518,12 +518,11 @@ static inline int audit_log_bprm_fcaps(struct linux_binprm *bprm,
518 return 0; 518 return 0;
519} 519}
520 520
521static inline int audit_log_capset(pid_t pid, const struct cred *new, 521static inline void audit_log_capset(pid_t pid, const struct cred *new,
522 const struct cred *old) 522 const struct cred *old)
523{ 523{
524 if (unlikely(!audit_dummy_context())) 524 if (unlikely(!audit_dummy_context()))
525 return __audit_log_capset(pid, new, old); 525 __audit_log_capset(pid, new, old);
526 return 0;
527} 526}
528 527
529extern int audit_n_rules; 528extern int audit_n_rules;
@@ -546,20 +545,19 @@ extern int audit_signals;
546#define audit_get_loginuid(t) (-1) 545#define audit_get_loginuid(t) (-1)
547#define audit_get_sessionid(t) (-1) 546#define audit_get_sessionid(t) (-1)
548#define audit_log_task_context(b) do { ; } while (0) 547#define audit_log_task_context(b) do { ; } while (0)
549#define audit_ipc_obj(i) ({ 0; }) 548#define audit_ipc_obj(i) ((void)0)
550#define audit_ipc_set_perm(q,u,g,m) ({ 0; }) 549#define audit_ipc_set_perm(q,u,g,m) ((void)0)
551#define audit_bprm(p) ({ 0; }) 550#define audit_bprm(p) ({ 0; })
552#define audit_socketcall(n,a) ({ 0; }) 551#define audit_socketcall(n,a) ((void)0)
553#define audit_fd_pair(n,a) ({ 0; }) 552#define audit_fd_pair(n,a) ((void)0)
554#define audit_sockaddr(len, addr) ({ 0; }) 553#define audit_sockaddr(len, addr) ({ 0; })
555#define audit_set_macxattr(n) do { ; } while (0) 554#define audit_set_macxattr(n) do { ; } while (0)
556#define audit_mq_open(o,m,a) ({ 0; }) 555#define audit_mq_open(o,m,a) ((void)0)
557#define audit_mq_timedsend(d,l,p,t) ({ 0; }) 556#define audit_mq_sendrecv(d,l,p,t) ((void)0)
558#define audit_mq_timedreceive(d,l,p,t) ({ 0; }) 557#define audit_mq_notify(d,n) ((void)0)
559#define audit_mq_notify(d,n) ({ 0; }) 558#define audit_mq_getsetattr(d,s) ((void)0)
560#define audit_mq_getsetattr(d,s) ({ 0; })
561#define audit_log_bprm_fcaps(b, ncr, ocr) ({ 0; }) 559#define audit_log_bprm_fcaps(b, ncr, ocr) ({ 0; })
562#define audit_log_capset(pid, ncr, ocr) ({ 0; }) 560#define audit_log_capset(pid, ncr, ocr) ((void)0)
563#define audit_ptrace(t) ((void)0) 561#define audit_ptrace(t) ((void)0)
564#define audit_n_rules 0 562#define audit_n_rules 0
565#define audit_signals 0 563#define audit_signals 0
diff --git a/include/linux/auto_dev-ioctl.h b/include/linux/auto_dev-ioctl.h
index f4d05ccd731f..91a773993a5c 100644
--- a/include/linux/auto_dev-ioctl.h
+++ b/include/linux/auto_dev-ioctl.h
@@ -10,6 +10,7 @@
10#ifndef _LINUX_AUTO_DEV_IOCTL_H 10#ifndef _LINUX_AUTO_DEV_IOCTL_H
11#define _LINUX_AUTO_DEV_IOCTL_H 11#define _LINUX_AUTO_DEV_IOCTL_H
12 12
13#include <linux/string.h>
13#include <linux/types.h> 14#include <linux/types.h>
14 15
15#define AUTOFS_DEVICE_NAME "autofs" 16#define AUTOFS_DEVICE_NAME "autofs"
@@ -25,6 +26,60 @@
25 * An ioctl interface for autofs mount point control. 26 * An ioctl interface for autofs mount point control.
26 */ 27 */
27 28
29struct args_protover {
30 __u32 version;
31};
32
33struct args_protosubver {
34 __u32 sub_version;
35};
36
37struct args_openmount {
38 __u32 devid;
39};
40
41struct args_ready {
42 __u32 token;
43};
44
45struct args_fail {
46 __u32 token;
47 __s32 status;
48};
49
50struct args_setpipefd {
51 __s32 pipefd;
52};
53
54struct args_timeout {
55 __u64 timeout;
56};
57
58struct args_requester {
59 __u32 uid;
60 __u32 gid;
61};
62
63struct args_expire {
64 __u32 how;
65};
66
67struct args_askumount {
68 __u32 may_umount;
69};
70
71struct args_ismountpoint {
72 union {
73 struct args_in {
74 __u32 type;
75 } in;
76 struct args_out {
77 __u32 devid;
78 __u32 magic;
79 } out;
80 };
81};
82
28/* 83/*
29 * All the ioctls use this structure. 84 * All the ioctls use this structure.
30 * When sending a path size must account for the total length 85 * When sending a path size must account for the total length
@@ -39,20 +94,32 @@ struct autofs_dev_ioctl {
39 * including this struct */ 94 * including this struct */
40 __s32 ioctlfd; /* automount command fd */ 95 __s32 ioctlfd; /* automount command fd */
41 96
42 __u32 arg1; /* Command parameters */ 97 /* Command parameters */
43 __u32 arg2; 98
99 union {
100 struct args_protover protover;
101 struct args_protosubver protosubver;
102 struct args_openmount openmount;
103 struct args_ready ready;
104 struct args_fail fail;
105 struct args_setpipefd setpipefd;
106 struct args_timeout timeout;
107 struct args_requester requester;
108 struct args_expire expire;
109 struct args_askumount askumount;
110 struct args_ismountpoint ismountpoint;
111 };
44 112
45 char path[0]; 113 char path[0];
46}; 114};
47 115
48static inline void init_autofs_dev_ioctl(struct autofs_dev_ioctl *in) 116static inline void init_autofs_dev_ioctl(struct autofs_dev_ioctl *in)
49{ 117{
118 memset(in, 0, sizeof(struct autofs_dev_ioctl));
50 in->ver_major = AUTOFS_DEV_IOCTL_VERSION_MAJOR; 119 in->ver_major = AUTOFS_DEV_IOCTL_VERSION_MAJOR;
51 in->ver_minor = AUTOFS_DEV_IOCTL_VERSION_MINOR; 120 in->ver_minor = AUTOFS_DEV_IOCTL_VERSION_MINOR;
52 in->size = sizeof(struct autofs_dev_ioctl); 121 in->size = sizeof(struct autofs_dev_ioctl);
53 in->ioctlfd = -1; 122 in->ioctlfd = -1;
54 in->arg1 = 0;
55 in->arg2 = 0;
56 return; 123 return;
57} 124}
58 125
diff --git a/include/linux/auto_fs4.h b/include/linux/auto_fs4.h
index 2253716d4b92..55fa478bd639 100644
--- a/include/linux/auto_fs4.h
+++ b/include/linux/auto_fs4.h
@@ -29,10 +29,64 @@
29#define AUTOFS_EXP_IMMEDIATE 1 29#define AUTOFS_EXP_IMMEDIATE 1
30#define AUTOFS_EXP_LEAVES 2 30#define AUTOFS_EXP_LEAVES 2
31 31
32#define AUTOFS_TYPE_ANY 0x0000 32#define AUTOFS_TYPE_ANY 0U
33#define AUTOFS_TYPE_INDIRECT 0x0001 33#define AUTOFS_TYPE_INDIRECT 1U
34#define AUTOFS_TYPE_DIRECT 0x0002 34#define AUTOFS_TYPE_DIRECT 2U
35#define AUTOFS_TYPE_OFFSET 0x0004 35#define AUTOFS_TYPE_OFFSET 4U
36
37static inline void set_autofs_type_indirect(unsigned int *type)
38{
39 *type = AUTOFS_TYPE_INDIRECT;
40 return;
41}
42
43static inline unsigned int autofs_type_indirect(unsigned int type)
44{
45 return (type == AUTOFS_TYPE_INDIRECT);
46}
47
48static inline void set_autofs_type_direct(unsigned int *type)
49{
50 *type = AUTOFS_TYPE_DIRECT;
51 return;
52}
53
54static inline unsigned int autofs_type_direct(unsigned int type)
55{
56 return (type == AUTOFS_TYPE_DIRECT);
57}
58
59static inline void set_autofs_type_offset(unsigned int *type)
60{
61 *type = AUTOFS_TYPE_OFFSET;
62 return;
63}
64
65static inline unsigned int autofs_type_offset(unsigned int type)
66{
67 return (type == AUTOFS_TYPE_OFFSET);
68}
69
70static inline unsigned int autofs_type_trigger(unsigned int type)
71{
72 return (type == AUTOFS_TYPE_DIRECT || type == AUTOFS_TYPE_OFFSET);
73}
74
75/*
76 * This isn't really a type as we use it to say "no type set" to
77 * indicate we want to search for "any" mount in the
78 * autofs_dev_ioctl_ismountpoint() device ioctl function.
79 */
80static inline void set_autofs_type_any(unsigned int *type)
81{
82 *type = AUTOFS_TYPE_ANY;
83 return;
84}
85
86static inline unsigned int autofs_type_any(unsigned int type)
87{
88 return (type == AUTOFS_TYPE_ANY);
89}
36 90
37/* Daemon notification packet types */ 91/* Daemon notification packet types */
38enum autofs_notify { 92enum autofs_notify {
diff --git a/include/linux/auxvec.h b/include/linux/auxvec.h
index d7afa9dd6635..f3b5d4e3a2ac 100644
--- a/include/linux/auxvec.h
+++ b/include/linux/auxvec.h
@@ -23,16 +23,16 @@
23#define AT_PLATFORM 15 /* string identifying CPU for optimizations */ 23#define AT_PLATFORM 15 /* string identifying CPU for optimizations */
24#define AT_HWCAP 16 /* arch dependent hints at CPU capabilities */ 24#define AT_HWCAP 16 /* arch dependent hints at CPU capabilities */
25#define AT_CLKTCK 17 /* frequency at which times() increments */ 25#define AT_CLKTCK 17 /* frequency at which times() increments */
26 26/* AT_* values 18 through 22 are reserved */
27#define AT_SECURE 23 /* secure mode boolean */ 27#define AT_SECURE 23 /* secure mode boolean */
28
29#define AT_BASE_PLATFORM 24 /* string identifying real platform, may 28#define AT_BASE_PLATFORM 24 /* string identifying real platform, may
30 * differ from AT_PLATFORM. */ 29 * differ from AT_PLATFORM. */
30#define AT_RANDOM 25 /* address of 16 random bytes */
31 31
32#define AT_EXECFN 31 /* filename of program */ 32#define AT_EXECFN 31 /* filename of program */
33 33
34#ifdef __KERNEL__ 34#ifdef __KERNEL__
35#define AT_VECTOR_SIZE_BASE 18 /* NEW_AUX_ENT entries in auxiliary table */ 35#define AT_VECTOR_SIZE_BASE 19 /* NEW_AUX_ENT entries in auxiliary table */
36 /* number of "#define AT_.*" above, minus {AT_NULL, AT_IGNORE, AT_NOTELF} */ 36 /* number of "#define AT_.*" above, minus {AT_NULL, AT_IGNORE, AT_NOTELF} */
37#endif 37#endif
38 38
diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index 1ee9488ca2e4..79ca2da81c87 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -31,6 +31,10 @@ struct backlight_device;
31struct fb_info; 31struct fb_info;
32 32
33struct backlight_ops { 33struct backlight_ops {
34 unsigned int options;
35
36#define BL_CORE_SUSPENDRESUME (1 << 0)
37
34 /* Notify the backlight driver some property has changed */ 38 /* Notify the backlight driver some property has changed */
35 int (*update_status)(struct backlight_device *); 39 int (*update_status)(struct backlight_device *);
36 /* Return the current backlight brightness (accounting for power, 40 /* Return the current backlight brightness (accounting for power,
@@ -51,7 +55,19 @@ struct backlight_properties {
51 modes; 4: full off), see FB_BLANK_XXX */ 55 modes; 4: full off), see FB_BLANK_XXX */
52 int power; 56 int power;
53 /* FB Blanking active? (values as for power) */ 57 /* FB Blanking active? (values as for power) */
58 /* Due to be removed, please use (state & BL_CORE_FBBLANK) */
54 int fb_blank; 59 int fb_blank;
60 /* Flags used to signal drivers of state changes */
61 /* Upper 4 bits are reserved for driver internal use */
62 unsigned int state;
63
64#define BL_CORE_SUSPENDED (1 << 0) /* backlight is suspended */
65#define BL_CORE_FBBLANK (1 << 1) /* backlight is under an fb blank event */
66#define BL_CORE_DRIVER4 (1 << 28) /* reserved for driver specific use */
67#define BL_CORE_DRIVER3 (1 << 29) /* reserved for driver specific use */
68#define BL_CORE_DRIVER2 (1 << 30) /* reserved for driver specific use */
69#define BL_CORE_DRIVER1 (1 << 31) /* reserved for driver specific use */
70
55}; 71};
56 72
57struct backlight_device { 73struct backlight_device {
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index 6cbfbe297180..77b4a9e46004 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -18,6 +18,7 @@ struct pt_regs;
18#define BINPRM_BUF_SIZE 128 18#define BINPRM_BUF_SIZE 128
19 19
20#ifdef __KERNEL__ 20#ifdef __KERNEL__
21#include <linux/list.h>
21 22
22#define CORENAME_MAX_SIZE 128 23#define CORENAME_MAX_SIZE 128
23 24
@@ -106,7 +107,7 @@ extern int setup_arg_pages(struct linux_binprm * bprm,
106extern int bprm_mm_init(struct linux_binprm *bprm); 107extern int bprm_mm_init(struct linux_binprm *bprm);
107extern int copy_strings_kernel(int argc,char ** argv,struct linux_binprm *bprm); 108extern int copy_strings_kernel(int argc,char ** argv,struct linux_binprm *bprm);
108extern void install_exec_creds(struct linux_binprm *bprm); 109extern void install_exec_creds(struct linux_binprm *bprm);
109extern int do_coredump(long signr, int exit_code, struct pt_regs * regs); 110extern void do_coredump(long signr, int exit_code, struct pt_regs *regs);
110extern int set_binfmt(struct linux_binfmt *new); 111extern int set_binfmt(struct linux_binfmt *new);
111extern void free_bprm(struct linux_binprm *); 112extern void free_bprm(struct linux_binprm *);
112 113
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 7035cec583b6..044467ef7b11 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -690,6 +690,8 @@ struct rq_map_data {
690 struct page **pages; 690 struct page **pages;
691 int page_order; 691 int page_order;
692 int nr_entries; 692 int nr_entries;
693 unsigned long offset;
694 int null_mapped;
693}; 695};
694 696
695struct req_iterator { 697struct req_iterator {
diff --git a/include/linux/blockgroup_lock.h b/include/linux/blockgroup_lock.h
index 8607312983bd..e44b88ba552b 100644
--- a/include/linux/blockgroup_lock.h
+++ b/include/linux/blockgroup_lock.h
@@ -53,7 +53,10 @@ static inline void bgl_lock_init(struct blockgroup_lock *bgl)
53 * The accessor is a macro so we can embed a blockgroup_lock into different 53 * The accessor is a macro so we can embed a blockgroup_lock into different
54 * superblock types 54 * superblock types
55 */ 55 */
56#define sb_bgl_lock(sb, block_group) \ 56static inline spinlock_t *
57 (&(sb)->s_blockgroup_lock.locks[(block_group) & (NR_BG_LOCKS-1)].lock) 57bgl_lock_ptr(struct blockgroup_lock *bgl, unsigned int block_group)
58{
59 return &bgl->locks[(block_group) & (NR_BG_LOCKS-1)].lock;
60}
58 61
59#endif 62#endif
diff --git a/include/linux/byteorder.h b/include/linux/byteorder.h
deleted file mode 100644
index 29f002d73d98..000000000000
--- a/include/linux/byteorder.h
+++ /dev/null
@@ -1,372 +0,0 @@
1#ifndef _LINUX_BYTEORDER_H
2#define _LINUX_BYTEORDER_H
3
4#include <linux/types.h>
5#include <linux/swab.h>
6
7#if defined(__LITTLE_ENDIAN) && defined(__BIG_ENDIAN)
8# error Fix asm/byteorder.h to define one endianness
9#endif
10
11#if !defined(__LITTLE_ENDIAN) && !defined(__BIG_ENDIAN)
12# error Fix asm/byteorder.h to define arch endianness
13#endif
14
15#ifdef __LITTLE_ENDIAN
16# undef __LITTLE_ENDIAN
17# define __LITTLE_ENDIAN 1234
18#endif
19
20#ifdef __BIG_ENDIAN
21# undef __BIG_ENDIAN
22# define __BIG_ENDIAN 4321
23#endif
24
25#if defined(__LITTLE_ENDIAN) && !defined(__LITTLE_ENDIAN_BITFIELD)
26# define __LITTLE_ENDIAN_BITFIELD
27#endif
28
29#if defined(__BIG_ENDIAN) && !defined(__BIG_ENDIAN_BITFIELD)
30# define __BIG_ENDIAN_BITFIELD
31#endif
32
33#ifdef __LITTLE_ENDIAN
34# define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
35# define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
36# define __le64_to_cpu(x) ((__force __u64)(__le64)(x))
37# define __cpu_to_le16(x) ((__force __le16)(__u16)(x))
38# define __cpu_to_le32(x) ((__force __le32)(__u32)(x))
39# define __cpu_to_le64(x) ((__force __le64)(__u64)(x))
40
41# define __be16_to_cpu(x) __swab16((__force __u16)(__be16)(x))
42# define __be32_to_cpu(x) __swab32((__force __u32)(__be32)(x))
43# define __be64_to_cpu(x) __swab64((__force __u64)(__be64)(x))
44# define __cpu_to_be16(x) ((__force __be16)__swab16(x))
45# define __cpu_to_be32(x) ((__force __be32)__swab32(x))
46# define __cpu_to_be64(x) ((__force __be64)__swab64(x))
47#endif
48
49#ifdef __BIG_ENDIAN
50# define __be16_to_cpu(x) ((__force __u16)(__be16)(x))
51# define __be32_to_cpu(x) ((__force __u32)(__be32)(x))
52# define __be64_to_cpu(x) ((__force __u64)(__be64)(x))
53# define __cpu_to_be16(x) ((__force __be16)(__u16)(x))
54# define __cpu_to_be32(x) ((__force __be32)(__u32)(x))
55# define __cpu_to_be64(x) ((__force __be64)(__u64)(x))
56
57# define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
58# define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
59# define __le64_to_cpu(x) __swab64((__force __u64)(__le64)(x))
60# define __cpu_to_le16(x) ((__force __le16)__swab16(x))
61# define __cpu_to_le32(x) ((__force __le32)__swab32(x))
62# define __cpu_to_le64(x) ((__force __le64)__swab64(x))
63#endif
64
65/*
66 * These helpers could be phased out over time as the base version
67 * handles constant folding.
68 */
69#define __constant_htonl(x) __cpu_to_be32(x)
70#define __constant_ntohl(x) __be32_to_cpu(x)
71#define __constant_htons(x) __cpu_to_be16(x)
72#define __constant_ntohs(x) __be16_to_cpu(x)
73
74#define __constant_le16_to_cpu(x) __le16_to_cpu(x)
75#define __constant_le32_to_cpu(x) __le32_to_cpu(x)
76#define __constant_le64_to_cpu(x) __le64_to_cpu(x)
77#define __constant_be16_to_cpu(x) __be16_to_cpu(x)
78#define __constant_be32_to_cpu(x) __be32_to_cpu(x)
79#define __constant_be64_to_cpu(x) __be64_to_cpu(x)
80
81#define __constant_cpu_to_le16(x) __cpu_to_le16(x)
82#define __constant_cpu_to_le32(x) __cpu_to_le32(x)
83#define __constant_cpu_to_le64(x) __cpu_to_le64(x)
84#define __constant_cpu_to_be16(x) __cpu_to_be16(x)
85#define __constant_cpu_to_be32(x) __cpu_to_be32(x)
86#define __constant_cpu_to_be64(x) __cpu_to_be64(x)
87
88static inline void __le16_to_cpus(__u16 *p)
89{
90#ifdef __BIG_ENDIAN
91 __swab16s(p);
92#endif
93}
94
95static inline void __cpu_to_le16s(__u16 *p)
96{
97#ifdef __BIG_ENDIAN
98 __swab16s(p);
99#endif
100}
101
102static inline void __le32_to_cpus(__u32 *p)
103{
104#ifdef __BIG_ENDIAN
105 __swab32s(p);
106#endif
107}
108
109static inline void __cpu_to_le32s(__u32 *p)
110{
111#ifdef __BIG_ENDIAN
112 __swab32s(p);
113#endif
114}
115
116static inline void __le64_to_cpus(__u64 *p)
117{
118#ifdef __BIG_ENDIAN
119 __swab64s(p);
120#endif
121}
122
123static inline void __cpu_to_le64s(__u64 *p)
124{
125#ifdef __BIG_ENDIAN
126 __swab64s(p);
127#endif
128}
129
130static inline void __be16_to_cpus(__u16 *p)
131{
132#ifdef __LITTLE_ENDIAN
133 __swab16s(p);
134#endif
135}
136
137static inline void __cpu_to_be16s(__u16 *p)
138{
139#ifdef __LITTLE_ENDIAN
140 __swab16s(p);
141#endif
142}
143
144static inline void __be32_to_cpus(__u32 *p)
145{
146#ifdef __LITTLE_ENDIAN
147 __swab32s(p);
148#endif
149}
150
151static inline void __cpu_to_be32s(__u32 *p)
152{
153#ifdef __LITTLE_ENDIAN
154 __swab32s(p);
155#endif
156}
157
158static inline void __be64_to_cpus(__u64 *p)
159{
160#ifdef __LITTLE_ENDIAN
161 __swab64s(p);
162#endif
163}
164
165static inline void __cpu_to_be64s(__u64 *p)
166{
167#ifdef __LITTLE_ENDIAN
168 __swab64s(p);
169#endif
170}
171
172static inline __u16 __le16_to_cpup(const __le16 *p)
173{
174#ifdef __LITTLE_ENDIAN
175 return (__force __u16)*p;
176#else
177 return __swab16p((__force __u16 *)p);
178#endif
179}
180
181static inline __u32 __le32_to_cpup(const __le32 *p)
182{
183#ifdef __LITTLE_ENDIAN
184 return (__force __u32)*p;
185#else
186 return __swab32p((__force __u32 *)p);
187#endif
188}
189
190static inline __u64 __le64_to_cpup(const __le64 *p)
191{
192#ifdef __LITTLE_ENDIAN
193 return (__force __u64)*p;
194#else
195 return __swab64p((__force __u64 *)p);
196#endif
197}
198
199static inline __le16 __cpu_to_le16p(const __u16 *p)
200{
201#ifdef __LITTLE_ENDIAN
202 return (__force __le16)*p;
203#else
204 return (__force __le16)__swab16p(p);
205#endif
206}
207
208static inline __le32 __cpu_to_le32p(const __u32 *p)
209{
210#ifdef __LITTLE_ENDIAN
211 return (__force __le32)*p;
212#else
213 return (__force __le32)__swab32p(p);
214#endif
215}
216
217static inline __le64 __cpu_to_le64p(const __u64 *p)
218{
219#ifdef __LITTLE_ENDIAN
220 return (__force __le64)*p;
221#else
222 return (__force __le64)__swab64p(p);
223#endif
224}
225
226static inline __u16 __be16_to_cpup(const __be16 *p)
227{
228#ifdef __BIG_ENDIAN
229 return (__force __u16)*p;
230#else
231 return __swab16p((__force __u16 *)p);
232#endif
233}
234
235static inline __u32 __be32_to_cpup(const __be32 *p)
236{
237#ifdef __BIG_ENDIAN
238 return (__force __u32)*p;
239#else
240 return __swab32p((__force __u32 *)p);
241#endif
242}
243
244static inline __u64 __be64_to_cpup(const __be64 *p)
245{
246#ifdef __BIG_ENDIAN
247 return (__force __u64)*p;
248#else
249 return __swab64p((__force __u64 *)p);
250#endif
251}
252
253static inline __be16 __cpu_to_be16p(const __u16 *p)
254{
255#ifdef __BIG_ENDIAN
256 return (__force __be16)*p;
257#else
258 return (__force __be16)__swab16p(p);
259#endif
260}
261
262static inline __be32 __cpu_to_be32p(const __u32 *p)
263{
264#ifdef __BIG_ENDIAN
265 return (__force __be32)*p;
266#else
267 return (__force __be32)__swab32p(p);
268#endif
269}
270
271static inline __be64 __cpu_to_be64p(const __u64 *p)
272{
273#ifdef __BIG_ENDIAN
274 return (__force __be64)*p;
275#else
276 return (__force __be64)__swab64p(p);
277#endif
278}
279
280#ifdef __KERNEL__
281
282# define le16_to_cpu __le16_to_cpu
283# define le32_to_cpu __le32_to_cpu
284# define le64_to_cpu __le64_to_cpu
285# define be16_to_cpu __be16_to_cpu
286# define be32_to_cpu __be32_to_cpu
287# define be64_to_cpu __be64_to_cpu
288# define cpu_to_le16 __cpu_to_le16
289# define cpu_to_le32 __cpu_to_le32
290# define cpu_to_le64 __cpu_to_le64
291# define cpu_to_be16 __cpu_to_be16
292# define cpu_to_be32 __cpu_to_be32
293# define cpu_to_be64 __cpu_to_be64
294
295# define le16_to_cpup __le16_to_cpup
296# define le32_to_cpup __le32_to_cpup
297# define le64_to_cpup __le64_to_cpup
298# define be16_to_cpup __be16_to_cpup
299# define be32_to_cpup __be32_to_cpup
300# define be64_to_cpup __be64_to_cpup
301# define cpu_to_le16p __cpu_to_le16p
302# define cpu_to_le32p __cpu_to_le32p
303# define cpu_to_le64p __cpu_to_le64p
304# define cpu_to_be16p __cpu_to_be16p
305# define cpu_to_be32p __cpu_to_be32p
306# define cpu_to_be64p __cpu_to_be64p
307
308# define le16_to_cpus __le16_to_cpus
309# define le32_to_cpus __le32_to_cpus
310# define le64_to_cpus __le64_to_cpus
311# define be16_to_cpus __be16_to_cpus
312# define be32_to_cpus __be32_to_cpus
313# define be64_to_cpus __be64_to_cpus
314# define cpu_to_le16s __cpu_to_le16s
315# define cpu_to_le32s __cpu_to_le32s
316# define cpu_to_le64s __cpu_to_le64s
317# define cpu_to_be16s __cpu_to_be16s
318# define cpu_to_be32s __cpu_to_be32s
319# define cpu_to_be64s __cpu_to_be64s
320
321/*
322 * They have to be macros in order to do the constant folding
323 * correctly - if the argument passed into a inline function
324 * it is no longer constant according to gcc..
325 */
326# undef ntohl
327# undef ntohs
328# undef htonl
329# undef htons
330
331# define ___htonl(x) __cpu_to_be32(x)
332# define ___htons(x) __cpu_to_be16(x)
333# define ___ntohl(x) __be32_to_cpu(x)
334# define ___ntohs(x) __be16_to_cpu(x)
335
336# define htonl(x) ___htonl(x)
337# define ntohl(x) ___ntohl(x)
338# define htons(x) ___htons(x)
339# define ntohs(x) ___ntohs(x)
340
341static inline void le16_add_cpu(__le16 *var, u16 val)
342{
343 *var = cpu_to_le16(le16_to_cpup(var) + val);
344}
345
346static inline void le32_add_cpu(__le32 *var, u32 val)
347{
348 *var = cpu_to_le32(le32_to_cpup(var) + val);
349}
350
351static inline void le64_add_cpu(__le64 *var, u64 val)
352{
353 *var = cpu_to_le64(le64_to_cpup(var) + val);
354}
355
356static inline void be16_add_cpu(__be16 *var, u16 val)
357{
358 *var = cpu_to_be16(be16_to_cpup(var) + val);
359}
360
361static inline void be32_add_cpu(__be32 *var, u32 val)
362{
363 *var = cpu_to_be32(be32_to_cpup(var) + val);
364}
365
366static inline void be64_add_cpu(__be64 *var, u64 val)
367{
368 *var = cpu_to_be64(be64_to_cpup(var) + val);
369}
370
371#endif /* __KERNEL__ */
372#endif /* _LINUX_BYTEORDER_H */
diff --git a/include/linux/byteorder/Kbuild b/include/linux/byteorder/Kbuild
index fbaa7f9cee32..38437225b092 100644
--- a/include/linux/byteorder/Kbuild
+++ b/include/linux/byteorder/Kbuild
@@ -1,4 +1,2 @@
1unifdef-y += big_endian.h 1unifdef-y += big_endian.h
2unifdef-y += little_endian.h 2unifdef-y += little_endian.h
3unifdef-y += swab.h
4unifdef-y += swabb.h
diff --git a/include/linux/byteorder/big_endian.h b/include/linux/byteorder/big_endian.h
index 1cba3f3efe5f..3c80fd7e8b56 100644
--- a/include/linux/byteorder/big_endian.h
+++ b/include/linux/byteorder/big_endian.h
@@ -9,8 +9,7 @@
9#endif 9#endif
10 10
11#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/byteorder/swab.h> 12#include <linux/swab.h>
13#include <linux/byteorder/swabb.h>
14 13
15#define __constant_htonl(x) ((__force __be32)(__u32)(x)) 14#define __constant_htonl(x) ((__force __be32)(__u32)(x))
16#define __constant_ntohl(x) ((__force __u32)(__be32)(x)) 15#define __constant_ntohl(x) ((__force __u32)(__be32)(x))
diff --git a/include/linux/byteorder/little_endian.h b/include/linux/byteorder/little_endian.h
index cedc1b5a289c..83195fb82962 100644
--- a/include/linux/byteorder/little_endian.h
+++ b/include/linux/byteorder/little_endian.h
@@ -9,8 +9,7 @@
9#endif 9#endif
10 10
11#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/byteorder/swab.h> 12#include <linux/swab.h>
13#include <linux/byteorder/swabb.h>
14 13
15#define __constant_htonl(x) ((__force __be32)___constant_swab32((x))) 14#define __constant_htonl(x) ((__force __be32)___constant_swab32((x)))
16#define __constant_ntohl(x) ___constant_swab32((__force __be32)(x)) 15#define __constant_ntohl(x) ___constant_swab32((__force __be32)(x))
diff --git a/include/linux/byteorder/swab.h b/include/linux/byteorder/swab.h
deleted file mode 100644
index 142134ff1645..000000000000
--- a/include/linux/byteorder/swab.h
+++ /dev/null
@@ -1,222 +0,0 @@
1#ifndef _LINUX_BYTEORDER_SWAB_H
2#define _LINUX_BYTEORDER_SWAB_H
3
4/*
5 * linux/byteorder/swab.h
6 * Byte-swapping, independently from CPU endianness
7 * swabXX[ps]?(foo)
8 *
9 * Francois-Rene Rideau <fare@tunes.org> 19971205
10 * separated swab functions from cpu_to_XX,
11 * to clean up support for bizarre-endian architectures.
12 *
13 * Trent Piepho <xyzzy@speakeasy.org> 2007114
14 * make constant-folding work, provide C versions that
15 * gcc can optimize better, explain different versions
16 *
17 * See asm-i386/byteorder.h and suches for examples of how to provide
18 * architecture-dependent optimized versions
19 *
20 */
21
22#include <linux/compiler.h>
23
24/* Functions/macros defined, there are a lot:
25 *
26 * ___swabXX
27 * Generic C versions of the swab functions.
28 *
29 * ___constant_swabXX
30 * C versions that gcc can fold into a compile-time constant when
31 * the argument is a compile-time constant.
32 *
33 * __arch__swabXX[sp]?
34 * Architecture optimized versions of all the swab functions
35 * (including the s and p versions). These can be defined in
36 * asm-arch/byteorder.h. Any which are not, are defined here.
37 * __arch__swabXXs() is defined in terms of __arch__swabXXp(), which
38 * is defined in terms of __arch__swabXX(), which is in turn defined
39 * in terms of ___swabXX(x).
40 * These must be macros. They may be unsafe for arguments with
41 * side-effects.
42 *
43 * __fswabXX
44 * Inline function versions of the __arch__ macros. These _are_ safe
45 * if the arguments have side-effects. Note there are no s and p
46 * versions of these.
47 *
48 * __swabXX[sb]
49 * There are the ones you should actually use. The __swabXX versions
50 * will be a constant given a constant argument and use the arch
51 * specific code (if any) for non-constant arguments. The s and p
52 * versions always use the arch specific code (constant folding
53 * doesn't apply). They are safe to use with arguments with
54 * side-effects.
55 *
56 * swabXX[sb]
57 * Nicknames for __swabXX[sb] to use in the kernel.
58 */
59
60/* casts are necessary for constants, because we never know how for sure
61 * how U/UL/ULL map to __u16, __u32, __u64. At least not in a portable way.
62 */
63
64static __inline__ __attribute_const__ __u16 ___swab16(__u16 x)
65{
66 return x<<8 | x>>8;
67}
68static __inline__ __attribute_const__ __u32 ___swab32(__u32 x)
69{
70 return x<<24 | x>>24 |
71 (x & (__u32)0x0000ff00UL)<<8 |
72 (x & (__u32)0x00ff0000UL)>>8;
73}
74static __inline__ __attribute_const__ __u64 ___swab64(__u64 x)
75{
76 return x<<56 | x>>56 |
77 (x & (__u64)0x000000000000ff00ULL)<<40 |
78 (x & (__u64)0x0000000000ff0000ULL)<<24 |
79 (x & (__u64)0x00000000ff000000ULL)<< 8 |
80 (x & (__u64)0x000000ff00000000ULL)>> 8 |
81 (x & (__u64)0x0000ff0000000000ULL)>>24 |
82 (x & (__u64)0x00ff000000000000ULL)>>40;
83}
84
85#define ___constant_swab16(x) \
86 ((__u16)( \
87 (((__u16)(x) & (__u16)0x00ffU) << 8) | \
88 (((__u16)(x) & (__u16)0xff00U) >> 8) ))
89#define ___constant_swab32(x) \
90 ((__u32)( \
91 (((__u32)(x) & (__u32)0x000000ffUL) << 24) | \
92 (((__u32)(x) & (__u32)0x0000ff00UL) << 8) | \
93 (((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | \
94 (((__u32)(x) & (__u32)0xff000000UL) >> 24) ))
95#define ___constant_swab64(x) \
96 ((__u64)( \
97 (__u64)(((__u64)(x) & (__u64)0x00000000000000ffULL) << 56) | \
98 (__u64)(((__u64)(x) & (__u64)0x000000000000ff00ULL) << 40) | \
99 (__u64)(((__u64)(x) & (__u64)0x0000000000ff0000ULL) << 24) | \
100 (__u64)(((__u64)(x) & (__u64)0x00000000ff000000ULL) << 8) | \
101 (__u64)(((__u64)(x) & (__u64)0x000000ff00000000ULL) >> 8) | \
102 (__u64)(((__u64)(x) & (__u64)0x0000ff0000000000ULL) >> 24) | \
103 (__u64)(((__u64)(x) & (__u64)0x00ff000000000000ULL) >> 40) | \
104 (__u64)(((__u64)(x) & (__u64)0xff00000000000000ULL) >> 56) ))
105
106/*
107 * provide defaults when no architecture-specific optimization is detected
108 */
109#ifndef __arch__swab16
110# define __arch__swab16(x) ___swab16(x)
111#endif
112#ifndef __arch__swab32
113# define __arch__swab32(x) ___swab32(x)
114#endif
115#ifndef __arch__swab64
116# define __arch__swab64(x) ___swab64(x)
117#endif
118
119#ifndef __arch__swab16p
120# define __arch__swab16p(x) __arch__swab16(*(x))
121#endif
122#ifndef __arch__swab32p
123# define __arch__swab32p(x) __arch__swab32(*(x))
124#endif
125#ifndef __arch__swab64p
126# define __arch__swab64p(x) __arch__swab64(*(x))
127#endif
128
129#ifndef __arch__swab16s
130# define __arch__swab16s(x) ((void)(*(x) = __arch__swab16p(x)))
131#endif
132#ifndef __arch__swab32s
133# define __arch__swab32s(x) ((void)(*(x) = __arch__swab32p(x)))
134#endif
135#ifndef __arch__swab64s
136# define __arch__swab64s(x) ((void)(*(x) = __arch__swab64p(x)))
137#endif
138
139
140/*
141 * Allow constant folding
142 */
143#if defined(__GNUC__) && defined(__OPTIMIZE__)
144# define __swab16(x) \
145(__builtin_constant_p((__u16)(x)) ? \
146 ___constant_swab16((x)) : \
147 __fswab16((x)))
148# define __swab32(x) \
149(__builtin_constant_p((__u32)(x)) ? \
150 ___constant_swab32((x)) : \
151 __fswab32((x)))
152# define __swab64(x) \
153(__builtin_constant_p((__u64)(x)) ? \
154 ___constant_swab64((x)) : \
155 __fswab64((x)))
156#else
157# define __swab16(x) __fswab16(x)
158# define __swab32(x) __fswab32(x)
159# define __swab64(x) __fswab64(x)
160#endif /* OPTIMIZE */
161
162
163static __inline__ __attribute_const__ __u16 __fswab16(__u16 x)
164{
165 return __arch__swab16(x);
166}
167static __inline__ __u16 __swab16p(const __u16 *x)
168{
169 return __arch__swab16p(x);
170}
171static __inline__ void __swab16s(__u16 *addr)
172{
173 __arch__swab16s(addr);
174}
175
176static __inline__ __attribute_const__ __u32 __fswab32(__u32 x)
177{
178 return __arch__swab32(x);
179}
180static __inline__ __u32 __swab32p(const __u32 *x)
181{
182 return __arch__swab32p(x);
183}
184static __inline__ void __swab32s(__u32 *addr)
185{
186 __arch__swab32s(addr);
187}
188
189#ifdef __BYTEORDER_HAS_U64__
190static __inline__ __attribute_const__ __u64 __fswab64(__u64 x)
191{
192# ifdef __SWAB_64_THRU_32__
193 __u32 h = x >> 32;
194 __u32 l = x & ((1ULL<<32)-1);
195 return (((__u64)__swab32(l)) << 32) | ((__u64)(__swab32(h)));
196# else
197 return __arch__swab64(x);
198# endif
199}
200static __inline__ __u64 __swab64p(const __u64 *x)
201{
202 return __arch__swab64p(x);
203}
204static __inline__ void __swab64s(__u64 *addr)
205{
206 __arch__swab64s(addr);
207}
208#endif /* __BYTEORDER_HAS_U64__ */
209
210#if defined(__KERNEL__)
211#define swab16 __swab16
212#define swab32 __swab32
213#define swab64 __swab64
214#define swab16p __swab16p
215#define swab32p __swab32p
216#define swab64p __swab64p
217#define swab16s __swab16s
218#define swab32s __swab32s
219#define swab64s __swab64s
220#endif
221
222#endif /* _LINUX_BYTEORDER_SWAB_H */
diff --git a/include/linux/byteorder/swabb.h b/include/linux/byteorder/swabb.h
deleted file mode 100644
index 8c780c7d779e..000000000000
--- a/include/linux/byteorder/swabb.h
+++ /dev/null
@@ -1,135 +0,0 @@
1#ifndef _LINUX_BYTEORDER_SWABB_H
2#define _LINUX_BYTEORDER_SWABB_H
3
4/*
5 * linux/byteorder/swabb.h
6 * SWAp Bytes Bizarrely
7 * swaHHXX[ps]?(foo)
8 *
9 * Support for obNUXIous pdp-endian and other bizarre architectures.
10 * Will Linux ever run on such ancient beasts? if not, this file
11 * will be but a programming pearl. Still, it's a reminder that we
12 * shouldn't be making too many assumptions when trying to be portable.
13 *
14 */
15
16/*
17 * Meaning of the names I chose (vaxlinux people feel free to correct them):
18 * swahw32 swap 16-bit half-words in a 32-bit word
19 * swahb32 swap 8-bit halves of each 16-bit half-word in a 32-bit word
20 *
21 * No 64-bit support yet. I don't know NUXI conventions for long longs.
22 * I guarantee it will be a mess when it's there, though :->
23 * It will be even worse if there are conflicting 64-bit conventions.
24 * Hopefully, no one ever used 64-bit objects on NUXI machines.
25 *
26 */
27
28#include <linux/types.h>
29
30#define ___swahw32(x) \
31({ \
32 __u32 __x = (x); \
33 ((__u32)( \
34 (((__u32)(__x) & (__u32)0x0000ffffUL) << 16) | \
35 (((__u32)(__x) & (__u32)0xffff0000UL) >> 16) )); \
36})
37#define ___swahb32(x) \
38({ \
39 __u32 __x = (x); \
40 ((__u32)( \
41 (((__u32)(__x) & (__u32)0x00ff00ffUL) << 8) | \
42 (((__u32)(__x) & (__u32)0xff00ff00UL) >> 8) )); \
43})
44
45#define ___constant_swahw32(x) \
46 ((__u32)( \
47 (((__u32)(x) & (__u32)0x0000ffffUL) << 16) | \
48 (((__u32)(x) & (__u32)0xffff0000UL) >> 16) ))
49#define ___constant_swahb32(x) \
50 ((__u32)( \
51 (((__u32)(x) & (__u32)0x00ff00ffUL) << 8) | \
52 (((__u32)(x) & (__u32)0xff00ff00UL) >> 8) ))
53
54/*
55 * provide defaults when no architecture-specific optimization is detected
56 */
57#ifndef __arch__swahw32
58# define __arch__swahw32(x) ___swahw32(x)
59#endif
60#ifndef __arch__swahb32
61# define __arch__swahb32(x) ___swahb32(x)
62#endif
63
64#ifndef __arch__swahw32p
65# define __arch__swahw32p(x) __swahw32(*(x))
66#endif
67#ifndef __arch__swahb32p
68# define __arch__swahb32p(x) __swahb32(*(x))
69#endif
70
71#ifndef __arch__swahw32s
72# define __arch__swahw32s(x) do { *(x) = __swahw32p((x)); } while (0)
73#endif
74#ifndef __arch__swahb32s
75# define __arch__swahb32s(x) do { *(x) = __swahb32p((x)); } while (0)
76#endif
77
78
79/*
80 * Allow constant folding
81 */
82#define __swahw32(x) \
83(__builtin_constant_p((__u32)(x)) ? \
84 ___swahw32((x)) : \
85 __fswahw32((x)))
86#define __swahb32(x) \
87(__builtin_constant_p((__u32)(x)) ? \
88 ___swahb32((x)) : \
89 __fswahb32((x)))
90
91
92static inline __u32 __fswahw32(__u32 x)
93{
94 return __arch__swahw32(x);
95}
96
97static inline __u32 __swahw32p(__u32 *x)
98{
99 return __arch__swahw32p(x);
100}
101
102static inline void __swahw32s(__u32 *addr)
103{
104 __arch__swahw32s(addr);
105}
106
107static inline __u32 __fswahb32(__u32 x)
108{
109 return __arch__swahb32(x);
110}
111
112static inline __u32 __swahb32p(__u32 *x)
113{
114 return __arch__swahb32p(x);
115}
116
117static inline void __swahb32s(__u32 *addr)
118{
119 __arch__swahb32s(addr);
120}
121
122#ifdef __BYTEORDER_HAS_U64__
123/*
124 * Not supported yet
125 */
126#endif /* __BYTEORDER_HAS_U64__ */
127
128#define swahw32 __swahw32
129#define swahb32 __swahb32
130#define swahw32p __swahw32p
131#define swahb32p __swahb32p
132#define swahw32s __swahw32s
133#define swahb32s __swahb32s
134
135#endif /* _LINUX_BYTEORDER_SWABB_H */
diff --git a/include/linux/can/core.h b/include/linux/can/core.h
index f50785ad4781..25085cbadcfc 100644
--- a/include/linux/can/core.h
+++ b/include/linux/can/core.h
@@ -19,7 +19,7 @@
19#include <linux/skbuff.h> 19#include <linux/skbuff.h>
20#include <linux/netdevice.h> 20#include <linux/netdevice.h>
21 21
22#define CAN_VERSION "20081130" 22#define CAN_VERSION "20090105"
23 23
24/* increment this number each time you change some user-space interface */ 24/* increment this number each time you change some user-space interface */
25#define CAN_ABI_VERSION "8" 25#define CAN_ABI_VERSION "8"
diff --git a/include/linux/capability.h b/include/linux/capability.h
index e22f48c2a46f..02bdb768d43b 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -529,8 +529,21 @@ extern const kernel_cap_t __cap_init_eff_set;
529 * 529 *
530 * Note that this does not set PF_SUPERPRIV on the task. 530 * Note that this does not set PF_SUPERPRIV on the task.
531 */ 531 */
532#define has_capability(t, cap) (security_capable((t), (cap)) == 0) 532#define has_capability(t, cap) (security_real_capable((t), (cap)) == 0)
533#define has_capability_noaudit(t, cap) (security_capable_noaudit((t), (cap)) == 0) 533
534/**
535 * has_capability_noaudit - Determine if a task has a superior capability available (unaudited)
536 * @t: The task in question
537 * @cap: The capability to be tested for
538 *
539 * Return true if the specified task has the given superior capability
540 * currently in effect, false if not, but don't write an audit message for the
541 * check.
542 *
543 * Note that this does not set PF_SUPERPRIV on the task.
544 */
545#define has_capability_noaudit(t, cap) \
546 (security_real_capable_noaudit((t), (cap)) == 0)
534 547
535extern int capable(int cap); 548extern int capable(int cap);
536 549
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 1164963c3a85..e267e62827bb 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -52,9 +52,9 @@ struct cgroup_subsys_state {
52 * hierarchy structure */ 52 * hierarchy structure */
53 struct cgroup *cgroup; 53 struct cgroup *cgroup;
54 54
55 /* State maintained by the cgroup system to allow 55 /* State maintained by the cgroup system to allow subsystems
56 * subsystems to be "busy". Should be accessed via css_get() 56 * to be "busy". Should be accessed via css_get(),
57 * and css_put() */ 57 * css_tryget() and and css_put(). */
58 58
59 atomic_t refcnt; 59 atomic_t refcnt;
60 60
@@ -64,11 +64,14 @@ struct cgroup_subsys_state {
64/* bits in struct cgroup_subsys_state flags field */ 64/* bits in struct cgroup_subsys_state flags field */
65enum { 65enum {
66 CSS_ROOT, /* This CSS is the root of the subsystem */ 66 CSS_ROOT, /* This CSS is the root of the subsystem */
67 CSS_REMOVED, /* This CSS is dead */
67}; 68};
68 69
69/* 70/*
70 * Call css_get() to hold a reference on the cgroup; 71 * Call css_get() to hold a reference on the css; it can be used
71 * 72 * for a reference obtained via:
73 * - an existing ref-counted reference to the css
74 * - task->cgroups for a locked task
72 */ 75 */
73 76
74static inline void css_get(struct cgroup_subsys_state *css) 77static inline void css_get(struct cgroup_subsys_state *css)
@@ -77,9 +80,32 @@ static inline void css_get(struct cgroup_subsys_state *css)
77 if (!test_bit(CSS_ROOT, &css->flags)) 80 if (!test_bit(CSS_ROOT, &css->flags))
78 atomic_inc(&css->refcnt); 81 atomic_inc(&css->refcnt);
79} 82}
83
84static inline bool css_is_removed(struct cgroup_subsys_state *css)
85{
86 return test_bit(CSS_REMOVED, &css->flags);
87}
88
89/*
90 * Call css_tryget() to take a reference on a css if your existing
91 * (known-valid) reference isn't already ref-counted. Returns false if
92 * the css has been destroyed.
93 */
94
95static inline bool css_tryget(struct cgroup_subsys_state *css)
96{
97 if (test_bit(CSS_ROOT, &css->flags))
98 return true;
99 while (!atomic_inc_not_zero(&css->refcnt)) {
100 if (test_bit(CSS_REMOVED, &css->flags))
101 return false;
102 }
103 return true;
104}
105
80/* 106/*
81 * css_put() should be called to release a reference taken by 107 * css_put() should be called to release a reference taken by
82 * css_get() 108 * css_get() or css_tryget()
83 */ 109 */
84 110
85extern void __css_put(struct cgroup_subsys_state *css); 111extern void __css_put(struct cgroup_subsys_state *css);
@@ -116,7 +142,7 @@ struct cgroup {
116 struct list_head children; /* my children */ 142 struct list_head children; /* my children */
117 143
118 struct cgroup *parent; /* my parent */ 144 struct cgroup *parent; /* my parent */
119 struct dentry *dentry; /* cgroup fs entry */ 145 struct dentry *dentry; /* cgroup fs entry, RCU protected */
120 146
121 /* Private pointers for each registered subsystem */ 147 /* Private pointers for each registered subsystem */
122 struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT]; 148 struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT];
@@ -145,6 +171,9 @@ struct cgroup {
145 int pids_use_count; 171 int pids_use_count;
146 /* Length of the current tasks_pids array */ 172 /* Length of the current tasks_pids array */
147 int pids_length; 173 int pids_length;
174
175 /* For RCU-protected deletion */
176 struct rcu_head rcu_head;
148}; 177};
149 178
150/* A css_set is a structure holding pointers to a set of 179/* A css_set is a structure holding pointers to a set of
@@ -329,13 +358,7 @@ struct cgroup_subsys {
329 struct cgroup *cgrp); 358 struct cgroup *cgrp);
330 void (*post_clone)(struct cgroup_subsys *ss, struct cgroup *cgrp); 359 void (*post_clone)(struct cgroup_subsys *ss, struct cgroup *cgrp);
331 void (*bind)(struct cgroup_subsys *ss, struct cgroup *root); 360 void (*bind)(struct cgroup_subsys *ss, struct cgroup *root);
332 /* 361
333 * This routine is called with the task_lock of mm->owner held
334 */
335 void (*mm_owner_changed)(struct cgroup_subsys *ss,
336 struct cgroup *old,
337 struct cgroup *new,
338 struct task_struct *p);
339 int subsys_id; 362 int subsys_id;
340 int active; 363 int active;
341 int disabled; 364 int disabled;
@@ -343,9 +366,23 @@ struct cgroup_subsys {
343#define MAX_CGROUP_TYPE_NAMELEN 32 366#define MAX_CGROUP_TYPE_NAMELEN 32
344 const char *name; 367 const char *name;
345 368
346 /* Protected by RCU */ 369 /*
347 struct cgroupfs_root *root; 370 * Protects sibling/children links of cgroups in this
371 * hierarchy, plus protects which hierarchy (or none) the
372 * subsystem is a part of (i.e. root/sibling). To avoid
373 * potential deadlocks, the following operations should not be
374 * undertaken while holding any hierarchy_mutex:
375 *
376 * - allocating memory
377 * - initiating hotplug events
378 */
379 struct mutex hierarchy_mutex;
348 380
381 /*
382 * Link to parent, and list entry in parent's children.
383 * Protected by this->hierarchy_mutex and cgroup_lock()
384 */
385 struct cgroupfs_root *root;
349 struct list_head sibling; 386 struct list_head sibling;
350}; 387};
351 388
@@ -400,9 +437,6 @@ void cgroup_iter_end(struct cgroup *cgrp, struct cgroup_iter *it);
400int cgroup_scan_tasks(struct cgroup_scanner *scan); 437int cgroup_scan_tasks(struct cgroup_scanner *scan);
401int cgroup_attach_task(struct cgroup *, struct task_struct *); 438int cgroup_attach_task(struct cgroup *, struct task_struct *);
402 439
403void cgroup_mm_owner_callbacks(struct task_struct *old,
404 struct task_struct *new);
405
406#else /* !CONFIG_CGROUPS */ 440#else /* !CONFIG_CGROUPS */
407 441
408static inline int cgroup_init_early(void) { return 0; } 442static inline int cgroup_init_early(void) { return 0; }
@@ -420,9 +454,6 @@ static inline int cgroupstats_build(struct cgroupstats *stats,
420 return -EINVAL; 454 return -EINVAL;
421} 455}
422 456
423static inline void cgroup_mm_owner_callbacks(struct task_struct *old,
424 struct task_struct *new) {}
425
426#endif /* !CONFIG_CGROUPS */ 457#endif /* !CONFIG_CGROUPS */
427 458
428#endif /* _LINUX_CGROUP_H */ 459#endif /* _LINUX_CGROUP_H */
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 1ee608fd7b77..484b3abf61bb 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -234,6 +234,7 @@ struct cpufreq_driver {
234 int (*suspend) (struct cpufreq_policy *policy, pm_message_t pmsg); 234 int (*suspend) (struct cpufreq_policy *policy, pm_message_t pmsg);
235 int (*resume) (struct cpufreq_policy *policy); 235 int (*resume) (struct cpufreq_policy *policy);
236 struct freq_attr **attr; 236 struct freq_attr **attr;
237 bool hide_interface;
237}; 238};
238 239
239/* flags */ 240/* flags */
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 8e540d32c9fe..90c6074a36ca 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -20,8 +20,9 @@ extern int number_of_cpusets; /* How many cpusets are defined in system? */
20extern int cpuset_init_early(void); 20extern int cpuset_init_early(void);
21extern int cpuset_init(void); 21extern int cpuset_init(void);
22extern void cpuset_init_smp(void); 22extern void cpuset_init_smp(void);
23extern void cpuset_cpus_allowed(struct task_struct *p, cpumask_t *mask); 23extern void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask);
24extern void cpuset_cpus_allowed_locked(struct task_struct *p, cpumask_t *mask); 24extern void cpuset_cpus_allowed_locked(struct task_struct *p,
25 struct cpumask *mask);
25extern nodemask_t cpuset_mems_allowed(struct task_struct *p); 26extern nodemask_t cpuset_mems_allowed(struct task_struct *p);
26#define cpuset_current_mems_allowed (current->mems_allowed) 27#define cpuset_current_mems_allowed (current->mems_allowed)
27void cpuset_init_current_mems_allowed(void); 28void cpuset_init_current_mems_allowed(void);
@@ -78,18 +79,21 @@ extern int current_cpuset_is_being_rebound(void);
78 79
79extern void rebuild_sched_domains(void); 80extern void rebuild_sched_domains(void);
80 81
82extern void cpuset_print_task_mems_allowed(struct task_struct *p);
83
81#else /* !CONFIG_CPUSETS */ 84#else /* !CONFIG_CPUSETS */
82 85
83static inline int cpuset_init_early(void) { return 0; } 86static inline int cpuset_init_early(void) { return 0; }
84static inline int cpuset_init(void) { return 0; } 87static inline int cpuset_init(void) { return 0; }
85static inline void cpuset_init_smp(void) {} 88static inline void cpuset_init_smp(void) {}
86 89
87static inline void cpuset_cpus_allowed(struct task_struct *p, cpumask_t *mask) 90static inline void cpuset_cpus_allowed(struct task_struct *p,
91 struct cpumask *mask)
88{ 92{
89 *mask = cpu_possible_map; 93 *mask = cpu_possible_map;
90} 94}
91static inline void cpuset_cpus_allowed_locked(struct task_struct *p, 95static inline void cpuset_cpus_allowed_locked(struct task_struct *p,
92 cpumask_t *mask) 96 struct cpumask *mask)
93{ 97{
94 *mask = cpu_possible_map; 98 *mask = cpu_possible_map;
95} 99}
@@ -159,6 +163,10 @@ static inline void rebuild_sched_domains(void)
159 partition_sched_domains(1, NULL, NULL); 163 partition_sched_domains(1, NULL, NULL);
160} 164}
161 165
166static inline void cpuset_print_task_mems_allowed(struct task_struct *p)
167{
168}
169
162#endif /* !CONFIG_CPUSETS */ 170#endif /* !CONFIG_CPUSETS */
163 171
164#endif /* _LINUX_CPUSET_H */ 172#endif /* _LINUX_CPUSET_H */
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index e1a6c046cea3..23936b16426b 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -63,6 +63,8 @@ struct dentry *debugfs_create_x16(const char *name, mode_t mode,
63 struct dentry *parent, u16 *value); 63 struct dentry *parent, u16 *value);
64struct dentry *debugfs_create_x32(const char *name, mode_t mode, 64struct dentry *debugfs_create_x32(const char *name, mode_t mode,
65 struct dentry *parent, u32 *value); 65 struct dentry *parent, u32 *value);
66struct dentry *debugfs_create_size_t(const char *name, mode_t mode,
67 struct dentry *parent, size_t *value);
66struct dentry *debugfs_create_bool(const char *name, mode_t mode, 68struct dentry *debugfs_create_bool(const char *name, mode_t mode,
67 struct dentry *parent, u32 *value); 69 struct dentry *parent, u32 *value);
68 70
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index c17fd334e574..8209e08969f9 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -45,6 +45,8 @@ typedef void (*dm_dtr_fn) (struct dm_target *ti);
45 */ 45 */
46typedef int (*dm_map_fn) (struct dm_target *ti, struct bio *bio, 46typedef int (*dm_map_fn) (struct dm_target *ti, struct bio *bio,
47 union map_info *map_context); 47 union map_info *map_context);
48typedef int (*dm_map_request_fn) (struct dm_target *ti, struct request *clone,
49 union map_info *map_context);
48 50
49/* 51/*
50 * Returns: 52 * Returns:
@@ -57,6 +59,9 @@ typedef int (*dm_map_fn) (struct dm_target *ti, struct bio *bio,
57typedef int (*dm_endio_fn) (struct dm_target *ti, 59typedef int (*dm_endio_fn) (struct dm_target *ti,
58 struct bio *bio, int error, 60 struct bio *bio, int error,
59 union map_info *map_context); 61 union map_info *map_context);
62typedef int (*dm_request_endio_fn) (struct dm_target *ti,
63 struct request *clone, int error,
64 union map_info *map_context);
60 65
61typedef void (*dm_flush_fn) (struct dm_target *ti); 66typedef void (*dm_flush_fn) (struct dm_target *ti);
62typedef void (*dm_presuspend_fn) (struct dm_target *ti); 67typedef void (*dm_presuspend_fn) (struct dm_target *ti);
@@ -75,6 +80,13 @@ typedef int (*dm_ioctl_fn) (struct dm_target *ti, unsigned int cmd,
75typedef int (*dm_merge_fn) (struct dm_target *ti, struct bvec_merge_data *bvm, 80typedef int (*dm_merge_fn) (struct dm_target *ti, struct bvec_merge_data *bvm,
76 struct bio_vec *biovec, int max_size); 81 struct bio_vec *biovec, int max_size);
77 82
83/*
84 * Returns:
85 * 0: The target can handle the next I/O immediately.
86 * 1: The target can't handle the next I/O immediately.
87 */
88typedef int (*dm_busy_fn) (struct dm_target *ti);
89
78void dm_error(const char *message); 90void dm_error(const char *message);
79 91
80/* 92/*
@@ -100,14 +112,23 @@ void dm_put_device(struct dm_target *ti, struct dm_dev *d);
100/* 112/*
101 * Information about a target type 113 * Information about a target type
102 */ 114 */
115
116/*
117 * Target features
118 */
119#define DM_TARGET_SUPPORTS_BARRIERS 0x00000001
120
103struct target_type { 121struct target_type {
122 uint64_t features;
104 const char *name; 123 const char *name;
105 struct module *module; 124 struct module *module;
106 unsigned version[3]; 125 unsigned version[3];
107 dm_ctr_fn ctr; 126 dm_ctr_fn ctr;
108 dm_dtr_fn dtr; 127 dm_dtr_fn dtr;
109 dm_map_fn map; 128 dm_map_fn map;
129 dm_map_request_fn map_rq;
110 dm_endio_fn end_io; 130 dm_endio_fn end_io;
131 dm_request_endio_fn rq_end_io;
111 dm_flush_fn flush; 132 dm_flush_fn flush;
112 dm_presuspend_fn presuspend; 133 dm_presuspend_fn presuspend;
113 dm_postsuspend_fn postsuspend; 134 dm_postsuspend_fn postsuspend;
@@ -117,6 +138,7 @@ struct target_type {
117 dm_message_fn message; 138 dm_message_fn message;
118 dm_ioctl_fn ioctl; 139 dm_ioctl_fn ioctl;
119 dm_merge_fn merge; 140 dm_merge_fn merge;
141 dm_busy_fn busy;
120}; 142};
121 143
122struct io_restrictions { 144struct io_restrictions {
@@ -157,8 +179,7 @@ struct dm_target {
157}; 179};
158 180
159int dm_register_target(struct target_type *t); 181int dm_register_target(struct target_type *t);
160int dm_unregister_target(struct target_type *t); 182void dm_unregister_target(struct target_type *t);
161
162 183
163/*----------------------------------------------------------------- 184/*-----------------------------------------------------------------
164 * Functions for creating and manipulating mapped devices. 185 * Functions for creating and manipulating mapped devices.
@@ -276,6 +297,9 @@ void *dm_vcalloc(unsigned long nmemb, unsigned long elem_size);
276 *---------------------------------------------------------------*/ 297 *---------------------------------------------------------------*/
277#define DM_NAME "device-mapper" 298#define DM_NAME "device-mapper"
278 299
300#define DMCRIT(f, arg...) \
301 printk(KERN_CRIT DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg)
302
279#define DMERR(f, arg...) \ 303#define DMERR(f, arg...) \
280 printk(KERN_ERR DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg) 304 printk(KERN_ERR DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg)
281#define DMERR_LIMIT(f, arg...) \ 305#define DMERR_LIMIT(f, arg...) \
diff --git a/include/linux/device.h b/include/linux/device.h
index 1a3686d15f98..45e5b1921fbb 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -65,7 +65,7 @@ struct bus_type {
65 int (*resume_early)(struct device *dev); 65 int (*resume_early)(struct device *dev);
66 int (*resume)(struct device *dev); 66 int (*resume)(struct device *dev);
67 67
68 struct pm_ext_ops *pm; 68 struct dev_pm_ops *pm;
69 69
70 struct bus_type_private *p; 70 struct bus_type_private *p;
71}; 71};
@@ -133,7 +133,7 @@ struct device_driver {
133 int (*resume) (struct device *dev); 133 int (*resume) (struct device *dev);
134 struct attribute_group **groups; 134 struct attribute_group **groups;
135 135
136 struct pm_ops *pm; 136 struct dev_pm_ops *pm;
137 137
138 struct driver_private *p; 138 struct driver_private *p;
139}; 139};
@@ -198,7 +198,7 @@ struct class {
198 int (*suspend)(struct device *dev, pm_message_t state); 198 int (*suspend)(struct device *dev, pm_message_t state);
199 int (*resume)(struct device *dev); 199 int (*resume)(struct device *dev);
200 200
201 struct pm_ops *pm; 201 struct dev_pm_ops *pm;
202 struct class_private *p; 202 struct class_private *p;
203}; 203};
204 204
@@ -291,7 +291,7 @@ struct device_type {
291 int (*suspend)(struct device *dev, pm_message_t state); 291 int (*suspend)(struct device *dev, pm_message_t state);
292 int (*resume)(struct device *dev); 292 int (*resume)(struct device *dev);
293 293
294 struct pm_ops *pm; 294 struct dev_pm_ops *pm;
295}; 295};
296 296
297/* interface for exporting device attributes */ 297/* interface for exporting device attributes */
@@ -373,9 +373,9 @@ struct device {
373 373
374 struct kobject kobj; 374 struct kobject kobj;
375 char bus_id[BUS_ID_SIZE]; /* position on parent bus */ 375 char bus_id[BUS_ID_SIZE]; /* position on parent bus */
376 unsigned uevent_suppress:1;
376 const char *init_name; /* initial name of the device */ 377 const char *init_name; /* initial name of the device */
377 struct device_type *type; 378 struct device_type *type;
378 unsigned uevent_suppress:1;
379 379
380 struct semaphore sem; /* semaphore to synchronize calls to 380 struct semaphore sem; /* semaphore to synchronize calls to
381 * its driver. 381 * its driver.
@@ -408,12 +408,13 @@ struct device {
408 /* arch specific additions */ 408 /* arch specific additions */
409 struct dev_archdata archdata; 409 struct dev_archdata archdata;
410 410
411 dev_t devt; /* dev_t, creates the sysfs "dev" */
412
411 spinlock_t devres_lock; 413 spinlock_t devres_lock;
412 struct list_head devres_head; 414 struct list_head devres_head;
413 415
414 struct klist_node knode_class; 416 struct klist_node knode_class;
415 struct class *class; 417 struct class *class;
416 dev_t devt; /* dev_t, creates the sysfs "dev" */
417 struct attribute_group **groups; /* optional groups */ 418 struct attribute_group **groups; /* optional groups */
418 419
419 void (*release)(struct device *dev); 420 void (*release)(struct device *dev);
@@ -483,6 +484,17 @@ extern int device_rename(struct device *dev, char *new_name);
483extern int device_move(struct device *dev, struct device *new_parent); 484extern int device_move(struct device *dev, struct device *new_parent);
484 485
485/* 486/*
487 * Root device objects for grouping under /sys/devices
488 */
489extern struct device *__root_device_register(const char *name,
490 struct module *owner);
491static inline struct device *root_device_register(const char *name)
492{
493 return __root_device_register(name, THIS_MODULE);
494}
495extern void root_device_unregister(struct device *root);
496
497/*
486 * Manual binding of a device to driver. See drivers/base/bus.c 498 * Manual binding of a device to driver. See drivers/base/bus.c
487 * for information on use. 499 * for information on use.
488 */ 500 */
@@ -553,13 +565,13 @@ extern const char *dev_driver_string(const struct device *dev);
553#define dev_info(dev, format, arg...) \ 565#define dev_info(dev, format, arg...) \
554 dev_printk(KERN_INFO , dev , format , ## arg) 566 dev_printk(KERN_INFO , dev , format , ## arg)
555 567
556#if defined(CONFIG_DYNAMIC_PRINTK_DEBUG) 568#if defined(DEBUG)
569#define dev_dbg(dev, format, arg...) \
570 dev_printk(KERN_DEBUG , dev , format , ## arg)
571#elif defined(CONFIG_DYNAMIC_PRINTK_DEBUG)
557#define dev_dbg(dev, format, ...) do { \ 572#define dev_dbg(dev, format, ...) do { \
558 dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \ 573 dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \
559 } while (0) 574 } while (0)
560#elif defined(DEBUG)
561#define dev_dbg(dev, format, arg...) \
562 dev_printk(KERN_DEBUG , dev , format , ## arg)
563#else 575#else
564#define dev_dbg(dev, format, arg...) \ 576#define dev_dbg(dev, format, arg...) \
565 ({ if (0) dev_printk(KERN_DEBUG, dev, format, ##arg); 0; }) 577 ({ if (0) dev_printk(KERN_DEBUG, dev, format, ##arg); 0; })
diff --git a/include/linux/dma_remapping.h b/include/linux/dma_remapping.h
index 136f170cecc2..af1dab41674b 100644
--- a/include/linux/dma_remapping.h
+++ b/include/linux/dma_remapping.h
@@ -17,7 +17,15 @@ struct dmar_domain;
17struct root_entry; 17struct root_entry;
18 18
19extern void free_dmar_iommu(struct intel_iommu *iommu); 19extern void free_dmar_iommu(struct intel_iommu *iommu);
20
21#ifdef CONFIG_DMAR
20extern int iommu_calculate_agaw(struct intel_iommu *iommu); 22extern int iommu_calculate_agaw(struct intel_iommu *iommu);
23#else
24static inline int iommu_calculate_agaw(struct intel_iommu *iommu)
25{
26 return 0;
27}
28#endif
21 29
22extern int dmar_disabled; 30extern int dmar_disabled;
23 31
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index adb0b084eb5a..64dea2ab326c 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -29,32 +29,6 @@
29#include <linux/dma-mapping.h> 29#include <linux/dma-mapping.h>
30 30
31/** 31/**
32 * enum dma_state - resource PNP/power management state
33 * @DMA_RESOURCE_SUSPEND: DMA device going into low power state
34 * @DMA_RESOURCE_RESUME: DMA device returning to full power
35 * @DMA_RESOURCE_AVAILABLE: DMA device available to the system
36 * @DMA_RESOURCE_REMOVED: DMA device removed from the system
37 */
38enum dma_state {
39 DMA_RESOURCE_SUSPEND,
40 DMA_RESOURCE_RESUME,
41 DMA_RESOURCE_AVAILABLE,
42 DMA_RESOURCE_REMOVED,
43};
44
45/**
46 * enum dma_state_client - state of the channel in the client
47 * @DMA_ACK: client would like to use, or was using this channel
48 * @DMA_DUP: client has already seen this channel, or is not using this channel
49 * @DMA_NAK: client does not want to see any more channels
50 */
51enum dma_state_client {
52 DMA_ACK,
53 DMA_DUP,
54 DMA_NAK,
55};
56
57/**
58 * typedef dma_cookie_t - an opaque DMA cookie 32 * typedef dma_cookie_t - an opaque DMA cookie
59 * 33 *
60 * if dma_cookie_t is >0 it's a DMA request cookie, <0 it's an error code 34 * if dma_cookie_t is >0 it's a DMA request cookie, <0 it's an error code
@@ -89,23 +63,13 @@ enum dma_transaction_type {
89 DMA_MEMSET, 63 DMA_MEMSET,
90 DMA_MEMCPY_CRC32C, 64 DMA_MEMCPY_CRC32C,
91 DMA_INTERRUPT, 65 DMA_INTERRUPT,
66 DMA_PRIVATE,
92 DMA_SLAVE, 67 DMA_SLAVE,
93}; 68};
94 69
95/* last transaction type for creation of the capabilities mask */ 70/* last transaction type for creation of the capabilities mask */
96#define DMA_TX_TYPE_END (DMA_SLAVE + 1) 71#define DMA_TX_TYPE_END (DMA_SLAVE + 1)
97 72
98/**
99 * enum dma_slave_width - DMA slave register access width.
100 * @DMA_SLAVE_WIDTH_8BIT: Do 8-bit slave register accesses
101 * @DMA_SLAVE_WIDTH_16BIT: Do 16-bit slave register accesses
102 * @DMA_SLAVE_WIDTH_32BIT: Do 32-bit slave register accesses
103 */
104enum dma_slave_width {
105 DMA_SLAVE_WIDTH_8BIT,
106 DMA_SLAVE_WIDTH_16BIT,
107 DMA_SLAVE_WIDTH_32BIT,
108};
109 73
110/** 74/**
111 * enum dma_ctrl_flags - DMA flags to augment operation preparation, 75 * enum dma_ctrl_flags - DMA flags to augment operation preparation,
@@ -132,32 +96,6 @@ enum dma_ctrl_flags {
132typedef struct { DECLARE_BITMAP(bits, DMA_TX_TYPE_END); } dma_cap_mask_t; 96typedef struct { DECLARE_BITMAP(bits, DMA_TX_TYPE_END); } dma_cap_mask_t;
133 97
134/** 98/**
135 * struct dma_slave - Information about a DMA slave
136 * @dev: device acting as DMA slave
137 * @dma_dev: required DMA master device. If non-NULL, the client can not be
138 * bound to other masters than this.
139 * @tx_reg: physical address of data register used for
140 * memory-to-peripheral transfers
141 * @rx_reg: physical address of data register used for
142 * peripheral-to-memory transfers
143 * @reg_width: peripheral register width
144 *
145 * If dma_dev is non-NULL, the client can not be bound to other DMA
146 * masters than the one corresponding to this device. The DMA master
147 * driver may use this to determine if there is controller-specific
148 * data wrapped around this struct. Drivers of platform code that sets
149 * the dma_dev field must therefore make sure to use an appropriate
150 * controller-specific dma slave structure wrapping this struct.
151 */
152struct dma_slave {
153 struct device *dev;
154 struct device *dma_dev;
155 dma_addr_t tx_reg;
156 dma_addr_t rx_reg;
157 enum dma_slave_width reg_width;
158};
159
160/**
161 * struct dma_chan_percpu - the per-CPU part of struct dma_chan 99 * struct dma_chan_percpu - the per-CPU part of struct dma_chan
162 * @refcount: local_t used for open-coded "bigref" counting 100 * @refcount: local_t used for open-coded "bigref" counting
163 * @memcpy_count: transaction counter 101 * @memcpy_count: transaction counter
@@ -165,7 +103,6 @@ struct dma_slave {
165 */ 103 */
166 104
167struct dma_chan_percpu { 105struct dma_chan_percpu {
168 local_t refcount;
169 /* stats */ 106 /* stats */
170 unsigned long memcpy_count; 107 unsigned long memcpy_count;
171 unsigned long bytes_transferred; 108 unsigned long bytes_transferred;
@@ -176,13 +113,14 @@ struct dma_chan_percpu {
176 * @device: ptr to the dma device who supplies this channel, always !%NULL 113 * @device: ptr to the dma device who supplies this channel, always !%NULL
177 * @cookie: last cookie value returned to client 114 * @cookie: last cookie value returned to client
178 * @chan_id: channel ID for sysfs 115 * @chan_id: channel ID for sysfs
179 * @class_dev: class device for sysfs 116 * @dev: class device for sysfs
180 * @refcount: kref, used in "bigref" slow-mode 117 * @refcount: kref, used in "bigref" slow-mode
181 * @slow_ref: indicates that the DMA channel is free 118 * @slow_ref: indicates that the DMA channel is free
182 * @rcu: the DMA channel's RCU head 119 * @rcu: the DMA channel's RCU head
183 * @device_node: used to add this to the device chan list 120 * @device_node: used to add this to the device chan list
184 * @local: per-cpu pointer to a struct dma_chan_percpu 121 * @local: per-cpu pointer to a struct dma_chan_percpu
185 * @client-count: how many clients are using this channel 122 * @client-count: how many clients are using this channel
123 * @table_count: number of appearances in the mem-to-mem allocation table
186 */ 124 */
187struct dma_chan { 125struct dma_chan {
188 struct dma_device *device; 126 struct dma_device *device;
@@ -190,73 +128,47 @@ struct dma_chan {
190 128
191 /* sysfs */ 129 /* sysfs */
192 int chan_id; 130 int chan_id;
193 struct device dev; 131 struct dma_chan_dev *dev;
194
195 struct kref refcount;
196 int slow_ref;
197 struct rcu_head rcu;
198 132
199 struct list_head device_node; 133 struct list_head device_node;
200 struct dma_chan_percpu *local; 134 struct dma_chan_percpu *local;
201 int client_count; 135 int client_count;
136 int table_count;
202}; 137};
203 138
204#define to_dma_chan(p) container_of(p, struct dma_chan, dev) 139/**
205 140 * struct dma_chan_dev - relate sysfs device node to backing channel device
206void dma_chan_cleanup(struct kref *kref); 141 * @chan - driver channel device
207 142 * @device - sysfs device
208static inline void dma_chan_get(struct dma_chan *chan) 143 * @dev_id - parent dma_device dev_id
209{ 144 * @idr_ref - reference count to gate release of dma_device dev_id
210 if (unlikely(chan->slow_ref)) 145 */
211 kref_get(&chan->refcount); 146struct dma_chan_dev {
212 else { 147 struct dma_chan *chan;
213 local_inc(&(per_cpu_ptr(chan->local, get_cpu())->refcount)); 148 struct device device;
214 put_cpu(); 149 int dev_id;
215 } 150 atomic_t *idr_ref;
216} 151};
217 152
218static inline void dma_chan_put(struct dma_chan *chan) 153static inline const char *dma_chan_name(struct dma_chan *chan)
219{ 154{
220 if (unlikely(chan->slow_ref)) 155 return dev_name(&chan->dev->device);
221 kref_put(&chan->refcount, dma_chan_cleanup);
222 else {
223 local_dec(&(per_cpu_ptr(chan->local, get_cpu())->refcount));
224 put_cpu();
225 }
226} 156}
227 157
228/* 158void dma_chan_cleanup(struct kref *kref);
229 * typedef dma_event_callback - function pointer to a DMA event callback
230 * For each channel added to the system this routine is called for each client.
231 * If the client would like to use the channel it returns '1' to signal (ack)
232 * the dmaengine core to take out a reference on the channel and its
233 * corresponding device. A client must not 'ack' an available channel more
234 * than once. When a channel is removed all clients are notified. If a client
235 * is using the channel it must 'ack' the removal. A client must not 'ack' a
236 * removed channel more than once.
237 * @client - 'this' pointer for the client context
238 * @chan - channel to be acted upon
239 * @state - available or removed
240 */
241struct dma_client;
242typedef enum dma_state_client (*dma_event_callback) (struct dma_client *client,
243 struct dma_chan *chan, enum dma_state state);
244 159
245/** 160/**
246 * struct dma_client - info on the entity making use of DMA services 161 * typedef dma_filter_fn - callback filter for dma_request_channel
247 * @event_callback: func ptr to call when something happens 162 * @chan: channel to be reviewed
248 * @cap_mask: only return channels that satisfy the requested capabilities 163 * @filter_param: opaque parameter passed through dma_request_channel
249 * a value of zero corresponds to any capability 164 *
250 * @slave: data for preparing slave transfer. Must be non-NULL iff the 165 * When this optional parameter is specified in a call to dma_request_channel a
251 * DMA_SLAVE capability is requested. 166 * suitable channel is passed to this routine for further dispositioning before
252 * @global_node: list_head for global dma_client_list 167 * being returned. Where 'suitable' indicates a non-busy channel that
168 * satisfies the given capability mask. It returns 'true' to indicate that the
169 * channel is suitable.
253 */ 170 */
254struct dma_client { 171typedef bool (*dma_filter_fn)(struct dma_chan *chan, void *filter_param);
255 dma_event_callback event_callback;
256 dma_cap_mask_t cap_mask;
257 struct dma_slave *slave;
258 struct list_head global_node;
259};
260 172
261typedef void (*dma_async_tx_callback)(void *dma_async_param); 173typedef void (*dma_async_tx_callback)(void *dma_async_param);
262/** 174/**
@@ -323,14 +235,10 @@ struct dma_device {
323 dma_cap_mask_t cap_mask; 235 dma_cap_mask_t cap_mask;
324 int max_xor; 236 int max_xor;
325 237
326 struct kref refcount;
327 struct completion done;
328
329 int dev_id; 238 int dev_id;
330 struct device *dev; 239 struct device *dev;
331 240
332 int (*device_alloc_chan_resources)(struct dma_chan *chan, 241 int (*device_alloc_chan_resources)(struct dma_chan *chan);
333 struct dma_client *client);
334 void (*device_free_chan_resources)(struct dma_chan *chan); 242 void (*device_free_chan_resources)(struct dma_chan *chan);
335 243
336 struct dma_async_tx_descriptor *(*device_prep_dma_memcpy)( 244 struct dma_async_tx_descriptor *(*device_prep_dma_memcpy)(
@@ -362,9 +270,8 @@ struct dma_device {
362 270
363/* --- public DMA engine API --- */ 271/* --- public DMA engine API --- */
364 272
365void dma_async_client_register(struct dma_client *client); 273void dmaengine_get(void);
366void dma_async_client_unregister(struct dma_client *client); 274void dmaengine_put(void);
367void dma_async_client_chan_request(struct dma_client *client);
368dma_cookie_t dma_async_memcpy_buf_to_buf(struct dma_chan *chan, 275dma_cookie_t dma_async_memcpy_buf_to_buf(struct dma_chan *chan,
369 void *dest, void *src, size_t len); 276 void *dest, void *src, size_t len);
370dma_cookie_t dma_async_memcpy_buf_to_pg(struct dma_chan *chan, 277dma_cookie_t dma_async_memcpy_buf_to_pg(struct dma_chan *chan,
@@ -406,6 +313,12 @@ __dma_cap_set(enum dma_transaction_type tx_type, dma_cap_mask_t *dstp)
406 set_bit(tx_type, dstp->bits); 313 set_bit(tx_type, dstp->bits);
407} 314}
408 315
316#define dma_cap_zero(mask) __dma_cap_zero(&(mask))
317static inline void __dma_cap_zero(dma_cap_mask_t *dstp)
318{
319 bitmap_zero(dstp->bits, DMA_TX_TYPE_END);
320}
321
409#define dma_has_cap(tx, mask) __dma_has_cap((tx), &(mask)) 322#define dma_has_cap(tx, mask) __dma_has_cap((tx), &(mask))
410static inline int 323static inline int
411__dma_has_cap(enum dma_transaction_type tx_type, dma_cap_mask_t *srcp) 324__dma_has_cap(enum dma_transaction_type tx_type, dma_cap_mask_t *srcp)
@@ -475,11 +388,25 @@ static inline enum dma_status dma_async_is_complete(dma_cookie_t cookie,
475} 388}
476 389
477enum dma_status dma_sync_wait(struct dma_chan *chan, dma_cookie_t cookie); 390enum dma_status dma_sync_wait(struct dma_chan *chan, dma_cookie_t cookie);
391#ifdef CONFIG_DMA_ENGINE
392enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx);
393#else
394static inline enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx)
395{
396 return DMA_SUCCESS;
397}
398#endif
478 399
479/* --- DMA device --- */ 400/* --- DMA device --- */
480 401
481int dma_async_device_register(struct dma_device *device); 402int dma_async_device_register(struct dma_device *device);
482void dma_async_device_unregister(struct dma_device *device); 403void dma_async_device_unregister(struct dma_device *device);
404void dma_run_dependencies(struct dma_async_tx_descriptor *tx);
405struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type);
406void dma_issue_pending_all(void);
407#define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y)
408struct dma_chan *__dma_request_channel(dma_cap_mask_t *mask, dma_filter_fn fn, void *fn_param);
409void dma_release_channel(struct dma_chan *chan);
483 410
484/* --- Helper iov-locking functions --- */ 411/* --- Helper iov-locking functions --- */
485 412
diff --git a/include/linux/dqblk_qtree.h b/include/linux/dqblk_qtree.h
new file mode 100644
index 000000000000..82a16527b367
--- /dev/null
+++ b/include/linux/dqblk_qtree.h
@@ -0,0 +1,56 @@
1/*
2 * Definitions of structures and functions for quota formats using trie
3 */
4
5#ifndef _LINUX_DQBLK_QTREE_H
6#define _LINUX_DQBLK_QTREE_H
7
8#include <linux/types.h>
9
10/* Numbers of blocks needed for updates - we count with the smallest
11 * possible block size (1024) */
12#define QTREE_INIT_ALLOC 4
13#define QTREE_INIT_REWRITE 2
14#define QTREE_DEL_ALLOC 0
15#define QTREE_DEL_REWRITE 6
16
17struct dquot;
18
19/* Operations */
20struct qtree_fmt_operations {
21 void (*mem2disk_dqblk)(void *disk, struct dquot *dquot); /* Convert given entry from in memory format to disk one */
22 void (*disk2mem_dqblk)(struct dquot *dquot, void *disk); /* Convert given entry from disk format to in memory one */
23 int (*is_id)(void *disk, struct dquot *dquot); /* Is this structure for given id? */
24};
25
26/* Inmemory copy of version specific information */
27struct qtree_mem_dqinfo {
28 struct super_block *dqi_sb; /* Sb quota is on */
29 int dqi_type; /* Quota type */
30 unsigned int dqi_blocks; /* # of blocks in quota file */
31 unsigned int dqi_free_blk; /* First block in list of free blocks */
32 unsigned int dqi_free_entry; /* First block with free entry */
33 unsigned int dqi_blocksize_bits; /* Block size of quota file */
34 unsigned int dqi_entry_size; /* Size of quota entry in quota file */
35 unsigned int dqi_usable_bs; /* Space usable in block for quota data */
36 unsigned int dqi_qtree_depth; /* Precomputed depth of quota tree */
37 struct qtree_fmt_operations *dqi_ops; /* Operations for entry manipulation */
38};
39
40int qtree_write_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot);
41int qtree_read_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot);
42int qtree_delete_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot);
43int qtree_release_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot);
44int qtree_entry_unused(struct qtree_mem_dqinfo *info, char *disk);
45static inline int qtree_depth(struct qtree_mem_dqinfo *info)
46{
47 unsigned int epb = info->dqi_usable_bs >> 2;
48 unsigned long long entries = epb;
49 int i;
50
51 for (i = 1; entries < (1ULL << 32); i++)
52 entries *= epb;
53 return i;
54}
55
56#endif /* _LINUX_DQBLK_QTREE_H */
diff --git a/include/linux/dqblk_v1.h b/include/linux/dqblk_v1.h
index 57f1250d5a52..3713a7232dd8 100644
--- a/include/linux/dqblk_v1.h
+++ b/include/linux/dqblk_v1.h
@@ -5,9 +5,6 @@
5#ifndef _LINUX_DQBLK_V1_H 5#ifndef _LINUX_DQBLK_V1_H
6#define _LINUX_DQBLK_V1_H 6#define _LINUX_DQBLK_V1_H
7 7
8/* Id of quota format */
9#define QFMT_VFS_OLD 1
10
11/* Root squash turned on */ 8/* Root squash turned on */
12#define V1_DQF_RSQUASH 1 9#define V1_DQF_RSQUASH 1
13 10
@@ -17,8 +14,4 @@
17#define V1_DEL_ALLOC 0 14#define V1_DEL_ALLOC 0
18#define V1_DEL_REWRITE 2 15#define V1_DEL_REWRITE 2
19 16
20/* Special information about quotafile */
21struct v1_mem_dqinfo {
22};
23
24#endif /* _LINUX_DQBLK_V1_H */ 17#endif /* _LINUX_DQBLK_V1_H */
diff --git a/include/linux/dqblk_v2.h b/include/linux/dqblk_v2.h
index 4f853322cb7f..18000a542677 100644
--- a/include/linux/dqblk_v2.h
+++ b/include/linux/dqblk_v2.h
@@ -1,26 +1,16 @@
1/* 1/*
2 * Definitions of structures for vfsv0 quota format 2 * Definitions for vfsv0 quota format
3 */ 3 */
4 4
5#ifndef _LINUX_DQBLK_V2_H 5#ifndef _LINUX_DQBLK_V2_H
6#define _LINUX_DQBLK_V2_H 6#define _LINUX_DQBLK_V2_H
7 7
8#include <linux/types.h> 8#include <linux/dqblk_qtree.h>
9
10/* id numbers of quota format */
11#define QFMT_VFS_V0 2
12 9
13/* Numbers of blocks needed for updates */ 10/* Numbers of blocks needed for updates */
14#define V2_INIT_ALLOC 4 11#define V2_INIT_ALLOC QTREE_INIT_ALLOC
15#define V2_INIT_REWRITE 2 12#define V2_INIT_REWRITE QTREE_INIT_REWRITE
16#define V2_DEL_ALLOC 0 13#define V2_DEL_ALLOC QTREE_DEL_ALLOC
17#define V2_DEL_REWRITE 6 14#define V2_DEL_REWRITE QTREE_DEL_REWRITE
18
19/* Inmemory copy of version specific information */
20struct v2_mem_dqinfo {
21 unsigned int dqi_blocks;
22 unsigned int dqi_free_blk;
23 unsigned int dqi_free_entry;
24};
25 15
26#endif /* _LINUX_DQBLK_V2_H */ 16#endif /* _LINUX_DQBLK_V2_H */
diff --git a/include/linux/dw_dmac.h b/include/linux/dw_dmac.h
index 04d217b442bf..d797dde247f7 100644
--- a/include/linux/dw_dmac.h
+++ b/include/linux/dw_dmac.h
@@ -22,14 +22,34 @@ struct dw_dma_platform_data {
22}; 22};
23 23
24/** 24/**
25 * enum dw_dma_slave_width - DMA slave register access width.
26 * @DMA_SLAVE_WIDTH_8BIT: Do 8-bit slave register accesses
27 * @DMA_SLAVE_WIDTH_16BIT: Do 16-bit slave register accesses
28 * @DMA_SLAVE_WIDTH_32BIT: Do 32-bit slave register accesses
29 */
30enum dw_dma_slave_width {
31 DW_DMA_SLAVE_WIDTH_8BIT,
32 DW_DMA_SLAVE_WIDTH_16BIT,
33 DW_DMA_SLAVE_WIDTH_32BIT,
34};
35
36/**
25 * struct dw_dma_slave - Controller-specific information about a slave 37 * struct dw_dma_slave - Controller-specific information about a slave
26 * @slave: Generic information about the slave 38 *
27 * @ctl_lo: Platform-specific initializer for the CTL_LO register 39 * @dma_dev: required DMA master device
40 * @tx_reg: physical address of data register used for
41 * memory-to-peripheral transfers
42 * @rx_reg: physical address of data register used for
43 * peripheral-to-memory transfers
44 * @reg_width: peripheral register width
28 * @cfg_hi: Platform-specific initializer for the CFG_HI register 45 * @cfg_hi: Platform-specific initializer for the CFG_HI register
29 * @cfg_lo: Platform-specific initializer for the CFG_LO register 46 * @cfg_lo: Platform-specific initializer for the CFG_LO register
30 */ 47 */
31struct dw_dma_slave { 48struct dw_dma_slave {
32 struct dma_slave slave; 49 struct device *dma_dev;
50 dma_addr_t tx_reg;
51 dma_addr_t rx_reg;
52 enum dw_dma_slave_width reg_width;
33 u32 cfg_hi; 53 u32 cfg_hi;
34 u32 cfg_lo; 54 u32 cfg_lo;
35}; 55};
@@ -54,9 +74,4 @@ struct dw_dma_slave {
54#define DWC_CFGL_HS_DST_POL (1 << 18) /* dst handshake active low */ 74#define DWC_CFGL_HS_DST_POL (1 << 18) /* dst handshake active low */
55#define DWC_CFGL_HS_SRC_POL (1 << 19) /* src handshake active low */ 75#define DWC_CFGL_HS_SRC_POL (1 << 19) /* src handshake active low */
56 76
57static inline struct dw_dma_slave *to_dw_dma_slave(struct dma_slave *slave)
58{
59 return container_of(slave, struct dw_dma_slave, slave);
60}
61
62#endif /* DW_DMAC_H */ 77#endif /* DW_DMAC_H */
diff --git a/include/linux/ext2_fs.h b/include/linux/ext2_fs.h
index 78c775a83f7c..121720d74e15 100644
--- a/include/linux/ext2_fs.h
+++ b/include/linux/ext2_fs.h
@@ -194,6 +194,30 @@ struct ext2_group_desc
194#define EXT2_FL_USER_VISIBLE FS_FL_USER_VISIBLE /* User visible flags */ 194#define EXT2_FL_USER_VISIBLE FS_FL_USER_VISIBLE /* User visible flags */
195#define EXT2_FL_USER_MODIFIABLE FS_FL_USER_MODIFIABLE /* User modifiable flags */ 195#define EXT2_FL_USER_MODIFIABLE FS_FL_USER_MODIFIABLE /* User modifiable flags */
196 196
197/* Flags that should be inherited by new inodes from their parent. */
198#define EXT2_FL_INHERITED (EXT2_SECRM_FL | EXT2_UNRM_FL | EXT2_COMPR_FL |\
199 EXT2_SYNC_FL | EXT2_IMMUTABLE_FL | EXT2_APPEND_FL |\
200 EXT2_NODUMP_FL | EXT2_NOATIME_FL | EXT2_COMPRBLK_FL|\
201 EXT2_NOCOMP_FL | EXT2_JOURNAL_DATA_FL |\
202 EXT2_NOTAIL_FL | EXT2_DIRSYNC_FL)
203
204/* Flags that are appropriate for regular files (all but dir-specific ones). */
205#define EXT2_REG_FLMASK (~(EXT2_DIRSYNC_FL | EXT2_TOPDIR_FL))
206
207/* Flags that are appropriate for non-directories/regular files. */
208#define EXT2_OTHER_FLMASK (EXT2_NODUMP_FL | EXT2_NOATIME_FL)
209
210/* Mask out flags that are inappropriate for the given type of inode. */
211static inline __u32 ext2_mask_flags(umode_t mode, __u32 flags)
212{
213 if (S_ISDIR(mode))
214 return flags;
215 else if (S_ISREG(mode))
216 return flags & EXT2_REG_FLMASK;
217 else
218 return flags & EXT2_OTHER_FLMASK;
219}
220
197/* 221/*
198 * ioctl commands 222 * ioctl commands
199 */ 223 */
diff --git a/include/linux/ext2_fs_sb.h b/include/linux/ext2_fs_sb.h
index f273415ab6f1..1cdb66367c98 100644
--- a/include/linux/ext2_fs_sb.h
+++ b/include/linux/ext2_fs_sb.h
@@ -101,11 +101,17 @@ struct ext2_sb_info {
101 struct percpu_counter s_freeblocks_counter; 101 struct percpu_counter s_freeblocks_counter;
102 struct percpu_counter s_freeinodes_counter; 102 struct percpu_counter s_freeinodes_counter;
103 struct percpu_counter s_dirs_counter; 103 struct percpu_counter s_dirs_counter;
104 struct blockgroup_lock s_blockgroup_lock; 104 struct blockgroup_lock *s_blockgroup_lock;
105 /* root of the per fs reservation window tree */ 105 /* root of the per fs reservation window tree */
106 spinlock_t s_rsv_window_lock; 106 spinlock_t s_rsv_window_lock;
107 struct rb_root s_rsv_window_root; 107 struct rb_root s_rsv_window_root;
108 struct ext2_reserve_window_node s_rsv_window_head; 108 struct ext2_reserve_window_node s_rsv_window_head;
109}; 109};
110 110
111static inline spinlock_t *
112sb_bgl_lock(struct ext2_sb_info *sbi, unsigned int block_group)
113{
114 return bgl_lock_ptr(sbi->s_blockgroup_lock, block_group);
115}
116
111#endif /* _LINUX_EXT2_FS_SB */ 117#endif /* _LINUX_EXT2_FS_SB */
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index d14f02918483..dd495b8c3091 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -178,6 +178,30 @@ struct ext3_group_desc
178#define EXT3_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */ 178#define EXT3_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */
179#define EXT3_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */ 179#define EXT3_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */
180 180
181/* Flags that should be inherited by new inodes from their parent. */
182#define EXT3_FL_INHERITED (EXT3_SECRM_FL | EXT3_UNRM_FL | EXT3_COMPR_FL |\
183 EXT3_SYNC_FL | EXT3_IMMUTABLE_FL | EXT3_APPEND_FL |\
184 EXT3_NODUMP_FL | EXT3_NOATIME_FL | EXT3_COMPRBLK_FL|\
185 EXT3_NOCOMPR_FL | EXT3_JOURNAL_DATA_FL |\
186 EXT3_NOTAIL_FL | EXT3_DIRSYNC_FL)
187
188/* Flags that are appropriate for regular files (all but dir-specific ones). */
189#define EXT3_REG_FLMASK (~(EXT3_DIRSYNC_FL | EXT3_TOPDIR_FL))
190
191/* Flags that are appropriate for non-directories/regular files. */
192#define EXT3_OTHER_FLMASK (EXT3_NODUMP_FL | EXT3_NOATIME_FL)
193
194/* Mask out flags that are inappropriate for the given type of inode. */
195static inline __u32 ext3_mask_flags(umode_t mode, __u32 flags)
196{
197 if (S_ISDIR(mode))
198 return flags;
199 else if (S_ISREG(mode))
200 return flags & EXT3_REG_FLMASK;
201 else
202 return flags & EXT3_OTHER_FLMASK;
203}
204
181/* 205/*
182 * Inode dynamic state flags 206 * Inode dynamic state flags
183 */ 207 */
@@ -354,6 +378,13 @@ struct ext3_inode {
354#define EXT3_ORPHAN_FS 0x0004 /* Orphans being recovered */ 378#define EXT3_ORPHAN_FS 0x0004 /* Orphans being recovered */
355 379
356/* 380/*
381 * Misc. filesystem flags
382 */
383#define EXT2_FLAGS_SIGNED_HASH 0x0001 /* Signed dirhash in use */
384#define EXT2_FLAGS_UNSIGNED_HASH 0x0002 /* Unsigned dirhash in use */
385#define EXT2_FLAGS_TEST_FILESYS 0x0004 /* to test development code */
386
387/*
357 * Mount flags 388 * Mount flags
358 */ 389 */
359#define EXT3_MOUNT_CHECK 0x00001 /* Do mount-time checks */ 390#define EXT3_MOUNT_CHECK 0x00001 /* Do mount-time checks */
@@ -489,7 +520,23 @@ struct ext3_super_block {
489 __u16 s_reserved_word_pad; 520 __u16 s_reserved_word_pad;
490 __le32 s_default_mount_opts; 521 __le32 s_default_mount_opts;
491 __le32 s_first_meta_bg; /* First metablock block group */ 522 __le32 s_first_meta_bg; /* First metablock block group */
492 __u32 s_reserved[190]; /* Padding to the end of the block */ 523 __le32 s_mkfs_time; /* When the filesystem was created */
524 __le32 s_jnl_blocks[17]; /* Backup of the journal inode */
525 /* 64bit support valid if EXT4_FEATURE_COMPAT_64BIT */
526/*150*/ __le32 s_blocks_count_hi; /* Blocks count */
527 __le32 s_r_blocks_count_hi; /* Reserved blocks count */
528 __le32 s_free_blocks_count_hi; /* Free blocks count */
529 __le16 s_min_extra_isize; /* All inodes have at least # bytes */
530 __le16 s_want_extra_isize; /* New inodes should reserve # bytes */
531 __le32 s_flags; /* Miscellaneous flags */
532 __le16 s_raid_stride; /* RAID stride */
533 __le16 s_mmp_interval; /* # seconds to wait in MMP checking */
534 __le64 s_mmp_block; /* Block for multi-mount protection */
535 __le32 s_raid_stripe_width; /* blocks on all data disks (N*stride)*/
536 __u8 s_log_groups_per_flex; /* FLEX_BG group size */
537 __u8 s_reserved_char_pad2;
538 __le16 s_reserved_pad;
539 __u32 s_reserved[162]; /* Padding to the end of the block */
493}; 540};
494 541
495#ifdef __KERNEL__ 542#ifdef __KERNEL__
@@ -694,6 +741,9 @@ static inline __le16 ext3_rec_len_to_disk(unsigned len)
694#define DX_HASH_LEGACY 0 741#define DX_HASH_LEGACY 0
695#define DX_HASH_HALF_MD4 1 742#define DX_HASH_HALF_MD4 1
696#define DX_HASH_TEA 2 743#define DX_HASH_TEA 2
744#define DX_HASH_LEGACY_UNSIGNED 3
745#define DX_HASH_HALF_MD4_UNSIGNED 4
746#define DX_HASH_TEA_UNSIGNED 5
697 747
698#ifdef __KERNEL__ 748#ifdef __KERNEL__
699 749
diff --git a/include/linux/ext3_fs_sb.h b/include/linux/ext3_fs_sb.h
index b65f0288b842..f07f34de2f0e 100644
--- a/include/linux/ext3_fs_sb.h
+++ b/include/linux/ext3_fs_sb.h
@@ -57,10 +57,11 @@ struct ext3_sb_info {
57 u32 s_next_generation; 57 u32 s_next_generation;
58 u32 s_hash_seed[4]; 58 u32 s_hash_seed[4];
59 int s_def_hash_version; 59 int s_def_hash_version;
60 int s_hash_unsigned; /* 3 if hash should be signed, 0 if not */
60 struct percpu_counter s_freeblocks_counter; 61 struct percpu_counter s_freeblocks_counter;
61 struct percpu_counter s_freeinodes_counter; 62 struct percpu_counter s_freeinodes_counter;
62 struct percpu_counter s_dirs_counter; 63 struct percpu_counter s_dirs_counter;
63 struct blockgroup_lock s_blockgroup_lock; 64 struct blockgroup_lock *s_blockgroup_lock;
64 65
65 /* root of the per fs reservation window tree */ 66 /* root of the per fs reservation window tree */
66 spinlock_t s_rsv_window_lock; 67 spinlock_t s_rsv_window_lock;
@@ -83,4 +84,10 @@ struct ext3_sb_info {
83#endif 84#endif
84}; 85};
85 86
87static inline spinlock_t *
88sb_bgl_lock(struct ext3_sb_info *sbi, unsigned int block_group)
89{
90 return bgl_lock_ptr(sbi->s_blockgroup_lock, block_group);
91}
92
86#endif /* _LINUX_EXT3_FS_SB */ 93#endif /* _LINUX_EXT3_FS_SB */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index e2170ee21e18..0b87b29f4797 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -423,6 +423,9 @@ enum positive_aop_returns {
423 423
424#define AOP_FLAG_UNINTERRUPTIBLE 0x0001 /* will not do a short write */ 424#define AOP_FLAG_UNINTERRUPTIBLE 0x0001 /* will not do a short write */
425#define AOP_FLAG_CONT_EXPAND 0x0002 /* called from cont_expand */ 425#define AOP_FLAG_CONT_EXPAND 0x0002 /* called from cont_expand */
426#define AOP_FLAG_NOFS 0x0004 /* used by filesystem to direct
427 * helper code (eg buffer layer)
428 * to clear GFP_FS from alloc */
426 429
427/* 430/*
428 * oh the beauties of C type declarations. 431 * oh the beauties of C type declarations.
@@ -562,6 +565,7 @@ struct address_space {
562struct block_device { 565struct block_device {
563 dev_t bd_dev; /* not a kdev_t - it's a search key */ 566 dev_t bd_dev; /* not a kdev_t - it's a search key */
564 struct inode * bd_inode; /* will die */ 567 struct inode * bd_inode; /* will die */
568 struct super_block * bd_super;
565 int bd_openers; 569 int bd_openers;
566 struct mutex bd_mutex; /* open/close mutex */ 570 struct mutex bd_mutex; /* open/close mutex */
567 struct semaphore bd_mount_sem; 571 struct semaphore bd_mount_sem;
@@ -1130,7 +1134,6 @@ struct super_block {
1130 struct rw_semaphore s_umount; 1134 struct rw_semaphore s_umount;
1131 struct mutex s_lock; 1135 struct mutex s_lock;
1132 int s_count; 1136 int s_count;
1133 int s_syncing;
1134 int s_need_sync_fs; 1137 int s_need_sync_fs;
1135 atomic_t s_active; 1138 atomic_t s_active;
1136#ifdef CONFIG_SECURITY 1139#ifdef CONFIG_SECURITY
@@ -1182,6 +1185,11 @@ struct super_block {
1182 * generic_show_options() 1185 * generic_show_options()
1183 */ 1186 */
1184 char *s_options; 1187 char *s_options;
1188
1189 /*
1190 * storage for asynchronous operations
1191 */
1192 struct list_head s_async_list;
1185}; 1193};
1186 1194
1187extern struct timespec current_fs_time(struct super_block *sb); 1195extern struct timespec current_fs_time(struct super_block *sb);
@@ -1382,6 +1390,7 @@ struct super_operations {
1382 ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t); 1390 ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t);
1383 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t); 1391 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t);
1384#endif 1392#endif
1393 int (*bdev_try_to_free_page)(struct super_block*, struct page*, gfp_t);
1385}; 1394};
1386 1395
1387/* 1396/*
@@ -1827,7 +1836,7 @@ extern int __filemap_fdatawrite_range(struct address_space *mapping,
1827extern int filemap_fdatawrite_range(struct address_space *mapping, 1836extern int filemap_fdatawrite_range(struct address_space *mapping,
1828 loff_t start, loff_t end); 1837 loff_t start, loff_t end);
1829 1838
1830extern long do_fsync(struct file *file, int datasync); 1839extern int vfs_fsync(struct file *file, struct dentry *dentry, int datasync);
1831extern void sync_supers(void); 1840extern void sync_supers(void);
1832extern void sync_filesystems(int wait); 1841extern void sync_filesystems(int wait);
1833extern void __fsync_super(struct super_block *sb); 1842extern void __fsync_super(struct super_block *sb);
@@ -2035,7 +2044,7 @@ extern int page_readlink(struct dentry *, char __user *, int);
2035extern void *page_follow_link_light(struct dentry *, struct nameidata *); 2044extern void *page_follow_link_light(struct dentry *, struct nameidata *);
2036extern void page_put_link(struct dentry *, struct nameidata *, void *); 2045extern void page_put_link(struct dentry *, struct nameidata *, void *);
2037extern int __page_symlink(struct inode *inode, const char *symname, int len, 2046extern int __page_symlink(struct inode *inode, const char *symname, int len,
2038 gfp_t gfp_mask); 2047 int nofs);
2039extern int page_symlink(struct inode *inode, const char *symname, int len); 2048extern int page_symlink(struct inode *inode, const char *symname, int len);
2040extern const struct inode_operations page_symlink_inode_operations; 2049extern const struct inode_operations page_symlink_inode_operations;
2041extern int generic_readlink(struct dentry *, char __user *, int); 2050extern int generic_readlink(struct dentry *, char __user *, int);
@@ -2056,6 +2065,9 @@ extern int vfs_fstat(unsigned int, struct kstat *);
2056 2065
2057extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, 2066extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
2058 unsigned long arg); 2067 unsigned long arg);
2068extern int __generic_block_fiemap(struct inode *inode,
2069 struct fiemap_extent_info *fieinfo, u64 start,
2070 u64 len, get_block_t *get_block);
2059extern int generic_block_fiemap(struct inode *inode, 2071extern int generic_block_fiemap(struct inode *inode,
2060 struct fiemap_extent_info *fieinfo, u64 start, 2072 struct fiemap_extent_info *fieinfo, u64 start,
2061 u64 len, get_block_t *get_block); 2073 u64 len, get_block_t *get_block);
diff --git a/include/linux/fuse.h b/include/linux/fuse.h
index 350fe9767bbc..162e5defe683 100644
--- a/include/linux/fuse.h
+++ b/include/linux/fuse.h
@@ -1,6 +1,6 @@
1/* 1/*
2 FUSE: Filesystem in Userspace 2 FUSE: Filesystem in Userspace
3 Copyright (C) 2001-2006 Miklos Szeredi <miklos@szeredi.hu> 3 Copyright (C) 2001-2008 Miklos Szeredi <miklos@szeredi.hu>
4 4
5 This program can be distributed under the terms of the GNU GPL. 5 This program can be distributed under the terms of the GNU GPL.
6 See the file COPYING. 6 See the file COPYING.
@@ -20,29 +20,27 @@
20 * 20 *
21 * 7.10 21 * 7.10
22 * - add nonseekable open flag 22 * - add nonseekable open flag
23 *
24 * 7.11
25 * - add IOCTL message
26 * - add unsolicited notification support
27 * - add POLL message and NOTIFY_POLL notification
23 */ 28 */
24 29
25#ifndef _LINUX_FUSE_H 30#ifndef _LINUX_FUSE_H
26#define _LINUX_FUSE_H 31#define _LINUX_FUSE_H
27 32
28#include <asm/types.h> 33#include <linux/types.h>
29#include <linux/major.h>
30 34
31/** Version number of this interface */ 35/** Version number of this interface */
32#define FUSE_KERNEL_VERSION 7 36#define FUSE_KERNEL_VERSION 7
33 37
34/** Minor version number of this interface */ 38/** Minor version number of this interface */
35#define FUSE_KERNEL_MINOR_VERSION 10 39#define FUSE_KERNEL_MINOR_VERSION 11
36 40
37/** The node ID of the root inode */ 41/** The node ID of the root inode */
38#define FUSE_ROOT_ID 1 42#define FUSE_ROOT_ID 1
39 43
40/** The major number of the fuse character device */
41#define FUSE_MAJOR MISC_MAJOR
42
43/** The minor number of the fuse character device */
44#define FUSE_MINOR 229
45
46/* Make sure all structures are padded to 64bit boundary, so 32bit 44/* Make sure all structures are padded to 64bit boundary, so 32bit
47 userspace works under 64bit kernels */ 45 userspace works under 64bit kernels */
48 46
@@ -151,6 +149,28 @@ struct fuse_file_lock {
151 */ 149 */
152#define FUSE_READ_LOCKOWNER (1 << 1) 150#define FUSE_READ_LOCKOWNER (1 << 1)
153 151
152/**
153 * Ioctl flags
154 *
155 * FUSE_IOCTL_COMPAT: 32bit compat ioctl on 64bit machine
156 * FUSE_IOCTL_UNRESTRICTED: not restricted to well-formed ioctls, retry allowed
157 * FUSE_IOCTL_RETRY: retry with new iovecs
158 *
159 * FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs
160 */
161#define FUSE_IOCTL_COMPAT (1 << 0)
162#define FUSE_IOCTL_UNRESTRICTED (1 << 1)
163#define FUSE_IOCTL_RETRY (1 << 2)
164
165#define FUSE_IOCTL_MAX_IOV 256
166
167/**
168 * Poll flags
169 *
170 * FUSE_POLL_SCHEDULE_NOTIFY: request poll notify
171 */
172#define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0)
173
154enum fuse_opcode { 174enum fuse_opcode {
155 FUSE_LOOKUP = 1, 175 FUSE_LOOKUP = 1,
156 FUSE_FORGET = 2, /* no reply */ 176 FUSE_FORGET = 2, /* no reply */
@@ -188,6 +208,13 @@ enum fuse_opcode {
188 FUSE_INTERRUPT = 36, 208 FUSE_INTERRUPT = 36,
189 FUSE_BMAP = 37, 209 FUSE_BMAP = 37,
190 FUSE_DESTROY = 38, 210 FUSE_DESTROY = 38,
211 FUSE_IOCTL = 39,
212 FUSE_POLL = 40,
213};
214
215enum fuse_notify_code {
216 FUSE_NOTIFY_POLL = 1,
217 FUSE_NOTIFY_CODE_MAX,
191}; 218};
192 219
193/* The read buffer is required to be at least 8k, but may be much larger */ 220/* The read buffer is required to be at least 8k, but may be much larger */
@@ -388,6 +415,38 @@ struct fuse_bmap_out {
388 __u64 block; 415 __u64 block;
389}; 416};
390 417
418struct fuse_ioctl_in {
419 __u64 fh;
420 __u32 flags;
421 __u32 cmd;
422 __u64 arg;
423 __u32 in_size;
424 __u32 out_size;
425};
426
427struct fuse_ioctl_out {
428 __s32 result;
429 __u32 flags;
430 __u32 in_iovs;
431 __u32 out_iovs;
432};
433
434struct fuse_poll_in {
435 __u64 fh;
436 __u64 kh;
437 __u32 flags;
438 __u32 padding;
439};
440
441struct fuse_poll_out {
442 __u32 revents;
443 __u32 padding;
444};
445
446struct fuse_notify_poll_wakeup_out {
447 __u64 kh;
448};
449
391struct fuse_in_header { 450struct fuse_in_header {
392 __u32 len; 451 __u32 len;
393 __u32 opcode; 452 __u32 opcode;
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index e8003afeffba..dd20cd78faa8 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -69,12 +69,6 @@ struct vm_area_struct;
69#define GFP_HIGHUSER_MOVABLE (__GFP_WAIT | __GFP_IO | __GFP_FS | \ 69#define GFP_HIGHUSER_MOVABLE (__GFP_WAIT | __GFP_IO | __GFP_FS | \
70 __GFP_HARDWALL | __GFP_HIGHMEM | \ 70 __GFP_HARDWALL | __GFP_HIGHMEM | \
71 __GFP_MOVABLE) 71 __GFP_MOVABLE)
72#define GFP_NOFS_PAGECACHE (__GFP_WAIT | __GFP_IO | __GFP_MOVABLE)
73#define GFP_USER_PAGECACHE (__GFP_WAIT | __GFP_IO | __GFP_FS | \
74 __GFP_HARDWALL | __GFP_MOVABLE)
75#define GFP_HIGHUSER_PAGECACHE (__GFP_WAIT | __GFP_IO | __GFP_FS | \
76 __GFP_HARDWALL | __GFP_HIGHMEM | \
77 __GFP_MOVABLE)
78 72
79#ifdef CONFIG_NUMA 73#ifdef CONFIG_NUMA
80#define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY) 74#define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY)
diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h
index ec6ecd74781d..1289fa7623ca 100644
--- a/include/linux/gpio_keys.h
+++ b/include/linux/gpio_keys.h
@@ -15,6 +15,7 @@ struct gpio_keys_button {
15struct gpio_keys_platform_data { 15struct gpio_keys_platform_data {
16 struct gpio_keys_button *buttons; 16 struct gpio_keys_button *buttons;
17 int nbuttons; 17 int nbuttons;
18 unsigned int rep:1; /* enable input subsystem auto repeat */
18}; 19};
19 20
20#endif 21#endif
diff --git a/include/linux/hid.h b/include/linux/hid.h
index e5780f8c934a..81aa84d60c6b 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -403,15 +403,6 @@ struct hid_output_fifo {
403#define HID_STAT_ADDED 1 403#define HID_STAT_ADDED 1
404#define HID_STAT_PARSED 2 404#define HID_STAT_PARSED 2
405 405
406#define HID_CTRL_RUNNING 1
407#define HID_OUT_RUNNING 2
408#define HID_IN_RUNNING 3
409#define HID_RESET_PENDING 4
410#define HID_SUSPENDED 5
411#define HID_CLEAR_HALT 6
412#define HID_DISCONNECTED 7
413#define HID_STARTED 8
414
415struct hid_input { 406struct hid_input {
416 struct list_head list; 407 struct list_head list;
417 struct hid_report *report; 408 struct hid_report *report;
@@ -540,6 +531,8 @@ struct hid_usage_id {
540 * @name: driver name (e.g. "Footech_bar-wheel") 531 * @name: driver name (e.g. "Footech_bar-wheel")
541 * @id_table: which devices is this driver for (must be non-NULL for probe 532 * @id_table: which devices is this driver for (must be non-NULL for probe
542 * to be called) 533 * to be called)
534 * @dyn_list: list of dynamically added device ids
535 * @dyn_lock: lock protecting @dyn_list
543 * @probe: new device inserted 536 * @probe: new device inserted
544 * @remove: device removed (NULL if not a hot-plug capable driver) 537 * @remove: device removed (NULL if not a hot-plug capable driver)
545 * @report_table: on which reports to call raw_event (NULL means all) 538 * @report_table: on which reports to call raw_event (NULL means all)
@@ -567,6 +560,9 @@ struct hid_driver {
567 char *name; 560 char *name;
568 const struct hid_device_id *id_table; 561 const struct hid_device_id *id_table;
569 562
563 struct list_head dyn_list;
564 spinlock_t dyn_lock;
565
570 int (*probe)(struct hid_device *dev, const struct hid_device_id *id); 566 int (*probe)(struct hid_device *dev, const struct hid_device_id *id);
571 void (*remove)(struct hid_device *dev); 567 void (*remove)(struct hid_device *dev);
572 568
@@ -797,6 +793,8 @@ dbg_hid(const char *fmt, ...)
797 793
798#ifdef CONFIG_HID_COMPAT 794#ifdef CONFIG_HID_COMPAT
799#define HID_COMPAT_LOAD_DRIVER(name) \ 795#define HID_COMPAT_LOAD_DRIVER(name) \
796/* prototype to avoid sparse warning */ \
797extern void hid_compat_##name(void); \
800void hid_compat_##name(void) { } \ 798void hid_compat_##name(void) { } \
801EXPORT_SYMBOL(hid_compat_##name) 799EXPORT_SYMBOL(hid_compat_##name)
802#else 800#else
diff --git a/include/linux/hidraw.h b/include/linux/hidraw.h
index dbb5c8c374f0..dd8d69269176 100644
--- a/include/linux/hidraw.h
+++ b/include/linux/hidraw.h
@@ -33,6 +33,8 @@ struct hidraw_devinfo {
33#define HIDIOCGRDESCSIZE _IOR('H', 0x01, int) 33#define HIDIOCGRDESCSIZE _IOR('H', 0x01, int)
34#define HIDIOCGRDESC _IOR('H', 0x02, struct hidraw_report_descriptor) 34#define HIDIOCGRDESC _IOR('H', 0x02, struct hidraw_report_descriptor)
35#define HIDIOCGRAWINFO _IOR('H', 0x03, struct hidraw_devinfo) 35#define HIDIOCGRAWINFO _IOR('H', 0x03, struct hidraw_devinfo)
36#define HIDIOCGRAWNAME(len) _IOC(_IOC_READ, 'H', 0x04, len)
37#define HIDIOCGRAWPHYS(len) _IOC(_IOC_READ, 'H', 0x05, len)
36 38
37#define HIDRAW_FIRST_MINOR 0 39#define HIDRAW_FIRST_MINOR 0
38#define HIDRAW_MAX_DEVICES 64 40#define HIDRAW_MAX_DEVICES 64
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index e1c8afc002c0..f1d2fba19ea0 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -233,6 +233,10 @@ static inline unsigned long huge_page_size(struct hstate *h)
233 return (unsigned long)PAGE_SIZE << h->order; 233 return (unsigned long)PAGE_SIZE << h->order;
234} 234}
235 235
236extern unsigned long vma_kernel_pagesize(struct vm_area_struct *vma);
237
238extern unsigned long vma_mmu_pagesize(struct vm_area_struct *vma);
239
236static inline unsigned long huge_page_mask(struct hstate *h) 240static inline unsigned long huge_page_mask(struct hstate *h)
237{ 241{
238 return h->mask; 242 return h->mask;
@@ -273,6 +277,8 @@ struct hstate {};
273#define hstate_inode(i) NULL 277#define hstate_inode(i) NULL
274#define huge_page_size(h) PAGE_SIZE 278#define huge_page_size(h) PAGE_SIZE
275#define huge_page_mask(h) PAGE_MASK 279#define huge_page_mask(h) PAGE_MASK
280#define vma_kernel_pagesize(v) PAGE_SIZE
281#define vma_mmu_pagesize(v) PAGE_SIZE
276#define huge_page_order(h) 0 282#define huge_page_order(h) 0
277#define huge_page_shift(h) PAGE_SHIFT 283#define huge_page_shift(h) PAGE_SHIFT
278static inline unsigned int pages_per_huge_page(struct hstate *h) 284static inline unsigned int pages_per_huge_page(struct hstate *h)
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 33a5992d4936..20873d402467 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -393,11 +393,7 @@ static inline void i2c_set_adapdata(struct i2c_adapter *dev, void *data)
393#define I2C_CLASS_TV_ANALOG (1<<1) /* bttv + friends */ 393#define I2C_CLASS_TV_ANALOG (1<<1) /* bttv + friends */
394#define I2C_CLASS_TV_DIGITAL (1<<2) /* dvb cards */ 394#define I2C_CLASS_TV_DIGITAL (1<<2) /* dvb cards */
395#define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */ 395#define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */
396#define I2C_CLASS_CAM_ANALOG (1<<4) /* camera with analog CCD */
397#define I2C_CLASS_CAM_DIGITAL (1<<5) /* most webcams */
398#define I2C_CLASS_SOUND (1<<6) /* sound devices */
399#define I2C_CLASS_SPD (1<<7) /* SPD EEPROMs and similar */ 396#define I2C_CLASS_SPD (1<<7) /* SPD EEPROMs and similar */
400#define I2C_CLASS_ALL (UINT_MAX) /* all of the above */
401 397
402/* i2c_client_address_data is the struct for holding default client 398/* i2c_client_address_data is the struct for holding default client
403 * addresses for a driver and for the parameters supplied on the 399 * addresses for a driver and for the parameters supplied on the
diff --git a/include/linux/i2c/dm355evm_msp.h b/include/linux/i2c/dm355evm_msp.h
new file mode 100644
index 000000000000..372470350fab
--- /dev/null
+++ b/include/linux/i2c/dm355evm_msp.h
@@ -0,0 +1,79 @@
1/*
2 * dm355evm_msp.h - support MSP430 microcontroller on DM355EVM board
3 */
4#ifndef __LINUX_I2C_DM355EVM_MSP
5#define __LINUX_I2C_DM355EVM_MSP
6
7/*
8 * Written against Spectrum's writeup for the A4 firmware revision,
9 * and tweaked to match source and rev D2 schematics by removing CPLD
10 * and NOR flash hooks (which were last appropriate in rev B boards).
11 *
12 * Note that the firmware supports a flavor of write posting ... to be
13 * sure a write completes, issue another read or write.
14 */
15
16/* utilities to access "registers" emulated by msp430 firmware */
17extern int dm355evm_msp_write(u8 value, u8 reg);
18extern int dm355evm_msp_read(u8 reg);
19
20
21/* command/control registers */
22#define DM355EVM_MSP_COMMAND 0x00
23# define MSP_COMMAND_NULL 0
24# define MSP_COMMAND_RESET_COLD 1
25# define MSP_COMMAND_RESET_WARM 2
26# define MSP_COMMAND_RESET_WARM_I 3
27# define MSP_COMMAND_POWEROFF 4
28# define MSP_COMMAND_IR_REINIT 5
29#define DM355EVM_MSP_STATUS 0x01
30# define MSP_STATUS_BAD_OFFSET BIT(0)
31# define MSP_STATUS_BAD_COMMAND BIT(1)
32# define MSP_STATUS_POWER_ERROR BIT(2)
33# define MSP_STATUS_RXBUF_OVERRUN BIT(3)
34#define DM355EVM_MSP_RESET 0x02 /* 0 bits == in reset */
35# define MSP_RESET_DC5 BIT(0)
36# define MSP_RESET_TVP5154 BIT(2)
37# define MSP_RESET_IMAGER BIT(3)
38# define MSP_RESET_ETHERNET BIT(4)
39# define MSP_RESET_SYS BIT(5)
40# define MSP_RESET_AIC33 BIT(7)
41
42/* GPIO registers ... bit patterns mostly match the source MSP ports */
43#define DM355EVM_MSP_LED 0x03 /* active low (MSP P4) */
44#define DM355EVM_MSP_SWITCH1 0x04 /* (MSP P5, masked) */
45# define MSP_SWITCH1_SW6_1 BIT(0)
46# define MSP_SWITCH1_SW6_2 BIT(1)
47# define MSP_SWITCH1_SW6_3 BIT(2)
48# define MSP_SWITCH1_SW6_4 BIT(3)
49# define MSP_SWITCH1_J1 BIT(4) /* NTSC/PAL */
50# define MSP_SWITCH1_MSP_INT BIT(5) /* active low */
51#define DM355EVM_MSP_SWITCH2 0x05 /* (MSP P6, masked) */
52# define MSP_SWITCH2_SW10 BIT(3)
53# define MSP_SWITCH2_SW11 BIT(4)
54# define MSP_SWITCH2_SW12 BIT(5)
55# define MSP_SWITCH2_SW13 BIT(6)
56# define MSP_SWITCH2_SW14 BIT(7)
57#define DM355EVM_MSP_SDMMC 0x06 /* (MSP P2, masked) */
58# define MSP_SDMMC_0_WP BIT(1)
59# define MSP_SDMMC_0_CD BIT(2) /* active low */
60# define MSP_SDMMC_1_WP BIT(3)
61# define MSP_SDMMC_1_CD BIT(4) /* active low */
62#define DM355EVM_MSP_FIRMREV 0x07 /* not a GPIO (out of order) */
63#define DM355EVM_MSP_VIDEO_IN 0x08 /* (MSP P3, masked) */
64# define MSP_VIDEO_IMAGER BIT(7) /* low == tvp5146 */
65
66/* power supply registers are currently omitted */
67
68/* RTC registers */
69#define DM355EVM_MSP_RTC_0 0x12 /* LSB */
70#define DM355EVM_MSP_RTC_1 0x13
71#define DM355EVM_MSP_RTC_2 0x14
72#define DM355EVM_MSP_RTC_3 0x15 /* MSB */
73
74/* input event queue registers; code == ((HIGH << 8) | LOW) */
75#define DM355EVM_MSP_INPUT_COUNT 0x16 /* decrement by reading LOW */
76#define DM355EVM_MSP_INPUT_HIGH 0x17
77#define DM355EVM_MSP_INPUT_LOW 0x18
78
79#endif /* __LINUX_I2C_DM355EVM_MSP */
diff --git a/include/linux/i2c/tsc2007.h b/include/linux/i2c/tsc2007.h
new file mode 100644
index 000000000000..c6361fbb7bf9
--- /dev/null
+++ b/include/linux/i2c/tsc2007.h
@@ -0,0 +1,17 @@
1#ifndef __LINUX_I2C_TSC2007_H
2#define __LINUX_I2C_TSC2007_H
3
4/* linux/i2c/tsc2007.h */
5
6struct tsc2007_platform_data {
7 u16 model; /* 2007. */
8 u16 x_plate_ohms;
9
10 int (*get_pendown_state)(void);
11 void (*clear_penirq)(void); /* If needed, clear 2nd level
12 interrupt source */
13 int (*init_platform_hw)(void);
14 void (*exit_platform_hw)(void);
15};
16
17#endif
diff --git a/include/linux/i2c/twl4030.h b/include/linux/i2c/twl4030.h
index fb604dcd38f1..8137f660a5cc 100644
--- a/include/linux/i2c/twl4030.h
+++ b/include/linux/i2c/twl4030.h
@@ -78,8 +78,8 @@ int twl4030_i2c_read_u8(u8 mod_no, u8 *val, u8 reg);
78 * IMPORTANT: For twl4030_i2c_write(), allocate num_bytes + 1 78 * IMPORTANT: For twl4030_i2c_write(), allocate num_bytes + 1
79 * for the value, and populate your data starting at offset 1. 79 * for the value, and populate your data starting at offset 1.
80 */ 80 */
81int twl4030_i2c_write(u8 mod_no, u8 *value, u8 reg, u8 num_bytes); 81int twl4030_i2c_write(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
82int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, u8 num_bytes); 82int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
83 83
84/*----------------------------------------------------------------------*/ 84/*----------------------------------------------------------------------*/
85 85
@@ -234,6 +234,9 @@ struct twl4030_gpio_platform_data {
234 /* gpio-n should control VMMC(n+1) if BIT(n) in mmc_cd is set */ 234 /* gpio-n should control VMMC(n+1) if BIT(n) in mmc_cd is set */
235 u8 mmc_cd; 235 u8 mmc_cd;
236 236
237 /* if BIT(N) is set, or VMMC(n+1) is linked, debounce GPIO-N */
238 u32 debounce;
239
237 /* For gpio-N, bit (1 << N) in "pullups" is set if that pullup 240 /* For gpio-N, bit (1 << N) in "pullups" is set if that pullup
238 * should be enabled. Else, if that bit is set in "pulldowns", 241 * should be enabled. Else, if that bit is set in "pulldowns",
239 * that pulldown is enabled. Don't waste power by letting any 242 * that pulldown is enabled. Don't waste power by letting any
@@ -278,6 +281,18 @@ struct twl4030_platform_data {
278 struct twl4030_keypad_data *keypad; 281 struct twl4030_keypad_data *keypad;
279 struct twl4030_usb_data *usb; 282 struct twl4030_usb_data *usb;
280 283
284 /* LDO regulators */
285 struct regulator_init_data *vdac;
286 struct regulator_init_data *vpll1;
287 struct regulator_init_data *vpll2;
288 struct regulator_init_data *vmmc1;
289 struct regulator_init_data *vmmc2;
290 struct regulator_init_data *vsim;
291 struct regulator_init_data *vaux1;
292 struct regulator_init_data *vaux2;
293 struct regulator_init_data *vaux3;
294 struct regulator_init_data *vaux4;
295
281 /* REVISIT more to come ... _nothing_ should be hard-wired */ 296 /* REVISIT more to come ... _nothing_ should be hard-wired */
282}; 297};
283 298
@@ -285,33 +300,6 @@ struct twl4030_platform_data {
285 300
286int twl4030_sih_setup(int module); 301int twl4030_sih_setup(int module);
287 302
288/*
289 * FIXME completely stop using TWL4030_IRQ_BASE ... instead, pass the
290 * IRQ data to subsidiary devices using platform device resources.
291 */
292
293/* IRQ information-need base */
294#include <mach/irqs.h>
295/* TWL4030 interrupts */
296
297/* #define TWL4030_MODIRQ_GPIO (TWL4030_IRQ_BASE + 0) */
298#define TWL4030_MODIRQ_KEYPAD (TWL4030_IRQ_BASE + 1)
299#define TWL4030_MODIRQ_BCI (TWL4030_IRQ_BASE + 2)
300#define TWL4030_MODIRQ_MADC (TWL4030_IRQ_BASE + 3)
301/* #define TWL4030_MODIRQ_USB (TWL4030_IRQ_BASE + 4) */
302/* #define TWL4030_MODIRQ_PWR (TWL4030_IRQ_BASE + 5) */
303
304#define TWL4030_PWRIRQ_PWRBTN (TWL4030_PWR_IRQ_BASE + 0)
305/* #define TWL4030_PWRIRQ_CHG_PRES (TWL4030_PWR_IRQ_BASE + 1) */
306/* #define TWL4030_PWRIRQ_USB_PRES (TWL4030_PWR_IRQ_BASE + 2) */
307/* #define TWL4030_PWRIRQ_RTC (TWL4030_PWR_IRQ_BASE + 3) */
308/* #define TWL4030_PWRIRQ_HOT_DIE (TWL4030_PWR_IRQ_BASE + 4) */
309/* #define TWL4030_PWRIRQ_PWROK_TIMEOUT (TWL4030_PWR_IRQ_BASE + 5) */
310/* #define TWL4030_PWRIRQ_MBCHG (TWL4030_PWR_IRQ_BASE + 6) */
311/* #define TWL4030_PWRIRQ_SC_DETECT (TWL4030_PWR_IRQ_BASE + 7) */
312
313/* Rest are unsued currently*/
314
315/* Offsets to Power Registers */ 303/* Offsets to Power Registers */
316#define TWL4030_VDAC_DEV_GRP 0x3B 304#define TWL4030_VDAC_DEV_GRP 0x3B
317#define TWL4030_VDAC_DEDICATED 0x3E 305#define TWL4030_VDAC_DEDICATED 0x3E
@@ -322,16 +310,6 @@ int twl4030_sih_setup(int module);
322#define TWL4030_VAUX3_DEV_GRP 0x1F 310#define TWL4030_VAUX3_DEV_GRP 0x1F
323#define TWL4030_VAUX3_DEDICATED 0x22 311#define TWL4030_VAUX3_DEDICATED 0x22
324 312
325/* TWL4030 GPIO interrupt definitions */
326
327#define TWL4030_GPIO_IRQ_NO(n) (TWL4030_GPIO_IRQ_BASE + (n))
328
329/*
330 * Exported TWL4030 GPIO APIs
331 *
332 * WARNING -- use standard GPIO and IRQ calls instead; these will vanish.
333 */
334int twl4030_set_gpio_debounce(int gpio, int enable);
335 313
336#if defined(CONFIG_TWL4030_BCI_BATTERY) || \ 314#if defined(CONFIG_TWL4030_BCI_BATTERY) || \
337 defined(CONFIG_TWL4030_BCI_BATTERY_MODULE) 315 defined(CONFIG_TWL4030_BCI_BATTERY_MODULE)
@@ -340,4 +318,38 @@ int twl4030_set_gpio_debounce(int gpio, int enable);
340 static inline int twl4030charger_usb_en(int enable) { return 0; } 318 static inline int twl4030charger_usb_en(int enable) { return 0; }
341#endif 319#endif
342 320
321/*----------------------------------------------------------------------*/
322
323/* Linux-specific regulator identifiers ... for now, we only support
324 * the LDOs, and leave the three buck converters alone. VDD1 and VDD2
325 * need to tie into hardware based voltage scaling (cpufreq etc), while
326 * VIO is generally fixed.
327 */
328
329/* EXTERNAL dc-to-dc buck converters */
330#define TWL4030_REG_VDD1 0
331#define TWL4030_REG_VDD2 1
332#define TWL4030_REG_VIO 2
333
334/* EXTERNAL LDOs */
335#define TWL4030_REG_VDAC 3
336#define TWL4030_REG_VPLL1 4
337#define TWL4030_REG_VPLL2 5 /* not on all chips */
338#define TWL4030_REG_VMMC1 6
339#define TWL4030_REG_VMMC2 7 /* not on all chips */
340#define TWL4030_REG_VSIM 8 /* not on all chips */
341#define TWL4030_REG_VAUX1 9 /* not on all chips */
342#define TWL4030_REG_VAUX2_4030 10 /* (twl4030-specific) */
343#define TWL4030_REG_VAUX2 11 /* (twl5030 and newer) */
344#define TWL4030_REG_VAUX3 12 /* not on all chips */
345#define TWL4030_REG_VAUX4 13 /* not on all chips */
346
347/* INTERNAL LDOs */
348#define TWL4030_REG_VINTANA1 14
349#define TWL4030_REG_VINTANA2 15
350#define TWL4030_REG_VINTDIG 16
351#define TWL4030_REG_VUSB1V5 17
352#define TWL4030_REG_VUSB1V8 18
353#define TWL4030_REG_VUSB3V1 19
354
343#endif /* End of __TWL4030_H */ 355#endif /* End of __TWL4030_H */
diff --git a/include/linux/ide.h b/include/linux/ide.h
index db5ef8ae1ab9..3644f6323384 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -32,18 +32,14 @@
32# define SUPPORT_VLB_SYNC 1 32# define SUPPORT_VLB_SYNC 1
33#endif 33#endif
34 34
35typedef unsigned char byte; /* used everywhere */
36
37/* 35/*
38 * Probably not wise to fiddle with these 36 * Probably not wise to fiddle with these
39 */ 37 */
38#define IDE_DEFAULT_MAX_FAILURES 1
40#define ERROR_MAX 8 /* Max read/write errors per sector */ 39#define ERROR_MAX 8 /* Max read/write errors per sector */
41#define ERROR_RESET 3 /* Reset controller every 4th retry */ 40#define ERROR_RESET 3 /* Reset controller every 4th retry */
42#define ERROR_RECAL 1 /* Recalibrate every 2nd retry */ 41#define ERROR_RECAL 1 /* Recalibrate every 2nd retry */
43 42
44#define HWIF(drive) ((ide_hwif_t *)((drive)->hwif))
45#define HWGROUP(drive) ((ide_hwgroup_t *)(HWIF(drive)->hwgroup))
46
47/* 43/*
48 * Definitions for accessing IDE controller registers 44 * Definitions for accessing IDE controller registers
49 */ 45 */
@@ -185,9 +181,6 @@ typedef struct hw_regs_s {
185 unsigned long config; 181 unsigned long config;
186} hw_regs_t; 182} hw_regs_t;
187 183
188void ide_init_port_data(struct hwif_s *, unsigned int);
189void ide_init_port_hw(struct hwif_s *, hw_regs_t *);
190
191static inline void ide_std_init_ports(hw_regs_t *hw, 184static inline void ide_std_init_ports(hw_regs_t *hw,
192 unsigned long io_addr, 185 unsigned long io_addr,
193 unsigned long ctl_addr) 186 unsigned long ctl_addr)
@@ -433,18 +426,14 @@ struct ide_atapi_pc {
433 struct idetape_bh *bh; 426 struct idetape_bh *bh;
434 char *b_data; 427 char *b_data;
435 428
436 /* idescsi only for now */
437 struct scatterlist *sg; 429 struct scatterlist *sg;
438 unsigned int sg_cnt; 430 unsigned int sg_cnt;
439 431
440 struct scsi_cmnd *scsi_cmd;
441 void (*done) (struct scsi_cmnd *);
442
443 unsigned long timeout; 432 unsigned long timeout;
444}; 433};
445 434
446struct ide_devset; 435struct ide_devset;
447struct ide_driver_s; 436struct ide_driver;
448 437
449#ifdef CONFIG_BLK_DEV_IDEACPI 438#ifdef CONFIG_BLK_DEV_IDEACPI
450struct ide_acpi_drive_link; 439struct ide_acpi_drive_link;
@@ -588,7 +577,6 @@ struct ide_drive_s {
588 struct request_queue *queue; /* request queue */ 577 struct request_queue *queue; /* request queue */
589 578
590 struct request *rq; /* current request */ 579 struct request *rq; /* current request */
591 struct ide_drive_s *next; /* circular list of hwgroup drives */
592 void *driver_data; /* extra driver data */ 580 void *driver_data; /* extra driver data */
593 u16 *id; /* identification info */ 581 u16 *id; /* identification info */
594#ifdef CONFIG_IDE_PROC_FS 582#ifdef CONFIG_IDE_PROC_FS
@@ -662,6 +650,8 @@ struct ide_drive_s {
662 int (*pc_io_buffers)(struct ide_drive_s *, struct ide_atapi_pc *, 650 int (*pc_io_buffers)(struct ide_drive_s *, struct ide_atapi_pc *,
663 unsigned int, int); 651 unsigned int, int);
664 652
653 ide_startstop_t (*irq_handler)(struct ide_drive_s *);
654
665 unsigned long atapi_flags; 655 unsigned long atapi_flags;
666 656
667 struct ide_atapi_pc request_sense_pc; 657 struct ide_atapi_pc request_sense_pc;
@@ -684,7 +674,6 @@ struct ide_tp_ops {
684 void (*exec_command)(struct hwif_s *, u8); 674 void (*exec_command)(struct hwif_s *, u8);
685 u8 (*read_status)(struct hwif_s *); 675 u8 (*read_status)(struct hwif_s *);
686 u8 (*read_altstatus)(struct hwif_s *); 676 u8 (*read_altstatus)(struct hwif_s *);
687 u8 (*read_sff_dma_status)(struct hwif_s *);
688 677
689 void (*set_irq)(struct hwif_s *, int); 678 void (*set_irq)(struct hwif_s *, int);
690 679
@@ -745,14 +734,17 @@ struct ide_dma_ops {
745 int (*dma_test_irq)(struct ide_drive_s *); 734 int (*dma_test_irq)(struct ide_drive_s *);
746 void (*dma_lost_irq)(struct ide_drive_s *); 735 void (*dma_lost_irq)(struct ide_drive_s *);
747 void (*dma_timeout)(struct ide_drive_s *); 736 void (*dma_timeout)(struct ide_drive_s *);
737 /*
738 * The following method is optional and only required to be
739 * implemented for the SFF-8038i compatible controllers.
740 */
741 u8 (*dma_sff_read_status)(struct hwif_s *);
748}; 742};
749 743
750struct ide_host; 744struct ide_host;
751 745
752typedef struct hwif_s { 746typedef struct hwif_s {
753 struct hwif_s *next; /* for linked-list in ide_hwgroup_t */
754 struct hwif_s *mate; /* other hwif from same PCI chip */ 747 struct hwif_s *mate; /* other hwif from same PCI chip */
755 struct hwgroup_s *hwgroup; /* actually (ide_hwgroup_t *) */
756 struct proc_dir_entry *proc; /* /proc/ide/ directory entry */ 748 struct proc_dir_entry *proc; /* /proc/ide/ directory entry */
757 749
758 struct ide_host *host; 750 struct ide_host *host;
@@ -763,7 +755,7 @@ typedef struct hwif_s {
763 755
764 unsigned long sata_scr[SATA_NR_PORTS]; 756 unsigned long sata_scr[SATA_NR_PORTS];
765 757
766 ide_drive_t drives[MAX_DRIVES]; /* drive info */ 758 ide_drive_t *devices[MAX_DRIVES + 1];
767 759
768 u8 major; /* our major number */ 760 u8 major; /* our major number */
769 u8 index; /* 0 for ide0; 1 for ide1; ... */ 761 u8 index; /* 0 for ide0; 1 for ide1; ... */
@@ -829,7 +821,7 @@ typedef struct hwif_s {
829 unsigned extra_ports; /* number of extra dma ports */ 821 unsigned extra_ports; /* number of extra dma ports */
830 822
831 unsigned present : 1; /* this interface exists */ 823 unsigned present : 1; /* this interface exists */
832 unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ 824 unsigned busy : 1; /* serializes devices on a port */
833 825
834 struct device gendev; 826 struct device gendev;
835 struct device *portdev; 827 struct device *portdev;
@@ -841,19 +833,49 @@ typedef struct hwif_s {
841#ifdef CONFIG_BLK_DEV_IDEACPI 833#ifdef CONFIG_BLK_DEV_IDEACPI
842 struct ide_acpi_hwif_link *acpidata; 834 struct ide_acpi_hwif_link *acpidata;
843#endif 835#endif
836
837 /* IRQ handler, if active */
838 ide_startstop_t (*handler)(ide_drive_t *);
839
840 /* BOOL: polling active & poll_timeout field valid */
841 unsigned int polling : 1;
842
843 /* current drive */
844 ide_drive_t *cur_dev;
845
846 /* current request */
847 struct request *rq;
848
849 /* failsafe timer */
850 struct timer_list timer;
851 /* timeout value during long polls */
852 unsigned long poll_timeout;
853 /* queried upon timeouts */
854 int (*expiry)(ide_drive_t *);
855
856 int req_gen;
857 int req_gen_timer;
858
859 spinlock_t lock;
844} ____cacheline_internodealigned_in_smp ide_hwif_t; 860} ____cacheline_internodealigned_in_smp ide_hwif_t;
845 861
846#define MAX_HOST_PORTS 4 862#define MAX_HOST_PORTS 4
847 863
848struct ide_host { 864struct ide_host {
849 ide_hwif_t *ports[MAX_HOST_PORTS]; 865 ide_hwif_t *ports[MAX_HOST_PORTS + 1];
850 unsigned int n_ports; 866 unsigned int n_ports;
851 struct device *dev[2]; 867 struct device *dev[2];
852 unsigned int (*init_chipset)(struct pci_dev *); 868 unsigned int (*init_chipset)(struct pci_dev *);
853 unsigned long host_flags; 869 unsigned long host_flags;
854 void *host_priv; 870 void *host_priv;
871 ide_hwif_t *cur_port; /* for hosts requiring serialization */
872
873 /* used for hosts requiring serialization */
874 volatile long host_busy;
855}; 875};
856 876
877#define IDE_HOST_BUSY 0
878
857/* 879/*
858 * internal ide interrupt handler type 880 * internal ide interrupt handler type
859 */ 881 */
@@ -863,38 +885,6 @@ typedef int (ide_expiry_t)(ide_drive_t *);
863/* used by ide-cd, ide-floppy, etc. */ 885/* used by ide-cd, ide-floppy, etc. */
864typedef void (xfer_func_t)(ide_drive_t *, struct request *rq, void *, unsigned); 886typedef void (xfer_func_t)(ide_drive_t *, struct request *rq, void *, unsigned);
865 887
866typedef struct hwgroup_s {
867 /* irq handler, if active */
868 ide_startstop_t (*handler)(ide_drive_t *);
869
870 /* BOOL: protects all fields below */
871 volatile int busy;
872 /* BOOL: polling active & poll_timeout field valid */
873 unsigned int polling : 1;
874
875 /* current drive */
876 ide_drive_t *drive;
877 /* ptr to current hwif in linked-list */
878 ide_hwif_t *hwif;
879
880 /* current request */
881 struct request *rq;
882
883 /* failsafe timer */
884 struct timer_list timer;
885 /* timeout value during long polls */
886 unsigned long poll_timeout;
887 /* queried upon timeouts */
888 int (*expiry)(ide_drive_t *);
889
890 int req_gen;
891 int req_gen_timer;
892
893 spinlock_t lock;
894} ide_hwgroup_t;
895
896typedef struct ide_driver_s ide_driver_t;
897
898extern struct mutex ide_setting_mtx; 888extern struct mutex ide_setting_mtx;
899 889
900/* 890/*
@@ -1020,8 +1010,8 @@ void ide_proc_register_port(ide_hwif_t *);
1020void ide_proc_port_register_devices(ide_hwif_t *); 1010void ide_proc_port_register_devices(ide_hwif_t *);
1021void ide_proc_unregister_device(ide_drive_t *); 1011void ide_proc_unregister_device(ide_drive_t *);
1022void ide_proc_unregister_port(ide_hwif_t *); 1012void ide_proc_unregister_port(ide_hwif_t *);
1023void ide_proc_register_driver(ide_drive_t *, ide_driver_t *); 1013void ide_proc_register_driver(ide_drive_t *, struct ide_driver *);
1024void ide_proc_unregister_driver(ide_drive_t *, ide_driver_t *); 1014void ide_proc_unregister_driver(ide_drive_t *, struct ide_driver *);
1025 1015
1026read_proc_t proc_ide_read_capacity; 1016read_proc_t proc_ide_read_capacity;
1027read_proc_t proc_ide_read_geometry; 1017read_proc_t proc_ide_read_geometry;
@@ -1048,8 +1038,10 @@ static inline void ide_proc_register_port(ide_hwif_t *hwif) { ; }
1048static inline void ide_proc_port_register_devices(ide_hwif_t *hwif) { ; } 1038static inline void ide_proc_port_register_devices(ide_hwif_t *hwif) { ; }
1049static inline void ide_proc_unregister_device(ide_drive_t *drive) { ; } 1039static inline void ide_proc_unregister_device(ide_drive_t *drive) { ; }
1050static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; } 1040static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; }
1051static inline void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } 1041static inline void ide_proc_register_driver(ide_drive_t *drive,
1052static inline void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } 1042 struct ide_driver *driver) { ; }
1043static inline void ide_proc_unregister_driver(ide_drive_t *drive,
1044 struct ide_driver *driver) { ; }
1053#define PROC_IDE_READ_RETURN(page,start,off,count,eof,len) return 0; 1045#define PROC_IDE_READ_RETURN(page,start,off,count,eof,len) return 0;
1054#endif 1046#endif
1055 1047
@@ -1118,11 +1110,10 @@ void ide_check_pm_state(ide_drive_t *, struct request *);
1118 * The gendriver.owner field should be set to the module owner of this driver. 1110 * The gendriver.owner field should be set to the module owner of this driver.
1119 * The gendriver.name field should be set to the name of this driver 1111 * The gendriver.name field should be set to the name of this driver
1120 */ 1112 */
1121struct ide_driver_s { 1113struct ide_driver {
1122 const char *version; 1114 const char *version;
1123 ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t); 1115 ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t);
1124 int (*end_request)(ide_drive_t *, int, int); 1116 int (*end_request)(ide_drive_t *, int, int);
1125 ide_startstop_t (*error)(ide_drive_t *, struct request *rq, u8, u8);
1126 struct device_driver gen_driver; 1117 struct device_driver gen_driver;
1127 int (*probe)(ide_drive_t *); 1118 int (*probe)(ide_drive_t *);
1128 void (*remove)(ide_drive_t *); 1119 void (*remove)(ide_drive_t *);
@@ -1134,7 +1125,7 @@ struct ide_driver_s {
1134#endif 1125#endif
1135}; 1126};
1136 1127
1137#define to_ide_driver(drv) container_of(drv, ide_driver_t, gen_driver) 1128#define to_ide_driver(drv) container_of(drv, struct ide_driver, gen_driver)
1138 1129
1139int ide_device_get(ide_drive_t *); 1130int ide_device_get(ide_drive_t *);
1140void ide_device_put(ide_drive_t *); 1131void ide_device_put(ide_drive_t *);
@@ -1166,9 +1157,7 @@ void ide_execute_pkt_cmd(ide_drive_t *);
1166 1157
1167void ide_pad_transfer(ide_drive_t *, int, int); 1158void ide_pad_transfer(ide_drive_t *, int, int);
1168 1159
1169ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8); 1160ide_startstop_t ide_error(ide_drive_t *, const char *, u8);
1170
1171ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat);
1172 1161
1173void ide_fix_driveid(u16 *); 1162void ide_fix_driveid(u16 *);
1174 1163
@@ -1192,7 +1181,6 @@ void ide_tf_dump(const char *, struct ide_taskfile *);
1192void ide_exec_command(ide_hwif_t *, u8); 1181void ide_exec_command(ide_hwif_t *, u8);
1193u8 ide_read_status(ide_hwif_t *); 1182u8 ide_read_status(ide_hwif_t *);
1194u8 ide_read_altstatus(ide_hwif_t *); 1183u8 ide_read_altstatus(ide_hwif_t *);
1195u8 ide_read_sff_dma_status(ide_hwif_t *);
1196 1184
1197void ide_set_irq(ide_hwif_t *, int); 1185void ide_set_irq(ide_hwif_t *, int);
1198 1186
@@ -1272,26 +1260,6 @@ extern void ide_stall_queue(ide_drive_t *drive, unsigned long timeout);
1272 1260
1273extern void ide_timer_expiry(unsigned long); 1261extern void ide_timer_expiry(unsigned long);
1274extern irqreturn_t ide_intr(int irq, void *dev_id); 1262extern irqreturn_t ide_intr(int irq, void *dev_id);
1275
1276static inline int ide_lock_hwgroup(ide_hwgroup_t *hwgroup)
1277{
1278 if (hwgroup->busy)
1279 return 1;
1280
1281 hwgroup->busy = 1;
1282 /* for atari only */
1283 ide_get_lock(ide_intr, hwgroup);
1284
1285 return 0;
1286}
1287
1288static inline void ide_unlock_hwgroup(ide_hwgroup_t *hwgroup)
1289{
1290 /* for atari only */
1291 ide_release_lock();
1292 hwgroup->busy = 0;
1293}
1294
1295extern void do_ide_request(struct request_queue *); 1263extern void do_ide_request(struct request_queue *);
1296 1264
1297void ide_init_disk(struct gendisk *, ide_drive_t *); 1265void ide_init_disk(struct gendisk *, ide_drive_t *);
@@ -1327,11 +1295,11 @@ static inline int ide_hwif_setup_dma(ide_hwif_t *hwif,
1327} 1295}
1328#endif 1296#endif
1329 1297
1330typedef struct ide_pci_enablebit_s { 1298struct ide_pci_enablebit {
1331 u8 reg; /* byte pci reg holding the enable-bit */ 1299 u8 reg; /* byte pci reg holding the enable-bit */
1332 u8 mask; /* mask to isolate the enable-bit */ 1300 u8 mask; /* mask to isolate the enable-bit */
1333 u8 val; /* value of masked reg when "enabled" */ 1301 u8 val; /* value of masked reg when "enabled" */
1334} ide_pci_enablebit_t; 1302};
1335 1303
1336enum { 1304enum {
1337 /* Uses ISA control ports not PCI ones. */ 1305 /* Uses ISA control ports not PCI ones. */
@@ -1420,7 +1388,8 @@ struct ide_port_info {
1420 const struct ide_port_ops *port_ops; 1388 const struct ide_port_ops *port_ops;
1421 const struct ide_dma_ops *dma_ops; 1389 const struct ide_dma_ops *dma_ops;
1422 1390
1423 ide_pci_enablebit_t enablebits[2]; 1391 struct ide_pci_enablebit enablebits[2];
1392
1424 hwif_chipset_t chipset; 1393 hwif_chipset_t chipset;
1425 1394
1426 u16 max_sectors; /* if < than the default one */ 1395 u16 max_sectors; /* if < than the default one */
@@ -1492,6 +1461,7 @@ void ide_dma_exec_cmd(ide_drive_t *, u8);
1492extern void ide_dma_start(ide_drive_t *); 1461extern void ide_dma_start(ide_drive_t *);
1493int ide_dma_end(ide_drive_t *); 1462int ide_dma_end(ide_drive_t *);
1494int ide_dma_test_irq(ide_drive_t *); 1463int ide_dma_test_irq(ide_drive_t *);
1464u8 ide_dma_sff_read_status(ide_hwif_t *);
1495extern const struct ide_dma_ops sff_dma_ops; 1465extern const struct ide_dma_ops sff_dma_ops;
1496#else 1466#else
1497static inline int config_drive_for_dma(ide_drive_t *drive) { return 0; } 1467static inline int config_drive_for_dma(ide_drive_t *drive) { return 0; }
@@ -1529,9 +1499,6 @@ static inline void ide_acpi_port_init_devices(ide_hwif_t *hwif) { ; }
1529static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {} 1499static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {}
1530#endif 1500#endif
1531 1501
1532void ide_remove_port_from_hwgroup(ide_hwif_t *);
1533void ide_unregister(ide_hwif_t *);
1534
1535void ide_register_region(struct gendisk *); 1502void ide_register_region(struct gendisk *);
1536void ide_unregister_region(struct gendisk *); 1503void ide_unregister_region(struct gendisk *);
1537 1504
@@ -1616,23 +1583,6 @@ static inline void ide_set_max_pio(ide_drive_t *drive)
1616 ide_set_pio(drive, 255); 1583 ide_set_pio(drive, 255);
1617} 1584}
1618 1585
1619extern spinlock_t ide_lock;
1620extern struct mutex ide_cfg_mtx;
1621/*
1622 * Structure locking:
1623 *
1624 * ide_cfg_mtx and hwgroup->lock together protect changes to
1625 * ide_hwif_t->next
1626 * ide_drive_t->next
1627 *
1628 * ide_hwgroup_t->busy: hwgroup->lock
1629 * ide_hwgroup_t->hwif: hwgroup->lock
1630 * ide_hwif_t->{hwgroup,mate}: constant, no locking
1631 * ide_drive_t->hwif: constant, no locking
1632 */
1633
1634#define local_irq_set(flags) do { local_save_flags((flags)); local_irq_enable_in_hardirq(); } while (0)
1635
1636char *ide_media_string(ide_drive_t *); 1586char *ide_media_string(ide_drive_t *);
1637 1587
1638extern struct device_attribute ide_dev_attrs[]; 1588extern struct device_attribute ide_dev_attrs[];
@@ -1651,8 +1601,15 @@ static inline int hwif_to_node(ide_hwif_t *hwif)
1651 1601
1652static inline ide_drive_t *ide_get_pair_dev(ide_drive_t *drive) 1602static inline ide_drive_t *ide_get_pair_dev(ide_drive_t *drive)
1653{ 1603{
1654 ide_drive_t *peer = &drive->hwif->drives[(drive->dn ^ 1) & 1]; 1604 ide_drive_t *peer = drive->hwif->devices[(drive->dn ^ 1) & 1];
1655 1605
1656 return (peer->dev_flags & IDE_DFLAG_PRESENT) ? peer : NULL; 1606 return (peer->dev_flags & IDE_DFLAG_PRESENT) ? peer : NULL;
1657} 1607}
1608
1609#define ide_port_for_each_dev(i, dev, port) \
1610 for ((i) = 0; ((dev) = (port)->devices[i]) || (i) < MAX_DRIVES; (i)++)
1611
1612#define ide_host_for_each_port(i, port, host) \
1613 for ((i) = 0; ((port) = (host)->ports[i]) || (i) < MAX_HOST_PORTS; (i)++)
1614
1658#endif /* _IDE_H */ 1615#endif /* _IDE_H */
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index a5cb0c3f6dcf..f8ff918c208f 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -115,6 +115,11 @@ extern u16 vlan_dev_vlan_id(const struct net_device *dev);
115extern int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp, 115extern int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp,
116 u16 vlan_tci, int polling); 116 u16 vlan_tci, int polling);
117extern int vlan_hwaccel_do_receive(struct sk_buff *skb); 117extern int vlan_hwaccel_do_receive(struct sk_buff *skb);
118extern int vlan_gro_receive(struct napi_struct *napi, struct vlan_group *grp,
119 unsigned int vlan_tci, struct sk_buff *skb);
120extern int vlan_gro_frags(struct napi_struct *napi, struct vlan_group *grp,
121 unsigned int vlan_tci,
122 struct napi_gro_fraginfo *info);
118 123
119#else 124#else
120static inline struct net_device *vlan_dev_real_dev(const struct net_device *dev) 125static inline struct net_device *vlan_dev_real_dev(const struct net_device *dev)
@@ -140,6 +145,20 @@ static inline int vlan_hwaccel_do_receive(struct sk_buff *skb)
140{ 145{
141 return 0; 146 return 0;
142} 147}
148
149static inline int vlan_gro_receive(struct napi_struct *napi,
150 struct vlan_group *grp,
151 unsigned int vlan_tci, struct sk_buff *skb)
152{
153 return NET_RX_DROP;
154}
155
156static inline int vlan_gro_frags(struct napi_struct *napi,
157 struct vlan_group *grp, unsigned int vlan_tci,
158 struct napi_gro_fraginfo *info)
159{
160 return NET_RX_DROP;
161}
143#endif 162#endif
144 163
145/** 164/**
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 0702c4d7bdf0..9127f6b51a39 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -14,7 +14,6 @@
14#include <linux/irqflags.h> 14#include <linux/irqflags.h>
15#include <linux/smp.h> 15#include <linux/smp.h>
16#include <linux/percpu.h> 16#include <linux/percpu.h>
17#include <linux/irqnr.h>
18 17
19#include <asm/atomic.h> 18#include <asm/atomic.h>
20#include <asm/ptrace.h> 19#include <asm/ptrace.h>
@@ -253,7 +252,8 @@ enum
253 BLOCK_SOFTIRQ, 252 BLOCK_SOFTIRQ,
254 TASKLET_SOFTIRQ, 253 TASKLET_SOFTIRQ,
255 SCHED_SOFTIRQ, 254 SCHED_SOFTIRQ,
256 RCU_SOFTIRQ, /* Preferable RCU should always be the last softirq */ 255 HRTIMER_SOFTIRQ,
256 RCU_SOFTIRQ, /* Preferable RCU should always be the last softirq */
257 257
258 NR_SOFTIRQS 258 NR_SOFTIRQS
259}; 259};
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 041e95aac2bf..f6bb2ca8e3ba 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -49,6 +49,7 @@ struct resource_list {
49#define IORESOURCE_SIZEALIGN 0x00020000 /* size indicates alignment */ 49#define IORESOURCE_SIZEALIGN 0x00020000 /* size indicates alignment */
50#define IORESOURCE_STARTALIGN 0x00040000 /* start field is alignment */ 50#define IORESOURCE_STARTALIGN 0x00040000 /* start field is alignment */
51 51
52#define IORESOURCE_EXCLUSIVE 0x08000000 /* Userland may not map this resource */
52#define IORESOURCE_DISABLED 0x10000000 53#define IORESOURCE_DISABLED 0x10000000
53#define IORESOURCE_UNSET 0x20000000 54#define IORESOURCE_UNSET 0x20000000
54#define IORESOURCE_AUTO 0x40000000 55#define IORESOURCE_AUTO 0x40000000
@@ -133,13 +134,16 @@ static inline unsigned long resource_type(struct resource *res)
133} 134}
134 135
135/* Convenience shorthand with allocation */ 136/* Convenience shorthand with allocation */
136#define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name)) 137#define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name), 0)
137#define request_mem_region(start,n,name) __request_region(&iomem_resource, (start), (n), (name)) 138#define __request_mem_region(start,n,name, excl) __request_region(&iomem_resource, (start), (n), (name), excl)
139#define request_mem_region(start,n,name) __request_region(&iomem_resource, (start), (n), (name), 0)
140#define request_mem_region_exclusive(start,n,name) \
141 __request_region(&iomem_resource, (start), (n), (name), IORESOURCE_EXCLUSIVE)
138#define rename_region(region, newname) do { (region)->name = (newname); } while (0) 142#define rename_region(region, newname) do { (region)->name = (newname); } while (0)
139 143
140extern struct resource * __request_region(struct resource *, 144extern struct resource * __request_region(struct resource *,
141 resource_size_t start, 145 resource_size_t start,
142 resource_size_t n, const char *name); 146 resource_size_t n, const char *name, int relaxed);
143 147
144/* Compatibility cruft */ 148/* Compatibility cruft */
145#define release_region(start,n) __release_region(&ioport_resource, (start), (n)) 149#define release_region(start,n) __release_region(&ioport_resource, (start), (n))
@@ -175,6 +179,7 @@ extern struct resource * __devm_request_region(struct device *dev,
175extern void __devm_release_region(struct device *dev, struct resource *parent, 179extern void __devm_release_region(struct device *dev, struct resource *parent,
176 resource_size_t start, resource_size_t n); 180 resource_size_t start, resource_size_t n);
177extern int iomem_map_sanity_check(resource_size_t addr, unsigned long size); 181extern int iomem_map_sanity_check(resource_size_t addr, unsigned long size);
182extern int iomem_is_exclusive(u64 addr);
178 183
179#endif /* __ASSEMBLY__ */ 184#endif /* __ASSEMBLY__ */
180#endif /* _LINUX_IOPORT_H */ 185#endif /* _LINUX_IOPORT_H */
diff --git a/include/linux/ioprio.h b/include/linux/ioprio.h
index f98a656b17e5..76dad4808847 100644
--- a/include/linux/ioprio.h
+++ b/include/linux/ioprio.h
@@ -86,4 +86,6 @@ static inline int task_nice_ioclass(struct task_struct *task)
86 */ 86 */
87extern int ioprio_best(unsigned short aprio, unsigned short bprio); 87extern int ioprio_best(unsigned short aprio, unsigned short bprio);
88 88
89extern int set_task_ioprio(struct task_struct *task, int ioprio);
90
89#endif 91#endif
diff --git a/include/linux/irqnr.h b/include/linux/irqnr.h
index 5504a5c97836..86af92e9e84c 100644
--- a/include/linux/irqnr.h
+++ b/include/linux/irqnr.h
@@ -8,7 +8,12 @@
8 8
9#ifndef CONFIG_GENERIC_HARDIRQS 9#ifndef CONFIG_GENERIC_HARDIRQS
10#include <asm/irq.h> 10#include <asm/irq.h>
11# define nr_irqs NR_IRQS 11
12/*
13 * Wrappers for non-genirq architectures:
14 */
15#define nr_irqs NR_IRQS
16#define irq_to_desc(irq) (&irq_desc[irq])
12 17
13# define for_each_irq_desc(irq, desc) \ 18# define for_each_irq_desc(irq, desc) \
14 for (irq = 0; irq < nr_irqs; irq++) 19 for (irq = 0; irq < nr_irqs; irq++)
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index 346e2b80be7d..6384b19efe64 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -543,6 +543,11 @@ struct transaction_s
543 unsigned long t_expires; 543 unsigned long t_expires;
544 544
545 /* 545 /*
546 * When this transaction started, in nanoseconds [no locking]
547 */
548 ktime_t t_start_time;
549
550 /*
546 * How many handles used this transaction? [t_handle_lock] 551 * How many handles used this transaction? [t_handle_lock]
547 */ 552 */
548 int t_handle_count; 553 int t_handle_count;
@@ -798,9 +803,19 @@ struct journal_s
798 struct buffer_head **j_wbuf; 803 struct buffer_head **j_wbuf;
799 int j_wbufsize; 804 int j_wbufsize;
800 805
806 /*
807 * this is the pid of the last person to run a synchronous operation
808 * through the journal.
809 */
801 pid_t j_last_sync_writer; 810 pid_t j_last_sync_writer;
802 811
803 /* 812 /*
813 * the average amount of time in nanoseconds it takes to commit a
814 * transaction to the disk. [j_state_lock]
815 */
816 u64 j_average_commit_time;
817
818 /*
804 * An opaque pointer to fs-private information. ext3 puts its 819 * An opaque pointer to fs-private information. ext3 puts its
805 * superblock pointer here 820 * superblock pointer here
806 */ 821 */
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index c7d106ef22e2..b45109c61fba 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -329,6 +329,7 @@ enum jbd_state_bits {
329 BH_State, /* Pins most journal_head state */ 329 BH_State, /* Pins most journal_head state */
330 BH_JournalHead, /* Pins bh->b_private and jh->b_bh */ 330 BH_JournalHead, /* Pins bh->b_private and jh->b_bh */
331 BH_Unshadow, /* Dummy bit, for BJ_Shadow wakeup filtering */ 331 BH_Unshadow, /* Dummy bit, for BJ_Shadow wakeup filtering */
332 BH_JBDPrivateStart, /* First bit available for private use by FS */
332}; 333};
333 334
334BUFFER_FNS(JBD, jbd) 335BUFFER_FNS(JBD, jbd)
@@ -637,6 +638,11 @@ struct transaction_s
637 unsigned long t_expires; 638 unsigned long t_expires;
638 639
639 /* 640 /*
641 * When this transaction started, in nanoseconds [no locking]
642 */
643 ktime_t t_start_time;
644
645 /*
640 * How many handles used this transaction? [t_handle_lock] 646 * How many handles used this transaction? [t_handle_lock]
641 */ 647 */
642 int t_handle_count; 648 int t_handle_count;
@@ -681,6 +687,8 @@ jbd2_time_diff(unsigned long start, unsigned long end)
681 return end + (MAX_JIFFY_OFFSET - start); 687 return end + (MAX_JIFFY_OFFSET - start);
682} 688}
683 689
690#define JBD2_NR_BATCH 64
691
684/** 692/**
685 * struct journal_s - The journal_s type is the concrete type associated with 693 * struct journal_s - The journal_s type is the concrete type associated with
686 * journal_t. 694 * journal_t.
@@ -825,6 +833,14 @@ struct journal_s
825 struct mutex j_checkpoint_mutex; 833 struct mutex j_checkpoint_mutex;
826 834
827 /* 835 /*
836 * List of buffer heads used by the checkpoint routine. This
837 * was moved from jbd2_log_do_checkpoint() to reduce stack
838 * usage. Access to this array is controlled by the
839 * j_checkpoint_mutex. [j_checkpoint_mutex]
840 */
841 struct buffer_head *j_chkpt_bhs[JBD2_NR_BATCH];
842
843 /*
828 * Journal head: identifies the first unused block in the journal. 844 * Journal head: identifies the first unused block in the journal.
829 * [j_state_lock] 845 * [j_state_lock]
830 */ 846 */
@@ -938,8 +954,26 @@ struct journal_s
938 struct buffer_head **j_wbuf; 954 struct buffer_head **j_wbuf;
939 int j_wbufsize; 955 int j_wbufsize;
940 956
957 /*
958 * this is the pid of hte last person to run a synchronous operation
959 * through the journal
960 */
941 pid_t j_last_sync_writer; 961 pid_t j_last_sync_writer;
942 962
963 /*
964 * the average amount of time in nanoseconds it takes to commit a
965 * transaction to disk. [j_state_lock]
966 */
967 u64 j_average_commit_time;
968
969 /*
970 * minimum and maximum times that we should wait for
971 * additional filesystem operations to get batched into a
972 * synchronous handle in microseconds
973 */
974 u32 j_min_batch_time;
975 u32 j_max_batch_time;
976
943 /* This function is called when a transaction is closed */ 977 /* This function is called when a transaction is closed */
944 void (*j_commit_callback)(journal_t *, 978 void (*j_commit_callback)(journal_t *,
945 transaction_t *); 979 transaction_t *);
@@ -1007,6 +1041,35 @@ int __jbd2_journal_clean_checkpoint_list(journal_t *journal);
1007int __jbd2_journal_remove_checkpoint(struct journal_head *); 1041int __jbd2_journal_remove_checkpoint(struct journal_head *);
1008void __jbd2_journal_insert_checkpoint(struct journal_head *, transaction_t *); 1042void __jbd2_journal_insert_checkpoint(struct journal_head *, transaction_t *);
1009 1043
1044
1045/*
1046 * Triggers
1047 */
1048
1049struct jbd2_buffer_trigger_type {
1050 /*
1051 * Fired just before a buffer is written to the journal.
1052 * mapped_data is a mapped buffer that is the frozen data for
1053 * commit.
1054 */
1055 void (*t_commit)(struct jbd2_buffer_trigger_type *type,
1056 struct buffer_head *bh, void *mapped_data,
1057 size_t size);
1058
1059 /*
1060 * Fired during journal abort for dirty buffers that will not be
1061 * committed.
1062 */
1063 void (*t_abort)(struct jbd2_buffer_trigger_type *type,
1064 struct buffer_head *bh);
1065};
1066
1067extern void jbd2_buffer_commit_trigger(struct journal_head *jh,
1068 void *mapped_data,
1069 struct jbd2_buffer_trigger_type *triggers);
1070extern void jbd2_buffer_abort_trigger(struct journal_head *jh,
1071 struct jbd2_buffer_trigger_type *triggers);
1072
1010/* Buffer IO */ 1073/* Buffer IO */
1011extern int 1074extern int
1012jbd2_journal_write_metadata_buffer(transaction_t *transaction, 1075jbd2_journal_write_metadata_buffer(transaction_t *transaction,
@@ -1045,6 +1108,8 @@ extern int jbd2_journal_extend (handle_t *, int nblocks);
1045extern int jbd2_journal_get_write_access(handle_t *, struct buffer_head *); 1108extern int jbd2_journal_get_write_access(handle_t *, struct buffer_head *);
1046extern int jbd2_journal_get_create_access (handle_t *, struct buffer_head *); 1109extern int jbd2_journal_get_create_access (handle_t *, struct buffer_head *);
1047extern int jbd2_journal_get_undo_access(handle_t *, struct buffer_head *); 1110extern int jbd2_journal_get_undo_access(handle_t *, struct buffer_head *);
1111void jbd2_journal_set_triggers(struct buffer_head *,
1112 struct jbd2_buffer_trigger_type *type);
1048extern int jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *); 1113extern int jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *);
1049extern void jbd2_journal_release_buffer (handle_t *, struct buffer_head *); 1114extern void jbd2_journal_release_buffer (handle_t *, struct buffer_head *);
1050extern int jbd2_journal_forget (handle_t *, struct buffer_head *); 1115extern int jbd2_journal_forget (handle_t *, struct buffer_head *);
@@ -1070,7 +1135,6 @@ extern int jbd2_journal_set_features
1070 (journal_t *, unsigned long, unsigned long, unsigned long); 1135 (journal_t *, unsigned long, unsigned long, unsigned long);
1071extern void jbd2_journal_clear_features 1136extern void jbd2_journal_clear_features
1072 (journal_t *, unsigned long, unsigned long, unsigned long); 1137 (journal_t *, unsigned long, unsigned long, unsigned long);
1073extern int jbd2_journal_create (journal_t *);
1074extern int jbd2_journal_load (journal_t *journal); 1138extern int jbd2_journal_load (journal_t *journal);
1075extern int jbd2_journal_destroy (journal_t *); 1139extern int jbd2_journal_destroy (journal_t *);
1076extern int jbd2_journal_recover (journal_t *journal); 1140extern int jbd2_journal_recover (journal_t *journal);
@@ -1145,8 +1209,8 @@ int jbd2_log_wait_commit(journal_t *journal, tid_t tid);
1145int jbd2_log_do_checkpoint(journal_t *journal); 1209int jbd2_log_do_checkpoint(journal_t *journal);
1146 1210
1147void __jbd2_log_wait_for_space(journal_t *journal); 1211void __jbd2_log_wait_for_space(journal_t *journal);
1148extern void __jbd2_journal_drop_transaction(journal_t *, transaction_t *); 1212extern void __jbd2_journal_drop_transaction(journal_t *, transaction_t *);
1149extern int jbd2_cleanup_journal_tail(journal_t *); 1213extern int jbd2_cleanup_journal_tail(journal_t *);
1150 1214
1151/* Debugging code only: */ 1215/* Debugging code only: */
1152 1216
diff --git a/include/linux/journal-head.h b/include/linux/journal-head.h
index bb70ebb6a2d5..525aac3c97df 100644
--- a/include/linux/journal-head.h
+++ b/include/linux/journal-head.h
@@ -12,6 +12,8 @@
12 12
13typedef unsigned int tid_t; /* Unique transaction ID */ 13typedef unsigned int tid_t; /* Unique transaction ID */
14typedef struct transaction_s transaction_t; /* Compound transaction type */ 14typedef struct transaction_s transaction_t; /* Compound transaction type */
15
16
15struct buffer_head; 17struct buffer_head;
16 18
17struct journal_head { 19struct journal_head {
@@ -87,6 +89,12 @@ struct journal_head {
87 * [j_list_lock] 89 * [j_list_lock]
88 */ 90 */
89 struct journal_head *b_cpnext, *b_cpprev; 91 struct journal_head *b_cpnext, *b_cpprev;
92
93 /* Trigger type */
94 struct jbd2_buffer_trigger_type *b_triggers;
95
96 /* Trigger type for the committing transaction's frozen data */
97 struct jbd2_buffer_trigger_type *b_frozen_triggers;
90}; 98};
91 99
92#endif /* JOURNAL_HEAD_H_INCLUDED */ 100#endif /* JOURNAL_HEAD_H_INCLUDED */
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index ca9ff6411dfa..343df9ef2412 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -48,6 +48,12 @@ extern const char linux_proc_banner[];
48#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f)) 48#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f))
49#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) 49#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
50#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) 50#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
51#define DIV_ROUND_CLOSEST(x, divisor)( \
52{ \
53 typeof(divisor) __divisor = divisor; \
54 (((x) + ((__divisor) / 2)) / (__divisor)); \
55} \
56)
51 57
52#define _RET_IP_ (unsigned long)__builtin_return_address(0) 58#define _RET_IP_ (unsigned long)__builtin_return_address(0)
53#define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; }) 59#define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; })
@@ -349,13 +355,13 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
349 printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) 355 printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
350 356
351/* If you are writing a driver, please use dev_dbg instead */ 357/* If you are writing a driver, please use dev_dbg instead */
352#if defined(CONFIG_DYNAMIC_PRINTK_DEBUG) 358#if defined(DEBUG)
359#define pr_debug(fmt, ...) \
360 printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
361#elif defined(CONFIG_DYNAMIC_PRINTK_DEBUG)
353#define pr_debug(fmt, ...) do { \ 362#define pr_debug(fmt, ...) do { \
354 dynamic_pr_debug(pr_fmt(fmt), ##__VA_ARGS__); \ 363 dynamic_pr_debug(pr_fmt(fmt), ##__VA_ARGS__); \
355 } while (0) 364 } while (0)
356#elif defined(DEBUG)
357#define pr_debug(fmt, ...) \
358 printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
359#else 365#else
360#define pr_debug(fmt, ...) \ 366#define pr_debug(fmt, ...) \
361 ({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; }) 367 ({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; })
@@ -470,6 +476,12 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
470 __val = __val < __min ? __min: __val; \ 476 __val = __val < __min ? __min: __val; \
471 __val > __max ? __max: __val; }) 477 __val > __max ? __max: __val; })
472 478
479
480/*
481 * swap - swap value of @a and @b
482 */
483#define swap(a, b) ({ typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; })
484
473/** 485/**
474 * container_of - cast a member of a structure out to the containing structure 486 * container_of - cast a member of a structure out to the containing structure
475 * @ptr: the pointer to the member. 487 * @ptr: the pointer to the member.
diff --git a/include/linux/klist.h b/include/linux/klist.h
index 8ea98db223e5..d5a27af9dba5 100644
--- a/include/linux/klist.h
+++ b/include/linux/klist.h
@@ -13,7 +13,6 @@
13#define _LINUX_KLIST_H 13#define _LINUX_KLIST_H
14 14
15#include <linux/spinlock.h> 15#include <linux/spinlock.h>
16#include <linux/completion.h>
17#include <linux/kref.h> 16#include <linux/kref.h>
18#include <linux/list.h> 17#include <linux/list.h>
19 18
@@ -41,7 +40,6 @@ struct klist_node {
41 void *n_klist; /* never access directly */ 40 void *n_klist; /* never access directly */
42 struct list_head n_node; 41 struct list_head n_node;
43 struct kref n_ref; 42 struct kref n_ref;
44 struct completion n_removed;
45}; 43};
46 44
47extern void klist_add_tail(struct klist_node *n, struct klist *k); 45extern void klist_add_tail(struct klist_node *n, struct klist *k);
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index 497b1d1f7a05..d6ea19e314bb 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -69,9 +69,6 @@ struct kprobe {
69 /* list of kprobes for multi-handler support */ 69 /* list of kprobes for multi-handler support */
70 struct list_head list; 70 struct list_head list;
71 71
72 /* Indicates that the corresponding module has been ref counted */
73 unsigned int mod_refcounted;
74
75 /*count the number of times this probe was temporarily disarmed */ 72 /*count the number of times this probe was temporarily disarmed */
76 unsigned long nmissed; 73 unsigned long nmissed;
77 74
@@ -103,8 +100,19 @@ struct kprobe {
103 100
104 /* copy of the original instruction */ 101 /* copy of the original instruction */
105 struct arch_specific_insn ainsn; 102 struct arch_specific_insn ainsn;
103
104 /* Indicates various status flags. Protected by kprobe_mutex. */
105 u32 flags;
106}; 106};
107 107
108/* Kprobe status flags */
109#define KPROBE_FLAG_GONE 1 /* breakpoint has already gone */
110
111static inline int kprobe_gone(struct kprobe *p)
112{
113 return p->flags & KPROBE_FLAG_GONE;
114}
115
108/* 116/*
109 * Special probe type that uses setjmp-longjmp type tricks to resume 117 * Special probe type that uses setjmp-longjmp type tricks to resume
110 * execution at a specified entry with a matching prototype corresponding 118 * execution at a specified entry with a matching prototype corresponding
@@ -201,7 +209,6 @@ static inline int init_test_probes(void)
201} 209}
202#endif /* CONFIG_KPROBES_SANITY_TEST */ 210#endif /* CONFIG_KPROBES_SANITY_TEST */
203 211
204extern struct mutex kprobe_mutex;
205extern int arch_prepare_kprobe(struct kprobe *p); 212extern int arch_prepare_kprobe(struct kprobe *p);
206extern void arch_arm_kprobe(struct kprobe *p); 213extern void arch_arm_kprobe(struct kprobe *p);
207extern void arch_disarm_kprobe(struct kprobe *p); 214extern void arch_disarm_kprobe(struct kprobe *p);
diff --git a/include/linux/leds-pca9532.h b/include/linux/leds-pca9532.h
index 81b4207deb95..96eea90f01a8 100644
--- a/include/linux/leds-pca9532.h
+++ b/include/linux/leds-pca9532.h
@@ -15,6 +15,7 @@
15#define __LINUX_PCA9532_H 15#define __LINUX_PCA9532_H
16 16
17#include <linux/leds.h> 17#include <linux/leds.h>
18#include <linux/workqueue.h>
18 19
19enum pca9532_state { 20enum pca9532_state {
20 PCA9532_OFF = 0x0, 21 PCA9532_OFF = 0x0,
@@ -31,6 +32,7 @@ struct pca9532_led {
31 struct i2c_client *client; 32 struct i2c_client *client;
32 char *name; 33 char *name;
33 struct led_classdev ldev; 34 struct led_classdev ldev;
35 struct work_struct work;
34 enum pca9532_type type; 36 enum pca9532_type type;
35 enum pca9532_state state; 37 enum pca9532_state state;
36}; 38};
diff --git a/include/linux/leds.h b/include/linux/leds.h
index d3a73f5a48c3..24489da701e3 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -32,7 +32,10 @@ struct led_classdev {
32 int brightness; 32 int brightness;
33 int flags; 33 int flags;
34 34
35 /* Lower 16 bits reflect status */
35#define LED_SUSPENDED (1 << 0) 36#define LED_SUSPENDED (1 << 0)
37 /* Upper 16 bits reflect control information */
38#define LED_CORE_SUSPENDRESUME (1 << 16)
36 39
37 /* Set LED brightness level */ 40 /* Set LED brightness level */
38 /* Must not sleep, use a workqueue if needed */ 41 /* Must not sleep, use a workqueue if needed */
@@ -62,7 +65,7 @@ struct led_classdev {
62 65
63extern int led_classdev_register(struct device *parent, 66extern int led_classdev_register(struct device *parent,
64 struct led_classdev *led_cdev); 67 struct led_classdev *led_cdev);
65extern void led_classdev_unregister(struct led_classdev *lcd); 68extern void led_classdev_unregister(struct led_classdev *led_cdev);
66extern void led_classdev_suspend(struct led_classdev *led_cdev); 69extern void led_classdev_suspend(struct led_classdev *led_cdev);
67extern void led_classdev_resume(struct led_classdev *led_cdev); 70extern void led_classdev_resume(struct led_classdev *led_cdev);
68 71
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 3449de597eff..4f7c8fb4d3fe 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -1518,6 +1518,7 @@ extern void sata_pmp_error_handler(struct ata_port *ap);
1518 1518
1519extern const struct ata_port_operations ata_sff_port_ops; 1519extern const struct ata_port_operations ata_sff_port_ops;
1520extern const struct ata_port_operations ata_bmdma_port_ops; 1520extern const struct ata_port_operations ata_bmdma_port_ops;
1521extern const struct ata_port_operations ata_bmdma32_port_ops;
1521 1522
1522/* PIO only, sg_tablesize and dma_boundary limits can be removed */ 1523/* PIO only, sg_tablesize and dma_boundary limits can be removed */
1523#define ATA_PIO_SHT(drv_name) \ 1524#define ATA_PIO_SHT(drv_name) \
@@ -1545,6 +1546,8 @@ extern void ata_sff_exec_command(struct ata_port *ap,
1545 const struct ata_taskfile *tf); 1546 const struct ata_taskfile *tf);
1546extern unsigned int ata_sff_data_xfer(struct ata_device *dev, 1547extern unsigned int ata_sff_data_xfer(struct ata_device *dev,
1547 unsigned char *buf, unsigned int buflen, int rw); 1548 unsigned char *buf, unsigned int buflen, int rw);
1549extern unsigned int ata_sff_data_xfer32(struct ata_device *dev,
1550 unsigned char *buf, unsigned int buflen, int rw);
1548extern unsigned int ata_sff_data_xfer_noirq(struct ata_device *dev, 1551extern unsigned int ata_sff_data_xfer_noirq(struct ata_device *dev,
1549 unsigned char *buf, unsigned int buflen, int rw); 1552 unsigned char *buf, unsigned int buflen, int rw);
1550extern u8 ata_sff_irq_on(struct ata_port *ap); 1553extern u8 ata_sff_irq_on(struct ata_port *ap);
diff --git a/include/linux/libps2.h b/include/linux/libps2.h
index afc413369101..b94534b7e266 100644
--- a/include/linux/libps2.h
+++ b/include/linux/libps2.h
@@ -18,11 +18,13 @@
18#define PS2_RET_ID 0x00 18#define PS2_RET_ID 0x00
19#define PS2_RET_ACK 0xfa 19#define PS2_RET_ACK 0xfa
20#define PS2_RET_NAK 0xfe 20#define PS2_RET_NAK 0xfe
21#define PS2_RET_ERR 0xfc
21 22
22#define PS2_FLAG_ACK 1 /* Waiting for ACK/NAK */ 23#define PS2_FLAG_ACK 1 /* Waiting for ACK/NAK */
23#define PS2_FLAG_CMD 2 /* Waiting for command to finish */ 24#define PS2_FLAG_CMD 2 /* Waiting for command to finish */
24#define PS2_FLAG_CMD1 4 /* Waiting for the first byte of command response */ 25#define PS2_FLAG_CMD1 4 /* Waiting for the first byte of command response */
25#define PS2_FLAG_WAITID 8 /* Command execiting is GET ID */ 26#define PS2_FLAG_WAITID 8 /* Command execiting is GET ID */
27#define PS2_FLAG_NAK 16 /* Last transmission was NAKed */
26 28
27struct ps2dev { 29struct ps2dev {
28 struct serio *serio; 30 struct serio *serio;
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index 23da3fa69efa..aa6fe7026de7 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -43,8 +43,8 @@ struct nlm_host {
43 struct sockaddr_storage h_addr; /* peer address */ 43 struct sockaddr_storage h_addr; /* peer address */
44 size_t h_addrlen; 44 size_t h_addrlen;
45 struct sockaddr_storage h_srcaddr; /* our address (optional) */ 45 struct sockaddr_storage h_srcaddr; /* our address (optional) */
46 struct rpc_clnt * h_rpcclnt; /* RPC client to talk to peer */ 46 struct rpc_clnt *h_rpcclnt; /* RPC client to talk to peer */
47 char * h_name; /* remote hostname */ 47 char *h_name; /* remote hostname */
48 u32 h_version; /* interface version */ 48 u32 h_version; /* interface version */
49 unsigned short h_proto; /* transport proto */ 49 unsigned short h_proto; /* transport proto */
50 unsigned short h_reclaiming : 1, 50 unsigned short h_reclaiming : 1,
@@ -64,21 +64,29 @@ struct nlm_host {
64 spinlock_t h_lock; 64 spinlock_t h_lock;
65 struct list_head h_granted; /* Locks in GRANTED state */ 65 struct list_head h_granted; /* Locks in GRANTED state */
66 struct list_head h_reclaim; /* Locks in RECLAIM state */ 66 struct list_head h_reclaim; /* Locks in RECLAIM state */
67 struct nsm_handle * h_nsmhandle; /* NSM status handle */ 67 struct nsm_handle *h_nsmhandle; /* NSM status handle */
68 68 char *h_addrbuf; /* address eyecatcher */
69 char h_addrbuf[48], /* address eyecatchers */
70 h_srcaddrbuf[48];
71}; 69};
72 70
71/*
72 * The largest string sm_addrbuf should hold is a full-size IPv6 address
73 * (no "::" anywhere) with a scope ID. The buffer size is computed to
74 * hold eight groups of colon-separated four-hex-digit numbers, a
75 * percent sign, a scope id (at most 32 bits, in decimal), and NUL.
76 */
77#define NSM_ADDRBUF ((8 * 4 + 7) + (1 + 10) + 1)
78
73struct nsm_handle { 79struct nsm_handle {
74 struct list_head sm_link; 80 struct list_head sm_link;
75 atomic_t sm_count; 81 atomic_t sm_count;
76 char * sm_name; 82 char *sm_mon_name;
83 char *sm_name;
77 struct sockaddr_storage sm_addr; 84 struct sockaddr_storage sm_addr;
78 size_t sm_addrlen; 85 size_t sm_addrlen;
79 unsigned int sm_monitored : 1, 86 unsigned int sm_monitored : 1,
80 sm_sticky : 1; /* don't unmonitor */ 87 sm_sticky : 1; /* don't unmonitor */
81 char sm_addrbuf[48]; /* address eyecatcher */ 88 struct nsm_private sm_priv;
89 char sm_addrbuf[NSM_ADDRBUF];
82}; 90};
83 91
84/* 92/*
@@ -104,16 +112,6 @@ static inline struct sockaddr *nlm_srcaddr(const struct nlm_host *host)
104 return (struct sockaddr *)&host->h_srcaddr; 112 return (struct sockaddr *)&host->h_srcaddr;
105} 113}
106 114
107static inline struct sockaddr_in *nsm_addr_in(const struct nsm_handle *handle)
108{
109 return (struct sockaddr_in *)&handle->sm_addr;
110}
111
112static inline struct sockaddr *nsm_addr(const struct nsm_handle *handle)
113{
114 return (struct sockaddr *)&handle->sm_addr;
115}
116
117/* 115/*
118 * Map an fl_owner_t into a unique 32-bit "pid" 116 * Map an fl_owner_t into a unique 32-bit "pid"
119 */ 117 */
@@ -197,6 +195,7 @@ extern struct svc_procedure nlmsvc_procedures4[];
197extern int nlmsvc_grace_period; 195extern int nlmsvc_grace_period;
198extern unsigned long nlmsvc_timeout; 196extern unsigned long nlmsvc_timeout;
199extern int nsm_use_hostnames; 197extern int nsm_use_hostnames;
198extern int nsm_local_state;
200 199
201/* 200/*
202 * Lockd client functions 201 * Lockd client functions
@@ -231,10 +230,20 @@ void nlm_rebind_host(struct nlm_host *);
231struct nlm_host * nlm_get_host(struct nlm_host *); 230struct nlm_host * nlm_get_host(struct nlm_host *);
232void nlm_release_host(struct nlm_host *); 231void nlm_release_host(struct nlm_host *);
233void nlm_shutdown_hosts(void); 232void nlm_shutdown_hosts(void);
234extern void nlm_host_rebooted(const struct sockaddr_in *, const char *, 233void nlm_host_rebooted(const struct nlm_reboot *);
235 unsigned int, u32);
236void nsm_release(struct nsm_handle *);
237 234
235/*
236 * Host monitoring
237 */
238int nsm_monitor(const struct nlm_host *host);
239void nsm_unmonitor(const struct nlm_host *host);
240
241struct nsm_handle *nsm_get_handle(const struct sockaddr *sap,
242 const size_t salen,
243 const char *hostname,
244 const size_t hostname_len);
245struct nsm_handle *nsm_reboot_lookup(const struct nlm_reboot *info);
246void nsm_release(struct nsm_handle *nsm);
238 247
239/* 248/*
240 * This is used in garbage collection and resource reclaim 249 * This is used in garbage collection and resource reclaim
@@ -282,16 +291,25 @@ static inline struct inode *nlmsvc_file_inode(struct nlm_file *file)
282static inline int __nlm_privileged_request4(const struct sockaddr *sap) 291static inline int __nlm_privileged_request4(const struct sockaddr *sap)
283{ 292{
284 const struct sockaddr_in *sin = (struct sockaddr_in *)sap; 293 const struct sockaddr_in *sin = (struct sockaddr_in *)sap;
285 return (sin->sin_addr.s_addr == htonl(INADDR_LOOPBACK)) && 294
286 (ntohs(sin->sin_port) < 1024); 295 if (ntohs(sin->sin_port) > 1023)
296 return 0;
297
298 return ipv4_is_loopback(sin->sin_addr.s_addr);
287} 299}
288 300
289#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 301#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
290static inline int __nlm_privileged_request6(const struct sockaddr *sap) 302static inline int __nlm_privileged_request6(const struct sockaddr *sap)
291{ 303{
292 const struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sap; 304 const struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sap;
293 return (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LOOPBACK) && 305
294 (ntohs(sin6->sin6_port) < 1024); 306 if (ntohs(sin6->sin6_port) > 1023)
307 return 0;
308
309 if (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_MAPPED)
310 return ipv4_is_loopback(sin6->sin6_addr.s6_addr32[3]);
311
312 return ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LOOPBACK;
295} 313}
296#else /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ 314#else /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */
297static inline int __nlm_privileged_request6(const struct sockaddr *sap) 315static inline int __nlm_privileged_request6(const struct sockaddr *sap)
diff --git a/include/linux/lockd/sm_inter.h b/include/linux/lockd/sm_inter.h
deleted file mode 100644
index 5a5448bdb17d..000000000000
--- a/include/linux/lockd/sm_inter.h
+++ /dev/null
@@ -1,48 +0,0 @@
1/*
2 * linux/include/linux/lockd/sm_inter.h
3 *
4 * Declarations for the kernel statd client.
5 *
6 * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de>
7 */
8
9#ifndef LINUX_LOCKD_SM_INTER_H
10#define LINUX_LOCKD_SM_INTER_H
11
12#define SM_PROGRAM 100024
13#define SM_VERSION 1
14#define SM_STAT 1
15#define SM_MON 2
16#define SM_UNMON 3
17#define SM_UNMON_ALL 4
18#define SM_SIMU_CRASH 5
19#define SM_NOTIFY 6
20
21#define SM_MAXSTRLEN 1024
22#define SM_PRIV_SIZE 16
23
24/*
25 * Arguments for all calls to statd
26 */
27struct nsm_args {
28 __be32 addr; /* remote address */
29 u32 prog; /* RPC callback info */
30 u32 vers;
31 u32 proc;
32
33 char * mon_name;
34};
35
36/*
37 * Result returned by statd
38 */
39struct nsm_res {
40 u32 status;
41 u32 state;
42};
43
44int nsm_monitor(struct nlm_host *);
45int nsm_unmonitor(struct nlm_host *);
46extern int nsm_local_state;
47
48#endif /* LINUX_LOCKD_SM_INTER_H */
diff --git a/include/linux/lockd/xdr.h b/include/linux/lockd/xdr.h
index d6b3a802c046..7dc5b6cb44cd 100644
--- a/include/linux/lockd/xdr.h
+++ b/include/linux/lockd/xdr.h
@@ -13,6 +13,13 @@
13#include <linux/nfs.h> 13#include <linux/nfs.h>
14#include <linux/sunrpc/xdr.h> 14#include <linux/sunrpc/xdr.h>
15 15
16#define SM_MAXSTRLEN 1024
17#define SM_PRIV_SIZE 16
18
19struct nsm_private {
20 unsigned char data[SM_PRIV_SIZE];
21};
22
16struct svc_rqst; 23struct svc_rqst;
17 24
18#define NLM_MAXCOOKIELEN 32 25#define NLM_MAXCOOKIELEN 32
@@ -77,10 +84,10 @@ struct nlm_res {
77 * statd callback when client has rebooted 84 * statd callback when client has rebooted
78 */ 85 */
79struct nlm_reboot { 86struct nlm_reboot {
80 char * mon; 87 char *mon;
81 unsigned int len; 88 unsigned int len;
82 u32 state; 89 u32 state;
83 __be32 addr; 90 struct nsm_private priv;
84}; 91};
85 92
86/* 93/*
diff --git a/include/linux/mISDNhw.h b/include/linux/mISDNhw.h
index e794dfb87504..97ffdc1d3442 100644
--- a/include/linux/mISDNhw.h
+++ b/include/linux/mISDNhw.h
@@ -57,20 +57,21 @@
57#define FLG_L2DATA 14 /* channel use L2 DATA primitivs */ 57#define FLG_L2DATA 14 /* channel use L2 DATA primitivs */
58#define FLG_ORIGIN 15 /* channel is on origin site */ 58#define FLG_ORIGIN 15 /* channel is on origin site */
59/* channel specific stuff */ 59/* channel specific stuff */
60#define FLG_FILLEMPTY 16 /* fill fifo on first frame (empty) */
60/* arcofi specific */ 61/* arcofi specific */
61#define FLG_ARCOFI_TIMER 16 62#define FLG_ARCOFI_TIMER 17
62#define FLG_ARCOFI_ERROR 17 63#define FLG_ARCOFI_ERROR 18
63/* isar specific */ 64/* isar specific */
64#define FLG_INITIALIZED 16 65#define FLG_INITIALIZED 17
65#define FLG_DLEETX 17 66#define FLG_DLEETX 18
66#define FLG_LASTDLE 18 67#define FLG_LASTDLE 19
67#define FLG_FIRST 19 68#define FLG_FIRST 20
68#define FLG_LASTDATA 20 69#define FLG_LASTDATA 21
69#define FLG_NMD_DATA 21 70#define FLG_NMD_DATA 22
70#define FLG_FTI_RUN 22 71#define FLG_FTI_RUN 23
71#define FLG_LL_OK 23 72#define FLG_LL_OK 24
72#define FLG_LL_CONN 24 73#define FLG_LL_CONN 25
73#define FLG_DTMFSEND 25 74#define FLG_DTMFSEND 26
74 75
75/* workq events */ 76/* workq events */
76#define FLG_RECVQUEUE 30 77#define FLG_RECVQUEUE 30
@@ -183,6 +184,7 @@ extern void queue_ch_frame(struct mISDNchannel *, u_int,
183extern int dchannel_senddata(struct dchannel *, struct sk_buff *); 184extern int dchannel_senddata(struct dchannel *, struct sk_buff *);
184extern int bchannel_senddata(struct bchannel *, struct sk_buff *); 185extern int bchannel_senddata(struct bchannel *, struct sk_buff *);
185extern void recv_Dchannel(struct dchannel *); 186extern void recv_Dchannel(struct dchannel *);
187extern void recv_Echannel(struct dchannel *, struct dchannel *);
186extern void recv_Bchannel(struct bchannel *); 188extern void recv_Bchannel(struct bchannel *);
187extern void recv_Dchannel_skb(struct dchannel *, struct sk_buff *); 189extern void recv_Dchannel_skb(struct dchannel *, struct sk_buff *);
188extern void recv_Bchannel_skb(struct bchannel *, struct sk_buff *); 190extern void recv_Bchannel_skb(struct bchannel *, struct sk_buff *);
diff --git a/include/linux/mISDNif.h b/include/linux/mISDNif.h
index 8f2d60da04e7..557477ac3d5b 100644
--- a/include/linux/mISDNif.h
+++ b/include/linux/mISDNif.h
@@ -36,8 +36,8 @@
36 * - should be incremented on every checkin 36 * - should be incremented on every checkin
37 */ 37 */
38#define MISDN_MAJOR_VERSION 1 38#define MISDN_MAJOR_VERSION 1
39#define MISDN_MINOR_VERSION 0 39#define MISDN_MINOR_VERSION 1
40#define MISDN_RELEASE 19 40#define MISDN_RELEASE 20
41 41
42/* primitives for information exchange 42/* primitives for information exchange
43 * generell format 43 * generell format
@@ -80,6 +80,7 @@
80#define PH_DEACTIVATE_IND 0x0202 80#define PH_DEACTIVATE_IND 0x0202
81#define PH_DEACTIVATE_CNF 0x4202 81#define PH_DEACTIVATE_CNF 0x4202
82#define PH_DATA_IND 0x2002 82#define PH_DATA_IND 0x2002
83#define PH_DATA_E_IND 0x3002
83#define MPH_ACTIVATE_IND 0x0502 84#define MPH_ACTIVATE_IND 0x0502
84#define MPH_DEACTIVATE_IND 0x0602 85#define MPH_DEACTIVATE_IND 0x0602
85#define MPH_INFORMATION_IND 0x0702 86#define MPH_INFORMATION_IND 0x0702
@@ -199,6 +200,18 @@
199#define ISDN_P_NT_S0 0x02 200#define ISDN_P_NT_S0 0x02
200#define ISDN_P_TE_E1 0x03 201#define ISDN_P_TE_E1 0x03
201#define ISDN_P_NT_E1 0x04 202#define ISDN_P_NT_E1 0x04
203#define ISDN_P_TE_UP0 0x05
204#define ISDN_P_NT_UP0 0x06
205
206#define IS_ISDN_P_TE(p) ((p == ISDN_P_TE_S0) || (p == ISDN_P_TE_E1) || \
207 (p == ISDN_P_TE_UP0) || (p == ISDN_P_LAPD_TE))
208#define IS_ISDN_P_NT(p) ((p == ISDN_P_NT_S0) || (p == ISDN_P_NT_E1) || \
209 (p == ISDN_P_NT_UP0) || (p == ISDN_P_LAPD_NT))
210#define IS_ISDN_P_S0(p) ((p == ISDN_P_TE_S0) || (p == ISDN_P_NT_S0))
211#define IS_ISDN_P_E1(p) ((p == ISDN_P_TE_E1) || (p == ISDN_P_NT_E1))
212#define IS_ISDN_P_UP0(p) ((p == ISDN_P_TE_UP0) || (p == ISDN_P_NT_UP0))
213
214
202#define ISDN_P_LAPD_TE 0x10 215#define ISDN_P_LAPD_TE 0x10
203#define ISDN_P_LAPD_NT 0x11 216#define ISDN_P_LAPD_NT 0x11
204 217
@@ -255,16 +268,6 @@ struct sockaddr_mISDN {
255 unsigned char tei; 268 unsigned char tei;
256}; 269};
257 270
258/* timer device ioctl */
259#define IMADDTIMER _IOR('I', 64, int)
260#define IMDELTIMER _IOR('I', 65, int)
261/* socket ioctls */
262#define IMGETVERSION _IOR('I', 66, int)
263#define IMGETCOUNT _IOR('I', 67, int)
264#define IMGETDEVINFO _IOR('I', 68, int)
265#define IMCTRLREQ _IOR('I', 69, int)
266#define IMCLEAR_L2 _IOR('I', 70, int)
267
268struct mISDNversion { 271struct mISDNversion {
269 unsigned char major; 272 unsigned char major;
270 unsigned char minor; 273 unsigned char minor;
@@ -281,6 +284,40 @@ struct mISDN_devinfo {
281 char name[MISDN_MAX_IDLEN]; 284 char name[MISDN_MAX_IDLEN];
282}; 285};
283 286
287struct mISDN_devrename {
288 u_int id;
289 char name[MISDN_MAX_IDLEN]; /* new name */
290};
291
292/* MPH_INFORMATION_REQ payload */
293struct ph_info_ch {
294 __u32 protocol;
295 __u64 Flags;
296};
297
298struct ph_info_dch {
299 struct ph_info_ch ch;
300 __u16 state;
301 __u16 num_bch;
302};
303
304struct ph_info {
305 struct ph_info_dch dch;
306 struct ph_info_ch bch[];
307};
308
309/* timer device ioctl */
310#define IMADDTIMER _IOR('I', 64, int)
311#define IMDELTIMER _IOR('I', 65, int)
312
313/* socket ioctls */
314#define IMGETVERSION _IOR('I', 66, int)
315#define IMGETCOUNT _IOR('I', 67, int)
316#define IMGETDEVINFO _IOR('I', 68, int)
317#define IMCTRLREQ _IOR('I', 69, int)
318#define IMCLEAR_L2 _IOR('I', 70, int)
319#define IMSETDEVNAME _IOR('I', 71, struct mISDN_devrename)
320
284static inline int 321static inline int
285test_channelmap(u_int nr, u_char *map) 322test_channelmap(u_int nr, u_char *map)
286{ 323{
@@ -312,6 +349,8 @@ clear_channelmap(u_int nr, u_char *map)
312#define MISDN_CTRL_SETPEER 0x0040 349#define MISDN_CTRL_SETPEER 0x0040
313#define MISDN_CTRL_UNSETPEER 0x0080 350#define MISDN_CTRL_UNSETPEER 0x0080
314#define MISDN_CTRL_RX_OFF 0x0100 351#define MISDN_CTRL_RX_OFF 0x0100
352#define MISDN_CTRL_FILL_EMPTY 0x0200
353#define MISDN_CTRL_GETPEER 0x0400
315#define MISDN_CTRL_HW_FEATURES_OP 0x2000 354#define MISDN_CTRL_HW_FEATURES_OP 0x2000
316#define MISDN_CTRL_HW_FEATURES 0x2001 355#define MISDN_CTRL_HW_FEATURES 0x2001
317#define MISDN_CTRL_HFC_OP 0x4000 356#define MISDN_CTRL_HFC_OP 0x4000
@@ -362,6 +401,7 @@ struct mISDN_ctrl_req {
362#define DEBUG_L2_TEI 0x00100000 401#define DEBUG_L2_TEI 0x00100000
363#define DEBUG_L2_TEIFSM 0x00200000 402#define DEBUG_L2_TEIFSM 0x00200000
364#define DEBUG_TIMER 0x01000000 403#define DEBUG_TIMER 0x01000000
404#define DEBUG_CLOCK 0x02000000
365 405
366#define mISDN_HEAD_P(s) ((struct mISDNhead *)&s->cb[0]) 406#define mISDN_HEAD_P(s) ((struct mISDNhead *)&s->cb[0])
367#define mISDN_HEAD_PRIM(s) (((struct mISDNhead *)&s->cb[0])->prim) 407#define mISDN_HEAD_PRIM(s) (((struct mISDNhead *)&s->cb[0])->prim)
@@ -375,6 +415,7 @@ struct mISDN_ctrl_req {
375struct mISDNchannel; 415struct mISDNchannel;
376struct mISDNdevice; 416struct mISDNdevice;
377struct mISDNstack; 417struct mISDNstack;
418struct mISDNclock;
378 419
379struct channel_req { 420struct channel_req {
380 u_int protocol; 421 u_int protocol;
@@ -423,7 +464,6 @@ struct mISDN_sock {
423struct mISDNdevice { 464struct mISDNdevice {
424 struct mISDNchannel D; 465 struct mISDNchannel D;
425 u_int id; 466 u_int id;
426 char name[MISDN_MAX_IDLEN];
427 u_int Dprotocols; 467 u_int Dprotocols;
428 u_int Bprotocols; 468 u_int Bprotocols;
429 u_int nrbchan; 469 u_int nrbchan;
@@ -452,6 +492,16 @@ struct mISDNstack {
452#endif 492#endif
453}; 493};
454 494
495typedef int (clockctl_func_t)(void *, int);
496
497struct mISDNclock {
498 struct list_head list;
499 char name[64];
500 int pri;
501 clockctl_func_t *ctl;
502 void *priv;
503};
504
455/* global alloc/queue functions */ 505/* global alloc/queue functions */
456 506
457static inline struct sk_buff * 507static inline struct sk_buff *
@@ -498,12 +548,23 @@ _queue_data(struct mISDNchannel *ch, u_int prim,
498 548
499/* global register/unregister functions */ 549/* global register/unregister functions */
500 550
501extern int mISDN_register_device(struct mISDNdevice *, char *name); 551extern int mISDN_register_device(struct mISDNdevice *,
552 struct device *parent, char *name);
502extern void mISDN_unregister_device(struct mISDNdevice *); 553extern void mISDN_unregister_device(struct mISDNdevice *);
503extern int mISDN_register_Bprotocol(struct Bprotocol *); 554extern int mISDN_register_Bprotocol(struct Bprotocol *);
504extern void mISDN_unregister_Bprotocol(struct Bprotocol *); 555extern void mISDN_unregister_Bprotocol(struct Bprotocol *);
556extern struct mISDNclock *mISDN_register_clock(char *, int, clockctl_func_t *,
557 void *);
558extern void mISDN_unregister_clock(struct mISDNclock *);
559
560static inline struct mISDNdevice *dev_to_mISDN(struct device *dev)
561{
562 return dev_get_drvdata(dev);
563}
505 564
506extern void set_channel_address(struct mISDNchannel *, u_int, u_int); 565extern void set_channel_address(struct mISDNchannel *, u_int, u_int);
566extern void mISDN_clock_update(struct mISDNclock *, int, struct timeval *);
567extern unsigned short mISDN_clock_get(void);
507 568
508#endif /* __KERNEL__ */ 569#endif /* __KERNEL__ */
509#endif /* mISDNIF_H */ 570#endif /* mISDNIF_H */
diff --git a/include/linux/magic.h b/include/linux/magic.h
index f7f3fdddbef0..439f6f3cb0c4 100644
--- a/include/linux/magic.h
+++ b/include/linux/magic.h
@@ -13,6 +13,7 @@
13#define EFS_SUPER_MAGIC 0x414A53 13#define EFS_SUPER_MAGIC 0x414A53
14#define EXT2_SUPER_MAGIC 0xEF53 14#define EXT2_SUPER_MAGIC 0xEF53
15#define EXT3_SUPER_MAGIC 0xEF53 15#define EXT3_SUPER_MAGIC 0xEF53
16#define XENFS_SUPER_MAGIC 0xabba1974
16#define EXT4_SUPER_MAGIC 0xEF53 17#define EXT4_SUPER_MAGIC 0xEF53
17#define HPFS_SUPER_MAGIC 0xf995e849 18#define HPFS_SUPER_MAGIC 0xf995e849
18#define ISOFS_SUPER_MAGIC 0x9660 19#define ISOFS_SUPER_MAGIC 0x9660
diff --git a/include/linux/map_to_7segment.h b/include/linux/map_to_7segment.h
index 7df8432c4402..12d62a54d470 100644
--- a/include/linux/map_to_7segment.h
+++ b/include/linux/map_to_7segment.h
@@ -75,7 +75,7 @@ struct seg7_conversion_map {
75 unsigned char table[128]; 75 unsigned char table[128];
76}; 76};
77 77
78static inline int map_to_seg7(struct seg7_conversion_map *map, int c) 78static __inline__ int map_to_seg7(struct seg7_conversion_map *map, int c)
79{ 79{
80 return c >= 0 && c < sizeof(map->table) ? map->table[c] : -EINVAL; 80 return c >= 0 && c < sizeof(map->table) ? map->table[c] : -EINVAL;
81} 81}
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 1fbe14d39521..326f45c86530 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -19,22 +19,45 @@
19 19
20#ifndef _LINUX_MEMCONTROL_H 20#ifndef _LINUX_MEMCONTROL_H
21#define _LINUX_MEMCONTROL_H 21#define _LINUX_MEMCONTROL_H
22 22#include <linux/cgroup.h>
23struct mem_cgroup; 23struct mem_cgroup;
24struct page_cgroup; 24struct page_cgroup;
25struct page; 25struct page;
26struct mm_struct; 26struct mm_struct;
27 27
28#ifdef CONFIG_CGROUP_MEM_RES_CTLR 28#ifdef CONFIG_CGROUP_MEM_RES_CTLR
29/*
30 * All "charge" functions with gfp_mask should use GFP_KERNEL or
31 * (gfp_mask & GFP_RECLAIM_MASK). In current implementatin, memcg doesn't
32 * alloc memory but reclaims memory from all available zones. So, "where I want
33 * memory from" bits of gfp_mask has no meaning. So any bits of that field is
34 * available but adding a rule is better. charge functions' gfp_mask should
35 * be set to GFP_KERNEL or gfp_mask & GFP_RECLAIM_MASK for avoiding ambiguous
36 * codes.
37 * (Of course, if memcg does memory allocation in future, GFP_KERNEL is sane.)
38 */
29 39
30extern int mem_cgroup_charge(struct page *page, struct mm_struct *mm, 40extern int mem_cgroup_newpage_charge(struct page *page, struct mm_struct *mm,
31 gfp_t gfp_mask); 41 gfp_t gfp_mask);
42/* for swap handling */
43extern int mem_cgroup_try_charge_swapin(struct mm_struct *mm,
44 struct page *page, gfp_t mask, struct mem_cgroup **ptr);
45extern void mem_cgroup_commit_charge_swapin(struct page *page,
46 struct mem_cgroup *ptr);
47extern void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *ptr);
48
32extern int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm, 49extern int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm,
33 gfp_t gfp_mask); 50 gfp_t gfp_mask);
34extern void mem_cgroup_move_lists(struct page *page, enum lru_list lru); 51extern void mem_cgroup_add_lru_list(struct page *page, enum lru_list lru);
52extern void mem_cgroup_del_lru_list(struct page *page, enum lru_list lru);
53extern void mem_cgroup_rotate_lru_list(struct page *page, enum lru_list lru);
54extern void mem_cgroup_del_lru(struct page *page);
55extern void mem_cgroup_move_lists(struct page *page,
56 enum lru_list from, enum lru_list to);
35extern void mem_cgroup_uncharge_page(struct page *page); 57extern void mem_cgroup_uncharge_page(struct page *page);
36extern void mem_cgroup_uncharge_cache_page(struct page *page); 58extern void mem_cgroup_uncharge_cache_page(struct page *page);
37extern int mem_cgroup_shrink_usage(struct mm_struct *mm, gfp_t gfp_mask); 59extern int mem_cgroup_shrink_usage(struct page *page,
60 struct mm_struct *mm, gfp_t gfp_mask);
38 61
39extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan, 62extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
40 struct list_head *dst, 63 struct list_head *dst,
@@ -47,12 +70,20 @@ int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem);
47 70
48extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p); 71extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p);
49 72
50#define mm_match_cgroup(mm, cgroup) \ 73static inline
51 ((cgroup) == mem_cgroup_from_task((mm)->owner)) 74int mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *cgroup)
75{
76 struct mem_cgroup *mem;
77 rcu_read_lock();
78 mem = mem_cgroup_from_task((mm)->owner);
79 rcu_read_unlock();
80 return cgroup == mem;
81}
52 82
53extern int 83extern int
54mem_cgroup_prepare_migration(struct page *page, struct page *newpage); 84mem_cgroup_prepare_migration(struct page *page, struct mem_cgroup **ptr);
55extern void mem_cgroup_end_migration(struct page *page); 85extern void mem_cgroup_end_migration(struct mem_cgroup *mem,
86 struct page *oldpage, struct page *newpage);
56 87
57/* 88/*
58 * For memory reclaim. 89 * For memory reclaim.
@@ -65,13 +96,32 @@ extern void mem_cgroup_note_reclaim_priority(struct mem_cgroup *mem,
65 int priority); 96 int priority);
66extern void mem_cgroup_record_reclaim_priority(struct mem_cgroup *mem, 97extern void mem_cgroup_record_reclaim_priority(struct mem_cgroup *mem,
67 int priority); 98 int priority);
99int mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg);
100unsigned long mem_cgroup_zone_nr_pages(struct mem_cgroup *memcg,
101 struct zone *zone,
102 enum lru_list lru);
103struct zone_reclaim_stat *mem_cgroup_get_reclaim_stat(struct mem_cgroup *memcg,
104 struct zone *zone);
105struct zone_reclaim_stat*
106mem_cgroup_get_reclaim_stat_from_page(struct page *page);
68 107
69extern long mem_cgroup_calc_reclaim(struct mem_cgroup *mem, struct zone *zone, 108#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
70 int priority, enum lru_list lru); 109extern int do_swap_account;
110#endif
71 111
112static inline bool mem_cgroup_disabled(void)
113{
114 if (mem_cgroup_subsys.disabled)
115 return true;
116 return false;
117}
118
119extern bool mem_cgroup_oom_called(struct task_struct *task);
72 120
73#else /* CONFIG_CGROUP_MEM_RES_CTLR */ 121#else /* CONFIG_CGROUP_MEM_RES_CTLR */
74static inline int mem_cgroup_charge(struct page *page, 122struct mem_cgroup;
123
124static inline int mem_cgroup_newpage_charge(struct page *page,
75 struct mm_struct *mm, gfp_t gfp_mask) 125 struct mm_struct *mm, gfp_t gfp_mask)
76{ 126{
77 return 0; 127 return 0;
@@ -83,6 +133,21 @@ static inline int mem_cgroup_cache_charge(struct page *page,
83 return 0; 133 return 0;
84} 134}
85 135
136static inline int mem_cgroup_try_charge_swapin(struct mm_struct *mm,
137 struct page *page, gfp_t gfp_mask, struct mem_cgroup **ptr)
138{
139 return 0;
140}
141
142static inline void mem_cgroup_commit_charge_swapin(struct page *page,
143 struct mem_cgroup *ptr)
144{
145}
146
147static inline void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *ptr)
148{
149}
150
86static inline void mem_cgroup_uncharge_page(struct page *page) 151static inline void mem_cgroup_uncharge_page(struct page *page)
87{ 152{
88} 153}
@@ -91,12 +156,33 @@ static inline void mem_cgroup_uncharge_cache_page(struct page *page)
91{ 156{
92} 157}
93 158
94static inline int mem_cgroup_shrink_usage(struct mm_struct *mm, gfp_t gfp_mask) 159static inline int mem_cgroup_shrink_usage(struct page *page,
160 struct mm_struct *mm, gfp_t gfp_mask)
95{ 161{
96 return 0; 162 return 0;
97} 163}
98 164
99static inline void mem_cgroup_move_lists(struct page *page, bool active) 165static inline void mem_cgroup_add_lru_list(struct page *page, int lru)
166{
167}
168
169static inline void mem_cgroup_del_lru_list(struct page *page, int lru)
170{
171 return ;
172}
173
174static inline void mem_cgroup_rotate_lru_list(struct page *page, int lru)
175{
176 return ;
177}
178
179static inline void mem_cgroup_del_lru(struct page *page)
180{
181 return ;
182}
183
184static inline void
185mem_cgroup_move_lists(struct page *page, enum lru_list from, enum lru_list to)
100{ 186{
101} 187}
102 188
@@ -112,12 +198,14 @@ static inline int task_in_mem_cgroup(struct task_struct *task,
112} 198}
113 199
114static inline int 200static inline int
115mem_cgroup_prepare_migration(struct page *page, struct page *newpage) 201mem_cgroup_prepare_migration(struct page *page, struct mem_cgroup **ptr)
116{ 202{
117 return 0; 203 return 0;
118} 204}
119 205
120static inline void mem_cgroup_end_migration(struct page *page) 206static inline void mem_cgroup_end_migration(struct mem_cgroup *mem,
207 struct page *oldpage,
208 struct page *newpage)
121{ 209{
122} 210}
123 211
@@ -146,12 +234,42 @@ static inline void mem_cgroup_record_reclaim_priority(struct mem_cgroup *mem,
146{ 234{
147} 235}
148 236
149static inline long mem_cgroup_calc_reclaim(struct mem_cgroup *mem, 237static inline bool mem_cgroup_disabled(void)
150 struct zone *zone, int priority, 238{
151 enum lru_list lru) 239 return true;
240}
241
242static inline bool mem_cgroup_oom_called(struct task_struct *task)
243{
244 return false;
245}
246
247static inline int
248mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg)
249{
250 return 1;
251}
252
253static inline unsigned long
254mem_cgroup_zone_nr_pages(struct mem_cgroup *memcg, struct zone *zone,
255 enum lru_list lru)
152{ 256{
153 return 0; 257 return 0;
154} 258}
259
260
261static inline struct zone_reclaim_stat*
262mem_cgroup_get_reclaim_stat(struct mem_cgroup *memcg, struct zone *zone)
263{
264 return NULL;
265}
266
267static inline struct zone_reclaim_stat*
268mem_cgroup_get_reclaim_stat_from_page(struct page *page)
269{
270 return NULL;
271}
272
155#endif /* CONFIG_CGROUP_MEM_CONT */ 273#endif /* CONFIG_CGROUP_MEM_CONT */
156 274
157#endif /* _LINUX_MEMCONTROL_H */ 275#endif /* _LINUX_MEMCONTROL_H */
diff --git a/include/linux/memory.h b/include/linux/memory.h
index 36c82c9e6ea7..3fdc10806d31 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -79,14 +79,14 @@ static inline int memory_notify(unsigned long val, void *v)
79#else 79#else
80extern int register_memory_notifier(struct notifier_block *nb); 80extern int register_memory_notifier(struct notifier_block *nb);
81extern void unregister_memory_notifier(struct notifier_block *nb); 81extern void unregister_memory_notifier(struct notifier_block *nb);
82extern int register_new_memory(struct mem_section *); 82extern int register_new_memory(int, struct mem_section *);
83extern int unregister_memory_section(struct mem_section *); 83extern int unregister_memory_section(struct mem_section *);
84extern int memory_dev_init(void); 84extern int memory_dev_init(void);
85extern int remove_memory_block(unsigned long, struct mem_section *, int); 85extern int remove_memory_block(unsigned long, struct mem_section *, int);
86extern int memory_notify(unsigned long val, void *v); 86extern int memory_notify(unsigned long val, void *v);
87extern struct memory_block *find_memory_block(struct mem_section *);
87#define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT) 88#define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT)
88 89enum mem_add_context { BOOT, HOTPLUG };
89
90#endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */ 90#endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */
91 91
92#ifdef CONFIG_MEMORY_HOTPLUG 92#ifdef CONFIG_MEMORY_HOTPLUG
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 763ba81fc0f0..d95f72e79b82 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -72,7 +72,7 @@ extern void __offline_isolated_pages(unsigned long, unsigned long);
72extern int offline_pages(unsigned long, unsigned long, unsigned long); 72extern int offline_pages(unsigned long, unsigned long, unsigned long);
73 73
74/* reasonably generic interface to expand the physical pages in a zone */ 74/* reasonably generic interface to expand the physical pages in a zone */
75extern int __add_pages(struct zone *zone, unsigned long start_pfn, 75extern int __add_pages(int nid, struct zone *zone, unsigned long start_pfn,
76 unsigned long nr_pages); 76 unsigned long nr_pages);
77extern int __remove_pages(struct zone *zone, unsigned long start_pfn, 77extern int __remove_pages(struct zone *zone, unsigned long start_pfn,
78 unsigned long nr_pages); 78 unsigned long nr_pages);
diff --git a/include/linux/mfd/da903x.h b/include/linux/mfd/da903x.h
index cad314c12439..115dbe965082 100644
--- a/include/linux/mfd/da903x.h
+++ b/include/linux/mfd/da903x.h
@@ -32,6 +32,7 @@ enum {
32 DA9030_ID_LDO18, 32 DA9030_ID_LDO18,
33 DA9030_ID_LDO19, 33 DA9030_ID_LDO19,
34 DA9030_ID_LDO_INT, /* LDO Internal */ 34 DA9030_ID_LDO_INT, /* LDO Internal */
35 DA9030_ID_BAT, /* battery charger */
35 36
36 DA9034_ID_LED_1, 37 DA9034_ID_LED_1,
37 DA9034_ID_LED_2, 38 DA9034_ID_LED_2,
@@ -93,6 +94,43 @@ struct da9034_touch_pdata {
93 int y_inverted; 94 int y_inverted;
94}; 95};
95 96
97/* DA9030 battery charger data */
98struct power_supply_info;
99
100struct da9030_battery_info {
101 /* battery parameters */
102 struct power_supply_info *battery_info;
103
104 /* current and voltage to use for battery charging */
105 unsigned int charge_milliamp;
106 unsigned int charge_millivolt;
107
108 /* voltage thresholds (in millivolts) */
109 int vbat_low;
110 int vbat_crit;
111 int vbat_charge_start;
112 int vbat_charge_stop;
113 int vbat_charge_restart;
114
115 /* battery nominal minimal and maximal voltages in millivolts */
116 int vcharge_min;
117 int vcharge_max;
118
119 /* Temperature thresholds. These are DA9030 register values
120 "as is" and should be measured for each battery type */
121 int tbat_low;
122 int tbat_high;
123 int tbat_restart;
124
125
126 /* battery monitor interval (seconds) */
127 unsigned int batmon_interval;
128
129 /* platform callbacks for battery low and critical events */
130 void (*battery_low)(void);
131 void (*battery_critical)(void);
132};
133
96struct da903x_subdev_info { 134struct da903x_subdev_info {
97 int id; 135 int id;
98 const char *name; 136 const char *name;
@@ -190,11 +228,13 @@ extern int da903x_unregister_notifier(struct device *dev,
190extern int da903x_query_status(struct device *dev, unsigned int status); 228extern int da903x_query_status(struct device *dev, unsigned int status);
191 229
192 230
193/* NOTE: the two functions below are not intended for use outside 231/* NOTE: the functions below are not intended for use outside
194 * of the DA9034 sub-device drivers 232 * of the DA903x sub-device drivers
195 */ 233 */
196extern int da903x_write(struct device *dev, int reg, uint8_t val); 234extern int da903x_write(struct device *dev, int reg, uint8_t val);
235extern int da903x_writes(struct device *dev, int reg, int len, uint8_t *val);
197extern int da903x_read(struct device *dev, int reg, uint8_t *val); 236extern int da903x_read(struct device *dev, int reg, uint8_t *val);
237extern int da903x_reads(struct device *dev, int reg, int len, uint8_t *val);
198extern int da903x_update(struct device *dev, int reg, uint8_t val, uint8_t mask); 238extern int da903x_update(struct device *dev, int reg, uint8_t val, uint8_t mask);
199extern int da903x_set_bits(struct device *dev, int reg, uint8_t bit_mask); 239extern int da903x_set_bits(struct device *dev, int reg, uint8_t bit_mask);
200extern int da903x_clr_bits(struct device *dev, int reg, uint8_t bit_mask); 240extern int da903x_clr_bits(struct device *dev, int reg, uint8_t bit_mask);
diff --git a/include/linux/mfd/wm8350/comparator.h b/include/linux/mfd/wm8350/comparator.h
index 053788649452..54bc5d0fd502 100644
--- a/include/linux/mfd/wm8350/comparator.h
+++ b/include/linux/mfd/wm8350/comparator.h
@@ -164,4 +164,12 @@
164#define WM8350_AUXADC_BATT 6 164#define WM8350_AUXADC_BATT 6
165#define WM8350_AUXADC_TEMP 7 165#define WM8350_AUXADC_TEMP 7
166 166
167struct wm8350;
168
169/*
170 * AUX ADC Readback
171 */
172int wm8350_read_auxadc(struct wm8350 *wm8350, int channel, int scale,
173 int vref);
174
167#endif 175#endif
diff --git a/include/linux/mfd/wm8350/core.h b/include/linux/mfd/wm8350/core.h
index 6ebf97f2a475..980669d50dca 100644
--- a/include/linux/mfd/wm8350/core.h
+++ b/include/linux/mfd/wm8350/core.h
@@ -29,6 +29,7 @@
29 */ 29 */
30#define WM8350_RESET_ID 0x00 30#define WM8350_RESET_ID 0x00
31#define WM8350_ID 0x01 31#define WM8350_ID 0x01
32#define WM8350_REVISION 0x02
32#define WM8350_SYSTEM_CONTROL_1 0x03 33#define WM8350_SYSTEM_CONTROL_1 0x03
33#define WM8350_SYSTEM_CONTROL_2 0x04 34#define WM8350_SYSTEM_CONTROL_2 0x04
34#define WM8350_SYSTEM_HIBERNATE 0x05 35#define WM8350_SYSTEM_HIBERNATE 0x05
@@ -57,6 +58,10 @@
57#define WM8350_OVER_CURRENT_INT_STATUS_MASK 0x25 58#define WM8350_OVER_CURRENT_INT_STATUS_MASK 0x25
58#define WM8350_GPIO_INT_STATUS_MASK 0x26 59#define WM8350_GPIO_INT_STATUS_MASK 0x26
59#define WM8350_COMPARATOR_INT_STATUS_MASK 0x27 60#define WM8350_COMPARATOR_INT_STATUS_MASK 0x27
61#define WM8350_CHARGER_OVERRIDES 0xE2
62#define WM8350_MISC_OVERRIDES 0xE3
63#define WM8350_COMPARATOR_OVERRIDES 0xE7
64#define WM8350_STATE_MACHINE_STATUS 0xE9
60 65
61#define WM8350_MAX_REGISTER 0xFF 66#define WM8350_MAX_REGISTER 0xFF
62 67
@@ -77,6 +82,11 @@
77#define WM8350_CUST_ID_MASK 0x00FF 82#define WM8350_CUST_ID_MASK 0x00FF
78 83
79/* 84/*
85 * R2 (0x02) - Revision
86 */
87#define WM8350_MASK_REV_MASK 0x00FF
88
89/*
80 * R3 (0x03) - System Control 1 90 * R3 (0x03) - System Control 1
81 */ 91 */
82#define WM8350_CHIP_ON 0x8000 92#define WM8350_CHIP_ON 0x8000
@@ -523,6 +533,35 @@
523#define WM8350_DC2_STS 0x0002 533#define WM8350_DC2_STS 0x0002
524#define WM8350_DC1_STS 0x0001 534#define WM8350_DC1_STS 0x0001
525 535
536/*
537 * R226 (0xE2) - Charger status
538 */
539#define WM8350_CHG_BATT_HOT_OVRDE 0x8000
540#define WM8350_CHG_BATT_COLD_OVRDE 0x4000
541
542/*
543 * R227 (0xE3) - Misc Overrides
544 */
545#define WM8350_USB_LIMIT_OVRDE 0x0400
546
547/*
548 * R227 (0xE7) - Comparator Overrides
549 */
550#define WM8350_USB_FB_OVRDE 0x8000
551#define WM8350_WALL_FB_OVRDE 0x4000
552#define WM8350_BATT_FB_OVRDE 0x2000
553
554
555/*
556 * R233 (0xE9) - State Machinine Status
557 */
558#define WM8350_USB_SM_MASK 0x0700
559#define WM8350_USB_SM_SHIFT 8
560
561#define WM8350_USB_SM_100_SLV 1
562#define WM8350_USB_SM_500_SLV 5
563#define WM8350_USB_SM_STDBY_SLV 7
564
526/* WM8350 wake up conditions */ 565/* WM8350 wake up conditions */
527#define WM8350_IRQ_WKUP_OFF_STATE 43 566#define WM8350_IRQ_WKUP_OFF_STATE 43
528#define WM8350_IRQ_WKUP_HIB_STATE 44 567#define WM8350_IRQ_WKUP_HIB_STATE 44
@@ -536,6 +575,7 @@
536#define WM8350_REV_E 0x4 575#define WM8350_REV_E 0x4
537#define WM8350_REV_F 0x5 576#define WM8350_REV_F 0x5
538#define WM8350_REV_G 0x6 577#define WM8350_REV_G 0x6
578#define WM8350_REV_H 0x7
539 579
540#define WM8350_NUM_IRQ 63 580#define WM8350_NUM_IRQ 63
541 581
@@ -549,6 +589,14 @@ extern const u16 wm8350_mode0_defaults[];
549extern const u16 wm8350_mode1_defaults[]; 589extern const u16 wm8350_mode1_defaults[];
550extern const u16 wm8350_mode2_defaults[]; 590extern const u16 wm8350_mode2_defaults[];
551extern const u16 wm8350_mode3_defaults[]; 591extern const u16 wm8350_mode3_defaults[];
592extern const u16 wm8351_mode0_defaults[];
593extern const u16 wm8351_mode1_defaults[];
594extern const u16 wm8351_mode2_defaults[];
595extern const u16 wm8351_mode3_defaults[];
596extern const u16 wm8352_mode0_defaults[];
597extern const u16 wm8352_mode1_defaults[];
598extern const u16 wm8352_mode2_defaults[];
599extern const u16 wm8352_mode3_defaults[];
552 600
553struct wm8350; 601struct wm8350;
554 602
@@ -558,8 +606,6 @@ struct wm8350_irq {
558}; 606};
559 607
560struct wm8350 { 608struct wm8350 {
561 int rev; /* chip revision */
562
563 struct device *dev; 609 struct device *dev;
564 610
565 /* device IO */ 611 /* device IO */
@@ -572,6 +618,8 @@ struct wm8350 {
572 void *src); 618 void *src);
573 u16 *reg_cache; 619 u16 *reg_cache;
574 620
621 struct mutex auxadc_mutex;
622
575 /* Interrupt handling */ 623 /* Interrupt handling */
576 struct work_struct irq_work; 624 struct work_struct irq_work;
577 struct mutex irq_mutex; /* IRQ table mutex */ 625 struct mutex irq_mutex; /* IRQ table mutex */
diff --git a/include/linux/mfd/wm8350/pmic.h b/include/linux/mfd/wm8350/pmic.h
index 69b69e07f62f..be3264e286e0 100644
--- a/include/linux/mfd/wm8350/pmic.h
+++ b/include/linux/mfd/wm8350/pmic.h
@@ -13,6 +13,10 @@
13#ifndef __LINUX_MFD_WM8350_PMIC_H 13#ifndef __LINUX_MFD_WM8350_PMIC_H
14#define __LINUX_MFD_WM8350_PMIC_H 14#define __LINUX_MFD_WM8350_PMIC_H
15 15
16#include <linux/platform_device.h>
17#include <linux/leds.h>
18#include <linux/regulator/machine.h>
19
16/* 20/*
17 * Register values. 21 * Register values.
18 */ 22 */
@@ -700,7 +704,38 @@ struct wm8350;
700struct platform_device; 704struct platform_device;
701struct regulator_init_data; 705struct regulator_init_data;
702 706
707/*
708 * WM8350 LED platform data
709 */
710struct wm8350_led_platform_data {
711 const char *name;
712 const char *default_trigger;
713 int max_uA;
714};
715
716struct wm8350_led {
717 struct platform_device *pdev;
718 struct mutex mutex;
719 struct work_struct work;
720 spinlock_t value_lock;
721 enum led_brightness value;
722 struct led_classdev cdev;
723 int max_uA_index;
724 int enabled;
725
726 struct regulator *isink;
727 struct regulator_consumer_supply isink_consumer;
728 struct regulator_init_data isink_init;
729 struct regulator *dcdc;
730 struct regulator_consumer_supply dcdc_consumer;
731 struct regulator_init_data dcdc_init;
732};
733
703struct wm8350_pmic { 734struct wm8350_pmic {
735 /* Number of regulators of each type on this device */
736 int max_dcdc;
737 int max_isink;
738
704 /* ISINK to DCDC mapping */ 739 /* ISINK to DCDC mapping */
705 int isink_A_dcdc; 740 int isink_A_dcdc;
706 int isink_B_dcdc; 741 int isink_B_dcdc;
@@ -713,10 +748,15 @@ struct wm8350_pmic {
713 748
714 /* regulator devices */ 749 /* regulator devices */
715 struct platform_device *pdev[NUM_WM8350_REGULATORS]; 750 struct platform_device *pdev[NUM_WM8350_REGULATORS];
751
752 /* LED devices */
753 struct wm8350_led led[2];
716}; 754};
717 755
718int wm8350_register_regulator(struct wm8350 *wm8350, int reg, 756int wm8350_register_regulator(struct wm8350 *wm8350, int reg,
719 struct regulator_init_data *initdata); 757 struct regulator_init_data *initdata);
758int wm8350_register_led(struct wm8350 *wm8350, int lednum, int dcdc, int isink,
759 struct wm8350_led_platform_data *pdata);
720 760
721/* 761/*
722 * Additional DCDC control not supported via regulator API 762 * Additional DCDC control not supported via regulator API
diff --git a/include/linux/mfd/wm8350/supply.h b/include/linux/mfd/wm8350/supply.h
index 1c8f3cde79b0..2b9479310bbd 100644
--- a/include/linux/mfd/wm8350/supply.h
+++ b/include/linux/mfd/wm8350/supply.h
@@ -13,7 +13,8 @@
13#ifndef __LINUX_MFD_WM8350_SUPPLY_H_ 13#ifndef __LINUX_MFD_WM8350_SUPPLY_H_
14#define __LINUX_MFD_WM8350_SUPPLY_H_ 14#define __LINUX_MFD_WM8350_SUPPLY_H_
15 15
16#include <linux/platform_device.h> 16#include <linux/mutex.h>
17#include <linux/power_supply.h>
17 18
18/* 19/*
19 * Charger registers 20 * Charger registers
@@ -104,8 +105,30 @@
104#define WM8350_IRQ_EXT_WALL_FB 37 105#define WM8350_IRQ_EXT_WALL_FB 37
105#define WM8350_IRQ_EXT_BAT_FB 38 106#define WM8350_IRQ_EXT_BAT_FB 38
106 107
108/*
109 * Policy to control charger state machine.
110 */
111struct wm8350_charger_policy {
112
113 /* charger state machine policy - set in machine driver */
114 int eoc_mA; /* end of charge current (mA) */
115 int charge_mV; /* charge voltage */
116 int fast_limit_mA; /* fast charge current limit */
117 int fast_limit_USB_mA; /* USB fast charge current limit */
118 int charge_timeout; /* charge timeout (mins) */
119 int trickle_start_mV; /* trickle charge starts at mV */
120 int trickle_charge_mA; /* trickle charge current */
121 int trickle_charge_USB_mA; /* USB trickle charge current */
122};
123
107struct wm8350_power { 124struct wm8350_power {
108 struct platform_device *pdev; 125 struct platform_device *pdev;
126 struct power_supply battery;
127 struct power_supply usb;
128 struct power_supply ac;
129 struct wm8350_charger_policy *policy;
130
131 int rev_g_coeff;
109}; 132};
110 133
111#endif 134#endif
diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index 3f34005068d4..527602cdea1c 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -7,6 +7,8 @@
7typedef struct page *new_page_t(struct page *, unsigned long private, int **); 7typedef struct page *new_page_t(struct page *, unsigned long private, int **);
8 8
9#ifdef CONFIG_MIGRATION 9#ifdef CONFIG_MIGRATION
10#define PAGE_MIGRATION 1
11
10extern int putback_lru_pages(struct list_head *l); 12extern int putback_lru_pages(struct list_head *l);
11extern int migrate_page(struct address_space *, 13extern int migrate_page(struct address_space *,
12 struct page *, struct page *); 14 struct page *, struct page *);
@@ -20,6 +22,8 @@ extern int migrate_vmas(struct mm_struct *mm,
20 const nodemask_t *from, const nodemask_t *to, 22 const nodemask_t *from, const nodemask_t *to,
21 unsigned long flags); 23 unsigned long flags);
22#else 24#else
25#define PAGE_MIGRATION 0
26
23static inline int putback_lru_pages(struct list_head *l) { return 0; } 27static inline int putback_lru_pages(struct list_head *l) { return 0; }
24static inline int migrate_pages(struct list_head *l, new_page_t x, 28static inline int migrate_pages(struct list_head *l, new_page_t x,
25 unsigned long private) { return -ENOSYS; } 29 unsigned long private) { return -ENOSYS; }
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index 26433ec520b3..a820f816a49e 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -3,33 +3,33 @@
3#include <linux/module.h> 3#include <linux/module.h>
4#include <linux/major.h> 4#include <linux/major.h>
5 5
6#define PSMOUSE_MINOR 1 6#define PSMOUSE_MINOR 1
7#define MS_BUSMOUSE_MINOR 2 7#define MS_BUSMOUSE_MINOR 2
8#define ATIXL_BUSMOUSE_MINOR 3 8#define ATIXL_BUSMOUSE_MINOR 3
9/*#define AMIGAMOUSE_MINOR 4 FIXME OBSOLETE */ 9/*#define AMIGAMOUSE_MINOR 4 FIXME OBSOLETE */
10#define ATARIMOUSE_MINOR 5 10#define ATARIMOUSE_MINOR 5
11#define SUN_MOUSE_MINOR 6 11#define SUN_MOUSE_MINOR 6
12#define APOLLO_MOUSE_MINOR 7 12#define APOLLO_MOUSE_MINOR 7
13#define PC110PAD_MINOR 9 13#define PC110PAD_MINOR 9
14/*#define ADB_MOUSE_MINOR 10 FIXME OBSOLETE */ 14/*#define ADB_MOUSE_MINOR 10 FIXME OBSOLETE */
15#define WATCHDOG_MINOR 130 /* Watchdog timer */ 15#define WATCHDOG_MINOR 130 /* Watchdog timer */
16#define TEMP_MINOR 131 /* Temperature Sensor */ 16#define TEMP_MINOR 131 /* Temperature Sensor */
17#define RTC_MINOR 135 17#define RTC_MINOR 135
18#define EFI_RTC_MINOR 136 /* EFI Time services */ 18#define EFI_RTC_MINOR 136 /* EFI Time services */
19#define SUN_OPENPROM_MINOR 139 19#define SUN_OPENPROM_MINOR 139
20#define DMAPI_MINOR 140 /* DMAPI */ 20#define DMAPI_MINOR 140 /* DMAPI */
21#define NVRAM_MINOR 144 21#define NVRAM_MINOR 144
22#define SGI_MMTIMER 153 22#define SGI_MMTIMER 153
23#define STORE_QUEUE_MINOR 155 23#define STORE_QUEUE_MINOR 155
24#define I2O_MINOR 166 24#define I2O_MINOR 166
25#define MICROCODE_MINOR 184 25#define MICROCODE_MINOR 184
26#define MWAVE_MINOR 219 /* ACP/Mwave Modem */ 26#define TUN_MINOR 200
27#define MPT_MINOR 220 27#define MWAVE_MINOR 219 /* ACP/Mwave Modem */
28#define MISC_DYNAMIC_MINOR 255 28#define MPT_MINOR 220
29 29#define HPET_MINOR 228
30#define TUN_MINOR 200 30#define FUSE_MINOR 229
31#define HPET_MINOR 228 31#define KVM_MINOR 232
32#define KVM_MINOR 232 32#define MISC_DYNAMIC_MINOR 255
33 33
34struct device; 34struct device;
35 35
diff --git a/include/linux/mm.h b/include/linux/mm.h
index aaa8b843be28..b91a73fd1bcc 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -56,19 +56,9 @@ extern unsigned long mmap_min_addr;
56 56
57extern struct kmem_cache *vm_area_cachep; 57extern struct kmem_cache *vm_area_cachep;
58 58
59/*
60 * This struct defines the per-mm list of VMAs for uClinux. If CONFIG_MMU is
61 * disabled, then there's a single shared list of VMAs maintained by the
62 * system, and mm's subscribe to these individually
63 */
64struct vm_list_struct {
65 struct vm_list_struct *next;
66 struct vm_area_struct *vma;
67};
68
69#ifndef CONFIG_MMU 59#ifndef CONFIG_MMU
70extern struct rb_root nommu_vma_tree; 60extern struct rb_root nommu_region_tree;
71extern struct rw_semaphore nommu_vma_sem; 61extern struct rw_semaphore nommu_region_sem;
72 62
73extern unsigned int kobjsize(const void *objp); 63extern unsigned int kobjsize(const void *objp);
74#endif 64#endif
@@ -717,6 +707,11 @@ static inline int page_mapped(struct page *page)
717 707
718#define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS) 708#define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS)
719 709
710/*
711 * Can be called by the pagefault handler when it gets a VM_FAULT_OOM.
712 */
713extern void pagefault_out_of_memory(void);
714
720#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK) 715#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK)
721 716
722extern void show_free_areas(void); 717extern void show_free_areas(void);
@@ -1056,6 +1051,7 @@ extern void memmap_init_zone(unsigned long, int, unsigned long,
1056 unsigned long, enum memmap_context); 1051 unsigned long, enum memmap_context);
1057extern void setup_per_zone_pages_min(void); 1052extern void setup_per_zone_pages_min(void);
1058extern void mem_init(void); 1053extern void mem_init(void);
1054extern void __init mmap_init(void);
1059extern void show_mem(void); 1055extern void show_mem(void);
1060extern void si_meminfo(struct sysinfo * val); 1056extern void si_meminfo(struct sysinfo * val);
1061extern void si_meminfo_node(struct sysinfo *val, int nid); 1057extern void si_meminfo_node(struct sysinfo *val, int nid);
@@ -1067,6 +1063,9 @@ extern void setup_per_cpu_pageset(void);
1067static inline void setup_per_cpu_pageset(void) {} 1063static inline void setup_per_cpu_pageset(void) {}
1068#endif 1064#endif
1069 1065
1066/* nommu.c */
1067extern atomic_t mmap_pages_allocated;
1068
1070/* prio_tree.c */ 1069/* prio_tree.c */
1071void vma_prio_tree_add(struct vm_area_struct *, struct vm_area_struct *old); 1070void vma_prio_tree_add(struct vm_area_struct *, struct vm_area_struct *old);
1072void vma_prio_tree_insert(struct vm_area_struct *, struct prio_tree_root *); 1071void vma_prio_tree_insert(struct vm_area_struct *, struct prio_tree_root *);
diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h
index c948350c378e..7fbb97267556 100644
--- a/include/linux/mm_inline.h
+++ b/include/linux/mm_inline.h
@@ -28,6 +28,7 @@ add_page_to_lru_list(struct zone *zone, struct page *page, enum lru_list l)
28{ 28{
29 list_add(&page->lru, &zone->lru[l].list); 29 list_add(&page->lru, &zone->lru[l].list);
30 __inc_zone_state(zone, NR_LRU_BASE + l); 30 __inc_zone_state(zone, NR_LRU_BASE + l);
31 mem_cgroup_add_lru_list(page, l);
31} 32}
32 33
33static inline void 34static inline void
@@ -35,6 +36,7 @@ del_page_from_lru_list(struct zone *zone, struct page *page, enum lru_list l)
35{ 36{
36 list_del(&page->lru); 37 list_del(&page->lru);
37 __dec_zone_state(zone, NR_LRU_BASE + l); 38 __dec_zone_state(zone, NR_LRU_BASE + l);
39 mem_cgroup_del_lru_list(page, l);
38} 40}
39 41
40static inline void 42static inline void
@@ -54,6 +56,7 @@ del_page_from_lru(struct zone *zone, struct page *page)
54 l += page_is_file_cache(page); 56 l += page_is_file_cache(page);
55 } 57 }
56 __dec_zone_state(zone, NR_LRU_BASE + l); 58 __dec_zone_state(zone, NR_LRU_BASE + l);
59 mem_cgroup_del_lru_list(page, l);
57} 60}
58 61
59/** 62/**
@@ -78,23 +81,4 @@ static inline enum lru_list page_lru(struct page *page)
78 return lru; 81 return lru;
79} 82}
80 83
81/**
82 * inactive_anon_is_low - check if anonymous pages need to be deactivated
83 * @zone: zone to check
84 *
85 * Returns true if the zone does not have enough inactive anon pages,
86 * meaning some active anon pages need to be deactivated.
87 */
88static inline int inactive_anon_is_low(struct zone *zone)
89{
90 unsigned long active, inactive;
91
92 active = zone_page_state(zone, NR_ACTIVE_ANON);
93 inactive = zone_page_state(zone, NR_INACTIVE_ANON);
94
95 if (inactive * zone->inactive_ratio < active)
96 return 1;
97
98 return 0;
99}
100#endif 84#endif
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 9cfc9b627fdd..92915e81443f 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -97,6 +97,23 @@ struct page {
97}; 97};
98 98
99/* 99/*
100 * A region containing a mapping of a non-memory backed file under NOMMU
101 * conditions. These are held in a global tree and are pinned by the VMAs that
102 * map parts of them.
103 */
104struct vm_region {
105 struct rb_node vm_rb; /* link in global region tree */
106 unsigned long vm_flags; /* VMA vm_flags */
107 unsigned long vm_start; /* start address of region */
108 unsigned long vm_end; /* region initialised to here */
109 unsigned long vm_top; /* region allocated to here */
110 unsigned long vm_pgoff; /* the offset in vm_file corresponding to vm_start */
111 struct file *vm_file; /* the backing file or NULL */
112
113 atomic_t vm_usage; /* region usage count */
114};
115
116/*
100 * This struct defines a memory VMM memory area. There is one of these 117 * This struct defines a memory VMM memory area. There is one of these
101 * per VM-area/task. A VM area is any part of the process virtual memory 118 * per VM-area/task. A VM area is any part of the process virtual memory
102 * space that has a special rule for the page-fault handlers (ie a shared 119 * space that has a special rule for the page-fault handlers (ie a shared
@@ -152,7 +169,7 @@ struct vm_area_struct {
152 unsigned long vm_truncate_count;/* truncate_count or restart_addr */ 169 unsigned long vm_truncate_count;/* truncate_count or restart_addr */
153 170
154#ifndef CONFIG_MMU 171#ifndef CONFIG_MMU
155 atomic_t vm_usage; /* refcount (VMAs shared if !MMU) */ 172 struct vm_region *vm_region; /* NOMMU mapping region */
156#endif 173#endif
157#ifdef CONFIG_NUMA 174#ifdef CONFIG_NUMA
158 struct mempolicy *vm_policy; /* NUMA policy for the VMA */ 175 struct mempolicy *vm_policy; /* NUMA policy for the VMA */
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 35a7b5e19465..09c14e213b63 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -263,6 +263,19 @@ enum zone_type {
263#error ZONES_SHIFT -- too many zones configured adjust calculation 263#error ZONES_SHIFT -- too many zones configured adjust calculation
264#endif 264#endif
265 265
266struct zone_reclaim_stat {
267 /*
268 * The pageout code in vmscan.c keeps track of how many of the
269 * mem/swap backed and file backed pages are refeferenced.
270 * The higher the rotated/scanned ratio, the more valuable
271 * that cache is.
272 *
273 * The anon LRU stats live in [0], file LRU stats in [1]
274 */
275 unsigned long recent_rotated[2];
276 unsigned long recent_scanned[2];
277};
278
266struct zone { 279struct zone {
267 /* Fields commonly accessed by the page allocator */ 280 /* Fields commonly accessed by the page allocator */
268 unsigned long pages_min, pages_low, pages_high; 281 unsigned long pages_min, pages_low, pages_high;
@@ -315,16 +328,7 @@ struct zone {
315 unsigned long nr_scan; 328 unsigned long nr_scan;
316 } lru[NR_LRU_LISTS]; 329 } lru[NR_LRU_LISTS];
317 330
318 /* 331 struct zone_reclaim_stat reclaim_stat;
319 * The pageout code in vmscan.c keeps track of how many of the
320 * mem/swap backed and file backed pages are refeferenced.
321 * The higher the rotated/scanned ratio, the more valuable
322 * that cache is.
323 *
324 * The anon LRU stats live in [0], file LRU stats in [1]
325 */
326 unsigned long recent_rotated[2];
327 unsigned long recent_scanned[2];
328 332
329 unsigned long pages_scanned; /* since last reclaim */ 333 unsigned long pages_scanned; /* since last reclaim */
330 unsigned long flags; /* zone flags, see below */ 334 unsigned long flags; /* zone flags, see below */
diff --git a/include/linux/module.h b/include/linux/module.h
index 3bfed013350b..4f7ea12463d3 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -294,9 +294,6 @@ struct module
294 /* The size of the executable code in each section. */ 294 /* The size of the executable code in each section. */
295 unsigned int init_text_size, core_text_size; 295 unsigned int init_text_size, core_text_size;
296 296
297 /* The handle returned from unwind_add_table. */
298 void *unwind_info;
299
300 /* Arch-specific module values */ 297 /* Arch-specific module values */
301 struct mod_arch_specific arch; 298 struct mod_arch_specific arch;
302 299
@@ -368,6 +365,18 @@ struct module *module_text_address(unsigned long addr);
368struct module *__module_text_address(unsigned long addr); 365struct module *__module_text_address(unsigned long addr);
369int is_module_address(unsigned long addr); 366int is_module_address(unsigned long addr);
370 367
368static inline int within_module_core(unsigned long addr, struct module *mod)
369{
370 return (unsigned long)mod->module_core <= addr &&
371 addr < (unsigned long)mod->module_core + mod->core_size;
372}
373
374static inline int within_module_init(unsigned long addr, struct module *mod)
375{
376 return (unsigned long)mod->module_init <= addr &&
377 addr < (unsigned long)mod->module_init + mod->init_size;
378}
379
371/* Returns 0 and fills in value, defined and namebuf, or -ERANGE if 380/* Returns 0 and fills in value, defined and namebuf, or -ERANGE if
372 symnum out of range. */ 381 symnum out of range. */
373int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type, 382int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type,
diff --git a/include/linux/moduleloader.h b/include/linux/moduleloader.h
index eb1033957486..c1f40c2f7ffb 100644
--- a/include/linux/moduleloader.h
+++ b/include/linux/moduleloader.h
@@ -13,6 +13,9 @@ int module_frob_arch_sections(Elf_Ehdr *hdr,
13 char *secstrings, 13 char *secstrings,
14 struct module *mod); 14 struct module *mod);
15 15
16/* Additional bytes needed by arch in front of individual sections */
17unsigned int arch_mod_section_prepend(struct module *mod, unsigned int section);
18
16/* Allocator used for allocating struct module, core sections and init 19/* Allocator used for allocating struct module, core sections and init
17 sections. Returns NULL on failure. */ 20 sections. Returns NULL on failure. */
18void *module_alloc(unsigned long size); 21void *module_alloc(unsigned long size);
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h
index 00e2b575021f..88d3d8fbf9f2 100644
--- a/include/linux/mtd/cfi.h
+++ b/include/linux/mtd/cfi.h
@@ -520,6 +520,7 @@ struct cfi_fixup {
520 520
521#define CFI_MFR_AMD 0x0001 521#define CFI_MFR_AMD 0x0001
522#define CFI_MFR_ATMEL 0x001F 522#define CFI_MFR_ATMEL 0x001F
523#define CFI_MFR_SAMSUNG 0x00EC
523#define CFI_MFR_ST 0x0020 /* STMicroelectronics */ 524#define CFI_MFR_ST 0x0020 /* STMicroelectronics */
524 525
525void cfi_fixup(struct mtd_info *mtd, struct cfi_fixup* fixups); 526void cfi_fixup(struct mtd_info *mtd, struct cfi_fixup* fixups);
diff --git a/include/linux/mtd/concat.h b/include/linux/mtd/concat.h
index c02f3d264ecf..e80c674daeb3 100644
--- a/include/linux/mtd/concat.h
+++ b/include/linux/mtd/concat.h
@@ -13,7 +13,7 @@
13struct mtd_info *mtd_concat_create( 13struct mtd_info *mtd_concat_create(
14 struct mtd_info *subdev[], /* subdevices to concatenate */ 14 struct mtd_info *subdev[], /* subdevices to concatenate */
15 int num_devs, /* number of subdevices */ 15 int num_devs, /* number of subdevices */
16 char *name); /* name for the new device */ 16 const char *name); /* name for the new device */
17 17
18void mtd_concat_destroy(struct mtd_info *mtd); 18void mtd_concat_destroy(struct mtd_info *mtd);
19 19
diff --git a/include/linux/mtd/ftl.h b/include/linux/mtd/ftl.h
index 0be442f881dd..0555f7a0b9ed 100644
--- a/include/linux/mtd/ftl.h
+++ b/include/linux/mtd/ftl.h
@@ -32,25 +32,25 @@
32#define _LINUX_FTL_H 32#define _LINUX_FTL_H
33 33
34typedef struct erase_unit_header_t { 34typedef struct erase_unit_header_t {
35 u_int8_t LinkTargetTuple[5]; 35 uint8_t LinkTargetTuple[5];
36 u_int8_t DataOrgTuple[10]; 36 uint8_t DataOrgTuple[10];
37 u_int8_t NumTransferUnits; 37 uint8_t NumTransferUnits;
38 u_int32_t EraseCount; 38 uint32_t EraseCount;
39 u_int16_t LogicalEUN; 39 uint16_t LogicalEUN;
40 u_int8_t BlockSize; 40 uint8_t BlockSize;
41 u_int8_t EraseUnitSize; 41 uint8_t EraseUnitSize;
42 u_int16_t FirstPhysicalEUN; 42 uint16_t FirstPhysicalEUN;
43 u_int16_t NumEraseUnits; 43 uint16_t NumEraseUnits;
44 u_int32_t FormattedSize; 44 uint32_t FormattedSize;
45 u_int32_t FirstVMAddress; 45 uint32_t FirstVMAddress;
46 u_int16_t NumVMPages; 46 uint16_t NumVMPages;
47 u_int8_t Flags; 47 uint8_t Flags;
48 u_int8_t Code; 48 uint8_t Code;
49 u_int32_t SerialNumber; 49 uint32_t SerialNumber;
50 u_int32_t AltEUHOffset; 50 uint32_t AltEUHOffset;
51 u_int32_t BAMOffset; 51 uint32_t BAMOffset;
52 u_int8_t Reserved[12]; 52 uint8_t Reserved[12];
53 u_int8_t EndTuple[2]; 53 uint8_t EndTuple[2];
54} erase_unit_header_t; 54} erase_unit_header_t;
55 55
56/* Flags in erase_unit_header_t */ 56/* Flags in erase_unit_header_t */
diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h
index aa30244492c6..b981b8772217 100644
--- a/include/linux/mtd/map.h
+++ b/include/linux/mtd/map.h
@@ -223,6 +223,7 @@ struct map_info {
223 must leave it enabled. */ 223 must leave it enabled. */
224 void (*set_vpp)(struct map_info *, int); 224 void (*set_vpp)(struct map_info *, int);
225 225
226 unsigned long pfow_base;
226 unsigned long map_priv_1; 227 unsigned long map_priv_1;
227 unsigned long map_priv_2; 228 unsigned long map_priv_2;
228 void *fldrv_priv; 229 void *fldrv_priv;
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index eae26bb6430a..3aa5d77c2cdb 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -15,6 +15,8 @@
15#include <linux/mtd/compatmac.h> 15#include <linux/mtd/compatmac.h>
16#include <mtd/mtd-abi.h> 16#include <mtd/mtd-abi.h>
17 17
18#include <asm/div64.h>
19
18#define MTD_CHAR_MAJOR 90 20#define MTD_CHAR_MAJOR 90
19#define MTD_BLOCK_MAJOR 31 21#define MTD_BLOCK_MAJOR 31
20#define MAX_MTD_DEVICES 32 22#define MAX_MTD_DEVICES 32
@@ -25,20 +27,20 @@
25#define MTD_ERASE_DONE 0x08 27#define MTD_ERASE_DONE 0x08
26#define MTD_ERASE_FAILED 0x10 28#define MTD_ERASE_FAILED 0x10
27 29
28#define MTD_FAIL_ADDR_UNKNOWN 0xffffffff 30#define MTD_FAIL_ADDR_UNKNOWN -1LL
29 31
30/* If the erase fails, fail_addr might indicate exactly which block failed. If 32/* If the erase fails, fail_addr might indicate exactly which block failed. If
31 fail_addr = MTD_FAIL_ADDR_UNKNOWN, the failure was not at the device level or was not 33 fail_addr = MTD_FAIL_ADDR_UNKNOWN, the failure was not at the device level or was not
32 specific to any particular block. */ 34 specific to any particular block. */
33struct erase_info { 35struct erase_info {
34 struct mtd_info *mtd; 36 struct mtd_info *mtd;
35 u_int32_t addr; 37 uint64_t addr;
36 u_int32_t len; 38 uint64_t len;
37 u_int32_t fail_addr; 39 uint64_t fail_addr;
38 u_long time; 40 u_long time;
39 u_long retries; 41 u_long retries;
40 u_int dev; 42 unsigned dev;
41 u_int cell; 43 unsigned cell;
42 void (*callback) (struct erase_info *self); 44 void (*callback) (struct erase_info *self);
43 u_long priv; 45 u_long priv;
44 u_char state; 46 u_char state;
@@ -46,9 +48,9 @@ struct erase_info {
46}; 48};
47 49
48struct mtd_erase_region_info { 50struct mtd_erase_region_info {
49 u_int32_t offset; /* At which this region starts, from the beginning of the MTD */ 51 uint64_t offset; /* At which this region starts, from the beginning of the MTD */
50 u_int32_t erasesize; /* For this region */ 52 uint32_t erasesize; /* For this region */
51 u_int32_t numblocks; /* Number of blocks of erasesize in this region */ 53 uint32_t numblocks; /* Number of blocks of erasesize in this region */
52 unsigned long *lockmap; /* If keeping bitmap of locks */ 54 unsigned long *lockmap; /* If keeping bitmap of locks */
53}; 55};
54 56
@@ -83,7 +85,7 @@ typedef enum {
83 * @datbuf: data buffer - if NULL only oob data are read/written 85 * @datbuf: data buffer - if NULL only oob data are read/written
84 * @oobbuf: oob data buffer 86 * @oobbuf: oob data buffer
85 * 87 *
86 * Note, it is allowed to read more then one OOB area at one go, but not write. 88 * Note, it is allowed to read more than one OOB area at one go, but not write.
87 * The interface assumes that the OOB write requests program only one page's 89 * The interface assumes that the OOB write requests program only one page's
88 * OOB area. 90 * OOB area.
89 */ 91 */
@@ -100,14 +102,14 @@ struct mtd_oob_ops {
100 102
101struct mtd_info { 103struct mtd_info {
102 u_char type; 104 u_char type;
103 u_int32_t flags; 105 uint32_t flags;
104 u_int32_t size; // Total size of the MTD 106 uint64_t size; // Total size of the MTD
105 107
106 /* "Major" erase size for the device. Naïve users may take this 108 /* "Major" erase size for the device. Naïve users may take this
107 * to be the only erase size available, or may use the more detailed 109 * to be the only erase size available, or may use the more detailed
108 * information below if they desire 110 * information below if they desire
109 */ 111 */
110 u_int32_t erasesize; 112 uint32_t erasesize;
111 /* Minimal writable flash unit size. In case of NOR flash it is 1 (even 113 /* Minimal writable flash unit size. In case of NOR flash it is 1 (even
112 * though individual bits can be cleared), in case of NAND flash it is 114 * though individual bits can be cleared), in case of NAND flash it is
113 * one NAND page (or half, or one-fourths of it), in case of ECC-ed NOR 115 * one NAND page (or half, or one-fourths of it), in case of ECC-ed NOR
@@ -115,10 +117,20 @@ struct mtd_info {
115 * Any driver registering a struct mtd_info must ensure a writesize of 117 * Any driver registering a struct mtd_info must ensure a writesize of
116 * 1 or larger. 118 * 1 or larger.
117 */ 119 */
118 u_int32_t writesize; 120 uint32_t writesize;
121
122 uint32_t oobsize; // Amount of OOB data per block (e.g. 16)
123 uint32_t oobavail; // Available OOB bytes per block
119 124
120 u_int32_t oobsize; // Amount of OOB data per block (e.g. 16) 125 /*
121 u_int32_t oobavail; // Available OOB bytes per block 126 * If erasesize is a power of 2 then the shift is stored in
127 * erasesize_shift otherwise erasesize_shift is zero. Ditto writesize.
128 */
129 unsigned int erasesize_shift;
130 unsigned int writesize_shift;
131 /* Masks based on erasesize_shift and writesize_shift */
132 unsigned int erasesize_mask;
133 unsigned int writesize_mask;
122 134
123 // Kernel-only stuff starts here. 135 // Kernel-only stuff starts here.
124 const char *name; 136 const char *name;
@@ -190,8 +202,8 @@ struct mtd_info {
190 void (*sync) (struct mtd_info *mtd); 202 void (*sync) (struct mtd_info *mtd);
191 203
192 /* Chip-supported device locking */ 204 /* Chip-supported device locking */
193 int (*lock) (struct mtd_info *mtd, loff_t ofs, size_t len); 205 int (*lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
194 int (*unlock) (struct mtd_info *mtd, loff_t ofs, size_t len); 206 int (*unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
195 207
196 /* Power Management functions */ 208 /* Power Management functions */
197 int (*suspend) (struct mtd_info *mtd); 209 int (*suspend) (struct mtd_info *mtd);
@@ -221,6 +233,35 @@ struct mtd_info {
221 void (*put_device) (struct mtd_info *mtd); 233 void (*put_device) (struct mtd_info *mtd);
222}; 234};
223 235
236static inline uint32_t mtd_div_by_eb(uint64_t sz, struct mtd_info *mtd)
237{
238 if (mtd->erasesize_shift)
239 return sz >> mtd->erasesize_shift;
240 do_div(sz, mtd->erasesize);
241 return sz;
242}
243
244static inline uint32_t mtd_mod_by_eb(uint64_t sz, struct mtd_info *mtd)
245{
246 if (mtd->erasesize_shift)
247 return sz & mtd->erasesize_mask;
248 return do_div(sz, mtd->erasesize);
249}
250
251static inline uint32_t mtd_div_by_ws(uint64_t sz, struct mtd_info *mtd)
252{
253 if (mtd->writesize_shift)
254 return sz >> mtd->writesize_shift;
255 do_div(sz, mtd->writesize);
256 return sz;
257}
258
259static inline uint32_t mtd_mod_by_ws(uint64_t sz, struct mtd_info *mtd)
260{
261 if (mtd->writesize_shift)
262 return sz & mtd->writesize_mask;
263 return do_div(sz, mtd->writesize);
264}
224 265
225 /* Kernel-side ioctl definitions */ 266 /* Kernel-side ioctl definitions */
226 267
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 733d3f3b4eb8..db5b63da2a7e 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -335,17 +335,12 @@ struct nand_buffers {
335 * @erase_cmd: [INTERN] erase command write function, selectable due to AND support 335 * @erase_cmd: [INTERN] erase command write function, selectable due to AND support
336 * @scan_bbt: [REPLACEABLE] function to scan bad block table 336 * @scan_bbt: [REPLACEABLE] function to scan bad block table
337 * @chip_delay: [BOARDSPECIFIC] chip dependent delay for transfering data from array to read regs (tR) 337 * @chip_delay: [BOARDSPECIFIC] chip dependent delay for transfering data from array to read regs (tR)
338 * @wq: [INTERN] wait queue to sleep on if a NAND operation is in progress
339 * @state: [INTERN] the current state of the NAND device 338 * @state: [INTERN] the current state of the NAND device
340 * @oob_poi: poison value buffer 339 * @oob_poi: poison value buffer
341 * @page_shift: [INTERN] number of address bits in a page (column address bits) 340 * @page_shift: [INTERN] number of address bits in a page (column address bits)
342 * @phys_erase_shift: [INTERN] number of address bits in a physical eraseblock 341 * @phys_erase_shift: [INTERN] number of address bits in a physical eraseblock
343 * @bbt_erase_shift: [INTERN] number of address bits in a bbt entry 342 * @bbt_erase_shift: [INTERN] number of address bits in a bbt entry
344 * @chip_shift: [INTERN] number of address bits in one chip 343 * @chip_shift: [INTERN] number of address bits in one chip
345 * @datbuf: [INTERN] internal buffer for one page + oob
346 * @oobbuf: [INTERN] oob buffer for one eraseblock
347 * @oobdirty: [INTERN] indicates that oob_buf must be reinitialized
348 * @data_poi: [INTERN] pointer to a data buffer
349 * @options: [BOARDSPECIFIC] various chip options. They can partly be set to inform nand_scan about 344 * @options: [BOARDSPECIFIC] various chip options. They can partly be set to inform nand_scan about
350 * special functionality. See the defines for further explanation 345 * special functionality. See the defines for further explanation
351 * @badblockpos: [INTERN] position of the bad block marker in the oob area 346 * @badblockpos: [INTERN] position of the bad block marker in the oob area
@@ -399,7 +394,7 @@ struct nand_chip {
399 int bbt_erase_shift; 394 int bbt_erase_shift;
400 int chip_shift; 395 int chip_shift;
401 int numchips; 396 int numchips;
402 unsigned long chipsize; 397 uint64_t chipsize;
403 int pagemask; 398 int pagemask;
404 int pagebuf; 399 int pagebuf;
405 int subpagesize; 400 int subpagesize;
diff --git a/include/linux/mtd/partitions.h b/include/linux/mtd/partitions.h
index c92b4d439609..a45dd831b3f8 100644
--- a/include/linux/mtd/partitions.h
+++ b/include/linux/mtd/partitions.h
@@ -36,9 +36,9 @@
36 36
37struct mtd_partition { 37struct mtd_partition {
38 char *name; /* identifier string */ 38 char *name; /* identifier string */
39 u_int32_t size; /* partition size */ 39 uint64_t size; /* partition size */
40 u_int32_t offset; /* offset within the master MTD space */ 40 uint64_t offset; /* offset within the master MTD space */
41 u_int32_t mask_flags; /* master MTD flags to mask out for this partition */ 41 uint32_t mask_flags; /* master MTD flags to mask out for this partition */
42 struct nand_ecclayout *ecclayout; /* out of band layout for this partition (NAND only)*/ 42 struct nand_ecclayout *ecclayout; /* out of band layout for this partition (NAND only)*/
43 struct mtd_info **mtdp; /* pointer to store the MTD object */ 43 struct mtd_info **mtdp; /* pointer to store the MTD object */
44}; 44};
diff --git a/include/linux/mtd/pfow.h b/include/linux/mtd/pfow.h
new file mode 100644
index 000000000000..b730d4f84655
--- /dev/null
+++ b/include/linux/mtd/pfow.h
@@ -0,0 +1,159 @@
1/* Primary function overlay window definitions
2 * and service functions used by LPDDR chips
3 */
4#ifndef __LINUX_MTD_PFOW_H
5#define __LINUX_MTD_PFOW_H
6
7#include <linux/mtd/qinfo.h>
8
9/* PFOW registers addressing */
10/* Address of symbol "P" */
11#define PFOW_QUERY_STRING_P 0x0000
12/* Address of symbol "F" */
13#define PFOW_QUERY_STRING_F 0x0002
14/* Address of symbol "O" */
15#define PFOW_QUERY_STRING_O 0x0004
16/* Address of symbol "W" */
17#define PFOW_QUERY_STRING_W 0x0006
18/* Identification info for LPDDR chip */
19#define PFOW_MANUFACTURER_ID 0x0020
20#define PFOW_DEVICE_ID 0x0022
21/* Address in PFOW where prog buffer can can be found */
22#define PFOW_PROGRAM_BUFFER_OFFSET 0x0040
23/* Size of program buffer in words */
24#define PFOW_PROGRAM_BUFFER_SIZE 0x0042
25/* Address command code register */
26#define PFOW_COMMAND_CODE 0x0080
27/* command data register */
28#define PFOW_COMMAND_DATA 0x0084
29/* command address register lower address bits */
30#define PFOW_COMMAND_ADDRESS_L 0x0088
31/* command address register upper address bits */
32#define PFOW_COMMAND_ADDRESS_H 0x008a
33/* number of bytes to be proggrammed lower address bits */
34#define PFOW_DATA_COUNT_L 0x0090
35/* number of bytes to be proggrammed higher address bits */
36#define PFOW_DATA_COUNT_H 0x0092
37/* command execution register, the only possible value is 0x01 */
38#define PFOW_COMMAND_EXECUTE 0x00c0
39/* 0x01 should be written at this address to clear buffer */
40#define PFOW_CLEAR_PROGRAM_BUFFER 0x00c4
41/* device program/erase suspend register */
42#define PFOW_PROGRAM_ERASE_SUSPEND 0x00c8
43/* device status register */
44#define PFOW_DSR 0x00cc
45
46/* LPDDR memory device command codes */
47/* They are possible values of PFOW command code register */
48#define LPDDR_WORD_PROGRAM 0x0041
49#define LPDDR_BUFF_PROGRAM 0x00E9
50#define LPDDR_BLOCK_ERASE 0x0020
51#define LPDDR_LOCK_BLOCK 0x0061
52#define LPDDR_UNLOCK_BLOCK 0x0062
53#define LPDDR_READ_BLOCK_LOCK_STATUS 0x0065
54#define LPDDR_INFO_QUERY 0x0098
55#define LPDDR_READ_OTP 0x0097
56#define LPDDR_PROG_OTP 0x00C0
57#define LPDDR_RESUME 0x00D0
58
59/* Defines possible value of PFOW command execution register */
60#define LPDDR_START_EXECUTION 0x0001
61
62/* Defines possible value of PFOW program/erase suspend register */
63#define LPDDR_SUSPEND 0x0001
64
65/* Possible values of PFOW device status register */
66/* access R - read; RC read & clearable */
67#define DSR_DPS (1<<1) /* RC; device protect status
68 * 0 - not protected 1 - locked */
69#define DSR_PSS (1<<2) /* R; program suspend status;
70 * 0-prog in progress/completed,
71 * 1- prog suspended */
72#define DSR_VPPS (1<<3) /* RC; 0-Vpp OK, * 1-Vpp low */
73#define DSR_PROGRAM_STATUS (1<<4) /* RC; 0-successful, 1-error */
74#define DSR_ERASE_STATUS (1<<5) /* RC; erase or blank check status;
75 * 0-success erase/blank check,
76 * 1 blank check error */
77#define DSR_ESS (1<<6) /* R; erase suspend status;
78 * 0-erase in progress/complete,
79 * 1 erase suspended */
80#define DSR_READY_STATUS (1<<7) /* R; Device status
81 * 0-busy,
82 * 1-ready */
83#define DSR_RPS (0x3<<8) /* RC; region program status
84 * 00 - Success,
85 * 01-re-program attempt in region with
86 * object mode data,
87 * 10-object mode program w attempt in
88 * region with control mode data
89 * 11-attempt to program invalid half
90 * with 0x41 command */
91#define DSR_AOS (1<<12) /* RC; 1- AO related failure */
92#define DSR_AVAILABLE (1<<15) /* R; Device availbility
93 * 1 - Device available
94 * 0 - not available */
95
96/* The superset of all possible error bits in DSR */
97#define DSR_ERR 0x133A
98
99static inline void send_pfow_command(struct map_info *map,
100 unsigned long cmd_code, unsigned long adr,
101 unsigned long len, map_word *datum)
102{
103 int bits_per_chip = map_bankwidth(map) * 8;
104 int chipnum;
105 struct lpddr_private *lpddr = map->fldrv_priv;
106 chipnum = adr >> lpddr->chipshift;
107
108 map_write(map, CMD(cmd_code), map->pfow_base + PFOW_COMMAND_CODE);
109 map_write(map, CMD(adr & ((1<<bits_per_chip) - 1)),
110 map->pfow_base + PFOW_COMMAND_ADDRESS_L);
111 map_write(map, CMD(adr>>bits_per_chip),
112 map->pfow_base + PFOW_COMMAND_ADDRESS_H);
113 if (len) {
114 map_write(map, CMD(len & ((1<<bits_per_chip) - 1)),
115 map->pfow_base + PFOW_DATA_COUNT_L);
116 map_write(map, CMD(len>>bits_per_chip),
117 map->pfow_base + PFOW_DATA_COUNT_H);
118 }
119 if (datum)
120 map_write(map, *datum, map->pfow_base + PFOW_COMMAND_DATA);
121
122 /* Command execution start */
123 map_write(map, CMD(LPDDR_START_EXECUTION),
124 map->pfow_base + PFOW_COMMAND_EXECUTE);
125}
126
127static inline void print_drs_error(unsigned dsr)
128{
129 int prog_status = (dsr & DSR_RPS) >> 8;
130
131 if (!(dsr & DSR_AVAILABLE))
132 printk(KERN_NOTICE"DSR.15: (0) Device not Available\n");
133 if (prog_status & 0x03)
134 printk(KERN_NOTICE"DSR.9,8: (11) Attempt to program invalid "
135 "half with 41h command\n");
136 else if (prog_status & 0x02)
137 printk(KERN_NOTICE"DSR.9,8: (10) Object Mode Program attempt "
138 "in region with Control Mode data\n");
139 else if (prog_status & 0x01)
140 printk(KERN_NOTICE"DSR.9,8: (01) Program attempt in region "
141 "with Object Mode data\n");
142 if (!(dsr & DSR_READY_STATUS))
143 printk(KERN_NOTICE"DSR.7: (0) Device is Busy\n");
144 if (dsr & DSR_ESS)
145 printk(KERN_NOTICE"DSR.6: (1) Erase Suspended\n");
146 if (dsr & DSR_ERASE_STATUS)
147 printk(KERN_NOTICE"DSR.5: (1) Erase/Blank check error\n");
148 if (dsr & DSR_PROGRAM_STATUS)
149 printk(KERN_NOTICE"DSR.4: (1) Program Error\n");
150 if (dsr & DSR_VPPS)
151 printk(KERN_NOTICE"DSR.3: (1) Vpp low detect, operation "
152 "aborted\n");
153 if (dsr & DSR_PSS)
154 printk(KERN_NOTICE"DSR.2: (1) Program suspended\n");
155 if (dsr & DSR_DPS)
156 printk(KERN_NOTICE"DSR.1: (1) Aborted Erase/Program attempt "
157 "on locked block\n");
158}
159#endif /* __LINUX_MTD_PFOW_H */
diff --git a/include/linux/mtd/physmap.h b/include/linux/mtd/physmap.h
index c8e63a5ee72e..76f7cabf07d3 100644
--- a/include/linux/mtd/physmap.h
+++ b/include/linux/mtd/physmap.h
@@ -24,6 +24,7 @@ struct physmap_flash_data {
24 unsigned int width; 24 unsigned int width;
25 void (*set_vpp)(struct map_info *, int); 25 void (*set_vpp)(struct map_info *, int);
26 unsigned int nr_parts; 26 unsigned int nr_parts;
27 unsigned int pfow_base;
27 struct mtd_partition *parts; 28 struct mtd_partition *parts;
28}; 29};
29 30
diff --git a/include/linux/mtd/qinfo.h b/include/linux/mtd/qinfo.h
new file mode 100644
index 000000000000..7b3d487d8b3f
--- /dev/null
+++ b/include/linux/mtd/qinfo.h
@@ -0,0 +1,91 @@
1#ifndef __LINUX_MTD_QINFO_H
2#define __LINUX_MTD_QINFO_H
3
4#include <linux/mtd/map.h>
5#include <linux/wait.h>
6#include <linux/spinlock.h>
7#include <linux/delay.h>
8#include <linux/mtd/mtd.h>
9#include <linux/mtd/flashchip.h>
10#include <linux/mtd/partitions.h>
11
12/* lpddr_private describes lpddr flash chip in memory map
13 * @ManufactId - Chip Manufacture ID
14 * @DevId - Chip Device ID
15 * @qinfo - pointer to qinfo records describing the chip
16 * @numchips - number of chips including virual RWW partitions
17 * @chipshift - Chip/partiton size 2^chipshift
18 * @chips - per-chip data structure
19 */
20struct lpddr_private {
21 uint16_t ManufactId;
22 uint16_t DevId;
23 struct qinfo_chip *qinfo;
24 int numchips;
25 unsigned long chipshift;
26 struct flchip chips[0];
27};
28
29/* qinfo_query_info structure contains request information for
30 * each qinfo record
31 * @major - major number of qinfo record
32 * @major - minor number of qinfo record
33 * @id_str - descriptive string to access the record
34 * @desc - detailed description for the qinfo record
35 */
36struct qinfo_query_info {
37 uint8_t major;
38 uint8_t minor;
39 char *id_str;
40 char *desc;
41};
42
43/*
44 * qinfo_chip structure contains necessary qinfo records data
45 * @DevSizeShift - Device size 2^n bytes
46 * @BufSizeShift - Program buffer size 2^n bytes
47 * @TotalBlocksNum - Total number of blocks
48 * @UniformBlockSizeShift - Uniform block size 2^UniformBlockSizeShift bytes
49 * @HWPartsNum - Number of hardware partitions
50 * @SuspEraseSupp - Suspend erase supported
51 * @SingleWordProgTime - Single word program 2^SingleWordProgTime u-sec
52 * @ProgBufferTime - Program buffer write 2^ProgBufferTime u-sec
53 * @BlockEraseTime - Block erase 2^BlockEraseTime m-sec
54 */
55struct qinfo_chip {
56 /* General device info */
57 uint16_t DevSizeShift;
58 uint16_t BufSizeShift;
59 /* Erase block information */
60 uint16_t TotalBlocksNum;
61 uint16_t UniformBlockSizeShift;
62 /* Partition information */
63 uint16_t HWPartsNum;
64 /* Optional features */
65 uint16_t SuspEraseSupp;
66 /* Operation typical time */
67 uint16_t SingleWordProgTime;
68 uint16_t ProgBufferTime;
69 uint16_t BlockEraseTime;
70};
71
72/* defines for fixup usage */
73#define LPDDR_MFR_ANY 0xffff
74#define LPDDR_ID_ANY 0xffff
75#define NUMONYX_MFGR_ID 0x0089
76#define R18_DEVICE_ID_1G 0x893c
77
78static inline map_word lpddr_build_cmd(u_long cmd, struct map_info *map)
79{
80 map_word val = { {0} };
81 val.x[0] = cmd;
82 return val;
83}
84
85#define CMD(x) lpddr_build_cmd(x, map)
86#define CMDVAL(cmd) cmd.x[0]
87
88struct mtd_info *lpddr_cmdset(struct map_info *);
89
90#endif
91
diff --git a/include/linux/mtd/sharpsl.h b/include/linux/mtd/sharpsl.h
new file mode 100644
index 000000000000..25f4d2a845c1
--- /dev/null
+++ b/include/linux/mtd/sharpsl.h
@@ -0,0 +1,20 @@
1/*
2 * SharpSL NAND support
3 *
4 * Copyright (C) 2008 Dmitry Baryshkov
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#include <linux/mtd/nand.h>
12#include <linux/mtd/nand_ecc.h>
13#include <linux/mtd/partitions.h>
14
15struct sharpsl_nand_platform_data {
16 struct nand_bbt_descr *badblock_pattern;
17 struct nand_ecclayout *ecc_layout;
18 struct mtd_partition *partitions;
19 unsigned int nr_partitions;
20};
diff --git a/include/linux/ncp_fs.h b/include/linux/ncp_fs.h
index 9f2d76347f19..f69e66d151cc 100644
--- a/include/linux/ncp_fs.h
+++ b/include/linux/ncp_fs.h
@@ -87,7 +87,7 @@ struct ncp_objectname_ioctl
87#define NCP_AUTH_NDS 0x32 87#define NCP_AUTH_NDS 0x32
88 int auth_type; 88 int auth_type;
89 size_t object_name_len; 89 size_t object_name_len;
90 void __user * object_name; /* an userspace data, in most cases user name */ 90 void __user * object_name; /* a userspace data, in most cases user name */
91}; 91};
92 92
93struct ncp_privatedata_ioctl 93struct ncp_privatedata_ioctl
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 41e1224651cf..f24556813375 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -313,10 +313,11 @@ struct napi_struct {
313#ifdef CONFIG_NETPOLL 313#ifdef CONFIG_NETPOLL
314 spinlock_t poll_lock; 314 spinlock_t poll_lock;
315 int poll_owner; 315 int poll_owner;
316 struct net_device *dev;
317#endif 316#endif
317 struct net_device *dev;
318 struct list_head dev_list; 318 struct list_head dev_list;
319 struct sk_buff *gro_list; 319 struct sk_buff *gro_list;
320 struct sk_buff *skb;
320}; 321};
321 322
322enum 323enum
@@ -990,6 +991,9 @@ struct napi_gro_cb {
990 991
991 /* Number of segments aggregated. */ 992 /* Number of segments aggregated. */
992 int count; 993 int count;
994
995 /* Free the skb? */
996 int free;
993}; 997};
994 998
995#define NAPI_GRO_CB(skb) ((struct napi_gro_cb *)(skb)->cb) 999#define NAPI_GRO_CB(skb) ((struct napi_gro_cb *)(skb)->cb)
@@ -1011,6 +1015,14 @@ struct packet_type {
1011 struct list_head list; 1015 struct list_head list;
1012}; 1016};
1013 1017
1018struct napi_gro_fraginfo {
1019 skb_frag_t frags[MAX_SKB_FRAGS];
1020 unsigned int nr_frags;
1021 unsigned int ip_summed;
1022 unsigned int len;
1023 __wsum csum;
1024};
1025
1014#include <linux/interrupt.h> 1026#include <linux/interrupt.h>
1015#include <linux/notifier.h> 1027#include <linux/notifier.h>
1016 1028
@@ -1113,9 +1125,6 @@ struct softnet_data
1113 struct sk_buff *completion_queue; 1125 struct sk_buff *completion_queue;
1114 1126
1115 struct napi_struct backlog; 1127 struct napi_struct backlog;
1116#ifdef CONFIG_NET_DMA
1117 struct dma_chan *net_dma;
1118#endif
1119}; 1128};
1120 1129
1121DECLARE_PER_CPU(struct softnet_data,softnet_data); 1130DECLARE_PER_CPU(struct softnet_data,softnet_data);
@@ -1361,8 +1370,16 @@ extern int netif_rx_ni(struct sk_buff *skb);
1361#define HAVE_NETIF_RECEIVE_SKB 1 1370#define HAVE_NETIF_RECEIVE_SKB 1
1362extern int netif_receive_skb(struct sk_buff *skb); 1371extern int netif_receive_skb(struct sk_buff *skb);
1363extern void napi_gro_flush(struct napi_struct *napi); 1372extern void napi_gro_flush(struct napi_struct *napi);
1373extern int dev_gro_receive(struct napi_struct *napi,
1374 struct sk_buff *skb);
1364extern int napi_gro_receive(struct napi_struct *napi, 1375extern int napi_gro_receive(struct napi_struct *napi,
1365 struct sk_buff *skb); 1376 struct sk_buff *skb);
1377extern void napi_reuse_skb(struct napi_struct *napi,
1378 struct sk_buff *skb);
1379extern struct sk_buff * napi_fraginfo_skb(struct napi_struct *napi,
1380 struct napi_gro_fraginfo *info);
1381extern int napi_gro_frags(struct napi_struct *napi,
1382 struct napi_gro_fraginfo *info);
1366extern void netif_nit_deliver(struct sk_buff *skb); 1383extern void netif_nit_deliver(struct sk_buff *skb);
1367extern int dev_valid_name(const char *name); 1384extern int dev_valid_name(const char *name);
1368extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); 1385extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *);
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index ea0366769484..b912311a56b1 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -88,6 +88,8 @@
88#define NFS4_ACE_GENERIC_EXECUTE 0x001200A0 88#define NFS4_ACE_GENERIC_EXECUTE 0x001200A0
89#define NFS4_ACE_MASK_ALL 0x001F01FF 89#define NFS4_ACE_MASK_ALL 0x001F01FF
90 90
91#define NFS4_MAX_UINT64 (~(u64)0)
92
91enum nfs4_acl_whotype { 93enum nfs4_acl_whotype {
92 NFS4_ACL_WHO_NAMED = 0, 94 NFS4_ACL_WHO_NAMED = 0,
93 NFS4_ACL_WHO_OWNER, 95 NFS4_ACL_WHO_OWNER,
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
index 21269405ffe2..e19f45991b2e 100644
--- a/include/linux/nfsd/nfsd.h
+++ b/include/linux/nfsd/nfsd.h
@@ -23,7 +23,6 @@
23/* 23/*
24 * nfsd version 24 * nfsd version
25 */ 25 */
26#define NFSD_VERSION "0.5"
27#define NFSD_SUPPORTED_MINOR_VERSION 0 26#define NFSD_SUPPORTED_MINOR_VERSION 0
28 27
29/* 28/*
diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h
index d1941cb965e9..b2e093870bc6 100644
--- a/include/linux/nfsd/nfsfh.h
+++ b/include/linux/nfsd/nfsfh.h
@@ -68,6 +68,10 @@ struct nfs_fhbase_old {
68 * 1 - 4 byte user specified identifier 68 * 1 - 4 byte user specified identifier
69 * 2 - 4 byte major, 4 byte minor, 4 byte inode number - DEPRECATED 69 * 2 - 4 byte major, 4 byte minor, 4 byte inode number - DEPRECATED
70 * 3 - 4 byte device id, encoded for user-space, 4 byte inode number 70 * 3 - 4 byte device id, encoded for user-space, 4 byte inode number
71 * 4 - 4 byte inode number and 4 byte uuid
72 * 5 - 8 byte uuid
73 * 6 - 16 byte uuid
74 * 7 - 8 byte inode number and 16 byte uuid
71 * 75 *
72 * The fileid_type identified how the file within the filesystem is encoded. 76 * The fileid_type identified how the file within the filesystem is encoded.
73 * This is (will be) passed to, and set by, the underlying filesystem if it supports 77 * This is (will be) passed to, and set by, the underlying filesystem if it supports
diff --git a/include/linux/node.h b/include/linux/node.h
index bc001bc225c3..681a697b9a86 100644
--- a/include/linux/node.h
+++ b/include/linux/node.h
@@ -26,6 +26,7 @@ struct node {
26 struct sys_device sysdev; 26 struct sys_device sysdev;
27}; 27};
28 28
29struct memory_block;
29extern struct node node_devices[]; 30extern struct node node_devices[];
30 31
31extern int register_node(struct node *, int, struct node *); 32extern int register_node(struct node *, int, struct node *);
@@ -35,6 +36,9 @@ extern int register_one_node(int nid);
35extern void unregister_one_node(int nid); 36extern void unregister_one_node(int nid);
36extern int register_cpu_under_node(unsigned int cpu, unsigned int nid); 37extern int register_cpu_under_node(unsigned int cpu, unsigned int nid);
37extern int unregister_cpu_under_node(unsigned int cpu, unsigned int nid); 38extern int unregister_cpu_under_node(unsigned int cpu, unsigned int nid);
39extern int register_mem_sect_under_node(struct memory_block *mem_blk,
40 int nid);
41extern int unregister_mem_sect_under_nodes(struct memory_block *mem_blk);
38#else 42#else
39static inline int register_one_node(int nid) 43static inline int register_one_node(int nid)
40{ 44{
@@ -52,6 +56,15 @@ static inline int unregister_cpu_under_node(unsigned int cpu, unsigned int nid)
52{ 56{
53 return 0; 57 return 0;
54} 58}
59static inline int register_mem_sect_under_node(struct memory_block *mem_blk,
60 int nid)
61{
62 return 0;
63}
64static inline int unregister_mem_sect_under_nodes(struct memory_block *mem_blk)
65{
66 return 0;
67}
55#endif 68#endif
56 69
57#define to_node(sys_device) container_of(sys_device, struct node, sysdev) 70#define to_node(sys_device) container_of(sys_device, struct node, sysdev)
diff --git a/include/linux/nwpserial.h b/include/linux/nwpserial.h
new file mode 100644
index 000000000000..9acb21572eaf
--- /dev/null
+++ b/include/linux/nwpserial.h
@@ -0,0 +1,18 @@
1/*
2 * Serial Port driver for a NWP uart device
3 *
4 * Copyright (C) 2008 IBM Corp., Benjamin Krill <ben@codiert.org>
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#ifndef _NWPSERIAL_H
13#define _NWPSERIAL_H
14
15int nwpserial_register_port(struct uart_port *port);
16void nwpserial_unregister_port(int line);
17
18#endif /* _NWPSERIAL_H */
diff --git a/include/linux/oprofile.h b/include/linux/oprofile.h
index 1ce9fe572e51..1d9518bc4c58 100644
--- a/include/linux/oprofile.h
+++ b/include/linux/oprofile.h
@@ -164,4 +164,22 @@ void oprofile_put_buff(unsigned long *buf, unsigned int start,
164unsigned long oprofile_get_cpu_buffer_size(void); 164unsigned long oprofile_get_cpu_buffer_size(void);
165void oprofile_cpu_buffer_inc_smpl_lost(void); 165void oprofile_cpu_buffer_inc_smpl_lost(void);
166 166
167/* cpu buffer functions */
168
169struct op_sample;
170
171struct op_entry {
172 struct ring_buffer_event *event;
173 struct op_sample *sample;
174 unsigned long irq_flags;
175 unsigned long size;
176 unsigned long *data;
177};
178
179void oprofile_write_reserve(struct op_entry *entry,
180 struct pt_regs * const regs,
181 unsigned long pc, int code, int size);
182int oprofile_add_data(struct op_entry *entry, unsigned long val);
183int oprofile_write_commit(struct op_entry *entry);
184
167#endif /* OPROFILE_H */ 185#endif /* OPROFILE_H */
diff --git a/include/linux/oxu210hp.h b/include/linux/oxu210hp.h
new file mode 100644
index 000000000000..0bf96eae5389
--- /dev/null
+++ b/include/linux/oxu210hp.h
@@ -0,0 +1,7 @@
1/* platform data for the OXU210HP HCD */
2
3struct oxu210hp_platform_data {
4 unsigned int bus16:1;
5 unsigned int use_hcd_otg:1;
6 unsigned int use_hcd_sph:1;
7};
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index b12f93a3c345..219a523ecdb0 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -228,6 +228,7 @@ PAGEFLAG_FALSE(HighMem)
228PAGEFLAG(SwapCache, swapcache) 228PAGEFLAG(SwapCache, swapcache)
229#else 229#else
230PAGEFLAG_FALSE(SwapCache) 230PAGEFLAG_FALSE(SwapCache)
231 SETPAGEFLAG_NOOP(SwapCache) CLEARPAGEFLAG_NOOP(SwapCache)
231#endif 232#endif
232 233
233#ifdef CONFIG_UNEVICTABLE_LRU 234#ifdef CONFIG_UNEVICTABLE_LRU
@@ -372,31 +373,22 @@ static inline void __ClearPageTail(struct page *page)
372#define __PG_MLOCKED 0 373#define __PG_MLOCKED 0
373#endif 374#endif
374 375
375#define PAGE_FLAGS (1 << PG_lru | 1 << PG_private | 1 << PG_locked | \
376 1 << PG_buddy | 1 << PG_writeback | \
377 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active | \
378 __PG_UNEVICTABLE | __PG_MLOCKED)
379
380/*
381 * Flags checked in bad_page(). Pages on the free list should not have
382 * these flags set. It they are, there is a problem.
383 */
384#define PAGE_FLAGS_CLEAR_WHEN_BAD (PAGE_FLAGS | \
385 1 << PG_reclaim | 1 << PG_dirty | 1 << PG_swapbacked)
386
387/* 376/*
388 * Flags checked when a page is freed. Pages being freed should not have 377 * Flags checked when a page is freed. Pages being freed should not have
389 * these flags set. It they are, there is a problem. 378 * these flags set. It they are, there is a problem.
390 */ 379 */
391#define PAGE_FLAGS_CHECK_AT_FREE (PAGE_FLAGS | 1 << PG_reserved) 380#define PAGE_FLAGS_CHECK_AT_FREE \
381 (1 << PG_lru | 1 << PG_private | 1 << PG_locked | \
382 1 << PG_buddy | 1 << PG_writeback | 1 << PG_reserved | \
383 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active | \
384 __PG_UNEVICTABLE | __PG_MLOCKED)
392 385
393/* 386/*
394 * Flags checked when a page is prepped for return by the page allocator. 387 * Flags checked when a page is prepped for return by the page allocator.
395 * Pages being prepped should not have these flags set. It they are, there 388 * Pages being prepped should not have any flags set. It they are set,
396 * is a problem. 389 * there has been a kernel bug or struct page corruption.
397 */ 390 */
398#define PAGE_FLAGS_CHECK_AT_PREP (PAGE_FLAGS | \ 391#define PAGE_FLAGS_CHECK_AT_PREP ((1 << NR_PAGEFLAGS) - 1)
399 1 << PG_reserved | 1 << PG_dirty | 1 << PG_swapbacked)
400 392
401#endif /* !__GENERATING_BOUNDS_H */ 393#endif /* !__GENERATING_BOUNDS_H */
402#endif /* PAGE_FLAGS_H */ 394#endif /* PAGE_FLAGS_H */
diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h
index 1e6d34bfa094..602cc1fdee90 100644
--- a/include/linux/page_cgroup.h
+++ b/include/linux/page_cgroup.h
@@ -26,10 +26,6 @@ enum {
26 PCG_LOCK, /* page cgroup is locked */ 26 PCG_LOCK, /* page cgroup is locked */
27 PCG_CACHE, /* charged as cache */ 27 PCG_CACHE, /* charged as cache */
28 PCG_USED, /* this object is in use. */ 28 PCG_USED, /* this object is in use. */
29 /* flags for LRU placement */
30 PCG_ACTIVE, /* page is active in this cgroup */
31 PCG_FILE, /* page is file system backed */
32 PCG_UNEVICTABLE, /* page is unevictableable */
33}; 29};
34 30
35#define TESTPCGFLAG(uname, lname) \ 31#define TESTPCGFLAG(uname, lname) \
@@ -50,19 +46,6 @@ TESTPCGFLAG(Cache, CACHE)
50TESTPCGFLAG(Used, USED) 46TESTPCGFLAG(Used, USED)
51CLEARPCGFLAG(Used, USED) 47CLEARPCGFLAG(Used, USED)
52 48
53/* LRU management flags (from global-lru definition) */
54TESTPCGFLAG(File, FILE)
55SETPCGFLAG(File, FILE)
56CLEARPCGFLAG(File, FILE)
57
58TESTPCGFLAG(Active, ACTIVE)
59SETPCGFLAG(Active, ACTIVE)
60CLEARPCGFLAG(Active, ACTIVE)
61
62TESTPCGFLAG(Unevictable, UNEVICTABLE)
63SETPCGFLAG(Unevictable, UNEVICTABLE)
64CLEARPCGFLAG(Unevictable, UNEVICTABLE)
65
66static inline int page_cgroup_nid(struct page_cgroup *pc) 49static inline int page_cgroup_nid(struct page_cgroup *pc)
67{ 50{
68 return page_to_nid(pc->page); 51 return page_to_nid(pc->page);
@@ -105,4 +88,39 @@ static inline void page_cgroup_init(void)
105} 88}
106 89
107#endif 90#endif
91
92#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
93#include <linux/swap.h>
94extern struct mem_cgroup *
95swap_cgroup_record(swp_entry_t ent, struct mem_cgroup *mem);
96extern struct mem_cgroup *lookup_swap_cgroup(swp_entry_t ent);
97extern int swap_cgroup_swapon(int type, unsigned long max_pages);
98extern void swap_cgroup_swapoff(int type);
99#else
100#include <linux/swap.h>
101
102static inline
103struct mem_cgroup *swap_cgroup_record(swp_entry_t ent, struct mem_cgroup *mem)
104{
105 return NULL;
106}
107
108static inline
109struct mem_cgroup *lookup_swap_cgroup(swp_entry_t ent)
110{
111 return NULL;
112}
113
114static inline int
115swap_cgroup_swapon(int type, unsigned long max_pages)
116{
117 return 0;
118}
119
120static inline void swap_cgroup_swapoff(int type)
121{
122 return;
123}
124
125#endif
108#endif 126#endif
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 709742be02f0..01ca0856caff 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -241,7 +241,8 @@ unsigned find_get_pages_contig(struct address_space *mapping, pgoff_t start,
241unsigned find_get_pages_tag(struct address_space *mapping, pgoff_t *index, 241unsigned find_get_pages_tag(struct address_space *mapping, pgoff_t *index,
242 int tag, unsigned int nr_pages, struct page **pages); 242 int tag, unsigned int nr_pages, struct page **pages);
243 243
244struct page *__grab_cache_page(struct address_space *mapping, pgoff_t index); 244struct page *grab_cache_page_write_begin(struct address_space *mapping,
245 pgoff_t index, unsigned flags);
245 246
246/* 247/*
247 * Returns locked page at given index in given cache, creating it if needed. 248 * Returns locked page at given index in given cache, creating it if needed.
diff --git a/include/linux/pagevec.h b/include/linux/pagevec.h
index e90a2cb02915..7b2886fa7fdc 100644
--- a/include/linux/pagevec.h
+++ b/include/linux/pagevec.h
@@ -21,7 +21,6 @@ struct pagevec {
21}; 21};
22 22
23void __pagevec_release(struct pagevec *pvec); 23void __pagevec_release(struct pagevec *pvec);
24void __pagevec_release_nonlru(struct pagevec *pvec);
25void __pagevec_free(struct pagevec *pvec); 24void __pagevec_free(struct pagevec *pvec);
26void ____pagevec_lru_add(struct pagevec *pvec, enum lru_list lru); 25void ____pagevec_lru_add(struct pagevec *pvec, enum lru_list lru);
27void pagevec_strip(struct pagevec *pvec); 26void pagevec_strip(struct pagevec *pvec);
@@ -69,12 +68,6 @@ static inline void pagevec_release(struct pagevec *pvec)
69 __pagevec_release(pvec); 68 __pagevec_release(pvec);
70} 69}
71 70
72static inline void pagevec_release_nonlru(struct pagevec *pvec)
73{
74 if (pagevec_count(pvec))
75 __pagevec_release_nonlru(pvec);
76}
77
78static inline void pagevec_free(struct pagevec *pvec) 71static inline void pagevec_free(struct pagevec *pvec)
79{ 72{
80 if (pagevec_count(pvec)) 73 if (pagevec_count(pvec))
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h
index 8837928fbf33..042c166f65d5 100644
--- a/include/linux/pci-acpi.h
+++ b/include/linux/pci-acpi.h
@@ -8,6 +8,8 @@
8#ifndef _PCI_ACPI_H_ 8#ifndef _PCI_ACPI_H_
9#define _PCI_ACPI_H_ 9#define _PCI_ACPI_H_
10 10
11#include <linux/acpi.h>
12
11#define OSC_QUERY_TYPE 0 13#define OSC_QUERY_TYPE 0
12#define OSC_SUPPORT_TYPE 1 14#define OSC_SUPPORT_TYPE 1
13#define OSC_CONTROL_TYPE 2 15#define OSC_CONTROL_TYPE 2
@@ -48,15 +50,7 @@
48 50
49#ifdef CONFIG_ACPI 51#ifdef CONFIG_ACPI
50extern acpi_status pci_osc_control_set(acpi_handle handle, u32 flags); 52extern acpi_status pci_osc_control_set(acpi_handle handle, u32 flags);
51extern acpi_status __pci_osc_support_set(u32 flags, const char *hid); 53int pci_acpi_osc_support(acpi_handle handle, u32 flags);
52static inline acpi_status pci_osc_support_set(u32 flags)
53{
54 return __pci_osc_support_set(flags, PCI_ROOT_HID_STRING);
55}
56static inline acpi_status pcie_osc_support_set(u32 flags)
57{
58 return __pci_osc_support_set(flags, PCI_EXPRESS_ROOT_HID_STRING);
59}
60static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev) 54static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev)
61{ 55{
62 /* Find root host bridge */ 56 /* Find root host bridge */
@@ -66,6 +60,15 @@ static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev)
66 return acpi_get_pci_rootbridge_handle(pci_domain_nr(pdev->bus), 60 return acpi_get_pci_rootbridge_handle(pci_domain_nr(pdev->bus),
67 pdev->bus->number); 61 pdev->bus->number);
68} 62}
63
64static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus)
65{
66 int seg = pci_domain_nr(pbus), busnr = pbus->number;
67 struct pci_dev *bridge = pbus->self;
68 if (bridge)
69 return DEVICE_ACPI_HANDLE(&(bridge->dev));
70 return acpi_get_pci_rootbridge_handle(seg, busnr);
71}
69#else 72#else
70#if !defined(AE_ERROR) 73#if !defined(AE_ERROR)
71typedef u32 acpi_status; 74typedef u32 acpi_status;
@@ -73,8 +76,6 @@ typedef u32 acpi_status;
73#endif 76#endif
74static inline acpi_status pci_osc_control_set(acpi_handle handle, u32 flags) 77static inline acpi_status pci_osc_control_set(acpi_handle handle, u32 flags)
75{return AE_ERROR;} 78{return AE_ERROR;}
76static inline acpi_status pci_osc_support_set(u32 flags) {return AE_ERROR;}
77static inline acpi_status pcie_osc_support_set(u32 flags) {return AE_ERROR;}
78static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev) 79static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev)
79{ return NULL; } 80{ return NULL; }
80#endif 81#endif
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 03b0b8c3c81b..80f8b8b65fde 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -82,7 +82,30 @@ enum pci_mmap_state {
82#define PCI_DMA_FROMDEVICE 2 82#define PCI_DMA_FROMDEVICE 2
83#define PCI_DMA_NONE 3 83#define PCI_DMA_NONE 3
84 84
85#define DEVICE_COUNT_RESOURCE 12 85/*
86 * For PCI devices, the region numbers are assigned this way:
87 */
88enum {
89 /* #0-5: standard PCI resources */
90 PCI_STD_RESOURCES,
91 PCI_STD_RESOURCE_END = 5,
92
93 /* #6: expansion ROM resource */
94 PCI_ROM_RESOURCE,
95
96 /* resources assigned to buses behind the bridge */
97#define PCI_BRIDGE_RESOURCE_NUM 4
98
99 PCI_BRIDGE_RESOURCES,
100 PCI_BRIDGE_RESOURCE_END = PCI_BRIDGE_RESOURCES +
101 PCI_BRIDGE_RESOURCE_NUM - 1,
102
103 /* total resources associated with a PCI device */
104 PCI_NUM_RESOURCES,
105
106 /* preserve this for compatibility */
107 DEVICE_COUNT_RESOURCE
108};
86 109
87typedef int __bitwise pci_power_t; 110typedef int __bitwise pci_power_t;
88 111
@@ -274,18 +297,6 @@ static inline void pci_add_saved_cap(struct pci_dev *pci_dev,
274 hlist_add_head(&new_cap->next, &pci_dev->saved_cap_space); 297 hlist_add_head(&new_cap->next, &pci_dev->saved_cap_space);
275} 298}
276 299
277/*
278 * For PCI devices, the region numbers are assigned this way:
279 *
280 * 0-5 standard PCI regions
281 * 6 expansion ROM
282 * 7-10 bridges: address space assigned to buses behind the bridge
283 */
284
285#define PCI_ROM_RESOURCE 6
286#define PCI_BRIDGE_RESOURCES 7
287#define PCI_NUM_RESOURCES 11
288
289#ifndef PCI_BUS_NUM_RESOURCES 300#ifndef PCI_BUS_NUM_RESOURCES
290#define PCI_BUS_NUM_RESOURCES 16 301#define PCI_BUS_NUM_RESOURCES 16
291#endif 302#endif
@@ -325,6 +336,15 @@ struct pci_bus {
325#define pci_bus_b(n) list_entry(n, struct pci_bus, node) 336#define pci_bus_b(n) list_entry(n, struct pci_bus, node)
326#define to_pci_bus(n) container_of(n, struct pci_bus, dev) 337#define to_pci_bus(n) container_of(n, struct pci_bus, dev)
327 338
339#ifdef CONFIG_PCI_MSI
340static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev)
341{
342 return pci_dev->msi_enabled || pci_dev->msix_enabled;
343}
344#else
345static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev) { return false; }
346#endif
347
328/* 348/*
329 * Error values that may be returned by PCI functions. 349 * Error values that may be returned by PCI functions.
330 */ 350 */
@@ -421,7 +441,6 @@ struct pci_driver {
421 int (*resume_early) (struct pci_dev *dev); 441 int (*resume_early) (struct pci_dev *dev);
422 int (*resume) (struct pci_dev *dev); /* Device woken up */ 442 int (*resume) (struct pci_dev *dev); /* Device woken up */
423 void (*shutdown) (struct pci_dev *dev); 443 void (*shutdown) (struct pci_dev *dev);
424 struct pm_ext_ops *pm;
425 struct pci_error_handlers *err_handler; 444 struct pci_error_handlers *err_handler;
426 struct device_driver driver; 445 struct device_driver driver;
427 struct pci_dynids dynids; 446 struct pci_dynids dynids;
@@ -533,7 +552,9 @@ int __must_check pci_bus_add_device(struct pci_dev *dev);
533void pci_read_bridge_bases(struct pci_bus *child); 552void pci_read_bridge_bases(struct pci_bus *child);
534struct resource *pci_find_parent_resource(const struct pci_dev *dev, 553struct resource *pci_find_parent_resource(const struct pci_dev *dev,
535 struct resource *res); 554 struct resource *res);
555u8 pci_swizzle_interrupt_pin(struct pci_dev *dev, u8 pin);
536int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge); 556int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge);
557u8 pci_common_swizzle(struct pci_dev *dev, u8 *pinp);
537extern struct pci_dev *pci_dev_get(struct pci_dev *dev); 558extern struct pci_dev *pci_dev_get(struct pci_dev *dev);
538extern void pci_dev_put(struct pci_dev *dev); 559extern void pci_dev_put(struct pci_dev *dev);
539extern void pci_remove_bus(struct pci_bus *b); 560extern void pci_remove_bus(struct pci_bus *b);
@@ -630,6 +651,7 @@ static inline int pci_is_managed(struct pci_dev *pdev)
630 651
631void pci_disable_device(struct pci_dev *dev); 652void pci_disable_device(struct pci_dev *dev);
632void pci_set_master(struct pci_dev *dev); 653void pci_set_master(struct pci_dev *dev);
654void pci_clear_master(struct pci_dev *dev);
633int pci_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state); 655int pci_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state);
634#define HAVE_PCI_SET_MWI 656#define HAVE_PCI_SET_MWI
635int __must_check pci_set_mwi(struct pci_dev *dev); 657int __must_check pci_set_mwi(struct pci_dev *dev);
@@ -648,7 +670,7 @@ int pcie_get_readrq(struct pci_dev *dev);
648int pcie_set_readrq(struct pci_dev *dev, int rq); 670int pcie_set_readrq(struct pci_dev *dev, int rq);
649int pci_reset_function(struct pci_dev *dev); 671int pci_reset_function(struct pci_dev *dev);
650int pci_execute_reset_function(struct pci_dev *dev); 672int pci_execute_reset_function(struct pci_dev *dev);
651void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno); 673void pci_update_resource(struct pci_dev *dev, int resno);
652int __must_check pci_assign_resource(struct pci_dev *dev, int i); 674int __must_check pci_assign_resource(struct pci_dev *dev, int i);
653int pci_select_bars(struct pci_dev *dev, unsigned long flags); 675int pci_select_bars(struct pci_dev *dev, unsigned long flags);
654 676
@@ -675,6 +697,11 @@ int pci_back_from_sleep(struct pci_dev *dev);
675/* Functions for PCI Hotplug drivers to use */ 697/* Functions for PCI Hotplug drivers to use */
676int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap); 698int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap);
677 699
700/* Vital product data routines */
701ssize_t pci_read_vpd(struct pci_dev *dev, loff_t pos, size_t count, void *buf);
702ssize_t pci_write_vpd(struct pci_dev *dev, loff_t pos, size_t count, const void *buf);
703int pci_vpd_truncate(struct pci_dev *dev, size_t size);
704
678/* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */ 705/* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */
679void pci_bus_assign_resources(struct pci_bus *bus); 706void pci_bus_assign_resources(struct pci_bus *bus);
680void pci_bus_size_bridges(struct pci_bus *bus); 707void pci_bus_size_bridges(struct pci_bus *bus);
@@ -687,10 +714,13 @@ void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *),
687 int (*)(struct pci_dev *, u8, u8)); 714 int (*)(struct pci_dev *, u8, u8));
688#define HAVE_PCI_REQ_REGIONS 2 715#define HAVE_PCI_REQ_REGIONS 2
689int __must_check pci_request_regions(struct pci_dev *, const char *); 716int __must_check pci_request_regions(struct pci_dev *, const char *);
717int __must_check pci_request_regions_exclusive(struct pci_dev *, const char *);
690void pci_release_regions(struct pci_dev *); 718void pci_release_regions(struct pci_dev *);
691int __must_check pci_request_region(struct pci_dev *, int, const char *); 719int __must_check pci_request_region(struct pci_dev *, int, const char *);
720int __must_check pci_request_region_exclusive(struct pci_dev *, int, const char *);
692void pci_release_region(struct pci_dev *, int); 721void pci_release_region(struct pci_dev *, int);
693int pci_request_selected_regions(struct pci_dev *, int, const char *); 722int pci_request_selected_regions(struct pci_dev *, int, const char *);
723int pci_request_selected_regions_exclusive(struct pci_dev *, int, const char *);
694void pci_release_selected_regions(struct pci_dev *, int); 724void pci_release_selected_regions(struct pci_dev *, int);
695 725
696/* drivers/pci/bus.c */ 726/* drivers/pci/bus.c */
@@ -780,6 +810,10 @@ static inline void msi_remove_pci_irq_vectors(struct pci_dev *dev)
780 810
781static inline void pci_restore_msi_state(struct pci_dev *dev) 811static inline void pci_restore_msi_state(struct pci_dev *dev)
782{ } 812{ }
813static inline int pci_msi_enabled(void)
814{
815 return 0;
816}
783#else 817#else
784extern int pci_enable_msi(struct pci_dev *dev); 818extern int pci_enable_msi(struct pci_dev *dev);
785extern void pci_msi_shutdown(struct pci_dev *dev); 819extern void pci_msi_shutdown(struct pci_dev *dev);
@@ -790,6 +824,16 @@ extern void pci_msix_shutdown(struct pci_dev *dev);
790extern void pci_disable_msix(struct pci_dev *dev); 824extern void pci_disable_msix(struct pci_dev *dev);
791extern void msi_remove_pci_irq_vectors(struct pci_dev *dev); 825extern void msi_remove_pci_irq_vectors(struct pci_dev *dev);
792extern void pci_restore_msi_state(struct pci_dev *dev); 826extern void pci_restore_msi_state(struct pci_dev *dev);
827extern int pci_msi_enabled(void);
828#endif
829
830#ifndef CONFIG_PCIEASPM
831static inline int pcie_aspm_enabled(void)
832{
833 return 0;
834}
835#else
836extern int pcie_aspm_enabled(void);
793#endif 837#endif
794 838
795#ifdef CONFIG_HT_IRQ 839#ifdef CONFIG_HT_IRQ
@@ -1141,20 +1185,9 @@ static inline void pci_mmcfg_early_init(void) { }
1141static inline void pci_mmcfg_late_init(void) { } 1185static inline void pci_mmcfg_late_init(void) { }
1142#endif 1186#endif
1143 1187
1144#ifdef CONFIG_HAS_IOMEM 1188int pci_ext_cfg_avail(struct pci_dev *dev);
1145static inline void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar) 1189
1146{ 1190void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar);
1147 /*
1148 * Make sure the BAR is actually a memory resource, not an IO resource
1149 */
1150 if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM)) {
1151 WARN_ON(1);
1152 return NULL;
1153 }
1154 return ioremap_nocache(pci_resource_start(pdev, bar),
1155 pci_resource_len(pdev, bar));
1156}
1157#endif
1158 1191
1159#endif /* __KERNEL__ */ 1192#endif /* __KERNEL__ */
1160#endif /* LINUX_PCI_H */ 1193#endif /* LINUX_PCI_H */
diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h
index a00bd1a0f156..20998746518e 100644
--- a/include/linux/pci_hotplug.h
+++ b/include/linux/pci_hotplug.h
@@ -223,11 +223,12 @@ struct hotplug_params {
223#ifdef CONFIG_ACPI 223#ifdef CONFIG_ACPI
224#include <acpi/acpi.h> 224#include <acpi/acpi.h>
225#include <acpi/acpi_bus.h> 225#include <acpi/acpi_bus.h>
226#include <acpi/actypes.h>
227extern acpi_status acpi_get_hp_params_from_firmware(struct pci_bus *bus, 226extern acpi_status acpi_get_hp_params_from_firmware(struct pci_bus *bus,
228 struct hotplug_params *hpp); 227 struct hotplug_params *hpp);
229int acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev, u32 flags); 228int acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev, u32 flags);
230int acpi_root_bridge(acpi_handle handle); 229int acpi_root_bridge(acpi_handle handle);
230int acpi_pci_check_ejectable(struct pci_bus *pbus, acpi_handle handle);
231int acpi_pci_detect_ejectable(struct pci_bus *pbus);
231#endif 232#endif
232#endif 233#endif
233 234
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 218c73b1e6d4..d543365518ab 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1658,6 +1658,7 @@
1658#define PCI_VENDOR_ID_ROCKWELL 0x127A 1658#define PCI_VENDOR_ID_ROCKWELL 0x127A
1659 1659
1660#define PCI_VENDOR_ID_ITE 0x1283 1660#define PCI_VENDOR_ID_ITE 0x1283
1661#define PCI_DEVICE_ID_ITE_8172 0x8172
1661#define PCI_DEVICE_ID_ITE_8211 0x8211 1662#define PCI_DEVICE_ID_ITE_8211 0x8211
1662#define PCI_DEVICE_ID_ITE_8212 0x8212 1663#define PCI_DEVICE_ID_ITE_8212 0x8212
1663#define PCI_DEVICE_ID_ITE_8213 0x8213 1664#define PCI_DEVICE_ID_ITE_8213 0x8213
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
index e5effd47ed74..027815b4635e 100644
--- a/include/linux/pci_regs.h
+++ b/include/linux/pci_regs.h
@@ -210,6 +210,7 @@
210#define PCI_CAP_ID_AGP3 0x0E /* AGP Target PCI-PCI bridge */ 210#define PCI_CAP_ID_AGP3 0x0E /* AGP Target PCI-PCI bridge */
211#define PCI_CAP_ID_EXP 0x10 /* PCI Express */ 211#define PCI_CAP_ID_EXP 0x10 /* PCI Express */
212#define PCI_CAP_ID_MSIX 0x11 /* MSI-X */ 212#define PCI_CAP_ID_MSIX 0x11 /* MSI-X */
213#define PCI_CAP_ID_AF 0x13 /* PCI Advanced Features */
213#define PCI_CAP_LIST_NEXT 1 /* Next capability in the list */ 214#define PCI_CAP_LIST_NEXT 1 /* Next capability in the list */
214#define PCI_CAP_FLAGS 2 /* Capability defined flags (16 bits) */ 215#define PCI_CAP_FLAGS 2 /* Capability defined flags (16 bits) */
215#define PCI_CAP_SIZEOF 4 216#define PCI_CAP_SIZEOF 4
@@ -316,6 +317,17 @@
316#define PCI_CHSWP_EXT 0x40 /* ENUM# status - extraction */ 317#define PCI_CHSWP_EXT 0x40 /* ENUM# status - extraction */
317#define PCI_CHSWP_INS 0x80 /* ENUM# status - insertion */ 318#define PCI_CHSWP_INS 0x80 /* ENUM# status - insertion */
318 319
320/* PCI Advanced Feature registers */
321
322#define PCI_AF_LENGTH 2
323#define PCI_AF_CAP 3
324#define PCI_AF_CAP_TP 0x01
325#define PCI_AF_CAP_FLR 0x02
326#define PCI_AF_CTRL 4
327#define PCI_AF_CTRL_FLR 0x01
328#define PCI_AF_STATUS 5
329#define PCI_AF_STATUS_TP 0x01
330
319/* PCI-X registers */ 331/* PCI-X registers */
320 332
321#define PCI_X_CMD 2 /* Modes & Features */ 333#define PCI_X_CMD 2 /* Modes & Features */
@@ -399,20 +411,70 @@
399#define PCI_EXP_DEVSTA_AUXPD 0x10 /* AUX Power Detected */ 411#define PCI_EXP_DEVSTA_AUXPD 0x10 /* AUX Power Detected */
400#define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */ 412#define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */
401#define PCI_EXP_LNKCAP 12 /* Link Capabilities */ 413#define PCI_EXP_LNKCAP 12 /* Link Capabilities */
402#define PCI_EXP_LNKCAP_ASPMS 0xc00 /* ASPM Support */ 414#define PCI_EXP_LNKCAP_SLS 0x0000000f /* Supported Link Speeds */
403#define PCI_EXP_LNKCAP_L0SEL 0x7000 /* L0s Exit Latency */ 415#define PCI_EXP_LNKCAP_MLW 0x000003f0 /* Maximum Link Width */
404#define PCI_EXP_LNKCAP_L1EL 0x38000 /* L1 Exit Latency */ 416#define PCI_EXP_LNKCAP_ASPMS 0x00000c00 /* ASPM Support */
405#define PCI_EXP_LNKCAP_CLKPM 0x40000 /* L1 Clock Power Management */ 417#define PCI_EXP_LNKCAP_L0SEL 0x00007000 /* L0s Exit Latency */
418#define PCI_EXP_LNKCAP_L1EL 0x00038000 /* L1 Exit Latency */
419#define PCI_EXP_LNKCAP_CLKPM 0x00040000 /* L1 Clock Power Management */
420#define PCI_EXP_LNKCAP_SDERC 0x00080000 /* Suprise Down Error Reporting Capable */
421#define PCI_EXP_LNKCAP_DLLLARC 0x00100000 /* Data Link Layer Link Active Reporting Capable */
422#define PCI_EXP_LNKCAP_LBNC 0x00200000 /* Link Bandwidth Notification Capability */
423#define PCI_EXP_LNKCAP_PN 0xff000000 /* Port Number */
406#define PCI_EXP_LNKCTL 16 /* Link Control */ 424#define PCI_EXP_LNKCTL 16 /* Link Control */
407#define PCI_EXP_LNKCTL_RL 0x20 /* Retrain Link */ 425#define PCI_EXP_LNKCTL_ASPMC 0x0003 /* ASPM Control */
408#define PCI_EXP_LNKCTL_CCC 0x40 /* Common Clock COnfiguration */ 426#define PCI_EXP_LNKCTL_RCB 0x0008 /* Read Completion Boundary */
427#define PCI_EXP_LNKCTL_LD 0x0010 /* Link Disable */
428#define PCI_EXP_LNKCTL_RL 0x0020 /* Retrain Link */
429#define PCI_EXP_LNKCTL_CCC 0x0040 /* Common Clock Configuration */
430#define PCI_EXP_LNKCTL_ES 0x0080 /* Extended Synch */
409#define PCI_EXP_LNKCTL_CLKREQ_EN 0x100 /* Enable clkreq */ 431#define PCI_EXP_LNKCTL_CLKREQ_EN 0x100 /* Enable clkreq */
432#define PCI_EXP_LNKCTL_HAWD 0x0200 /* Hardware Autonomous Width Disable */
433#define PCI_EXP_LNKCTL_LBMIE 0x0400 /* Link Bandwidth Management Interrupt Enable */
434#define PCI_EXP_LNKCTL_LABIE 0x0800 /* Lnk Autonomous Bandwidth Interrupt Enable */
410#define PCI_EXP_LNKSTA 18 /* Link Status */ 435#define PCI_EXP_LNKSTA 18 /* Link Status */
411#define PCI_EXP_LNKSTA_LT 0x800 /* Link Training */ 436#define PCI_EXP_LNKSTA_CLS 0x000f /* Current Link Speed */
437#define PCI_EXP_LNKSTA_NLW 0x03f0 /* Nogotiated Link Width */
438#define PCI_EXP_LNKSTA_LT 0x0800 /* Link Training */
412#define PCI_EXP_LNKSTA_SLC 0x1000 /* Slot Clock Configuration */ 439#define PCI_EXP_LNKSTA_SLC 0x1000 /* Slot Clock Configuration */
440#define PCI_EXP_LNKSTA_DLLLA 0x2000 /* Data Link Layer Link Active */
441#define PCI_EXP_LNKSTA_LBMS 0x4000 /* Link Bandwidth Management Status */
442#define PCI_EXP_LNKSTA_LABS 0x8000 /* Link Autonomous Bandwidth Status */
413#define PCI_EXP_SLTCAP 20 /* Slot Capabilities */ 443#define PCI_EXP_SLTCAP 20 /* Slot Capabilities */
444#define PCI_EXP_SLTCAP_ABP 0x00000001 /* Attention Button Present */
445#define PCI_EXP_SLTCAP_PCP 0x00000002 /* Power Controller Present */
446#define PCI_EXP_SLTCAP_MRLSP 0x00000004 /* MRL Sensor Present */
447#define PCI_EXP_SLTCAP_AIP 0x00000008 /* Attention Indicator Present */
448#define PCI_EXP_SLTCAP_PIP 0x00000010 /* Power Indicator Present */
449#define PCI_EXP_SLTCAP_HPS 0x00000020 /* Hot-Plug Surprise */
450#define PCI_EXP_SLTCAP_HPC 0x00000040 /* Hot-Plug Capable */
451#define PCI_EXP_SLTCAP_SPLV 0x00007f80 /* Slot Power Limit Value */
452#define PCI_EXP_SLTCAP_SPLS 0x00018000 /* Slot Power Limit Scale */
453#define PCI_EXP_SLTCAP_EIP 0x00020000 /* Electromechanical Interlock Present */
454#define PCI_EXP_SLTCAP_NCCS 0x00040000 /* No Command Completed Support */
455#define PCI_EXP_SLTCAP_PSN 0xfff80000 /* Physical Slot Number */
414#define PCI_EXP_SLTCTL 24 /* Slot Control */ 456#define PCI_EXP_SLTCTL 24 /* Slot Control */
457#define PCI_EXP_SLTCTL_ABPE 0x0001 /* Attention Button Pressed Enable */
458#define PCI_EXP_SLTCTL_PFDE 0x0002 /* Power Fault Detected Enable */
459#define PCI_EXP_SLTCTL_MRLSCE 0x0004 /* MRL Sensor Changed Enable */
460#define PCI_EXP_SLTCTL_PDCE 0x0008 /* Presence Detect Changed Enable */
461#define PCI_EXP_SLTCTL_CCIE 0x0010 /* Command Completed Interrupt Enable */
462#define PCI_EXP_SLTCTL_HPIE 0x0020 /* Hot-Plug Interrupt Enable */
463#define PCI_EXP_SLTCTL_AIC 0x00c0 /* Attention Indicator Control */
464#define PCI_EXP_SLTCTL_PIC 0x0300 /* Power Indicator Control */
465#define PCI_EXP_SLTCTL_PCC 0x0400 /* Power Controller Control */
466#define PCI_EXP_SLTCTL_EIC 0x0800 /* Electromechanical Interlock Control */
467#define PCI_EXP_SLTCTL_DLLSCE 0x1000 /* Data Link Layer State Changed Enable */
415#define PCI_EXP_SLTSTA 26 /* Slot Status */ 468#define PCI_EXP_SLTSTA 26 /* Slot Status */
469#define PCI_EXP_SLTSTA_ABP 0x0001 /* Attention Button Pressed */
470#define PCI_EXP_SLTSTA_PFD 0x0002 /* Power Fault Detected */
471#define PCI_EXP_SLTSTA_MRLSC 0x0004 /* MRL Sensor Changed */
472#define PCI_EXP_SLTSTA_PDC 0x0008 /* Presence Detect Changed */
473#define PCI_EXP_SLTSTA_CC 0x0010 /* Command Completed */
474#define PCI_EXP_SLTSTA_MRLSS 0x0020 /* MRL Sensor State */
475#define PCI_EXP_SLTSTA_PDS 0x0040 /* Presence Detect State */
476#define PCI_EXP_SLTSTA_EIS 0x0080 /* Electromechanical Interlock Status */
477#define PCI_EXP_SLTSTA_DLLSC 0x0100 /* Data Link Layer State Changed */
416#define PCI_EXP_RTCTL 28 /* Root Control */ 478#define PCI_EXP_RTCTL 28 /* Root Control */
417#define PCI_EXP_RTCTL_SECEE 0x01 /* System Error on Correctable Error */ 479#define PCI_EXP_RTCTL_SECEE 0x01 /* System Error on Correctable Error */
418#define PCI_EXP_RTCTL_SENFEE 0x02 /* System Error on Non-Fatal Error */ 480#define PCI_EXP_RTCTL_SENFEE 0x02 /* System Error on Non-Fatal Error */
diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h
index 9007ccdfc112..a7684a513994 100644
--- a/include/linux/percpu_counter.h
+++ b/include/linux/percpu_counter.h
@@ -24,14 +24,18 @@ struct percpu_counter {
24 s32 *counters; 24 s32 *counters;
25}; 25};
26 26
27#if NR_CPUS >= 16 27extern int percpu_counter_batch;
28#define FBC_BATCH (NR_CPUS*2) 28
29#else 29int __percpu_counter_init(struct percpu_counter *fbc, s64 amount,
30#define FBC_BATCH (NR_CPUS*4) 30 struct lock_class_key *key);
31#endif 31
32#define percpu_counter_init(fbc, value) \
33 ({ \
34 static struct lock_class_key __key; \
35 \
36 __percpu_counter_init(fbc, value, &__key); \
37 })
32 38
33int percpu_counter_init(struct percpu_counter *fbc, s64 amount);
34int percpu_counter_init_irq(struct percpu_counter *fbc, s64 amount);
35void percpu_counter_destroy(struct percpu_counter *fbc); 39void percpu_counter_destroy(struct percpu_counter *fbc);
36void percpu_counter_set(struct percpu_counter *fbc, s64 amount); 40void percpu_counter_set(struct percpu_counter *fbc, s64 amount);
37void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch); 41void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch);
@@ -39,7 +43,7 @@ s64 __percpu_counter_sum(struct percpu_counter *fbc);
39 43
40static inline void percpu_counter_add(struct percpu_counter *fbc, s64 amount) 44static inline void percpu_counter_add(struct percpu_counter *fbc, s64 amount)
41{ 45{
42 __percpu_counter_add(fbc, amount, FBC_BATCH); 46 __percpu_counter_add(fbc, amount, percpu_counter_batch);
43} 47}
44 48
45static inline s64 percpu_counter_sum_positive(struct percpu_counter *fbc) 49static inline s64 percpu_counter_sum_positive(struct percpu_counter *fbc)
@@ -85,8 +89,6 @@ static inline int percpu_counter_init(struct percpu_counter *fbc, s64 amount)
85 return 0; 89 return 0;
86} 90}
87 91
88#define percpu_counter_init_irq percpu_counter_init
89
90static inline void percpu_counter_destroy(struct percpu_counter *fbc) 92static inline void percpu_counter_destroy(struct percpu_counter *fbc)
91{ 93{
92} 94}
diff --git a/include/linux/pid.h b/include/linux/pid.h
index bb206c56d1f0..49f1c2f66e95 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -123,6 +123,24 @@ extern struct pid *alloc_pid(struct pid_namespace *ns);
123extern void free_pid(struct pid *pid); 123extern void free_pid(struct pid *pid);
124 124
125/* 125/*
126 * ns_of_pid() returns the pid namespace in which the specified pid was
127 * allocated.
128 *
129 * NOTE:
130 * ns_of_pid() is expected to be called for a process (task) that has
131 * an attached 'struct pid' (see attach_pid(), detach_pid()) i.e @pid
132 * is expected to be non-NULL. If @pid is NULL, caller should handle
133 * the resulting NULL pid-ns.
134 */
135static inline struct pid_namespace *ns_of_pid(struct pid *pid)
136{
137 struct pid_namespace *ns = NULL;
138 if (pid)
139 ns = pid->numbers[pid->level].ns;
140 return ns;
141}
142
143/*
126 * the helpers to get the pid's id seen from different namespaces 144 * the helpers to get the pid's id seen from different namespaces
127 * 145 *
128 * pid_nr() : global id, i.e. the id seen from the init namespace; 146 * pid_nr() : global id, i.e. the id seen from the init namespace;
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index d82fe825d62f..38d10326246a 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -79,11 +79,7 @@ static inline void zap_pid_ns_processes(struct pid_namespace *ns)
79} 79}
80#endif /* CONFIG_PID_NS */ 80#endif /* CONFIG_PID_NS */
81 81
82static inline struct pid_namespace *task_active_pid_ns(struct task_struct *tsk) 82extern struct pid_namespace *task_active_pid_ns(struct task_struct *tsk);
83{
84 return tsk->nsproxy->pid_ns;
85}
86
87void pidhash_init(void); 83void pidhash_init(void);
88void pidmap_init(void); 84void pidmap_init(void);
89 85
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 4b8cc6a32479..9a342699c607 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -55,7 +55,6 @@ struct platform_driver {
55 int (*suspend_late)(struct platform_device *, pm_message_t state); 55 int (*suspend_late)(struct platform_device *, pm_message_t state);
56 int (*resume_early)(struct platform_device *); 56 int (*resume_early)(struct platform_device *);
57 int (*resume)(struct platform_device *); 57 int (*resume)(struct platform_device *);
58 struct pm_ext_ops *pm;
59 struct device_driver driver; 58 struct device_driver driver;
60}; 59};
61 60
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 42de4003c4ee..de2e0a8f6728 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -41,7 +41,7 @@ typedef struct pm_message {
41} pm_message_t; 41} pm_message_t;
42 42
43/** 43/**
44 * struct pm_ops - device PM callbacks 44 * struct dev_pm_ops - device PM callbacks
45 * 45 *
46 * Several driver power state transitions are externally visible, affecting 46 * Several driver power state transitions are externally visible, affecting
47 * the state of pending I/O queues and (for drivers that touch hardware) 47 * the state of pending I/O queues and (for drivers that touch hardware)
@@ -126,46 +126,6 @@ typedef struct pm_message {
126 * On most platforms, there are no restrictions on availability of 126 * On most platforms, there are no restrictions on availability of
127 * resources like clocks during @restore(). 127 * resources like clocks during @restore().
128 * 128 *
129 * All of the above callbacks, except for @complete(), return error codes.
130 * However, the error codes returned by the resume operations, @resume(),
131 * @thaw(), and @restore(), do not cause the PM core to abort the resume
132 * transition during which they are returned. The error codes returned in
133 * that cases are only printed by the PM core to the system logs for debugging
134 * purposes. Still, it is recommended that drivers only return error codes
135 * from their resume methods in case of an unrecoverable failure (i.e. when the
136 * device being handled refuses to resume and becomes unusable) to allow us to
137 * modify the PM core in the future, so that it can avoid attempting to handle
138 * devices that failed to resume and their children.
139 *
140 * It is allowed to unregister devices while the above callbacks are being
141 * executed. However, it is not allowed to unregister a device from within any
142 * of its own callbacks.
143 */
144
145struct pm_ops {
146 int (*prepare)(struct device *dev);
147 void (*complete)(struct device *dev);
148 int (*suspend)(struct device *dev);
149 int (*resume)(struct device *dev);
150 int (*freeze)(struct device *dev);
151 int (*thaw)(struct device *dev);
152 int (*poweroff)(struct device *dev);
153 int (*restore)(struct device *dev);
154};
155
156/**
157 * struct pm_ext_ops - extended device PM callbacks
158 *
159 * Some devices require certain operations related to suspend and hibernation
160 * to be carried out with interrupts disabled. Thus, 'struct pm_ext_ops' below
161 * is defined, adding callbacks to be executed with interrupts disabled to
162 * 'struct pm_ops'.
163 *
164 * The following callbacks included in 'struct pm_ext_ops' are executed with
165 * the nonboot CPUs switched off and with interrupts disabled on the only
166 * functional CPU. They also are executed with the PM core list of devices
167 * locked, so they must NOT unregister any devices.
168 *
169 * @suspend_noirq: Complete the operations of ->suspend() by carrying out any 129 * @suspend_noirq: Complete the operations of ->suspend() by carrying out any
170 * actions required for suspending the device that need interrupts to be 130 * actions required for suspending the device that need interrupts to be
171 * disabled 131 * disabled
@@ -190,18 +150,32 @@ struct pm_ops {
190 * actions required for restoring the operations of the device that need 150 * actions required for restoring the operations of the device that need
191 * interrupts to be disabled 151 * interrupts to be disabled
192 * 152 *
193 * All of the above callbacks return error codes, but the error codes returned 153 * All of the above callbacks, except for @complete(), return error codes.
194 * by the resume operations, @resume_noirq(), @thaw_noirq(), and 154 * However, the error codes returned by the resume operations, @resume(),
195 * @restore_noirq(), do not cause the PM core to abort the resume transition 155 * @thaw(), @restore(), @resume_noirq(), @thaw_noirq(), and @restore_noirq() do
196 * during which they are returned. The error codes returned in that cases are 156 * not cause the PM core to abort the resume transition during which they are
197 * only printed by the PM core to the system logs for debugging purposes. 157 * returned. The error codes returned in that cases are only printed by the PM
198 * Still, as stated above, it is recommended that drivers only return error 158 * core to the system logs for debugging purposes. Still, it is recommended
199 * codes from their resume methods if the device being handled fails to resume 159 * that drivers only return error codes from their resume methods in case of an
200 * and is not usable any more. 160 * unrecoverable failure (i.e. when the device being handled refuses to resume
161 * and becomes unusable) to allow us to modify the PM core in the future, so
162 * that it can avoid attempting to handle devices that failed to resume and
163 * their children.
164 *
165 * It is allowed to unregister devices while the above callbacks are being
166 * executed. However, it is not allowed to unregister a device from within any
167 * of its own callbacks.
201 */ 168 */
202 169
203struct pm_ext_ops { 170struct dev_pm_ops {
204 struct pm_ops base; 171 int (*prepare)(struct device *dev);
172 void (*complete)(struct device *dev);
173 int (*suspend)(struct device *dev);
174 int (*resume)(struct device *dev);
175 int (*freeze)(struct device *dev);
176 int (*thaw)(struct device *dev);
177 int (*poweroff)(struct device *dev);
178 int (*restore)(struct device *dev);
205 int (*suspend_noirq)(struct device *dev); 179 int (*suspend_noirq)(struct device *dev);
206 int (*resume_noirq)(struct device *dev); 180 int (*resume_noirq)(struct device *dev);
207 int (*freeze_noirq)(struct device *dev); 181 int (*freeze_noirq)(struct device *dev);
@@ -278,7 +252,7 @@ struct pm_ext_ops {
278#define PM_EVENT_SLEEP (PM_EVENT_SUSPEND | PM_EVENT_HIBERNATE) 252#define PM_EVENT_SLEEP (PM_EVENT_SUSPEND | PM_EVENT_HIBERNATE)
279#define PM_EVENT_USER_SUSPEND (PM_EVENT_USER | PM_EVENT_SUSPEND) 253#define PM_EVENT_USER_SUSPEND (PM_EVENT_USER | PM_EVENT_SUSPEND)
280#define PM_EVENT_USER_RESUME (PM_EVENT_USER | PM_EVENT_RESUME) 254#define PM_EVENT_USER_RESUME (PM_EVENT_USER | PM_EVENT_RESUME)
281#define PM_EVENT_REMOTE_WAKEUP (PM_EVENT_REMOTE | PM_EVENT_RESUME) 255#define PM_EVENT_REMOTE_RESUME (PM_EVENT_REMOTE | PM_EVENT_RESUME)
282#define PM_EVENT_AUTO_SUSPEND (PM_EVENT_AUTO | PM_EVENT_SUSPEND) 256#define PM_EVENT_AUTO_SUSPEND (PM_EVENT_AUTO | PM_EVENT_SUSPEND)
283#define PM_EVENT_AUTO_RESUME (PM_EVENT_AUTO | PM_EVENT_RESUME) 257#define PM_EVENT_AUTO_RESUME (PM_EVENT_AUTO | PM_EVENT_RESUME)
284 258
@@ -291,15 +265,15 @@ struct pm_ext_ops {
291#define PMSG_THAW ((struct pm_message){ .event = PM_EVENT_THAW, }) 265#define PMSG_THAW ((struct pm_message){ .event = PM_EVENT_THAW, })
292#define PMSG_RESTORE ((struct pm_message){ .event = PM_EVENT_RESTORE, }) 266#define PMSG_RESTORE ((struct pm_message){ .event = PM_EVENT_RESTORE, })
293#define PMSG_RECOVER ((struct pm_message){ .event = PM_EVENT_RECOVER, }) 267#define PMSG_RECOVER ((struct pm_message){ .event = PM_EVENT_RECOVER, })
294#define PMSG_USER_SUSPEND ((struct pm_messge) \ 268#define PMSG_USER_SUSPEND ((struct pm_message) \
295 { .event = PM_EVENT_USER_SUSPEND, }) 269 { .event = PM_EVENT_USER_SUSPEND, })
296#define PMSG_USER_RESUME ((struct pm_messge) \ 270#define PMSG_USER_RESUME ((struct pm_message) \
297 { .event = PM_EVENT_USER_RESUME, }) 271 { .event = PM_EVENT_USER_RESUME, })
298#define PMSG_REMOTE_RESUME ((struct pm_messge) \ 272#define PMSG_REMOTE_RESUME ((struct pm_message) \
299 { .event = PM_EVENT_REMOTE_RESUME, }) 273 { .event = PM_EVENT_REMOTE_RESUME, })
300#define PMSG_AUTO_SUSPEND ((struct pm_messge) \ 274#define PMSG_AUTO_SUSPEND ((struct pm_message) \
301 { .event = PM_EVENT_AUTO_SUSPEND, }) 275 { .event = PM_EVENT_AUTO_SUSPEND, })
302#define PMSG_AUTO_RESUME ((struct pm_messge) \ 276#define PMSG_AUTO_RESUME ((struct pm_message) \
303 { .event = PM_EVENT_AUTO_RESUME, }) 277 { .event = PM_EVENT_AUTO_RESUME, })
304 278
305/** 279/**
diff --git a/include/linux/poll.h b/include/linux/poll.h
index badd98ab06f6..8c24ef8d9976 100644
--- a/include/linux/poll.h
+++ b/include/linux/poll.h
@@ -46,9 +46,9 @@ static inline void init_poll_funcptr(poll_table *pt, poll_queue_proc qproc)
46} 46}
47 47
48struct poll_table_entry { 48struct poll_table_entry {
49 struct file * filp; 49 struct file *filp;
50 wait_queue_t wait; 50 wait_queue_t wait;
51 wait_queue_head_t * wait_address; 51 wait_queue_head_t *wait_address;
52}; 52};
53 53
54/* 54/*
@@ -56,7 +56,9 @@ struct poll_table_entry {
56 */ 56 */
57struct poll_wqueues { 57struct poll_wqueues {
58 poll_table pt; 58 poll_table pt;
59 struct poll_table_page * table; 59 struct poll_table_page *table;
60 struct task_struct *polling_task;
61 int triggered;
60 int error; 62 int error;
61 int inline_index; 63 int inline_index;
62 struct poll_table_entry inline_entries[N_INLINE_POLL_ENTRIES]; 64 struct poll_table_entry inline_entries[N_INLINE_POLL_ENTRIES];
@@ -64,6 +66,13 @@ struct poll_wqueues {
64 66
65extern void poll_initwait(struct poll_wqueues *pwq); 67extern void poll_initwait(struct poll_wqueues *pwq);
66extern void poll_freewait(struct poll_wqueues *pwq); 68extern void poll_freewait(struct poll_wqueues *pwq);
69extern int poll_schedule_timeout(struct poll_wqueues *pwq, int state,
70 ktime_t *expires, unsigned long slack);
71
72static inline int poll_schedule(struct poll_wqueues *pwq, int state)
73{
74 return poll_schedule_timeout(pwq, state, NULL, 0);
75}
67 76
68/* 77/*
69 * Scaleable version of the fd_set. 78 * Scaleable version of the fd_set.
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index f9348cba6dc1..8ff25e0e7f7a 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -45,6 +45,7 @@ enum {
45 POWER_SUPPLY_HEALTH_DEAD, 45 POWER_SUPPLY_HEALTH_DEAD,
46 POWER_SUPPLY_HEALTH_OVERVOLTAGE, 46 POWER_SUPPLY_HEALTH_OVERVOLTAGE,
47 POWER_SUPPLY_HEALTH_UNSPEC_FAILURE, 47 POWER_SUPPLY_HEALTH_UNSPEC_FAILURE,
48 POWER_SUPPLY_HEALTH_COLD,
48}; 49};
49 50
50enum { 51enum {
diff --git a/include/linux/qnx4_fs.h b/include/linux/qnx4_fs.h
index 34a196ee7941..787d19ea9f46 100644
--- a/include/linux/qnx4_fs.h
+++ b/include/linux/qnx4_fs.h
@@ -2,14 +2,12 @@
2 * Name : qnx4_fs.h 2 * Name : qnx4_fs.h
3 * Author : Richard Frowijn 3 * Author : Richard Frowijn
4 * Function : qnx4 global filesystem definitions 4 * Function : qnx4 global filesystem definitions
5 * Version : 1.0.2
6 * Last modified : 2000-01-31
7 *
8 * History : 23-03-1998 created 5 * History : 23-03-1998 created
9 */ 6 */
10#ifndef _LINUX_QNX4_FS_H 7#ifndef _LINUX_QNX4_FS_H
11#define _LINUX_QNX4_FS_H 8#define _LINUX_QNX4_FS_H
12 9
10#include <linux/types.h>
13#include <linux/qnxtypes.h> 11#include <linux/qnxtypes.h>
14#include <linux/magic.h> 12#include <linux/magic.h>
15 13
diff --git a/include/linux/qnxtypes.h b/include/linux/qnxtypes.h
index a3eb1137857b..bebbe5cc4fb8 100644
--- a/include/linux/qnxtypes.h
+++ b/include/linux/qnxtypes.h
@@ -2,9 +2,6 @@
2 * Name : qnxtypes.h 2 * Name : qnxtypes.h
3 * Author : Richard Frowijn 3 * Author : Richard Frowijn
4 * Function : standard qnx types 4 * Function : standard qnx types
5 * Version : 1.0.2
6 * Last modified : 2000-01-06
7 *
8 * History : 22-03-1998 created 5 * History : 22-03-1998 created
9 * 6 *
10 */ 7 */
@@ -12,6 +9,8 @@
12#ifndef _QNX4TYPES_H 9#ifndef _QNX4TYPES_H
13#define _QNX4TYPES_H 10#define _QNX4TYPES_H
14 11
12#include <linux/types.h>
13
15typedef __le16 qnx4_nxtnt_t; 14typedef __le16 qnx4_nxtnt_t;
16typedef __u8 qnx4_ftype_t; 15typedef __u8 qnx4_ftype_t;
17 16
diff --git a/include/linux/quota.h b/include/linux/quota.h
index 40401b554484..d72d5d84fde5 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -36,17 +36,7 @@
36#include <linux/errno.h> 36#include <linux/errno.h>
37#include <linux/types.h> 37#include <linux/types.h>
38 38
39#define __DQUOT_VERSION__ "dquot_6.5.1" 39#define __DQUOT_VERSION__ "dquot_6.5.2"
40#define __DQUOT_NUM_VERSION__ 6*10000+5*100+1
41
42/* Size of blocks in which are counted size limits */
43#define QUOTABLOCK_BITS 10
44#define QUOTABLOCK_SIZE (1 << QUOTABLOCK_BITS)
45
46/* Conversion routines from and to quota blocks */
47#define qb2kb(x) ((x) << (QUOTABLOCK_BITS-10))
48#define kb2qb(x) ((x) >> (QUOTABLOCK_BITS-10))
49#define toqb(x) (((x) + QUOTABLOCK_SIZE - 1) >> QUOTABLOCK_BITS)
50 40
51#define MAXQUOTAS 2 41#define MAXQUOTAS 2
52#define USRQUOTA 0 /* element used for user quotas */ 42#define USRQUOTA 0 /* element used for user quotas */
@@ -80,16 +70,34 @@
80#define Q_GETQUOTA 0x800007 /* get user quota structure */ 70#define Q_GETQUOTA 0x800007 /* get user quota structure */
81#define Q_SETQUOTA 0x800008 /* set user quota structure */ 71#define Q_SETQUOTA 0x800008 /* set user quota structure */
82 72
73/* Quota format type IDs */
74#define QFMT_VFS_OLD 1
75#define QFMT_VFS_V0 2
76
77/* Size of block in which space limits are passed through the quota
78 * interface */
79#define QIF_DQBLKSIZE_BITS 10
80#define QIF_DQBLKSIZE (1 << QIF_DQBLKSIZE_BITS)
81
83/* 82/*
84 * Quota structure used for communication with userspace via quotactl 83 * Quota structure used for communication with userspace via quotactl
85 * Following flags are used to specify which fields are valid 84 * Following flags are used to specify which fields are valid
86 */ 85 */
87#define QIF_BLIMITS 1 86enum {
88#define QIF_SPACE 2 87 QIF_BLIMITS_B = 0,
89#define QIF_ILIMITS 4 88 QIF_SPACE_B,
90#define QIF_INODES 8 89 QIF_ILIMITS_B,
91#define QIF_BTIME 16 90 QIF_INODES_B,
92#define QIF_ITIME 32 91 QIF_BTIME_B,
92 QIF_ITIME_B,
93};
94
95#define QIF_BLIMITS (1 << QIF_BLIMITS_B)
96#define QIF_SPACE (1 << QIF_SPACE_B)
97#define QIF_ILIMITS (1 << QIF_ILIMITS_B)
98#define QIF_INODES (1 << QIF_INODES_B)
99#define QIF_BTIME (1 << QIF_BTIME_B)
100#define QIF_ITIME (1 << QIF_ITIME_B)
93#define QIF_LIMITS (QIF_BLIMITS | QIF_ILIMITS) 101#define QIF_LIMITS (QIF_BLIMITS | QIF_ILIMITS)
94#define QIF_USAGE (QIF_SPACE | QIF_INODES) 102#define QIF_USAGE (QIF_SPACE | QIF_INODES)
95#define QIF_TIMES (QIF_BTIME | QIF_ITIME) 103#define QIF_TIMES (QIF_BTIME | QIF_ITIME)
@@ -172,7 +180,7 @@ enum {
172#include <asm/atomic.h> 180#include <asm/atomic.h>
173 181
174typedef __kernel_uid32_t qid_t; /* Type in which we store ids in memory */ 182typedef __kernel_uid32_t qid_t; /* Type in which we store ids in memory */
175typedef __u64 qsize_t; /* Type in which we store sizes */ 183typedef long long qsize_t; /* Type in which we store sizes */
176 184
177extern spinlock_t dq_data_lock; 185extern spinlock_t dq_data_lock;
178 186
@@ -187,12 +195,12 @@ extern spinlock_t dq_data_lock;
187 * Data for one user/group kept in memory 195 * Data for one user/group kept in memory
188 */ 196 */
189struct mem_dqblk { 197struct mem_dqblk {
190 __u32 dqb_bhardlimit; /* absolute limit on disk blks alloc */ 198 qsize_t dqb_bhardlimit; /* absolute limit on disk blks alloc */
191 __u32 dqb_bsoftlimit; /* preferred limit on disk blks */ 199 qsize_t dqb_bsoftlimit; /* preferred limit on disk blks */
192 qsize_t dqb_curspace; /* current used space */ 200 qsize_t dqb_curspace; /* current used space */
193 __u32 dqb_ihardlimit; /* absolute limit on allocated inodes */ 201 qsize_t dqb_ihardlimit; /* absolute limit on allocated inodes */
194 __u32 dqb_isoftlimit; /* preferred inode limit */ 202 qsize_t dqb_isoftlimit; /* preferred inode limit */
195 __u32 dqb_curinodes; /* current # allocated inodes */ 203 qsize_t dqb_curinodes; /* current # allocated inodes */
196 time_t dqb_btime; /* time limit for excessive disk use */ 204 time_t dqb_btime; /* time limit for excessive disk use */
197 time_t dqb_itime; /* time limit for excessive inode use */ 205 time_t dqb_itime; /* time limit for excessive inode use */
198}; 206};
@@ -212,10 +220,7 @@ struct mem_dqinfo {
212 unsigned int dqi_igrace; 220 unsigned int dqi_igrace;
213 qsize_t dqi_maxblimit; 221 qsize_t dqi_maxblimit;
214 qsize_t dqi_maxilimit; 222 qsize_t dqi_maxilimit;
215 union { 223 void *dqi_priv;
216 struct v1_mem_dqinfo v1_i;
217 struct v2_mem_dqinfo v2_i;
218 } u;
219}; 224};
220 225
221struct super_block; 226struct super_block;
@@ -249,6 +254,11 @@ extern struct dqstats dqstats;
249#define DQ_FAKE_B 3 /* no limits only usage */ 254#define DQ_FAKE_B 3 /* no limits only usage */
250#define DQ_READ_B 4 /* dquot was read into memory */ 255#define DQ_READ_B 4 /* dquot was read into memory */
251#define DQ_ACTIVE_B 5 /* dquot is active (dquot_release not called) */ 256#define DQ_ACTIVE_B 5 /* dquot is active (dquot_release not called) */
257#define DQ_LASTSET_B 6 /* Following 6 bits (see QIF_) are reserved\
258 * for the mask of entries set via SETQUOTA\
259 * quotactl. They are set under dq_data_lock\
260 * and the quota format handling dquot can\
261 * clear them when it sees fit. */
252 262
253struct dquot { 263struct dquot {
254 struct hlist_node dq_hash; /* Hash list in memory */ 264 struct hlist_node dq_hash; /* Hash list in memory */
@@ -287,11 +297,13 @@ struct dquot_operations {
287 int (*initialize) (struct inode *, int); 297 int (*initialize) (struct inode *, int);
288 int (*drop) (struct inode *); 298 int (*drop) (struct inode *);
289 int (*alloc_space) (struct inode *, qsize_t, int); 299 int (*alloc_space) (struct inode *, qsize_t, int);
290 int (*alloc_inode) (const struct inode *, unsigned long); 300 int (*alloc_inode) (const struct inode *, qsize_t);
291 int (*free_space) (struct inode *, qsize_t); 301 int (*free_space) (struct inode *, qsize_t);
292 int (*free_inode) (const struct inode *, unsigned long); 302 int (*free_inode) (const struct inode *, qsize_t);
293 int (*transfer) (struct inode *, struct iattr *); 303 int (*transfer) (struct inode *, struct iattr *);
294 int (*write_dquot) (struct dquot *); /* Ordinary dquot write */ 304 int (*write_dquot) (struct dquot *); /* Ordinary dquot write */
305 struct dquot *(*alloc_dquot)(struct super_block *, int); /* Allocate memory for new dquot */
306 void (*destroy_dquot)(struct dquot *); /* Free memory for dquot */
295 int (*acquire_dquot) (struct dquot *); /* Quota is going to be created on disk */ 307 int (*acquire_dquot) (struct dquot *); /* Quota is going to be created on disk */
296 int (*release_dquot) (struct dquot *); /* Quota is going to be deleted from disk */ 308 int (*release_dquot) (struct dquot *); /* Quota is going to be deleted from disk */
297 int (*mark_dirty) (struct dquot *); /* Dquot is marked dirty */ 309 int (*mark_dirty) (struct dquot *); /* Dquot is marked dirty */
@@ -320,12 +332,42 @@ struct quota_format_type {
320 struct quota_format_type *qf_next; 332 struct quota_format_type *qf_next;
321}; 333};
322 334
323#define DQUOT_USR_ENABLED 0x01 /* User diskquotas enabled */ 335/* Quota state flags - they actually come in two flavors - for users and groups */
324#define DQUOT_GRP_ENABLED 0x02 /* Group diskquotas enabled */ 336enum {
325#define DQUOT_USR_SUSPENDED 0x04 /* User diskquotas are off, but 337 _DQUOT_USAGE_ENABLED = 0, /* Track disk usage for users */
338 _DQUOT_LIMITS_ENABLED, /* Enforce quota limits for users */
339 _DQUOT_SUSPENDED, /* User diskquotas are off, but
326 * we have necessary info in 340 * we have necessary info in
327 * memory to turn them on */ 341 * memory to turn them on */
328#define DQUOT_GRP_SUSPENDED 0x08 /* The same for group quotas */ 342 _DQUOT_STATE_FLAGS
343};
344#define DQUOT_USAGE_ENABLED (1 << _DQUOT_USAGE_ENABLED)
345#define DQUOT_LIMITS_ENABLED (1 << _DQUOT_LIMITS_ENABLED)
346#define DQUOT_SUSPENDED (1 << _DQUOT_SUSPENDED)
347#define DQUOT_STATE_FLAGS (DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED | \
348 DQUOT_SUSPENDED)
349/* Other quota flags */
350#define DQUOT_QUOTA_SYS_FILE (1 << 6) /* Quota file is a special
351 * system file and user cannot
352 * touch it. Filesystem is
353 * responsible for setting
354 * S_NOQUOTA, S_NOATIME flags
355 */
356#define DQUOT_NEGATIVE_USAGE (1 << 7) /* Allow negative quota usage */
357
358static inline unsigned int dquot_state_flag(unsigned int flags, int type)
359{
360 if (type == USRQUOTA)
361 return flags;
362 return flags << _DQUOT_STATE_FLAGS;
363}
364
365static inline unsigned int dquot_generic_flag(unsigned int flags, int type)
366{
367 if (type == USRQUOTA)
368 return flags;
369 return flags >> _DQUOT_STATE_FLAGS;
370}
329 371
330struct quota_info { 372struct quota_info {
331 unsigned int flags; /* Flags for diskquotas on this device */ 373 unsigned int flags; /* Flags for diskquotas on this device */
diff --git a/include/linux/quotaio_v1.h b/include/linux/quotaio_v1.h
deleted file mode 100644
index 746654b5de70..000000000000
--- a/include/linux/quotaio_v1.h
+++ /dev/null
@@ -1,33 +0,0 @@
1#ifndef _LINUX_QUOTAIO_V1_H
2#define _LINUX_QUOTAIO_V1_H
3
4#include <linux/types.h>
5
6/*
7 * The following constants define the amount of time given a user
8 * before the soft limits are treated as hard limits (usually resulting
9 * in an allocation failure). The timer is started when the user crosses
10 * their soft limit, it is reset when they go below their soft limit.
11 */
12#define MAX_IQ_TIME 604800 /* (7*24*60*60) 1 week */
13#define MAX_DQ_TIME 604800 /* (7*24*60*60) 1 week */
14
15/*
16 * The following structure defines the format of the disk quota file
17 * (as it appears on disk) - the file is an array of these structures
18 * indexed by user or group number.
19 */
20struct v1_disk_dqblk {
21 __u32 dqb_bhardlimit; /* absolute limit on disk blks alloc */
22 __u32 dqb_bsoftlimit; /* preferred limit on disk blks */
23 __u32 dqb_curblocks; /* current block count */
24 __u32 dqb_ihardlimit; /* absolute limit on allocated inodes */
25 __u32 dqb_isoftlimit; /* preferred inode limit */
26 __u32 dqb_curinodes; /* current # allocated inodes */
27 time_t dqb_btime; /* time limit for excessive disk use */
28 time_t dqb_itime; /* time limit for excessive inode use */
29};
30
31#define v1_dqoff(UID) ((loff_t)((UID) * sizeof (struct v1_disk_dqblk)))
32
33#endif /* _LINUX_QUOTAIO_V1_H */
diff --git a/include/linux/quotaio_v2.h b/include/linux/quotaio_v2.h
deleted file mode 100644
index 303d7cbe30d4..000000000000
--- a/include/linux/quotaio_v2.h
+++ /dev/null
@@ -1,79 +0,0 @@
1/*
2 * Definitions of structures for vfsv0 quota format
3 */
4
5#ifndef _LINUX_QUOTAIO_V2_H
6#define _LINUX_QUOTAIO_V2_H
7
8#include <linux/types.h>
9#include <linux/quota.h>
10
11/*
12 * Definitions of magics and versions of current quota files
13 */
14#define V2_INITQMAGICS {\
15 0xd9c01f11, /* USRQUOTA */\
16 0xd9c01927 /* GRPQUOTA */\
17}
18
19#define V2_INITQVERSIONS {\
20 0, /* USRQUOTA */\
21 0 /* GRPQUOTA */\
22}
23
24/*
25 * The following structure defines the format of the disk quota file
26 * (as it appears on disk) - the file is a radix tree whose leaves point
27 * to blocks of these structures.
28 */
29struct v2_disk_dqblk {
30 __le32 dqb_id; /* id this quota applies to */
31 __le32 dqb_ihardlimit; /* absolute limit on allocated inodes */
32 __le32 dqb_isoftlimit; /* preferred inode limit */
33 __le32 dqb_curinodes; /* current # allocated inodes */
34 __le32 dqb_bhardlimit; /* absolute limit on disk space (in QUOTABLOCK_SIZE) */
35 __le32 dqb_bsoftlimit; /* preferred limit on disk space (in QUOTABLOCK_SIZE) */
36 __le64 dqb_curspace; /* current space occupied (in bytes) */
37 __le64 dqb_btime; /* time limit for excessive disk use */
38 __le64 dqb_itime; /* time limit for excessive inode use */
39};
40
41/*
42 * Here are header structures as written on disk and their in-memory copies
43 */
44/* First generic header */
45struct v2_disk_dqheader {
46 __le32 dqh_magic; /* Magic number identifying file */
47 __le32 dqh_version; /* File version */
48};
49
50/* Header with type and version specific information */
51struct v2_disk_dqinfo {
52 __le32 dqi_bgrace; /* Time before block soft limit becomes hard limit */
53 __le32 dqi_igrace; /* Time before inode soft limit becomes hard limit */
54 __le32 dqi_flags; /* Flags for quotafile (DQF_*) */
55 __le32 dqi_blocks; /* Number of blocks in file */
56 __le32 dqi_free_blk; /* Number of first free block in the list */
57 __le32 dqi_free_entry; /* Number of block with at least one free entry */
58};
59
60/*
61 * Structure of header of block with quota structures. It is padded to 16 bytes so
62 * there will be space for exactly 21 quota-entries in a block
63 */
64struct v2_disk_dqdbheader {
65 __le32 dqdh_next_free; /* Number of next block with free entry */
66 __le32 dqdh_prev_free; /* Number of previous block with free entry */
67 __le16 dqdh_entries; /* Number of valid entries in block */
68 __le16 dqdh_pad1;
69 __le32 dqdh_pad2;
70};
71
72#define V2_DQINFOOFF sizeof(struct v2_disk_dqheader) /* Offset of info header in file */
73#define V2_DQBLKSIZE_BITS 10
74#define V2_DQBLKSIZE (1 << V2_DQBLKSIZE_BITS) /* Size of block with quota structures */
75#define V2_DQTREEOFF 1 /* Offset of tree in file in blocks */
76#define V2_DQTREEDEPTH 4 /* Depth of quota tree */
77#define V2_DQSTRINBLK ((V2_DQBLKSIZE - sizeof(struct v2_disk_dqdbheader)) / sizeof(struct v2_disk_dqblk)) /* Number of entries in one blocks */
78
79#endif /* _LINUX_QUOTAIO_V2_H */
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index a558a4c1d35a..21b781a3350f 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -24,12 +24,21 @@ void sync_dquots(struct super_block *sb, int type);
24 24
25int dquot_initialize(struct inode *inode, int type); 25int dquot_initialize(struct inode *inode, int type);
26int dquot_drop(struct inode *inode); 26int dquot_drop(struct inode *inode);
27int dquot_drop_locked(struct inode *inode);
28struct dquot *dqget(struct super_block *sb, unsigned int id, int type);
29void dqput(struct dquot *dquot);
30int dquot_is_cached(struct super_block *sb, unsigned int id, int type);
31int dquot_scan_active(struct super_block *sb,
32 int (*fn)(struct dquot *dquot, unsigned long priv),
33 unsigned long priv);
34struct dquot *dquot_alloc(struct super_block *sb, int type);
35void dquot_destroy(struct dquot *dquot);
27 36
28int dquot_alloc_space(struct inode *inode, qsize_t number, int prealloc); 37int dquot_alloc_space(struct inode *inode, qsize_t number, int prealloc);
29int dquot_alloc_inode(const struct inode *inode, unsigned long number); 38int dquot_alloc_inode(const struct inode *inode, qsize_t number);
30 39
31int dquot_free_space(struct inode *inode, qsize_t number); 40int dquot_free_space(struct inode *inode, qsize_t number);
32int dquot_free_inode(const struct inode *inode, unsigned long number); 41int dquot_free_inode(const struct inode *inode, qsize_t number);
33 42
34int dquot_transfer(struct inode *inode, struct iattr *iattr); 43int dquot_transfer(struct inode *inode, struct iattr *iattr);
35int dquot_commit(struct dquot *dquot); 44int dquot_commit(struct dquot *dquot);
@@ -40,11 +49,14 @@ int dquot_mark_dquot_dirty(struct dquot *dquot);
40 49
41int vfs_quota_on(struct super_block *sb, int type, int format_id, 50int vfs_quota_on(struct super_block *sb, int type, int format_id,
42 char *path, int remount); 51 char *path, int remount);
52int vfs_quota_enable(struct inode *inode, int type, int format_id,
53 unsigned int flags);
43int vfs_quota_on_path(struct super_block *sb, int type, int format_id, 54int vfs_quota_on_path(struct super_block *sb, int type, int format_id,
44 struct path *path); 55 struct path *path);
45int vfs_quota_on_mount(struct super_block *sb, char *qf_name, 56int vfs_quota_on_mount(struct super_block *sb, char *qf_name,
46 int format_id, int type); 57 int format_id, int type);
47int vfs_quota_off(struct super_block *sb, int type, int remount); 58int vfs_quota_off(struct super_block *sb, int type, int remount);
59int vfs_quota_disable(struct super_block *sb, int type, unsigned int flags);
48int vfs_quota_sync(struct super_block *sb, int type); 60int vfs_quota_sync(struct super_block *sb, int type);
49int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); 61int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
50int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); 62int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
@@ -64,24 +76,22 @@ static inline struct mem_dqinfo *sb_dqinfo(struct super_block *sb, int type)
64 * Functions for checking status of quota 76 * Functions for checking status of quota
65 */ 77 */
66 78
67static inline int sb_has_quota_enabled(struct super_block *sb, int type) 79static inline int sb_has_quota_usage_enabled(struct super_block *sb, int type)
68{ 80{
69 if (type == USRQUOTA) 81 return sb_dqopt(sb)->flags &
70 return sb_dqopt(sb)->flags & DQUOT_USR_ENABLED; 82 dquot_state_flag(DQUOT_USAGE_ENABLED, type);
71 return sb_dqopt(sb)->flags & DQUOT_GRP_ENABLED;
72} 83}
73 84
74static inline int sb_any_quota_enabled(struct super_block *sb) 85static inline int sb_has_quota_limits_enabled(struct super_block *sb, int type)
75{ 86{
76 return sb_has_quota_enabled(sb, USRQUOTA) || 87 return sb_dqopt(sb)->flags &
77 sb_has_quota_enabled(sb, GRPQUOTA); 88 dquot_state_flag(DQUOT_LIMITS_ENABLED, type);
78} 89}
79 90
80static inline int sb_has_quota_suspended(struct super_block *sb, int type) 91static inline int sb_has_quota_suspended(struct super_block *sb, int type)
81{ 92{
82 if (type == USRQUOTA) 93 return sb_dqopt(sb)->flags &
83 return sb_dqopt(sb)->flags & DQUOT_USR_SUSPENDED; 94 dquot_state_flag(DQUOT_SUSPENDED, type);
84 return sb_dqopt(sb)->flags & DQUOT_GRP_SUSPENDED;
85} 95}
86 96
87static inline int sb_any_quota_suspended(struct super_block *sb) 97static inline int sb_any_quota_suspended(struct super_block *sb)
@@ -90,6 +100,31 @@ static inline int sb_any_quota_suspended(struct super_block *sb)
90 sb_has_quota_suspended(sb, GRPQUOTA); 100 sb_has_quota_suspended(sb, GRPQUOTA);
91} 101}
92 102
103/* Does kernel know about any quota information for given sb + type? */
104static inline int sb_has_quota_loaded(struct super_block *sb, int type)
105{
106 /* Currently if anything is on, then quota usage is on as well */
107 return sb_has_quota_usage_enabled(sb, type);
108}
109
110static inline int sb_any_quota_loaded(struct super_block *sb)
111{
112 return sb_has_quota_loaded(sb, USRQUOTA) ||
113 sb_has_quota_loaded(sb, GRPQUOTA);
114}
115
116static inline int sb_has_quota_active(struct super_block *sb, int type)
117{
118 return sb_has_quota_loaded(sb, type) &&
119 !sb_has_quota_suspended(sb, type);
120}
121
122static inline int sb_any_quota_active(struct super_block *sb)
123{
124 return sb_has_quota_active(sb, USRQUOTA) ||
125 sb_has_quota_active(sb, GRPQUOTA);
126}
127
93/* 128/*
94 * Operations supported for diskquotas. 129 * Operations supported for diskquotas.
95 */ 130 */
@@ -104,7 +139,7 @@ extern struct quotactl_ops vfs_quotactl_ops;
104static inline void vfs_dq_init(struct inode *inode) 139static inline void vfs_dq_init(struct inode *inode)
105{ 140{
106 BUG_ON(!inode->i_sb); 141 BUG_ON(!inode->i_sb);
107 if (sb_any_quota_enabled(inode->i_sb) && !IS_NOQUOTA(inode)) 142 if (sb_any_quota_active(inode->i_sb) && !IS_NOQUOTA(inode))
108 inode->i_sb->dq_op->initialize(inode, -1); 143 inode->i_sb->dq_op->initialize(inode, -1);
109} 144}
110 145
@@ -112,7 +147,7 @@ static inline void vfs_dq_init(struct inode *inode)
112 * a transaction (deadlocks possible otherwise) */ 147 * a transaction (deadlocks possible otherwise) */
113static inline int vfs_dq_prealloc_space_nodirty(struct inode *inode, qsize_t nr) 148static inline int vfs_dq_prealloc_space_nodirty(struct inode *inode, qsize_t nr)
114{ 149{
115 if (sb_any_quota_enabled(inode->i_sb)) { 150 if (sb_any_quota_active(inode->i_sb)) {
116 /* Used space is updated in alloc_space() */ 151 /* Used space is updated in alloc_space() */
117 if (inode->i_sb->dq_op->alloc_space(inode, nr, 1) == NO_QUOTA) 152 if (inode->i_sb->dq_op->alloc_space(inode, nr, 1) == NO_QUOTA)
118 return 1; 153 return 1;
@@ -132,7 +167,7 @@ static inline int vfs_dq_prealloc_space(struct inode *inode, qsize_t nr)
132 167
133static inline int vfs_dq_alloc_space_nodirty(struct inode *inode, qsize_t nr) 168static inline int vfs_dq_alloc_space_nodirty(struct inode *inode, qsize_t nr)
134{ 169{
135 if (sb_any_quota_enabled(inode->i_sb)) { 170 if (sb_any_quota_active(inode->i_sb)) {
136 /* Used space is updated in alloc_space() */ 171 /* Used space is updated in alloc_space() */
137 if (inode->i_sb->dq_op->alloc_space(inode, nr, 0) == NO_QUOTA) 172 if (inode->i_sb->dq_op->alloc_space(inode, nr, 0) == NO_QUOTA)
138 return 1; 173 return 1;
@@ -152,7 +187,7 @@ static inline int vfs_dq_alloc_space(struct inode *inode, qsize_t nr)
152 187
153static inline int vfs_dq_alloc_inode(struct inode *inode) 188static inline int vfs_dq_alloc_inode(struct inode *inode)
154{ 189{
155 if (sb_any_quota_enabled(inode->i_sb)) { 190 if (sb_any_quota_active(inode->i_sb)) {
156 vfs_dq_init(inode); 191 vfs_dq_init(inode);
157 if (inode->i_sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA) 192 if (inode->i_sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA)
158 return 1; 193 return 1;
@@ -162,7 +197,7 @@ static inline int vfs_dq_alloc_inode(struct inode *inode)
162 197
163static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr) 198static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr)
164{ 199{
165 if (sb_any_quota_enabled(inode->i_sb)) 200 if (sb_any_quota_active(inode->i_sb))
166 inode->i_sb->dq_op->free_space(inode, nr); 201 inode->i_sb->dq_op->free_space(inode, nr);
167 else 202 else
168 inode_sub_bytes(inode, nr); 203 inode_sub_bytes(inode, nr);
@@ -176,7 +211,7 @@ static inline void vfs_dq_free_space(struct inode *inode, qsize_t nr)
176 211
177static inline void vfs_dq_free_inode(struct inode *inode) 212static inline void vfs_dq_free_inode(struct inode *inode)
178{ 213{
179 if (sb_any_quota_enabled(inode->i_sb)) 214 if (sb_any_quota_active(inode->i_sb))
180 inode->i_sb->dq_op->free_inode(inode, 1); 215 inode->i_sb->dq_op->free_inode(inode, 1);
181} 216}
182 217
@@ -197,12 +232,12 @@ static inline int vfs_dq_off(struct super_block *sb, int remount)
197 232
198#else 233#else
199 234
200static inline int sb_has_quota_enabled(struct super_block *sb, int type) 235static inline int sb_has_quota_usage_enabled(struct super_block *sb, int type)
201{ 236{
202 return 0; 237 return 0;
203} 238}
204 239
205static inline int sb_any_quota_enabled(struct super_block *sb) 240static inline int sb_has_quota_limits_enabled(struct super_block *sb, int type)
206{ 241{
207 return 0; 242 return 0;
208} 243}
@@ -217,6 +252,27 @@ static inline int sb_any_quota_suspended(struct super_block *sb)
217 return 0; 252 return 0;
218} 253}
219 254
255/* Does kernel know about any quota information for given sb + type? */
256static inline int sb_has_quota_loaded(struct super_block *sb, int type)
257{
258 return 0;
259}
260
261static inline int sb_any_quota_loaded(struct super_block *sb)
262{
263 return 0;
264}
265
266static inline int sb_has_quota_active(struct super_block *sb, int type)
267{
268 return 0;
269}
270
271static inline int sb_any_quota_active(struct super_block *sb)
272{
273 return 0;
274}
275
220/* 276/*
221 * NO-OP when quota not configured. 277 * NO-OP when quota not configured.
222 */ 278 */
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index a916c6660dfa..355f6e80db0d 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -136,7 +136,7 @@ do { \
136 */ 136 */
137static inline void *radix_tree_deref_slot(void **pslot) 137static inline void *radix_tree_deref_slot(void **pslot)
138{ 138{
139 void *ret = *pslot; 139 void *ret = rcu_dereference(*pslot);
140 if (unlikely(radix_tree_is_indirect_ptr(ret))) 140 if (unlikely(radix_tree_is_indirect_ptr(ret)))
141 ret = RADIX_TREE_RETRY; 141 ret = RADIX_TREE_RETRY;
142 return ret; 142 return ret;
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
index 8fc909ef6787..9743e4dbc918 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -137,6 +137,9 @@ struct mddev_s
137 struct gendisk *gendisk; 137 struct gendisk *gendisk;
138 138
139 struct kobject kobj; 139 struct kobject kobj;
140 int hold_active;
141#define UNTIL_IOCTL 1
142#define UNTIL_STOP 2
140 143
141 /* Superblock information */ 144 /* Superblock information */
142 int major_version, 145 int major_version,
@@ -215,6 +218,9 @@ struct mddev_s
215#define MD_RECOVERY_FROZEN 9 218#define MD_RECOVERY_FROZEN 9
216 219
217 unsigned long recovery; 220 unsigned long recovery;
221 int recovery_disabled; /* if we detect that recovery
222 * will always fail, set this
223 * so we don't loop trying */
218 224
219 int in_sync; /* know to not need resync */ 225 int in_sync; /* know to not need resync */
220 struct mutex reconfig_mutex; 226 struct mutex reconfig_mutex;
@@ -244,6 +250,9 @@ struct mddev_s
244 struct sysfs_dirent *sysfs_state; /* handle for 'array_state' 250 struct sysfs_dirent *sysfs_state; /* handle for 'array_state'
245 * file in sysfs. 251 * file in sysfs.
246 */ 252 */
253 struct sysfs_dirent *sysfs_action; /* handle for 'sync_action' */
254
255 struct work_struct del_work; /* used for delayed sysfs removal */
247 256
248 spinlock_t write_lock; 257 spinlock_t write_lock;
249 wait_queue_head_t sb_wait; /* for waiting on superblock updates */ 258 wait_queue_head_t sb_wait; /* for waiting on superblock updates */
@@ -334,17 +343,14 @@ static inline char * mdname (mddev_t * mddev)
334 * iterates through some rdev ringlist. It's safe to remove the 343 * iterates through some rdev ringlist. It's safe to remove the
335 * current 'rdev'. Dont touch 'tmp' though. 344 * current 'rdev'. Dont touch 'tmp' though.
336 */ 345 */
337#define rdev_for_each_list(rdev, tmp, list) \ 346#define rdev_for_each_list(rdev, tmp, head) \
338 \ 347 list_for_each_entry_safe(rdev, tmp, head, same_set)
339 for ((tmp) = (list).next; \ 348
340 (rdev) = (list_entry((tmp), mdk_rdev_t, same_set)), \
341 (tmp) = (tmp)->next, (tmp)->prev != &(list) \
342 ; )
343/* 349/*
344 * iterates through the 'same array disks' ringlist 350 * iterates through the 'same array disks' ringlist
345 */ 351 */
346#define rdev_for_each(rdev, tmp, mddev) \ 352#define rdev_for_each(rdev, tmp, mddev) \
347 rdev_for_each_list(rdev, tmp, (mddev)->disks) 353 list_for_each_entry_safe(rdev, tmp, &((mddev)->disks), same_set)
348 354
349#define rdev_for_each_rcu(rdev, mddev) \ 355#define rdev_for_each_rcu(rdev, mddev) \
350 list_for_each_entry_rcu(rdev, &((mddev)->disks), same_set) 356 list_for_each_entry_rcu(rdev, &((mddev)->disks), same_set)
diff --git a/include/linux/raid/md_p.h b/include/linux/raid/md_p.h
index 8b4de4a41ff1..9491026afe66 100644
--- a/include/linux/raid/md_p.h
+++ b/include/linux/raid/md_p.h
@@ -194,6 +194,8 @@ static inline __u64 md_event(mdp_super_t *sb) {
194 return (ev<<32)| sb->events_lo; 194 return (ev<<32)| sb->events_lo;
195} 195}
196 196
197#define MD_SUPERBLOCK_1_TIME_SEC_MASK ((1ULL<<40) - 1)
198
197/* 199/*
198 * The version-1 superblock : 200 * The version-1 superblock :
199 * All numeric fields are little-endian. 201 * All numeric fields are little-endian.
diff --git a/include/linux/raid/raid0.h b/include/linux/raid/raid0.h
index 1b2dda035f8e..fd42aa87c391 100644
--- a/include/linux/raid/raid0.h
+++ b/include/linux/raid/raid0.h
@@ -5,9 +5,9 @@
5 5
6struct strip_zone 6struct strip_zone
7{ 7{
8 sector_t zone_offset; /* Zone offset in md_dev */ 8 sector_t zone_start; /* Zone offset in md_dev (in sectors) */
9 sector_t dev_offset; /* Zone offset in real dev */ 9 sector_t dev_start; /* Zone offset in real dev (in sectors) */
10 sector_t size; /* Zone size */ 10 sector_t sectors; /* Zone size in sectors */
11 int nb_dev; /* # of devices attached to the zone */ 11 int nb_dev; /* # of devices attached to the zone */
12 mdk_rdev_t **dev; /* Devices attached to the zone */ 12 mdk_rdev_t **dev; /* Devices attached to the zone */
13}; 13};
@@ -19,8 +19,8 @@ struct raid0_private_data
19 mdk_rdev_t **devlist; /* lists of rdevs, pointed to by strip_zone->dev */ 19 mdk_rdev_t **devlist; /* lists of rdevs, pointed to by strip_zone->dev */
20 int nr_strip_zones; 20 int nr_strip_zones;
21 21
22 sector_t hash_spacing; 22 sector_t spacing;
23 int preshift; /* shift this before divide by hash_spacing */ 23 int sector_shift; /* shift this before divide by spacing */
24}; 24};
25 25
26typedef struct raid0_private_data raid0_conf_t; 26typedef struct raid0_private_data raid0_conf_t;
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 1168fbcea8d4..921340a7b71c 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -204,18 +204,6 @@ struct rcu_synchronize {
204 204
205extern void wakeme_after_rcu(struct rcu_head *head); 205extern void wakeme_after_rcu(struct rcu_head *head);
206 206
207#define synchronize_rcu_xxx(name, func) \
208void name(void) \
209{ \
210 struct rcu_synchronize rcu; \
211 \
212 init_completion(&rcu.completion); \
213 /* Will wake me after RCU finished. */ \
214 func(&rcu.head, wakeme_after_rcu); \
215 /* Wait for it. */ \
216 wait_for_completion(&rcu.completion); \
217}
218
219/** 207/**
220 * synchronize_sched - block until all CPUs have exited any non-preemptive 208 * synchronize_sched - block until all CPUs have exited any non-preemptive
221 * kernel code sequences. 209 * kernel code sequences.
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index afdc4558bb94..801bf77ff4e2 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -104,10 +104,10 @@ struct regulator;
104/** 104/**
105 * struct regulator_bulk_data - Data used for bulk regulator operations. 105 * struct regulator_bulk_data - Data used for bulk regulator operations.
106 * 106 *
107 * @supply The name of the supply. Initialised by the user before 107 * @supply: The name of the supply. Initialised by the user before
108 * using the bulk regulator APIs. 108 * using the bulk regulator APIs.
109 * @consumer The regulator consumer for the supply. This will be managed 109 * @consumer: The regulator consumer for the supply. This will be managed
110 * by the bulk API. 110 * by the bulk API.
111 * 111 *
112 * The regulator APIs provide a series of regulator_bulk_() API calls as 112 * The regulator APIs provide a series of regulator_bulk_() API calls as
113 * a convenience to consumers which require multiple supplies. This 113 * a convenience to consumers which require multiple supplies. This
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index e37d80561985..2dae05705f13 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -24,7 +24,33 @@ struct regulator_init_data;
24/** 24/**
25 * struct regulator_ops - regulator operations. 25 * struct regulator_ops - regulator operations.
26 * 26 *
27 * This struct describes regulator operations. 27 * This struct describes regulator operations which can be implemented by
28 * regulator chip drivers.
29 *
30 * @enable: Enable the regulator.
31 * @disable: Disable the regulator.
32 * @is_enabled: Return 1 if the regulator is enabled, 0 otherwise.
33 *
34 * @set_voltage: Set the voltage for the regulator within the range specified.
35 * The driver should select the voltage closest to min_uV.
36 * @get_voltage: Return the currently configured voltage for the regulator.
37 *
38 * @set_current_limit: Configure a limit for a current-limited regulator.
39 * @get_current_limit: Get the limit for a current-limited regulator.
40 *
41 * @set_mode: Set the operating mode for the regulator.
42 * @get_mode: Get the current operating mode for the regulator.
43 * @get_optimum_mode: Get the most efficient operating mode for the regulator
44 * when running with the specified parameters.
45 *
46 * @set_suspend_voltage: Set the voltage for the regulator when the system
47 * is suspended.
48 * @set_suspend_enable: Mark the regulator as enabled when the system is
49 * suspended.
50 * @set_suspend_disable: Mark the regulator as disabled when the system is
51 * suspended.
52 * @set_suspend_mode: Set the operating mode for the regulator when the
53 * system is suspended.
28 */ 54 */
29struct regulator_ops { 55struct regulator_ops {
30 56
@@ -75,6 +101,15 @@ enum regulator_type {
75/** 101/**
76 * struct regulator_desc - Regulator descriptor 102 * struct regulator_desc - Regulator descriptor
77 * 103 *
104 * Each regulator registered with the core is described with a structure of
105 * this type.
106 *
107 * @name: Identifying name for the regulator.
108 * @id: Numerical identifier for the regulator.
109 * @ops: Regulator operations table.
110 * @irq: Interrupt number for the regulator.
111 * @type: Indicates if the regulator is a voltage or current regulator.
112 * @owner: Module providing the regulator, used for refcounting.
78 */ 113 */
79struct regulator_desc { 114struct regulator_desc {
80 const char *name; 115 const char *name;
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h
index c6d69331a81e..3794773b23d2 100644
--- a/include/linux/regulator/machine.h
+++ b/include/linux/regulator/machine.h
@@ -44,6 +44,10 @@ struct regulator;
44 * struct regulator_state - regulator state during low power syatem states 44 * struct regulator_state - regulator state during low power syatem states
45 * 45 *
46 * This describes a regulators state during a system wide low power state. 46 * This describes a regulators state during a system wide low power state.
47 *
48 * @uV: Operating voltage during suspend.
49 * @mode: Operating mode during suspend.
50 * @enabled: Enabled during suspend.
47 */ 51 */
48struct regulator_state { 52struct regulator_state {
49 int uV; /* suspend voltage */ 53 int uV; /* suspend voltage */
@@ -55,6 +59,30 @@ struct regulator_state {
55 * struct regulation_constraints - regulator operating constraints. 59 * struct regulation_constraints - regulator operating constraints.
56 * 60 *
57 * This struct describes regulator and board/machine specific constraints. 61 * This struct describes regulator and board/machine specific constraints.
62 *
63 * @name: Descriptive name for the constraints, used for display purposes.
64 *
65 * @min_uV: Smallest voltage consumers may set.
66 * @max_uV: Largest voltage consumers may set.
67 *
68 * @min_uA: Smallest consumers consumers may set.
69 * @max_uA: Largest current consumers may set.
70 *
71 * @valid_modes_mask: Mask of modes which may be configured by consumers.
72 * @valid_ops_mask: Operations which may be performed by consumers.
73 *
74 * @always_on: Set if the regulator should never be disabled.
75 * @boot_on: Set if the regulator is enabled when the system is initially
76 * started.
77 * @apply_uV: Apply the voltage constraint when initialising.
78 *
79 * @input_uV: Input voltage for regulator when supplied by another regulator.
80 *
81 * @state_disk: State for regulator when system is suspended in disk mode.
82 * @state_mem: State for regulator when system is suspended in mem mode.
83 * @state_standby: State for regulator when system is suspended in standby
84 * mode.
85 * @initial_state: Suspend state to set by default.
58 */ 86 */
59struct regulation_constraints { 87struct regulation_constraints {
60 88
@@ -93,6 +121,9 @@ struct regulation_constraints {
93 * struct regulator_consumer_supply - supply -> device mapping 121 * struct regulator_consumer_supply - supply -> device mapping
94 * 122 *
95 * This maps a supply name to a device. 123 * This maps a supply name to a device.
124 *
125 * @dev: Device structure for the consumer.
126 * @supply: Name for the supply.
96 */ 127 */
97struct regulator_consumer_supply { 128struct regulator_consumer_supply {
98 struct device *dev; /* consumer */ 129 struct device *dev; /* consumer */
@@ -103,6 +134,16 @@ struct regulator_consumer_supply {
103 * struct regulator_init_data - regulator platform initialisation data. 134 * struct regulator_init_data - regulator platform initialisation data.
104 * 135 *
105 * Initialisation constraints, our supply and consumers supplies. 136 * Initialisation constraints, our supply and consumers supplies.
137 *
138 * @supply_regulator_dev: Parent regulator (if any).
139 *
140 * @constraints: Constraints. These must be specified for the regulator to
141 * be usable.
142 * @num_consumer_supplies: Number of consumer device supplies.
143 * @consumer_supplies: Consumer device supply configuration.
144 *
145 * @regulator_init: Callback invoked when the regulator has been registered.
146 * @driver_data: Data passed to regulator_init.
106 */ 147 */
107struct regulator_init_data { 148struct regulator_init_data {
108 struct device *supply_regulator_dev; /* or NULL for LINE */ 149 struct device *supply_regulator_dev; /* or NULL for LINE */
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
index 271c1c2c9f6f..dede0a2cfc45 100644
--- a/include/linux/res_counter.h
+++ b/include/linux/res_counter.h
@@ -43,6 +43,10 @@ struct res_counter {
43 * the routines below consider this to be IRQ-safe 43 * the routines below consider this to be IRQ-safe
44 */ 44 */
45 spinlock_t lock; 45 spinlock_t lock;
46 /*
47 * Parent counter, used for hierarchial resource accounting
48 */
49 struct res_counter *parent;
46}; 50};
47 51
48/** 52/**
@@ -87,7 +91,7 @@ enum {
87 * helpers for accounting 91 * helpers for accounting
88 */ 92 */
89 93
90void res_counter_init(struct res_counter *counter); 94void res_counter_init(struct res_counter *counter, struct res_counter *parent);
91 95
92/* 96/*
93 * charge - try to consume more resource. 97 * charge - try to consume more resource.
@@ -103,7 +107,7 @@ void res_counter_init(struct res_counter *counter);
103int __must_check res_counter_charge_locked(struct res_counter *counter, 107int __must_check res_counter_charge_locked(struct res_counter *counter,
104 unsigned long val); 108 unsigned long val);
105int __must_check res_counter_charge(struct res_counter *counter, 109int __must_check res_counter_charge(struct res_counter *counter,
106 unsigned long val); 110 unsigned long val, struct res_counter **limit_fail_at);
107 111
108/* 112/*
109 * uncharge - tell that some portion of the resource is released 113 * uncharge - tell that some portion of the resource is released
diff --git a/include/linux/rio_drv.h b/include/linux/rio_drv.h
index 32c0547ffafc..c93a58a40033 100644
--- a/include/linux/rio_drv.h
+++ b/include/linux/rio_drv.h
@@ -391,7 +391,6 @@ static inline int rio_add_inb_buffer(struct rio_mport *mport, int mbox,
391 * rio_get_inb_message - Get A RIO message from an inbound mailbox queue 391 * rio_get_inb_message - Get A RIO message from an inbound mailbox queue
392 * @mport: Master port containing the inbound mailbox 392 * @mport: Master port containing the inbound mailbox
393 * @mbox: The inbound mailbox number 393 * @mbox: The inbound mailbox number
394 * @buffer: Pointer to the message buffer
395 * 394 *
396 * Get a RIO message from an inbound mailbox queue. Returns 0 on success. 395 * Get a RIO message from an inbound mailbox queue. Returns 0 on success.
397 */ 396 */
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index 89f0564b10c8..b35bc0e19cd9 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -63,16 +63,13 @@ void anon_vma_unlink(struct vm_area_struct *);
63void anon_vma_link(struct vm_area_struct *); 63void anon_vma_link(struct vm_area_struct *);
64void __anon_vma_link(struct vm_area_struct *); 64void __anon_vma_link(struct vm_area_struct *);
65 65
66extern struct anon_vma *page_lock_anon_vma(struct page *page);
67extern void page_unlock_anon_vma(struct anon_vma *anon_vma);
68
69/* 66/*
70 * rmap interfaces called when adding or removing pte of page 67 * rmap interfaces called when adding or removing pte of page
71 */ 68 */
72void page_add_anon_rmap(struct page *, struct vm_area_struct *, unsigned long); 69void page_add_anon_rmap(struct page *, struct vm_area_struct *, unsigned long);
73void page_add_new_anon_rmap(struct page *, struct vm_area_struct *, unsigned long); 70void page_add_new_anon_rmap(struct page *, struct vm_area_struct *, unsigned long);
74void page_add_file_rmap(struct page *); 71void page_add_file_rmap(struct page *);
75void page_remove_rmap(struct page *, struct vm_area_struct *); 72void page_remove_rmap(struct page *);
76 73
77#ifdef CONFIG_DEBUG_VM 74#ifdef CONFIG_DEBUG_VM
78void page_dup_rmap(struct page *page, struct vm_area_struct *vma, unsigned long address); 75void page_dup_rmap(struct page *page, struct vm_area_struct *vma, unsigned long address);
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index 91f597ad6acc..4046b75563c1 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -145,6 +145,8 @@ struct rtc_class_ops {
145 int (*irq_set_state)(struct device *, int enabled); 145 int (*irq_set_state)(struct device *, int enabled);
146 int (*irq_set_freq)(struct device *, int freq); 146 int (*irq_set_freq)(struct device *, int freq);
147 int (*read_callback)(struct device *, int data); 147 int (*read_callback)(struct device *, int data);
148 int (*alarm_irq_enable)(struct device *, unsigned int enabled);
149 int (*update_irq_enable)(struct device *, unsigned int enabled);
148}; 150};
149 151
150#define RTC_DEVICE_NAME_SIZE 20 152#define RTC_DEVICE_NAME_SIZE 20
@@ -181,7 +183,7 @@ struct rtc_device
181 struct timer_list uie_timer; 183 struct timer_list uie_timer;
182 /* Those fields are protected by rtc->irq_lock */ 184 /* Those fields are protected by rtc->irq_lock */
183 unsigned int oldsecs; 185 unsigned int oldsecs;
184 unsigned int irq_active:1; 186 unsigned int uie_irq_active:1;
185 unsigned int stop_uie_polling:1; 187 unsigned int stop_uie_polling:1;
186 unsigned int uie_task_active:1; 188 unsigned int uie_task_active:1;
187 unsigned int uie_timer_active:1; 189 unsigned int uie_timer_active:1;
@@ -216,6 +218,10 @@ extern int rtc_irq_set_state(struct rtc_device *rtc,
216 struct rtc_task *task, int enabled); 218 struct rtc_task *task, int enabled);
217extern int rtc_irq_set_freq(struct rtc_device *rtc, 219extern int rtc_irq_set_freq(struct rtc_device *rtc,
218 struct rtc_task *task, int freq); 220 struct rtc_task *task, int freq);
221extern int rtc_update_irq_enable(struct rtc_device *rtc, unsigned int enabled);
222extern int rtc_alarm_irq_enable(struct rtc_device *rtc, unsigned int enabled);
223extern int rtc_dev_update_irq_enable_emul(struct rtc_device *rtc,
224 unsigned int enabled);
219 225
220typedef struct rtc_task { 226typedef struct rtc_task {
221 void (*func)(void *private_data); 227 void (*func)(void *private_data);
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 38a3f4b15394..4cae9b81a1f8 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -386,6 +386,9 @@ extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long);
386 (mm)->hiwater_vm = (mm)->total_vm; \ 386 (mm)->hiwater_vm = (mm)->total_vm; \
387} while (0) 387} while (0)
388 388
389#define get_mm_hiwater_rss(mm) max((mm)->hiwater_rss, get_mm_rss(mm))
390#define get_mm_hiwater_vm(mm) max((mm)->hiwater_vm, (mm)->total_vm)
391
389extern void set_dumpable(struct mm_struct *mm, int value); 392extern void set_dumpable(struct mm_struct *mm, int value);
390extern int get_dumpable(struct mm_struct *mm); 393extern int get_dumpable(struct mm_struct *mm);
391 394
@@ -912,7 +915,6 @@ static inline struct cpumask *sched_domain_span(struct sched_domain *sd)
912 915
913extern void partition_sched_domains(int ndoms_new, struct cpumask *doms_new, 916extern void partition_sched_domains(int ndoms_new, struct cpumask *doms_new,
914 struct sched_domain_attr *dattr_new); 917 struct sched_domain_attr *dattr_new);
915extern int arch_reinit_sched_domains(void);
916 918
917/* Test a flag in parent sched domain */ 919/* Test a flag in parent sched domain */
918static inline int test_sd_parent(struct sched_domain *sd, int flag) 920static inline int test_sd_parent(struct sched_domain *sd, int flag)
@@ -1704,16 +1706,16 @@ extern void wake_up_idle_cpu(int cpu);
1704static inline void wake_up_idle_cpu(int cpu) { } 1706static inline void wake_up_idle_cpu(int cpu) { }
1705#endif 1707#endif
1706 1708
1707#ifdef CONFIG_SCHED_DEBUG
1708extern unsigned int sysctl_sched_latency; 1709extern unsigned int sysctl_sched_latency;
1709extern unsigned int sysctl_sched_min_granularity; 1710extern unsigned int sysctl_sched_min_granularity;
1710extern unsigned int sysctl_sched_wakeup_granularity; 1711extern unsigned int sysctl_sched_wakeup_granularity;
1712extern unsigned int sysctl_sched_shares_ratelimit;
1713extern unsigned int sysctl_sched_shares_thresh;
1714#ifdef CONFIG_SCHED_DEBUG
1711extern unsigned int sysctl_sched_child_runs_first; 1715extern unsigned int sysctl_sched_child_runs_first;
1712extern unsigned int sysctl_sched_features; 1716extern unsigned int sysctl_sched_features;
1713extern unsigned int sysctl_sched_migration_cost; 1717extern unsigned int sysctl_sched_migration_cost;
1714extern unsigned int sysctl_sched_nr_migrate; 1718extern unsigned int sysctl_sched_nr_migrate;
1715extern unsigned int sysctl_sched_shares_ratelimit;
1716extern unsigned int sysctl_sched_shares_thresh;
1717 1719
1718int sched_nr_latency_handler(struct ctl_table *table, int write, 1720int sched_nr_latency_handler(struct ctl_table *table, int write,
1719 struct file *file, void __user *buffer, size_t *length, 1721 struct file *file, void __user *buffer, size_t *length,
diff --git a/include/linux/security.h b/include/linux/security.h
index b92b5e453f64..1f2ab6353c00 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -48,7 +48,8 @@ struct audit_krule;
48 * These functions are in security/capability.c and are used 48 * These functions are in security/capability.c and are used
49 * as the default capabilities functions 49 * as the default capabilities functions
50 */ 50 */
51extern int cap_capable(struct task_struct *tsk, int cap, int audit); 51extern int cap_capable(struct task_struct *tsk, const struct cred *cred,
52 int cap, int audit);
52extern int cap_settime(struct timespec *ts, struct timezone *tz); 53extern int cap_settime(struct timespec *ts, struct timezone *tz);
53extern int cap_ptrace_may_access(struct task_struct *child, unsigned int mode); 54extern int cap_ptrace_may_access(struct task_struct *child, unsigned int mode);
54extern int cap_ptrace_traceme(struct task_struct *parent); 55extern int cap_ptrace_traceme(struct task_struct *parent);
@@ -1251,9 +1252,12 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1251 * @permitted contains the permitted capability set. 1252 * @permitted contains the permitted capability set.
1252 * Return 0 and update @new if permission is granted. 1253 * Return 0 and update @new if permission is granted.
1253 * @capable: 1254 * @capable:
1254 * Check whether the @tsk process has the @cap capability. 1255 * Check whether the @tsk process has the @cap capability in the indicated
1256 * credentials.
1255 * @tsk contains the task_struct for the process. 1257 * @tsk contains the task_struct for the process.
1258 * @cred contains the credentials to use.
1256 * @cap contains the capability <include/linux/capability.h>. 1259 * @cap contains the capability <include/linux/capability.h>.
1260 * @audit: Whether to write an audit message or not
1257 * Return 0 if the capability is granted for @tsk. 1261 * Return 0 if the capability is granted for @tsk.
1258 * @acct: 1262 * @acct:
1259 * Check permission before enabling or disabling process accounting. If 1263 * Check permission before enabling or disabling process accounting. If
@@ -1346,7 +1350,8 @@ struct security_operations {
1346 const kernel_cap_t *effective, 1350 const kernel_cap_t *effective,
1347 const kernel_cap_t *inheritable, 1351 const kernel_cap_t *inheritable,
1348 const kernel_cap_t *permitted); 1352 const kernel_cap_t *permitted);
1349 int (*capable) (struct task_struct *tsk, int cap, int audit); 1353 int (*capable) (struct task_struct *tsk, const struct cred *cred,
1354 int cap, int audit);
1350 int (*acct) (struct file *file); 1355 int (*acct) (struct file *file);
1351 int (*sysctl) (struct ctl_table *table, int op); 1356 int (*sysctl) (struct ctl_table *table, int op);
1352 int (*quotactl) (int cmds, int type, int id, struct super_block *sb); 1357 int (*quotactl) (int cmds, int type, int id, struct super_block *sb);
@@ -1628,8 +1633,9 @@ int security_capset(struct cred *new, const struct cred *old,
1628 const kernel_cap_t *effective, 1633 const kernel_cap_t *effective,
1629 const kernel_cap_t *inheritable, 1634 const kernel_cap_t *inheritable,
1630 const kernel_cap_t *permitted); 1635 const kernel_cap_t *permitted);
1631int security_capable(struct task_struct *tsk, int cap); 1636int security_capable(int cap);
1632int security_capable_noaudit(struct task_struct *tsk, int cap); 1637int security_real_capable(struct task_struct *tsk, int cap);
1638int security_real_capable_noaudit(struct task_struct *tsk, int cap);
1633int security_acct(struct file *file); 1639int security_acct(struct file *file);
1634int security_sysctl(struct ctl_table *table, int op); 1640int security_sysctl(struct ctl_table *table, int op);
1635int security_quotactl(int cmds, int type, int id, struct super_block *sb); 1641int security_quotactl(int cmds, int type, int id, struct super_block *sb);
@@ -1826,14 +1832,31 @@ static inline int security_capset(struct cred *new,
1826 return cap_capset(new, old, effective, inheritable, permitted); 1832 return cap_capset(new, old, effective, inheritable, permitted);
1827} 1833}
1828 1834
1829static inline int security_capable(struct task_struct *tsk, int cap) 1835static inline int security_capable(int cap)
1830{ 1836{
1831 return cap_capable(tsk, cap, SECURITY_CAP_AUDIT); 1837 return cap_capable(current, current_cred(), cap, SECURITY_CAP_AUDIT);
1832} 1838}
1833 1839
1834static inline int security_capable_noaudit(struct task_struct *tsk, int cap) 1840static inline int security_real_capable(struct task_struct *tsk, int cap)
1835{ 1841{
1836 return cap_capable(tsk, cap, SECURITY_CAP_NOAUDIT); 1842 int ret;
1843
1844 rcu_read_lock();
1845 ret = cap_capable(tsk, __task_cred(tsk), cap, SECURITY_CAP_AUDIT);
1846 rcu_read_unlock();
1847 return ret;
1848}
1849
1850static inline
1851int security_real_capable_noaudit(struct task_struct *tsk, int cap)
1852{
1853 int ret;
1854
1855 rcu_read_lock();
1856 ret = cap_capable(tsk, __task_cred(tsk), cap,
1857 SECURITY_CAP_NOAUDIT);
1858 rcu_read_unlock();
1859 return ret;
1837} 1860}
1838 1861
1839static inline int security_acct(struct file *file) 1862static inline int security_acct(struct file *file)
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index b4199841f1fc..90bbbf0b1161 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -161,6 +161,9 @@
161 161
162#define PORT_S3C6400 84 162#define PORT_S3C6400 84
163 163
164/* NWPSERIAL */
165#define PORT_NWPSERIAL 85
166
164#ifdef __KERNEL__ 167#ifdef __KERNEL__
165 168
166#include <linux/compiler.h> 169#include <linux/compiler.h>
diff --git a/include/linux/serio.h b/include/linux/serio.h
index 25641d9e0ea8..1bcb357a01a1 100644
--- a/include/linux/serio.h
+++ b/include/linux/serio.h
@@ -213,5 +213,6 @@ static inline void serio_unpin_driver(struct serio *serio)
213#define SERIO_ZHENHUA 0x36 213#define SERIO_ZHENHUA 0x36
214#define SERIO_INEXIO 0x37 214#define SERIO_INEXIO 0x37
215#define SERIO_TOUCHIT213 0x37 215#define SERIO_TOUCHIT213 0x37
216#define SERIO_W8001 0x39
216 217
217#endif 218#endif
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 4be01bb44377..68bb1c501d0d 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -19,6 +19,8 @@
19#ifndef __LINUX_SPI_H 19#ifndef __LINUX_SPI_H
20#define __LINUX_SPI_H 20#define __LINUX_SPI_H
21 21
22#include <linux/device.h>
23
22/* 24/*
23 * INTERFACES between SPI master-side drivers and SPI infrastructure. 25 * INTERFACES between SPI master-side drivers and SPI infrastructure.
24 * (There's no SPI slave support for Linux yet...) 26 * (There's no SPI slave support for Linux yet...)
@@ -325,9 +327,9 @@ extern struct spi_master *spi_busnum_to_master(u16 busnum);
325 * @tx_dma: DMA address of tx_buf, if @spi_message.is_dma_mapped 327 * @tx_dma: DMA address of tx_buf, if @spi_message.is_dma_mapped
326 * @rx_dma: DMA address of rx_buf, if @spi_message.is_dma_mapped 328 * @rx_dma: DMA address of rx_buf, if @spi_message.is_dma_mapped
327 * @len: size of rx and tx buffers (in bytes) 329 * @len: size of rx and tx buffers (in bytes)
328 * @speed_hz: Select a speed other then the device default for this 330 * @speed_hz: Select a speed other than the device default for this
329 * transfer. If 0 the default (from @spi_device) is used. 331 * transfer. If 0 the default (from @spi_device) is used.
330 * @bits_per_word: select a bits_per_word other then the device default 332 * @bits_per_word: select a bits_per_word other than the device default
331 * for this transfer. If 0 the default (from @spi_device) is used. 333 * for this transfer. If 0 the default (from @spi_device) is used.
332 * @cs_change: affects chipselect after this transfer completes 334 * @cs_change: affects chipselect after this transfer completes
333 * @delay_usecs: microseconds to delay after this transfer before 335 * @delay_usecs: microseconds to delay after this transfer before
diff --git a/include/linux/spi/spi_gpio.h b/include/linux/spi/spi_gpio.h
new file mode 100644
index 000000000000..0f01a0f1f40c
--- /dev/null
+++ b/include/linux/spi/spi_gpio.h
@@ -0,0 +1,60 @@
1#ifndef __LINUX_SPI_GPIO_H
2#define __LINUX_SPI_GPIO_H
3
4/*
5 * For each bitbanged SPI bus, set up a platform_device node with:
6 * - name "spi_gpio"
7 * - id the same as the SPI bus number it implements
8 * - dev.platform data pointing to a struct spi_gpio_platform_data
9 *
10 * Or, see the driver code for information about speedups that are
11 * possible on platforms that support inlined access for GPIOs (no
12 * spi_gpio_platform_data is used).
13 *
14 * Use spi_board_info with these busses in the usual way, being sure
15 * that the controller_data being the GPIO used for each device's
16 * chipselect:
17 *
18 * static struct spi_board_info ... [] = {
19 * ...
20 * // this slave uses GPIO 42 for its chipselect
21 * .controller_data = (void *) 42,
22 * ...
23 * // this one uses GPIO 86 for its chipselect
24 * .controller_data = (void *) 86,
25 * ...
26 * };
27 *
28 * If the bitbanged bus is later switched to a "native" controller,
29 * that platform_device and controller_data should be removed.
30 */
31
32/**
33 * struct spi_gpio_platform_data - parameter for bitbanged SPI master
34 * @sck: number of the GPIO used for clock output
35 * @mosi: number of the GPIO used for Master Output, Slave In (MOSI) data
36 * @miso: number of the GPIO used for Master Input, Slave Output (MISO) data
37 * @num_chipselect: how many slaves to allow
38 *
39 * All GPIO signals used with the SPI bus managed through this driver
40 * (chipselects, MOSI, MISO, SCK) must be configured as GPIOs, instead
41 * of some alternate function.
42 *
43 * It can be convenient to use this driver with pins that have alternate
44 * functions associated with a "native" SPI controller if a driver for that
45 * controller is not available, or is missing important functionality.
46 *
47 * On platforms which can do so, configure MISO with a weak pullup unless
48 * there's an external pullup on that signal. That saves power by avoiding
49 * floating signals. (A weak pulldown would save power too, but many
50 * drivers expect to see all-ones data as the no slave "response".)
51 */
52struct spi_gpio_platform_data {
53 unsigned sck;
54 unsigned mosi;
55 unsigned miso;
56
57 u16 num_chipselect;
58};
59
60#endif /* __LINUX_SPI_GPIO_H */
diff --git a/include/linux/spi/tdo24m.h b/include/linux/spi/tdo24m.h
new file mode 100644
index 000000000000..7572d4e1fe76
--- /dev/null
+++ b/include/linux/spi/tdo24m.h
@@ -0,0 +1,13 @@
1#ifndef __TDO24M_H__
2#define __TDO24M_H__
3
4enum tdo24m_model {
5 TDO24M,
6 TDO35S,
7};
8
9struct tdo24m_platform_data {
10 enum tdo24m_model model;
11};
12
13#endif /* __TDO24M_H__ */
diff --git a/include/linux/stop_machine.h b/include/linux/stop_machine.h
index 74d59a641362..baba3a23a814 100644
--- a/include/linux/stop_machine.h
+++ b/include/linux/stop_machine.h
@@ -35,6 +35,24 @@ int stop_machine(int (*fn)(void *), void *data, const struct cpumask *cpus);
35 * won't come or go while it's being called. Used by hotplug cpu. 35 * won't come or go while it's being called. Used by hotplug cpu.
36 */ 36 */
37int __stop_machine(int (*fn)(void *), void *data, const struct cpumask *cpus); 37int __stop_machine(int (*fn)(void *), void *data, const struct cpumask *cpus);
38
39/**
40 * stop_machine_create: create all stop_machine threads
41 *
42 * Description: This causes all stop_machine threads to be created before
43 * stop_machine actually gets called. This can be used by subsystems that
44 * need a non failing stop_machine infrastructure.
45 */
46int stop_machine_create(void);
47
48/**
49 * stop_machine_destroy: destroy all stop_machine threads
50 *
51 * Description: This causes all stop_machine threads which were created with
52 * stop_machine_create to be destroyed again.
53 */
54void stop_machine_destroy(void);
55
38#else 56#else
39 57
40static inline int stop_machine(int (*fn)(void *), void *data, 58static inline int stop_machine(int (*fn)(void *), void *data,
@@ -46,5 +64,9 @@ static inline int stop_machine(int (*fn)(void *), void *data,
46 local_irq_enable(); 64 local_irq_enable();
47 return ret; 65 return ret;
48} 66}
67
68static inline int stop_machine_create(void) { return 0; }
69static inline void stop_machine_destroy(void) { }
70
49#endif /* CONFIG_SMP */ 71#endif /* CONFIG_SMP */
50#endif /* _LINUX_STOP_MACHINE */ 72#endif /* _LINUX_STOP_MACHINE */
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 3afe7fb403b2..3435d24bfe55 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -58,10 +58,13 @@ struct svc_serv {
58 struct svc_stat * sv_stats; /* RPC statistics */ 58 struct svc_stat * sv_stats; /* RPC statistics */
59 spinlock_t sv_lock; 59 spinlock_t sv_lock;
60 unsigned int sv_nrthreads; /* # of server threads */ 60 unsigned int sv_nrthreads; /* # of server threads */
61 unsigned int sv_maxconn; /* max connections allowed or
62 * '0' causing max to be based
63 * on number of threads. */
64
61 unsigned int sv_max_payload; /* datagram payload size */ 65 unsigned int sv_max_payload; /* datagram payload size */
62 unsigned int sv_max_mesg; /* max_payload + 1 page for overheads */ 66 unsigned int sv_max_mesg; /* max_payload + 1 page for overheads */
63 unsigned int sv_xdrsize; /* XDR buffer size */ 67 unsigned int sv_xdrsize; /* XDR buffer size */
64
65 struct list_head sv_permsocks; /* all permanent sockets */ 68 struct list_head sv_permsocks; /* all permanent sockets */
66 struct list_head sv_tempsocks; /* all temporary sockets */ 69 struct list_head sv_tempsocks; /* all temporary sockets */
67 int sv_tmpcnt; /* count of temporary sockets */ 70 int sv_tmpcnt; /* count of temporary sockets */
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 2ce8207686e2..2b409c44db83 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -232,6 +232,11 @@ extern unsigned long get_safe_page(gfp_t gfp_mask);
232 232
233extern void hibernation_set_ops(struct platform_hibernation_ops *ops); 233extern void hibernation_set_ops(struct platform_hibernation_ops *ops);
234extern int hibernate(void); 234extern int hibernate(void);
235extern int hibernate_nvs_register(unsigned long start, unsigned long size);
236extern int hibernate_nvs_alloc(void);
237extern void hibernate_nvs_free(void);
238extern void hibernate_nvs_save(void);
239extern void hibernate_nvs_restore(void);
235#else /* CONFIG_HIBERNATION */ 240#else /* CONFIG_HIBERNATION */
236static inline int swsusp_page_is_forbidden(struct page *p) { return 0; } 241static inline int swsusp_page_is_forbidden(struct page *p) { return 0; }
237static inline void swsusp_set_page_free(struct page *p) {} 242static inline void swsusp_set_page_free(struct page *p) {}
@@ -239,6 +244,14 @@ static inline void swsusp_unset_page_free(struct page *p) {}
239 244
240static inline void hibernation_set_ops(struct platform_hibernation_ops *ops) {} 245static inline void hibernation_set_ops(struct platform_hibernation_ops *ops) {}
241static inline int hibernate(void) { return -ENOSYS; } 246static inline int hibernate(void) { return -ENOSYS; }
247static inline int hibernate_nvs_register(unsigned long a, unsigned long b)
248{
249 return 0;
250}
251static inline int hibernate_nvs_alloc(void) { return 0; }
252static inline void hibernate_nvs_free(void) {}
253static inline void hibernate_nvs_save(void) {}
254static inline void hibernate_nvs_restore(void) {}
242#endif /* CONFIG_HIBERNATION */ 255#endif /* CONFIG_HIBERNATION */
243 256
244#ifdef CONFIG_PM_SLEEP 257#ifdef CONFIG_PM_SLEEP
diff --git a/include/linux/swab.h b/include/linux/swab.h
index bbed279f3b32..be5284d4a053 100644
--- a/include/linux/swab.h
+++ b/include/linux/swab.h
@@ -9,17 +9,17 @@
9 * casts are necessary for constants, because we never know how for sure 9 * casts are necessary for constants, because we never know how for sure
10 * how U/UL/ULL map to __u16, __u32, __u64. At least not in a portable way. 10 * how U/UL/ULL map to __u16, __u32, __u64. At least not in a portable way.
11 */ 11 */
12#define __const_swab16(x) ((__u16)( \ 12#define ___constant_swab16(x) ((__u16)( \
13 (((__u16)(x) & (__u16)0x00ffU) << 8) | \ 13 (((__u16)(x) & (__u16)0x00ffU) << 8) | \
14 (((__u16)(x) & (__u16)0xff00U) >> 8))) 14 (((__u16)(x) & (__u16)0xff00U) >> 8)))
15 15
16#define __const_swab32(x) ((__u32)( \ 16#define ___constant_swab32(x) ((__u32)( \
17 (((__u32)(x) & (__u32)0x000000ffUL) << 24) | \ 17 (((__u32)(x) & (__u32)0x000000ffUL) << 24) | \
18 (((__u32)(x) & (__u32)0x0000ff00UL) << 8) | \ 18 (((__u32)(x) & (__u32)0x0000ff00UL) << 8) | \
19 (((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | \ 19 (((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | \
20 (((__u32)(x) & (__u32)0xff000000UL) >> 24))) 20 (((__u32)(x) & (__u32)0xff000000UL) >> 24)))
21 21
22#define __const_swab64(x) ((__u64)( \ 22#define ___constant_swab64(x) ((__u64)( \
23 (((__u64)(x) & (__u64)0x00000000000000ffULL) << 56) | \ 23 (((__u64)(x) & (__u64)0x00000000000000ffULL) << 56) | \
24 (((__u64)(x) & (__u64)0x000000000000ff00ULL) << 40) | \ 24 (((__u64)(x) & (__u64)0x000000000000ff00ULL) << 40) | \
25 (((__u64)(x) & (__u64)0x0000000000ff0000ULL) << 24) | \ 25 (((__u64)(x) & (__u64)0x0000000000ff0000ULL) << 24) | \
@@ -29,11 +29,11 @@
29 (((__u64)(x) & (__u64)0x00ff000000000000ULL) >> 40) | \ 29 (((__u64)(x) & (__u64)0x00ff000000000000ULL) >> 40) | \
30 (((__u64)(x) & (__u64)0xff00000000000000ULL) >> 56))) 30 (((__u64)(x) & (__u64)0xff00000000000000ULL) >> 56)))
31 31
32#define __const_swahw32(x) ((__u32)( \ 32#define ___constant_swahw32(x) ((__u32)( \
33 (((__u32)(x) & (__u32)0x0000ffffUL) << 16) | \ 33 (((__u32)(x) & (__u32)0x0000ffffUL) << 16) | \
34 (((__u32)(x) & (__u32)0xffff0000UL) >> 16))) 34 (((__u32)(x) & (__u32)0xffff0000UL) >> 16)))
35 35
36#define __const_swahb32(x) ((__u32)( \ 36#define ___constant_swahb32(x) ((__u32)( \
37 (((__u32)(x) & (__u32)0x00ff00ffUL) << 8) | \ 37 (((__u32)(x) & (__u32)0x00ff00ffUL) << 8) | \
38 (((__u32)(x) & (__u32)0xff00ff00UL) >> 8))) 38 (((__u32)(x) & (__u32)0xff00ff00UL) >> 8)))
39 39
@@ -43,52 +43,52 @@
43 * ___swab16, ___swab32, ___swab64, ___swahw32, ___swahb32 43 * ___swab16, ___swab32, ___swab64, ___swahw32, ___swahb32
44 */ 44 */
45 45
46static inline __attribute_const__ __u16 ___swab16(__u16 val) 46static inline __attribute_const__ __u16 __fswab16(__u16 val)
47{ 47{
48#ifdef __arch_swab16 48#ifdef __arch_swab16
49 return __arch_swab16(val); 49 return __arch_swab16(val);
50#else 50#else
51 return __const_swab16(val); 51 return ___constant_swab16(val);
52#endif 52#endif
53} 53}
54 54
55static inline __attribute_const__ __u32 ___swab32(__u32 val) 55static inline __attribute_const__ __u32 __fswab32(__u32 val)
56{ 56{
57#ifdef __arch_swab32 57#ifdef __arch_swab32
58 return __arch_swab32(val); 58 return __arch_swab32(val);
59#else 59#else
60 return __const_swab32(val); 60 return ___constant_swab32(val);
61#endif 61#endif
62} 62}
63 63
64static inline __attribute_const__ __u64 ___swab64(__u64 val) 64static inline __attribute_const__ __u64 __fswab64(__u64 val)
65{ 65{
66#ifdef __arch_swab64 66#ifdef __arch_swab64
67 return __arch_swab64(val); 67 return __arch_swab64(val);
68#elif defined(__SWAB_64_THRU_32__) 68#elif defined(__SWAB_64_THRU_32__)
69 __u32 h = val >> 32; 69 __u32 h = val >> 32;
70 __u32 l = val & ((1ULL << 32) - 1); 70 __u32 l = val & ((1ULL << 32) - 1);
71 return (((__u64)___swab32(l)) << 32) | ((__u64)(___swab32(h))); 71 return (((__u64)__fswab32(l)) << 32) | ((__u64)(__fswab32(h)));
72#else 72#else
73 return __const_swab64(val); 73 return ___constant_swab64(val);
74#endif 74#endif
75} 75}
76 76
77static inline __attribute_const__ __u32 ___swahw32(__u32 val) 77static inline __attribute_const__ __u32 __fswahw32(__u32 val)
78{ 78{
79#ifdef __arch_swahw32 79#ifdef __arch_swahw32
80 return __arch_swahw32(val); 80 return __arch_swahw32(val);
81#else 81#else
82 return __const_swahw32(val); 82 return ___constant_swahw32(val);
83#endif 83#endif
84} 84}
85 85
86static inline __attribute_const__ __u32 ___swahb32(__u32 val) 86static inline __attribute_const__ __u32 __fswahb32(__u32 val)
87{ 87{
88#ifdef __arch_swahb32 88#ifdef __arch_swahb32
89 return __arch_swahb32(val); 89 return __arch_swahb32(val);
90#else 90#else
91 return __const_swahb32(val); 91 return ___constant_swahb32(val);
92#endif 92#endif
93} 93}
94 94
@@ -98,8 +98,8 @@ static inline __attribute_const__ __u32 ___swahb32(__u32 val)
98 */ 98 */
99#define __swab16(x) \ 99#define __swab16(x) \
100 (__builtin_constant_p((__u16)(x)) ? \ 100 (__builtin_constant_p((__u16)(x)) ? \
101 __const_swab16((x)) : \ 101 ___constant_swab16(x) : \
102 ___swab16((x))) 102 __fswab16(x))
103 103
104/** 104/**
105 * __swab32 - return a byteswapped 32-bit value 105 * __swab32 - return a byteswapped 32-bit value
@@ -107,8 +107,8 @@ static inline __attribute_const__ __u32 ___swahb32(__u32 val)
107 */ 107 */
108#define __swab32(x) \ 108#define __swab32(x) \
109 (__builtin_constant_p((__u32)(x)) ? \ 109 (__builtin_constant_p((__u32)(x)) ? \
110 __const_swab32((x)) : \ 110 ___constant_swab32(x) : \
111 ___swab32((x))) 111 __fswab32(x))
112 112
113/** 113/**
114 * __swab64 - return a byteswapped 64-bit value 114 * __swab64 - return a byteswapped 64-bit value
@@ -116,8 +116,8 @@ static inline __attribute_const__ __u32 ___swahb32(__u32 val)
116 */ 116 */
117#define __swab64(x) \ 117#define __swab64(x) \
118 (__builtin_constant_p((__u64)(x)) ? \ 118 (__builtin_constant_p((__u64)(x)) ? \
119 __const_swab64((x)) : \ 119 ___constant_swab64(x) : \
120 ___swab64((x))) 120 __fswab64(x))
121 121
122/** 122/**
123 * __swahw32 - return a word-swapped 32-bit value 123 * __swahw32 - return a word-swapped 32-bit value
@@ -127,8 +127,8 @@ static inline __attribute_const__ __u32 ___swahb32(__u32 val)
127 */ 127 */
128#define __swahw32(x) \ 128#define __swahw32(x) \
129 (__builtin_constant_p((__u32)(x)) ? \ 129 (__builtin_constant_p((__u32)(x)) ? \
130 __const_swahw32((x)) : \ 130 ___constant_swahw32(x) : \
131 ___swahw32((x))) 131 __fswahw32(x))
132 132
133/** 133/**
134 * __swahb32 - return a high and low byte-swapped 32-bit value 134 * __swahb32 - return a high and low byte-swapped 32-bit value
@@ -138,8 +138,8 @@ static inline __attribute_const__ __u32 ___swahb32(__u32 val)
138 */ 138 */
139#define __swahb32(x) \ 139#define __swahb32(x) \
140 (__builtin_constant_p((__u32)(x)) ? \ 140 (__builtin_constant_p((__u32)(x)) ? \
141 __const_swahb32((x)) : \ 141 ___constant_swahb32(x) : \
142 ___swahb32((x))) 142 __fswahb32(x))
143 143
144/** 144/**
145 * __swab16p - return a byteswapped 16-bit value from a pointer 145 * __swab16p - return a byteswapped 16-bit value from a pointer
diff --git a/include/linux/swap.h b/include/linux/swap.h
index a3af95b2cb6d..d30215578877 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -120,7 +120,9 @@ struct swap_extent {
120enum { 120enum {
121 SWP_USED = (1 << 0), /* is slot in swap_info[] used? */ 121 SWP_USED = (1 << 0), /* is slot in swap_info[] used? */
122 SWP_WRITEOK = (1 << 1), /* ok to write to this swap? */ 122 SWP_WRITEOK = (1 << 1), /* ok to write to this swap? */
123 SWP_ACTIVE = (SWP_USED | SWP_WRITEOK), 123 SWP_DISCARDABLE = (1 << 2), /* blkdev supports discard */
124 SWP_DISCARDING = (1 << 3), /* now discarding a free cluster */
125 SWP_SOLIDSTATE = (1 << 4), /* blkdev seeks are cheap */
124 /* add others here before... */ 126 /* add others here before... */
125 SWP_SCANNING = (1 << 8), /* refcount in scan_swap_map */ 127 SWP_SCANNING = (1 << 8), /* refcount in scan_swap_map */
126}; 128};
@@ -134,22 +136,24 @@ enum {
134 * The in-memory structure used to track swap areas. 136 * The in-memory structure used to track swap areas.
135 */ 137 */
136struct swap_info_struct { 138struct swap_info_struct {
137 unsigned int flags; 139 unsigned long flags;
138 int prio; /* swap priority */ 140 int prio; /* swap priority */
141 int next; /* next entry on swap list */
139 struct file *swap_file; 142 struct file *swap_file;
140 struct block_device *bdev; 143 struct block_device *bdev;
141 struct list_head extent_list; 144 struct list_head extent_list;
142 struct swap_extent *curr_swap_extent; 145 struct swap_extent *curr_swap_extent;
143 unsigned old_block_size; 146 unsigned short *swap_map;
144 unsigned short * swap_map;
145 unsigned int lowest_bit; 147 unsigned int lowest_bit;
146 unsigned int highest_bit; 148 unsigned int highest_bit;
149 unsigned int lowest_alloc; /* while preparing discard cluster */
150 unsigned int highest_alloc; /* while preparing discard cluster */
147 unsigned int cluster_next; 151 unsigned int cluster_next;
148 unsigned int cluster_nr; 152 unsigned int cluster_nr;
149 unsigned int pages; 153 unsigned int pages;
150 unsigned int max; 154 unsigned int max;
151 unsigned int inuse_pages; 155 unsigned int inuse_pages;
152 int next; /* next entry on swap list */ 156 unsigned int old_block_size;
153}; 157};
154 158
155struct swap_list_t { 159struct swap_list_t {
@@ -163,7 +167,6 @@ struct swap_list_t {
163/* linux/mm/page_alloc.c */ 167/* linux/mm/page_alloc.c */
164extern unsigned long totalram_pages; 168extern unsigned long totalram_pages;
165extern unsigned long totalreserve_pages; 169extern unsigned long totalreserve_pages;
166extern long nr_swap_pages;
167extern unsigned int nr_free_buffer_pages(void); 170extern unsigned int nr_free_buffer_pages(void);
168extern unsigned int nr_free_pagecache_pages(void); 171extern unsigned int nr_free_pagecache_pages(void);
169 172
@@ -174,8 +177,6 @@ extern unsigned int nr_free_pagecache_pages(void);
174/* linux/mm/swap.c */ 177/* linux/mm/swap.c */
175extern void __lru_cache_add(struct page *, enum lru_list lru); 178extern void __lru_cache_add(struct page *, enum lru_list lru);
176extern void lru_cache_add_lru(struct page *, enum lru_list lru); 179extern void lru_cache_add_lru(struct page *, enum lru_list lru);
177extern void lru_cache_add_active_or_unevictable(struct page *,
178 struct vm_area_struct *);
179extern void activate_page(struct page *); 180extern void activate_page(struct page *);
180extern void mark_page_accessed(struct page *); 181extern void mark_page_accessed(struct page *);
181extern void lru_add_drain(void); 182extern void lru_add_drain(void);
@@ -213,7 +214,8 @@ static inline void lru_cache_add_active_file(struct page *page)
213extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order, 214extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
214 gfp_t gfp_mask); 215 gfp_t gfp_mask);
215extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem, 216extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem,
216 gfp_t gfp_mask); 217 gfp_t gfp_mask, bool noswap,
218 unsigned int swappiness);
217extern int __isolate_lru_page(struct page *page, int mode, int file); 219extern int __isolate_lru_page(struct page *page, int mode, int file);
218extern unsigned long shrink_all_memory(unsigned long nr_pages); 220extern unsigned long shrink_all_memory(unsigned long nr_pages);
219extern int vm_swappiness; 221extern int vm_swappiness;
@@ -280,7 +282,7 @@ extern void end_swap_bio_read(struct bio *bio, int err);
280extern struct address_space swapper_space; 282extern struct address_space swapper_space;
281#define total_swapcache_pages swapper_space.nrpages 283#define total_swapcache_pages swapper_space.nrpages
282extern void show_swap_cache_info(void); 284extern void show_swap_cache_info(void);
283extern int add_to_swap(struct page *, gfp_t); 285extern int add_to_swap(struct page *);
284extern int add_to_swap_cache(struct page *, swp_entry_t, gfp_t); 286extern int add_to_swap_cache(struct page *, swp_entry_t, gfp_t);
285extern void __delete_from_swap_cache(struct page *); 287extern void __delete_from_swap_cache(struct page *);
286extern void delete_from_swap_cache(struct page *); 288extern void delete_from_swap_cache(struct page *);
@@ -293,6 +295,7 @@ extern struct page *swapin_readahead(swp_entry_t, gfp_t,
293 struct vm_area_struct *vma, unsigned long addr); 295 struct vm_area_struct *vma, unsigned long addr);
294 296
295/* linux/mm/swapfile.c */ 297/* linux/mm/swapfile.c */
298extern long nr_swap_pages;
296extern long total_swap_pages; 299extern long total_swap_pages;
297extern void si_swapinfo(struct sysinfo *); 300extern void si_swapinfo(struct sysinfo *);
298extern swp_entry_t get_swap_page(void); 301extern swp_entry_t get_swap_page(void);
@@ -300,15 +303,14 @@ extern swp_entry_t get_swap_page_of_type(int);
300extern int swap_duplicate(swp_entry_t); 303extern int swap_duplicate(swp_entry_t);
301extern int valid_swaphandles(swp_entry_t, unsigned long *); 304extern int valid_swaphandles(swp_entry_t, unsigned long *);
302extern void swap_free(swp_entry_t); 305extern void swap_free(swp_entry_t);
303extern void free_swap_and_cache(swp_entry_t); 306extern int free_swap_and_cache(swp_entry_t);
304extern int swap_type_of(dev_t, sector_t, struct block_device **); 307extern int swap_type_of(dev_t, sector_t, struct block_device **);
305extern unsigned int count_swap_pages(int, int); 308extern unsigned int count_swap_pages(int, int);
306extern sector_t map_swap_page(struct swap_info_struct *, pgoff_t); 309extern sector_t map_swap_page(struct swap_info_struct *, pgoff_t);
307extern sector_t swapdev_block(int, pgoff_t); 310extern sector_t swapdev_block(int, pgoff_t);
308extern struct swap_info_struct *get_swap_info_struct(unsigned); 311extern struct swap_info_struct *get_swap_info_struct(unsigned);
309extern int can_share_swap_page(struct page *); 312extern int reuse_swap_page(struct page *);
310extern int remove_exclusive_swap_page(struct page *); 313extern int try_to_free_swap(struct page *);
311extern int remove_exclusive_swap_page_ref(struct page *);
312struct backing_dev_info; 314struct backing_dev_info;
313 315
314/* linux/mm/thrash.c */ 316/* linux/mm/thrash.c */
@@ -332,9 +334,26 @@ static inline void disable_swap_token(void)
332 put_swap_token(swap_token_mm); 334 put_swap_token(swap_token_mm);
333} 335}
334 336
337#ifdef CONFIG_CGROUP_MEM_RES_CTLR
338extern void mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent);
339#else
340static inline void
341mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent)
342{
343}
344#endif
345#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
346extern void mem_cgroup_uncharge_swap(swp_entry_t ent);
347#else
348static inline void mem_cgroup_uncharge_swap(swp_entry_t ent)
349{
350}
351#endif
352
335#else /* CONFIG_SWAP */ 353#else /* CONFIG_SWAP */
336 354
337#define total_swap_pages 0 355#define nr_swap_pages 0L
356#define total_swap_pages 0L
338#define total_swapcache_pages 0UL 357#define total_swapcache_pages 0UL
339 358
340#define si_swapinfo(val) \ 359#define si_swapinfo(val) \
@@ -350,14 +369,8 @@ static inline void show_swap_cache_info(void)
350{ 369{
351} 370}
352 371
353static inline void free_swap_and_cache(swp_entry_t swp) 372#define free_swap_and_cache(swp) is_migration_entry(swp)
354{ 373#define swap_duplicate(swp) is_migration_entry(swp)
355}
356
357static inline int swap_duplicate(swp_entry_t swp)
358{
359 return 0;
360}
361 374
362static inline void swap_free(swp_entry_t swp) 375static inline void swap_free(swp_entry_t swp)
363{ 376{
@@ -374,7 +387,10 @@ static inline struct page *lookup_swap_cache(swp_entry_t swp)
374 return NULL; 387 return NULL;
375} 388}
376 389
377#define can_share_swap_page(p) (page_mapcount(p) == 1) 390static inline int add_to_swap(struct page *page)
391{
392 return 0;
393}
378 394
379static inline int add_to_swap_cache(struct page *page, swp_entry_t entry, 395static inline int add_to_swap_cache(struct page *page, swp_entry_t entry,
380 gfp_t gfp_mask) 396 gfp_t gfp_mask)
@@ -390,14 +406,9 @@ static inline void delete_from_swap_cache(struct page *page)
390{ 406{
391} 407}
392 408
393#define swap_token_default_timeout 0 409#define reuse_swap_page(page) (page_mapcount(page) == 1)
394 410
395static inline int remove_exclusive_swap_page(struct page *p) 411static inline int try_to_free_swap(struct page *page)
396{
397 return 0;
398}
399
400static inline int remove_exclusive_swap_page_ref(struct page *page)
401{ 412{
402 return 0; 413 return 0;
403} 414}
@@ -415,6 +426,12 @@ static inline swp_entry_t get_swap_page(void)
415#define has_swap_token(x) 0 426#define has_swap_token(x) 0
416#define disable_swap_token() do { } while(0) 427#define disable_swap_token() do { } while(0)
417 428
429static inline int mem_cgroup_cache_charge_swapin(struct page *page,
430 struct mm_struct *mm, gfp_t mask, bool locked)
431{
432 return 0;
433}
434
418#endif /* CONFIG_SWAP */ 435#endif /* CONFIG_SWAP */
419#endif /* __KERNEL__*/ 436#endif /* __KERNEL__*/
420#endif /* _LINUX_SWAP_H */ 437#endif /* _LINUX_SWAP_H */
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
index 325af1de0351..dedd3c0cfe30 100644
--- a/include/linux/swiotlb.h
+++ b/include/linux/swiotlb.h
@@ -27,7 +27,8 @@ swiotlb_init(void);
27extern void *swiotlb_alloc_boot(size_t bytes, unsigned long nslabs); 27extern void *swiotlb_alloc_boot(size_t bytes, unsigned long nslabs);
28extern void *swiotlb_alloc(unsigned order, unsigned long nslabs); 28extern void *swiotlb_alloc(unsigned order, unsigned long nslabs);
29 29
30extern dma_addr_t swiotlb_phys_to_bus(phys_addr_t address); 30extern dma_addr_t swiotlb_phys_to_bus(struct device *hwdev,
31 phys_addr_t address);
31extern phys_addr_t swiotlb_bus_to_phys(dma_addr_t address); 32extern phys_addr_t swiotlb_bus_to_phys(dma_addr_t address);
32 33
33extern int swiotlb_arch_range_needs_mapping(void *ptr, size_t size); 34extern int swiotlb_arch_range_needs_mapping(void *ptr, size_t size);
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 04fb47bfb920..18d0a243a7b3 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -549,7 +549,7 @@ asmlinkage long sys_inotify_init(void);
549asmlinkage long sys_inotify_init1(int flags); 549asmlinkage long sys_inotify_init1(int flags);
550asmlinkage long sys_inotify_add_watch(int fd, const char __user *path, 550asmlinkage long sys_inotify_add_watch(int fd, const char __user *path,
551 u32 mask); 551 u32 mask);
552asmlinkage long sys_inotify_rm_watch(int fd, u32 wd); 552asmlinkage long sys_inotify_rm_watch(int fd, __s32 wd);
553 553
554asmlinkage long sys_spu_run(int fd, __u32 __user *unpc, 554asmlinkage long sys_spu_run(int fd, __u32 __user *unpc,
555 __u32 __user *ustatus); 555 __u32 __user *ustatus);
diff --git a/include/linux/time.h b/include/linux/time.h
index ce321ac5c8f8..fbbd2a1c92ba 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -105,6 +105,7 @@ extern unsigned long read_persistent_clock(void);
105extern int update_persistent_clock(struct timespec now); 105extern int update_persistent_clock(struct timespec now);
106extern int no_sync_cmos_clock __read_mostly; 106extern int no_sync_cmos_clock __read_mostly;
107void timekeeping_init(void); 107void timekeeping_init(void);
108extern int timekeeping_suspended;
108 109
109unsigned long get_seconds(void); 110unsigned long get_seconds(void);
110struct timespec current_kernel_time(void); 111struct timespec current_kernel_time(void);
diff --git a/include/linux/types.h b/include/linux/types.h
index 121f349cb7ec..712ca53bc348 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -176,10 +176,9 @@ typedef __u16 __bitwise __le16;
176typedef __u16 __bitwise __be16; 176typedef __u16 __bitwise __be16;
177typedef __u32 __bitwise __le32; 177typedef __u32 __bitwise __le32;
178typedef __u32 __bitwise __be32; 178typedef __u32 __bitwise __be32;
179#if defined(__GNUC__)
180typedef __u64 __bitwise __le64; 179typedef __u64 __bitwise __le64;
181typedef __u64 __bitwise __be64; 180typedef __u64 __bitwise __be64;
182#endif 181
183typedef __u16 __bitwise __sum16; 182typedef __u16 __bitwise __sum16;
184typedef __u32 __bitwise __wsum; 183typedef __u32 __bitwise __wsum;
185 184
@@ -195,6 +194,16 @@ typedef u32 phys_addr_t;
195 194
196typedef phys_addr_t resource_size_t; 195typedef phys_addr_t resource_size_t;
197 196
197typedef struct {
198 volatile int counter;
199} atomic_t;
200
201#ifdef CONFIG_64BIT
202typedef struct {
203 volatile long counter;
204} atomic64_t;
205#endif
206
198struct ustat { 207struct ustat {
199 __kernel_daddr_t f_tfree; 208 __kernel_daddr_t f_tfree;
200 __kernel_ino_t f_tinode; 209 __kernel_ino_t f_tinode;
diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h
index cdf338d94b7f..a0bb6bd2e5c1 100644
--- a/include/linux/uio_driver.h
+++ b/include/linux/uio_driver.h
@@ -38,6 +38,24 @@ struct uio_mem {
38 38
39#define MAX_UIO_MAPS 5 39#define MAX_UIO_MAPS 5
40 40
41struct uio_portio;
42
43/**
44 * struct uio_port - description of a UIO port region
45 * @start: start of port region
46 * @size: size of port region
47 * @porttype: type of port (see UIO_PORT_* below)
48 * @portio: for use by the UIO core only.
49 */
50struct uio_port {
51 unsigned long start;
52 unsigned long size;
53 int porttype;
54 struct uio_portio *portio;
55};
56
57#define MAX_UIO_PORT_REGIONS 5
58
41struct uio_device; 59struct uio_device;
42 60
43/** 61/**
@@ -46,6 +64,7 @@ struct uio_device;
46 * @name: device name 64 * @name: device name
47 * @version: device driver version 65 * @version: device driver version
48 * @mem: list of mappable memory regions, size==0 for end of list 66 * @mem: list of mappable memory regions, size==0 for end of list
67 * @port: list of port regions, size==0 for end of list
49 * @irq: interrupt number or UIO_IRQ_CUSTOM 68 * @irq: interrupt number or UIO_IRQ_CUSTOM
50 * @irq_flags: flags for request_irq() 69 * @irq_flags: flags for request_irq()
51 * @priv: optional private data 70 * @priv: optional private data
@@ -57,9 +76,10 @@ struct uio_device;
57 */ 76 */
58struct uio_info { 77struct uio_info {
59 struct uio_device *uio_dev; 78 struct uio_device *uio_dev;
60 char *name; 79 const char *name;
61 char *version; 80 const char *version;
62 struct uio_mem mem[MAX_UIO_MAPS]; 81 struct uio_mem mem[MAX_UIO_MAPS];
82 struct uio_port port[MAX_UIO_PORT_REGIONS];
63 long irq; 83 long irq;
64 unsigned long irq_flags; 84 unsigned long irq_flags;
65 void *priv; 85 void *priv;
@@ -92,4 +112,10 @@ extern void uio_event_notify(struct uio_info *info);
92#define UIO_MEM_LOGICAL 2 112#define UIO_MEM_LOGICAL 2
93#define UIO_MEM_VIRTUAL 3 113#define UIO_MEM_VIRTUAL 3
94 114
115/* defines for uio_port->porttype */
116#define UIO_PORT_NONE 0
117#define UIO_PORT_X86 1
118#define UIO_PORT_GPIO 2
119#define UIO_PORT_OTHER 3
120
95#endif /* _LINUX_UIO_DRIVER_H_ */ 121#endif /* _LINUX_UIO_DRIVER_H_ */
diff --git a/include/linux/unwind.h b/include/linux/unwind.h
deleted file mode 100644
index 7760860fa170..000000000000
--- a/include/linux/unwind.h
+++ /dev/null
@@ -1,68 +0,0 @@
1#ifndef _LINUX_UNWIND_H
2#define _LINUX_UNWIND_H
3
4/*
5 * Copyright (C) 2002-2006 Novell, Inc.
6 * Jan Beulich <jbeulich@novell.com>
7 * This code is released under version 2 of the GNU GPL.
8 *
9 * A simple API for unwinding kernel stacks. This is used for
10 * debugging and error reporting purposes. The kernel doesn't need
11 * full-blown stack unwinding with all the bells and whistles, so there
12 * is not much point in implementing the full Dwarf2 unwind API.
13 */
14
15struct module;
16
17struct unwind_frame_info {};
18
19static inline void unwind_init(void) {}
20static inline void unwind_setup(void) {}
21
22#ifdef CONFIG_MODULES
23
24static inline void *unwind_add_table(struct module *mod,
25 const void *table_start,
26 unsigned long table_size)
27{
28 return NULL;
29}
30
31static inline void unwind_remove_table(void *handle, int init_only)
32{
33}
34
35#endif
36
37static inline int unwind_init_frame_info(struct unwind_frame_info *info,
38 struct task_struct *tsk,
39 const struct pt_regs *regs)
40{
41 return -ENOSYS;
42}
43
44static inline int unwind_init_blocked(struct unwind_frame_info *info,
45 struct task_struct *tsk)
46{
47 return -ENOSYS;
48}
49
50static inline int unwind_init_running(struct unwind_frame_info *info,
51 asmlinkage int (*cb)(struct unwind_frame_info *,
52 void *arg),
53 void *arg)
54{
55 return -ENOSYS;
56}
57
58static inline int unwind(struct unwind_frame_info *info)
59{
60 return -ENOSYS;
61}
62
63static inline int unwind_to_user(struct unwind_frame_info *info)
64{
65 return -ENOSYS;
66}
67
68#endif /* _LINUX_UNWIND_H */
diff --git a/include/linux/usb.h b/include/linux/usb.h
index f72aa51f7bcd..85ee9be9361e 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -108,6 +108,7 @@ enum usb_interface_condition {
108 * (in probe()), bound to a driver, or unbinding (in disconnect()) 108 * (in probe()), bound to a driver, or unbinding (in disconnect())
109 * @is_active: flag set when the interface is bound and not suspended. 109 * @is_active: flag set when the interface is bound and not suspended.
110 * @sysfs_files_created: sysfs attributes exist 110 * @sysfs_files_created: sysfs attributes exist
111 * @ep_devs_created: endpoint child pseudo-devices exist
111 * @unregistering: flag set when the interface is being unregistered 112 * @unregistering: flag set when the interface is being unregistered
112 * @needs_remote_wakeup: flag set when the driver requires remote-wakeup 113 * @needs_remote_wakeup: flag set when the driver requires remote-wakeup
113 * capability during autosuspend. 114 * capability during autosuspend.
@@ -120,6 +121,11 @@ enum usb_interface_condition {
120 * to the sysfs representation for that device. 121 * to the sysfs representation for that device.
121 * @pm_usage_cnt: PM usage counter for this interface; autosuspend is not 122 * @pm_usage_cnt: PM usage counter for this interface; autosuspend is not
122 * allowed unless the counter is 0. 123 * allowed unless the counter is 0.
124 * @reset_ws: Used for scheduling resets from atomic context.
125 * @reset_running: set to 1 if the interface is currently running a
126 * queued reset so that usb_cancel_queued_reset() doesn't try to
127 * remove from the workqueue when running inside the worker
128 * thread. See __usb_queue_reset_device().
123 * 129 *
124 * USB device drivers attach to interfaces on a physical device. Each 130 * USB device drivers attach to interfaces on a physical device. Each
125 * interface encapsulates a single high level function, such as feeding 131 * interface encapsulates a single high level function, such as feeding
@@ -164,14 +170,17 @@ struct usb_interface {
164 enum usb_interface_condition condition; /* state of binding */ 170 enum usb_interface_condition condition; /* state of binding */
165 unsigned is_active:1; /* the interface is not suspended */ 171 unsigned is_active:1; /* the interface is not suspended */
166 unsigned sysfs_files_created:1; /* the sysfs attributes exist */ 172 unsigned sysfs_files_created:1; /* the sysfs attributes exist */
173 unsigned ep_devs_created:1; /* endpoint "devices" exist */
167 unsigned unregistering:1; /* unregistration is in progress */ 174 unsigned unregistering:1; /* unregistration is in progress */
168 unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */ 175 unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */
169 unsigned needs_altsetting0:1; /* switch to altsetting 0 is pending */ 176 unsigned needs_altsetting0:1; /* switch to altsetting 0 is pending */
170 unsigned needs_binding:1; /* needs delayed unbind/rebind */ 177 unsigned needs_binding:1; /* needs delayed unbind/rebind */
178 unsigned reset_running:1;
171 179
172 struct device dev; /* interface specific device info */ 180 struct device dev; /* interface specific device info */
173 struct device *usb_dev; 181 struct device *usb_dev;
174 int pm_usage_cnt; /* usage counter for autosuspend */ 182 int pm_usage_cnt; /* usage counter for autosuspend */
183 struct work_struct reset_ws; /* for resets in atomic context */
175}; 184};
176#define to_usb_interface(d) container_of(d, struct usb_interface, dev) 185#define to_usb_interface(d) container_of(d, struct usb_interface, dev)
177#define interface_to_usbdev(intf) \ 186#define interface_to_usbdev(intf) \
@@ -329,7 +338,7 @@ struct usb_bus {
329#endif 338#endif
330 struct device *dev; /* device for this bus */ 339 struct device *dev; /* device for this bus */
331 340
332#if defined(CONFIG_USB_MON) 341#if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE)
333 struct mon_bus *mon_bus; /* non-null when associated */ 342 struct mon_bus *mon_bus; /* non-null when associated */
334 int monitored; /* non-zero when monitored */ 343 int monitored; /* non-zero when monitored */
335#endif 344#endif
@@ -398,6 +407,7 @@ struct usb_tt;
398 * @urbnum: number of URBs submitted for the whole device 407 * @urbnum: number of URBs submitted for the whole device
399 * @active_duration: total time device is not suspended 408 * @active_duration: total time device is not suspended
400 * @autosuspend: for delayed autosuspends 409 * @autosuspend: for delayed autosuspends
410 * @autoresume: for autoresumes requested while in_interrupt
401 * @pm_mutex: protects PM operations 411 * @pm_mutex: protects PM operations
402 * @last_busy: time of last use 412 * @last_busy: time of last use
403 * @autosuspend_delay: in jiffies 413 * @autosuspend_delay: in jiffies
@@ -476,6 +486,7 @@ struct usb_device {
476 486
477#ifdef CONFIG_PM 487#ifdef CONFIG_PM
478 struct delayed_work autosuspend; 488 struct delayed_work autosuspend;
489 struct work_struct autoresume;
479 struct mutex pm_mutex; 490 struct mutex pm_mutex;
480 491
481 unsigned long last_busy; 492 unsigned long last_busy;
@@ -505,6 +516,7 @@ extern int usb_lock_device_for_reset(struct usb_device *udev,
505 516
506/* USB port reset for device reinitialization */ 517/* USB port reset for device reinitialization */
507extern int usb_reset_device(struct usb_device *dev); 518extern int usb_reset_device(struct usb_device *dev);
519extern void usb_queue_reset_device(struct usb_interface *dev);
508 520
509extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id); 521extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id);
510 522
@@ -513,6 +525,8 @@ extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id);
513extern int usb_autopm_set_interface(struct usb_interface *intf); 525extern int usb_autopm_set_interface(struct usb_interface *intf);
514extern int usb_autopm_get_interface(struct usb_interface *intf); 526extern int usb_autopm_get_interface(struct usb_interface *intf);
515extern void usb_autopm_put_interface(struct usb_interface *intf); 527extern void usb_autopm_put_interface(struct usb_interface *intf);
528extern int usb_autopm_get_interface_async(struct usb_interface *intf);
529extern void usb_autopm_put_interface_async(struct usb_interface *intf);
516 530
517static inline void usb_autopm_enable(struct usb_interface *intf) 531static inline void usb_autopm_enable(struct usb_interface *intf)
518{ 532{
@@ -539,8 +553,13 @@ static inline int usb_autopm_set_interface(struct usb_interface *intf)
539static inline int usb_autopm_get_interface(struct usb_interface *intf) 553static inline int usb_autopm_get_interface(struct usb_interface *intf)
540{ return 0; } 554{ return 0; }
541 555
556static inline int usb_autopm_get_interface_async(struct usb_interface *intf)
557{ return 0; }
558
542static inline void usb_autopm_put_interface(struct usb_interface *intf) 559static inline void usb_autopm_put_interface(struct usb_interface *intf)
543{ } 560{ }
561static inline void usb_autopm_put_interface_async(struct usb_interface *intf)
562{ }
544static inline void usb_autopm_enable(struct usb_interface *intf) 563static inline void usb_autopm_enable(struct usb_interface *intf)
545{ } 564{ }
546static inline void usb_autopm_disable(struct usb_interface *intf) 565static inline void usb_autopm_disable(struct usb_interface *intf)
@@ -1050,7 +1069,7 @@ struct usb_device_driver {
1050 void (*disconnect) (struct usb_device *udev); 1069 void (*disconnect) (struct usb_device *udev);
1051 1070
1052 int (*suspend) (struct usb_device *udev, pm_message_t message); 1071 int (*suspend) (struct usb_device *udev, pm_message_t message);
1053 int (*resume) (struct usb_device *udev); 1072 int (*resume) (struct usb_device *udev, pm_message_t message);
1054 struct usbdrv_wrap drvwrap; 1073 struct usbdrv_wrap drvwrap;
1055 unsigned int supports_autosuspend:1; 1074 unsigned int supports_autosuspend:1;
1056}; 1075};
@@ -1321,7 +1340,7 @@ struct urb {
1321 struct kref kref; /* reference count of the URB */ 1340 struct kref kref; /* reference count of the URB */
1322 void *hcpriv; /* private data for host controller */ 1341 void *hcpriv; /* private data for host controller */
1323 atomic_t use_count; /* concurrent submissions counter */ 1342 atomic_t use_count; /* concurrent submissions counter */
1324 u8 reject; /* submissions will fail */ 1343 atomic_t reject; /* submissions will fail */
1325 int unlinked; /* unlink error code */ 1344 int unlinked; /* unlink error code */
1326 1345
1327 /* public: documented fields in the urb that can be used by drivers */ 1346 /* public: documented fields in the urb that can be used by drivers */
@@ -1466,6 +1485,7 @@ extern void usb_poison_urb(struct urb *urb);
1466extern void usb_unpoison_urb(struct urb *urb); 1485extern void usb_unpoison_urb(struct urb *urb);
1467extern void usb_kill_anchored_urbs(struct usb_anchor *anchor); 1486extern void usb_kill_anchored_urbs(struct usb_anchor *anchor);
1468extern void usb_poison_anchored_urbs(struct usb_anchor *anchor); 1487extern void usb_poison_anchored_urbs(struct usb_anchor *anchor);
1488extern void usb_unpoison_anchored_urbs(struct usb_anchor *anchor);
1469extern void usb_unlink_anchored_urbs(struct usb_anchor *anchor); 1489extern void usb_unlink_anchored_urbs(struct usb_anchor *anchor);
1470extern void usb_anchor_urb(struct urb *urb, struct usb_anchor *anchor); 1490extern void usb_anchor_urb(struct urb *urb, struct usb_anchor *anchor);
1471extern void usb_unanchor_urb(struct urb *urb); 1491extern void usb_unanchor_urb(struct urb *urb);
@@ -1722,10 +1742,6 @@ extern void usb_unregister_notify(struct notifier_block *nb);
1722 1742
1723#define err(format, arg...) printk(KERN_ERR KBUILD_MODNAME ": " \ 1743#define err(format, arg...) printk(KERN_ERR KBUILD_MODNAME ": " \
1724 format "\n" , ## arg) 1744 format "\n" , ## arg)
1725#define info(format, arg...) printk(KERN_INFO KBUILD_MODNAME ": " \
1726 format "\n" , ## arg)
1727#define warn(format, arg...) printk(KERN_WARNING KBUILD_MODNAME ": " \
1728 format "\n" , ## arg)
1729 1745
1730#endif /* __KERNEL__ */ 1746#endif /* __KERNEL__ */
1731 1747
diff --git a/include/linux/usb/association.h b/include/linux/usb/association.h
index 07c5e3cf5898..0a4a18b3c1bb 100644
--- a/include/linux/usb/association.h
+++ b/include/linux/usb/association.h
@@ -28,17 +28,17 @@ struct wusb_am_attr {
28}; 28};
29 29
30/* Different fields defined by the spec */ 30/* Different fields defined by the spec */
31#define WUSB_AR_AssociationTypeId { .id = 0x0000, .len = 2 } 31#define WUSB_AR_AssociationTypeId { .id = cpu_to_le16(0x0000), .len = cpu_to_le16(2) }
32#define WUSB_AR_AssociationSubTypeId { .id = 0x0001, .len = 2 } 32#define WUSB_AR_AssociationSubTypeId { .id = cpu_to_le16(0x0001), .len = cpu_to_le16(2) }
33#define WUSB_AR_Length { .id = 0x0002, .len = 4 } 33#define WUSB_AR_Length { .id = cpu_to_le16(0x0002), .len = cpu_to_le16(4) }
34#define WUSB_AR_AssociationStatus { .id = 0x0004, .len = 4 } 34#define WUSB_AR_AssociationStatus { .id = cpu_to_le16(0x0004), .len = cpu_to_le16(4) }
35#define WUSB_AR_LangID { .id = 0x0008, .len = 2 } 35#define WUSB_AR_LangID { .id = cpu_to_le16(0x0008), .len = cpu_to_le16(2) }
36#define WUSB_AR_DeviceFriendlyName { .id = 0x000b, .len = 64 } /* max */ 36#define WUSB_AR_DeviceFriendlyName { .id = cpu_to_le16(0x000b), .len = cpu_to_le16(64) } /* max */
37#define WUSB_AR_HostFriendlyName { .id = 0x000c, .len = 64 } /* max */ 37#define WUSB_AR_HostFriendlyName { .id = cpu_to_le16(0x000c), .len = cpu_to_le16(64) } /* max */
38#define WUSB_AR_CHID { .id = 0x1000, .len = 16 } 38#define WUSB_AR_CHID { .id = cpu_to_le16(0x1000), .len = cpu_to_le16(16) }
39#define WUSB_AR_CDID { .id = 0x1001, .len = 16 } 39#define WUSB_AR_CDID { .id = cpu_to_le16(0x1001), .len = cpu_to_le16(16) }
40#define WUSB_AR_ConnectionContext { .id = 0x1002, .len = 48 } 40#define WUSB_AR_ConnectionContext { .id = cpu_to_le16(0x1002), .len = cpu_to_le16(48) }
41#define WUSB_AR_BandGroups { .id = 0x1004, .len = 2 } 41#define WUSB_AR_BandGroups { .id = cpu_to_le16(0x1004), .len = cpu_to_le16(2) }
42 42
43/* CBAF Control Requests (AMS1.0[T4-1] */ 43/* CBAF Control Requests (AMS1.0[T4-1] */
44enum { 44enum {
diff --git a/include/linux/usb/gpio_vbus.h b/include/linux/usb/gpio_vbus.h
new file mode 100644
index 000000000000..d9f03ccc2d60
--- /dev/null
+++ b/include/linux/usb/gpio_vbus.h
@@ -0,0 +1,30 @@
1/*
2 * A simple GPIO VBUS sensing driver for B peripheral only devices
3 * with internal transceivers.
4 * Optionally D+ pullup can be controlled by a second GPIO.
5 *
6 * Copyright (c) 2008 Philipp Zabel <philipp.zabel@gmail.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 */
13
14/**
15 * struct gpio_vbus_mach_info - configuration for gpio_vbus
16 * @gpio_vbus: VBUS sensing GPIO
17 * @gpio_pullup: optional D+ or D- pullup GPIO (else negative/invalid)
18 * @gpio_vbus_inverted: true if gpio_vbus is active low
19 * @gpio_pullup_inverted: true if gpio_pullup is active low
20 *
21 * The VBUS sensing GPIO should have a pulldown, which will normally be
22 * part of a resistor ladder turning a 4.0V-5.25V level on VBUS into a
23 * value the GPIO detects as active. Some systems will use comparators.
24 */
25struct gpio_vbus_mach_info {
26 int gpio_vbus;
27 int gpio_pullup;
28 bool gpio_vbus_inverted;
29 bool gpio_pullup_inverted;
30};
diff --git a/include/linux/usb/musb.h b/include/linux/usb/musb.h
index 630962c04ca4..d6aad0ea6033 100644
--- a/include/linux/usb/musb.h
+++ b/include/linux/usb/musb.h
@@ -47,6 +47,11 @@ struct musb_hdrc_config {
47 u8 ram_bits; /* ram address size */ 47 u8 ram_bits; /* ram address size */
48 48
49 struct musb_hdrc_eps_bits *eps_bits; 49 struct musb_hdrc_eps_bits *eps_bits;
50#ifdef CONFIG_BLACKFIN
51 /* A GPIO controlling VRSEL in Blackfin */
52 unsigned int gpio_vrsel;
53#endif
54
50}; 55};
51 56
52struct musb_hdrc_platform_data { 57struct musb_hdrc_platform_data {
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index 1db25d152ad8..94df4fe6c6c0 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -84,6 +84,7 @@ extern int otg_set_transceiver(struct otg_transceiver *);
84 84
85/* for usb host and peripheral controller drivers */ 85/* for usb host and peripheral controller drivers */
86extern struct otg_transceiver *otg_get_transceiver(void); 86extern struct otg_transceiver *otg_get_transceiver(void);
87extern void otg_put_transceiver(struct otg_transceiver *);
87 88
88static inline int 89static inline int
89otg_start_hnp(struct otg_transceiver *otg) 90otg_start_hnp(struct otg_transceiver *otg)
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h
index d9a3bbe38e6b..1eea1ab68dc4 100644
--- a/include/linux/usb_usual.h
+++ b/include/linux/usb_usual.h
@@ -52,8 +52,11 @@
52 US_FLAG(MAX_SECTORS_MIN,0x00002000) \ 52 US_FLAG(MAX_SECTORS_MIN,0x00002000) \
53 /* Sets max_sectors to arch min */ \ 53 /* Sets max_sectors to arch min */ \
54 US_FLAG(BULK_IGNORE_TAG,0x00004000) \ 54 US_FLAG(BULK_IGNORE_TAG,0x00004000) \
55 /* Ignore tag mismatch in bulk operations */ 55 /* Ignore tag mismatch in bulk operations */ \
56 56 US_FLAG(SANE_SENSE, 0x00008000) \
57 /* Sane Sense (> 18 bytes) */ \
58 US_FLAG(CAPACITY_OK, 0x00010000) \
59 /* READ CAPACITY response is correct */
57 60
58#define US_FLAG(name, value) US_FL_##name = value , 61#define US_FLAG(name, value) US_FL_##name = value ,
59enum { US_DO_ALL_FLAGS }; 62enum { US_DO_ALL_FLAGS };
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 307b88577eaa..506e7620a986 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -97,6 +97,10 @@ extern void unmap_kernel_range(unsigned long addr, unsigned long size);
97extern struct vm_struct *alloc_vm_area(size_t size); 97extern struct vm_struct *alloc_vm_area(size_t size);
98extern void free_vm_area(struct vm_struct *area); 98extern void free_vm_area(struct vm_struct *area);
99 99
100/* for /dev/kmem */
101extern long vread(char *buf, char *addr, unsigned long count);
102extern long vwrite(char *buf, char *addr, unsigned long count);
103
100/* 104/*
101 * Internals. Dont't use.. 105 * Internals. Dont't use..
102 */ 106 */
diff --git a/include/linux/wimax.h b/include/linux/wimax.h
new file mode 100644
index 000000000000..c89de7f4e5b9
--- /dev/null
+++ b/include/linux/wimax.h
@@ -0,0 +1,234 @@
1/*
2 * Linux WiMax
3 * API for user space
4 *
5 *
6 * Copyright (C) 2007-2008 Intel Corporation. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
17 * distribution.
18 * * Neither the name of Intel Corporation nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 *
35 * Intel Corporation <linux-wimax@intel.com>
36 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
37 * - Initial implementation
38 *
39 *
40 * This file declares the user/kernel protocol that is spoken over
41 * Generic Netlink, as well as any type declaration that is to be used
42 * by kernel and user space.
43 *
44 * It is intended for user space to clone it verbatim to use it as a
45 * primary reference for definitions.
46 *
47 * Stuff intended for kernel usage as well as full protocol and stack
48 * documentation is rooted in include/net/wimax.h.
49 */
50
51#ifndef __LINUX__WIMAX_H__
52#define __LINUX__WIMAX_H__
53
54#include <linux/types.h>
55
56enum {
57 /**
58 * Version of the interface (unsigned decimal, MMm, max 25.5)
59 * M - Major: change if removing or modifying an existing call.
60 * m - minor: change when adding a new call
61 */
62 WIMAX_GNL_VERSION = 00,
63 /* Generic NetLink attributes */
64 WIMAX_GNL_ATTR_INVALID = 0x00,
65 WIMAX_GNL_ATTR_MAX = 10,
66};
67
68
69/*
70 * Generic NetLink operations
71 *
72 * Most of these map to an API call; _OP_ stands for operation, _RP_
73 * for reply and _RE_ for report (aka: signal).
74 */
75enum {
76 WIMAX_GNL_OP_MSG_FROM_USER, /* User to kernel message */
77 WIMAX_GNL_OP_MSG_TO_USER, /* Kernel to user message */
78 WIMAX_GNL_OP_RFKILL, /* Run wimax_rfkill() */
79 WIMAX_GNL_OP_RESET, /* Run wimax_rfkill() */
80 WIMAX_GNL_RE_STATE_CHANGE, /* Report: status change */
81};
82
83
84/* Message from user / to user */
85enum {
86 WIMAX_GNL_MSG_IFIDX = 1,
87 WIMAX_GNL_MSG_PIPE_NAME,
88 WIMAX_GNL_MSG_DATA,
89};
90
91
92/*
93 * wimax_rfkill()
94 *
95 * The state of the radio (ON/OFF) is mapped to the rfkill subsystem's
96 * switch state (DISABLED/ENABLED).
97 */
98enum wimax_rf_state {
99 WIMAX_RF_OFF = 0, /* Radio is off, rfkill on/enabled */
100 WIMAX_RF_ON = 1, /* Radio is on, rfkill off/disabled */
101 WIMAX_RF_QUERY = 2,
102};
103
104/* Attributes */
105enum {
106 WIMAX_GNL_RFKILL_IFIDX = 1,
107 WIMAX_GNL_RFKILL_STATE,
108};
109
110
111/* Attributes for wimax_reset() */
112enum {
113 WIMAX_GNL_RESET_IFIDX = 1,
114};
115
116
117/*
118 * Attributes for the Report State Change
119 *
120 * For now we just have the old and new states; new attributes might
121 * be added later on.
122 */
123enum {
124 WIMAX_GNL_STCH_IFIDX = 1,
125 WIMAX_GNL_STCH_STATE_OLD,
126 WIMAX_GNL_STCH_STATE_NEW,
127};
128
129
130/**
131 * enum wimax_st - The different states of a WiMAX device
132 * @__WIMAX_ST_NULL: The device structure has been allocated and zeroed,
133 * but still wimax_dev_add() hasn't been called. There is no state.
134 *
135 * @WIMAX_ST_DOWN: The device has been registered with the WiMAX and
136 * networking stacks, but it is not initialized (normally that is
137 * done with 'ifconfig DEV up' [or equivalent], which can upload
138 * firmware and enable communications with the device).
139 * In this state, the device is powered down and using as less
140 * power as possible.
141 * This state is the default after a call to wimax_dev_add(). It
142 * is ok to have drivers move directly to %WIMAX_ST_UNINITIALIZED
143 * or %WIMAX_ST_RADIO_OFF in _probe() after the call to
144 * wimax_dev_add().
145 * It is recommended that the driver leaves this state when
146 * calling 'ifconfig DEV up' and enters it back on 'ifconfig DEV
147 * down'.
148 *
149 * @__WIMAX_ST_QUIESCING: The device is being torn down, so no API
150 * operations are allowed to proceed except the ones needed to
151 * complete the device clean up process.
152 *
153 * @WIMAX_ST_UNINITIALIZED: [optional] Communication with the device
154 * is setup, but the device still requires some configuration
155 * before being operational.
156 * Some WiMAX API calls might work.
157 *
158 * @WIMAX_ST_RADIO_OFF: The device is fully up; radio is off (wether
159 * by hardware or software switches).
160 * It is recommended to always leave the device in this state
161 * after initialization.
162 *
163 * @WIMAX_ST_READY: The device is fully up and radio is on.
164 *
165 * @WIMAX_ST_SCANNING: [optional] The device has been instructed to
166 * scan. In this state, the device cannot be actively connected to
167 * a network.
168 *
169 * @WIMAX_ST_CONNECTING: The device is connecting to a network. This
170 * state exists because in some devices, the connect process can
171 * include a number of negotiations between user space, kernel
172 * space and the device. User space needs to know what the device
173 * is doing. If the connect sequence in a device is atomic and
174 * fast, the device can transition directly to CONNECTED
175 *
176 * @WIMAX_ST_CONNECTED: The device is connected to a network.
177 *
178 * @__WIMAX_ST_INVALID: This is an invalid state used to mark the
179 * maximum numeric value of states.
180 *
181 * Description:
182 *
183 * Transitions from one state to another one are atomic and can only
184 * be caused in kernel space with wimax_state_change(). To read the
185 * state, use wimax_state_get().
186 *
187 * States starting with __ are internal and shall not be used or
188 * referred to by drivers or userspace. They look ugly, but that's the
189 * point -- if any use is made non-internal to the stack, it is easier
190 * to catch on review.
191 *
192 * All API operations [with well defined exceptions] will take the
193 * device mutex before starting and then check the state. If the state
194 * is %__WIMAX_ST_NULL, %WIMAX_ST_DOWN, %WIMAX_ST_UNINITIALIZED or
195 * %__WIMAX_ST_QUIESCING, it will drop the lock and quit with
196 * -%EINVAL, -%ENOMEDIUM, -%ENOTCONN or -%ESHUTDOWN.
197 *
198 * The order of the definitions is important, so we can do numerical
199 * comparisons (eg: < %WIMAX_ST_RADIO_OFF means the device is not ready
200 * to operate).
201 */
202/*
203 * The allowed state transitions are described in the table below
204 * (states in rows can go to states in columns where there is an X):
205 *
206 * UNINI RADIO READY SCAN CONNEC CONNEC
207 * NULL DOWN QUIESCING TIALIZED OFF NING TING TED
208 * NULL - x
209 * DOWN - x x x
210 * QUIESCING x -
211 * UNINITIALIZED x - x
212 * RADIO_OFF x - x
213 * READY x x - x x x
214 * SCANNING x x x - x x
215 * CONNECTING x x x x - x
216 * CONNECTED x x x -
217 *
218 * This table not available in kernel-doc because the formatting messes it up.
219 */
220 enum wimax_st {
221 __WIMAX_ST_NULL = 0,
222 WIMAX_ST_DOWN,
223 __WIMAX_ST_QUIESCING,
224 WIMAX_ST_UNINITIALIZED,
225 WIMAX_ST_RADIO_OFF,
226 WIMAX_ST_READY,
227 WIMAX_ST_SCANNING,
228 WIMAX_ST_CONNECTING,
229 WIMAX_ST_CONNECTED,
230 __WIMAX_ST_INVALID /* Always keep last */
231};
232
233
234#endif /* #ifndef __LINUX__WIMAX_H__ */
diff --git a/include/linux/wimax/Kbuild b/include/linux/wimax/Kbuild
new file mode 100644
index 000000000000..3cb4f269bb09
--- /dev/null
+++ b/include/linux/wimax/Kbuild
@@ -0,0 +1 @@
header-y += i2400m.h
diff --git a/include/linux/wimax/debug.h b/include/linux/wimax/debug.h
new file mode 100644
index 000000000000..ba0c49399a83
--- /dev/null
+++ b/include/linux/wimax/debug.h
@@ -0,0 +1,453 @@
1/*
2 * Linux WiMAX
3 * Collection of tools to manage debug operations.
4 *
5 *
6 * Copyright (C) 2005-2007 Intel Corporation
7 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License version
11 * 2 as published by the Free Software Foundation.
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., 51 Franklin Street, Fifth Floor, Boston, MA
21 * 02110-1301, USA.
22 *
23 *
24 * Don't #include this file directly, read on!
25 *
26 *
27 * EXECUTING DEBUGGING ACTIONS OR NOT
28 *
29 * The main thing this framework provides is decission power to take a
30 * debug action (like printing a message) if the current debug level
31 * allows it.
32 *
33 * The decission power is at two levels: at compile-time (what does
34 * not make it is compiled out) and at run-time. The run-time
35 * selection is done per-submodule (as they are declared by the user
36 * of the framework).
37 *
38 * A call to d_test(L) (L being the target debug level) returns true
39 * if the action should be taken because the current debug levels
40 * allow it (both compile and run time).
41 *
42 * It follows that a call to d_test() that can be determined to be
43 * always false at compile time will get the code depending on it
44 * compiled out by optimization.
45 *
46 *
47 * DEBUG LEVELS
48 *
49 * It is up to the caller to define how much a debugging level is.
50 *
51 * Convention sets 0 as "no debug" (so an action marked as debug level 0
52 * will always be taken). The increasing debug levels are used for
53 * increased verbosity.
54 *
55 *
56 * USAGE
57 *
58 * Group the code in modules and submodules inside each module [which
59 * in most cases maps to Linux modules and .c files that compose
60 * those].
61 *
62 *
63 * For each module, there is:
64 *
65 * - a MODULENAME (single word, legal C identifier)
66 *
67 * - a debug-levels.h header file that declares the list of
68 * submodules and that is included by all .c files that use
69 * the debugging tools. The file name can be anything.
70 *
71 * - some (optional) .c code to manipulate the runtime debug levels
72 * through debugfs.
73 *
74 * The debug-levels.h file would look like:
75 *
76 * #ifndef __debug_levels__h__
77 * #define __debug_levels__h__
78 *
79 * #define D_MODULENAME modulename
80 * #define D_MASTER 10
81 *
82 * #include <linux/wimax/debug.h>
83 *
84 * enum d_module {
85 * D_SUBMODULE_DECLARE(submodule_1),
86 * D_SUBMODULE_DECLARE(submodule_2),
87 * ...
88 * D_SUBMODULE_DECLARE(submodule_N)
89 * };
90 *
91 * #endif
92 *
93 * D_MASTER is the maximum compile-time debug level; any debug actions
94 * above this will be out. D_MODULENAME is the module name (legal C
95 * identifier), which has to be unique for each module (to avoid
96 * namespace collisions during linkage). Note those #defines need to
97 * be done before #including debug.h
98 *
99 * We declare N different submodules whose debug level can be
100 * independently controlled during runtime.
101 *
102 * In a .c file of the module (and only in one of them), define the
103 * following code:
104 *
105 * struct d_level D_LEVEL[] = {
106 * D_SUBMODULE_DEFINE(submodule_1),
107 * D_SUBMODULE_DEFINE(submodule_2),
108 * ...
109 * D_SUBMODULE_DEFINE(submodule_N),
110 * };
111 * size_t D_LEVEL_SIZE = ARRAY_SIZE(D_LEVEL);
112 *
113 * Externs for d_level_MODULENAME and d_level_size_MODULENAME are used
114 * and declared in this file using the D_LEVEL and D_LEVEL_SIZE macros
115 * #defined also in this file.
116 *
117 * To manipulate from user space the levels, create a debugfs dentry
118 * and then register each submodule with:
119 *
120 * result = d_level_register_debugfs("PREFIX_", submodule_X, parent);
121 * if (result < 0)
122 * goto error;
123 *
124 * Where PREFIX_ is a name of your chosing. This will create debugfs
125 * file with a single numeric value that can be use to tweak it. To
126 * remove the entires, just use debugfs_remove_recursive() on 'parent'.
127 *
128 * NOTE: remember that even if this will show attached to some
129 * particular instance of a device, the settings are *global*.
130 *
131 *
132 * On each submodule (for example, .c files), the debug infrastructure
133 * should be included like this:
134 *
135 * #define D_SUBMODULE submodule_x // matches one in debug-levels.h
136 * #include "debug-levels.h"
137 *
138 * after #including all your include files.
139 *
140 *
141 * Now you can use the d_*() macros below [d_test(), d_fnstart(),
142 * d_fnend(), d_printf(), d_dump()].
143 *
144 * If their debug level is greater than D_MASTER, they will be
145 * compiled out.
146 *
147 * If their debug level is lower or equal than D_MASTER but greater
148 * than the current debug level of their submodule, they'll be
149 * ignored.
150 *
151 * Otherwise, the action will be performed.
152 */
153#ifndef __debug__h__
154#define __debug__h__
155
156#include <linux/types.h>
157#include <linux/device.h>
158
159
160/* Backend stuff */
161
162/*
163 * Debug backend: generate a message header from a 'struct device'
164 *
165 * @head: buffer where to place the header
166 * @head_size: length of @head
167 * @dev: pointer to device used to generate a header from. If NULL,
168 * an empty ("") header is generated.
169 */
170static inline
171void __d_head(char *head, size_t head_size,
172 struct device *dev)
173{
174 if (dev == NULL)
175 head[0] = 0;
176 else if ((unsigned long)dev < 4096) {
177 printk(KERN_ERR "E: Corrupt dev %p\n", dev);
178 WARN_ON(1);
179 } else
180 snprintf(head, head_size, "%s %s: ",
181 dev_driver_string(dev), dev->bus_id);
182}
183
184
185/*
186 * Debug backend: log some message if debugging is enabled
187 *
188 * @l: intended debug level
189 * @tag: tag to prefix the message with
190 * @dev: 'struct device' associated to this message
191 * @f: printf-like format and arguments
192 *
193 * Note this is optimized out if it doesn't pass the compile-time
194 * check; however, it is *always* compiled. This is useful to make
195 * sure the printf-like formats and variables are always checked and
196 * they don't get bit rot if you have all the debugging disabled.
197 */
198#define _d_printf(l, tag, dev, f, a...) \
199do { \
200 char head[64]; \
201 if (!d_test(l)) \
202 break; \
203 __d_head(head, sizeof(head), dev); \
204 printk(KERN_ERR "%s%s%s: " f, head, __func__, tag, ##a); \
205} while (0)
206
207
208/*
209 * CPP sintatic sugar to generate A_B like symbol names when one of
210 * the arguments is a a preprocessor #define.
211 */
212#define __D_PASTE__(varname, modulename) varname##_##modulename
213#define __D_PASTE(varname, modulename) (__D_PASTE__(varname, modulename))
214#define _D_SUBMODULE_INDEX(_name) (D_SUBMODULE_DECLARE(_name))
215
216
217/*
218 * Store a submodule's runtime debug level and name
219 */
220struct d_level {
221 u8 level;
222 const char *name;
223};
224
225
226/*
227 * List of available submodules and their debug levels
228 *
229 * We call them d_level_MODULENAME and d_level_size_MODULENAME; the
230 * macros D_LEVEL and D_LEVEL_SIZE contain the name already for
231 * convenience.
232 *
233 * This array and the size are defined on some .c file that is part of
234 * the current module.
235 */
236#define D_LEVEL __D_PASTE(d_level, D_MODULENAME)
237#define D_LEVEL_SIZE __D_PASTE(d_level_size, D_MODULENAME)
238
239extern struct d_level D_LEVEL[];
240extern size_t D_LEVEL_SIZE;
241
242
243/*
244 * Frontend stuff
245 *
246 *
247 * Stuff you need to declare prior to using the actual "debug" actions
248 * (defined below).
249 */
250
251#ifndef D_MODULENAME
252#error D_MODULENAME is not defined in your debug-levels.h file
253/**
254 * D_MODULE - Name of the current module
255 *
256 * #define in your module's debug-levels.h, making sure it is
257 * unique. This has to be a legal C identifier.
258 */
259#define D_MODULENAME undefined_modulename
260#endif
261
262
263#ifndef D_MASTER
264#warning D_MASTER not defined, but debug.h included! [see docs]
265/**
266 * D_MASTER - Compile time maximum debug level
267 *
268 * #define in your debug-levels.h file to the maximum debug level the
269 * runtime code will be allowed to have. This allows you to provide a
270 * main knob.
271 *
272 * Anything above that level will be optimized out of the compile.
273 *
274 * Defaults to zero (no debug code compiled in).
275 *
276 * Maximum one definition per module (at the debug-levels.h file).
277 */
278#define D_MASTER 0
279#endif
280
281#ifndef D_SUBMODULE
282#error D_SUBMODULE not defined, but debug.h included! [see docs]
283/**
284 * D_SUBMODULE - Name of the current submodule
285 *
286 * #define in your submodule .c file before #including debug-levels.h
287 * to the name of the current submodule as previously declared and
288 * defined with D_SUBMODULE_DECLARE() (in your module's
289 * debug-levels.h) and D_SUBMODULE_DEFINE().
290 *
291 * This is used to provide runtime-control over the debug levels.
292 *
293 * Maximum one per .c file! Can be shared among different .c files
294 * (meaning they belong to the same submodule categorization).
295 */
296#define D_SUBMODULE undefined_module
297#endif
298
299
300/**
301 * D_SUBMODULE_DECLARE - Declare a submodule for runtime debug level control
302 *
303 * @_name: name of the submodule, restricted to the chars that make up a
304 * valid C identifier ([a-zA-Z0-9_]).
305 *
306 * Declare in the module's debug-levels.h header file as:
307 *
308 * enum d_module {
309 * D_SUBMODULE_DECLARE(submodule_1),
310 * D_SUBMODULE_DECLARE(submodule_2),
311 * D_SUBMODULE_DECLARE(submodule_3),
312 * };
313 *
314 * Some corresponding .c file needs to have a matching
315 * D_SUBMODULE_DEFINE().
316 */
317#define D_SUBMODULE_DECLARE(_name) __D_SUBMODULE_##_name
318
319
320/**
321 * D_SUBMODULE_DEFINE - Define a submodule for runtime debug level control
322 *
323 * @_name: name of the submodule, restricted to the chars that make up a
324 * valid C identifier ([a-zA-Z0-9_]).
325 *
326 * Use once per module (in some .c file) as:
327 *
328 * static
329 * struct d_level d_level_SUBMODULENAME[] = {
330 * D_SUBMODULE_DEFINE(submodule_1),
331 * D_SUBMODULE_DEFINE(submodule_2),
332 * D_SUBMODULE_DEFINE(submodule_3),
333 * };
334 * size_t d_level_size_SUBDMODULENAME = ARRAY_SIZE(d_level_SUBDMODULENAME);
335 *
336 * Matching D_SUBMODULE_DECLARE()s have to be present in a
337 * debug-levels.h header file.
338 */
339#define D_SUBMODULE_DEFINE(_name) \
340[__D_SUBMODULE_##_name] = { \
341 .level = 0, \
342 .name = #_name \
343}
344
345
346
347/* The actual "debug" operations */
348
349
350/**
351 * d_test - Returns true if debugging should be enabled
352 *
353 * @l: intended debug level (unsigned)
354 *
355 * If the master debug switch is enabled and the current settings are
356 * higher or equal to the requested level, then debugging
357 * output/actions should be enabled.
358 *
359 * NOTE:
360 *
361 * This needs to be coded so that it can be evaluated in compile
362 * time; this is why the ugly BUG_ON() is placed in there, so the
363 * D_MASTER evaluation compiles all out if it is compile-time false.
364 */
365#define d_test(l) \
366({ \
367 unsigned __l = l; /* type enforcer */ \
368 (D_MASTER) >= __l \
369 && ({ \
370 BUG_ON(_D_SUBMODULE_INDEX(D_SUBMODULE) >= D_LEVEL_SIZE);\
371 D_LEVEL[_D_SUBMODULE_INDEX(D_SUBMODULE)].level >= __l; \
372 }); \
373})
374
375
376/**
377 * d_fnstart - log message at function start if debugging enabled
378 *
379 * @l: intended debug level
380 * @_dev: 'struct device' pointer, NULL if none (for context)
381 * @f: printf-like format and arguments
382 */
383#define d_fnstart(l, _dev, f, a...) _d_printf(l, " FNSTART", _dev, f, ## a)
384
385
386/**
387 * d_fnend - log message at function end if debugging enabled
388 *
389 * @l: intended debug level
390 * @_dev: 'struct device' pointer, NULL if none (for context)
391 * @f: printf-like format and arguments
392 */
393#define d_fnend(l, _dev, f, a...) _d_printf(l, " FNEND", _dev, f, ## a)
394
395
396/**
397 * d_printf - log message if debugging enabled
398 *
399 * @l: intended debug level
400 * @_dev: 'struct device' pointer, NULL if none (for context)
401 * @f: printf-like format and arguments
402 */
403#define d_printf(l, _dev, f, a...) _d_printf(l, "", _dev, f, ## a)
404
405
406/**
407 * d_dump - log buffer hex dump if debugging enabled
408 *
409 * @l: intended debug level
410 * @_dev: 'struct device' pointer, NULL if none (for context)
411 * @f: printf-like format and arguments
412 */
413#define d_dump(l, dev, ptr, size) \
414do { \
415 char head[64]; \
416 if (!d_test(l)) \
417 break; \
418 __d_head(head, sizeof(head), dev); \
419 print_hex_dump(KERN_ERR, head, 0, 16, 1, \
420 ((void *) ptr), (size), 0); \
421} while (0)
422
423
424/**
425 * Export a submodule's debug level over debugfs as PREFIXSUBMODULE
426 *
427 * @prefix: string to prefix the name with
428 * @submodule: name of submodule (not a string, just the name)
429 * @dentry: debugfs parent dentry
430 *
431 * Returns: 0 if ok, < 0 errno on error.
432 *
433 * For removing, just use debugfs_remove_recursive() on the parent.
434 */
435#define d_level_register_debugfs(prefix, name, parent) \
436({ \
437 int rc; \
438 struct dentry *fd; \
439 struct dentry *verify_parent_type = parent; \
440 fd = debugfs_create_u8( \
441 prefix #name, 0600, verify_parent_type, \
442 &(D_LEVEL[__D_SUBMODULE_ ## name].level)); \
443 rc = PTR_ERR(fd); \
444 if (IS_ERR(fd) && rc != -ENODEV) \
445 printk(KERN_ERR "%s: Can't create debugfs entry %s: " \
446 "%d\n", __func__, prefix #name, rc); \
447 else \
448 rc = 0; \
449 rc; \
450})
451
452
453#endif /* #ifndef __debug__h__ */
diff --git a/include/linux/wimax/i2400m.h b/include/linux/wimax/i2400m.h
new file mode 100644
index 000000000000..74198f5bb4dc
--- /dev/null
+++ b/include/linux/wimax/i2400m.h
@@ -0,0 +1,512 @@
1/*
2 * Intel Wireless WiMax Connection 2400m
3 * Host-Device protocol interface definitions
4 *
5 *
6 * Copyright (C) 2007-2008 Intel Corporation. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
17 * distribution.
18 * * Neither the name of Intel Corporation nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 *
35 * Intel Corporation <linux-wimax@intel.com>
36 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
37 * - Initial implementation
38 *
39 *
40 * This header defines the data structures and constants used to
41 * communicate with the device.
42 *
43 * BOOTMODE/BOOTROM/FIRMWARE UPLOAD PROTOCOL
44 *
45 * The firmware upload protocol is quite simple and only requires a
46 * handful of commands. See drivers/net/wimax/i2400m/fw.c for more
47 * details.
48 *
49 * The BCF data structure is for the firmware file header.
50 *
51 *
52 * THE DATA / CONTROL PROTOCOL
53 *
54 * This is the normal protocol spoken with the device once the
55 * firmware is uploaded. It transports data payloads and control
56 * messages back and forth.
57 *
58 * It consists 'messages' that pack one or more payloads each. The
59 * format is described in detail in drivers/net/wimax/i2400m/rx.c and
60 * tx.c.
61 *
62 *
63 * THE L3L4 PROTOCOL
64 *
65 * The term L3L4 refers to Layer 3 (the device), Layer 4 (the
66 * driver/host software).
67 *
68 * This is the control protocol used by the host to control the i2400m
69 * device (scan, connect, disconnect...). This is sent to / received
70 * as control frames. These frames consist of a header and zero or
71 * more TLVs with information. We call each control frame a "message".
72 *
73 * Each message is composed of:
74 *
75 * HEADER
76 * [TLV0 + PAYLOAD0]
77 * [TLV1 + PAYLOAD1]
78 * [...]
79 * [TLVN + PAYLOADN]
80 *
81 * The HEADER is defined by 'struct i2400m_l3l4_hdr'. The payloads are
82 * defined by a TLV structure (Type Length Value) which is a 'header'
83 * (struct i2400m_tlv_hdr) and then the payload.
84 *
85 * All integers are represented as Little Endian.
86 *
87 * - REQUESTS AND EVENTS
88 *
89 * The requests can be clasified as follows:
90 *
91 * COMMAND: implies a request from the host to the device requesting
92 * an action being performed. The device will reply with a
93 * message (with the same type as the command), status and
94 * no (TLV) payload. Execution of a command might cause
95 * events (of different type) to be sent later on as
96 * device's state changes.
97 *
98 * GET/SET: similar to COMMAND, but will not cause other
99 * EVENTs. The reply, in the case of GET, will contain
100 * TLVs with the requested information.
101 *
102 * EVENT: asynchronous messages sent from the device, maybe as a
103 * consequence of previous COMMANDs but disassociated from
104 * them.
105 *
106 * Only one request might be pending at the same time (ie: don't
107 * parallelize nor post another GET request before the previous
108 * COMMAND has been acknowledged with it's corresponding reply by the
109 * device).
110 *
111 * The different requests and their formats are described below:
112 *
113 * I2400M_MT_* Message types
114 * I2400M_MS_* Message status (for replies, events)
115 * i2400m_tlv_* TLVs
116 *
117 * data types are named 'struct i2400m_msg_OPNAME', OPNAME matching the
118 * operation.
119 */
120
121#ifndef __LINUX__WIMAX__I2400M_H__
122#define __LINUX__WIMAX__I2400M_H__
123
124#include <linux/types.h>
125
126
127/*
128 * Host Device Interface (HDI) common to all busses
129 */
130
131/* Boot-mode (firmware upload mode) commands */
132
133/* Header for the firmware file */
134struct i2400m_bcf_hdr {
135 __le32 module_type;
136 __le32 header_len;
137 __le32 header_version;
138 __le32 module_id;
139 __le32 module_vendor;
140 __le32 date; /* BCD YYYMMDD */
141 __le32 size;
142 __le32 key_size; /* in dwords */
143 __le32 modulus_size; /* in dwords */
144 __le32 exponent_size; /* in dwords */
145 __u8 reserved[88];
146} __attribute__ ((packed));
147
148/* Boot mode opcodes */
149enum i2400m_brh_opcode {
150 I2400M_BRH_READ = 1,
151 I2400M_BRH_WRITE = 2,
152 I2400M_BRH_JUMP = 3,
153 I2400M_BRH_SIGNED_JUMP = 8,
154 I2400M_BRH_HASH_PAYLOAD_ONLY = 9,
155};
156
157/* Boot mode command masks and stuff */
158enum i2400m_brh {
159 I2400M_BRH_SIGNATURE = 0xcbbc0000,
160 I2400M_BRH_SIGNATURE_MASK = 0xffff0000,
161 I2400M_BRH_SIGNATURE_SHIFT = 16,
162 I2400M_BRH_OPCODE_MASK = 0x0000000f,
163 I2400M_BRH_RESPONSE_MASK = 0x000000f0,
164 I2400M_BRH_RESPONSE_SHIFT = 4,
165 I2400M_BRH_DIRECT_ACCESS = 0x00000400,
166 I2400M_BRH_RESPONSE_REQUIRED = 0x00000200,
167 I2400M_BRH_USE_CHECKSUM = 0x00000100,
168};
169
170
171/* Constants for bcf->module_id */
172enum i2400m_bcf_mod_id {
173 /* Firmware file carries its own pokes -- pokes are a set of
174 * magical values that have to be written in certain memory
175 * addresses to get the device up and ready for firmware
176 * download when it is in non-signed boot mode. */
177 I2400M_BCF_MOD_ID_POKES = 0x000000001,
178};
179
180
181/**
182 * i2400m_bootrom_header - Header for a boot-mode command
183 *
184 * @cmd: the above command descriptor
185 * @target_addr: where on the device memory should the action be performed.
186 * @data_size: for read/write, amount of data to be read/written
187 * @block_checksum: checksum value (if applicable)
188 * @payload: the beginning of data attached to this header
189 */
190struct i2400m_bootrom_header {
191 __le32 command; /* Compose with enum i2400_brh */
192 __le32 target_addr;
193 __le32 data_size;
194 __le32 block_checksum;
195 char payload[0];
196} __attribute__ ((packed));
197
198
199/*
200 * Data / control protocol
201 */
202
203/* Packet types for the host-device interface */
204enum i2400m_pt {
205 I2400M_PT_DATA = 0,
206 I2400M_PT_CTRL,
207 I2400M_PT_TRACE, /* For device debug */
208 I2400M_PT_RESET_WARM, /* device reset */
209 I2400M_PT_RESET_COLD, /* USB[transport] reset, like reconnect */
210 I2400M_PT_ILLEGAL
211};
212
213
214/*
215 * Payload for a data packet
216 *
217 * This is prefixed to each and every outgoing DATA type.
218 */
219struct i2400m_pl_data_hdr {
220 __le32 reserved;
221} __attribute__((packed));
222
223
224/* Misc constants */
225enum {
226 I2400M_PL_PAD = 16, /* Payload data size alignment */
227 I2400M_PL_SIZE_MAX = 0x3EFF,
228 I2400M_MAX_PLS_IN_MSG = 60,
229 /* protocol barkers: sync sequences; for notifications they
230 * are sent in groups of four. */
231 I2400M_H2D_PREVIEW_BARKER = 0xcafe900d,
232 I2400M_COLD_RESET_BARKER = 0xc01dc01d,
233 I2400M_WARM_RESET_BARKER = 0x50f750f7,
234 I2400M_NBOOT_BARKER = 0xdeadbeef,
235 I2400M_SBOOT_BARKER = 0x0ff1c1a1,
236 I2400M_ACK_BARKER = 0xfeedbabe,
237 I2400M_D2H_MSG_BARKER = 0xbeefbabe,
238};
239
240
241/*
242 * Hardware payload descriptor
243 *
244 * Bitfields encoded in a struct to enforce typing semantics.
245 *
246 * Look in rx.c and tx.c for a full description of the format.
247 */
248struct i2400m_pld {
249 __le32 val;
250} __attribute__ ((packed));
251
252#define I2400M_PLD_SIZE_MASK 0x00003fff
253#define I2400M_PLD_TYPE_SHIFT 16
254#define I2400M_PLD_TYPE_MASK 0x000f0000
255
256/*
257 * Header for a TX message or RX message
258 *
259 * @barker: preamble
260 * @size: used for management of the FIFO queue buffer; before
261 * sending, this is converted to be a real preamble. This
262 * indicates the real size of the TX message that starts at this
263 * point. If the highest bit is set, then this message is to be
264 * skipped.
265 * @sequence: sequence number of this message
266 * @offset: offset where the message itself starts -- see the comments
267 * in the file header about message header and payload descriptor
268 * alignment.
269 * @num_pls: number of payloads in this message
270 * @padding: amount of padding bytes at the end of the message to make
271 * it be of block-size aligned
272 *
273 * Look in rx.c and tx.c for a full description of the format.
274 */
275struct i2400m_msg_hdr {
276 union {
277 __le32 barker;
278 __u32 size; /* same size type as barker!! */
279 };
280 union {
281 __le32 sequence;
282 __u32 offset; /* same size type as barker!! */
283 };
284 __le16 num_pls;
285 __le16 rsv1;
286 __le16 padding;
287 __le16 rsv2;
288 struct i2400m_pld pld[0];
289} __attribute__ ((packed));
290
291
292
293/*
294 * L3/L4 control protocol
295 */
296
297enum {
298 /* Interface version */
299 I2400M_L3L4_VERSION = 0x0100,
300};
301
302/* Message types */
303enum i2400m_mt {
304 I2400M_MT_RESERVED = 0x0000,
305 I2400M_MT_INVALID = 0xffff,
306 I2400M_MT_REPORT_MASK = 0x8000,
307
308 I2400M_MT_GET_SCAN_RESULT = 0x4202,
309 I2400M_MT_SET_SCAN_PARAM = 0x4402,
310 I2400M_MT_CMD_RF_CONTROL = 0x4602,
311 I2400M_MT_CMD_SCAN = 0x4603,
312 I2400M_MT_CMD_CONNECT = 0x4604,
313 I2400M_MT_CMD_DISCONNECT = 0x4605,
314 I2400M_MT_CMD_EXIT_IDLE = 0x4606,
315 I2400M_MT_GET_LM_VERSION = 0x5201,
316 I2400M_MT_GET_DEVICE_INFO = 0x5202,
317 I2400M_MT_GET_LINK_STATUS = 0x5203,
318 I2400M_MT_GET_STATISTICS = 0x5204,
319 I2400M_MT_GET_STATE = 0x5205,
320 I2400M_MT_GET_MEDIA_STATUS = 0x5206,
321 I2400M_MT_SET_INIT_CONFIG = 0x5404,
322 I2400M_MT_CMD_INIT = 0x5601,
323 I2400M_MT_CMD_TERMINATE = 0x5602,
324 I2400M_MT_CMD_MODE_OF_OP = 0x5603,
325 I2400M_MT_CMD_RESET_DEVICE = 0x5604,
326 I2400M_MT_CMD_MONITOR_CONTROL = 0x5605,
327 I2400M_MT_CMD_ENTER_POWERSAVE = 0x5606,
328 I2400M_MT_GET_TLS_OPERATION_RESULT = 0x6201,
329 I2400M_MT_SET_EAP_SUCCESS = 0x6402,
330 I2400M_MT_SET_EAP_FAIL = 0x6403,
331 I2400M_MT_SET_EAP_KEY = 0x6404,
332 I2400M_MT_CMD_SEND_EAP_RESPONSE = 0x6602,
333 I2400M_MT_REPORT_SCAN_RESULT = 0xc002,
334 I2400M_MT_REPORT_STATE = 0xd002,
335 I2400M_MT_REPORT_POWERSAVE_READY = 0xd005,
336 I2400M_MT_REPORT_EAP_REQUEST = 0xe002,
337 I2400M_MT_REPORT_EAP_RESTART = 0xe003,
338 I2400M_MT_REPORT_ALT_ACCEPT = 0xe004,
339 I2400M_MT_REPORT_KEY_REQUEST = 0xe005,
340};
341
342
343/*
344 * Message Ack Status codes
345 *
346 * When a message is replied-to, this status is reported.
347 */
348enum i2400m_ms {
349 I2400M_MS_DONE_OK = 0,
350 I2400M_MS_DONE_IN_PROGRESS = 1,
351 I2400M_MS_INVALID_OP = 2,
352 I2400M_MS_BAD_STATE = 3,
353 I2400M_MS_ILLEGAL_VALUE = 4,
354 I2400M_MS_MISSING_PARAMS = 5,
355 I2400M_MS_VERSION_ERROR = 6,
356 I2400M_MS_ACCESSIBILITY_ERROR = 7,
357 I2400M_MS_BUSY = 8,
358 I2400M_MS_CORRUPTED_TLV = 9,
359 I2400M_MS_UNINITIALIZED = 10,
360 I2400M_MS_UNKNOWN_ERROR = 11,
361 I2400M_MS_PRODUCTION_ERROR = 12,
362 I2400M_MS_NO_RF = 13,
363 I2400M_MS_NOT_READY_FOR_POWERSAVE = 14,
364 I2400M_MS_THERMAL_CRITICAL = 15,
365 I2400M_MS_MAX
366};
367
368
369/**
370 * i2400m_tlv - enumeration of the different types of TLVs
371 *
372 * TLVs stand for type-length-value and are the header for a payload
373 * composed of almost anything. Each payload has a type assigned
374 * and a length.
375 */
376enum i2400m_tlv {
377 I2400M_TLV_L4_MESSAGE_VERSIONS = 129,
378 I2400M_TLV_SYSTEM_STATE = 141,
379 I2400M_TLV_MEDIA_STATUS = 161,
380 I2400M_TLV_RF_OPERATION = 162,
381 I2400M_TLV_RF_STATUS = 163,
382 I2400M_TLV_DEVICE_RESET_TYPE = 132,
383 I2400M_TLV_CONFIG_IDLE_PARAMETERS = 601,
384};
385
386
387struct i2400m_tlv_hdr {
388 __le16 type;
389 __le16 length; /* payload's */
390 __u8 pl[0];
391} __attribute__((packed));
392
393
394struct i2400m_l3l4_hdr {
395 __le16 type;
396 __le16 length; /* payload's */
397 __le16 version;
398 __le16 resv1;
399 __le16 status;
400 __le16 resv2;
401 struct i2400m_tlv_hdr pl[0];
402} __attribute__((packed));
403
404
405/**
406 * i2400m_system_state - different states of the device
407 */
408enum i2400m_system_state {
409 I2400M_SS_UNINITIALIZED = 1,
410 I2400M_SS_INIT,
411 I2400M_SS_READY,
412 I2400M_SS_SCAN,
413 I2400M_SS_STANDBY,
414 I2400M_SS_CONNECTING,
415 I2400M_SS_WIMAX_CONNECTED,
416 I2400M_SS_DATA_PATH_CONNECTED,
417 I2400M_SS_IDLE,
418 I2400M_SS_DISCONNECTING,
419 I2400M_SS_OUT_OF_ZONE,
420 I2400M_SS_SLEEPACTIVE,
421 I2400M_SS_PRODUCTION,
422 I2400M_SS_CONFIG,
423 I2400M_SS_RF_OFF,
424 I2400M_SS_RF_SHUTDOWN,
425 I2400M_SS_DEVICE_DISCONNECT,
426 I2400M_SS_MAX,
427};
428
429
430/**
431 * i2400m_tlv_system_state - report on the state of the system
432 *
433 * @state: see enum i2400m_system_state
434 */
435struct i2400m_tlv_system_state {
436 struct i2400m_tlv_hdr hdr;
437 __le32 state;
438} __attribute__((packed));
439
440
441struct i2400m_tlv_l4_message_versions {
442 struct i2400m_tlv_hdr hdr;
443 __le16 major;
444 __le16 minor;
445 __le16 branch;
446 __le16 reserved;
447} __attribute__((packed));
448
449
450struct i2400m_tlv_detailed_device_info {
451 struct i2400m_tlv_hdr hdr;
452 __u8 reserved1[400];
453 __u8 mac_address[6];
454 __u8 reserved2[2];
455} __attribute__((packed));
456
457
458enum i2400m_rf_switch_status {
459 I2400M_RF_SWITCH_ON = 1,
460 I2400M_RF_SWITCH_OFF = 2,
461};
462
463struct i2400m_tlv_rf_switches_status {
464 struct i2400m_tlv_hdr hdr;
465 __u8 sw_rf_switch; /* 1 ON, 2 OFF */
466 __u8 hw_rf_switch; /* 1 ON, 2 OFF */
467 __u8 reserved[2];
468} __attribute__((packed));
469
470
471enum {
472 i2400m_rf_operation_on = 1,
473 i2400m_rf_operation_off = 2
474};
475
476struct i2400m_tlv_rf_operation {
477 struct i2400m_tlv_hdr hdr;
478 __le32 status; /* 1 ON, 2 OFF */
479} __attribute__((packed));
480
481
482enum i2400m_tlv_reset_type {
483 I2400M_RESET_TYPE_COLD = 1,
484 I2400M_RESET_TYPE_WARM
485};
486
487struct i2400m_tlv_device_reset_type {
488 struct i2400m_tlv_hdr hdr;
489 __le32 reset_type;
490} __attribute__((packed));
491
492
493struct i2400m_tlv_config_idle_parameters {
494 struct i2400m_tlv_hdr hdr;
495 __le32 idle_timeout; /* 100 to 300000 ms [5min], 100 increments
496 * 0 disabled */
497 __le32 idle_paging_interval; /* frames */
498} __attribute__((packed));
499
500
501enum i2400m_media_status {
502 I2400M_MEDIA_STATUS_LINK_UP = 1,
503 I2400M_MEDIA_STATUS_LINK_DOWN,
504 I2400M_MEDIA_STATUS_LINK_RENEW,
505};
506
507struct i2400m_tlv_media_status {
508 struct i2400m_tlv_hdr hdr;
509 __le32 media_status;
510} __attribute__((packed));
511
512#endif /* #ifndef __LINUX__WIMAX__I2400M_H__ */
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index e585657e9831..7300ecdc480c 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -30,7 +30,6 @@ static inline int task_is_pdflush(struct task_struct *task)
30enum writeback_sync_modes { 30enum writeback_sync_modes {
31 WB_SYNC_NONE, /* Don't wait on anything */ 31 WB_SYNC_NONE, /* Don't wait on anything */
32 WB_SYNC_ALL, /* Wait on every mapping */ 32 WB_SYNC_ALL, /* Wait on every mapping */
33 WB_SYNC_HOLD, /* Hold the inode on sb_dirty for sys_sync() */
34}; 33};
35 34
36/* 35/*
@@ -107,7 +106,9 @@ void throttle_vm_writeout(gfp_t gfp_mask);
107 106
108/* These are exported to sysctl. */ 107/* These are exported to sysctl. */
109extern int dirty_background_ratio; 108extern int dirty_background_ratio;
109extern unsigned long dirty_background_bytes;
110extern int vm_dirty_ratio; 110extern int vm_dirty_ratio;
111extern unsigned long vm_dirty_bytes;
111extern int dirty_writeback_interval; 112extern int dirty_writeback_interval;
112extern int dirty_expire_interval; 113extern int dirty_expire_interval;
113extern int vm_highmem_is_dirtyable; 114extern int vm_highmem_is_dirtyable;
@@ -116,17 +117,26 @@ extern int laptop_mode;
116 117
117extern unsigned long determine_dirtyable_memory(void); 118extern unsigned long determine_dirtyable_memory(void);
118 119
120extern int dirty_background_ratio_handler(struct ctl_table *table, int write,
121 struct file *filp, void __user *buffer, size_t *lenp,
122 loff_t *ppos);
123extern int dirty_background_bytes_handler(struct ctl_table *table, int write,
124 struct file *filp, void __user *buffer, size_t *lenp,
125 loff_t *ppos);
119extern int dirty_ratio_handler(struct ctl_table *table, int write, 126extern int dirty_ratio_handler(struct ctl_table *table, int write,
120 struct file *filp, void __user *buffer, size_t *lenp, 127 struct file *filp, void __user *buffer, size_t *lenp,
121 loff_t *ppos); 128 loff_t *ppos);
129extern int dirty_bytes_handler(struct ctl_table *table, int write,
130 struct file *filp, void __user *buffer, size_t *lenp,
131 loff_t *ppos);
122 132
123struct ctl_table; 133struct ctl_table;
124struct file; 134struct file;
125int dirty_writeback_centisecs_handler(struct ctl_table *, int, struct file *, 135int dirty_writeback_centisecs_handler(struct ctl_table *, int, struct file *,
126 void __user *, size_t *, loff_t *); 136 void __user *, size_t *, loff_t *);
127 137
128void get_dirty_limits(long *pbackground, long *pdirty, long *pbdi_dirty, 138void get_dirty_limits(unsigned long *pbackground, unsigned long *pdirty,
129 struct backing_dev_info *bdi); 139 unsigned long *pbdi_dirty, struct backing_dev_info *bdi);
130 140
131void page_writeback_init(void); 141void page_writeback_init(void);
132void balance_dirty_pages_ratelimited_nr(struct address_space *mapping, 142void balance_dirty_pages_ratelimited_nr(struct address_space *mapping,
diff --git a/include/mtd/ubi-user.h b/include/mtd/ubi-user.h
index ccdc562e444e..2dc2eb2b8e22 100644
--- a/include/mtd/ubi-user.h
+++ b/include/mtd/ubi-user.h
@@ -253,7 +253,7 @@ struct ubi_mkvol_req {
253 * 253 *
254 * Re-sizing is possible for both dynamic and static volumes. But while dynamic 254 * Re-sizing is possible for both dynamic and static volumes. But while dynamic
255 * volumes may be re-sized arbitrarily, static volumes cannot be made to be 255 * volumes may be re-sized arbitrarily, static volumes cannot be made to be
256 * smaller then the number of bytes they bear. To arbitrarily shrink a static 256 * smaller than the number of bytes they bear. To arbitrarily shrink a static
257 * volume, it must be wiped out first (by means of volume update operation with 257 * volume, it must be wiped out first (by means of volume update operation with
258 * zero number of bytes). 258 * zero number of bytes).
259 */ 259 */
diff --git a/include/net/cipso_ipv4.h b/include/net/cipso_ipv4.h
index 9909774eb998..bedc7f62e35d 100644
--- a/include/net/cipso_ipv4.h
+++ b/include/net/cipso_ipv4.h
@@ -131,7 +131,8 @@ extern int cipso_v4_rbm_strictvalid;
131 */ 131 */
132 132
133#ifdef CONFIG_NETLABEL 133#ifdef CONFIG_NETLABEL
134int cipso_v4_doi_add(struct cipso_v4_doi *doi_def); 134int cipso_v4_doi_add(struct cipso_v4_doi *doi_def,
135 struct netlbl_audit *audit_info);
135void cipso_v4_doi_free(struct cipso_v4_doi *doi_def); 136void cipso_v4_doi_free(struct cipso_v4_doi *doi_def);
136int cipso_v4_doi_remove(u32 doi, struct netlbl_audit *audit_info); 137int cipso_v4_doi_remove(u32 doi, struct netlbl_audit *audit_info);
137struct cipso_v4_doi *cipso_v4_doi_getdef(u32 doi); 138struct cipso_v4_doi *cipso_v4_doi_getdef(u32 doi);
@@ -140,7 +141,8 @@ int cipso_v4_doi_walk(u32 *skip_cnt,
140 int (*callback) (struct cipso_v4_doi *doi_def, void *arg), 141 int (*callback) (struct cipso_v4_doi *doi_def, void *arg),
141 void *cb_arg); 142 void *cb_arg);
142#else 143#else
143static inline int cipso_v4_doi_add(struct cipso_v4_doi *doi_def) 144static inline int cipso_v4_doi_add(struct cipso_v4_doi *doi_def,
145 struct netlbl_audit *audit_info)
144{ 146{
145 return -ENOSYS; 147 return -ENOSYS;
146} 148}
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index ce532f2222ce..1459ed3e2697 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -155,9 +155,9 @@ static inline struct neighbour * ndisc_get_neigh(struct net_device *dev, const s
155{ 155{
156 156
157 if (dev) 157 if (dev)
158 return __neigh_lookup(&nd_tbl, addr, dev, 1); 158 return __neigh_lookup_errno(&nd_tbl, addr, dev);
159 159
160 return NULL; 160 return ERR_PTR(-ENODEV);
161} 161}
162 162
163 163
diff --git a/include/net/netdma.h b/include/net/netdma.h
index f28c6e064e8f..8ba8ce284eeb 100644
--- a/include/net/netdma.h
+++ b/include/net/netdma.h
@@ -24,17 +24,6 @@
24#include <linux/dmaengine.h> 24#include <linux/dmaengine.h>
25#include <linux/skbuff.h> 25#include <linux/skbuff.h>
26 26
27static inline struct dma_chan *get_softnet_dma(void)
28{
29 struct dma_chan *chan;
30 rcu_read_lock();
31 chan = rcu_dereference(__get_cpu_var(softnet_data).net_dma);
32 if (chan)
33 dma_chan_get(chan);
34 rcu_read_unlock();
35 return chan;
36}
37
38int dma_skb_copy_datagram_iovec(struct dma_chan* chan, 27int dma_skb_copy_datagram_iovec(struct dma_chan* chan,
39 struct sk_buff *skb, int offset, struct iovec *to, 28 struct sk_buff *skb, int offset, struct iovec *to,
40 size_t len, struct dma_pinned_list *pinned_list); 29 size_t len, struct dma_pinned_list *pinned_list);
diff --git a/include/net/netlabel.h b/include/net/netlabel.h
index 17c442a4514e..749011eedc0b 100644
--- a/include/net/netlabel.h
+++ b/include/net/netlabel.h
@@ -33,6 +33,8 @@
33#include <linux/types.h> 33#include <linux/types.h>
34#include <linux/net.h> 34#include <linux/net.h>
35#include <linux/skbuff.h> 35#include <linux/skbuff.h>
36#include <linux/in.h>
37#include <linux/in6.h>
36#include <net/netlink.h> 38#include <net/netlink.h>
37#include <asm/atomic.h> 39#include <asm/atomic.h>
38 40
@@ -353,13 +355,37 @@ static inline void netlbl_secattr_free(struct netlbl_lsm_secattr *secattr)
353/* 355/*
354 * LSM configuration operations 356 * LSM configuration operations
355 */ 357 */
356int netlbl_cfg_map_del(const char *domain, struct netlbl_audit *audit_info); 358int netlbl_cfg_map_del(const char *domain,
357int netlbl_cfg_unlbl_add_map(const char *domain, 359 u16 family,
360 const void *addr,
361 const void *mask,
362 struct netlbl_audit *audit_info);
363int netlbl_cfg_unlbl_map_add(const char *domain,
364 u16 family,
365 const void *addr,
366 const void *mask,
358 struct netlbl_audit *audit_info); 367 struct netlbl_audit *audit_info);
359int netlbl_cfg_cipsov4_add_map(struct cipso_v4_doi *doi_def, 368int netlbl_cfg_unlbl_static_add(struct net *net,
369 const char *dev_name,
370 const void *addr,
371 const void *mask,
372 u16 family,
373 u32 secid,
374 struct netlbl_audit *audit_info);
375int netlbl_cfg_unlbl_static_del(struct net *net,
376 const char *dev_name,
377 const void *addr,
378 const void *mask,
379 u16 family,
380 struct netlbl_audit *audit_info);
381int netlbl_cfg_cipsov4_add(struct cipso_v4_doi *doi_def,
382 struct netlbl_audit *audit_info);
383void netlbl_cfg_cipsov4_del(u32 doi, struct netlbl_audit *audit_info);
384int netlbl_cfg_cipsov4_map_add(u32 doi,
360 const char *domain, 385 const char *domain,
386 const struct in_addr *addr,
387 const struct in_addr *mask,
361 struct netlbl_audit *audit_info); 388 struct netlbl_audit *audit_info);
362
363/* 389/*
364 * LSM security attribute operations 390 * LSM security attribute operations
365 */ 391 */
@@ -401,19 +427,62 @@ void netlbl_skbuff_err(struct sk_buff *skb, int error, int gateway);
401void netlbl_cache_invalidate(void); 427void netlbl_cache_invalidate(void);
402int netlbl_cache_add(const struct sk_buff *skb, 428int netlbl_cache_add(const struct sk_buff *skb,
403 const struct netlbl_lsm_secattr *secattr); 429 const struct netlbl_lsm_secattr *secattr);
430
431/*
432 * Protocol engine operations
433 */
434struct audit_buffer *netlbl_audit_start(int type,
435 struct netlbl_audit *audit_info);
404#else 436#else
405static inline int netlbl_cfg_map_del(const char *domain, 437static inline int netlbl_cfg_map_del(const char *domain,
438 u16 family,
439 const void *addr,
440 const void *mask,
406 struct netlbl_audit *audit_info) 441 struct netlbl_audit *audit_info)
407{ 442{
408 return -ENOSYS; 443 return -ENOSYS;
409} 444}
410static inline int netlbl_cfg_unlbl_add_map(const char *domain, 445static inline int netlbl_cfg_unlbl_map_add(const char *domain,
446 u16 family,
447 void *addr,
448 void *mask,
411 struct netlbl_audit *audit_info) 449 struct netlbl_audit *audit_info)
412{ 450{
413 return -ENOSYS; 451 return -ENOSYS;
414} 452}
415static inline int netlbl_cfg_cipsov4_add_map(struct cipso_v4_doi *doi_def, 453static inline int netlbl_cfg_unlbl_static_add(struct net *net,
454 const char *dev_name,
455 const void *addr,
456 const void *mask,
457 u16 family,
458 u32 secid,
459 struct netlbl_audit *audit_info)
460{
461 return -ENOSYS;
462}
463static inline int netlbl_cfg_unlbl_static_del(struct net *net,
464 const char *dev_name,
465 const void *addr,
466 const void *mask,
467 u16 family,
468 struct netlbl_audit *audit_info)
469{
470 return -ENOSYS;
471}
472static inline int netlbl_cfg_cipsov4_add(struct cipso_v4_doi *doi_def,
473 struct netlbl_audit *audit_info)
474{
475 return -ENOSYS;
476}
477static inline void netlbl_cfg_cipsov4_del(u32 doi,
478 struct netlbl_audit *audit_info)
479{
480 return;
481}
482static inline int netlbl_cfg_cipsov4_map_add(u32 doi,
416 const char *domain, 483 const char *domain,
484 const struct in_addr *addr,
485 const struct in_addr *mask,
417 struct netlbl_audit *audit_info) 486 struct netlbl_audit *audit_info)
418{ 487{
419 return -ENOSYS; 488 return -ENOSYS;
@@ -495,6 +564,11 @@ static inline int netlbl_cache_add(const struct sk_buff *skb,
495{ 564{
496 return 0; 565 return 0;
497} 566}
567static inline struct audit_buffer *netlbl_audit_start(int type,
568 struct netlbl_audit *audit_info)
569{
570 return NULL;
571}
498#endif /* CONFIG_NETLABEL */ 572#endif /* CONFIG_NETLABEL */
499 573
500#endif /* _NETLABEL_H */ 574#endif /* _NETLABEL_H */
diff --git a/include/net/protocol.h b/include/net/protocol.h
index cb2965aa1b62..ffa5b8b1f1df 100644
--- a/include/net/protocol.h
+++ b/include/net/protocol.h
@@ -59,6 +59,9 @@ struct inet6_protocol
59 int (*gso_send_check)(struct sk_buff *skb); 59 int (*gso_send_check)(struct sk_buff *skb);
60 struct sk_buff *(*gso_segment)(struct sk_buff *skb, 60 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
61 int features); 61 int features);
62 struct sk_buff **(*gro_receive)(struct sk_buff **head,
63 struct sk_buff *skb);
64 int (*gro_complete)(struct sk_buff *skb);
62 65
63 unsigned int flags; /* INET6_PROTO_xxx */ 66 unsigned int flags; /* INET6_PROTO_xxx */
64}; 67};
diff --git a/include/net/wimax.h b/include/net/wimax.h
new file mode 100644
index 000000000000..073809ce94f8
--- /dev/null
+++ b/include/net/wimax.h
@@ -0,0 +1,523 @@
1/*
2 * Linux WiMAX
3 * Kernel space API for accessing WiMAX devices
4 *
5 *
6 * Copyright (C) 2007-2008 Intel Corporation <linux-wimax@intel.com>
7 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License version
11 * 2 as published by the Free Software Foundation.
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., 51 Franklin Street, Fifth Floor, Boston, MA
21 * 02110-1301, USA.
22 *
23 *
24 * The WiMAX stack provides an API for controlling and managing the
25 * system's WiMAX devices. This API affects the control plane; the
26 * data plane is accessed via the network stack (netdev).
27 *
28 * Parts of the WiMAX stack API and notifications are exported to
29 * user space via Generic Netlink. In user space, libwimax (part of
30 * the wimax-tools package) provides a shim layer for accessing those
31 * calls.
32 *
33 * The API is standarized for all WiMAX devices and different drivers
34 * implement the backend support for it. However, device-specific
35 * messaging pipes are provided that can be used to issue commands and
36 * receive notifications in free form.
37 *
38 * Currently the messaging pipes are the only means of control as it
39 * is not known (due to the lack of more devices in the market) what
40 * will be a good abstraction layer. Expect this to change as more
41 * devices show in the market. This API is designed to be growable in
42 * order to address this problem.
43 *
44 * USAGE
45 *
46 * Embed a `struct wimax_dev` at the beginning of the the device's
47 * private structure, initialize and register it. For details, see
48 * `struct wimax_dev`s documentation.
49 *
50 * Once this is done, wimax-tools's libwimaxll can be used to
51 * communicate with the driver from user space. You user space
52 * application does not have to forcibily use libwimaxll and can talk
53 * the generic netlink protocol directly if desired.
54 *
55 * Remember this is a very low level API that will to provide all of
56 * WiMAX features. Other daemons and services running in user space
57 * are the expected clients of it. They offer a higher level API that
58 * applications should use (an example of this is the Intel's WiMAX
59 * Network Service for the i2400m).
60 *
61 * DESIGN
62 *
63 * Although not set on final stone, this very basic interface is
64 * mostly completed. Remember this is meant to grow as new common
65 * operations are decided upon. New operations will be added to the
66 * interface, intent being on keeping backwards compatibility as much
67 * as possible.
68 *
69 * This layer implements a set of calls to control a WiMAX device,
70 * exposing a frontend to the rest of the kernel and user space (via
71 * generic netlink) and a backend implementation in the driver through
72 * function pointers.
73 *
74 * WiMAX devices have a state, and a kernel-only API allows the
75 * drivers to manipulate that state. State transitions are atomic, and
76 * only some of them are allowed (see `enum wimax_st`).
77 *
78 * Most API calls will set the state automatically; in most cases
79 * drivers have to only report state changes due to external
80 * conditions.
81 *
82 * All API operations are 'atomic', serialized thorough a mutex in the
83 * `struct wimax_dev`.
84 *
85 * EXPORTING TO USER SPACE THROUGH GENERIC NETLINK
86 *
87 * The API is exported to user space using generic netlink (other
88 * methods can be added as needed).
89 *
90 * There is a Generic Netlink Family named "WiMAX", where interfaces
91 * supporting the WiMAX interface receive commands and broadcast their
92 * signals over a multicast group named "msg".
93 *
94 * Mapping to the source/destination interface is done by an interface
95 * index attribute.
96 *
97 * For user-to-kernel traffic (commands) we use a function call
98 * marshalling mechanism, where a message X with attributes A, B, C
99 * sent from user space to kernel space means executing the WiMAX API
100 * call wimax_X(A, B, C), sending the results back as a message.
101 *
102 * Kernel-to-user (notifications or signals) communication is sent
103 * over multicast groups. This allows to have multiple applications
104 * monitoring them.
105 *
106 * Each command/signal gets assigned it's own attribute policy. This
107 * way the validator will verify that all the attributes in there are
108 * only the ones that should be for each command/signal. Thing of an
109 * attribute mapping to a type+argumentname for each command/signal.
110 *
111 * If we had a single policy for *all* commands/signals, after running
112 * the validator we'd have to check "does this attribute belong in
113 * here"? for each one. It can be done manually, but it's just easier
114 * to have the validator do that job with multiple policies. As well,
115 * it makes it easier to later expand each command/signal signature
116 * without affecting others and keeping the namespace more or less
117 * sane. Not that it is too complicated, but it makes it even easier.
118 *
119 * No state information is maintained in the kernel for each user
120 * space connection (the connection is stateless).
121 *
122 * TESTING FOR THE INTERFACE AND VERSIONING
123 *
124 * If network interface X is a WiMAX device, there will be a Generic
125 * Netlink family named "WiMAX X" and the device will present a
126 * "wimax" directory in it's network sysfs directory
127 * (/sys/class/net/DEVICE/wimax) [used by HAL].
128 *
129 * The inexistence of any of these means the device does not support
130 * this WiMAX API.
131 *
132 * By querying the generic netlink controller, versioning information
133 * and the multicast groups available can be found. Applications using
134 * the interface can either rely on that or use the generic netlink
135 * controller to figure out which generic netlink commands/signals are
136 * supported.
137 *
138 * NOTE: this versioning is a last resort to avoid hard
139 * incompatibilities. It is the intention of the design of this
140 * stack not to introduce backward incompatible changes.
141 *
142 * The version code has to fit in one byte (restrictions imposed by
143 * generic netlink); we use `version / 10` for the major version and
144 * `version % 10` for the minor. This gives 9 minors for each major
145 * and 25 majors.
146 *
147 * The version change protocol is as follow:
148 *
149 * - Major versions: needs to be increased if an existing message/API
150 * call is changed or removed. Doesn't need to be changed if a new
151 * message is added.
152 *
153 * - Minor version: needs to be increased if new messages/API calls are
154 * being added or some other consideration that doesn't impact the
155 * user-kernel interface too much (like some kind of bug fix) and
156 * that is kind of left up in the air to common sense.
157 *
158 * User space code should not try to work if the major version it was
159 * compiled for differs from what the kernel offers. As well, if the
160 * minor version of the kernel interface is lower than the one user
161 * space is expecting (the one it was compiled for), the kernel
162 * might be missing API calls; user space shall be ready to handle
163 * said condition. Use the generic netlink controller operations to
164 * find which ones are supported and which not.
165 *
166 * libwimaxll:wimaxll_open() takes care of checking versions.
167 *
168 * THE OPERATIONS:
169 *
170 * Each operation is defined in its on file (drivers/net/wimax/op-*.c)
171 * for clarity. The parts needed for an operation are:
172 *
173 * - a function pointer in `struct wimax_dev`: optional, as the
174 * operation might be implemented by the stack and not by the
175 * driver.
176 *
177 * All function pointers are named wimax_dev->op_*(), and drivers
178 * must implement them except where noted otherwise.
179 *
180 * - When exported to user space, a `struct nla_policy` to define the
181 * attributes of the generic netlink command and a `struct genl_ops`
182 * to define the operation.
183 *
184 * All the declarations for the operation codes (WIMAX_GNL_OP_<NAME>)
185 * and generic netlink attributes (WIMAX_GNL_<NAME>_*) are declared in
186 * include/linux/wimax.h; this file is intended to be cloned by user
187 * space to gain access to those declarations.
188 *
189 * A few caveats to remember:
190 *
191 * - Need to define attribute numbers starting in 1; otherwise it
192 * fails.
193 *
194 * - the `struct genl_family` requires a maximum attribute id; when
195 * defining the `struct nla_policy` for each message, it has to have
196 * an array size of WIMAX_GNL_ATTR_MAX+1.
197 *
198 * THE PIPE INTERFACE:
199 *
200 * This interface is kept intentionally simple. The driver can send
201 * and receive free-form messages to/from user space through a
202 * pipe. See drivers/net/wimax/op-msg.c for details.
203 *
204 * The kernel-to-user messages are sent with
205 * wimax_msg(). user-to-kernel messages are delivered via
206 * wimax_dev->op_msg_from_user().
207 *
208 * RFKILL:
209 *
210 * RFKILL support is built into the wimax_dev layer; the driver just
211 * needs to call wimax_report_rfkill_{hw,sw}() to inform of changes in
212 * the hardware or software RF kill switches. When the stack wants to
213 * turn the radio off, it will call wimax_dev->op_rfkill_sw_toggle(),
214 * which the driver implements.
215 *
216 * User space can set the software RF Kill switch by calling
217 * wimax_rfkill().
218 *
219 * The code for now only supports devices that don't require polling;
220 * If the device needs to be polled, create a self-rearming delayed
221 * work struct for polling or look into adding polled support to the
222 * WiMAX stack.
223 *
224 * When initializing the hardware (_probe), after calling
225 * wimax_dev_add(), query the device for it's RF Kill switches status
226 * and feed it back to the WiMAX stack using
227 * wimax_report_rfkill_{hw,sw}(). If any switch is missing, always
228 * report it as ON.
229 *
230 * NOTE: the wimax stack uses an inverted terminology to that of the
231 * RFKILL subsystem:
232 *
233 * - ON: radio is ON, RFKILL is DISABLED or OFF.
234 * - OFF: radio is OFF, RFKILL is ENABLED or ON.
235 *
236 * MISCELLANEOUS OPS:
237 *
238 * wimax_reset() can be used to reset the device to power on state; by
239 * default it issues a warm reset that maintains the same device
240 * node. If that is not possible, it falls back to a cold reset
241 * (device reconnect). The driver implements the backend to this
242 * through wimax_dev->op_reset().
243 */
244
245#ifndef __NET__WIMAX_H__
246#define __NET__WIMAX_H__
247#ifdef __KERNEL__
248
249#include <linux/wimax.h>
250#include <net/genetlink.h>
251#include <linux/netdevice.h>
252
253struct net_device;
254struct genl_info;
255struct wimax_dev;
256struct input_dev;
257
258/**
259 * struct wimax_dev - Generic WiMAX device
260 *
261 * @net_dev: [fill] Pointer to the &struct net_device this WiMAX
262 * device implements.
263 *
264 * @op_msg_from_user: [fill] Driver-specific operation to
265 * handle a raw message from user space to the driver. The
266 * driver can send messages to user space using with
267 * wimax_msg_to_user().
268 *
269 * @op_rfkill_sw_toggle: [fill] Driver-specific operation to act on
270 * userspace (or any other agent) requesting the WiMAX device to
271 * change the RF Kill software switch (WIMAX_RF_ON or
272 * WIMAX_RF_OFF).
273 * If such hardware support is not present, it is assumed the
274 * radio cannot be switched off and it is always on (and the stack
275 * will error out when trying to switch it off). In such case,
276 * this function pointer can be left as NULL.
277 *
278 * @op_reset: [fill] Driver specific operation to reset the
279 * device.
280 * This operation should always attempt first a warm reset that
281 * does not disconnect the device from the bus and return 0.
282 * If that fails, it should resort to some sort of cold or bus
283 * reset (even if it implies a bus disconnection and device
284 * dissapearance). In that case, -ENODEV should be returned to
285 * indicate the device is gone.
286 * This operation has to be synchronous, and return only when the
287 * reset is complete. In case of having had to resort to bus/cold
288 * reset implying a device disconnection, the call is allowed to
289 * return inmediately.
290 * NOTE: wimax_dev->mutex is NOT locked when this op is being
291 * called; however, wimax_dev->mutex_reset IS locked to ensure
292 * serialization of calls to wimax_reset().
293 * See wimax_reset()'s documentation.
294 *
295 * @name: [fill] A way to identify this device. We need to register a
296 * name with many subsystems (input for RFKILL, workqueue
297 * creation, etc). We can't use the network device name as that
298 * might change and in some instances we don't know it yet (until
299 * we don't call register_netdev()). So we generate an unique one
300 * using the driver name and device bus id, place it here and use
301 * it across the board. Recommended naming:
302 * DRIVERNAME-BUSNAME:BUSID (dev->bus->name, dev->bus_id).
303 *
304 * @id_table_node: [private] link to the list of wimax devices kept by
305 * id-table.c. Protected by it's own spinlock.
306 *
307 * @mutex: [private] Serializes all concurrent access and execution of
308 * operations.
309 *
310 * @mutex_reset: [private] Serializes reset operations. Needs to be a
311 * different mutex because as part of the reset operation, the
312 * driver has to call back into the stack to do things such as
313 * state change, that require wimax_dev->mutex.
314 *
315 * @state: [private] Current state of the WiMAX device.
316 *
317 * @rfkill: [private] integration into the RF-Kill infrastructure.
318 *
319 * @rfkill_input: [private] virtual input device to process the
320 * hardware RF Kill switches.
321 *
322 * @rf_sw: [private] State of the software radio switch (OFF/ON)
323 *
324 * @rf_hw: [private] State of the hardware radio switch (OFF/ON)
325 *
326 * @debufs_dentry: [private] Used to hook up a debugfs entry. This
327 * shows up in the debugfs root as wimax:DEVICENAME.
328 *
329 * Description:
330 * This structure defines a common interface to access all WiMAX
331 * devices from different vendors and provides a common API as well as
332 * a free-form device-specific messaging channel.
333 *
334 * Usage:
335 * 1. Embed a &struct wimax_dev at *the beginning* the network
336 * device structure so that netdev_priv() points to it.
337 *
338 * 2. memset() it to zero
339 *
340 * 3. Initialize with wimax_dev_init(). This will leave the WiMAX
341 * device in the %__WIMAX_ST_NULL state.
342 *
343 * 4. Fill all the fields marked with [fill]; once called
344 * wimax_dev_add(), those fields CANNOT be modified.
345 *
346 * 5. Call wimax_dev_add() *after* registering the network
347 * device. This will leave the WiMAX device in the %WIMAX_ST_DOWN
348 * state.
349 * Protect the driver's net_device->open() against succeeding if
350 * the wimax device state is lower than %WIMAX_ST_DOWN.
351 *
352 * 6. Select when the device is going to be turned on/initialized;
353 * for example, it could be initialized on 'ifconfig up' (when the
354 * netdev op 'open()' is called on the driver).
355 *
356 * When the device is initialized (at `ifconfig up` time, or right
357 * after calling wimax_dev_add() from _probe(), make sure the
358 * following steps are taken
359 *
360 * a. Move the device to %WIMAX_ST_UNINITIALIZED. This is needed so
361 * some API calls that shouldn't work until the device is ready
362 * can be blocked.
363 *
364 * b. Initialize the device. Make sure to turn the SW radio switch
365 * off and move the device to state %WIMAX_ST_RADIO_OFF when
366 * done. When just initialized, a device should be left in RADIO
367 * OFF state until user space devices to turn it on.
368 *
369 * c. Query the device for the state of the hardware rfkill switch
370 * and call wimax_rfkill_report_hw() and wimax_rfkill_report_sw()
371 * as needed. See below.
372 *
373 * wimax_dev_rm() undoes before unregistering the network device. Once
374 * wimax_dev_add() is called, the driver can get called on the
375 * wimax_dev->op_* function pointers
376 *
377 * CONCURRENCY:
378 *
379 * The stack provides a mutex for each device that will disallow API
380 * calls happening concurrently; thus, op calls into the driver
381 * through the wimax_dev->op*() function pointers will always be
382 * serialized and *never* concurrent.
383 *
384 * For locking, take wimax_dev->mutex is taken; (most) operations in
385 * the API have to check for wimax_dev_is_ready() to return 0 before
386 * continuing (this is done internally).
387 *
388 * REFERENCE COUNTING:
389 *
390 * The WiMAX device is reference counted by the associated network
391 * device. The only operation that can be used to reference the device
392 * is wimax_dev_get_by_genl_info(), and the reference it acquires has
393 * to be released with dev_put(wimax_dev->net_dev).
394 *
395 * RFKILL:
396 *
397 * At startup, both HW and SW radio switchess are assumed to be off.
398 *
399 * At initialization time [after calling wimax_dev_add()], have the
400 * driver query the device for the status of the software and hardware
401 * RF kill switches and call wimax_report_rfkill_hw() and
402 * wimax_rfkill_report_sw() to indicate their state. If any is
403 * missing, just call it to indicate it is ON (radio always on).
404 *
405 * Whenever the driver detects a change in the state of the RF kill
406 * switches, it should call wimax_report_rfkill_hw() or
407 * wimax_report_rfkill_sw() to report it to the stack.
408 */
409struct wimax_dev {
410 struct net_device *net_dev;
411 struct list_head id_table_node;
412 struct mutex mutex; /* Protects all members and API calls */
413 struct mutex mutex_reset;
414 enum wimax_st state;
415
416 int (*op_msg_from_user)(struct wimax_dev *wimax_dev,
417 const char *,
418 const void *, size_t,
419 const struct genl_info *info);
420 int (*op_rfkill_sw_toggle)(struct wimax_dev *wimax_dev,
421 enum wimax_rf_state);
422 int (*op_reset)(struct wimax_dev *wimax_dev);
423
424 struct rfkill *rfkill;
425 struct input_dev *rfkill_input;
426 unsigned rf_hw;
427 unsigned rf_sw;
428 char name[32];
429
430 struct dentry *debugfs_dentry;
431};
432
433
434
435/*
436 * WiMAX stack public API for device drivers
437 * -----------------------------------------
438 *
439 * These functions are not exported to user space.
440 */
441extern void wimax_dev_init(struct wimax_dev *);
442extern int wimax_dev_add(struct wimax_dev *, struct net_device *);
443extern void wimax_dev_rm(struct wimax_dev *);
444
445static inline
446struct wimax_dev *net_dev_to_wimax(struct net_device *net_dev)
447{
448 return netdev_priv(net_dev);
449}
450
451static inline
452struct device *wimax_dev_to_dev(struct wimax_dev *wimax_dev)
453{
454 return wimax_dev->net_dev->dev.parent;
455}
456
457extern void wimax_state_change(struct wimax_dev *, enum wimax_st);
458extern enum wimax_st wimax_state_get(struct wimax_dev *);
459
460/*
461 * Radio Switch state reporting.
462 *
463 * enum wimax_rf_state is declared in linux/wimax.h so the exports
464 * to user space can use it.
465 */
466extern void wimax_report_rfkill_hw(struct wimax_dev *, enum wimax_rf_state);
467extern void wimax_report_rfkill_sw(struct wimax_dev *, enum wimax_rf_state);
468
469
470/*
471 * Free-form messaging to/from user space
472 *
473 * Sending a message:
474 *
475 * wimax_msg(wimax_dev, pipe_name, buf, buf_size, GFP_KERNEL);
476 *
477 * Broken up:
478 *
479 * skb = wimax_msg_alloc(wimax_dev, pipe_name, buf_size, GFP_KERNEL);
480 * ...fill up skb...
481 * wimax_msg_send(wimax_dev, pipe_name, skb);
482 *
483 * Be sure not to modify skb->data in the middle (ie: don't use
484 * skb_push()/skb_pull()/skb_reserve() on the skb).
485 *
486 * "pipe_name" is any string, than can be interpreted as the name of
487 * the pipe or destinatary; the interpretation of it is driver
488 * specific, so the recipient can multiplex it as wished. It can be
489 * NULL, it won't be used - an example is using a "diagnostics" tag to
490 * send diagnostics information that a device-specific diagnostics
491 * tool would be interested in.
492 */
493extern struct sk_buff *wimax_msg_alloc(struct wimax_dev *, const char *,
494 const void *, size_t, gfp_t);
495extern int wimax_msg_send(struct wimax_dev *, struct sk_buff *);
496extern int wimax_msg(struct wimax_dev *, const char *,
497 const void *, size_t, gfp_t);
498
499extern const void *wimax_msg_data_len(struct sk_buff *, size_t *);
500extern const void *wimax_msg_data(struct sk_buff *);
501extern ssize_t wimax_msg_len(struct sk_buff *);
502
503
504/*
505 * WiMAX stack user space API
506 * --------------------------
507 *
508 * This API is what gets exported to user space for general
509 * operations. As well, they can be called from within the kernel,
510 * (with a properly referenced `struct wimax_dev`).
511 *
512 * Properly referenced means: the 'struct net_device' that embeds the
513 * device's control structure and (as such) the 'struct wimax_dev' is
514 * referenced by the caller.
515 */
516extern int wimax_rfkill(struct wimax_dev *, enum wimax_rf_state);
517extern int wimax_reset(struct wimax_dev *);
518
519#else
520/* You might be looking for linux/wimax.h */
521#error This file should not be included from user space.
522#endif /* #ifdef __KERNEL__ */
523#endif /* #ifndef __NET__WIMAX_H__ */
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index 6e04e6fe79c7..c9184f756cad 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -358,6 +358,7 @@ struct fc_rport { /* aka fc_starget_attrs */
358#define FC_RPORT_DEVLOSS_PENDING 0x01 358#define FC_RPORT_DEVLOSS_PENDING 0x01
359#define FC_RPORT_SCAN_PENDING 0x02 359#define FC_RPORT_SCAN_PENDING 0x02
360#define FC_RPORT_FAST_FAIL_TIMEDOUT 0x04 360#define FC_RPORT_FAST_FAIL_TIMEDOUT 0x04
361#define FC_RPORT_DEVLOSS_CALLBK_DONE 0x08
361 362
362#define dev_to_rport(d) \ 363#define dev_to_rport(d) \
363 container_of(d, struct fc_rport, dev) 364 container_of(d, struct fc_rport, dev)
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 7ee2f70ca42e..4af1083e3287 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -85,6 +85,10 @@
85#define SND_SOC_DAPM_MUX(wname, wreg, wshift, winvert, wcontrols) \ 85#define SND_SOC_DAPM_MUX(wname, wreg, wshift, winvert, wcontrols) \
86{ .id = snd_soc_dapm_mux, .name = wname, .reg = wreg, .shift = wshift, \ 86{ .id = snd_soc_dapm_mux, .name = wname, .reg = wreg, .shift = wshift, \
87 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1} 87 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1}
88#define SND_SOC_DAPM_VALUE_MUX(wname, wreg, wshift, winvert, wcontrols) \
89{ .id = snd_soc_dapm_value_mux, .name = wname, .reg = wreg, \
90 .shift = wshift, .invert = winvert, .kcontrols = wcontrols, \
91 .num_kcontrols = 1}
88 92
89/* path domain with event - event handler must return 0 for success */ 93/* path domain with event - event handler must return 0 for success */
90#define SND_SOC_DAPM_PGA_E(wname, wreg, wshift, winvert, wcontrols, \ 94#define SND_SOC_DAPM_PGA_E(wname, wreg, wshift, winvert, wcontrols, \
@@ -172,6 +176,12 @@
172 .get = snd_soc_dapm_get_enum_double, \ 176 .get = snd_soc_dapm_get_enum_double, \
173 .put = snd_soc_dapm_put_enum_double, \ 177 .put = snd_soc_dapm_put_enum_double, \
174 .private_value = (unsigned long)&xenum } 178 .private_value = (unsigned long)&xenum }
179#define SOC_DAPM_VALUE_ENUM(xname, xenum) \
180{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
181 .info = snd_soc_info_value_enum_double, \
182 .get = snd_soc_dapm_get_value_enum_double, \
183 .put = snd_soc_dapm_put_value_enum_double, \
184 .private_value = (unsigned long)&xenum }
175 185
176/* dapm stream operations */ 186/* dapm stream operations */
177#define SND_SOC_DAPM_STREAM_NOP 0x0 187#define SND_SOC_DAPM_STREAM_NOP 0x0
@@ -214,6 +224,10 @@ int snd_soc_dapm_get_enum_double(struct snd_kcontrol *kcontrol,
214 struct snd_ctl_elem_value *ucontrol); 224 struct snd_ctl_elem_value *ucontrol);
215int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol, 225int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,
216 struct snd_ctl_elem_value *ucontrol); 226 struct snd_ctl_elem_value *ucontrol);
227int snd_soc_dapm_get_value_enum_double(struct snd_kcontrol *kcontrol,
228 struct snd_ctl_elem_value *ucontrol);
229int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol,
230 struct snd_ctl_elem_value *ucontrol);
217int snd_soc_dapm_new_control(struct snd_soc_codec *codec, 231int snd_soc_dapm_new_control(struct snd_soc_codec *codec,
218 const struct snd_soc_dapm_widget *widget); 232 const struct snd_soc_dapm_widget *widget);
219int snd_soc_dapm_new_controls(struct snd_soc_codec *codec, 233int snd_soc_dapm_new_controls(struct snd_soc_codec *codec,
@@ -247,6 +261,7 @@ enum snd_soc_dapm_type {
247 snd_soc_dapm_input = 0, /* input pin */ 261 snd_soc_dapm_input = 0, /* input pin */
248 snd_soc_dapm_output, /* output pin */ 262 snd_soc_dapm_output, /* output pin */
249 snd_soc_dapm_mux, /* selects 1 analog signal from many inputs */ 263 snd_soc_dapm_mux, /* selects 1 analog signal from many inputs */
264 snd_soc_dapm_value_mux, /* selects 1 analog signal from many inputs */
250 snd_soc_dapm_mixer, /* mixes several analog signals together */ 265 snd_soc_dapm_mixer, /* mixes several analog signals together */
251 snd_soc_dapm_pga, /* programmable gain/attenuation (volume) */ 266 snd_soc_dapm_pga, /* programmable gain/attenuation (volume) */
252 snd_soc_dapm_adc, /* analog to digital converter */ 267 snd_soc_dapm_adc, /* analog to digital converter */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index f86e455d3828..9b930d342116 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -94,11 +94,22 @@
94 SOC_ENUM_DOUBLE(xreg, xshift, xshift, xmax, xtexts) 94 SOC_ENUM_DOUBLE(xreg, xshift, xshift, xmax, xtexts)
95#define SOC_ENUM_SINGLE_EXT(xmax, xtexts) \ 95#define SOC_ENUM_SINGLE_EXT(xmax, xtexts) \
96{ .max = xmax, .texts = xtexts } 96{ .max = xmax, .texts = xtexts }
97#define SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xmax, xtexts, xvalues) \
98{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \
99 .mask = xmask, .max = xmax, .texts = xtexts, .values = xvalues}
100#define SOC_VALUE_ENUM_SINGLE(xreg, xshift, xmask, xmax, xtexts, xvalues) \
101 SOC_VALUE_ENUM_DOUBLE(xreg, xshift, xshift, xmask, xmax, xtexts, xvalues)
97#define SOC_ENUM(xname, xenum) \ 102#define SOC_ENUM(xname, xenum) \
98{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\ 103{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\
99 .info = snd_soc_info_enum_double, \ 104 .info = snd_soc_info_enum_double, \
100 .get = snd_soc_get_enum_double, .put = snd_soc_put_enum_double, \ 105 .get = snd_soc_get_enum_double, .put = snd_soc_put_enum_double, \
101 .private_value = (unsigned long)&xenum } 106 .private_value = (unsigned long)&xenum }
107#define SOC_VALUE_ENUM(xname, xenum) \
108{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\
109 .info = snd_soc_info_value_enum_double, \
110 .get = snd_soc_get_value_enum_double, \
111 .put = snd_soc_put_value_enum_double, \
112 .private_value = (unsigned long)&xenum }
102#define SOC_SINGLE_EXT(xname, xreg, xshift, xmax, xinvert,\ 113#define SOC_SINGLE_EXT(xname, xreg, xshift, xmax, xinvert,\
103 xhandler_get, xhandler_put) \ 114 xhandler_get, xhandler_put) \
104{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 115{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
@@ -200,6 +211,12 @@ int snd_soc_get_enum_double(struct snd_kcontrol *kcontrol,
200 struct snd_ctl_elem_value *ucontrol); 211 struct snd_ctl_elem_value *ucontrol);
201int snd_soc_put_enum_double(struct snd_kcontrol *kcontrol, 212int snd_soc_put_enum_double(struct snd_kcontrol *kcontrol,
202 struct snd_ctl_elem_value *ucontrol); 213 struct snd_ctl_elem_value *ucontrol);
214int snd_soc_info_value_enum_double(struct snd_kcontrol *kcontrol,
215 struct snd_ctl_elem_info *uinfo);
216int snd_soc_get_value_enum_double(struct snd_kcontrol *kcontrol,
217 struct snd_ctl_elem_value *ucontrol);
218int snd_soc_put_value_enum_double(struct snd_kcontrol *kcontrol,
219 struct snd_ctl_elem_value *ucontrol);
203int snd_soc_info_volsw(struct snd_kcontrol *kcontrol, 220int snd_soc_info_volsw(struct snd_kcontrol *kcontrol,
204 struct snd_ctl_elem_info *uinfo); 221 struct snd_ctl_elem_info *uinfo);
205int snd_soc_info_volsw_ext(struct snd_kcontrol *kcontrol, 222int snd_soc_info_volsw_ext(struct snd_kcontrol *kcontrol,
@@ -406,6 +423,19 @@ struct soc_enum {
406 void *dapm; 423 void *dapm;
407}; 424};
408 425
426/* semi enumerated kcontrol */
427struct soc_value_enum {
428 unsigned short reg;
429 unsigned short reg2;
430 unsigned char shift_l;
431 unsigned char shift_r;
432 unsigned int max;
433 unsigned int mask;
434 const char **texts;
435 const unsigned int *values;
436 void *dapm;
437};
438
409#include <sound/soc-dai.h> 439#include <sound/soc-dai.h>
410 440
411#endif 441#endif
diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h
index 6369d89c25d5..f87f9614844d 100644
--- a/include/xen/xenbus.h
+++ b/include/xen/xenbus.h
@@ -136,8 +136,6 @@ struct xenbus_transaction
136/* Nil transaction ID. */ 136/* Nil transaction ID. */
137#define XBT_NIL ((struct xenbus_transaction) { 0 }) 137#define XBT_NIL ((struct xenbus_transaction) { 0 })
138 138
139int __init xenbus_dev_init(void);
140
141char **xenbus_directory(struct xenbus_transaction t, 139char **xenbus_directory(struct xenbus_transaction t,
142 const char *dir, const char *node, unsigned int *num); 140 const char *dir, const char *node, unsigned int *num);
143void *xenbus_read(struct xenbus_transaction t, 141void *xenbus_read(struct xenbus_transaction t,