aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/asm-alpha/smp.h4
-rw-r--r--include/asm-alpha/termbits.h1
-rw-r--r--include/asm-arm/arch-ixp23xx/memory.h2
-rw-r--r--include/asm-arm/arch-l7200/serial_l7200.h2
-rw-r--r--include/asm-arm/arch-l7200/uncompress.h2
-rw-r--r--include/asm-arm/arch-lh7a40x/clocks.h20
-rw-r--r--include/asm-arm/arch-lh7a40x/constants.h8
-rw-r--r--include/asm-arm/arch-lh7a40x/dma.h79
-rw-r--r--include/asm-arm/arch-lh7a40x/entry-macro.S70
-rw-r--r--include/asm-arm/arch-lh7a40x/hardware.h4
-rw-r--r--include/asm-arm/arch-lh7a40x/irqs.h7
-rw-r--r--include/asm-arm/arch-lh7a40x/registers.h64
-rw-r--r--include/asm-arm/arch-lh7a40x/ssp.h71
-rw-r--r--include/asm-arm/arch-lh7a40x/uncompress.h2
-rw-r--r--include/asm-arm/arch-pnx4008/clock.h61
-rw-r--r--include/asm-arm/arch-pnx4008/debug-macro.S27
-rw-r--r--include/asm-arm/arch-pnx4008/dma.h162
-rw-r--r--include/asm-arm/arch-pnx4008/entry-macro.S121
-rw-r--r--include/asm-arm/arch-pnx4008/gpio.h139
-rw-r--r--include/asm-arm/arch-pnx4008/hardware.h32
-rw-r--r--include/asm-arm/arch-pnx4008/io.h21
-rw-r--r--include/asm-arm/arch-pnx4008/irq.h42
-rw-r--r--include/asm-arm/arch-pnx4008/irqs.h215
-rw-r--r--include/asm-arm/arch-pnx4008/memory.h24
-rw-r--r--include/asm-arm/arch-pnx4008/param.h21
-rw-r--r--include/asm-arm/arch-pnx4008/platform.h69
-rw-r--r--include/asm-arm/arch-pnx4008/pm.h62
-rw-r--r--include/asm-arm/arch-pnx4008/system.h38
-rw-r--r--include/asm-arm/arch-pnx4008/timex.h73
-rw-r--r--include/asm-arm/arch-pnx4008/uncompress.h46
-rw-r--r--include/asm-arm/arch-pnx4008/vmalloc.h20
-rw-r--r--include/asm-arm/arch-pxa/ohci.h2
-rw-r--r--include/asm-arm/arch-s3c2410/map.h11
-rw-r--r--include/asm-arm/arch-s3c2410/regs-clock.h6
-rw-r--r--include/asm-arm/arch-s3c2410/regs-gpio.h5
-rw-r--r--include/asm-arm/arch-s3c2410/uncompress.h5
-rw-r--r--include/asm-arm/mach/time.h1
-rw-r--r--include/asm-arm/system.h6
-rw-r--r--include/asm-generic/pgtable.h11
-rw-r--r--include/asm-mips/addrspace.h36
-rw-r--r--include/asm-mips/apm.h65
-rw-r--r--include/asm-mips/asmmacro-32.h4
-rw-r--r--include/asm-mips/asmmacro-64.h19
-rw-r--r--include/asm-mips/bootinfo.h13
-rw-r--r--include/asm-mips/cpu.h6
-rw-r--r--include/asm-mips/ddb5074.h11
-rw-r--r--include/asm-mips/ddb5xxx/ddb5074.h38
-rw-r--r--include/asm-mips/ddb5xxx/ddb5476.h157
-rw-r--r--include/asm-mips/ddb5xxx/ddb5xxx.h11
-rw-r--r--include/asm-mips/delay.h22
-rw-r--r--include/asm-mips/emma2rh/emma2rh.h330
-rw-r--r--include/asm-mips/emma2rh/markeins.h76
-rw-r--r--include/asm-mips/fpu.h3
-rw-r--r--include/asm-mips/fpu_emulator.h4
-rw-r--r--include/asm-mips/futex.h153
-rw-r--r--include/asm-mips/inst.h33
-rw-r--r--include/asm-mips/mach-ddb5074/mc146818rtc.h31
-rw-r--r--include/asm-mips/mach-dec/param.h18
-rw-r--r--include/asm-mips/mach-emma2rh/irq.h (renamed from include/asm-mips/mach-mips/param.h)8
-rw-r--r--include/asm-mips/mach-excite/cpu-feature-overrides.h40
-rw-r--r--include/asm-mips/mach-excite/excite.h155
-rw-r--r--include/asm-mips/mach-excite/excite_nandflash.h7
-rw-r--r--include/asm-mips/mach-excite/rm9k_eth.h23
-rw-r--r--include/asm-mips/mach-excite/rm9k_wdt.h12
-rw-r--r--include/asm-mips/mach-excite/rm9k_xicap.h16
-rw-r--r--include/asm-mips/mach-generic/param.h13
-rw-r--r--include/asm-mips/mach-ip22/cpu-feature-overrides.h2
-rw-r--r--include/asm-mips/mach-ip27/cpu-feature-overrides.h3
-rw-r--r--include/asm-mips/mach-ip32/cpu-feature-overrides.h2
-rw-r--r--include/asm-mips/mach-jazz/param.h16
-rw-r--r--include/asm-mips/mach-mips/cpu-feature-overrides.h4
-rw-r--r--include/asm-mips/mach-qemu/param.h13
-rw-r--r--include/asm-mips/mach-rm200/cpu-feature-overrides.h4
-rw-r--r--include/asm-mips/mach-sim/cpu-feature-overrides.h4
-rw-r--r--include/asm-mips/mach-wrppmc/mach-gt64120.h84
-rw-r--r--include/asm-mips/mipsregs.h6
-rw-r--r--include/asm-mips/mmzone.h11
-rw-r--r--include/asm-mips/page.h21
-rw-r--r--include/asm-mips/param.h2
-rw-r--r--include/asm-mips/pci/bridge.h3
-rw-r--r--include/asm-mips/pgtable-32.h61
-rw-r--r--include/asm-mips/pgtable-64.h13
-rw-r--r--include/asm-mips/pgtable.h105
-rw-r--r--include/asm-mips/processor.h16
-rw-r--r--include/asm-mips/qemu.h6
-rw-r--r--include/asm-mips/rm9k-ocd.h56
-rw-r--r--include/asm-mips/sigcontext.h10
-rw-r--r--include/asm-mips/smp.h5
-rw-r--r--include/asm-mips/sn/addrs.h27
-rw-r--r--include/asm-mips/sn/fru.h (renamed from include/asm-mips/sn/sn0/sn0_fru.h)8
-rw-r--r--include/asm-mips/sn/klconfig.h89
-rw-r--r--include/asm-mips/sn/kldir.h34
-rw-r--r--include/asm-mips/sn/sn0/addrs.h87
-rw-r--r--include/asm-mips/sn/sn0/arch.h17
-rw-r--r--include/asm-mips/sn/sn0/hub.h4
-rw-r--r--include/asm-mips/sn/sn0/hubio.h16
-rw-r--r--include/asm-mips/sn/sn0/hubmd.h2
-rw-r--r--include/asm-mips/sn/sn0/hubpi.h18
-rw-r--r--include/asm-mips/sn/sn0/ip27.h9
-rw-r--r--include/asm-mips/sni.h7
-rw-r--r--include/asm-mips/sparsemem.h14
-rw-r--r--include/asm-mips/war.h5
-rw-r--r--include/asm-powerpc/cputable.h2
-rw-r--r--include/asm-powerpc/termbits.h1
-rw-r--r--include/asm-s390/futex.h15
-rw-r--r--include/asm-s390/lowcore.h4
-rw-r--r--include/asm-sparc64/pgtable.h17
-rw-r--r--include/asm-um/irqflags.h6
-rw-r--r--include/asm-um/uaccess.h6
-rw-r--r--include/asm-x86_64/elf.h2
-rw-r--r--include/linux/console.h4
-rw-r--r--include/linux/dmaengine.h359
-rw-r--r--include/linux/elevator.h2
-rw-r--r--include/linux/hrtimer.h2
-rw-r--r--include/linux/i2o.h5
-rw-r--r--include/linux/igmp.h2
-rw-r--r--include/linux/input.h13
-rw-r--r--include/linux/jffs2.h56
-rw-r--r--include/linux/jffs2_fs_i.h50
-rw-r--r--include/linux/jffs2_fs_sb.h122
-rw-r--r--include/linux/m48t86.h4
-rw-r--r--include/linux/mempolicy.h1
-rw-r--r--include/linux/mmzone.h1
-rw-r--r--include/linux/module.h9
-rw-r--r--include/linux/mtd/inftl.h2
-rw-r--r--include/linux/mtd/mtd.h97
-rw-r--r--include/linux/mtd/nand.h354
-rw-r--r--include/linux/mtd/ndfc.h67
-rw-r--r--include/linux/mtd/nftl.h2
-rw-r--r--include/linux/mtd/onenand.h11
-rw-r--r--include/linux/mtd/onenand_regs.h8
-rw-r--r--include/linux/mtd/partitions.h2
-rw-r--r--include/linux/mtd/physmap.h28
-rw-r--r--include/linux/netdevice.h45
-rw-r--r--include/linux/netfilter/nf_conntrack_common.h4
-rw-r--r--include/linux/netfilter/nfnetlink_conntrack.h4
-rw-r--r--include/linux/netfilter/xt_CONNSECMARK.h13
-rw-r--r--include/linux/netfilter/xt_SECMARK.h26
-rw-r--r--include/linux/netfilter/xt_quota.h16
-rw-r--r--include/linux/netfilter/xt_statistic.h32
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack.h6
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_h323.h7
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_helper_h323_types.h3
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_sip.h44
-rw-r--r--include/linux/pci-acpi.h2
-rw-r--r--include/linux/pci.h2
-rw-r--r--include/linux/pci_ids.h13
-rw-r--r--include/linux/pfkeyv2.h2
-rw-r--r--include/linux/rbtree.h26
-rw-r--r--include/linux/security.h40
-rw-r--r--include/linux/selinux.h32
-rw-r--r--include/linux/skbuff.h74
-rw-r--r--include/linux/sysctl.h4
-rw-r--r--include/linux/tcp.h8
-rw-r--r--include/linux/vt_kern.h5
-rw-r--r--include/linux/xfrm.h4
-rw-r--r--include/mtd/mtd-abi.h90
-rw-r--r--include/mtd/mtd-user.h1
-rw-r--r--include/net/compat.h3
-rw-r--r--include/net/ieee80211.h9
-rw-r--r--include/net/ieee80211softmac.h40
-rw-r--r--include/net/ieee80211softmac_wx.h5
-rw-r--r--include/net/ip.h1
-rw-r--r--include/net/llc_if.h17
-rw-r--r--include/net/netdma.h44
-rw-r--r--include/net/netfilter/nf_conntrack.h5
-rw-r--r--include/net/netfilter/nf_conntrack_compat.h26
-rw-r--r--include/net/raw.h2
-rw-r--r--include/net/sctp/sctp.h2
-rw-r--r--include/net/sctp/structs.h3
-rw-r--r--include/net/sock.h20
-rw-r--r--include/net/tcp.h15
-rw-r--r--include/net/xfrm.h26
-rw-r--r--include/rdma/ib_addr.h114
-rw-r--r--include/rdma/ib_cache.h13
-rw-r--r--include/rdma/ib_cm.h26
-rw-r--r--include/rdma/ib_marshall.h50
-rw-r--r--include/rdma/ib_sa.h7
-rw-r--r--include/rdma/ib_smi.h36
-rw-r--r--include/rdma/ib_user_cm.h86
-rw-r--r--include/rdma/ib_user_sa.h60
-rw-r--r--include/rdma/ib_user_verbs.h80
-rw-r--r--include/rdma/ib_verbs.h22
-rw-r--r--include/rdma/rdma_cm.h256
-rw-r--r--include/rdma/rdma_cm_ib.h47
-rw-r--r--include/scsi/srp.h5
186 files changed, 4925 insertions, 1496 deletions
diff --git a/include/asm-alpha/smp.h b/include/asm-alpha/smp.h
index 06fb6c119671..a1a1eca6be45 100644
--- a/include/asm-alpha/smp.h
+++ b/include/asm-alpha/smp.h
@@ -44,10 +44,8 @@ extern struct cpuinfo_alpha cpu_data[NR_CPUS];
44#define hard_smp_processor_id() __hard_smp_processor_id() 44#define hard_smp_processor_id() __hard_smp_processor_id()
45#define raw_smp_processor_id() (current_thread_info()->cpu) 45#define raw_smp_processor_id() (current_thread_info()->cpu)
46 46
47extern cpumask_t cpu_present_mask;
48extern cpumask_t cpu_online_map;
49extern int smp_num_cpus; 47extern int smp_num_cpus;
50#define cpu_possible_map cpu_present_mask 48#define cpu_possible_map cpu_present_map
51 49
52int smp_call_function_on_cpu(void (*func) (void *info), void *info,int retry, int wait, cpumask_t cpu); 50int smp_call_function_on_cpu(void (*func) (void *info), void *info,int retry, int wait, cpumask_t cpu);
53 51
diff --git a/include/asm-alpha/termbits.h b/include/asm-alpha/termbits.h
index f4837fa29420..5541101b58ae 100644
--- a/include/asm-alpha/termbits.h
+++ b/include/asm-alpha/termbits.h
@@ -148,6 +148,7 @@ struct termios {
148#define HUPCL 00040000 148#define HUPCL 00040000
149 149
150#define CLOCAL 00100000 150#define CLOCAL 00100000
151#define CMSPAR 010000000000 /* mark or space (stick) parity */
151#define CRTSCTS 020000000000 /* flow control */ 152#define CRTSCTS 020000000000 /* flow control */
152 153
153/* c_lflag bits */ 154/* c_lflag bits */
diff --git a/include/asm-arm/arch-ixp23xx/memory.h b/include/asm-arm/arch-ixp23xx/memory.h
index 6e19f46d54d1..c85fc06a043c 100644
--- a/include/asm-arm/arch-ixp23xx/memory.h
+++ b/include/asm-arm/arch-ixp23xx/memory.h
@@ -49,7 +49,7 @@ static inline int __ixp23xx_arch_is_coherent(void)
49{ 49{
50 extern unsigned int processor_id; 50 extern unsigned int processor_id;
51 51
52 if (((processor_id & 15) >= 2) || machine_is_roadrunner()) 52 if (((processor_id & 15) >= 4) || machine_is_roadrunner())
53 return 1; 53 return 1;
54 54
55 return 0; 55 return 0;
diff --git a/include/asm-arm/arch-l7200/serial_l7200.h b/include/asm-arm/arch-l7200/serial_l7200.h
index 238c595d97ea..b1008a9d23e5 100644
--- a/include/asm-arm/arch-l7200/serial_l7200.h
+++ b/include/asm-arm/arch-l7200/serial_l7200.h
@@ -28,7 +28,7 @@
28#define UARTDR 0x00 /* Tx/Rx data */ 28#define UARTDR 0x00 /* Tx/Rx data */
29#define RXSTAT 0x04 /* Rx status */ 29#define RXSTAT 0x04 /* Rx status */
30#define H_UBRLCR 0x08 /* mode register high */ 30#define H_UBRLCR 0x08 /* mode register high */
31#define M_UBRLCR 0x0C /* mode reg mid (MSB of buad)*/ 31#define M_UBRLCR 0x0C /* mode reg mid (MSB of baud)*/
32#define L_UBRLCR 0x10 /* mode reg low (LSB of baud)*/ 32#define L_UBRLCR 0x10 /* mode reg low (LSB of baud)*/
33#define UARTCON 0x14 /* control register */ 33#define UARTCON 0x14 /* control register */
34#define UARTFLG 0x18 /* flag register */ 34#define UARTFLG 0x18 /* flag register */
diff --git a/include/asm-arm/arch-l7200/uncompress.h b/include/asm-arm/arch-l7200/uncompress.h
index 9fcd40aee3e3..04be2a088639 100644
--- a/include/asm-arm/arch-l7200/uncompress.h
+++ b/include/asm-arm/arch-l7200/uncompress.h
@@ -6,7 +6,7 @@
6 * Changelog: 6 * Changelog:
7 * 05-01-2000 SJH Created 7 * 05-01-2000 SJH Created
8 * 05-13-2000 SJH Filled in function bodies 8 * 05-13-2000 SJH Filled in function bodies
9 * 07-26-2000 SJH Removed hard coded buad rate 9 * 07-26-2000 SJH Removed hard coded baud rate
10 */ 10 */
11 11
12#include <asm/hardware.h> 12#include <asm/hardware.h>
diff --git a/include/asm-arm/arch-lh7a40x/clocks.h b/include/asm-arm/arch-lh7a40x/clocks.h
new file mode 100644
index 000000000000..bee02fd8dab1
--- /dev/null
+++ b/include/asm-arm/arch-lh7a40x/clocks.h
@@ -0,0 +1,20 @@
1/* include/asm-arm/arch-lh7a40x/clocks.h
2 *
3 * Copyright (C) 2004 Marc Singer
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * version 2 as published by the Free Software Foundation.
8 *
9 */
10
11#include <linux/config.h>
12
13#ifndef __ASM_ARCH_CLOCKS_H
14#define __ASM_ARCH_CLOCKS_H
15
16unsigned int fclkfreq_get (void);
17unsigned int hclkfreq_get (void);
18unsigned int pclkfreq_get (void);
19
20#endif /* _ASM_ARCH_CLOCKS_H */
diff --git a/include/asm-arm/arch-lh7a40x/constants.h b/include/asm-arm/arch-lh7a40x/constants.h
index 267d1145c3f9..51de96e87faf 100644
--- a/include/asm-arm/arch-lh7a40x/constants.h
+++ b/include/asm-arm/arch-lh7a40x/constants.h
@@ -28,8 +28,7 @@
28 28
29#if defined (CONFIG_MACH_LPD7A400) || defined (CONFIG_MACH_LPD7A404) 29#if defined (CONFIG_MACH_LPD7A400) || defined (CONFIG_MACH_LPD7A404)
30 30
31# define IOBARRIER_PHYS 0xc0000000 /* Start of SDRAM */ 31# define IOBARRIER_PHYS 0x10000000 /* Second bank, fastest timing */
32/*# define IOBARRIER_PHYS 0x00000000 */ /* Start of flash */
33# define IOBARRIER_VIRT 0xf0000000 32# define IOBARRIER_VIRT 0xf0000000
34# define IOBARRIER_SIZE PAGE_SIZE 33# define IOBARRIER_SIZE PAGE_SIZE
35 34
@@ -52,6 +51,9 @@
52# define CPLD08_PHYS CPLDX_PHYS (0x08) 51# define CPLD08_PHYS CPLDX_PHYS (0x08)
53# define CPLD08_VIRT CPLDX_VIRT (0x08) 52# define CPLD08_VIRT CPLDX_VIRT (0x08)
54# define CPLD08_SIZE PAGE_SIZE 53# define CPLD08_SIZE PAGE_SIZE
54# define CPLD0A_PHYS CPLDX_PHYS (0x0a)
55# define CPLD0A_VIRT CPLDX_VIRT (0x0a)
56# define CPLD0A_SIZE PAGE_SIZE
55# define CPLD0C_PHYS CPLDX_PHYS (0x0c) 57# define CPLD0C_PHYS CPLDX_PHYS (0x0c)
56# define CPLD0C_VIRT CPLDX_VIRT (0x0c) 58# define CPLD0C_VIRT CPLDX_VIRT (0x0c)
57# define CPLD0C_SIZE PAGE_SIZE 59# define CPLD0C_SIZE PAGE_SIZE
@@ -83,5 +85,7 @@
83#define XTAL_IN 14745600 /* 14.7456 MHz crystal */ 85#define XTAL_IN 14745600 /* 14.7456 MHz crystal */
84#define PLL_CLOCK (XTAL_IN * 21) /* 309 MHz PLL clock */ 86#define PLL_CLOCK (XTAL_IN * 21) /* 309 MHz PLL clock */
85#define MAX_HCLK_KHZ 100000 /* HCLK max limit ~100MHz */ 87#define MAX_HCLK_KHZ 100000 /* HCLK max limit ~100MHz */
88#define HCLK (99993600)
89//#define HCLK (119808000)
86 90
87#endif /* __ASM_ARCH_CONSTANTS_H */ 91#endif /* __ASM_ARCH_CONSTANTS_H */
diff --git a/include/asm-arm/arch-lh7a40x/dma.h b/include/asm-arm/arch-lh7a40x/dma.h
index 15492e3253f6..a8cbd14bbf9d 100644
--- a/include/asm-arm/arch-lh7a40x/dma.h
+++ b/include/asm-arm/arch-lh7a40x/dma.h
@@ -1,9 +1,86 @@
1/* include/asm-arm/arch-lh7a40x/dma.h 1/* include/asm-arm/arch-lh7a40x/dma.h
2 * 2 *
3 * Copyright (C) 2003 Coastal Environmental Systems 3 * Copyright (C) 2005 Marc Singer
4 * 4 *
5 * This program is free software; you can redistribute it and/or 5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License 6 * modify it under the terms of the GNU General Public License
7 * version 2 as published by the Free Software Foundation. 7 * version 2 as published by the Free Software Foundation.
8 * 8 *
9 */ 9 */
10
11typedef enum {
12 DMA_M2M0 = 0,
13 DMA_M2M1 = 1,
14 DMA_M2P0 = 2, /* Tx */
15 DMA_M2P1 = 3, /* Rx */
16 DMA_M2P2 = 4, /* Tx */
17 DMA_M2P3 = 5, /* Rx */
18 DMA_M2P4 = 6, /* Tx - AC97 */
19 DMA_M2P5 = 7, /* Rx - AC97 */
20 DMA_M2P6 = 8, /* Tx */
21 DMA_M2P7 = 9, /* Rx */
22} dma_device_t;
23
24#define DMA_LENGTH_MAX ((64*1024) - 4) /* bytes */
25
26#define DMAC_GCA __REG(DMAC_PHYS + 0x2b80)
27#define DMAC_GIR __REG(DMAC_PHYS + 0x2bc0)
28
29#define DMAC_GIR_MMI1 (1<<11)
30#define DMAC_GIR_MMI0 (1<<10)
31#define DMAC_GIR_MPI8 (1<<9)
32#define DMAC_GIR_MPI9 (1<<8)
33#define DMAC_GIR_MPI6 (1<<7)
34#define DMAC_GIR_MPI7 (1<<6)
35#define DMAC_GIR_MPI4 (1<<5)
36#define DMAC_GIR_MPI5 (1<<4)
37#define DMAC_GIR_MPI2 (1<<3)
38#define DMAC_GIR_MPI3 (1<<2)
39#define DMAC_GIR_MPI0 (1<<1)
40#define DMAC_GIR_MPI1 (1<<0)
41
42#define DMAC_M2P0 0x0000
43#define DMAC_M2P1 0x0040
44#define DMAC_M2P2 0x0080
45#define DMAC_M2P3 0x00c0
46#define DMAC_M2P4 0x0240
47#define DMAC_M2P5 0x0200
48#define DMAC_M2P6 0x02c0
49#define DMAC_M2P7 0x0280
50#define DMAC_M2P8 0x0340
51#define DMAC_M2P9 0x0300
52#define DMAC_M2M0 0x0100
53#define DMAC_M2M1 0x0140
54
55#define DMAC_P_PCONTROL(c) __REG(DMAC_PHYS + (c) + 0x00)
56#define DMAC_P_PINTERRUPT(c) __REG(DMAC_PHYS + (c) + 0x04)
57#define DMAC_P_PPALLOC(c) __REG(DMAC_PHYS + (c) + 0x08)
58#define DMAC_P_PSTATUS(c) __REG(DMAC_PHYS + (c) + 0x0c)
59#define DMAC_P_REMAIN(c) __REG(DMAC_PHYS + (c) + 0x14)
60#define DMAC_P_MAXCNT0(c) __REG(DMAC_PHYS + (c) + 0x20)
61#define DMAC_P_BASE0(c) __REG(DMAC_PHYS + (c) + 0x24)
62#define DMAC_P_CURRENT0(c) __REG(DMAC_PHYS + (c) + 0x28)
63#define DMAC_P_MAXCNT1(c) __REG(DMAC_PHYS + (c) + 0x30)
64#define DMAC_P_BASE1(c) __REG(DMAC_PHYS + (c) + 0x34)
65#define DMAC_P_CURRENT1(c) __REG(DMAC_PHYS + (c) + 0x38)
66
67#define DMAC_PCONTROL_ENABLE (1<<4)
68
69#define DMAC_PORT_USB 0
70#define DMAC_PORT_SDMMC 1
71#define DMAC_PORT_AC97_1 2
72#define DMAC_PORT_AC97_2 3
73#define DMAC_PORT_AC97_3 4
74#define DMAC_PORT_UART1 6
75#define DMAC_PORT_UART2 7
76#define DMAC_PORT_UART3 8
77
78#define DMAC_PSTATUS_CURRSTATE_SHIFT 4
79#define DMAC_PSTATUS_CURRSTATE_MASK 0x3
80
81#define DMAC_PSTATUS_NEXTBUF (1<<6)
82#define DMAC_PSTATUS_STALLRINT (1<<0)
83
84#define DMAC_INT_CHE (1<<3)
85#define DMAC_INT_NFB (1<<1)
86#define DMAC_INT_STALL (1<<0)
diff --git a/include/asm-arm/arch-lh7a40x/entry-macro.S b/include/asm-arm/arch-lh7a40x/entry-macro.S
index a2f67c06d9c9..9fc7f4988124 100644
--- a/include/asm-arm/arch-lh7a40x/entry-macro.S
+++ b/include/asm-arm/arch-lh7a40x/entry-macro.S
@@ -10,11 +10,73 @@
10#include <asm/hardware.h> 10#include <asm/hardware.h>
11#include <asm/arch/irqs.h> 11#include <asm/arch/irqs.h>
12 12
13# if defined (CONFIG_ARCH_LH7A400) && defined (CONFIG_ARCH_LH7A404) 13/* In order to allow there to be support for both of the processor
14# error "LH7A400 and LH7A404 are mutually exclusive" 14 classes at the same time, we make a hack here that isn't very
15# endif 15 pretty. At startup, the link pointed to with the
16 branch_irq_lh7a400 symbol is replaced with a NOP when the CPU is
17 detected as a lh7a404.
16 18
17# if defined (CONFIG_ARCH_LH7A400) 19 *** FIXME: we should clean this up so that there is only one
20 implementation for each CPU's design.
21
22*/
23
24#if defined (CONFIG_ARCH_LH7A400) && defined (CONFIG_ARCH_LH7A404)
25
26 .macro disable_fiq
27 .endm
28
29 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
30
31branch_irq_lh7a400: b 1000f
32
33@ Implementation of the LH7A404 get_irqnr_and_base.
34
35 mov \irqnr, #0 @ VIC1 irq base
36 mov \base, #io_p2v(0x80000000) @ APB registers
37 add \base, \base, #0x8000
38 ldr \tmp, [\base, #0x0030] @ VIC1_VECTADDR
39 tst \tmp, #VA_VECTORED @ Direct vectored
40 bne 1002f
41 tst \tmp, #VA_VIC1DEFAULT @ Default vectored VIC1
42 ldrne \irqstat, [\base, #0] @ VIC1_IRQSTATUS
43 bne 1001f
44 add \base, \base, #(0xa000 - 0x8000)
45 ldr \tmp, [\base, #0x0030] @ VIC2_VECTADDR
46 tst \tmp, #VA_VECTORED @ Direct vectored
47 bne 1002f
48 ldr \irqstat, [\base, #0] @ VIC2_IRQSTATUS
49 mov \irqnr, #32 @ VIC2 irq base
50
511001: movs \irqstat, \irqstat, lsr #1 @ Shift into carry
52 bcs 1008f @ Bit set; irq found
53 add \irqnr, \irqnr, #1
54 bne 1001b @ Until no bits
55 b 1009f @ Nothing? Hmm.
561002: and \irqnr, \tmp, #0x3f @ Mask for valid bits
571008: movs \irqstat, #1 @ Force !Z
58 str \tmp, [\base, #0x0030] @ Clear vector
59 b 1009f
60
61@ Implementation of the LH7A400 get_irqnr_and_base.
62
631000: mov \irqnr, #0
64 mov \base, #io_p2v(0x80000000) @ APB registers
65 ldr \irqstat, [\base, #0x500] @ PIC INTSR
66
671001: movs \irqstat, \irqstat, lsr #1 @ Shift into carry
68 bcs 1008f @ Bit set; irq found
69 add \irqnr, \irqnr, #1
70 bne 1001b @ Until no bits
71 b 1009f @ Nothing? Hmm.
721008: movs \irqstat, #1 @ Force !Z
73
741009:
75 .endm
76
77
78
79#elif defined (CONFIG_ARCH_LH7A400)
18 .macro disable_fiq 80 .macro disable_fiq
19 .endm 81 .endm
20 82
diff --git a/include/asm-arm/arch-lh7a40x/hardware.h b/include/asm-arm/arch-lh7a40x/hardware.h
index aeb07c162e25..e9ff74fd7939 100644
--- a/include/asm-arm/arch-lh7a40x/hardware.h
+++ b/include/asm-arm/arch-lh7a40x/hardware.h
@@ -13,6 +13,8 @@
13#ifndef __ASM_ARCH_HARDWARE_H 13#ifndef __ASM_ARCH_HARDWARE_H
14#define __ASM_ARCH_HARDWARE_H 14#define __ASM_ARCH_HARDWARE_H
15 15
16#include <asm/sizes.h> /* Added for the sake of amba-clcd driver */
17
16#define io_p2v(x) (0xf0000000 | (((x) & 0xfff00000) >> 4) | ((x) & 0x0000ffff)) 18#define io_p2v(x) (0xf0000000 | (((x) & 0xfff00000) >> 4) | ((x) & 0x0000ffff))
17#define io_v2p(x) ( (((x) & 0x0fff0000) << 4) | ((x) & 0x0000ffff)) 19#define io_v2p(x) ( (((x) & 0x0fff0000) << 4) | ((x) & 0x0000ffff))
18 20
@@ -53,6 +55,8 @@ typedef struct { volatile u8 offset[4096]; } __regbase8;
53 55
54#endif 56#endif
55 57
58#define MASK_AND_SET(v,m,s) (v) = ((v)&~(m))|(s)
59
56#include "registers.h" 60#include "registers.h"
57 61
58#endif /* _ASM_ARCH_HARDWARE_H */ 62#endif /* _ASM_ARCH_HARDWARE_H */
diff --git a/include/asm-arm/arch-lh7a40x/irqs.h b/include/asm-arm/arch-lh7a40x/irqs.h
index 189908b2b79a..afe8c7cbad6a 100644
--- a/include/asm-arm/arch-lh7a40x/irqs.h
+++ b/include/asm-arm/arch-lh7a40x/irqs.h
@@ -153,9 +153,10 @@
153#if !defined (IRQ_GPIO0INTR) 153#if !defined (IRQ_GPIO0INTR)
154# define IRQ_GPIO0INTR IRQ_GPIO0FIQ 154# define IRQ_GPIO0INTR IRQ_GPIO0FIQ
155#endif 155#endif
156#define IRQ_TICK IRQ_TINTR 156#define IRQ_TICK IRQ_TINTR
157#define IRQ_PCC1_RDY IRQ_GPIO6INTR /* PCCard 1 ready */ 157#define IRQ_PCC1_RDY IRQ_GPIO6INTR /* PCCard 1 ready */
158#define IRQ_PCC2_RDY IRQ_GPIO7INTR /* PCCard 2 ready */ 158#define IRQ_PCC2_RDY IRQ_GPIO7INTR /* PCCard 2 ready */
159#define IRQ_USB IRQ_USBINTR /* USB device */
159 160
160#ifdef CONFIG_MACH_KEV7A400 161#ifdef CONFIG_MACH_KEV7A400
161# define IRQ_TS IRQ_GPIOFIQ /* Touchscreen */ 162# define IRQ_TS IRQ_GPIOFIQ /* Touchscreen */
@@ -190,6 +191,10 @@
190# define IRQ_LPD7A400_TS IRQ_LPD7A40X_CPLD + 1 /* Touch screen */ 191# define IRQ_LPD7A400_TS IRQ_LPD7A40X_CPLD + 1 /* Touch screen */
191#endif 192#endif
192 193
194#if defined (CONFIG_MACH_LPD7A400)
195# define IRQ_TOUCH IRQ_LPD7A400_TS
196#endif
197
193#define NR_IRQS (NR_IRQ_CPU + NR_IRQ_BOARD) 198#define NR_IRQS (NR_IRQ_CPU + NR_IRQ_BOARD)
194 199
195#endif 200#endif
diff --git a/include/asm-arm/arch-lh7a40x/registers.h b/include/asm-arm/arch-lh7a40x/registers.h
index 3b0d4fcd36f7..b4f09b3e2d03 100644
--- a/include/asm-arm/arch-lh7a40x/registers.h
+++ b/include/asm-arm/arch-lh7a40x/registers.h
@@ -17,7 +17,7 @@
17 17
18 /* Physical register base addresses */ 18 /* Physical register base addresses */
19 19
20#define AC97_PHYS (0x80000000) /* AC97 Controller */ 20#define AC97C_PHYS (0x80000000) /* AC97 Controller */
21#define MMC_PHYS (0x80000100) /* Multimedia Card Controller */ 21#define MMC_PHYS (0x80000100) /* Multimedia Card Controller */
22#define USB_PHYS (0x80000200) /* USB Client */ 22#define USB_PHYS (0x80000200) /* USB Client */
23#define SCI_PHYS (0x80000300) /* Secure Card Interface */ 23#define SCI_PHYS (0x80000300) /* Secure Card Interface */
@@ -34,6 +34,8 @@
34#define RTC_PHYS (0x80000d00) /* Real-time Clock */ 34#define RTC_PHYS (0x80000d00) /* Real-time Clock */
35#define GPIO_PHYS (0x80000e00) /* General Purpose IO */ 35#define GPIO_PHYS (0x80000e00) /* General Purpose IO */
36#define BMI_PHYS (0x80000f00) /* Battery Monitor Interface */ 36#define BMI_PHYS (0x80000f00) /* Battery Monitor Interface */
37#define HRTFTC_PHYS (0x80001000) /* High-res TFT Controller (LH7A400) */
38#define ALI_PHYS (0x80001000) /* Advanced LCD Interface (LH7A404) */
37#define WDT_PHYS (0x80001400) /* Watchdog Timer */ 39#define WDT_PHYS (0x80001400) /* Watchdog Timer */
38#define SMC_PHYS (0x80002000) /* Static Memory Controller */ 40#define SMC_PHYS (0x80002000) /* Static Memory Controller */
39#define SDRC_PHYS (0x80002400) /* SDRAM Controller */ 41#define SDRC_PHYS (0x80002400) /* SDRAM Controller */
@@ -42,6 +44,7 @@
42 44
43 /* Physical registers of the LH7A404 */ 45 /* Physical registers of the LH7A404 */
44 46
47#define ADC_PHYS (0x80001300) /* A/D & Touchscreen Controller */
45#define VIC1_PHYS (0x80008000) /* Vectored Interrupt Controller 1 */ 48#define VIC1_PHYS (0x80008000) /* Vectored Interrupt Controller 1 */
46#define USBH_PHYS (0x80009000) /* USB OHCI host controller */ 49#define USBH_PHYS (0x80009000) /* USB OHCI host controller */
47#define VIC2_PHYS (0x8000a000) /* Vectored Interrupt Controller 2 */ 50#define VIC2_PHYS (0x8000a000) /* Vectored Interrupt Controller 2 */
@@ -52,10 +55,32 @@
52 55
53 /* Clock/State Controller register */ 56 /* Clock/State Controller register */
54 57
58#define CSC_PWRSR __REG(CSC_PHYS + 0x00) /* Reset register & ID */
55#define CSC_PWRCNT __REG(CSC_PHYS + 0x04) /* Power control */ 59#define CSC_PWRCNT __REG(CSC_PHYS + 0x04) /* Power control */
60#define CSC_CLKSET __REG(CSC_PHYS + 0x20) /* Clock speed control */
61#define CSC_USBDRESET __REG(CSC_PHYS + 0x4c) /* USB Device resets */
56 62
57#define CSC_PWRCNT_USBH_EN (1<<28) /* USB Host power enable */ 63#define CSC_PWRCNT_USBH_EN (1<<28) /* USB Host power enable */
58 64#define CSC_PWRCNT_DMAC_M2M1_EN (1<<27)
65#define CSC_PWRCNT_DMAC_M2M0_EN (1<<26)
66#define CSC_PWRCNT_DMAC_M2P8_EN (1<<25)
67#define CSC_PWRCNT_DMAC_M2P9_EN (1<<24)
68#define CSC_PWRCNT_DMAC_M2P6_EN (1<<23)
69#define CSC_PWRCNT_DMAC_M2P7_EN (1<<22)
70#define CSC_PWRCNT_DMAC_M2P4_EN (1<<21)
71#define CSC_PWRCNT_DMAC_M2P5_EN (1<<20)
72#define CSC_PWRCNT_DMAC_M2P2_EN (1<<19)
73#define CSC_PWRCNT_DMAC_M2P3_EN (1<<18)
74#define CSC_PWRCNT_DMAC_M2P0_EN (1<<17)
75#define CSC_PWRCNT_DMAC_M2P1_EN (1<<16)
76
77#define CSC_PWRSR_CHIPMAN_SHIFT (24)
78#define CSC_PWRSR_CHIPMAN_MASK (0xff)
79#define CSC_PWRSR_CHIPID_SHIFT (16)
80#define CSC_PWRSR_CHIPID_MASK (0xff)
81
82#define CSC_USBDRESET_APBRESETREG (1<<1)
83#define CSC_USBDRESET_IORESETREG (1<<0)
59 84
60 /* Interrupt Controller registers */ 85 /* Interrupt Controller registers */
61 86
@@ -108,6 +133,13 @@
108#define GPIO_GPIOFEOI __REG(GPIO_PHYS + 0x54) /* GPIO End-of-Interrupt */ 133#define GPIO_GPIOFEOI __REG(GPIO_PHYS + 0x54) /* GPIO End-of-Interrupt */
109#define GPIO_GPIOINTEN __REG(GPIO_PHYS + 0x58) /* GPIO Interrupt Enable */ 134#define GPIO_GPIOINTEN __REG(GPIO_PHYS + 0x58) /* GPIO Interrupt Enable */
110#define GPIO_INTSTATUS __REG(GPIO_PHYS + 0x5c) /* GPIO Interrupt Status */ 135#define GPIO_INTSTATUS __REG(GPIO_PHYS + 0x5c) /* GPIO Interrupt Status */
136#define GPIO_PINMUX __REG(GPIO_PHYS + 0x2c)
137#define GPIO_PADD __REG(GPIO_PHYS + 0x10)
138#define GPIO_PAD __REG(GPIO_PHYS + 0x00)
139#define GPIO_PCD __REG(GPIO_PHYS + 0x08)
140#define GPIO_PCDD __REG(GPIO_PHYS + 0x18)
141#define GPIO_PEDD __REG(GPIO_PHYS + 0x24)
142#define GPIO_PED __REG(GPIO_PHYS + 0x20)
111 143
112 144
113 /* Static Memory Controller registers */ 145 /* Static Memory Controller registers */
@@ -137,20 +169,21 @@
137#endif 169#endif
138 170
139#if defined (CONFIG_MACH_LPD7A400) || defined (CONFIG_MACH_LPD7A404) 171#if defined (CONFIG_MACH_LPD7A400) || defined (CONFIG_MACH_LPD7A404)
140# define CPLD_CONTROL __REG8(CPLD02_PHYS)
141# define CPLD_SPI_DATA __REG8(CPLD06_PHYS)
142# define CPLD_SPI_CONTROL __REG8(CPLD08_PHYS)
143# define CPLD_SPI_EEPROM __REG8(CPLD0A_PHYS)
144# define CPLD_INTERRUPTS __REG8(CPLD0C_PHYS) /* IRQ mask/status */
145# define CPLD_BOOT_MODE __REG8(CPLD0E_PHYS)
146# define CPLD_FLASH __REG8(CPLD10_PHYS)
147# define CPLD_POWER_MGMT __REG8(CPLD12_PHYS)
148# define CPLD_REVISION __REG8(CPLD14_PHYS)
149# define CPLD_GPIO_EXT __REG8(CPLD16_PHYS)
150# define CPLD_GPIO_DATA __REG8(CPLD18_PHYS)
151# define CPLD_GPIO_DIR __REG8(CPLD1A_PHYS)
152#endif
153 172
173# define CPLD_CONTROL __REG16(CPLD02_PHYS)
174# define CPLD_SPI_DATA __REG16(CPLD06_PHYS)
175# define CPLD_SPI_CONTROL __REG16(CPLD08_PHYS)
176# define CPLD_SPI_EEPROM __REG16(CPLD0A_PHYS)
177# define CPLD_INTERRUPTS __REG16(CPLD0C_PHYS) /* IRQ mask/status */
178# define CPLD_BOOT_MODE __REG16(CPLD0E_PHYS)
179# define CPLD_FLASH __REG16(CPLD10_PHYS)
180# define CPLD_POWER_MGMT __REG16(CPLD12_PHYS)
181# define CPLD_REVISION __REG16(CPLD14_PHYS)
182# define CPLD_GPIO_EXT __REG16(CPLD16_PHYS)
183# define CPLD_GPIO_DATA __REG16(CPLD18_PHYS)
184# define CPLD_GPIO_DIR __REG16(CPLD1A_PHYS)
185
186#endif
154 187
155 /* Timer registers */ 188 /* Timer registers */
156 189
@@ -189,4 +222,3 @@
189 222
190 223
191#endif /* _ASM_ARCH_REGISTERS_H */ 224#endif /* _ASM_ARCH_REGISTERS_H */
192
diff --git a/include/asm-arm/arch-lh7a40x/ssp.h b/include/asm-arm/arch-lh7a40x/ssp.h
new file mode 100644
index 000000000000..132b1c4d5ce6
--- /dev/null
+++ b/include/asm-arm/arch-lh7a40x/ssp.h
@@ -0,0 +1,71 @@
1/* ssp.h
2 $Id$
3
4 written by Marc Singer
5 6 Dec 2004
6
7 Copyright (C) 2004 Marc Singer
8
9 -----------
10 DESCRIPTION
11 -----------
12
13 This SSP header is available throughout the kernel, for this
14 machine/architecture, because drivers that use it may be dispersed.
15
16 This file was cloned from the 7952x implementation. It would be
17 better to share them, but we're taking an easier approach for the
18 time being.
19
20*/
21
22#if !defined (__SSP_H__)
23# define __SSP_H__
24
25/* ----- Includes */
26
27/* ----- Types */
28
29struct ssp_driver {
30 int (*init) (void);
31 void (*exit) (void);
32 void (*acquire) (void);
33 void (*release) (void);
34 int (*configure) (int device, int mode, int speed,
35 int frame_size_write, int frame_size_read);
36 void (*chip_select) (int enable);
37 void (*set_callbacks) (void* handle,
38 irqreturn_t (*callback_tx)(void*),
39 irqreturn_t (*callback_rx)(void*));
40 void (*enable) (void);
41 void (*disable) (void);
42// int (*save_state) (void*);
43// void (*restore_state) (void*);
44 int (*read) (void);
45 int (*write) (u16 data);
46 int (*write_read) (u16 data);
47 void (*flush) (void);
48 void (*write_async) (void* pv, size_t cb);
49 size_t (*write_pos) (void);
50};
51
52 /* These modes are only available on the LH79524 */
53#define SSP_MODE_SPI (1)
54#define SSP_MODE_SSI (2)
55#define SSP_MODE_MICROWIRE (3)
56#define SSP_MODE_I2S (4)
57
58 /* CPLD SPI devices */
59#define DEVICE_EEPROM 0 /* Configuration eeprom */
60#define DEVICE_MAC 1 /* MAC eeprom (LPD79524) */
61#define DEVICE_CODEC 2 /* Audio codec */
62#define DEVICE_TOUCH 3 /* Touch screen (LPD79520) */
63
64/* ----- Globals */
65
66/* ----- Prototypes */
67
68//extern struct ssp_driver lh79520_i2s_driver;
69extern struct ssp_driver lh7a400_cpld_ssp_driver;
70
71#endif /* __SSP_H__ */
diff --git a/include/asm-arm/arch-lh7a40x/uncompress.h b/include/asm-arm/arch-lh7a40x/uncompress.h
index f8053346f608..3d1ce0426a33 100644
--- a/include/asm-arm/arch-lh7a40x/uncompress.h
+++ b/include/asm-arm/arch-lh7a40x/uncompress.h
@@ -16,7 +16,7 @@
16#ifndef UART_R_STATUS 16#ifndef UART_R_STATUS
17# define UART_R_STATUS (0x10) 17# define UART_R_STATUS (0x10)
18#endif 18#endif
19#define nTxRdy (0x20) /* Not TxReady (literally Tx FIFO full) */ 19#define nTxRdy (0x20) /* Not TxReady (literally Tx FIFO full) */
20 20
21 /* Access UART with physical addresses before MMU is setup */ 21 /* Access UART with physical addresses before MMU is setup */
22#define UART_STATUS (*(volatile unsigned long*) (UART2_PHYS + UART_R_STATUS)) 22#define UART_STATUS (*(volatile unsigned long*) (UART2_PHYS + UART_R_STATUS))
diff --git a/include/asm-arm/arch-pnx4008/clock.h b/include/asm-arm/arch-pnx4008/clock.h
new file mode 100644
index 000000000000..91ae0030fdf2
--- /dev/null
+++ b/include/asm-arm/arch-pnx4008/clock.h
@@ -0,0 +1,61 @@
1/*
2 * include/asm-arm/arch-pnx4008/clock.h
3 *
4 * Clock control driver for PNX4008 - header file
5 *
6 * Authors: Vitaly Wool, Dmitry Chigirev <source@mvista.com>
7 *
8 * 2005 (c) MontaVista Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 */
13#ifndef __PNX4008_CLOCK_H__
14#define __PNX4008_CLOCK_H__
15
16struct module;
17struct clk;
18
19#define PWRMAN_VA_BASE IO_ADDRESS(PNX4008_PWRMAN_BASE)
20#define HCLKDIVCTRL_REG (PWRMAN_VA_BASE + 0x40)
21#define PWRCTRL_REG (PWRMAN_VA_BASE + 0x44)
22#define PLLCTRL_REG (PWRMAN_VA_BASE + 0x48)
23#define OSC13CTRL_REG (PWRMAN_VA_BASE + 0x4c)
24#define SYSCLKCTRL_REG (PWRMAN_VA_BASE + 0x50)
25#define HCLKPLLCTRL_REG (PWRMAN_VA_BASE + 0x58)
26#define USBCTRL_REG (PWRMAN_VA_BASE + 0x64)
27#define SDRAMCLKCTRL_REG (PWRMAN_VA_BASE + 0x68)
28#define MSCTRL_REG (PWRMAN_VA_BASE + 0x80)
29#define BTCLKCTRL (PWRMAN_VA_BASE + 0x84)
30#define DUMCLKCTRL_REG (PWRMAN_VA_BASE + 0x90)
31#define I2CCLKCTRL_REG (PWRMAN_VA_BASE + 0xac)
32#define KEYCLKCTRL_REG (PWRMAN_VA_BASE + 0xb0)
33#define TSCLKCTRL_REG (PWRMAN_VA_BASE + 0xb4)
34#define PWMCLKCTRL_REG (PWRMAN_VA_BASE + 0xb8)
35#define SPICTRL_REG (PWRMAN_VA_BASE + 0xc4)
36#define FLASHCLKCTRL_REG (PWRMAN_VA_BASE + 0xc8)
37#define UART3CLK_REG (PWRMAN_VA_BASE + 0xd0)
38#define UARTCLKCTRL_REG (PWRMAN_VA_BASE + 0xe4)
39#define DMACLKCTRL_REG (PWRMAN_VA_BASE + 0xe8)
40#define AUTOCLK_CTRL (PWRMAN_VA_BASE + 0xec)
41#define JPEGCLKCTRL_REG (PWRMAN_VA_BASE + 0xfc)
42
43#define AUDIOCONFIG_VA_BASE IO_ADDRESS(PNX4008_AUDIOCONFIG_BASE)
44#define DSPPLLCTRL_REG (AUDIOCONFIG_VA_BASE + 0x60)
45#define DSPCLKCTRL_REG (AUDIOCONFIG_VA_BASE + 0x64)
46#define AUDIOCLKCTRL_REG (AUDIOCONFIG_VA_BASE + 0x68)
47#define AUDIOPLLCTRL_REG (AUDIOCONFIG_VA_BASE + 0x6C)
48
49#define USB_OTG_CLKCTRL_REG IO_ADDRESS(PNX4008_USB_CONFIG_BASE + 0xff4)
50
51#define VFP9CLKCTRL_REG IO_ADDRESS(PNX4008_DEBUG_BASE)
52
53#define CLK_RATE_13MHZ 13000
54#define CLK_RATE_1MHZ 1000
55#define CLK_RATE_208MHZ 208000
56#define CLK_RATE_48MHZ 48000
57#define CLK_RATE_32KHZ 32
58
59#define PNX4008_UART_CLK CLK_RATE_13MHZ * 1000 /* in MHz */
60
61#endif
diff --git a/include/asm-arm/arch-pnx4008/debug-macro.S b/include/asm-arm/arch-pnx4008/debug-macro.S
new file mode 100644
index 000000000000..eb3839de389a
--- /dev/null
+++ b/include/asm-arm/arch-pnx4008/debug-macro.S
@@ -0,0 +1,27 @@
1/* linux/include/asm-arm/arch-pnx4008/debug-macro.S
2 *
3 * Debugging macro include header
4 *
5 * Copyright (C) 1994-1999 Russell King
6 * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12*/
13
14 .macro addruart,rx
15 mrc p15, 0, \rx, c1, c0
16 tst \rx, #1 @ MMU enabled?
17 mov \rx, #0x00090000
18 addeq \rx, \rx, #0x40000000
19 addne \rx, \rx, #0xf4000000
20 .endm
21
22 .macro senduart,rd,rx
23 strb \rd, [\rx, #0x0]
24 .endm
25
26#define UART_SHIFT 2
27#include <asm/hardware/debug-8250.S>
diff --git a/include/asm-arm/arch-pnx4008/dma.h b/include/asm-arm/arch-pnx4008/dma.h
new file mode 100644
index 000000000000..3aee1204795b
--- /dev/null
+++ b/include/asm-arm/arch-pnx4008/dma.h
@@ -0,0 +1,162 @@
1/*
2 * linux/include/asm-arm/arch-pnx4008/dma.h
3 *
4 * PNX4008 DMA header file
5 *
6 * Author: Vitaly Wool
7 * Copyright: MontaVista Software Inc. (c) 2005
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#ifndef __ASM_ARCH_DMA_H
15#define __ASM_ARCH_DMA_H
16
17#include "platform.h"
18
19#define MAX_DMA_ADDRESS 0xffffffff
20
21#define MAX_DMA_CHANNELS 8
22
23#define DMAC_BASE IO_ADDRESS(PNX4008_DMA_CONFIG_BASE)
24#define DMAC_INT_STAT (DMAC_BASE + 0x0000)
25#define DMAC_INT_TC_STAT (DMAC_BASE + 0x0004)
26#define DMAC_INT_TC_CLEAR (DMAC_BASE + 0x0008)
27#define DMAC_INT_ERR_STAT (DMAC_BASE + 0x000c)
28#define DMAC_INT_ERR_CLEAR (DMAC_BASE + 0x0010)
29#define DMAC_SOFT_SREQ (DMAC_BASE + 0x0024)
30#define DMAC_CONFIG (DMAC_BASE + 0x0030)
31#define DMAC_Cx_SRC_ADDR(c) (DMAC_BASE + 0x0100 + (c) * 0x20)
32#define DMAC_Cx_DEST_ADDR(c) (DMAC_BASE + 0x0104 + (c) * 0x20)
33#define DMAC_Cx_LLI(c) (DMAC_BASE + 0x0108 + (c) * 0x20)
34#define DMAC_Cx_CONTROL(c) (DMAC_BASE + 0x010c + (c) * 0x20)
35#define DMAC_Cx_CONFIG(c) (DMAC_BASE + 0x0110 + (c) * 0x20)
36
37enum {
38 WIDTH_BYTE = 0,
39 WIDTH_HWORD,
40 WIDTH_WORD
41};
42
43enum {
44 FC_MEM2MEM_DMA,
45 FC_MEM2PER_DMA,
46 FC_PER2MEM_DMA,
47 FC_PER2PER_DMA,
48 FC_PER2PER_DPER,
49 FC_MEM2PER_PER,
50 FC_PER2MEM_PER,
51 FC_PER2PER_SPER
52};
53
54enum {
55 DMA_INT_UNKNOWN = 0,
56 DMA_ERR_INT = 1,
57 DMA_TC_INT = 2,
58};
59
60enum {
61 DMA_BUFFER_ALLOCATED = 1,
62 DMA_HAS_LL = 2,
63};
64
65enum {
66 PER_CAM_DMA_1 = 0,
67 PER_NDF_FLASH = 1,
68 PER_MBX_SLAVE_FIFO = 2,
69 PER_SPI2_REC_XMIT = 3,
70 PER_MS_SD_RX_XMIT = 4,
71 PER_HS_UART_1_XMIT = 5,
72 PER_HS_UART_1_RX = 6,
73 PER_HS_UART_2_XMIT = 7,
74 PER_HS_UART_2_RX = 8,
75 PER_HS_UART_7_XMIT = 9,
76 PER_HS_UART_7_RX = 10,
77 PER_SPI1_REC_XMIT = 11,
78 PER_MLC_NDF_SREC = 12,
79 PER_CAM_DMA_2 = 13,
80 PER_PRNG_INFIFO = 14,
81 PER_PRNG_OUTFIFO = 15,
82};
83
84struct pnx4008_dma_ch_ctrl {
85 int tc_mask;
86 int cacheable;
87 int bufferable;
88 int priv_mode;
89 int di;
90 int si;
91 int dest_ahb1;
92 int src_ahb1;
93 int dwidth;
94 int swidth;
95 int dbsize;
96 int sbsize;
97 int tr_size;
98};
99
100struct pnx4008_dma_ch_config {
101 int halt;
102 int active;
103 int lock;
104 int itc;
105 int ie;
106 int flow_cntrl;
107 int dest_per;
108 int src_per;
109};
110
111struct pnx4008_dma_ll {
112 unsigned long src_addr;
113 unsigned long dest_addr;
114 u32 next_dma;
115 unsigned long ch_ctrl;
116 struct pnx4008_dma_ll *next;
117 int flags;
118 void *alloc_data;
119 int (*free) (void *);
120};
121
122struct pnx4008_dma_config {
123 int is_ll;
124 unsigned long src_addr;
125 unsigned long dest_addr;
126 unsigned long ch_ctrl;
127 unsigned long ch_cfg;
128 struct pnx4008_dma_ll *ll;
129 u32 ll_dma;
130 int flags;
131 void *alloc_data;
132 int (*free) (void *);
133};
134
135extern struct pnx4008_dma_ll *pnx4008_alloc_ll_entry(dma_addr_t *);
136extern void pnx4008_free_ll_entry(struct pnx4008_dma_ll *, dma_addr_t);
137extern void pnx4008_free_ll(u32 ll_dma, struct pnx4008_dma_ll *);
138
139extern int pnx4008_request_channel(char *, int,
140 void (*)(int, int, void *, struct pt_regs *),
141 void *);
142extern void pnx4008_free_channel(int);
143extern int pnx4008_config_dma(int, int, int);
144extern int pnx4008_dma_pack_control(const struct pnx4008_dma_ch_ctrl *,
145 unsigned long *);
146extern int pnx4008_dma_parse_control(unsigned long,
147 struct pnx4008_dma_ch_ctrl *);
148extern int pnx4008_dma_pack_config(const struct pnx4008_dma_ch_config *,
149 unsigned long *);
150extern int pnx4008_dma_parse_config(unsigned long,
151 struct pnx4008_dma_ch_config *);
152extern int pnx4008_config_channel(int, struct pnx4008_dma_config *);
153extern int pnx4008_channel_get_config(int, struct pnx4008_dma_config *);
154extern int pnx4008_dma_ch_enable(int);
155extern int pnx4008_dma_ch_disable(int);
156extern int pnx4008_dma_ch_enabled(int);
157extern void pnx4008_dma_split_head_entry(struct pnx4008_dma_config *,
158 struct pnx4008_dma_ch_ctrl *);
159extern void pnx4008_dma_split_ll_entry(struct pnx4008_dma_ll *,
160 struct pnx4008_dma_ch_ctrl *);
161
162#endif /* _ASM_ARCH_DMA_H */
diff --git a/include/asm-arm/arch-pnx4008/entry-macro.S b/include/asm-arm/arch-pnx4008/entry-macro.S
new file mode 100644
index 000000000000..c1c198e3680b
--- /dev/null
+++ b/include/asm-arm/arch-pnx4008/entry-macro.S
@@ -0,0 +1,121 @@
1/*
2 * include/asm-arm/arch-pnx4008/entry-macro.S
3 *
4 * Low-level IRQ helper macros for PNX4008-based platforms
5 *
6 * 2005-2006 (c) MontaVista Software, Inc.
7 * Author: Vitaly Wool <vwool@ru.mvista.com>
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 */
12
13#include "platform.h"
14
15#define IO_BASE 0xF0000000
16#define IO_ADDRESS(x) (((((x) & 0xff000000) >> 4) | ((x) & 0xfffff)) | IO_BASE)
17
18#define INTRC_MASK 0x00
19#define INTRC_RAW_STAT 0x04
20#define INTRC_STAT 0x08
21#define INTRC_POLAR 0x0C
22#define INTRC_ACT_TYPE 0x10
23#define INTRC_TYPE 0x14
24
25#define SIC1_BASE_INT 32
26#define SIC2_BASE_INT 64
27
28 .macro disable_fiq
29 .endm
30
31 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
32/* decode the MIC interrupt numbers */
33 ldr \base, =IO_ADDRESS(PNX4008_INTCTRLMIC_BASE)
34 ldr \irqstat, [\base, #INTRC_STAT]
35
36 cmp \irqstat,#1<<16
37 movhs \irqnr,#16
38 movlo \irqnr,#0
39 movhs \irqstat,\irqstat,lsr#16
40 cmp \irqstat,#1<<8
41 addhs \irqnr,\irqnr,#8
42 movhs \irqstat,\irqstat,lsr#8
43 cmp \irqstat,#1<<4
44 addhs \irqnr,\irqnr,#4
45 movhs \irqstat,\irqstat,lsr#4
46 cmp \irqstat,#1<<2
47 addhs \irqnr,\irqnr,#2
48 movhs \irqstat,\irqstat,lsr#2
49 cmp \irqstat,#1<<1
50 addhs \irqnr,\irqnr,#1
51
52/* was there an interrupt ? if not then drop out with EQ status */
53 teq \irqstat,#0
54 beq 1003f
55
56/* and now check for extended IRQ reasons */
57 cmp \irqnr,#1
58 bls 1003f
59 cmp \irqnr,#30
60 blo 1002f
61
62/* IRQ 31,30 : High priority cascade IRQ handle */
63/* read the correct SIC */
64/* decoding status after compare : eq is 30 (SIC1) , ne is 31 (SIC2) */
65/* set the base IRQ number */
66 ldreq \base, =IO_ADDRESS(PNX4008_INTCTRLSIC1_BASE)
67 moveq \irqnr,#SIC1_BASE_INT
68 ldrne \base, =IO_ADDRESS(PNX4008_INTCTRLSIC2_BASE)
69 movne \irqnr,#SIC2_BASE_INT
70 ldr \irqstat, [\base, #INTRC_STAT]
71 ldr \tmp, [\base, #INTRC_TYPE]
72/* and with inverted mask : low priority interrupts */
73 and \irqstat,\irqstat,\tmp
74 b 1004f
75
761003:
77/* IRQ 1,0 : Low priority cascade IRQ handle */
78/* read the correct SIC */
79/* decoding status after compare : eq is 1 (SIC2) , ne is 0 (SIC1)*/
80/* read the correct SIC */
81/* set the base IRQ number */
82 ldrne \base, =IO_ADDRESS(PNX4008_INTCTRLSIC1_BASE)
83 movne \irqnr,#SIC1_BASE_INT
84 ldreq \base, =IO_ADDRESS(PNX4008_INTCTRLSIC2_BASE)
85 moveq \irqnr,#SIC2_BASE_INT
86 ldr \irqstat, [\base, #INTRC_STAT]
87 ldr \tmp, [\base, #INTRC_TYPE]
88/* and with inverted mask : low priority interrupts */
89 bic \irqstat,\irqstat,\tmp
90
911004:
92
93 cmp \irqstat,#1<<16
94 addhs \irqnr,\irqnr,#16
95 movhs \irqstat,\irqstat,lsr#16
96 cmp \irqstat,#1<<8
97 addhs \irqnr,\irqnr,#8
98 movhs \irqstat,\irqstat,lsr#8
99 cmp \irqstat,#1<<4
100 addhs \irqnr,\irqnr,#4
101 movhs \irqstat,\irqstat,lsr#4
102 cmp \irqstat,#1<<2
103 addhs \irqnr,\irqnr,#2
104 movhs \irqstat,\irqstat,lsr#2
105 cmp \irqstat,#1<<1
106 addhs \irqnr,\irqnr,#1
107
108
109/* is irqstat not zero */
110
1111002:
112/* we assert that irqstat is not equal to zero and return ne status if true*/
113 teq \irqstat,#0
1141003:
115 .endm
116
117
118 .macro irq_prio_table
119 .endm
120
121
diff --git a/include/asm-arm/arch-pnx4008/gpio.h b/include/asm-arm/arch-pnx4008/gpio.h
new file mode 100644
index 000000000000..1fa5a77c3010
--- /dev/null
+++ b/include/asm-arm/arch-pnx4008/gpio.h
@@ -0,0 +1,139 @@
1/*
2 * include/asm-arm/arch-pnx4008/gpio.h
3 *
4 * PNX4008 GPIO driver - header file
5 *
6 * Author: Dmitry Chigirev <source@mvista.com>
7 *
8 * Based on reference code by Iwo Mergler and Z.Tabaaloute from Philips:
9 * Copyright (c) 2005 Koninklijke Philips Electronics N.V.
10 *
11 * 2005 (c) MontaVista Software, Inc. This file is licensed under
12 * the terms of the GNU General Public License version 2. This program
13 * is licensed "as is" without any warranty of any kind, whether express
14 * or implied.
15 */
16
17#ifndef _PNX4008_GPIO_H_
18#define _PNX4008_GPIO_H_
19
20
21/* Block numbers */
22#define GPIO_IN (0)
23#define GPIO_OUT (0x100)
24#define GPIO_BID (0x200)
25#define GPIO_RAM (0x300)
26#define GPIO_MUX (0x400)
27
28#define GPIO_TYPE_MASK(K) ((K) & 0x700)
29
30/* INPUT GPIOs */
31/* GPI */
32#define GPI_00 (GPIO_IN | 0)
33#define GPI_01 (GPIO_IN | 1)
34#define GPI_02 (GPIO_IN | 2)
35#define GPI_03 (GPIO_IN | 3)
36#define GPI_04 (GPIO_IN | 4)
37#define GPI_05 (GPIO_IN | 5)
38#define GPI_06 (GPIO_IN | 6)
39#define GPI_07 (GPIO_IN | 7)
40#define GPI_08 (GPIO_IN | 8)
41#define GPI_09 (GPIO_IN | 9)
42#define U1_RX (GPIO_IN | 15)
43#define U2_HTCS (GPIO_IN | 16)
44#define U2_RX (GPIO_IN | 17)
45#define U3_RX (GPIO_IN | 18)
46#define U4_RX (GPIO_IN | 19)
47#define U5_RX (GPIO_IN | 20)
48#define U6_IRRX (GPIO_IN | 21)
49#define U7_HCTS (GPIO_IN | 22)
50#define U7_RX (GPIO_IN | 23)
51/* MISC IN */
52#define SPI1_DATIN (GPIO_IN | 25)
53#define DISP_SYNC (GPIO_IN | 26)
54#define SPI2_DATIN (GPIO_IN | 27)
55#define GPI_11 (GPIO_IN | 28)
56
57#define GPIO_IN_MASK 0x1eff83ff
58
59/* OUTPUT GPIOs */
60/* GPO */
61#define GPO_00 (GPIO_OUT | 0)
62#define GPO_01 (GPIO_OUT | 1)
63#define GPO_02 (GPIO_OUT | 2)
64#define GPO_03 (GPIO_OUT | 3)
65#define GPO_04 (GPIO_OUT | 4)
66#define GPO_05 (GPIO_OUT | 5)
67#define GPO_06 (GPIO_OUT | 6)
68#define GPO_07 (GPIO_OUT | 7)
69#define GPO_08 (GPIO_OUT | 8)
70#define GPO_09 (GPIO_OUT | 9)
71#define GPO_10 (GPIO_OUT | 10)
72#define GPO_11 (GPIO_OUT | 11)
73#define GPO_12 (GPIO_OUT | 12)
74#define GPO_13 (GPIO_OUT | 13)
75#define GPO_14 (GPIO_OUT | 14)
76#define GPO_15 (GPIO_OUT | 15)
77#define GPO_16 (GPIO_OUT | 16)
78#define GPO_17 (GPIO_OUT | 17)
79#define GPO_18 (GPIO_OUT | 18)
80#define GPO_19 (GPIO_OUT | 19)
81#define GPO_20 (GPIO_OUT | 20)
82#define GPO_21 (GPIO_OUT | 21)
83#define GPO_22 (GPIO_OUT | 22)
84#define GPO_23 (GPIO_OUT | 23)
85
86#define GPIO_OUT_MASK 0xffffff
87
88/* BIDIRECTIONAL GPIOs */
89/* RAM pins */
90#define RAM_D19 (GPIO_RAM | 0)
91#define RAM_D20 (GPIO_RAM | 1)
92#define RAM_D21 (GPIO_RAM | 2)
93#define RAM_D22 (GPIO_RAM | 3)
94#define RAM_D23 (GPIO_RAM | 4)
95#define RAM_D24 (GPIO_RAM | 5)
96#define RAM_D25 (GPIO_RAM | 6)
97#define RAM_D26 (GPIO_RAM | 7)
98#define RAM_D27 (GPIO_RAM | 8)
99#define RAM_D28 (GPIO_RAM | 9)
100#define RAM_D29 (GPIO_RAM | 10)
101#define RAM_D30 (GPIO_RAM | 11)
102#define RAM_D31 (GPIO_RAM | 12)
103
104#define GPIO_RAM_MASK 0x1fff
105
106/* I/O pins */
107#define GPIO_00 (GPIO_BID | 25)
108#define GPIO_01 (GPIO_BID | 26)
109#define GPIO_02 (GPIO_BID | 27)
110#define GPIO_03 (GPIO_BID | 28)
111#define GPIO_04 (GPIO_BID | 29)
112#define GPIO_05 (GPIO_BID | 30)
113
114#define GPIO_BID_MASK 0x7e000000
115
116/* Non-GPIO multiplexed PIOs. For multiplexing with GPIO, please use GPIO macros */
117#define GPIO_SDRAM_SEL (GPIO_MUX | 3)
118
119#define GPIO_MUX_MASK 0x8
120
121/* Extraction/assembly macros */
122#define GPIO_BIT_MASK(K) ((K) & 0x1F)
123#define GPIO_BIT(K) (1 << GPIO_BIT_MASK(K))
124#define GPIO_ISMUX(K) ((GPIO_TYPE_MASK(K) == GPIO_MUX) && (GPIO_BIT(K) & GPIO_MUX_MASK))
125#define GPIO_ISRAM(K) ((GPIO_TYPE_MASK(K) == GPIO_RAM) && (GPIO_BIT(K) & GPIO_RAM_MASK))
126#define GPIO_ISBID(K) ((GPIO_TYPE_MASK(K) == GPIO_BID) && (GPIO_BIT(K) & GPIO_BID_MASK))
127#define GPIO_ISOUT(K) ((GPIO_TYPE_MASK(K) == GPIO_OUT) && (GPIO_BIT(K) & GPIO_OUT_MASK))
128#define GPIO_ISIN(K) ((GPIO_TYPE_MASK(K) == GPIO_IN) && (GPIO_BIT(K) & GPIO_IN_MASK))
129
130extern int pnx4008_gpio_register_pin(unsigned short pin);
131extern int pnx4008_gpio_unregister_pin(unsigned short pin);
132extern unsigned long pnx4008_gpio_read_pin(unsigned short pin);
133extern int pnx4008_gpio_write_pin(unsigned short pin, int output);
134extern int pnx4008_gpio_set_pin_direction(unsigned short pin, int output);
135extern int pnx4008_gpio_read_pin_direction(unsigned short pin);
136extern int pnx4008_gpio_set_pin_mux(unsigned short pin, int output);
137extern int pnx4008_gpio_read_pin_mux(unsigned short pin);
138
139#endif /* _PNX4008_GPIO_H_ */
diff --git a/include/asm-arm/arch-pnx4008/hardware.h b/include/asm-arm/arch-pnx4008/hardware.h
new file mode 100644
index 000000000000..a4410397a921
--- /dev/null
+++ b/include/asm-arm/arch-pnx4008/hardware.h
@@ -0,0 +1,32 @@
1/*
2 * linux/include/asm-arm/arch-pnx4008/hardware.h
3 *
4 * Copyright (c) 2005 MontaVista Software, Inc. <source@mvista.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#ifndef __ASM_ARCH_HARDWARE_H
21#define __ASM_ARCH_HARDWARE_H
22
23#include <asm/sizes.h>
24#include <asm/arch/platform.h>
25
26/* Start of virtual addresses for IO devices */
27#define IO_BASE 0xF0000000
28
29/* This macro relies on fact that for all HW i/o addresses bits 20-23 are 0 */
30#define IO_ADDRESS(x) (((((x) & 0xff000000) >> 4) | ((x) & 0xfffff)) | IO_BASE)
31
32#endif
diff --git a/include/asm-arm/arch-pnx4008/io.h b/include/asm-arm/arch-pnx4008/io.h
new file mode 100644
index 000000000000..29ee43955c52
--- /dev/null
+++ b/include/asm-arm/arch-pnx4008/io.h
@@ -0,0 +1,21 @@
1
2/*
3 * include/asm-arm/arch-pnx4008/io.h
4 *
5 * Author: Dmitry Chigirev <chigirev@ru.mvista.com>
6 *
7 * 2005 (c) MontaVista Software, Inc. This file is licensed under
8 * the terms of the GNU General Public License version 2. This program
9 * is licensed "as is" without any warranty of any kind, whether express
10 * or implied.
11 */
12
13#ifndef __ASM_ARM_ARCH_IO_H
14#define __ASM_ARM_ARCH_IO_H
15
16#define IO_SPACE_LIMIT 0xffffffff
17
18#define __io(a) ((void __iomem *)(a))
19#define __mem_pci(a) (a)
20
21#endif
diff --git a/include/asm-arm/arch-pnx4008/irq.h b/include/asm-arm/arch-pnx4008/irq.h
new file mode 100644
index 000000000000..fabff5dc337f
--- /dev/null
+++ b/include/asm-arm/arch-pnx4008/irq.h
@@ -0,0 +1,42 @@
1/*
2 * include/asm-arm/arch-pnx4008/irq.h
3 *
4 * PNX4008 IRQ controller driver - header file
5 * this one is used in entry-arnv.S as well so it cannot contain C code
6 *
7 * Copyright (c) 2005 Philips Semiconductors
8 * Copyright (c) 2005 MontaVista Software, Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15#ifndef __PNX4008_IRQ_H__
16#define __PNX4008_IRQ_H__
17
18#define MIC_VA_BASE IO_ADDRESS(PNX4008_INTCTRLMIC_BASE)
19#define SIC1_VA_BASE IO_ADDRESS(PNX4008_INTCTRLSIC1_BASE)
20#define SIC2_VA_BASE IO_ADDRESS(PNX4008_INTCTRLSIC2_BASE)
21
22/* Manual: Chapter 20, page 195 */
23
24#define INTC_BIT(irq) (1<< ((irq) & 0x1F))
25
26#define INTC_ER(irq) IO_ADDRESS((PNX4008_INTCTRLMIC_BASE + 0x0 + (((irq)&(0x3<<5))<<9)))
27#define INTC_RSR(irq) IO_ADDRESS((PNX4008_INTCTRLMIC_BASE + 0x4 + (((irq)&(0x3<<5))<<9)))
28#define INTC_SR(irq) IO_ADDRESS((PNX4008_INTCTRLMIC_BASE + 0x8 + (((irq)&(0x3<<5))<<9)))
29#define INTC_APR(irq) IO_ADDRESS((PNX4008_INTCTRLMIC_BASE + 0xC + (((irq)&(0x3<<5))<<9)))
30#define INTC_ATR(irq) IO_ADDRESS((PNX4008_INTCTRLMIC_BASE + 0x10 + (((irq)&(0x3<<5))<<9)))
31#define INTC_ITR(irq) IO_ADDRESS((PNX4008_INTCTRLMIC_BASE + 0x14 + (((irq)&(0x3<<5))<<9)))
32
33#define START_INT_REG_BIT(irq) (1<<((irq)&0x1F))
34
35#define START_INT_ER_REG(irq) IO_ADDRESS((PNX4008_PWRMAN_BASE + 0x20 + (((irq)&(0x1<<5))>>1)))
36#define START_INT_RSR_REG(irq) IO_ADDRESS((PNX4008_PWRMAN_BASE + 0x24 + (((irq)&(0x1<<5))>>1)))
37#define START_INT_SR_REG(irq) IO_ADDRESS((PNX4008_PWRMAN_BASE + 0x28 + (((irq)&(0x1<<5))>>1)))
38#define START_INT_APR_REG(irq) IO_ADDRESS((PNX4008_PWRMAN_BASE + 0x2C + (((irq)&(0x1<<5))>>1)))
39
40extern void __init pnx4008_init_irq(void);
41
42#endif /* __PNX4008_IRQ_H__ */
diff --git a/include/asm-arm/arch-pnx4008/irqs.h b/include/asm-arm/arch-pnx4008/irqs.h
new file mode 100644
index 000000000000..13ec7ed0f501
--- /dev/null
+++ b/include/asm-arm/arch-pnx4008/irqs.h
@@ -0,0 +1,215 @@
1/*
2 * include/asm-arm/arch-pnx4008/irqs.h
3 *
4 * PNX4008 IRQ controller driver - header file
5 *
6 * Author: Dmitry Chigirev <source@mvista.com>
7 *
8 * 2005 (c) MontaVista Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 */
13#ifndef __PNX4008_IRQS_h__
14#define __PNX4008_IRQS_h__
15
16#define NR_IRQS 96
17
18/*Manual: table 259, page 199*/
19
20/*SUB2 Interrupt Routing (SIC2)*/
21
22#define SIC2_BASE_INT 64
23
24#define CLK_SWITCH_ARM_INT 95 /*manual: Clkswitch ARM */
25#define CLK_SWITCH_DSP_INT 94 /*manual: ClkSwitch DSP */
26#define CLK_SWITCH_AUD_INT 93 /*manual: Clkswitch AUD */
27#define GPI_06_INT 92
28#define GPI_05_INT 91
29#define GPI_04_INT 90
30#define GPI_03_INT 89
31#define GPI_02_INT 88
32#define GPI_01_INT 87
33#define GPI_00_INT 86
34#define BT_CLKREQ_INT 85
35#define SPI1_DATIN_INT 84
36#define U5_RX_INT 83
37#define SDIO_INT_N 82
38#define CAM_HS_INT 81
39#define CAM_VS_INT 80
40#define GPI_07_INT 79
41#define DISP_SYNC_INT 78
42#define DSP_INT8 77
43#define U7_HCTS_INT 76
44#define GPI_10_INT 75
45#define GPI_09_INT 74
46#define GPI_08_INT 73
47#define DSP_INT7 72
48#define U2_HCTS_INT 71
49#define SPI2_DATIN_INT 70
50#define GPIO_05_INT 69
51#define GPIO_04_INT 68
52#define GPIO_03_INT 67
53#define GPIO_02_INT 66
54#define GPIO_01_INT 65
55#define GPIO_00_INT 64
56
57/*Manual: table 258, page 198*/
58
59/*SUB1 Interrupt Routing (SIC1)*/
60
61#define SIC1_BASE_INT 32
62
63#define USB_I2C_INT 63
64#define USB_DEV_HP_INT 62
65#define USB_DEV_LP_INT 61
66#define USB_DEV_DMA_INT 60
67#define USB_HOST_INT 59
68#define USB_OTG_ATX_INT_N 58
69#define USB_OTG_TIMER_INT 57
70#define SW_INT 56
71#define SPI1_INT 55
72#define KEY_IRQ 54
73#define DSP_M_INT 53
74#define RTC_INT 52
75#define I2C_1_INT 51
76#define I2C_2_INT 50
77#define PLL1_LOCK_INT 49
78#define PLL2_LOCK_INT 48
79#define PLL3_LOCK_INT 47
80#define PLL4_LOCK_INT 46
81#define PLL5_LOCK_INT 45
82#define SPI2_INT 44
83#define DSP_INT1 43
84#define DSP_INT2 42
85#define DSP_TDM_INT2 41
86#define TS_AUX_INT 40
87#define TS_IRQ 39
88#define TS_P_INT 38
89#define UOUT1_TO_PAD_INT 37
90#define GPI_11_INT 36
91#define DSP_INT4 35
92#define JTAG_COMM_RX_INT 34
93#define JTAG_COMM_TX_INT 33
94#define DSP_INT3 32
95
96/*Manual: table 257, page 197*/
97
98/*MAIN Interrupt Routing*/
99
100#define MAIN_BASE_INT 0
101
102#define SUB2_FIQ_N 31 /*active low */
103#define SUB1_FIQ_N 30 /*active low */
104#define JPEG_INT 29
105#define DMA_INT 28
106#define MSTIMER_INT 27
107#define IIR1_INT 26
108#define IIR2_INT 25
109#define IIR7_INT 24
110#define DSP_TDM_INT0 23
111#define DSP_TDM_INT1 22
112#define DSP_P_INT 21
113#define DSP_INT0 20
114#define DUM_INT 19
115#define UOUT0_TO_PAD_INT 18
116#define MP4_ENC_INT 17
117#define MP4_DEC_INT 16
118#define SD0_INT 15
119#define MBX_INT 14
120#define SD1_INT 13
121#define MS_INT_N 12
122#define FLASH_INT 11 /*NAND*/
123#define IIR6_INT 10
124#define IIR5_INT 9
125#define IIR4_INT 8
126#define IIR3_INT 7
127#define WATCH_INT 6
128#define HSTIMER_INT 5
129#define ARCH_TIMER_IRQ HSTIMER_INT
130#define CAM_INT 4
131#define PRNG_INT 3
132#define CRYPTO_INT 2
133#define SUB2_IRQ_N 1 /*active low */
134#define SUB1_IRQ_N 0 /*active low */
135
136#define PNX4008_IRQ_TYPES \
137{ /*IRQ #'s: */ \
138IRQT_LOW, IRQT_LOW, IRQT_LOW, IRQT_HIGH, /* 0, 1, 2, 3 */ \
139IRQT_LOW, IRQT_HIGH, IRQT_HIGH, IRQT_HIGH, /* 4, 5, 6, 7 */ \
140IRQT_HIGH, IRQT_HIGH, IRQT_HIGH, IRQT_HIGH, /* 8, 9,10,11 */ \
141IRQT_LOW, IRQT_HIGH, IRQT_HIGH, IRQT_HIGH, /* 12,13,14,15 */ \
142IRQT_HIGH, IRQT_HIGH, IRQT_HIGH, IRQT_HIGH, /* 16,17,18,19 */ \
143IRQT_HIGH, IRQT_HIGH, IRQT_HIGH, IRQT_HIGH, /* 20,21,22,23 */ \
144IRQT_HIGH, IRQT_HIGH, IRQT_HIGH, IRQT_HIGH, /* 24,25,26,27 */ \
145IRQT_HIGH, IRQT_HIGH, IRQT_LOW, IRQT_LOW, /* 28,29,30,31 */ \
146IRQT_HIGH, IRQT_LOW, IRQT_HIGH, IRQT_HIGH, /* 32,33,34,35 */ \
147IRQT_HIGH, IRQT_HIGH, IRQT_FALLING, IRQT_HIGH, /* 36,37,38,39 */ \
148IRQT_HIGH, IRQT_HIGH, IRQT_HIGH, IRQT_HIGH, /* 40,41,42,43 */ \
149IRQT_HIGH, IRQT_HIGH, IRQT_HIGH, IRQT_HIGH, /* 44,45,46,47 */ \
150IRQT_HIGH, IRQT_HIGH, IRQT_LOW, IRQT_LOW, /* 48,49,50,51 */ \
151IRQT_HIGH, IRQT_HIGH, IRQT_HIGH, IRQT_HIGH, /* 52,53,54,55 */ \
152IRQT_HIGH, IRQT_HIGH, IRQT_LOW, IRQT_HIGH, /* 56,57,58,59 */ \
153IRQT_HIGH, IRQT_HIGH, IRQT_HIGH, IRQT_HIGH, /* 60,61,62,63 */ \
154IRQT_HIGH, IRQT_HIGH, IRQT_HIGH, IRQT_HIGH, /* 64,65,66,67 */ \
155IRQT_HIGH, IRQT_HIGH, IRQT_HIGH, IRQT_HIGH, /* 68,69,70,71 */ \
156IRQT_HIGH, IRQT_HIGH, IRQT_HIGH, IRQT_HIGH, /* 72,73,74,75 */ \
157IRQT_HIGH, IRQT_HIGH, IRQT_HIGH, IRQT_HIGH, /* 76,77,78,79 */ \
158IRQT_HIGH, IRQT_HIGH, IRQT_HIGH, IRQT_HIGH, /* 80,81,82,83 */ \
159IRQT_HIGH, IRQT_HIGH, IRQT_HIGH, IRQT_HIGH, /* 84,85,86,87 */ \
160IRQT_HIGH, IRQT_HIGH, IRQT_HIGH, IRQT_HIGH, /* 88,89,90,91 */ \
161IRQT_HIGH, IRQT_HIGH, IRQT_HIGH, IRQT_HIGH, /* 92,93,94,95 */ \
162}
163
164/* Start Enable Pin Interrupts - table 58 page 66 */
165
166#define SE_PIN_BASE_INT 32
167
168#define SE_U7_RX_INT 63
169#define SE_U7_HCTS_INT 62
170#define SE_BT_CLKREQ_INT 61
171#define SE_U6_IRRX_INT 60
172/*59 unused*/
173#define SE_U5_RX_INT 58
174#define SE_GPI_11_INT 57
175#define SE_U3_RX_INT 56
176#define SE_U2_HCTS_INT 55
177#define SE_U2_RX_INT 54
178#define SE_U1_RX_INT 53
179#define SE_DISP_SYNC_INT 52
180/*51 unused*/
181#define SE_SDIO_INT_N 50
182#define SE_MSDIO_START_INT 49
183#define SE_GPI_06_INT 48
184#define SE_GPI_05_INT 47
185#define SE_GPI_04_INT 46
186#define SE_GPI_03_INT 45
187#define SE_GPI_02_INT 44
188#define SE_GPI_01_INT 43
189#define SE_GPI_00_INT 42
190#define SE_SYSCLKEN_PIN_INT 41
191#define SE_SPI1_DATAIN_INT 40
192#define SE_GPI_07_INT 39
193#define SE_SPI2_DATAIN_INT 38
194#define SE_GPI_10_INT 37
195#define SE_GPI_09_INT 36
196#define SE_GPI_08_INT 35
197/*34-32 unused*/
198
199/* Start Enable Internal Interrupts - table 57 page 65 */
200
201#define SE_INT_BASE_INT 0
202
203#define SE_TS_IRQ 31
204#define SE_TS_P_INT 30
205#define SE_TS_AUX_INT 29
206/*27-28 unused*/
207#define SE_USB_AHB_NEED_CLK_INT 26
208#define SE_MSTIMER_INT 25
209#define SE_RTC_INT 24
210#define SE_USB_NEED_CLK_INT 23
211#define SE_USB_INT 22
212#define SE_USB_I2C_INT 21
213#define SE_USB_OTG_TIMER_INT 20
214
215#endif /* __PNX4008_IRQS_h__ */
diff --git a/include/asm-arm/arch-pnx4008/memory.h b/include/asm-arm/arch-pnx4008/memory.h
new file mode 100644
index 000000000000..0d8268a95261
--- /dev/null
+++ b/include/asm-arm/arch-pnx4008/memory.h
@@ -0,0 +1,24 @@
1/*
2 * linux/include/asm-arm/arch-pnx4008/memory.h
3 *
4 * Copyright (c) 2005 Philips Semiconductors
5 * Copyright (c) 2005 MontaVista Software, Inc.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12
13#ifndef __ASM_ARCH_MEMORY_H
14#define __ASM_ARCH_MEMORY_H
15
16/*
17 * Physical DRAM offset.
18 */
19#define PHYS_OFFSET (0x80000000)
20
21#define __virt_to_bus(x) ((x) - PAGE_OFFSET + PHYS_OFFSET)
22#define __bus_to_virt(x) ((x) + PAGE_OFFSET - PHYS_OFFSET)
23
24#endif
diff --git a/include/asm-arm/arch-pnx4008/param.h b/include/asm-arm/arch-pnx4008/param.h
new file mode 100644
index 000000000000..95d5f547b416
--- /dev/null
+++ b/include/asm-arm/arch-pnx4008/param.h
@@ -0,0 +1,21 @@
1/*
2 * linux/include/asm-arm/arch-pnx4008/param.h
3 *
4 * Copyright (C) 1999 ARM Limited
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#define HZ 100
diff --git a/include/asm-arm/arch-pnx4008/platform.h b/include/asm-arm/arch-pnx4008/platform.h
new file mode 100644
index 000000000000..485a3651b4d7
--- /dev/null
+++ b/include/asm-arm/arch-pnx4008/platform.h
@@ -0,0 +1,69 @@
1/*
2 * include/asm-arm/arch-pnx4008/platfrom.h
3 *
4 * PNX4008 Base addresses - header file
5 *
6 * Author: Dmitry Chigirev <source@mvista.com>
7 *
8 * Based on reference code received from Philips:
9 * Copyright (C) 2003 Philips Semiconductors
10 *
11 * 2005 (c) MontaVista Software, Inc. This file is licensed under
12 * the terms of the GNU General Public License version 2. This program
13 * is licensed "as is" without any warranty of any kind, whether express
14 * or implied.
15 */
16
17
18#ifndef __ASM_ARCH_PLATFORM_H__
19#define __ASM_ARCH_PLATFORM_H__
20
21#define PNX4008_IRAM_BASE 0x08000000
22#define PNX4008_IRAM_SIZE 0x00010000
23#define PNX4008_YUV_SLAVE_BASE 0x10000000
24#define PNX4008_DUM_SLAVE_BASE 0x18000000
25#define PNX4008_NDF_FLASH_BASE 0x20020000
26#define PNX4008_SPI1_BASE 0x20088000
27#define PNX4008_SPI2_BASE 0x20090000
28#define PNX4008_SD_CONFIG_BASE 0x20098000
29#define PNX4008_FLASH_DATA 0x200B0000
30#define PNX4008_MLC_FLASH_BASE 0x200B8000
31#define PNX4008_JPEG_CONFIG_BASE 0x300A0000
32#define PNX4008_DMA_CONFIG_BASE 0x31000000
33#define PNX4008_USB_CONFIG_BASE 0x31020000
34#define PNX4008_SDRAM_CFG_BASE 0x31080000
35#define PNX4008_AHB2FAB_BASE 0x40000000
36#define PNX4008_PWRMAN_BASE 0x40004000
37#define PNX4008_INTCTRLMIC_BASE 0x40008000
38#define PNX4008_INTCTRLSIC1_BASE 0x4000C000
39#define PNX4008_INTCTRLSIC2_BASE 0x40010000
40#define PNX4008_HSUART1_BASE 0x40014000
41#define PNX4008_HSUART2_BASE 0x40018000
42#define PNX4008_HSUART7_BASE 0x4001C000
43#define PNX4008_RTC_BASE 0x40024000
44#define PNX4008_PIO_BASE 0x40028000
45#define PNX4008_MSTIMER_BASE 0x40034000
46#define PNX4008_HSTIMER_BASE 0x40038000
47#define PNX4008_WDOG_BASE 0x4003C000
48#define PNX4008_DEBUG_BASE 0x40040000
49#define PNX4008_TOUCH1_BASE 0x40048000
50#define PNX4008_KEYSCAN_BASE 0x40050000
51#define PNX4008_UARTCTRL_BASE 0x40054000
52#define PNX4008_PWM_BASE 0x4005C000
53#define PNX4008_UART3_BASE 0x40080000
54#define PNX4008_UART4_BASE 0x40088000
55#define PNX4008_UART5_BASE 0x40090000
56#define PNX4008_UART6_BASE 0x40098000
57#define PNX4008_I2C1_BASE 0x400A0000
58#define PNX4008_I2C2_BASE 0x400A8000
59#define PNX4008_MAGICGATE_BASE 0x400B0000
60#define PNX4008_DUMCONF_BASE 0x400B8000
61#define PNX4008_DUM_MAINCFG_BASE 0x400BC000
62#define PNX4008_DSP_BASE 0x400C0000
63#define PNX4008_PROFCOUNTER_BASE 0x400C8000
64#define PNX4008_CRYPTO_BASE 0x400D0000
65#define PNX4008_CAMIFCONF_BASE 0x400D8000
66#define PNX4008_YUV2RGB_BASE 0x400E0000
67#define PNX4008_AUDIOCONFIG_BASE 0x400E8000
68
69#endif
diff --git a/include/asm-arm/arch-pnx4008/pm.h b/include/asm-arm/arch-pnx4008/pm.h
new file mode 100644
index 000000000000..c660486670fb
--- /dev/null
+++ b/include/asm-arm/arch-pnx4008/pm.h
@@ -0,0 +1,62 @@
1/*
2 * include/asm-arm/arch-pnx4008/pm.h
3 *
4 * PNX4008 Power Management Routiness - header file
5 *
6 * Authors: Vitaly Wool, Dmitry Chigirev <source@mvista.com>
7 *
8 * 2005 (c) MontaVista Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 */
13
14#ifndef __ASM_ARCH_PNX4008_PM_H
15#define __ASM_ARCH_PNX4008_PM_H
16
17#ifndef __ASSEMBLER__
18#include "irq.h"
19#include "irqs.h"
20#include "clock.h"
21
22extern void pnx4008_pm_idle(void);
23extern void pnx4008_pm_suspend(void);
24extern unsigned int pnx4008_cpu_suspend_sz;
25extern void pnx4008_cpu_suspend(void);
26extern unsigned int pnx4008_cpu_standby_sz;
27extern void pnx4008_cpu_standby(void);
28
29extern int pnx4008_startup_pll(struct clk *);
30extern int pnx4008_shutdown_pll(struct clk *);
31
32static inline void start_int_umask(u8 irq)
33{
34 __raw_writel(__raw_readl(START_INT_ER_REG(irq)) |
35 START_INT_REG_BIT(irq), START_INT_ER_REG(irq));
36}
37
38static inline void start_int_mask(u8 irq)
39{
40 __raw_writel(__raw_readl(START_INT_ER_REG(irq)) &
41 ~START_INT_REG_BIT(irq), START_INT_ER_REG(irq));
42}
43
44static inline void start_int_ack(u8 irq)
45{
46 __raw_writel(START_INT_REG_BIT(irq), START_INT_RSR_REG(irq));
47}
48
49static inline void start_int_set_falling_edge(u8 irq)
50{
51 __raw_writel(__raw_readl(START_INT_APR_REG(irq)) &
52 ~START_INT_REG_BIT(irq), START_INT_APR_REG(irq));
53}
54
55static inline void start_int_set_rising_edge(u8 irq)
56{
57 __raw_writel(__raw_readl(START_INT_APR_REG(irq)) |
58 START_INT_REG_BIT(irq), START_INT_APR_REG(irq));
59}
60
61#endif /* ASSEMBLER */
62#endif /* __ASM_ARCH_PNX4008_PM_H */
diff --git a/include/asm-arm/arch-pnx4008/system.h b/include/asm-arm/arch-pnx4008/system.h
new file mode 100644
index 000000000000..6e3da70ab107
--- /dev/null
+++ b/include/asm-arm/arch-pnx4008/system.h
@@ -0,0 +1,38 @@
1/*
2 * linux/include/asm-arm/arch-pnx4008/system.h
3 *
4 * Copyright (C) 2003 Philips Semiconductors
5 * Copyright (C) 2005 MontaVista Software, Inc.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21#ifndef __ASM_ARCH_SYSTEM_H
22#define __ASM_ARCH_SYSTEM_H
23
24#include <asm/hardware.h>
25#include <asm/io.h>
26#include <asm/arch/platform.h>
27
28static void arch_idle(void)
29{
30 cpu_do_idle();
31}
32
33static inline void arch_reset(char mode)
34{
35 cpu_reset(0);
36}
37
38#endif
diff --git a/include/asm-arm/arch-pnx4008/timex.h b/include/asm-arm/arch-pnx4008/timex.h
new file mode 100644
index 000000000000..ee470a39089a
--- /dev/null
+++ b/include/asm-arm/arch-pnx4008/timex.h
@@ -0,0 +1,73 @@
1/*
2 * include/asm-arm/arch-pnx4008/timex.h
3 *
4 * PNX4008 timers header file
5 *
6 * Author: Dmitry Chigirev <source@mvista.com>
7 *
8 * 2005 (c) MontaVista Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 */
13
14#ifndef __PNX4008_TIMEX_H
15#define __PNX4008_TIMEX_H
16
17#include <asm/hardware.h>
18#include <asm/io.h>
19
20#define CLOCK_TICK_RATE 1000000
21
22#define TICKS2USECS(x) (x)
23
24/* MilliSecond Timer - Chapter 21 Page 202 */
25
26#define MSTIM_INT IO_ADDRESS((PNX4008_MSTIMER_BASE + 0x0))
27#define MSTIM_CTRL IO_ADDRESS((PNX4008_MSTIMER_BASE + 0x4))
28#define MSTIM_COUNTER IO_ADDRESS((PNX4008_MSTIMER_BASE + 0x8))
29#define MSTIM_MCTRL IO_ADDRESS((PNX4008_MSTIMER_BASE + 0x14))
30#define MSTIM_MATCH0 IO_ADDRESS((PNX4008_MSTIMER_BASE + 0x18))
31#define MSTIM_MATCH1 IO_ADDRESS((PNX4008_MSTIMER_BASE + 0x1c))
32
33/* High Speed Timer - Chpater 22, Page 205 */
34
35#define HSTIM_INT IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x0))
36#define HSTIM_CTRL IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x4))
37#define HSTIM_COUNTER IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x8))
38#define HSTIM_PMATCH IO_ADDRESS((PNX4008_HSTIMER_BASE + 0xC))
39#define HSTIM_PCOUNT IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x10))
40#define HSTIM_MCTRL IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x14))
41#define HSTIM_MATCH0 IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x18))
42#define HSTIM_MATCH1 IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x1c))
43#define HSTIM_MATCH2 IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x20))
44#define HSTIM_CCR IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x28))
45#define HSTIM_CR0 IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x2C))
46#define HSTIM_CR1 IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x30))
47
48/* IMPORTANT: both timers are UPCOUNTING */
49
50/* xSTIM_MCTRL bit definitions */
51#define MR0_INT 1
52#define RESET_COUNT0 (1<<1)
53#define STOP_COUNT0 (1<<2)
54#define MR1_INT (1<<3)
55#define RESET_COUNT1 (1<<4)
56#define STOP_COUNT1 (1<<5)
57#define MR2_INT (1<<6)
58#define RESET_COUNT2 (1<<7)
59#define STOP_COUNT2 (1<<8)
60
61/* xSTIM_CTRL bit definitions */
62#define COUNT_ENAB 1
63#define RESET_COUNT (1<<1)
64#define DEBUG_EN (1<<2)
65
66/* xSTIM_INT bit definitions */
67#define MATCH0_INT 1
68#define MATCH1_INT (1<<1)
69#define MATCH2_INT (1<<2)
70#define RTC_TICK0 (1<<4)
71#define RTC_TICK1 (1<<5)
72
73#endif
diff --git a/include/asm-arm/arch-pnx4008/uncompress.h b/include/asm-arm/arch-pnx4008/uncompress.h
new file mode 100644
index 000000000000..8fa4d24b72b4
--- /dev/null
+++ b/include/asm-arm/arch-pnx4008/uncompress.h
@@ -0,0 +1,46 @@
1/*
2 * linux/include/asm-arm/arch-pnx4008/uncompress.h
3 *
4 * Copyright (C) 1999 ARM Limited
5 * Copyright (C) 2006 MontaVista Software, Inc.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#define UART5_BASE 0x40090000
23
24#define UART5_DR (*(volatile unsigned char *) (UART5_BASE))
25#define UART5_FR (*(volatile unsigned char *) (UART5_BASE + 18))
26
27static __inline__ void putc(char c)
28{
29 while (UART5_FR & (1 << 5))
30 barrier();
31
32 UART5_DR = c;
33}
34
35/*
36 * This does not append a newline
37 */
38static inline void flush(void)
39{
40}
41
42/*
43 * nothing to do
44 */
45#define arch_decomp_setup()
46#define arch_decomp_wdog()
diff --git a/include/asm-arm/arch-pnx4008/vmalloc.h b/include/asm-arm/arch-pnx4008/vmalloc.h
new file mode 100644
index 000000000000..140d925f6f37
--- /dev/null
+++ b/include/asm-arm/arch-pnx4008/vmalloc.h
@@ -0,0 +1,20 @@
1/*
2 * include/asm-arm/arch-pnx4008/vmalloc.h
3 *
4 * Author: Vitaly Wool <source@mvista.com>
5 *
6 * 2006 (c) MontaVista Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10 */
11
12/*
13 * Just any arbitrary offset to the start of the vmalloc VM area: the
14 * current 8MB value just means that there will be a 8MB "hole" after the
15 * physical memory until the kernel virtual memory starts. That means that
16 * any out-of-bounds memory accesses will hopefully be caught.
17 * The vmalloc() routines leaves a hole of 4kB between each vmalloced
18 * area for the same reason. ;)
19 */
20#define VMALLOC_END (PAGE_OFFSET + 0x10000000)
diff --git a/include/asm-arm/arch-pxa/ohci.h b/include/asm-arm/arch-pxa/ohci.h
index 7da89569061e..e848a47128cd 100644
--- a/include/asm-arm/arch-pxa/ohci.h
+++ b/include/asm-arm/arch-pxa/ohci.h
@@ -11,6 +11,8 @@ struct pxaohci_platform_data {
11#define PMM_NPS_MODE 1 11#define PMM_NPS_MODE 1
12#define PMM_GLOBAL_MODE 2 12#define PMM_GLOBAL_MODE 2
13#define PMM_PERPORT_MODE 3 13#define PMM_PERPORT_MODE 3
14
15 int power_budget;
14}; 16};
15 17
16extern void pxa_set_ohci_info(struct pxaohci_platform_data *info); 18extern void pxa_set_ohci_info(struct pxaohci_platform_data *info);
diff --git a/include/asm-arm/arch-s3c2410/map.h b/include/asm-arm/arch-s3c2410/map.h
index c380d264a847..5e4c8c37bc66 100644
--- a/include/asm-arm/arch-s3c2410/map.h
+++ b/include/asm-arm/arch-s3c2410/map.h
@@ -126,9 +126,18 @@
126#define S3C24XX_SZ_IIS SZ_1M 126#define S3C24XX_SZ_IIS SZ_1M
127 127
128/* GPIO ports */ 128/* GPIO ports */
129#define S3C24XX_VA_GPIO S3C2410_ADDR(0x00E00000) 129
130/* the calculation for the VA of this must ensure that
131 * it is the same distance apart from the UART in the
132 * phsyical address space, as the initial mapping for the IO
133 * is done as a 1:1 maping. This puts it (currently) at
134 * 0xF6800000, which is not in the way of any current mapping
135 * by the base system.
136*/
137
130#define S3C2400_PA_GPIO (0x15600000) 138#define S3C2400_PA_GPIO (0x15600000)
131#define S3C2410_PA_GPIO (0x56000000) 139#define S3C2410_PA_GPIO (0x56000000)
140#define S3C24XX_VA_GPIO ((S3C2410_PA_GPIO - S3C24XX_PA_UART) + S3C24XX_VA_UART)
132#define S3C24XX_SZ_GPIO SZ_1M 141#define S3C24XX_SZ_GPIO SZ_1M
133 142
134/* RTC */ 143/* RTC */
diff --git a/include/asm-arm/arch-s3c2410/regs-clock.h b/include/asm-arm/arch-s3c2410/regs-clock.h
index 34360706e016..6c92faffe985 100644
--- a/include/asm-arm/arch-s3c2410/regs-clock.h
+++ b/include/asm-arm/arch-s3c2410/regs-clock.h
@@ -114,7 +114,7 @@ s3c2410_get_pll(unsigned int pllval, unsigned int baseclk)
114 114
115#endif /* __ASSEMBLY__ */ 115#endif /* __ASSEMBLY__ */
116 116
117#ifdef CONFIG_CPU_S3C2440 117#if defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2442)
118 118
119/* extra registers */ 119/* extra registers */
120#define S3C2440_CAMDIVN S3C2410_CLKREG(0x18) 120#define S3C2440_CAMDIVN S3C2410_CLKREG(0x18)
@@ -136,7 +136,9 @@ s3c2410_get_pll(unsigned int pllval, unsigned int baseclk)
136#define S3C2440_CAMDIVN_HCLK4_HALF (1<<9) 136#define S3C2440_CAMDIVN_HCLK4_HALF (1<<9)
137#define S3C2440_CAMDIVN_DVSEN (1<<12) 137#define S3C2440_CAMDIVN_DVSEN (1<<12)
138 138
139#endif /* CONFIG_CPU_S3C2440 */ 139#define S3C2442_CAMDIVN_CAMCLK_DIV3 (1<<5)
140
141#endif /* CONFIG_CPU_S3C2440 or CONFIG_CPU_S3C2442 */
140 142
141 143
142#endif /* __ASM_ARM_REGS_CLOCK */ 144#endif /* __ASM_ARM_REGS_CLOCK */
diff --git a/include/asm-arm/arch-s3c2410/regs-gpio.h b/include/asm-arm/arch-s3c2410/regs-gpio.h
index d2574084697f..5f10334f06bf 100644
--- a/include/asm-arm/arch-s3c2410/regs-gpio.h
+++ b/include/asm-arm/arch-s3c2410/regs-gpio.h
@@ -450,12 +450,14 @@
450#define S3C2410_GPD0_OUTP (0x01 << 0) 450#define S3C2410_GPD0_OUTP (0x01 << 0)
451#define S3C2410_GPD0_VD8 (0x02 << 0) 451#define S3C2410_GPD0_VD8 (0x02 << 0)
452#define S3C2400_GPD0_VFRAME (0x02 << 0) 452#define S3C2400_GPD0_VFRAME (0x02 << 0)
453#define S3C2442_GPD0_nSPICS1 (0x03 << 0)
453 454
454#define S3C2410_GPD1 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 1) 455#define S3C2410_GPD1 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 1)
455#define S3C2410_GPD1_INP (0x00 << 2) 456#define S3C2410_GPD1_INP (0x00 << 2)
456#define S3C2410_GPD1_OUTP (0x01 << 2) 457#define S3C2410_GPD1_OUTP (0x01 << 2)
457#define S3C2410_GPD1_VD9 (0x02 << 2) 458#define S3C2410_GPD1_VD9 (0x02 << 2)
458#define S3C2400_GPD1_VM (0x02 << 2) 459#define S3C2400_GPD1_VM (0x02 << 2)
460#define S3C2442_GPD1_SPICLK1 (0x03 << 2)
459 461
460#define S3C2410_GPD2 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 2) 462#define S3C2410_GPD2 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 2)
461#define S3C2410_GPD2_INP (0x00 << 4) 463#define S3C2410_GPD2_INP (0x00 << 4)
@@ -858,6 +860,7 @@
858#define S3C2410_GPG12_OUTP (0x01 << 24) 860#define S3C2410_GPG12_OUTP (0x01 << 24)
859#define S3C2410_GPG12_EINT20 (0x02 << 24) 861#define S3C2410_GPG12_EINT20 (0x02 << 24)
860#define S3C2410_GPG12_XMON (0x03 << 24) 862#define S3C2410_GPG12_XMON (0x03 << 24)
863#define S3C2442_GPG12_nSPICS0 (0x03 << 24)
861 864
862#define S3C2410_GPG13 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 13) 865#define S3C2410_GPG13 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 13)
863#define S3C2410_GPG13_INP (0x00 << 26) 866#define S3C2410_GPG13_INP (0x00 << 26)
@@ -943,6 +946,7 @@
943#define S3C2410_GPH9_INP (0x00 << 18) 946#define S3C2410_GPH9_INP (0x00 << 18)
944#define S3C2410_GPH9_OUTP (0x01 << 18) 947#define S3C2410_GPH9_OUTP (0x01 << 18)
945#define S3C2410_GPH9_CLKOUT0 (0x02 << 18) 948#define S3C2410_GPH9_CLKOUT0 (0x02 << 18)
949#define S3C2442_GPH9_nSPICS0 (0x03 << 18)
946 950
947#define S3C2410_GPH10 S3C2410_GPIONO(S3C2410_GPIO_BANKH, 10) 951#define S3C2410_GPH10 S3C2410_GPIONO(S3C2410_GPIO_BANKH, 10)
948#define S3C2410_GPH10_INP (0x00 << 20) 952#define S3C2410_GPH10_INP (0x00 << 20)
@@ -1051,6 +1055,7 @@
1051#define S3C2410_GSTATUS1_IDMASK (0xffff0000) 1055#define S3C2410_GSTATUS1_IDMASK (0xffff0000)
1052#define S3C2410_GSTATUS1_2410 (0x32410000) 1056#define S3C2410_GSTATUS1_2410 (0x32410000)
1053#define S3C2410_GSTATUS1_2440 (0x32440000) 1057#define S3C2410_GSTATUS1_2440 (0x32440000)
1058#define S3C2410_GSTATUS1_2442 (0x32440aaa)
1054 1059
1055#define S3C2410_GSTATUS2_WTRESET (1<<2) 1060#define S3C2410_GSTATUS2_WTRESET (1<<2)
1056#define S3C2410_GSTATUS2_OFFRESET (1<<1) 1061#define S3C2410_GSTATUS2_OFFRESET (1<<1)
diff --git a/include/asm-arm/arch-s3c2410/uncompress.h b/include/asm-arm/arch-s3c2410/uncompress.h
index 0ecb8103fa70..8e152a05e533 100644
--- a/include/asm-arm/arch-s3c2410/uncompress.h
+++ b/include/asm-arm/arch-s3c2410/uncompress.h
@@ -81,7 +81,8 @@ static void putc(int ch)
81 while (1) { 81 while (1) {
82 level = uart_rd(S3C2410_UFSTAT); 82 level = uart_rd(S3C2410_UFSTAT);
83 83
84 if (cpuid == S3C2410_GSTATUS1_2440) { 84 if (cpuid == S3C2410_GSTATUS1_2440 ||
85 cpuid == S3C2410_GSTATUS1_2442) {
85 level &= S3C2440_UFSTAT_TXMASK; 86 level &= S3C2440_UFSTAT_TXMASK;
86 level >>= S3C2440_UFSTAT_TXSHIFT; 87 level >>= S3C2440_UFSTAT_TXSHIFT;
87 } else { 88 } else {
@@ -129,7 +130,7 @@ static void arch_decomp_wdog_start(void)
129{ 130{
130 __raw_writel(WDOG_COUNT, S3C2410_WTDAT); 131 __raw_writel(WDOG_COUNT, S3C2410_WTDAT);
131 __raw_writel(WDOG_COUNT, S3C2410_WTCNT); 132 __raw_writel(WDOG_COUNT, S3C2410_WTCNT);
132 __raw_writel(S3C2410_WTCON_ENABLE | S3C2410_WTCON_DIV128 | S3C2410_WTCON_RSTEN | S3C2410_WTCON_PRESCALE(0x40), S3C2410_WTCON); 133 __raw_writel(S3C2410_WTCON_ENABLE | S3C2410_WTCON_DIV128 | S3C2410_WTCON_RSTEN | S3C2410_WTCON_PRESCALE(0x80), S3C2410_WTCON);
133} 134}
134 135
135#else 136#else
diff --git a/include/asm-arm/mach/time.h b/include/asm-arm/mach/time.h
index 96c6db7dd0e1..9f28073559e8 100644
--- a/include/asm-arm/mach/time.h
+++ b/include/asm-arm/mach/time.h
@@ -50,6 +50,7 @@ struct sys_timer {
50#define DYN_TICK_ENABLED (1 << 1) 50#define DYN_TICK_ENABLED (1 << 1)
51 51
52struct dyn_tick_timer { 52struct dyn_tick_timer {
53 spinlock_t lock;
53 unsigned int state; /* Current state */ 54 unsigned int state; /* Current state */
54 int (*enable)(void); /* Enables dynamic tick */ 55 int (*enable)(void); /* Enables dynamic tick */
55 int (*disable)(void); /* Disables dynamic tick */ 56 int (*disable)(void); /* Disables dynamic tick */
diff --git a/include/asm-arm/system.h b/include/asm-arm/system.h
index f5eafd7ed8fa..9c744ae6c6e3 100644
--- a/include/asm-arm/system.h
+++ b/include/asm-arm/system.h
@@ -126,6 +126,12 @@ static inline int cpu_is_xsc3(void)
126} 126}
127#endif 127#endif
128 128
129#if !defined(CONFIG_CPU_XSCALE) && !defined(CONFIG_CPU_XSC3)
130#define cpu_is_xscale() 0
131#else
132#define cpu_is_xscale() 1
133#endif
134
129#define set_cr(x) \ 135#define set_cr(x) \
130 __asm__ __volatile__( \ 136 __asm__ __volatile__( \
131 "mcr p15, 0, %0, c1, c0, 0 @ set CR" \ 137 "mcr p15, 0, %0, c1, c0, 0 @ set CR" \
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index 358e4d309ceb..c2059a3a0621 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -159,17 +159,8 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addres
159#define lazy_mmu_prot_update(pte) do { } while (0) 159#define lazy_mmu_prot_update(pte) do { } while (0)
160#endif 160#endif
161 161
162#ifndef __HAVE_ARCH_MULTIPLE_ZERO_PAGE 162#ifndef __HAVE_ARCH_MOVE_PTE
163#define move_pte(pte, prot, old_addr, new_addr) (pte) 163#define move_pte(pte, prot, old_addr, new_addr) (pte)
164#else
165#define move_pte(pte, prot, old_addr, new_addr) \
166({ \
167 pte_t newpte = (pte); \
168 if (pte_present(pte) && pfn_valid(pte_pfn(pte)) && \
169 pte_page(pte) == ZERO_PAGE(old_addr)) \
170 newpte = mk_pte(ZERO_PAGE(new_addr), (prot)); \
171 newpte; \
172})
173#endif 164#endif
174 165
175/* 166/*
diff --git a/include/asm-mips/addrspace.h b/include/asm-mips/addrspace.h
index a7d0d26e93c9..45c706e34df1 100644
--- a/include/asm-mips/addrspace.h
+++ b/include/asm-mips/addrspace.h
@@ -128,60 +128,26 @@
128#if defined (CONFIG_CPU_R4300) \ 128#if defined (CONFIG_CPU_R4300) \
129 || defined (CONFIG_CPU_R4X00) \ 129 || defined (CONFIG_CPU_R4X00) \
130 || defined (CONFIG_CPU_R5000) \ 130 || defined (CONFIG_CPU_R5000) \
131 || defined (CONFIG_CPU_RM7000) \
131 || defined (CONFIG_CPU_NEVADA) \ 132 || defined (CONFIG_CPU_NEVADA) \
132 || defined (CONFIG_CPU_TX49XX) \ 133 || defined (CONFIG_CPU_TX49XX) \
133 || defined (CONFIG_CPU_MIPS64) 134 || defined (CONFIG_CPU_MIPS64)
134#define KUSIZE _LLCONST_(0x0000010000000000) /* 2^^40 */
135#define KUSIZE_64 _LLCONST_(0x0000010000000000) /* 2^^40 */
136#define K0SIZE _LLCONST_(0x0000001000000000) /* 2^^36 */
137#define K1SIZE _LLCONST_(0x0000001000000000) /* 2^^36 */
138#define K2SIZE _LLCONST_(0x000000ff80000000)
139#define KSEGSIZE _LLCONST_(0x000000ff80000000) /* max syssegsz */
140#define TO_PHYS_MASK _LLCONST_(0x0000000fffffffff) /* 2^^36 - 1 */ 135#define TO_PHYS_MASK _LLCONST_(0x0000000fffffffff) /* 2^^36 - 1 */
141#endif 136#endif
142 137
143#if defined (CONFIG_CPU_R8000) 138#if defined (CONFIG_CPU_R8000)
144/* We keep KUSIZE consistent with R4000 for now (2^^40) instead of (2^^48) */ 139/* We keep KUSIZE consistent with R4000 for now (2^^40) instead of (2^^48) */
145#define KUSIZE _LLCONST_(0x0000010000000000) /* 2^^40 */
146#define KUSIZE_64 _LLCONST_(0x0000010000000000) /* 2^^40 */
147#define K0SIZE _LLCONST_(0x0000010000000000) /* 2^^40 */
148#define K1SIZE _LLCONST_(0x0000010000000000) /* 2^^40 */
149#define K2SIZE _LLCONST_(0x0001000000000000)
150#define KSEGSIZE _LLCONST_(0x0000010000000000) /* max syssegsz */
151#define TO_PHYS_MASK _LLCONST_(0x000000ffffffffff) /* 2^^40 - 1 */ 140#define TO_PHYS_MASK _LLCONST_(0x000000ffffffffff) /* 2^^40 - 1 */
152#endif 141#endif
153 142
154#if defined (CONFIG_CPU_R10000) 143#if defined (CONFIG_CPU_R10000)
155#define KUSIZE _LLCONST_(0x0000010000000000) /* 2^^40 */
156#define KUSIZE_64 _LLCONST_(0x0000010000000000) /* 2^^40 */
157#define K0SIZE _LLCONST_(0x0000010000000000) /* 2^^40 */
158#define K1SIZE _LLCONST_(0x0000010000000000) /* 2^^40 */
159#define K2SIZE _LLCONST_(0x00000fff80000000)
160#define KSEGSIZE _LLCONST_(0x00000fff80000000) /* max syssegsz */
161#define TO_PHYS_MASK _LLCONST_(0x000000ffffffffff) /* 2^^40 - 1 */ 144#define TO_PHYS_MASK _LLCONST_(0x000000ffffffffff) /* 2^^40 - 1 */
162#endif 145#endif
163 146
164#if defined(CONFIG_CPU_SB1) || defined(CONFIG_CPU_SB1A) 147#if defined(CONFIG_CPU_SB1) || defined(CONFIG_CPU_SB1A)
165#define KUSIZE _LLCONST_(0x0000100000000000) /* 2^^44 */
166#define KUSIZE_64 _LLCONST_(0x0000100000000000) /* 2^^44 */
167#define K0SIZE _LLCONST_(0x0000100000000000) /* 2^^44 */
168#define K1SIZE _LLCONST_(0x0000100000000000) /* 2^^44 */
169#define K2SIZE _LLCONST_(0x0000ffff80000000)
170#define KSEGSIZE _LLCONST_(0x0000ffff80000000) /* max syssegsz */
171#define TO_PHYS_MASK _LLCONST_(0x00000fffffffffff) /* 2^^44 - 1 */ 148#define TO_PHYS_MASK _LLCONST_(0x00000fffffffffff) /* 2^^44 - 1 */
172#endif 149#endif
173 150
174/*
175 * Further names for SGI source compatibility. These are stolen from
176 * IRIX's <sys/mips_addrspace.h>.
177 */
178#define KUBASE _LLCONST_(0)
179#define KUSIZE_32 _LLCONST_(0x0000000080000000) /* KUSIZE
180 for a 32 bit proc */
181#define K0BASE_EXL_WR _LLCONST_(0xa800000000000000) /* exclusive on write */
182#define K0BASE_NONCOH _LLCONST_(0x9800000000000000) /* noncoherent */
183#define K0BASE_EXL _LLCONST_(0xa000000000000000) /* exclusive */
184
185#ifndef CONFIG_CPU_R8000 151#ifndef CONFIG_CPU_R8000
186 152
187/* 153/*
diff --git a/include/asm-mips/apm.h b/include/asm-mips/apm.h
new file mode 100644
index 000000000000..e8c69208f63a
--- /dev/null
+++ b/include/asm-mips/apm.h
@@ -0,0 +1,65 @@
1/* -*- linux-c -*-
2 *
3 * (C) 2003 zecke@handhelds.org
4 *
5 * GPL version 2
6 *
7 * based on arch/arm/kernel/apm.c
8 * factor out the information needed by architectures to provide
9 * apm status
10 *
11 *
12 */
13#ifndef MIPS_ASM_SA1100_APM_H
14#define MIPS_ASM_SA1100_APM_H
15
16#include <linux/config.h>
17#include <linux/apm_bios.h>
18
19/*
20 * This structure gets filled in by the machine specific 'get_power_status'
21 * implementation. Any fields which are not set default to a safe value.
22 */
23struct apm_power_info {
24 unsigned char ac_line_status;
25#define APM_AC_OFFLINE 0
26#define APM_AC_ONLINE 1
27#define APM_AC_BACKUP 2
28#define APM_AC_UNKNOWN 0xff
29
30 unsigned char battery_status;
31#define APM_BATTERY_STATUS_HIGH 0
32#define APM_BATTERY_STATUS_LOW 1
33#define APM_BATTERY_STATUS_CRITICAL 2
34#define APM_BATTERY_STATUS_CHARGING 3
35#define APM_BATTERY_STATUS_NOT_PRESENT 4
36#define APM_BATTERY_STATUS_UNKNOWN 0xff
37
38 unsigned char battery_flag;
39#define APM_BATTERY_FLAG_HIGH (1 << 0)
40#define APM_BATTERY_FLAG_LOW (1 << 1)
41#define APM_BATTERY_FLAG_CRITICAL (1 << 2)
42#define APM_BATTERY_FLAG_CHARGING (1 << 3)
43#define APM_BATTERY_FLAG_NOT_PRESENT (1 << 7)
44#define APM_BATTERY_FLAG_UNKNOWN 0xff
45
46 int battery_life;
47 int time;
48 int units;
49#define APM_UNITS_MINS 0
50#define APM_UNITS_SECS 1
51#define APM_UNITS_UNKNOWN -1
52
53};
54
55/*
56 * This allows machines to provide their own "apm get power status" function.
57 */
58extern void (*apm_get_power_status)(struct apm_power_info *);
59
60/*
61 * Queue an event (APM_SYS_SUSPEND or APM_CRITICAL_SUSPEND)
62 */
63void apm_queue_event(apm_event_t event);
64
65#endif
diff --git a/include/asm-mips/asmmacro-32.h b/include/asm-mips/asmmacro-32.h
index 11daf5ceb7b4..5de3963f511e 100644
--- a/include/asm-mips/asmmacro-32.h
+++ b/include/asm-mips/asmmacro-32.h
@@ -12,7 +12,7 @@
12#include <asm/fpregdef.h> 12#include <asm/fpregdef.h>
13#include <asm/mipsregs.h> 13#include <asm/mipsregs.h>
14 14
15 .macro fpu_save_double thread status tmp1=t0 tmp2 15 .macro fpu_save_double thread status tmp1=t0
16 cfc1 \tmp1, fcr31 16 cfc1 \tmp1, fcr31
17 sdc1 $f0, THREAD_FPR0(\thread) 17 sdc1 $f0, THREAD_FPR0(\thread)
18 sdc1 $f2, THREAD_FPR2(\thread) 18 sdc1 $f2, THREAD_FPR2(\thread)
@@ -70,7 +70,7 @@
70 sw \tmp, THREAD_FCR31(\thread) 70 sw \tmp, THREAD_FCR31(\thread)
71 .endm 71 .endm
72 72
73 .macro fpu_restore_double thread tmp=t0 73 .macro fpu_restore_double thread status tmp=t0
74 lw \tmp, THREAD_FCR31(\thread) 74 lw \tmp, THREAD_FCR31(\thread)
75 ldc1 $f0, THREAD_FPR0(\thread) 75 ldc1 $f0, THREAD_FPR0(\thread)
76 ldc1 $f2, THREAD_FPR2(\thread) 76 ldc1 $f2, THREAD_FPR2(\thread)
diff --git a/include/asm-mips/asmmacro-64.h b/include/asm-mips/asmmacro-64.h
index 559c355b9b86..225feefcb25d 100644
--- a/include/asm-mips/asmmacro-64.h
+++ b/include/asm-mips/asmmacro-64.h
@@ -53,12 +53,12 @@
53 sdc1 $f31, THREAD_FPR31(\thread) 53 sdc1 $f31, THREAD_FPR31(\thread)
54 .endm 54 .endm
55 55
56 .macro fpu_save_double thread status tmp1 tmp2 56 .macro fpu_save_double thread status tmp
57 sll \tmp2, \tmp1, 5 57 sll \tmp, \status, 5
58 bgez \tmp2, 2f 58 bgez \tmp, 2f
59 fpu_save_16odd \thread 59 fpu_save_16odd \thread
602: 602:
61 fpu_save_16even \thread \tmp1 # clobbers t1 61 fpu_save_16even \thread \tmp
62 .endm 62 .endm
63 63
64 .macro fpu_restore_16even thread tmp=t0 64 .macro fpu_restore_16even thread tmp=t0
@@ -101,13 +101,12 @@
101 ldc1 $f31, THREAD_FPR31(\thread) 101 ldc1 $f31, THREAD_FPR31(\thread)
102 .endm 102 .endm
103 103
104 .macro fpu_restore_double thread tmp 104 .macro fpu_restore_double thread status tmp
105 mfc0 t0, CP0_STATUS 105 sll \tmp, \status, 5
106 sll t1, t0, 5 106 bgez \tmp, 1f # 16 register mode?
107 bgez t1, 1f # 16 register mode?
108 107
109 fpu_restore_16odd a0 108 fpu_restore_16odd \thread
1101: fpu_restore_16even a0, t0 # clobbers t0 1091: fpu_restore_16even \thread \tmp
111 .endm 110 .endm
112 111
113 .macro cpu_save_nonscratch thread 112 .macro cpu_save_nonscratch thread
diff --git a/include/asm-mips/bootinfo.h b/include/asm-mips/bootinfo.h
index 14fc88f27226..3b745e76f429 100644
--- a/include/asm-mips/bootinfo.h
+++ b/include/asm-mips/bootinfo.h
@@ -217,6 +217,13 @@
217 */ 217 */
218#define MACH_GROUP_TITAN 22 /* PMC-Sierra Titan */ 218#define MACH_GROUP_TITAN 22 /* PMC-Sierra Titan */
219#define MACH_TITAN_YOSEMITE 1 /* PMC-Sierra Yosemite */ 219#define MACH_TITAN_YOSEMITE 1 /* PMC-Sierra Yosemite */
220#define MACH_TITAN_EXCITE 2 /* Basler eXcite */
221
222/*
223 * Valid machtype for group NEC EMMA2RH
224 */
225#define MACH_GROUP_NEC_EMMA2RH 25 /* NEC EMMA2RH (was 23) */
226#define MACH_NEC_MARKEINS 0 /* NEC EMMA2RH Mark-eins */
220 227
221#define CL_SIZE COMMAND_LINE_SIZE 228#define CL_SIZE COMMAND_LINE_SIZE
222 229
@@ -258,4 +265,10 @@ extern char arcs_cmdline[CL_SIZE];
258 * Registers a0, a1, a3 and a4 as passed to the kenrel entry by firmware 265 * Registers a0, a1, a3 and a4 as passed to the kenrel entry by firmware
259 */ 266 */
260extern unsigned long fw_arg0, fw_arg1, fw_arg2, fw_arg3; 267extern unsigned long fw_arg0, fw_arg1, fw_arg2, fw_arg3;
268
269/*
270 * Platform memory detection hook called by setup_arch
271 */
272extern void plat_mem_setup(void);
273
261#endif /* _ASM_BOOTINFO_H */ 274#endif /* _ASM_BOOTINFO_H */
diff --git a/include/asm-mips/cpu.h b/include/asm-mips/cpu.h
index 818b9a97e214..dff2a0a52f8f 100644
--- a/include/asm-mips/cpu.h
+++ b/include/asm-mips/cpu.h
@@ -51,6 +51,7 @@
51#define PRID_IMP_R4300 0x0b00 51#define PRID_IMP_R4300 0x0b00
52#define PRID_IMP_VR41XX 0x0c00 52#define PRID_IMP_VR41XX 0x0c00
53#define PRID_IMP_R12000 0x0e00 53#define PRID_IMP_R12000 0x0e00
54#define PRID_IMP_R14000 0x0f00
54#define PRID_IMP_R8000 0x1000 55#define PRID_IMP_R8000 0x1000
55#define PRID_IMP_PR4450 0x1200 56#define PRID_IMP_PR4450 0x1200
56#define PRID_IMP_R4600 0x2000 57#define PRID_IMP_R4600 0x2000
@@ -87,6 +88,7 @@
87#define PRID_IMP_24K 0x9300 88#define PRID_IMP_24K 0x9300
88#define PRID_IMP_34K 0x9500 89#define PRID_IMP_34K 0x9500
89#define PRID_IMP_24KE 0x9600 90#define PRID_IMP_24KE 0x9600
91#define PRID_IMP_74K 0x9700
90 92
91/* 93/*
92 * These are the PRID's for when 23:16 == PRID_COMP_SIBYTE 94 * These are the PRID's for when 23:16 == PRID_COMP_SIBYTE
@@ -196,7 +198,9 @@
196#define CPU_34K 60 198#define CPU_34K 60
197#define CPU_PR4450 61 199#define CPU_PR4450 61
198#define CPU_SB1A 62 200#define CPU_SB1A 62
199#define CPU_LAST 62 201#define CPU_74K 63
202#define CPU_R14000 64
203#define CPU_LAST 64
200 204
201/* 205/*
202 * ISA Level encodings 206 * ISA Level encodings
diff --git a/include/asm-mips/ddb5074.h b/include/asm-mips/ddb5074.h
deleted file mode 100644
index 0d09ac27f9a5..000000000000
--- a/include/asm-mips/ddb5074.h
+++ /dev/null
@@ -1,11 +0,0 @@
1/*
2 * include/asm-mips/ddb5074.h -- NEC DDB Vrc-5074 definitions
3 *
4 * Copyright (C) 2000 Geert Uytterhoeven <geert@sonycom.com>
5 * Sony Software Development Center Europe (SDCE), Brussels
6 */
7
8extern void ddb5074_led_hex(int hex);
9extern void ddb5074_led_d2(int on);
10extern void ddb5074_led_d3(int on);
11
diff --git a/include/asm-mips/ddb5xxx/ddb5074.h b/include/asm-mips/ddb5xxx/ddb5074.h
deleted file mode 100644
index 58d88306af65..000000000000
--- a/include/asm-mips/ddb5xxx/ddb5074.h
+++ /dev/null
@@ -1,38 +0,0 @@
1/*
2 * include/asm-mips/ddb5074.h -- NEC DDB Vrc-5074 definitions
3 *
4 * Copyright (C) 2000 Geert Uytterhoeven <geert@sonycom.com>
5 * Sony Software Development Center Europe (SDCE), Brussels
6 */
7
8#ifndef _ASM_DDB5XXX_DDB5074_H
9#define _ASM_DDB5XXX_DDB5074_H
10
11#include <asm/nile4.h>
12
13#define DDB_SDRAM_SIZE 0x04000000 /* 64MB */
14
15#define DDB_PCI_IO_BASE 0x06000000
16#define DDB_PCI_IO_SIZE 0x02000000 /* 32 MB */
17
18#define DDB_PCI_MEM_BASE 0x08000000
19#define DDB_PCI_MEM_SIZE 0x08000000 /* 128 MB */
20
21#define DDB_PCI_CONFIG_BASE DDB_PCI_MEM_BASE
22#define DDB_PCI_CONFIG_SIZE DDB_PCI_MEM_SIZE
23
24#define NILE4_PCI_IO_BASE 0xa6000000
25#define NILE4_PCI_MEM_BASE 0xa8000000
26#define NILE4_PCI_CFG_BASE NILE4_PCI_MEM_BASE
27#define DDB_PCI_IACK_BASE NILE4_PCI_IO_BASE
28
29#define NILE4_IRQ_BASE NUM_I8259_INTERRUPTS
30#define CPU_IRQ_BASE (NUM_NILE4_INTERRUPTS + NILE4_IRQ_BASE)
31#define CPU_NILE4_CASCADE 2
32
33extern void ddb5074_led_hex(int hex);
34extern void ddb5074_led_d2(int on);
35extern void ddb5074_led_d3(int on);
36
37extern void nile4_irq_setup(u32 base);
38#endif
diff --git a/include/asm-mips/ddb5xxx/ddb5476.h b/include/asm-mips/ddb5xxx/ddb5476.h
deleted file mode 100644
index 4c23390d9354..000000000000
--- a/include/asm-mips/ddb5xxx/ddb5476.h
+++ /dev/null
@@ -1,157 +0,0 @@
1/*
2 * header file specific for ddb5476
3 *
4 * Copyright (C) 2001 MontaVista Software Inc.
5 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 */
13
14/*
15 * Memory map (physical address)
16 *
17 * Note most of the following address must be properly aligned by the
18 * corresponding size. For example, if PCI_IO_SIZE is 16MB, then
19 * PCI_IO_BASE must be aligned along 16MB boundary.
20 */
21#define DDB_SDRAM_BASE 0x00000000
22#define DDB_SDRAM_SIZE 0x04000000 /* 64MB */
23
24#define DDB_DCS3_BASE 0x04000000 /* flash 1 */
25#define DDB_DCS3_SIZE 0x01000000 /* 16MB */
26
27#define DDB_DCS2_BASE 0x05000000 /* flash 2 */
28#define DDB_DCS2_SIZE 0x01000000 /* 16MB */
29
30#define DDB_PCI_IO_BASE 0x06000000
31#define DDB_PCI_IO_SIZE 0x02000000 /* 32 MB */
32
33#define DDB_PCI_MEM_BASE 0x08000000
34#define DDB_PCI_MEM_SIZE 0x08000000 /* 128 MB */
35
36#define DDB_DCS5_BASE 0x13000000 /* DDB status regs */
37#define DDB_DCS5_SIZE 0x00200000 /* 2MB, 8-bit */
38
39#define DDB_DCS4_BASE 0x14000000 /* DDB control regs */
40#define DDB_DCS4_SIZE 0x00200000 /* 2MB, 8-bit */
41
42#define DDB_INTCS_BASE 0x1fa00000 /* VRC5476 control regs */
43#define DDB_INTCS_SIZE 0x00200000 /* 2MB */
44
45#define DDB_BOOTCS_BASE 0x1fc00000 /* Boot ROM / EPROM /Flash */
46#define DDB_BOOTCS_SIZE 0x00200000 /* 2 MB - doc says 4MB */
47
48
49/* aliases */
50#define DDB_PCI_CONFIG_BASE DDB_PCI_MEM_BASE
51#define DDB_PCI_CONFIG_SIZE DDB_PCI_MEM_SIZE
52
53/* PCI intr ack share PCIW0 with PCI IO */
54#define DDB_PCI_IACK_BASE DDB_PCI_IO_BASE
55
56/*
57 * Interrupt mapping
58 *
59 * We have three interrupt controllers:
60 *
61 * . CPU itself - 8 sources
62 * . i8259 - 16 sources
63 * . vrc5476 - 16 sources
64 *
65 * They connected as follows:
66 * all vrc5476 interrupts are routed to cpu IP2 (by software setting)
67 * all i2869 are routed to INTC in vrc5476 (by hardware connection)
68 *
69 * All VRC5476 PCI interrupts are level-triggered (no ack needed).
70 * All PCI irq but INTC are active low.
71 */
72
73/*
74 * irq number block assignment
75 */
76
77#define NUM_CPU_IRQ 8
78#define NUM_I8259_IRQ 16
79#define NUM_VRC5476_IRQ 16
80
81#define DDB_IRQ_BASE 0
82
83#define I8259_IRQ_BASE DDB_IRQ_BASE
84#define VRC5476_IRQ_BASE (I8259_IRQ_BASE + NUM_I8259_IRQ)
85#define CPU_IRQ_BASE (VRC5476_IRQ_BASE + NUM_VRC5476_IRQ)
86
87/*
88 * vrc5476 irq defs, see page 52-64 of Vrc5074 system controller manual
89 */
90
91#define VRC5476_IRQ_CPCE 0 /* cpu parity error */
92#define VRC5476_IRQ_CNTD 1 /* cpu no target */
93#define VRC5476_IRQ_MCE 2 /* memory check error */
94#define VRC5476_IRQ_DMA 3 /* DMA */
95#define VRC5476_IRQ_UART 4 /* vrc5476 builtin UART, not used */
96#define VRC5476_IRQ_WDOG 5 /* watchdog timer */
97#define VRC5476_IRQ_GPT 6 /* general purpose timer */
98#define VRC5476_IRQ_LBRT 7 /* local bus read timeout */
99#define VRC5476_IRQ_INTA 8 /* PCI INT #A */
100#define VRC5476_IRQ_INTB 9 /* PCI INT #B */
101#define VRC5476_IRQ_INTC 10 /* PCI INT #C */
102#define VRC5476_IRQ_INTD 11 /* PCI INT #D */
103#define VRC5476_IRQ_INTE 12 /* PCI INT #E */
104#define VRC5476_IRQ_RESERVED_13 13 /* reserved */
105#define VRC5476_IRQ_PCIS 14 /* PCI SERR # */
106#define VRC5476_IRQ_PCI 15 /* PCI internal error */
107
108/*
109 * i2859 irq assignment
110 */
111#define I8259_IRQ_RESERVED_0 0
112#define I8259_IRQ_KEYBOARD 1 /* M1543 default */
113#define I8259_IRQ_CASCADE 2
114#define I8259_IRQ_UART_B 3 /* M1543 default, may conflict with RTC according to schematic diagram */
115#define I8259_IRQ_UART_A 4 /* M1543 default */
116#define I8259_IRQ_PARALLEL 5 /* M1543 default */
117#define I8259_IRQ_RESERVED_6 6
118#define I8259_IRQ_RESERVED_7 7
119#define I8259_IRQ_RTC 8 /* who set this? */
120#define I8259_IRQ_USB 9 /* ddb_setup */
121#define I8259_IRQ_PMU 10 /* ddb_setup */
122#define I8259_IRQ_RESERVED_11 11
123#define I8259_IRQ_RESERVED_12 12 /* m1543_irq_setup */
124#define I8259_IRQ_RESERVED_13 13
125#define I8259_IRQ_HDC1 14 /* default and ddb_setup */
126#define I8259_IRQ_HDC2 15 /* default */
127
128
129/*
130 * misc
131 */
132#define VRC5476_I8259_CASCADE VRC5476_IRQ_INTC
133#define CPU_VRC5476_CASCADE 2
134
135#define is_i8259_irq(irq) ((irq) < NUM_I8259_IRQ)
136#define nile4_to_irq(n) ((n)+NUM_I8259_IRQ)
137#define irq_to_nile4(n) ((n)-NUM_I8259_IRQ)
138
139/*
140 * low-level irq functions
141 */
142#ifndef __ASSEMBLY__
143extern void nile4_map_irq(int nile4_irq, int cpu_irq);
144extern void nile4_map_irq_all(int cpu_irq);
145extern void nile4_enable_irq(int nile4_irq);
146extern void nile4_disable_irq(int nile4_irq);
147extern void nile4_disable_irq_all(void);
148extern u16 nile4_get_irq_stat(int cpu_irq);
149extern void nile4_enable_irq_output(int cpu_irq);
150extern void nile4_disable_irq_output(int cpu_irq);
151extern void nile4_set_pci_irq_polarity(int pci_irq, int high);
152extern void nile4_set_pci_irq_level_or_edge(int pci_irq, int level);
153extern void nile4_clear_irq(int nile4_irq);
154extern void nile4_clear_irq_mask(u32 mask);
155extern u8 nile4_i8259_iack(void);
156extern void nile4_dump_irq_status(void); /* Debug */
157#endif /* !__ASSEMBLY__ */
diff --git a/include/asm-mips/ddb5xxx/ddb5xxx.h b/include/asm-mips/ddb5xxx/ddb5xxx.h
index 42c274871625..e97fcc8d548b 100644
--- a/include/asm-mips/ddb5xxx/ddb5xxx.h
+++ b/include/asm-mips/ddb5xxx/ddb5xxx.h
@@ -173,13 +173,8 @@
173 173
174static inline void ddb_sync(void) 174static inline void ddb_sync(void)
175{ 175{
176/* The DDB5074 doesn't seem to like these accesses. They kill the board on
177 * interrupt load
178 */
179#ifndef CONFIG_DDB5074
180 volatile u32 *p = (volatile u32 *)0xbfc00000; 176 volatile u32 *p = (volatile u32 *)0xbfc00000;
181 (void)(*p); 177 (void)(*p);
182#endif
183} 178}
184 179
185static inline void ddb_out32(u32 offset, u32 val) 180static inline void ddb_out32(u32 offset, u32 val)
@@ -259,11 +254,7 @@ extern void ddb_pci_reset_bus(void);
259/* 254/*
260 * include the board dependent part 255 * include the board dependent part
261 */ 256 */
262#if defined(CONFIG_DDB5074) 257#if defined(CONFIG_DDB5477)
263#include <asm/ddb5xxx/ddb5074.h>
264#elif defined(CONFIG_DDB5476)
265#include <asm/ddb5xxx/ddb5476.h>
266#elif defined(CONFIG_DDB5477)
267#include <asm/ddb5xxx/ddb5477.h> 258#include <asm/ddb5xxx/ddb5477.h>
268#else 259#else
269#error "Unknown DDB board!" 260#error "Unknown DDB board!"
diff --git a/include/asm-mips/delay.h b/include/asm-mips/delay.h
index b2c9ed47508d..ea77050f8e3a 100644
--- a/include/asm-mips/delay.h
+++ b/include/asm-mips/delay.h
@@ -18,20 +18,22 @@ static inline void __delay(unsigned long loops)
18{ 18{
19 if (sizeof(long) == 4) 19 if (sizeof(long) == 4)
20 __asm__ __volatile__ ( 20 __asm__ __volatile__ (
21 ".set\tnoreorder\n" 21 " .set noreorder \n"
22 "1:\tbnez\t%0,1b\n\t" 22 " .align 3 \n"
23 "subu\t%0,1\n\t" 23 "1: bnez %0, 1b \n"
24 ".set\treorder" 24 " subu %0, 1 \n"
25 " .set reorder \n"
25 : "=r" (loops) 26 : "=r" (loops)
26 : "0" (loops)); 27 : "0" (loops));
27 else if (sizeof(long) == 8) 28 else if (sizeof(long) == 8)
28 __asm__ __volatile__ ( 29 __asm__ __volatile__ (
29 ".set\tnoreorder\n" 30 " .set noreorder \n"
30 "1:\tbnez\t%0,1b\n\t" 31 " .align 3 \n"
31 "dsubu\t%0,1\n\t" 32 "1: bnez %0, 1b \n"
32 ".set\treorder" 33 " dsubu %0, 1 \n"
33 :"=r" (loops) 34 " .set reorder \n"
34 :"0" (loops)); 35 : "=r" (loops)
36 : "0" (loops));
35} 37}
36 38
37 39
diff --git a/include/asm-mips/emma2rh/emma2rh.h b/include/asm-mips/emma2rh/emma2rh.h
new file mode 100644
index 000000000000..4fb8df71caa9
--- /dev/null
+++ b/include/asm-mips/emma2rh/emma2rh.h
@@ -0,0 +1,330 @@
1/*
2 * include/asm-mips/emma2rh/emma2rh.h
3 * This file is EMMA2RH common header.
4 *
5 * Copyright (C) NEC Electronics Corporation 2005-2006
6 *
7 * This file based on include/asm-mips/ddb5xxx/ddb5xxx.h
8 * Copyright 2001 MontaVista Software Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24#ifndef __ASM_EMMA2RH_EMMA2RH_H
25#define __ASM_EMMA2RH_EMMA2RH_H
26
27/*
28 * EMMA2RH registers
29 */
30#define REGBASE 0x10000000
31
32#define EMMA2RH_BHIF_STRAP_0 (0x000010+REGBASE)
33#define EMMA2RH_BHIF_INT_ST_0 (0x000030+REGBASE)
34#define EMMA2RH_BHIF_INT_ST_1 (0x000034+REGBASE)
35#define EMMA2RH_BHIF_INT_ST_2 (0x000038+REGBASE)
36#define EMMA2RH_BHIF_INT_EN_0 (0x000040+REGBASE)
37#define EMMA2RH_BHIF_INT_EN_1 (0x000044+REGBASE)
38#define EMMA2RH_BHIF_INT_EN_2 (0x000048+REGBASE)
39#define EMMA2RH_BHIF_INT1_EN_0 (0x000050+REGBASE)
40#define EMMA2RH_BHIF_INT1_EN_1 (0x000054+REGBASE)
41#define EMMA2RH_BHIF_INT1_EN_2 (0x000058+REGBASE)
42#define EMMA2RH_BHIF_SW_INT (0x000070+REGBASE)
43#define EMMA2RH_BHIF_SW_INT_EN (0x000080+REGBASE)
44#define EMMA2RH_BHIF_SW_INT_CLR (0x000090+REGBASE)
45#define EMMA2RH_BHIF_MAIN_CTRL (0x0000b4+REGBASE)
46#define EMMA2RH_BHIF_EXCEPT_VECT_BASE_ADDRESS (0x0000c0+REGBASE)
47#define EMMA2RH_GPIO_DIR (0x110d20+REGBASE)
48#define EMMA2RH_GPIO_INT_ST (0x110d30+REGBASE)
49#define EMMA2RH_GPIO_INT_MASK (0x110d3c+REGBASE)
50#define EMMA2RH_GPIO_INT_MODE (0x110d48+REGBASE)
51#define EMMA2RH_GPIO_INT_CND_A (0x110d54+REGBASE)
52#define EMMA2RH_GPIO_INT_CND_B (0x110d60+REGBASE)
53#define EMMA2RH_PBRD_INT_EN (0x100010+REGBASE)
54#define EMMA2RH_PBRD_CLKSEL (0x100028+REGBASE)
55#define EMMA2RH_PFUR0_BASE (0x101000+REGBASE)
56#define EMMA2RH_PFUR1_BASE (0x102000+REGBASE)
57#define EMMA2RH_PFUR2_BASE (0x103000+REGBASE)
58#define EMMA2RH_PIIC0_BASE (0x107000+REGBASE)
59#define EMMA2RH_PIIC1_BASE (0x108000+REGBASE)
60#define EMMA2RH_PIIC2_BASE (0x109000+REGBASE)
61#define EMMA2RH_PCI_CONTROL (0x200000+REGBASE)
62#define EMMA2RH_PCI_ARBIT_CTR (0x200004+REGBASE)
63#define EMMA2RH_PCI_IWIN0_CTR (0x200010+REGBASE)
64#define EMMA2RH_PCI_IWIN1_CTR (0x200014+REGBASE)
65#define EMMA2RH_PCI_INIT_ESWP (0x200018+REGBASE)
66#define EMMA2RH_PCI_INT (0x200020+REGBASE)
67#define EMMA2RH_PCI_INT_EN (0x200024+REGBASE)
68#define EMMA2RH_PCI_TWIN_CTR (0x200030+REGBASE)
69#define EMMA2RH_PCI_TWIN_BADR (0x200034+REGBASE)
70#define EMMA2RH_PCI_TWIN0_DADR (0x200038+REGBASE)
71#define EMMA2RH_PCI_TWIN1_DADR (0x20003c+REGBASE)
72
73/*
74 * Memory map (physical address)
75 *
76 * Note most of the following address must be properly aligned by the
77 * corresponding size. For example, if PCI_IO_SIZE is 16MB, then
78 * PCI_IO_BASE must be aligned along 16MB boundary.
79 */
80
81/* the actual ram size is detected at run-time */
82#define EMMA2RH_RAM_BASE 0x00000000
83#define EMMA2RH_RAM_SIZE 0x10000000 /* less than 256MB */
84
85#define EMMA2RH_IO_BASE 0x10000000
86#define EMMA2RH_IO_SIZE 0x01000000 /* 16 MB */
87
88#define EMMA2RH_GENERALIO_BASE 0x11000000
89#define EMMA2RH_GENERALIO_SIZE 0x01000000 /* 16 MB */
90
91#define EMMA2RH_PCI_IO_BASE 0x12000000
92#define EMMA2RH_PCI_IO_SIZE 0x02000000 /* 32 MB */
93
94#define EMMA2RH_PCI_MEM_BASE 0x14000000
95#define EMMA2RH_PCI_MEM_SIZE 0x08000000 /* 128 MB */
96
97#define EMMA2RH_ROM_BASE 0x1c000000
98#define EMMA2RH_ROM_SIZE 0x04000000 /* 64 MB */
99
100#define EMMA2RH_PCI_CONFIG_BASE EMMA2RH_PCI_IO_BASE
101#define EMMA2RH_PCI_CONFIG_SIZE EMMA2RH_PCI_IO_SIZE
102
103#define NUM_CPU_IRQ 8
104#define NUM_EMMA2RH_IRQ 96
105
106#define CPU_EMMA2RH_CASCADE 2
107#define EMMA2RH_IRQ_BASE 0
108
109/*
110 * emma2rh irq defs
111 */
112
113#define EMMA2RH_IRQ_INT0 (0 + EMMA2RH_IRQ_BASE)
114#define EMMA2RH_IRQ_INT1 (1 + EMMA2RH_IRQ_BASE)
115#define EMMA2RH_IRQ_INT2 (2 + EMMA2RH_IRQ_BASE)
116#define EMMA2RH_IRQ_INT3 (3 + EMMA2RH_IRQ_BASE)
117#define EMMA2RH_IRQ_INT4 (4 + EMMA2RH_IRQ_BASE)
118#define EMMA2RH_IRQ_INT5 (5 + EMMA2RH_IRQ_BASE)
119#define EMMA2RH_IRQ_INT6 (6 + EMMA2RH_IRQ_BASE)
120#define EMMA2RH_IRQ_INT7 (7 + EMMA2RH_IRQ_BASE)
121#define EMMA2RH_IRQ_INT8 (8 + EMMA2RH_IRQ_BASE)
122#define EMMA2RH_IRQ_INT9 (9 + EMMA2RH_IRQ_BASE)
123#define EMMA2RH_IRQ_INT10 (10 + EMMA2RH_IRQ_BASE)
124#define EMMA2RH_IRQ_INT11 (11 + EMMA2RH_IRQ_BASE)
125#define EMMA2RH_IRQ_INT12 (12 + EMMA2RH_IRQ_BASE)
126#define EMMA2RH_IRQ_INT13 (13 + EMMA2RH_IRQ_BASE)
127#define EMMA2RH_IRQ_INT14 (14 + EMMA2RH_IRQ_BASE)
128#define EMMA2RH_IRQ_INT15 (15 + EMMA2RH_IRQ_BASE)
129#define EMMA2RH_IRQ_INT16 (16 + EMMA2RH_IRQ_BASE)
130#define EMMA2RH_IRQ_INT17 (17 + EMMA2RH_IRQ_BASE)
131#define EMMA2RH_IRQ_INT18 (18 + EMMA2RH_IRQ_BASE)
132#define EMMA2RH_IRQ_INT19 (19 + EMMA2RH_IRQ_BASE)
133#define EMMA2RH_IRQ_INT20 (20 + EMMA2RH_IRQ_BASE)
134#define EMMA2RH_IRQ_INT21 (21 + EMMA2RH_IRQ_BASE)
135#define EMMA2RH_IRQ_INT22 (22 + EMMA2RH_IRQ_BASE)
136#define EMMA2RH_IRQ_INT23 (23 + EMMA2RH_IRQ_BASE)
137#define EMMA2RH_IRQ_INT24 (24 + EMMA2RH_IRQ_BASE)
138#define EMMA2RH_IRQ_INT25 (25 + EMMA2RH_IRQ_BASE)
139#define EMMA2RH_IRQ_INT26 (26 + EMMA2RH_IRQ_BASE)
140#define EMMA2RH_IRQ_INT27 (27 + EMMA2RH_IRQ_BASE)
141#define EMMA2RH_IRQ_INT28 (28 + EMMA2RH_IRQ_BASE)
142#define EMMA2RH_IRQ_INT29 (29 + EMMA2RH_IRQ_BASE)
143#define EMMA2RH_IRQ_INT30 (30 + EMMA2RH_IRQ_BASE)
144#define EMMA2RH_IRQ_INT31 (31 + EMMA2RH_IRQ_BASE)
145#define EMMA2RH_IRQ_INT32 (32 + EMMA2RH_IRQ_BASE)
146#define EMMA2RH_IRQ_INT33 (33 + EMMA2RH_IRQ_BASE)
147#define EMMA2RH_IRQ_INT34 (34 + EMMA2RH_IRQ_BASE)
148#define EMMA2RH_IRQ_INT35 (35 + EMMA2RH_IRQ_BASE)
149#define EMMA2RH_IRQ_INT36 (36 + EMMA2RH_IRQ_BASE)
150#define EMMA2RH_IRQ_INT37 (37 + EMMA2RH_IRQ_BASE)
151#define EMMA2RH_IRQ_INT38 (38 + EMMA2RH_IRQ_BASE)
152#define EMMA2RH_IRQ_INT39 (39 + EMMA2RH_IRQ_BASE)
153#define EMMA2RH_IRQ_INT40 (40 + EMMA2RH_IRQ_BASE)
154#define EMMA2RH_IRQ_INT41 (41 + EMMA2RH_IRQ_BASE)
155#define EMMA2RH_IRQ_INT42 (42 + EMMA2RH_IRQ_BASE)
156#define EMMA2RH_IRQ_INT43 (43 + EMMA2RH_IRQ_BASE)
157#define EMMA2RH_IRQ_INT44 (44 + EMMA2RH_IRQ_BASE)
158#define EMMA2RH_IRQ_INT45 (45 + EMMA2RH_IRQ_BASE)
159#define EMMA2RH_IRQ_INT46 (46 + EMMA2RH_IRQ_BASE)
160#define EMMA2RH_IRQ_INT47 (47 + EMMA2RH_IRQ_BASE)
161#define EMMA2RH_IRQ_INT48 (48 + EMMA2RH_IRQ_BASE)
162#define EMMA2RH_IRQ_INT49 (49 + EMMA2RH_IRQ_BASE)
163#define EMMA2RH_IRQ_INT50 (50 + EMMA2RH_IRQ_BASE)
164#define EMMA2RH_IRQ_INT51 (51 + EMMA2RH_IRQ_BASE)
165#define EMMA2RH_IRQ_INT52 (52 + EMMA2RH_IRQ_BASE)
166#define EMMA2RH_IRQ_INT53 (53 + EMMA2RH_IRQ_BASE)
167#define EMMA2RH_IRQ_INT54 (54 + EMMA2RH_IRQ_BASE)
168#define EMMA2RH_IRQ_INT55 (55 + EMMA2RH_IRQ_BASE)
169#define EMMA2RH_IRQ_INT56 (56 + EMMA2RH_IRQ_BASE)
170#define EMMA2RH_IRQ_INT57 (57 + EMMA2RH_IRQ_BASE)
171#define EMMA2RH_IRQ_INT58 (58 + EMMA2RH_IRQ_BASE)
172#define EMMA2RH_IRQ_INT59 (59 + EMMA2RH_IRQ_BASE)
173#define EMMA2RH_IRQ_INT60 (60 + EMMA2RH_IRQ_BASE)
174#define EMMA2RH_IRQ_INT61 (61 + EMMA2RH_IRQ_BASE)
175#define EMMA2RH_IRQ_INT62 (62 + EMMA2RH_IRQ_BASE)
176#define EMMA2RH_IRQ_INT63 (63 + EMMA2RH_IRQ_BASE)
177
178#define EMMA2RH_IRQ_PFUR0 EMMA2RH_IRQ_INT49
179#define EMMA2RH_IRQ_PFUR1 EMMA2RH_IRQ_INT50
180#define EMMA2RH_IRQ_PFUR2 EMMA2RH_IRQ_INT51
181#define EMMA2RH_IRQ_PIIC0 EMMA2RH_IRQ_INT56
182#define EMMA2RH_IRQ_PIIC1 EMMA2RH_IRQ_INT57
183#define EMMA2RH_IRQ_PIIC2 EMMA2RH_IRQ_INT58
184
185/*
186 * EMMA2RH Register Access
187 */
188
189#define EMMA2RH_BASE (0xa0000000)
190
191static inline void emma2rh_sync(void)
192{
193 volatile u32 *p = (volatile u32 *)0xbfc00000;
194 (void)(*p);
195}
196
197static inline void emma2rh_out32(u32 offset, u32 val)
198{
199 *(volatile u32 *)(EMMA2RH_BASE | offset) = val;
200 emma2rh_sync();
201}
202
203static inline u32 emma2rh_in32(u32 offset)
204{
205 u32 val = *(volatile u32 *)(EMMA2RH_BASE | offset);
206 emma2rh_sync();
207 return val;
208}
209
210static inline void emma2rh_out16(u32 offset, u16 val)
211{
212 *(volatile u16 *)(EMMA2RH_BASE | offset) = val;
213 emma2rh_sync();
214}
215
216static inline u16 emma2rh_in16(u32 offset)
217{
218 u16 val = *(volatile u16 *)(EMMA2RH_BASE | offset);
219 emma2rh_sync();
220 return val;
221}
222
223static inline void emma2rh_out8(u32 offset, u8 val)
224{
225 *(volatile u8 *)(EMMA2RH_BASE | offset) = val;
226 emma2rh_sync();
227}
228
229static inline u8 emma2rh_in8(u32 offset)
230{
231 u8 val = *(volatile u8 *)(EMMA2RH_BASE | offset);
232 emma2rh_sync();
233 return val;
234}
235
236/**
237 * IIC registers map
238 **/
239
240/*---------------------------------------------------------------------------*/
241/* CNT - Control register (00H R/W) */
242/*---------------------------------------------------------------------------*/
243#define SPT 0x00000001
244#define STT 0x00000002
245#define ACKE 0x00000004
246#define WTIM 0x00000008
247#define SPIE 0x00000010
248#define WREL 0x00000020
249#define LREL 0x00000040
250#define IICE 0x00000080
251#define CNT_RESERVED 0x000000ff /* reserved bit 0 */
252
253#define I2C_EMMA_START (IICE | STT)
254#define I2C_EMMA_STOP (IICE | SPT)
255#define I2C_EMMA_REPSTART I2C_EMMA_START
256
257/*---------------------------------------------------------------------------*/
258/* STA - Status register (10H Read) */
259/*---------------------------------------------------------------------------*/
260#define MSTS 0x00000080
261#define ALD 0x00000040
262#define EXC 0x00000020
263#define COI 0x00000010
264#define TRC 0x00000008
265#define ACKD 0x00000004
266#define STD 0x00000002
267#define SPD 0x00000001
268
269/*---------------------------------------------------------------------------*/
270/* CSEL - Clock select register (20H R/W) */
271/*---------------------------------------------------------------------------*/
272#define FCL 0x00000080
273#define ND50 0x00000040
274#define CLD 0x00000020
275#define DAD 0x00000010
276#define SMC 0x00000008
277#define DFC 0x00000004
278#define CL 0x00000003
279#define CSEL_RESERVED 0x000000ff /* reserved bit 0 */
280
281#define FAST397 0x0000008b
282#define FAST297 0x0000008a
283#define FAST347 0x0000000b
284#define FAST260 0x0000000a
285#define FAST130 0x00000008
286#define STANDARD108 0x00000083
287#define STANDARD83 0x00000082
288#define STANDARD95 0x00000003
289#define STANDARD73 0x00000002
290#define STANDARD36 0x00000001
291#define STANDARD71 0x00000000
292
293/*---------------------------------------------------------------------------*/
294/* SVA - Slave address register (30H R/W) */
295/*---------------------------------------------------------------------------*/
296#define SVA 0x000000fe
297
298/*---------------------------------------------------------------------------*/
299/* SHR - Shift register (40H R/W) */
300/*---------------------------------------------------------------------------*/
301#define SR 0x000000ff
302
303/*---------------------------------------------------------------------------*/
304/* INT - Interrupt register (50H R/W) */
305/* INTM - Interrupt mask register (60H R/W) */
306/*---------------------------------------------------------------------------*/
307#define INTE0 0x00000001
308
309/***********************************************************************
310 * I2C registers
311 ***********************************************************************
312 */
313#define I2C_EMMA_CNT 0x00
314#define I2C_EMMA_STA 0x10
315#define I2C_EMMA_CSEL 0x20
316#define I2C_EMMA_SVA 0x30
317#define I2C_EMMA_SHR 0x40
318#define I2C_EMMA_INT 0x50
319#define I2C_EMMA_INTM 0x60
320
321/*
322 * include the board dependent part
323 */
324#if defined(CONFIG_MARKEINS)
325#include <asm/emma2rh/markeins.h>
326#else
327#error "Unknown EMMA2RH board!"
328#endif
329
330#endif /* __ASM_EMMA2RH_EMMA2RH_H */
diff --git a/include/asm-mips/emma2rh/markeins.h b/include/asm-mips/emma2rh/markeins.h
new file mode 100644
index 000000000000..8fa766795078
--- /dev/null
+++ b/include/asm-mips/emma2rh/markeins.h
@@ -0,0 +1,76 @@
1/*
2 * include/asm-mips/emma2rh/markeins.h
3 * This file is EMMA2RH board depended header.
4 *
5 * Copyright (C) NEC Electronics Corporation 2005-2006
6 *
7 * This file based on include/asm-mips/ddb5xxx/ddb5xxx.h
8 * Copyright 2001 MontaVista Software Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24
25#ifndef MARKEINS_H
26#define MARKEINS_H
27
28#define NUM_EMMA2RH_IRQ_SW 32
29#define NUM_EMMA2RH_IRQ_GPIO 32
30
31#define EMMA2RH_SW_CASCADE (EMMA2RH_IRQ_INT7 - EMMA2RH_IRQ_INT0)
32#define EMMA2RH_GPIO_CASCADE (EMMA2RH_IRQ_INT46 - EMMA2RH_IRQ_INT0)
33
34#define EMMA2RH_SW_IRQ_BASE (EMMA2RH_IRQ_BASE + NUM_EMMA2RH_IRQ)
35#define EMMA2RH_GPIO_IRQ_BASE (EMMA2RH_SW_IRQ_BASE + NUM_EMMA2RH_IRQ_SW)
36#define CPU_IRQ_BASE (EMMA2RH_GPIO_IRQ_BASE + NUM_EMMA2RH_IRQ_GPIO)
37
38#define EMMA2RH_SW_IRQ_INT0 (0+EMMA2RH_SW_IRQ_BASE)
39#define EMMA2RH_SW_IRQ_INT1 (1+EMMA2RH_SW_IRQ_BASE)
40#define EMMA2RH_SW_IRQ_INT2 (2+EMMA2RH_SW_IRQ_BASE)
41#define EMMA2RH_SW_IRQ_INT3 (3+EMMA2RH_SW_IRQ_BASE)
42#define EMMA2RH_SW_IRQ_INT4 (4+EMMA2RH_SW_IRQ_BASE)
43#define EMMA2RH_SW_IRQ_INT5 (5+EMMA2RH_SW_IRQ_BASE)
44#define EMMA2RH_SW_IRQ_INT6 (6+EMMA2RH_SW_IRQ_BASE)
45#define EMMA2RH_SW_IRQ_INT7 (7+EMMA2RH_SW_IRQ_BASE)
46#define EMMA2RH_SW_IRQ_INT8 (8+EMMA2RH_SW_IRQ_BASE)
47#define EMMA2RH_SW_IRQ_INT9 (9+EMMA2RH_SW_IRQ_BASE)
48#define EMMA2RH_SW_IRQ_INT10 (10+EMMA2RH_SW_IRQ_BASE)
49#define EMMA2RH_SW_IRQ_INT11 (11+EMMA2RH_SW_IRQ_BASE)
50#define EMMA2RH_SW_IRQ_INT12 (12+EMMA2RH_SW_IRQ_BASE)
51#define EMMA2RH_SW_IRQ_INT13 (13+EMMA2RH_SW_IRQ_BASE)
52#define EMMA2RH_SW_IRQ_INT14 (14+EMMA2RH_SW_IRQ_BASE)
53#define EMMA2RH_SW_IRQ_INT15 (15+EMMA2RH_SW_IRQ_BASE)
54#define EMMA2RH_SW_IRQ_INT16 (16+EMMA2RH_SW_IRQ_BASE)
55#define EMMA2RH_SW_IRQ_INT17 (17+EMMA2RH_SW_IRQ_BASE)
56#define EMMA2RH_SW_IRQ_INT18 (18+EMMA2RH_SW_IRQ_BASE)
57#define EMMA2RH_SW_IRQ_INT19 (19+EMMA2RH_SW_IRQ_BASE)
58#define EMMA2RH_SW_IRQ_INT20 (20+EMMA2RH_SW_IRQ_BASE)
59#define EMMA2RH_SW_IRQ_INT21 (21+EMMA2RH_SW_IRQ_BASE)
60#define EMMA2RH_SW_IRQ_INT22 (22+EMMA2RH_SW_IRQ_BASE)
61#define EMMA2RH_SW_IRQ_INT23 (23+EMMA2RH_SW_IRQ_BASE)
62#define EMMA2RH_SW_IRQ_INT24 (24+EMMA2RH_SW_IRQ_BASE)
63#define EMMA2RH_SW_IRQ_INT25 (25+EMMA2RH_SW_IRQ_BASE)
64#define EMMA2RH_SW_IRQ_INT26 (26+EMMA2RH_SW_IRQ_BASE)
65#define EMMA2RH_SW_IRQ_INT27 (27+EMMA2RH_SW_IRQ_BASE)
66#define EMMA2RH_SW_IRQ_INT28 (28+EMMA2RH_SW_IRQ_BASE)
67#define EMMA2RH_SW_IRQ_INT29 (29+EMMA2RH_SW_IRQ_BASE)
68#define EMMA2RH_SW_IRQ_INT30 (30+EMMA2RH_SW_IRQ_BASE)
69#define EMMA2RH_SW_IRQ_INT31 (31+EMMA2RH_SW_IRQ_BASE)
70
71#define MARKEINS_PCI_IRQ_INTA EMMA2RH_GPIO_IRQ_BASE+15
72#define MARKEINS_PCI_IRQ_INTB EMMA2RH_GPIO_IRQ_BASE+16
73#define MARKEINS_PCI_IRQ_INTC EMMA2RH_GPIO_IRQ_BASE+17
74#define MARKEINS_PCI_IRQ_INTD EMMA2RH_GPIO_IRQ_BASE+18
75
76#endif /* CONFIG_MARKEINS */
diff --git a/include/asm-mips/fpu.h b/include/asm-mips/fpu.h
index 199e768ff73a..58c561a9ec6b 100644
--- a/include/asm-mips/fpu.h
+++ b/include/asm-mips/fpu.h
@@ -137,10 +137,9 @@ static inline fpureg_t *get_fpu_regs(struct task_struct *tsk)
137 if (cpu_has_fpu) { 137 if (cpu_has_fpu) {
138 if ((tsk == current) && __is_fpu_owner()) 138 if ((tsk == current) && __is_fpu_owner())
139 _save_fp(current); 139 _save_fp(current);
140 return tsk->thread.fpu.hard.fpr;
141 } 140 }
142 141
143 return tsk->thread.fpu.soft.fpr; 142 return tsk->thread.fpu.fpr;
144} 143}
145 144
146#endif /* _ASM_FPU_H */ 145#endif /* _ASM_FPU_H */
diff --git a/include/asm-mips/fpu_emulator.h b/include/asm-mips/fpu_emulator.h
index 16cb4d11dd0b..2731c38bd7ae 100644
--- a/include/asm-mips/fpu_emulator.h
+++ b/include/asm-mips/fpu_emulator.h
@@ -12,8 +12,8 @@
12 * with this program; if not, write to the Free Software Foundation, Inc., 12 * with this program; if not, write to the Free Software Foundation, Inc.,
13 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 13 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
14 * 14 *
15 * Further private data for which no space exists in mips_fpu_soft_struct. 15 * Further private data for which no space exists in mips_fpu_struct.
16 * This should be subsumed into the mips_fpu_soft_struct structure as 16 * This should be subsumed into the mips_fpu_struct structure as
17 * defined in processor.h as soon as the absurd wired absolute assembler 17 * defined in processor.h as soon as the absurd wired absolute assembler
18 * offsets become dynamic at compile time. 18 * offsets become dynamic at compile time.
19 * 19 *
diff --git a/include/asm-mips/futex.h b/include/asm-mips/futex.h
index d71d878990df..ed023eae0674 100644
--- a/include/asm-mips/futex.h
+++ b/include/asm-mips/futex.h
@@ -6,6 +6,7 @@
6#include <linux/futex.h> 6#include <linux/futex.h>
7#include <asm/errno.h> 7#include <asm/errno.h>
8#include <asm/uaccess.h> 8#include <asm/uaccess.h>
9#include <asm/war.h>
9 10
10#ifdef CONFIG_SMP 11#ifdef CONFIG_SMP
11#define __FUTEX_SMP_SYNC " sync \n" 12#define __FUTEX_SMP_SYNC " sync \n"
@@ -15,30 +16,60 @@
15 16
16#define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \ 17#define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \
17{ \ 18{ \
18 __asm__ __volatile__( \ 19 if (cpu_has_llsc && R10000_LLSC_WAR) { \
19 " .set push \n" \ 20 __asm__ __volatile__( \
20 " .set noat \n" \ 21 " .set push \n" \
21 " .set mips3 \n" \ 22 " .set noat \n" \
22 "1: ll %1, (%3) # __futex_atomic_op1 \n" \ 23 " .set mips3 \n" \
23 " .set mips0 \n" \ 24 "1: ll %1, %4 # __futex_atomic_op \n" \
24 " " insn " \n" \ 25 " .set mips0 \n" \
25 " .set mips3 \n" \ 26 " " insn " \n" \
26 "2: sc $1, (%3) \n" \ 27 " .set mips3 \n" \
27 " beqzl $1, 1b \n" \ 28 "2: sc $1, %2 \n" \
28 __FUTEX_SMP_SYNC \ 29 " beqzl $1, 1b \n" \
29 "3: \n" \ 30 __FUTEX_SMP_SYNC \
30 " .set pop \n" \ 31 "3: \n" \
31 " .set mips0 \n" \ 32 " .set pop \n" \
32 " .section .fixup,\"ax\" \n" \ 33 " .set mips0 \n" \
33 "4: li %0, %5 \n" \ 34 " .section .fixup,\"ax\" \n" \
34 " j 2b \n" \ 35 "4: li %0, %6 \n" \
35 " .previous \n" \ 36 " j 2b \n" \
36 " .section __ex_table,\"a\" \n" \ 37 " .previous \n" \
37 " "__UA_ADDR "\t1b, 4b \n" \ 38 " .section __ex_table,\"a\" \n" \
38 " "__UA_ADDR "\t2b, 4b \n" \ 39 " "__UA_ADDR "\t1b, 4b \n" \
39 " .previous \n" \ 40 " "__UA_ADDR "\t2b, 4b \n" \
40 : "=r" (ret), "=r" (oldval) \ 41 " .previous \n" \
41 : "0" (0), "r" (uaddr), "Jr" (oparg), "i" (-EFAULT)); \ 42 : "=r" (ret), "=&r" (oldval), "=R" (*uaddr) \
43 : "0" (0), "R" (*uaddr), "Jr" (oparg), "i" (-EFAULT) \
44 : "memory"); \
45 } else if (cpu_has_llsc) { \
46 __asm__ __volatile__( \
47 " .set push \n" \
48 " .set noat \n" \
49 " .set mips3 \n" \
50 "1: ll %1, %4 # __futex_atomic_op \n" \
51 " .set mips0 \n" \
52 " " insn " \n" \
53 " .set mips3 \n" \
54 "2: sc $1, %2 \n" \
55 " beqz $1, 1b \n" \
56 __FUTEX_SMP_SYNC \
57 "3: \n" \
58 " .set pop \n" \
59 " .set mips0 \n" \
60 " .section .fixup,\"ax\" \n" \
61 "4: li %0, %6 \n" \
62 " j 2b \n" \
63 " .previous \n" \
64 " .section __ex_table,\"a\" \n" \
65 " "__UA_ADDR "\t1b, 4b \n" \
66 " "__UA_ADDR "\t2b, 4b \n" \
67 " .previous \n" \
68 : "=r" (ret), "=&r" (oldval), "=R" (*uaddr) \
69 : "0" (0), "R" (*uaddr), "Jr" (oparg), "i" (-EFAULT) \
70 : "memory"); \
71 } else \
72 ret = -ENOSYS; \
42} 73}
43 74
44static inline int 75static inline int
@@ -59,23 +90,23 @@ futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
59 90
60 switch (op) { 91 switch (op) {
61 case FUTEX_OP_SET: 92 case FUTEX_OP_SET:
62 __futex_atomic_op("move $1, %z4", ret, oldval, uaddr, oparg); 93 __futex_atomic_op("move $1, %z5", ret, oldval, uaddr, oparg);
63 break; 94 break;
64 95
65 case FUTEX_OP_ADD: 96 case FUTEX_OP_ADD:
66 __futex_atomic_op("addu $1, %1, %z4", 97 __futex_atomic_op("addu $1, %1, %z5",
67 ret, oldval, uaddr, oparg); 98 ret, oldval, uaddr, oparg);
68 break; 99 break;
69 case FUTEX_OP_OR: 100 case FUTEX_OP_OR:
70 __futex_atomic_op("or $1, %1, %z4", 101 __futex_atomic_op("or $1, %1, %z5",
71 ret, oldval, uaddr, oparg); 102 ret, oldval, uaddr, oparg);
72 break; 103 break;
73 case FUTEX_OP_ANDN: 104 case FUTEX_OP_ANDN:
74 __futex_atomic_op("and $1, %1, %z4", 105 __futex_atomic_op("and $1, %1, %z5",
75 ret, oldval, uaddr, ~oparg); 106 ret, oldval, uaddr, ~oparg);
76 break; 107 break;
77 case FUTEX_OP_XOR: 108 case FUTEX_OP_XOR:
78 __futex_atomic_op("xor $1, %1, %z4", 109 __futex_atomic_op("xor $1, %1, %z5",
79 ret, oldval, uaddr, oparg); 110 ret, oldval, uaddr, oparg);
80 break; 111 break;
81 default: 112 default:
@@ -101,7 +132,69 @@ futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
101static inline int 132static inline int
102futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval) 133futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
103{ 134{
104 return -ENOSYS; 135 int retval;
136
137 if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))
138 return -EFAULT;
139
140 if (cpu_has_llsc && R10000_LLSC_WAR) {
141 __asm__ __volatile__(
142 "# futex_atomic_cmpxchg_inatomic \n"
143 " .set push \n"
144 " .set noat \n"
145 " .set mips3 \n"
146 "1: ll %0, %2 \n"
147 " bne %0, %z3, 3f \n"
148 " .set mips0 \n"
149 " move $1, %z4 \n"
150 " .set mips3 \n"
151 "2: sc $1, %1 \n"
152 " beqzl $1, 1b \n"
153 __FUTEX_SMP_SYNC
154 "3: \n"
155 " .set pop \n"
156 " .section .fixup,\"ax\" \n"
157 "4: li %0, %5 \n"
158 " j 3b \n"
159 " .previous \n"
160 " .section __ex_table,\"a\" \n"
161 " "__UA_ADDR "\t1b, 4b \n"
162 " "__UA_ADDR "\t2b, 4b \n"
163 " .previous \n"
164 : "=&r" (retval), "=R" (*uaddr)
165 : "R" (*uaddr), "Jr" (oldval), "Jr" (newval), "i" (-EFAULT)
166 : "memory");
167 } else if (cpu_has_llsc) {
168 __asm__ __volatile__(
169 "# futex_atomic_cmpxchg_inatomic \n"
170 " .set push \n"
171 " .set noat \n"
172 " .set mips3 \n"
173 "1: ll %0, %2 \n"
174 " bne %0, %z3, 3f \n"
175 " .set mips0 \n"
176 " move $1, %z4 \n"
177 " .set mips3 \n"
178 "2: sc $1, %1 \n"
179 " beqz $1, 1b \n"
180 __FUTEX_SMP_SYNC
181 "3: \n"
182 " .set pop \n"
183 " .section .fixup,\"ax\" \n"
184 "4: li %0, %5 \n"
185 " j 3b \n"
186 " .previous \n"
187 " .section __ex_table,\"a\" \n"
188 " "__UA_ADDR "\t1b, 4b \n"
189 " "__UA_ADDR "\t2b, 4b \n"
190 " .previous \n"
191 : "=&r" (retval), "=R" (*uaddr)
192 : "R" (*uaddr), "Jr" (oldval), "Jr" (newval), "i" (-EFAULT)
193 : "memory");
194 } else
195 return -ENOSYS;
196
197 return retval;
105} 198}
106 199
107#endif 200#endif
diff --git a/include/asm-mips/inst.h b/include/asm-mips/inst.h
index e0745f4ff624..1ed8d0f62577 100644
--- a/include/asm-mips/inst.h
+++ b/include/asm-mips/inst.h
@@ -6,6 +6,7 @@
6 * for more details. 6 * for more details.
7 * 7 *
8 * Copyright (C) 1996, 2000 by Ralf Baechle 8 * Copyright (C) 1996, 2000 by Ralf Baechle
9 * Copyright (C) 2006 by Thiemo Seufer
9 */ 10 */
10#ifndef _ASM_INST_H 11#ifndef _ASM_INST_H
11#define _ASM_INST_H 12#define _ASM_INST_H
@@ -21,14 +22,14 @@ enum major_op {
21 cop0_op, cop1_op, cop2_op, cop1x_op, 22 cop0_op, cop1_op, cop2_op, cop1x_op,
22 beql_op, bnel_op, blezl_op, bgtzl_op, 23 beql_op, bnel_op, blezl_op, bgtzl_op,
23 daddi_op, daddiu_op, ldl_op, ldr_op, 24 daddi_op, daddiu_op, ldl_op, ldr_op,
24 major_1c_op, jalx_op, major_1e_op, major_1f_op, 25 spec2_op, jalx_op, mdmx_op, spec3_op,
25 lb_op, lh_op, lwl_op, lw_op, 26 lb_op, lh_op, lwl_op, lw_op,
26 lbu_op, lhu_op, lwr_op, lwu_op, 27 lbu_op, lhu_op, lwr_op, lwu_op,
27 sb_op, sh_op, swl_op, sw_op, 28 sb_op, sh_op, swl_op, sw_op,
28 sdl_op, sdr_op, swr_op, cache_op, 29 sdl_op, sdr_op, swr_op, cache_op,
29 ll_op, lwc1_op, lwc2_op, pref_op, 30 ll_op, lwc1_op, lwc2_op, pref_op,
30 lld_op, ldc1_op, ldc2_op, ld_op, 31 lld_op, ldc1_op, ldc2_op, ld_op,
31 sc_op, swc1_op, swc2_op, rdhwr_op, 32 sc_op, swc1_op, swc2_op, major_3b_op,
32 scd_op, sdc1_op, sdc2_op, sd_op 33 scd_op, sdc1_op, sdc2_op, sd_op
33}; 34};
34 35
@@ -37,7 +38,7 @@ enum major_op {
37 */ 38 */
38enum spec_op { 39enum spec_op {
39 sll_op, movc_op, srl_op, sra_op, 40 sll_op, movc_op, srl_op, sra_op,
40 sllv_op, srlv_op, srav_op, spec1_unused_op, /* Opcode 0x07 is unused */ 41 sllv_op, pmon_op, srlv_op, srav_op,
41 jr_op, jalr_op, movz_op, movn_op, 42 jr_op, jalr_op, movz_op, movn_op,
42 syscall_op, break_op, spim_op, sync_op, 43 syscall_op, break_op, spim_op, sync_op,
43 mfhi_op, mthi_op, mflo_op, mtlo_op, 44 mfhi_op, mthi_op, mflo_op, mtlo_op,
@@ -55,6 +56,28 @@ enum spec_op {
55}; 56};
56 57
57/* 58/*
59 * func field of spec2 opcode.
60 */
61enum spec2_op {
62 madd_op, maddu_op, mul_op, spec2_3_unused_op,
63 msub_op, msubu_op, /* more unused ops */
64 clz_op = 0x20, clo_op,
65 dclz_op = 0x24, dclo_op,
66 sdbpp_op = 0x3f
67};
68
69/*
70 * func field of spec3 opcode.
71 */
72enum spec3_op {
73 ext_op, dextm_op, dextu_op, dext_op,
74 ins_op, dinsm_op, dinsu_op, dins_op,
75 bshfl_op = 0x20,
76 dbshfl_op = 0x24,
77 rdhwr_op = 0x3f
78};
79
80/*
58 * rt field of bcond opcodes. 81 * rt field of bcond opcodes.
59 */ 82 */
60enum rt_op { 83enum rt_op {
@@ -151,8 +174,8 @@ enum cop1x_func {
151 * func field for mad opcodes (MIPS IV). 174 * func field for mad opcodes (MIPS IV).
152 */ 175 */
153enum mad_func { 176enum mad_func {
154 madd_op = 0x08, msub_op = 0x0a, 177 madd_fp_op = 0x08, msub_fp_op = 0x0a,
155 nmadd_op = 0x0c, nmsub_op = 0x0e 178 nmadd_fp_op = 0x0c, nmsub_fp_op = 0x0e
156}; 179};
157 180
158/* 181/*
diff --git a/include/asm-mips/mach-ddb5074/mc146818rtc.h b/include/asm-mips/mach-ddb5074/mc146818rtc.h
deleted file mode 100644
index 2eb9acb10a5a..000000000000
--- a/include/asm-mips/mach-ddb5074/mc146818rtc.h
+++ /dev/null
@@ -1,31 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1998, 2001, 03 by Ralf Baechle
7 *
8 * RTC routines for PC style attached Dallas chip.
9 */
10#ifndef __ASM_MACH_DDB5074_MC146818RTC_H
11#define __ASM_MACH_DDB5074_MC146818RTC_H
12
13#include <asm/ddb5xxx/ddb5074.h>
14#include <asm/ddb5xxx/ddb5xxx.h>
15
16#define RTC_PORT(x) (0x70 + (x))
17#define RTC_IRQ 8
18
19static inline unsigned char CMOS_READ(unsigned long addr)
20{
21 return *(volatile unsigned char *)(KSEG1ADDR(DDB_PCI_MEM_BASE)+addr);
22}
23
24static inline void CMOS_WRITE(unsigned char data, unsigned long addr)
25{
26 *(volatile unsigned char *)(KSEG1ADDR(DDB_PCI_MEM_BASE)+addr) = data;
27}
28
29#define RTC_ALWAYS_BCD 1
30
31#endif /* __ASM_MACH_DDB5074_MC146818RTC_H */
diff --git a/include/asm-mips/mach-dec/param.h b/include/asm-mips/mach-dec/param.h
deleted file mode 100644
index 3e4f0e390847..000000000000
--- a/include/asm-mips/mach-dec/param.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003 by Ralf Baechle
7 */
8#ifndef __ASM_MACH_DEC_PARAM_H
9#define __ASM_MACH_DEC_PARAM_H
10
11/*
12 * log2(HZ), change this here if you want another HZ value. This is also
13 * used in dec_time_init. Minimum is 1, Maximum is 15.
14 */
15#define LOG_2_HZ 7
16#define HZ (1 << LOG_2_HZ)
17
18#endif /* __ASM_MACH_DEC_PARAM_H */
diff --git a/include/asm-mips/mach-mips/param.h b/include/asm-mips/mach-emma2rh/irq.h
index 805ef6d27d3c..bce64244b800 100644
--- a/include/asm-mips/mach-mips/param.h
+++ b/include/asm-mips/mach-emma2rh/irq.h
@@ -5,9 +5,9 @@
5 * 5 *
6 * Copyright (C) 2003 by Ralf Baechle 6 * Copyright (C) 2003 by Ralf Baechle
7 */ 7 */
8#ifndef __ASM_MACH_MIPS_PARAM_H 8#ifndef __ASM_MACH_EMMA2RH_IRQ_H
9#define __ASM_MACH_MIPS_PARAM_H 9#define __ASM_MACH_EMMA2RH_IRQ_H
10 10
11#define HZ 100 /* Internal kernel timer frequency */ 11#define NR_IRQS 256
12 12
13#endif /* __ASM_MACH_MIPS_PARAM_H */ 13#endif /* __ASM_MACH_EMMA2RH_IRQ_H */
diff --git a/include/asm-mips/mach-excite/cpu-feature-overrides.h b/include/asm-mips/mach-excite/cpu-feature-overrides.h
new file mode 100644
index 000000000000..abb76b2fd865
--- /dev/null
+++ b/include/asm-mips/mach-excite/cpu-feature-overrides.h
@@ -0,0 +1,40 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2004 Thomas Koeller <thomas.koeller@baslerweb.com>
7 */
8#ifndef __ASM_MACH_EXCITE_CPU_FEATURE_OVERRIDES_H
9#define __ASM_MACH_EXCITE_CPU_FEATURE_OVERRIDES_H
10
11/*
12 * Basler eXcite has an RM9122 processor.
13 */
14#define cpu_has_watch 1
15#define cpu_has_mips16 0
16#define cpu_has_divec 0
17#define cpu_has_vce 0
18#define cpu_has_cache_cdex_p 0
19#define cpu_has_cache_cdex_s 0
20#define cpu_has_prefetch 1
21#define cpu_has_mcheck 0
22#define cpu_has_ejtag 0
23
24#define cpu_has_llsc 1
25#define cpu_has_vtag_icache 0
26#define cpu_has_dc_aliases 0
27#define cpu_has_ic_fills_f_dc 0
28#define cpu_has_dsp 0
29#define cpu_icache_snoops_remote_store 0
30
31#define cpu_has_nofpuex 0
32#define cpu_has_64bits 1
33
34#define cpu_has_subset_pcaches 0
35
36#define cpu_dcache_line_size() 32
37#define cpu_icache_line_size() 32
38#define cpu_scache_line_size() 32
39
40#endif /* __ASM_MACH_EXCITE_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mach-excite/excite.h b/include/asm-mips/mach-excite/excite.h
new file mode 100644
index 000000000000..c52610de2b3a
--- /dev/null
+++ b/include/asm-mips/mach-excite/excite.h
@@ -0,0 +1,155 @@
1#ifndef __EXCITE_H__
2#define __EXCITE_H__
3
4#include <linux/config.h>
5#include <linux/init.h>
6#include <asm/addrspace.h>
7#include <asm/types.h>
8
9#define EXCITE_CPU_EXT_CLOCK 100000000
10
11#if !defined(__ASSEMBLER__)
12void __init excite_kgdb_init(void);
13void excite_procfs_init(void);
14extern unsigned long memsize;
15extern char modetty[];
16extern u32 unit_id;
17#endif
18
19/* Base name for XICAP devices */
20#define XICAP_NAME "xicap_gpi"
21
22/* OCD register offsets */
23#define LKB0 0x0038
24#define LKB5 0x0128
25#define LKM5 0x012C
26#define LKB7 0x0138
27#define LKM7 0x013c
28#define LKB8 0x0140
29#define LKM8 0x0144
30#define LKB9 0x0148
31#define LKM9 0x014c
32#define LKB10 0x0150
33#define LKM10 0x0154
34#define LKB11 0x0158
35#define LKM11 0x015c
36#define LKB12 0x0160
37#define LKM12 0x0164
38#define LKB13 0x0168
39#define LKM13 0x016c
40#define LDP0 0x0200
41#define LDP1 0x0210
42#define LDP2 0x0220
43#define LDP3 0x0230
44#define INTPIN0 0x0A40
45#define INTPIN1 0x0A44
46#define INTPIN2 0x0A48
47#define INTPIN3 0x0A4C
48#define INTPIN4 0x0A50
49#define INTPIN5 0x0A54
50#define INTPIN6 0x0A58
51#define INTPIN7 0x0A5C
52
53
54
55
56/* TITAN register offsets */
57#define CPRR 0x0004
58#define CPDSR 0x0008
59#define CPTC0R 0x000c
60#define CPTC1R 0x0010
61#define CPCFG0 0x0020
62#define CPCFG1 0x0024
63#define CPDST0A 0x0028
64#define CPDST0B 0x002c
65#define CPDST1A 0x0030
66#define CPDST1B 0x0034
67#define CPXDSTA 0x0038
68#define CPXDSTB 0x003c
69#define CPXCISRA 0x0048
70#define CPXCISRB 0x004c
71#define CPGIG0ER 0x0050
72#define CPGIG1ER 0x0054
73#define CPGRWL 0x0068
74#define CPURSLMT 0x00f8
75#define UACFG 0x0200
76#define UAINTS 0x0204
77#define SDRXFCIE 0x4828
78#define SDTXFCIE 0x4928
79#define INTP0Status0 0x1B00
80#define INTP0Mask0 0x1B04
81#define INTP0Set0 0x1B08
82#define INTP0Clear0 0x1B0C
83#define GXCFG 0x5000
84#define GXDMADRPFX 0x5018
85#define GXDMA_DESCADR 0x501c
86#define GXCH0TDESSTRT 0x5054
87
88/* IRQ definitions */
89#define NMICONFIG 0xac0
90#define TITAN_MSGINT 0xc4
91#define TITAN_IRQ ((TITAN_MSGINT / 0x20) + 2)
92#define FPGA0_MSGINT 0x5a
93#define FPGA0_IRQ ((FPGA0_MSGINT / 0x20) + 2)
94#define FPGA1_MSGINT 0x7b
95#define FPGA1_IRQ ((FPGA1_MSGINT / 0x20) + 2)
96#define PHY_MSGINT 0x9c
97#define PHY_IRQ ((PHY_MSGINT / 0x20) + 2)
98
99#if defined(CONFIG_BASLER_EXCITE_PROTOTYPE)
100/* Pre-release units used interrupt pin #9 */
101#define USB_IRQ 11
102#else
103/* Re-designed units use interrupt pin #1 */
104#define USB_MSGINT 0x39
105#define USB_IRQ ((USB_MSGINT / 0x20) + 2)
106#endif
107#define TIMER_IRQ 12
108
109
110/* Device address ranges */
111#define EXCITE_OFFS_OCD 0x1fffc000
112#define EXCITE_SIZE_OCD (16 * 1024)
113#define EXCITE_PHYS_OCD CPHYSADDR(EXCITE_OFFS_OCD)
114#define EXCITE_ADDR_OCD CKSEG1ADDR(EXCITE_OFFS_OCD)
115
116#define EXCITE_OFFS_SCRAM 0x1fffa000
117#define EXCITE_SIZE_SCRAM (8 << 10)
118#define EXCITE_PHYS_SCRAM CPHYSADDR(EXCITE_OFFS_SCRAM)
119#define EXCITE_ADDR_SCRAM CKSEG1ADDR(EXCITE_OFFS_SCRAM)
120
121#define EXCITE_OFFS_PCI_IO 0x1fff8000
122#define EXCITE_SIZE_PCI_IO (8 << 10)
123#define EXCITE_PHYS_PCI_IO CPHYSADDR(EXCITE_OFFS_PCI_IO)
124#define EXCITE_ADDR_PCI_IO CKSEG1ADDR(EXCITE_OFFS_PCI_IO)
125
126#define EXCITE_OFFS_TITAN 0x1fff0000
127#define EXCITE_SIZE_TITAN (32 << 10)
128#define EXCITE_PHYS_TITAN CPHYSADDR(EXCITE_OFFS_TITAN)
129#define EXCITE_ADDR_TITAN CKSEG1ADDR(EXCITE_OFFS_TITAN)
130
131#define EXCITE_OFFS_PCI_MEM 0x1ffe0000
132#define EXCITE_SIZE_PCI_MEM (64 << 10)
133#define EXCITE_PHYS_PCI_MEM CPHYSADDR(EXCITE_OFFS_PCI_MEM)
134#define EXCITE_ADDR_PCI_MEM CKSEG1ADDR(EXCITE_OFFS_PCI_MEM)
135
136#define EXCITE_OFFS_FPGA 0x1ffdc000
137#define EXCITE_SIZE_FPGA (16 << 10)
138#define EXCITE_PHYS_FPGA CPHYSADDR(EXCITE_OFFS_FPGA)
139#define EXCITE_ADDR_FPGA CKSEG1ADDR(EXCITE_OFFS_FPGA)
140
141#define EXCITE_OFFS_NAND 0x1ffd8000
142#define EXCITE_SIZE_NAND (16 << 10)
143#define EXCITE_PHYS_NAND CPHYSADDR(EXCITE_OFFS_NAND)
144#define EXCITE_ADDR_NAND CKSEG1ADDR(EXCITE_OFFS_NAND)
145
146#define EXCITE_OFFS_BOOTROM 0x1f000000
147#define EXCITE_SIZE_BOOTROM (8 << 20)
148#define EXCITE_PHYS_BOOTROM CPHYSADDR(EXCITE_OFFS_BOOTROM)
149#define EXCITE_ADDR_BOOTROM CKSEG1ADDR(EXCITE_OFFS_BOOTROM)
150
151/* FPGA address offsets */
152#define EXCITE_FPGA_DPR 0x0104 /* dual-ported ram */
153#define EXCITE_FPGA_SYSCTL 0x0200 /* system control register block */
154
155#endif /* __EXCITE_H__ */
diff --git a/include/asm-mips/mach-excite/excite_nandflash.h b/include/asm-mips/mach-excite/excite_nandflash.h
new file mode 100644
index 000000000000..c4cf6140622e
--- /dev/null
+++ b/include/asm-mips/mach-excite/excite_nandflash.h
@@ -0,0 +1,7 @@
1#ifndef __EXCITE_NANDFLASH_H__
2#define __EXCITE_NANDFLASH_H__
3
4/* Resource names */
5#define EXCITE_NANDFLASH_RESOURCE_REGS "excite_nandflash_regs"
6
7#endif /* __EXCITE_NANDFLASH_H__ */
diff --git a/include/asm-mips/mach-excite/rm9k_eth.h b/include/asm-mips/mach-excite/rm9k_eth.h
new file mode 100644
index 000000000000..94705a46f72e
--- /dev/null
+++ b/include/asm-mips/mach-excite/rm9k_eth.h
@@ -0,0 +1,23 @@
1#if !defined(__RM9K_ETH_H__)
2#define __RM9K_ETH_H__
3
4#define RM9K_GE_NAME "rm9k_ge"
5
6/* Resource names */
7#define RM9K_GE_RESOURCE_MAC "rm9k_ge_mac"
8#define RM9K_GE_RESOURCE_MSTAT "rm9k_ge_mstat"
9#define RM9K_GE_RESOURCE_PKTPROC "rm9k_ge_pktproc"
10#define RM9K_GE_RESOURCE_XDMA "rm9k_ge_xdma"
11#define RM9K_GE_RESOURCE_FIFO_RX "rm9k_ge_fifo_rx"
12#define RM9K_GE_RESOURCE_FIFO_TX "rm9k_ge_fifo_tx"
13#define RM9K_GE_RESOURCE_FIFOMEM_RX "rm9k_ge_fifo_memory_rx"
14#define RM9K_GE_RESOURCE_FIFOMEM_TX "rm9k_ge_fifo_memory_tx"
15#define RM9K_GE_RESOURCE_PHY "rm9k_ge_phy"
16#define RM9K_GE_RESOURCE_DMADESC_RX "rm9k_ge_dmadesc_rx"
17#define RM9K_GE_RESOURCE_DMADESC_TX "rm9k_ge_dmadesc_tx"
18#define RM9K_GE_RESOURCE_IRQ_MAIN "rm9k_ge_irq_main"
19#define RM9K_GE_RESOURCE_IRQ_PHY "rm9k_ge_irq_phy"
20#define RM9K_GE_RESOURCE_GPI_SLICE "rm9k_ge_gpi_slice"
21#define RM9K_GE_RESOURCE_MDIO_CHANNEL "rm9k_ge_mdio_channel"
22
23#endif /* !defined(__RM9K_ETH_H__) */
diff --git a/include/asm-mips/mach-excite/rm9k_wdt.h b/include/asm-mips/mach-excite/rm9k_wdt.h
new file mode 100644
index 000000000000..3fa3c08d2da7
--- /dev/null
+++ b/include/asm-mips/mach-excite/rm9k_wdt.h
@@ -0,0 +1,12 @@
1#ifndef __RM9K_WDT_H__
2#define __RM9K_WDT_H__
3
4/* Device name */
5#define WDT_NAME "wdt_gpi"
6
7/* Resource names */
8#define WDT_RESOURCE_REGS "excite_watchdog_regs"
9#define WDT_RESOURCE_IRQ "excite_watchdog_irq"
10#define WDT_RESOURCE_COUNTER "excite_watchdog_counter"
11
12#endif /* __RM9K_WDT_H__ */
diff --git a/include/asm-mips/mach-excite/rm9k_xicap.h b/include/asm-mips/mach-excite/rm9k_xicap.h
new file mode 100644
index 000000000000..009577734a8d
--- /dev/null
+++ b/include/asm-mips/mach-excite/rm9k_xicap.h
@@ -0,0 +1,16 @@
1#ifndef __EXCITE_XICAP_H__
2#define __EXCITE_XICAP_H__
3
4
5/* Resource names */
6#define XICAP_RESOURCE_FIFO_RX "xicap_fifo_rx"
7#define XICAP_RESOURCE_FIFO_TX "xicap_fifo_tx"
8#define XICAP_RESOURCE_XDMA "xicap_xdma"
9#define XICAP_RESOURCE_DMADESC "xicap_dmadesc"
10#define XICAP_RESOURCE_PKTPROC "xicap_pktproc"
11#define XICAP_RESOURCE_IRQ "xicap_irq"
12#define XICAP_RESOURCE_GPI_SLICE "xicap_gpi_slice"
13#define XICAP_RESOURCE_FIFO_BLK "xicap_fifo_blocks"
14#define XICAP_RESOURCE_PKT_STREAM "xicap_pkt_stream"
15
16#endif /* __EXCITE_XICAP_H__ */
diff --git a/include/asm-mips/mach-generic/param.h b/include/asm-mips/mach-generic/param.h
deleted file mode 100644
index a0d12f964e4f..000000000000
--- a/include/asm-mips/mach-generic/param.h
+++ /dev/null
@@ -1,13 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003 by Ralf Baechle
7 */
8#ifndef __ASM_MACH_GENERIC_PARAM_H
9#define __ASM_MACH_GENERIC_PARAM_H
10
11#define HZ 1000 /* Internal kernel timer frequency */
12
13#endif /* __ASM_MACH_GENERIC_PARAM_H */
diff --git a/include/asm-mips/mach-ip22/cpu-feature-overrides.h b/include/asm-mips/mach-ip22/cpu-feature-overrides.h
index 2a37bedb4053..f7c5dc8a5336 100644
--- a/include/asm-mips/mach-ip22/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-ip22/cpu-feature-overrides.h
@@ -13,7 +13,7 @@
13 */ 13 */
14#define cpu_has_tlb 1 14#define cpu_has_tlb 1
15#define cpu_has_4kex 1 15#define cpu_has_4kex 1
16#define cpu_has_4kcache 1 16#define cpu_has_4k_cache 1
17#define cpu_has_fpu 1 17#define cpu_has_fpu 1
18#define cpu_has_32fpr 1 18#define cpu_has_32fpr 1
19#define cpu_has_counter 1 19#define cpu_has_counter 1
diff --git a/include/asm-mips/mach-ip27/cpu-feature-overrides.h b/include/asm-mips/mach-ip27/cpu-feature-overrides.h
index 2d2f5b91e47f..19c2d135985b 100644
--- a/include/asm-mips/mach-ip27/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-ip27/cpu-feature-overrides.h
@@ -31,6 +31,9 @@
31#define cpu_has_nofpuex 0 31#define cpu_has_nofpuex 0
32#define cpu_has_64bits 1 32#define cpu_has_64bits 1
33 33
34#define cpu_has_4kex 1
35#define cpu_has_4k_cache 1
36
34#define cpu_has_subset_pcaches 1 37#define cpu_has_subset_pcaches 1
35 38
36#define cpu_dcache_line_size() 32 39#define cpu_dcache_line_size() 32
diff --git a/include/asm-mips/mach-ip32/cpu-feature-overrides.h b/include/asm-mips/mach-ip32/cpu-feature-overrides.h
index 5312a11098d9..2a3de092bf13 100644
--- a/include/asm-mips/mach-ip32/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-ip32/cpu-feature-overrides.h
@@ -37,6 +37,8 @@
37#define cpu_has_vtag_icache 0 37#define cpu_has_vtag_icache 0
38#define cpu_has_ic_fills_f_dc 0 38#define cpu_has_ic_fills_f_dc 0
39#define cpu_has_dsp 0 39#define cpu_has_dsp 0
40#define cpu_has_4k_cache 1
41
40 42
41#define cpu_has_mips32r1 0 43#define cpu_has_mips32r1 0
42#define cpu_has_mips32r2 0 44#define cpu_has_mips32r2 0
diff --git a/include/asm-mips/mach-jazz/param.h b/include/asm-mips/mach-jazz/param.h
deleted file mode 100644
index 639763a517bc..000000000000
--- a/include/asm-mips/mach-jazz/param.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003 by Ralf Baechle
7 */
8#ifndef __ASM_MACH_JAZZ_PARAM_H
9#define __ASM_MACH_JAZZ_PARAM_H
10
11/*
12 * Jazz is currently using the internal 100Hz timer of the R4030
13 */
14#define HZ 100 /* Internal kernel timer frequency */
15
16#endif /* __ASM_MACH_JAZZ_PARAM_H */
diff --git a/include/asm-mips/mach-mips/cpu-feature-overrides.h b/include/asm-mips/mach-mips/cpu-feature-overrides.h
index 7efbff50fcdd..e960679f54ba 100644
--- a/include/asm-mips/mach-mips/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-mips/cpu-feature-overrides.h
@@ -16,7 +16,7 @@
16#ifdef CONFIG_CPU_MIPS32 16#ifdef CONFIG_CPU_MIPS32
17#define cpu_has_tlb 1 17#define cpu_has_tlb 1
18#define cpu_has_4kex 1 18#define cpu_has_4kex 1
19#define cpu_has_4kcache 1 19#define cpu_has_4k_cache 1
20/* #define cpu_has_fpu ? */ 20/* #define cpu_has_fpu ? */
21/* #define cpu_has_32fpr ? */ 21/* #define cpu_has_32fpr ? */
22#define cpu_has_counter 1 22#define cpu_has_counter 1
@@ -46,7 +46,7 @@
46#ifdef CONFIG_CPU_MIPS64 46#ifdef CONFIG_CPU_MIPS64
47#define cpu_has_tlb 1 47#define cpu_has_tlb 1
48#define cpu_has_4kex 1 48#define cpu_has_4kex 1
49#define cpu_has_4kcache 1 49#define cpu_has_4k_cache 1
50/* #define cpu_has_fpu ? */ 50/* #define cpu_has_fpu ? */
51/* #define cpu_has_32fpr ? */ 51/* #define cpu_has_32fpr ? */
52#define cpu_has_counter 1 52#define cpu_has_counter 1
diff --git a/include/asm-mips/mach-qemu/param.h b/include/asm-mips/mach-qemu/param.h
deleted file mode 100644
index cb30ee490ae6..000000000000
--- a/include/asm-mips/mach-qemu/param.h
+++ /dev/null
@@ -1,13 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2005 by Ralf Baechle
7 */
8#ifndef __ASM_MACH_QEMU_PARAM_H
9#define __ASM_MACH_QEMU_PARAM_H
10
11#define HZ 100 /* Internal kernel timer frequency */
12
13#endif /* __ASM_MACH_QEMU_PARAM_H */
diff --git a/include/asm-mips/mach-rm200/cpu-feature-overrides.h b/include/asm-mips/mach-rm200/cpu-feature-overrides.h
index 91e7cf5f2bfe..11410ae10d36 100644
--- a/include/asm-mips/mach-rm200/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-rm200/cpu-feature-overrides.h
@@ -14,7 +14,7 @@
14 14
15#define cpu_has_tlb 1 15#define cpu_has_tlb 1
16#define cpu_has_4kex 1 16#define cpu_has_4kex 1
17#define cpu_has_4kcache 1 17#define cpu_has_4k_cache 1
18#define cpu_has_fpu 1 18#define cpu_has_fpu 1
19#define cpu_has_32fpr 1 19#define cpu_has_32fpr 1
20#define cpu_has_counter 1 20#define cpu_has_counter 1
@@ -35,10 +35,8 @@
35#define cpu_has_nofpuex 0 35#define cpu_has_nofpuex 0
36#define cpu_has_64bits 1 36#define cpu_has_64bits 1
37 37
38#define cpu_has_subset_pcaches 0 /* No S-cache on R5000 I think ... */
39#define cpu_dcache_line_size() 32 38#define cpu_dcache_line_size() 32
40#define cpu_icache_line_size() 32 39#define cpu_icache_line_size() 32
41#define cpu_scache_line_size() 0 /* No S-cache on R5000 I think ... */
42 40
43#define cpu_has_mips32r1 0 41#define cpu_has_mips32r1 0
44#define cpu_has_mips32r2 0 42#define cpu_has_mips32r2 0
diff --git a/include/asm-mips/mach-sim/cpu-feature-overrides.h b/include/asm-mips/mach-sim/cpu-feature-overrides.h
index f86f2751bc0c..d736bdadb6df 100644
--- a/include/asm-mips/mach-sim/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-sim/cpu-feature-overrides.h
@@ -15,7 +15,7 @@
15#ifdef CONFIG_CPU_MIPS32 15#ifdef CONFIG_CPU_MIPS32
16#define cpu_has_tlb 1 16#define cpu_has_tlb 1
17#define cpu_has_4kex 1 17#define cpu_has_4kex 1
18#define cpu_has_4kcache 1 18#define cpu_has_4k_cache 1
19#define cpu_has_fpu 0 19#define cpu_has_fpu 0
20/* #define cpu_has_32fpr ? */ 20/* #define cpu_has_32fpr ? */
21#define cpu_has_counter 1 21#define cpu_has_counter 1
@@ -40,7 +40,7 @@
40#ifdef CONFIG_CPU_MIPS64 40#ifdef CONFIG_CPU_MIPS64
41#define cpu_has_tlb 1 41#define cpu_has_tlb 1
42#define cpu_has_4kex 1 42#define cpu_has_4kex 1
43#define cpu_has_4kcache 1 43#define cpu_has_4k_cache 1
44/* #define cpu_has_fpu ? */ 44/* #define cpu_has_fpu ? */
45/* #define cpu_has_32fpr ? */ 45/* #define cpu_has_32fpr ? */
46#define cpu_has_counter 1 46#define cpu_has_counter 1
diff --git a/include/asm-mips/mach-wrppmc/mach-gt64120.h b/include/asm-mips/mach-wrppmc/mach-gt64120.h
new file mode 100644
index 000000000000..ba9205a04582
--- /dev/null
+++ b/include/asm-mips/mach-wrppmc/mach-gt64120.h
@@ -0,0 +1,84 @@
1/*
2 * This is a direct copy of the ev96100.h file, with a global
3 * search and replace. The numbers are the same.
4 *
5 * The reason I'm duplicating this is so that the 64120/96100
6 * defines won't be confusing in the source code.
7 */
8#ifndef __ASM_MIPS_GT64120_H
9#define __ASM_MIPS_GT64120_H
10
11/*
12 * This is the CPU physical memory map of PPMC Board:
13 *
14 * 0x00000000-0x03FFFFFF - 64MB SDRAM (SCS[0]#)
15 * 0x1C000000-0x1C000000 - LED (CS0)
16 * 0x1C800000-0x1C800007 - UART 16550 port (CS1)
17 * 0x1F000000-0x1F000000 - MailBox (CS3)
18 * 0x1FC00000-0x20000000 - 4MB Flash (BOOT CS)
19 */
20
21#define WRPPMC_SDRAM_SCS0_BASE 0x00000000
22#define WRPPMC_SDRAM_SCS0_SIZE 0x04000000
23
24#define WRPPMC_UART16550_BASE 0x1C800000
25#define WRPPMC_UART16550_CLOCK 3686400 /* 3.68MHZ */
26
27#define WRPPMC_LED_BASE 0x1C000000
28#define WRPPMC_MBOX_BASE 0x1F000000
29
30#define WRPPMC_BOOTROM_BASE 0x1FC00000
31#define WRPPMC_BOOTROM_SIZE 0x00400000 /* 4M Flash */
32
33#define WRPPMC_MIPS_TIMER_IRQ 7 /* MIPS compare/count timer interrupt */
34#define WRPPMC_UART16550_IRQ 6
35#define WRPPMC_PCI_INTA_IRQ 3
36
37/*
38 * PCI Bus I/O and Memory resources allocation
39 *
40 * NOTE: We only have PCI_0 hose interface
41 */
42#define GT_PCI_MEM_BASE 0x13000000UL
43#define GT_PCI_MEM_SIZE 0x02000000UL
44#define GT_PCI_IO_BASE 0x11000000UL
45#define GT_PCI_IO_SIZE 0x02000000UL
46#define GT_ISA_IO_BASE PCI_IO_BASE
47
48/*
49 * PCI interrupts will come in on either the INTA or INTD interrups lines,
50 * which are mapped to the #2 and #5 interrupt pins of the MIPS. On our
51 * boards, they all either come in on IntD or they all come in on IntA, they
52 * aren't mixed. There can be numerous PCI interrupts, so we keep a list of the
53 * "requested" interrupt numbers and go through the list whenever we get an
54 * IntA/D.
55 *
56 * Interrupts < 8 are directly wired to the processor; PCI INTA is 8 and
57 * INTD is 11.
58 */
59#define GT_TIMER 4
60#define GT_INTA 2
61#define GT_INTD 5
62
63#ifndef __ASSEMBLY__
64
65/*
66 * GT64120 internal register space base address
67 */
68extern unsigned long gt64120_base;
69
70#define GT64120_BASE (gt64120_base)
71
72/* define WRPPMC_EARLY_DEBUG to enable early output something to UART */
73#undef WRPPMC_EARLY_DEBUG
74
75#ifdef WRPPMC_EARLY_DEBUG
76extern void wrppmc_led_on(int mask);
77extern void wrppmc_led_off(int mask);
78extern void wrppmc_early_printk(const char *fmt, ...);
79#else
80#define wrppmc_early_printk(fmt, ...) do {} while (0)
81#endif /* WRPPMC_EARLY_DEBUG */
82
83#endif /* __ASSEMBLY__ */
84#endif /* __ASM_MIPS_GT64120_H */
diff --git a/include/asm-mips/mipsregs.h b/include/asm-mips/mipsregs.h
index 87e95b5e27d4..673977901ed3 100644
--- a/include/asm-mips/mipsregs.h
+++ b/include/asm-mips/mipsregs.h
@@ -290,7 +290,7 @@
290#define ST0_DL (_ULCAST_(1) << 24) 290#define ST0_DL (_ULCAST_(1) << 24)
291 291
292/* 292/*
293 * Enable the MIPS DSP ASE 293 * Enable the MIPS MDMX and DSP ASEs
294 */ 294 */
295#define ST0_MX 0x01000000 295#define ST0_MX 0x01000000
296 296
@@ -1450,12 +1450,10 @@ static inline void __emt(unsigned int previous)
1450{ 1450{
1451 if ((previous & __EMT_ENABLE)) 1451 if ((previous & __EMT_ENABLE))
1452 __asm__ __volatile__( 1452 __asm__ __volatile__(
1453 " .set noreorder \n"
1454 " .set mips32r2 \n" 1453 " .set mips32r2 \n"
1455 " .word 0x41600be1 # emt \n" 1454 " .word 0x41600be1 # emt \n"
1456 " ehb \n" 1455 " ehb \n"
1457 " .set mips0 \n" 1456 " .set mips0 \n");
1458 " .set reorder \n");
1459} 1457}
1460 1458
1461static inline void __ehb(void) 1459static inline void __ehb(void)
diff --git a/include/asm-mips/mmzone.h b/include/asm-mips/mmzone.h
index e132975256b2..dc231c89bef9 100644
--- a/include/asm-mips/mmzone.h
+++ b/include/asm-mips/mmzone.h
@@ -13,17 +13,6 @@
13#define kvaddr_to_nid(kvaddr) pa_to_nid(__pa(kvaddr)) 13#define kvaddr_to_nid(kvaddr) pa_to_nid(__pa(kvaddr))
14#define pfn_to_nid(pfn) pa_to_nid((pfn) << PAGE_SHIFT) 14#define pfn_to_nid(pfn) pa_to_nid((pfn) << PAGE_SHIFT)
15 15
16#define pfn_valid(pfn) \
17({ \
18 unsigned long __pfn = (pfn); \
19 int __n = pfn_to_nid(__pfn); \
20 ((__n >= 0) ? (__pfn < NODE_DATA(__n)->node_start_pfn + \
21 NODE_DATA(__n)->node_spanned_pages) : 0);\
22})
23
24/* XXX: FIXME -- wli */
25#define kern_addr_valid(addr) (0)
26
27#endif /* CONFIG_DISCONTIGMEM */ 16#endif /* CONFIG_DISCONTIGMEM */
28 17
29#endif /* _ASM_MMZONE_H_ */ 18#endif /* _ASM_MMZONE_H_ */
diff --git a/include/asm-mips/page.h b/include/asm-mips/page.h
index f2b3314fcabc..6b97744f00cd 100644
--- a/include/asm-mips/page.h
+++ b/include/asm-mips/page.h
@@ -138,9 +138,30 @@ typedef struct { unsigned long pgprot; } pgprot_t;
138 138
139#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) 139#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
140 140
141#ifndef CONFIG_SPARSEMEM
141#ifndef CONFIG_NEED_MULTIPLE_NODES 142#ifndef CONFIG_NEED_MULTIPLE_NODES
142#define pfn_valid(pfn) ((pfn) < max_mapnr) 143#define pfn_valid(pfn) ((pfn) < max_mapnr)
143#endif 144#endif
145#endif
146
147#ifdef CONFIG_FLATMEM
148
149#define pfn_valid(pfn) ((pfn) < max_mapnr)
150
151#elif defined(CONFIG_NEED_MULTIPLE_NODES)
152
153#define pfn_valid(pfn) \
154({ \
155 unsigned long __pfn = (pfn); \
156 int __n = pfn_to_nid(__pfn); \
157 ((__n >= 0) ? (__pfn < NODE_DATA(__n)->node_start_pfn + \
158 NODE_DATA(__n)->node_spanned_pages) \
159 : 0); \
160})
161
162#else
163#error Provide a definition of pfn_valid
164#endif
144 165
145#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) 166#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
146#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) 167#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
diff --git a/include/asm-mips/param.h b/include/asm-mips/param.h
index 2bead8273ced..1d9bb8c5ab24 100644
--- a/include/asm-mips/param.h
+++ b/include/asm-mips/param.h
@@ -11,7 +11,7 @@
11 11
12#ifdef __KERNEL__ 12#ifdef __KERNEL__
13 13
14# include <param.h> /* Internal kernel timer frequency */ 14# define HZ CONFIG_HZ /* Internal kernel timer frequency */
15# define USER_HZ 100 /* .. some user interfaces are in "ticks" */ 15# define USER_HZ 100 /* .. some user interfaces are in "ticks" */
16# define CLOCKS_PER_SEC (USER_HZ) /* like times() */ 16# define CLOCKS_PER_SEC (USER_HZ) /* like times() */
17#endif 17#endif
diff --git a/include/asm-mips/pci/bridge.h b/include/asm-mips/pci/bridge.h
index b4ee995c56e6..0c45e7598f3f 100644
--- a/include/asm-mips/pci/bridge.h
+++ b/include/asm-mips/pci/bridge.h
@@ -15,6 +15,7 @@
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/pci.h> 16#include <linux/pci.h>
17#include <asm/xtalk/xwidget.h> /* generic widget header */ 17#include <asm/xtalk/xwidget.h> /* generic widget header */
18#include <asm/sn/types.h>
18 19
19/* I/O page size */ 20/* I/O page size */
20 21
@@ -848,4 +849,6 @@ struct bridge_controller {
848extern void register_bridge_irq(unsigned int irq); 849extern void register_bridge_irq(unsigned int irq);
849extern int request_bridge_irq(struct bridge_controller *bc); 850extern int request_bridge_irq(struct bridge_controller *bc);
850 851
852extern struct pci_ops bridge_pci_ops;
853
851#endif /* _ASM_PCI_BRIDGE_H */ 854#endif /* _ASM_PCI_BRIDGE_H */
diff --git a/include/asm-mips/pgtable-32.h b/include/asm-mips/pgtable-32.h
index e1c0e88f03f5..4b26d8528133 100644
--- a/include/asm-mips/pgtable-32.h
+++ b/include/asm-mips/pgtable-32.h
@@ -176,48 +176,67 @@ pfn_pte(unsigned long pfn, pgprot_t prot)
176 ((swp_entry_t) { ((type) << 10) | ((offset) << 15) }) 176 ((swp_entry_t) { ((type) << 10) | ((offset) << 15) })
177 177
178/* 178/*
179 * Bits 0, 1, 2, 9 and 10 are taken, split up the 27 bits of offset 179 * Bits 0, 4, 8, and 9 are taken, split up 28 bits of offset into this range:
180 * into this range:
181 */ 180 */
182#define PTE_FILE_MAX_BITS 27 181#define PTE_FILE_MAX_BITS 28
183 182
184#define pte_to_pgoff(_pte) \ 183#define pte_to_pgoff(_pte) ((((_pte).pte >> 1 ) & 0x07) | \
185 ((((_pte).pte >> 3) & 0x3f ) + (((_pte).pte >> 11) << 8 )) 184 (((_pte).pte >> 2 ) & 0x38) | \
185 (((_pte).pte >> 10) << 6 ))
186 186
187#define pgoff_to_pte(off) \ 187#define pgoff_to_pte(off) ((pte_t) { (((off) & 0x07) << 1 ) | \
188 ((pte_t) { (((off) & 0x3f) << 3) + (((off) >> 8) << 11) + _PAGE_FILE }) 188 (((off) & 0x38) << 2 ) | \
189 (((off) >> 6 ) << 10) | \
190 _PAGE_FILE })
189 191
190#else 192#else
191 193
192/* Swap entries must have VALID and GLOBAL bits cleared. */ 194/* Swap entries must have VALID and GLOBAL bits cleared. */
195#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32)
196#define __swp_type(x) (((x).val >> 2) & 0x1f)
197#define __swp_offset(x) ((x).val >> 7)
198#define __swp_entry(type,offset) \
199 ((swp_entry_t) { ((type) << 2) | ((offset) << 7) })
200#else
193#define __swp_type(x) (((x).val >> 8) & 0x1f) 201#define __swp_type(x) (((x).val >> 8) & 0x1f)
194#define __swp_offset(x) ((x).val >> 13) 202#define __swp_offset(x) ((x).val >> 13)
195#define __swp_entry(type,offset) \ 203#define __swp_entry(type,offset) \
196 ((swp_entry_t) { ((type) << 8) | ((offset) << 13) }) 204 ((swp_entry_t) { ((type) << 8) | ((offset) << 13) })
205#endif /* defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) */
197 206
207#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32)
198/* 208/*
199 * Bits 0, 1, 2, 7 and 8 are taken, split up the 27 bits of offset 209 * Bits 0 and 1 of pte_high are taken, use the rest for the page offset...
200 * into this range:
201 */ 210 */
202#define PTE_FILE_MAX_BITS 27 211#define PTE_FILE_MAX_BITS 30
203 212
204#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1) 213#define pte_to_pgoff(_pte) ((_pte).pte_high >> 2)
205 /* fixme */ 214#define pgoff_to_pte(off) ((pte_t) { _PAGE_FILE, (off) << 2 })
206#define pte_to_pgoff(_pte) (((_pte).pte_high >> 6) + ((_pte).pte_high & 0x3f))
207#define pgoff_to_pte(off) \
208 ((pte_t){(((off) & 0x3f) + ((off) << 6) + _PAGE_FILE)})
209 215
210#else 216#else
211#define pte_to_pgoff(_pte) \ 217/*
212 ((((_pte).pte >> 3) & 0x1f ) + (((_pte).pte >> 9) << 6 )) 218 * Bits 0, 4, 6, and 7 are taken, split up 28 bits of offset into this range:
219 */
220#define PTE_FILE_MAX_BITS 28
221
222#define pte_to_pgoff(_pte) ((((_pte).pte >> 1) & 0x7) | \
223 (((_pte).pte >> 2) & 0x8) | \
224 (((_pte).pte >> 8) << 4))
213 225
214#define pgoff_to_pte(off) \ 226#define pgoff_to_pte(off) ((pte_t) { (((off) & 0x7) << 1) | \
215 ((pte_t) { (((off) & 0x1f) << 3) + (((off) >> 6) << 9) + _PAGE_FILE }) 227 (((off) & 0x8) << 2) | \
228 (((off) >> 4) << 8) | \
229 _PAGE_FILE })
216#endif 230#endif
217 231
218#endif 232#endif
219 233
234#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32)
235#define __pte_to_swp_entry(pte) ((swp_entry_t) { (pte).pte_high })
236#define __swp_entry_to_pte(x) ((pte_t) { 0, (x).val })
237#else
220#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) 238#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
221#define __swp_entry_to_pte(x) ((pte_t) { (x).val }) 239#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
240#endif
222 241
223#endif /* _ASM_PGTABLE_32_H */ 242#endif /* _ASM_PGTABLE_32_H */
diff --git a/include/asm-mips/pgtable-64.h b/include/asm-mips/pgtable-64.h
index 0ae30d56d019..e3db93212eab 100644
--- a/include/asm-mips/pgtable-64.h
+++ b/include/asm-mips/pgtable-64.h
@@ -223,15 +223,12 @@ static inline pte_t mk_swap_pte(unsigned long type, unsigned long offset)
223#define __swp_entry_to_pte(x) ((pte_t) { (x).val }) 223#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
224 224
225/* 225/*
226 * Bits 0, 1, 2, 7 and 8 are taken, split up the 32 bits of offset 226 * Bits 0, 4, 6, and 7 are taken. Let's leave bits 1, 2, 3, and 5 alone to
227 * into this range: 227 * make things easier, and only use the upper 56 bits for the page offset...
228 */ 228 */
229#define PTE_FILE_MAX_BITS 32 229#define PTE_FILE_MAX_BITS 56
230 230
231#define pte_to_pgoff(_pte) \ 231#define pte_to_pgoff(_pte) ((_pte).pte >> 8)
232 ((((_pte).pte >> 3) & 0x1f ) + (((_pte).pte >> 9) << 6 )) 232#define pgoff_to_pte(off) ((pte_t) { ((off) << 8) | _PAGE_FILE })
233
234#define pgoff_to_pte(off) \
235 ((pte_t) { (((off) & 0x1f) << 3) + (((off) >> 6) << 9) + _PAGE_FILE })
236 233
237#endif /* _ASM_PGTABLE_64_H */ 234#endif /* _ASM_PGTABLE_64_H */
diff --git a/include/asm-mips/pgtable.h b/include/asm-mips/pgtable.h
index d02b47933d7f..a36ca1be17f2 100644
--- a/include/asm-mips/pgtable.h
+++ b/include/asm-mips/pgtable.h
@@ -69,7 +69,15 @@ extern unsigned long zero_page_mask;
69#define ZERO_PAGE(vaddr) \ 69#define ZERO_PAGE(vaddr) \
70 (virt_to_page(empty_zero_page + (((unsigned long)(vaddr)) & zero_page_mask))) 70 (virt_to_page(empty_zero_page + (((unsigned long)(vaddr)) & zero_page_mask)))
71 71
72#define __HAVE_ARCH_MULTIPLE_ZERO_PAGE 72#define __HAVE_ARCH_MOVE_PTE
73#define move_pte(pte, prot, old_addr, new_addr) \
74({ \
75 pte_t newpte = (pte); \
76 if (pte_present(pte) && pfn_valid(pte_pfn(pte)) && \
77 pte_page(pte) == ZERO_PAGE(old_addr)) \
78 newpte = mk_pte(ZERO_PAGE(new_addr), (prot)); \
79 newpte; \
80})
73 81
74extern void paging_init(void); 82extern void paging_init(void);
75 83
@@ -81,10 +89,11 @@ extern void paging_init(void);
81#define pmd_page(pmd) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT)) 89#define pmd_page(pmd) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT))
82#define pmd_page_kernel(pmd) pmd_val(pmd) 90#define pmd_page_kernel(pmd) pmd_val(pmd)
83 91
84#define pte_none(pte) (!(pte_val(pte) & ~_PAGE_GLOBAL))
85#define pte_present(pte) (pte_val(pte) & _PAGE_PRESENT)
86
87#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1) 92#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1)
93
94#define pte_none(pte) (!(((pte).pte_low | (pte).pte_high) & ~_PAGE_GLOBAL))
95#define pte_present(pte) ((pte).pte_low & _PAGE_PRESENT)
96
88static inline void set_pte(pte_t *ptep, pte_t pte) 97static inline void set_pte(pte_t *ptep, pte_t pte)
89{ 98{
90 ptep->pte_high = pte.pte_high; 99 ptep->pte_high = pte.pte_high;
@@ -92,27 +101,35 @@ static inline void set_pte(pte_t *ptep, pte_t pte)
92 ptep->pte_low = pte.pte_low; 101 ptep->pte_low = pte.pte_low;
93 //printk("pte_high %x pte_low %x\n", ptep->pte_high, ptep->pte_low); 102 //printk("pte_high %x pte_low %x\n", ptep->pte_high, ptep->pte_low);
94 103
95 if (pte_val(pte) & _PAGE_GLOBAL) { 104 if (pte.pte_low & _PAGE_GLOBAL) {
96 pte_t *buddy = ptep_buddy(ptep); 105 pte_t *buddy = ptep_buddy(ptep);
97 /* 106 /*
98 * Make sure the buddy is global too (if it's !none, 107 * Make sure the buddy is global too (if it's !none,
99 * it better already be global) 108 * it better already be global)
100 */ 109 */
101 if (pte_none(*buddy)) 110 if (pte_none(*buddy)) {
102 buddy->pte_low |= _PAGE_GLOBAL; 111 buddy->pte_low |= _PAGE_GLOBAL;
112 buddy->pte_high |= _PAGE_GLOBAL;
113 }
103 } 114 }
104} 115}
105#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval) 116#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
106 117
107static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) 118static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
108{ 119{
120 pte_t null = __pte(0);
121
109 /* Preserve global status for the pair */ 122 /* Preserve global status for the pair */
110 if (pte_val(*ptep_buddy(ptep)) & _PAGE_GLOBAL) 123 if (ptep_buddy(ptep)->pte_low & _PAGE_GLOBAL)
111 set_pte_at(mm, addr, ptep, __pte(_PAGE_GLOBAL)); 124 null.pte_low = null.pte_high = _PAGE_GLOBAL;
112 else 125
113 set_pte_at(mm, addr, ptep, __pte(0)); 126 set_pte_at(mm, addr, ptep, null);
114} 127}
115#else 128#else
129
130#define pte_none(pte) (!(pte_val(pte) & ~_PAGE_GLOBAL))
131#define pte_present(pte) (pte_val(pte) & _PAGE_PRESENT)
132
116/* 133/*
117 * Certain architectures need to do special things when pte's 134 * Certain architectures need to do special things when pte's
118 * within a page table are directly modified. Thus, the following 135 * within a page table are directly modified. Thus, the following
@@ -173,75 +190,76 @@ extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
173 */ 190 */
174static inline int pte_user(pte_t pte) { BUG(); return 0; } 191static inline int pte_user(pte_t pte) { BUG(); return 0; }
175#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1) 192#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1)
176static inline int pte_read(pte_t pte) { return (pte).pte_low & _PAGE_READ; } 193static inline int pte_read(pte_t pte) { return pte.pte_low & _PAGE_READ; }
177static inline int pte_write(pte_t pte) { return (pte).pte_low & _PAGE_WRITE; } 194static inline int pte_write(pte_t pte) { return pte.pte_low & _PAGE_WRITE; }
178static inline int pte_dirty(pte_t pte) { return (pte).pte_low & _PAGE_MODIFIED; } 195static inline int pte_dirty(pte_t pte) { return pte.pte_low & _PAGE_MODIFIED; }
179static inline int pte_young(pte_t pte) { return (pte).pte_low & _PAGE_ACCESSED; } 196static inline int pte_young(pte_t pte) { return pte.pte_low & _PAGE_ACCESSED; }
180static inline int pte_file(pte_t pte) { return (pte).pte_low & _PAGE_FILE; } 197static inline int pte_file(pte_t pte) { return pte.pte_low & _PAGE_FILE; }
198
181static inline pte_t pte_wrprotect(pte_t pte) 199static inline pte_t pte_wrprotect(pte_t pte)
182{ 200{
183 (pte).pte_low &= ~(_PAGE_WRITE | _PAGE_SILENT_WRITE); 201 pte.pte_low &= ~(_PAGE_WRITE | _PAGE_SILENT_WRITE);
184 (pte).pte_high &= ~_PAGE_SILENT_WRITE; 202 pte.pte_high &= ~_PAGE_SILENT_WRITE;
185 return pte; 203 return pte;
186} 204}
187 205
188static inline pte_t pte_rdprotect(pte_t pte) 206static inline pte_t pte_rdprotect(pte_t pte)
189{ 207{
190 (pte).pte_low &= ~(_PAGE_READ | _PAGE_SILENT_READ); 208 pte.pte_low &= ~(_PAGE_READ | _PAGE_SILENT_READ);
191 (pte).pte_high &= ~_PAGE_SILENT_READ; 209 pte.pte_high &= ~_PAGE_SILENT_READ;
192 return pte; 210 return pte;
193} 211}
194 212
195static inline pte_t pte_mkclean(pte_t pte) 213static inline pte_t pte_mkclean(pte_t pte)
196{ 214{
197 (pte).pte_low &= ~(_PAGE_MODIFIED|_PAGE_SILENT_WRITE); 215 pte.pte_low &= ~(_PAGE_MODIFIED | _PAGE_SILENT_WRITE);
198 (pte).pte_high &= ~_PAGE_SILENT_WRITE; 216 pte.pte_high &= ~_PAGE_SILENT_WRITE;
199 return pte; 217 return pte;
200} 218}
201 219
202static inline pte_t pte_mkold(pte_t pte) 220static inline pte_t pte_mkold(pte_t pte)
203{ 221{
204 (pte).pte_low &= ~(_PAGE_ACCESSED|_PAGE_SILENT_READ); 222 pte.pte_low &= ~(_PAGE_ACCESSED | _PAGE_SILENT_READ);
205 (pte).pte_high &= ~_PAGE_SILENT_READ; 223 pte.pte_high &= ~_PAGE_SILENT_READ;
206 return pte; 224 return pte;
207} 225}
208 226
209static inline pte_t pte_mkwrite(pte_t pte) 227static inline pte_t pte_mkwrite(pte_t pte)
210{ 228{
211 (pte).pte_low |= _PAGE_WRITE; 229 pte.pte_low |= _PAGE_WRITE;
212 if ((pte).pte_low & _PAGE_MODIFIED) { 230 if (pte.pte_low & _PAGE_MODIFIED) {
213 (pte).pte_low |= _PAGE_SILENT_WRITE; 231 pte.pte_low |= _PAGE_SILENT_WRITE;
214 (pte).pte_high |= _PAGE_SILENT_WRITE; 232 pte.pte_high |= _PAGE_SILENT_WRITE;
215 } 233 }
216 return pte; 234 return pte;
217} 235}
218 236
219static inline pte_t pte_mkread(pte_t pte) 237static inline pte_t pte_mkread(pte_t pte)
220{ 238{
221 (pte).pte_low |= _PAGE_READ; 239 pte.pte_low |= _PAGE_READ;
222 if ((pte).pte_low & _PAGE_ACCESSED) { 240 if (pte.pte_low & _PAGE_ACCESSED) {
223 (pte).pte_low |= _PAGE_SILENT_READ; 241 pte.pte_low |= _PAGE_SILENT_READ;
224 (pte).pte_high |= _PAGE_SILENT_READ; 242 pte.pte_high |= _PAGE_SILENT_READ;
225 } 243 }
226 return pte; 244 return pte;
227} 245}
228 246
229static inline pte_t pte_mkdirty(pte_t pte) 247static inline pte_t pte_mkdirty(pte_t pte)
230{ 248{
231 (pte).pte_low |= _PAGE_MODIFIED; 249 pte.pte_low |= _PAGE_MODIFIED;
232 if ((pte).pte_low & _PAGE_WRITE) { 250 if (pte.pte_low & _PAGE_WRITE) {
233 (pte).pte_low |= _PAGE_SILENT_WRITE; 251 pte.pte_low |= _PAGE_SILENT_WRITE;
234 (pte).pte_high |= _PAGE_SILENT_WRITE; 252 pte.pte_high |= _PAGE_SILENT_WRITE;
235 } 253 }
236 return pte; 254 return pte;
237} 255}
238 256
239static inline pte_t pte_mkyoung(pte_t pte) 257static inline pte_t pte_mkyoung(pte_t pte)
240{ 258{
241 (pte).pte_low |= _PAGE_ACCESSED; 259 pte.pte_low |= _PAGE_ACCESSED;
242 if ((pte).pte_low & _PAGE_READ) 260 if (pte.pte_low & _PAGE_READ)
243 (pte).pte_low |= _PAGE_SILENT_READ; 261 pte.pte_low |= _PAGE_SILENT_READ;
244 (pte).pte_high |= _PAGE_SILENT_READ; 262 pte.pte_high |= _PAGE_SILENT_READ;
245 return pte; 263 return pte;
246} 264}
247#else 265#else
@@ -334,8 +352,9 @@ static inline pgprot_t pgprot_noncached(pgprot_t _prot)
334#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1) 352#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1)
335static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) 353static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
336{ 354{
337 pte.pte_low &= _PAGE_CHG_MASK; 355 pte.pte_low &= _PAGE_CHG_MASK;
338 pte.pte_low |= pgprot_val(newprot); 356 pte.pte_high &= ~0x3f;
357 pte.pte_low |= pgprot_val(newprot);
339 pte.pte_high |= pgprot_val(newprot) & 0x3f; 358 pte.pte_high |= pgprot_val(newprot) & 0x3f;
340 return pte; 359 return pte;
341} 360}
@@ -359,9 +378,7 @@ static inline void update_mmu_cache(struct vm_area_struct *vma,
359 __update_cache(vma, address, pte); 378 __update_cache(vma, address, pte);
360} 379}
361 380
362#ifndef CONFIG_NEED_MULTIPLE_NODES
363#define kern_addr_valid(addr) (1) 381#define kern_addr_valid(addr) (1)
364#endif
365 382
366#ifdef CONFIG_64BIT_PHYS_ADDR 383#ifdef CONFIG_64BIT_PHYS_ADDR
367extern int remap_pfn_range(struct vm_area_struct *vma, unsigned long from, unsigned long pfn, unsigned long size, pgprot_t prot); 384extern int remap_pfn_range(struct vm_area_struct *vma, unsigned long from, unsigned long pfn, unsigned long size, pgprot_t prot);
diff --git a/include/asm-mips/processor.h b/include/asm-mips/processor.h
index 532df530b4ec..5f80ba71ab92 100644
--- a/include/asm-mips/processor.h
+++ b/include/asm-mips/processor.h
@@ -70,11 +70,6 @@ extern unsigned int vced_count, vcei_count;
70 70
71typedef __u64 fpureg_t; 71typedef __u64 fpureg_t;
72 72
73struct mips_fpu_hard_struct {
74 fpureg_t fpr[NUM_FPU_REGS];
75 unsigned int fcr31;
76};
77
78/* 73/*
79 * It would be nice to add some more fields for emulator statistics, but there 74 * It would be nice to add some more fields for emulator statistics, but there
80 * are a number of fixed offsets in offset.h and elsewhere that would have to 75 * are a number of fixed offsets in offset.h and elsewhere that would have to
@@ -82,18 +77,13 @@ struct mips_fpu_hard_struct {
82 * the FPU emulator for now. See asm-mips/fpu_emulator.h. 77 * the FPU emulator for now. See asm-mips/fpu_emulator.h.
83 */ 78 */
84 79
85struct mips_fpu_soft_struct { 80struct mips_fpu_struct {
86 fpureg_t fpr[NUM_FPU_REGS]; 81 fpureg_t fpr[NUM_FPU_REGS];
87 unsigned int fcr31; 82 unsigned int fcr31;
88}; 83};
89 84
90union mips_fpu_union {
91 struct mips_fpu_hard_struct hard;
92 struct mips_fpu_soft_struct soft;
93};
94
95#define INIT_FPU { \ 85#define INIT_FPU { \
96 {{0,},} \ 86 {0,} \
97} 87}
98 88
99#define NUM_DSP_REGS 6 89#define NUM_DSP_REGS 6
@@ -132,7 +122,7 @@ struct thread_struct {
132 unsigned long cp0_status; 122 unsigned long cp0_status;
133 123
134 /* Saved fpu/fpu emulator stuff. */ 124 /* Saved fpu/fpu emulator stuff. */
135 union mips_fpu_union fpu; 125 struct mips_fpu_struct fpu;
136#ifdef CONFIG_MIPS_MT_FPAFF 126#ifdef CONFIG_MIPS_MT_FPAFF
137 /* Emulated instruction count */ 127 /* Emulated instruction count */
138 unsigned long emulated_fp; 128 unsigned long emulated_fp;
diff --git a/include/asm-mips/qemu.h b/include/asm-mips/qemu.h
index 905c39585903..531caf44560c 100644
--- a/include/asm-mips/qemu.h
+++ b/include/asm-mips/qemu.h
@@ -21,4 +21,10 @@
21 */ 21 */
22#define QEMU_C0_COUNTER_CLOCK 100000000 22#define QEMU_C0_COUNTER_CLOCK 100000000
23 23
24/*
25 * Magic qemu system control location.
26 */
27#define QEMU_RESTART_REG 0xBFBF0000
28#define QEMU_HALT_REG 0xBFBF0004
29
24#endif /* __ASM_QEMU_H */ 30#endif /* __ASM_QEMU_H */
diff --git a/include/asm-mips/rm9k-ocd.h b/include/asm-mips/rm9k-ocd.h
new file mode 100644
index 000000000000..b0b80d9ecf96
--- /dev/null
+++ b/include/asm-mips/rm9k-ocd.h
@@ -0,0 +1,56 @@
1/*
2 * Copyright (C) 2004 by Basler Vision Technologies AG
3 * Author: Thomas Koeller <thomas.koeller@baslerweb.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#if !defined(_ASM_RM9K_OCD_H)
21#define _ASM_RM9K_OCD_H
22
23#include <linux/types.h>
24#include <linux/spinlock.h>
25#include <asm/io.h>
26
27extern volatile void __iomem * const ocd_base;
28extern volatile void __iomem * const titan_base;
29
30#define ocd_addr(__x__) (ocd_base + (__x__))
31#define titan_addr(__x__) (titan_base + (__x__))
32#define scram_addr(__x__) (scram_base + (__x__))
33
34/* OCD register access */
35#define ocd_readl(__offs__) __raw_readl(ocd_addr(__offs__))
36#define ocd_readw(__offs__) __raw_readw(ocd_addr(__offs__))
37#define ocd_readb(__offs__) __raw_readb(ocd_addr(__offs__))
38#define ocd_writel(__val__, __offs__) \
39 __raw_writel((__val__), ocd_addr(__offs__))
40#define ocd_writew(__val__, __offs__) \
41 __raw_writew((__val__), ocd_addr(__offs__))
42#define ocd_writeb(__val__, __offs__) \
43 __raw_writeb((__val__), ocd_addr(__offs__))
44
45/* TITAN register access - 32 bit-wide only */
46#define titan_readl(__offs__) __raw_readl(titan_addr(__offs__))
47#define titan_writel(__val__, __offs__) \
48 __raw_writel((__val__), titan_addr(__offs__))
49
50/* Protect access to shared TITAN registers */
51extern spinlock_t titan_lock;
52extern int titan_irqflags;
53#define lock_titan_regs() spin_lock_irqsave(&titan_lock, titan_irqflags)
54#define unlock_titan_regs() spin_unlock_irqrestore(&titan_lock, titan_irqflags)
55
56#endif /* !defined(_ASM_RM9K_OCD_H) */
diff --git a/include/asm-mips/sigcontext.h b/include/asm-mips/sigcontext.h
index 8edabb0be23f..cefa657dd04a 100644
--- a/include/asm-mips/sigcontext.h
+++ b/include/asm-mips/sigcontext.h
@@ -55,8 +55,14 @@ struct sigcontext {
55struct sigcontext { 55struct sigcontext {
56 unsigned long sc_regs[32]; 56 unsigned long sc_regs[32];
57 unsigned long sc_fpregs[32]; 57 unsigned long sc_fpregs[32];
58 unsigned long sc_hi[4]; 58 unsigned long sc_mdhi;
59 unsigned long sc_lo[4]; 59 unsigned long sc_hi1;
60 unsigned long sc_hi2;
61 unsigned long sc_hi3;
62 unsigned long sc_mdlo;
63 unsigned long sc_lo1;
64 unsigned long sc_lo2;
65 unsigned long sc_lo3;
60 unsigned long sc_pc; 66 unsigned long sc_pc;
61 unsigned int sc_fpc_csr; 67 unsigned int sc_fpc_csr;
62 unsigned int sc_used_math; 68 unsigned int sc_used_math;
diff --git a/include/asm-mips/smp.h b/include/asm-mips/smp.h
index ffcb7a336b17..1608fd71d6f7 100644
--- a/include/asm-mips/smp.h
+++ b/include/asm-mips/smp.h
@@ -47,7 +47,6 @@ extern struct call_data_struct *call_data;
47#define SMP_CALL_FUNCTION 0x2 47#define SMP_CALL_FUNCTION 0x2
48 48
49extern cpumask_t phys_cpu_present_map; 49extern cpumask_t phys_cpu_present_map;
50extern cpumask_t cpu_online_map;
51#define cpu_possible_map phys_cpu_present_map 50#define cpu_possible_map phys_cpu_present_map
52 51
53extern cpumask_t cpu_callout_map; 52extern cpumask_t cpu_callout_map;
@@ -85,9 +84,9 @@ extern void prom_init_secondary(void);
85extern void plat_smp_setup(void); 84extern void plat_smp_setup(void);
86 85
87/* 86/*
88 * Called after init_IRQ but before __cpu_up. 87 * Called in smp_prepare_cpus.
89 */ 88 */
90extern void prom_prepare_cpus(unsigned int max_cpus); 89extern void plat_prepare_cpus(unsigned int max_cpus);
91 90
92/* 91/*
93 * Last chance for the board code to finish SMP initialization before 92 * Last chance for the board code to finish SMP initialization before
diff --git a/include/asm-mips/sn/addrs.h b/include/asm-mips/sn/addrs.h
index 3f6891b0c0ea..8fa0af6b68d2 100644
--- a/include/asm-mips/sn/addrs.h
+++ b/include/asm-mips/sn/addrs.h
@@ -26,13 +26,8 @@
26 26
27#ifndef __ASSEMBLY__ 27#ifndef __ASSEMBLY__
28 28
29#if defined(CONFIG_SGI_IO) /* FIXME */
30#define PS_UINT_CAST (__psunsigned_t)
31#define UINT64_CAST (__uint64_t)
32#else /* CONFIG_SGI_IO */
33#define PS_UINT_CAST (unsigned long) 29#define PS_UINT_CAST (unsigned long)
34#define UINT64_CAST (unsigned long) 30#define UINT64_CAST (unsigned long)
35#endif /* CONFIG_SGI_IO */
36 31
37#define HUBREG_CAST (volatile hubreg_t *) 32#define HUBREG_CAST (volatile hubreg_t *)
38 33
@@ -252,14 +247,6 @@
252 * for _x. 247 * for _x.
253 */ 248 */
254 249
255#ifdef _STANDALONE
256
257/* DO NOT USE THESE DIRECTLY IN THE KERNEL. SEE BELOW. */
258#define LOCAL_HUB(_x) (HUBREG_CAST (IALIAS_BASE + (_x)))
259#define REMOTE_HUB(_n, _x) (HUBREG_CAST (NODE_SWIN_BASE(_n, 1) + \
260 0x800000 + (_x)))
261#endif /* _STANDALONE */
262
263/* 250/*
264 * WARNING: 251 * WARNING:
265 * When certain Hub chip workaround are defined, it's not sufficient 252 * When certain Hub chip workaround are defined, it's not sufficient
@@ -326,20 +313,6 @@
326 PHYS_TO_K0(NODE_OFFSET(nasid) | ARCS_SPB_OFFSET) 313 PHYS_TO_K0(NODE_OFFSET(nasid) | ARCS_SPB_OFFSET)
327#define ARCS_SPB_SIZE 0x0400 314#define ARCS_SPB_SIZE 0x0400
328 315
329#ifdef _STANDALONE
330
331#define ARCS_TVECTOR_OFFSET 0x2800
332#define ARCS_PVECTOR_OFFSET 0x2c00
333
334/*
335 * These addresses are used by the master CPU to install the transfer
336 * and private vectors. All others use the SPB to find them.
337 */
338#define TVADDR (NODE_CAC_BASE(get_nasid()) + ARCS_TVECTOR_OFFSET)
339#define PVADDR (NODE_CAC_BASE(get_nasid()) + ARCS_PVECTOR_OFFSET)
340
341#endif /* _STANDALONE */
342
343#define KLDIR_OFFSET 0x2000 316#define KLDIR_OFFSET 0x2000
344#define KLDIR_ADDR(nasid) \ 317#define KLDIR_ADDR(nasid) \
345 TO_NODE_UNCAC((nasid), KLDIR_OFFSET) 318 TO_NODE_UNCAC((nasid), KLDIR_OFFSET)
diff --git a/include/asm-mips/sn/sn0/sn0_fru.h b/include/asm-mips/sn/fru.h
index 82c6377c275a..b3e3606723b7 100644
--- a/include/asm-mips/sn/sn0/sn0_fru.h
+++ b/include/asm-mips/sn/fru.h
@@ -6,10 +6,10 @@
6 * Derived from IRIX <sys/SN/SN0/sn0_fru.h> 6 * Derived from IRIX <sys/SN/SN0/sn0_fru.h>
7 * 7 *
8 * Copyright (C) 1992 - 1997, 1999 Silcon Graphics, Inc. 8 * Copyright (C) 1992 - 1997, 1999 Silcon Graphics, Inc.
9 * Copyright (C) 1999 Ralf Baechle (ralf@gnu.org) 9 * Copyright (C) 1999, 2006 Ralf Baechle (ralf@linux-mips)
10 */ 10 */
11#ifndef _ASM_SN_SN0_SN0_FRU_H 11#ifndef __ASM_SN_FRU_H
12#define _ASM_SN_SN0_SN0_FRU_H 12#define __ASM_SN_FRU_H
13 13
14#define MAX_DIMMS 8 /* max # of dimm banks */ 14#define MAX_DIMMS 8 /* max # of dimm banks */
15#define MAX_PCIDEV 8 /* max # of pci devices on a pci bus */ 15#define MAX_PCIDEV 8 /* max # of pci devices on a pci bus */
@@ -41,4 +41,4 @@ typedef struct kf_pci_bus_s {
41 /* confidence level that the pci dev is bad */ 41 /* confidence level that the pci dev is bad */
42} kf_pci_bus_t; 42} kf_pci_bus_t;
43 43
44#endif /* _ASM_SN_SN0_SN0_FRU_H */ 44#endif /* __ASM_SN_FRU_H */
diff --git a/include/asm-mips/sn/klconfig.h b/include/asm-mips/sn/klconfig.h
index 19e0e926be55..52238e65af8e 100644
--- a/include/asm-mips/sn/klconfig.h
+++ b/include/asm-mips/sn/klconfig.h
@@ -36,7 +36,7 @@
36//#include <sys/SN/router.h> 36//#include <sys/SN/router.h>
37// XXX Stolen from <sys/SN/router.h>: 37// XXX Stolen from <sys/SN/router.h>:
38#define MAX_ROUTER_PORTS (6) /* Max. number of ports on a router */ 38#define MAX_ROUTER_PORTS (6) /* Max. number of ports on a router */
39#include <asm/sn/sn0/sn0_fru.h> 39#include <asm/sn/fru.h>
40//#include <sys/graph.h> 40//#include <sys/graph.h>
41//#include <sys/xtalk/xbow.h> 41//#include <sys/xtalk/xbow.h>
42 42
@@ -53,32 +53,21 @@
53#include <asm/sn/agent.h> 53#include <asm/sn/agent.h>
54#include <asm/arc/types.h> 54#include <asm/arc/types.h>
55#include <asm/arc/hinv.h> 55#include <asm/arc/hinv.h>
56#if defined(CONFIG_SGI_IO) || defined(CONFIG_SGI_IP35) 56#if defined(CONFIG_SGI_IP35)
57// The hack file has to be before vector and after sn0_fru.... 57// The hack file has to be before vector and after sn0_fru....
58#include <asm/hack.h> 58#include <asm/hack.h>
59#include <asm/sn/vector.h> 59#include <asm/sn/vector.h>
60#include <asm/xtalk/xtalk.h> 60#include <asm/xtalk/xtalk.h>
61#endif /* CONFIG_SGI_IO || CONFIG_SGI_IP35 */ 61#endif /* CONFIG_SGI_IP35 */
62#endif /* CONFIG_SGI_IP27 || CONFIG_SGI_IP35 */ 62#endif /* CONFIG_SGI_IP27 || CONFIG_SGI_IP35 */
63 63
64#define KLCFGINFO_MAGIC 0xbeedbabe 64#define KLCFGINFO_MAGIC 0xbeedbabe
65 65
66#ifdef FRUTEST
67typedef u64 klconf_off_t;
68#else
69typedef s32 klconf_off_t; 66typedef s32 klconf_off_t;
70#endif
71 67
72/* 68/*
73 * Some IMPORTANT OFFSETS. These are the offsets on all NODES. 69 * Some IMPORTANT OFFSETS. These are the offsets on all NODES.
74 */ 70 */
75#if 0
76#define RAMBASE 0
77#define ARCSSPB_OFF 0x1000 /* shift it to sys/arcs/spb.h */
78
79#define OFF_HWGRAPH 0
80#endif
81
82#define MAX_MODULE_ID 255 71#define MAX_MODULE_ID 255
83#define SIZE_PAD 4096 /* 4k padding for structures */ 72#define SIZE_PAD 4096 /* 4k padding for structures */
84/* 73/*
@@ -133,15 +122,9 @@ typedef s32 klconf_off_t;
133 122
134 123
135typedef struct console_s { 124typedef struct console_s {
136#if defined(CONFIG_SGI_IO) /* FIXME */
137 __psunsigned_t uart_base;
138 __psunsigned_t config_base;
139 __psunsigned_t memory_base;
140#else
141 unsigned long uart_base; 125 unsigned long uart_base;
142 unsigned long config_base; 126 unsigned long config_base;
143 unsigned long memory_base; 127 unsigned long memory_base;
144#endif
145 short baud; 128 short baud;
146 short flag; 129 short flag;
147 int type; 130 int type;
@@ -173,10 +156,6 @@ typedef struct kl_config_hdr {
173 156
174 157
175#define KL_CONFIG_HDR(_nasid) ((kl_config_hdr_t *)(KLCONFIG_ADDR(_nasid))) 158#define KL_CONFIG_HDR(_nasid) ((kl_config_hdr_t *)(KLCONFIG_ADDR(_nasid)))
176#if 0
177#define KL_CONFIG_MALLOC_HDR(_nasid) \
178 (KL_CONFIG_HDR(_nasid)->ch_malloc_hdr)
179#endif
180#define KL_CONFIG_INFO_OFFSET(_nasid) \ 159#define KL_CONFIG_INFO_OFFSET(_nasid) \
181 (KL_CONFIG_HDR(_nasid)->ch_board_info) 160 (KL_CONFIG_HDR(_nasid)->ch_board_info)
182#define KL_CONFIG_INFO_SET_OFFSET(_nasid, _off) \ 161#define KL_CONFIG_INFO_SET_OFFSET(_nasid, _off) \
@@ -196,23 +175,13 @@ typedef struct kl_config_hdr {
196 175
197/* --- New Macros for the changed kl_config_hdr_t structure --- */ 176/* --- New Macros for the changed kl_config_hdr_t structure --- */
198 177
199#if defined(CONFIG_SGI_IO)
200#define PTR_CH_MALLOC_HDR(_k) ((klc_malloc_hdr_t *)\
201 ((__psunsigned_t)_k + (_k->ch_malloc_hdr_off)))
202#else
203#define PTR_CH_MALLOC_HDR(_k) ((klc_malloc_hdr_t *)\ 178#define PTR_CH_MALLOC_HDR(_k) ((klc_malloc_hdr_t *)\
204 (unsigned long)_k + (_k->ch_malloc_hdr_off))) 179 (unsigned long)_k + (_k->ch_malloc_hdr_off)))
205#endif
206 180
207#define KL_CONFIG_CH_MALLOC_HDR(_n) PTR_CH_MALLOC_HDR(KL_CONFIG_HDR(_n)) 181#define KL_CONFIG_CH_MALLOC_HDR(_n) PTR_CH_MALLOC_HDR(KL_CONFIG_HDR(_n))
208 182
209#if defined(CONFIG_SGI_IO)
210#define PTR_CH_CONS_INFO(_k) ((console_t *)\
211 ((__psunsigned_t)_k + (_k->ch_cons_off)))
212#else
213#define PTR_CH_CONS_INFO(_k) ((console_t *)\ 183#define PTR_CH_CONS_INFO(_k) ((console_t *)\
214 ((unsigned long)_k + (_k->ch_cons_off))) 184 ((unsigned long)_k + (_k->ch_cons_off)))
215#endif
216 185
217#define KL_CONFIG_CH_CONS_INFO(_n) PTR_CH_CONS_INFO(KL_CONFIG_HDR(_n)) 186#define KL_CONFIG_CH_CONS_INFO(_n) PTR_CH_CONS_INFO(KL_CONFIG_HDR(_n))
218 187
@@ -489,14 +458,6 @@ typedef struct lboard_s {
489#define KLCF_NUM_COMPS(_brd) ((_brd)->brd_numcompts) 458#define KLCF_NUM_COMPS(_brd) ((_brd)->brd_numcompts)
490#define KLCF_MODULE_ID(_brd) ((_brd)->brd_module) 459#define KLCF_MODULE_ID(_brd) ((_brd)->brd_module)
491 460
492#ifdef FRUTEST
493
494#define KLCF_NEXT(_brd) ((_brd)->brd_next ? (lboard_t *)((_brd)->brd_next): NULL)
495#define KLCF_COMP(_brd, _ndx) (klinfo_t *)((_brd)->brd_compts[(_ndx)])
496#define KLCF_COMP_ERROR(_brd, _comp) (_brd = _brd , (_comp)->errinfo)
497
498#else
499
500#define KLCF_NEXT(_brd) \ 461#define KLCF_NEXT(_brd) \
501 ((_brd)->brd_next ? \ 462 ((_brd)->brd_next ? \
502 (lboard_t *)(NODE_OFFSET_TO_K1(NASID_GET(_brd), (_brd)->brd_next)):\ 463 (lboard_t *)(NODE_OFFSET_TO_K1(NASID_GET(_brd), (_brd)->brd_next)):\
@@ -508,8 +469,6 @@ typedef struct lboard_s {
508#define KLCF_COMP_ERROR(_brd, _comp) \ 469#define KLCF_COMP_ERROR(_brd, _comp) \
509 (NODE_OFFSET_TO_K1(NASID_GET(_brd), (_comp)->errinfo)) 470 (NODE_OFFSET_TO_K1(NASID_GET(_brd), (_comp)->errinfo))
510 471
511#endif
512
513#define KLCF_COMP_TYPE(_comp) ((_comp)->struct_type) 472#define KLCF_COMP_TYPE(_comp) ((_comp)->struct_type)
514#define KLCF_BRIDGE_W_ID(_comp) ((_comp)->physid) /* Widget ID */ 473#define KLCF_BRIDGE_W_ID(_comp) ((_comp)->physid) /* Widget ID */
515 474
@@ -630,18 +589,6 @@ typedef struct klport_s {
630 klconf_off_t port_offset; 589 klconf_off_t port_offset;
631} klport_t; 590} klport_t;
632 591
633#if 0
634/*
635 * This is very similar to the klport_s but instead of having a componant
636 * offset it has a board offset.
637 */
638typedef struct klxbow_port_s {
639 nasid_t port_nasid;
640 unsigned char port_flag;
641 klconf_off_t board_offset;
642} klxbow_port_t;
643#endif
644
645typedef struct klcpu_s { /* CPU */ 592typedef struct klcpu_s { /* CPU */
646 klinfo_t cpu_info; 593 klinfo_t cpu_info;
647 unsigned short cpu_prid; /* Processor PRID value */ 594 unsigned short cpu_prid; /* Processor PRID value */
@@ -944,36 +891,6 @@ extern klcpu_t *nasid_slice_to_cpuinfo(nasid_t, int);
944extern lboard_t *find_lboard_class(lboard_t *start, unsigned char brd_class); 891extern lboard_t *find_lboard_class(lboard_t *start, unsigned char brd_class);
945 892
946 893
947#if defined(CONFIG_SGI_IO)
948extern xwidgetnum_t nodevertex_widgetnum_get(vertex_hdl_t node_vtx);
949extern vertex_hdl_t nodevertex_xbow_peer_get(vertex_hdl_t node_vtx);
950extern lboard_t *find_gfxpipe(int pipenum);
951extern void setup_gfxpipe_link(vertex_hdl_t vhdl,int pipenum);
952extern lboard_t *find_lboard_module_class(lboard_t *start, moduleid_t mod,
953 unsigned char brd_class);
954extern lboard_t *find_nic_lboard(lboard_t *, nic_t);
955extern lboard_t *find_nic_type_lboard(nasid_t, unsigned char, nic_t);
956extern lboard_t *find_lboard_modslot(lboard_t *start, moduleid_t mod, slotid_t slot);
957extern lboard_t *find_lboard_module(lboard_t *start, moduleid_t mod);
958extern lboard_t *get_board_name(nasid_t nasid, moduleid_t mod, slotid_t slot, char *name);
959extern int config_find_nic_router(nasid_t, nic_t, lboard_t **, klrou_t**);
960extern int config_find_nic_hub(nasid_t, nic_t, lboard_t **, klhub_t**);
961extern int config_find_xbow(nasid_t, lboard_t **, klxbow_t**);
962extern klcpu_t *get_cpuinfo(cpuid_t cpu);
963extern int update_klcfg_cpuinfo(nasid_t, int);
964extern void board_to_path(lboard_t *brd, char *path);
965extern moduleid_t get_module_id(nasid_t nasid);
966extern void nic_name_convert(char *old_name, char *new_name);
967extern int module_brds(nasid_t nasid, lboard_t **module_brds, int n);
968extern lboard_t *brd_from_key(ulong_t key);
969extern void device_component_canonical_name_get(lboard_t *,klinfo_t *,
970 char *);
971extern int board_serial_number_get(lboard_t *,char *);
972extern int is_master_baseio(nasid_t,moduleid_t,slotid_t);
973extern nasid_t get_actual_nasid(lboard_t *brd) ;
974extern net_vec_t klcfg_discover_route(lboard_t *, lboard_t *, int);
975#else /* CONFIG_SGI_IO */
976extern klcpu_t *sn_get_cpuinfo(cpuid_t cpu); 894extern klcpu_t *sn_get_cpuinfo(cpuid_t cpu);
977#endif /* CONFIG_SGI_IO */
978 895
979#endif /* _ASM_SN_KLCONFIG_H */ 896#endif /* _ASM_SN_KLCONFIG_H */
diff --git a/include/asm-mips/sn/kldir.h b/include/asm-mips/sn/kldir.h
index e3e231f0b79d..0573cbffc104 100644
--- a/include/asm-mips/sn/kldir.h
+++ b/include/asm-mips/sn/kldir.h
@@ -12,10 +12,6 @@
12#define _ASM_SN_KLDIR_H 12#define _ASM_SN_KLDIR_H
13 13
14 14
15#if defined(CONFIG_SGI_IO)
16#include <asm/hack.h>
17#endif
18
19/* 15/*
20 * The kldir memory area resides at a fixed place in each node's memory and 16 * The kldir memory area resides at a fixed place in each node's memory and
21 * provides pointers to most other IP27 memory areas. This allows us to 17 * provides pointers to most other IP27 memory areas. This allows us to
@@ -135,8 +131,6 @@
135#define KLDIR_OFF_STRIDE 0x28 131#define KLDIR_OFF_STRIDE 0x28
136#endif /* __ASSEMBLY__ */ 132#endif /* __ASSEMBLY__ */
137 133
138#if !defined(CONFIG_SGI_IO)
139
140/* 134/*
141 * This is defined here because IP27_SYMMON_STK_SIZE must be at least what 135 * This is defined here because IP27_SYMMON_STK_SIZE must be at least what
142 * we define here. Since it's set up in the prom. We can't redefine it later 136 * we define here. Since it's set up in the prom. We can't redefine it later
@@ -146,7 +140,7 @@
146 */ 140 */
147#define SYMMON_STACK_SIZE 0x8000 141#define SYMMON_STACK_SIZE 0x8000
148 142
149#if defined (PROM) || defined (SABLE) 143#if defined (PROM)
150 144
151/* 145/*
152 * These defines are prom version dependent. No code other than the IP27 146 * These defines are prom version dependent. No code other than the IP27
@@ -183,7 +177,7 @@
183#define IP27_FREEMEM_COUNT 1 177#define IP27_FREEMEM_COUNT 1
184#define IP27_FREEMEM_STRIDE 0 178#define IP27_FREEMEM_STRIDE 0
185 179
186#endif /* PROM || SABLE*/ 180#endif /* PROM */
187/* 181/*
188 * There will be only one of these in a partition so the IO6 must set it up. 182 * There will be only one of these in a partition so the IO6 must set it up.
189 */ 183 */
@@ -206,17 +200,11 @@
206#define KLDIR_ENT_SIZE 0x40 200#define KLDIR_ENT_SIZE 0x40
207#define KLDIR_MAX_ENTRIES (0x400 / 0x40) 201#define KLDIR_MAX_ENTRIES (0x400 / 0x40)
208 202
209#endif /* !CONFIG_SGI_IO */
210
211#ifndef __ASSEMBLY__ 203#ifndef __ASSEMBLY__
212typedef struct kldir_ent_s { 204typedef struct kldir_ent_s {
213 u64 magic; /* Indicates validity of entry */ 205 u64 magic; /* Indicates validity of entry */
214 off_t offset; /* Offset from start of node space */ 206 off_t offset; /* Offset from start of node space */
215#if defined(CONFIG_SGI_IO) /* FIXME */
216 __psunsigned_t pointer; /* Pointer to area in some cases */
217#else
218 unsigned long pointer; /* Pointer to area in some cases */ 207 unsigned long pointer; /* Pointer to area in some cases */
219#endif
220 size_t size; /* Size in bytes */ 208 size_t size; /* Size in bytes */
221 u64 count; /* Repeat count if array, 1 if not */ 209 u64 count; /* Repeat count if array, 1 if not */
222 size_t stride; /* Stride if array, 0 if not */ 210 size_t stride; /* Stride if array, 0 if not */
@@ -226,22 +214,4 @@ typedef struct kldir_ent_s {
226} kldir_ent_t; 214} kldir_ent_t;
227#endif /* !__ASSEMBLY__ */ 215#endif /* !__ASSEMBLY__ */
228 216
229#if defined(CONFIG_SGI_IO)
230
231#define KLDIR_ENT_SIZE 0x40
232#define KLDIR_MAX_ENTRIES (0x400 / 0x40)
233
234/*
235 * The actual offsets of each memory area are machine-dependent
236 */
237#ifdef CONFIG_SGI_IP27
238// Not yet #include <asm/sn/sn0/kldir.h>
239#elif defined(CONFIG_SGI_IP35)
240#include <asm/sn/sn1/kldir.h>
241#else
242#error "kldir.h is currently defined for IP27 and IP35 platforms only"
243#endif
244
245#endif /* CONFIG_SGI_IO */
246
247#endif /* _ASM_SN_KLDIR_H */ 217#endif /* _ASM_SN_KLDIR_H */
diff --git a/include/asm-mips/sn/sn0/addrs.h b/include/asm-mips/sn/sn0/addrs.h
index c0905c1ac938..9e8cc52910f6 100644
--- a/include/asm-mips/sn/sn0/addrs.h
+++ b/include/asm-mips/sn/sn0/addrs.h
@@ -48,7 +48,7 @@
48 * so for now we just use defines bracketed by an ifdef. 48 * so for now we just use defines bracketed by an ifdef.
49 */ 49 */
50 50
51#ifdef CONFIG_SGI_SN0_N_MODE 51#ifdef CONFIG_SGI_SN_N_MODE
52 52
53#define NODE_SIZE_BITS 31 53#define NODE_SIZE_BITS 31
54#define BWIN_SIZE_BITS 28 54#define BWIN_SIZE_BITS 28
@@ -62,7 +62,7 @@
62#define BDDIR_UPPER_MASK (UINT64_CAST 0x7ffff << 10) 62#define BDDIR_UPPER_MASK (UINT64_CAST 0x7ffff << 10)
63#define BDECC_UPPER_MASK (UINT64_CAST 0x3ffffff << 3) 63#define BDECC_UPPER_MASK (UINT64_CAST 0x3ffffff << 3)
64 64
65#else /* !defined(CONFIG_SGI_SN0_N_MODE), assume that M-mode is desired */ 65#else /* !defined(CONFIG_SGI_SN_N_MODE), assume that M-mode is desired */
66 66
67#define NODE_SIZE_BITS 32 67#define NODE_SIZE_BITS 32
68#define BWIN_SIZE_BITS 29 68#define BWIN_SIZE_BITS 29
@@ -76,7 +76,7 @@
76#define BDDIR_UPPER_MASK (UINT64_CAST 0xfffff << 10) 76#define BDDIR_UPPER_MASK (UINT64_CAST 0xfffff << 10)
77#define BDECC_UPPER_MASK (UINT64_CAST 0x7ffffff << 3) 77#define BDECC_UPPER_MASK (UINT64_CAST 0x7ffffff << 3)
78 78
79#endif /* !defined(CONFIG_SGI_SN0_N_MODE) */ 79#endif /* !defined(CONFIG_SGI_SN_N_MODE) */
80 80
81#define NODE_ADDRSPACE_SIZE (UINT64_CAST 1 << NODE_SIZE_BITS) 81#define NODE_ADDRSPACE_SIZE (UINT64_CAST 1 << NODE_SIZE_BITS)
82 82
@@ -84,15 +84,15 @@
84#define NASID_GET(_pa) (int) ((UINT64_CAST (_pa) >> \ 84#define NASID_GET(_pa) (int) ((UINT64_CAST (_pa) >> \
85 NASID_SHFT) & NASID_BITMASK) 85 NASID_SHFT) & NASID_BITMASK)
86 86
87#if !defined(__ASSEMBLY__) && !defined(_STANDALONE) 87#if !defined(__ASSEMBLY__)
88 88
89#define NODE_SWIN_BASE(nasid, widget) \ 89#define NODE_SWIN_BASE(nasid, widget) \
90 ((widget == 0) ? NODE_BWIN_BASE((nasid), SWIN0_BIGWIN) \ 90 ((widget == 0) ? NODE_BWIN_BASE((nasid), SWIN0_BIGWIN) \
91 : RAW_NODE_SWIN_BASE(nasid, widget)) 91 : RAW_NODE_SWIN_BASE(nasid, widget))
92#else /* __ASSEMBLY__ || _STANDALONE */ 92#else /* __ASSEMBLY__ */
93#define NODE_SWIN_BASE(nasid, widget) \ 93#define NODE_SWIN_BASE(nasid, widget) \
94 (NODE_IO_BASE(nasid) + (UINT64_CAST (widget) << SWIN_SIZE_BITS)) 94 (NODE_IO_BASE(nasid) + (UINT64_CAST (widget) << SWIN_SIZE_BITS))
95#endif /* __ASSEMBLY__ || _STANDALONE */ 95#endif /* __ASSEMBLY__ */
96 96
97/* 97/*
98 * The following definitions pertain to the IO special address 98 * The following definitions pertain to the IO special address
@@ -142,12 +142,7 @@
142#define SN0_WIDGET_BASE(_nasid, _wid) (NODE_SWIN_BASE((_nasid), (_wid))) 142#define SN0_WIDGET_BASE(_nasid, _wid) (NODE_SWIN_BASE((_nasid), (_wid)))
143 143
144/* Turn on sable logging for the processors whose bits are set. */ 144/* Turn on sable logging for the processors whose bits are set. */
145#ifdef SABLE
146#define SABLE_LOG_TRIGGER(_map) \
147 *((volatile hubreg_t *)(IO_BASE + 0x17ffff0)) = (_map)
148#else
149#define SABLE_LOG_TRIGGER(_map) 145#define SABLE_LOG_TRIGGER(_map)
150#endif /* SABLE */
151 146
152#ifndef __ASSEMBLY__ 147#ifndef __ASSEMBLY__
153#define KERN_NMI_ADDR(nasid, slice) \ 148#define KERN_NMI_ADDR(nasid, slice) \
@@ -280,76 +275,6 @@
280 275
281#define _ARCSPROM 276#define _ARCSPROM
282 277
283#ifdef _STANDALONE
284
285/*
286 * The PROM needs to pass the device base address and the
287 * device pci cfg space address to the device drivers during
288 * install. The COMPONENT->Key field is used for this purpose.
289 * Macros needed by SN0 device drivers to convert the
290 * COMPONENT->Key field to the respective base address.
291 * Key field looks as follows:
292 *
293 * +----------------------------------------------------+
294 * |devnasid | widget |pciid |hubwidid|hstnasid | adap |
295 * | 2 | 1 | 1 | 1 | 2 | 1 |
296 * +----------------------------------------------------+
297 * | | | | | | |
298 * 64 48 40 32 24 8 0
299 *
300 * These are used by standalone drivers till the io infrastructure
301 * is in place.
302 */
303
304#ifndef __ASSEMBLY__
305
306#define uchar unsigned char
307
308#define KEY_DEVNASID_SHFT 48
309#define KEY_WIDID_SHFT 40
310#define KEY_PCIID_SHFT 32
311#define KEY_HUBWID_SHFT 24
312#define KEY_HSTNASID_SHFT 8
313
314#define MK_SN0_KEY(nasid, widid, pciid) \
315 ((((__psunsigned_t)nasid)<< KEY_DEVNASID_SHFT |\
316 ((__psunsigned_t)widid) << KEY_WIDID_SHFT) |\
317 ((__psunsigned_t)pciid) << KEY_PCIID_SHFT)
318
319#define ADD_HUBWID_KEY(key,hubwid)\
320 (key|=((__psunsigned_t)hubwid << KEY_HUBWID_SHFT))
321
322#define ADD_HSTNASID_KEY(key,hstnasid)\
323 (key|=((__psunsigned_t)hstnasid << KEY_HSTNASID_SHFT))
324
325#define GET_DEVNASID_FROM_KEY(key) ((short)(key >> KEY_DEVNASID_SHFT))
326#define GET_WIDID_FROM_KEY(key) ((uchar)(key >> KEY_WIDID_SHFT))
327#define GET_PCIID_FROM_KEY(key) ((uchar)(key >> KEY_PCIID_SHFT))
328#define GET_HUBWID_FROM_KEY(key) ((uchar)(key >> KEY_HUBWID_SHFT))
329#define GET_HSTNASID_FROM_KEY(key) ((short)(key >> KEY_HSTNASID_SHFT))
330
331#define PCI_64_TARGID_SHFT 60
332
333#define GET_PCIBASE_FROM_KEY(key) (NODE_SWIN_BASE(GET_DEVNASID_FROM_KEY(key),\
334 GET_WIDID_FROM_KEY(key))\
335 | BRIDGE_DEVIO(GET_PCIID_FROM_KEY(key)))
336
337#define GET_PCICFGBASE_FROM_KEY(key) \
338 (NODE_SWIN_BASE(GET_DEVNASID_FROM_KEY(key),\
339 GET_WIDID_FROM_KEY(key))\
340 | BRIDGE_TYPE0_CFG_DEV(GET_PCIID_FROM_KEY(key)))
341
342#define GET_WIDBASE_FROM_KEY(key) \
343 (NODE_SWIN_BASE(GET_DEVNASID_FROM_KEY(key),\
344 GET_WIDID_FROM_KEY(key)))
345
346#define PUT_INSTALL_STATUS(c,s) c->Revision = s
347#define GET_INSTALL_STATUS(c) c->Revision
348
349#endif /* !__ASSEMBLY__ */
350
351#endif /* _STANDALONE */
352
353#if defined (HUB_ERR_STS_WAR) 278#if defined (HUB_ERR_STS_WAR)
354 279
355#define ERR_STS_WAR_REGISTER IIO_IIBUSERR 280#define ERR_STS_WAR_REGISTER IIO_IIBUSERR
diff --git a/include/asm-mips/sn/sn0/arch.h b/include/asm-mips/sn/sn0/arch.h
index 7a221666c58e..f734f2007f24 100644
--- a/include/asm-mips/sn/sn0/arch.h
+++ b/include/asm-mips/sn/sn0/arch.h
@@ -12,8 +12,6 @@
12#define _ASM_SN_SN0_ARCH_H 12#define _ASM_SN_SN0_ARCH_H
13 13
14 14
15#ifndef SABLE
16
17#ifndef SN0XXL /* 128 cpu SMP max */ 15#ifndef SN0XXL /* 128 cpu SMP max */
18/* 16/*
19 * This is the maximum number of nodes that can be part of a kernel. 17 * This is the maximum number of nodes that can be part of a kernel.
@@ -53,25 +51,16 @@
53 */ 51 */
54#define MAX_PARTITIONS MAX_REGIONS 52#define MAX_PARTITIONS MAX_REGIONS
55 53
56
57#else
58
59#define MAX_COMPACT_NODES 4
60#define MAX_NASIDS 4
61#define MAXCPUS 8
62
63#endif
64
65#define NASID_MASK_BYTES ((MAX_NASIDS + 7) / 8) 54#define NASID_MASK_BYTES ((MAX_NASIDS + 7) / 8)
66 55
67/* 56/*
68 * Slot constants for SN0 57 * Slot constants for SN0
69 */ 58 */
70#ifdef CONFIG_SGI_SN0_N_MODE 59#ifdef CONFIG_SGI_SN_N_MODE
71#define MAX_MEM_SLOTS 16 /* max slots per node */ 60#define MAX_MEM_SLOTS 16 /* max slots per node */
72#else /* !CONFIG_SGI_SN0_N_MODE, assume M_MODE */ 61#else /* !CONFIG_SGI_SN_N_MODE, assume CONFIG_SGI_SN_M_MODE */
73#define MAX_MEM_SLOTS 32 /* max slots per node */ 62#define MAX_MEM_SLOTS 32 /* max slots per node */
74#endif /* defined(N_MODE) */ 63#endif /* CONFIG_SGI_SN_M_MODE */
75 64
76#define SLOT_SHIFT (27) 65#define SLOT_SHIFT (27)
77#define SLOT_MIN_MEM_SIZE (32*1024*1024) 66#define SLOT_MIN_MEM_SIZE (32*1024*1024)
diff --git a/include/asm-mips/sn/sn0/hub.h b/include/asm-mips/sn/sn0/hub.h
index f5dbba6f4610..3e228f8e7969 100644
--- a/include/asm-mips/sn/sn0/hub.h
+++ b/include/asm-mips/sn/sn0/hub.h
@@ -31,10 +31,6 @@
31#include <asm/sn/sn0/hubni.h> 31#include <asm/sn/sn0/hubni.h>
32//#include <asm/sn/sn0/hubcore.h> 32//#include <asm/sn/sn0/hubcore.h>
33 33
34#ifdef SABLE
35#define IP27_NO_HUBUART_INT 1
36#endif
37
38/* Translation of uncached attributes */ 34/* Translation of uncached attributes */
39#define UATTR_HSPEC 0 35#define UATTR_HSPEC 0
40#define UATTR_IO 1 36#define UATTR_IO 1
diff --git a/include/asm-mips/sn/sn0/hubio.h b/include/asm-mips/sn/sn0/hubio.h
index f314da21b970..ef91b3363554 100644
--- a/include/asm-mips/sn/sn0/hubio.h
+++ b/include/asm-mips/sn/sn0/hubio.h
@@ -486,22 +486,6 @@ typedef union h1_icrba_u {
486#define ICRBN_A_CERR_SHFT 54 486#define ICRBN_A_CERR_SHFT 54
487#define ICRBN_A_ERR_MASK 0x3ff 487#define ICRBN_A_ERR_MASK 0x3ff
488 488
489#if 0 /* Disabled, this causes namespace polution and break allmodconfig */
490/*
491 * Easy access macros.
492 */
493#define a_error icrba_fields_s.error
494#define a_ecode icrba_fields_s.ecode
495#define a_lnetuce icrba_fields_s.lnetuce
496#define a_mark icrba_fields_s.mark
497#define a_xerr icrba_fields_s.xerr
498#define a_sidn icrba_fields_s.sidn
499#define a_tnum icrba_fields_s.tnum
500#define a_addr icrba_fields_s.addr
501#define a_valid icrba_fields_s.valid
502#define a_iow icrba_fields_s.iow
503#endif
504
505#endif /* !__ASSEMBLY__ */ 489#endif /* !__ASSEMBLY__ */
506 490
507#define IIO_ICRB_ADDR_SHFT 2 /* Shift to get proper address */ 491#define IIO_ICRB_ADDR_SHFT 2 /* Shift to get proper address */
diff --git a/include/asm-mips/sn/sn0/hubmd.h b/include/asm-mips/sn/sn0/hubmd.h
index f01000241884..14c225d80664 100644
--- a/include/asm-mips/sn/sn0/hubmd.h
+++ b/include/asm-mips/sn/sn0/hubmd.h
@@ -91,7 +91,7 @@
91#define MD_UREG1_14 0x2200f0 /* uController/UART 1 register */ 91#define MD_UREG1_14 0x2200f0 /* uController/UART 1 register */
92#define MD_UREG1_15 0x2200f8 /* uController/UART 1 register */ 92#define MD_UREG1_15 0x2200f8 /* uController/UART 1 register */
93 93
94#ifdef CONFIG_SGI_SN0_N_MODE 94#ifdef CONFIG_SGI_SN_N_MODE
95#define MD_MEM_BANKS 4 /* 4 banks of memory max in N mode */ 95#define MD_MEM_BANKS 4 /* 4 banks of memory max in N mode */
96#else 96#else
97#define MD_MEM_BANKS 8 /* 8 banks of memory max in M mode */ 97#define MD_MEM_BANKS 8 /* 8 banks of memory max in M mode */
diff --git a/include/asm-mips/sn/sn0/hubpi.h b/include/asm-mips/sn/sn0/hubpi.h
index 355bba8552e3..e39f5f9da040 100644
--- a/include/asm-mips/sn/sn0/hubpi.h
+++ b/include/asm-mips/sn/sn0/hubpi.h
@@ -398,24 +398,6 @@ typedef u64 rtc_time_t;
398 398
399/* PI_RT_FILTER_CTRL mask and shift definitions */ 399/* PI_RT_FILTER_CTRL mask and shift definitions */
400 400
401#if 0
402/*
403 * XXX - This register's definition has changed, but it's only implemented
404 * in Hub 2.
405 */
406#define PRFC_DROP_COUNT_SHFT 27
407#define PRFC_DROP_COUNT_MASK (UINT64_CAST 0x3ff << 27)
408#define PRFC_DROP_CTR_SHFT 18
409#define PRFC_DROP_CTR_MASK (UINT64_CAST 0x1ff << 18)
410#define PRFC_MASK_ENABLE_SHFT 10
411#define PRFC_MASK_ENABLE_MASK (UINT64_CAST 0x7f << 10)
412#define PRFC_MASK_CTR_SHFT 2
413#define PRFC_MASK_CTR_MASK (UINT64_CAST 0xff << 2)
414#define PRFC_OFFSET_SHFT 0
415#define PRFC_OFFSET_MASK (UINT64_CAST 3)
416#endif /* 0 */
417
418
419/* 401/*
420 * Bits for NACK_CNT_A/B and NACK_CMP 402 * Bits for NACK_CNT_A/B and NACK_CMP
421 */ 403 */
diff --git a/include/asm-mips/sn/sn0/ip27.h b/include/asm-mips/sn/sn0/ip27.h
index ade0e974dd78..3c97e0855c8d 100644
--- a/include/asm-mips/sn/sn0/ip27.h
+++ b/include/asm-mips/sn/sn0/ip27.h
@@ -6,7 +6,7 @@
6 * Derived from IRIX <sys/SN/SN0/IP27.h>. 6 * Derived from IRIX <sys/SN/SN0/IP27.h>.
7 * 7 *
8 * Copyright (C) 1992 - 1997, 1999 Silicon Graphics, Inc. 8 * Copyright (C) 1992 - 1997, 1999 Silicon Graphics, Inc.
9 * Copyright (C) 1999 by Ralf Baechle 9 * Copyright (C) 1999, 2006 by Ralf Baechle
10 */ 10 */
11#ifndef _ASM_SN_SN0_IP27_H 11#ifndef _ASM_SN_SN0_IP27_H
12#define _ASM_SN_SN0_IP27_H 12#define _ASM_SN_SN0_IP27_H
@@ -82,11 +82,4 @@
82#define SEND_NMI(_nasid, _slice) \ 82#define SEND_NMI(_nasid, _slice) \
83 REMOTE_HUB_S((_nasid), (PI_NMI_A + ((_slice) * PI_NMI_OFFSET)), 1) 83 REMOTE_HUB_S((_nasid), (PI_NMI_A + ((_slice) * PI_NMI_OFFSET)), 1)
84 84
85/* Sanity hazzard ... Below all the Origin hacks are following. */
86
87#define SN00_BRIDGE 0x9200000008000000
88#define SN00I_BRIDGE0 0x920000000b000000
89#define SN00I_BRIDGE1 0x920000000e000000
90#define SN00I_BRIDGE2 0x920000000f000000
91
92#endif /* _ASM_SN_SN0_IP27_H */ 85#endif /* _ASM_SN_SN0_IP27_H */
diff --git a/include/asm-mips/sni.h b/include/asm-mips/sni.h
index b3bc698dfdee..b9ba54d0dd35 100644
--- a/include/asm-mips/sni.h
+++ b/include/asm-mips/sni.h
@@ -15,9 +15,6 @@
15/* 15/*
16 * ASIC PCI registers for little endian configuration. 16 * ASIC PCI registers for little endian configuration.
17 */ 17 */
18#ifndef __MIPSEL__
19#error "Fix me for big endian"
20#endif
21#define PCIMT_UCONF 0xbfff0000 18#define PCIMT_UCONF 0xbfff0000
22#define PCIMT_IOADTIMEOUT2 0xbfff0008 19#define PCIMT_IOADTIMEOUT2 0xbfff0008
23#define PCIMT_IOMEMCONF 0xbfff0010 20#define PCIMT_IOMEMCONF 0xbfff0010
@@ -51,9 +48,9 @@
51#define PCIMT_PCI_CONF 0xbfff0100 48#define PCIMT_PCI_CONF 0xbfff0100
52 49
53/* 50/*
54 * Data port for the PCI bus. 51 * Data port for the PCI bus in IO space
55 */ 52 */
56#define PCIMT_CONFIG_DATA 0xb4000cfc 53#define PCIMT_CONFIG_DATA 0x0cfc
57 54
58/* 55/*
59 * Board specific registers 56 * Board specific registers
diff --git a/include/asm-mips/sparsemem.h b/include/asm-mips/sparsemem.h
new file mode 100644
index 000000000000..795ac6c23203
--- /dev/null
+++ b/include/asm-mips/sparsemem.h
@@ -0,0 +1,14 @@
1#ifndef _MIPS_SPARSEMEM_H
2#define _MIPS_SPARSEMEM_H
3#ifdef CONFIG_SPARSEMEM
4
5/*
6 * SECTION_SIZE_BITS 2^N: how big each section will be
7 * MAX_PHYSMEM_BITS 2^N: how much memory we can have in that space
8 */
9#define SECTION_SIZE_BITS 28
10#define MAX_PHYSMEM_BITS 35
11
12#endif /* CONFIG_SPARSEMEM */
13#endif /* _MIPS_SPARSEMEM_H */
14
diff --git a/include/asm-mips/war.h b/include/asm-mips/war.h
index 9844f0c2dfee..3ac146c019c9 100644
--- a/include/asm-mips/war.h
+++ b/include/asm-mips/war.h
@@ -171,7 +171,8 @@
171 * On the RM9000 there is a problem which makes the CreateDirtyExclusive 171 * On the RM9000 there is a problem which makes the CreateDirtyExclusive
172 * cache operation unusable on SMP systems. 172 * cache operation unusable on SMP systems.
173 */ 173 */
174#if defined(CONFIG_MOMENCO_JAGUAR_ATX) || defined(CONFIG_PMC_YOSEMITE) 174#if defined(CONFIG_MOMENCO_JAGUAR_ATX) || defined(CONFIG_PMC_YOSEMITE) || \
175 defined(CONFIG_BASLER_EXCITE)
175#define RM9000_CDEX_SMP_WAR 1 176#define RM9000_CDEX_SMP_WAR 1
176#endif 177#endif
177 178
@@ -181,7 +182,7 @@
181 * being fetched may case spurious exceptions. 182 * being fetched may case spurious exceptions.
182 */ 183 */
183#if defined(CONFIG_MOMENCO_JAGUAR_ATX) || defined(CONFIG_MOMENCO_OCELOT_3) || \ 184#if defined(CONFIG_MOMENCO_JAGUAR_ATX) || defined(CONFIG_MOMENCO_OCELOT_3) || \
184 defined(CONFIG_PMC_YOSEMITE) 185 defined(CONFIG_PMC_YOSEMITE) || defined(CONFIG_BASLER_EXCITE)
185#define ICACHE_REFILLS_WORKAROUND_WAR 1 186#define ICACHE_REFILLS_WORKAROUND_WAR 1
186#endif 187#endif
187 188
diff --git a/include/asm-powerpc/cputable.h b/include/asm-powerpc/cputable.h
index 9fcf0162d859..f6265c2a0dd2 100644
--- a/include/asm-powerpc/cputable.h
+++ b/include/asm-powerpc/cputable.h
@@ -329,7 +329,7 @@ extern void do_cpu_ftr_fixups(unsigned long offset);
329#define CPU_FTRS_CELL (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 329#define CPU_FTRS_CELL (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
330 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \ 330 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \
331 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \ 331 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \
332 CPU_FTR_CTRL | CPU_FTR_PAUSE_ZERO) 332 CPU_FTR_CTRL | CPU_FTR_PAUSE_ZERO | CPU_FTR_CI_LARGE_PAGE)
333#define CPU_FTRS_COMPATIBLE (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 333#define CPU_FTRS_COMPATIBLE (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
334 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2) 334 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2)
335#endif 335#endif
diff --git a/include/asm-powerpc/termbits.h b/include/asm-powerpc/termbits.h
index ebf6055481dc..6d533b07aaf5 100644
--- a/include/asm-powerpc/termbits.h
+++ b/include/asm-powerpc/termbits.h
@@ -153,6 +153,7 @@ struct termios {
153#define HUPCL 00040000 153#define HUPCL 00040000
154 154
155#define CLOCAL 00100000 155#define CLOCAL 00100000
156#define CMSPAR 010000000000 /* mark or space (stick) parity */
156#define CRTSCTS 020000000000 /* flow control */ 157#define CRTSCTS 020000000000 /* flow control */
157 158
158/* c_lflag bits */ 159/* c_lflag bits */
diff --git a/include/asm-s390/futex.h b/include/asm-s390/futex.h
index 40c25e166a9b..1802775568b9 100644
--- a/include/asm-s390/futex.h
+++ b/include/asm-s390/futex.h
@@ -11,23 +11,24 @@
11#define __futex_atomic_fixup \ 11#define __futex_atomic_fixup \
12 ".section __ex_table,\"a\"\n" \ 12 ".section __ex_table,\"a\"\n" \
13 " .align 4\n" \ 13 " .align 4\n" \
14 " .long 0b,2b,1b,2b\n" \ 14 " .long 0b,4b,2b,4b,3b,4b\n" \
15 ".previous" 15 ".previous"
16#else /* __s390x__ */ 16#else /* __s390x__ */
17#define __futex_atomic_fixup \ 17#define __futex_atomic_fixup \
18 ".section __ex_table,\"a\"\n" \ 18 ".section __ex_table,\"a\"\n" \
19 " .align 8\n" \ 19 " .align 8\n" \
20 " .quad 0b,2b,1b,2b\n" \ 20 " .quad 0b,4b,2b,4b,3b,4b\n" \
21 ".previous" 21 ".previous"
22#endif /* __s390x__ */ 22#endif /* __s390x__ */
23 23
24#define __futex_atomic_op(insn, ret, oldval, newval, uaddr, oparg) \ 24#define __futex_atomic_op(insn, ret, oldval, newval, uaddr, oparg) \
25 asm volatile(" l %1,0(%6)\n" \ 25 asm volatile(" sacf 256\n" \
26 "0: " insn \ 26 "0: l %1,0(%6)\n" \
27 " cs %1,%2,0(%6)\n" \ 27 "1: " insn \
28 "1: jl 0b\n" \ 28 "2: cs %1,%2,0(%6)\n" \
29 "3: jl 1b\n" \
29 " lhi %0,0\n" \ 30 " lhi %0,0\n" \
30 "2:\n" \ 31 "4: sacf 0\n" \
31 __futex_atomic_fixup \ 32 __futex_atomic_fixup \
32 : "=d" (ret), "=&d" (oldval), "=&d" (newval), \ 33 : "=d" (ret), "=&d" (oldval), "=&d" (newval), \
33 "=m" (*uaddr) \ 34 "=m" (*uaddr) \
diff --git a/include/asm-s390/lowcore.h b/include/asm-s390/lowcore.h
index e17d181b98a9..596c8b172104 100644
--- a/include/asm-s390/lowcore.h
+++ b/include/asm-s390/lowcore.h
@@ -98,8 +98,8 @@
98#define __LC_KERNEL_ASCE 0xD58 98#define __LC_KERNEL_ASCE 0xD58
99#define __LC_USER_ASCE 0xD60 99#define __LC_USER_ASCE 0xD60
100#define __LC_PANIC_STACK 0xD68 100#define __LC_PANIC_STACK 0xD68
101#define __LC_CPUID 0xD90 101#define __LC_CPUID 0xD80
102#define __LC_CPUADDR 0xD98 102#define __LC_CPUADDR 0xD88
103#define __LC_IPLDEV 0xDB8 103#define __LC_IPLDEV 0xDB8
104#define __LC_JIFFY_TIMER 0xDC0 104#define __LC_JIFFY_TIMER 0xDC0
105#define __LC_CURRENT 0xDD8 105#define __LC_CURRENT 0xDD8
diff --git a/include/asm-sparc64/pgtable.h b/include/asm-sparc64/pgtable.h
index 72f9a524dc67..4e218814bb3c 100644
--- a/include/asm-sparc64/pgtable.h
+++ b/include/asm-sparc64/pgtable.h
@@ -688,6 +688,23 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *p
688#define pte_clear(mm,addr,ptep) \ 688#define pte_clear(mm,addr,ptep) \
689 set_pte_at((mm), (addr), (ptep), __pte(0UL)) 689 set_pte_at((mm), (addr), (ptep), __pte(0UL))
690 690
691#ifdef DCACHE_ALIASING_POSSIBLE
692#define __HAVE_ARCH_MOVE_PTE
693#define move_pte(pte, prot, old_addr, new_addr) \
694({ \
695 pte_t newpte = (pte); \
696 if (tlb_type != hypervisor && pte_present(pte)) { \
697 unsigned long this_pfn = pte_pfn(pte); \
698 \
699 if (pfn_valid(this_pfn) && \
700 (((old_addr) ^ (new_addr)) & (1 << 13))) \
701 flush_dcache_page_all(current->mm, \
702 pfn_to_page(this_pfn)); \
703 } \
704 newpte; \
705})
706#endif
707
691extern pgd_t swapper_pg_dir[2048]; 708extern pgd_t swapper_pg_dir[2048];
692extern pmd_t swapper_low_pmd_dir[2048]; 709extern pmd_t swapper_low_pmd_dir[2048];
693 710
diff --git a/include/asm-um/irqflags.h b/include/asm-um/irqflags.h
new file mode 100644
index 000000000000..659b9abdfdba
--- /dev/null
+++ b/include/asm-um/irqflags.h
@@ -0,0 +1,6 @@
1#ifndef __UM_IRQFLAGS_H
2#define __UM_IRQFLAGS_H
3
4/* Empty for now */
5
6#endif
diff --git a/include/asm-um/uaccess.h b/include/asm-um/uaccess.h
index bea5a015f667..16c734af9193 100644
--- a/include/asm-um/uaccess.h
+++ b/include/asm-um/uaccess.h
@@ -41,11 +41,11 @@
41 41
42#define __get_user(x, ptr) \ 42#define __get_user(x, ptr) \
43({ \ 43({ \
44 const __typeof__(ptr) __private_ptr = ptr; \ 44 const __typeof__(*(ptr)) __user *__private_ptr = (ptr); \
45 __typeof__(x) __private_val; \ 45 __typeof__(x) __private_val; \
46 int __private_ret = -EFAULT; \ 46 int __private_ret = -EFAULT; \
47 (x) = (__typeof__(*(__private_ptr)))0; \ 47 (x) = (__typeof__(*(__private_ptr)))0; \
48 if (__copy_from_user((void *) &__private_val, (__private_ptr), \ 48 if (__copy_from_user((__force void *)&__private_val, (__private_ptr),\
49 sizeof(*(__private_ptr))) == 0) { \ 49 sizeof(*(__private_ptr))) == 0) { \
50 (x) = (__typeof__(*(__private_ptr))) __private_val; \ 50 (x) = (__typeof__(*(__private_ptr))) __private_val; \
51 __private_ret = 0; \ 51 __private_ret = 0; \
@@ -62,7 +62,7 @@
62 62
63#define __put_user(x, ptr) \ 63#define __put_user(x, ptr) \
64({ \ 64({ \
65 __typeof__(ptr) __private_ptr = ptr; \ 65 __typeof__(*(ptr)) __user *__private_ptr = ptr; \
66 __typeof__(*(__private_ptr)) __private_val; \ 66 __typeof__(*(__private_ptr)) __private_val; \
67 int __private_ret = -EFAULT; \ 67 int __private_ret = -EFAULT; \
68 __private_val = (__typeof__(*(__private_ptr))) (x); \ 68 __private_val = (__typeof__(*(__private_ptr))) (x); \
diff --git a/include/asm-x86_64/elf.h b/include/asm-x86_64/elf.h
index c98633af07d2..b4f8f4a41a6e 100644
--- a/include/asm-x86_64/elf.h
+++ b/include/asm-x86_64/elf.h
@@ -159,7 +159,7 @@ extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *);
159#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs) 159#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs)
160 160
161/* 1GB for 64bit, 8MB for 32bit */ 161/* 1GB for 64bit, 8MB for 32bit */
162#define STACK_RND_MASK (is_compat_task() ? 0x7ff : 0x3fffff) 162#define STACK_RND_MASK (test_thread_flag(TIF_IA32) ? 0x7ff : 0x3fffff)
163 163
164#endif 164#endif
165 165
diff --git a/include/linux/console.h b/include/linux/console.h
index 721371382ae5..08734e660d41 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -117,6 +117,10 @@ extern void console_stop(struct console *);
117extern void console_start(struct console *); 117extern void console_start(struct console *);
118extern int is_console_locked(void); 118extern int is_console_locked(void);
119 119
120/* Suspend and resume console messages over PM events */
121extern void suspend_console(void);
122extern void resume_console(void);
123
120/* Some debug stub to catch some of the obvious races in the VT code */ 124/* Some debug stub to catch some of the obvious races in the VT code */
121#if 1 125#if 1
122#define WARN_CONSOLE_UNLOCKED() WARN_ON(!is_console_locked() && !oops_in_progress) 126#define WARN_CONSOLE_UNLOCKED() WARN_ON(!is_console_locked() && !oops_in_progress)
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
new file mode 100644
index 000000000000..78b236ca04f8
--- /dev/null
+++ b/include/linux/dmaengine.h
@@ -0,0 +1,359 @@
1/*
2 * Copyright(c) 2004 - 2006 Intel Corporation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the Free
6 * Software Foundation; either version 2 of the License, or (at your option)
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 59
16 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 * The full GNU General Public License is included in this distribution in the
19 * file called COPYING.
20 */
21#ifndef DMAENGINE_H
22#define DMAENGINE_H
23#include <linux/config.h>
24#ifdef CONFIG_DMA_ENGINE
25
26#include <linux/device.h>
27#include <linux/uio.h>
28#include <linux/kref.h>
29#include <linux/completion.h>
30#include <linux/rcupdate.h>
31
32/**
33 * enum dma_event - resource PNP/power managment events
34 * @DMA_RESOURCE_SUSPEND: DMA device going into low power state
35 * @DMA_RESOURCE_RESUME: DMA device returning to full power
36 * @DMA_RESOURCE_ADDED: DMA device added to the system
37 * @DMA_RESOURCE_REMOVED: DMA device removed from the system
38 */
39enum dma_event {
40 DMA_RESOURCE_SUSPEND,
41 DMA_RESOURCE_RESUME,
42 DMA_RESOURCE_ADDED,
43 DMA_RESOURCE_REMOVED,
44};
45
46/**
47 * typedef dma_cookie_t
48 *
49 * if dma_cookie_t is >0 it's a DMA request cookie, <0 it's an error code
50 */
51typedef s32 dma_cookie_t;
52
53#define dma_submit_error(cookie) ((cookie) < 0 ? 1 : 0)
54
55/**
56 * enum dma_status - DMA transaction status
57 * @DMA_SUCCESS: transaction completed successfully
58 * @DMA_IN_PROGRESS: transaction not yet processed
59 * @DMA_ERROR: transaction failed
60 */
61enum dma_status {
62 DMA_SUCCESS,
63 DMA_IN_PROGRESS,
64 DMA_ERROR,
65};
66
67/**
68 * struct dma_chan_percpu - the per-CPU part of struct dma_chan
69 * @refcount: local_t used for open-coded "bigref" counting
70 * @memcpy_count: transaction counter
71 * @bytes_transferred: byte counter
72 */
73
74struct dma_chan_percpu {
75 local_t refcount;
76 /* stats */
77 unsigned long memcpy_count;
78 unsigned long bytes_transferred;
79};
80
81/**
82 * struct dma_chan - devices supply DMA channels, clients use them
83 * @client: ptr to the client user of this chan, will be NULL when unused
84 * @device: ptr to the dma device who supplies this channel, always !NULL
85 * @cookie: last cookie value returned to client
86 * @chan_id:
87 * @class_dev:
88 * @refcount: kref, used in "bigref" slow-mode
89 * @slow_ref:
90 * @rcu:
91 * @client_node: used to add this to the client chan list
92 * @device_node: used to add this to the device chan list
93 * @local: per-cpu pointer to a struct dma_chan_percpu
94 */
95struct dma_chan {
96 struct dma_client *client;
97 struct dma_device *device;
98 dma_cookie_t cookie;
99
100 /* sysfs */
101 int chan_id;
102 struct class_device class_dev;
103
104 struct kref refcount;
105 int slow_ref;
106 struct rcu_head rcu;
107
108 struct list_head client_node;
109 struct list_head device_node;
110 struct dma_chan_percpu *local;
111};
112
113void dma_chan_cleanup(struct kref *kref);
114
115static inline void dma_chan_get(struct dma_chan *chan)
116{
117 if (unlikely(chan->slow_ref))
118 kref_get(&chan->refcount);
119 else {
120 local_inc(&(per_cpu_ptr(chan->local, get_cpu())->refcount));
121 put_cpu();
122 }
123}
124
125static inline void dma_chan_put(struct dma_chan *chan)
126{
127 if (unlikely(chan->slow_ref))
128 kref_put(&chan->refcount, dma_chan_cleanup);
129 else {
130 local_dec(&(per_cpu_ptr(chan->local, get_cpu())->refcount));
131 put_cpu();
132 }
133}
134
135/*
136 * typedef dma_event_callback - function pointer to a DMA event callback
137 */
138typedef void (*dma_event_callback) (struct dma_client *client,
139 struct dma_chan *chan, enum dma_event event);
140
141/**
142 * struct dma_client - info on the entity making use of DMA services
143 * @event_callback: func ptr to call when something happens
144 * @chan_count: number of chans allocated
145 * @chans_desired: number of chans requested. Can be +/- chan_count
146 * @lock: protects access to the channels list
147 * @channels: the list of DMA channels allocated
148 * @global_node: list_head for global dma_client_list
149 */
150struct dma_client {
151 dma_event_callback event_callback;
152 unsigned int chan_count;
153 unsigned int chans_desired;
154
155 spinlock_t lock;
156 struct list_head channels;
157 struct list_head global_node;
158};
159
160/**
161 * struct dma_device - info on the entity supplying DMA services
162 * @chancnt: how many DMA channels are supported
163 * @channels: the list of struct dma_chan
164 * @global_node: list_head for global dma_device_list
165 * @refcount:
166 * @done:
167 * @dev_id:
168 * Other func ptrs: used to make use of this device's capabilities
169 */
170struct dma_device {
171
172 unsigned int chancnt;
173 struct list_head channels;
174 struct list_head global_node;
175
176 struct kref refcount;
177 struct completion done;
178
179 int dev_id;
180
181 int (*device_alloc_chan_resources)(struct dma_chan *chan);
182 void (*device_free_chan_resources)(struct dma_chan *chan);
183 dma_cookie_t (*device_memcpy_buf_to_buf)(struct dma_chan *chan,
184 void *dest, void *src, size_t len);
185 dma_cookie_t (*device_memcpy_buf_to_pg)(struct dma_chan *chan,
186 struct page *page, unsigned int offset, void *kdata,
187 size_t len);
188 dma_cookie_t (*device_memcpy_pg_to_pg)(struct dma_chan *chan,
189 struct page *dest_pg, unsigned int dest_off,
190 struct page *src_pg, unsigned int src_off, size_t len);
191 enum dma_status (*device_memcpy_complete)(struct dma_chan *chan,
192 dma_cookie_t cookie, dma_cookie_t *last,
193 dma_cookie_t *used);
194 void (*device_memcpy_issue_pending)(struct dma_chan *chan);
195};
196
197/* --- public DMA engine API --- */
198
199struct dma_client *dma_async_client_register(dma_event_callback event_callback);
200void dma_async_client_unregister(struct dma_client *client);
201void dma_async_client_chan_request(struct dma_client *client,
202 unsigned int number);
203
204/**
205 * dma_async_memcpy_buf_to_buf - offloaded copy between virtual addresses
206 * @chan: DMA channel to offload copy to
207 * @dest: destination address (virtual)
208 * @src: source address (virtual)
209 * @len: length
210 *
211 * Both @dest and @src must be mappable to a bus address according to the
212 * DMA mapping API rules for streaming mappings.
213 * Both @dest and @src must stay memory resident (kernel memory or locked
214 * user space pages)
215 */
216static inline dma_cookie_t dma_async_memcpy_buf_to_buf(struct dma_chan *chan,
217 void *dest, void *src, size_t len)
218{
219 int cpu = get_cpu();
220 per_cpu_ptr(chan->local, cpu)->bytes_transferred += len;
221 per_cpu_ptr(chan->local, cpu)->memcpy_count++;
222 put_cpu();
223
224 return chan->device->device_memcpy_buf_to_buf(chan, dest, src, len);
225}
226
227/**
228 * dma_async_memcpy_buf_to_pg - offloaded copy
229 * @chan: DMA channel to offload copy to
230 * @page: destination page
231 * @offset: offset in page to copy to
232 * @kdata: source address (virtual)
233 * @len: length
234 *
235 * Both @page/@offset and @kdata must be mappable to a bus address according
236 * to the DMA mapping API rules for streaming mappings.
237 * Both @page/@offset and @kdata must stay memory resident (kernel memory or
238 * locked user space pages)
239 */
240static inline dma_cookie_t dma_async_memcpy_buf_to_pg(struct dma_chan *chan,
241 struct page *page, unsigned int offset, void *kdata, size_t len)
242{
243 int cpu = get_cpu();
244 per_cpu_ptr(chan->local, cpu)->bytes_transferred += len;
245 per_cpu_ptr(chan->local, cpu)->memcpy_count++;
246 put_cpu();
247
248 return chan->device->device_memcpy_buf_to_pg(chan, page, offset,
249 kdata, len);
250}
251
252/**
253 * dma_async_memcpy_buf_to_pg - offloaded copy
254 * @chan: DMA channel to offload copy to
255 * @dest_page: destination page
256 * @dest_off: offset in page to copy to
257 * @src_page: source page
258 * @src_off: offset in page to copy from
259 * @len: length
260 *
261 * Both @dest_page/@dest_off and @src_page/@src_off must be mappable to a bus
262 * address according to the DMA mapping API rules for streaming mappings.
263 * Both @dest_page/@dest_off and @src_page/@src_off must stay memory resident
264 * (kernel memory or locked user space pages)
265 */
266static inline dma_cookie_t dma_async_memcpy_pg_to_pg(struct dma_chan *chan,
267 struct page *dest_pg, unsigned int dest_off, struct page *src_pg,
268 unsigned int src_off, size_t len)
269{
270 int cpu = get_cpu();
271 per_cpu_ptr(chan->local, cpu)->bytes_transferred += len;
272 per_cpu_ptr(chan->local, cpu)->memcpy_count++;
273 put_cpu();
274
275 return chan->device->device_memcpy_pg_to_pg(chan, dest_pg, dest_off,
276 src_pg, src_off, len);
277}
278
279/**
280 * dma_async_memcpy_issue_pending - flush pending copies to HW
281 * @chan:
282 *
283 * This allows drivers to push copies to HW in batches,
284 * reducing MMIO writes where possible.
285 */
286static inline void dma_async_memcpy_issue_pending(struct dma_chan *chan)
287{
288 return chan->device->device_memcpy_issue_pending(chan);
289}
290
291/**
292 * dma_async_memcpy_complete - poll for transaction completion
293 * @chan: DMA channel
294 * @cookie: transaction identifier to check status of
295 * @last: returns last completed cookie, can be NULL
296 * @used: returns last issued cookie, can be NULL
297 *
298 * If @last and @used are passed in, upon return they reflect the driver
299 * internal state and can be used with dma_async_is_complete() to check
300 * the status of multiple cookies without re-checking hardware state.
301 */
302static inline enum dma_status dma_async_memcpy_complete(struct dma_chan *chan,
303 dma_cookie_t cookie, dma_cookie_t *last, dma_cookie_t *used)
304{
305 return chan->device->device_memcpy_complete(chan, cookie, last, used);
306}
307
308/**
309 * dma_async_is_complete - test a cookie against chan state
310 * @cookie: transaction identifier to test status of
311 * @last_complete: last know completed transaction
312 * @last_used: last cookie value handed out
313 *
314 * dma_async_is_complete() is used in dma_async_memcpy_complete()
315 * the test logic is seperated for lightweight testing of multiple cookies
316 */
317static inline enum dma_status dma_async_is_complete(dma_cookie_t cookie,
318 dma_cookie_t last_complete, dma_cookie_t last_used)
319{
320 if (last_complete <= last_used) {
321 if ((cookie <= last_complete) || (cookie > last_used))
322 return DMA_SUCCESS;
323 } else {
324 if ((cookie <= last_complete) && (cookie > last_used))
325 return DMA_SUCCESS;
326 }
327 return DMA_IN_PROGRESS;
328}
329
330
331/* --- DMA device --- */
332
333int dma_async_device_register(struct dma_device *device);
334void dma_async_device_unregister(struct dma_device *device);
335
336/* --- Helper iov-locking functions --- */
337
338struct dma_page_list {
339 char *base_address;
340 int nr_pages;
341 struct page **pages;
342};
343
344struct dma_pinned_list {
345 int nr_iovecs;
346 struct dma_page_list page_list[0];
347};
348
349struct dma_pinned_list *dma_pin_iovec_pages(struct iovec *iov, size_t len);
350void dma_unpin_iovec_pages(struct dma_pinned_list* pinned_list);
351
352dma_cookie_t dma_memcpy_to_iovec(struct dma_chan *chan, struct iovec *iov,
353 struct dma_pinned_list *pinned_list, unsigned char *kdata, size_t len);
354dma_cookie_t dma_memcpy_pg_to_iovec(struct dma_chan *chan, struct iovec *iov,
355 struct dma_pinned_list *pinned_list, struct page *page,
356 unsigned int offset, size_t len);
357
358#endif /* CONFIG_DMA_ENGINE */
359#endif /* DMAENGINE_H */
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index ad133fcfb239..1713ace808bf 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -21,7 +21,7 @@ typedef void (elevator_put_req_fn) (request_queue_t *, struct request *);
21typedef void (elevator_activate_req_fn) (request_queue_t *, struct request *); 21typedef void (elevator_activate_req_fn) (request_queue_t *, struct request *);
22typedef void (elevator_deactivate_req_fn) (request_queue_t *, struct request *); 22typedef void (elevator_deactivate_req_fn) (request_queue_t *, struct request *);
23 23
24typedef int (elevator_init_fn) (request_queue_t *, elevator_t *); 24typedef void *(elevator_init_fn) (request_queue_t *, elevator_t *);
25typedef void (elevator_exit_fn) (elevator_t *); 25typedef void (elevator_exit_fn) (elevator_t *);
26 26
27struct elevator_ops 27struct elevator_ops
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 306acf1dc6d5..7d2a1b974c5e 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -127,7 +127,7 @@ extern ktime_t hrtimer_get_next_event(void);
127 127
128static inline int hrtimer_active(const struct hrtimer *timer) 128static inline int hrtimer_active(const struct hrtimer *timer)
129{ 129{
130 return timer->node.rb_parent != HRTIMER_INACTIVE; 130 return rb_parent(&timer->node) != &timer->node;
131} 131}
132 132
133/* Forward a hrtimer so it expires after now: */ 133/* Forward a hrtimer so it expires after now: */
diff --git a/include/linux/i2o.h b/include/linux/i2o.h
index dd7d627bf66f..c115e9e840b4 100644
--- a/include/linux/i2o.h
+++ b/include/linux/i2o.h
@@ -1114,8 +1114,11 @@ static inline struct i2o_message *i2o_msg_get(struct i2o_controller *c)
1114 1114
1115 mmsg->mfa = readl(c->in_port); 1115 mmsg->mfa = readl(c->in_port);
1116 if (unlikely(mmsg->mfa >= c->in_queue.len)) { 1116 if (unlikely(mmsg->mfa >= c->in_queue.len)) {
1117 u32 mfa = mmsg->mfa;
1118
1117 mempool_free(mmsg, c->in_msg.mempool); 1119 mempool_free(mmsg, c->in_msg.mempool);
1118 if(mmsg->mfa == I2O_QUEUE_EMPTY) 1120
1121 if (mfa == I2O_QUEUE_EMPTY)
1119 return ERR_PTR(-EBUSY); 1122 return ERR_PTR(-EBUSY);
1120 return ERR_PTR(-EFAULT); 1123 return ERR_PTR(-EFAULT);
1121 } 1124 }
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index 28f4f3b36950..899c3d4776f3 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -169,7 +169,7 @@ struct ip_sf_list
169struct ip_mc_list 169struct ip_mc_list
170{ 170{
171 struct in_device *interface; 171 struct in_device *interface;
172 unsigned long multiaddr; 172 __be32 multiaddr;
173 struct ip_sf_list *sources; 173 struct ip_sf_list *sources;
174 struct ip_sf_list *tomb; 174 struct ip_sf_list *tomb;
175 unsigned int sfmode; 175 unsigned int sfmode;
diff --git a/include/linux/input.h b/include/linux/input.h
index b48d9873cbbc..b32c2b6e53f6 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -346,6 +346,8 @@ struct input_absinfo {
346#define KEY_SAVE 234 346#define KEY_SAVE 234
347#define KEY_DOCUMENTS 235 347#define KEY_DOCUMENTS 235
348 348
349#define KEY_BATTERY 236
350
349#define KEY_UNKNOWN 240 351#define KEY_UNKNOWN 240
350 352
351#define BTN_MISC 0x100 353#define BTN_MISC 0x100
@@ -578,14 +580,9 @@ struct input_absinfo {
578 * Switch events 580 * Switch events
579 */ 581 */
580 582
581#define SW_0 0x00 583#define SW_LID 0x00 /* set = lid shut */
582#define SW_1 0x01 584#define SW_TABLET_MODE 0x01 /* set = tablet mode */
583#define SW_2 0x02 585#define SW_HEADPHONE_INSERT 0x02 /* set = inserted */
584#define SW_3 0x03
585#define SW_4 0x04
586#define SW_5 0x05
587#define SW_6 0x06
588#define SW_7 0x07
589#define SW_MAX 0x0f 586#define SW_MAX 0x0f
590 587
591/* 588/*
diff --git a/include/linux/jffs2.h b/include/linux/jffs2.h
index cf792bb3c726..c6f70660b371 100644
--- a/include/linux/jffs2.h
+++ b/include/linux/jffs2.h
@@ -65,6 +65,18 @@
65 65
66#define JFFS2_NODETYPE_SUMMARY (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 6) 66#define JFFS2_NODETYPE_SUMMARY (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 6)
67 67
68#define JFFS2_NODETYPE_XATTR (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 8)
69#define JFFS2_NODETYPE_XREF (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 9)
70
71/* XATTR Related */
72#define JFFS2_XPREFIX_USER 1 /* for "user." */
73#define JFFS2_XPREFIX_SECURITY 2 /* for "security." */
74#define JFFS2_XPREFIX_ACL_ACCESS 3 /* for "system.posix_acl_access" */
75#define JFFS2_XPREFIX_ACL_DEFAULT 4 /* for "system.posix_acl_default" */
76#define JFFS2_XPREFIX_TRUSTED 5 /* for "trusted.*" */
77
78#define JFFS2_ACL_VERSION 0x0001
79
68// Maybe later... 80// Maybe later...
69//#define JFFS2_NODETYPE_CHECKPOINT (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 3) 81//#define JFFS2_NODETYPE_CHECKPOINT (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 3)
70//#define JFFS2_NODETYPE_OPTIONS (JFFS2_FEATURE_RWCOMPAT_COPY | JFFS2_NODE_ACCURATE | 4) 82//#define JFFS2_NODETYPE_OPTIONS (JFFS2_FEATURE_RWCOMPAT_COPY | JFFS2_NODE_ACCURATE | 4)
@@ -82,11 +94,11 @@
82 94
83typedef struct { 95typedef struct {
84 uint32_t v32; 96 uint32_t v32;
85} __attribute__((packed)) jint32_t; 97} __attribute__((packed)) jint32_t;
86 98
87typedef struct { 99typedef struct {
88 uint32_t m; 100 uint32_t m;
89} __attribute__((packed)) jmode_t; 101} __attribute__((packed)) jmode_t;
90 102
91typedef struct { 103typedef struct {
92 uint16_t v16; 104 uint16_t v16;
@@ -99,7 +111,7 @@ struct jffs2_unknown_node
99 jint16_t nodetype; 111 jint16_t nodetype;
100 jint32_t totlen; /* So we can skip over nodes we don't grok */ 112 jint32_t totlen; /* So we can skip over nodes we don't grok */
101 jint32_t hdr_crc; 113 jint32_t hdr_crc;
102} __attribute__((packed)); 114};
103 115
104struct jffs2_raw_dirent 116struct jffs2_raw_dirent
105{ 117{
@@ -117,7 +129,7 @@ struct jffs2_raw_dirent
117 jint32_t node_crc; 129 jint32_t node_crc;
118 jint32_t name_crc; 130 jint32_t name_crc;
119 uint8_t name[0]; 131 uint8_t name[0];
120} __attribute__((packed)); 132};
121 133
122/* The JFFS2 raw inode structure: Used for storage on physical media. */ 134/* The JFFS2 raw inode structure: Used for storage on physical media. */
123/* The uid, gid, atime, mtime and ctime members could be longer, but 135/* The uid, gid, atime, mtime and ctime members could be longer, but
@@ -149,6 +161,32 @@ struct jffs2_raw_inode
149 jint32_t data_crc; /* CRC for the (compressed) data. */ 161 jint32_t data_crc; /* CRC for the (compressed) data. */
150 jint32_t node_crc; /* CRC for the raw inode (excluding data) */ 162 jint32_t node_crc; /* CRC for the raw inode (excluding data) */
151 uint8_t data[0]; 163 uint8_t data[0];
164};
165
166struct jffs2_raw_xattr {
167 jint16_t magic;
168 jint16_t nodetype; /* = JFFS2_NODETYPE_XATTR */
169 jint32_t totlen;
170 jint32_t hdr_crc;
171 jint32_t xid; /* XATTR identifier number */
172 jint32_t version;
173 uint8_t xprefix;
174 uint8_t name_len;
175 jint16_t value_len;
176 jint32_t data_crc;
177 jint32_t node_crc;
178 uint8_t data[0];
179} __attribute__((packed));
180
181struct jffs2_raw_xref
182{
183 jint16_t magic;
184 jint16_t nodetype; /* = JFFS2_NODETYPE_XREF */
185 jint32_t totlen;
186 jint32_t hdr_crc;
187 jint32_t ino; /* inode number */
188 jint32_t xid; /* XATTR identifier number */
189 jint32_t node_crc;
152} __attribute__((packed)); 190} __attribute__((packed));
153 191
154struct jffs2_raw_summary 192struct jffs2_raw_summary
@@ -163,14 +201,22 @@ struct jffs2_raw_summary
163 jint32_t sum_crc; /* summary information crc */ 201 jint32_t sum_crc; /* summary information crc */
164 jint32_t node_crc; /* node crc */ 202 jint32_t node_crc; /* node crc */
165 jint32_t sum[0]; /* inode summary info */ 203 jint32_t sum[0]; /* inode summary info */
166} __attribute__((packed)); 204};
167 205
168union jffs2_node_union 206union jffs2_node_union
169{ 207{
170 struct jffs2_raw_inode i; 208 struct jffs2_raw_inode i;
171 struct jffs2_raw_dirent d; 209 struct jffs2_raw_dirent d;
210 struct jffs2_raw_xattr x;
211 struct jffs2_raw_xref r;
172 struct jffs2_raw_summary s; 212 struct jffs2_raw_summary s;
173 struct jffs2_unknown_node u; 213 struct jffs2_unknown_node u;
174}; 214};
175 215
216/* Data payload for device nodes. */
217union jffs2_device_node {
218 jint16_t old;
219 jint32_t new;
220};
221
176#endif /* __LINUX_JFFS2_H__ */ 222#endif /* __LINUX_JFFS2_H__ */
diff --git a/include/linux/jffs2_fs_i.h b/include/linux/jffs2_fs_i.h
deleted file mode 100644
index ad565bf9dcc1..000000000000
--- a/include/linux/jffs2_fs_i.h
+++ /dev/null
@@ -1,50 +0,0 @@
1/* $Id: jffs2_fs_i.h,v 1.19 2005/11/07 11:14:52 gleixner Exp $ */
2
3#ifndef _JFFS2_FS_I
4#define _JFFS2_FS_I
5
6#include <linux/version.h>
7#include <linux/rbtree.h>
8#include <asm/semaphore.h>
9
10struct jffs2_inode_info {
11 /* We need an internal mutex similar to inode->i_mutex.
12 Unfortunately, we can't used the existing one, because
13 either the GC would deadlock, or we'd have to release it
14 before letting GC proceed. Or we'd have to put ugliness
15 into the GC code so it didn't attempt to obtain the i_mutex
16 for the inode(s) which are already locked */
17 struct semaphore sem;
18
19 /* The highest (datanode) version number used for this ino */
20 uint32_t highest_version;
21
22 /* List of data fragments which make up the file */
23 struct rb_root fragtree;
24
25 /* There may be one datanode which isn't referenced by any of the
26 above fragments, if it contains a metadata update but no actual
27 data - or if this is a directory inode */
28 /* This also holds the _only_ dnode for symlinks/device nodes,
29 etc. */
30 struct jffs2_full_dnode *metadata;
31
32 /* Directory entries */
33 struct jffs2_full_dirent *dents;
34
35 /* The target path if this is the inode of a symlink */
36 unsigned char *target;
37
38 /* Some stuff we just have to keep in-core at all times, for each inode. */
39 struct jffs2_inode_cache *inocache;
40
41 uint16_t flags;
42 uint8_t usercompr;
43#if !defined (__ECOS)
44#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,2)
45 struct inode vfs_inode;
46#endif
47#endif
48};
49
50#endif /* _JFFS2_FS_I */
diff --git a/include/linux/jffs2_fs_sb.h b/include/linux/jffs2_fs_sb.h
deleted file mode 100644
index 4bcfb5570221..000000000000
--- a/include/linux/jffs2_fs_sb.h
+++ /dev/null
@@ -1,122 +0,0 @@
1/* $Id: jffs2_fs_sb.h,v 1.54 2005/09/21 13:37:34 dedekind Exp $ */
2
3#ifndef _JFFS2_FS_SB
4#define _JFFS2_FS_SB
5
6#include <linux/types.h>
7#include <linux/spinlock.h>
8#include <linux/workqueue.h>
9#include <linux/completion.h>
10#include <asm/semaphore.h>
11#include <linux/timer.h>
12#include <linux/wait.h>
13#include <linux/list.h>
14#include <linux/rwsem.h>
15
16#define JFFS2_SB_FLAG_RO 1
17#define JFFS2_SB_FLAG_SCANNING 2 /* Flash scanning is in progress */
18#define JFFS2_SB_FLAG_BUILDING 4 /* File system building is in progress */
19
20struct jffs2_inodirty;
21
22/* A struct for the overall file system control. Pointers to
23 jffs2_sb_info structs are named `c' in the source code.
24 Nee jffs_control
25*/
26struct jffs2_sb_info {
27 struct mtd_info *mtd;
28
29 uint32_t highest_ino;
30 uint32_t checked_ino;
31
32 unsigned int flags;
33
34 struct task_struct *gc_task; /* GC task struct */
35 struct completion gc_thread_start; /* GC thread start completion */
36 struct completion gc_thread_exit; /* GC thread exit completion port */
37
38 struct semaphore alloc_sem; /* Used to protect all the following
39 fields, and also to protect against
40 out-of-order writing of nodes. And GC. */
41 uint32_t cleanmarker_size; /* Size of an _inline_ CLEANMARKER
42 (i.e. zero for OOB CLEANMARKER */
43
44 uint32_t flash_size;
45 uint32_t used_size;
46 uint32_t dirty_size;
47 uint32_t wasted_size;
48 uint32_t free_size;
49 uint32_t erasing_size;
50 uint32_t bad_size;
51 uint32_t sector_size;
52 uint32_t unchecked_size;
53
54 uint32_t nr_free_blocks;
55 uint32_t nr_erasing_blocks;
56
57 /* Number of free blocks there must be before we... */
58 uint8_t resv_blocks_write; /* ... allow a normal filesystem write */
59 uint8_t resv_blocks_deletion; /* ... allow a normal filesystem deletion */
60 uint8_t resv_blocks_gctrigger; /* ... wake up the GC thread */
61 uint8_t resv_blocks_gcbad; /* ... pick a block from the bad_list to GC */
62 uint8_t resv_blocks_gcmerge; /* ... merge pages when garbage collecting */
63
64 uint32_t nospc_dirty_size;
65
66 uint32_t nr_blocks;
67 struct jffs2_eraseblock *blocks; /* The whole array of blocks. Used for getting blocks
68 * from the offset (blocks[ofs / sector_size]) */
69 struct jffs2_eraseblock *nextblock; /* The block we're currently filling */
70
71 struct jffs2_eraseblock *gcblock; /* The block we're currently garbage-collecting */
72
73 struct list_head clean_list; /* Blocks 100% full of clean data */
74 struct list_head very_dirty_list; /* Blocks with lots of dirty space */
75 struct list_head dirty_list; /* Blocks with some dirty space */
76 struct list_head erasable_list; /* Blocks which are completely dirty, and need erasing */
77 struct list_head erasable_pending_wbuf_list; /* Blocks which need erasing but only after the current wbuf is flushed */
78 struct list_head erasing_list; /* Blocks which are currently erasing */
79 struct list_head erase_pending_list; /* Blocks which need erasing now */
80 struct list_head erase_complete_list; /* Blocks which are erased and need the clean marker written to them */
81 struct list_head free_list; /* Blocks which are free and ready to be used */
82 struct list_head bad_list; /* Bad blocks. */
83 struct list_head bad_used_list; /* Bad blocks with valid data in. */
84
85 spinlock_t erase_completion_lock; /* Protect free_list and erasing_list
86 against erase completion handler */
87 wait_queue_head_t erase_wait; /* For waiting for erases to complete */
88
89 wait_queue_head_t inocache_wq;
90 struct jffs2_inode_cache **inocache_list;
91 spinlock_t inocache_lock;
92
93 /* Sem to allow jffs2_garbage_collect_deletion_dirent to
94 drop the erase_completion_lock while it's holding a pointer
95 to an obsoleted node. I don't like this. Alternatives welcomed. */
96 struct semaphore erase_free_sem;
97
98 uint32_t wbuf_pagesize; /* 0 for NOR and other flashes with no wbuf */
99
100#ifdef CONFIG_JFFS2_FS_WRITEBUFFER
101 /* Write-behind buffer for NAND flash */
102 unsigned char *wbuf;
103 uint32_t wbuf_ofs;
104 uint32_t wbuf_len;
105 struct jffs2_inodirty *wbuf_inodes;
106
107 struct rw_semaphore wbuf_sem; /* Protects the write buffer */
108
109 /* Information about out-of-band area usage... */
110 struct nand_oobinfo *oobinfo;
111 uint32_t badblock_pos;
112 uint32_t fsdata_pos;
113 uint32_t fsdata_len;
114#endif
115
116 struct jffs2_summary *summary; /* Summary information */
117
118 /* OS-private pointer for getting back to master superblock info */
119 void *os_priv;
120};
121
122#endif /* _JFFS2_FB_SB */
diff --git a/include/linux/m48t86.h b/include/linux/m48t86.h
index 9065199319d0..915d6b4f0f89 100644
--- a/include/linux/m48t86.h
+++ b/include/linux/m48t86.h
@@ -11,6 +11,6 @@
11 11
12struct m48t86_ops 12struct m48t86_ops
13{ 13{
14 void (*writeb)(unsigned char value, unsigned long addr); 14 void (*writebyte)(unsigned char value, unsigned long addr);
15 unsigned char (*readb)(unsigned long addr); 15 unsigned char (*readbyte)(unsigned long addr);
16}; 16};
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index 8dfdd352bccd..72440f0a443d 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -35,6 +35,7 @@
35#include <linux/nodemask.h> 35#include <linux/nodemask.h>
36 36
37struct vm_area_struct; 37struct vm_area_struct;
38struct mm_struct;
38 39
39#ifdef CONFIG_NUMA 40#ifdef CONFIG_NUMA
40 41
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 230180c3eb61..9742e3c16222 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -14,6 +14,7 @@
14#include <linux/seqlock.h> 14#include <linux/seqlock.h>
15#include <linux/nodemask.h> 15#include <linux/nodemask.h>
16#include <asm/atomic.h> 16#include <asm/atomic.h>
17#include <asm/page.h>
17 18
18/* Free memory management - zoned buddy allocator. */ 19/* Free memory management - zoned buddy allocator. */
19#ifndef CONFIG_FORCE_MAX_ZONEORDER 20#ifndef CONFIG_FORCE_MAX_ZONEORDER
diff --git a/include/linux/module.h b/include/linux/module.h
index 05e7dd17b7d0..c2d89e037af0 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -556,13 +556,4 @@ static inline void module_remove_driver(struct device_driver *driver)
556 556
557#define __MODULE_STRING(x) __stringify(x) 557#define __MODULE_STRING(x) __stringify(x)
558 558
559/* Use symbol_get and symbol_put instead. You'll thank me. */
560#define HAVE_INTER_MODULE
561extern void __deprecated inter_module_register(const char *,
562 struct module *, const void *);
563extern void __deprecated inter_module_unregister(const char *);
564extern const void * __deprecated inter_module_get_request(const char *,
565 const char *);
566extern void __deprecated inter_module_put(const char *);
567
568#endif /* _LINUX_MODULE_H */ 559#endif /* _LINUX_MODULE_H */
diff --git a/include/linux/mtd/inftl.h b/include/linux/mtd/inftl.h
index d7eaa40e5ab0..6977780e548f 100644
--- a/include/linux/mtd/inftl.h
+++ b/include/linux/mtd/inftl.h
@@ -46,7 +46,7 @@ struct INFTLrecord {
46 unsigned int nb_blocks; /* number of physical blocks */ 46 unsigned int nb_blocks; /* number of physical blocks */
47 unsigned int nb_boot_blocks; /* number of blocks used by the bios */ 47 unsigned int nb_boot_blocks; /* number of blocks used by the bios */
48 struct erase_info instr; 48 struct erase_info instr;
49 struct nand_oobinfo oobinfo; 49 struct nand_ecclayout oobinfo;
50}; 50};
51 51
52int INFTL_mount(struct INFTLrecord *s); 52int INFTL_mount(struct INFTLrecord *s);
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 012a47df1960..9b7a2b525d63 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -55,18 +55,69 @@ struct mtd_erase_region_info {
55 u_int32_t numblocks; /* Number of blocks of erasesize in this region */ 55 u_int32_t numblocks; /* Number of blocks of erasesize in this region */
56}; 56};
57 57
58/*
59 * oob operation modes
60 *
61 * MTD_OOB_PLACE: oob data are placed at the given offset
62 * MTD_OOB_AUTO: oob data are automatically placed at the free areas
63 * which are defined by the ecclayout
64 * MTD_OOB_RAW: mode to read raw data+oob in one chunk. The oob data
65 * is inserted into the data. Thats a raw image of the
66 * flash contents.
67 */
68typedef enum {
69 MTD_OOB_PLACE,
70 MTD_OOB_AUTO,
71 MTD_OOB_RAW,
72} mtd_oob_mode_t;
73
74/**
75 * struct mtd_oob_ops - oob operation operands
76 * @mode: operation mode
77 *
78 * @len: number of bytes to write/read. When a data buffer is given
79 * (datbuf != NULL) this is the number of data bytes. When
80 + no data buffer is available this is the number of oob bytes.
81 *
82 * @retlen: number of bytes written/read. When a data buffer is given
83 * (datbuf != NULL) this is the number of data bytes. When
84 + no data buffer is available this is the number of oob bytes.
85 *
86 * @ooblen: number of oob bytes per page
87 * @ooboffs: offset of oob data in the oob area (only relevant when
88 * mode = MTD_OOB_PLACE)
89 * @datbuf: data buffer - if NULL only oob data are read/written
90 * @oobbuf: oob data buffer
91 */
92struct mtd_oob_ops {
93 mtd_oob_mode_t mode;
94 size_t len;
95 size_t retlen;
96 size_t ooblen;
97 uint32_t ooboffs;
98 uint8_t *datbuf;
99 uint8_t *oobbuf;
100};
101
58struct mtd_info { 102struct mtd_info {
59 u_char type; 103 u_char type;
60 u_int32_t flags; 104 u_int32_t flags;
61 u_int32_t size; // Total size of the MTD 105 u_int32_t size; // Total size of the MTD
62 106
63 /* "Major" erase size for the device. Naïve users may take this 107 /* "Major" erase size for the device. Naïve users may take this
64 * to be the only erase size available, or may use the more detailed 108 * to be the only erase size available, or may use the more detailed
65 * information below if they desire 109 * information below if they desire
66 */ 110 */
67 u_int32_t erasesize; 111 u_int32_t erasesize;
112 /* Minimal writable flash unit size. In case of NOR flash it is 1 (even
113 * though individual bits can be cleared), in case of NAND flash it is
114 * one NAND page (or half, or one-fourths of it), in case of ECC-ed NOR
115 * it is of ECC block size, etc. It is illegal to have writesize = 0.
116 * Any driver registering a struct mtd_info must ensure a writesize of
117 * 1 or larger.
118 */
119 u_int32_t writesize;
68 120
69 u_int32_t oobblock; // Size of OOB blocks (e.g. 512)
70 u_int32_t oobsize; // Amount of OOB data per block (e.g. 16) 121 u_int32_t oobsize; // Amount of OOB data per block (e.g. 16)
71 u_int32_t ecctype; 122 u_int32_t ecctype;
72 u_int32_t eccsize; 123 u_int32_t eccsize;
@@ -78,7 +129,6 @@ struct mtd_info {
78 * MTD_PROGRAM_REGIONS flag is set. 129 * MTD_PROGRAM_REGIONS flag is set.
79 * (Maybe we should have an union for those?) 130 * (Maybe we should have an union for those?)
80 */ 131 */
81#define MTD_PROGREGION_SIZE(mtd) (mtd)->oobblock
82#define MTD_PROGREGION_CTRLMODE_VALID(mtd) (mtd)->oobsize 132#define MTD_PROGREGION_CTRLMODE_VALID(mtd) (mtd)->oobsize
83#define MTD_PROGREGION_CTRLMODE_INVALID(mtd) (mtd)->ecctype 133#define MTD_PROGREGION_CTRLMODE_INVALID(mtd) (mtd)->ecctype
84 134
@@ -86,9 +136,8 @@ struct mtd_info {
86 char *name; 136 char *name;
87 int index; 137 int index;
88 138
89 // oobinfo is a nand_oobinfo structure, which can be set by iotcl (MEMSETOOBINFO) 139 /* ecc layout structure pointer - read only ! */
90 struct nand_oobinfo oobinfo; 140 struct nand_ecclayout *ecclayout;
91 u_int32_t oobavail; // Number of bytes in OOB area available for fs
92 141
93 /* Data for variable erase regions. If numeraseregions is zero, 142 /* Data for variable erase regions. If numeraseregions is zero,
94 * it means that the whole device has erasesize as given above. 143 * it means that the whole device has erasesize as given above.
@@ -111,11 +160,10 @@ struct mtd_info {
111 int (*read) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); 160 int (*read) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf);
112 int (*write) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf); 161 int (*write) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf);
113 162
114 int (*read_ecc) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf, u_char *eccbuf, struct nand_oobinfo *oobsel); 163 int (*read_oob) (struct mtd_info *mtd, loff_t from,
115 int (*write_ecc) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf, u_char *eccbuf, struct nand_oobinfo *oobsel); 164 struct mtd_oob_ops *ops);
116 165 int (*write_oob) (struct mtd_info *mtd, loff_t to,
117 int (*read_oob) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); 166 struct mtd_oob_ops *ops);
118 int (*write_oob) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf);
119 167
120 /* 168 /*
121 * Methods to access the protection register area, present in some 169 * Methods to access the protection register area, present in some
@@ -129,17 +177,11 @@ struct mtd_info {
129 int (*write_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); 177 int (*write_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf);
130 int (*lock_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len); 178 int (*lock_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len);
131 179
132 /* kvec-based read/write methods. We need these especially for NAND flash, 180 /* kvec-based read/write methods.
133 with its limited number of write cycles per erase.
134 NB: The 'count' parameter is the number of _vectors_, each of 181 NB: The 'count' parameter is the number of _vectors_, each of
135 which contains an (ofs, len) tuple. 182 which contains an (ofs, len) tuple.
136 */ 183 */
137 int (*readv) (struct mtd_info *mtd, struct kvec *vecs, unsigned long count, loff_t from, size_t *retlen);
138 int (*readv_ecc) (struct mtd_info *mtd, struct kvec *vecs, unsigned long count, loff_t from,
139 size_t *retlen, u_char *eccbuf, struct nand_oobinfo *oobsel);
140 int (*writev) (struct mtd_info *mtd, const struct kvec *vecs, unsigned long count, loff_t to, size_t *retlen); 184 int (*writev) (struct mtd_info *mtd, const struct kvec *vecs, unsigned long count, loff_t to, size_t *retlen);
141 int (*writev_ecc) (struct mtd_info *mtd, const struct kvec *vecs, unsigned long count, loff_t to,
142 size_t *retlen, u_char *eccbuf, struct nand_oobinfo *oobsel);
143 185
144 /* Sync */ 186 /* Sync */
145 void (*sync) (struct mtd_info *mtd); 187 void (*sync) (struct mtd_info *mtd);
@@ -158,6 +200,9 @@ struct mtd_info {
158 200
159 struct notifier_block reboot_notifier; /* default mode before reboot */ 201 struct notifier_block reboot_notifier; /* default mode before reboot */
160 202
203 /* ECC status information */
204 struct mtd_ecc_stats ecc_stats;
205
161 void *priv; 206 void *priv;
162 207
163 struct module *owner; 208 struct module *owner;
@@ -191,20 +236,6 @@ int default_mtd_writev(struct mtd_info *mtd, const struct kvec *vecs,
191int default_mtd_readv(struct mtd_info *mtd, struct kvec *vecs, 236int default_mtd_readv(struct mtd_info *mtd, struct kvec *vecs,
192 unsigned long count, loff_t from, size_t *retlen); 237 unsigned long count, loff_t from, size_t *retlen);
193 238
194#define MTD_ERASE(mtd, args...) (*(mtd->erase))(mtd, args)
195#define MTD_POINT(mtd, a,b,c,d) (*(mtd->point))(mtd, a,b,c, (u_char **)(d))
196#define MTD_UNPOINT(mtd, arg) (*(mtd->unpoint))(mtd, (u_char *)arg)
197#define MTD_READ(mtd, args...) (*(mtd->read))(mtd, args)
198#define MTD_WRITE(mtd, args...) (*(mtd->write))(mtd, args)
199#define MTD_READV(mtd, args...) (*(mtd->readv))(mtd, args)
200#define MTD_WRITEV(mtd, args...) (*(mtd->writev))(mtd, args)
201#define MTD_READECC(mtd, args...) (*(mtd->read_ecc))(mtd, args)
202#define MTD_WRITEECC(mtd, args...) (*(mtd->write_ecc))(mtd, args)
203#define MTD_READOOB(mtd, args...) (*(mtd->read_oob))(mtd, args)
204#define MTD_WRITEOOB(mtd, args...) (*(mtd->write_oob))(mtd, args)
205#define MTD_SYNC(mtd) do { if (mtd->sync) (*(mtd->sync))(mtd); } while (0)
206
207
208#ifdef CONFIG_MTD_PARTITIONS 239#ifdef CONFIG_MTD_PARTITIONS
209void mtd_erase_callback(struct erase_info *instr); 240void mtd_erase_callback(struct erase_info *instr);
210#else 241#else
@@ -225,7 +256,7 @@ static inline void mtd_erase_callback(struct erase_info *instr)
225 256
226#ifdef CONFIG_MTD_DEBUG 257#ifdef CONFIG_MTD_DEBUG
227#define DEBUG(n, args...) \ 258#define DEBUG(n, args...) \
228 do { \ 259 do { \
229 if (n <= CONFIG_MTD_DEBUG_VERBOSE) \ 260 if (n <= CONFIG_MTD_DEBUG_VERBOSE) \
230 printk(KERN_INFO args); \ 261 printk(KERN_INFO args); \
231 } while(0) 262 } while(0)
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 4b99d285803f..66559272ebcb 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -11,47 +11,11 @@
11 * it under the terms of the GNU General Public License version 2 as 11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 * 13 *
14 * Info: 14 * Info:
15 * Contains standard defines and IDs for NAND flash devices 15 * Contains standard defines and IDs for NAND flash devices
16 * 16 *
17 * Changelog: 17 * Changelog:
18 * 01-31-2000 DMW Created 18 * See git changelog.
19 * 09-18-2000 SJH Moved structure out of the Disk-On-Chip drivers
20 * so it can be used by other NAND flash device
21 * drivers. I also changed the copyright since none
22 * of the original contents of this file are specific
23 * to DoC devices. David can whack me with a baseball
24 * bat later if I did something naughty.
25 * 10-11-2000 SJH Added private NAND flash structure for driver
26 * 10-24-2000 SJH Added prototype for 'nand_scan' function
27 * 10-29-2001 TG changed nand_chip structure to support
28 * hardwarespecific function for accessing control lines
29 * 02-21-2002 TG added support for different read/write adress and
30 * ready/busy line access function
31 * 02-26-2002 TG added chip_delay to nand_chip structure to optimize
32 * command delay times for different chips
33 * 04-28-2002 TG OOB config defines moved from nand.c to avoid duplicate
34 * defines in jffs2/wbuf.c
35 * 08-07-2002 TG forced bad block location to byte 5 of OOB, even if
36 * CONFIG_MTD_NAND_ECC_JFFS2 is not set
37 * 08-10-2002 TG extensions to nand_chip structure to support HW-ECC
38 *
39 * 08-29-2002 tglx nand_chip structure: data_poi for selecting
40 * internal / fs-driver buffer
41 * support for 6byte/512byte hardware ECC
42 * read_ecc, write_ecc extended for different oob-layout
43 * oob layout selections: NAND_NONE_OOB, NAND_JFFS2_OOB,
44 * NAND_YAFFS_OOB
45 * 11-25-2002 tglx Added Manufacturer code FUJITSU, NATIONAL
46 * Split manufacturer and device ID structures
47 *
48 * 02-08-2004 tglx added option field to nand structure for chip anomalities
49 * 05-25-2004 tglx added bad block table support, ST-MICRO manufacturer id
50 * update of nand_chip structure description
51 * 01-17-2005 dmarlin added extended commands for AG-AND device and added option
52 * for BBT_AUTO_REFRESH.
53 * 01-20-2005 dmarlin added optional pointer to hardware specific callback for
54 * extra error status checks.
55 */ 19 */
56#ifndef __LINUX_MTD_NAND_H 20#ifndef __LINUX_MTD_NAND_H
57#define __LINUX_MTD_NAND_H 21#define __LINUX_MTD_NAND_H
@@ -66,10 +30,6 @@ extern int nand_scan (struct mtd_info *mtd, int max_chips);
66/* Free resources held by the NAND device */ 30/* Free resources held by the NAND device */
67extern void nand_release (struct mtd_info *mtd); 31extern void nand_release (struct mtd_info *mtd);
68 32
69/* Read raw data from the device without ECC */
70extern int nand_read_raw (struct mtd_info *mtd, uint8_t *buf, loff_t from, size_t len, size_t ooblen);
71
72
73/* The maximum number of NAND chips in an array */ 33/* The maximum number of NAND chips in an array */
74#define NAND_MAX_CHIPS 8 34#define NAND_MAX_CHIPS 8
75 35
@@ -78,44 +38,45 @@ extern int nand_read_raw (struct mtd_info *mtd, uint8_t *buf, loff_t from, size_
78 * adjust this accordingly. 38 * adjust this accordingly.
79 */ 39 */
80#define NAND_MAX_OOBSIZE 64 40#define NAND_MAX_OOBSIZE 64
41#define NAND_MAX_PAGESIZE 2048
81 42
82/* 43/*
83 * Constants for hardware specific CLE/ALE/NCE function 44 * Constants for hardware specific CLE/ALE/NCE function
84*/ 45 *
46 * These are bits which can be or'ed to set/clear multiple
47 * bits in one go.
48 */
85/* Select the chip by setting nCE to low */ 49/* Select the chip by setting nCE to low */
86#define NAND_CTL_SETNCE 1 50#define NAND_NCE 0x01
87/* Deselect the chip by setting nCE to high */
88#define NAND_CTL_CLRNCE 2
89/* Select the command latch by setting CLE to high */ 51/* Select the command latch by setting CLE to high */
90#define NAND_CTL_SETCLE 3 52#define NAND_CLE 0x02
91/* Deselect the command latch by setting CLE to low */
92#define NAND_CTL_CLRCLE 4
93/* Select the address latch by setting ALE to high */ 53/* Select the address latch by setting ALE to high */
94#define NAND_CTL_SETALE 5 54#define NAND_ALE 0x04
95/* Deselect the address latch by setting ALE to low */ 55
96#define NAND_CTL_CLRALE 6 56#define NAND_CTRL_CLE (NAND_NCE | NAND_CLE)
97/* Set write protection by setting WP to high. Not used! */ 57#define NAND_CTRL_ALE (NAND_NCE | NAND_ALE)
98#define NAND_CTL_SETWP 7 58#define NAND_CTRL_CHANGE 0x80
99/* Clear write protection by setting WP to low. Not used! */
100#define NAND_CTL_CLRWP 8
101 59
102/* 60/*
103 * Standard NAND flash commands 61 * Standard NAND flash commands
104 */ 62 */
105#define NAND_CMD_READ0 0 63#define NAND_CMD_READ0 0
106#define NAND_CMD_READ1 1 64#define NAND_CMD_READ1 1
65#define NAND_CMD_RNDOUT 5
107#define NAND_CMD_PAGEPROG 0x10 66#define NAND_CMD_PAGEPROG 0x10
108#define NAND_CMD_READOOB 0x50 67#define NAND_CMD_READOOB 0x50
109#define NAND_CMD_ERASE1 0x60 68#define NAND_CMD_ERASE1 0x60
110#define NAND_CMD_STATUS 0x70 69#define NAND_CMD_STATUS 0x70
111#define NAND_CMD_STATUS_MULTI 0x71 70#define NAND_CMD_STATUS_MULTI 0x71
112#define NAND_CMD_SEQIN 0x80 71#define NAND_CMD_SEQIN 0x80
72#define NAND_CMD_RNDIN 0x85
113#define NAND_CMD_READID 0x90 73#define NAND_CMD_READID 0x90
114#define NAND_CMD_ERASE2 0xd0 74#define NAND_CMD_ERASE2 0xd0
115#define NAND_CMD_RESET 0xff 75#define NAND_CMD_RESET 0xff
116 76
117/* Extended commands for large page devices */ 77/* Extended commands for large page devices */
118#define NAND_CMD_READSTART 0x30 78#define NAND_CMD_READSTART 0x30
79#define NAND_CMD_RNDOUTSTART 0xE0
119#define NAND_CMD_CACHEDPROG 0x15 80#define NAND_CMD_CACHEDPROG 0x15
120 81
121/* Extended commands for AG-AND device */ 82/* Extended commands for AG-AND device */
@@ -137,6 +98,8 @@ extern int nand_read_raw (struct mtd_info *mtd, uint8_t *buf, loff_t from, size_
137#define NAND_CMD_STATUS_RESET 0x7f 98#define NAND_CMD_STATUS_RESET 0x7f
138#define NAND_CMD_STATUS_CLEAR 0xff 99#define NAND_CMD_STATUS_CLEAR 0xff
139 100
101#define NAND_CMD_NONE -1
102
140/* Status bits */ 103/* Status bits */
141#define NAND_STATUS_FAIL 0x01 104#define NAND_STATUS_FAIL 0x01
142#define NAND_STATUS_FAIL_N1 0x02 105#define NAND_STATUS_FAIL_N1 0x02
@@ -147,21 +110,12 @@ extern int nand_read_raw (struct mtd_info *mtd, uint8_t *buf, loff_t from, size_
147/* 110/*
148 * Constants for ECC_MODES 111 * Constants for ECC_MODES
149 */ 112 */
150 113typedef enum {
151/* No ECC. Usage is not recommended ! */ 114 NAND_ECC_NONE,
152#define NAND_ECC_NONE 0 115 NAND_ECC_SOFT,
153/* Software ECC 3 byte ECC per 256 Byte data */ 116 NAND_ECC_HW,
154#define NAND_ECC_SOFT 1 117 NAND_ECC_HW_SYNDROME,
155/* Hardware ECC 3 byte ECC per 256 Byte data */ 118} nand_ecc_modes_t;
156#define NAND_ECC_HW3_256 2
157/* Hardware ECC 3 byte ECC per 512 Byte data */
158#define NAND_ECC_HW3_512 3
159/* Hardware ECC 3 byte ECC per 512 Byte data */
160#define NAND_ECC_HW6_512 4
161/* Hardware ECC 8 byte ECC per 512 Byte data */
162#define NAND_ECC_HW8_512 6
163/* Hardware ECC 12 byte ECC per 2048 Byte data */
164#define NAND_ECC_HW12_2048 7
165 119
166/* 120/*
167 * Constants for Hardware ECC 121 * Constants for Hardware ECC
@@ -200,6 +154,10 @@ extern int nand_read_raw (struct mtd_info *mtd, uint8_t *buf, loff_t from, size_
200 * bits from adjacent blocks from 'leaking' in altering data. 154 * bits from adjacent blocks from 'leaking' in altering data.
201 * This happens with the Renesas AG-AND chips, possibly others. */ 155 * This happens with the Renesas AG-AND chips, possibly others. */
202#define BBT_AUTO_REFRESH 0x00000080 156#define BBT_AUTO_REFRESH 0x00000080
157/* Chip does not require ready check on read. True
158 * for all large page devices, as they do not support
159 * autoincrement.*/
160#define NAND_NO_READRDY 0x00000100
203 161
204/* Options valid for Samsung large page devices */ 162/* Options valid for Samsung large page devices */
205#define NAND_SAMSUNG_LP_OPTIONS \ 163#define NAND_SAMSUNG_LP_OPTIONS \
@@ -218,18 +176,12 @@ extern int nand_read_raw (struct mtd_info *mtd, uint8_t *buf, loff_t from, size_
218/* Use a flash based bad block table. This option is passed to the 176/* Use a flash based bad block table. This option is passed to the
219 * default bad block table function. */ 177 * default bad block table function. */
220#define NAND_USE_FLASH_BBT 0x00010000 178#define NAND_USE_FLASH_BBT 0x00010000
221/* The hw ecc generator provides a syndrome instead a ecc value on read
222 * This can only work if we have the ecc bytes directly behind the
223 * data bytes. Applies for DOC and AG-AND Renesas HW Reed Solomon generators */
224#define NAND_HWECC_SYNDROME 0x00020000
225/* This option skips the bbt scan during initialization. */ 179/* This option skips the bbt scan during initialization. */
226#define NAND_SKIP_BBTSCAN 0x00040000 180#define NAND_SKIP_BBTSCAN 0x00020000
227 181
228/* Options set by nand scan */ 182/* Options set by nand scan */
229/* Nand scan has allocated oob_buf */ 183/* Nand scan has allocated controller struct */
230#define NAND_OOBBUF_ALLOC 0x40000000 184#define NAND_CONTROLLER_ALLOC 0x80000000
231/* Nand scan has allocated data_buf */
232#define NAND_DATABUF_ALLOC 0x80000000
233 185
234 186
235/* 187/*
@@ -263,45 +215,102 @@ struct nand_hw_control {
263}; 215};
264 216
265/** 217/**
218 * struct nand_ecc_ctrl - Control structure for ecc
219 * @mode: ecc mode
220 * @steps: number of ecc steps per page
221 * @size: data bytes per ecc step
222 * @bytes: ecc bytes per step
223 * @total: total number of ecc bytes per page
224 * @prepad: padding information for syndrome based ecc generators
225 * @postpad: padding information for syndrome based ecc generators
226 * @hwctl: function to control hardware ecc generator. Must only
227 * be provided if an hardware ECC is available
228 * @calculate: function for ecc calculation or readback from ecc hardware
229 * @correct: function for ecc correction, matching to ecc generator (sw/hw)
230 * @read_page: function to read a page according to the ecc generator requirements
231 * @write_page: function to write a page according to the ecc generator requirements
232 */
233struct nand_ecc_ctrl {
234 nand_ecc_modes_t mode;
235 int steps;
236 int size;
237 int bytes;
238 int total;
239 int prepad;
240 int postpad;
241 struct nand_ecclayout *layout;
242 void (*hwctl)(struct mtd_info *mtd, int mode);
243 int (*calculate)(struct mtd_info *mtd,
244 const uint8_t *dat,
245 uint8_t *ecc_code);
246 int (*correct)(struct mtd_info *mtd, uint8_t *dat,
247 uint8_t *read_ecc,
248 uint8_t *calc_ecc);
249 int (*read_page)(struct mtd_info *mtd,
250 struct nand_chip *chip,
251 uint8_t *buf);
252 void (*write_page)(struct mtd_info *mtd,
253 struct nand_chip *chip,
254 const uint8_t *buf);
255 int (*read_oob)(struct mtd_info *mtd,
256 struct nand_chip *chip,
257 int page,
258 int sndcmd);
259 int (*write_oob)(struct mtd_info *mtd,
260 struct nand_chip *chip,
261 int page);
262};
263
264/**
265 * struct nand_buffers - buffer structure for read/write
266 * @ecccalc: buffer for calculated ecc
267 * @ecccode: buffer for ecc read from flash
268 * @oobwbuf: buffer for write oob data
269 * @databuf: buffer for data - dynamically sized
270 * @oobrbuf: buffer to read oob data
271 *
272 * Do not change the order of buffers. databuf and oobrbuf must be in
273 * consecutive order.
274 */
275struct nand_buffers {
276 uint8_t ecccalc[NAND_MAX_OOBSIZE];
277 uint8_t ecccode[NAND_MAX_OOBSIZE];
278 uint8_t oobwbuf[NAND_MAX_OOBSIZE];
279 uint8_t databuf[NAND_MAX_PAGESIZE];
280 uint8_t oobrbuf[NAND_MAX_OOBSIZE];
281};
282
283/**
266 * struct nand_chip - NAND Private Flash Chip Data 284 * struct nand_chip - NAND Private Flash Chip Data
267 * @IO_ADDR_R: [BOARDSPECIFIC] address to read the 8 I/O lines of the flash device 285 * @IO_ADDR_R: [BOARDSPECIFIC] address to read the 8 I/O lines of the flash device
268 * @IO_ADDR_W: [BOARDSPECIFIC] address to write the 8 I/O lines of the flash device 286 * @IO_ADDR_W: [BOARDSPECIFIC] address to write the 8 I/O lines of the flash device
269 * @read_byte: [REPLACEABLE] read one byte from the chip 287 * @read_byte: [REPLACEABLE] read one byte from the chip
270 * @write_byte: [REPLACEABLE] write one byte to the chip
271 * @read_word: [REPLACEABLE] read one word from the chip 288 * @read_word: [REPLACEABLE] read one word from the chip
272 * @write_word: [REPLACEABLE] write one word to the chip
273 * @write_buf: [REPLACEABLE] write data from the buffer to the chip 289 * @write_buf: [REPLACEABLE] write data from the buffer to the chip
274 * @read_buf: [REPLACEABLE] read data from the chip into the buffer 290 * @read_buf: [REPLACEABLE] read data from the chip into the buffer
275 * @verify_buf: [REPLACEABLE] verify buffer contents against the chip data 291 * @verify_buf: [REPLACEABLE] verify buffer contents against the chip data
276 * @select_chip: [REPLACEABLE] select chip nr 292 * @select_chip: [REPLACEABLE] select chip nr
277 * @block_bad: [REPLACEABLE] check, if the block is bad 293 * @block_bad: [REPLACEABLE] check, if the block is bad
278 * @block_markbad: [REPLACEABLE] mark the block bad 294 * @block_markbad: [REPLACEABLE] mark the block bad
279 * @hwcontrol: [BOARDSPECIFIC] hardwarespecific function for accesing control-lines 295 * @cmd_ctrl: [BOARDSPECIFIC] hardwarespecific funtion for controlling
296 * ALE/CLE/nCE. Also used to write command and address
280 * @dev_ready: [BOARDSPECIFIC] hardwarespecific function for accesing device ready/busy line 297 * @dev_ready: [BOARDSPECIFIC] hardwarespecific function for accesing device ready/busy line
281 * If set to NULL no access to ready/busy is available and the ready/busy information 298 * If set to NULL no access to ready/busy is available and the ready/busy information
282 * is read from the chip status register 299 * is read from the chip status register
283 * @cmdfunc: [REPLACEABLE] hardwarespecific function for writing commands to the chip 300 * @cmdfunc: [REPLACEABLE] hardwarespecific function for writing commands to the chip
284 * @waitfunc: [REPLACEABLE] hardwarespecific function for wait on ready 301 * @waitfunc: [REPLACEABLE] hardwarespecific function for wait on ready
285 * @calculate_ecc: [REPLACEABLE] function for ecc calculation or readback from ecc hardware 302 * @ecc: [BOARDSPECIFIC] ecc control ctructure
286 * @correct_data: [REPLACEABLE] function for ecc correction, matching to ecc generator (sw/hw)
287 * @enable_hwecc: [BOARDSPECIFIC] function to enable (reset) hardware ecc generator. Must only
288 * be provided if a hardware ECC is available
289 * @erase_cmd: [INTERN] erase command write function, selectable due to AND support 303 * @erase_cmd: [INTERN] erase command write function, selectable due to AND support
290 * @scan_bbt: [REPLACEABLE] function to scan bad block table 304 * @scan_bbt: [REPLACEABLE] function to scan bad block table
291 * @eccmode: [BOARDSPECIFIC] mode of ecc, see defines
292 * @eccsize: [INTERN] databytes used per ecc-calculation
293 * @eccbytes: [INTERN] number of ecc bytes per ecc-calculation step
294 * @eccsteps: [INTERN] number of ecc calculation steps per page
295 * @chip_delay: [BOARDSPECIFIC] chip dependent delay for transfering data from array to read regs (tR) 305 * @chip_delay: [BOARDSPECIFIC] chip dependent delay for transfering data from array to read regs (tR)
296 * @chip_lock: [INTERN] spinlock used to protect access to this structure and the chip
297 * @wq: [INTERN] wait queue to sleep on if a NAND operation is in progress 306 * @wq: [INTERN] wait queue to sleep on if a NAND operation is in progress
298 * @state: [INTERN] the current state of the NAND device 307 * @state: [INTERN] the current state of the NAND device
299 * @page_shift: [INTERN] number of address bits in a page (column address bits) 308 * @page_shift: [INTERN] number of address bits in a page (column address bits)
300 * @phys_erase_shift: [INTERN] number of address bits in a physical eraseblock 309 * @phys_erase_shift: [INTERN] number of address bits in a physical eraseblock
301 * @bbt_erase_shift: [INTERN] number of address bits in a bbt entry 310 * @bbt_erase_shift: [INTERN] number of address bits in a bbt entry
302 * @chip_shift: [INTERN] number of address bits in one chip 311 * @chip_shift: [INTERN] number of address bits in one chip
303 * @data_buf: [INTERN] internal buffer for one page + oob 312 * @datbuf: [INTERN] internal buffer for one page + oob
304 * @oob_buf: [INTERN] oob buffer for one eraseblock 313 * @oobbuf: [INTERN] oob buffer for one eraseblock
305 * @oobdirty: [INTERN] indicates that oob_buf must be reinitialized 314 * @oobdirty: [INTERN] indicates that oob_buf must be reinitialized
306 * @data_poi: [INTERN] pointer to a data buffer 315 * @data_poi: [INTERN] pointer to a data buffer
307 * @options: [BOARDSPECIFIC] various chip options. They can partly be set to inform nand_scan about 316 * @options: [BOARDSPECIFIC] various chip options. They can partly be set to inform nand_scan about
@@ -311,12 +320,13 @@ struct nand_hw_control {
311 * @chipsize: [INTERN] the size of one chip for multichip arrays 320 * @chipsize: [INTERN] the size of one chip for multichip arrays
312 * @pagemask: [INTERN] page number mask = number of (pages / chip) - 1 321 * @pagemask: [INTERN] page number mask = number of (pages / chip) - 1
313 * @pagebuf: [INTERN] holds the pagenumber which is currently in data_buf 322 * @pagebuf: [INTERN] holds the pagenumber which is currently in data_buf
314 * @autooob: [REPLACEABLE] the default (auto)placement scheme 323 * @ecclayout: [REPLACEABLE] the default ecc placement scheme
315 * @bbt: [INTERN] bad block table pointer 324 * @bbt: [INTERN] bad block table pointer
316 * @bbt_td: [REPLACEABLE] bad block table descriptor for flash lookup 325 * @bbt_td: [REPLACEABLE] bad block table descriptor for flash lookup
317 * @bbt_md: [REPLACEABLE] bad block table mirror descriptor 326 * @bbt_md: [REPLACEABLE] bad block table mirror descriptor
318 * @badblock_pattern: [REPLACEABLE] bad block scan pattern used for initial bad block scan 327 * @badblock_pattern: [REPLACEABLE] bad block scan pattern used for initial bad block scan
319 * @controller: [OPTIONAL] a pointer to a hardware controller structure which is shared among multiple independend devices 328 * @controller: [REPLACEABLE] a pointer to a hardware controller structure
329 * which is shared among multiple independend devices
320 * @priv: [OPTIONAL] pointer to private chip date 330 * @priv: [OPTIONAL] pointer to private chip date
321 * @errstat: [OPTIONAL] hardware specific function to perform additional error status checks 331 * @errstat: [OPTIONAL] hardware specific function to perform additional error status checks
322 * (determine if errors are correctable) 332 * (determine if errors are correctable)
@@ -324,58 +334,57 @@ struct nand_hw_control {
324 334
325struct nand_chip { 335struct nand_chip {
326 void __iomem *IO_ADDR_R; 336 void __iomem *IO_ADDR_R;
327 void __iomem *IO_ADDR_W; 337 void __iomem *IO_ADDR_W;
328 338
329 u_char (*read_byte)(struct mtd_info *mtd); 339 uint8_t (*read_byte)(struct mtd_info *mtd);
330 void (*write_byte)(struct mtd_info *mtd, u_char byte);
331 u16 (*read_word)(struct mtd_info *mtd); 340 u16 (*read_word)(struct mtd_info *mtd);
332 void (*write_word)(struct mtd_info *mtd, u16 word); 341 void (*write_buf)(struct mtd_info *mtd, const uint8_t *buf, int len);
333 342 void (*read_buf)(struct mtd_info *mtd, uint8_t *buf, int len);
334 void (*write_buf)(struct mtd_info *mtd, const u_char *buf, int len); 343 int (*verify_buf)(struct mtd_info *mtd, const uint8_t *buf, int len);
335 void (*read_buf)(struct mtd_info *mtd, u_char *buf, int len);
336 int (*verify_buf)(struct mtd_info *mtd, const u_char *buf, int len);
337 void (*select_chip)(struct mtd_info *mtd, int chip); 344 void (*select_chip)(struct mtd_info *mtd, int chip);
338 int (*block_bad)(struct mtd_info *mtd, loff_t ofs, int getchip); 345 int (*block_bad)(struct mtd_info *mtd, loff_t ofs, int getchip);
339 int (*block_markbad)(struct mtd_info *mtd, loff_t ofs); 346 int (*block_markbad)(struct mtd_info *mtd, loff_t ofs);
340 void (*hwcontrol)(struct mtd_info *mtd, int cmd); 347 void (*cmd_ctrl)(struct mtd_info *mtd, int dat,
341 int (*dev_ready)(struct mtd_info *mtd); 348 unsigned int ctrl);
342 void (*cmdfunc)(struct mtd_info *mtd, unsigned command, int column, int page_addr); 349 int (*dev_ready)(struct mtd_info *mtd);
343 int (*waitfunc)(struct mtd_info *mtd, struct nand_chip *this, int state); 350 void (*cmdfunc)(struct mtd_info *mtd, unsigned command, int column, int page_addr);
344 int (*calculate_ecc)(struct mtd_info *mtd, const u_char *dat, u_char *ecc_code); 351 int (*waitfunc)(struct mtd_info *mtd, struct nand_chip *this);
345 int (*correct_data)(struct mtd_info *mtd, u_char *dat, u_char *read_ecc, u_char *calc_ecc);
346 void (*enable_hwecc)(struct mtd_info *mtd, int mode);
347 void (*erase_cmd)(struct mtd_info *mtd, int page); 352 void (*erase_cmd)(struct mtd_info *mtd, int page);
348 int (*scan_bbt)(struct mtd_info *mtd); 353 int (*scan_bbt)(struct mtd_info *mtd);
349 int eccmode; 354 int (*errstat)(struct mtd_info *mtd, struct nand_chip *this, int state, int status, int page);
350 int eccsize; 355
351 int eccbytes; 356 int chip_delay;
352 int eccsteps; 357 unsigned int options;
353 int chip_delay; 358
354 spinlock_t chip_lock; 359 int page_shift;
355 wait_queue_head_t wq;
356 nand_state_t state;
357 int page_shift;
358 int phys_erase_shift; 360 int phys_erase_shift;
359 int bbt_erase_shift; 361 int bbt_erase_shift;
360 int chip_shift; 362 int chip_shift;
361 u_char *data_buf;
362 u_char *oob_buf;
363 int oobdirty;
364 u_char *data_poi;
365 unsigned int options;
366 int badblockpos;
367 int numchips; 363 int numchips;
368 unsigned long chipsize; 364 unsigned long chipsize;
369 int pagemask; 365 int pagemask;
370 int pagebuf; 366 int pagebuf;
371 struct nand_oobinfo *autooob; 367 int badblockpos;
368
369 nand_state_t state;
370
371 uint8_t *oob_poi;
372 struct nand_hw_control *controller;
373 struct nand_ecclayout *ecclayout;
374
375 struct nand_ecc_ctrl ecc;
376 struct nand_buffers buffers;
377 struct nand_hw_control hwcontrol;
378
379 struct mtd_oob_ops ops;
380
372 uint8_t *bbt; 381 uint8_t *bbt;
373 struct nand_bbt_descr *bbt_td; 382 struct nand_bbt_descr *bbt_td;
374 struct nand_bbt_descr *bbt_md; 383 struct nand_bbt_descr *bbt_md;
384
375 struct nand_bbt_descr *badblock_pattern; 385 struct nand_bbt_descr *badblock_pattern;
376 struct nand_hw_control *controller; 386
377 void *priv; 387 void *priv;
378 int (*errstat)(struct mtd_info *mtd, struct nand_chip *this, int state, int status, int page);
379}; 388};
380 389
381/* 390/*
@@ -387,19 +396,19 @@ struct nand_chip {
387#define NAND_MFR_NATIONAL 0x8f 396#define NAND_MFR_NATIONAL 0x8f
388#define NAND_MFR_RENESAS 0x07 397#define NAND_MFR_RENESAS 0x07
389#define NAND_MFR_STMICRO 0x20 398#define NAND_MFR_STMICRO 0x20
390#define NAND_MFR_HYNIX 0xad 399#define NAND_MFR_HYNIX 0xad
391 400
392/** 401/**
393 * struct nand_flash_dev - NAND Flash Device ID Structure 402 * struct nand_flash_dev - NAND Flash Device ID Structure
394 * 403 *
395 * @name: Identify the device type 404 * @name: Identify the device type
396 * @id: device ID code 405 * @id: device ID code
397 * @pagesize: Pagesize in bytes. Either 256 or 512 or 0 406 * @pagesize: Pagesize in bytes. Either 256 or 512 or 0
398 * If the pagesize is 0, then the real pagesize 407 * If the pagesize is 0, then the real pagesize
399 * and the eraseize are determined from the 408 * and the eraseize are determined from the
400 * extended id bytes in the chip 409 * extended id bytes in the chip
401 * @erasesize: Size of an erase block in the flash device. 410 * @erasesize: Size of an erase block in the flash device.
402 * @chipsize: Total chipsize in Mega Bytes 411 * @chipsize: Total chipsize in Mega Bytes
403 * @options: Bitfield to store chip relevant options 412 * @options: Bitfield to store chip relevant options
404 */ 413 */
405struct nand_flash_dev { 414struct nand_flash_dev {
@@ -414,7 +423,7 @@ struct nand_flash_dev {
414/** 423/**
415 * struct nand_manufacturers - NAND Flash Manufacturer ID Structure 424 * struct nand_manufacturers - NAND Flash Manufacturer ID Structure
416 * @name: Manufacturer name 425 * @name: Manufacturer name
417 * @id: manufacturer ID code of device. 426 * @id: manufacturer ID code of device.
418*/ 427*/
419struct nand_manufacturers { 428struct nand_manufacturers {
420 int id; 429 int id;
@@ -454,7 +463,7 @@ struct nand_bbt_descr {
454 int veroffs; 463 int veroffs;
455 uint8_t version[NAND_MAX_CHIPS]; 464 uint8_t version[NAND_MAX_CHIPS];
456 int len; 465 int len;
457 int maxblocks; 466 int maxblocks;
458 int reserved_block_code; 467 int reserved_block_code;
459 uint8_t *pattern; 468 uint8_t *pattern;
460}; 469};
@@ -493,14 +502,14 @@ struct nand_bbt_descr {
493/* The maximum number of blocks to scan for a bbt */ 502/* The maximum number of blocks to scan for a bbt */
494#define NAND_BBT_SCAN_MAXBLOCKS 4 503#define NAND_BBT_SCAN_MAXBLOCKS 4
495 504
496extern int nand_scan_bbt (struct mtd_info *mtd, struct nand_bbt_descr *bd); 505extern int nand_scan_bbt(struct mtd_info *mtd, struct nand_bbt_descr *bd);
497extern int nand_update_bbt (struct mtd_info *mtd, loff_t offs); 506extern int nand_update_bbt(struct mtd_info *mtd, loff_t offs);
498extern int nand_default_bbt (struct mtd_info *mtd); 507extern int nand_default_bbt(struct mtd_info *mtd);
499extern int nand_isbad_bbt (struct mtd_info *mtd, loff_t offs, int allowbbt); 508extern int nand_isbad_bbt(struct mtd_info *mtd, loff_t offs, int allowbbt);
500extern int nand_erase_nand (struct mtd_info *mtd, struct erase_info *instr, int allowbbt); 509extern int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
501extern int nand_do_read_ecc (struct mtd_info *mtd, loff_t from, size_t len, 510 int allowbbt);
502 size_t * retlen, u_char * buf, u_char * oob_buf, 511extern int nand_do_read(struct mtd_info *mtd, loff_t from, size_t len,
503 struct nand_oobinfo *oobsel, int flags); 512 size_t * retlen, uint8_t * buf);
504 513
505/* 514/*
506* Constants for oob configuration 515* Constants for oob configuration
@@ -508,4 +517,53 @@ extern int nand_do_read_ecc (struct mtd_info *mtd, loff_t from, size_t len,
508#define NAND_SMALL_BADBLOCK_POS 5 517#define NAND_SMALL_BADBLOCK_POS 5
509#define NAND_LARGE_BADBLOCK_POS 0 518#define NAND_LARGE_BADBLOCK_POS 0
510 519
520/**
521 * struct platform_nand_chip - chip level device structure
522 *
523 * @nr_chips: max. number of chips to scan for
524 * @chip_offs: chip number offset
525 * @nr_partitions: number of partitions pointed to by partitions (or zero)
526 * @partitions: mtd partition list
527 * @chip_delay: R/B delay value in us
528 * @options: Option flags, e.g. 16bit buswidth
529 * @ecclayout: ecc layout info structure
530 * @priv: hardware controller specific settings
531 */
532struct platform_nand_chip {
533 int nr_chips;
534 int chip_offset;
535 int nr_partitions;
536 struct mtd_partition *partitions;
537 struct nand_ecclayout *ecclayout;
538 int chip_delay;
539 unsigned int options;
540 void *priv;
541};
542
543/**
544 * struct platform_nand_ctrl - controller level device structure
545 *
546 * @hwcontrol: platform specific hardware control structure
547 * @dev_ready: platform specific function to read ready/busy pin
548 * @select_chip: platform specific chip select function
549 * @priv_data: private data to transport driver specific settings
550 *
551 * All fields are optional and depend on the hardware driver requirements
552 */
553struct platform_nand_ctrl {
554 void (*hwcontrol)(struct mtd_info *mtd, int cmd);
555 int (*dev_ready)(struct mtd_info *mtd);
556 void (*select_chip)(struct mtd_info *mtd, int chip);
557 void *priv;
558};
559
560/* Some helpers to access the data structures */
561static inline
562struct platform_nand_chip *get_platform_nandchip(struct mtd_info *mtd)
563{
564 struct nand_chip *chip = mtd->priv;
565
566 return chip->priv;
567}
568
511#endif /* __LINUX_MTD_NAND_H */ 569#endif /* __LINUX_MTD_NAND_H */
diff --git a/include/linux/mtd/ndfc.h b/include/linux/mtd/ndfc.h
new file mode 100644
index 000000000000..d0558a982628
--- /dev/null
+++ b/include/linux/mtd/ndfc.h
@@ -0,0 +1,67 @@
1/*
2 * linux/include/linux/mtd/ndfc.h
3 *
4 * Copyright (c) 2006 Thomas Gleixner <tglx@linutronix.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Info:
11 * Contains defines, datastructures for ndfc nand controller
12 *
13 */
14#ifndef __LINUX_MTD_NDFC_H
15#define __LINUX_MTD_NDFC_H
16
17/* NDFC Register definitions */
18#define NDFC_CMD 0x00
19#define NDFC_ALE 0x04
20#define NDFC_DATA 0x08
21#define NDFC_ECC 0x10
22#define NDFC_BCFG0 0x30
23#define NDFC_BCFG1 0x34
24#define NDFC_BCFG2 0x38
25#define NDFC_BCFG3 0x3c
26#define NDFC_CCR 0x40
27#define NDFC_STAT 0x44
28#define NDFC_HWCTL 0x48
29#define NDFC_REVID 0x50
30
31#define NDFC_STAT_IS_READY 0x01000000
32
33#define NDFC_CCR_RESET_CE 0x80000000 /* CE Reset */
34#define NDFC_CCR_RESET_ECC 0x40000000 /* ECC Reset */
35#define NDFC_CCR_RIE 0x20000000 /* Interrupt Enable on Device Rdy */
36#define NDFC_CCR_REN 0x10000000 /* Enable wait for Rdy in LinearR */
37#define NDFC_CCR_ROMEN 0x08000000 /* Enable ROM In LinearR */
38#define NDFC_CCR_ARE 0x04000000 /* Auto-Read Enable */
39#define NDFC_CCR_BS(x) (((x) & 0x3) << 24) /* Select Bank on CE[x] */
40#define NDFC_CCR_BS_MASK 0x03000000 /* Select Bank */
41#define NDFC_CCR_ARAC0 0x00000000 /* 3 Addr, 1 Col 2 Row 512b page */
42#define NDFC_CCR_ARAC1 0x00001000 /* 4 Addr, 1 Col 3 Row 512b page */
43#define NDFC_CCR_ARAC2 0x00002000 /* 4 Addr, 2 Col 2 Row 2K page */
44#define NDFC_CCR_ARAC3 0x00003000 /* 5 Addr, 2 Col 3 Row 2K page */
45#define NDFC_CCR_ARAC_MASK 0x00003000 /* Auto-Read mode Addr Cycles */
46#define NDFC_CCR_RPG 0x0000C000 /* Auto-Read Page */
47#define NDFC_CCR_EBCC 0x00000004 /* EBC Configuration Completed */
48#define NDFC_CCR_DHC 0x00000002 /* Direct Hardware Control Enable */
49
50#define NDFC_BxCFG_EN 0x80000000 /* Bank Enable */
51#define NDFC_BxCFG_CED 0x40000000 /* nCE Style */
52#define NDFC_BxCFG_SZ_MASK 0x08000000 /* Bank Size */
53#define NDFC_BxCFG_SZ_8BIT 0x00000000 /* 8bit */
54#define NDFC_BxCFG_SZ_16BIT 0x08000000 /* 16bit */
55
56#define NDFC_MAX_BANKS 4
57
58struct ndfc_controller_settings {
59 uint32_t ccr_settings;
60 uint64_t ndfc_erpn;
61};
62
63struct ndfc_chip_settings {
64 uint32_t bank_settings;
65};
66
67#endif
diff --git a/include/linux/mtd/nftl.h b/include/linux/mtd/nftl.h
index d35d2c21ff3e..bcf2fb3fa4a7 100644
--- a/include/linux/mtd/nftl.h
+++ b/include/linux/mtd/nftl.h
@@ -37,7 +37,7 @@ struct NFTLrecord {
37 unsigned int nb_blocks; /* number of physical blocks */ 37 unsigned int nb_blocks; /* number of physical blocks */
38 unsigned int nb_boot_blocks; /* number of blocks used by the bios */ 38 unsigned int nb_boot_blocks; /* number of blocks used by the bios */
39 struct erase_info instr; 39 struct erase_info instr;
40 struct nand_oobinfo oobinfo; 40 struct nand_ecclayout oobinfo;
41}; 41};
42 42
43int NFTL_mount(struct NFTLrecord *s); 43int NFTL_mount(struct NFTLrecord *s);
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h
index 7419b5fab133..9ce9a48db444 100644
--- a/include/linux/mtd/onenand.h
+++ b/include/linux/mtd/onenand.h
@@ -35,6 +35,8 @@ typedef enum {
35 FL_SYNCING, 35 FL_SYNCING,
36 FL_UNLOCKING, 36 FL_UNLOCKING,
37 FL_LOCKING, 37 FL_LOCKING,
38 FL_RESETING,
39 FL_OTPING,
38 FL_PM_SUSPENDED, 40 FL_PM_SUSPENDED,
39} onenand_state_t; 41} onenand_state_t;
40 42
@@ -75,7 +77,7 @@ struct onenand_bufferram {
75 * @param chip_lock [INTERN] spinlock used to protect access to this structure and the chip 77 * @param chip_lock [INTERN] spinlock used to protect access to this structure and the chip
76 * @param wq [INTERN] wait queue to sleep on if a OneNAND operation is in progress 78 * @param wq [INTERN] wait queue to sleep on if a OneNAND operation is in progress
77 * @param state [INTERN] the current state of the OneNAND device 79 * @param state [INTERN] the current state of the OneNAND device
78 * @param autooob [REPLACEABLE] the default (auto)placement scheme 80 * @param ecclayout [REPLACEABLE] the default ecc placement scheme
79 * @param bbm [REPLACEABLE] pointer to Bad Block Management 81 * @param bbm [REPLACEABLE] pointer to Bad Block Management
80 * @param priv [OPTIONAL] pointer to private chip date 82 * @param priv [OPTIONAL] pointer to private chip date
81 */ 83 */
@@ -111,9 +113,9 @@ struct onenand_chip {
111 onenand_state_t state; 113 onenand_state_t state;
112 unsigned char *page_buf; 114 unsigned char *page_buf;
113 115
114 struct nand_oobinfo *autooob; 116 struct nand_ecclayout *ecclayout;
115 117
116 void *bbm; 118 void *bbm;
117 119
118 void *priv; 120 void *priv;
119}; 121};
@@ -130,6 +132,9 @@ struct onenand_chip {
130#define ONENAND_SET_SYS_CFG1(v, this) \ 132#define ONENAND_SET_SYS_CFG1(v, this) \
131 (this->write_word(v, this->base + ONENAND_REG_SYS_CFG1)) 133 (this->write_word(v, this->base + ONENAND_REG_SYS_CFG1))
132 134
135/* Check byte access in OneNAND */
136#define ONENAND_CHECK_BYTE_ACCESS(addr) (addr & 0x1)
137
133/* 138/*
134 * Options bits 139 * Options bits
135 */ 140 */
diff --git a/include/linux/mtd/onenand_regs.h b/include/linux/mtd/onenand_regs.h
index d7832ef8ed63..4a72818d2545 100644
--- a/include/linux/mtd/onenand_regs.h
+++ b/include/linux/mtd/onenand_regs.h
@@ -112,6 +112,7 @@
112#define ONENAND_CMD_LOCK_TIGHT (0x2C) 112#define ONENAND_CMD_LOCK_TIGHT (0x2C)
113#define ONENAND_CMD_ERASE (0x94) 113#define ONENAND_CMD_ERASE (0x94)
114#define ONENAND_CMD_RESET (0xF0) 114#define ONENAND_CMD_RESET (0xF0)
115#define ONENAND_CMD_OTP_ACCESS (0x65)
115#define ONENAND_CMD_READID (0x90) 116#define ONENAND_CMD_READID (0x90)
116 117
117/* NOTE: Those are not *REAL* commands */ 118/* NOTE: Those are not *REAL* commands */
@@ -152,6 +153,8 @@
152#define ONENAND_CTRL_ERASE (1 << 11) 153#define ONENAND_CTRL_ERASE (1 << 11)
153#define ONENAND_CTRL_ERROR (1 << 10) 154#define ONENAND_CTRL_ERROR (1 << 10)
154#define ONENAND_CTRL_RSTB (1 << 7) 155#define ONENAND_CTRL_RSTB (1 << 7)
156#define ONENAND_CTRL_OTP_L (1 << 6)
157#define ONENAND_CTRL_OTP_BL (1 << 5)
155 158
156/* 159/*
157 * Interrupt Status Register F241h (R) 160 * Interrupt Status Register F241h (R)
@@ -177,4 +180,9 @@
177#define ONENAND_ECC_2BIT (1 << 1) 180#define ONENAND_ECC_2BIT (1 << 1)
178#define ONENAND_ECC_2BIT_ALL (0xAAAA) 181#define ONENAND_ECC_2BIT_ALL (0xAAAA)
179 182
183/*
184 * One-Time Programmable (OTP)
185 */
186#define ONENAND_OTP_LOCK_OFFSET (14)
187
180#endif /* __ONENAND_REG_H */ 188#endif /* __ONENAND_REG_H */
diff --git a/include/linux/mtd/partitions.h b/include/linux/mtd/partitions.h
index b03f512d51b9..da6b3d6f12a7 100644
--- a/include/linux/mtd/partitions.h
+++ b/include/linux/mtd/partitions.h
@@ -41,7 +41,7 @@ struct mtd_partition {
41 u_int32_t size; /* partition size */ 41 u_int32_t size; /* partition size */
42 u_int32_t offset; /* offset within the master MTD space */ 42 u_int32_t offset; /* offset within the master MTD space */
43 u_int32_t mask_flags; /* master MTD flags to mask out for this partition */ 43 u_int32_t mask_flags; /* master MTD flags to mask out for this partition */
44 struct nand_oobinfo *oobsel; /* out of band layout for this partition (NAND only)*/ 44 struct nand_ecclayout *ecclayout; /* out of band layout for this partition (NAND only)*/
45 struct mtd_info **mtdp; /* pointer to store the MTD object */ 45 struct mtd_info **mtdp; /* pointer to store the MTD object */
46}; 46};
47 47
diff --git a/include/linux/mtd/physmap.h b/include/linux/mtd/physmap.h
index bffaade1111e..86831e3594f6 100644
--- a/include/linux/mtd/physmap.h
+++ b/include/linux/mtd/physmap.h
@@ -15,32 +15,26 @@
15 */ 15 */
16 16
17#ifndef __LINUX_MTD_PHYSMAP__ 17#ifndef __LINUX_MTD_PHYSMAP__
18 18#define __LINUX_MTD_PHYSMAP__
19
20#if defined(CONFIG_MTD_PHYSMAP)
21 19
22#include <linux/mtd/mtd.h> 20#include <linux/mtd/mtd.h>
23#include <linux/mtd/map.h> 21#include <linux/mtd/map.h>
24#include <linux/mtd/partitions.h> 22#include <linux/mtd/partitions.h>
25 23
26/* 24struct physmap_flash_data {
27 * The map_info for physmap. Board can override size, buswidth, phys, 25 unsigned int width;
28 * (*set_vpp)(), etc in their initial setup routine. 26 void (*set_vpp)(struct map_info *, int);
29 */ 27 unsigned int nr_parts;
30extern struct map_info physmap_map; 28 struct mtd_partition *parts;
29};
31 30
32/* 31/*
33 * Board needs to specify the exact mapping during their setup time. 32 * Board needs to specify the exact mapping during their setup time.
34 */ 33 */
35static inline void physmap_configure(unsigned long addr, unsigned long size, int bankwidth, void (*set_vpp)(struct map_info *, int) ) 34void physmap_configure(unsigned long addr, unsigned long size,
36{ 35 int bankwidth, void (*set_vpp)(struct map_info *, int) );
37 physmap_map.phys = addr;
38 physmap_map.size = size;
39 physmap_map.bankwidth = bankwidth;
40 physmap_map.set_vpp = set_vpp;
41}
42 36
43#if defined(CONFIG_MTD_PARTITIONS) 37#ifdef CONFIG_MTD_PARTITIONS
44 38
45/* 39/*
46 * Machines that wish to do flash partition may want to call this function in 40 * Machines that wish to do flash partition may want to call this function in
@@ -54,7 +48,5 @@ static inline void physmap_configure(unsigned long addr, unsigned long size, int
54void physmap_set_partitions(struct mtd_partition *parts, int num_parts); 48void physmap_set_partitions(struct mtd_partition *parts, int num_parts);
55 49
56#endif /* defined(CONFIG_MTD_PARTITIONS) */ 50#endif /* defined(CONFIG_MTD_PARTITIONS) */
57#endif /* defined(CONFIG_MTD) */
58 51
59#endif /* __LINUX_MTD_PHYSMAP__ */ 52#endif /* __LINUX_MTD_PHYSMAP__ */
60
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index cebe677e153b..5e8e2d50429a 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -36,6 +36,7 @@
36 36
37#include <linux/device.h> 37#include <linux/device.h>
38#include <linux/percpu.h> 38#include <linux/percpu.h>
39#include <linux/dmaengine.h>
39 40
40struct divert_blk; 41struct divert_blk;
41struct vlan_group; 42struct vlan_group;
@@ -310,6 +311,9 @@ struct net_device
310#define NETIF_F_LLTX 4096 /* LockLess TX */ 311#define NETIF_F_LLTX 4096 /* LockLess TX */
311#define NETIF_F_UFO 8192 /* Can offload UDP Large Send*/ 312#define NETIF_F_UFO 8192 /* Can offload UDP Large Send*/
312 313
314#define NETIF_F_GEN_CSUM (NETIF_F_NO_CSUM | NETIF_F_HW_CSUM)
315#define NETIF_F_ALL_CSUM (NETIF_F_IP_CSUM | NETIF_F_GEN_CSUM)
316
313 struct net_device *next_sched; 317 struct net_device *next_sched;
314 318
315 /* Interface index. Unique device identifier */ 319 /* Interface index. Unique device identifier */
@@ -405,7 +409,7 @@ struct net_device
405 * One part is mostly used on xmit path (device) 409 * One part is mostly used on xmit path (device)
406 */ 410 */
407 /* hard_start_xmit synchronizer */ 411 /* hard_start_xmit synchronizer */
408 spinlock_t xmit_lock ____cacheline_aligned_in_smp; 412 spinlock_t _xmit_lock ____cacheline_aligned_in_smp;
409 /* cpu id of processor entered to hard_start_xmit or -1, 413 /* cpu id of processor entered to hard_start_xmit or -1,
410 if nobody entered there. 414 if nobody entered there.
411 */ 415 */
@@ -592,6 +596,9 @@ struct softnet_data
592 struct sk_buff *completion_queue; 596 struct sk_buff *completion_queue;
593 597
594 struct net_device backlog_dev; /* Sorry. 8) */ 598 struct net_device backlog_dev; /* Sorry. 8) */
599#ifdef CONFIG_NET_DMA
600 struct dma_chan *net_dma;
601#endif
595}; 602};
596 603
597DECLARE_PER_CPU(struct softnet_data,softnet_data); 604DECLARE_PER_CPU(struct softnet_data,softnet_data);
@@ -888,11 +895,43 @@ static inline void __netif_rx_complete(struct net_device *dev)
888 clear_bit(__LINK_STATE_RX_SCHED, &dev->state); 895 clear_bit(__LINK_STATE_RX_SCHED, &dev->state);
889} 896}
890 897
898static inline void netif_tx_lock(struct net_device *dev)
899{
900 spin_lock(&dev->_xmit_lock);
901 dev->xmit_lock_owner = smp_processor_id();
902}
903
904static inline void netif_tx_lock_bh(struct net_device *dev)
905{
906 spin_lock_bh(&dev->_xmit_lock);
907 dev->xmit_lock_owner = smp_processor_id();
908}
909
910static inline int netif_tx_trylock(struct net_device *dev)
911{
912 int err = spin_trylock(&dev->_xmit_lock);
913 if (!err)
914 dev->xmit_lock_owner = smp_processor_id();
915 return err;
916}
917
918static inline void netif_tx_unlock(struct net_device *dev)
919{
920 dev->xmit_lock_owner = -1;
921 spin_unlock(&dev->_xmit_lock);
922}
923
924static inline void netif_tx_unlock_bh(struct net_device *dev)
925{
926 dev->xmit_lock_owner = -1;
927 spin_unlock_bh(&dev->_xmit_lock);
928}
929
891static inline void netif_tx_disable(struct net_device *dev) 930static inline void netif_tx_disable(struct net_device *dev)
892{ 931{
893 spin_lock_bh(&dev->xmit_lock); 932 netif_tx_lock_bh(dev);
894 netif_stop_queue(dev); 933 netif_stop_queue(dev);
895 spin_unlock_bh(&dev->xmit_lock); 934 netif_tx_unlock_bh(dev);
896} 935}
897 936
898/* These functions live elsewhere (drivers/net/net_init.c, but related) */ 937/* These functions live elsewhere (drivers/net/net_init.c, but related) */
diff --git a/include/linux/netfilter/nf_conntrack_common.h b/include/linux/netfilter/nf_conntrack_common.h
index 3ff88c878308..d2e4bd7a7a14 100644
--- a/include/linux/netfilter/nf_conntrack_common.h
+++ b/include/linux/netfilter/nf_conntrack_common.h
@@ -69,6 +69,10 @@ enum ip_conntrack_status {
69 /* Connection is dying (removed from lists), can not be unset. */ 69 /* Connection is dying (removed from lists), can not be unset. */
70 IPS_DYING_BIT = 9, 70 IPS_DYING_BIT = 9,
71 IPS_DYING = (1 << IPS_DYING_BIT), 71 IPS_DYING = (1 << IPS_DYING_BIT),
72
73 /* Connection has fixed timeout. */
74 IPS_FIXED_TIMEOUT_BIT = 10,
75 IPS_FIXED_TIMEOUT = (1 << IPS_FIXED_TIMEOUT_BIT),
72}; 76};
73 77
74/* Connection tracking event bits */ 78/* Connection tracking event bits */
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h
index 668ec946c8e2..b5883ccee295 100644
--- a/include/linux/netfilter/nfnetlink_conntrack.h
+++ b/include/linux/netfilter/nfnetlink_conntrack.h
@@ -27,13 +27,15 @@ enum ctattr_type {
27 CTA_STATUS, 27 CTA_STATUS,
28 CTA_PROTOINFO, 28 CTA_PROTOINFO,
29 CTA_HELP, 29 CTA_HELP,
30 CTA_NAT, 30 CTA_NAT_SRC,
31#define CTA_NAT CTA_NAT_SRC /* backwards compatibility */
31 CTA_TIMEOUT, 32 CTA_TIMEOUT,
32 CTA_MARK, 33 CTA_MARK,
33 CTA_COUNTERS_ORIG, 34 CTA_COUNTERS_ORIG,
34 CTA_COUNTERS_REPLY, 35 CTA_COUNTERS_REPLY,
35 CTA_USE, 36 CTA_USE,
36 CTA_ID, 37 CTA_ID,
38 CTA_NAT_DST,
37 __CTA_MAX 39 __CTA_MAX
38}; 40};
39#define CTA_MAX (__CTA_MAX - 1) 41#define CTA_MAX (__CTA_MAX - 1)
diff --git a/include/linux/netfilter/xt_CONNSECMARK.h b/include/linux/netfilter/xt_CONNSECMARK.h
new file mode 100644
index 000000000000..c6bd75469ba2
--- /dev/null
+++ b/include/linux/netfilter/xt_CONNSECMARK.h
@@ -0,0 +1,13 @@
1#ifndef _XT_CONNSECMARK_H_target
2#define _XT_CONNSECMARK_H_target
3
4enum {
5 CONNSECMARK_SAVE = 1,
6 CONNSECMARK_RESTORE,
7};
8
9struct xt_connsecmark_target_info {
10 u_int8_t mode;
11};
12
13#endif /*_XT_CONNSECMARK_H_target */
diff --git a/include/linux/netfilter/xt_SECMARK.h b/include/linux/netfilter/xt_SECMARK.h
new file mode 100644
index 000000000000..c53fbffa997d
--- /dev/null
+++ b/include/linux/netfilter/xt_SECMARK.h
@@ -0,0 +1,26 @@
1#ifndef _XT_SECMARK_H_target
2#define _XT_SECMARK_H_target
3
4/*
5 * This is intended for use by various security subsystems (but not
6 * at the same time).
7 *
8 * 'mode' refers to the specific security subsystem which the
9 * packets are being marked for.
10 */
11#define SECMARK_MODE_SEL 0x01 /* SELinux */
12#define SECMARK_SELCTX_MAX 256
13
14struct xt_secmark_target_selinux_info {
15 u_int32_t selsid;
16 char selctx[SECMARK_SELCTX_MAX];
17};
18
19struct xt_secmark_target_info {
20 u_int8_t mode;
21 union {
22 struct xt_secmark_target_selinux_info sel;
23 } u;
24};
25
26#endif /*_XT_SECMARK_H_target */
diff --git a/include/linux/netfilter/xt_quota.h b/include/linux/netfilter/xt_quota.h
new file mode 100644
index 000000000000..acd7fd77bbee
--- /dev/null
+++ b/include/linux/netfilter/xt_quota.h
@@ -0,0 +1,16 @@
1#ifndef _XT_QUOTA_H
2#define _XT_QUOTA_H
3
4enum xt_quota_flags {
5 XT_QUOTA_INVERT = 0x1,
6};
7#define XT_QUOTA_MASK 0x1
8
9struct xt_quota_info {
10 u_int32_t flags;
11 u_int32_t pad;
12 aligned_u64 quota;
13 struct xt_quota_info *master;
14};
15
16#endif /* _XT_QUOTA_H */
diff --git a/include/linux/netfilter/xt_statistic.h b/include/linux/netfilter/xt_statistic.h
new file mode 100644
index 000000000000..c344e9916e23
--- /dev/null
+++ b/include/linux/netfilter/xt_statistic.h
@@ -0,0 +1,32 @@
1#ifndef _XT_STATISTIC_H
2#define _XT_STATISTIC_H
3
4enum xt_statistic_mode {
5 XT_STATISTIC_MODE_RANDOM,
6 XT_STATISTIC_MODE_NTH,
7 __XT_STATISTIC_MODE_MAX
8};
9#define XT_STATISTIC_MODE_MAX (__XT_STATISTIC_MODE_MAX - 1)
10
11enum xt_statistic_flags {
12 XT_STATISTIC_INVERT = 0x1,
13};
14#define XT_STATISTIC_MASK 0x1
15
16struct xt_statistic_info {
17 u_int16_t mode;
18 u_int16_t flags;
19 union {
20 struct {
21 u_int32_t probability;
22 } random;
23 struct {
24 u_int32_t every;
25 u_int32_t packet;
26 u_int32_t count;
27 } nth;
28 } u;
29 struct xt_statistic_info *master __attribute__((aligned(8)));
30};
31
32#endif /* _XT_STATISTIC_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack.h b/include/linux/netfilter_ipv4/ip_conntrack.h
index 4255bfec0920..51dbec1892c8 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack.h
@@ -120,6 +120,10 @@ struct ip_conntrack
120 u_int32_t mark; 120 u_int32_t mark;
121#endif 121#endif
122 122
123#ifdef CONFIG_IP_NF_CONNTRACK_SECMARK
124 u_int32_t secmark;
125#endif
126
123 /* Traversed often, so hopefully in different cacheline to top */ 127 /* Traversed often, so hopefully in different cacheline to top */
124 /* These are my tuples; original and reply */ 128 /* These are my tuples; original and reply */
125 struct ip_conntrack_tuple_hash tuplehash[IP_CT_DIR_MAX]; 129 struct ip_conntrack_tuple_hash tuplehash[IP_CT_DIR_MAX];
@@ -153,6 +157,7 @@ struct ip_conntrack_expect
153 unsigned int flags; 157 unsigned int flags;
154 158
155#ifdef CONFIG_IP_NF_NAT_NEEDED 159#ifdef CONFIG_IP_NF_NAT_NEEDED
160 u_int32_t saved_ip;
156 /* This is the original per-proto part, used to map the 161 /* This is the original per-proto part, used to map the
157 * expected connection the way the recipient expects. */ 162 * expected connection the way the recipient expects. */
158 union ip_conntrack_manip_proto saved_proto; 163 union ip_conntrack_manip_proto saved_proto;
@@ -292,6 +297,7 @@ static inline int is_dying(struct ip_conntrack *ct)
292} 297}
293 298
294extern unsigned int ip_conntrack_htable_size; 299extern unsigned int ip_conntrack_htable_size;
300extern int ip_conntrack_checksum;
295 301
296#define CONNTRACK_STAT_INC(count) (__get_cpu_var(ip_conntrack_stat).count++) 302#define CONNTRACK_STAT_INC(count) (__get_cpu_var(ip_conntrack_stat).count++)
297 303
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_h323.h b/include/linux/netfilter_ipv4/ip_conntrack_h323.h
index eace86bd2adb..3cbff7379002 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_h323.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_h323.h
@@ -71,6 +71,13 @@ extern int (*nat_h245_hook) (struct sk_buff ** pskb, struct ip_conntrack * ct,
71 unsigned char **data, int dataoff, 71 unsigned char **data, int dataoff,
72 TransportAddress * addr, u_int16_t port, 72 TransportAddress * addr, u_int16_t port,
73 struct ip_conntrack_expect * exp); 73 struct ip_conntrack_expect * exp);
74extern int (*nat_callforwarding_hook) (struct sk_buff ** pskb,
75 struct ip_conntrack * ct,
76 enum ip_conntrack_info ctinfo,
77 unsigned char **data, int dataoff,
78 TransportAddress * addr,
79 u_int16_t port,
80 struct ip_conntrack_expect * exp);
74extern int (*nat_q931_hook) (struct sk_buff ** pskb, struct ip_conntrack * ct, 81extern int (*nat_q931_hook) (struct sk_buff ** pskb, struct ip_conntrack * ct,
75 enum ip_conntrack_info ctinfo, 82 enum ip_conntrack_info ctinfo,
76 unsigned char **data, TransportAddress * addr, 83 unsigned char **data, TransportAddress * addr,
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_helper_h323_types.h b/include/linux/netfilter_ipv4/ip_conntrack_helper_h323_types.h
index cc98f7aa5abe..3d4a773799fc 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_helper_h323_types.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_helper_h323_types.h
@@ -1,4 +1,4 @@
1/* Generated by Jing Min Zhao's ASN.1 parser, Mar 15 2006 1/* Generated by Jing Min Zhao's ASN.1 parser, Apr 20 2006
2 * 2 *
3 * Copyright (c) 2006 Jing Min Zhao <zhaojingmin@users.sourceforge.net> 3 * Copyright (c) 2006 Jing Min Zhao <zhaojingmin@users.sourceforge.net>
4 * 4 *
@@ -412,6 +412,7 @@ typedef struct Facility_UUIE { /* SEQUENCE */
412 eFacility_UUIE_destinationInfo = (1 << 14), 412 eFacility_UUIE_destinationInfo = (1 << 14),
413 eFacility_UUIE_h245SecurityMode = (1 << 13), 413 eFacility_UUIE_h245SecurityMode = (1 << 13),
414 } options; 414 } options;
415 TransportAddress alternativeAddress;
415 FacilityReason reason; 416 FacilityReason reason;
416 TransportAddress h245Address; 417 TransportAddress h245Address;
417 Facility_UUIE_fastStart fastStart; 418 Facility_UUIE_fastStart fastStart;
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_sip.h b/include/linux/netfilter_ipv4/ip_conntrack_sip.h
new file mode 100644
index 000000000000..913dad66c0fb
--- /dev/null
+++ b/include/linux/netfilter_ipv4/ip_conntrack_sip.h
@@ -0,0 +1,44 @@
1#ifndef __IP_CONNTRACK_SIP_H__
2#define __IP_CONNTRACK_SIP_H__
3#ifdef __KERNEL__
4
5#define SIP_PORT 5060
6#define SIP_TIMEOUT 3600
7
8#define POS_VIA 0
9#define POS_CONTACT 1
10#define POS_CONTENT 2
11#define POS_MEDIA 3
12#define POS_OWNER 4
13#define POS_CONNECTION 5
14#define POS_REQ_HEADER 6
15#define POS_SDP_HEADER 7
16
17struct sip_header_nfo {
18 const char *lname;
19 const char *sname;
20 const char *ln_str;
21 size_t lnlen;
22 size_t snlen;
23 size_t ln_strlen;
24 int (*match_len)(const char *, const char *, int *);
25};
26
27extern unsigned int (*ip_nat_sip_hook)(struct sk_buff **pskb,
28 enum ip_conntrack_info ctinfo,
29 struct ip_conntrack *ct,
30 const char **dptr);
31extern unsigned int (*ip_nat_sdp_hook)(struct sk_buff **pskb,
32 enum ip_conntrack_info ctinfo,
33 struct ip_conntrack_expect *exp,
34 const char *dptr);
35
36extern int ct_sip_get_info(const char *dptr, size_t dlen,
37 unsigned int *matchoff,
38 unsigned int *matchlen,
39 struct sip_header_nfo *hnfo);
40extern int ct_sip_lnlen(const char *line, const char *limit);
41extern const char *ct_sip_search(const char *needle, const char *haystack,
42 size_t needle_len, size_t haystack_len);
43#endif /* __KERNEL__ */
44#endif /* __IP_CONNTRACK_SIP_H__ */
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h
index 4877e35ae202..936ef82ed76a 100644
--- a/include/linux/pci-acpi.h
+++ b/include/linux/pci-acpi.h
@@ -50,7 +50,7 @@
50extern acpi_status pci_osc_control_set(acpi_handle handle, u32 flags); 50extern acpi_status pci_osc_control_set(acpi_handle handle, u32 flags);
51extern acpi_status pci_osc_support_set(u32 flags); 51extern acpi_status pci_osc_support_set(u32 flags);
52#else 52#else
53#if !defined(acpi_status) 53#if !defined(AE_ERROR)
54typedef u32 acpi_status; 54typedef u32 acpi_status;
55#define AE_ERROR (acpi_status) (0x0001) 55#define AE_ERROR (acpi_status) (0x0001)
56#endif 56#endif
diff --git a/include/linux/pci.h b/include/linux/pci.h
index fee8275df6d8..6c4bc773f7b7 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -441,6 +441,7 @@ struct pci_dev *pci_find_device_reverse (unsigned int vendor, unsigned int devic
441struct pci_dev *pci_find_slot (unsigned int bus, unsigned int devfn); 441struct pci_dev *pci_find_slot (unsigned int bus, unsigned int devfn);
442int pci_find_capability (struct pci_dev *dev, int cap); 442int pci_find_capability (struct pci_dev *dev, int cap);
443int pci_find_next_capability (struct pci_dev *dev, u8 pos, int cap); 443int pci_find_next_capability (struct pci_dev *dev, u8 pos, int cap);
444int pci_find_ext_capability (struct pci_dev *dev, int cap);
444struct pci_bus * pci_find_next_bus(const struct pci_bus *from); 445struct pci_bus * pci_find_next_bus(const struct pci_bus *from);
445 446
446struct pci_dev *pci_get_device (unsigned int vendor, unsigned int device, struct pci_dev *from); 447struct pci_dev *pci_get_device (unsigned int vendor, unsigned int device, struct pci_dev *from);
@@ -661,6 +662,7 @@ static inline int pci_register_driver(struct pci_driver *drv) { return 0;}
661static inline void pci_unregister_driver(struct pci_driver *drv) { } 662static inline void pci_unregister_driver(struct pci_driver *drv) { }
662static inline int pci_find_capability (struct pci_dev *dev, int cap) {return 0; } 663static inline int pci_find_capability (struct pci_dev *dev, int cap) {return 0; }
663static inline int pci_find_next_capability (struct pci_dev *dev, u8 post, int cap) { return 0; } 664static inline int pci_find_next_capability (struct pci_dev *dev, u8 post, int cap) { return 0; }
665static inline int pci_find_ext_capability (struct pci_dev *dev, int cap) {return 0; }
664static inline const struct pci_device_id *pci_match_device(const struct pci_device_id *ids, const struct pci_dev *dev) { return NULL; } 666static inline const struct pci_device_id *pci_match_device(const struct pci_device_id *ids, const struct pci_dev *dev) { return NULL; }
665 667
666/* Power management related routines */ 668/* Power management related routines */
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index d6fe048376ab..bcfe9d4f56ae 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -935,6 +935,7 @@
935#define PCI_DEVICE_ID_PLX_DJINN_ITOO 0x1151 935#define PCI_DEVICE_ID_PLX_DJINN_ITOO 0x1151
936#define PCI_DEVICE_ID_PLX_R753 0x1152 936#define PCI_DEVICE_ID_PLX_R753 0x1152
937#define PCI_DEVICE_ID_PLX_OLITEC 0x1187 937#define PCI_DEVICE_ID_PLX_OLITEC 0x1187
938#define PCI_DEVICE_ID_PLX_PCI200SYN 0x3196
938#define PCI_DEVICE_ID_PLX_9050 0x9050 939#define PCI_DEVICE_ID_PLX_9050 0x9050
939#define PCI_DEVICE_ID_PLX_9080 0x9080 940#define PCI_DEVICE_ID_PLX_9080 0x9080
940#define PCI_DEVICE_ID_PLX_GTEK_SERIAL2 0xa001 941#define PCI_DEVICE_ID_PLX_GTEK_SERIAL2 0xa001
@@ -1182,6 +1183,14 @@
1182#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_1100 0x034E 1183#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_1100 0x034E
1183#define PCI_DEVICE_ID_NVIDIA_NVENET_14 0x0372 1184#define PCI_DEVICE_ID_NVIDIA_NVENET_14 0x0372
1184#define PCI_DEVICE_ID_NVIDIA_NVENET_15 0x0373 1185#define PCI_DEVICE_ID_NVIDIA_NVENET_15 0x0373
1186#define PCI_DEVICE_ID_NVIDIA_NVENET_16 0x03E5
1187#define PCI_DEVICE_ID_NVIDIA_NVENET_17 0x03E6
1188#define PCI_DEVICE_ID_NVIDIA_NVENET_18 0x03EE
1189#define PCI_DEVICE_ID_NVIDIA_NVENET_19 0x03EF
1190#define PCI_DEVICE_ID_NVIDIA_NVENET_20 0x0450
1191#define PCI_DEVICE_ID_NVIDIA_NVENET_21 0x0451
1192#define PCI_DEVICE_ID_NVIDIA_NVENET_22 0x0452
1193#define PCI_DEVICE_ID_NVIDIA_NVENET_23 0x0453
1185 1194
1186#define PCI_VENDOR_ID_IMS 0x10e0 1195#define PCI_VENDOR_ID_IMS 0x10e0
1187#define PCI_DEVICE_ID_IMS_TT128 0x9128 1196#define PCI_DEVICE_ID_IMS_TT128 0x9128
@@ -1231,6 +1240,7 @@
1231#define PCI_DEVICE_ID_VIA_8380_0 0x0204 1240#define PCI_DEVICE_ID_VIA_8380_0 0x0204
1232#define PCI_DEVICE_ID_VIA_3238_0 0x0238 1241#define PCI_DEVICE_ID_VIA_3238_0 0x0238
1233#define PCI_DEVICE_ID_VIA_PT880 0x0258 1242#define PCI_DEVICE_ID_VIA_PT880 0x0258
1243#define PCI_DEVICE_ID_VIA_PT880ULTRA 0x0308
1234#define PCI_DEVICE_ID_VIA_PX8X0_0 0x0259 1244#define PCI_DEVICE_ID_VIA_PX8X0_0 0x0259
1235#define PCI_DEVICE_ID_VIA_3269_0 0x0269 1245#define PCI_DEVICE_ID_VIA_3269_0 0x0269
1236#define PCI_DEVICE_ID_VIA_K8T800PRO_0 0x0282 1246#define PCI_DEVICE_ID_VIA_K8T800PRO_0 0x0282
@@ -1826,6 +1836,7 @@
1826 1836
1827#define PCI_VENDOR_ID_SAMSUNG 0x144d 1837#define PCI_VENDOR_ID_SAMSUNG 0x144d
1828 1838
1839#define PCI_VENDOR_ID_MYRICOM 0x14c1
1829 1840
1830#define PCI_VENDOR_ID_TITAN 0x14D2 1841#define PCI_VENDOR_ID_TITAN 0x14D2
1831#define PCI_DEVICE_ID_TITAN_010L 0x8001 1842#define PCI_DEVICE_ID_TITAN_010L 0x8001
@@ -1886,6 +1897,7 @@
1886#define PCI_DEVICE_ID_TIGON3_5751F 0x167e 1897#define PCI_DEVICE_ID_TIGON3_5751F 0x167e
1887#define PCI_DEVICE_ID_TIGON3_5787M 0x1693 1898#define PCI_DEVICE_ID_TIGON3_5787M 0x1693
1888#define PCI_DEVICE_ID_TIGON3_5782 0x1696 1899#define PCI_DEVICE_ID_TIGON3_5782 0x1696
1900#define PCI_DEVICE_ID_TIGON3_5786 0x169a
1889#define PCI_DEVICE_ID_TIGON3_5787 0x169b 1901#define PCI_DEVICE_ID_TIGON3_5787 0x169b
1890#define PCI_DEVICE_ID_TIGON3_5788 0x169c 1902#define PCI_DEVICE_ID_TIGON3_5788 0x169c
1891#define PCI_DEVICE_ID_TIGON3_5789 0x169d 1903#define PCI_DEVICE_ID_TIGON3_5789 0x169d
@@ -2042,6 +2054,7 @@
2042#define PCI_DEVICE_ID_INTEL_80960_RP 0x1960 2054#define PCI_DEVICE_ID_INTEL_80960_RP 0x1960
2043#define PCI_DEVICE_ID_INTEL_82840_HB 0x1a21 2055#define PCI_DEVICE_ID_INTEL_82840_HB 0x1a21
2044#define PCI_DEVICE_ID_INTEL_82845_HB 0x1a30 2056#define PCI_DEVICE_ID_INTEL_82845_HB 0x1a30
2057#define PCI_DEVICE_ID_INTEL_IOAT 0x1a38
2045#define PCI_DEVICE_ID_INTEL_82801AA_0 0x2410 2058#define PCI_DEVICE_ID_INTEL_82801AA_0 0x2410
2046#define PCI_DEVICE_ID_INTEL_82801AA_1 0x2411 2059#define PCI_DEVICE_ID_INTEL_82801AA_1 0x2411
2047#define PCI_DEVICE_ID_INTEL_82801AA_3 0x2413 2060#define PCI_DEVICE_ID_INTEL_82801AA_3 0x2413
diff --git a/include/linux/pfkeyv2.h b/include/linux/pfkeyv2.h
index bac0fb389cf1..d5dd471da225 100644
--- a/include/linux/pfkeyv2.h
+++ b/include/linux/pfkeyv2.h
@@ -159,7 +159,7 @@ struct sadb_spirange {
159struct sadb_x_kmprivate { 159struct sadb_x_kmprivate {
160 uint16_t sadb_x_kmprivate_len; 160 uint16_t sadb_x_kmprivate_len;
161 uint16_t sadb_x_kmprivate_exttype; 161 uint16_t sadb_x_kmprivate_exttype;
162 u_int32_t sadb_x_kmprivate_reserved; 162 uint32_t sadb_x_kmprivate_reserved;
163} __attribute__((packed)); 163} __attribute__((packed));
164/* sizeof(struct sadb_x_kmprivate) == 8 */ 164/* sizeof(struct sadb_x_kmprivate) == 8 */
165 165
diff --git a/include/linux/rbtree.h b/include/linux/rbtree.h
index 4b7cc4fe366d..f37006f21664 100644
--- a/include/linux/rbtree.h
+++ b/include/linux/rbtree.h
@@ -99,19 +99,36 @@ static inline struct page * rb_insert_page_cache(struct inode * inode,
99 99
100struct rb_node 100struct rb_node
101{ 101{
102 struct rb_node *rb_parent; 102 unsigned long rb_parent_color;
103 int rb_color;
104#define RB_RED 0 103#define RB_RED 0
105#define RB_BLACK 1 104#define RB_BLACK 1
106 struct rb_node *rb_right; 105 struct rb_node *rb_right;
107 struct rb_node *rb_left; 106 struct rb_node *rb_left;
108}; 107} __attribute__((aligned(sizeof(long))));
108 /* The alignment might seem pointless, but allegedly CRIS needs it */
109 109
110struct rb_root 110struct rb_root
111{ 111{
112 struct rb_node *rb_node; 112 struct rb_node *rb_node;
113}; 113};
114 114
115
116#define rb_parent(r) ((struct rb_node *)((r)->rb_parent_color & ~3))
117#define rb_color(r) ((r)->rb_parent_color & 1)
118#define rb_is_red(r) (!rb_color(r))
119#define rb_is_black(r) rb_color(r)
120#define rb_set_red(r) do { (r)->rb_parent_color &= ~1; } while (0)
121#define rb_set_black(r) do { (r)->rb_parent_color |= 1; } while (0)
122
123static inline void rb_set_parent(struct rb_node *rb, struct rb_node *p)
124{
125 rb->rb_parent_color = (rb->rb_parent_color & 3) | (unsigned long)p;
126}
127static inline void rb_set_color(struct rb_node *rb, int color)
128{
129 rb->rb_parent_color = (rb->rb_parent_color & ~1) | color;
130}
131
115#define RB_ROOT (struct rb_root) { NULL, } 132#define RB_ROOT (struct rb_root) { NULL, }
116#define rb_entry(ptr, type, member) container_of(ptr, type, member) 133#define rb_entry(ptr, type, member) container_of(ptr, type, member)
117 134
@@ -131,8 +148,7 @@ extern void rb_replace_node(struct rb_node *victim, struct rb_node *new,
131static inline void rb_link_node(struct rb_node * node, struct rb_node * parent, 148static inline void rb_link_node(struct rb_node * node, struct rb_node * parent,
132 struct rb_node ** rb_link) 149 struct rb_node ** rb_link)
133{ 150{
134 node->rb_parent = parent; 151 node->rb_parent_color = (unsigned long )parent;
135 node->rb_color = RB_RED;
136 node->rb_left = node->rb_right = NULL; 152 node->rb_left = node->rb_right = NULL;
137 153
138 *rb_link = node; 154 *rb_link = node;
diff --git a/include/linux/security.h b/include/linux/security.h
index 1bab48f6aeac..4dfb1b84a9b3 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -805,31 +805,37 @@ struct swap_info_struct;
805 * used by the XFRM system. 805 * used by the XFRM system.
806 * @sec_ctx contains the security context information being provided by 806 * @sec_ctx contains the security context information being provided by
807 * the user-level policy update program (e.g., setkey). 807 * the user-level policy update program (e.g., setkey).
808 * Allocate a security structure to the xp->selector.security field. 808 * Allocate a security structure to the xp->security field.
809 * The security field is initialized to NULL when the xfrm_policy is 809 * The security field is initialized to NULL when the xfrm_policy is
810 * allocated. 810 * allocated.
811 * Return 0 if operation was successful (memory to allocate, legal context) 811 * Return 0 if operation was successful (memory to allocate, legal context)
812 * @xfrm_policy_clone_security: 812 * @xfrm_policy_clone_security:
813 * @old contains an existing xfrm_policy in the SPD. 813 * @old contains an existing xfrm_policy in the SPD.
814 * @new contains a new xfrm_policy being cloned from old. 814 * @new contains a new xfrm_policy being cloned from old.
815 * Allocate a security structure to the new->selector.security field 815 * Allocate a security structure to the new->security field
816 * that contains the information from the old->selector.security field. 816 * that contains the information from the old->security field.
817 * Return 0 if operation was successful (memory to allocate). 817 * Return 0 if operation was successful (memory to allocate).
818 * @xfrm_policy_free_security: 818 * @xfrm_policy_free_security:
819 * @xp contains the xfrm_policy 819 * @xp contains the xfrm_policy
820 * Deallocate xp->selector.security. 820 * Deallocate xp->security.
821 * @xfrm_policy_delete_security:
822 * @xp contains the xfrm_policy.
823 * Authorize deletion of xp->security.
821 * @xfrm_state_alloc_security: 824 * @xfrm_state_alloc_security:
822 * @x contains the xfrm_state being added to the Security Association 825 * @x contains the xfrm_state being added to the Security Association
823 * Database by the XFRM system. 826 * Database by the XFRM system.
824 * @sec_ctx contains the security context information being provided by 827 * @sec_ctx contains the security context information being provided by
825 * the user-level SA generation program (e.g., setkey or racoon). 828 * the user-level SA generation program (e.g., setkey or racoon).
826 * Allocate a security structure to the x->sel.security field. The 829 * Allocate a security structure to the x->security field. The
827 * security field is initialized to NULL when the xfrm_state is 830 * security field is initialized to NULL when the xfrm_state is
828 * allocated. 831 * allocated.
829 * Return 0 if operation was successful (memory to allocate, legal context). 832 * Return 0 if operation was successful (memory to allocate, legal context).
830 * @xfrm_state_free_security: 833 * @xfrm_state_free_security:
831 * @x contains the xfrm_state. 834 * @x contains the xfrm_state.
832 * Deallocate x>sel.security. 835 * Deallocate x->security.
836 * @xfrm_state_delete_security:
837 * @x contains the xfrm_state.
838 * Authorize deletion of x->security.
833 * @xfrm_policy_lookup: 839 * @xfrm_policy_lookup:
834 * @xp contains the xfrm_policy for which the access control is being 840 * @xp contains the xfrm_policy for which the access control is being
835 * checked. 841 * checked.
@@ -1298,8 +1304,10 @@ struct security_operations {
1298 int (*xfrm_policy_alloc_security) (struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx); 1304 int (*xfrm_policy_alloc_security) (struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx);
1299 int (*xfrm_policy_clone_security) (struct xfrm_policy *old, struct xfrm_policy *new); 1305 int (*xfrm_policy_clone_security) (struct xfrm_policy *old, struct xfrm_policy *new);
1300 void (*xfrm_policy_free_security) (struct xfrm_policy *xp); 1306 void (*xfrm_policy_free_security) (struct xfrm_policy *xp);
1307 int (*xfrm_policy_delete_security) (struct xfrm_policy *xp);
1301 int (*xfrm_state_alloc_security) (struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx); 1308 int (*xfrm_state_alloc_security) (struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx);
1302 void (*xfrm_state_free_security) (struct xfrm_state *x); 1309 void (*xfrm_state_free_security) (struct xfrm_state *x);
1310 int (*xfrm_state_delete_security) (struct xfrm_state *x);
1303 int (*xfrm_policy_lookup)(struct xfrm_policy *xp, u32 sk_sid, u8 dir); 1311 int (*xfrm_policy_lookup)(struct xfrm_policy *xp, u32 sk_sid, u8 dir);
1304#endif /* CONFIG_SECURITY_NETWORK_XFRM */ 1312#endif /* CONFIG_SECURITY_NETWORK_XFRM */
1305 1313
@@ -2934,11 +2942,21 @@ static inline void security_xfrm_policy_free(struct xfrm_policy *xp)
2934 security_ops->xfrm_policy_free_security(xp); 2942 security_ops->xfrm_policy_free_security(xp);
2935} 2943}
2936 2944
2945static inline int security_xfrm_policy_delete(struct xfrm_policy *xp)
2946{
2947 return security_ops->xfrm_policy_delete_security(xp);
2948}
2949
2937static inline int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx) 2950static inline int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx)
2938{ 2951{
2939 return security_ops->xfrm_state_alloc_security(x, sec_ctx); 2952 return security_ops->xfrm_state_alloc_security(x, sec_ctx);
2940} 2953}
2941 2954
2955static inline int security_xfrm_state_delete(struct xfrm_state *x)
2956{
2957 return security_ops->xfrm_state_delete_security(x);
2958}
2959
2942static inline void security_xfrm_state_free(struct xfrm_state *x) 2960static inline void security_xfrm_state_free(struct xfrm_state *x)
2943{ 2961{
2944 security_ops->xfrm_state_free_security(x); 2962 security_ops->xfrm_state_free_security(x);
@@ -2963,6 +2981,11 @@ static inline void security_xfrm_policy_free(struct xfrm_policy *xp)
2963{ 2981{
2964} 2982}
2965 2983
2984static inline int security_xfrm_policy_delete(struct xfrm_policy *xp)
2985{
2986 return 0;
2987}
2988
2966static inline int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx) 2989static inline int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx)
2967{ 2990{
2968 return 0; 2991 return 0;
@@ -2972,6 +2995,11 @@ static inline void security_xfrm_state_free(struct xfrm_state *x)
2972{ 2995{
2973} 2996}
2974 2997
2998static inline int security_xfrm_state_delete(struct xfrm_state *x)
2999{
3000 return 0;
3001}
3002
2975static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 sk_sid, u8 dir) 3003static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 sk_sid, u8 dir)
2976{ 3004{
2977 return 0; 3005 return 0;
diff --git a/include/linux/selinux.h b/include/linux/selinux.h
index 4047bcde4484..aad4e390d6a5 100644
--- a/include/linux/selinux.h
+++ b/include/linux/selinux.h
@@ -118,6 +118,27 @@ void selinux_get_ipc_sid(const struct kern_ipc_perm *ipcp, u32 *sid);
118 */ 118 */
119void selinux_get_task_sid(struct task_struct *tsk, u32 *sid); 119void selinux_get_task_sid(struct task_struct *tsk, u32 *sid);
120 120
121/**
122 * selinux_string_to_sid - map a security context string to a security ID
123 * @str: the security context string to be mapped
124 * @sid: ID value returned via this.
125 *
126 * Returns 0 if successful, with the SID stored in sid. A value
127 * of zero for sid indicates no SID could be determined (but no error
128 * occurred).
129 */
130int selinux_string_to_sid(char *str, u32 *sid);
131
132/**
133 * selinux_relabel_packet_permission - check permission to relabel a packet
134 * @sid: ID value to be applied to network packet (via SECMARK, most likely)
135 *
136 * Returns 0 if the current task is allowed to label packets with the
137 * supplied security ID. Note that it is implicit that the packet is always
138 * being relabeled from the default unlabled value, and that the access
139 * control decision is made in the AVC.
140 */
141int selinux_relabel_packet_permission(u32 sid);
121 142
122#else 143#else
123 144
@@ -172,6 +193,17 @@ static inline void selinux_get_task_sid(struct task_struct *tsk, u32 *sid)
172 *sid = 0; 193 *sid = 0;
173} 194}
174 195
196static inline int selinux_string_to_sid(const char *str, u32 *sid)
197{
198 *sid = 0;
199 return 0;
200}
201
202static inline int selinux_relabel_packet_permission(u32 sid)
203{
204 return 0;
205}
206
175#endif /* CONFIG_SECURITY_SELINUX */ 207#endif /* CONFIG_SECURITY_SELINUX */
176 208
177#endif /* _LINUX_SELINUX_H */ 209#endif /* _LINUX_SELINUX_H */
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 4dc65b55812e..66f8819f9568 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -28,6 +28,7 @@
28#include <linux/net.h> 28#include <linux/net.h>
29#include <linux/textsearch.h> 29#include <linux/textsearch.h>
30#include <net/checksum.h> 30#include <net/checksum.h>
31#include <linux/dmaengine.h>
31 32
32#define HAVE_ALLOC_SKB /* For the drivers to know */ 33#define HAVE_ALLOC_SKB /* For the drivers to know */
33#define HAVE_ALIGNABLE_SKB /* Ditto 8) */ 34#define HAVE_ALIGNABLE_SKB /* Ditto 8) */
@@ -208,6 +209,7 @@ enum {
208 * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c 209 * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c
209 * @tc_index: Traffic control index 210 * @tc_index: Traffic control index
210 * @tc_verd: traffic control verdict 211 * @tc_verd: traffic control verdict
212 * @secmark: security marking
211 */ 213 */
212 214
213struct sk_buff { 215struct sk_buff {
@@ -284,6 +286,12 @@ struct sk_buff {
284 __u16 tc_verd; /* traffic control verdict */ 286 __u16 tc_verd; /* traffic control verdict */
285#endif 287#endif
286#endif 288#endif
289#ifdef CONFIG_NET_DMA
290 dma_cookie_t dma_cookie;
291#endif
292#ifdef CONFIG_NETWORK_SECMARK
293 __u32 secmark;
294#endif
287 295
288 296
289 /* These elements must be at the end, see alloc_skb() for details. */ 297 /* These elements must be at the end, see alloc_skb() for details. */
@@ -966,15 +974,16 @@ static inline void skb_reserve(struct sk_buff *skb, int len)
966#define NET_SKB_PAD 16 974#define NET_SKB_PAD 16
967#endif 975#endif
968 976
969extern int ___pskb_trim(struct sk_buff *skb, unsigned int len, int realloc); 977extern int ___pskb_trim(struct sk_buff *skb, unsigned int len);
970 978
971static inline void __skb_trim(struct sk_buff *skb, unsigned int len) 979static inline void __skb_trim(struct sk_buff *skb, unsigned int len)
972{ 980{
973 if (!skb->data_len) { 981 if (unlikely(skb->data_len)) {
974 skb->len = len; 982 WARN_ON(1);
975 skb->tail = skb->data + len; 983 return;
976 } else 984 }
977 ___pskb_trim(skb, len, 0); 985 skb->len = len;
986 skb->tail = skb->data + len;
978} 987}
979 988
980/** 989/**
@@ -984,6 +993,7 @@ static inline void __skb_trim(struct sk_buff *skb, unsigned int len)
984 * 993 *
985 * Cut the length of a buffer down by removing data from the tail. If 994 * Cut the length of a buffer down by removing data from the tail. If
986 * the buffer is already under the length specified it is not modified. 995 * the buffer is already under the length specified it is not modified.
996 * The skb must be linear.
987 */ 997 */
988static inline void skb_trim(struct sk_buff *skb, unsigned int len) 998static inline void skb_trim(struct sk_buff *skb, unsigned int len)
989{ 999{
@@ -994,12 +1004,10 @@ static inline void skb_trim(struct sk_buff *skb, unsigned int len)
994 1004
995static inline int __pskb_trim(struct sk_buff *skb, unsigned int len) 1005static inline int __pskb_trim(struct sk_buff *skb, unsigned int len)
996{ 1006{
997 if (!skb->data_len) { 1007 if (skb->data_len)
998 skb->len = len; 1008 return ___pskb_trim(skb, len);
999 skb->tail = skb->data+len; 1009 __skb_trim(skb, len);
1000 return 0; 1010 return 0;
1001 }
1002 return ___pskb_trim(skb, len, 1);
1003} 1011}
1004 1012
1005static inline int pskb_trim(struct sk_buff *skb, unsigned int len) 1013static inline int pskb_trim(struct sk_buff *skb, unsigned int len)
@@ -1160,18 +1168,34 @@ static inline int skb_can_coalesce(struct sk_buff *skb, int i,
1160 return 0; 1168 return 0;
1161} 1169}
1162 1170
1171static inline int __skb_linearize(struct sk_buff *skb)
1172{
1173 return __pskb_pull_tail(skb, skb->data_len) ? 0 : -ENOMEM;
1174}
1175
1163/** 1176/**
1164 * skb_linearize - convert paged skb to linear one 1177 * skb_linearize - convert paged skb to linear one
1165 * @skb: buffer to linarize 1178 * @skb: buffer to linarize
1166 * @gfp: allocation mode
1167 * 1179 *
1168 * If there is no free memory -ENOMEM is returned, otherwise zero 1180 * If there is no free memory -ENOMEM is returned, otherwise zero
1169 * is returned and the old skb data released. 1181 * is returned and the old skb data released.
1170 */ 1182 */
1171extern int __skb_linearize(struct sk_buff *skb, gfp_t gfp); 1183static inline int skb_linearize(struct sk_buff *skb)
1172static inline int skb_linearize(struct sk_buff *skb, gfp_t gfp) 1184{
1185 return skb_is_nonlinear(skb) ? __skb_linearize(skb) : 0;
1186}
1187
1188/**
1189 * skb_linearize_cow - make sure skb is linear and writable
1190 * @skb: buffer to process
1191 *
1192 * If there is no free memory -ENOMEM is returned, otherwise zero
1193 * is returned and the old skb data released.
1194 */
1195static inline int skb_linearize_cow(struct sk_buff *skb)
1173{ 1196{
1174 return __skb_linearize(skb, gfp); 1197 return skb_is_nonlinear(skb) || skb_cloned(skb) ?
1198 __skb_linearize(skb) : 0;
1175} 1199}
1176 1200
1177/** 1201/**
@@ -1395,5 +1419,23 @@ static inline void nf_reset(struct sk_buff *skb)
1395static inline void nf_reset(struct sk_buff *skb) {} 1419static inline void nf_reset(struct sk_buff *skb) {}
1396#endif /* CONFIG_NETFILTER */ 1420#endif /* CONFIG_NETFILTER */
1397 1421
1422#ifdef CONFIG_NETWORK_SECMARK
1423static inline void skb_copy_secmark(struct sk_buff *to, const struct sk_buff *from)
1424{
1425 to->secmark = from->secmark;
1426}
1427
1428static inline void skb_init_secmark(struct sk_buff *skb)
1429{
1430 skb->secmark = 0;
1431}
1432#else
1433static inline void skb_copy_secmark(struct sk_buff *to, const struct sk_buff *from)
1434{ }
1435
1436static inline void skb_init_secmark(struct sk_buff *skb)
1437{ }
1438#endif
1439
1398#endif /* __KERNEL__ */ 1440#endif /* __KERNEL__ */
1399#endif /* _LINUX_SKBUFF_H */ 1441#endif /* _LINUX_SKBUFF_H */
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 76eaeff76f82..cee944dbdcd4 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -313,6 +313,7 @@ enum
313 NET_NF_CONNTRACK_FRAG6_TIMEOUT=29, 313 NET_NF_CONNTRACK_FRAG6_TIMEOUT=29,
314 NET_NF_CONNTRACK_FRAG6_LOW_THRESH=30, 314 NET_NF_CONNTRACK_FRAG6_LOW_THRESH=30,
315 NET_NF_CONNTRACK_FRAG6_HIGH_THRESH=31, 315 NET_NF_CONNTRACK_FRAG6_HIGH_THRESH=31,
316 NET_NF_CONNTRACK_CHECKSUM=32,
316}; 317};
317 318
318/* /proc/sys/net/ipv4 */ 319/* /proc/sys/net/ipv4 */
@@ -403,6 +404,8 @@ enum
403 NET_TCP_MTU_PROBING=113, 404 NET_TCP_MTU_PROBING=113,
404 NET_TCP_BASE_MSS=114, 405 NET_TCP_BASE_MSS=114,
405 NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS=115, 406 NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS=115,
407 NET_TCP_DMA_COPYBREAK=116,
408 NET_TCP_SLOW_START_AFTER_IDLE=117,
406}; 409};
407 410
408enum { 411enum {
@@ -491,6 +494,7 @@ enum
491 NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_RECD=25, 494 NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_RECD=25,
492 NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_ACK_SENT=26, 495 NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_ACK_SENT=26,
493 NET_IPV4_NF_CONNTRACK_COUNT=27, 496 NET_IPV4_NF_CONNTRACK_COUNT=27,
497 NET_IPV4_NF_CONNTRACK_CHECKSUM=28,
494}; 498};
495 499
496/* /proc/sys/net/ipv6 */ 500/* /proc/sys/net/ipv6 */
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index a8b24eff5b5f..420a689c3fb4 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -18,6 +18,7 @@
18#define _LINUX_TCP_H 18#define _LINUX_TCP_H
19 19
20#include <linux/types.h> 20#include <linux/types.h>
21#include <linux/dmaengine.h>
21#include <asm/byteorder.h> 22#include <asm/byteorder.h>
22 23
23struct tcphdr { 24struct tcphdr {
@@ -232,6 +233,13 @@ struct tcp_sock {
232 struct iovec *iov; 233 struct iovec *iov;
233 int memory; 234 int memory;
234 int len; 235 int len;
236#ifdef CONFIG_NET_DMA
237 /* members for async copy */
238 struct dma_chan *dma_chan;
239 int wakeup;
240 struct dma_pinned_list *pinned_list;
241 dma_cookie_t dma_cookie;
242#endif
235 } ucopy; 243 } ucopy;
236 244
237 __u32 snd_wl1; /* Sequence for window update */ 245 __u32 snd_wl1; /* Sequence for window update */
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h
index 6ef527bb6235..940d0261a545 100644
--- a/include/linux/vt_kern.h
+++ b/include/linux/vt_kern.h
@@ -72,11 +72,6 @@ int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc);
72int vt_waitactive(int vt); 72int vt_waitactive(int vt);
73void change_console(struct vc_data *new_vc); 73void change_console(struct vc_data *new_vc);
74void reset_vc(struct vc_data *vc); 74void reset_vc(struct vc_data *vc);
75#ifdef CONFIG_VT
76int is_console_suspend_safe(void);
77#else
78static inline int is_console_suspend_safe(void) { return 1; }
79#endif
80 75
81/* 76/*
82 * vc_screen.c shares this temporary buffer with the console write code so that 77 * vc_screen.c shares this temporary buffer with the console write code so that
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index 6b42cc474c01..46a15c7a1a13 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -118,6 +118,10 @@ enum
118 XFRM_SHARE_UNIQUE /* Use once */ 118 XFRM_SHARE_UNIQUE /* Use once */
119}; 119};
120 120
121#define XFRM_MODE_TRANSPORT 0
122#define XFRM_MODE_TUNNEL 1
123#define XFRM_MODE_MAX 2
124
121/* Netlink configuration messages. */ 125/* Netlink configuration messages. */
122enum { 126enum {
123 XFRM_MSG_BASE = 0x10, 127 XFRM_MSG_BASE = 0x10,
diff --git a/include/mtd/mtd-abi.h b/include/mtd/mtd-abi.h
index 9fd8c720a803..31329fce1ff5 100644
--- a/include/mtd/mtd-abi.h
+++ b/include/mtd/mtd-abi.h
@@ -29,28 +29,17 @@ struct mtd_oob_buf {
29#define MTD_ROM 2 29#define MTD_ROM 2
30#define MTD_NORFLASH 3 30#define MTD_NORFLASH 3
31#define MTD_NANDFLASH 4 31#define MTD_NANDFLASH 4
32#define MTD_PEROM 5
33#define MTD_DATAFLASH 6 32#define MTD_DATAFLASH 6
34#define MTD_OTHER 14 33
35#define MTD_UNKNOWN 15 34#define MTD_WRITEABLE 0x400 /* Device is writeable */
36 35#define MTD_BIT_WRITEABLE 0x800 /* Single bits can be flipped */
37#define MTD_CLEAR_BITS 1 // Bits can be cleared (flash) 36#define MTD_NO_ERASE 0x1000 /* No erase necessary */
38#define MTD_SET_BITS 2 // Bits can be set
39#define MTD_ERASEABLE 4 // Has an erase function
40#define MTD_WRITEB_WRITEABLE 8 // Direct IO is possible
41#define MTD_VOLATILE 16 // Set for RAMs
42#define MTD_XIP 32 // eXecute-In-Place possible
43#define MTD_OOB 64 // Out-of-band data (NAND flash)
44#define MTD_ECC 128 // Device capable of automatic ECC
45#define MTD_NO_VIRTBLOCKS 256 // Virtual blocks not allowed
46#define MTD_PROGRAM_REGIONS 512 // Configurable Programming Regions
47 37
48// Some common devices / combinations of capabilities 38// Some common devices / combinations of capabilities
49#define MTD_CAP_ROM 0 39#define MTD_CAP_ROM 0
50#define MTD_CAP_RAM (MTD_CLEAR_BITS|MTD_SET_BITS|MTD_WRITEB_WRITEABLE) 40#define MTD_CAP_RAM (MTD_WRITEABLE | MTD_BIT_WRITEABLE | MTD_NO_ERASE)
51#define MTD_CAP_NORFLASH (MTD_CLEAR_BITS|MTD_ERASEABLE) 41#define MTD_CAP_NORFLASH (MTD_WRITEABLE | MTD_BIT_WRITEABLE)
52#define MTD_CAP_NANDFLASH (MTD_CLEAR_BITS|MTD_ERASEABLE|MTD_OOB) 42#define MTD_CAP_NANDFLASH (MTD_WRITEABLE)
53#define MTD_WRITEABLE (MTD_CLEAR_BITS|MTD_SET_BITS)
54 43
55 44
56// Types of automatic ECC/Checksum available 45// Types of automatic ECC/Checksum available
@@ -75,7 +64,7 @@ struct mtd_info_user {
75 uint32_t flags; 64 uint32_t flags;
76 uint32_t size; // Total size of the MTD 65 uint32_t size; // Total size of the MTD
77 uint32_t erasesize; 66 uint32_t erasesize;
78 uint32_t oobblock; // Size of OOB blocks (e.g. 512) 67 uint32_t writesize;
79 uint32_t oobsize; // Amount of OOB data per block (e.g. 16) 68 uint32_t oobsize; // Amount of OOB data per block (e.g. 16)
80 uint32_t ecctype; 69 uint32_t ecctype;
81 uint32_t eccsize; 70 uint32_t eccsize;
@@ -95,12 +84,12 @@ struct otp_info {
95 uint32_t locked; 84 uint32_t locked;
96}; 85};
97 86
98#define MEMGETINFO _IOR('M', 1, struct mtd_info_user) 87#define MEMGETINFO _IOR('M', 1, struct mtd_info_user)
99#define MEMERASE _IOW('M', 2, struct erase_info_user) 88#define MEMERASE _IOW('M', 2, struct erase_info_user)
100#define MEMWRITEOOB _IOWR('M', 3, struct mtd_oob_buf) 89#define MEMWRITEOOB _IOWR('M', 3, struct mtd_oob_buf)
101#define MEMREADOOB _IOWR('M', 4, struct mtd_oob_buf) 90#define MEMREADOOB _IOWR('M', 4, struct mtd_oob_buf)
102#define MEMLOCK _IOW('M', 5, struct erase_info_user) 91#define MEMLOCK _IOW('M', 5, struct erase_info_user)
103#define MEMUNLOCK _IOW('M', 6, struct erase_info_user) 92#define MEMUNLOCK _IOW('M', 6, struct erase_info_user)
104#define MEMGETREGIONCOUNT _IOR('M', 7, int) 93#define MEMGETREGIONCOUNT _IOR('M', 7, int)
105#define MEMGETREGIONINFO _IOWR('M', 8, struct region_info_user) 94#define MEMGETREGIONINFO _IOWR('M', 8, struct region_info_user)
106#define MEMSETOOBSEL _IOW('M', 9, struct nand_oobinfo) 95#define MEMSETOOBSEL _IOW('M', 9, struct nand_oobinfo)
@@ -110,8 +99,15 @@ struct otp_info {
110#define OTPSELECT _IOR('M', 13, int) 99#define OTPSELECT _IOR('M', 13, int)
111#define OTPGETREGIONCOUNT _IOW('M', 14, int) 100#define OTPGETREGIONCOUNT _IOW('M', 14, int)
112#define OTPGETREGIONINFO _IOW('M', 15, struct otp_info) 101#define OTPGETREGIONINFO _IOW('M', 15, struct otp_info)
113#define OTPLOCK _IOR('M', 16, struct otp_info) 102#define OTPLOCK _IOR('M', 16, struct otp_info)
103#define ECCGETLAYOUT _IOR('M', 17, struct nand_ecclayout)
104#define ECCGETSTATS _IOR('M', 18, struct mtd_ecc_stats)
105#define MTDFILEMODE _IO('M', 19)
114 106
107/*
108 * Obsolete legacy interface. Keep it in order not to break userspace
109 * interfaces
110 */
115struct nand_oobinfo { 111struct nand_oobinfo {
116 uint32_t useecc; 112 uint32_t useecc;
117 uint32_t eccbytes; 113 uint32_t eccbytes;
@@ -119,4 +115,46 @@ struct nand_oobinfo {
119 uint32_t eccpos[32]; 115 uint32_t eccpos[32];
120}; 116};
121 117
118struct nand_oobfree {
119 uint32_t offset;
120 uint32_t length;
121};
122
123#define MTD_MAX_OOBFREE_ENTRIES 8
124/*
125 * ECC layout control structure. Exported to userspace for
126 * diagnosis and to allow creation of raw images
127 */
128struct nand_ecclayout {
129 uint32_t eccbytes;
130 uint32_t eccpos[64];
131 uint32_t oobavail;
132 struct nand_oobfree oobfree[MTD_MAX_OOBFREE_ENTRIES];
133};
134
135/**
136 * struct mtd_ecc_stats - error correction status
137 *
138 * @corrected: number of corrected bits
139 * @failed: number of uncorrectable errors
140 * @badblocks: number of bad blocks in this partition
141 * @bbtblocks: number of blocks reserved for bad block tables
142 */
143struct mtd_ecc_stats {
144 uint32_t corrected;
145 uint32_t failed;
146 uint32_t badblocks;
147 uint32_t bbtblocks;
148};
149
150/*
151 * Read/write file modes for access to MTD
152 */
153enum mtd_file_modes {
154 MTD_MODE_NORMAL = MTD_OTP_OFF,
155 MTD_MODE_OTP_FACTORY = MTD_OTP_FACTORY,
156 MTD_MODE_OTP_USER = MTD_OTP_USER,
157 MTD_MODE_RAW,
158};
159
122#endif /* __MTD_ABI_H__ */ 160#endif /* __MTD_ABI_H__ */
diff --git a/include/mtd/mtd-user.h b/include/mtd/mtd-user.h
index 1c13fc7161fe..713f34d3e62e 100644
--- a/include/mtd/mtd-user.h
+++ b/include/mtd/mtd-user.h
@@ -16,5 +16,6 @@ typedef struct mtd_info_user mtd_info_t;
16typedef struct erase_info_user erase_info_t; 16typedef struct erase_info_user erase_info_t;
17typedef struct region_info_user region_info_t; 17typedef struct region_info_user region_info_t;
18typedef struct nand_oobinfo nand_oobinfo_t; 18typedef struct nand_oobinfo nand_oobinfo_t;
19typedef struct nand_ecclayout nand_ecclayout_t;
19 20
20#endif /* __MTD_USER_H__ */ 21#endif /* __MTD_USER_H__ */
diff --git a/include/net/compat.h b/include/net/compat.h
index da680272cf6e..9859b60280d5 100644
--- a/include/net/compat.h
+++ b/include/net/compat.h
@@ -2,6 +2,8 @@
2#define NET_COMPAT_H 2#define NET_COMPAT_H
3 3
4 4
5struct sock;
6
5#if defined(CONFIG_COMPAT) 7#if defined(CONFIG_COMPAT)
6 8
7#include <linux/compat.h> 9#include <linux/compat.h>
@@ -22,7 +24,6 @@ struct compat_cmsghdr {
22 compat_int_t cmsg_type; 24 compat_int_t cmsg_type;
23}; 25};
24 26
25struct sock;
26extern int compat_sock_get_timestamp(struct sock *, struct timeval __user *); 27extern int compat_sock_get_timestamp(struct sock *, struct timeval __user *);
27 28
28#else /* defined(CONFIG_COMPAT) */ 29#else /* defined(CONFIG_COMPAT) */
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h
index d5926bfb1fc9..d5147770ad47 100644
--- a/include/net/ieee80211.h
+++ b/include/net/ieee80211.h
@@ -29,7 +29,7 @@
29#include <linux/kernel.h> /* ARRAY_SIZE */ 29#include <linux/kernel.h> /* ARRAY_SIZE */
30#include <linux/wireless.h> 30#include <linux/wireless.h>
31 31
32#define IEEE80211_VERSION "git-1.1.7" 32#define IEEE80211_VERSION "git-1.1.13"
33 33
34#define IEEE80211_DATA_LEN 2304 34#define IEEE80211_DATA_LEN 2304
35/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section 35/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
@@ -104,6 +104,9 @@
104#define IEEE80211_SCTL_FRAG 0x000F 104#define IEEE80211_SCTL_FRAG 0x000F
105#define IEEE80211_SCTL_SEQ 0xFFF0 105#define IEEE80211_SCTL_SEQ 0xFFF0
106 106
107/* QOS control */
108#define IEEE80211_QCTL_TID 0x000F
109
107/* debug macros */ 110/* debug macros */
108 111
109#ifdef CONFIG_IEEE80211_DEBUG 112#ifdef CONFIG_IEEE80211_DEBUG
@@ -1075,6 +1078,7 @@ struct ieee80211_device {
1075 1078
1076 int (*handle_management) (struct net_device * dev, 1079 int (*handle_management) (struct net_device * dev,
1077 struct ieee80211_network * network, u16 type); 1080 struct ieee80211_network * network, u16 type);
1081 int (*is_qos_active) (struct net_device *dev, struct sk_buff *skb);
1078 1082
1079 /* Typical STA methods */ 1083 /* Typical STA methods */
1080 int (*handle_auth) (struct net_device * dev, 1084 int (*handle_auth) (struct net_device * dev,
@@ -1243,7 +1247,8 @@ extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
1243extern int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev); 1247extern int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev);
1244extern void ieee80211_txb_free(struct ieee80211_txb *); 1248extern void ieee80211_txb_free(struct ieee80211_txb *);
1245extern int ieee80211_tx_frame(struct ieee80211_device *ieee, 1249extern int ieee80211_tx_frame(struct ieee80211_device *ieee,
1246 struct ieee80211_hdr *frame, int len); 1250 struct ieee80211_hdr *frame, int hdr_len,
1251 int total_len, int encrypt_mpdu);
1247 1252
1248/* ieee80211_rx.c */ 1253/* ieee80211_rx.c */
1249extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, 1254extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
diff --git a/include/net/ieee80211softmac.h b/include/net/ieee80211softmac.h
index 052ed596a4e4..7a483ab4022f 100644
--- a/include/net/ieee80211softmac.h
+++ b/include/net/ieee80211softmac.h
@@ -86,6 +86,9 @@ struct ieee80211softmac_assoc_info {
86 86
87 /* BSSID we're trying to associate to */ 87 /* BSSID we're trying to associate to */
88 char bssid[ETH_ALEN]; 88 char bssid[ETH_ALEN];
89
90 /* Rates supported by the network */
91 struct ieee80211softmac_ratesinfo supported_rates;
89 92
90 /* some flags. 93 /* some flags.
91 * static_essid is valid if the essid is constant, 94 * static_essid is valid if the essid is constant,
@@ -132,23 +135,26 @@ enum {
132struct ieee80211softmac_txrates { 135struct ieee80211softmac_txrates {
133 /* The Bit-Rate to be used for multicast frames. */ 136 /* The Bit-Rate to be used for multicast frames. */
134 u8 mcast_rate; 137 u8 mcast_rate;
135 /* The Bit-Rate to be used for multicast fallback 138
136 * (If the device supports fallback and hardware-retry) 139 /* The Bit-Rate to be used for multicast management frames. */
137 */ 140 u8 mgt_mcast_rate;
138 u8 mcast_fallback; 141
139 /* The Bit-Rate to be used for any other (normal) data packet. */ 142 /* The Bit-Rate to be used for any other (normal) data packet. */
140 u8 default_rate; 143 u8 default_rate;
141 /* The Bit-Rate to be used for default fallback 144 /* The Bit-Rate to be used for default fallback
142 * (If the device supports fallback and hardware-retry) 145 * (If the device supports fallback and hardware-retry)
143 */ 146 */
144 u8 default_fallback; 147 u8 default_fallback;
148
149 /* This is the rate that the user asked for */
150 u8 user_rate;
145}; 151};
146 152
147/* Bits for txrates_change callback. */ 153/* Bits for txrates_change callback. */
148#define IEEE80211SOFTMAC_TXRATECHG_DEFAULT (1 << 0) /* default_rate */ 154#define IEEE80211SOFTMAC_TXRATECHG_DEFAULT (1 << 0) /* default_rate */
149#define IEEE80211SOFTMAC_TXRATECHG_DEFAULT_FBACK (1 << 1) /* default_fallback */ 155#define IEEE80211SOFTMAC_TXRATECHG_DEFAULT_FBACK (1 << 1) /* default_fallback */
150#define IEEE80211SOFTMAC_TXRATECHG_MCAST (1 << 2) /* mcast_rate */ 156#define IEEE80211SOFTMAC_TXRATECHG_MCAST (1 << 2) /* mcast_rate */
151#define IEEE80211SOFTMAC_TXRATECHG_MCAST_FBACK (1 << 3) /* mcast_fallback */ 157#define IEEE80211SOFTMAC_TXRATECHG_MGT_MCAST (1 << 3) /* mgt_mcast_rate */
152 158
153struct ieee80211softmac_device { 159struct ieee80211softmac_device {
154 /* 802.11 structure for data stuff */ 160 /* 802.11 structure for data stuff */
@@ -250,6 +256,28 @@ extern void ieee80211softmac_fragment_lost(struct net_device *dev,
250 * Note that the rates need to be sorted. */ 256 * Note that the rates need to be sorted. */
251extern void ieee80211softmac_set_rates(struct net_device *dev, u8 count, u8 *rates); 257extern void ieee80211softmac_set_rates(struct net_device *dev, u8 count, u8 *rates);
252 258
259/* Helper function which advises you the rate at which a frame should be
260 * transmitted at. */
261static inline u8 ieee80211softmac_suggest_txrate(struct ieee80211softmac_device *mac,
262 int is_multicast,
263 int is_mgt)
264{
265 struct ieee80211softmac_txrates *txrates = &mac->txrates;
266
267 if (!mac->associated)
268 return txrates->mgt_mcast_rate;
269
270 /* We are associated, sending unicast frame */
271 if (!is_multicast)
272 return txrates->default_rate;
273
274 /* We are associated, sending multicast frame */
275 if (is_mgt)
276 return txrates->mgt_mcast_rate;
277 else
278 return txrates->mcast_rate;
279}
280
253/* Start the SoftMAC. Call this after you initialized the device 281/* Start the SoftMAC. Call this after you initialized the device
254 * and it is ready to run. 282 * and it is ready to run.
255 */ 283 */
@@ -282,7 +310,7 @@ extern void ieee80211softmac_stop(struct net_device *dev);
282 * - context set to the context data you want passed 310 * - context set to the context data you want passed
283 * The return value is 0, or an error. 311 * The return value is 0, or an error.
284 */ 312 */
285typedef void (*notify_function_ptr)(struct net_device *dev, void *context); 313typedef void (*notify_function_ptr)(struct net_device *dev, int event_type, void *context);
286 314
287#define ieee80211softmac_notify(dev, event, fun, context) ieee80211softmac_notify_gfp(dev, event, fun, context, GFP_KERNEL); 315#define ieee80211softmac_notify(dev, event, fun, context) ieee80211softmac_notify_gfp(dev, event, fun, context, GFP_KERNEL);
288#define ieee80211softmac_notify_atomic(dev, event, fun, context) ieee80211softmac_notify_gfp(dev, event, fun, context, GFP_ATOMIC); 316#define ieee80211softmac_notify_atomic(dev, event, fun, context) ieee80211softmac_notify_gfp(dev, event, fun, context, GFP_ATOMIC);
diff --git a/include/net/ieee80211softmac_wx.h b/include/net/ieee80211softmac_wx.h
index 3e0be453ecea..4ee3ad57283f 100644
--- a/include/net/ieee80211softmac_wx.h
+++ b/include/net/ieee80211softmac_wx.h
@@ -91,4 +91,9 @@ ieee80211softmac_wx_get_genie(struct net_device *dev,
91 struct iw_request_info *info, 91 struct iw_request_info *info,
92 union iwreq_data *wrqu, 92 union iwreq_data *wrqu,
93 char *extra); 93 char *extra);
94extern int
95ieee80211softmac_wx_set_mlme(struct net_device *dev,
96 struct iw_request_info *info,
97 union iwreq_data *wrqu,
98 char *extra);
94#endif /* _IEEE80211SOFTMAC_WX */ 99#endif /* _IEEE80211SOFTMAC_WX */
diff --git a/include/net/ip.h b/include/net/ip.h
index 3900fccf60c7..98f908400771 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -146,7 +146,6 @@ void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *ar
146struct ipv4_config 146struct ipv4_config
147{ 147{
148 int log_martians; 148 int log_martians;
149 int autoconfig;
150 int no_pmtu_disc; 149 int no_pmtu_disc;
151}; 150};
152 151
diff --git a/include/net/llc_if.h b/include/net/llc_if.h
index 090eaa0d71f9..c608812a8e89 100644
--- a/include/net/llc_if.h
+++ b/include/net/llc_if.h
@@ -16,6 +16,7 @@
16#include <linux/if.h> 16#include <linux/if.h>
17#include <linux/if_arp.h> 17#include <linux/if_arp.h>
18#include <linux/llc.h> 18#include <linux/llc.h>
19#include <linux/etherdevice.h>
19#include <net/llc.h> 20#include <net/llc.h>
20 21
21#define LLC_DATAUNIT_PRIM 1 22#define LLC_DATAUNIT_PRIM 1
@@ -61,8 +62,6 @@
61#define LLC_STATUS_CONFLICT 7 /* disconnect conn */ 62#define LLC_STATUS_CONFLICT 7 /* disconnect conn */
62#define LLC_STATUS_RESET_DONE 8 /* */ 63#define LLC_STATUS_RESET_DONE 8 /* */
63 64
64extern u8 llc_mac_null_var[IFHWADDRLEN];
65
66/** 65/**
67 * llc_mac_null - determines if a address is a null mac address 66 * llc_mac_null - determines if a address is a null mac address
68 * @mac: Mac address to test if null. 67 * @mac: Mac address to test if null.
@@ -70,16 +69,20 @@ extern u8 llc_mac_null_var[IFHWADDRLEN];
70 * Determines if a given address is a null mac address. Returns 0 if the 69 * Determines if a given address is a null mac address. Returns 0 if the
71 * address is not a null mac, 1 if the address is a null mac. 70 * address is not a null mac, 1 if the address is a null mac.
72 */ 71 */
73static __inline__ int llc_mac_null(u8 *mac) 72static inline int llc_mac_null(const u8 *mac)
74{ 73{
75 return !memcmp(mac, llc_mac_null_var, IFHWADDRLEN); 74 return is_zero_ether_addr(mac);
76} 75}
77 76
78static __inline__ int llc_addrany(struct llc_addr *addr) 77static inline int llc_addrany(const struct llc_addr *addr)
79{ 78{
80 return llc_mac_null(addr->mac) && !addr->lsap; 79 return llc_mac_null(addr->mac) && !addr->lsap;
81} 80}
82 81
82static inline int llc_mac_multicast(const u8 *mac)
83{
84 return is_multicast_ether_addr(mac);
85}
83/** 86/**
84 * llc_mac_match - determines if two mac addresses are the same 87 * llc_mac_match - determines if two mac addresses are the same
85 * @mac1: First mac address to compare. 88 * @mac1: First mac address to compare.
@@ -89,9 +92,9 @@ static __inline__ int llc_addrany(struct llc_addr *addr)
89 * is not a complete match up to len, 1 if a complete match up to len is 92 * is not a complete match up to len, 1 if a complete match up to len is
90 * found. 93 * found.
91 */ 94 */
92static __inline__ int llc_mac_match(u8 *mac1, u8 *mac2) 95static inline int llc_mac_match(const u8 *mac1, const u8 *mac2)
93{ 96{
94 return !memcmp(mac1, mac2, IFHWADDRLEN); 97 return !compare_ether_addr(mac1, mac2);
95} 98}
96 99
97extern int llc_establish_connection(struct sock *sk, u8 *lmac, 100extern int llc_establish_connection(struct sock *sk, u8 *lmac,
diff --git a/include/net/netdma.h b/include/net/netdma.h
new file mode 100644
index 000000000000..19760eb131aa
--- /dev/null
+++ b/include/net/netdma.h
@@ -0,0 +1,44 @@
1/*
2 * Copyright(c) 2004 - 2006 Intel Corporation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the Free
6 * Software Foundation; either version 2 of the License, or (at your option)
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 59
16 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 * The full GNU General Public License is included in this distribution in the
19 * file called COPYING.
20 */
21#ifndef NETDMA_H
22#define NETDMA_H
23#include <linux/config.h>
24#ifdef CONFIG_NET_DMA
25#include <linux/dmaengine.h>
26#include <linux/skbuff.h>
27
28static inline struct dma_chan *get_softnet_dma(void)
29{
30 struct dma_chan *chan;
31 rcu_read_lock();
32 chan = rcu_dereference(__get_cpu_var(softnet_data.net_dma));
33 if (chan)
34 dma_chan_get(chan);
35 rcu_read_unlock();
36 return chan;
37}
38
39int dma_skb_copy_datagram_iovec(struct dma_chan* chan,
40 const struct sk_buff *skb, int offset, struct iovec *to,
41 size_t len, struct dma_pinned_list *pinned_list);
42
43#endif /* CONFIG_NET_DMA */
44#endif /* NETDMA_H */
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index fc00aa31e282..1fbd8193d5f1 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -113,6 +113,10 @@ struct nf_conn
113 u_int32_t mark; 113 u_int32_t mark;
114#endif 114#endif
115 115
116#ifdef CONFIG_NF_CONNTRACK_SECMARK
117 u_int32_t secmark;
118#endif
119
116 /* Storage reserved for other modules: */ 120 /* Storage reserved for other modules: */
117 union nf_conntrack_proto proto; 121 union nf_conntrack_proto proto;
118 122
@@ -284,6 +288,7 @@ static inline int nf_ct_is_dying(struct nf_conn *ct)
284} 288}
285 289
286extern unsigned int nf_conntrack_htable_size; 290extern unsigned int nf_conntrack_htable_size;
291extern int nf_conntrack_checksum;
287 292
288#define NF_CT_STAT_INC(count) (__get_cpu_var(nf_conntrack_stat).count++) 293#define NF_CT_STAT_INC(count) (__get_cpu_var(nf_conntrack_stat).count++)
289 294
diff --git a/include/net/netfilter/nf_conntrack_compat.h b/include/net/netfilter/nf_conntrack_compat.h
index 3cac19fb3648..f1b1482d7200 100644
--- a/include/net/netfilter/nf_conntrack_compat.h
+++ b/include/net/netfilter/nf_conntrack_compat.h
@@ -20,6 +20,19 @@ static inline u_int32_t *nf_ct_get_mark(const struct sk_buff *skb,
20} 20}
21#endif /* CONFIG_IP_NF_CONNTRACK_MARK */ 21#endif /* CONFIG_IP_NF_CONNTRACK_MARK */
22 22
23#ifdef CONFIG_IP_NF_CONNTRACK_SECMARK
24static inline u_int32_t *nf_ct_get_secmark(const struct sk_buff *skb,
25 u_int32_t *ctinfo)
26{
27 struct ip_conntrack *ct = ip_conntrack_get(skb, ctinfo);
28
29 if (ct)
30 return &ct->secmark;
31 else
32 return NULL;
33}
34#endif /* CONFIG_IP_NF_CONNTRACK_SECMARK */
35
23#ifdef CONFIG_IP_NF_CT_ACCT 36#ifdef CONFIG_IP_NF_CT_ACCT
24static inline struct ip_conntrack_counter * 37static inline struct ip_conntrack_counter *
25nf_ct_get_counters(const struct sk_buff *skb) 38nf_ct_get_counters(const struct sk_buff *skb)
@@ -70,6 +83,19 @@ static inline u_int32_t *nf_ct_get_mark(const struct sk_buff *skb,
70} 83}
71#endif /* CONFIG_NF_CONNTRACK_MARK */ 84#endif /* CONFIG_NF_CONNTRACK_MARK */
72 85
86#ifdef CONFIG_NF_CONNTRACK_SECMARK
87static inline u_int32_t *nf_ct_get_secmark(const struct sk_buff *skb,
88 u_int32_t *ctinfo)
89{
90 struct nf_conn *ct = nf_ct_get(skb, ctinfo);
91
92 if (ct)
93 return &ct->secmark;
94 else
95 return NULL;
96}
97#endif /* CONFIG_NF_CONNTRACK_MARK */
98
73#ifdef CONFIG_NF_CT_ACCT 99#ifdef CONFIG_NF_CT_ACCT
74static inline struct ip_conntrack_counter * 100static inline struct ip_conntrack_counter *
75nf_ct_get_counters(const struct sk_buff *skb) 101nf_ct_get_counters(const struct sk_buff *skb)
diff --git a/include/net/raw.h b/include/net/raw.h
index 481b20190b12..e4af59781949 100644
--- a/include/net/raw.h
+++ b/include/net/raw.h
@@ -35,7 +35,7 @@ extern rwlock_t raw_v4_lock;
35 35
36 36
37extern struct sock *__raw_v4_lookup(struct sock *sk, unsigned short num, 37extern struct sock *__raw_v4_lookup(struct sock *sk, unsigned short num,
38 unsigned long raddr, unsigned long laddr, 38 __be32 raddr, __be32 laddr,
39 int dif); 39 int dif);
40 40
41extern int raw_v4_input(struct sk_buff *skb, struct iphdr *iph, int hash); 41extern int raw_v4_input(struct sk_buff *skb, struct iphdr *iph, int hash);
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index a9663b49ea54..237f82b05e40 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -254,7 +254,7 @@ extern int sctp_debug_flag;
254#define SCTP_DEBUG_PRINTK_IPADDR(whatever...) 254#define SCTP_DEBUG_PRINTK_IPADDR(whatever...)
255#define SCTP_ENABLE_DEBUG 255#define SCTP_ENABLE_DEBUG
256#define SCTP_DISABLE_DEBUG 256#define SCTP_DISABLE_DEBUG
257#define SCTP_ASSERT(expr, str, func) 257#define SCTP_ASSERT(expr, str, func) BUG_ON(!(expr))
258 258
259#endif /* SCTP_DEBUG */ 259#endif /* SCTP_DEBUG */
260 260
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 7f4fea173fb1..5f69158c1006 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -555,7 +555,8 @@ struct sctp_af {
555 int (*to_addr_param) (const union sctp_addr *, 555 int (*to_addr_param) (const union sctp_addr *,
556 union sctp_addr_param *); 556 union sctp_addr_param *);
557 int (*addr_valid) (union sctp_addr *, 557 int (*addr_valid) (union sctp_addr *,
558 struct sctp_sock *); 558 struct sctp_sock *,
559 const struct sk_buff *);
559 sctp_scope_t (*scope) (union sctp_addr *); 560 sctp_scope_t (*scope) (union sctp_addr *);
560 void (*inaddr_any) (union sctp_addr *, unsigned short); 561 void (*inaddr_any) (union sctp_addr *, unsigned short);
561 int (*is_any) (const union sctp_addr *); 562 int (*is_any) (const union sctp_addr *);
diff --git a/include/net/sock.h b/include/net/sock.h
index d27e748a8259..d10dfecb6cbd 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -131,6 +131,7 @@ struct sock_common {
131 * @sk_receive_queue: incoming packets 131 * @sk_receive_queue: incoming packets
132 * @sk_wmem_alloc: transmit queue bytes committed 132 * @sk_wmem_alloc: transmit queue bytes committed
133 * @sk_write_queue: Packet sending queue 133 * @sk_write_queue: Packet sending queue
134 * @sk_async_wait_queue: DMA copied packets
134 * @sk_omem_alloc: "o" is "option" or "other" 135 * @sk_omem_alloc: "o" is "option" or "other"
135 * @sk_wmem_queued: persistent queue size 136 * @sk_wmem_queued: persistent queue size
136 * @sk_forward_alloc: space allocated forward 137 * @sk_forward_alloc: space allocated forward
@@ -204,6 +205,7 @@ struct sock {
204 atomic_t sk_omem_alloc; 205 atomic_t sk_omem_alloc;
205 struct sk_buff_head sk_receive_queue; 206 struct sk_buff_head sk_receive_queue;
206 struct sk_buff_head sk_write_queue; 207 struct sk_buff_head sk_write_queue;
208 struct sk_buff_head sk_async_wait_queue;
207 int sk_wmem_queued; 209 int sk_wmem_queued;
208 int sk_forward_alloc; 210 int sk_forward_alloc;
209 gfp_t sk_allocation; 211 gfp_t sk_allocation;
@@ -870,10 +872,7 @@ static inline int sk_filter(struct sock *sk, struct sk_buff *skb, int needlock)
870 if (filter) { 872 if (filter) {
871 unsigned int pkt_len = sk_run_filter(skb, filter->insns, 873 unsigned int pkt_len = sk_run_filter(skb, filter->insns,
872 filter->len); 874 filter->len);
873 if (!pkt_len) 875 err = pkt_len ? pskb_trim(skb, pkt_len) : -EPERM;
874 err = -EPERM;
875 else
876 skb_trim(skb, pkt_len);
877 } 876 }
878 877
879 if (needlock) 878 if (needlock)
@@ -1270,11 +1269,22 @@ sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
1270 * This routine must be called with interrupts disabled or with the socket 1269 * This routine must be called with interrupts disabled or with the socket
1271 * locked so that the sk_buff queue operation is ok. 1270 * locked so that the sk_buff queue operation is ok.
1272*/ 1271*/
1273static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb) 1272#ifdef CONFIG_NET_DMA
1273static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, int copied_early)
1274{
1275 __skb_unlink(skb, &sk->sk_receive_queue);
1276 if (!copied_early)
1277 __kfree_skb(skb);
1278 else
1279 __skb_queue_tail(&sk->sk_async_wait_queue, skb);
1280}
1281#else
1282static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, int copied_early)
1274{ 1283{
1275 __skb_unlink(skb, &sk->sk_receive_queue); 1284 __skb_unlink(skb, &sk->sk_receive_queue);
1276 __kfree_skb(skb); 1285 __kfree_skb(skb);
1277} 1286}
1287#endif
1278 1288
1279extern void sock_enable_timestamp(struct sock *sk); 1289extern void sock_enable_timestamp(struct sock *sk);
1280extern int sock_get_timestamp(struct sock *, struct timeval __user *); 1290extern int sock_get_timestamp(struct sock *, struct timeval __user *);
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 9e88dcd5f134..5f4eb5c79689 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -27,6 +27,7 @@
27#include <linux/cache.h> 27#include <linux/cache.h>
28#include <linux/percpu.h> 28#include <linux/percpu.h>
29#include <linux/skbuff.h> 29#include <linux/skbuff.h>
30#include <linux/dmaengine.h>
30 31
31#include <net/inet_connection_sock.h> 32#include <net/inet_connection_sock.h>
32#include <net/inet_timewait_sock.h> 33#include <net/inet_timewait_sock.h>
@@ -217,6 +218,7 @@ extern int sysctl_tcp_adv_win_scale;
217extern int sysctl_tcp_tw_reuse; 218extern int sysctl_tcp_tw_reuse;
218extern int sysctl_tcp_frto; 219extern int sysctl_tcp_frto;
219extern int sysctl_tcp_low_latency; 220extern int sysctl_tcp_low_latency;
221extern int sysctl_tcp_dma_copybreak;
220extern int sysctl_tcp_nometrics_save; 222extern int sysctl_tcp_nometrics_save;
221extern int sysctl_tcp_moderate_rcvbuf; 223extern int sysctl_tcp_moderate_rcvbuf;
222extern int sysctl_tcp_tso_win_divisor; 224extern int sysctl_tcp_tso_win_divisor;
@@ -224,6 +226,7 @@ extern int sysctl_tcp_abc;
224extern int sysctl_tcp_mtu_probing; 226extern int sysctl_tcp_mtu_probing;
225extern int sysctl_tcp_base_mss; 227extern int sysctl_tcp_base_mss;
226extern int sysctl_tcp_workaround_signed_windows; 228extern int sysctl_tcp_workaround_signed_windows;
229extern int sysctl_tcp_slow_start_after_idle;
227 230
228extern atomic_t tcp_memory_allocated; 231extern atomic_t tcp_memory_allocated;
229extern atomic_t tcp_sockets_allocated; 232extern atomic_t tcp_sockets_allocated;
@@ -292,6 +295,8 @@ extern int tcp_rcv_established(struct sock *sk,
292 295
293extern void tcp_rcv_space_adjust(struct sock *sk); 296extern void tcp_rcv_space_adjust(struct sock *sk);
294 297
298extern void tcp_cleanup_rbuf(struct sock *sk, int copied);
299
295extern int tcp_twsk_unique(struct sock *sk, 300extern int tcp_twsk_unique(struct sock *sk,
296 struct sock *sktw, void *twp); 301 struct sock *sktw, void *twp);
297 302
@@ -627,7 +632,7 @@ struct tcp_congestion_ops {
627 /* return slow start threshold (required) */ 632 /* return slow start threshold (required) */
628 u32 (*ssthresh)(struct sock *sk); 633 u32 (*ssthresh)(struct sock *sk);
629 /* lower bound for congestion window (optional) */ 634 /* lower bound for congestion window (optional) */
630 u32 (*min_cwnd)(struct sock *sk); 635 u32 (*min_cwnd)(const struct sock *sk);
631 /* do new cwnd calculation (required) */ 636 /* do new cwnd calculation (required) */
632 void (*cong_avoid)(struct sock *sk, u32 ack, 637 void (*cong_avoid)(struct sock *sk, u32 ack,
633 u32 rtt, u32 in_flight, int good_ack); 638 u32 rtt, u32 in_flight, int good_ack);
@@ -662,7 +667,7 @@ extern struct tcp_congestion_ops tcp_init_congestion_ops;
662extern u32 tcp_reno_ssthresh(struct sock *sk); 667extern u32 tcp_reno_ssthresh(struct sock *sk);
663extern void tcp_reno_cong_avoid(struct sock *sk, u32 ack, 668extern void tcp_reno_cong_avoid(struct sock *sk, u32 ack,
664 u32 rtt, u32 in_flight, int flag); 669 u32 rtt, u32 in_flight, int flag);
665extern u32 tcp_reno_min_cwnd(struct sock *sk); 670extern u32 tcp_reno_min_cwnd(const struct sock *sk);
666extern struct tcp_congestion_ops tcp_reno; 671extern struct tcp_congestion_ops tcp_reno;
667 672
668static inline void tcp_set_ca_state(struct sock *sk, const u8 ca_state) 673static inline void tcp_set_ca_state(struct sock *sk, const u8 ca_state)
@@ -816,6 +821,12 @@ static inline void tcp_prequeue_init(struct tcp_sock *tp)
816 tp->ucopy.len = 0; 821 tp->ucopy.len = 0;
817 tp->ucopy.memory = 0; 822 tp->ucopy.memory = 0;
818 skb_queue_head_init(&tp->ucopy.prequeue); 823 skb_queue_head_init(&tp->ucopy.prequeue);
824#ifdef CONFIG_NET_DMA
825 tp->ucopy.dma_chan = NULL;
826 tp->ucopy.wakeup = 0;
827 tp->ucopy.pinned_list = NULL;
828 tp->ucopy.dma_cookie = 0;
829#endif
819} 830}
820 831
821/* Packet is added to VJ-style prequeue for processing in process 832/* Packet is added to VJ-style prequeue for processing in process
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index afa508d92c93..9c5ee9f20b65 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -20,6 +20,8 @@
20#include <net/ip6_fib.h> 20#include <net/ip6_fib.h>
21 21
22#define XFRM_ALIGN8(len) (((len) + 7) & ~7) 22#define XFRM_ALIGN8(len) (((len) + 7) & ~7)
23#define MODULE_ALIAS_XFRM_MODE(family, encap) \
24 MODULE_ALIAS("xfrm-mode-" __stringify(family) "-" __stringify(encap))
23 25
24extern struct sock *xfrm_nl; 26extern struct sock *xfrm_nl;
25extern u32 sysctl_xfrm_aevent_etime; 27extern u32 sysctl_xfrm_aevent_etime;
@@ -164,6 +166,7 @@ struct xfrm_state
164 /* Reference to data common to all the instances of this 166 /* Reference to data common to all the instances of this
165 * transformer. */ 167 * transformer. */
166 struct xfrm_type *type; 168 struct xfrm_type *type;
169 struct xfrm_mode *mode;
167 170
168 /* Security context */ 171 /* Security context */
169 struct xfrm_sec_ctx *security; 172 struct xfrm_sec_ctx *security;
@@ -204,8 +207,8 @@ struct xfrm_type;
204struct xfrm_dst; 207struct xfrm_dst;
205struct xfrm_policy_afinfo { 208struct xfrm_policy_afinfo {
206 unsigned short family; 209 unsigned short family;
207 rwlock_t lock; 210 struct xfrm_type *type_map[IPPROTO_MAX];
208 struct xfrm_type_map *type_map; 211 struct xfrm_mode *mode_map[XFRM_MODE_MAX];
209 struct dst_ops *dst_ops; 212 struct dst_ops *dst_ops;
210 void (*garbage_collect)(void); 213 void (*garbage_collect)(void);
211 int (*dst_lookup)(struct xfrm_dst **dst, struct flowi *fl); 214 int (*dst_lookup)(struct xfrm_dst **dst, struct flowi *fl);
@@ -232,7 +235,6 @@ extern int __xfrm_state_delete(struct xfrm_state *x);
232 235
233struct xfrm_state_afinfo { 236struct xfrm_state_afinfo {
234 unsigned short family; 237 unsigned short family;
235 rwlock_t lock;
236 struct list_head *state_bydst; 238 struct list_head *state_bydst;
237 struct list_head *state_byspi; 239 struct list_head *state_byspi;
238 int (*init_flags)(struct xfrm_state *x); 240 int (*init_flags)(struct xfrm_state *x);
@@ -264,16 +266,24 @@ struct xfrm_type
264 u32 (*get_max_size)(struct xfrm_state *, int size); 266 u32 (*get_max_size)(struct xfrm_state *, int size);
265}; 267};
266 268
267struct xfrm_type_map {
268 rwlock_t lock;
269 struct xfrm_type *map[256];
270};
271
272extern int xfrm_register_type(struct xfrm_type *type, unsigned short family); 269extern int xfrm_register_type(struct xfrm_type *type, unsigned short family);
273extern int xfrm_unregister_type(struct xfrm_type *type, unsigned short family); 270extern int xfrm_unregister_type(struct xfrm_type *type, unsigned short family);
274extern struct xfrm_type *xfrm_get_type(u8 proto, unsigned short family); 271extern struct xfrm_type *xfrm_get_type(u8 proto, unsigned short family);
275extern void xfrm_put_type(struct xfrm_type *type); 272extern void xfrm_put_type(struct xfrm_type *type);
276 273
274struct xfrm_mode {
275 int (*input)(struct xfrm_state *x, struct sk_buff *skb);
276 int (*output)(struct sk_buff *skb);
277
278 struct module *owner;
279 unsigned int encap;
280};
281
282extern int xfrm_register_mode(struct xfrm_mode *mode, int family);
283extern int xfrm_unregister_mode(struct xfrm_mode *mode, int family);
284extern struct xfrm_mode *xfrm_get_mode(unsigned int encap, int family);
285extern void xfrm_put_mode(struct xfrm_mode *mode);
286
277struct xfrm_tmpl 287struct xfrm_tmpl
278{ 288{
279/* id in template is interpreted as: 289/* id in template is interpreted as:
diff --git a/include/rdma/ib_addr.h b/include/rdma/ib_addr.h
new file mode 100644
index 000000000000..fcb5ba87dcc5
--- /dev/null
+++ b/include/rdma/ib_addr.h
@@ -0,0 +1,114 @@
1/*
2 * Copyright (c) 2005 Voltaire Inc. All rights reserved.
3 * Copyright (c) 2005 Intel Corporation. All rights reserved.
4 *
5 * This Software is licensed under one of the following licenses:
6 *
7 * 1) under the terms of the "Common Public License 1.0" a copy of which is
8 * available from the Open Source Initiative, see
9 * http://www.opensource.org/licenses/cpl.php.
10 *
11 * 2) under the terms of the "The BSD License" a copy of which is
12 * available from the Open Source Initiative, see
13 * http://www.opensource.org/licenses/bsd-license.php.
14 *
15 * 3) under the terms of the "GNU General Public License (GPL) Version 2" a
16 * copy of which is available from the Open Source Initiative, see
17 * http://www.opensource.org/licenses/gpl-license.php.
18 *
19 * Licensee has the right to choose one of the above licenses.
20 *
21 * Redistributions of source code must retain the above copyright
22 * notice and one of the license notices.
23 *
24 * Redistributions in binary form must reproduce both the above copyright
25 * notice, one of the license notices in the documentation
26 * and/or other materials provided with the distribution.
27 *
28 */
29
30#if !defined(IB_ADDR_H)
31#define IB_ADDR_H
32
33#include <linux/in.h>
34#include <linux/in6.h>
35#include <linux/netdevice.h>
36#include <linux/socket.h>
37#include <rdma/ib_verbs.h>
38
39struct rdma_dev_addr {
40 unsigned char src_dev_addr[MAX_ADDR_LEN];
41 unsigned char dst_dev_addr[MAX_ADDR_LEN];
42 unsigned char broadcast[MAX_ADDR_LEN];
43 enum ib_node_type dev_type;
44};
45
46/**
47 * rdma_translate_ip - Translate a local IP address to an RDMA hardware
48 * address.
49 */
50int rdma_translate_ip(struct sockaddr *addr, struct rdma_dev_addr *dev_addr);
51
52/**
53 * rdma_resolve_ip - Resolve source and destination IP addresses to
54 * RDMA hardware addresses.
55 * @src_addr: An optional source address to use in the resolution. If a
56 * source address is not provided, a usable address will be returned via
57 * the callback.
58 * @dst_addr: The destination address to resolve.
59 * @addr: A reference to a data location that will receive the resolved
60 * addresses. The data location must remain valid until the callback has
61 * been invoked.
62 * @timeout_ms: Amount of time to wait for the address resolution to complete.
63 * @callback: Call invoked once address resolution has completed, timed out,
64 * or been canceled. A status of 0 indicates success.
65 * @context: User-specified context associated with the call.
66 */
67int rdma_resolve_ip(struct sockaddr *src_addr, struct sockaddr *dst_addr,
68 struct rdma_dev_addr *addr, int timeout_ms,
69 void (*callback)(int status, struct sockaddr *src_addr,
70 struct rdma_dev_addr *addr, void *context),
71 void *context);
72
73void rdma_addr_cancel(struct rdma_dev_addr *addr);
74
75static inline int ip_addr_size(struct sockaddr *addr)
76{
77 return addr->sa_family == AF_INET6 ?
78 sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in);
79}
80
81static inline u16 ib_addr_get_pkey(struct rdma_dev_addr *dev_addr)
82{
83 return ((u16)dev_addr->broadcast[8] << 8) | (u16)dev_addr->broadcast[9];
84}
85
86static inline void ib_addr_set_pkey(struct rdma_dev_addr *dev_addr, u16 pkey)
87{
88 dev_addr->broadcast[8] = pkey >> 8;
89 dev_addr->broadcast[9] = (unsigned char) pkey;
90}
91
92static inline union ib_gid *ib_addr_get_sgid(struct rdma_dev_addr *dev_addr)
93{
94 return (union ib_gid *) (dev_addr->src_dev_addr + 4);
95}
96
97static inline void ib_addr_set_sgid(struct rdma_dev_addr *dev_addr,
98 union ib_gid *gid)
99{
100 memcpy(dev_addr->src_dev_addr + 4, gid, sizeof *gid);
101}
102
103static inline union ib_gid *ib_addr_get_dgid(struct rdma_dev_addr *dev_addr)
104{
105 return (union ib_gid *) (dev_addr->dst_dev_addr + 4);
106}
107
108static inline void ib_addr_set_dgid(struct rdma_dev_addr *dev_addr,
109 union ib_gid *gid)
110{
111 memcpy(dev_addr->dst_dev_addr + 4, gid, sizeof *gid);
112}
113
114#endif /* IB_ADDR_H */
diff --git a/include/rdma/ib_cache.h b/include/rdma/ib_cache.h
index 5bf9834f7dca..f179d233ffc3 100644
--- a/include/rdma/ib_cache.h
+++ b/include/rdma/ib_cache.h
@@ -102,4 +102,17 @@ int ib_find_cached_pkey(struct ib_device *device,
102 u16 pkey, 102 u16 pkey,
103 u16 *index); 103 u16 *index);
104 104
105/**
106 * ib_get_cached_lmc - Returns a cached lmc table entry
107 * @device: The device to query.
108 * @port_num: The port number of the device to query.
109 * @lmc: The lmc value for the specified port for that device.
110 *
111 * ib_get_cached_lmc() fetches the specified lmc table entry stored in
112 * the local software cache.
113 */
114int ib_get_cached_lmc(struct ib_device *device,
115 u8 port_num,
116 u8 *lmc);
117
105#endif /* _IB_CACHE_H */ 118#endif /* _IB_CACHE_H */
diff --git a/include/rdma/ib_cm.h b/include/rdma/ib_cm.h
index 0a9fcd59eb43..c9b4738be9d6 100644
--- a/include/rdma/ib_cm.h
+++ b/include/rdma/ib_cm.h
@@ -32,7 +32,7 @@
32 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33 * SOFTWARE. 33 * SOFTWARE.
34 * 34 *
35 * $Id: ib_cm.h 2730 2005-06-28 16:43:03Z sean.hefty $ 35 * $Id: ib_cm.h 4311 2005-12-05 18:42:01Z sean.hefty $
36 */ 36 */
37#if !defined(IB_CM_H) 37#if !defined(IB_CM_H)
38#define IB_CM_H 38#define IB_CM_H
@@ -102,7 +102,8 @@ enum ib_cm_data_size {
102 IB_CM_APR_INFO_LENGTH = 72, 102 IB_CM_APR_INFO_LENGTH = 72,
103 IB_CM_SIDR_REQ_PRIVATE_DATA_SIZE = 216, 103 IB_CM_SIDR_REQ_PRIVATE_DATA_SIZE = 216,
104 IB_CM_SIDR_REP_PRIVATE_DATA_SIZE = 136, 104 IB_CM_SIDR_REP_PRIVATE_DATA_SIZE = 136,
105 IB_CM_SIDR_REP_INFO_LENGTH = 72 105 IB_CM_SIDR_REP_INFO_LENGTH = 72,
106 IB_CM_COMPARE_SIZE = 64
106}; 107};
107 108
108struct ib_cm_id; 109struct ib_cm_id;
@@ -238,7 +239,6 @@ struct ib_cm_sidr_rep_event_param {
238 u32 qpn; 239 u32 qpn;
239 void *info; 240 void *info;
240 u8 info_len; 241 u8 info_len;
241
242}; 242};
243 243
244struct ib_cm_event { 244struct ib_cm_event {
@@ -317,6 +317,15 @@ void ib_destroy_cm_id(struct ib_cm_id *cm_id);
317 317
318#define IB_SERVICE_ID_AGN_MASK __constant_cpu_to_be64(0xFF00000000000000ULL) 318#define IB_SERVICE_ID_AGN_MASK __constant_cpu_to_be64(0xFF00000000000000ULL)
319#define IB_CM_ASSIGN_SERVICE_ID __constant_cpu_to_be64(0x0200000000000000ULL) 319#define IB_CM_ASSIGN_SERVICE_ID __constant_cpu_to_be64(0x0200000000000000ULL)
320#define IB_CMA_SERVICE_ID __constant_cpu_to_be64(0x0000000001000000ULL)
321#define IB_CMA_SERVICE_ID_MASK __constant_cpu_to_be64(0xFFFFFFFFFF000000ULL)
322#define IB_SDP_SERVICE_ID __constant_cpu_to_be64(0x0000000000010000ULL)
323#define IB_SDP_SERVICE_ID_MASK __constant_cpu_to_be64(0xFFFFFFFFFFFF0000ULL)
324
325struct ib_cm_compare_data {
326 u8 data[IB_CM_COMPARE_SIZE];
327 u8 mask[IB_CM_COMPARE_SIZE];
328};
320 329
321/** 330/**
322 * ib_cm_listen - Initiates listening on the specified service ID for 331 * ib_cm_listen - Initiates listening on the specified service ID for
@@ -330,10 +339,12 @@ void ib_destroy_cm_id(struct ib_cm_id *cm_id);
330 * range of service IDs. If set to 0, the service ID is matched 339 * range of service IDs. If set to 0, the service ID is matched
331 * exactly. This parameter is ignored if %service_id is set to 340 * exactly. This parameter is ignored if %service_id is set to
332 * IB_CM_ASSIGN_SERVICE_ID. 341 * IB_CM_ASSIGN_SERVICE_ID.
342 * @compare_data: This parameter is optional. It specifies data that must
343 * appear in the private data of a connection request for the specified
344 * listen request.
333 */ 345 */
334int ib_cm_listen(struct ib_cm_id *cm_id, 346int ib_cm_listen(struct ib_cm_id *cm_id, __be64 service_id, __be64 service_mask,
335 __be64 service_id, 347 struct ib_cm_compare_data *compare_data);
336 __be64 service_mask);
337 348
338struct ib_cm_req_param { 349struct ib_cm_req_param {
339 struct ib_sa_path_rec *primary_path; 350 struct ib_sa_path_rec *primary_path;
@@ -535,7 +546,6 @@ struct ib_cm_sidr_req_param {
535 const void *private_data; 546 const void *private_data;
536 u8 private_data_len; 547 u8 private_data_len;
537 u8 max_cm_retries; 548 u8 max_cm_retries;
538 u16 pkey;
539}; 549};
540 550
541/** 551/**
@@ -559,7 +569,7 @@ struct ib_cm_sidr_rep_param {
559}; 569};
560 570
561/** 571/**
562 * ib_send_cm_sidr_rep - Sends a service ID resolution request to the 572 * ib_send_cm_sidr_rep - Sends a service ID resolution reply to the
563 * remote node. 573 * remote node.
564 * @cm_id: Communication identifier associated with the received service ID 574 * @cm_id: Communication identifier associated with the received service ID
565 * resolution request. 575 * resolution request.
diff --git a/include/rdma/ib_marshall.h b/include/rdma/ib_marshall.h
new file mode 100644
index 000000000000..66bf4d7d0dfb
--- /dev/null
+++ b/include/rdma/ib_marshall.h
@@ -0,0 +1,50 @@
1/*
2 * Copyright (c) 2005 Intel Corporation. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 */
32
33#if !defined(IB_USER_MARSHALL_H)
34#define IB_USER_MARSHALL_H
35
36#include <rdma/ib_verbs.h>
37#include <rdma/ib_sa.h>
38#include <rdma/ib_user_verbs.h>
39#include <rdma/ib_user_sa.h>
40
41void ib_copy_qp_attr_to_user(struct ib_uverbs_qp_attr *dst,
42 struct ib_qp_attr *src);
43
44void ib_copy_path_rec_to_user(struct ib_user_path_rec *dst,
45 struct ib_sa_path_rec *src);
46
47void ib_copy_path_rec_from_user(struct ib_sa_path_rec *dst,
48 struct ib_user_path_rec *src);
49
50#endif /* IB_USER_MARSHALL_H */
diff --git a/include/rdma/ib_sa.h b/include/rdma/ib_sa.h
index ad63c215efe5..c99e4420fd7e 100644
--- a/include/rdma/ib_sa.h
+++ b/include/rdma/ib_sa.h
@@ -370,5 +370,12 @@ ib_sa_mcmember_rec_delete(struct ib_device *device, u8 port_num,
370 context, query); 370 context, query);
371} 371}
372 372
373/**
374 * ib_init_ah_from_path - Initialize address handle attributes based on an SA
375 * path record.
376 */
377int ib_init_ah_from_path(struct ib_device *device, u8 port_num,
378 struct ib_sa_path_rec *rec,
379 struct ib_ah_attr *ah_attr);
373 380
374#endif /* IB_SA_H */ 381#endif /* IB_SA_H */
diff --git a/include/rdma/ib_smi.h b/include/rdma/ib_smi.h
index 87f60737f695..f29af135ba83 100644
--- a/include/rdma/ib_smi.h
+++ b/include/rdma/ib_smi.h
@@ -85,6 +85,42 @@ struct ib_smp {
85#define IB_SMP_ATTR_LED_INFO __constant_htons(0x0031) 85#define IB_SMP_ATTR_LED_INFO __constant_htons(0x0031)
86#define IB_SMP_ATTR_VENDOR_MASK __constant_htons(0xFF00) 86#define IB_SMP_ATTR_VENDOR_MASK __constant_htons(0xFF00)
87 87
88struct ib_port_info {
89 __be64 mkey;
90 __be64 gid_prefix;
91 __be16 lid;
92 __be16 sm_lid;
93 __be32 cap_mask;
94 __be16 diag_code;
95 __be16 mkey_lease_period;
96 u8 local_port_num;
97 u8 link_width_enabled;
98 u8 link_width_supported;
99 u8 link_width_active;
100 u8 linkspeed_portstate; /* 4 bits, 4 bits */
101 u8 portphysstate_linkdown; /* 4 bits, 4 bits */
102 u8 mkeyprot_resv_lmc; /* 2 bits, 3, 3 */
103 u8 linkspeedactive_enabled; /* 4 bits, 4 bits */
104 u8 neighbormtu_mastersmsl; /* 4 bits, 4 bits */
105 u8 vlcap_inittype; /* 4 bits, 4 bits */
106 u8 vl_high_limit;
107 u8 vl_arb_high_cap;
108 u8 vl_arb_low_cap;
109 u8 inittypereply_mtucap; /* 4 bits, 4 bits */
110 u8 vlstallcnt_hoqlife; /* 3 bits, 5 bits */
111 u8 operationalvl_pei_peo_fpi_fpo; /* 4 bits, 1, 1, 1, 1 */
112 __be16 mkey_violations;
113 __be16 pkey_violations;
114 __be16 qkey_violations;
115 u8 guid_cap;
116 u8 clientrereg_resv_subnetto; /* 1 bit, 2 bits, 5 */
117 u8 resv_resptimevalue; /* 3 bits, 5 bits */
118 u8 localphyerrors_overrunerrors; /* 4 bits, 4 bits */
119 __be16 max_credit_hint;
120 u8 resv;
121 u8 link_roundtrip_latency[3];
122};
123
88static inline u8 124static inline u8
89ib_get_smp_direction(struct ib_smp *smp) 125ib_get_smp_direction(struct ib_smp *smp)
90{ 126{
diff --git a/include/rdma/ib_user_cm.h b/include/rdma/ib_user_cm.h
index 19be116047f6..066c20b7cdfb 100644
--- a/include/rdma/ib_user_cm.h
+++ b/include/rdma/ib_user_cm.h
@@ -30,13 +30,13 @@
30 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 30 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31 * SOFTWARE. 31 * SOFTWARE.
32 * 32 *
33 * $Id: ib_user_cm.h 2576 2005-06-09 17:00:30Z libor $ 33 * $Id: ib_user_cm.h 4019 2005-11-11 00:33:09Z sean.hefty $
34 */ 34 */
35 35
36#ifndef IB_USER_CM_H 36#ifndef IB_USER_CM_H
37#define IB_USER_CM_H 37#define IB_USER_CM_H
38 38
39#include <linux/types.h> 39#include <rdma/ib_user_sa.h>
40 40
41#define IB_USER_CM_ABI_VERSION 4 41#define IB_USER_CM_ABI_VERSION 4
42 42
@@ -110,58 +110,6 @@ struct ib_ucm_init_qp_attr {
110 __u32 qp_state; 110 __u32 qp_state;
111}; 111};
112 112
113struct ib_ucm_ah_attr {
114 __u8 grh_dgid[16];
115 __u32 grh_flow_label;
116 __u16 dlid;
117 __u16 reserved;
118 __u8 grh_sgid_index;
119 __u8 grh_hop_limit;
120 __u8 grh_traffic_class;
121 __u8 sl;
122 __u8 src_path_bits;
123 __u8 static_rate;
124 __u8 is_global;
125 __u8 port_num;
126};
127
128struct ib_ucm_init_qp_attr_resp {
129 __u32 qp_attr_mask;
130 __u32 qp_state;
131 __u32 cur_qp_state;
132 __u32 path_mtu;
133 __u32 path_mig_state;
134 __u32 qkey;
135 __u32 rq_psn;
136 __u32 sq_psn;
137 __u32 dest_qp_num;
138 __u32 qp_access_flags;
139
140 struct ib_ucm_ah_attr ah_attr;
141 struct ib_ucm_ah_attr alt_ah_attr;
142
143 /* ib_qp_cap */
144 __u32 max_send_wr;
145 __u32 max_recv_wr;
146 __u32 max_send_sge;
147 __u32 max_recv_sge;
148 __u32 max_inline_data;
149
150 __u16 pkey_index;
151 __u16 alt_pkey_index;
152 __u8 en_sqd_async_notify;
153 __u8 sq_draining;
154 __u8 max_rd_atomic;
155 __u8 max_dest_rd_atomic;
156 __u8 min_rnr_timer;
157 __u8 port_num;
158 __u8 timeout;
159 __u8 retry_cnt;
160 __u8 rnr_retry;
161 __u8 alt_port_num;
162 __u8 alt_timeout;
163};
164
165struct ib_ucm_listen { 113struct ib_ucm_listen {
166 __be64 service_id; 114 __be64 service_id;
167 __be64 service_mask; 115 __be64 service_mask;
@@ -180,28 +128,6 @@ struct ib_ucm_private_data {
180 __u8 reserved[3]; 128 __u8 reserved[3];
181}; 129};
182 130
183struct ib_ucm_path_rec {
184 __u8 dgid[16];
185 __u8 sgid[16];
186 __be16 dlid;
187 __be16 slid;
188 __u32 raw_traffic;
189 __be32 flow_label;
190 __u32 reversible;
191 __u32 mtu;
192 __be16 pkey;
193 __u8 hop_limit;
194 __u8 traffic_class;
195 __u8 numb_path;
196 __u8 sl;
197 __u8 mtu_selector;
198 __u8 rate_selector;
199 __u8 rate;
200 __u8 packet_life_time_selector;
201 __u8 packet_life_time;
202 __u8 preference;
203};
204
205struct ib_ucm_req { 131struct ib_ucm_req {
206 __u32 id; 132 __u32 id;
207 __u32 qpn; 133 __u32 qpn;
@@ -274,7 +200,7 @@ struct ib_ucm_sidr_req {
274 __be64 sid; 200 __be64 sid;
275 __u64 data; 201 __u64 data;
276 __u64 path; 202 __u64 path;
277 __u16 pkey; 203 __u16 reserved_pkey;
278 __u8 len; 204 __u8 len;
279 __u8 max_cm_retries; 205 __u8 max_cm_retries;
280 __u8 reserved[4]; 206 __u8 reserved[4];
@@ -304,8 +230,8 @@ struct ib_ucm_event_get {
304}; 230};
305 231
306struct ib_ucm_req_event_resp { 232struct ib_ucm_req_event_resp {
307 struct ib_ucm_path_rec primary_path; 233 struct ib_user_path_rec primary_path;
308 struct ib_ucm_path_rec alternate_path; 234 struct ib_user_path_rec alternate_path;
309 __be64 remote_ca_guid; 235 __be64 remote_ca_guid;
310 __u32 remote_qkey; 236 __u32 remote_qkey;
311 __u32 remote_qpn; 237 __u32 remote_qpn;
@@ -349,7 +275,7 @@ struct ib_ucm_mra_event_resp {
349}; 275};
350 276
351struct ib_ucm_lap_event_resp { 277struct ib_ucm_lap_event_resp {
352 struct ib_ucm_path_rec path; 278 struct ib_user_path_rec path;
353}; 279};
354 280
355struct ib_ucm_apr_event_resp { 281struct ib_ucm_apr_event_resp {
diff --git a/include/rdma/ib_user_sa.h b/include/rdma/ib_user_sa.h
new file mode 100644
index 000000000000..659120157e14
--- /dev/null
+++ b/include/rdma/ib_user_sa.h
@@ -0,0 +1,60 @@
1/*
2 * Copyright (c) 2005 Intel Corporation. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 */
32
33#ifndef IB_USER_SA_H
34#define IB_USER_SA_H
35
36#include <linux/types.h>
37
38struct ib_user_path_rec {
39 __u8 dgid[16];
40 __u8 sgid[16];
41 __be16 dlid;
42 __be16 slid;
43 __u32 raw_traffic;
44 __be32 flow_label;
45 __u32 reversible;
46 __u32 mtu;
47 __be16 pkey;
48 __u8 hop_limit;
49 __u8 traffic_class;
50 __u8 numb_path;
51 __u8 sl;
52 __u8 mtu_selector;
53 __u8 rate_selector;
54 __u8 rate;
55 __u8 packet_life_time_selector;
56 __u8 packet_life_time;
57 __u8 preference;
58};
59
60#endif /* IB_USER_SA_H */
diff --git a/include/rdma/ib_user_verbs.h b/include/rdma/ib_user_verbs.h
index 338ed4333063..7b5372010f4b 100644
--- a/include/rdma/ib_user_verbs.h
+++ b/include/rdma/ib_user_verbs.h
@@ -32,7 +32,7 @@
32 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33 * SOFTWARE. 33 * SOFTWARE.
34 * 34 *
35 * $Id: ib_user_verbs.h 2708 2005-06-24 17:27:21Z roland $ 35 * $Id: ib_user_verbs.h 4019 2005-11-11 00:33:09Z sean.hefty $
36 */ 36 */
37 37
38#ifndef IB_USER_VERBS_H 38#ifndef IB_USER_VERBS_H
@@ -323,6 +323,64 @@ struct ib_uverbs_destroy_cq_resp {
323 __u32 async_events_reported; 323 __u32 async_events_reported;
324}; 324};
325 325
326struct ib_uverbs_global_route {
327 __u8 dgid[16];
328 __u32 flow_label;
329 __u8 sgid_index;
330 __u8 hop_limit;
331 __u8 traffic_class;
332 __u8 reserved;
333};
334
335struct ib_uverbs_ah_attr {
336 struct ib_uverbs_global_route grh;
337 __u16 dlid;
338 __u8 sl;
339 __u8 src_path_bits;
340 __u8 static_rate;
341 __u8 is_global;
342 __u8 port_num;
343 __u8 reserved;
344};
345
346struct ib_uverbs_qp_attr {
347 __u32 qp_attr_mask;
348 __u32 qp_state;
349 __u32 cur_qp_state;
350 __u32 path_mtu;
351 __u32 path_mig_state;
352 __u32 qkey;
353 __u32 rq_psn;
354 __u32 sq_psn;
355 __u32 dest_qp_num;
356 __u32 qp_access_flags;
357
358 struct ib_uverbs_ah_attr ah_attr;
359 struct ib_uverbs_ah_attr alt_ah_attr;
360
361 /* ib_qp_cap */
362 __u32 max_send_wr;
363 __u32 max_recv_wr;
364 __u32 max_send_sge;
365 __u32 max_recv_sge;
366 __u32 max_inline_data;
367
368 __u16 pkey_index;
369 __u16 alt_pkey_index;
370 __u8 en_sqd_async_notify;
371 __u8 sq_draining;
372 __u8 max_rd_atomic;
373 __u8 max_dest_rd_atomic;
374 __u8 min_rnr_timer;
375 __u8 port_num;
376 __u8 timeout;
377 __u8 retry_cnt;
378 __u8 rnr_retry;
379 __u8 alt_port_num;
380 __u8 alt_timeout;
381 __u8 reserved[5];
382};
383
326struct ib_uverbs_create_qp { 384struct ib_uverbs_create_qp {
327 __u64 response; 385 __u64 response;
328 __u64 user_handle; 386 __u64 user_handle;
@@ -541,26 +599,6 @@ struct ib_uverbs_post_srq_recv_resp {
541 __u32 bad_wr; 599 __u32 bad_wr;
542}; 600};
543 601
544struct ib_uverbs_global_route {
545 __u8 dgid[16];
546 __u32 flow_label;
547 __u8 sgid_index;
548 __u8 hop_limit;
549 __u8 traffic_class;
550 __u8 reserved;
551};
552
553struct ib_uverbs_ah_attr {
554 struct ib_uverbs_global_route grh;
555 __u16 dlid;
556 __u8 sl;
557 __u8 src_path_bits;
558 __u8 static_rate;
559 __u8 is_global;
560 __u8 port_num;
561 __u8 reserved;
562};
563
564struct ib_uverbs_create_ah { 602struct ib_uverbs_create_ah {
565 __u64 response; 603 __u64 response;
566 __u64 user_handle; 604 __u64 user_handle;
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 6bbf1b364400..ee1f3a355666 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -260,7 +260,8 @@ enum ib_event_type {
260 IB_EVENT_SM_CHANGE, 260 IB_EVENT_SM_CHANGE,
261 IB_EVENT_SRQ_ERR, 261 IB_EVENT_SRQ_ERR,
262 IB_EVENT_SRQ_LIMIT_REACHED, 262 IB_EVENT_SRQ_LIMIT_REACHED,
263 IB_EVENT_QP_LAST_WQE_REACHED 263 IB_EVENT_QP_LAST_WQE_REACHED,
264 IB_EVENT_CLIENT_REREGISTER
264}; 265};
265 266
266struct ib_event { 267struct ib_event {
@@ -696,8 +697,12 @@ struct ib_ucontext {
696struct ib_uobject { 697struct ib_uobject {
697 u64 user_handle; /* handle given to us by userspace */ 698 u64 user_handle; /* handle given to us by userspace */
698 struct ib_ucontext *context; /* associated user context */ 699 struct ib_ucontext *context; /* associated user context */
700 void *object; /* containing object */
699 struct list_head list; /* link to context's list */ 701 struct list_head list; /* link to context's list */
700 u32 id; /* index into kernel idr */ 702 u32 id; /* index into kernel idr */
703 struct kref ref;
704 struct rw_semaphore mutex; /* protects .live */
705 int live;
701}; 706};
702 707
703struct ib_umem { 708struct ib_umem {
@@ -827,6 +832,7 @@ struct ib_cache {
827 struct ib_event_handler event_handler; 832 struct ib_event_handler event_handler;
828 struct ib_pkey_cache **pkey_cache; 833 struct ib_pkey_cache **pkey_cache;
829 struct ib_gid_cache **gid_cache; 834 struct ib_gid_cache **gid_cache;
835 u8 *lmc_cache;
830}; 836};
831 837
832struct ib_device { 838struct ib_device {
@@ -1086,6 +1092,20 @@ int ib_dealloc_pd(struct ib_pd *pd);
1086struct ib_ah *ib_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr); 1092struct ib_ah *ib_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr);
1087 1093
1088/** 1094/**
1095 * ib_init_ah_from_wc - Initializes address handle attributes from a
1096 * work completion.
1097 * @device: Device on which the received message arrived.
1098 * @port_num: Port on which the received message arrived.
1099 * @wc: Work completion associated with the received message.
1100 * @grh: References the received global route header. This parameter is
1101 * ignored unless the work completion indicates that the GRH is valid.
1102 * @ah_attr: Returned attributes that can be used when creating an address
1103 * handle for replying to the message.
1104 */
1105int ib_init_ah_from_wc(struct ib_device *device, u8 port_num, struct ib_wc *wc,
1106 struct ib_grh *grh, struct ib_ah_attr *ah_attr);
1107
1108/**
1089 * ib_create_ah_from_wc - Creates an address handle associated with the 1109 * ib_create_ah_from_wc - Creates an address handle associated with the
1090 * sender of the specified work completion. 1110 * sender of the specified work completion.
1091 * @pd: The protection domain associated with the address handle. 1111 * @pd: The protection domain associated with the address handle.
diff --git a/include/rdma/rdma_cm.h b/include/rdma/rdma_cm.h
new file mode 100644
index 000000000000..402c63d7226b
--- /dev/null
+++ b/include/rdma/rdma_cm.h
@@ -0,0 +1,256 @@
1/*
2 * Copyright (c) 2005 Voltaire Inc. All rights reserved.
3 * Copyright (c) 2005 Intel Corporation. All rights reserved.
4 *
5 * This Software is licensed under one of the following licenses:
6 *
7 * 1) under the terms of the "Common Public License 1.0" a copy of which is
8 * available from the Open Source Initiative, see
9 * http://www.opensource.org/licenses/cpl.php.
10 *
11 * 2) under the terms of the "The BSD License" a copy of which is
12 * available from the Open Source Initiative, see
13 * http://www.opensource.org/licenses/bsd-license.php.
14 *
15 * 3) under the terms of the "GNU General Public License (GPL) Version 2" a
16 * copy of which is available from the Open Source Initiative, see
17 * http://www.opensource.org/licenses/gpl-license.php.
18 *
19 * Licensee has the right to choose one of the above licenses.
20 *
21 * Redistributions of source code must retain the above copyright
22 * notice and one of the license notices.
23 *
24 * Redistributions in binary form must reproduce both the above copyright
25 * notice, one of the license notices in the documentation
26 * and/or other materials provided with the distribution.
27 *
28 */
29
30#if !defined(RDMA_CM_H)
31#define RDMA_CM_H
32
33#include <linux/socket.h>
34#include <linux/in6.h>
35#include <rdma/ib_addr.h>
36#include <rdma/ib_sa.h>
37
38/*
39 * Upon receiving a device removal event, users must destroy the associated
40 * RDMA identifier and release all resources allocated with the device.
41 */
42enum rdma_cm_event_type {
43 RDMA_CM_EVENT_ADDR_RESOLVED,
44 RDMA_CM_EVENT_ADDR_ERROR,
45 RDMA_CM_EVENT_ROUTE_RESOLVED,
46 RDMA_CM_EVENT_ROUTE_ERROR,
47 RDMA_CM_EVENT_CONNECT_REQUEST,
48 RDMA_CM_EVENT_CONNECT_RESPONSE,
49 RDMA_CM_EVENT_CONNECT_ERROR,
50 RDMA_CM_EVENT_UNREACHABLE,
51 RDMA_CM_EVENT_REJECTED,
52 RDMA_CM_EVENT_ESTABLISHED,
53 RDMA_CM_EVENT_DISCONNECTED,
54 RDMA_CM_EVENT_DEVICE_REMOVAL,
55};
56
57enum rdma_port_space {
58 RDMA_PS_SDP = 0x0001,
59 RDMA_PS_TCP = 0x0106,
60 RDMA_PS_UDP = 0x0111,
61 RDMA_PS_SCTP = 0x0183
62};
63
64struct rdma_addr {
65 struct sockaddr src_addr;
66 u8 src_pad[sizeof(struct sockaddr_in6) -
67 sizeof(struct sockaddr)];
68 struct sockaddr dst_addr;
69 u8 dst_pad[sizeof(struct sockaddr_in6) -
70 sizeof(struct sockaddr)];
71 struct rdma_dev_addr dev_addr;
72};
73
74struct rdma_route {
75 struct rdma_addr addr;
76 struct ib_sa_path_rec *path_rec;
77 int num_paths;
78};
79
80struct rdma_cm_event {
81 enum rdma_cm_event_type event;
82 int status;
83 void *private_data;
84 u8 private_data_len;
85};
86
87struct rdma_cm_id;
88
89/**
90 * rdma_cm_event_handler - Callback used to report user events.
91 *
92 * Notes: Users may not call rdma_destroy_id from this callback to destroy
93 * the passed in id, or a corresponding listen id. Returning a
94 * non-zero value from the callback will destroy the passed in id.
95 */
96typedef int (*rdma_cm_event_handler)(struct rdma_cm_id *id,
97 struct rdma_cm_event *event);
98
99struct rdma_cm_id {
100 struct ib_device *device;
101 void *context;
102 struct ib_qp *qp;
103 rdma_cm_event_handler event_handler;
104 struct rdma_route route;
105 enum rdma_port_space ps;
106 u8 port_num;
107};
108
109/**
110 * rdma_create_id - Create an RDMA identifier.
111 *
112 * @event_handler: User callback invoked to report events associated with the
113 * returned rdma_id.
114 * @context: User specified context associated with the id.
115 * @ps: RDMA port space.
116 */
117struct rdma_cm_id *rdma_create_id(rdma_cm_event_handler event_handler,
118 void *context, enum rdma_port_space ps);
119
120void rdma_destroy_id(struct rdma_cm_id *id);
121
122/**
123 * rdma_bind_addr - Bind an RDMA identifier to a source address and
124 * associated RDMA device, if needed.
125 *
126 * @id: RDMA identifier.
127 * @addr: Local address information. Wildcard values are permitted.
128 *
129 * This associates a source address with the RDMA identifier before calling
130 * rdma_listen. If a specific local address is given, the RDMA identifier will
131 * be bound to a local RDMA device.
132 */
133int rdma_bind_addr(struct rdma_cm_id *id, struct sockaddr *addr);
134
135/**
136 * rdma_resolve_addr - Resolve destination and optional source addresses
137 * from IP addresses to an RDMA address. If successful, the specified
138 * rdma_cm_id will be bound to a local device.
139 *
140 * @id: RDMA identifier.
141 * @src_addr: Source address information. This parameter may be NULL.
142 * @dst_addr: Destination address information.
143 * @timeout_ms: Time to wait for resolution to complete.
144 */
145int rdma_resolve_addr(struct rdma_cm_id *id, struct sockaddr *src_addr,
146 struct sockaddr *dst_addr, int timeout_ms);
147
148/**
149 * rdma_resolve_route - Resolve the RDMA address bound to the RDMA identifier
150 * into route information needed to establish a connection.
151 *
152 * This is called on the client side of a connection.
153 * Users must have first called rdma_resolve_addr to resolve a dst_addr
154 * into an RDMA address before calling this routine.
155 */
156int rdma_resolve_route(struct rdma_cm_id *id, int timeout_ms);
157
158/**
159 * rdma_create_qp - Allocate a QP and associate it with the specified RDMA
160 * identifier.
161 *
162 * QPs allocated to an rdma_cm_id will automatically be transitioned by the CMA
163 * through their states.
164 */
165int rdma_create_qp(struct rdma_cm_id *id, struct ib_pd *pd,
166 struct ib_qp_init_attr *qp_init_attr);
167
168/**
169 * rdma_destroy_qp - Deallocate the QP associated with the specified RDMA
170 * identifier.
171 *
172 * Users must destroy any QP associated with an RDMA identifier before
173 * destroying the RDMA ID.
174 */
175void rdma_destroy_qp(struct rdma_cm_id *id);
176
177/**
178 * rdma_init_qp_attr - Initializes the QP attributes for use in transitioning
179 * to a specified QP state.
180 * @id: Communication identifier associated with the QP attributes to
181 * initialize.
182 * @qp_attr: On input, specifies the desired QP state. On output, the
183 * mandatory and desired optional attributes will be set in order to
184 * modify the QP to the specified state.
185 * @qp_attr_mask: The QP attribute mask that may be used to transition the
186 * QP to the specified state.
187 *
188 * Users must set the @qp_attr->qp_state to the desired QP state. This call
189 * will set all required attributes for the given transition, along with
190 * known optional attributes. Users may override the attributes returned from
191 * this call before calling ib_modify_qp.
192 *
193 * Users that wish to have their QP automatically transitioned through its
194 * states can associate a QP with the rdma_cm_id by calling rdma_create_qp().
195 */
196int rdma_init_qp_attr(struct rdma_cm_id *id, struct ib_qp_attr *qp_attr,
197 int *qp_attr_mask);
198
199struct rdma_conn_param {
200 const void *private_data;
201 u8 private_data_len;
202 u8 responder_resources;
203 u8 initiator_depth;
204 u8 flow_control;
205 u8 retry_count; /* ignored when accepting */
206 u8 rnr_retry_count;
207 /* Fields below ignored if a QP is created on the rdma_cm_id. */
208 u8 srq;
209 u32 qp_num;
210 enum ib_qp_type qp_type;
211};
212
213/**
214 * rdma_connect - Initiate an active connection request.
215 *
216 * Users must have resolved a route for the rdma_cm_id to connect with
217 * by having called rdma_resolve_route before calling this routine.
218 */
219int rdma_connect(struct rdma_cm_id *id, struct rdma_conn_param *conn_param);
220
221/**
222 * rdma_listen - This function is called by the passive side to
223 * listen for incoming connection requests.
224 *
225 * Users must have bound the rdma_cm_id to a local address by calling
226 * rdma_bind_addr before calling this routine.
227 */
228int rdma_listen(struct rdma_cm_id *id, int backlog);
229
230/**
231 * rdma_accept - Called to accept a connection request or response.
232 * @id: Connection identifier associated with the request.
233 * @conn_param: Information needed to establish the connection. This must be
234 * provided if accepting a connection request. If accepting a connection
235 * response, this parameter must be NULL.
236 *
237 * Typically, this routine is only called by the listener to accept a connection
238 * request. It must also be called on the active side of a connection if the
239 * user is performing their own QP transitions.
240 */
241int rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param);
242
243/**
244 * rdma_reject - Called to reject a connection request or response.
245 */
246int rdma_reject(struct rdma_cm_id *id, const void *private_data,
247 u8 private_data_len);
248
249/**
250 * rdma_disconnect - This function disconnects the associated QP and
251 * transitions it into the error state.
252 */
253int rdma_disconnect(struct rdma_cm_id *id);
254
255#endif /* RDMA_CM_H */
256
diff --git a/include/rdma/rdma_cm_ib.h b/include/rdma/rdma_cm_ib.h
new file mode 100644
index 000000000000..e8c3af1804d4
--- /dev/null
+++ b/include/rdma/rdma_cm_ib.h
@@ -0,0 +1,47 @@
1/*
2 * Copyright (c) 2006 Intel Corporation. All rights reserved.
3 *
4 * This Software is licensed under one of the following licenses:
5 *
6 * 1) under the terms of the "Common Public License 1.0" a copy of which is
7 * available from the Open Source Initiative, see
8 * http://www.opensource.org/licenses/cpl.php.
9 *
10 * 2) under the terms of the "The BSD License" a copy of which is
11 * available from the Open Source Initiative, see
12 * http://www.opensource.org/licenses/bsd-license.php.
13 *
14 * 3) under the terms of the "GNU General Public License (GPL) Version 2" a
15 * copy of which is available from the Open Source Initiative, see
16 * http://www.opensource.org/licenses/gpl-license.php.
17 *
18 * Licensee has the right to choose one of the above licenses.
19 *
20 * Redistributions of source code must retain the above copyright
21 * notice and one of the license notices.
22 *
23 * Redistributions in binary form must reproduce both the above copyright
24 * notice, one of the license notices in the documentation
25 * and/or other materials provided with the distribution.
26 *
27 */
28
29#if !defined(RDMA_CM_IB_H)
30#define RDMA_CM_IB_H
31
32#include <rdma/rdma_cm.h>
33
34/**
35 * rdma_set_ib_paths - Manually sets the path records used to establish a
36 * connection.
37 * @id: Connection identifier associated with the request.
38 * @path_rec: Reference to the path record
39 *
40 * This call permits a user to specify routing information for rdma_cm_id's
41 * bound to Infiniband devices. It is called on the client side of a
42 * connection and replaces the call to rdma_resolve_route.
43 */
44int rdma_set_ib_paths(struct rdma_cm_id *id,
45 struct ib_sa_path_rec *path_rec, int num_paths);
46
47#endif /* RDMA_CM_IB_H */
diff --git a/include/scsi/srp.h b/include/scsi/srp.h
index 637f77eccf0c..ad178fa78f66 100644
--- a/include/scsi/srp.h
+++ b/include/scsi/srp.h
@@ -87,6 +87,11 @@ enum srp_login_rej_reason {
87 SRP_LOGIN_REJ_CHANNEL_LIMIT_REACHED = 0x00010006 87 SRP_LOGIN_REJ_CHANNEL_LIMIT_REACHED = 0x00010006
88}; 88};
89 89
90enum {
91 SRP_REV10_IB_IO_CLASS = 0xff00,
92 SRP_REV16A_IB_IO_CLASS = 0x0100
93};
94
90struct srp_direct_buf { 95struct srp_direct_buf {
91 __be64 va; 96 __be64 va;
92 __be32 key; 97 __be32 key;