aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/asm-arm/arch-pxa/pxa3xx_nand.h18
-rw-r--r--include/asm-arm/plat-s3c/nand.h5
-rw-r--r--include/asm-generic/iomap.h4
-rw-r--r--include/asm-powerpc/fixmap.h106
-rw-r--r--include/asm-powerpc/highmem.h41
-rw-r--r--include/asm-powerpc/io-defs.h101
-rw-r--r--include/asm-powerpc/io.h8
-rw-r--r--include/asm-powerpc/kdump.h5
-rw-r--r--include/asm-powerpc/paca.h1
-rw-r--r--include/asm-powerpc/page.h45
-rw-r--r--include/asm-powerpc/page_32.h6
-rw-r--r--include/asm-powerpc/thread_info.h8
-rw-r--r--include/asm-ppc/mmu.h2
-rw-r--r--include/asm-ppc/mpc8260.h4
-rw-r--r--include/asm-ppc/mpc8xx.h4
-rw-r--r--include/asm-x86/fixmap.h8
-rw-r--r--include/asm-x86/fixmap_32.h7
-rw-r--r--include/asm-x86/fixmap_64.h4
-rw-r--r--include/asm-x86/io.h8
-rw-r--r--include/asm-x86/io_32.h6
-rw-r--r--include/asm-x86/io_64.h6
-rw-r--r--include/asm-x86/page.h1
-rw-r--r--include/asm-x86/paravirt.h43
-rw-r--r--include/asm-x86/pgalloc.h111
-rw-r--r--include/asm-x86/pgalloc_32.h95
-rw-r--r--include/asm-x86/pgalloc_64.h133
-rw-r--r--include/asm-x86/pgtable.h63
-rw-r--r--include/asm-x86/pgtable_32.h18
-rw-r--r--include/asm-x86/pgtable_64.h2
-rw-r--r--include/asm-x86/xen/events.h22
-rw-r--r--include/asm-x86/xen/grant_table.h7
-rw-r--r--include/asm-x86/xen/hypercall.h6
-rw-r--r--include/asm-x86/xen/interface.h28
-rw-r--r--include/asm-x86/xen/page.h168
-rw-r--r--include/linux/device-mapper.h96
-rw-r--r--include/linux/dm-dirty-log.h131
-rw-r--r--include/linux/dm-io.h85
-rw-r--r--include/linux/dm-kcopyd.h47
-rw-r--r--include/linux/fs.h1
-rw-r--r--include/linux/input.h8
-rw-r--r--include/linux/keyboard.h1
-rw-r--r--include/linux/leds.h6
-rw-r--r--include/linux/libata.h1
-rw-r--r--include/linux/lockd/lockd.h8
-rw-r--r--include/linux/mtd/inftl.h5
-rw-r--r--include/linux/mtd/nftl.h5
-rw-r--r--include/linux/mtd/onenand.h3
-rw-r--r--include/linux/mtd/plat-ram.h5
-rw-r--r--include/linux/nfsd/nfsd.h2
-rw-r--r--include/linux/phy.h24
-rw-r--r--include/linux/sched.h2
-rw-r--r--include/linux/seqlock.h46
-rw-r--r--include/linux/serio.h1
-rw-r--r--include/linux/spi/ads7846.h3
-rw-r--r--include/linux/usb.h196
-rw-r--r--include/linux/usb/audio.h2
-rw-r--r--include/linux/usb/cdc.h4
-rw-r--r--include/linux/usb/ch9.h17
-rw-r--r--include/linux/usb/g_printer.h4
-rw-r--r--include/linux/usb/gadget.h2
-rw-r--r--include/linux/usb/gadgetfs.h16
-rw-r--r--include/linux/usb/input.h8
-rw-r--r--include/linux/usb/iowarrior.h6
-rw-r--r--include/linux/usb/isp116x.h6
-rw-r--r--include/linux/usb/midi.h2
-rw-r--r--include/linux/usb/net2280.h9
-rw-r--r--include/linux/usb/otg.h6
-rw-r--r--include/linux/usb/quirks.h5
-rw-r--r--include/linux/usb/rndis_host.h9
-rw-r--r--include/linux/usb/serial.h21
-rw-r--r--include/linux/usb/sl811.h5
-rw-r--r--include/linux/usb/usbnet.h8
-rw-r--r--include/linux/usb_usual.h1
-rw-r--r--include/linux/usbdevice_fs.h7
-rw-r--r--include/linux/wm97xx.h314
-rw-r--r--include/linux/xfrm.h8
-rw-r--r--include/mtd/Kbuild1
-rw-r--r--include/mtd/ubi-header.h372
-rw-r--r--include/xen/balloon.h61
-rw-r--r--include/xen/events.h9
-rw-r--r--include/xen/grant_table.h7
-rw-r--r--include/xen/interface/callback.h102
-rw-r--r--include/xen/interface/grant_table.h11
-rw-r--r--include/xen/interface/io/fbif.h124
-rw-r--r--include/xen/interface/io/kbdif.h114
-rw-r--r--include/xen/interface/io/protocols.h21
-rw-r--r--include/xen/interface/memory.h12
-rw-r--r--include/xen/interface/vcpu.h5
-rw-r--r--include/xen/interface/xen.h22
-rw-r--r--include/xen/interface/xencomm.h41
-rw-r--r--include/xen/page.h181
-rw-r--r--include/xen/xen-ops.h8
-rw-r--r--include/xen/xenbus.h1
-rw-r--r--include/xen/xencomm.h77
94 files changed, 2233 insertions, 1166 deletions
diff --git a/include/asm-arm/arch-pxa/pxa3xx_nand.h b/include/asm-arm/arch-pxa/pxa3xx_nand.h
new file mode 100644
index 000000000000..81a8937486cb
--- /dev/null
+++ b/include/asm-arm/arch-pxa/pxa3xx_nand.h
@@ -0,0 +1,18 @@
1#ifndef __ASM_ARCH_PXA3XX_NAND_H
2#define __ASM_ARCH_PXA3XX_NAND_H
3
4#include <linux/mtd/mtd.h>
5#include <linux/mtd/partitions.h>
6
7struct pxa3xx_nand_platform_data {
8
9 /* the data flash bus is shared between the Static Memory
10 * Controller and the Data Flash Controller, the arbiter
11 * controls the ownership of the bus
12 */
13 int enable_arbiter;
14
15 struct mtd_partition *parts;
16 unsigned int nr_parts;
17};
18#endif /* __ASM_ARCH_PXA3XX_NAND_H */
diff --git a/include/asm-arm/plat-s3c/nand.h b/include/asm-arm/plat-s3c/nand.h
index 8816f7f9cee1..ad6bbe90616e 100644
--- a/include/asm-arm/plat-s3c/nand.h
+++ b/include/asm-arm/plat-s3c/nand.h
@@ -22,11 +22,14 @@
22*/ 22*/
23 23
24struct s3c2410_nand_set { 24struct s3c2410_nand_set {
25 unsigned int disable_ecc : 1;
26
25 int nr_chips; 27 int nr_chips;
26 int nr_partitions; 28 int nr_partitions;
27 char *name; 29 char *name;
28 int *nr_map; 30 int *nr_map;
29 struct mtd_partition *partitions; 31 struct mtd_partition *partitions;
32 struct nand_ecclayout *ecc_layout;
30}; 33};
31 34
32struct s3c2410_platform_nand { 35struct s3c2410_platform_nand {
@@ -36,6 +39,8 @@ struct s3c2410_platform_nand {
36 int twrph0; /* active time for nWE/nOE */ 39 int twrph0; /* active time for nWE/nOE */
37 int twrph1; /* time for release CLE/ALE from nWE/nOE inactive */ 40 int twrph1; /* time for release CLE/ALE from nWE/nOE inactive */
38 41
42 unsigned int ignore_unset_ecc : 1;
43
39 int nr_sets; 44 int nr_sets;
40 struct s3c2410_nand_set *sets; 45 struct s3c2410_nand_set *sets;
41 46
diff --git a/include/asm-generic/iomap.h b/include/asm-generic/iomap.h
index 67dc84cd1343..76b0cc5637f8 100644
--- a/include/asm-generic/iomap.h
+++ b/include/asm-generic/iomap.h
@@ -60,6 +60,10 @@ extern void iowrite32_rep(void __iomem *port, const void *buf, unsigned long cou
60extern void __iomem *ioport_map(unsigned long port, unsigned int nr); 60extern void __iomem *ioport_map(unsigned long port, unsigned int nr);
61extern void ioport_unmap(void __iomem *); 61extern void ioport_unmap(void __iomem *);
62 62
63#ifndef ARCH_HAS_IOREMAP_WC
64#define ioremap_wc ioremap_nocache
65#endif
66
63/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ 67/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
64struct pci_dev; 68struct pci_dev;
65extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max); 69extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
diff --git a/include/asm-powerpc/fixmap.h b/include/asm-powerpc/fixmap.h
new file mode 100644
index 000000000000..8428b38a3d30
--- /dev/null
+++ b/include/asm-powerpc/fixmap.h
@@ -0,0 +1,106 @@
1/*
2 * fixmap.h: compile-time virtual memory allocation
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) 1998 Ingo Molnar
9 *
10 * Copyright 2008 Freescale Semiconductor Inc.
11 * Port to powerpc added by Kumar Gala
12 */
13
14#ifndef _ASM_FIXMAP_H
15#define _ASM_FIXMAP_H
16
17extern unsigned long FIXADDR_TOP;
18
19#ifndef __ASSEMBLY__
20#include <linux/kernel.h>
21#include <asm/page.h>
22#ifdef CONFIG_HIGHMEM
23#include <linux/threads.h>
24#include <asm/kmap_types.h>
25#endif
26
27/*
28 * Here we define all the compile-time 'special' virtual
29 * addresses. The point is to have a constant address at
30 * compile time, but to set the physical address only
31 * in the boot process. We allocate these special addresses
32 * from the end of virtual memory (0xfffff000) backwards.
33 * Also this lets us do fail-safe vmalloc(), we
34 * can guarantee that these special addresses and
35 * vmalloc()-ed addresses never overlap.
36 *
37 * these 'compile-time allocated' memory buffers are
38 * fixed-size 4k pages. (or larger if used with an increment
39 * highger than 1) use fixmap_set(idx,phys) to associate
40 * physical memory with fixmap indices.
41 *
42 * TLB entries of such buffers will not be flushed across
43 * task switches.
44 */
45enum fixed_addresses {
46 FIX_HOLE,
47#ifdef CONFIG_HIGHMEM
48 FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */
49 FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1,
50#endif
51 /* FIX_PCIE_MCFG, */
52 __end_of_fixed_addresses
53};
54
55extern void __set_fixmap (enum fixed_addresses idx,
56 phys_addr_t phys, pgprot_t flags);
57
58#define set_fixmap(idx, phys) \
59 __set_fixmap(idx, phys, PAGE_KERNEL)
60/*
61 * Some hardware wants to get fixmapped without caching.
62 */
63#define set_fixmap_nocache(idx, phys) \
64 __set_fixmap(idx, phys, PAGE_KERNEL_NOCACHE)
65
66#define clear_fixmap(idx) \
67 __set_fixmap(idx, 0, __pgprot(0))
68
69#define __FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
70#define FIXADDR_START (FIXADDR_TOP - __FIXADDR_SIZE)
71
72#define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT))
73#define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT)
74
75extern void __this_fixmap_does_not_exist(void);
76
77/*
78 * 'index to address' translation. If anyone tries to use the idx
79 * directly without tranlation, we catch the bug with a NULL-deference
80 * kernel oops. Illegal ranges of incoming indices are caught too.
81 */
82static __always_inline unsigned long fix_to_virt(const unsigned int idx)
83{
84 /*
85 * this branch gets completely eliminated after inlining,
86 * except when someone tries to use fixaddr indices in an
87 * illegal way. (such as mixing up address types or using
88 * out-of-range indices).
89 *
90 * If it doesn't get removed, the linker will complain
91 * loudly with a reasonably clear error message..
92 */
93 if (idx >= __end_of_fixed_addresses)
94 __this_fixmap_does_not_exist();
95
96 return __fix_to_virt(idx);
97}
98
99static inline unsigned long virt_to_fix(const unsigned long vaddr)
100{
101 BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START);
102 return __virt_to_fix(vaddr);
103}
104
105#endif /* !__ASSEMBLY__ */
106#endif
diff --git a/include/asm-powerpc/highmem.h b/include/asm-powerpc/highmem.h
index f7b21ee302b4..5d99b6489d56 100644
--- a/include/asm-powerpc/highmem.h
+++ b/include/asm-powerpc/highmem.h
@@ -27,9 +27,7 @@
27#include <asm/kmap_types.h> 27#include <asm/kmap_types.h>
28#include <asm/tlbflush.h> 28#include <asm/tlbflush.h>
29#include <asm/page.h> 29#include <asm/page.h>
30 30#include <asm/fixmap.h>
31/* undef for production */
32#define HIGHMEM_DEBUG 1
33 31
34extern pte_t *kmap_pte; 32extern pte_t *kmap_pte;
35extern pgprot_t kmap_prot; 33extern pgprot_t kmap_prot;
@@ -40,14 +38,12 @@ extern pte_t *pkmap_page_table;
40 * easily, subsequent pte tables have to be allocated in one physical 38 * easily, subsequent pte tables have to be allocated in one physical
41 * chunk of RAM. 39 * chunk of RAM.
42 */ 40 */
43#define PKMAP_BASE CONFIG_HIGHMEM_START
44#define LAST_PKMAP (1 << PTE_SHIFT) 41#define LAST_PKMAP (1 << PTE_SHIFT)
45#define LAST_PKMAP_MASK (LAST_PKMAP-1) 42#define LAST_PKMAP_MASK (LAST_PKMAP-1)
43#define PKMAP_BASE ((FIXADDR_START - PAGE_SIZE*(LAST_PKMAP + 1)) & PMD_MASK)
46#define PKMAP_NR(virt) ((virt-PKMAP_BASE) >> PAGE_SHIFT) 44#define PKMAP_NR(virt) ((virt-PKMAP_BASE) >> PAGE_SHIFT)
47#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT)) 45#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT))
48 46
49#define KMAP_FIX_BEGIN (PKMAP_BASE + 0x00400000UL)
50
51extern void *kmap_high(struct page *page); 47extern void *kmap_high(struct page *page);
52extern void kunmap_high(struct page *page); 48extern void kunmap_high(struct page *page);
53 49
@@ -73,7 +69,7 @@ static inline void kunmap(struct page *page)
73 * be used in IRQ contexts, so in some (very limited) cases we need 69 * be used in IRQ contexts, so in some (very limited) cases we need
74 * it. 70 * it.
75 */ 71 */
76static inline void *kmap_atomic(struct page *page, enum km_type type) 72static inline void *kmap_atomic_prot(struct page *page, enum km_type type, pgprot_t prot)
77{ 73{
78 unsigned int idx; 74 unsigned int idx;
79 unsigned long vaddr; 75 unsigned long vaddr;
@@ -84,34 +80,39 @@ static inline void *kmap_atomic(struct page *page, enum km_type type)
84 return page_address(page); 80 return page_address(page);
85 81
86 idx = type + KM_TYPE_NR*smp_processor_id(); 82 idx = type + KM_TYPE_NR*smp_processor_id();
87 vaddr = KMAP_FIX_BEGIN + idx * PAGE_SIZE; 83 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
88#ifdef HIGHMEM_DEBUG 84#ifdef CONFIG_DEBUG_HIGHMEM
89 BUG_ON(!pte_none(*(kmap_pte+idx))); 85 BUG_ON(!pte_none(*(kmap_pte-idx)));
90#endif 86#endif
91 set_pte_at(&init_mm, vaddr, kmap_pte+idx, mk_pte(page, kmap_prot)); 87 set_pte_at(&init_mm, vaddr, kmap_pte-idx, mk_pte(page, prot));
92 flush_tlb_page(NULL, vaddr); 88 flush_tlb_page(NULL, vaddr);
93 89
94 return (void*) vaddr; 90 return (void*) vaddr;
95} 91}
96 92
93static inline void *kmap_atomic(struct page *page, enum km_type type)
94{
95 return kmap_atomic_prot(page, type, kmap_prot);
96}
97
97static inline void kunmap_atomic(void *kvaddr, enum km_type type) 98static inline void kunmap_atomic(void *kvaddr, enum km_type type)
98{ 99{
99#ifdef HIGHMEM_DEBUG 100#ifdef CONFIG_DEBUG_HIGHMEM
100 unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK; 101 unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK;
101 unsigned int idx = type + KM_TYPE_NR*smp_processor_id(); 102 enum fixed_addresses idx = type + KM_TYPE_NR*smp_processor_id();
102 103
103 if (vaddr < KMAP_FIX_BEGIN) { // FIXME 104 if (vaddr < __fix_to_virt(FIX_KMAP_END)) {
104 pagefault_enable(); 105 pagefault_enable();
105 return; 106 return;
106 } 107 }
107 108
108 BUG_ON(vaddr != KMAP_FIX_BEGIN + idx * PAGE_SIZE); 109 BUG_ON(vaddr != __fix_to_virt(FIX_KMAP_BEGIN + idx));
109 110
110 /* 111 /*
111 * force other mappings to Oops if they'll try to access 112 * force other mappings to Oops if they'll try to access
112 * this pte without first remap it 113 * this pte without first remap it
113 */ 114 */
114 pte_clear(&init_mm, vaddr, kmap_pte+idx); 115 pte_clear(&init_mm, vaddr, kmap_pte-idx);
115 flush_tlb_page(NULL, vaddr); 116 flush_tlb_page(NULL, vaddr);
116#endif 117#endif
117 pagefault_enable(); 118 pagefault_enable();
@@ -120,12 +121,14 @@ static inline void kunmap_atomic(void *kvaddr, enum km_type type)
120static inline struct page *kmap_atomic_to_page(void *ptr) 121static inline struct page *kmap_atomic_to_page(void *ptr)
121{ 122{
122 unsigned long idx, vaddr = (unsigned long) ptr; 123 unsigned long idx, vaddr = (unsigned long) ptr;
124 pte_t *pte;
123 125
124 if (vaddr < KMAP_FIX_BEGIN) 126 if (vaddr < FIXADDR_START)
125 return virt_to_page(ptr); 127 return virt_to_page(ptr);
126 128
127 idx = (vaddr - KMAP_FIX_BEGIN) >> PAGE_SHIFT; 129 idx = virt_to_fix(vaddr);
128 return pte_page(kmap_pte[idx]); 130 pte = kmap_pte - (idx - FIX_KMAP_BEGIN);
131 return pte_page(*pte);
129} 132}
130 133
131#define flush_cache_kmaps() flush_cache_all() 134#define flush_cache_kmaps() flush_cache_all()
diff --git a/include/asm-powerpc/io-defs.h b/include/asm-powerpc/io-defs.h
index 03691ab69217..44d7927aec69 100644
--- a/include/asm-powerpc/io-defs.h
+++ b/include/asm-powerpc/io-defs.h
@@ -1,59 +1,60 @@
1/* This file is meant to be include multiple times by other headers */ 1/* This file is meant to be include multiple times by other headers */
2/* last 2 argments are used by platforms/cell/io-workarounds.[ch] */
2 3
3DEF_PCI_AC_RET(readb, u8, (const PCI_IO_ADDR addr), (addr)) 4DEF_PCI_AC_RET(readb, u8, (const PCI_IO_ADDR addr), (addr), mem, addr)
4DEF_PCI_AC_RET(readw, u16, (const PCI_IO_ADDR addr), (addr)) 5DEF_PCI_AC_RET(readw, u16, (const PCI_IO_ADDR addr), (addr), mem, addr)
5DEF_PCI_AC_RET(readl, u32, (const PCI_IO_ADDR addr), (addr)) 6DEF_PCI_AC_RET(readl, u32, (const PCI_IO_ADDR addr), (addr), mem, addr)
6DEF_PCI_AC_RET(readw_be, u16, (const PCI_IO_ADDR addr), (addr)) 7DEF_PCI_AC_RET(readw_be, u16, (const PCI_IO_ADDR addr), (addr), mem, addr)
7DEF_PCI_AC_RET(readl_be, u32, (const PCI_IO_ADDR addr), (addr)) 8DEF_PCI_AC_RET(readl_be, u32, (const PCI_IO_ADDR addr), (addr), mem, addr)
8DEF_PCI_AC_NORET(writeb, (u8 val, PCI_IO_ADDR addr), (val, addr)) 9DEF_PCI_AC_NORET(writeb, (u8 val, PCI_IO_ADDR addr), (val, addr), mem, addr)
9DEF_PCI_AC_NORET(writew, (u16 val, PCI_IO_ADDR addr), (val, addr)) 10DEF_PCI_AC_NORET(writew, (u16 val, PCI_IO_ADDR addr), (val, addr), mem, addr)
10DEF_PCI_AC_NORET(writel, (u32 val, PCI_IO_ADDR addr), (val, addr)) 11DEF_PCI_AC_NORET(writel, (u32 val, PCI_IO_ADDR addr), (val, addr), mem, addr)
11DEF_PCI_AC_NORET(writew_be, (u16 val, PCI_IO_ADDR addr), (val, addr)) 12DEF_PCI_AC_NORET(writew_be, (u16 val, PCI_IO_ADDR addr), (val, addr), mem, addr)
12DEF_PCI_AC_NORET(writel_be, (u32 val, PCI_IO_ADDR addr), (val, addr)) 13DEF_PCI_AC_NORET(writel_be, (u32 val, PCI_IO_ADDR addr), (val, addr), mem, addr)
13 14
14#ifdef __powerpc64__ 15#ifdef __powerpc64__
15DEF_PCI_AC_RET(readq, u64, (const PCI_IO_ADDR addr), (addr)) 16DEF_PCI_AC_RET(readq, u64, (const PCI_IO_ADDR addr), (addr), mem, addr)
16DEF_PCI_AC_RET(readq_be, u64, (const PCI_IO_ADDR addr), (addr)) 17DEF_PCI_AC_RET(readq_be, u64, (const PCI_IO_ADDR addr), (addr), mem, addr)
17DEF_PCI_AC_NORET(writeq, (u64 val, PCI_IO_ADDR addr), (val, addr)) 18DEF_PCI_AC_NORET(writeq, (u64 val, PCI_IO_ADDR addr), (val, addr), mem, addr)
18DEF_PCI_AC_NORET(writeq_be, (u64 val, PCI_IO_ADDR addr), (val, addr)) 19DEF_PCI_AC_NORET(writeq_be, (u64 val, PCI_IO_ADDR addr), (val, addr), mem, addr)
19#endif /* __powerpc64__ */ 20#endif /* __powerpc64__ */
20 21
21DEF_PCI_AC_RET(inb, u8, (unsigned long port), (port)) 22DEF_PCI_AC_RET(inb, u8, (unsigned long port), (port), pio, port)
22DEF_PCI_AC_RET(inw, u16, (unsigned long port), (port)) 23DEF_PCI_AC_RET(inw, u16, (unsigned long port), (port), pio, port)
23DEF_PCI_AC_RET(inl, u32, (unsigned long port), (port)) 24DEF_PCI_AC_RET(inl, u32, (unsigned long port), (port), pio, port)
24DEF_PCI_AC_NORET(outb, (u8 val, unsigned long port), (val, port)) 25DEF_PCI_AC_NORET(outb, (u8 val, unsigned long port), (val, port), pio, port)
25DEF_PCI_AC_NORET(outw, (u16 val, unsigned long port), (val, port)) 26DEF_PCI_AC_NORET(outw, (u16 val, unsigned long port), (val, port), pio, port)
26DEF_PCI_AC_NORET(outl, (u32 val, unsigned long port), (val, port)) 27DEF_PCI_AC_NORET(outl, (u32 val, unsigned long port), (val, port), pio, port)
27 28
28DEF_PCI_AC_NORET(readsb, (const PCI_IO_ADDR a, void *b, unsigned long c), \ 29DEF_PCI_AC_NORET(readsb, (const PCI_IO_ADDR a, void *b, unsigned long c),
29 (a, b, c)) 30 (a, b, c), mem, a)
30DEF_PCI_AC_NORET(readsw, (const PCI_IO_ADDR a, void *b, unsigned long c), \ 31DEF_PCI_AC_NORET(readsw, (const PCI_IO_ADDR a, void *b, unsigned long c),
31 (a, b, c)) 32 (a, b, c), mem, a)
32DEF_PCI_AC_NORET(readsl, (const PCI_IO_ADDR a, void *b, unsigned long c), \ 33DEF_PCI_AC_NORET(readsl, (const PCI_IO_ADDR a, void *b, unsigned long c),
33 (a, b, c)) 34 (a, b, c), mem, a)
34DEF_PCI_AC_NORET(writesb, (PCI_IO_ADDR a, const void *b, unsigned long c), \ 35DEF_PCI_AC_NORET(writesb, (PCI_IO_ADDR a, const void *b, unsigned long c),
35 (a, b, c)) 36 (a, b, c), mem, a)
36DEF_PCI_AC_NORET(writesw, (PCI_IO_ADDR a, const void *b, unsigned long c), \ 37DEF_PCI_AC_NORET(writesw, (PCI_IO_ADDR a, const void *b, unsigned long c),
37 (a, b, c)) 38 (a, b, c), mem, a)
38DEF_PCI_AC_NORET(writesl, (PCI_IO_ADDR a, const void *b, unsigned long c), \ 39DEF_PCI_AC_NORET(writesl, (PCI_IO_ADDR a, const void *b, unsigned long c),
39 (a, b, c)) 40 (a, b, c), mem, a)
40 41
41DEF_PCI_AC_NORET(insb, (unsigned long p, void *b, unsigned long c), \ 42DEF_PCI_AC_NORET(insb, (unsigned long p, void *b, unsigned long c),
42 (p, b, c)) 43 (p, b, c), pio, p)
43DEF_PCI_AC_NORET(insw, (unsigned long p, void *b, unsigned long c), \ 44DEF_PCI_AC_NORET(insw, (unsigned long p, void *b, unsigned long c),
44 (p, b, c)) 45 (p, b, c), pio, p)
45DEF_PCI_AC_NORET(insl, (unsigned long p, void *b, unsigned long c), \ 46DEF_PCI_AC_NORET(insl, (unsigned long p, void *b, unsigned long c),
46 (p, b, c)) 47 (p, b, c), pio, p)
47DEF_PCI_AC_NORET(outsb, (unsigned long p, const void *b, unsigned long c), \ 48DEF_PCI_AC_NORET(outsb, (unsigned long p, const void *b, unsigned long c),
48 (p, b, c)) 49 (p, b, c), pio, p)
49DEF_PCI_AC_NORET(outsw, (unsigned long p, const void *b, unsigned long c), \ 50DEF_PCI_AC_NORET(outsw, (unsigned long p, const void *b, unsigned long c),
50 (p, b, c)) 51 (p, b, c), pio, p)
51DEF_PCI_AC_NORET(outsl, (unsigned long p, const void *b, unsigned long c), \ 52DEF_PCI_AC_NORET(outsl, (unsigned long p, const void *b, unsigned long c),
52 (p, b, c)) 53 (p, b, c), pio, p)
53 54
54DEF_PCI_AC_NORET(memset_io, (PCI_IO_ADDR a, int c, unsigned long n), \ 55DEF_PCI_AC_NORET(memset_io, (PCI_IO_ADDR a, int c, unsigned long n),
55 (a, c, n)) 56 (a, c, n), mem, a)
56DEF_PCI_AC_NORET(memcpy_fromio,(void *d,const PCI_IO_ADDR s,unsigned long n), \ 57DEF_PCI_AC_NORET(memcpy_fromio, (void *d, const PCI_IO_ADDR s, unsigned long n),
57 (d, s, n)) 58 (d, s, n), mem, s)
58DEF_PCI_AC_NORET(memcpy_toio,(PCI_IO_ADDR d,const void *s,unsigned long n), \ 59DEF_PCI_AC_NORET(memcpy_toio, (PCI_IO_ADDR d, const void *s, unsigned long n),
59 (d, s, n)) 60 (d, s, n), mem, d)
diff --git a/include/asm-powerpc/io.h b/include/asm-powerpc/io.h
index 7be26f615755..afae0697e8ce 100644
--- a/include/asm-powerpc/io.h
+++ b/include/asm-powerpc/io.h
@@ -458,8 +458,8 @@ __do_out_asm(_rec_outl, "stwbrx")
458/* Structure containing all the hooks */ 458/* Structure containing all the hooks */
459extern struct ppc_pci_io { 459extern struct ppc_pci_io {
460 460
461#define DEF_PCI_AC_RET(name, ret, at, al) ret (*name) at; 461#define DEF_PCI_AC_RET(name, ret, at, al, space, aa) ret (*name) at;
462#define DEF_PCI_AC_NORET(name, at, al) void (*name) at; 462#define DEF_PCI_AC_NORET(name, at, al, space, aa) void (*name) at;
463 463
464#include <asm/io-defs.h> 464#include <asm/io-defs.h>
465 465
@@ -469,7 +469,7 @@ extern struct ppc_pci_io {
469} ppc_pci_io; 469} ppc_pci_io;
470 470
471/* The inline wrappers */ 471/* The inline wrappers */
472#define DEF_PCI_AC_RET(name, ret, at, al) \ 472#define DEF_PCI_AC_RET(name, ret, at, al, space, aa) \
473static inline ret name at \ 473static inline ret name at \
474{ \ 474{ \
475 if (DEF_PCI_HOOK(ppc_pci_io.name) != NULL) \ 475 if (DEF_PCI_HOOK(ppc_pci_io.name) != NULL) \
@@ -477,7 +477,7 @@ static inline ret name at \
477 return __do_##name al; \ 477 return __do_##name al; \
478} 478}
479 479
480#define DEF_PCI_AC_NORET(name, at, al) \ 480#define DEF_PCI_AC_NORET(name, at, al, space, aa) \
481static inline void name at \ 481static inline void name at \
482{ \ 482{ \
483 if (DEF_PCI_HOOK(ppc_pci_io.name) != NULL) \ 483 if (DEF_PCI_HOOK(ppc_pci_io.name) != NULL) \
diff --git a/include/asm-powerpc/kdump.h b/include/asm-powerpc/kdump.h
index 10e8eb1e6f4f..f6c93c716898 100644
--- a/include/asm-powerpc/kdump.h
+++ b/include/asm-powerpc/kdump.h
@@ -11,16 +11,11 @@
11 11
12#ifdef CONFIG_CRASH_DUMP 12#ifdef CONFIG_CRASH_DUMP
13 13
14#define PHYSICAL_START KDUMP_KERNELBASE
15#define KDUMP_TRAMPOLINE_START 0x0100 14#define KDUMP_TRAMPOLINE_START 0x0100
16#define KDUMP_TRAMPOLINE_END 0x3000 15#define KDUMP_TRAMPOLINE_END 0x3000
17 16
18#define KDUMP_MIN_TCE_ENTRIES 2048 17#define KDUMP_MIN_TCE_ENTRIES 2048
19 18
20#else /* !CONFIG_CRASH_DUMP */
21
22#define PHYSICAL_START 0x0
23
24#endif /* CONFIG_CRASH_DUMP */ 19#endif /* CONFIG_CRASH_DUMP */
25 20
26#ifndef __ASSEMBLY__ 21#ifndef __ASSEMBLY__
diff --git a/include/asm-powerpc/paca.h b/include/asm-powerpc/paca.h
index eb61b9c1edfd..7b564444ff61 100644
--- a/include/asm-powerpc/paca.h
+++ b/include/asm-powerpc/paca.h
@@ -108,6 +108,7 @@ struct paca_struct {
108}; 108};
109 109
110extern struct paca_struct paca[]; 110extern struct paca_struct paca[];
111extern void initialise_pacas(void);
111 112
112#endif /* __KERNEL__ */ 113#endif /* __KERNEL__ */
113#endif /* _ASM_POWERPC_PACA_H */ 114#endif /* _ASM_POWERPC_PACA_H */
diff --git a/include/asm-powerpc/page.h b/include/asm-powerpc/page.h
index 6c850609b847..cffdf0eb0df6 100644
--- a/include/asm-powerpc/page.h
+++ b/include/asm-powerpc/page.h
@@ -12,6 +12,7 @@
12 12
13#include <asm/asm-compat.h> 13#include <asm/asm-compat.h>
14#include <asm/kdump.h> 14#include <asm/kdump.h>
15#include <asm/types.h>
15 16
16/* 17/*
17 * On PPC32 page size is 4K. For PPC64 we support either 4K or 64K software 18 * On PPC32 page size is 4K. For PPC64 we support either 4K or 64K software
@@ -42,8 +43,23 @@
42 * 43 *
43 * The kdump dump kernel is one example where KERNELBASE != PAGE_OFFSET. 44 * The kdump dump kernel is one example where KERNELBASE != PAGE_OFFSET.
44 * 45 *
45 * To get a physical address from a virtual one you subtract PAGE_OFFSET, 46 * PAGE_OFFSET is the virtual address of the start of lowmem.
46 * _not_ KERNELBASE. 47 *
48 * PHYSICAL_START is the physical address of the start of the kernel.
49 *
50 * MEMORY_START is the physical address of the start of lowmem.
51 *
52 * KERNELBASE, PAGE_OFFSET, and PHYSICAL_START are all configurable on
53 * ppc32 and based on how they are set we determine MEMORY_START.
54 *
55 * For the linear mapping the following equation should be true:
56 * KERNELBASE - PAGE_OFFSET = PHYSICAL_START - MEMORY_START
57 *
58 * Also, KERNELBASE >= PAGE_OFFSET and PHYSICAL_START >= MEMORY_START
59 *
60 * There are two was to determine a physical address from a virtual one:
61 * va = pa + PAGE_OFFSET - MEMORY_START
62 * va = pa + KERNELBASE - PHYSICAL_START
47 * 63 *
48 * If you want to know something's offset from the start of the kernel you 64 * If you want to know something's offset from the start of the kernel you
49 * should subtract KERNELBASE. 65 * should subtract KERNELBASE.
@@ -51,20 +67,33 @@
51 * If you want to test if something's a kernel address, use is_kernel_addr(). 67 * If you want to test if something's a kernel address, use is_kernel_addr().
52 */ 68 */
53 69
54#define PAGE_OFFSET ASM_CONST(CONFIG_KERNEL_START) 70#define KERNELBASE ASM_CONST(CONFIG_KERNEL_START)
55#define KERNELBASE (PAGE_OFFSET + PHYSICAL_START) 71#define PAGE_OFFSET ASM_CONST(CONFIG_PAGE_OFFSET)
56#define LOAD_OFFSET PAGE_OFFSET 72#define LOAD_OFFSET ASM_CONST((CONFIG_KERNEL_START-CONFIG_PHYSICAL_START))
73
74#if defined(CONFIG_RELOCATABLE) && defined(CONFIG_FLATMEM)
75#ifndef __ASSEMBLY__
76extern phys_addr_t memstart_addr;
77extern phys_addr_t kernstart_addr;
78#endif
79#define PHYSICAL_START kernstart_addr
80#define MEMORY_START memstart_addr
81#else
82#define PHYSICAL_START ASM_CONST(CONFIG_PHYSICAL_START)
83#define MEMORY_START (PHYSICAL_START + PAGE_OFFSET - KERNELBASE)
84#endif
57 85
58#ifdef CONFIG_FLATMEM 86#ifdef CONFIG_FLATMEM
59#define pfn_valid(pfn) ((pfn) < max_mapnr) 87#define ARCH_PFN_OFFSET (MEMORY_START >> PAGE_SHIFT)
88#define pfn_valid(pfn) ((pfn) >= ARCH_PFN_OFFSET && (pfn) < (ARCH_PFN_OFFSET + max_mapnr))
60#endif 89#endif
61 90
62#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) 91#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
63#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) 92#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
64#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) 93#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
65 94
66#define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET)) 95#define __va(x) ((void *)((unsigned long)(x) - PHYSICAL_START + KERNELBASE))
67#define __pa(x) ((unsigned long)(x) - PAGE_OFFSET) 96#define __pa(x) ((unsigned long)(x) + PHYSICAL_START - KERNELBASE)
68 97
69/* 98/*
70 * Unfortunately the PLT is in the BSS in the PPC32 ELF ABI, 99 * Unfortunately the PLT is in the BSS in the PPC32 ELF ABI,
diff --git a/include/asm-powerpc/page_32.h b/include/asm-powerpc/page_32.h
index 51f8134b5939..ebfae530a379 100644
--- a/include/asm-powerpc/page_32.h
+++ b/include/asm-powerpc/page_32.h
@@ -1,6 +1,12 @@
1#ifndef _ASM_POWERPC_PAGE_32_H 1#ifndef _ASM_POWERPC_PAGE_32_H
2#define _ASM_POWERPC_PAGE_32_H 2#define _ASM_POWERPC_PAGE_32_H
3 3
4#if defined(CONFIG_PHYSICAL_ALIGN) && (CONFIG_PHYSICAL_START != 0)
5#if (CONFIG_PHYSICAL_START % CONFIG_PHYSICAL_ALIGN) != 0
6#error "CONFIG_PHYSICAL_START must be a multiple of CONFIG_PHYSICAL_ALIGN"
7#endif
8#endif
9
4#define VM_DATA_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS32 10#define VM_DATA_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS32
5 11
6#ifdef CONFIG_NOT_COHERENT_CACHE 12#ifdef CONFIG_NOT_COHERENT_CACHE
diff --git a/include/asm-powerpc/thread_info.h b/include/asm-powerpc/thread_info.h
index 40d5f98c44fc..d030f5ce39ad 100644
--- a/include/asm-powerpc/thread_info.h
+++ b/include/asm-powerpc/thread_info.h
@@ -80,12 +80,8 @@ struct thread_info {
80 80
81#else /* THREAD_SHIFT < PAGE_SHIFT */ 81#else /* THREAD_SHIFT < PAGE_SHIFT */
82 82
83#ifdef CONFIG_DEBUG_STACK_USAGE 83extern struct thread_info *alloc_thread_info(struct task_struct *tsk);
84#define alloc_thread_info(tsk) kzalloc(THREAD_SIZE, GFP_KERNEL) 84extern void free_thread_info(struct thread_info *ti);
85#else
86#define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, GFP_KERNEL)
87#endif
88#define free_thread_info(ti) kfree(ti)
89 85
90#endif /* THREAD_SHIFT < PAGE_SHIFT */ 86#endif /* THREAD_SHIFT < PAGE_SHIFT */
91 87
diff --git a/include/asm-ppc/mmu.h b/include/asm-ppc/mmu.h
index d46b57b589ae..d76ef098ed37 100644
--- a/include/asm-ppc/mmu.h
+++ b/include/asm-ppc/mmu.h
@@ -15,10 +15,8 @@
15 * physical need a larger than native word size type. -Matt 15 * physical need a larger than native word size type. -Matt
16 */ 16 */
17#ifndef CONFIG_PHYS_64BIT 17#ifndef CONFIG_PHYS_64BIT
18typedef unsigned long phys_addr_t;
19#define PHYS_FMT "%.8lx" 18#define PHYS_FMT "%.8lx"
20#else 19#else
21typedef unsigned long long phys_addr_t;
22extern phys_addr_t fixup_bigphys_addr(phys_addr_t, phys_addr_t); 20extern phys_addr_t fixup_bigphys_addr(phys_addr_t, phys_addr_t);
23#define PHYS_FMT "%16Lx" 21#define PHYS_FMT "%16Lx"
24#endif 22#endif
diff --git a/include/asm-ppc/mpc8260.h b/include/asm-ppc/mpc8260.h
index 23579d4afae7..402ba15c2e80 100644
--- a/include/asm-ppc/mpc8260.h
+++ b/include/asm-ppc/mpc8260.h
@@ -35,10 +35,6 @@
35#include <platforms/tqm8260.h> 35#include <platforms/tqm8260.h>
36#endif 36#endif
37 37
38#if defined(CONFIG_PQ2ADS) || defined (CONFIG_PQ2FADS)
39#include <platforms/pq2ads.h>
40#endif
41
42#ifdef CONFIG_PCI_8260 38#ifdef CONFIG_PCI_8260
43#include <syslib/m82xx_pci.h> 39#include <syslib/m82xx_pci.h>
44#endif 40#endif
diff --git a/include/asm-ppc/mpc8xx.h b/include/asm-ppc/mpc8xx.h
index d3a2f2fe230c..b9e3060b0278 100644
--- a/include/asm-ppc/mpc8xx.h
+++ b/include/asm-ppc/mpc8xx.h
@@ -63,10 +63,6 @@
63#include <platforms/lantec.h> 63#include <platforms/lantec.h>
64#endif 64#endif
65 65
66#if defined(CONFIG_MPC885ADS)
67#include <platforms/mpc885ads.h>
68#endif
69
70/* Currently, all 8xx boards that support a processor to PCI/ISA bridge 66/* Currently, all 8xx boards that support a processor to PCI/ISA bridge
71 * use the same memory map. 67 * use the same memory map.
72 */ 68 */
diff --git a/include/asm-x86/fixmap.h b/include/asm-x86/fixmap.h
index 382eb271a892..5bd206973dca 100644
--- a/include/asm-x86/fixmap.h
+++ b/include/asm-x86/fixmap.h
@@ -1,5 +1,13 @@
1#ifndef _ASM_FIXMAP_H
2#define _ASM_FIXMAP_H
3
1#ifdef CONFIG_X86_32 4#ifdef CONFIG_X86_32
2# include "fixmap_32.h" 5# include "fixmap_32.h"
3#else 6#else
4# include "fixmap_64.h" 7# include "fixmap_64.h"
5#endif 8#endif
9
10#define clear_fixmap(idx) \
11 __set_fixmap(idx, 0, __pgprot(0))
12
13#endif
diff --git a/include/asm-x86/fixmap_32.h b/include/asm-x86/fixmap_32.h
index eb1665125c44..4b96148e90c1 100644
--- a/include/asm-x86/fixmap_32.h
+++ b/include/asm-x86/fixmap_32.h
@@ -10,8 +10,8 @@
10 * Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999 10 * Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999
11 */ 11 */
12 12
13#ifndef _ASM_FIXMAP_H 13#ifndef _ASM_FIXMAP_32_H
14#define _ASM_FIXMAP_H 14#define _ASM_FIXMAP_32_H
15 15
16 16
17/* used by vmalloc.c, vsyscall.lds.S. 17/* used by vmalloc.c, vsyscall.lds.S.
@@ -121,9 +121,6 @@ extern void reserve_top_address(unsigned long reserve);
121#define set_fixmap_nocache(idx, phys) \ 121#define set_fixmap_nocache(idx, phys) \
122 __set_fixmap(idx, phys, PAGE_KERNEL_NOCACHE) 122 __set_fixmap(idx, phys, PAGE_KERNEL_NOCACHE)
123 123
124#define clear_fixmap(idx) \
125 __set_fixmap(idx, 0, __pgprot(0))
126
127#define FIXADDR_TOP ((unsigned long)__FIXADDR_TOP) 124#define FIXADDR_TOP ((unsigned long)__FIXADDR_TOP)
128 125
129#define __FIXADDR_SIZE (__end_of_permanent_fixed_addresses << PAGE_SHIFT) 126#define __FIXADDR_SIZE (__end_of_permanent_fixed_addresses << PAGE_SHIFT)
diff --git a/include/asm-x86/fixmap_64.h b/include/asm-x86/fixmap_64.h
index f3d76858c0e6..355d26a75a82 100644
--- a/include/asm-x86/fixmap_64.h
+++ b/include/asm-x86/fixmap_64.h
@@ -8,8 +8,8 @@
8 * Copyright (C) 1998 Ingo Molnar 8 * Copyright (C) 1998 Ingo Molnar
9 */ 9 */
10 10
11#ifndef _ASM_FIXMAP_H 11#ifndef _ASM_FIXMAP_64_H
12#define _ASM_FIXMAP_H 12#define _ASM_FIXMAP_64_H
13 13
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <asm/apicdef.h> 15#include <asm/apicdef.h>
diff --git a/include/asm-x86/io.h b/include/asm-x86/io.h
index 7b292d386713..d5b11f60dbd0 100644
--- a/include/asm-x86/io.h
+++ b/include/asm-x86/io.h
@@ -1,3 +1,6 @@
1#ifndef _ASM_X86_IO_H
2#define _ASM_X86_IO_H
3
1#define ARCH_HAS_IOREMAP_WC 4#define ARCH_HAS_IOREMAP_WC
2 5
3#ifdef CONFIG_X86_32 6#ifdef CONFIG_X86_32
@@ -5,7 +8,12 @@
5#else 8#else
6# include "io_64.h" 9# include "io_64.h"
7#endif 10#endif
11
12extern void *xlate_dev_mem_ptr(unsigned long phys);
13extern void unxlate_dev_mem_ptr(unsigned long phys, void *addr);
14
8extern int ioremap_change_attr(unsigned long vaddr, unsigned long size, 15extern int ioremap_change_attr(unsigned long vaddr, unsigned long size,
9 unsigned long prot_val); 16 unsigned long prot_val);
10extern void __iomem *ioremap_wc(unsigned long offset, unsigned long size); 17extern void __iomem *ioremap_wc(unsigned long offset, unsigned long size);
11 18
19#endif /* _ASM_X86_IO_H */
diff --git a/include/asm-x86/io_32.h b/include/asm-x86/io_32.h
index 509045f5fda2..6e73467a4fb1 100644
--- a/include/asm-x86/io_32.h
+++ b/include/asm-x86/io_32.h
@@ -49,12 +49,6 @@
49#include <linux/vmalloc.h> 49#include <linux/vmalloc.h>
50 50
51/* 51/*
52 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
53 * access
54 */
55#define xlate_dev_mem_ptr(p) __va(p)
56
57/*
58 * Convert a virtual cached pointer to an uncached pointer 52 * Convert a virtual cached pointer to an uncached pointer
59 */ 53 */
60#define xlate_dev_kmem_ptr(p) p 54#define xlate_dev_kmem_ptr(p) p
diff --git a/include/asm-x86/io_64.h b/include/asm-x86/io_64.h
index c2f5eef47b88..0930bedf9e4d 100644
--- a/include/asm-x86/io_64.h
+++ b/include/asm-x86/io_64.h
@@ -308,12 +308,6 @@ extern int iommu_bio_merge;
308#define BIO_VMERGE_BOUNDARY iommu_bio_merge 308#define BIO_VMERGE_BOUNDARY iommu_bio_merge
309 309
310/* 310/*
311 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
312 * access
313 */
314#define xlate_dev_mem_ptr(p) __va(p)
315
316/*
317 * Convert a virtual cached pointer to an uncached pointer 311 * Convert a virtual cached pointer to an uncached pointer
318 */ 312 */
319#define xlate_dev_kmem_ptr(p) p 313#define xlate_dev_kmem_ptr(p) p
diff --git a/include/asm-x86/page.h b/include/asm-x86/page.h
index 6724a4bc6b7a..b381f4a5a0bd 100644
--- a/include/asm-x86/page.h
+++ b/include/asm-x86/page.h
@@ -47,6 +47,7 @@
47#ifndef __ASSEMBLY__ 47#ifndef __ASSEMBLY__
48 48
49extern int page_is_ram(unsigned long pagenr); 49extern int page_is_ram(unsigned long pagenr);
50extern int devmem_is_allowed(unsigned long pagenr);
50 51
51extern unsigned long max_pfn_mapped; 52extern unsigned long max_pfn_mapped;
52 53
diff --git a/include/asm-x86/paravirt.h b/include/asm-x86/paravirt.h
index 3d419398499b..0f13b945e240 100644
--- a/include/asm-x86/paravirt.h
+++ b/include/asm-x86/paravirt.h
@@ -220,11 +220,13 @@ struct pv_mmu_ops {
220 unsigned long va); 220 unsigned long va);
221 221
222 /* Hooks for allocating/releasing pagetable pages */ 222 /* Hooks for allocating/releasing pagetable pages */
223 void (*alloc_pt)(struct mm_struct *mm, u32 pfn); 223 void (*alloc_pte)(struct mm_struct *mm, u32 pfn);
224 void (*alloc_pd)(struct mm_struct *mm, u32 pfn); 224 void (*alloc_pmd)(struct mm_struct *mm, u32 pfn);
225 void (*alloc_pd_clone)(u32 pfn, u32 clonepfn, u32 start, u32 count); 225 void (*alloc_pmd_clone)(u32 pfn, u32 clonepfn, u32 start, u32 count);
226 void (*release_pt)(u32 pfn); 226 void (*alloc_pud)(struct mm_struct *mm, u32 pfn);
227 void (*release_pd)(u32 pfn); 227 void (*release_pte)(u32 pfn);
228 void (*release_pmd)(u32 pfn);
229 void (*release_pud)(u32 pfn);
228 230
229 /* Pagetable manipulation functions */ 231 /* Pagetable manipulation functions */
230 void (*set_pte)(pte_t *ptep, pte_t pteval); 232 void (*set_pte)(pte_t *ptep, pte_t pteval);
@@ -910,28 +912,37 @@ static inline void flush_tlb_others(cpumask_t cpumask, struct mm_struct *mm,
910 PVOP_VCALL3(pv_mmu_ops.flush_tlb_others, &cpumask, mm, va); 912 PVOP_VCALL3(pv_mmu_ops.flush_tlb_others, &cpumask, mm, va);
911} 913}
912 914
913static inline void paravirt_alloc_pt(struct mm_struct *mm, unsigned pfn) 915static inline void paravirt_alloc_pte(struct mm_struct *mm, unsigned pfn)
914{ 916{
915 PVOP_VCALL2(pv_mmu_ops.alloc_pt, mm, pfn); 917 PVOP_VCALL2(pv_mmu_ops.alloc_pte, mm, pfn);
916} 918}
917static inline void paravirt_release_pt(unsigned pfn) 919static inline void paravirt_release_pte(unsigned pfn)
918{ 920{
919 PVOP_VCALL1(pv_mmu_ops.release_pt, pfn); 921 PVOP_VCALL1(pv_mmu_ops.release_pte, pfn);
920} 922}
921 923
922static inline void paravirt_alloc_pd(struct mm_struct *mm, unsigned pfn) 924static inline void paravirt_alloc_pmd(struct mm_struct *mm, unsigned pfn)
923{ 925{
924 PVOP_VCALL2(pv_mmu_ops.alloc_pd, mm, pfn); 926 PVOP_VCALL2(pv_mmu_ops.alloc_pmd, mm, pfn);
925} 927}
926 928
927static inline void paravirt_alloc_pd_clone(unsigned pfn, unsigned clonepfn, 929static inline void paravirt_alloc_pmd_clone(unsigned pfn, unsigned clonepfn,
928 unsigned start, unsigned count) 930 unsigned start, unsigned count)
929{ 931{
930 PVOP_VCALL4(pv_mmu_ops.alloc_pd_clone, pfn, clonepfn, start, count); 932 PVOP_VCALL4(pv_mmu_ops.alloc_pmd_clone, pfn, clonepfn, start, count);
931} 933}
932static inline void paravirt_release_pd(unsigned pfn) 934static inline void paravirt_release_pmd(unsigned pfn)
933{ 935{
934 PVOP_VCALL1(pv_mmu_ops.release_pd, pfn); 936 PVOP_VCALL1(pv_mmu_ops.release_pmd, pfn);
937}
938
939static inline void paravirt_alloc_pud(struct mm_struct *mm, unsigned pfn)
940{
941 PVOP_VCALL2(pv_mmu_ops.alloc_pud, mm, pfn);
942}
943static inline void paravirt_release_pud(unsigned pfn)
944{
945 PVOP_VCALL1(pv_mmu_ops.release_pud, pfn);
935} 946}
936 947
937#ifdef CONFIG_HIGHPTE 948#ifdef CONFIG_HIGHPTE
diff --git a/include/asm-x86/pgalloc.h b/include/asm-x86/pgalloc.h
index 5886eed05886..91e4641f3f31 100644
--- a/include/asm-x86/pgalloc.h
+++ b/include/asm-x86/pgalloc.h
@@ -1,5 +1,110 @@
1#ifdef CONFIG_X86_32 1#ifndef _ASM_X86_PGALLOC_H
2# include "pgalloc_32.h" 2#define _ASM_X86_PGALLOC_H
3
4#include <linux/threads.h>
5#include <linux/mm.h> /* for struct page */
6#include <linux/pagemap.h>
7
8#ifdef CONFIG_PARAVIRT
9#include <asm/paravirt.h>
3#else 10#else
4# include "pgalloc_64.h" 11static inline void paravirt_alloc_pte(struct mm_struct *mm, unsigned long pfn) {}
12static inline void paravirt_alloc_pmd(struct mm_struct *mm, unsigned long pfn) {}
13static inline void paravirt_alloc_pmd_clone(unsigned long pfn, unsigned long clonepfn,
14 unsigned long start, unsigned long count) {}
15static inline void paravirt_alloc_pud(struct mm_struct *mm, unsigned long pfn) {}
16static inline void paravirt_release_pte(unsigned long pfn) {}
17static inline void paravirt_release_pmd(unsigned long pfn) {}
18static inline void paravirt_release_pud(unsigned long pfn) {}
5#endif 19#endif
20
21/*
22 * Allocate and free page tables.
23 */
24extern pgd_t *pgd_alloc(struct mm_struct *);
25extern void pgd_free(struct mm_struct *mm, pgd_t *pgd);
26
27extern pte_t *pte_alloc_one_kernel(struct mm_struct *, unsigned long);
28extern pgtable_t pte_alloc_one(struct mm_struct *, unsigned long);
29
30/* Should really implement gc for free page table pages. This could be
31 done with a reference count in struct page. */
32
33static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
34{
35 BUG_ON((unsigned long)pte & (PAGE_SIZE-1));
36 free_page((unsigned long)pte);
37}
38
39static inline void pte_free(struct mm_struct *mm, struct page *pte)
40{
41 __free_page(pte);
42}
43
44extern void __pte_free_tlb(struct mmu_gather *tlb, struct page *pte);
45
46static inline void pmd_populate_kernel(struct mm_struct *mm,
47 pmd_t *pmd, pte_t *pte)
48{
49 paravirt_alloc_pte(mm, __pa(pte) >> PAGE_SHIFT);
50 set_pmd(pmd, __pmd(__pa(pte) | _PAGE_TABLE));
51}
52
53static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
54 struct page *pte)
55{
56 unsigned long pfn = page_to_pfn(pte);
57
58 paravirt_alloc_pte(mm, pfn);
59 set_pmd(pmd, __pmd(((pteval_t)pfn << PAGE_SHIFT) | _PAGE_TABLE));
60}
61
62#define pmd_pgtable(pmd) pmd_page(pmd)
63
64#if PAGETABLE_LEVELS > 2
65static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
66{
67 return (pmd_t *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT);
68}
69
70static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
71{
72 BUG_ON((unsigned long)pmd & (PAGE_SIZE-1));
73 free_page((unsigned long)pmd);
74}
75
76extern void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd);
77
78#ifdef CONFIG_X86_PAE
79extern void pud_populate(struct mm_struct *mm, pud_t *pudp, pmd_t *pmd);
80#else /* !CONFIG_X86_PAE */
81static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)
82{
83 paravirt_alloc_pmd(mm, __pa(pmd) >> PAGE_SHIFT);
84 set_pud(pud, __pud(_PAGE_TABLE | __pa(pmd)));
85}
86#endif /* CONFIG_X86_PAE */
87
88#if PAGETABLE_LEVELS > 3
89static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pud_t *pud)
90{
91 paravirt_alloc_pud(mm, __pa(pud) >> PAGE_SHIFT);
92 set_pgd(pgd, __pgd(_PAGE_TABLE | __pa(pud)));
93}
94
95static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr)
96{
97 return (pud_t *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT);
98}
99
100static inline void pud_free(struct mm_struct *mm, pud_t *pud)
101{
102 BUG_ON((unsigned long)pud & (PAGE_SIZE-1));
103 free_page((unsigned long)pud);
104}
105
106extern void __pud_free_tlb(struct mmu_gather *tlb, pud_t *pud);
107#endif /* PAGETABLE_LEVELS > 3 */
108#endif /* PAGETABLE_LEVELS > 2 */
109
110#endif /* _ASM_X86_PGALLOC_H */
diff --git a/include/asm-x86/pgalloc_32.h b/include/asm-x86/pgalloc_32.h
deleted file mode 100644
index 6bea6e5b5ee5..000000000000
--- a/include/asm-x86/pgalloc_32.h
+++ /dev/null
@@ -1,95 +0,0 @@
1#ifndef _I386_PGALLOC_H
2#define _I386_PGALLOC_H
3
4#include <linux/threads.h>
5#include <linux/mm.h> /* for struct page */
6#include <linux/pagemap.h>
7#include <asm/tlb.h>
8#include <asm-generic/tlb.h>
9
10#ifdef CONFIG_PARAVIRT
11#include <asm/paravirt.h>
12#else
13#define paravirt_alloc_pt(mm, pfn) do { } while (0)
14#define paravirt_alloc_pd(mm, pfn) do { } while (0)
15#define paravirt_alloc_pd_clone(pfn, clonepfn, start, count) do { } while (0)
16#define paravirt_release_pt(pfn) do { } while (0)
17#define paravirt_release_pd(pfn) do { } while (0)
18#endif
19
20static inline void pmd_populate_kernel(struct mm_struct *mm,
21 pmd_t *pmd, pte_t *pte)
22{
23 paravirt_alloc_pt(mm, __pa(pte) >> PAGE_SHIFT);
24 set_pmd(pmd, __pmd(__pa(pte) | _PAGE_TABLE));
25}
26
27static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *pte)
28{
29 unsigned long pfn = page_to_pfn(pte);
30
31 paravirt_alloc_pt(mm, pfn);
32 set_pmd(pmd, __pmd(((pteval_t)pfn << PAGE_SHIFT) | _PAGE_TABLE));
33}
34#define pmd_pgtable(pmd) pmd_page(pmd)
35
36/*
37 * Allocate and free page tables.
38 */
39extern pgd_t *pgd_alloc(struct mm_struct *);
40extern void pgd_free(struct mm_struct *mm, pgd_t *pgd);
41
42extern pte_t *pte_alloc_one_kernel(struct mm_struct *, unsigned long);
43extern pgtable_t pte_alloc_one(struct mm_struct *, unsigned long);
44
45static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
46{
47 free_page((unsigned long)pte);
48}
49
50static inline void pte_free(struct mm_struct *mm, pgtable_t pte)
51{
52 pgtable_page_dtor(pte);
53 __free_page(pte);
54}
55
56
57extern void __pte_free_tlb(struct mmu_gather *tlb, struct page *pte);
58
59#ifdef CONFIG_X86_PAE
60/*
61 * In the PAE case we free the pmds as part of the pgd.
62 */
63static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
64{
65 return (pmd_t *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT);
66}
67
68static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
69{
70 BUG_ON((unsigned long)pmd & (PAGE_SIZE-1));
71 free_page((unsigned long)pmd);
72}
73
74extern void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd);
75
76static inline void pud_populate(struct mm_struct *mm, pud_t *pudp, pmd_t *pmd)
77{
78 paravirt_alloc_pd(mm, __pa(pmd) >> PAGE_SHIFT);
79
80 /* Note: almost everything apart from _PAGE_PRESENT is
81 reserved at the pmd (PDPT) level. */
82 set_pud(pudp, __pud(__pa(pmd) | _PAGE_PRESENT));
83
84 /*
85 * According to Intel App note "TLBs, Paging-Structure Caches,
86 * and Their Invalidation", April 2007, document 317080-001,
87 * section 8.1: in PAE mode we explicitly have to flush the
88 * TLB via cr3 if the top-level pgd is changed...
89 */
90 if (mm == current->active_mm)
91 write_cr3(read_cr3());
92}
93#endif /* CONFIG_X86_PAE */
94
95#endif /* _I386_PGALLOC_H */
diff --git a/include/asm-x86/pgalloc_64.h b/include/asm-x86/pgalloc_64.h
deleted file mode 100644
index 8d6722320dcc..000000000000
--- a/include/asm-x86/pgalloc_64.h
+++ /dev/null
@@ -1,133 +0,0 @@
1#ifndef _X86_64_PGALLOC_H
2#define _X86_64_PGALLOC_H
3
4#include <asm/pda.h>
5#include <linux/threads.h>
6#include <linux/mm.h>
7
8#define pmd_populate_kernel(mm, pmd, pte) \
9 set_pmd(pmd, __pmd(_PAGE_TABLE | __pa(pte)))
10#define pud_populate(mm, pud, pmd) \
11 set_pud(pud, __pud(_PAGE_TABLE | __pa(pmd)))
12#define pgd_populate(mm, pgd, pud) \
13 set_pgd(pgd, __pgd(_PAGE_TABLE | __pa(pud)))
14
15#define pmd_pgtable(pmd) pmd_page(pmd)
16
17static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *pte)
18{
19 set_pmd(pmd, __pmd(_PAGE_TABLE | (page_to_pfn(pte) << PAGE_SHIFT)));
20}
21
22static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
23{
24 BUG_ON((unsigned long)pmd & (PAGE_SIZE-1));
25 free_page((unsigned long)pmd);
26}
27
28static inline pmd_t *pmd_alloc_one (struct mm_struct *mm, unsigned long addr)
29{
30 return (pmd_t *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT);
31}
32
33static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr)
34{
35 return (pud_t *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT);
36}
37
38static inline void pud_free(struct mm_struct *mm, pud_t *pud)
39{
40 BUG_ON((unsigned long)pud & (PAGE_SIZE-1));
41 free_page((unsigned long)pud);
42}
43
44static inline void pgd_list_add(pgd_t *pgd)
45{
46 struct page *page = virt_to_page(pgd);
47 unsigned long flags;
48
49 spin_lock_irqsave(&pgd_lock, flags);
50 list_add(&page->lru, &pgd_list);
51 spin_unlock_irqrestore(&pgd_lock, flags);
52}
53
54static inline void pgd_list_del(pgd_t *pgd)
55{
56 struct page *page = virt_to_page(pgd);
57 unsigned long flags;
58
59 spin_lock_irqsave(&pgd_lock, flags);
60 list_del(&page->lru);
61 spin_unlock_irqrestore(&pgd_lock, flags);
62}
63
64static inline pgd_t *pgd_alloc(struct mm_struct *mm)
65{
66 unsigned boundary;
67 pgd_t *pgd = (pgd_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT);
68 if (!pgd)
69 return NULL;
70 pgd_list_add(pgd);
71 /*
72 * Copy kernel pointers in from init.
73 * Could keep a freelist or slab cache of those because the kernel
74 * part never changes.
75 */
76 boundary = pgd_index(__PAGE_OFFSET);
77 memset(pgd, 0, boundary * sizeof(pgd_t));
78 memcpy(pgd + boundary,
79 init_level4_pgt + boundary,
80 (PTRS_PER_PGD - boundary) * sizeof(pgd_t));
81 return pgd;
82}
83
84static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
85{
86 BUG_ON((unsigned long)pgd & (PAGE_SIZE-1));
87 pgd_list_del(pgd);
88 free_page((unsigned long)pgd);
89}
90
91static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
92{
93 return (pte_t *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT);
94}
95
96static inline pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address)
97{
98 struct page *page;
99 void *p;
100
101 p = (void *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT);
102 if (!p)
103 return NULL;
104 page = virt_to_page(p);
105 pgtable_page_ctor(page);
106 return page;
107}
108
109/* Should really implement gc for free page table pages. This could be
110 done with a reference count in struct page. */
111
112static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
113{
114 BUG_ON((unsigned long)pte & (PAGE_SIZE-1));
115 free_page((unsigned long)pte);
116}
117
118static inline void pte_free(struct mm_struct *mm, pgtable_t pte)
119{
120 pgtable_page_dtor(pte);
121 __free_page(pte);
122}
123
124#define __pte_free_tlb(tlb,pte) \
125do { \
126 pgtable_page_dtor((pte)); \
127 tlb_remove_page((tlb), (pte)); \
128} while (0)
129
130#define __pmd_free_tlb(tlb,x) tlb_remove_page((tlb),virt_to_page(x))
131#define __pud_free_tlb(tlb,x) tlb_remove_page((tlb),virt_to_page(x))
132
133#endif /* _X86_64_PGALLOC_H */
diff --git a/include/asm-x86/pgtable.h b/include/asm-x86/pgtable.h
index f1d9f4a03f6f..a496d6335d3b 100644
--- a/include/asm-x86/pgtable.h
+++ b/include/asm-x86/pgtable.h
@@ -1,7 +1,6 @@
1#ifndef _ASM_X86_PGTABLE_H 1#ifndef _ASM_X86_PGTABLE_H
2#define _ASM_X86_PGTABLE_H 2#define _ASM_X86_PGTABLE_H
3 3
4#define USER_PTRS_PER_PGD ((TASK_SIZE-1)/PGDIR_SIZE+1)
5#define FIRST_USER_ADDRESS 0 4#define FIRST_USER_ADDRESS 0
6 5
7#define _PAGE_BIT_PRESENT 0 /* is present */ 6#define _PAGE_BIT_PRESENT 0 /* is present */
@@ -289,6 +288,15 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
289 288
290#define canon_pgprot(p) __pgprot(pgprot_val(p) & __supported_pte_mask) 289#define canon_pgprot(p) __pgprot(pgprot_val(p) & __supported_pte_mask)
291 290
291#ifndef __ASSEMBLY__
292#define __HAVE_PHYS_MEM_ACCESS_PROT
293struct file;
294pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
295 unsigned long size, pgprot_t vma_prot);
296int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn,
297 unsigned long size, pgprot_t *vma_prot);
298#endif
299
292#ifdef CONFIG_PARAVIRT 300#ifdef CONFIG_PARAVIRT
293#include <asm/paravirt.h> 301#include <asm/paravirt.h>
294#else /* !CONFIG_PARAVIRT */ 302#else /* !CONFIG_PARAVIRT */
@@ -330,6 +338,9 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
330# include "pgtable_64.h" 338# include "pgtable_64.h"
331#endif 339#endif
332 340
341#define KERNEL_PGD_BOUNDARY pgd_index(PAGE_OFFSET)
342#define KERNEL_PGD_PTRS (PTRS_PER_PGD - KERNEL_PGD_BOUNDARY)
343
333#ifndef __ASSEMBLY__ 344#ifndef __ASSEMBLY__
334 345
335enum { 346enum {
@@ -389,37 +400,17 @@ static inline void native_set_pte_at(struct mm_struct *mm, unsigned long addr,
389 * bit at the same time. 400 * bit at the same time.
390 */ 401 */
391#define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS 402#define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
392#define ptep_set_access_flags(vma, address, ptep, entry, dirty) \ 403extern int ptep_set_access_flags(struct vm_area_struct *vma,
393({ \ 404 unsigned long address, pte_t *ptep,
394 int __changed = !pte_same(*(ptep), entry); \ 405 pte_t entry, int dirty);
395 if (__changed && dirty) { \
396 *ptep = entry; \
397 pte_update_defer((vma)->vm_mm, (address), (ptep)); \
398 flush_tlb_page(vma, address); \
399 } \
400 __changed; \
401})
402 406
403#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG 407#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
404#define ptep_test_and_clear_young(vma, addr, ptep) ({ \ 408extern int ptep_test_and_clear_young(struct vm_area_struct *vma,
405 int __ret = 0; \ 409 unsigned long addr, pte_t *ptep);
406 if (pte_young(*(ptep))) \
407 __ret = test_and_clear_bit(_PAGE_BIT_ACCESSED, \
408 &(ptep)->pte); \
409 if (__ret) \
410 pte_update((vma)->vm_mm, addr, ptep); \
411 __ret; \
412})
413 410
414#define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH 411#define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH
415#define ptep_clear_flush_young(vma, address, ptep) \ 412extern int ptep_clear_flush_young(struct vm_area_struct *vma,
416({ \ 413 unsigned long address, pte_t *ptep);
417 int __young; \
418 __young = ptep_test_and_clear_young((vma), (address), (ptep)); \
419 if (__young) \
420 flush_tlb_page(vma, address); \
421 __young; \
422})
423 414
424#define __HAVE_ARCH_PTEP_GET_AND_CLEAR 415#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
425static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, 416static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
@@ -456,6 +447,22 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm,
456 pte_update(mm, addr, ptep); 447 pte_update(mm, addr, ptep);
457} 448}
458 449
450/*
451 * clone_pgd_range(pgd_t *dst, pgd_t *src, int count);
452 *
453 * dst - pointer to pgd range anwhere on a pgd page
454 * src - ""
455 * count - the number of pgds to copy.
456 *
457 * dst and src can be on the same page, but the range must not overlap,
458 * and must not cross a page boundary.
459 */
460static inline void clone_pgd_range(pgd_t *dst, pgd_t *src, int count)
461{
462 memcpy(dst, src, count * sizeof(pgd_t));
463}
464
465
459#include <asm-generic/pgtable.h> 466#include <asm-generic/pgtable.h>
460#endif /* __ASSEMBLY__ */ 467#endif /* __ASSEMBLY__ */
461 468
diff --git a/include/asm-x86/pgtable_32.h b/include/asm-x86/pgtable_32.h
index c4a643674458..168b6447cf18 100644
--- a/include/asm-x86/pgtable_32.h
+++ b/include/asm-x86/pgtable_32.h
@@ -48,9 +48,6 @@ void paging_init(void);
48#define PGDIR_SIZE (1UL << PGDIR_SHIFT) 48#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
49#define PGDIR_MASK (~(PGDIR_SIZE - 1)) 49#define PGDIR_MASK (~(PGDIR_SIZE - 1))
50 50
51#define USER_PGD_PTRS (PAGE_OFFSET >> PGDIR_SHIFT)
52#define KERNEL_PGD_PTRS (PTRS_PER_PGD-USER_PGD_PTRS)
53
54/* Just any arbitrary offset to the start of the vmalloc VM area: the 51/* Just any arbitrary offset to the start of the vmalloc VM area: the
55 * current 8MB value just means that there will be a 8MB "hole" after the 52 * current 8MB value just means that there will be a 8MB "hole" after the
56 * physical memory until the kernel virtual memory starts. That means that 53 * physical memory until the kernel virtual memory starts. That means that
@@ -109,21 +106,6 @@ extern int pmd_bad(pmd_t pmd);
109#endif 106#endif
110 107
111/* 108/*
112 * clone_pgd_range(pgd_t *dst, pgd_t *src, int count);
113 *
114 * dst - pointer to pgd range anwhere on a pgd page
115 * src - ""
116 * count - the number of pgds to copy.
117 *
118 * dst and src can be on the same page, but the range must not overlap,
119 * and must not cross a page boundary.
120 */
121static inline void clone_pgd_range(pgd_t *dst, pgd_t *src, int count)
122{
123 memcpy(dst, src, count * sizeof(pgd_t));
124}
125
126/*
127 * Macro to mark a page protection value as "uncacheable". 109 * Macro to mark a page protection value as "uncacheable".
128 * On processors which do not support it, this is a no-op. 110 * On processors which do not support it, this is a no-op.
129 */ 111 */
diff --git a/include/asm-x86/pgtable_64.h b/include/asm-x86/pgtable_64.h
index 9fd87d0b6477..a3bbf8766c1d 100644
--- a/include/asm-x86/pgtable_64.h
+++ b/include/asm-x86/pgtable_64.h
@@ -24,7 +24,7 @@ extern void paging_init(void);
24 24
25#endif /* !__ASSEMBLY__ */ 25#endif /* !__ASSEMBLY__ */
26 26
27#define SHARED_KERNEL_PMD 1 27#define SHARED_KERNEL_PMD 0
28 28
29/* 29/*
30 * PGDIR_SHIFT determines what a top-level page table entry can map 30 * PGDIR_SHIFT determines what a top-level page table entry can map
diff --git a/include/asm-x86/xen/events.h b/include/asm-x86/xen/events.h
new file mode 100644
index 000000000000..596312a7bfc9
--- /dev/null
+++ b/include/asm-x86/xen/events.h
@@ -0,0 +1,22 @@
1#ifndef __XEN_EVENTS_H
2#define __XEN_EVENTS_H
3
4enum ipi_vector {
5 XEN_RESCHEDULE_VECTOR,
6 XEN_CALL_FUNCTION_VECTOR,
7
8 XEN_NR_IPIS,
9};
10
11static inline int xen_irqs_disabled(struct pt_regs *regs)
12{
13 return raw_irqs_disabled_flags(regs->flags);
14}
15
16static inline void xen_do_IRQ(int irq, struct pt_regs *regs)
17{
18 regs->orig_ax = ~irq;
19 do_IRQ(regs);
20}
21
22#endif /* __XEN_EVENTS_H */
diff --git a/include/asm-x86/xen/grant_table.h b/include/asm-x86/xen/grant_table.h
new file mode 100644
index 000000000000..2444d4593a3b
--- /dev/null
+++ b/include/asm-x86/xen/grant_table.h
@@ -0,0 +1,7 @@
1#ifndef __XEN_GRANT_TABLE_H
2#define __XEN_GRANT_TABLE_H
3
4#define xen_alloc_vm_area(size) alloc_vm_area(size)
5#define xen_free_vm_area(area) free_vm_area(area)
6
7#endif /* __XEN_GRANT_TABLE_H */
diff --git a/include/asm-x86/xen/hypercall.h b/include/asm-x86/xen/hypercall.h
index bc0ee7d961ca..c2ccd997ed35 100644
--- a/include/asm-x86/xen/hypercall.h
+++ b/include/asm-x86/xen/hypercall.h
@@ -164,6 +164,12 @@ HYPERVISOR_set_callbacks(unsigned long event_selector,
164} 164}
165 165
166static inline int 166static inline int
167HYPERVISOR_callback_op(int cmd, void *arg)
168{
169 return _hypercall2(int, callback_op, cmd, arg);
170}
171
172static inline int
167HYPERVISOR_fpu_taskswitch(int set) 173HYPERVISOR_fpu_taskswitch(int set)
168{ 174{
169 return _hypercall1(int, fpu_taskswitch, set); 175 return _hypercall1(int, fpu_taskswitch, set);
diff --git a/include/asm-x86/xen/interface.h b/include/asm-x86/xen/interface.h
index 165c3968e138..6227000a1e84 100644
--- a/include/asm-x86/xen/interface.h
+++ b/include/asm-x86/xen/interface.h
@@ -22,6 +22,30 @@
22#define DEFINE_GUEST_HANDLE(name) __DEFINE_GUEST_HANDLE(name, name) 22#define DEFINE_GUEST_HANDLE(name) __DEFINE_GUEST_HANDLE(name, name)
23#define GUEST_HANDLE(name) __guest_handle_ ## name 23#define GUEST_HANDLE(name) __guest_handle_ ## name
24 24
25#ifdef __XEN__
26#if defined(__i386__)
27#define set_xen_guest_handle(hnd, val) \
28 do { \
29 if (sizeof(hnd) == 8) \
30 *(uint64_t *)&(hnd) = 0; \
31 (hnd).p = val; \
32 } while (0)
33#elif defined(__x86_64__)
34#define set_xen_guest_handle(hnd, val) do { (hnd).p = val; } while (0)
35#endif
36#else
37#if defined(__i386__)
38#define set_xen_guest_handle(hnd, val) \
39 do { \
40 if (sizeof(hnd) == 8) \
41 *(uint64_t *)&(hnd) = 0; \
42 (hnd) = val; \
43 } while (0)
44#elif defined(__x86_64__)
45#define set_xen_guest_handle(hnd, val) do { (hnd) = val; } while (0)
46#endif
47#endif
48
25#ifndef __ASSEMBLY__ 49#ifndef __ASSEMBLY__
26/* Guest handles for primitive C types. */ 50/* Guest handles for primitive C types. */
27__DEFINE_GUEST_HANDLE(uchar, unsigned char); 51__DEFINE_GUEST_HANDLE(uchar, unsigned char);
@@ -171,6 +195,10 @@ struct arch_vcpu_info {
171 unsigned long pad[5]; /* sizeof(struct vcpu_info) == 64 */ 195 unsigned long pad[5]; /* sizeof(struct vcpu_info) == 64 */
172}; 196};
173 197
198struct xen_callback {
199 unsigned long cs;
200 unsigned long eip;
201};
174#endif /* !__ASSEMBLY__ */ 202#endif /* !__ASSEMBLY__ */
175 203
176/* 204/*
diff --git a/include/asm-x86/xen/page.h b/include/asm-x86/xen/page.h
new file mode 100644
index 000000000000..01799305f02a
--- /dev/null
+++ b/include/asm-x86/xen/page.h
@@ -0,0 +1,168 @@
1#ifndef __XEN_PAGE_H
2#define __XEN_PAGE_H
3
4#include <linux/pfn.h>
5
6#include <asm/uaccess.h>
7#include <asm/pgtable.h>
8
9#include <xen/features.h>
10
11/* Xen machine address */
12typedef struct xmaddr {
13 phys_addr_t maddr;
14} xmaddr_t;
15
16/* Xen pseudo-physical address */
17typedef struct xpaddr {
18 phys_addr_t paddr;
19} xpaddr_t;
20
21#define XMADDR(x) ((xmaddr_t) { .maddr = (x) })
22#define XPADDR(x) ((xpaddr_t) { .paddr = (x) })
23
24/**** MACHINE <-> PHYSICAL CONVERSION MACROS ****/
25#define INVALID_P2M_ENTRY (~0UL)
26#define FOREIGN_FRAME_BIT (1UL<<31)
27#define FOREIGN_FRAME(m) ((m) | FOREIGN_FRAME_BIT)
28
29extern unsigned long *phys_to_machine_mapping;
30
31static inline unsigned long pfn_to_mfn(unsigned long pfn)
32{
33 if (xen_feature(XENFEAT_auto_translated_physmap))
34 return pfn;
35
36 return phys_to_machine_mapping[(unsigned int)(pfn)] &
37 ~FOREIGN_FRAME_BIT;
38}
39
40static inline int phys_to_machine_mapping_valid(unsigned long pfn)
41{
42 if (xen_feature(XENFEAT_auto_translated_physmap))
43 return 1;
44
45 return (phys_to_machine_mapping[pfn] != INVALID_P2M_ENTRY);
46}
47
48static inline unsigned long mfn_to_pfn(unsigned long mfn)
49{
50 unsigned long pfn;
51
52 if (xen_feature(XENFEAT_auto_translated_physmap))
53 return mfn;
54
55#if 0
56 if (unlikely((mfn >> machine_to_phys_order) != 0))
57 return max_mapnr;
58#endif
59
60 pfn = 0;
61 /*
62 * The array access can fail (e.g., device space beyond end of RAM).
63 * In such cases it doesn't matter what we return (we return garbage),
64 * but we must handle the fault without crashing!
65 */
66 __get_user(pfn, &machine_to_phys_mapping[mfn]);
67
68 return pfn;
69}
70
71static inline xmaddr_t phys_to_machine(xpaddr_t phys)
72{
73 unsigned offset = phys.paddr & ~PAGE_MASK;
74 return XMADDR(PFN_PHYS((u64)pfn_to_mfn(PFN_DOWN(phys.paddr))) | offset);
75}
76
77static inline xpaddr_t machine_to_phys(xmaddr_t machine)
78{
79 unsigned offset = machine.maddr & ~PAGE_MASK;
80 return XPADDR(PFN_PHYS((u64)mfn_to_pfn(PFN_DOWN(machine.maddr))) | offset);
81}
82
83/*
84 * We detect special mappings in one of two ways:
85 * 1. If the MFN is an I/O page then Xen will set the m2p entry
86 * to be outside our maximum possible pseudophys range.
87 * 2. If the MFN belongs to a different domain then we will certainly
88 * not have MFN in our p2m table. Conversely, if the page is ours,
89 * then we'll have p2m(m2p(MFN))==MFN.
90 * If we detect a special mapping then it doesn't have a 'struct page'.
91 * We force !pfn_valid() by returning an out-of-range pointer.
92 *
93 * NB. These checks require that, for any MFN that is not in our reservation,
94 * there is no PFN such that p2m(PFN) == MFN. Otherwise we can get confused if
95 * we are foreign-mapping the MFN, and the other domain as m2p(MFN) == PFN.
96 * Yikes! Various places must poke in INVALID_P2M_ENTRY for safety.
97 *
98 * NB2. When deliberately mapping foreign pages into the p2m table, you *must*
99 * use FOREIGN_FRAME(). This will cause pte_pfn() to choke on it, as we
100 * require. In all the cases we care about, the FOREIGN_FRAME bit is
101 * masked (e.g., pfn_to_mfn()) so behaviour there is correct.
102 */
103static inline unsigned long mfn_to_local_pfn(unsigned long mfn)
104{
105 extern unsigned long max_mapnr;
106 unsigned long pfn = mfn_to_pfn(mfn);
107 if ((pfn < max_mapnr)
108 && !xen_feature(XENFEAT_auto_translated_physmap)
109 && (phys_to_machine_mapping[pfn] != mfn))
110 return max_mapnr; /* force !pfn_valid() */
111 return pfn;
112}
113
114static inline void set_phys_to_machine(unsigned long pfn, unsigned long mfn)
115{
116 if (xen_feature(XENFEAT_auto_translated_physmap)) {
117 BUG_ON(pfn != mfn && mfn != INVALID_P2M_ENTRY);
118 return;
119 }
120 phys_to_machine_mapping[pfn] = mfn;
121}
122
123/* VIRT <-> MACHINE conversion */
124#define virt_to_machine(v) (phys_to_machine(XPADDR(__pa(v))))
125#define virt_to_mfn(v) (pfn_to_mfn(PFN_DOWN(__pa(v))))
126#define mfn_to_virt(m) (__va(mfn_to_pfn(m) << PAGE_SHIFT))
127
128static inline unsigned long pte_mfn(pte_t pte)
129{
130 return (pte.pte & ~_PAGE_NX) >> PAGE_SHIFT;
131}
132
133static inline pte_t mfn_pte(unsigned long page_nr, pgprot_t pgprot)
134{
135 pte_t pte;
136
137 pte.pte = ((phys_addr_t)page_nr << PAGE_SHIFT) |
138 (pgprot_val(pgprot) & __supported_pte_mask);
139
140 return pte;
141}
142
143static inline pteval_t pte_val_ma(pte_t pte)
144{
145 return pte.pte;
146}
147
148static inline pte_t __pte_ma(pteval_t x)
149{
150 return (pte_t) { .pte = x };
151}
152
153#ifdef CONFIG_X86_PAE
154#define pmd_val_ma(v) ((v).pmd)
155#define pud_val_ma(v) ((v).pgd.pgd)
156#define __pmd_ma(x) ((pmd_t) { (x) } )
157#else /* !X86_PAE */
158#define pmd_val_ma(v) ((v).pud.pgd.pgd)
159#endif /* CONFIG_X86_PAE */
160
161#define pgd_val_ma(x) ((x).pgd)
162
163
164xmaddr_t arbitrary_virt_to_machine(unsigned long address);
165void make_lowmem_page_readonly(void *vaddr);
166void make_lowmem_page_readwrite(void *vaddr);
167
168#endif /* __XEN_PAGE_H */
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index cb784579956b..ad3b787479a4 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2001 Sistina Software (UK) Limited. 2 * Copyright (C) 2001 Sistina Software (UK) Limited.
3 * Copyright (C) 2004 Red Hat, Inc. All rights reserved. 3 * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
4 * 4 *
5 * This file is released under the LGPL. 5 * This file is released under the LGPL.
6 */ 6 */
@@ -10,6 +10,8 @@
10 10
11#ifdef __KERNEL__ 11#ifdef __KERNEL__
12 12
13#include <linux/bio.h>
14
13struct dm_target; 15struct dm_target;
14struct dm_table; 16struct dm_table;
15struct dm_dev; 17struct dm_dev;
@@ -250,11 +252,97 @@ void dm_table_event(struct dm_table *t);
250 */ 252 */
251int dm_swap_table(struct mapped_device *md, struct dm_table *t); 253int dm_swap_table(struct mapped_device *md, struct dm_table *t);
252 254
255/*-----------------------------------------------------------------
256 * Macros.
257 *---------------------------------------------------------------*/
258#define DM_NAME "device-mapper"
259
260#define DMERR(f, arg...) \
261 printk(KERN_ERR DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg)
262#define DMERR_LIMIT(f, arg...) \
263 do { \
264 if (printk_ratelimit()) \
265 printk(KERN_ERR DM_NAME ": " DM_MSG_PREFIX ": " \
266 f "\n", ## arg); \
267 } while (0)
268
269#define DMWARN(f, arg...) \
270 printk(KERN_WARNING DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg)
271#define DMWARN_LIMIT(f, arg...) \
272 do { \
273 if (printk_ratelimit()) \
274 printk(KERN_WARNING DM_NAME ": " DM_MSG_PREFIX ": " \
275 f "\n", ## arg); \
276 } while (0)
277
278#define DMINFO(f, arg...) \
279 printk(KERN_INFO DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg)
280#define DMINFO_LIMIT(f, arg...) \
281 do { \
282 if (printk_ratelimit()) \
283 printk(KERN_INFO DM_NAME ": " DM_MSG_PREFIX ": " f \
284 "\n", ## arg); \
285 } while (0)
286
287#ifdef CONFIG_DM_DEBUG
288# define DMDEBUG(f, arg...) \
289 printk(KERN_DEBUG DM_NAME ": " DM_MSG_PREFIX " DEBUG: " f "\n", ## arg)
290# define DMDEBUG_LIMIT(f, arg...) \
291 do { \
292 if (printk_ratelimit()) \
293 printk(KERN_DEBUG DM_NAME ": " DM_MSG_PREFIX ": " f \
294 "\n", ## arg); \
295 } while (0)
296#else
297# define DMDEBUG(f, arg...) do {} while (0)
298# define DMDEBUG_LIMIT(f, arg...) do {} while (0)
299#endif
300
301#define DMEMIT(x...) sz += ((sz >= maxlen) ? \
302 0 : scnprintf(result + sz, maxlen - sz, x))
303
304#define SECTOR_SHIFT 9
305
306/*
307 * Definitions of return values from target end_io function.
308 */
309#define DM_ENDIO_INCOMPLETE 1
310#define DM_ENDIO_REQUEUE 2
311
312/*
313 * Definitions of return values from target map function.
314 */
315#define DM_MAPIO_SUBMITTED 0
316#define DM_MAPIO_REMAPPED 1
317#define DM_MAPIO_REQUEUE DM_ENDIO_REQUEUE
318
319/*
320 * Ceiling(n / sz)
321 */
322#define dm_div_up(n, sz) (((n) + (sz) - 1) / (sz))
323
324#define dm_sector_div_up(n, sz) ( \
325{ \
326 sector_t _r = ((n) + (sz) - 1); \
327 sector_div(_r, (sz)); \
328 _r; \
329} \
330)
331
253/* 332/*
254 * Prepare a table for a device that will error all I/O. 333 * ceiling(n / size) * size
255 * To make it active, call dm_suspend(), dm_swap_table() then dm_resume().
256 */ 334 */
257int dm_create_error_table(struct dm_table **result, struct mapped_device *md); 335#define dm_round_up(n, sz) (dm_div_up((n), (sz)) * (sz))
336
337static inline sector_t to_sector(unsigned long n)
338{
339 return (n >> SECTOR_SHIFT);
340}
341
342static inline unsigned long to_bytes(sector_t n)
343{
344 return (n << SECTOR_SHIFT);
345}
258 346
259#endif /* __KERNEL__ */ 347#endif /* __KERNEL__ */
260#endif /* _LINUX_DEVICE_MAPPER_H */ 348#endif /* _LINUX_DEVICE_MAPPER_H */
diff --git a/include/linux/dm-dirty-log.h b/include/linux/dm-dirty-log.h
new file mode 100644
index 000000000000..600c5fb2daad
--- /dev/null
+++ b/include/linux/dm-dirty-log.h
@@ -0,0 +1,131 @@
1/*
2 * Copyright (C) 2003 Sistina Software
3 * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
4 *
5 * Device-Mapper dirty region log.
6 *
7 * This file is released under the LGPL.
8 */
9
10#ifndef _LINUX_DM_DIRTY_LOG
11#define _LINUX_DM_DIRTY_LOG
12
13#ifdef __KERNEL__
14
15#include <linux/types.h>
16#include <linux/device-mapper.h>
17
18typedef sector_t region_t;
19
20struct dm_dirty_log_type;
21
22struct dm_dirty_log {
23 struct dm_dirty_log_type *type;
24 void *context;
25};
26
27struct dm_dirty_log_type {
28 const char *name;
29 struct module *module;
30
31 int (*ctr)(struct dm_dirty_log *log, struct dm_target *ti,
32 unsigned argc, char **argv);
33 void (*dtr)(struct dm_dirty_log *log);
34
35 /*
36 * There are times when we don't want the log to touch
37 * the disk.
38 */
39 int (*presuspend)(struct dm_dirty_log *log);
40 int (*postsuspend)(struct dm_dirty_log *log);
41 int (*resume)(struct dm_dirty_log *log);
42
43 /*
44 * Retrieves the smallest size of region that the log can
45 * deal with.
46 */
47 uint32_t (*get_region_size)(struct dm_dirty_log *log);
48
49 /*
50 * A predicate to say whether a region is clean or not.
51 * May block.
52 */
53 int (*is_clean)(struct dm_dirty_log *log, region_t region);
54
55 /*
56 * Returns: 0, 1, -EWOULDBLOCK, < 0
57 *
58 * A predicate function to check the area given by
59 * [sector, sector + len) is in sync.
60 *
61 * If -EWOULDBLOCK is returned the state of the region is
62 * unknown, typically this will result in a read being
63 * passed to a daemon to deal with, since a daemon is
64 * allowed to block.
65 */
66 int (*in_sync)(struct dm_dirty_log *log, region_t region,
67 int can_block);
68
69 /*
70 * Flush the current log state (eg, to disk). This
71 * function may block.
72 */
73 int (*flush)(struct dm_dirty_log *log);
74
75 /*
76 * Mark an area as clean or dirty. These functions may
77 * block, though for performance reasons blocking should
78 * be extremely rare (eg, allocating another chunk of
79 * memory for some reason).
80 */
81 void (*mark_region)(struct dm_dirty_log *log, region_t region);
82 void (*clear_region)(struct dm_dirty_log *log, region_t region);
83
84 /*
85 * Returns: <0 (error), 0 (no region), 1 (region)
86 *
87 * The mirrord will need perform recovery on regions of
88 * the mirror that are in the NOSYNC state. This
89 * function asks the log to tell the caller about the
90 * next region that this machine should recover.
91 *
92 * Do not confuse this function with 'in_sync()', one
93 * tells you if an area is synchronised, the other
94 * assigns recovery work.
95 */
96 int (*get_resync_work)(struct dm_dirty_log *log, region_t *region);
97
98 /*
99 * This notifies the log that the resync status of a region
100 * has changed. It also clears the region from the recovering
101 * list (if present).
102 */
103 void (*set_region_sync)(struct dm_dirty_log *log,
104 region_t region, int in_sync);
105
106 /*
107 * Returns the number of regions that are in sync.
108 */
109 region_t (*get_sync_count)(struct dm_dirty_log *log);
110
111 /*
112 * Support function for mirror status requests.
113 */
114 int (*status)(struct dm_dirty_log *log, status_type_t status_type,
115 char *result, unsigned maxlen);
116};
117
118int dm_dirty_log_type_register(struct dm_dirty_log_type *type);
119int dm_dirty_log_type_unregister(struct dm_dirty_log_type *type);
120
121/*
122 * Make sure you use these two functions, rather than calling
123 * type->constructor/destructor() directly.
124 */
125struct dm_dirty_log *dm_dirty_log_create(const char *type_name,
126 struct dm_target *ti,
127 unsigned argc, char **argv);
128void dm_dirty_log_destroy(struct dm_dirty_log *log);
129
130#endif /* __KERNEL__ */
131#endif /* _LINUX_DM_DIRTY_LOG_H */
diff --git a/include/linux/dm-io.h b/include/linux/dm-io.h
new file mode 100644
index 000000000000..b6bf17ee2f61
--- /dev/null
+++ b/include/linux/dm-io.h
@@ -0,0 +1,85 @@
1/*
2 * Copyright (C) 2003 Sistina Software
3 * Copyright (C) 2004 - 2008 Red Hat, Inc. All rights reserved.
4 *
5 * Device-Mapper low-level I/O.
6 *
7 * This file is released under the GPL.
8 */
9
10#ifndef _LINUX_DM_IO_H
11#define _LINUX_DM_IO_H
12
13#ifdef __KERNEL__
14
15#include <linux/types.h>
16
17struct dm_io_region {
18 struct block_device *bdev;
19 sector_t sector;
20 sector_t count; /* If this is zero the region is ignored. */
21};
22
23struct page_list {
24 struct page_list *next;
25 struct page *page;
26};
27
28typedef void (*io_notify_fn)(unsigned long error, void *context);
29
30enum dm_io_mem_type {
31 DM_IO_PAGE_LIST,/* Page list */
32 DM_IO_BVEC, /* Bio vector */
33 DM_IO_VMA, /* Virtual memory area */
34 DM_IO_KMEM, /* Kernel memory */
35};
36
37struct dm_io_memory {
38 enum dm_io_mem_type type;
39
40 union {
41 struct page_list *pl;
42 struct bio_vec *bvec;
43 void *vma;
44 void *addr;
45 } ptr;
46
47 unsigned offset;
48};
49
50struct dm_io_notify {
51 io_notify_fn fn; /* Callback for asynchronous requests */
52 void *context; /* Passed to callback */
53};
54
55/*
56 * IO request structure
57 */
58struct dm_io_client;
59struct dm_io_request {
60 int bi_rw; /* READ|WRITE - not READA */
61 struct dm_io_memory mem; /* Memory to use for io */
62 struct dm_io_notify notify; /* Synchronous if notify.fn is NULL */
63 struct dm_io_client *client; /* Client memory handler */
64};
65
66/*
67 * For async io calls, users can alternatively use the dm_io() function below
68 * and dm_io_client_create() to create private mempools for the client.
69 *
70 * Create/destroy may block.
71 */
72struct dm_io_client *dm_io_client_create(unsigned num_pages);
73int dm_io_client_resize(unsigned num_pages, struct dm_io_client *client);
74void dm_io_client_destroy(struct dm_io_client *client);
75
76/*
77 * IO interface using private per-client pools.
78 * Each bit in the optional 'sync_error_bits' bitset indicates whether an
79 * error occurred doing io to the corresponding region.
80 */
81int dm_io(struct dm_io_request *io_req, unsigned num_regions,
82 struct dm_io_region *region, unsigned long *sync_error_bits);
83
84#endif /* __KERNEL__ */
85#endif /* _LINUX_DM_IO_H */
diff --git a/include/linux/dm-kcopyd.h b/include/linux/dm-kcopyd.h
new file mode 100644
index 000000000000..5db216311695
--- /dev/null
+++ b/include/linux/dm-kcopyd.h
@@ -0,0 +1,47 @@
1/*
2 * Copyright (C) 2001 - 2003 Sistina Software
3 * Copyright (C) 2004 - 2008 Red Hat, Inc. All rights reserved.
4 *
5 * kcopyd provides a simple interface for copying an area of one
6 * block-device to one or more other block-devices, either synchronous
7 * or with an asynchronous completion notification.
8 *
9 * This file is released under the GPL.
10 */
11
12#ifndef _LINUX_DM_KCOPYD_H
13#define _LINUX_DM_KCOPYD_H
14
15#ifdef __KERNEL__
16
17#include <linux/dm-io.h>
18
19/* FIXME: make this configurable */
20#define DM_KCOPYD_MAX_REGIONS 8
21
22#define DM_KCOPYD_IGNORE_ERROR 1
23
24/*
25 * To use kcopyd you must first create a dm_kcopyd_client object.
26 */
27struct dm_kcopyd_client;
28int dm_kcopyd_client_create(unsigned num_pages,
29 struct dm_kcopyd_client **result);
30void dm_kcopyd_client_destroy(struct dm_kcopyd_client *kc);
31
32/*
33 * Submit a copy job to kcopyd. This is built on top of the
34 * previous three fns.
35 *
36 * read_err is a boolean,
37 * write_err is a bitset, with 1 bit for each destination region
38 */
39typedef void (*dm_kcopyd_notify_fn)(int read_err, unsigned long write_err,
40 void *context);
41
42int dm_kcopyd_copy(struct dm_kcopyd_client *kc, struct dm_io_region *from,
43 unsigned num_dests, struct dm_io_region *dests,
44 unsigned flags, dm_kcopyd_notify_fn fn, void *context);
45
46#endif /* __KERNEL__ */
47#endif /* _LINUX_DM_KCOPYD_H */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index e057438a05ad..d6d7c52055c6 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -973,6 +973,7 @@ extern int do_sync_mapping_range(struct address_space *mapping, loff_t offset,
973/* fs/locks.c */ 973/* fs/locks.c */
974extern void locks_init_lock(struct file_lock *); 974extern void locks_init_lock(struct file_lock *);
975extern void locks_copy_lock(struct file_lock *, struct file_lock *); 975extern void locks_copy_lock(struct file_lock *, struct file_lock *);
976extern void __locks_copy_lock(struct file_lock *, const struct file_lock *);
976extern void locks_remove_posix(struct file *, fl_owner_t); 977extern void locks_remove_posix(struct file *, fl_owner_t);
977extern void locks_remove_flock(struct file *); 978extern void locks_remove_flock(struct file *);
978extern void posix_test_lock(struct file *, struct file_lock *); 979extern void posix_test_lock(struct file *, struct file_lock *);
diff --git a/include/linux/input.h b/include/linux/input.h
index cae2c35d1206..28a094fcfe20 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -1025,10 +1025,6 @@ struct ff_effect {
1025 * @node: used to place the device onto input_dev_list 1025 * @node: used to place the device onto input_dev_list
1026 */ 1026 */
1027struct input_dev { 1027struct input_dev {
1028 /* private: */
1029 void *private; /* do not use */
1030 /* public: */
1031
1032 const char *name; 1028 const char *name;
1033 const char *phys; 1029 const char *phys;
1034 const char *uniq; 1030 const char *uniq;
@@ -1238,12 +1234,12 @@ static inline void input_put_device(struct input_dev *dev)
1238 1234
1239static inline void *input_get_drvdata(struct input_dev *dev) 1235static inline void *input_get_drvdata(struct input_dev *dev)
1240{ 1236{
1241 return dev->private; 1237 return dev_get_drvdata(&dev->dev);
1242} 1238}
1243 1239
1244static inline void input_set_drvdata(struct input_dev *dev, void *data) 1240static inline void input_set_drvdata(struct input_dev *dev, void *data)
1245{ 1241{
1246 dev->private = data; 1242 dev_set_drvdata(&dev->dev, data);
1247} 1243}
1248 1244
1249int __must_check input_register_device(struct input_dev *); 1245int __must_check input_register_device(struct input_dev *);
diff --git a/include/linux/keyboard.h b/include/linux/keyboard.h
index 65c2d70853e9..a3c984d780f0 100644
--- a/include/linux/keyboard.h
+++ b/include/linux/keyboard.h
@@ -33,6 +33,7 @@ struct keyboard_notifier_param {
33 struct vc_data *vc; /* VC on which the keyboard press was done */ 33 struct vc_data *vc; /* VC on which the keyboard press was done */
34 int down; /* Pressure of the key? */ 34 int down; /* Pressure of the key? */
35 int shift; /* Current shift mask */ 35 int shift; /* Current shift mask */
36 int ledstate; /* Current led state */
36 unsigned int value; /* keycode, unicode value or keysym */ 37 unsigned int value; /* keycode, unicode value or keysym */
37}; 38};
38 39
diff --git a/include/linux/leds.h b/include/linux/leds.h
index b07e3d400bd6..519df72e939d 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -35,8 +35,11 @@ struct led_classdev {
35#define LED_SUSPENDED (1 << 0) 35#define LED_SUSPENDED (1 << 0)
36 36
37 /* Set LED brightness level */ 37 /* Set LED brightness level */
38 /* Must not sleep, use a workqueue if needed */
38 void (*brightness_set)(struct led_classdev *led_cdev, 39 void (*brightness_set)(struct led_classdev *led_cdev,
39 enum led_brightness brightness); 40 enum led_brightness brightness);
41 /* Get LED brightness level */
42 enum led_brightness (*brightness_get)(struct led_classdev *led_cdev);
40 43
41 /* Activate hardware accelerated blink */ 44 /* Activate hardware accelerated blink */
42 int (*blink_set)(struct led_classdev *led_cdev, 45 int (*blink_set)(struct led_classdev *led_cdev,
@@ -126,6 +129,9 @@ struct gpio_led {
126struct gpio_led_platform_data { 129struct gpio_led_platform_data {
127 int num_leds; 130 int num_leds;
128 struct gpio_led *leds; 131 struct gpio_led *leds;
132 int (*gpio_blink_set)(unsigned gpio,
133 unsigned long *delay_on,
134 unsigned long *delay_off);
129}; 135};
130 136
131 137
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 07ed56f7a767..395a523d8c30 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -847,7 +847,6 @@ static inline int ata_port_is_dummy(struct ata_port *ap)
847 return ap->ops == &ata_dummy_port_ops; 847 return ap->ops == &ata_dummy_port_ops;
848} 848}
849 849
850extern void sata_print_link_status(struct ata_link *link);
851extern void ata_port_probe(struct ata_port *); 850extern void ata_port_probe(struct ata_port *);
852extern int sata_set_spd(struct ata_link *link); 851extern int sata_set_spd(struct ata_link *link);
853extern int ata_std_prereset(struct ata_link *link, unsigned long deadline); 852extern int ata_std_prereset(struct ata_link *link, unsigned long deadline);
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index 94649a8da014..102d928f7206 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -194,7 +194,7 @@ void nsm_release(struct nsm_handle *);
194 * This is used in garbage collection and resource reclaim 194 * This is used in garbage collection and resource reclaim
195 * A return value != 0 means destroy the lock/block/share 195 * A return value != 0 means destroy the lock/block/share
196 */ 196 */
197typedef int (*nlm_host_match_fn_t)(struct nlm_host *cur, struct nlm_host *ref); 197typedef int (*nlm_host_match_fn_t)(void *cur, struct nlm_host *ref);
198 198
199/* 199/*
200 * Server-side lock handling 200 * Server-side lock handling
@@ -220,6 +220,12 @@ void nlmsvc_mark_resources(void);
220void nlmsvc_free_host_resources(struct nlm_host *); 220void nlmsvc_free_host_resources(struct nlm_host *);
221void nlmsvc_invalidate_all(void); 221void nlmsvc_invalidate_all(void);
222 222
223/*
224 * Cluster failover support
225 */
226int nlmsvc_unlock_all_by_sb(struct super_block *sb);
227int nlmsvc_unlock_all_by_ip(__be32 server_addr);
228
223static inline struct inode *nlmsvc_file_inode(struct nlm_file *file) 229static inline struct inode *nlmsvc_file_inode(struct nlm_file *file)
224{ 230{
225 return file->f_file->f_path.dentry->d_inode; 231 return file->f_file->f_path.dentry->d_inode;
diff --git a/include/linux/mtd/inftl.h b/include/linux/mtd/inftl.h
index 6977780e548f..85fd041d44ad 100644
--- a/include/linux/mtd/inftl.h
+++ b/include/linux/mtd/inftl.h
@@ -57,6 +57,11 @@ extern char inftlmountrev[];
57void INFTL_dumptables(struct INFTLrecord *s); 57void INFTL_dumptables(struct INFTLrecord *s);
58void INFTL_dumpVUchains(struct INFTLrecord *s); 58void INFTL_dumpVUchains(struct INFTLrecord *s);
59 59
60int inftl_read_oob(struct mtd_info *mtd, loff_t offs, size_t len,
61 size_t *retlen, uint8_t *buf);
62int inftl_write_oob(struct mtd_info *mtd, loff_t offs, size_t len,
63 size_t *retlen, uint8_t *buf);
64
60#endif /* __KERNEL__ */ 65#endif /* __KERNEL__ */
61 66
62#endif /* __MTD_INFTL_H__ */ 67#endif /* __MTD_INFTL_H__ */
diff --git a/include/linux/mtd/nftl.h b/include/linux/mtd/nftl.h
index bcf2fb3fa4a7..001eec50cac6 100644
--- a/include/linux/mtd/nftl.h
+++ b/include/linux/mtd/nftl.h
@@ -43,6 +43,11 @@ struct NFTLrecord {
43int NFTL_mount(struct NFTLrecord *s); 43int NFTL_mount(struct NFTLrecord *s);
44int NFTL_formatblock(struct NFTLrecord *s, int block); 44int NFTL_formatblock(struct NFTLrecord *s, int block);
45 45
46int nftl_read_oob(struct mtd_info *mtd, loff_t offs, size_t len,
47 size_t *retlen, uint8_t *buf);
48int nftl_write_oob(struct mtd_info *mtd, loff_t offs, size_t len,
49 size_t *retlen, uint8_t *buf);
50
46#ifndef NFTL_MAJOR 51#ifndef NFTL_MAJOR
47#define NFTL_MAJOR 93 52#define NFTL_MAJOR 93
48#endif 53#endif
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h
index fd0a260e070b..9aa2a9149b58 100644
--- a/include/linux/mtd/onenand.h
+++ b/include/linux/mtd/onenand.h
@@ -187,4 +187,7 @@ struct onenand_manufacturers {
187 char *name; 187 char *name;
188}; 188};
189 189
190int onenand_bbt_read_oob(struct mtd_info *mtd, loff_t from,
191 struct mtd_oob_ops *ops);
192
190#endif /* __LINUX_MTD_ONENAND_H */ 193#endif /* __LINUX_MTD_ONENAND_H */
diff --git a/include/linux/mtd/plat-ram.h b/include/linux/mtd/plat-ram.h
index 9667863bd7e3..0e37ad07bce2 100644
--- a/include/linux/mtd/plat-ram.h
+++ b/include/linux/mtd/plat-ram.h
@@ -21,8 +21,9 @@
21#define PLATRAM_RW (1) 21#define PLATRAM_RW (1)
22 22
23struct platdata_mtd_ram { 23struct platdata_mtd_ram {
24 char *mapname; 24 const char *mapname;
25 char **probes; 25 const char **map_probes;
26 const char **probes;
26 struct mtd_partition *partitions; 27 struct mtd_partition *partitions;
27 int nr_partitions; 28 int nr_partitions;
28 int bankwidth; 29 int bankwidth;
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
index 21ee440dd3e7..41d30c9c9de6 100644
--- a/include/linux/nfsd/nfsd.h
+++ b/include/linux/nfsd/nfsd.h
@@ -329,7 +329,7 @@ extern struct timeval nfssvc_boot;
329(FATTR4_WORD0_SIZE | FATTR4_WORD0_ACL ) 329(FATTR4_WORD0_SIZE | FATTR4_WORD0_ACL )
330#define NFSD_WRITEABLE_ATTRS_WORD1 \ 330#define NFSD_WRITEABLE_ATTRS_WORD1 \
331(FATTR4_WORD1_MODE | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP \ 331(FATTR4_WORD1_MODE | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP \
332 | FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_METADATA | FATTR4_WORD1_TIME_MODIFY_SET) 332 | FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET)
333 333
334#endif /* CONFIG_NFSD_V4 */ 334#endif /* CONFIG_NFSD_V4 */
335 335
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 779cbcd65f62..02df20f085fe 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -379,6 +379,18 @@ struct phy_driver {
379}; 379};
380#define to_phy_driver(d) container_of(d, struct phy_driver, driver) 380#define to_phy_driver(d) container_of(d, struct phy_driver, driver)
381 381
382#define PHY_ANY_ID "MATCH ANY PHY"
383#define PHY_ANY_UID 0xffffffff
384
385/* A Structure for boards to register fixups with the PHY Lib */
386struct phy_fixup {
387 struct list_head list;
388 char bus_id[BUS_ID_SIZE];
389 u32 phy_uid;
390 u32 phy_uid_mask;
391 int (*run)(struct phy_device *phydev);
392};
393
382int phy_read(struct phy_device *phydev, u16 regnum); 394int phy_read(struct phy_device *phydev, u16 regnum);
383int phy_write(struct phy_device *phydev, u16 regnum, u16 val); 395int phy_write(struct phy_device *phydev, u16 regnum, u16 val);
384int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id); 396int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id);
@@ -386,8 +398,8 @@ struct phy_device* get_phy_device(struct mii_bus *bus, int addr);
386int phy_clear_interrupt(struct phy_device *phydev); 398int phy_clear_interrupt(struct phy_device *phydev);
387int phy_config_interrupt(struct phy_device *phydev, u32 interrupts); 399int phy_config_interrupt(struct phy_device *phydev, u32 interrupts);
388struct phy_device * phy_attach(struct net_device *dev, 400struct phy_device * phy_attach(struct net_device *dev,
389 const char *phy_id, u32 flags, phy_interface_t interface); 401 const char *bus_id, u32 flags, phy_interface_t interface);
390struct phy_device * phy_connect(struct net_device *dev, const char *phy_id, 402struct phy_device * phy_connect(struct net_device *dev, const char *bus_id,
391 void (*handler)(struct net_device *), u32 flags, 403 void (*handler)(struct net_device *), u32 flags,
392 phy_interface_t interface); 404 phy_interface_t interface);
393void phy_disconnect(struct phy_device *phydev); 405void phy_disconnect(struct phy_device *phydev);
@@ -427,5 +439,13 @@ void phy_print_status(struct phy_device *phydev);
427struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id); 439struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id);
428void phy_device_free(struct phy_device *phydev); 440void phy_device_free(struct phy_device *phydev);
429 441
442int phy_register_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask,
443 int (*run)(struct phy_device *));
444int phy_register_fixup_for_id(const char *bus_id,
445 int (*run)(struct phy_device *));
446int phy_register_fixup_for_uid(u32 phy_uid, u32 phy_uid_mask,
447 int (*run)(struct phy_device *));
448int phy_scan_fixups(struct phy_device *phydev);
449
430extern struct bus_type mdio_bus_type; 450extern struct bus_type mdio_bus_type;
431#endif /* __PHY_H */ 451#endif /* __PHY_H */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 311380e5fe89..d0bd97044abd 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1926,6 +1926,8 @@ static inline unsigned long *end_of_stack(struct task_struct *p)
1926 1926
1927#endif 1927#endif
1928 1928
1929extern void thread_info_cache_init(void);
1930
1929/* set thread flags in other task's structures 1931/* set thread flags in other task's structures
1930 * - see asm/thread_info.h for TIF_xxxx flags available 1932 * - see asm/thread_info.h for TIF_xxxx flags available
1931 */ 1933 */
diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h
index 26e4925bc35b..632205ccc25d 100644
--- a/include/linux/seqlock.h
+++ b/include/linux/seqlock.h
@@ -85,23 +85,29 @@ static inline int write_tryseqlock(seqlock_t *sl)
85/* Start of read calculation -- fetch last complete writer token */ 85/* Start of read calculation -- fetch last complete writer token */
86static __always_inline unsigned read_seqbegin(const seqlock_t *sl) 86static __always_inline unsigned read_seqbegin(const seqlock_t *sl)
87{ 87{
88 unsigned ret = sl->sequence; 88 unsigned ret;
89
90repeat:
91 ret = sl->sequence;
89 smp_rmb(); 92 smp_rmb();
93 if (unlikely(ret & 1)) {
94 cpu_relax();
95 goto repeat;
96 }
97
90 return ret; 98 return ret;
91} 99}
92 100
93/* Test if reader processed invalid data. 101/*
94 * If initial values is odd, 102 * Test if reader processed invalid data.
95 * then writer had already started when section was entered 103 *
96 * If sequence value changed 104 * If sequence value changed then writer changed data while in section.
97 * then writer changed data while in section
98 *
99 * Using xor saves one conditional branch.
100 */ 105 */
101static __always_inline int read_seqretry(const seqlock_t *sl, unsigned iv) 106static __always_inline int read_seqretry(const seqlock_t *sl, unsigned start)
102{ 107{
103 smp_rmb(); 108 smp_rmb();
104 return (iv & 1) | (sl->sequence ^ iv); 109
110 return (sl->sequence != start);
105} 111}
106 112
107 113
@@ -122,20 +128,26 @@ typedef struct seqcount {
122/* Start of read using pointer to a sequence counter only. */ 128/* Start of read using pointer to a sequence counter only. */
123static inline unsigned read_seqcount_begin(const seqcount_t *s) 129static inline unsigned read_seqcount_begin(const seqcount_t *s)
124{ 130{
125 unsigned ret = s->sequence; 131 unsigned ret;
132
133repeat:
134 ret = s->sequence;
126 smp_rmb(); 135 smp_rmb();
136 if (unlikely(ret & 1)) {
137 cpu_relax();
138 goto repeat;
139 }
127 return ret; 140 return ret;
128} 141}
129 142
130/* Test if reader processed invalid data. 143/*
131 * Equivalent to: iv is odd or sequence number has changed. 144 * Test if reader processed invalid data because sequence number has changed.
132 * (iv & 1) || (*s != iv)
133 * Using xor saves one conditional branch.
134 */ 145 */
135static inline int read_seqcount_retry(const seqcount_t *s, unsigned iv) 146static inline int read_seqcount_retry(const seqcount_t *s, unsigned start)
136{ 147{
137 smp_rmb(); 148 smp_rmb();
138 return (iv & 1) | (s->sequence ^ iv); 149
150 return s->sequence != start;
139} 151}
140 152
141 153
diff --git a/include/linux/serio.h b/include/linux/serio.h
index 9f3825014674..95674d97dabd 100644
--- a/include/linux/serio.h
+++ b/include/linux/serio.h
@@ -211,5 +211,6 @@ static inline void serio_unpin_driver(struct serio *serio)
211#define SERIO_TOUCHWIN 0x33 211#define SERIO_TOUCHWIN 0x33
212#define SERIO_TAOSEVM 0x34 212#define SERIO_TAOSEVM 0x34
213#define SERIO_FUJITSU 0x35 213#define SERIO_FUJITSU 0x35
214#define SERIO_ZHENHUA 0x36
214 215
215#endif 216#endif
diff --git a/include/linux/spi/ads7846.h b/include/linux/spi/ads7846.h
index 334d31411629..daf744017a31 100644
--- a/include/linux/spi/ads7846.h
+++ b/include/linux/spi/ads7846.h
@@ -14,7 +14,8 @@ enum ads7846_filter {
14struct ads7846_platform_data { 14struct ads7846_platform_data {
15 u16 model; /* 7843, 7845, 7846. */ 15 u16 model; /* 7843, 7845, 7846. */
16 u16 vref_delay_usecs; /* 0 for external vref; etc */ 16 u16 vref_delay_usecs; /* 0 for external vref; etc */
17 int keep_vref_on:1; /* set to keep vref on for differential 17 u16 vref_mv; /* external vref value, milliVolts */
18 bool keep_vref_on; /* set to keep vref on for differential
18 * measurements as well */ 19 * measurements as well */
19 20
20 /* Settling time of the analog signals; a function of Vcc and the 21 /* Settling time of the analog signals; a function of Vcc and the
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 583e0481dfa0..c08689ea9b4b 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -23,6 +23,7 @@
23 23
24struct usb_device; 24struct usb_device;
25struct usb_driver; 25struct usb_driver;
26struct wusb_dev;
26 27
27/*-------------------------------------------------------------------------*/ 28/*-------------------------------------------------------------------------*/
28 29
@@ -341,103 +342,146 @@ struct usb_bus {
341 342
342struct usb_tt; 343struct usb_tt;
343 344
344/* 345/**
345 * struct usb_device - kernel's representation of a USB device 346 * struct usb_device - kernel's representation of a USB device
346 * 347 * @devnum: device number; address on a USB bus
347 * FIXME: Write the kerneldoc! 348 * @devpath: device ID string for use in messages (e.g., /port/...)
348 * 349 * @state: device state: configured, not attached, etc.
350 * @speed: device speed: high/full/low (or error)
351 * @tt: Transaction Translator info; used with low/full speed dev, highspeed hub
352 * @ttport: device port on that tt hub
353 * @toggle: one bit for each endpoint, with ([0] = IN, [1] = OUT) endpoints
354 * @parent: our hub, unless we're the root
355 * @bus: bus we're part of
356 * @ep0: endpoint 0 data (default control pipe)
357 * @dev: generic device interface
358 * @descriptor: USB device descriptor
359 * @config: all of the device's configs
360 * @actconfig: the active configuration
361 * @ep_in: array of IN endpoints
362 * @ep_out: array of OUT endpoints
363 * @rawdescriptors: raw descriptors for each config
364 * @bus_mA: Current available from the bus
365 * @portnum: parent port number (origin 1)
366 * @level: number of USB hub ancestors
367 * @can_submit: URBs may be submitted
368 * @discon_suspended: disconnected while suspended
369 * @persist_enabled: USB_PERSIST enabled for this device
370 * @have_langid: whether string_langid is valid
371 * @authorized: policy has said we can use it;
372 * (user space) policy determines if we authorize this device to be
373 * used or not. By default, wired USB devices are authorized.
374 * WUSB devices are not, until we authorize them from user space.
375 * FIXME -- complete doc
376 * @authenticated: Crypto authentication passed
377 * @wusb: device is Wireless USB
378 * @string_langid: language ID for strings
379 * @product: iProduct string, if present (static)
380 * @manufacturer: iManufacturer string, if present (static)
381 * @serial: iSerialNumber string, if present (static)
382 * @filelist: usbfs files that are open to this device
383 * @usb_classdev: USB class device that was created for usbfs device
384 * access from userspace
385 * @usbfs_dentry: usbfs dentry entry for the device
386 * @maxchild: number of ports if hub
387 * @children: child devices - USB devices that are attached to this hub
388 * @pm_usage_cnt: usage counter for autosuspend
389 * @quirks: quirks of the whole device
390 * @urbnum: number of URBs submitted for the whole device
391 * @active_duration: total time device is not suspended
392 * @autosuspend: for delayed autosuspends
393 * @pm_mutex: protects PM operations
394 * @last_busy: time of last use
395 * @autosuspend_delay: in jiffies
396 * @connect_time: time device was first connected
397 * @auto_pm: autosuspend/resume in progress
398 * @do_remote_wakeup: remote wakeup should be enabled
399 * @reset_resume: needs reset instead of resume
400 * @autosuspend_disabled: autosuspend disabled by the user
401 * @autoresume_disabled: autoresume disabled by the user
402 * @skip_sys_resume: skip the next system resume
403 *
404 * Notes:
349 * Usbcore drivers should not set usbdev->state directly. Instead use 405 * Usbcore drivers should not set usbdev->state directly. Instead use
350 * usb_set_device_state(). 406 * usb_set_device_state().
351 *
352 * @authorized: (user space) policy determines if we authorize this
353 * device to be used or not. By default, wired USB
354 * devices are authorized. WUSB devices are not, until we
355 * authorize them from user space. FIXME -- complete doc
356 */ 407 */
357struct usb_device { 408struct usb_device {
358 int devnum; /* Address on USB bus */ 409 int devnum;
359 char devpath [16]; /* Use in messages: /port/port/... */ 410 char devpath [16];
360 enum usb_device_state state; /* configured, not attached, etc */ 411 enum usb_device_state state;
361 enum usb_device_speed speed; /* high/full/low (or error) */ 412 enum usb_device_speed speed;
362 413
363 struct usb_tt *tt; /* low/full speed dev, highspeed hub */ 414 struct usb_tt *tt;
364 int ttport; /* device port on that tt hub */ 415 int ttport;
365 416
366 unsigned int toggle[2]; /* one bit for each endpoint 417 unsigned int toggle[2];
367 * ([0] = IN, [1] = OUT) */
368 418
369 struct usb_device *parent; /* our hub, unless we're the root */ 419 struct usb_device *parent;
370 struct usb_bus *bus; /* Bus we're part of */ 420 struct usb_bus *bus;
371 struct usb_host_endpoint ep0; 421 struct usb_host_endpoint ep0;
372 422
373 struct device dev; /* Generic device interface */ 423 struct device dev;
374 424
375 struct usb_device_descriptor descriptor;/* Descriptor */ 425 struct usb_device_descriptor descriptor;
376 struct usb_host_config *config; /* All of the configs */ 426 struct usb_host_config *config;
377 427
378 struct usb_host_config *actconfig;/* the active configuration */ 428 struct usb_host_config *actconfig;
379 struct usb_host_endpoint *ep_in[16]; 429 struct usb_host_endpoint *ep_in[16];
380 struct usb_host_endpoint *ep_out[16]; 430 struct usb_host_endpoint *ep_out[16];
381 431
382 char **rawdescriptors; /* Raw descriptors for each config */ 432 char **rawdescriptors;
383 433
384 unsigned short bus_mA; /* Current available from the bus */ 434 unsigned short bus_mA;
385 u8 portnum; /* Parent port number (origin 1) */ 435 u8 portnum;
386 u8 level; /* Number of USB hub ancestors */ 436 u8 level;
387 437
388 unsigned can_submit:1; /* URBs may be submitted */ 438 unsigned can_submit:1;
389 unsigned discon_suspended:1; /* Disconnected while suspended */ 439 unsigned discon_suspended:1;
390 unsigned have_langid:1; /* whether string_langid is valid */ 440 unsigned persist_enabled:1;
391 unsigned authorized:1; /* Policy has said we can use it */ 441 unsigned have_langid:1;
392 unsigned wusb:1; /* Device is Wireless USB */ 442 unsigned authorized:1;
393 int string_langid; /* language ID for strings */ 443 unsigned authenticated:1;
444 unsigned wusb:1;
445 int string_langid;
394 446
395 /* static strings from the device */ 447 /* static strings from the device */
396 char *product; /* iProduct string, if present */ 448 char *product;
397 char *manufacturer; /* iManufacturer string, if present */ 449 char *manufacturer;
398 char *serial; /* iSerialNumber string, if present */ 450 char *serial;
399 451
400 struct list_head filelist; 452 struct list_head filelist;
401#ifdef CONFIG_USB_DEVICE_CLASS 453#ifdef CONFIG_USB_DEVICE_CLASS
402 struct device *usb_classdev; 454 struct device *usb_classdev;
403#endif 455#endif
404#ifdef CONFIG_USB_DEVICEFS 456#ifdef CONFIG_USB_DEVICEFS
405 struct dentry *usbfs_dentry; /* usbfs dentry entry for the device */ 457 struct dentry *usbfs_dentry;
406#endif 458#endif
407 /*
408 * Child devices - these can be either new devices
409 * (if this is a hub device), or different instances
410 * of this same device.
411 *
412 * Each instance needs its own set of data structures.
413 */
414 459
415 int maxchild; /* Number of ports if hub */ 460 int maxchild;
416 struct usb_device *children[USB_MAXCHILDREN]; 461 struct usb_device *children[USB_MAXCHILDREN];
417 462
418 int pm_usage_cnt; /* usage counter for autosuspend */ 463 int pm_usage_cnt;
419 u32 quirks; /* quirks of the whole device */ 464 u32 quirks;
420 atomic_t urbnum; /* number of URBs submitted for 465 atomic_t urbnum;
421 the whole device */
422 466
423 unsigned long active_duration; /* total time device is not suspended */ 467 unsigned long active_duration;
424 468
425#ifdef CONFIG_PM 469#ifdef CONFIG_PM
426 struct delayed_work autosuspend; /* for delayed autosuspends */ 470 struct delayed_work autosuspend;
427 struct mutex pm_mutex; /* protects PM operations */ 471 struct mutex pm_mutex;
428 472
429 unsigned long last_busy; /* time of last use */ 473 unsigned long last_busy;
430 int autosuspend_delay; /* in jiffies */ 474 int autosuspend_delay;
431 unsigned long connect_time; /* time device was first connected */ 475 unsigned long connect_time;
432 476
433 unsigned auto_pm:1; /* autosuspend/resume in progress */ 477 unsigned auto_pm:1;
434 unsigned do_remote_wakeup:1; /* remote wakeup should be enabled */ 478 unsigned do_remote_wakeup:1;
435 unsigned reset_resume:1; /* needs reset instead of resume */ 479 unsigned reset_resume:1;
436 unsigned persist_enabled:1; /* USB_PERSIST enabled for this dev */ 480 unsigned autosuspend_disabled:1;
437 unsigned autosuspend_disabled:1; /* autosuspend and autoresume */ 481 unsigned autoresume_disabled:1;
438 unsigned autoresume_disabled:1; /* disabled by the user */ 482 unsigned skip_sys_resume:1;
439 unsigned skip_sys_resume:1; /* skip the next system resume */
440#endif 483#endif
484 struct wusb_dev *wusb_dev;
441}; 485};
442#define to_usb_device(d) container_of(d, struct usb_device, dev) 486#define to_usb_device(d) container_of(d, struct usb_device, dev)
443 487
@@ -898,10 +942,11 @@ struct usbdrv_wrap {
898 * and should normally be the same as the module name. 942 * and should normally be the same as the module name.
899 * @probe: Called to see if the driver is willing to manage a particular 943 * @probe: Called to see if the driver is willing to manage a particular
900 * interface on a device. If it is, probe returns zero and uses 944 * interface on a device. If it is, probe returns zero and uses
901 * dev_set_drvdata() to associate driver-specific data with the 945 * usb_set_intfdata() to associate driver-specific data with the
902 * interface. It may also use usb_set_interface() to specify the 946 * interface. It may also use usb_set_interface() to specify the
903 * appropriate altsetting. If unwilling to manage the interface, 947 * appropriate altsetting. If unwilling to manage the interface,
904 * return a negative errno value. 948 * return -ENODEV, if genuine IO errors occured, an appropriate
949 * negative errno value.
905 * @disconnect: Called when the interface is no longer accessible, usually 950 * @disconnect: Called when the interface is no longer accessible, usually
906 * because its device has been (or is being) disconnected or the 951 * because its device has been (or is being) disconnected or the
907 * driver module is being unloaded. 952 * driver module is being unloaded.
@@ -916,10 +961,7 @@ struct usbdrv_wrap {
916 * @pre_reset: Called by usb_reset_composite_device() when the device 961 * @pre_reset: Called by usb_reset_composite_device() when the device
917 * is about to be reset. 962 * is about to be reset.
918 * @post_reset: Called by usb_reset_composite_device() after the device 963 * @post_reset: Called by usb_reset_composite_device() after the device
919 * has been reset, or in lieu of @resume following a reset-resume 964 * has been reset
920 * (i.e., the device is reset instead of being resumed, as might
921 * happen if power was lost). The second argument tells which is
922 * the reason.
923 * @id_table: USB drivers use ID table to support hotplugging. 965 * @id_table: USB drivers use ID table to support hotplugging.
924 * Export this with MODULE_DEVICE_TABLE(usb,...). This must be set 966 * Export this with MODULE_DEVICE_TABLE(usb,...). This must be set
925 * or your driver's probe function will never get called. 967 * or your driver's probe function will never get called.
@@ -1411,6 +1453,7 @@ extern int usb_submit_urb(struct urb *urb, gfp_t mem_flags);
1411extern int usb_unlink_urb(struct urb *urb); 1453extern int usb_unlink_urb(struct urb *urb);
1412extern void usb_kill_urb(struct urb *urb); 1454extern void usb_kill_urb(struct urb *urb);
1413extern void usb_kill_anchored_urbs(struct usb_anchor *anchor); 1455extern void usb_kill_anchored_urbs(struct usb_anchor *anchor);
1456extern void usb_unlink_anchored_urbs(struct usb_anchor *anchor);
1414extern void usb_anchor_urb(struct urb *urb, struct usb_anchor *anchor); 1457extern void usb_anchor_urb(struct urb *urb, struct usb_anchor *anchor);
1415extern void usb_unanchor_urb(struct urb *urb); 1458extern void usb_unanchor_urb(struct urb *urb);
1416extern int usb_wait_anchor_empty_timeout(struct usb_anchor *anchor, 1459extern int usb_wait_anchor_empty_timeout(struct usb_anchor *anchor,
@@ -1661,13 +1704,12 @@ extern void usb_unregister_notify(struct notifier_block *nb);
1661#define dbg(format, arg...) do {} while (0) 1704#define dbg(format, arg...) do {} while (0)
1662#endif 1705#endif
1663 1706
1664#define err(format, arg...) printk(KERN_ERR "%s: " format "\n" , \ 1707#define err(format, arg...) printk(KERN_ERR KBUILD_MODNAME ": " \
1665 __FILE__ , ## arg) 1708 format "\n" , ## arg)
1666#define info(format, arg...) printk(KERN_INFO "%s: " format "\n" , \ 1709#define info(format, arg...) printk(KERN_INFO KBUILD_MODNAME ": " \
1667 __FILE__ , ## arg) 1710 format "\n" , ## arg)
1668#define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n" , \ 1711#define warn(format, arg...) printk(KERN_WARNING KBUILD_MODNAME ": " \
1669 __FILE__ , ## arg) 1712 format "\n" , ## arg)
1670
1671 1713
1672#endif /* __KERNEL__ */ 1714#endif /* __KERNEL__ */
1673 1715
diff --git a/include/linux/usb/audio.h b/include/linux/usb/audio.h
index 2dfeef16b221..8cb025fef634 100644
--- a/include/linux/usb/audio.h
+++ b/include/linux/usb/audio.h
@@ -50,4 +50,4 @@ struct usb_ac_header_descriptor_##n { \
50 __u8 baInterfaceNr[n]; \ 50 __u8 baInterfaceNr[n]; \
51} __attribute__ ((packed)) 51} __attribute__ ((packed))
52 52
53#endif 53#endif /* __LINUX_USB_AUDIO_H */
diff --git a/include/linux/usb/cdc.h b/include/linux/usb/cdc.h
index 94ee4ecf0564..71e52f2f6a38 100644
--- a/include/linux/usb/cdc.h
+++ b/include/linux/usb/cdc.h
@@ -6,6 +6,9 @@
6 * firmware based USB peripherals. 6 * firmware based USB peripherals.
7 */ 7 */
8 8
9#ifndef __LINUX_USB_CDC_H
10#define __LINUX_USB_CDC_H
11
9#define USB_CDC_SUBCLASS_ACM 0x02 12#define USB_CDC_SUBCLASS_ACM 0x02
10#define USB_CDC_SUBCLASS_ETHERNET 0x06 13#define USB_CDC_SUBCLASS_ETHERNET 0x06
11#define USB_CDC_SUBCLASS_WHCM 0x08 14#define USB_CDC_SUBCLASS_WHCM 0x08
@@ -221,3 +224,4 @@ struct usb_cdc_notification {
221 __le16 wLength; 224 __le16 wLength;
222} __attribute__ ((packed)); 225} __attribute__ ((packed));
223 226
227#endif /* __LINUX_USB_CDC_H */
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index 6169438ec5a2..7e0d3084f76c 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -66,8 +66,8 @@
66#define USB_RECIP_ENDPOINT 0x02 66#define USB_RECIP_ENDPOINT 0x02
67#define USB_RECIP_OTHER 0x03 67#define USB_RECIP_OTHER 0x03
68/* From Wireless USB 1.0 */ 68/* From Wireless USB 1.0 */
69#define USB_RECIP_PORT 0x04 69#define USB_RECIP_PORT 0x04
70#define USB_RECIP_RPIPE 0x05 70#define USB_RECIP_RPIPE 0x05
71 71
72/* 72/*
73 * Standard requests, for the bRequest field of a SETUP packet. 73 * Standard requests, for the bRequest field of a SETUP packet.
@@ -102,10 +102,16 @@
102#define USB_REQ_LOOPBACK_DATA_READ 0x16 102#define USB_REQ_LOOPBACK_DATA_READ 0x16
103#define USB_REQ_SET_INTERFACE_DS 0x17 103#define USB_REQ_SET_INTERFACE_DS 0x17
104 104
105/* The Link Power Mangement (LPM) ECN defines USB_REQ_TEST_AND_SET command,
106 * used by hubs to put ports into a new L1 suspend state, except that it
107 * forgot to define its number ...
108 */
109
105/* 110/*
106 * USB feature flags are written using USB_REQ_{CLEAR,SET}_FEATURE, and 111 * USB feature flags are written using USB_REQ_{CLEAR,SET}_FEATURE, and
107 * are read as a bit array returned by USB_REQ_GET_STATUS. (So there 112 * are read as a bit array returned by USB_REQ_GET_STATUS. (So there
108 * are at most sixteen features of each type.) 113 * are at most sixteen features of each type.) Hubs may also support a
114 * new USB_REQ_TEST_AND_SET_FEATURE to put ports into L1 suspend.
109 */ 115 */
110#define USB_DEVICE_SELF_POWERED 0 /* (read only) */ 116#define USB_DEVICE_SELF_POWERED 0 /* (read only) */
111#define USB_DEVICE_REMOTE_WAKEUP 1 /* dev may initiate wakeup */ 117#define USB_DEVICE_REMOTE_WAKEUP 1 /* dev may initiate wakeup */
@@ -180,6 +186,7 @@ struct usb_ctrlrequest {
180#define USB_DT_WIRELESS_ENDPOINT_COMP 0x11 186#define USB_DT_WIRELESS_ENDPOINT_COMP 0x11
181#define USB_DT_WIRE_ADAPTER 0x21 187#define USB_DT_WIRE_ADAPTER 0x21
182#define USB_DT_RPIPE 0x22 188#define USB_DT_RPIPE 0x22
189#define USB_DT_CS_RADIO_CONTROL 0x23
183 190
184/* Conventional codes for class-specific descriptors. The convention is 191/* Conventional codes for class-specific descriptors. The convention is
185 * defined in the USB "Common Class" Spec (3.11). Individual class specs 192 * defined in the USB "Common Class" Spec (3.11). Individual class specs
@@ -574,7 +581,9 @@ enum usb_device_state {
574 /* NOTE: there are actually four different SUSPENDED 581 /* NOTE: there are actually four different SUSPENDED
575 * states, returning to POWERED, DEFAULT, ADDRESS, or 582 * states, returning to POWERED, DEFAULT, ADDRESS, or
576 * CONFIGURED respectively when SOF tokens flow again. 583 * CONFIGURED respectively when SOF tokens flow again.
584 * At this level there's no difference between L1 and L2
585 * suspend states. (L2 being original USB 1.1 suspend.)
577 */ 586 */
578}; 587};
579 588
580#endif /* __LINUX_USB_CH9_H */ 589#endif /* __LINUX_USB_CH9_H */
diff --git a/include/linux/usb/g_printer.h b/include/linux/usb/g_printer.h
index 0c5ea1e3eb98..6178fde50f74 100644
--- a/include/linux/usb/g_printer.h
+++ b/include/linux/usb/g_printer.h
@@ -18,6 +18,8 @@
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20 20
21#ifndef __LINUX_USB_G_PRINTER_H
22#define __LINUX_USB_G_PRINTER_H
21 23
22#define PRINTER_NOT_ERROR 0x08 24#define PRINTER_NOT_ERROR 0x08
23#define PRINTER_SELECTED 0x10 25#define PRINTER_SELECTED 0x10
@@ -29,3 +31,5 @@
29 */ 31 */
30#define GADGET_GET_PRINTER_STATUS _IOR('g', 0x21, unsigned char) 32#define GADGET_GET_PRINTER_STATUS _IOR('g', 0x21, unsigned char)
31#define GADGET_SET_PRINTER_STATUS _IOWR('g', 0x22, unsigned char) 33#define GADGET_SET_PRINTER_STATUS _IOWR('g', 0x22, unsigned char)
34
35#endif /* __LINUX_USB_G_PRINTER_H */
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index f3295296b435..d8128f7102c9 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -846,4 +846,4 @@ extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *,
846 846
847extern void usb_ep_autoconfig_reset(struct usb_gadget *) __devinit; 847extern void usb_ep_autoconfig_reset(struct usb_gadget *) __devinit;
848 848
849#endif /* __LINUX_USB_GADGET_H */ 849#endif /* __LINUX_USB_GADGET_H */
diff --git a/include/linux/usb/gadgetfs.h b/include/linux/usb/gadgetfs.h
index c291ab1af747..ea45f265ec05 100644
--- a/include/linux/usb/gadgetfs.h
+++ b/include/linux/usb/gadgetfs.h
@@ -1,11 +1,3 @@
1#ifndef __LINUX_USB_GADGETFS_H
2#define __LINUX_USB_GADGETFS_H
3
4#include <asm/types.h>
5#include <asm/ioctl.h>
6
7#include <linux/usb/ch9.h>
8
9/* 1/*
10 * Filesystem based user-mode API to USB Gadget controller hardware 2 * Filesystem based user-mode API to USB Gadget controller hardware
11 * 3 *
@@ -23,6 +15,14 @@
23 * then performing data transfers by reading or writing. 15 * then performing data transfers by reading or writing.
24 */ 16 */
25 17
18#ifndef __LINUX_USB_GADGETFS_H
19#define __LINUX_USB_GADGETFS_H
20
21#include <asm/types.h>
22#include <asm/ioctl.h>
23
24#include <linux/usb/ch9.h>
25
26/* 26/*
27 * Events are delivered on the ep0 file descriptor, when the user mode driver 27 * Events are delivered on the ep0 file descriptor, when the user mode driver
28 * reads from this file descriptor after writing the descriptors. Don't 28 * reads from this file descriptor after writing the descriptors. Don't
diff --git a/include/linux/usb/input.h b/include/linux/usb/input.h
index 716e0cc16043..0e010b220e85 100644
--- a/include/linux/usb/input.h
+++ b/include/linux/usb/input.h
@@ -1,6 +1,3 @@
1#ifndef __USB_INPUT_H
2#define __USB_INPUT_H
3
4/* 1/*
5 * Copyright (C) 2005 Dmitry Torokhov 2 * Copyright (C) 2005 Dmitry Torokhov
6 * 3 *
@@ -9,6 +6,9 @@
9 * the Free Software Foundation. 6 * the Free Software Foundation.
10 */ 7 */
11 8
9#ifndef __LINUX_USB_INPUT_H
10#define __LINUX_USB_INPUT_H
11
12#include <linux/usb.h> 12#include <linux/usb.h>
13#include <linux/input.h> 13#include <linux/input.h>
14#include <asm/byteorder.h> 14#include <asm/byteorder.h>
@@ -22,4 +22,4 @@ usb_to_input_id(const struct usb_device *dev, struct input_id *id)
22 id->version = le16_to_cpu(dev->descriptor.bcdDevice); 22 id->version = le16_to_cpu(dev->descriptor.bcdDevice);
23} 23}
24 24
25#endif 25#endif /* __LINUX_USB_INPUT_H */
diff --git a/include/linux/usb/iowarrior.h b/include/linux/usb/iowarrior.h
index de6f380e17a2..4fd6513d564c 100644
--- a/include/linux/usb/iowarrior.h
+++ b/include/linux/usb/iowarrior.h
@@ -1,5 +1,5 @@
1#ifndef _IOWARRIOR_H_ 1#ifndef __LINUX_USB_IOWARRIOR_H
2#define _IOWARRIOR_H_ 2#define __LINUX_USB_IOWARRIOR_H
3 3
4#define CODEMERCS_MAGIC_NUMBER 0xC0 /* like COde Mercenaries */ 4#define CODEMERCS_MAGIC_NUMBER 0xC0 /* like COde Mercenaries */
5 5
@@ -39,4 +39,4 @@ struct iowarrior_info {
39*/ 39*/
40#define IOW_GETINFO _IOR(CODEMERCS_MAGIC_NUMBER, 3, struct iowarrior_info) 40#define IOW_GETINFO _IOR(CODEMERCS_MAGIC_NUMBER, 3, struct iowarrior_info)
41 41
42#endif /* _IOWARRIOR_H_ */ 42#endif /* __LINUX_USB_IOWARRIOR_H */
diff --git a/include/linux/usb/isp116x.h b/include/linux/usb/isp116x.h
index 67d2826f34fe..96ca114e88d0 100644
--- a/include/linux/usb/isp116x.h
+++ b/include/linux/usb/isp116x.h
@@ -1,9 +1,11 @@
1
2/* 1/*
3 * Board initialization code should put one of these into dev->platform_data 2 * Board initialization code should put one of these into dev->platform_data
4 * and place the isp116x onto platform_bus. 3 * and place the isp116x onto platform_bus.
5 */ 4 */
6 5
6#ifndef __LINUX_USB_ISP116X_H
7#define __LINUX_USB_ISP116X_H
8
7struct isp116x_platform_data { 9struct isp116x_platform_data {
8 /* Enable internal resistors on downstream ports */ 10 /* Enable internal resistors on downstream ports */
9 unsigned sel15Kres:1; 11 unsigned sel15Kres:1;
@@ -27,3 +29,5 @@ struct isp116x_platform_data {
27 */ 29 */
28 void (*delay) (struct device *dev, int delay); 30 void (*delay) (struct device *dev, int delay);
29}; 31};
32
33#endif /* __LINUX_USB_ISP116X_H */
diff --git a/include/linux/usb/midi.h b/include/linux/usb/midi.h
index 80624c562921..1d1040865661 100644
--- a/include/linux/usb/midi.h
+++ b/include/linux/usb/midi.h
@@ -109,4 +109,4 @@ struct usb_ms_endpoint_descriptor_##n { \
109 __u8 baAssocJackID[n]; \ 109 __u8 baAssocJackID[n]; \
110} __attribute__ ((packed)) 110} __attribute__ ((packed))
111 111
112#endif 112#endif /* __LINUX_USB_MIDI_H */
diff --git a/include/linux/usb/net2280.h b/include/linux/usb/net2280.h
index ec897cb844ab..96ca549a778d 100644
--- a/include/linux/usb/net2280.h
+++ b/include/linux/usb/net2280.h
@@ -1,11 +1,7 @@
1/* 1/*
2 * NetChip 2280 high/full speed USB device controller. 2 * NetChip 2280 high/full speed USB device controller.
3 * Unlike many such controllers, this one talks PCI. 3 * Unlike many such controllers, this one talks PCI.
4 */ 4 *
5#ifndef __LINUX_USB_NET2280_H
6#define __LINUX_USB_NET2280_H
7
8/*
9 * Copyright (C) 2002 NetChip Technology, Inc. (http://www.netchip.com) 5 * Copyright (C) 2002 NetChip Technology, Inc. (http://www.netchip.com)
10 * Copyright (C) 2003 David Brownell 6 * Copyright (C) 2003 David Brownell
11 * 7 *
@@ -24,6 +20,9 @@
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 */ 21 */
26 22
23#ifndef __LINUX_USB_NET2280_H
24#define __LINUX_USB_NET2280_H
25
27/*-------------------------------------------------------------------------*/ 26/*-------------------------------------------------------------------------*/
28 27
29/* NET2280 MEMORY MAPPED REGISTERS 28/* NET2280 MEMORY MAPPED REGISTERS
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index e007074ebe41..1db25d152ad8 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -1,11 +1,13 @@
1/* USB OTG (On The Go) defines */ 1/* USB OTG (On The Go) defines */
2
3/* 2/*
3 *
4 * These APIs may be used between USB controllers. USB device drivers 4 * These APIs may be used between USB controllers. USB device drivers
5 * (for either host or peripheral roles) don't use these calls; they 5 * (for either host or peripheral roles) don't use these calls; they
6 * continue to use just usb_device and usb_gadget. 6 * continue to use just usb_device and usb_gadget.
7 */ 7 */
8 8
9#ifndef __LINUX_USB_OTG_H
10#define __LINUX_USB_OTG_H
9 11
10/* OTG defines lots of enumeration states before device reset */ 12/* OTG defines lots of enumeration states before device reset */
11enum usb_otg_state { 13enum usb_otg_state {
@@ -129,3 +131,5 @@ otg_start_srp(struct otg_transceiver *otg)
129 131
130/* for OTG controller drivers (and maybe other stuff) */ 132/* for OTG controller drivers (and maybe other stuff) */
131extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num); 133extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num);
134
135#endif /* __LINUX_USB_OTG_H */
diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h
index 1f999ec8d08c..7f6c603db654 100644
--- a/include/linux/usb/quirks.h
+++ b/include/linux/usb/quirks.h
@@ -4,6 +4,9 @@
4 * belong here. 4 * belong here.
5 */ 5 */
6 6
7#ifndef __LINUX_USB_QUIRKS_H
8#define __LINUX_USB_QUIRKS_H
9
7/* string descriptors must not be fetched using a 255-byte read */ 10/* string descriptors must not be fetched using a 255-byte read */
8#define USB_QUIRK_STRING_FETCH_255 0x00000001 11#define USB_QUIRK_STRING_FETCH_255 0x00000001
9 12
@@ -12,3 +15,5 @@
12 15
13/* device can't handle Set-Interface requests */ 16/* device can't handle Set-Interface requests */
14#define USB_QUIRK_NO_SET_INTF 0x00000004 17#define USB_QUIRK_NO_SET_INTF 0x00000004
18
19#endif /* __LINUX_USB_QUIRKS_H */
diff --git a/include/linux/usb/rndis_host.h b/include/linux/usb/rndis_host.h
index edc1d4a0e272..29d6458ecb8d 100644
--- a/include/linux/usb/rndis_host.h
+++ b/include/linux/usb/rndis_host.h
@@ -17,10 +17,8 @@
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */ 18 */
19 19
20 20#ifndef __LINUX_USB_RNDIS_HOST_H
21#ifndef __RNDIS_HOST_H 21#define __LINUX_USB_RNDIS_HOST_H
22#define __RNDIS_HOST_H
23
24 22
25/* 23/*
26 * CONTROL uses CDC "encapsulated commands" with funky notifications. 24 * CONTROL uses CDC "encapsulated commands" with funky notifications.
@@ -270,5 +268,4 @@ extern int rndis_rx_fixup(struct usbnet *dev, struct sk_buff *skb);
270extern struct sk_buff * 268extern struct sk_buff *
271rndis_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags); 269rndis_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags);
272 270
273#endif /* __RNDIS_HOST_H */ 271#endif /* __LINUX_USB_RNDIS_HOST_H */
274
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 21b4a1c6f585..8f891cbaf9ab 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -10,7 +10,6 @@
10 * 10 *
11 */ 11 */
12 12
13
14#ifndef __LINUX_USB_SERIAL_H 13#ifndef __LINUX_USB_SERIAL_H
15#define __LINUX_USB_SERIAL_H 14#define __LINUX_USB_SERIAL_H
16 15
@@ -146,8 +145,6 @@ struct usb_serial {
146}; 145};
147#define to_usb_serial(d) container_of(d, struct usb_serial, kref) 146#define to_usb_serial(d) container_of(d, struct usb_serial, kref)
148 147
149#define NUM_DONT_CARE 99
150
151/* get and set the serial private data pointer helper functions */ 148/* get and set the serial private data pointer helper functions */
152static inline void *usb_get_serial_data(struct usb_serial *serial) 149static inline void *usb_get_serial_data(struct usb_serial *serial)
153{ 150{
@@ -165,18 +162,6 @@ static inline void usb_set_serial_data(struct usb_serial *serial, void *data)
165 * used in the syslog messages when a device is inserted or removed. 162 * used in the syslog messages when a device is inserted or removed.
166 * @id_table: pointer to a list of usb_device_id structures that define all 163 * @id_table: pointer to a list of usb_device_id structures that define all
167 * of the devices this structure can support. 164 * of the devices this structure can support.
168 * @num_interrupt_in: If a device doesn't have this many interrupt-in
169 * endpoints, it won't be sent to the driver's attach() method.
170 * (But it might still be sent to the probe() method.)
171 * @num_interrupt_out: If a device doesn't have this many interrupt-out
172 * endpoints, it won't be sent to the driver's attach() method.
173 * (But it might still be sent to the probe() method.)
174 * @num_bulk_in: If a device doesn't have this many bulk-in
175 * endpoints, it won't be sent to the driver's attach() method.
176 * (But it might still be sent to the probe() method.)
177 * @num_bulk_out: If a device doesn't have this many bulk-out
178 * endpoints, it won't be sent to the driver's attach() method.
179 * (But it might still be sent to the probe() method.)
180 * @num_ports: the number of different ports this device will have. 165 * @num_ports: the number of different ports this device will have.
181 * @calc_num_ports: pointer to a function to determine how many ports this 166 * @calc_num_ports: pointer to a function to determine how many ports this
182 * device has dynamically. It will be called after the probe() 167 * device has dynamically. It will be called after the probe()
@@ -212,10 +197,6 @@ static inline void usb_set_serial_data(struct usb_serial *serial, void *data)
212struct usb_serial_driver { 197struct usb_serial_driver {
213 const char *description; 198 const char *description;
214 const struct usb_device_id *id_table; 199 const struct usb_device_id *id_table;
215 char num_interrupt_in;
216 char num_interrupt_out;
217 char num_bulk_in;
218 char num_bulk_out;
219 char num_ports; 200 char num_ports;
220 201
221 struct list_head driver_list; 202 struct list_head driver_list;
@@ -340,5 +321,5 @@ static inline void usb_serial_debug_data(int debug,
340 321
341 322
342 323
343#endif /* ifdef __LINUX_USB_SERIAL_H */ 324#endif /* __LINUX_USB_SERIAL_H */
344 325
diff --git a/include/linux/usb/sl811.h b/include/linux/usb/sl811.h
index 877373da410d..3afe4d16fcef 100644
--- a/include/linux/usb/sl811.h
+++ b/include/linux/usb/sl811.h
@@ -1,9 +1,11 @@
1
2/* 1/*
3 * board initialization should put one of these into dev->platform_data 2 * board initialization should put one of these into dev->platform_data
4 * and place the sl811hs onto platform_bus named "sl811-hcd". 3 * and place the sl811hs onto platform_bus named "sl811-hcd".
5 */ 4 */
6 5
6#ifndef __LINUX_USB_SL811_H
7#define __LINUX_USB_SL811_H
8
7struct sl811_platform_data { 9struct sl811_platform_data {
8 unsigned can_wakeup:1; 10 unsigned can_wakeup:1;
9 11
@@ -24,3 +26,4 @@ struct sl811_platform_data {
24 /* void (*clock_enable)(struct device *dev, int is_on); */ 26 /* void (*clock_enable)(struct device *dev, int is_on); */
25}; 27};
26 28
29#endif /* __LINUX_USB_SL811_H */
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index e0501da3dd11..ba09fe88adda 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -19,10 +19,8 @@
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */ 20 */
21 21
22 22#ifndef __LINUX_USB_USBNET_H
23#ifndef __USBNET_H 23#define __LINUX_USB_USBNET_H
24#define __USBNET_H
25
26 24
27/* interface from usbnet core to each USB networking link we handle */ 25/* interface from usbnet core to each USB networking link we handle */
28struct usbnet { 26struct usbnet {
@@ -211,4 +209,4 @@ extern int usbnet_nway_reset(struct net_device *net);
211 printk(KERN_INFO "%s: " fmt "\n" , (usbnet)->net->name , ## arg); \ 209 printk(KERN_INFO "%s: " fmt "\n" , (usbnet)->net->name , ## arg); \
212 210
213 211
214#endif /* __USBNET_H */ 212#endif /* __LINUX_USB_USBNET_H */
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h
index 0a40dfa44c9f..d9a3bbe38e6b 100644
--- a/include/linux/usb_usual.h
+++ b/include/linux/usb_usual.h
@@ -85,6 +85,7 @@ enum { US_DO_ALL_FLAGS };
85#define US_SC_LOCKABLE 0x07 /* Password-protected */ 85#define US_SC_LOCKABLE 0x07 /* Password-protected */
86 86
87#define US_SC_ISD200 0xf0 /* ISD200 ATA */ 87#define US_SC_ISD200 0xf0 /* ISD200 ATA */
88#define US_SC_CYP_ATACB 0xf1 /* Cypress ATACB */
88#define US_SC_DEVICE 0xff /* Use device's value */ 89#define US_SC_DEVICE 0xff /* Use device's value */
89 90
90/* Protocols */ 91/* Protocols */
diff --git a/include/linux/usbdevice_fs.h b/include/linux/usbdevice_fs.h
index 17cb108b7db0..3118ede2c67b 100644
--- a/include/linux/usbdevice_fs.h
+++ b/include/linux/usbdevice_fs.h
@@ -77,8 +77,11 @@ struct usbdevfs_connectinfo {
77 unsigned char slow; 77 unsigned char slow;
78}; 78};
79 79
80#define USBDEVFS_URB_SHORT_NOT_OK 1 80#define USBDEVFS_URB_SHORT_NOT_OK 0x01
81#define USBDEVFS_URB_ISO_ASAP 2 81#define USBDEVFS_URB_ISO_ASAP 0x02
82#define USBDEVFS_URB_NO_FSBR 0x20
83#define USBDEVFS_URB_ZERO_PACKET 0x40
84#define USBDEVFS_URB_NO_INTERRUPT 0x80
82 85
83#define USBDEVFS_URB_TYPE_ISO 0 86#define USBDEVFS_URB_TYPE_ISO 0
84#define USBDEVFS_URB_TYPE_INTERRUPT 1 87#define USBDEVFS_URB_TYPE_INTERRUPT 1
diff --git a/include/linux/wm97xx.h b/include/linux/wm97xx.h
new file mode 100644
index 000000000000..4d13732e9cf0
--- /dev/null
+++ b/include/linux/wm97xx.h
@@ -0,0 +1,314 @@
1
2/*
3 * Register bits and API for Wolfson WM97xx series of codecs
4 */
5
6#ifndef _LINUX_WM97XX_H
7#define _LINUX_WM97XX_H
8
9#include <sound/core.h>
10#include <sound/pcm.h>
11#include <sound/ac97_codec.h>
12#include <sound/initval.h>
13#include <linux/types.h>
14#include <linux/list.h>
15#include <linux/input.h> /* Input device layer */
16#include <linux/platform_device.h>
17
18/*
19 * WM97xx AC97 Touchscreen registers
20 */
21#define AC97_WM97XX_DIGITISER1 0x76
22#define AC97_WM97XX_DIGITISER2 0x78
23#define AC97_WM97XX_DIGITISER_RD 0x7a
24#define AC97_WM9713_DIG1 0x74
25#define AC97_WM9713_DIG2 AC97_WM97XX_DIGITISER1
26#define AC97_WM9713_DIG3 AC97_WM97XX_DIGITISER2
27
28/*
29 * WM97xx register bits
30 */
31#define WM97XX_POLL 0x8000 /* initiate a polling measurement */
32#define WM97XX_ADCSEL_X 0x1000 /* x coord measurement */
33#define WM97XX_ADCSEL_Y 0x2000 /* y coord measurement */
34#define WM97XX_ADCSEL_PRES 0x3000 /* pressure measurement */
35#define WM97XX_ADCSEL_MASK 0x7000
36#define WM97XX_COO 0x0800 /* enable coordinate mode */
37#define WM97XX_CTC 0x0400 /* enable continuous mode */
38#define WM97XX_CM_RATE_93 0x0000 /* 93.75Hz continuous rate */
39#define WM97XX_CM_RATE_187 0x0100 /* 187.5Hz continuous rate */
40#define WM97XX_CM_RATE_375 0x0200 /* 375Hz continuous rate */
41#define WM97XX_CM_RATE_750 0x0300 /* 750Hz continuous rate */
42#define WM97XX_CM_RATE_8K 0x00f0 /* 8kHz continuous rate */
43#define WM97XX_CM_RATE_12K 0x01f0 /* 12kHz continuous rate */
44#define WM97XX_CM_RATE_24K 0x02f0 /* 24kHz continuous rate */
45#define WM97XX_CM_RATE_48K 0x03f0 /* 48kHz continuous rate */
46#define WM97XX_CM_RATE_MASK 0x03f0
47#define WM97XX_RATE(i) (((i & 3) << 8) | ((i & 4) ? 0xf0 : 0))
48#define WM97XX_DELAY(i) ((i << 4) & 0x00f0) /* sample delay times */
49#define WM97XX_DELAY_MASK 0x00f0
50#define WM97XX_SLEN 0x0008 /* slot read back enable */
51#define WM97XX_SLT(i) ((i - 5) & 0x7) /* panel slot (5-11) */
52#define WM97XX_SLT_MASK 0x0007
53#define WM97XX_PRP_DETW 0x4000 /* detect on, digitise off, wake */
54#define WM97XX_PRP_DET 0x8000 /* detect on, digitise off, no wake */
55#define WM97XX_PRP_DET_DIG 0xc000 /* setect on, digitise on */
56#define WM97XX_RPR 0x2000 /* wake up on pen down */
57#define WM97XX_PEN_DOWN 0x8000 /* pen is down */
58#define WM97XX_ADCSRC_MASK 0x7000 /* ADC source mask */
59
60#define WM97XX_AUX_ID1 0x8001
61#define WM97XX_AUX_ID2 0x8002
62#define WM97XX_AUX_ID3 0x8003
63#define WM97XX_AUX_ID4 0x8004
64
65
66/* WM9712 Bits */
67#define WM9712_45W 0x1000 /* set for 5-wire touchscreen */
68#define WM9712_PDEN 0x0800 /* measure only when pen down */
69#define WM9712_WAIT 0x0200 /* wait until adc is read before next sample */
70#define WM9712_PIL 0x0100 /* current used for pressure measurement. set 400uA else 200uA */
71#define WM9712_MASK_HI 0x0040 /* hi on mask pin (47) stops conversions */
72#define WM9712_MASK_EDGE 0x0080 /* rising/falling edge on pin delays sample */
73#define WM9712_MASK_SYNC 0x00c0 /* rising/falling edge on mask initiates sample */
74#define WM9712_RPU(i) (i&0x3f) /* internal pull up on pen detect (64k / rpu) */
75#define WM9712_PD(i) (0x1 << i) /* power management */
76
77/* WM9712 Registers */
78#define AC97_WM9712_POWER 0x24
79#define AC97_WM9712_REV 0x58
80
81/* WM9705 Bits */
82#define WM9705_PDEN 0x1000 /* measure only when pen is down */
83#define WM9705_PINV 0x0800 /* inverts sense of pen down output */
84#define WM9705_BSEN 0x0400 /* BUSY flag enable, pin47 is 1 when busy */
85#define WM9705_BINV 0x0200 /* invert BUSY (pin47) output */
86#define WM9705_WAIT 0x0100 /* wait until adc is read before next sample */
87#define WM9705_PIL 0x0080 /* current used for pressure measurement. set 400uA else 200uA */
88#define WM9705_PHIZ 0x0040 /* set PHONE and PCBEEP inputs to high impedance */
89#define WM9705_MASK_HI 0x0010 /* hi on mask stops conversions */
90#define WM9705_MASK_EDGE 0x0020 /* rising/falling edge on pin delays sample */
91#define WM9705_MASK_SYNC 0x0030 /* rising/falling edge on mask initiates sample */
92#define WM9705_PDD(i) (i & 0x000f) /* pen detect comparator threshold */
93
94
95/* WM9713 Bits */
96#define WM9713_PDPOL 0x0400 /* Pen down polarity */
97#define WM9713_POLL 0x0200 /* initiate a polling measurement */
98#define WM9713_CTC 0x0100 /* enable continuous mode */
99#define WM9713_ADCSEL_X 0x0002 /* X measurement */
100#define WM9713_ADCSEL_Y 0x0004 /* Y measurement */
101#define WM9713_ADCSEL_PRES 0x0008 /* Pressure measurement */
102#define WM9713_COO 0x0001 /* enable coordinate mode */
103#define WM9713_PDEN 0x0800 /* measure only when pen down */
104#define WM9713_ADCSEL_MASK 0x00fe /* ADC selection mask */
105#define WM9713_WAIT 0x0200 /* coordinate wait */
106
107/* AUX ADC ID's */
108#define TS_COMP1 0x0
109#define TS_COMP2 0x1
110#define TS_BMON 0x2
111#define TS_WIPER 0x3
112
113/* ID numbers */
114#define WM97XX_ID1 0x574d
115#define WM9712_ID2 0x4c12
116#define WM9705_ID2 0x4c05
117#define WM9713_ID2 0x4c13
118
119/* Codec GPIO's */
120#define WM97XX_MAX_GPIO 16
121#define WM97XX_GPIO_1 (1 << 1)
122#define WM97XX_GPIO_2 (1 << 2)
123#define WM97XX_GPIO_3 (1 << 3)
124#define WM97XX_GPIO_4 (1 << 4)
125#define WM97XX_GPIO_5 (1 << 5)
126#define WM97XX_GPIO_6 (1 << 6)
127#define WM97XX_GPIO_7 (1 << 7)
128#define WM97XX_GPIO_8 (1 << 8)
129#define WM97XX_GPIO_9 (1 << 9)
130#define WM97XX_GPIO_10 (1 << 10)
131#define WM97XX_GPIO_11 (1 << 11)
132#define WM97XX_GPIO_12 (1 << 12)
133#define WM97XX_GPIO_13 (1 << 13)
134#define WM97XX_GPIO_14 (1 << 14)
135#define WM97XX_GPIO_15 (1 << 15)
136
137
138#define AC97_LINK_FRAME 21 /* time in uS for AC97 link frame */
139
140
141/*---------------- Return codes from sample reading functions ---------------*/
142
143/* More data is available; call the sample gathering function again */
144#define RC_AGAIN 0x00000001
145/* The returned sample is valid */
146#define RC_VALID 0x00000002
147/* The pen is up (the first RC_VALID without RC_PENUP means pen is down) */
148#define RC_PENUP 0x00000004
149/* The pen is down (RC_VALID implies RC_PENDOWN, but sometimes it is helpful
150 to tell the handler that the pen is down but we don't know yet his coords,
151 so the handler should not sleep or wait for pendown irq) */
152#define RC_PENDOWN 0x00000008
153
154/*
155 * The wm97xx driver provides a private API for writing platform-specific
156 * drivers.
157 */
158
159/* The structure used to return arch specific sampled data into */
160struct wm97xx_data {
161 int x;
162 int y;
163 int p;
164};
165
166/*
167 * Codec GPIO status
168 */
169enum wm97xx_gpio_status {
170 WM97XX_GPIO_HIGH,
171 WM97XX_GPIO_LOW
172};
173
174/*
175 * Codec GPIO direction
176 */
177enum wm97xx_gpio_dir {
178 WM97XX_GPIO_IN,
179 WM97XX_GPIO_OUT
180};
181
182/*
183 * Codec GPIO polarity
184 */
185enum wm97xx_gpio_pol {
186 WM97XX_GPIO_POL_HIGH,
187 WM97XX_GPIO_POL_LOW
188};
189
190/*
191 * Codec GPIO sticky
192 */
193enum wm97xx_gpio_sticky {
194 WM97XX_GPIO_STICKY,
195 WM97XX_GPIO_NOTSTICKY
196};
197
198/*
199 * Codec GPIO wake
200 */
201enum wm97xx_gpio_wake {
202 WM97XX_GPIO_WAKE,
203 WM97XX_GPIO_NOWAKE
204};
205
206/*
207 * Digitiser ioctl commands
208 */
209#define WM97XX_DIG_START 0x1
210#define WM97XX_DIG_STOP 0x2
211#define WM97XX_PHY_INIT 0x3
212#define WM97XX_AUX_PREPARE 0x4
213#define WM97XX_DIG_RESTORE 0x5
214
215struct wm97xx;
216
217extern struct wm97xx_codec_drv wm9705_codec;
218extern struct wm97xx_codec_drv wm9712_codec;
219extern struct wm97xx_codec_drv wm9713_codec;
220
221/*
222 * Codec driver interface - allows mapping to WM9705/12/13 and newer codecs
223 */
224struct wm97xx_codec_drv {
225 u16 id;
226 char *name;
227
228 /* read 1 sample */
229 int (*poll_sample) (struct wm97xx *, int adcsel, int *sample);
230
231 /* read X,Y,[P] in poll */
232 int (*poll_touch) (struct wm97xx *, struct wm97xx_data *);
233
234 int (*acc_enable) (struct wm97xx *, int enable);
235 void (*phy_init) (struct wm97xx *);
236 void (*dig_enable) (struct wm97xx *, int enable);
237 void (*dig_restore) (struct wm97xx *);
238 void (*aux_prepare) (struct wm97xx *);
239};
240
241
242/* Machine specific and accelerated touch operations */
243struct wm97xx_mach_ops {
244
245 /* accelerated touch readback - coords are transmited on AC97 link */
246 int acc_enabled;
247 void (*acc_pen_up) (struct wm97xx *);
248 int (*acc_pen_down) (struct wm97xx *);
249 int (*acc_startup) (struct wm97xx *);
250 void (*acc_shutdown) (struct wm97xx *);
251
252 /* interrupt mask control - required for accelerated operation */
253 void (*irq_enable) (struct wm97xx *, int enable);
254
255 /* GPIO pin used for accelerated operation */
256 int irq_gpio;
257
258 /* pre and post sample - can be used to minimise any analog noise */
259 void (*pre_sample) (int); /* function to run before sampling */
260 void (*post_sample) (int); /* function to run after sampling */
261};
262
263struct wm97xx {
264 u16 dig[3], id, gpio[6], misc; /* Cached codec registers */
265 u16 dig_save[3]; /* saved during aux reading */
266 struct wm97xx_codec_drv *codec; /* attached codec driver*/
267 struct input_dev *input_dev; /* touchscreen input device */
268 struct snd_ac97 *ac97; /* ALSA codec access */
269 struct device *dev; /* ALSA device */
270 struct platform_device *battery_dev;
271 struct platform_device *touch_dev;
272 struct wm97xx_mach_ops *mach_ops;
273 struct mutex codec_mutex;
274 struct delayed_work ts_reader; /* Used to poll touchscreen */
275 unsigned long ts_reader_interval; /* Current interval for timer */
276 unsigned long ts_reader_min_interval; /* Minimum interval */
277 unsigned int pen_irq; /* Pen IRQ number in use */
278 struct workqueue_struct *ts_workq;
279 struct work_struct pen_event_work;
280 u16 acc_slot; /* AC97 slot used for acc touch data */
281 u16 acc_rate; /* acc touch data rate */
282 unsigned pen_is_down:1; /* Pen is down */
283 unsigned aux_waiting:1; /* aux measurement waiting */
284 unsigned pen_probably_down:1; /* used in polling mode */
285 u16 suspend_mode; /* PRP in suspend mode */
286};
287
288/*
289 * Codec GPIO access (not supported on WM9705)
290 * This can be used to set/get codec GPIO and Virtual GPIO status.
291 */
292enum wm97xx_gpio_status wm97xx_get_gpio(struct wm97xx *wm, u32 gpio);
293void wm97xx_set_gpio(struct wm97xx *wm, u32 gpio,
294 enum wm97xx_gpio_status status);
295void wm97xx_config_gpio(struct wm97xx *wm, u32 gpio,
296 enum wm97xx_gpio_dir dir,
297 enum wm97xx_gpio_pol pol,
298 enum wm97xx_gpio_sticky sticky,
299 enum wm97xx_gpio_wake wake);
300
301void wm97xx_set_suspend_mode(struct wm97xx *wm, u16 mode);
302
303/* codec AC97 IO access */
304int wm97xx_reg_read(struct wm97xx *wm, u16 reg);
305void wm97xx_reg_write(struct wm97xx *wm, u16 reg, u16 val);
306
307/* aux adc readback */
308int wm97xx_read_aux_adc(struct wm97xx *wm, u16 adcsel);
309
310/* machine ops */
311int wm97xx_register_mach_ops(struct wm97xx *, struct wm97xx_mach_ops *);
312void wm97xx_unregister_mach_ops(struct wm97xx *);
313
314#endif
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index 0c82c80b277f..2ca6bae88721 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -97,10 +97,10 @@ struct xfrm_algo {
97}; 97};
98 98
99struct xfrm_algo_aead { 99struct xfrm_algo_aead {
100 char alg_name[64]; 100 char alg_name[64];
101 int alg_key_len; /* in bits */ 101 unsigned int alg_key_len; /* in bits */
102 int alg_icv_len; /* in bits */ 102 unsigned int alg_icv_len; /* in bits */
103 char alg_key[0]; 103 char alg_key[0];
104}; 104};
105 105
106struct xfrm_stats { 106struct xfrm_stats {
diff --git a/include/mtd/Kbuild b/include/mtd/Kbuild
index 4d46b3bdebd8..8eb018f96002 100644
--- a/include/mtd/Kbuild
+++ b/include/mtd/Kbuild
@@ -3,5 +3,4 @@ header-y += jffs2-user.h
3header-y += mtd-abi.h 3header-y += mtd-abi.h
4header-y += mtd-user.h 4header-y += mtd-user.h
5header-y += nftl-user.h 5header-y += nftl-user.h
6header-y += ubi-header.h
7header-y += ubi-user.h 6header-y += ubi-user.h
diff --git a/include/mtd/ubi-header.h b/include/mtd/ubi-header.h
deleted file mode 100644
index 292f916ea564..000000000000
--- a/include/mtd/ubi-header.h
+++ /dev/null
@@ -1,372 +0,0 @@
1/*
2 * Copyright (c) International Business Machines Corp., 2006
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
12 * the GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Authors: Artem Bityutskiy (Битюцкий Артём)
19 * Thomas Gleixner
20 * Frank Haverkamp
21 * Oliver Lohmann
22 * Andreas Arnez
23 */
24
25/*
26 * This file defines the layout of UBI headers and all the other UBI on-flash
27 * data structures. May be included by user-space.
28 */
29
30#ifndef __UBI_HEADER_H__
31#define __UBI_HEADER_H__
32
33#include <asm/byteorder.h>
34
35/* The version of UBI images supported by this implementation */
36#define UBI_VERSION 1
37
38/* The highest erase counter value supported by this implementation */
39#define UBI_MAX_ERASECOUNTER 0x7FFFFFFF
40
41/* The initial CRC32 value used when calculating CRC checksums */
42#define UBI_CRC32_INIT 0xFFFFFFFFU
43
44/* Erase counter header magic number (ASCII "UBI#") */
45#define UBI_EC_HDR_MAGIC 0x55424923
46/* Volume identifier header magic number (ASCII "UBI!") */
47#define UBI_VID_HDR_MAGIC 0x55424921
48
49/*
50 * Volume type constants used in the volume identifier header.
51 *
52 * @UBI_VID_DYNAMIC: dynamic volume
53 * @UBI_VID_STATIC: static volume
54 */
55enum {
56 UBI_VID_DYNAMIC = 1,
57 UBI_VID_STATIC = 2
58};
59
60/*
61 * Volume flags used in the volume table record.
62 *
63 * @UBI_VTBL_AUTORESIZE_FLG: auto-resize this volume
64 *
65 * %UBI_VTBL_AUTORESIZE_FLG flag can be set only for one volume in the volume
66 * table. UBI automatically re-sizes the volume which has this flag and makes
67 * the volume to be of largest possible size. This means that if after the
68 * initialization UBI finds out that there are available physical eraseblocks
69 * present on the device, it automatically appends all of them to the volume
70 * (the physical eraseblocks reserved for bad eraseblocks handling and other
71 * reserved physical eraseblocks are not taken). So, if there is a volume with
72 * the %UBI_VTBL_AUTORESIZE_FLG flag set, the amount of available logical
73 * eraseblocks will be zero after UBI is loaded, because all of them will be
74 * reserved for this volume. Note, the %UBI_VTBL_AUTORESIZE_FLG bit is cleared
75 * after the volume had been initialized.
76 *
77 * The auto-resize feature is useful for device production purposes. For
78 * example, different NAND flash chips may have different amount of initial bad
79 * eraseblocks, depending of particular chip instance. Manufacturers of NAND
80 * chips usually guarantee that the amount of initial bad eraseblocks does not
81 * exceed certain percent, e.g. 2%. When one creates an UBI image which will be
82 * flashed to the end devices in production, he does not know the exact amount
83 * of good physical eraseblocks the NAND chip on the device will have, but this
84 * number is required to calculate the volume sized and put them to the volume
85 * table of the UBI image. In this case, one of the volumes (e.g., the one
86 * which will store the root file system) is marked as "auto-resizable", and
87 * UBI will adjust its size on the first boot if needed.
88 *
89 * Note, first UBI reserves some amount of physical eraseblocks for bad
90 * eraseblock handling, and then re-sizes the volume, not vice-versa. This
91 * means that the pool of reserved physical eraseblocks will always be present.
92 */
93enum {
94 UBI_VTBL_AUTORESIZE_FLG = 0x01,
95};
96
97/*
98 * Compatibility constants used by internal volumes.
99 *
100 * @UBI_COMPAT_DELETE: delete this internal volume before anything is written
101 * to the flash
102 * @UBI_COMPAT_RO: attach this device in read-only mode
103 * @UBI_COMPAT_PRESERVE: preserve this internal volume - do not touch its
104 * physical eraseblocks, don't allow the wear-leveling unit to move them
105 * @UBI_COMPAT_REJECT: reject this UBI image
106 */
107enum {
108 UBI_COMPAT_DELETE = 1,
109 UBI_COMPAT_RO = 2,
110 UBI_COMPAT_PRESERVE = 4,
111 UBI_COMPAT_REJECT = 5
112};
113
114/* Sizes of UBI headers */
115#define UBI_EC_HDR_SIZE sizeof(struct ubi_ec_hdr)
116#define UBI_VID_HDR_SIZE sizeof(struct ubi_vid_hdr)
117
118/* Sizes of UBI headers without the ending CRC */
119#define UBI_EC_HDR_SIZE_CRC (UBI_EC_HDR_SIZE - sizeof(__be32))
120#define UBI_VID_HDR_SIZE_CRC (UBI_VID_HDR_SIZE - sizeof(__be32))
121
122/**
123 * struct ubi_ec_hdr - UBI erase counter header.
124 * @magic: erase counter header magic number (%UBI_EC_HDR_MAGIC)
125 * @version: version of UBI implementation which is supposed to accept this
126 * UBI image
127 * @padding1: reserved for future, zeroes
128 * @ec: the erase counter
129 * @vid_hdr_offset: where the VID header starts
130 * @data_offset: where the user data start
131 * @padding2: reserved for future, zeroes
132 * @hdr_crc: erase counter header CRC checksum
133 *
134 * The erase counter header takes 64 bytes and has a plenty of unused space for
135 * future usage. The unused fields are zeroed. The @version field is used to
136 * indicate the version of UBI implementation which is supposed to be able to
137 * work with this UBI image. If @version is greater then the current UBI
138 * version, the image is rejected. This may be useful in future if something
139 * is changed radically. This field is duplicated in the volume identifier
140 * header.
141 *
142 * The @vid_hdr_offset and @data_offset fields contain the offset of the the
143 * volume identifier header and user data, relative to the beginning of the
144 * physical eraseblock. These values have to be the same for all physical
145 * eraseblocks.
146 */
147struct ubi_ec_hdr {
148 __be32 magic;
149 __u8 version;
150 __u8 padding1[3];
151 __be64 ec; /* Warning: the current limit is 31-bit anyway! */
152 __be32 vid_hdr_offset;
153 __be32 data_offset;
154 __u8 padding2[36];
155 __be32 hdr_crc;
156} __attribute__ ((packed));
157
158/**
159 * struct ubi_vid_hdr - on-flash UBI volume identifier header.
160 * @magic: volume identifier header magic number (%UBI_VID_HDR_MAGIC)
161 * @version: UBI implementation version which is supposed to accept this UBI
162 * image (%UBI_VERSION)
163 * @vol_type: volume type (%UBI_VID_DYNAMIC or %UBI_VID_STATIC)
164 * @copy_flag: if this logical eraseblock was copied from another physical
165 * eraseblock (for wear-leveling reasons)
166 * @compat: compatibility of this volume (%0, %UBI_COMPAT_DELETE,
167 * %UBI_COMPAT_IGNORE, %UBI_COMPAT_PRESERVE, or %UBI_COMPAT_REJECT)
168 * @vol_id: ID of this volume
169 * @lnum: logical eraseblock number
170 * @leb_ver: version of this logical eraseblock (IMPORTANT: obsolete, to be
171 * removed, kept only for not breaking older UBI users)
172 * @data_size: how many bytes of data this logical eraseblock contains
173 * @used_ebs: total number of used logical eraseblocks in this volume
174 * @data_pad: how many bytes at the end of this physical eraseblock are not
175 * used
176 * @data_crc: CRC checksum of the data stored in this logical eraseblock
177 * @padding1: reserved for future, zeroes
178 * @sqnum: sequence number
179 * @padding2: reserved for future, zeroes
180 * @hdr_crc: volume identifier header CRC checksum
181 *
182 * The @sqnum is the value of the global sequence counter at the time when this
183 * VID header was created. The global sequence counter is incremented each time
184 * UBI writes a new VID header to the flash, i.e. when it maps a logical
185 * eraseblock to a new physical eraseblock. The global sequence counter is an
186 * unsigned 64-bit integer and we assume it never overflows. The @sqnum
187 * (sequence number) is used to distinguish between older and newer versions of
188 * logical eraseblocks.
189 *
190 * There are 2 situations when there may be more then one physical eraseblock
191 * corresponding to the same logical eraseblock, i.e., having the same @vol_id
192 * and @lnum values in the volume identifier header. Suppose we have a logical
193 * eraseblock L and it is mapped to the physical eraseblock P.
194 *
195 * 1. Because UBI may erase physical eraseblocks asynchronously, the following
196 * situation is possible: L is asynchronously erased, so P is scheduled for
197 * erasure, then L is written to,i.e. mapped to another physical eraseblock P1,
198 * so P1 is written to, then an unclean reboot happens. Result - there are 2
199 * physical eraseblocks P and P1 corresponding to the same logical eraseblock
200 * L. But P1 has greater sequence number, so UBI picks P1 when it attaches the
201 * flash.
202 *
203 * 2. From time to time UBI moves logical eraseblocks to other physical
204 * eraseblocks for wear-leveling reasons. If, for example, UBI moves L from P
205 * to P1, and an unclean reboot happens before P is physically erased, there
206 * are two physical eraseblocks P and P1 corresponding to L and UBI has to
207 * select one of them when the flash is attached. The @sqnum field says which
208 * PEB is the original (obviously P will have lower @sqnum) and the copy. But
209 * it is not enough to select the physical eraseblock with the higher sequence
210 * number, because the unclean reboot could have happen in the middle of the
211 * copying process, so the data in P is corrupted. It is also not enough to
212 * just select the physical eraseblock with lower sequence number, because the
213 * data there may be old (consider a case if more data was added to P1 after
214 * the copying). Moreover, the unclean reboot may happen when the erasure of P
215 * was just started, so it result in unstable P, which is "mostly" OK, but
216 * still has unstable bits.
217 *
218 * UBI uses the @copy_flag field to indicate that this logical eraseblock is a
219 * copy. UBI also calculates data CRC when the data is moved and stores it at
220 * the @data_crc field of the copy (P1). So when UBI needs to pick one physical
221 * eraseblock of two (P or P1), the @copy_flag of the newer one (P1) is
222 * examined. If it is cleared, the situation* is simple and the newer one is
223 * picked. If it is set, the data CRC of the copy (P1) is examined. If the CRC
224 * checksum is correct, this physical eraseblock is selected (P1). Otherwise
225 * the older one (P) is selected.
226 *
227 * Note, there is an obsolete @leb_ver field which was used instead of @sqnum
228 * in the past. But it is not used anymore and we keep it in order to be able
229 * to deal with old UBI images. It will be removed at some point.
230 *
231 * There are 2 sorts of volumes in UBI: user volumes and internal volumes.
232 * Internal volumes are not seen from outside and are used for various internal
233 * UBI purposes. In this implementation there is only one internal volume - the
234 * layout volume. Internal volumes are the main mechanism of UBI extensions.
235 * For example, in future one may introduce a journal internal volume. Internal
236 * volumes have their own reserved range of IDs.
237 *
238 * The @compat field is only used for internal volumes and contains the "degree
239 * of their compatibility". It is always zero for user volumes. This field
240 * provides a mechanism to introduce UBI extensions and to be still compatible
241 * with older UBI binaries. For example, if someone introduced a journal in
242 * future, he would probably use %UBI_COMPAT_DELETE compatibility for the
243 * journal volume. And in this case, older UBI binaries, which know nothing
244 * about the journal volume, would just delete this volume and work perfectly
245 * fine. This is similar to what Ext2fs does when it is fed by an Ext3fs image
246 * - it just ignores the Ext3fs journal.
247 *
248 * The @data_crc field contains the CRC checksum of the contents of the logical
249 * eraseblock if this is a static volume. In case of dynamic volumes, it does
250 * not contain the CRC checksum as a rule. The only exception is when the
251 * data of the physical eraseblock was moved by the wear-leveling unit, then
252 * the wear-leveling unit calculates the data CRC and stores it in the
253 * @data_crc field. And of course, the @copy_flag is %in this case.
254 *
255 * The @data_size field is used only for static volumes because UBI has to know
256 * how many bytes of data are stored in this eraseblock. For dynamic volumes,
257 * this field usually contains zero. The only exception is when the data of the
258 * physical eraseblock was moved to another physical eraseblock for
259 * wear-leveling reasons. In this case, UBI calculates CRC checksum of the
260 * contents and uses both @data_crc and @data_size fields. In this case, the
261 * @data_size field contains data size.
262 *
263 * The @used_ebs field is used only for static volumes and indicates how many
264 * eraseblocks the data of the volume takes. For dynamic volumes this field is
265 * not used and always contains zero.
266 *
267 * The @data_pad is calculated when volumes are created using the alignment
268 * parameter. So, effectively, the @data_pad field reduces the size of logical
269 * eraseblocks of this volume. This is very handy when one uses block-oriented
270 * software (say, cramfs) on top of the UBI volume.
271 */
272struct ubi_vid_hdr {
273 __be32 magic;
274 __u8 version;
275 __u8 vol_type;
276 __u8 copy_flag;
277 __u8 compat;
278 __be32 vol_id;
279 __be32 lnum;
280 __be32 leb_ver; /* obsolete, to be removed, don't use */
281 __be32 data_size;
282 __be32 used_ebs;
283 __be32 data_pad;
284 __be32 data_crc;
285 __u8 padding1[4];
286 __be64 sqnum;
287 __u8 padding2[12];
288 __be32 hdr_crc;
289} __attribute__ ((packed));
290
291/* Internal UBI volumes count */
292#define UBI_INT_VOL_COUNT 1
293
294/*
295 * Starting ID of internal volumes. There is reserved room for 4096 internal
296 * volumes.
297 */
298#define UBI_INTERNAL_VOL_START (0x7FFFFFFF - 4096)
299
300/* The layout volume contains the volume table */
301
302#define UBI_LAYOUT_VOLUME_ID UBI_INTERNAL_VOL_START
303#define UBI_LAYOUT_VOLUME_TYPE UBI_VID_DYNAMIC
304#define UBI_LAYOUT_VOLUME_ALIGN 1
305#define UBI_LAYOUT_VOLUME_EBS 2
306#define UBI_LAYOUT_VOLUME_NAME "layout volume"
307#define UBI_LAYOUT_VOLUME_COMPAT UBI_COMPAT_REJECT
308
309/* The maximum number of volumes per one UBI device */
310#define UBI_MAX_VOLUMES 128
311
312/* The maximum volume name length */
313#define UBI_VOL_NAME_MAX 127
314
315/* Size of the volume table record */
316#define UBI_VTBL_RECORD_SIZE sizeof(struct ubi_vtbl_record)
317
318/* Size of the volume table record without the ending CRC */
319#define UBI_VTBL_RECORD_SIZE_CRC (UBI_VTBL_RECORD_SIZE - sizeof(__be32))
320
321/**
322 * struct ubi_vtbl_record - a record in the volume table.
323 * @reserved_pebs: how many physical eraseblocks are reserved for this volume
324 * @alignment: volume alignment
325 * @data_pad: how many bytes are unused at the end of the each physical
326 * eraseblock to satisfy the requested alignment
327 * @vol_type: volume type (%UBI_DYNAMIC_VOLUME or %UBI_STATIC_VOLUME)
328 * @upd_marker: if volume update was started but not finished
329 * @name_len: volume name length
330 * @name: the volume name
331 * @flags: volume flags (%UBI_VTBL_AUTORESIZE_FLG)
332 * @padding: reserved, zeroes
333 * @crc: a CRC32 checksum of the record
334 *
335 * The volume table records are stored in the volume table, which is stored in
336 * the layout volume. The layout volume consists of 2 logical eraseblock, each
337 * of which contains a copy of the volume table (i.e., the volume table is
338 * duplicated). The volume table is an array of &struct ubi_vtbl_record
339 * objects indexed by the volume ID.
340 *
341 * If the size of the logical eraseblock is large enough to fit
342 * %UBI_MAX_VOLUMES records, the volume table contains %UBI_MAX_VOLUMES
343 * records. Otherwise, it contains as many records as it can fit (i.e., size of
344 * logical eraseblock divided by sizeof(struct ubi_vtbl_record)).
345 *
346 * The @upd_marker flag is used to implement volume update. It is set to %1
347 * before update and set to %0 after the update. So if the update operation was
348 * interrupted, UBI knows that the volume is corrupted.
349 *
350 * The @alignment field is specified when the volume is created and cannot be
351 * later changed. It may be useful, for example, when a block-oriented file
352 * system works on top of UBI. The @data_pad field is calculated using the
353 * logical eraseblock size and @alignment. The alignment must be multiple to the
354 * minimal flash I/O unit. If @alignment is 1, all the available space of
355 * the physical eraseblocks is used.
356 *
357 * Empty records contain all zeroes and the CRC checksum of those zeroes.
358 */
359struct ubi_vtbl_record {
360 __be32 reserved_pebs;
361 __be32 alignment;
362 __be32 data_pad;
363 __u8 vol_type;
364 __u8 upd_marker;
365 __be16 name_len;
366 __u8 name[UBI_VOL_NAME_MAX+1];
367 __u8 flags;
368 __u8 padding[23];
369 __be32 crc;
370} __attribute__ ((packed));
371
372#endif /* !__UBI_HEADER_H__ */
diff --git a/include/xen/balloon.h b/include/xen/balloon.h
new file mode 100644
index 000000000000..fe43b0f3c86a
--- /dev/null
+++ b/include/xen/balloon.h
@@ -0,0 +1,61 @@
1/******************************************************************************
2 * balloon.h
3 *
4 * Xen balloon driver - enables returning/claiming memory to/from Xen.
5 *
6 * Copyright (c) 2003, B Dragovic
7 * Copyright (c) 2003-2004, M Williamson, K Fraser
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 2
11 * as published by the Free Software Foundation; or, when distributed
12 * separately from the Linux kernel or incorporated into other
13 * software packages, subject to the following license:
14 *
15 * Permission is hereby granted, free of charge, to any person obtaining a copy
16 * of this source file (the "Software"), to deal in the Software without
17 * restriction, including without limitation the rights to use, copy, modify,
18 * merge, publish, distribute, sublicense, and/or sell copies of the Software,
19 * and to permit persons to whom the Software is furnished to do so, subject to
20 * the following conditions:
21 *
22 * The above copyright notice and this permission notice shall be included in
23 * all copies or substantial portions of the Software.
24 *
25 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
30 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
31 * IN THE SOFTWARE.
32 */
33
34#ifndef __XEN_BALLOON_H__
35#define __XEN_BALLOON_H__
36
37#include <linux/spinlock.h>
38
39#if 0
40/*
41 * Inform the balloon driver that it should allow some slop for device-driver
42 * memory activities.
43 */
44void balloon_update_driver_allowance(long delta);
45
46/* Allocate/free a set of empty pages in low memory (i.e., no RAM mapped). */
47struct page **alloc_empty_pages_and_pagevec(int nr_pages);
48void free_empty_pages_and_pagevec(struct page **pagevec, int nr_pages);
49
50void balloon_release_driver_page(struct page *page);
51
52/*
53 * Prevent the balloon driver from changing the memory reservation during
54 * a driver critical region.
55 */
56extern spinlock_t balloon_lock;
57#define balloon_lock(__flags) spin_lock_irqsave(&balloon_lock, __flags)
58#define balloon_unlock(__flags) spin_unlock_irqrestore(&balloon_lock, __flags)
59#endif
60
61#endif /* __XEN_BALLOON_H__ */
diff --git a/include/xen/events.h b/include/xen/events.h
index 2bde54d29be5..acd8e062c85f 100644
--- a/include/xen/events.h
+++ b/include/xen/events.h
@@ -5,13 +5,7 @@
5 5
6#include <xen/interface/event_channel.h> 6#include <xen/interface/event_channel.h>
7#include <asm/xen/hypercall.h> 7#include <asm/xen/hypercall.h>
8 8#include <asm/xen/events.h>
9enum ipi_vector {
10 XEN_RESCHEDULE_VECTOR,
11 XEN_CALL_FUNCTION_VECTOR,
12
13 XEN_NR_IPIS,
14};
15 9
16int bind_evtchn_to_irq(unsigned int evtchn); 10int bind_evtchn_to_irq(unsigned int evtchn);
17int bind_evtchn_to_irqhandler(unsigned int evtchn, 11int bind_evtchn_to_irqhandler(unsigned int evtchn,
@@ -37,6 +31,7 @@ int bind_ipi_to_irqhandler(enum ipi_vector ipi,
37void unbind_from_irqhandler(unsigned int irq, void *dev_id); 31void unbind_from_irqhandler(unsigned int irq, void *dev_id);
38 32
39void xen_send_IPI_one(unsigned int cpu, enum ipi_vector vector); 33void xen_send_IPI_one(unsigned int cpu, enum ipi_vector vector);
34int resend_irq_on_evtchn(unsigned int irq);
40 35
41static inline void notify_remote_via_evtchn(int port) 36static inline void notify_remote_via_evtchn(int port)
42{ 37{
diff --git a/include/xen/grant_table.h b/include/xen/grant_table.h
index 761c83498e03..466204846121 100644
--- a/include/xen/grant_table.h
+++ b/include/xen/grant_table.h
@@ -39,6 +39,7 @@
39 39
40#include <asm/xen/hypervisor.h> 40#include <asm/xen/hypervisor.h>
41#include <xen/interface/grant_table.h> 41#include <xen/interface/grant_table.h>
42#include <asm/xen/grant_table.h>
42 43
43/* NR_GRANT_FRAMES must be less than or equal to that configured in Xen */ 44/* NR_GRANT_FRAMES must be less than or equal to that configured in Xen */
44#define NR_GRANT_FRAMES 4 45#define NR_GRANT_FRAMES 4
@@ -102,6 +103,12 @@ void gnttab_grant_foreign_access_ref(grant_ref_t ref, domid_t domid,
102void gnttab_grant_foreign_transfer_ref(grant_ref_t, domid_t domid, 103void gnttab_grant_foreign_transfer_ref(grant_ref_t, domid_t domid,
103 unsigned long pfn); 104 unsigned long pfn);
104 105
106int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes,
107 unsigned long max_nr_gframes,
108 struct grant_entry **__shared);
109void arch_gnttab_unmap_shared(struct grant_entry *shared,
110 unsigned long nr_gframes);
111
105#define gnttab_map_vaddr(map) ((void *)(map.host_virt_addr)) 112#define gnttab_map_vaddr(map) ((void *)(map.host_virt_addr))
106 113
107#endif /* __ASM_GNTTAB_H__ */ 114#endif /* __ASM_GNTTAB_H__ */
diff --git a/include/xen/interface/callback.h b/include/xen/interface/callback.h
new file mode 100644
index 000000000000..4aadcba31af9
--- /dev/null
+++ b/include/xen/interface/callback.h
@@ -0,0 +1,102 @@
1/******************************************************************************
2 * callback.h
3 *
4 * Register guest OS callbacks with Xen.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 *
24 * Copyright (c) 2006, Ian Campbell
25 */
26
27#ifndef __XEN_PUBLIC_CALLBACK_H__
28#define __XEN_PUBLIC_CALLBACK_H__
29
30#include "xen.h"
31
32/*
33 * Prototype for this hypercall is:
34 * long callback_op(int cmd, void *extra_args)
35 * @cmd == CALLBACKOP_??? (callback operation).
36 * @extra_args == Operation-specific extra arguments (NULL if none).
37 */
38
39/* ia64, x86: Callback for event delivery. */
40#define CALLBACKTYPE_event 0
41
42/* x86: Failsafe callback when guest state cannot be restored by Xen. */
43#define CALLBACKTYPE_failsafe 1
44
45/* x86/64 hypervisor: Syscall by 64-bit guest app ('64-on-64-on-64'). */
46#define CALLBACKTYPE_syscall 2
47
48/*
49 * x86/32 hypervisor: Only available on x86/32 when supervisor_mode_kernel
50 * feature is enabled. Do not use this callback type in new code.
51 */
52#define CALLBACKTYPE_sysenter_deprecated 3
53
54/* x86: Callback for NMI delivery. */
55#define CALLBACKTYPE_nmi 4
56
57/*
58 * x86: sysenter is only available as follows:
59 * - 32-bit hypervisor: with the supervisor_mode_kernel feature enabled
60 * - 64-bit hypervisor: 32-bit guest applications on Intel CPUs
61 * ('32-on-32-on-64', '32-on-64-on-64')
62 * [nb. also 64-bit guest applications on Intel CPUs
63 * ('64-on-64-on-64'), but syscall is preferred]
64 */
65#define CALLBACKTYPE_sysenter 5
66
67/*
68 * x86/64 hypervisor: Syscall by 32-bit guest app on AMD CPUs
69 * ('32-on-32-on-64', '32-on-64-on-64')
70 */
71#define CALLBACKTYPE_syscall32 7
72
73/*
74 * Disable event deliver during callback? This flag is ignored for event and
75 * NMI callbacks: event delivery is unconditionally disabled.
76 */
77#define _CALLBACKF_mask_events 0
78#define CALLBACKF_mask_events (1U << _CALLBACKF_mask_events)
79
80/*
81 * Register a callback.
82 */
83#define CALLBACKOP_register 0
84struct callback_register {
85 uint16_t type;
86 uint16_t flags;
87 struct xen_callback address;
88};
89
90/*
91 * Unregister a callback.
92 *
93 * Not all callbacks can be unregistered. -EINVAL will be returned if
94 * you attempt to unregister such a callback.
95 */
96#define CALLBACKOP_unregister 1
97struct callback_unregister {
98 uint16_t type;
99 uint16_t _unused;
100};
101
102#endif /* __XEN_PUBLIC_CALLBACK_H__ */
diff --git a/include/xen/interface/grant_table.h b/include/xen/interface/grant_table.h
index 219049802cf2..39da93c21de0 100644
--- a/include/xen/interface/grant_table.h
+++ b/include/xen/interface/grant_table.h
@@ -185,6 +185,7 @@ struct gnttab_map_grant_ref {
185 grant_handle_t handle; 185 grant_handle_t handle;
186 uint64_t dev_bus_addr; 186 uint64_t dev_bus_addr;
187}; 187};
188DEFINE_GUEST_HANDLE_STRUCT(gnttab_map_grant_ref);
188 189
189/* 190/*
190 * GNTTABOP_unmap_grant_ref: Destroy one or more grant-reference mappings 191 * GNTTABOP_unmap_grant_ref: Destroy one or more grant-reference mappings
@@ -206,6 +207,7 @@ struct gnttab_unmap_grant_ref {
206 /* OUT parameters. */ 207 /* OUT parameters. */
207 int16_t status; /* GNTST_* */ 208 int16_t status; /* GNTST_* */
208}; 209};
210DEFINE_GUEST_HANDLE_STRUCT(gnttab_unmap_grant_ref);
209 211
210/* 212/*
211 * GNTTABOP_setup_table: Set up a grant table for <dom> comprising at least 213 * GNTTABOP_setup_table: Set up a grant table for <dom> comprising at least
@@ -223,8 +225,9 @@ struct gnttab_setup_table {
223 uint32_t nr_frames; 225 uint32_t nr_frames;
224 /* OUT parameters. */ 226 /* OUT parameters. */
225 int16_t status; /* GNTST_* */ 227 int16_t status; /* GNTST_* */
226 ulong *frame_list; 228 GUEST_HANDLE(ulong) frame_list;
227}; 229};
230DEFINE_GUEST_HANDLE_STRUCT(gnttab_setup_table);
228 231
229/* 232/*
230 * GNTTABOP_dump_table: Dump the contents of the grant table to the 233 * GNTTABOP_dump_table: Dump the contents of the grant table to the
@@ -237,6 +240,7 @@ struct gnttab_dump_table {
237 /* OUT parameters. */ 240 /* OUT parameters. */
238 int16_t status; /* GNTST_* */ 241 int16_t status; /* GNTST_* */
239}; 242};
243DEFINE_GUEST_HANDLE_STRUCT(gnttab_dump_table);
240 244
241/* 245/*
242 * GNTTABOP_transfer_grant_ref: Transfer <frame> to a foreign domain. The 246 * GNTTABOP_transfer_grant_ref: Transfer <frame> to a foreign domain. The
@@ -255,7 +259,7 @@ struct gnttab_transfer {
255 /* OUT parameters. */ 259 /* OUT parameters. */
256 int16_t status; 260 int16_t status;
257}; 261};
258 262DEFINE_GUEST_HANDLE_STRUCT(gnttab_transfer);
259 263
260/* 264/*
261 * GNTTABOP_copy: Hypervisor based copy 265 * GNTTABOP_copy: Hypervisor based copy
@@ -296,6 +300,7 @@ struct gnttab_copy {
296 /* OUT parameters. */ 300 /* OUT parameters. */
297 int16_t status; 301 int16_t status;
298}; 302};
303DEFINE_GUEST_HANDLE_STRUCT(gnttab_copy);
299 304
300/* 305/*
301 * GNTTABOP_query_size: Query the current and maximum sizes of the shared 306 * GNTTABOP_query_size: Query the current and maximum sizes of the shared
@@ -313,7 +318,7 @@ struct gnttab_query_size {
313 uint32_t max_nr_frames; 318 uint32_t max_nr_frames;
314 int16_t status; /* GNTST_* */ 319 int16_t status; /* GNTST_* */
315}; 320};
316 321DEFINE_GUEST_HANDLE_STRUCT(gnttab_query_size);
317 322
318/* 323/*
319 * Bitfield values for update_pin_status.flags. 324 * Bitfield values for update_pin_status.flags.
diff --git a/include/xen/interface/io/fbif.h b/include/xen/interface/io/fbif.h
new file mode 100644
index 000000000000..5a934dd7796d
--- /dev/null
+++ b/include/xen/interface/io/fbif.h
@@ -0,0 +1,124 @@
1/*
2 * fbif.h -- Xen virtual frame buffer device
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to
6 * deal in the Software without restriction, including without limitation the
7 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 * sell copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 *
22 * Copyright (C) 2005 Anthony Liguori <aliguori@us.ibm.com>
23 * Copyright (C) 2006 Red Hat, Inc., Markus Armbruster <armbru@redhat.com>
24 */
25
26#ifndef __XEN_PUBLIC_IO_FBIF_H__
27#define __XEN_PUBLIC_IO_FBIF_H__
28
29/* Out events (frontend -> backend) */
30
31/*
32 * Out events may be sent only when requested by backend, and receipt
33 * of an unknown out event is an error.
34 */
35
36/* Event type 1 currently not used */
37/*
38 * Framebuffer update notification event
39 * Capable frontend sets feature-update in xenstore.
40 * Backend requests it by setting request-update in xenstore.
41 */
42#define XENFB_TYPE_UPDATE 2
43
44struct xenfb_update {
45 uint8_t type; /* XENFB_TYPE_UPDATE */
46 int32_t x; /* source x */
47 int32_t y; /* source y */
48 int32_t width; /* rect width */
49 int32_t height; /* rect height */
50};
51
52#define XENFB_OUT_EVENT_SIZE 40
53
54union xenfb_out_event {
55 uint8_t type;
56 struct xenfb_update update;
57 char pad[XENFB_OUT_EVENT_SIZE];
58};
59
60/* In events (backend -> frontend) */
61
62/*
63 * Frontends should ignore unknown in events.
64 * No in events currently defined.
65 */
66
67#define XENFB_IN_EVENT_SIZE 40
68
69union xenfb_in_event {
70 uint8_t type;
71 char pad[XENFB_IN_EVENT_SIZE];
72};
73
74/* shared page */
75
76#define XENFB_IN_RING_SIZE 1024
77#define XENFB_IN_RING_LEN (XENFB_IN_RING_SIZE / XENFB_IN_EVENT_SIZE)
78#define XENFB_IN_RING_OFFS 1024
79#define XENFB_IN_RING(page) \
80 ((union xenfb_in_event *)((char *)(page) + XENFB_IN_RING_OFFS))
81#define XENFB_IN_RING_REF(page, idx) \
82 (XENFB_IN_RING((page))[(idx) % XENFB_IN_RING_LEN])
83
84#define XENFB_OUT_RING_SIZE 2048
85#define XENFB_OUT_RING_LEN (XENFB_OUT_RING_SIZE / XENFB_OUT_EVENT_SIZE)
86#define XENFB_OUT_RING_OFFS (XENFB_IN_RING_OFFS + XENFB_IN_RING_SIZE)
87#define XENFB_OUT_RING(page) \
88 ((union xenfb_out_event *)((char *)(page) + XENFB_OUT_RING_OFFS))
89#define XENFB_OUT_RING_REF(page, idx) \
90 (XENFB_OUT_RING((page))[(idx) % XENFB_OUT_RING_LEN])
91
92struct xenfb_page {
93 uint32_t in_cons, in_prod;
94 uint32_t out_cons, out_prod;
95
96 int32_t width; /* width of the framebuffer (in pixels) */
97 int32_t height; /* height of the framebuffer (in pixels) */
98 uint32_t line_length; /* length of a row of pixels (in bytes) */
99 uint32_t mem_length; /* length of the framebuffer (in bytes) */
100 uint8_t depth; /* depth of a pixel (in bits) */
101
102 /*
103 * Framebuffer page directory
104 *
105 * Each directory page holds PAGE_SIZE / sizeof(*pd)
106 * framebuffer pages, and can thus map up to PAGE_SIZE *
107 * PAGE_SIZE / sizeof(*pd) bytes. With PAGE_SIZE == 4096 and
108 * sizeof(unsigned long) == 4, that's 4 Megs. Two directory
109 * pages should be enough for a while.
110 */
111 unsigned long pd[2];
112};
113
114/*
115 * Wart: xenkbd needs to know resolution. Put it here until a better
116 * solution is found, but don't leak it to the backend.
117 */
118#ifdef __KERNEL__
119#define XENFB_WIDTH 800
120#define XENFB_HEIGHT 600
121#define XENFB_DEPTH 32
122#endif
123
124#endif
diff --git a/include/xen/interface/io/kbdif.h b/include/xen/interface/io/kbdif.h
new file mode 100644
index 000000000000..fb97f4284ffd
--- /dev/null
+++ b/include/xen/interface/io/kbdif.h
@@ -0,0 +1,114 @@
1/*
2 * kbdif.h -- Xen virtual keyboard/mouse
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to
6 * deal in the Software without restriction, including without limitation the
7 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 * sell copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 *
22 * Copyright (C) 2005 Anthony Liguori <aliguori@us.ibm.com>
23 * Copyright (C) 2006 Red Hat, Inc., Markus Armbruster <armbru@redhat.com>
24 */
25
26#ifndef __XEN_PUBLIC_IO_KBDIF_H__
27#define __XEN_PUBLIC_IO_KBDIF_H__
28
29/* In events (backend -> frontend) */
30
31/*
32 * Frontends should ignore unknown in events.
33 */
34
35/* Pointer movement event */
36#define XENKBD_TYPE_MOTION 1
37/* Event type 2 currently not used */
38/* Key event (includes pointer buttons) */
39#define XENKBD_TYPE_KEY 3
40/*
41 * Pointer position event
42 * Capable backend sets feature-abs-pointer in xenstore.
43 * Frontend requests ot instead of XENKBD_TYPE_MOTION by setting
44 * request-abs-update in xenstore.
45 */
46#define XENKBD_TYPE_POS 4
47
48struct xenkbd_motion {
49 uint8_t type; /* XENKBD_TYPE_MOTION */
50 int32_t rel_x; /* relative X motion */
51 int32_t rel_y; /* relative Y motion */
52};
53
54struct xenkbd_key {
55 uint8_t type; /* XENKBD_TYPE_KEY */
56 uint8_t pressed; /* 1 if pressed; 0 otherwise */
57 uint32_t keycode; /* KEY_* from linux/input.h */
58};
59
60struct xenkbd_position {
61 uint8_t type; /* XENKBD_TYPE_POS */
62 int32_t abs_x; /* absolute X position (in FB pixels) */
63 int32_t abs_y; /* absolute Y position (in FB pixels) */
64};
65
66#define XENKBD_IN_EVENT_SIZE 40
67
68union xenkbd_in_event {
69 uint8_t type;
70 struct xenkbd_motion motion;
71 struct xenkbd_key key;
72 struct xenkbd_position pos;
73 char pad[XENKBD_IN_EVENT_SIZE];
74};
75
76/* Out events (frontend -> backend) */
77
78/*
79 * Out events may be sent only when requested by backend, and receipt
80 * of an unknown out event is an error.
81 * No out events currently defined.
82 */
83
84#define XENKBD_OUT_EVENT_SIZE 40
85
86union xenkbd_out_event {
87 uint8_t type;
88 char pad[XENKBD_OUT_EVENT_SIZE];
89};
90
91/* shared page */
92
93#define XENKBD_IN_RING_SIZE 2048
94#define XENKBD_IN_RING_LEN (XENKBD_IN_RING_SIZE / XENKBD_IN_EVENT_SIZE)
95#define XENKBD_IN_RING_OFFS 1024
96#define XENKBD_IN_RING(page) \
97 ((union xenkbd_in_event *)((char *)(page) + XENKBD_IN_RING_OFFS))
98#define XENKBD_IN_RING_REF(page, idx) \
99 (XENKBD_IN_RING((page))[(idx) % XENKBD_IN_RING_LEN])
100
101#define XENKBD_OUT_RING_SIZE 1024
102#define XENKBD_OUT_RING_LEN (XENKBD_OUT_RING_SIZE / XENKBD_OUT_EVENT_SIZE)
103#define XENKBD_OUT_RING_OFFS (XENKBD_IN_RING_OFFS + XENKBD_IN_RING_SIZE)
104#define XENKBD_OUT_RING(page) \
105 ((union xenkbd_out_event *)((char *)(page) + XENKBD_OUT_RING_OFFS))
106#define XENKBD_OUT_RING_REF(page, idx) \
107 (XENKBD_OUT_RING((page))[(idx) % XENKBD_OUT_RING_LEN])
108
109struct xenkbd_page {
110 uint32_t in_cons, in_prod;
111 uint32_t out_cons, out_prod;
112};
113
114#endif
diff --git a/include/xen/interface/io/protocols.h b/include/xen/interface/io/protocols.h
new file mode 100644
index 000000000000..01fc8ae5f0b0
--- /dev/null
+++ b/include/xen/interface/io/protocols.h
@@ -0,0 +1,21 @@
1#ifndef __XEN_PROTOCOLS_H__
2#define __XEN_PROTOCOLS_H__
3
4#define XEN_IO_PROTO_ABI_X86_32 "x86_32-abi"
5#define XEN_IO_PROTO_ABI_X86_64 "x86_64-abi"
6#define XEN_IO_PROTO_ABI_IA64 "ia64-abi"
7#define XEN_IO_PROTO_ABI_POWERPC64 "powerpc64-abi"
8
9#if defined(__i386__)
10# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_X86_32
11#elif defined(__x86_64__)
12# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_X86_64
13#elif defined(__ia64__)
14# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_IA64
15#elif defined(__powerpc64__)
16# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_POWERPC64
17#else
18# error arch fixup needed here
19#endif
20
21#endif
diff --git a/include/xen/interface/memory.h b/include/xen/interface/memory.h
index af36ead16817..da768469aa92 100644
--- a/include/xen/interface/memory.h
+++ b/include/xen/interface/memory.h
@@ -29,7 +29,7 @@ struct xen_memory_reservation {
29 * OUT: GMFN bases of extents that were allocated 29 * OUT: GMFN bases of extents that were allocated
30 * (NB. This command also updates the mach_to_phys translation table) 30 * (NB. This command also updates the mach_to_phys translation table)
31 */ 31 */
32 GUEST_HANDLE(ulong) extent_start; 32 ulong extent_start;
33 33
34 /* Number of extents, and size/alignment of each (2^extent_order pages). */ 34 /* Number of extents, and size/alignment of each (2^extent_order pages). */
35 unsigned long nr_extents; 35 unsigned long nr_extents;
@@ -50,7 +50,6 @@ struct xen_memory_reservation {
50 domid_t domid; 50 domid_t domid;
51 51
52}; 52};
53DEFINE_GUEST_HANDLE_STRUCT(xen_memory_reservation);
54 53
55/* 54/*
56 * Returns the maximum machine frame number of mapped RAM in this system. 55 * Returns the maximum machine frame number of mapped RAM in this system.
@@ -86,7 +85,7 @@ struct xen_machphys_mfn_list {
86 * any large discontiguities in the machine address space, 2MB gaps in 85 * any large discontiguities in the machine address space, 2MB gaps in
87 * the machphys table will be represented by an MFN base of zero. 86 * the machphys table will be represented by an MFN base of zero.
88 */ 87 */
89 GUEST_HANDLE(ulong) extent_start; 88 ulong extent_start;
90 89
91 /* 90 /*
92 * Number of extents written to the above array. This will be smaller 91 * Number of extents written to the above array. This will be smaller
@@ -94,7 +93,6 @@ struct xen_machphys_mfn_list {
94 */ 93 */
95 unsigned int nr_extents; 94 unsigned int nr_extents;
96}; 95};
97DEFINE_GUEST_HANDLE_STRUCT(xen_machphys_mfn_list);
98 96
99/* 97/*
100 * Sets the GPFN at which a particular page appears in the specified guest's 98 * Sets the GPFN at which a particular page appears in the specified guest's
@@ -117,7 +115,6 @@ struct xen_add_to_physmap {
117 /* GPFN where the source mapping page should appear. */ 115 /* GPFN where the source mapping page should appear. */
118 unsigned long gpfn; 116 unsigned long gpfn;
119}; 117};
120DEFINE_GUEST_HANDLE_STRUCT(xen_add_to_physmap);
121 118
122/* 119/*
123 * Translates a list of domain-specific GPFNs into MFNs. Returns a -ve error 120 * Translates a list of domain-specific GPFNs into MFNs. Returns a -ve error
@@ -132,14 +129,13 @@ struct xen_translate_gpfn_list {
132 unsigned long nr_gpfns; 129 unsigned long nr_gpfns;
133 130
134 /* List of GPFNs to translate. */ 131 /* List of GPFNs to translate. */
135 GUEST_HANDLE(ulong) gpfn_list; 132 ulong gpfn_list;
136 133
137 /* 134 /*
138 * Output list to contain MFN translations. May be the same as the input 135 * Output list to contain MFN translations. May be the same as the input
139 * list (in which case each input GPFN is overwritten with the output MFN). 136 * list (in which case each input GPFN is overwritten with the output MFN).
140 */ 137 */
141 GUEST_HANDLE(ulong) mfn_list; 138 ulong mfn_list;
142}; 139};
143DEFINE_GUEST_HANDLE_STRUCT(xen_translate_gpfn_list);
144 140
145#endif /* __XEN_PUBLIC_MEMORY_H__ */ 141#endif /* __XEN_PUBLIC_MEMORY_H__ */
diff --git a/include/xen/interface/vcpu.h b/include/xen/interface/vcpu.h
index b05d8a6d9143..87e6f8a48661 100644
--- a/include/xen/interface/vcpu.h
+++ b/include/xen/interface/vcpu.h
@@ -85,6 +85,7 @@ struct vcpu_runstate_info {
85 */ 85 */
86 uint64_t time[4]; 86 uint64_t time[4];
87}; 87};
88DEFINE_GUEST_HANDLE_STRUCT(vcpu_runstate_info);
88 89
89/* VCPU is currently running on a physical CPU. */ 90/* VCPU is currently running on a physical CPU. */
90#define RUNSTATE_running 0 91#define RUNSTATE_running 0
@@ -119,6 +120,7 @@ struct vcpu_runstate_info {
119#define VCPUOP_register_runstate_memory_area 5 120#define VCPUOP_register_runstate_memory_area 5
120struct vcpu_register_runstate_memory_area { 121struct vcpu_register_runstate_memory_area {
121 union { 122 union {
123 GUEST_HANDLE(vcpu_runstate_info) h;
122 struct vcpu_runstate_info *v; 124 struct vcpu_runstate_info *v;
123 uint64_t p; 125 uint64_t p;
124 } addr; 126 } addr;
@@ -134,6 +136,7 @@ struct vcpu_register_runstate_memory_area {
134struct vcpu_set_periodic_timer { 136struct vcpu_set_periodic_timer {
135 uint64_t period_ns; 137 uint64_t period_ns;
136}; 138};
139DEFINE_GUEST_HANDLE_STRUCT(vcpu_set_periodic_timer);
137 140
138/* 141/*
139 * Set or stop a VCPU's single-shot timer. Every VCPU has one single-shot 142 * Set or stop a VCPU's single-shot timer. Every VCPU has one single-shot
@@ -145,6 +148,7 @@ struct vcpu_set_singleshot_timer {
145 uint64_t timeout_abs_ns; 148 uint64_t timeout_abs_ns;
146 uint32_t flags; /* VCPU_SSHOTTMR_??? */ 149 uint32_t flags; /* VCPU_SSHOTTMR_??? */
147}; 150};
151DEFINE_GUEST_HANDLE_STRUCT(vcpu_set_singleshot_timer);
148 152
149/* Flags to VCPUOP_set_singleshot_timer. */ 153/* Flags to VCPUOP_set_singleshot_timer. */
150 /* Require the timeout to be in the future (return -ETIME if it's passed). */ 154 /* Require the timeout to be in the future (return -ETIME if it's passed). */
@@ -164,5 +168,6 @@ struct vcpu_register_vcpu_info {
164 uint32_t offset; /* offset within page */ 168 uint32_t offset; /* offset within page */
165 uint32_t rsvd; /* unused */ 169 uint32_t rsvd; /* unused */
166}; 170};
171DEFINE_GUEST_HANDLE_STRUCT(vcpu_register_vcpu_info);
167 172
168#endif /* __XEN_PUBLIC_VCPU_H__ */ 173#endif /* __XEN_PUBLIC_VCPU_H__ */
diff --git a/include/xen/interface/xen.h b/include/xen/interface/xen.h
index 518a5bf79ed3..9b018da48cf3 100644
--- a/include/xen/interface/xen.h
+++ b/include/xen/interface/xen.h
@@ -58,6 +58,16 @@
58#define __HYPERVISOR_physdev_op 33 58#define __HYPERVISOR_physdev_op 33
59#define __HYPERVISOR_hvm_op 34 59#define __HYPERVISOR_hvm_op 34
60 60
61/* Architecture-specific hypercall definitions. */
62#define __HYPERVISOR_arch_0 48
63#define __HYPERVISOR_arch_1 49
64#define __HYPERVISOR_arch_2 50
65#define __HYPERVISOR_arch_3 51
66#define __HYPERVISOR_arch_4 52
67#define __HYPERVISOR_arch_5 53
68#define __HYPERVISOR_arch_6 54
69#define __HYPERVISOR_arch_7 55
70
61/* 71/*
62 * VIRTUAL INTERRUPTS 72 * VIRTUAL INTERRUPTS
63 * 73 *
@@ -68,8 +78,18 @@
68#define VIRQ_CONSOLE 2 /* (DOM0) Bytes received on emergency console. */ 78#define VIRQ_CONSOLE 2 /* (DOM0) Bytes received on emergency console. */
69#define VIRQ_DOM_EXC 3 /* (DOM0) Exceptional event for some domain. */ 79#define VIRQ_DOM_EXC 3 /* (DOM0) Exceptional event for some domain. */
70#define VIRQ_DEBUGGER 6 /* (DOM0) A domain has paused for debugging. */ 80#define VIRQ_DEBUGGER 6 /* (DOM0) A domain has paused for debugging. */
71#define NR_VIRQS 8
72 81
82/* Architecture-specific VIRQ definitions. */
83#define VIRQ_ARCH_0 16
84#define VIRQ_ARCH_1 17
85#define VIRQ_ARCH_2 18
86#define VIRQ_ARCH_3 19
87#define VIRQ_ARCH_4 20
88#define VIRQ_ARCH_5 21
89#define VIRQ_ARCH_6 22
90#define VIRQ_ARCH_7 23
91
92#define NR_VIRQS 24
73/* 93/*
74 * MMU-UPDATE REQUESTS 94 * MMU-UPDATE REQUESTS
75 * 95 *
diff --git a/include/xen/interface/xencomm.h b/include/xen/interface/xencomm.h
new file mode 100644
index 000000000000..ac45e0712afa
--- /dev/null
+++ b/include/xen/interface/xencomm.h
@@ -0,0 +1,41 @@
1/*
2 * Permission is hereby granted, free of charge, to any person obtaining a copy
3 * of this software and associated documentation files (the "Software"), to
4 * deal in the Software without restriction, including without limitation the
5 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
6 * sell copies of the Software, and to permit persons to whom the Software is
7 * furnished to do so, subject to the following conditions:
8 *
9 * The above copyright notice and this permission notice shall be included in
10 * all copies or substantial portions of the Software.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
17 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
18 * DEALINGS IN THE SOFTWARE.
19 *
20 * Copyright (C) IBM Corp. 2006
21 */
22
23#ifndef _XEN_XENCOMM_H_
24#define _XEN_XENCOMM_H_
25
26/* A xencomm descriptor is a scatter/gather list containing physical
27 * addresses corresponding to a virtually contiguous memory area. The
28 * hypervisor translates these physical addresses to machine addresses to copy
29 * to and from the virtually contiguous area.
30 */
31
32#define XENCOMM_MAGIC 0x58434F4D /* 'XCOM' */
33#define XENCOMM_INVALID (~0UL)
34
35struct xencomm_desc {
36 uint32_t magic;
37 uint32_t nr_addrs; /* the number of entries in address[] */
38 uint64_t address[0];
39};
40
41#endif /* _XEN_XENCOMM_H_ */
diff --git a/include/xen/page.h b/include/xen/page.h
index 031ef22a971e..eaf85fab1263 100644
--- a/include/xen/page.h
+++ b/include/xen/page.h
@@ -1,180 +1 @@
1#ifndef __XEN_PAGE_H #include <asm/xen/page.h>
2#define __XEN_PAGE_H
3
4#include <linux/pfn.h>
5
6#include <asm/uaccess.h>
7#include <asm/pgtable.h>
8
9#include <xen/features.h>
10
11#ifdef CONFIG_X86_PAE
12/* Xen machine address */
13typedef struct xmaddr {
14 unsigned long long maddr;
15} xmaddr_t;
16
17/* Xen pseudo-physical address */
18typedef struct xpaddr {
19 unsigned long long paddr;
20} xpaddr_t;
21#else
22/* Xen machine address */
23typedef struct xmaddr {
24 unsigned long maddr;
25} xmaddr_t;
26
27/* Xen pseudo-physical address */
28typedef struct xpaddr {
29 unsigned long paddr;
30} xpaddr_t;
31#endif
32
33#define XMADDR(x) ((xmaddr_t) { .maddr = (x) })
34#define XPADDR(x) ((xpaddr_t) { .paddr = (x) })
35
36/**** MACHINE <-> PHYSICAL CONVERSION MACROS ****/
37#define INVALID_P2M_ENTRY (~0UL)
38#define FOREIGN_FRAME_BIT (1UL<<31)
39#define FOREIGN_FRAME(m) ((m) | FOREIGN_FRAME_BIT)
40
41extern unsigned long *phys_to_machine_mapping;
42
43static inline unsigned long pfn_to_mfn(unsigned long pfn)
44{
45 if (xen_feature(XENFEAT_auto_translated_physmap))
46 return pfn;
47
48 return phys_to_machine_mapping[(unsigned int)(pfn)] &
49 ~FOREIGN_FRAME_BIT;
50}
51
52static inline int phys_to_machine_mapping_valid(unsigned long pfn)
53{
54 if (xen_feature(XENFEAT_auto_translated_physmap))
55 return 1;
56
57 return (phys_to_machine_mapping[pfn] != INVALID_P2M_ENTRY);
58}
59
60static inline unsigned long mfn_to_pfn(unsigned long mfn)
61{
62 unsigned long pfn;
63
64 if (xen_feature(XENFEAT_auto_translated_physmap))
65 return mfn;
66
67#if 0
68 if (unlikely((mfn >> machine_to_phys_order) != 0))
69 return max_mapnr;
70#endif
71
72 pfn = 0;
73 /*
74 * The array access can fail (e.g., device space beyond end of RAM).
75 * In such cases it doesn't matter what we return (we return garbage),
76 * but we must handle the fault without crashing!
77 */
78 __get_user(pfn, &machine_to_phys_mapping[mfn]);
79
80 return pfn;
81}
82
83static inline xmaddr_t phys_to_machine(xpaddr_t phys)
84{
85 unsigned offset = phys.paddr & ~PAGE_MASK;
86 return XMADDR(PFN_PHYS((u64)pfn_to_mfn(PFN_DOWN(phys.paddr))) | offset);
87}
88
89static inline xpaddr_t machine_to_phys(xmaddr_t machine)
90{
91 unsigned offset = machine.maddr & ~PAGE_MASK;
92 return XPADDR(PFN_PHYS((u64)mfn_to_pfn(PFN_DOWN(machine.maddr))) | offset);
93}
94
95/*
96 * We detect special mappings in one of two ways:
97 * 1. If the MFN is an I/O page then Xen will set the m2p entry
98 * to be outside our maximum possible pseudophys range.
99 * 2. If the MFN belongs to a different domain then we will certainly
100 * not have MFN in our p2m table. Conversely, if the page is ours,
101 * then we'll have p2m(m2p(MFN))==MFN.
102 * If we detect a special mapping then it doesn't have a 'struct page'.
103 * We force !pfn_valid() by returning an out-of-range pointer.
104 *
105 * NB. These checks require that, for any MFN that is not in our reservation,
106 * there is no PFN such that p2m(PFN) == MFN. Otherwise we can get confused if
107 * we are foreign-mapping the MFN, and the other domain as m2p(MFN) == PFN.
108 * Yikes! Various places must poke in INVALID_P2M_ENTRY for safety.
109 *
110 * NB2. When deliberately mapping foreign pages into the p2m table, you *must*
111 * use FOREIGN_FRAME(). This will cause pte_pfn() to choke on it, as we
112 * require. In all the cases we care about, the FOREIGN_FRAME bit is
113 * masked (e.g., pfn_to_mfn()) so behaviour there is correct.
114 */
115static inline unsigned long mfn_to_local_pfn(unsigned long mfn)
116{
117 extern unsigned long max_mapnr;
118 unsigned long pfn = mfn_to_pfn(mfn);
119 if ((pfn < max_mapnr)
120 && !xen_feature(XENFEAT_auto_translated_physmap)
121 && (phys_to_machine_mapping[pfn] != mfn))
122 return max_mapnr; /* force !pfn_valid() */
123 return pfn;
124}
125
126static inline void set_phys_to_machine(unsigned long pfn, unsigned long mfn)
127{
128 if (xen_feature(XENFEAT_auto_translated_physmap)) {
129 BUG_ON(pfn != mfn && mfn != INVALID_P2M_ENTRY);
130 return;
131 }
132 phys_to_machine_mapping[pfn] = mfn;
133}
134
135/* VIRT <-> MACHINE conversion */
136#define virt_to_machine(v) (phys_to_machine(XPADDR(__pa(v))))
137#define virt_to_mfn(v) (pfn_to_mfn(PFN_DOWN(__pa(v))))
138#define mfn_to_virt(m) (__va(mfn_to_pfn(m) << PAGE_SHIFT))
139
140#ifdef CONFIG_X86_PAE
141#define pte_mfn(_pte) (((_pte).pte_low >> PAGE_SHIFT) | \
142 (((_pte).pte_high & 0xfff) << (32-PAGE_SHIFT)))
143
144static inline pte_t mfn_pte(unsigned long page_nr, pgprot_t pgprot)
145{
146 pte_t pte;
147
148 pte.pte_high = (page_nr >> (32 - PAGE_SHIFT)) |
149 (pgprot_val(pgprot) >> 32);
150 pte.pte_high &= (__supported_pte_mask >> 32);
151 pte.pte_low = ((page_nr << PAGE_SHIFT) | pgprot_val(pgprot));
152 pte.pte_low &= __supported_pte_mask;
153
154 return pte;
155}
156
157static inline unsigned long long pte_val_ma(pte_t x)
158{
159 return x.pte;
160}
161#define pmd_val_ma(v) ((v).pmd)
162#define pud_val_ma(v) ((v).pgd.pgd)
163#define __pte_ma(x) ((pte_t) { .pte = (x) })
164#define __pmd_ma(x) ((pmd_t) { (x) } )
165#else /* !X86_PAE */
166#define pte_mfn(_pte) ((_pte).pte_low >> PAGE_SHIFT)
167#define mfn_pte(pfn, prot) __pte_ma(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
168#define pte_val_ma(x) ((x).pte)
169#define pmd_val_ma(v) ((v).pud.pgd.pgd)
170#define __pte_ma(x) ((pte_t) { (x) } )
171#endif /* CONFIG_X86_PAE */
172
173#define pgd_val_ma(x) ((x).pgd)
174
175
176xmaddr_t arbitrary_virt_to_machine(unsigned long address);
177void make_lowmem_page_readonly(void *vaddr);
178void make_lowmem_page_readwrite(void *vaddr);
179
180#endif /* __XEN_PAGE_H */
diff --git a/include/xen/xen-ops.h b/include/xen/xen-ops.h
new file mode 100644
index 000000000000..10ddfe0142d0
--- /dev/null
+++ b/include/xen/xen-ops.h
@@ -0,0 +1,8 @@
1#ifndef INCLUDE_XEN_OPS_H
2#define INCLUDE_XEN_OPS_H
3
4#include <linux/percpu.h>
5
6DECLARE_PER_CPU(struct vcpu_info *, xen_vcpu);
7
8#endif /* INCLUDE_XEN_OPS_H */
diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h
index 6f7c290651ae..6369d89c25d5 100644
--- a/include/xen/xenbus.h
+++ b/include/xen/xenbus.h
@@ -97,6 +97,7 @@ struct xenbus_driver {
97 int (*uevent)(struct xenbus_device *, char **, int, char *, int); 97 int (*uevent)(struct xenbus_device *, char **, int, char *, int);
98 struct device_driver driver; 98 struct device_driver driver;
99 int (*read_otherend_details)(struct xenbus_device *dev); 99 int (*read_otherend_details)(struct xenbus_device *dev);
100 int (*is_ready)(struct xenbus_device *dev);
100}; 101};
101 102
102static inline struct xenbus_driver *to_xenbus_driver(struct device_driver *drv) 103static inline struct xenbus_driver *to_xenbus_driver(struct device_driver *drv)
diff --git a/include/xen/xencomm.h b/include/xen/xencomm.h
new file mode 100644
index 000000000000..e43b039be112
--- /dev/null
+++ b/include/xen/xencomm.h
@@ -0,0 +1,77 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15 *
16 * Copyright (C) IBM Corp. 2006
17 *
18 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
19 * Jerone Young <jyoung5@us.ibm.com>
20 */
21
22#ifndef _LINUX_XENCOMM_H_
23#define _LINUX_XENCOMM_H_
24
25#include <xen/interface/xencomm.h>
26
27#define XENCOMM_MINI_ADDRS 3
28struct xencomm_mini {
29 struct xencomm_desc _desc;
30 uint64_t address[XENCOMM_MINI_ADDRS];
31};
32
33/* To avoid additionnal virt to phys conversion, an opaque structure is
34 presented. */
35struct xencomm_handle;
36
37extern void xencomm_free(struct xencomm_handle *desc);
38extern struct xencomm_handle *xencomm_map(void *ptr, unsigned long bytes);
39extern struct xencomm_handle *__xencomm_map_no_alloc(void *ptr,
40 unsigned long bytes, struct xencomm_mini *xc_area);
41
42#if 0
43#define XENCOMM_MINI_ALIGNED(xc_desc, n) \
44 struct xencomm_mini xc_desc ## _base[(n)] \
45 __attribute__((__aligned__(sizeof(struct xencomm_mini)))); \
46 struct xencomm_mini *xc_desc = &xc_desc ## _base[0];
47#else
48/*
49 * gcc bug workaround:
50 * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16660
51 * gcc doesn't handle properly stack variable with
52 * __attribute__((__align__(sizeof(struct xencomm_mini))))
53 */
54#define XENCOMM_MINI_ALIGNED(xc_desc, n) \
55 unsigned char xc_desc ## _base[((n) + 1 ) * \
56 sizeof(struct xencomm_mini)]; \
57 struct xencomm_mini *xc_desc = (struct xencomm_mini *) \
58 ((unsigned long)xc_desc ## _base + \
59 (sizeof(struct xencomm_mini) - \
60 ((unsigned long)xc_desc ## _base) % \
61 sizeof(struct xencomm_mini)));
62#endif
63#define xencomm_map_no_alloc(ptr, bytes) \
64 ({ XENCOMM_MINI_ALIGNED(xc_desc, 1); \
65 __xencomm_map_no_alloc(ptr, bytes, xc_desc); })
66
67/* provided by architecture code: */
68extern unsigned long xencomm_vtop(unsigned long vaddr);
69
70static inline void *xencomm_pa(void *ptr)
71{
72 return (void *)xencomm_vtop((unsigned long)ptr);
73}
74
75#define xen_guest_handle(hnd) ((hnd).p)
76
77#endif /* _LINUX_XENCOMM_H_ */