summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-03-23 02:25:38 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-03-23 02:25:38 +0000
commit16b5d462f73eb29d1f67fa01cc1ea66afdc72569 (patch)
tree5407bd573f4840e473ea27cbe61e5c7a07131fcd /include
parentce8a076e11e7e5ee36007f9a3eee5bb3744cb8f6 (diff)
Merge with Linux 2.3.99-pre2.
Diffstat (limited to 'include')
-rw-r--r--include/asm-alpha/core_apecs.h47
-rw-r--r--include/asm-alpha/core_cia.h489
-rw-r--r--include/asm-alpha/core_irongate.h63
-rw-r--r--include/asm-alpha/core_lca.h47
-rw-r--r--include/asm-alpha/core_mcpcia.h47
-rw-r--r--include/asm-alpha/core_polaris.h63
-rw-r--r--include/asm-alpha/core_pyxis.h444
-rw-r--r--include/asm-alpha/core_t2.h37
-rw-r--r--include/asm-alpha/core_tsunami.h63
-rw-r--r--include/asm-alpha/delay.h69
-rw-r--r--include/asm-alpha/io.h36
-rw-r--r--include/asm-alpha/mman.h7
-rw-r--r--include/asm-alpha/mmu_context.h11
-rw-r--r--include/asm-alpha/page.h4
-rw-r--r--include/asm-alpha/pci.h5
-rw-r--r--include/asm-alpha/smp.h1
-rw-r--r--include/asm-alpha/unistd.h2
-rw-r--r--include/asm-alpha/vga.h4
-rw-r--r--include/asm-arm/arch-cl7500/system.h16
-rw-r--r--include/asm-arm/arch-ebsa110/system.h11
-rw-r--r--include/asm-arm/arch-ebsa285/system.h8
-rw-r--r--include/asm-arm/arch-rpc/system.h8
-rw-r--r--include/asm-arm/arch-sa1100/system.h6
-rw-r--r--include/asm-arm/cpu-multi32.h4
-rw-r--r--include/asm-arm/cpu-single.h2
-rw-r--r--include/asm-arm/mman.h6
-rw-r--r--include/asm-arm/page.h3
-rw-r--r--include/asm-arm/pci.h7
-rw-r--r--include/asm-arm/system.h4
-rw-r--r--include/asm-i386/hw_irq.h25
-rw-r--r--include/asm-i386/page.h3
-rw-r--r--include/asm-i386/pci.h5
-rw-r--r--include/asm-i386/processor.h4
-rw-r--r--include/asm-ia64/page.h3
-rw-r--r--include/asm-ia64/pci.h5
-rw-r--r--include/asm-m68k/page.h3
-rw-r--r--include/asm-m68k/pci.h5
-rw-r--r--include/asm-mips/page.h4
-rw-r--r--include/asm-mips/pci.h9
-rw-r--r--include/asm-mips64/page.h4
-rw-r--r--include/asm-mips64/pci.h9
-rw-r--r--include/asm-ppc/page.h2
-rw-r--r--include/asm-ppc/pci.h5
-rw-r--r--include/asm-sh/page.h2
-rw-r--r--include/asm-sh/pci.h7
-rw-r--r--include/asm-sparc/mman.h9
-rw-r--r--include/asm-sparc/page.h13
-rw-r--r--include/asm-sparc/pci.h7
-rw-r--r--include/asm-sparc64/atomic.h61
-rw-r--r--include/asm-sparc64/mman.h9
-rw-r--r--include/asm-sparc64/page.h4
-rw-r--r--include/asm-sparc64/parport.h3
-rw-r--r--include/asm-sparc64/pci.h7
-rw-r--r--include/asm-sparc64/semaphore.h16
-rw-r--r--include/asm-sparc64/spinlock.h44
-rw-r--r--include/linux/ac97_codec.h18
-rw-r--r--include/linux/binfmts.h2
-rw-r--r--include/linux/fs.h22
-rw-r--r--include/linux/hdreg.h4
-rw-r--r--include/linux/highmem.h20
-rw-r--r--include/linux/i2c-algo-pcf.h4
-rw-r--r--include/linux/i2c-dev.h8
-rw-r--r--include/linux/i2c-id.h7
-rw-r--r--include/linux/i2c.h4
-rw-r--r--include/linux/icmp.h21
-rw-r--r--include/linux/kernel.h2
-rw-r--r--include/linux/module.h6
-rw-r--r--include/linux/mount.h4
-rw-r--r--include/linux/netfilter.h15
-rw-r--r--include/linux/netfilter_ipv4.h10
-rw-r--r--include/linux/netfilter_ipv4/compat_firewall.h45
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack.h177
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_core.h39
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_ftp.h41
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_helper.h30
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_protocol.h58
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_tuple.h105
-rw-r--r--include/linux/netfilter_ipv4/ip_nat.h117
-rw-r--r--include/linux/netfilter_ipv4/ip_nat_core.h33
-rw-r--r--include/linux/netfilter_ipv4/ip_nat_ftp.h21
-rw-r--r--include/linux/netfilter_ipv4/ip_nat_helper.h30
-rw-r--r--include/linux/netfilter_ipv4/ip_nat_protocol.h57
-rw-r--r--include/linux/netfilter_ipv4/ip_nat_rule.h35
-rw-r--r--include/linux/netfilter_ipv4/ip_queue.h86
-rw-r--r--include/linux/netfilter_ipv4/ip_tables.h420
-rw-r--r--include/linux/netfilter_ipv4/ipchains_core.h193
-rw-r--r--include/linux/netfilter_ipv4/ipfwadm_core.h256
-rw-r--r--include/linux/netfilter_ipv4/ipt_LOG.h15
-rw-r--r--include/linux/netfilter_ipv4/ipt_MARK.h8
-rw-r--r--include/linux/netfilter_ipv4/ipt_REJECT.h17
-rw-r--r--include/linux/netfilter_ipv4/ipt_TOS.h12
-rw-r--r--include/linux/netfilter_ipv4/ipt_limit.h21
-rw-r--r--include/linux/netfilter_ipv4/ipt_mac.h8
-rw-r--r--include/linux/netfilter_ipv4/ipt_mark.h9
-rw-r--r--include/linux/netfilter_ipv4/ipt_multiport.h21
-rw-r--r--include/linux/netfilter_ipv4/ipt_owner.h18
-rw-r--r--include/linux/netfilter_ipv4/ipt_state.h12
-rw-r--r--include/linux/netfilter_ipv4/ipt_tos.h13
-rw-r--r--include/linux/netfilter_ipv4/listhelp.h115
-rw-r--r--include/linux/netfilter_ipv4/lockhelp.h129
-rw-r--r--include/linux/nfsd/nfsd.h3
-rw-r--r--include/linux/pci.h7
-rw-r--r--include/linux/ppp_channel.h4
-rw-r--r--include/linux/prctl.h4
-rw-r--r--include/linux/quota.h2
-rw-r--r--include/linux/quotaops.h6
-rw-r--r--include/linux/sched.h2
-rw-r--r--include/linux/shm.h4
-rw-r--r--include/linux/skbuff.h2
-rw-r--r--include/linux/soundcard.h19
-rw-r--r--include/net/tcp.h2
111 files changed, 3002 insertions, 1123 deletions
diff --git a/include/asm-alpha/core_apecs.h b/include/asm-alpha/core_apecs.h
index 927aa2ea7..fee9f3c13 100644
--- a/include/asm-alpha/core_apecs.h
+++ b/include/asm-alpha/core_apecs.h
@@ -511,32 +511,27 @@ __EXTERN_INLINE int apecs_is_ioaddr(unsigned long addr)
#ifdef __WANT_IO_DEF
-#define __inb apecs_inb
-#define __inw apecs_inw
-#define __inl apecs_inl
-#define __outb apecs_outb
-#define __outw apecs_outw
-#define __outl apecs_outl
-#define __readb apecs_readb
-#define __readw apecs_readw
-#define __readl apecs_readl
-#define __readq apecs_readq
-#define __writeb apecs_writeb
-#define __writew apecs_writew
-#define __writel apecs_writel
-#define __writeq apecs_writeq
-#define __ioremap apecs_ioremap
-#define __is_ioaddr apecs_is_ioaddr
-
-#define inb(port) \
- (__builtin_constant_p((port))?__inb(port):_inb(port))
-#define outb(x, port) \
- (__builtin_constant_p((port))?__outb((x),(port)):_outb((x),(port)))
-
-#define __raw_readl(a) __readl((unsigned long)(a))
-#define __raw_readq(a) __readq((unsigned long)(a))
-#define __raw_writel(v,a) __writel((v),(unsigned long)(a))
-#define __raw_writeq(v,a) __writeq((v),(unsigned long)(a))
+#define __inb(p) apecs_inb((unsigned long)(p))
+#define __inw(p) apecs_inw((unsigned long)(p))
+#define __inl(p) apecs_inl((unsigned long)(p))
+#define __outb(x,p) apecs_outb((x),(unsigned long)(p))
+#define __outw(x,p) apecs_outw((x),(unsigned long)(p))
+#define __outl(x,p) apecs_outl((x),(unsigned long)(p))
+#define __readb(a) apecs_readb((unsigned long)(a))
+#define __readw(a) apecs_readw((unsigned long)(a))
+#define __readl(a) apecs_readl((unsigned long)(a))
+#define __readq(a) apecs_readq((unsigned long)(a))
+#define __writeb(x,a) apecs_writeb((x),(unsigned long)(a))
+#define __writew(x,a) apecs_writew((x),(unsigned long)(a))
+#define __writel(x,a) apecs_writel((x),(unsigned long)(a))
+#define __writeq(x,a) apecs_writeq((x),(unsigned long)(a))
+#define __ioremap(a) apecs_ioremap((unsigned long)(a))
+#define __is_ioaddr(a) apecs_is_ioaddr((unsigned long)(a))
+
+#define __raw_readl(a) __readl(a)
+#define __raw_readq(a) __readq(a)
+#define __raw_writel(v,a) __writel((v),(a))
+#define __raw_writeq(v,a) __writeq((v),(a))
#endif /* __WANT_IO_DEF */
diff --git a/include/asm-alpha/core_cia.h b/include/asm-alpha/core_cia.h
index 418aa3492..32d2319b6 100644
--- a/include/asm-alpha/core_cia.h
+++ b/include/asm-alpha/core_cia.h
@@ -4,12 +4,18 @@
/* Define to experiment with fitting everything into one 512MB HAE window. */
#define CIA_ONE_HAE_WINDOW 1
+#include <linux/config.h>
#include <linux/types.h>
#include <asm/compiler.h>
/*
- * CIA is the internal name for the 2117x chipset which provides
+ * CIA is the internal name for the 21171 chipset which provides
* memory controller and PCI access for the 21164 chip based systems.
+ * Also supported here is the 21172 (CIA-2) and 21174 (PYXIS).
+ *
+ * The lineage is a bit confused, since the 21174 was reportedly started
+ * from the 21171 Pass 1 mask, and so is missing bug fixes that appear
+ * in 21171 Pass 2 and 21172, but it also contains additional features.
*
* This file is based on:
*
@@ -22,24 +28,8 @@
*
*/
-/*------------------------------------------------------------------------**
-** **
-** EB164 I/O procedures **
-** **
-** inport[b|w|t|l], outport[b|w|t|l] 8:16:24:32 IO xfers **
-** inportbxt: 8 bits only **
-** inport: alias of inportw **
-** outport: alias of outportw **
-** **
-** inmem[b|w|t|l], outmem[b|w|t|l] 8:16:24:32 ISA memory xfers **
-** inmembxt: 8 bits only **
-** inmem: alias of inmemw **
-** outmem: alias of outmemw **
-** **
-**------------------------------------------------------------------------*/
-
-
-/* CIA ADDRESS BIT DEFINITIONS
+/*
+ * CIA ADDRESS BIT DEFINITIONS
*
* 3333 3333 3322 2222 2222 1111 1111 11
* 9876 5432 1098 7654 3210 9876 5432 1098 7654 3210
@@ -78,91 +68,168 @@
#define CIA_MEM_R3_MASK 0x03ffffff /* SPARSE Mem region 3 mask is 26 bits */
/*
- * 21171-CA Control and Status Registers (p4-1)
+ * 21171-CA Control and Status Registers
+ */
+#define CIA_IOC_CIA_REV (IDENT_ADDR + 0x8740000080UL)
+# define CIA_REV_MASK 0xff
+#define CIA_IOC_PCI_LAT (IDENT_ADDR + 0x87400000C0UL)
+#define CIA_IOC_CIA_CTRL (IDENT_ADDR + 0x8740000100UL)
+# define CIA_CTRL_PCI_EN (1 << 0)
+# define CIA_CTRL_PCI_LOCK_EN (1 << 1)
+# define CIA_CTRL_PCI_LOOP_EN (1 << 2)
+# define CIA_CTRL_FST_BB_EN (1 << 3)
+# define CIA_CTRL_PCI_MST_EN (1 << 4)
+# define CIA_CTRL_PCI_MEM_EN (1 << 5)
+# define CIA_CTRL_PCI_REQ64_EN (1 << 6)
+# define CIA_CTRL_PCI_ACK64_EN (1 << 7)
+# define CIA_CTRL_ADDR_PE_EN (1 << 8)
+# define CIA_CTRL_PERR_EN (1 << 9)
+# define CIA_CTRL_FILL_ERR_EN (1 << 10)
+# define CIA_CTRL_MCHK_ERR_EN (1 << 11)
+# define CIA_CTRL_ECC_CHK_EN (1 << 12)
+# define CIA_CTRL_ASSERT_IDLE_BC (1 << 13)
+# define CIA_CTRL_COM_IDLE_BC (1 << 14)
+# define CIA_CTRL_CSR_IOA_BYPASS (1 << 15)
+# define CIA_CTRL_IO_FLUSHREQ_EN (1 << 16)
+# define CIA_CTRL_CPU_FLUSHREQ_EN (1 << 17)
+# define CIA_CTRL_ARB_CPU_EN (1 << 18)
+# define CIA_CTRL_EN_ARB_LINK (1 << 19)
+# define CIA_CTRL_RD_TYPE_SHIFT 20
+# define CIA_CTRL_RL_TYPE_SHIFT 24
+# define CIA_CTRL_RM_TYPE_SHIFT 28
+# define CIA_CTRL_EN_DMA_RD_PERF (1 << 31)
+#define CIA_IOC_CIA_CNFG (IDENT_ADDR + 0x8740000140UL)
+# define CIA_CNFG_IOA_BWEN (1 << 0)
+# define CIA_CNFG_PCI_MWEN (1 << 4)
+# define CIA_CNFG_PCI_DWEN (1 << 5)
+# define CIA_CNFG_PCI_WLEN (1 << 8)
+#define CIA_IOC_FLASH_CTRL (IDENT_ADDR + 0x8740000200UL)
+#define CIA_IOC_HAE_MEM (IDENT_ADDR + 0x8740000400UL)
+#define CIA_IOC_HAE_IO (IDENT_ADDR + 0x8740000440UL)
+#define CIA_IOC_CFG (IDENT_ADDR + 0x8740000480UL)
+#define CIA_IOC_CACK_EN (IDENT_ADDR + 0x8740000600UL)
+# define CIA_CACK_EN_LOCK_EN (1 << 0)
+# define CIA_CACK_EN_MB_EN (1 << 1)
+# define CIA_CACK_EN_SET_DIRTY_EN (1 << 2)
+# define CIA_CACK_EN_BC_VICTIM_EN (1 << 3)
+
+
+/*
+ * 21171-CA Diagnostic Registers
*/
-#define CIA_IOC_CIA_REV (IDENT_ADDR + 0x8740000080UL)
-#define CIA_IOC_PCI_LAT (IDENT_ADDR + 0x87400000C0UL)
-#define CIA_IOC_CIA_CTRL (IDENT_ADDR + 0x8740000100UL)
-#define CIA_IOC_CIA_CNFG (IDENT_ADDR + 0x8740000140UL)
-#define CIA_IOC_HAE_MEM (IDENT_ADDR + 0x8740000400UL)
-#define CIA_IOC_HAE_IO (IDENT_ADDR + 0x8740000440UL)
-#define CIA_IOC_CFG (IDENT_ADDR + 0x8740000480UL)
-#define CIA_IOC_CACK_EN (IDENT_ADDR + 0x8740000600UL)
+#define CIA_IOC_CIA_DIAG (IDENT_ADDR + 0x8740002000UL)
+#define CIA_IOC_DIAG_CHECK (IDENT_ADDR + 0x8740003000UL)
/*
- * 21171-CA Diagnostic Registers (p4-2)
+ * 21171-CA Performance Monitor registers
*/
-#define CIA_IOC_CIA_DIAG (IDENT_ADDR + 0x8740002000UL)
-#define CIA_IOC_DIAG_CHECK (IDENT_ADDR + 0x8740003000UL)
+#define CIA_IOC_PERF_MONITOR (IDENT_ADDR + 0x8740004000UL)
+#define CIA_IOC_PERF_CONTROL (IDENT_ADDR + 0x8740004040UL)
/*
- * 21171-CA Performance Monitor registers (p4-3)
+ * 21171-CA Error registers
*/
-#define CIA_IOC_PERF_MONITOR (IDENT_ADDR + 0x8740004000UL)
-#define CIA_IOC_PERF_CONTROL (IDENT_ADDR + 0x8740004040UL)
+#define CIA_IOC_CPU_ERR0 (IDENT_ADDR + 0x8740008000UL)
+#define CIA_IOC_CPU_ERR1 (IDENT_ADDR + 0x8740008040UL)
+#define CIA_IOC_CIA_ERR (IDENT_ADDR + 0x8740008200UL)
+# define CIA_ERR_COR_ERR (1 << 0)
+# define CIA_ERR_UN_COR_ERR (1 << 1)
+# define CIA_ERR_CPU_PE (1 << 2)
+# define CIA_ERR_MEM_NEM (1 << 3)
+# define CIA_ERR_PCI_SERR (1 << 4)
+# define CIA_ERR_PERR (1 << 5)
+# define CIA_ERR_PCI_ADDR_PE (1 << 6)
+# define CIA_ERR_RCVD_MAS_ABT (1 << 7)
+# define CIA_ERR_RCVD_TAR_ABT (1 << 8)
+# define CIA_ERR_PA_PTE_INV (1 << 9)
+# define CIA_ERR_FROM_WRT_ERR (1 << 10)
+# define CIA_ERR_IOA_TIMEOUT (1 << 11)
+# define CIA_ERR_LOST_CORR_ERR (1 << 16)
+# define CIA_ERR_LOST_UN_CORR_ERR (1 << 17)
+# define CIA_ERR_LOST_CPU_PE (1 << 18)
+# define CIA_ERR_LOST_MEM_NEM (1 << 19)
+# define CIA_ERR_LOST_PERR (1 << 21)
+# define CIA_ERR_LOST_PCI_ADDR_PE (1 << 22)
+# define CIA_ERR_LOST_RCVD_MAS_ABT (1 << 23)
+# define CIA_ERR_LOST_RCVD_TAR_ABT (1 << 24)
+# define CIA_ERR_LOST_PA_PTE_INV (1 << 25)
+# define CIA_ERR_LOST_FROM_WRT_ERR (1 << 26)
+# define CIA_ERR_LOST_IOA_TIMEOUT (1 << 27)
+# define CIA_ERR_VALID (1 << 31)
+#define CIA_IOC_CIA_STAT (IDENT_ADDR + 0x8740008240UL)
+#define CIA_IOC_ERR_MASK (IDENT_ADDR + 0x8740008280UL)
+#define CIA_IOC_CIA_SYN (IDENT_ADDR + 0x8740008300UL)
+#define CIA_IOC_MEM_ERR0 (IDENT_ADDR + 0x8740008400UL)
+#define CIA_IOC_MEM_ERR1 (IDENT_ADDR + 0x8740008440UL)
+#define CIA_IOC_PCI_ERR0 (IDENT_ADDR + 0x8740008800UL)
+#define CIA_IOC_PCI_ERR1 (IDENT_ADDR + 0x8740008840UL)
+#define CIA_IOC_PCI_ERR3 (IDENT_ADDR + 0x8740008880UL)
/*
- * 21171-CA Error registers (p4-3)
+ * 21171-CA System configuration registers
*/
-#define CIA_IOC_CPU_ERR0 (IDENT_ADDR + 0x8740008000UL)
-#define CIA_IOC_CPU_ERR1 (IDENT_ADDR + 0x8740008040UL)
-#define CIA_IOC_CIA_ERR (IDENT_ADDR + 0x8740008200UL)
-#define CIA_IOC_CIA_STAT (IDENT_ADDR + 0x8740008240UL)
-#define CIA_IOC_ERR_MASK (IDENT_ADDR + 0x8740008280UL)
-#define CIA_IOC_CIA_SYN (IDENT_ADDR + 0x8740008300UL)
-#define CIA_IOC_MEM_ERR0 (IDENT_ADDR + 0x8740008400UL)
-#define CIA_IOC_MEM_ERR1 (IDENT_ADDR + 0x8740008440UL)
-#define CIA_IOC_PCI_ERR0 (IDENT_ADDR + 0x8740008800UL)
-#define CIA_IOC_PCI_ERR1 (IDENT_ADDR + 0x8740008840UL)
-#define CIA_IOC_PCI_ERR3 (IDENT_ADDR + 0x8740008880UL)
+#define CIA_IOC_MCR (IDENT_ADDR + 0x8750000000UL)
+#define CIA_IOC_MBA0 (IDENT_ADDR + 0x8750000600UL)
+#define CIA_IOC_MBA2 (IDENT_ADDR + 0x8750000680UL)
+#define CIA_IOC_MBA4 (IDENT_ADDR + 0x8750000700UL)
+#define CIA_IOC_MBA6 (IDENT_ADDR + 0x8750000780UL)
+#define CIA_IOC_MBA8 (IDENT_ADDR + 0x8750000800UL)
+#define CIA_IOC_MBAA (IDENT_ADDR + 0x8750000880UL)
+#define CIA_IOC_MBAC (IDENT_ADDR + 0x8750000900UL)
+#define CIA_IOC_MBAE (IDENT_ADDR + 0x8750000980UL)
+#define CIA_IOC_TMG0 (IDENT_ADDR + 0x8750000B00UL)
+#define CIA_IOC_TMG1 (IDENT_ADDR + 0x8750000B40UL)
+#define CIA_IOC_TMG2 (IDENT_ADDR + 0x8750000B80UL)
/*
- * 2117A-CA PCI Address Translation Registers.
+ * 2117A-CA PCI Address and Scatter-Gather Registers.
*/
-#define CIA_IOC_PCI_TBIA (IDENT_ADDR + 0x8760000100UL)
+#define CIA_IOC_PCI_TBIA (IDENT_ADDR + 0x8760000100UL)
+
+#define CIA_IOC_PCI_W0_BASE (IDENT_ADDR + 0x8760000400UL)
+#define CIA_IOC_PCI_W0_MASK (IDENT_ADDR + 0x8760000440UL)
+#define CIA_IOC_PCI_T0_BASE (IDENT_ADDR + 0x8760000480UL)
-#define CIA_IOC_PCI_W0_BASE (IDENT_ADDR + 0x8760000400UL)
-#define CIA_IOC_PCI_W0_MASK (IDENT_ADDR + 0x8760000440UL)
-#define CIA_IOC_PCI_T0_BASE (IDENT_ADDR + 0x8760000480UL)
+#define CIA_IOC_PCI_W1_BASE (IDENT_ADDR + 0x8760000500UL)
+#define CIA_IOC_PCI_W1_MASK (IDENT_ADDR + 0x8760000540UL)
+#define CIA_IOC_PCI_T1_BASE (IDENT_ADDR + 0x8760000580UL)
-#define CIA_IOC_PCI_W1_BASE (IDENT_ADDR + 0x8760000500UL)
-#define CIA_IOC_PCI_W1_MASK (IDENT_ADDR + 0x8760000540UL)
-#define CIA_IOC_PCI_T1_BASE (IDENT_ADDR + 0x8760000580UL)
+#define CIA_IOC_PCI_W2_BASE (IDENT_ADDR + 0x8760000600UL)
+#define CIA_IOC_PCI_W2_MASK (IDENT_ADDR + 0x8760000640UL)
+#define CIA_IOC_PCI_T2_BASE (IDENT_ADDR + 0x8760000680UL)
-#define CIA_IOC_PCI_W2_BASE (IDENT_ADDR + 0x8760000600UL)
-#define CIA_IOC_PCI_W2_MASK (IDENT_ADDR + 0x8760000640UL)
-#define CIA_IOC_PCI_T2_BASE (IDENT_ADDR + 0x8760000680UL)
+#define CIA_IOC_PCI_W3_BASE (IDENT_ADDR + 0x8760000700UL)
+#define CIA_IOC_PCI_W3_MASK (IDENT_ADDR + 0x8760000740UL)
+#define CIA_IOC_PCI_T3_BASE (IDENT_ADDR + 0x8760000780UL)
-#define CIA_IOC_PCI_W3_BASE (IDENT_ADDR + 0x8760000700UL)
-#define CIA_IOC_PCI_W3_MASK (IDENT_ADDR + 0x8760000740UL)
-#define CIA_IOC_PCI_T3_BASE (IDENT_ADDR + 0x8760000780UL)
+#define CIA_IOC_PCI_W_DAC (IDENT_ADDR + 0x87600007C0UL)
/*
- * 21171-CA System configuration registers (p4-3)
+ * 2117A-CA Address Translation Registers.
*/
-#define CIA_IOC_MCR (IDENT_ADDR + 0x8750000000UL)
-#define CIA_IOC_MBA0 (IDENT_ADDR + 0x8750000600UL)
-#define CIA_IOC_MBA2 (IDENT_ADDR + 0x8750000680UL)
-#define CIA_IOC_MBA4 (IDENT_ADDR + 0x8750000700UL)
-#define CIA_IOC_MBA6 (IDENT_ADDR + 0x8750000780UL)
-#define CIA_IOC_MBA8 (IDENT_ADDR + 0x8750000800UL)
-#define CIA_IOC_MBAA (IDENT_ADDR + 0x8750000880UL)
-#define CIA_IOC_MBAC (IDENT_ADDR + 0x8750000900UL)
-#define CIA_IOC_MBAE (IDENT_ADDR + 0x8750000980UL)
-#define CIA_IOC_TMG0 (IDENT_ADDR + 0x8750000B00UL)
-#define CIA_IOC_TMG1 (IDENT_ADDR + 0x8750000B40UL)
-#define CIA_IOC_TMG2 (IDENT_ADDR + 0x8750000B80UL)
+
+/* 8 tag registers, the first 4 of which are lockable. */
+#define CIA_IOC_TB_TAGn(n) \
+ (IDENT_ADDR + 0x8760000800UL + (n)*0x40)
+
+/* 4 page registers per tag register. */
+#define CIA_IOC_TBn_PAGEm(n,m) \
+ (IDENT_ADDR + 0x8760001000UL + (n)*0x100 + (m)*0x40)
/*
* Memory spaces:
*/
-#define CIA_IACK_SC (IDENT_ADDR + 0x8720000000UL)
-#define CIA_CONF (IDENT_ADDR + 0x8700000000UL)
+#define CIA_IACK_SC (IDENT_ADDR + 0x8720000000UL)
+#define CIA_CONF (IDENT_ADDR + 0x8700000000UL)
#define CIA_IO (IDENT_ADDR + 0x8580000000UL)
#define CIA_SPARSE_MEM (IDENT_ADDR + 0x8000000000UL)
#define CIA_SPARSE_MEM_R2 (IDENT_ADDR + 0x8400000000UL)
#define CIA_SPARSE_MEM_R3 (IDENT_ADDR + 0x8500000000UL)
#define CIA_DENSE_MEM (IDENT_ADDR + 0x8600000000UL)
+#define CIA_BW_MEM (IDENT_ADDR + 0x8800000000UL)
+#define CIA_BW_IO (IDENT_ADDR + 0x8900000000UL)
+#define CIA_BW_CFG_0 (IDENT_ADDR + 0x8a00000000UL)
+#define CIA_BW_CFG_1 (IDENT_ADDR + 0x8b00000000UL)
/*
* ALCOR's GRU ASIC registers
@@ -182,23 +249,19 @@
#define XLT_GRU_INT_REQ_BITS 0x80003fffUL
#define GRU_INT_REQ_BITS (alpha_mv.sys.cia.gru_int_req_bits+0)
-
/*
- * Bit definitions for I/O Controller status register 0:
+ * PYXIS interrupt control registers
*/
-#define CIA_IOC_STAT0_CMD 0xf
-#define CIA_IOC_STAT0_ERR (1<<4)
-#define CIA_IOC_STAT0_LOST (1<<5)
-#define CIA_IOC_STAT0_THIT (1<<6)
-#define CIA_IOC_STAT0_TREF (1<<7)
-#define CIA_IOC_STAT0_CODE_SHIFT 8
-#define CIA_IOC_STAT0_CODE_MASK 0x7
-#define CIA_IOC_STAT0_P_NBR_SHIFT 13
-#define CIA_IOC_STAT0_P_NBR_MASK 0x7ffff
-
-#if !CIA_ONE_HAE_WINDOW
-#define CIA_HAE_ADDRESS CIA_IOC_HAE_MEM
-#endif
+#define PYXIS_INT_REQ (IDENT_ADDR + 0x87A0000000UL)
+#define PYXIS_INT_MASK (IDENT_ADDR + 0x87A0000040UL)
+#define PYXIS_INT_HILO (IDENT_ADDR + 0x87A00000C0UL)
+#define PYXIS_INT_ROUTE (IDENT_ADDR + 0x87A0000140UL)
+#define PYXIS_GPO (IDENT_ADDR + 0x87A0000180UL)
+#define PYXIS_INT_CNFG (IDENT_ADDR + 0x87A00001C0UL)
+#define PYXIS_RT_COUNT (IDENT_ADDR + 0x87A0000200UL)
+#define PYXIS_INT_TIME (IDENT_ADDR + 0x87A0000240UL)
+#define PYXIS_IIC_CTRL (IDENT_ADDR + 0x87A00002C0UL)
+#define PYXIS_RESET (IDENT_ADDR + 0x8780000900UL)
/*
* Data structure for handling CIA machine checks.
@@ -206,52 +269,6 @@
/* System-specific info. */
struct el_CIA_sysdata_mcheck {
-#if 0
- /* ??? Where did this come from. It appears to bear no
- relation to the cia logout written in the milo sources.
- Who knows what happens in the srm console... */
- unsigned long coma_gcr;
- unsigned long coma_edsr;
- unsigned long coma_ter;
- unsigned long coma_elar;
- unsigned long coma_ehar;
- unsigned long coma_ldlr;
- unsigned long coma_ldhr;
- unsigned long coma_base0;
- unsigned long coma_base1;
- unsigned long coma_base2;
- unsigned long coma_cnfg0;
- unsigned long coma_cnfg1;
- unsigned long coma_cnfg2;
- unsigned long epic_dcsr;
- unsigned long epic_pear;
- unsigned long epic_sear;
- unsigned long epic_tbr1;
- unsigned long epic_tbr2;
- unsigned long epic_pbr1;
- unsigned long epic_pbr2;
- unsigned long epic_pmr1;
- unsigned long epic_pmr2;
- unsigned long epic_harx1;
- unsigned long epic_harx2;
- unsigned long epic_pmlt;
- unsigned long epic_tag0;
- unsigned long epic_tag1;
- unsigned long epic_tag2;
- unsigned long epic_tag3;
- unsigned long epic_tag4;
- unsigned long epic_tag5;
- unsigned long epic_tag6;
- unsigned long epic_tag7;
- unsigned long epic_data0;
- unsigned long epic_data1;
- unsigned long epic_data2;
- unsigned long epic_data3;
- unsigned long epic_data4;
- unsigned long epic_data5;
- unsigned long epic_data6;
- unsigned long epic_data7;
-#else
unsigned long cpu_err0;
unsigned long cpu_err1;
unsigned long cia_err;
@@ -263,7 +280,6 @@ struct el_CIA_sysdata_mcheck {
unsigned long pci_err0;
unsigned long pci_err1;
unsigned long pci_err2;
-#endif
};
@@ -282,6 +298,8 @@ struct el_CIA_sysdata_mcheck {
* get at PCI memory and I/O.
*/
+#define vucp volatile unsigned char *
+#define vusp volatile unsigned short *
#define vip volatile int *
#define vuip volatile unsigned int *
#define vulp volatile unsigned long *
@@ -325,6 +343,44 @@ __EXTERN_INLINE void cia_outl(unsigned int b, unsigned long addr)
mb();
}
+__EXTERN_INLINE unsigned int cia_bwx_inb(unsigned long addr)
+{
+ /* ??? I wish I could get rid of this. But there's no ioremap
+ equivalent for I/O space. PCI I/O can be forced into the
+ CIA BWX I/O region, but that doesn't take care of legacy
+ ISA crap. */
+
+ return __kernel_ldbu(*(vucp)(addr+CIA_BW_IO));
+}
+
+__EXTERN_INLINE void cia_bwx_outb(unsigned char b, unsigned long addr)
+{
+ __kernel_stb(b, *(vucp)(addr+CIA_BW_IO));
+ mb();
+}
+
+__EXTERN_INLINE unsigned int cia_bwx_inw(unsigned long addr)
+{
+ return __kernel_ldwu(*(vusp)(addr+CIA_BW_IO));
+}
+
+__EXTERN_INLINE void cia_bwx_outw(unsigned short b, unsigned long addr)
+{
+ __kernel_stw(b, *(vusp)(addr+CIA_BW_IO));
+ mb();
+}
+
+__EXTERN_INLINE unsigned int cia_bwx_inl(unsigned long addr)
+{
+ return *(vuip)(addr+CIA_BW_IO);
+}
+
+__EXTERN_INLINE void cia_bwx_outl(unsigned int b, unsigned long addr)
+{
+ *(vuip)(addr+CIA_BW_IO) = b;
+ mb();
+}
+
/*
* Memory functions. 64-bit and 32-bit accesses are done through
@@ -362,15 +418,7 @@ __EXTERN_INLINE unsigned long cia_readb(unsigned long addr)
{
unsigned long result;
-#if !CIA_ONE_HAE_WINDOW
- unsigned long msb;
- /* Note that CIA_DENSE_MEM has no bits not masked in these
- operations, so we don't have to subtract it back out. */
- msb = addr & 0xE0000000;
- set_hae(msb);
-#endif
addr &= CIA_MEM_R1_MASK;
-
result = *(vip) ((addr << 5) + CIA_SPARSE_MEM + 0x00);
return __kernel_extbl(result, addr & 3);
}
@@ -379,15 +427,7 @@ __EXTERN_INLINE unsigned long cia_readw(unsigned long addr)
{
unsigned long result;
-#if !CIA_ONE_HAE_WINDOW
- unsigned long msb;
- /* Note that CIA_DENSE_MEM has no bits not masked in these
- operations, so we don't have to subtract it back out. */
- msb = addr & 0xE0000000;
- set_hae(msb);
-#endif
addr &= CIA_MEM_R1_MASK;
-
result = *(vip) ((addr << 5) + CIA_SPARSE_MEM + 0x08);
return __kernel_extwl(result, addr & 3);
}
@@ -396,15 +436,7 @@ __EXTERN_INLINE void cia_writeb(unsigned char b, unsigned long addr)
{
unsigned long w;
-#if !CIA_ONE_HAE_WINDOW
- unsigned long msb;
- /* Note that CIA_DENSE_MEM has no bits not masked in these
- operations, so we don't have to subtract it back out. */
- msb = addr & 0xE0000000;
- set_hae(msb);
-#endif
addr &= CIA_MEM_R1_MASK;
-
w = __kernel_insbl(b, addr & 3);
*(vuip) ((addr << 5) + CIA_SPARSE_MEM + 0x00) = w;
}
@@ -413,15 +445,7 @@ __EXTERN_INLINE void cia_writew(unsigned short b, unsigned long addr)
{
unsigned long w;
-#if !CIA_ONE_HAE_WINDOW
- unsigned long msb;
- /* Note that CIA_DENSE_MEM has no bits not masked in these
- operations, so we don't have to subtract it back out. */
- msb = addr & 0xE0000000;
- set_hae(msb);
-#endif
addr &= CIA_MEM_R1_MASK;
-
w = __kernel_inswl(b, addr & 3);
*(vuip) ((addr << 5) + CIA_SPARSE_MEM + 0x08) = w;
}
@@ -451,44 +475,117 @@ __EXTERN_INLINE unsigned long cia_ioremap(unsigned long addr)
return addr + CIA_DENSE_MEM;
}
+__EXTERN_INLINE unsigned long cia_bwx_readb(unsigned long addr)
+{
+ return __kernel_ldbu(*(vucp)addr);
+}
+
+__EXTERN_INLINE unsigned long cia_bwx_readw(unsigned long addr)
+{
+ return __kernel_ldwu(*(vusp)addr);
+}
+
+__EXTERN_INLINE unsigned long cia_bwx_readl(unsigned long addr)
+{
+ return *(vuip)addr;
+}
+
+__EXTERN_INLINE unsigned long cia_bwx_readq(unsigned long addr)
+{
+ return *(vulp)addr;
+}
+
+__EXTERN_INLINE void cia_bwx_writeb(unsigned char b, unsigned long addr)
+{
+ __kernel_stb(b, *(vucp)addr);
+}
+
+__EXTERN_INLINE void cia_bwx_writew(unsigned short b, unsigned long addr)
+{
+ __kernel_stw(b, *(vusp)addr);
+}
+
+__EXTERN_INLINE void cia_bwx_writel(unsigned int b, unsigned long addr)
+{
+ *(vuip)addr = b;
+}
+
+__EXTERN_INLINE void cia_bwx_writeq(unsigned long b, unsigned long addr)
+{
+ *(vulp)addr = b;
+}
+
+__EXTERN_INLINE unsigned long cia_bwx_ioremap(unsigned long addr)
+{
+ return addr + CIA_BW_MEM;
+}
+
__EXTERN_INLINE int cia_is_ioaddr(unsigned long addr)
{
return addr >= IDENT_ADDR + 0x8000000000UL;
}
+#undef vucp
+#undef vusp
#undef vip
#undef vuip
#undef vulp
#ifdef __WANT_IO_DEF
-#define __inb cia_inb
-#define __inw cia_inw
-#define __inl cia_inl
-#define __outb cia_outb
-#define __outw cia_outw
-#define __outl cia_outl
-
-#define __readb cia_readb
-#define __readw cia_readw
-#define __writeb cia_writeb
-#define __writew cia_writew
-#define __readl cia_readl
-#define __readq cia_readq
-#define __writel cia_writel
-#define __writeq cia_writeq
-#define __ioremap cia_ioremap
-#define __is_ioaddr cia_is_ioaddr
-
-#define inb(port) \
- (__builtin_constant_p((port))?__inb(port):_inb(port))
-#define outb(x, port) \
- (__builtin_constant_p((port))?__outb((x),(port)):_outb((x),(port)))
-
-#define __raw_readl(a) __readl((unsigned long)(a))
-#define __raw_readq(a) __readq((unsigned long)(a))
-#define __raw_writel(v,a) __writel((v),(unsigned long)(a))
-#define __raw_writeq(v,a) __writeq((v),(unsigned long)(a))
+#ifdef CONFIG_ALPHA_PYXIS
+# define __inb(p) cia_bwx_inb((unsigned long)(p))
+# define __inw(p) cia_bwx_inw((unsigned long)(p))
+# define __inl(p) cia_bwx_inl((unsigned long)(p))
+# define __outb(x,p) cia_bwx_outb((x),(unsigned long)(p))
+# define __outw(x,p) cia_bwx_outw((x),(unsigned long)(p))
+# define __outl(x,p) cia_bwx_outl((x),(unsigned long)(p))
+# define __readb(a) cia_bwx_readb((unsigned long)(a))
+# define __readw(a) cia_bwx_readw((unsigned long)(a))
+# define __readl(a) cia_bwx_readl((unsigned long)(a))
+# define __readq(a) cia_bwx_readq((unsigned long)(a))
+# define __writeb(x,a) cia_bwx_writeb((x),(unsigned long)(a))
+# define __writew(x,a) cia_bwx_writew((x),(unsigned long)(a))
+# define __writel(x,a) cia_bwx_writel((x),(unsigned long)(a))
+# define __writeq(x,a) cia_bwx_writeq((x),(unsigned long)(a))
+# define __ioremap(a) cia_bwx_ioremap((unsigned long)(a))
+# define inb(p) __inb(p)
+# define inw(p) __inw(p)
+# define inl(p) __inl(p)
+# define outb(x,p) __outb((x),(p))
+# define outw(x,p) __outw((x),(p))
+# define outl(x,p) __outl((x),(p))
+# define __raw_readb(a) __readb(a)
+# define __raw_readw(a) __readw(a)
+# define __raw_readl(a) __readl(a)
+# define __raw_readq(a) __readq(a)
+# define __raw_writeb(x,a) __writeb((x),(a))
+# define __raw_writew(x,a) __writew((x),(a))
+# define __raw_writel(x,a) __writel((x),(a))
+# define __raw_writeq(x,a) __writeq((x),(a))
+#else
+# define __inb(p) cia_inb((unsigned long)(p))
+# define __inw(p) cia_inw((unsigned long)(p))
+# define __inl(p) cia_inl((unsigned long)(p))
+# define __outb(x,p) cia_outb((x),(unsigned long)(p))
+# define __outw(x,p) cia_outw((x),(unsigned long)(p))
+# define __outl(x,p) cia_outl((x),(unsigned long)(p))
+# define __readb(a) cia_readb((unsigned long)(a))
+# define __readw(a) cia_readw((unsigned long)(a))
+# define __readl(a) cia_readl((unsigned long)(a))
+# define __readq(a) cia_readq((unsigned long)(a))
+# define __writeb(x,a) cia_writeb((x),(unsigned long)(a))
+# define __writew(x,a) cia_writew((x),(unsigned long)(a))
+# define __writel(x,a) cia_writel((x),(unsigned long)(a))
+# define __writeq(x,a) cia_writeq((x),(unsigned long)(a))
+# define __ioremap(a) cia_ioremap((unsigned long)(a))
+# define __raw_readl(a) __readl(a)
+# define __raw_readq(a) __readq(a)
+# define __raw_writel(v,a) __writel((v),(a))
+# define __raw_writeq(v,a) __writeq((v),(a))
+#endif /* PYXIS */
+
+#define __is_ioaddr(a) cia_is_ioaddr((unsigned long)(a))
#endif /* __WANT_IO_DEF */
diff --git a/include/asm-alpha/core_irongate.h b/include/asm-alpha/core_irongate.h
index 5c30feb37..c97283d89 100644
--- a/include/asm-alpha/core_irongate.h
+++ b/include/asm-alpha/core_irongate.h
@@ -493,38 +493,37 @@ __EXTERN_INLINE int irongate_is_ioaddr(unsigned long addr)
#ifdef __WANT_IO_DEF
-#define __inb irongate_inb
-#define __inw irongate_inw
-#define __inl irongate_inl
-#define __outb irongate_outb
-#define __outw irongate_outw
-#define __outl irongate_outl
-#define __readb irongate_readb
-#define __readw irongate_readw
-#define __writeb irongate_writeb
-#define __writew irongate_writew
-#define __readl irongate_readl
-#define __readq irongate_readq
-#define __writel irongate_writel
-#define __writeq irongate_writeq
-#define __ioremap irongate_ioremap
-#define __is_ioaddr irongate_is_ioaddr
-
-#define inb(port) __inb((port))
-#define inw(port) __inw((port))
-#define inl(port) __inl((port))
-#define outb(v, port) __outb((v),(port))
-#define outw(v, port) __outw((v),(port))
-#define outl(v, port) __outl((v),(port))
-
-#define __raw_readb(a) __readb((unsigned long)(a))
-#define __raw_readw(a) __readw((unsigned long)(a))
-#define __raw_readl(a) __readl((unsigned long)(a))
-#define __raw_readq(a) __readq((unsigned long)(a))
-#define __raw_writeb(v,a) __writeb((v),(unsigned long)(a))
-#define __raw_writew(v,a) __writew((v),(unsigned long)(a))
-#define __raw_writel(v,a) __writel((v),(unsigned long)(a))
-#define __raw_writeq(v,a) __writeq((v),(unsigned long)(a))
+#define __inb(p) irongate_inb((unsigned long)(p))
+#define __inw(p) irongate_inw((unsigned long)(p))
+#define __inl(p) irongate_inl((unsigned long)(p))
+#define __outb(x,p) irongate_outb((x),(unsigned long)(p))
+#define __outw(x,p) irongate_outw((x),(unsigned long)(p))
+#define __outl(x,p) irongate_outl((x),(unsigned long)(p))
+#define __readb(a) irongate_readb((unsigned long)(a))
+#define __readw(a) irongate_readw((unsigned long)(a))
+#define __readl(a) irongate_readl((unsigned long)(a))
+#define __readq(a) irongate_readq((unsigned long)(a))
+#define __writeb(x,a) irongate_writeb((x),(unsigned long)(a))
+#define __writew(x,a) irongate_writew((x),(unsigned long)(a))
+#define __writel(x,a) irongate_writel((x),(unsigned long)(a))
+#define __writeq(x,a) irongate_writeq((x),(unsigned long)(a))
+#define __ioremap(a) irongate_ioremap((unsigned long)(a))
+#define __is_ioaddr(a) irongate_is_ioaddr((unsigned long)(a))
+
+#define inb(p) __inb(p)
+#define inw(p) __inw(p)
+#define inl(p) __inl(p)
+#define outb(x,p) __outb((x),(p))
+#define outw(x,p) __outw((x),(p))
+#define outl(x,p) __outl((x),(p))
+#define __raw_readb(a) __readb(a)
+#define __raw_readw(a) __readw(a)
+#define __raw_readl(a) __readl(a)
+#define __raw_readq(a) __readq(a)
+#define __raw_writeb(v,a) __writeb((v),(a))
+#define __raw_writew(v,a) __writew((v),(a))
+#define __raw_writel(v,a) __writel((v),(a))
+#define __raw_writeq(v,a) __writeq((v),(a))
#endif /* __WANT_IO_DEF */
diff --git a/include/asm-alpha/core_lca.h b/include/asm-alpha/core_lca.h
index 6ba2bbd83..28b899308 100644
--- a/include/asm-alpha/core_lca.h
+++ b/include/asm-alpha/core_lca.h
@@ -360,32 +360,27 @@ __EXTERN_INLINE int lca_is_ioaddr(unsigned long addr)
#ifdef __WANT_IO_DEF
-#define __inb lca_inb
-#define __inw lca_inw
-#define __inl lca_inl
-#define __outb lca_outb
-#define __outw lca_outw
-#define __outl lca_outl
-#define __readb lca_readb
-#define __readw lca_readw
-#define __writeb lca_writeb
-#define __writew lca_writew
-#define __readl lca_readl
-#define __readq lca_readq
-#define __writel lca_writel
-#define __writeq lca_writeq
-#define __ioremap lca_ioremap
-#define __is_ioaddr lca_is_ioaddr
-
-#define inb(port) \
- (__builtin_constant_p((port))?__inb(port):_inb(port))
-#define outb(x, port) \
- (__builtin_constant_p((port))?__outb((x),(port)):_outb((x),(port)))
-
-#define __raw_readl(a) __readl((unsigned long)(a))
-#define __raw_readq(a) __readq((unsigned long)(a))
-#define __raw_writel(v,a) __writel((v),(unsigned long)(a))
-#define __raw_writeq(v,a) __writeq((v),(unsigned long)(a))
+#define __inb(p) lca_inb((unsigned long)(p))
+#define __inw(p) lca_inw((unsigned long)(p))
+#define __inl(p) lca_inl((unsigned long)(p))
+#define __outb(x,p) lca_outb((x),(unsigned long)(p))
+#define __outw(x,p) lca_outw((x),(unsigned long)(p))
+#define __outl(x,p) lca_outl((x),(unsigned long)(p))
+#define __readb(a) lca_readb((unsigned long)(a))
+#define __readw(a) lca_readw((unsigned long)(a))
+#define __readl(a) lca_readl((unsigned long)(a))
+#define __readq(a) lca_readq((unsigned long)(a))
+#define __writeb(x,a) lca_writeb((x),(unsigned long)(a))
+#define __writew(x,a) lca_writew((x),(unsigned long)(a))
+#define __writel(x,a) lca_writel((x),(unsigned long)(a))
+#define __writeq(x,a) lca_writeq((x),(unsigned long)(a))
+#define __ioremap(a) lca_ioremap((unsigned long)(a))
+#define __is_ioaddr(a) lca_is_ioaddr((unsigned long)(a))
+
+#define __raw_readl(a) __readl(a)
+#define __raw_readq(a) __readq(a)
+#define __raw_writel(v,a) __writel((v),(a))
+#define __raw_writeq(v,a) __writeq((v),(a))
#endif /* __WANT_IO_DEF */
diff --git a/include/asm-alpha/core_mcpcia.h b/include/asm-alpha/core_mcpcia.h
index bc3e44267..d35ad9190 100644
--- a/include/asm-alpha/core_mcpcia.h
+++ b/include/asm-alpha/core_mcpcia.h
@@ -438,32 +438,27 @@ __EXTERN_INLINE void mcpcia_writeq(unsigned long b, unsigned long addr)
#ifdef __WANT_IO_DEF
-#define __inb mcpcia_inb
-#define __inw mcpcia_inw
-#define __inl mcpcia_inl
-#define __outb mcpcia_outb
-#define __outw mcpcia_outw
-#define __outl mcpcia_outl
-#define __readb mcpcia_readb
-#define __readw mcpcia_readw
-#define __writeb mcpcia_writeb
-#define __writew mcpcia_writew
-#define __readl mcpcia_readl
-#define __readq mcpcia_readq
-#define __writel mcpcia_writel
-#define __writeq mcpcia_writeq
-#define __ioremap mcpcia_ioremap
-#define __is_ioaddr mcpcia_is_ioaddr
-
-# define inb(port) \
- (__builtin_constant_p((port))?__inb(port):_inb(port))
-# define outb(x, port) \
- (__builtin_constant_p((port))?__outb((x),(port)):_outb((x),(port)))
-
-#define __raw_readl(a) __readl((unsigned long)(a))
-#define __raw_readq(a) __readq((unsigned long)(a))
-#define __raw_writel(v,a) __writel((v),(unsigned long)(a))
-#define __raw_writeq(v,a) __writeq((v),(unsigned long)(a))
+#define __inb(p) mcpcia_inb((unsigned long)(p))
+#define __inw(p) mcpcia_inw((unsigned long)(p))
+#define __inl(p) mcpcia_inl((unsigned long)(p))
+#define __outb(x,p) mcpcia_outb((x),(unsigned long)(p))
+#define __outw(x,p) mcpcia_outw((x),(unsigned long)(p))
+#define __outl(x,p) mcpcia_outl((x),(unsigned long)(p))
+#define __readb(a) mcpcia_readb((unsigned long)(a))
+#define __readw(a) mcpcia_readw((unsigned long)(a))
+#define __readl(a) mcpcia_readl((unsigned long)(a))
+#define __readq(a) mcpcia_readq((unsigned long)(a))
+#define __writeb(x,a) mcpcia_writeb((x),(unsigned long)(a))
+#define __writew(x,a) mcpcia_writew((x),(unsigned long)(a))
+#define __writel(x,a) mcpcia_writel((x),(unsigned long)(a))
+#define __writeq(x,a) mcpcia_writeq((x),(unsigned long)(a))
+#define __ioremap(a) mcpcia_ioremap((unsigned long)(a))
+#define __is_ioaddr(a) mcpcia_is_ioaddr((unsigned long)(a))
+
+#define __raw_readl(a) __readl(a)
+#define __raw_readq(a) __readq(a)
+#define __raw_writel(v,a) __writel((v),(a))
+#define __raw_writeq(v,a) __writeq((v),(a))
#endif /* __WANT_IO_DEF */
diff --git a/include/asm-alpha/core_polaris.h b/include/asm-alpha/core_polaris.h
index 626b24a22..88a0573d2 100644
--- a/include/asm-alpha/core_polaris.h
+++ b/include/asm-alpha/core_polaris.h
@@ -170,38 +170,37 @@ __EXTERN_INLINE int polaris_is_ioaddr(unsigned long addr)
#ifdef __WANT_IO_DEF
-#define __inb polaris_inb
-#define __inw polaris_inw
-#define __inl polaris_inl
-#define __outb polaris_outb
-#define __outw polaris_outw
-#define __outl polaris_outl
-#define __readb polaris_readb
-#define __readw polaris_readw
-#define __writeb polaris_writeb
-#define __writew polaris_writew
-#define __readl polaris_readl
-#define __readq polaris_readq
-#define __writel polaris_writel
-#define __writeq polaris_writeq
-#define __ioremap polaris_ioremap
-#define __is_ioaddr polaris_is_ioaddr
-
-#define inb(port) __inb((port))
-#define inw(port) __inw((port))
-#define inl(port) __inl((port))
-#define outb(v, port) __outb((v),(port))
-#define outw(v, port) __outw((v),(port))
-#define outl(v, port) __outl((v),(port))
-
-#define __raw_readb(a) __readb((unsigned long)(a))
-#define __raw_readw(a) __readw((unsigned long)(a))
-#define __raw_readl(a) __readl((unsigned long)(a))
-#define __raw_readq(a) __readq((unsigned long)(a))
-#define __raw_writeb(v,a) __writeb((v),(unsigned long)(a))
-#define __raw_writew(v,a) __writew((v),(unsigned long)(a))
-#define __raw_writel(v,a) __writel((v),(unsigned long)(a))
-#define __raw_writeq(v,a) __writeq((v),(unsigned long)(a))
+#define __inb(p) polaris_inb((unsigned long)(p))
+#define __inw(p) polaris_inw((unsigned long)(p))
+#define __inl(p) polaris_inl((unsigned long)(p))
+#define __outb(x,p) polaris_outb((x),(unsigned long)(p))
+#define __outw(x,p) polaris_outw((x),(unsigned long)(p))
+#define __outl(x,p) polaris_outl((x),(unsigned long)(p))
+#define __readb(a) polaris_readb((unsigned long)(a))
+#define __readw(a) polaris_readw((unsigned long)(a))
+#define __readl(a) polaris_readl((unsigned long)(a))
+#define __readq(a) polaris_readq((unsigned long)(a))
+#define __writeb(x,a) polaris_writeb((x),(unsigned long)(a))
+#define __writew(x,a) polaris_writew((x),(unsigned long)(a))
+#define __writel(x,a) polaris_writel((x),(unsigned long)(a))
+#define __writeq(x,a) polaris_writeq((x),(unsigned long)(a))
+#define __ioremap(a) polaris_ioremap((unsigned long)(a))
+#define __is_ioaddr(a) polaris_is_ioaddr((unsigned long)(a))
+
+#define inb(p) __inb(p)
+#define inw(p) __inw(p)
+#define inl(p) __inl(p)
+#define outb(x,p) __outb((x),(p))
+#define outw(x,p) __outw((x),(p))
+#define outl(x,p) __outl((x),(p))
+#define __raw_readb(a) __readb(a)
+#define __raw_readw(a) __readw(a)
+#define __raw_readl(a) __readl(a)
+#define __raw_readq(a) __readq(a)
+#define __raw_writeb(v,a) __writeb((v),(a))
+#define __raw_writew(v,a) __writew((v),(a))
+#define __raw_writel(v,a) __writel((v),(a))
+#define __raw_writeq(v,a) __writeq((v),(a))
#endif /* __WANT_IO_DEF */
diff --git a/include/asm-alpha/core_pyxis.h b/include/asm-alpha/core_pyxis.h
deleted file mode 100644
index 18b523ef4..000000000
--- a/include/asm-alpha/core_pyxis.h
+++ /dev/null
@@ -1,444 +0,0 @@
-#ifndef __ALPHA_PYXIS__H__
-#define __ALPHA_PYXIS__H__
-
-#include <linux/types.h>
-#include <asm/compiler.h>
-
-/*
- * PYXIS is the internal name for a core logic chipset which provides
- * memory controller and PCI access for the 21164A chip based systems.
- *
- * This file is based on:
- *
- * Pyxis Chipset Spec
- * 14-Jun-96
- * Rev. X2.0
- *
- */
-
-/*------------------------------------------------------------------------**
-** **
-** I/O procedures **
-** **
-** inport[b|w|t|l], outport[b|w|t|l] 8:16:24:32 IO xfers **
-** inportbxt: 8 bits only **
-** inport: alias of inportw **
-** outport: alias of outportw **
-** **
-** inmem[b|w|t|l], outmem[b|w|t|l] 8:16:24:32 ISA memory xfers **
-** inmembxt: 8 bits only **
-** inmem: alias of inmemw **
-** outmem: alias of outmemw **
-** **
-**------------------------------------------------------------------------*/
-
-
-/* PYXIS ADDRESS BIT DEFINITIONS
- *
- * 3333 3333 3322 2222 2222 1111 1111 11
- * 9876 5432 1098 7654 3210 9876 5432 1098 7654 3210
- * ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
- * 1 000
- * ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
- * | |\|
- * | Byte Enable --+ |
- * | Transfer Length --+
- * +-- IO space, not cached
- *
- * Byte Transfer
- * Enable Length Transfer Byte Address
- * adr<6:5> adr<4:3> Length Enable Adder
- * ---------------------------------------------
- * 00 00 Byte 1110 0x000
- * 01 00 Byte 1101 0x020
- * 10 00 Byte 1011 0x040
- * 11 00 Byte 0111 0x060
- *
- * 00 01 Word 1100 0x008
- * 01 01 Word 1001 0x028 <= Not supported in this code.
- * 10 01 Word 0011 0x048
- *
- * 00 10 Tribyte 1000 0x010
- * 01 10 Tribyte 0001 0x030
- *
- * 10 11 Longword 0000 0x058
- *
- * Note that byte enables are asserted low.
- *
- */
-
-#define PYXIS_MEM_R1_MASK 0x1fffffff /* SPARSE Mem region 1 mask is 29 bits */
-#define PYXIS_MEM_R2_MASK 0x07ffffff /* SPARSE Mem region 2 mask is 27 bits */
-#define PYXIS_MEM_R3_MASK 0x03ffffff /* SPARSE Mem region 3 mask is 26 bits */
-
-/*
- * General Registers
- */
-#define PYXIS_REV (IDENT_ADDR + 0x8740000080UL)
-#define PYXIS_PCI_LAT (IDENT_ADDR + 0x87400000C0UL)
-#define PYXIS_CTRL (IDENT_ADDR + 0x8740000100UL)
-#define PYXIS_CTRL1 (IDENT_ADDR + 0x8740000140UL)
-#define PYXIS_FLASH_CTRL (IDENT_ADDR + 0x8740000200UL)
-
-#define PYXIS_HAE_MEM (IDENT_ADDR + 0x8740000400UL)
-#define PYXIS_HAE_IO (IDENT_ADDR + 0x8740000440UL)
-#define PYXIS_CFG (IDENT_ADDR + 0x8740000480UL)
-
-/*
- * Diagnostic Registers
- */
-#define PYXIS_DIAG (IDENT_ADDR + 0x8740002000UL)
-#define PYXIS_DIAG_CHECK (IDENT_ADDR + 0x8740003000UL)
-
-/*
- * Performance Monitor registers
- */
-#define PYXIS_PERF_MONITOR (IDENT_ADDR + 0x8740004000UL)
-#define PYXIS_PERF_CONTROL (IDENT_ADDR + 0x8740004040UL)
-
-/*
- * Error registers
- */
-#define PYXIS_ERR (IDENT_ADDR + 0x8740008200UL)
-#define PYXIS_STAT (IDENT_ADDR + 0x8740008240UL)
-#define PYXIS_ERR_MASK (IDENT_ADDR + 0x8740008280UL)
-#define PYXIS_SYN (IDENT_ADDR + 0x8740008300UL)
-#define PYXIS_ERR_DATA (IDENT_ADDR + 0x8740008308UL)
-
-#define PYXIS_MEAR (IDENT_ADDR + 0x8740008400UL)
-#define PYXIS_MESR (IDENT_ADDR + 0x8740008440UL)
-#define PYXIS_PCI_ERR0 (IDENT_ADDR + 0x8740008800UL)
-#define PYXIS_PCI_ERR1 (IDENT_ADDR + 0x8740008840UL)
-#define PYXIS_PCI_ERR2 (IDENT_ADDR + 0x8740008880UL)
-
-/*
- * PCI Address Translation Registers.
- */
-#define PYXIS_TBIA (IDENT_ADDR + 0x8760000100UL)
-
-#define PYXIS_W0_BASE (IDENT_ADDR + 0x8760000400UL)
-#define PYXIS_W0_MASK (IDENT_ADDR + 0x8760000440UL)
-#define PYXIS_T0_BASE (IDENT_ADDR + 0x8760000480UL)
-
-#define PYXIS_W1_BASE (IDENT_ADDR + 0x8760000500UL)
-#define PYXIS_W1_MASK (IDENT_ADDR + 0x8760000540UL)
-#define PYXIS_T1_BASE (IDENT_ADDR + 0x8760000580UL)
-
-#define PYXIS_W2_BASE (IDENT_ADDR + 0x8760000600UL)
-#define PYXIS_W2_MASK (IDENT_ADDR + 0x8760000640UL)
-#define PYXIS_T2_BASE (IDENT_ADDR + 0x8760000680UL)
-
-#define PYXIS_W3_BASE (IDENT_ADDR + 0x8760000700UL)
-#define PYXIS_W3_MASK (IDENT_ADDR + 0x8760000740UL)
-#define PYXIS_T3_BASE (IDENT_ADDR + 0x8760000780UL)
-
-/*
- * Memory Control registers
- */
-#define PYXIS_MCR (IDENT_ADDR + 0x8750000000UL)
-
-/*
- * Memory spaces:
- */
-#define PYXIS_IACK_SC (IDENT_ADDR + 0x8720000000UL)
-#define PYXIS_CONF (IDENT_ADDR + 0x8700000000UL)
-#define PYXIS_IO (IDENT_ADDR + 0x8580000000UL)
-#define PYXIS_SPARSE_MEM (IDENT_ADDR + 0x8000000000UL)
-#define PYXIS_SPARSE_MEM_R2 (IDENT_ADDR + 0x8400000000UL)
-#define PYXIS_SPARSE_MEM_R3 (IDENT_ADDR + 0x8500000000UL)
-#define PYXIS_DENSE_MEM (IDENT_ADDR + 0x8600000000UL)
-
-/*
- * Byte/Word PCI Memory Spaces:
- */
-#define PYXIS_BW_MEM (IDENT_ADDR + 0x8800000000UL)
-#define PYXIS_BW_IO (IDENT_ADDR + 0x8900000000UL)
-#define PYXIS_BW_CFG_0 (IDENT_ADDR + 0x8a00000000UL)
-#define PYXIS_BW_CFG_1 (IDENT_ADDR + 0x8b00000000UL)
-
-/*
- * Interrupt Control registers
- */
-#define PYXIS_INT_REQ (IDENT_ADDR + 0x87A0000000UL)
-#define PYXIS_INT_MASK (IDENT_ADDR + 0x87A0000040UL)
-#define PYXIS_INT_HILO (IDENT_ADDR + 0x87A00000C0UL)
-#define PYXIS_INT_ROUTE (IDENT_ADDR + 0x87A0000140UL)
-#define PYXIS_GPO (IDENT_ADDR + 0x87A0000180UL)
-#define PYXIS_INT_CNFG (IDENT_ADDR + 0x87A00001C0UL)
-#define PYXIS_RT_COUNT (IDENT_ADDR + 0x87A0000200UL)
-#define PYXIS_INT_TIME (IDENT_ADDR + 0x87A0000240UL)
-#define PYXIS_IIC_CTRL (IDENT_ADDR + 0x87A00002C0UL)
-#define PYXIS_RESET (IDENT_ADDR + 0x8780000900UL)
-
-/*
- * Bit definitions for I/O Controller status register 0:
- */
-#define PYXIS_STAT0_CMD 0xf
-#define PYXIS_STAT0_ERR (1<<4)
-#define PYXIS_STAT0_LOST (1<<5)
-#define PYXIS_STAT0_THIT (1<<6)
-#define PYXIS_STAT0_TREF (1<<7)
-#define PYXIS_STAT0_CODE_SHIFT 8
-#define PYXIS_STAT0_CODE_MASK 0x7
-#define PYXIS_STAT0_P_NBR_SHIFT 13
-#define PYXIS_STAT0_P_NBR_MASK 0x7ffff
-
-#define PYXIS_HAE_ADDRESS PYXIS_HAE_MEM
-
-/*
- * Data structure for handling PYXIS machine checks:
- */
-struct el_PYXIS_sysdata_mcheck {
-#if 0
- /* ??? Where did this come from. It appears to bear no
- relation to the pyxis logout written in the milo sources.
- Who knows what happens in the srm console... */
- u_long coma_gcr;
- u_long coma_edsr;
- u_long coma_ter;
- u_long coma_elar;
- u_long coma_ehar;
- u_long coma_ldlr;
- u_long coma_ldhr;
- u_long coma_base0;
- u_long coma_base1;
- u_long coma_base2;
- u_long coma_cnfg0;
- u_long coma_cnfg1;
- u_long coma_cnfg2;
- u_long epic_dcsr;
- u_long epic_pear;
- u_long epic_sear;
- u_long epic_tbr1;
- u_long epic_tbr2;
- u_long epic_pbr1;
- u_long epic_pbr2;
- u_long epic_pmr1;
- u_long epic_pmr2;
- u_long epic_harx1;
- u_long epic_harx2;
- u_long epic_pmlt;
- u_long epic_tag0;
- u_long epic_tag1;
- u_long epic_tag2;
- u_long epic_tag3;
- u_long epic_tag4;
- u_long epic_tag5;
- u_long epic_tag6;
- u_long epic_tag7;
- u_long epic_data0;
- u_long epic_data1;
- u_long epic_data2;
- u_long epic_data3;
- u_long epic_data4;
- u_long epic_data5;
- u_long epic_data6;
- u_long epic_data7;
-#else
- unsigned long cpu_err0;
- unsigned long cpu_err1;
- unsigned long cia_err;
- unsigned long cia_stat;
- unsigned long err_mask;
- unsigned long cia_syn;
- unsigned long mem_err0;
- unsigned long mem_err1;
- unsigned long pci_err0;
- unsigned long pci_err1;
- unsigned long pci_err2;
-#endif
-};
-
-
-#ifdef __KERNEL__
-
-#ifndef __EXTERN_INLINE
-#define __EXTERN_INLINE extern inline
-#define __IO_EXTERN_INLINE
-#endif
-
-/*
- * I/O functions:
- *
- * PYXIS, the 21174 PCI/memory support chipset for the EV56 (21164A)
- * and PCA56 (21164PC) processors, can use either a sparse address
- * mapping scheme, or the so-called byte-word PCI address space, to
- * get at PCI memory and I/O.
- */
-
-#define vucp volatile unsigned char *
-#define vusp volatile unsigned short *
-#define vip volatile int *
-#define vuip volatile unsigned int *
-#define vulp volatile unsigned long *
-
-__EXTERN_INLINE unsigned int pyxis_inb(unsigned long addr)
-{
- /* ??? I wish I could get rid of this. But there's no ioremap
- equivalent for I/O space. PCI I/O can be forced into the
- PYXIS I/O region, but that doesn't take care of legacy ISA crap. */
-
- return __kernel_ldbu(*(vucp)(addr+PYXIS_BW_IO));
-}
-
-__EXTERN_INLINE void pyxis_outb(unsigned char b, unsigned long addr)
-{
- __kernel_stb(b, *(vucp)(addr+PYXIS_BW_IO));
- mb();
-}
-
-__EXTERN_INLINE unsigned int pyxis_inw(unsigned long addr)
-{
- return __kernel_ldwu(*(vusp)(addr+PYXIS_BW_IO));
-}
-
-__EXTERN_INLINE void pyxis_outw(unsigned short b, unsigned long addr)
-{
- __kernel_stw(b, *(vusp)(addr+PYXIS_BW_IO));
- mb();
-}
-
-__EXTERN_INLINE unsigned int pyxis_inl(unsigned long addr)
-{
- return *(vuip)(addr+PYXIS_BW_IO);
-}
-
-__EXTERN_INLINE void pyxis_outl(unsigned int b, unsigned long addr)
-{
- *(vuip)(addr+PYXIS_BW_IO) = b;
- mb();
-}
-
-
-/*
- * Memory functions. 64-bit and 32-bit accesses are done through
- * dense memory space, everything else through sparse space.
- *
- * For reading and writing 8 and 16 bit quantities we need to
- * go through one of the three sparse address mapping regions
- * and use the HAE_MEM CSR to provide some bits of the address.
- * The following few routines use only sparse address region 1
- * which gives 1Gbyte of accessible space which relates exactly
- * to the amount of PCI memory mapping *into* system address space.
- * See p 6-17 of the specification but it looks something like this:
- *
- * 21164 Address:
- *
- * 3 2 1
- * 9876543210987654321098765432109876543210
- * 1ZZZZ0.PCI.QW.Address............BBLL
- *
- * ZZ = SBZ
- * BB = Byte offset
- * LL = Transfer length
- *
- * PCI Address:
- *
- * 3 2 1
- * 10987654321098765432109876543210
- * HHH....PCI.QW.Address........ 00
- *
- * HHH = 31:29 HAE_MEM CSR
- *
- */
-
-__EXTERN_INLINE unsigned long pyxis_readb(unsigned long addr)
-{
- return __kernel_ldbu(*(vucp)addr);
-}
-
-__EXTERN_INLINE unsigned long pyxis_readw(unsigned long addr)
-{
- return __kernel_ldwu(*(vusp)addr);
-}
-
-__EXTERN_INLINE unsigned long pyxis_readl(unsigned long addr)
-{
- return *(vuip)addr;
-}
-
-__EXTERN_INLINE unsigned long pyxis_readq(unsigned long addr)
-{
- return *(vulp)addr;
-}
-
-__EXTERN_INLINE void pyxis_writeb(unsigned char b, unsigned long addr)
-{
- __kernel_stb(b, *(vucp)addr);
-}
-
-__EXTERN_INLINE void pyxis_writew(unsigned short b, unsigned long addr)
-{
- __kernel_stw(b, *(vusp)addr);
-}
-
-__EXTERN_INLINE void pyxis_writel(unsigned int b, unsigned long addr)
-{
- *(vuip)addr = b;
-}
-
-__EXTERN_INLINE void pyxis_writeq(unsigned long b, unsigned long addr)
-{
- *(vulp)addr = b;
-}
-
-__EXTERN_INLINE unsigned long pyxis_ioremap(unsigned long addr)
-{
- return addr + PYXIS_BW_MEM;
-}
-
-__EXTERN_INLINE int pyxis_is_ioaddr(unsigned long addr)
-{
- return addr >= IDENT_ADDR + 0x8740000000UL;
-}
-
-#undef vucp
-#undef vusp
-#undef vip
-#undef vuip
-#undef vulp
-
-#ifdef __WANT_IO_DEF
-
-#define __inb pyxis_inb
-#define __inw pyxis_inw
-#define __inl pyxis_inl
-#define __outb pyxis_outb
-#define __outw pyxis_outw
-#define __outl pyxis_outl
-#define __readb pyxis_readb
-#define __readw pyxis_readw
-#define __writeb pyxis_writeb
-#define __writew pyxis_writew
-#define __readl pyxis_readl
-#define __readq pyxis_readq
-#define __writel pyxis_writel
-#define __writeq pyxis_writeq
-#define __ioremap pyxis_ioremap
-#define __is_ioaddr pyxis_is_ioaddr
-
-#define inb(port) __inb((port))
-#define inw(port) __inw((port))
-#define inl(port) __inl((port))
-#define outb(x, port) __outb((x),(port))
-#define outw(x, port) __outw((x),(port))
-#define outl(x, port) __outl((x),(port))
-#define __raw_readb(addr) __readb((addr))
-#define __raw_readw(addr) __readw((addr))
-#define __raw_writeb(b, addr) __writeb((b),(addr))
-#define __raw_writew(b, addr) __writew((b),(addr))
-#define __raw_readl(a) __readl((unsigned long)(a))
-#define __raw_readq(a) __readq((unsigned long)(a))
-#define __raw_writel(v,a) __writel((v),(unsigned long)(a))
-#define __raw_writeq(v,a) __writeq((v),(unsigned long)(a))
-
-#endif /* __WANT_IO_DEF */
-
-#ifdef __IO_EXTERN_INLINE
-#undef __EXTERN_INLINE
-#undef __IO_EXTERN_INLINE
-#endif
-
-#endif /* __KERNEL__ */
-
-#endif /* __ALPHA_PYXIS__H__ */
diff --git a/include/asm-alpha/core_t2.h b/include/asm-alpha/core_t2.h
index d11506cd5..4eab7fa64 100644
--- a/include/asm-alpha/core_t2.h
+++ b/include/asm-alpha/core_t2.h
@@ -516,27 +516,22 @@ __EXTERN_INLINE int t2_is_ioaddr(unsigned long addr)
#ifdef __WANT_IO_DEF
-#define __inb t2_inb
-#define __inw t2_inw
-#define __inl t2_inl
-#define __outb t2_outb
-#define __outw t2_outw
-#define __outl t2_outl
-#define __readb t2_readb
-#define __readw t2_readw
-#define __readl t2_readl
-#define __readq t2_readq
-#define __writeb t2_writeb
-#define __writew t2_writew
-#define __writel t2_writel
-#define __writeq t2_writeq
-#define __ioremap t2_ioremap
-#define __is_ioaddr t2_is_ioaddr
-
-#define inb(port) \
- (__builtin_constant_p((port))?__inb(port):_inb(port))
-#define outb(x, port) \
- (__builtin_constant_p((port))?__outb((x),(port)):_outb((x),(port)))
+#define __inb(p) t2_inb((unsigned long)(p))
+#define __inw(p) t2_inw((unsigned long)(p))
+#define __inl(p) t2_inl((unsigned long)(p))
+#define __outb(x,p) t2_outb((x),(unsigned long)(p))
+#define __outw(x,p) t2_outw((x),(unsigned long)(p))
+#define __outl(x,p) t2_outl((x),(unsigned long)(p))
+#define __readb(a) t2_readb((unsigned long)(a))
+#define __readw(a) t2_readw((unsigned long)(a))
+#define __readl(a) t2_readl((unsigned long)(a))
+#define __readq(a) t2_readq((unsigned long)(a))
+#define __writeb(x,a) t2_writeb((x),(unsigned long)(a))
+#define __writew(x,a) t2_writew((x),(unsigned long)(a))
+#define __writel(x,a) t2_writel((x),(unsigned long)(a))
+#define __writeq(x,a) t2_writeq((x),(unsigned long)(a))
+#define __ioremap(a) t2_ioremap((unsigned long)(a))
+#define __is_ioaddr(a) t2_is_ioaddr((unsigned long)(a))
#endif /* __WANT_IO_DEF */
diff --git a/include/asm-alpha/core_tsunami.h b/include/asm-alpha/core_tsunami.h
index ffbcc5c34..5d0d7cf7a 100644
--- a/include/asm-alpha/core_tsunami.h
+++ b/include/asm-alpha/core_tsunami.h
@@ -405,38 +405,37 @@ __EXTERN_INLINE void tsunami_writeq(unsigned long b, unsigned long addr)
#ifdef __WANT_IO_DEF
-#define __inb tsunami_inb
-#define __inw tsunami_inw
-#define __inl tsunami_inl
-#define __outb tsunami_outb
-#define __outw tsunami_outw
-#define __outl tsunami_outl
-#define __readb tsunami_readb
-#define __readw tsunami_readw
-#define __writeb tsunami_writeb
-#define __writew tsunami_writew
-#define __readl tsunami_readl
-#define __readq tsunami_readq
-#define __writel tsunami_writel
-#define __writeq tsunami_writeq
-#define __ioremap tsunami_ioremap
-#define __is_ioaddr tsunami_is_ioaddr
-
-#define inb(port) __inb((port))
-#define inw(port) __inw((port))
-#define inl(port) __inl((port))
-#define outb(v, port) __outb((v),(port))
-#define outw(v, port) __outw((v),(port))
-#define outl(v, port) __outl((v),(port))
-
-#define __raw_readb(a) __readb((unsigned long)(a))
-#define __raw_readw(a) __readw((unsigned long)(a))
-#define __raw_readl(a) __readl((unsigned long)(a))
-#define __raw_readq(a) __readq((unsigned long)(a))
-#define __raw_writeb(v,a) __writeb((v),(unsigned long)(a))
-#define __raw_writew(v,a) __writew((v),(unsigned long)(a))
-#define __raw_writel(v,a) __writel((v),(unsigned long)(a))
-#define __raw_writeq(v,a) __writeq((v),(unsigned long)(a))
+#define __inb(p) tsunami_inb((unsigned long)(p))
+#define __inw(p) tsunami_inw((unsigned long)(p))
+#define __inl(p) tsunami_inl((unsigned long)(p))
+#define __outb(x,p) tsunami_outb((x),(unsigned long)(p))
+#define __outw(x,p) tsunami_outw((x),(unsigned long)(p))
+#define __outl(x,p) tsunami_outl((x),(unsigned long)(p))
+#define __readb(a) tsunami_readb((unsigned long)(a))
+#define __readw(a) tsunami_readw((unsigned long)(a))
+#define __readl(a) tsunami_readl((unsigned long)(a))
+#define __readq(a) tsunami_readq((unsigned long)(a))
+#define __writeb(x,a) tsunami_writeb((x),(unsigned long)(a))
+#define __writew(x,a) tsunami_writew((x),(unsigned long)(a))
+#define __writel(x,a) tsunami_writel((x),(unsigned long)(a))
+#define __writeq(x,a) tsunami_writeq((x),(unsigned long)(a))
+#define __ioremap(a) tsunami_ioremap((unsigned long)(a))
+#define __is_ioaddr(a) tsunami_is_ioaddr((unsigned long)(a))
+
+#define inb(p) __inb(p)
+#define inw(p) __inw(p)
+#define inl(p) __inl(p)
+#define outb(x,p) __outb((x),(p))
+#define outw(x,p) __outw((x),(p))
+#define outl(x,p) __outl((x),(p))
+#define __raw_readb(a) __readb(a)
+#define __raw_readw(a) __readw(a)
+#define __raw_readl(a) __readl(a)
+#define __raw_readq(a) __readq(a)
+#define __raw_writeb(v,a) __writeb((v),(a))
+#define __raw_writew(v,a) __writew((v),(a))
+#define __raw_writel(v,a) __writel((v),(a))
+#define __raw_writeq(v,a) __writeq((v),(a))
#endif /* __WANT_IO_DEF */
diff --git a/include/asm-alpha/delay.h b/include/asm-alpha/delay.h
index 8db687bd4..84b6d1eb5 100644
--- a/include/asm-alpha/delay.h
+++ b/include/asm-alpha/delay.h
@@ -4,74 +4,43 @@
#include <asm/smp.h>
/*
- * Copyright (C) 1993 Linus Torvalds
+ * Copyright (C) 1993, 2000 Linus Torvalds
*
* Delay routines, using a pre-computed "loops_per_second" value.
*/
-/* We can make the delay loop inline, but we have to be very careful wrt
- scheduling for ev6 machines, so that we keep a consistent number of
- iterations for all invocations. */
-
-extern __inline__ void
-__delay(unsigned long loops)
-{
- __asm__ __volatile__(
- ".align 4\n"
- "1: subq %0,1,%0\n"
- " bge %0,1b\n"
- " nop"
- : "=r" (loops) : "0"(loops));
-}
-
/*
- * division by multiplication: you don't have to worry about
- * loss of precision.
- *
- * Use only for very small delays ( < 1 msec). Should probably use a
- * lookup table, really, as the multiplications take much too long with
- * short delays. This is a "reasonable" implementation, though (and the
- * first constant multiplications gets optimized away if the delay is
- * a constant).
+ * Use only for very small delays (< 1 msec).
*
- * Optimize small constants further by exposing the second multiplication
- * to the compiler. In addition, mulq is 2 cycles faster than umulh.
+ * The active part of our cycle counter is only 32-bits wide, and
+ * we're treating the difference between two marks as signed. On
+ * a 1GHz box, that's about 2 seconds.
*/
extern __inline__ void
-__udelay(unsigned long usecs, unsigned long lps)
+__delay(int loops)
{
- /* compute (usecs * 2**64 / 10**6) * loops_per_sec / 2**64 */
-
- usecs *= 0x000010c6f7a0b5edUL; /* 2**64 / 1000000 */
- __asm__("umulh %1,%2,%0" :"=r" (usecs) :"r" (usecs),"r" (lps));
- __delay(usecs);
+ int tmp;
+ __asm__ __volatile__(
+ " rpcc %0\n"
+ " addl %1,%0,%1\n"
+ "1: rpcc %0\n"
+ " subl %1,%0,%0\n"
+ " bgt %0,1b"
+ : "=&r" (tmp), "=r" (loops) : "1"(loops));
}
extern __inline__ void
-__small_const_udelay(unsigned long usecs, unsigned long lps)
+__udelay(unsigned long usecs, unsigned long lps)
{
- /* compute (usecs * 2**32 / 10**6) * loops_per_sec / 2**32 */
-
- usecs *= 0x10c6; /* 2^32 / 10^6 */
- usecs *= lps;
- usecs >>= 32;
- __delay(usecs);
+ usecs *= ((1UL << 32) / 1000000) * lps;
+ __delay((long)usecs >> 32);
}
#ifdef __SMP__
-#define udelay(usecs) \
- (__builtin_constant_p(usecs) && usecs < 0x100000000UL \
- ? __small_const_udelay(usecs, \
- cpu_data[smp_processor_id()].loops_per_sec) \
- : __udelay(usecs, \
- cpu_data[smp_processor_id()].loops_per_sec))
+#define udelay(u) __udelay((u), cpu_data[smp_processor_id()].loops_per_sec)
#else
-#define udelay(usecs) \
- (__builtin_constant_p(usecs) && usecs < 0x100000000UL \
- ? __small_const_udelay(usecs, loops_per_sec) \
- : __udelay(usecs, loops_per_sec))
+#define udelay(u) __udelay((u), loops_per_sec)
#endif
-
#endif /* defined(__ALPHA_DELAY_H) */
diff --git a/include/asm-alpha/io.h b/include/asm-alpha/io.h
index 59eeb9545..0e532f6e5 100644
--- a/include/asm-alpha/io.h
+++ b/include/asm-alpha/io.h
@@ -112,12 +112,12 @@ extern void _sethae (unsigned long addr); /* cached version */
/* In a generic kernel, we always go through the machine vector. */
-# define __inb alpha_mv.mv_inb
-# define __inw alpha_mv.mv_inw
-# define __inl alpha_mv.mv_inl
-# define __outb alpha_mv.mv_outb
-# define __outw alpha_mv.mv_outw
-# define __outl alpha_mv.mv_outl
+# define __inb(p) alpha_mv.mv_inb((unsigned long)(p))
+# define __inw(p) alpha_mv.mv_inw((unsigned long)(p))
+# define __inl(p) alpha_mv.mv_inl((unsigned long)(p))
+# define __outb(x,p) alpha_mv.mv_outb((x),(unsigned long)(p))
+# define __outw(x,p) alpha_mv.mv_outw((x),(unsigned long)(p))
+# define __outl(x,p) alpha_mv.mv_outl((x),(unsigned long)(p))
# define __readb(a) alpha_mv.mv_readb((unsigned long)(a))
# define __readw(a) alpha_mv.mv_readw((unsigned long)(a))
@@ -128,8 +128,8 @@ extern void _sethae (unsigned long addr); /* cached version */
# define __writel(v,a) alpha_mv.mv_writel((v),(unsigned long)(a))
# define __writeq(v,a) alpha_mv.mv_writeq((v),(unsigned long)(a))
-# define __ioremap(a) alpha_mv.mv_ioremap(a)
-# define __is_ioaddr(a) alpha_mv.mv_is_ioaddr(a)
+# define __ioremap(a) alpha_mv.mv_ioremap((unsigned long)(a))
+# define __is_ioaddr(a) alpha_mv.mv_is_ioaddr((unsigned long)(a))
# define inb __inb
# define inw __inw
@@ -166,8 +166,6 @@ extern void _sethae (unsigned long addr); /* cached version */
# include <asm/core_mcpcia.h>
#elif defined(CONFIG_ALPHA_POLARIS)
# include <asm/core_polaris.h>
-#elif defined(CONFIG_ALPHA_PYXIS)
-# include <asm/core_pyxis.h>
#elif defined(CONFIG_ALPHA_T2)
# include <asm/core_t2.h>
#elif defined(CONFIG_ALPHA_TSUNAMI)
@@ -212,13 +210,13 @@ extern void _writeq(unsigned long b, unsigned long addr);
* redefined by userlevel programs.
*/
#ifndef inb
-# define inb(p) _inb((p))
+# define inb(p) _inb(p)
#endif
#ifndef inw
-# define inw(p) _inw((p))
+# define inw(p) _inw(p)
#endif
#ifndef inl
-# define inl(p) _inl((p))
+# define inl(p) _inl(p)
#endif
#ifndef outb
# define outb(b,p) _outb((b),(p))
@@ -256,12 +254,12 @@ extern void _writeq(unsigned long b, unsigned long addr);
/* Userspace declarations. */
-extern unsigned int inb (unsigned long port);
-extern unsigned int inw (unsigned long port);
-extern unsigned int inl (unsigned long port);
-extern void outb (unsigned char b,unsigned long port);
-extern void outw (unsigned short w,unsigned long port);
-extern void outl (unsigned int l,unsigned long port);
+extern unsigned int inb(unsigned long port);
+extern unsigned int inw(unsigned long port);
+extern unsigned int inl(unsigned long port);
+extern void outb(unsigned char b,unsigned long port);
+extern void outw(unsigned short w,unsigned long port);
+extern void outl(unsigned int l,unsigned long port);
extern unsigned long readb(unsigned long addr);
extern unsigned long readw(unsigned long addr);
extern unsigned long readl(unsigned long addr);
diff --git a/include/asm-alpha/mman.h b/include/asm-alpha/mman.h
index ddfe6bda4..3e9b58d98 100644
--- a/include/asm-alpha/mman.h
+++ b/include/asm-alpha/mman.h
@@ -31,6 +31,13 @@
#define MCL_CURRENT 8192 /* lock all currently mapped pages */
#define MCL_FUTURE 16384 /* lock all additions to address space */
+#define MADV_NORMAL 0 /* no further special treatment */
+#define MADV_RANDOM 1 /* expect random page references */
+#define MADV_SEQUENTIAL 2 /* expect sequential page references */
+#define MADV_WILLNEED 3 /* will need these pages */
+#define MADV_SPACEAVAIL 5 /* ensure resources are available */
+#define MADV_DONTNEED 6 /* dont need these pages */
+
/* compatibility flags */
#define MAP_ANON MAP_ANONYMOUS
#define MAP_FILE 0
diff --git a/include/asm-alpha/mmu_context.h b/include/asm-alpha/mmu_context.h
index 6b268f4e6..c42c1ae54 100644
--- a/include/asm-alpha/mmu_context.h
+++ b/include/asm-alpha/mmu_context.h
@@ -22,11 +22,6 @@
#include <asm/io.h>
#endif
-static inline void
-enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk, unsigned cpu)
-{
-}
-
extern inline unsigned long
__reload_thread(struct thread_struct *pcb)
{
@@ -223,6 +218,12 @@ destroy_context(struct mm_struct *mm)
/* Nothing to do. */
}
+static inline void
+enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk, unsigned cpu)
+{
+ tsk->thread.ptbr = ((unsigned long)mm->pgd - IDENT_ADDR) >> PAGE_SHIFT;
+}
+
#ifdef __MMU_EXTERN_INLINE
#undef __EXTERN_INLINE
#undef __MMU_EXTERN_INLINE
diff --git a/include/asm-alpha/page.h b/include/asm-alpha/page.h
index d1dde606e..62a72144f 100644
--- a/include/asm-alpha/page.h
+++ b/include/asm-alpha/page.h
@@ -38,6 +38,8 @@ static inline void clear_page(void * page)
} while (count);
}
+#define clear_user_page(page, vaddr) clear_page(page)
+
static inline void copy_page(void * _to, void * _from)
{
unsigned long count = PAGE_SIZE/64;
@@ -68,6 +70,8 @@ static inline void copy_page(void * _to, void * _from)
} while (count);
}
+#define copy_user_page(to, from, vaddr) copy_page(to, from)
+
#ifdef STRICT_MM_TYPECHECKS
/*
* These are used to make use of C type-checking..
diff --git a/include/asm-alpha/pci.h b/include/asm-alpha/pci.h
index 1a68d43a3..8f89479b5 100644
--- a/include/asm-alpha/pci.h
+++ b/include/asm-alpha/pci.h
@@ -39,6 +39,11 @@ struct pci_controler {
#define PCIBIOS_MIN_IO alpha_mv.min_io_address
#define PCIBIOS_MIN_MEM alpha_mv.min_mem_address
+extern inline void pcibios_set_master(struct pci_dev *dev)
+{
+ /* No special bus mastering setup handling */
+}
+
/* IOMMU controls. */
/* Allocate and map kernel buffer using consistant mode DMA for PCI
diff --git a/include/asm-alpha/smp.h b/include/asm-alpha/smp.h
index 12ebc5087..b05076263 100644
--- a/include/asm-alpha/smp.h
+++ b/include/asm-alpha/smp.h
@@ -30,7 +30,6 @@ struct cpuinfo_alpha {
unsigned long pgtable_cache_sz;
unsigned long ipi_count;
unsigned long irq_attempt[NR_IRQS];
- unsigned long smp_local_irq_count;
unsigned long prof_multiplier;
unsigned long prof_counter;
int irq_count, bh_count;
diff --git a/include/asm-alpha/unistd.h b/include/asm-alpha/unistd.h
index e80f0ae3b..93ed9ed85 100644
--- a/include/asm-alpha/unistd.h
+++ b/include/asm-alpha/unistd.h
@@ -311,6 +311,8 @@
#define __NR_setresgid 371
#define __NR_getresgid 372
#define __NR_dipc 373
+#define __NR_pivot_root 374
+#define __NR_mincore 375
#if defined(__LIBRARY__) && defined(__GNUC__)
diff --git a/include/asm-alpha/vga.h b/include/asm-alpha/vga.h
index 44b6abcc0..4fc557ca1 100644
--- a/include/asm-alpha/vga.h
+++ b/include/asm-alpha/vga.h
@@ -14,7 +14,7 @@
#define VT_BUF_HAVE_MEMCPYW
#define VT_BUF_HAVE_MEMCPYF
-extern inline void scr_writew(u16 val, u16 *addr)
+extern inline void scr_writew(u16 val, volatile u16 *addr)
{
if (__is_ioaddr((unsigned long) addr))
__raw_writew(val, (unsigned long) addr);
@@ -22,7 +22,7 @@ extern inline void scr_writew(u16 val, u16 *addr)
*addr = val;
}
-extern inline u16 scr_readw(const u16 *addr)
+extern inline u16 scr_readw(volatile const u16 *addr)
{
if (__is_ioaddr((unsigned long) addr))
return __raw_readw((unsigned long) addr);
diff --git a/include/asm-arm/arch-cl7500/system.h b/include/asm-arm/arch-cl7500/system.h
index 6daffc785..a8a0ee518 100644
--- a/include/asm-arm/arch-cl7500/system.h
+++ b/include/asm-arm/arch-cl7500/system.h
@@ -8,18 +8,14 @@
#include <asm/iomd.h>
-#define arch_do_idle() \
+#define arch_do_idle() \
outb(0, IOMD_SUSMODE)
-#define arch_reset(mode) { \
- outb (0, IOMD_ROMCR0); \
- cli(); \
- __asm__ __volatile__("msr spsr, r1;" \
- "mcr p15, 0, %0, c1, c0, 0;" \
- "movs pc, #0" \
- : \
- : "r" (cpu_reset())); \
- }
+#define arch_reset(mode) \
+ do { \
+ outb (0, IOMD_ROMCR0); \
+ cpu_reset(0); \
+ } while (0);
#define arch_power_off() do { } while (0)
diff --git a/include/asm-arm/arch-ebsa110/system.h b/include/asm-arm/arch-ebsa110/system.h
index 39f4c84a4..2ec712d06 100644
--- a/include/asm-arm/arch-ebsa110/system.h
+++ b/include/asm-arm/arch-ebsa110/system.h
@@ -8,15 +8,6 @@
#define arch_do_idle() cpu_do_idle()
#define arch_power_off() do { } while (0)
-
-extern __inline__ void arch_reset(char mode)
-{
- if (mode == 's') {
- __asm__ volatile(
- "mcr p15, 0, %0, c1, c0, 0 @ MMU off
- mov pc, #0x80000000 @ jump to flash"
- : : "r" (cpu_reset()) : "cc");
- }
-}
+#define arch_reset(mode) cpu_reset(0x80000000)
#endif
diff --git a/include/asm-arm/arch-ebsa285/system.h b/include/asm-arm/arch-ebsa285/system.h
index ace6afbd6..46e60a084 100644
--- a/include/asm-arm/arch-ebsa285/system.h
+++ b/include/asm-arm/arch-ebsa285/system.h
@@ -14,10 +14,10 @@
extern __inline__ void arch_reset(char mode)
{
if (mode == 's') {
- __asm__ volatile (
- "mcr p15, 0, %0, c1, c0, 0 @ MMU off
- mov pc, #0x41000000 @ jump to ROM" : :
- "r" (cpu_reset()) : "cc");
+ /*
+ * Jump into the ROM
+ */
+ cpu_reset(0x41000000);
} else {
if (machine_is_netwinder()) {
/* open up the SuperIO chip
diff --git a/include/asm-arm/arch-rpc/system.h b/include/asm-arm/arch-rpc/system.h
index c5100fd1a..1282c9505 100644
--- a/include/asm-arm/arch-rpc/system.h
+++ b/include/asm-arm/arch-rpc/system.h
@@ -18,8 +18,8 @@ extern __inline__ void arch_reset(char mode)
outb(0, IOMD_ROMCR0);
- __asm__ __volatile__(
- "mcr p15, 0, %0, c1, c0, 0\n\t"
- "mov pc, #0"
- : : "r" (cpu_reset()));
+ /*
+ * Jump into the ROM
+ */
+ cpu_reset(0);
}
diff --git a/include/asm-arm/arch-sa1100/system.h b/include/asm-arm/arch-sa1100/system.h
index 3ec5c9074..4e883ee6a 100644
--- a/include/asm-arm/arch-sa1100/system.h
+++ b/include/asm-arm/arch-sa1100/system.h
@@ -16,11 +16,7 @@
#else
-#define arch_reset(x) { \
- __asm__ volatile ( \
-" mcr p15, 0, %0, c1, c0 @ MMU off\n" \
-" mov pc, #0\n" : : "r" (cpu_reset()) : "cc"); \
- }
+#define arch_reset(x) cpu_reset(0)
#endif
diff --git a/include/asm-arm/cpu-multi32.h b/include/asm-arm/cpu-multi32.h
index 500e473ca..b959f4994 100644
--- a/include/asm-arm/cpu-multi32.h
+++ b/include/asm-arm/cpu-multi32.h
@@ -75,7 +75,7 @@ extern struct processor {
/*
* Special stuff for a reset
*/
- unsigned long (*reset)(void);
+ volatile void (*reset)(unsigned long addr);
/*
* flush an icached page
*/
@@ -123,7 +123,7 @@ extern const struct processor sa110_processor_functions;
#define cpu_set_pgd(pgd) processor._set_pgd(pgd)
#define cpu_set_pmd(pmdp, pmd) processor._set_pmd(pmdp, pmd)
#define cpu_set_pte(ptep, pte) processor._set_pte(ptep, pte)
-#define cpu_reset() processor.reset()
+#define cpu_reset(addr) processor.reset(addr)
#define cpu_flush_icache_area(start,end) processor._flush_icache_area(start,end)
#define cpu_cache_wback_area(start,end) processor._cache_wback_area(start,end)
#define cpu_cache_purge_area(start,end) processor._cache_purge_area(start,end)
diff --git a/include/asm-arm/cpu-single.h b/include/asm-arm/cpu-single.h
index 0e992a564..74cffcdb5 100644
--- a/include/asm-arm/cpu-single.h
+++ b/include/asm-arm/cpu-single.h
@@ -62,7 +62,7 @@ extern void cpu_flush_tlb_page(unsigned long address, int flags);
extern void cpu_set_pgd(unsigned long pgd_phys);
extern void cpu_set_pmd(pmd_t *pmdp, pmd_t pmd);
extern void cpu_set_pte(pte_t *ptep, pte_t pte);
-extern unsigned long cpu_reset(void);
+extern volatile void cpu_reset(unsigned long addr);
extern void cpu_flush_icache_area(unsigned long start, unsigned long size);
extern void cpu_cache_wback_area(unsigned long start, unsigned long end);
extern void cpu_cache_purge_area(unsigned long start, unsigned long end);
diff --git a/include/asm-arm/mman.h b/include/asm-arm/mman.h
index 9fa76d215..5b6540779 100644
--- a/include/asm-arm/mman.h
+++ b/include/asm-arm/mman.h
@@ -25,6 +25,12 @@
#define MCL_CURRENT 1 /* lock all current mappings */
#define MCL_FUTURE 2 /* lock all future mappings */
+#define MADV_NORMAL 0x0 /* default page-in behavior */
+#define MADV_RANDOM 0x1 /* page-in minimum required */
+#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
+#define MADV_WILLNEED 0x3 /* pre-fault pages */
+#define MADV_DONTNEED 0x4 /* discard these pages */
+
/* compatibility flags */
#define MAP_ANON MAP_ANONYMOUS
#define MAP_FILE 0
diff --git a/include/asm-arm/page.h b/include/asm-arm/page.h
index e33597ff6..e1de021c4 100644
--- a/include/asm-arm/page.h
+++ b/include/asm-arm/page.h
@@ -14,6 +14,9 @@
#define clear_page(page) memzero((void *)(page), PAGE_SIZE)
extern void copy_page(void *to, void *from);
+#define clear_user_page(page, vaddr) clear_page(page)
+#define copy_user_page(to, from, vaddr) copy_page(to, from)
+
#ifdef STRICT_MM_TYPECHECKS
/*
* These are used to make use of C type-checking..
diff --git a/include/asm-arm/pci.h b/include/asm-arm/pci.h
index 542487cf6..c835f4c17 100644
--- a/include/asm-arm/pci.h
+++ b/include/asm-arm/pci.h
@@ -1,12 +1,17 @@
#ifndef ASMARM_PCI_H
#define ASMARM_PCI_H
+#ifdef __KERNEL__
+
#define pcibios_assign_all_busses() 0
#define PCIBIOS_MIN_IO 0x8000
#define PCIBIOS_MIN_MEM 0x40000000
-#ifdef __KERNEL__
+extern inline void pcibios_set_master(struct pci_dev *dev)
+{
+ /* No special bus mastering setup handling */
+}
#include <asm/scatterlist.h>
#include <asm/io.h>
diff --git a/include/asm-arm/system.h b/include/asm-arm/system.h
index a43117330..a33b9e08b 100644
--- a/include/asm-arm/system.h
+++ b/include/asm-arm/system.h
@@ -96,7 +96,7 @@ extern unsigned int __machine_arch_type;
# define machine_is_netwinder() (0)
#endif
-#ifdef CONFIG_CATS
+#ifdef CONFIG_ARCH_CATS
# ifdef machine_arch_type
# undef machine_arch_type
# define machine_arch_type __machine_arch_type
@@ -180,7 +180,7 @@ extern unsigned int __machine_arch_type;
# define machine_is_sa1100() (0)
#endif
-#ifdef CONFIG_PERSONAL_SERVER
+#ifdef CONFIG_ARCH_PERSONAL_SERVER
# ifdef machine_arch_type
# undef machine_arch_type
# define machine_arch_type __machine_arch_type
diff --git a/include/asm-i386/hw_irq.h b/include/asm-i386/hw_irq.h
index eb5d9124e..b371bd79f 100644
--- a/include/asm-i386/hw_irq.h
+++ b/include/asm-i386/hw_irq.h
@@ -189,6 +189,9 @@ extern unsigned long prof_shift;
*/
static inline void x86_do_profile (unsigned long eip)
{
+ if (!prof_buffer)
+ return;
+
/*
* Only measure the CPUs specified by /proc/irq/prof_cpu_mask.
* (default is all CPUs.)
@@ -196,18 +199,16 @@ static inline void x86_do_profile (unsigned long eip)
if (!((1<<smp_processor_id()) & prof_cpu_mask))
return;
- if (prof_buffer) {
- eip -= (unsigned long) &_stext;
- eip >>= prof_shift;
- /*
- * Don't ignore out-of-bounds EIP values silently,
- * put them into the last histogram slot, so if
- * present, they will show up as a sharp peak.
- */
- if (eip > prof_len-1)
- eip = prof_len-1;
- atomic_inc((atomic_t *)&prof_buffer[eip]);
- }
+ eip -= (unsigned long) &_stext;
+ eip >>= prof_shift;
+ /*
+ * Don't ignore out-of-bounds EIP values silently,
+ * put them into the last histogram slot, so if
+ * present, they will show up as a sharp peak.
+ */
+ if (eip > prof_len-1)
+ eip = prof_len-1;
+ atomic_inc((atomic_t *)&prof_buffer[eip]);
}
#ifdef __SMP__ /*more of this file should probably be ifdefed SMP */
diff --git a/include/asm-i386/page.h b/include/asm-i386/page.h
index 9e159523a..78d07c207 100644
--- a/include/asm-i386/page.h
+++ b/include/asm-i386/page.h
@@ -30,6 +30,9 @@
#endif
+#define clear_user_page(page, vaddr) clear_page(page)
+#define copy_user_page(to, from, vaddr) copy_page(to, from)
+
/*
* These are used to make use of C type-checking..
*/
diff --git a/include/asm-i386/pci.h b/include/asm-i386/pci.h
index 1e55ec60f..d6d0311b7 100644
--- a/include/asm-i386/pci.h
+++ b/include/asm-i386/pci.h
@@ -1,6 +1,8 @@
#ifndef __i386_PCI_H
#define __i386_PCI_H
+#ifdef __KERNEL__
+
/* Can be used to override the logic in pci_scan_bus for skipping
already-configured bus numbers - to be used for buggy BIOSes
or architectures with incomplete PCI setup by the loader */
@@ -10,7 +12,7 @@
#define PCIBIOS_MIN_IO 0x1000
#define PCIBIOS_MIN_MEM 0x10000000
-#ifdef __KERNEL__
+void pcibios_set_master(struct pci_dev *dev);
/* Dynamic DMA mapping stuff.
* i386 has everything mapped statically.
@@ -164,4 +166,3 @@ extern inline int pci_dma_supported(struct pci_dev *hwdev, dma_addr_t mask)
#endif /* __KERNEL__ */
#endif /* __i386_PCI_H */
-
diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h
index 1a4c151cd..9f594ab5d 100644
--- a/include/asm-i386/processor.h
+++ b/include/asm-i386/processor.h
@@ -116,6 +116,10 @@ extern struct cpuinfo_x86 cpu_data[];
(boot_cpu_data.x86_capability & X86_FEATURE_PAE)
#define cpu_has_tsc \
(boot_cpu_data.x86_capability & X86_FEATURE_TSC)
+#define cpu_has_de \
+ (boot_cpu_data.x86_capability & X86_FEATURE_DE)
+#define cpu_has_vme \
+ (boot_cpu_data.x86_capability & X86_FEATURE_VME)
extern char ignore_irq13;
diff --git a/include/asm-ia64/page.h b/include/asm-ia64/page.h
index 2361bc06d..648ff8a12 100644
--- a/include/asm-ia64/page.h
+++ b/include/asm-ia64/page.h
@@ -40,6 +40,9 @@
extern void clear_page (void *page);
extern void copy_page (void *to, void *from);
+#define clear_user_page(page, vaddr) clear_page(page)
+#define copy_user_page(to, from, vaddr) copy_page(to, from)
+
# ifdef STRICT_MM_TYPECHECKS
/*
* These are used to make use of C type-checking..
diff --git a/include/asm-ia64/pci.h b/include/asm-ia64/pci.h
index de50f98f0..bbabe63e8 100644
--- a/include/asm-ia64/pci.h
+++ b/include/asm-ia64/pci.h
@@ -11,6 +11,11 @@
#define PCIBIOS_MIN_IO 0x1000
#define PCIBIOS_MIN_MEM 0x10000000
+extern inline void pcibios_set_master(struct pci_dev *dev)
+{
+ /* No special bus mastering setup handling */
+}
+
/*
* Dynamic DMA mapping API.
* IA-64 has everything mapped statically.
diff --git a/include/asm-m68k/page.h b/include/asm-m68k/page.h
index 117abf25d..7cf002fb7 100644
--- a/include/asm-m68k/page.h
+++ b/include/asm-m68k/page.h
@@ -76,6 +76,9 @@ static inline void clear_page(void *page)
#define copy_page(to,from) memcpy((to), (from), PAGE_SIZE)
#endif
+#define clear_user_page(page, vaddr) clear_page(page)
+#define copy_user_page(to, from, vaddr) copy_page(to, from)
+
/*
* These are used to make use of C type-checking..
*/
diff --git a/include/asm-m68k/pci.h b/include/asm-m68k/pci.h
index 76915264d..efbaf41b5 100644
--- a/include/asm-m68k/pci.h
+++ b/include/asm-m68k/pci.h
@@ -35,4 +35,9 @@ struct pci_bus_info
#define pcibios_assign_all_busses() 0
+extern inline void pcibios_set_master(struct pci_dev *dev)
+{
+ /* No special bus mastering setup handling */
+}
+
#endif /* _ASM_M68K_PCI_H */
diff --git a/include/asm-mips/page.h b/include/asm-mips/page.h
index c458e3db1..fd391fb85 100644
--- a/include/asm-mips/page.h
+++ b/include/asm-mips/page.h
@@ -1,4 +1,4 @@
-/* $Id: page.h,v 1.8 2000/01/27 01:05:37 ralf Exp $
+/* $Id: page.h,v 1.9 2000/02/24 00:13:19 ralf Exp $
*
* Definitions for page handling
*
@@ -28,6 +28,8 @@ extern void (*_copy_page)(void * to, void * from);
#define clear_page(page) _clear_page(page)
#define copy_page(to, from) _copy_page(to, from)
+#define clear_user_page(page, vaddr) clear_page(page)
+#define copy_user_page(to, from, vaddr) copy_page(to, from)
/*
* These are used to make use of C type-checking..
diff --git a/include/asm-mips/pci.h b/include/asm-mips/pci.h
index 3f890fe68..aaa5c8fb7 100644
--- a/include/asm-mips/pci.h
+++ b/include/asm-mips/pci.h
@@ -1,4 +1,4 @@
-/* $Id: pci.h,v 1.8 2000/02/18 00:24:48 ralf Exp $
+/* $Id: pci.h,v 1.9 2000/02/24 00:13:19 ralf Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
@@ -7,6 +7,8 @@
#ifndef _ASM_PCI_H
#define _ASM_PCI_H
+#ifdef __KERNEL__
+
/* Can be used to override the logic in pci_scan_bus for skipping
already-configured bus numbers - to be used for buggy BIOSes
or architectures with incomplete PCI setup by the loader */
@@ -16,7 +18,10 @@
#define PCIBIOS_MIN_IO 0x1000
#define PCIBIOS_MIN_MEM 0x10000000
-#ifdef __KERNEL__
+extern inline void pcibios_set_master(struct pci_dev *dev)
+{
+ /* No special bus mastering setup handling */
+}
/*
* Dynamic DMA mapping stuff.
diff --git a/include/asm-mips64/page.h b/include/asm-mips64/page.h
index 287c2995a..27bcf8346 100644
--- a/include/asm-mips64/page.h
+++ b/include/asm-mips64/page.h
@@ -1,4 +1,4 @@
-/* $Id: page.h,v 1.5 2000/02/06 00:20:27 kanoj Exp $
+/* $Id: page.h,v 1.6 2000/02/24 00:13:20 ralf Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
@@ -29,6 +29,8 @@ extern void (*_copy_page)(void * to, void * from);
#define clear_page(page) _clear_page(page)
#define copy_page(to, from) _copy_page(to, from)
+#define clear_user_page(page, vaddr) clear_page(page)
+#define copy_user_page(to, from, vaddr) copy_page(to, from)
/*
* These are used to make use of C type-checking..
diff --git a/include/asm-mips64/pci.h b/include/asm-mips64/pci.h
index 217eea7d3..7769fef70 100644
--- a/include/asm-mips64/pci.h
+++ b/include/asm-mips64/pci.h
@@ -1,4 +1,4 @@
-/* $Id: pci.h,v 1.3 2000/02/18 00:24:48 ralf Exp $
+/* $Id: pci.h,v 1.4 2000/02/24 00:13:20 ralf Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
@@ -7,6 +7,8 @@
#ifndef _ASM_PCI_H
#define _ASM_PCI_H
+#ifdef __KERNEL__
+
/* Can be used to override the logic in pci_scan_bus for skipping
already-configured bus numbers - to be used for buggy BIOSes
or architectures with incomplete PCI setup by the loader */
@@ -16,7 +18,10 @@
#define PCIBIOS_MIN_IO 0x1000
#define PCIBIOS_MIN_MEM 0x10000000
-#ifdef __KERNEL__
+extern inline void pcibios_set_master(struct pci_dev *dev)
+{
+ /* No special bus mastering setup handling */
+}
/*
* Dynamic DMA mapping stuff.
diff --git a/include/asm-ppc/page.h b/include/asm-ppc/page.h
index 1be8ddfa5..e069f8b15 100644
--- a/include/asm-ppc/page.h
+++ b/include/asm-ppc/page.h
@@ -78,6 +78,8 @@ typedef unsigned long pgprot_t;
extern void clear_page(void *page);
extern void copy_page(void *to, void *from);
+#define clear_user_page(page, vaddr) clear_page(page)
+#define copy_user_page(to, from, vaddr) copy_page(to, from)
/* map phys->virtual and virtual->phys for RAM pages */
static inline unsigned long ___pa(unsigned long v)
diff --git a/include/asm-ppc/pci.h b/include/asm-ppc/pci.h
index d543c90cc..479f8ba2c 100644
--- a/include/asm-ppc/pci.h
+++ b/include/asm-ppc/pci.h
@@ -10,6 +10,11 @@
#define PCIBIOS_MIN_IO 0x1000
#define PCIBIOS_MIN_MEM 0x10000000
+extern inline void pcibios_set_master(struct pci_dev *dev)
+{
+ /* No special bus mastering setup handling */
+}
+
/* Dynamic DMA Mapping stuff
* ++ajoshi
*/
diff --git a/include/asm-sh/page.h b/include/asm-sh/page.h
index 23309458c..1348466a9 100644
--- a/include/asm-sh/page.h
+++ b/include/asm-sh/page.h
@@ -26,6 +26,8 @@
#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
#define copy_page(to,from) memcpy((void *)(to), (void *)(from), PAGE_SIZE)
+#define clear_user_page(page, vaddr) clear_page(page)
+#define copy_user_page(to, from, vaddr) copy_page(to, from)
/*
* These are used to make use of C type-checking..
diff --git a/include/asm-sh/pci.h b/include/asm-sh/pci.h
index e8f6e1d66..bf8fe93f5 100644
--- a/include/asm-sh/pci.h
+++ b/include/asm-sh/pci.h
@@ -1,13 +1,18 @@
#ifndef __ASM_SH_PCI_H
#define __ASM_SH_PCI_H
+#ifdef __KERNEL__
+
/* Can be used to override the logic in pci_scan_bus for skipping
already-configured bus numbers - to be used for buggy BIOSes
or architectures with incomplete PCI setup by the loader */
#define pcibios_assign_all_busses() 0
-#ifdef __KERNEL__
+extern inline void pcibios_set_master(struct pci_dev *dev)
+{
+ /* No special bus mastering setup handling */
+}
/* Dynamic DMA mapping stuff.
* SuperH has everything mapped statically like x86.
diff --git a/include/asm-sparc/mman.h b/include/asm-sparc/mman.h
index 68bc526a1..e6011ebbd 100644
--- a/include/asm-sparc/mman.h
+++ b/include/asm-sparc/mman.h
@@ -1,4 +1,4 @@
-/* $Id: mman.h,v 1.8 1996/10/27 08:55:28 davem Exp $ */
+/* $Id: mman.h,v 1.9 2000/03/15 02:44:23 davem Exp $ */
#ifndef __SPARC_MMAN_H__
#define __SPARC_MMAN_H__
@@ -42,6 +42,13 @@
#define MC_LOCKAS 5 /* Lock an entire address space of the calling process */
#define MC_UNLOCKAS 6 /* Unlock entire address space of calling process */
+#define MADV_NORMAL 0x0 /* default page-in behavior */
+#define MADV_RANDOM 0x1 /* page-in minimum required */
+#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
+#define MADV_WILLNEED 0x3 /* pre-fault pages */
+#define MADV_DONTNEED 0x4 /* discard these pages */
+#define MADV_FREE 0x5 /* (Solaris) contents can be freed */
+
/* compatibility flags */
#define MAP_ANON MAP_ANONYMOUS
#define MAP_FILE 0
diff --git a/include/asm-sparc/page.h b/include/asm-sparc/page.h
index 3c61eb636..0fc2aa247 100644
--- a/include/asm-sparc/page.h
+++ b/include/asm-sparc/page.h
@@ -1,4 +1,4 @@
-/* $Id: page.h,v 1.48 2000/02/16 07:34:51 davem Exp $
+/* $Id: page.h,v 1.51 2000/03/15 07:19:25 davem Exp $
* page.h: Various defines and such for MMU operations on the Sparc for
* the Linux kernel.
*
@@ -14,7 +14,12 @@
#else
#define PAGE_SHIFT 12
#endif
+#ifndef __ASSEMBLY__
+/* I have my suspicions... -DaveM */
+#define PAGE_SIZE (1UL << PAGE_SHIFT)
+#else
#define PAGE_SIZE (1 << PAGE_SHIFT)
+#endif
#define PAGE_MASK (~(PAGE_SIZE-1))
#ifdef __KERNEL__
@@ -33,8 +38,10 @@
BUG(); \
} while (0)
-#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
-#define copy_page(to,from) memcpy((void *)(to), (void *)(from), PAGE_SIZE)
+#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
+#define copy_page(to,from) memcpy((void *)(to), (void *)(from), PAGE_SIZE)
+#define clear_user_page(page, vaddr) clear_page(page)
+#define copy_user_page(to, from, vaddr) copy_page(to, from)
/* The following structure is used to hold the physical
* memory configuration of the machine. This is filled in
diff --git a/include/asm-sparc/pci.h b/include/asm-sparc/pci.h
index 80ea9d11d..f96225e2a 100644
--- a/include/asm-sparc/pci.h
+++ b/include/asm-sparc/pci.h
@@ -1,6 +1,8 @@
#ifndef __SPARC_PCI_H
#define __SPARC_PCI_H
+#ifdef __KERNEL__
+
/* Can be used to override the logic in pci_scan_bus for skipping
* already-configured bus numbers - to be used for buggy BIOSes
* or architectures with incomplete PCI setup by the loader.
@@ -10,7 +12,10 @@
#define PCIBIOS_MIN_IO 0UL
#define PCIBIOS_MIN_MEM 0UL
-#ifdef __KERNEL__
+extern inline void pcibios_set_master(struct pci_dev *dev)
+{
+ /* No special bus mastering setup handling */
+}
/* Dynamic DMA mapping stuff.
*/
diff --git a/include/asm-sparc64/atomic.h b/include/asm-sparc64/atomic.h
index 96ef1a585..db3cd5831 100644
--- a/include/asm-sparc64/atomic.h
+++ b/include/asm-sparc64/atomic.h
@@ -1,61 +1,32 @@
-/* $Id: atomic.h,v 1.19 1999/07/03 22:11:17 davem Exp $
+/* $Id: atomic.h,v 1.20 2000/03/16 16:44:44 davem Exp $
* atomic.h: Thankfully the V9 is at least reasonable for this
* stuff.
*
- * Copyright (C) 1996, 1997 David S. Miller (davem@caip.rutgers.edu)
+ * Copyright (C) 1996, 1997, 2000 David S. Miller (davem@redhat.com)
*/
#ifndef __ARCH_SPARC64_ATOMIC__
#define __ARCH_SPARC64_ATOMIC__
-/* Make sure gcc doesn't try to be clever and move things around
- * on us. We need to use _exactly_ the address the user gave us,
- * not some alias that contains the same information.
- */
-#define __atomic_fool_gcc(x) ((struct { int a[100]; } *)x)
-
typedef struct { int counter; } atomic_t;
#define ATOMIC_INIT(i) { (i) }
#define atomic_read(v) ((v)->counter)
#define atomic_set(v, i) (((v)->counter) = i)
-#define atomic_add_return(__i, __v) \
-({ register atomic_t *__V asm("g1"); \
- register int __I asm("g2"); \
- __V = (__v); __I = (__i); \
- __asm__ __volatile__("sethi %%hi(__atomic_add), %%g3\n\t" \
- "jmpl %%g3 + %%lo(__atomic_add), %%g3\n\t" \
- " nop\n1:" \
- : "=&r" (__I) \
- : "0" (__I), "r" (__V) \
- : "g3", "g5", "g7", "cc", "memory"); \
- __I; \
-})
-
-#define atomic_sub_return(__i, __v) \
-({ register atomic_t *__V asm("g1"); \
- register int __I asm("g2"); \
- __V = (__v); __I = (__i); \
- __asm__ __volatile__("sethi %%hi(__atomic_sub), %%g3\n\t" \
- "jmpl %%g3 + %%lo(__atomic_sub), %%g3\n\t" \
- " nop\n1:" \
- : "=&r" (__I) \
- : "0" (__I), "r" (__V) \
- : "g3", "g5", "g7", "cc", "memory"); \
- __I; \
-})
-
-#define atomic_add(i, v) atomic_add_return(i, v)
-#define atomic_sub(i, v) atomic_sub_return(i, v)
-
-#define atomic_dec_return(v) atomic_sub_return(1,(v))
-#define atomic_inc_return(v) atomic_add_return(1,(v))
-
-#define atomic_sub_and_test(i,v) (atomic_sub_return((i), (v)) == 0)
-#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0)
-
-#define atomic_inc(v) atomic_add(1,(v))
-#define atomic_dec(v) atomic_sub(1,(v))
+extern int __atomic_add(int, atomic_t *);
+extern int __atomic_sub(int, atomic_t *);
+
+#define atomic_add(i, v) ((void)__atomic_add(i, v))
+#define atomic_sub(i, v) ((void)__atomic_sub(i, v))
+
+#define atomic_dec_return(v) __atomic_sub(1, v)
+#define atomic_inc_return(v) __atomic_add(1, v)
+
+#define atomic_sub_and_test(i, v) (__atomic_sub(i, v) == 0)
+#define atomic_dec_and_test(v) (__atomic_sub(1, v) == 0)
+
+#define atomic_inc(v) ((void)__atomic_add(1, v))
+#define atomic_dec(v) ((void)__atomic_sub(1, v))
#endif /* !(__ARCH_SPARC64_ATOMIC__) */
diff --git a/include/asm-sparc64/mman.h b/include/asm-sparc64/mman.h
index bfb510af7..553e42906 100644
--- a/include/asm-sparc64/mman.h
+++ b/include/asm-sparc64/mman.h
@@ -1,4 +1,4 @@
-/* $Id: mman.h,v 1.1 1996/12/02 00:07:29 davem Exp $ */
+/* $Id: mman.h,v 1.2 2000/03/15 02:44:26 davem Exp $ */
#ifndef __SPARC64_MMAN_H__
#define __SPARC64_MMAN_H__
@@ -42,6 +42,13 @@
#define MC_LOCKAS 5 /* Lock an entire address space of the calling process */
#define MC_UNLOCKAS 6 /* Unlock entire address space of calling process */
+#define MADV_NORMAL 0x0 /* default page-in behavior */
+#define MADV_RANDOM 0x1 /* page-in minimum required */
+#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
+#define MADV_WILLNEED 0x3 /* pre-fault pages */
+#define MADV_DONTNEED 0x4 /* discard these pages */
+#define MADV_FREE 0x5 /* (Solaris) contents can be freed */
+
/* compatibility flags */
#define MAP_ANON MAP_ANONYMOUS
#define MAP_FILE 0
diff --git a/include/asm-sparc64/page.h b/include/asm-sparc64/page.h
index 7653f4af1..757f43c4d 100644
--- a/include/asm-sparc64/page.h
+++ b/include/asm-sparc64/page.h
@@ -1,4 +1,4 @@
-/* $Id: page.h,v 1.30 2000/02/16 07:34:54 davem Exp $ */
+/* $Id: page.h,v 1.32 2000/03/15 07:19:28 davem Exp $ */
#ifndef _SPARC64_PAGE_H
#define _SPARC64_PAGE_H
@@ -23,6 +23,8 @@
extern void clear_page(void *page);
extern void copy_page(void *to, void *from);
+extern void clear_user_page(void *page, unsigned long vaddr);
+extern void copy_user_page(void *to, void *from, unsigned long vaddr);
/* GROSS, defining this makes gcc pass these types as aggregates,
* and thus on the stack, turn this crap off... -DaveM
diff --git a/include/asm-sparc64/parport.h b/include/asm-sparc64/parport.h
index dac004a6b..6840476dd 100644
--- a/include/asm-sparc64/parport.h
+++ b/include/asm-sparc64/parport.h
@@ -1,4 +1,4 @@
-/* $Id: parport.h,v 1.7 2000/01/28 13:43:14 jj Exp $
+/* $Id: parport.h,v 1.9 2000/03/16 07:47:27 davem Exp $
* parport.h: sparc64 specific parport initialization and dma.
*
* Copyright (C) 1999 Eddie C. Dost (ecd@skynet.be)
@@ -7,7 +7,6 @@
#ifndef _ASM_SPARC64_PARPORT_H
#define _ASM_SPARC64_PARPORT_H 1
-#include <linux/config.h>
#include <asm/ebus.h>
#include <asm/ns87303.h>
diff --git a/include/asm-sparc64/pci.h b/include/asm-sparc64/pci.h
index 267cbf797..1fd24a47f 100644
--- a/include/asm-sparc64/pci.h
+++ b/include/asm-sparc64/pci.h
@@ -1,6 +1,8 @@
#ifndef __SPARC64_PCI_H
#define __SPARC64_PCI_H
+#ifdef __KERNEL__
+
/* Can be used to override the logic in pci_scan_bus for skipping
* already-configured bus numbers - to be used for buggy BIOSes
* or architectures with incomplete PCI setup by the loader.
@@ -10,7 +12,10 @@
#define PCIBIOS_MIN_IO 0UL
#define PCIBIOS_MIN_MEM 0UL
-#ifdef __KERNEL__
+extern inline void pcibios_set_master(struct pci_dev *dev)
+{
+ /* No special bus mastering setup handling */
+}
/* Dynamic DMA mapping stuff.
*/
diff --git a/include/asm-sparc64/semaphore.h b/include/asm-sparc64/semaphore.h
index 1d7b0e31c..85ae21c9d 100644
--- a/include/asm-sparc64/semaphore.h
+++ b/include/asm-sparc64/semaphore.h
@@ -90,7 +90,7 @@ extern __inline__ void down(struct semaphore * sem)
ba,pt %%xcc, 2b
restore %%l3, %%g0, %%g3
.previous\n"
- : : "r" (__atomic_fool_gcc(sem)), "i" (__down)
+ : : "r" (sem), "i" (__down)
: "g5", "g7", "memory", "cc");
}
@@ -126,7 +126,7 @@ extern __inline__ int down_interruptible(struct semaphore *sem)
restore %%o0, %%g0, %0
.previous\n"
: "=r" (ret)
- : "0" (ret), "r" (__atomic_fool_gcc(sem)), "i" (__down_interruptible)
+ : "0" (ret), "r" (sem), "i" (__down_interruptible)
: "g5", "g7", "memory", "cc");
return ret;
}
@@ -162,7 +162,7 @@ extern inline int down_trylock(struct semaphore *sem)
restore %%o0, %%g0, %0
.previous\n"
: "=r" (ret)
- : "0" (ret), "r" (__atomic_fool_gcc(sem)), "i" (__down_trylock)
+ : "0" (ret), "r" (sem), "i" (__down_trylock)
: "g5", "g7", "memory", "cc");
return ret;
}
@@ -196,7 +196,7 @@ extern __inline__ void up(struct semaphore * sem)
ba,pt %%xcc, 2b
restore %%l3, %%g0, %%g3
.previous\n"
- : : "r" (__atomic_fool_gcc(sem)), "i" (__up)
+ : : "r" (sem), "i" (__up)
: "g5", "g7", "memory", "cc");
}
@@ -309,7 +309,7 @@ extern inline void down_read(struct rw_semaphore *sem)
ba,pt %%xcc, 2b
restore %%l3, %%g0, %%g3
.previous\n"
- : : "r" (__atomic_fool_gcc(sem)), "i" (__down_read_failed)
+ : : "r" (sem), "i" (__down_read_failed)
: "g5", "g7", "memory", "cc");
#if WAITQUEUE_DEBUG
if (test_le_bit(1, &sem->granted))
@@ -348,7 +348,7 @@ extern inline void down_write(struct rw_semaphore *sem)
ba,pt %%xcc, 2b
restore %%l3, %%g0, %%g3
.previous\n"
- : : "r" (__atomic_fool_gcc(sem)), "i" (__down_write_failed)
+ : : "r" (sem), "i" (__down_write_failed)
: "g5", "g7", "memory", "cc");
#if WAITQUEUE_DEBUG
if (atomic_read(&sem->writers))
@@ -394,7 +394,7 @@ extern inline void __up_read(struct rw_semaphore *sem)
ba,pt %%xcc, 2b
restore %%l3, %%g0, %%g3
.previous\n"
- : : "r" (__atomic_fool_gcc(sem)), "i" (__rwsem_wake)
+ : : "r" (sem), "i" (__rwsem_wake)
: "g5", "g7", "memory", "cc");
}
@@ -430,7 +430,7 @@ extern inline void __up_write(struct rw_semaphore *sem)
ba,pt %%xcc, 2b
restore %%l3, %%g0, %%g3
.previous\n"
- : : "r" (__atomic_fool_gcc(sem)), "i" (__rwsem_wake)
+ : : "r" (sem), "i" (__rwsem_wake)
: "g5", "g7", "memory", "cc");
}
diff --git a/include/asm-sparc64/spinlock.h b/include/asm-sparc64/spinlock.h
index c4e571564..ea34fbefe 100644
--- a/include/asm-sparc64/spinlock.h
+++ b/include/asm-sparc64/spinlock.h
@@ -110,41 +110,15 @@ extern int _spin_trylock (spinlock_t *lock);
typedef unsigned int rwlock_t;
#define RW_LOCK_UNLOCKED 0
-#define read_lock(__rw_lck) \
-do { register rwlock_t *__X asm("g1"); \
- __asm__ __volatile__("sethi %%hi(__read_lock), %%g3\n\t" \
- "jmpl %%g3 + %%lo(__read_lock), %%g3\n\t" \
- " nop\n1:" \
- : : "r" (__X = (__rw_lck)) \
- : "g3", "g5", "g7", "cc", "memory"); \
-} while(0)
-
-#define read_unlock(__rw_lck) \
-do { register rwlock_t *__X asm("g1"); \
- __asm__ __volatile__("sethi %%hi(__read_unlock), %%g3\n\t" \
- "jmpl %%g3 + %%lo(__read_unlock), %%g3\n\t" \
- " nop\n1:" \
- : : "r" (__X = (__rw_lck)) \
- : "g3", "g5", "g7", "cc", "memory"); \
-} while(0)
-
-#define write_lock(__rw_lck) \
-do { register rwlock_t *__X asm("g1"); \
- __asm__ __volatile__("sethi %%hi(__write_lock), %%g3\n\t" \
- "jmpl %%g3 + %%lo(__write_lock), %%g3\n\t" \
- " nop\n1:" \
- : : "r" (__X = (__rw_lck)) \
- : "g2", "g3", "g5", "g7", "cc", "memory"); \
-} while(0)
-
-#define write_unlock(__rw_lck) \
-do { register rwlock_t *__X asm("g1"); \
- __asm__ __volatile__("sethi %%hi(__write_unlock), %%g3\n\t" \
- "jmpl %%g3 + %%lo(__write_unlock), %%g3\n\t" \
- " nop\n1:" \
- : : "r" (__X = (__rw_lck)) \
- : "g2", "g3", "g5", "g7", "cc", "memory"); \
-} while(0)
+extern void __read_lock(rwlock_t *);
+extern void __read_unlock(rwlock_t *);
+extern void __write_lock(rwlock_t *);
+extern void __write_unlock(rwlock_t *);
+
+#define read_lock(p) __read_lock(p)
+#define read_unlock(p) __read_unlock(p)
+#define write_lock(p) __write_lock(p)
+#define write_unlock(p) __write_unlock(p)
#else /* !(SPIN_LOCK_DEBUG) */
diff --git a/include/linux/ac97_codec.h b/include/linux/ac97_codec.h
index 50c75c3a8..da8730aef 100644
--- a/include/linux/ac97_codec.h
+++ b/include/linux/ac97_codec.h
@@ -39,6 +39,21 @@
#define AC97_RESERVED_3A 0x003A /* Reserved */
/* range 0x3c-0x58 - MODEM */
+#define AC97_EXTENDED_MODEM_ID 0x003C
+#define AC97_EXTEND_MODEM_STAT 0x003E
+#define AC97_LINE1_RATE 0x0040
+#define AC97_LINE2_RATE 0x0042
+#define AC97_HANDSET_RATE 0x0044
+#define AC97_LINE1_LEVEL 0x0046
+#define AC97_LINE2_LEVEL 0x0048
+#define AC97_HANDSET_LEVEL 0x004A
+#define AC97_GPIO_CONFIG 0x004C
+#define AC97_GPIO_POLARITY 0x004E
+#define AC97_GPIO_STICKY 0x0050
+#define AC97_GPIO_WAKE_UP 0x0052
+#define AC97_GPIO_STATUS 0x0054
+#define AC97_MISC_MODEM_STAT 0x0056
+#define AC97_RESERVED_58 0x0058
/* registers 0x005a - 0x007a are vendor reserved */
@@ -150,6 +165,9 @@ struct ac97_codec {
/* saved OSS mixer states */
unsigned int mixer_state[SOUND_MIXER_NRDEVICES];
+
+ /* Software Modem interface */
+ int (*modem_ioctl)(struct ac97_codec *codec, unsigned int cmd, unsigned long arg);
};
extern int ac97_read_proc (char *page_out, char **start, off_t off,
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index 31721c101..14e163b0e 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -37,7 +37,7 @@ struct linux_binfmt {
struct linux_binfmt * next;
struct module *module;
int (*load_binary)(struct linux_binprm *, struct pt_regs * regs);
- int (*load_shlib)(int fd);
+ int (*load_shlib)(struct file *);
int (*core_dump)(long signr, struct pt_regs * regs, struct file * file);
unsigned long min_coredump; /* minimal dump size */
};
diff --git a/include/linux/fs.h b/include/linux/fs.h
index bd37850b7..1001d5cba 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -589,6 +589,7 @@ struct super_block {
struct list_head s_files;
struct block_device *s_bdev;
+ struct quota_mount_options s_dquot; /* Diskquota specific options */
union {
struct minix_sb_info minix_sb;
@@ -730,7 +731,6 @@ struct file_system_type {
struct file_system_type * next;
};
-#ifdef MODULE
#define DECLARE_FSTYPE(var,type,read,flags) \
struct file_system_type var = { \
name: type, \
@@ -738,14 +738,6 @@ struct file_system_type var = { \
fs_flags: flags, \
owner: THIS_MODULE, \
}
-#else
-#define DECLARE_FSTYPE(var,type,read,flags) \
-struct file_system_type var = { \
- name: type, \
- read_super: read, \
- fs_flags: flags, \
-}
-#endif
#define DECLARE_FSTYPE_DEV(var,type,read) \
DECLARE_FSTYPE(var,type,read,FS_REQUIRES_DEV)
@@ -821,7 +813,7 @@ extern int do_truncate(struct dentry *, loff_t start);
extern int get_unused_fd(void);
extern void put_unused_fd(unsigned int);
-extern struct file *filp_open(const char *, int, int);
+extern struct file *filp_open(const char *, int, int, struct dentry *);
extern int filp_close(struct file *, fl_owner_t id);
extern char * getname(const char *);
@@ -936,10 +928,15 @@ extern int notify_change(struct dentry *, struct iattr *);
extern int permission(struct inode *, int);
extern int get_write_access(struct inode *);
extern void put_write_access(struct inode *);
-extern struct dentry * open_namei(const char *, int, int);
extern struct dentry * do_mknod(const char *, int, dev_t);
extern int do_pipe(int *);
-extern int do_unlink(const char * name);
+extern int do_unlink(const char * name, struct dentry *);
+extern struct dentry * __open_namei(const char *, int, int, struct dentry *);
+
+static inline struct dentry * open_namei(const char *pathname)
+{
+ return __open_namei(pathname, 0, 0, NULL);
+}
/* fs/dcache.c -- generic fs support functions */
extern int is_subdir(struct dentry *, struct dentry *);
@@ -989,6 +986,7 @@ typedef int (*read_actor_t)(read_descriptor_t *, struct page *, unsigned long, u
extern struct dentry * lookup_dentry(const char *, struct dentry *, unsigned int);
+extern struct dentry * lookup_one(const char *, struct dentry *);
extern struct dentry * __namei(const char *, unsigned int);
#define namei(pathname) __namei(pathname, 1)
diff --git a/include/linux/hdreg.h b/include/linux/hdreg.h
index 3509c5cb9..94030b18d 100644
--- a/include/linux/hdreg.h
+++ b/include/linux/hdreg.h
@@ -193,6 +193,8 @@ struct hd_geometry {
#define HDIO_SET_NICE 0x0329 /* set nice flags */
#define HDIO_UNREGISTER_HWIF 0x032a /* unregister interface */
+#define __NEW_HD_DRIVE_ID
+
/* structure returned by HDIO_GET_IDENTITY, as per ANSI ATA2 rev.2f spec */
struct hd_driveid {
unsigned short config; /* lots of obsolete bit flags */
@@ -256,7 +258,7 @@ struct hd_driveid {
unsigned short CurAPMvalues; /* current APM values */
unsigned short word92; /* reserved (word 92) */
unsigned short hw_config; /* hardware config */
- unsigned short words94_125[33];/* reserved words 94-125 */
+ unsigned short words94_125[31];/* reserved words 94-125 */
unsigned short last_lun; /* reserved (word 126) */
unsigned short word127; /* reserved (word 127) */
unsigned short dlf; /* device lock function
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index 2e31d77f2..3049ad259 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -29,6 +29,15 @@ extern inline unsigned int nr_free_highpages(void) { return 0; }
#endif /* CONFIG_HIGHMEM */
/* when CONFIG_HIGHMEM is not set these will be plain clear/copy_page */
+extern inline void clear_user_highpage(struct page *page, unsigned long vaddr)
+{
+ unsigned long kaddr;
+
+ kaddr = kmap(page);
+ clear_user_page((void *)kaddr, vaddr);
+ kunmap(page);
+}
+
extern inline void clear_highpage(struct page *page)
{
unsigned long kaddr;
@@ -64,6 +73,17 @@ extern inline void memclear_highpage_flush(struct page *page, unsigned int offse
kunmap(page);
}
+extern inline void copy_user_highpage(struct page *to, struct page *from, unsigned long vaddr)
+{
+ unsigned long vfrom, vto;
+
+ vfrom = kmap(from);
+ vto = kmap(to);
+ copy_user_page((void *)vto, (void *)vfrom, vaddr);
+ kunmap(from);
+ kunmap(to);
+}
+
extern inline void copy_highpage(struct page *to, struct page *from)
{
unsigned long vfrom, vto;
diff --git a/include/linux/i2c-algo-pcf.h b/include/linux/i2c-algo-pcf.h
index edb6ce644..892d737ca 100644
--- a/include/linux/i2c-algo-pcf.h
+++ b/include/linux/i2c-algo-pcf.h
@@ -22,10 +22,10 @@
/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even
Frodo Looijaard <frodol@dds.nl> */
-/* $Id: i2c-algo-pcf.h,v 1.6 1999/12/21 23:45:58 frodo Exp $ */
+/* $Id: i2c-algo-pcf.h,v 1.7 2000/02/27 23:02:45 frodo Exp $ */
#ifndef I2C_ALGO_PCF_H
-#define I2C_AGLO_PCF_H 1
+#define I2C_ALGO_PCF_H 1
/* --- Defines for pcf-adapters --------------------------------------- */
#include <linux/i2c.h>
diff --git a/include/linux/i2c-dev.h b/include/linux/i2c-dev.h
index 7588f626b..39ed2adfa 100644
--- a/include/linux/i2c-dev.h
+++ b/include/linux/i2c-dev.h
@@ -19,7 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: i2c-dev.h,v 1.6 2000/01/24 21:56:58 frodo Exp $ */
+/* $Id: i2c-dev.h,v 1.7 2000/02/15 17:57:27 frodo Exp $ */
#ifndef I2C_DEV_H
#define I2C_DEV_H
@@ -39,6 +39,12 @@ struct i2c_smbus_ioctl_data {
union i2c_smbus_data *data;
};
+/* This is the structure as used in the I2C_RDWR ioctl call */
+struct i2c_rdwr_ioctl_data {
+ struct i2c_msg *msgs; /* pointers to i2c_msgs */
+ int nmsgs; /* number of i2c_msgs */
+};
+
#ifndef __KERNEL__
#include <sys/ioctl.h>
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h
index ed98106ed..ae788ce52 100644
--- a/include/linux/i2c-id.h
+++ b/include/linux/i2c-id.h
@@ -20,7 +20,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* ------------------------------------------------------------------------- */
-/* $Id: i2c-id.h,v 1.10 2000/02/04 02:47:41 mds Exp $ */
+/* $Id: i2c-id.h,v 1.15 2000/03/16 14:01:57 frodo Exp $ */
#ifndef I2C_ID_H
#define I2C_ID_H
@@ -92,9 +92,7 @@
#define I2C_ALGO_ATI 0x030000 /* ATI video card */
#define I2C_ALGO_SMBUS 0x040000
#define I2C_ALGO_ISA 0x050000 /* lm_sensors ISA pseudo-adapter */
-#define I2C_ALGO_SAA714 0x060000 /* SAA 7146 video decoder bus */
-#define I2C_ALGO_SAA7146A 0x060001 /* SAA 7146A - enhanced version */
-
+#define I2C_ALGO_SAA7146 0x060000 /* SAA 7146 video decoder bus */
#define I2C_ALGO_EXP 0x800000 /* experimental */
@@ -120,6 +118,7 @@
#define I2C_HW_B_HYDRA 0x08 /* Apple Hydra Mac I/O */
#define I2C_HW_B_G400 0x09 /* Matrox G400 */
#define I2C_HW_B_I810 0x0a /* Intel I810 */
+#define I2C_HW_B_VOO 0x0b /* 3dfx Voodoo 3 / Banshee */
#define I2C_HW_B_RIVA 0x10 /* Riva based graphics cards */
#define I2C_HW_B_IOC 0x11 /* IOC bit-wiggling */
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 3aa308bc2..f1f82a1c8 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -23,7 +23,7 @@
/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and
Frodo Looijaard <frodol@dds.nl> */
-/* $Id: i2c.h,v 1.36 2000/01/18 23:54:07 frodo Exp $ */
+/* $Id: i2c.h,v 1.37 2000/02/15 17:57:27 frodo Exp $ */
#ifndef I2C_H
#define I2C_H
@@ -441,6 +441,7 @@ union i2c_smbus_data {
#define I2C_TENBIT 0x0704 /* 0 for 7 bit addrs, != 0 for 10 bit */
#define I2C_FUNCS 0x0705 /* Get the adapter functionality */
+#define I2C_RDWR 0x0707 /* Combined R/W transfer (one stop only)*/
#if 0
#define I2C_ACK_TEST 0x0710 /* See if a slave is at a specific adress */
#endif
@@ -452,7 +453,6 @@ union i2c_smbus_data {
/* written byte (except address) */
#define I2C_MDELAY 0x0706 /* millisec delay between written bytes */
-
/* ----- I2C-DEV: char device interface stuff ------------------------- */
#define I2C_MAJOR 89 /* Device major number */
diff --git a/include/linux/icmp.h b/include/linux/icmp.h
index fb4ed8b9a..292888923 100644
--- a/include/linux/icmp.h
+++ b/include/linux/icmp.h
@@ -82,10 +82,31 @@ struct icmphdr {
#ifdef __KERNEL__
+#include <linux/ip.h>
+
struct icmp_err {
int errno;
unsigned fatal:1;
};
+
+/*
+ * Build xmit assembly blocks
+ */
+
+struct icmp_bxm
+{
+ void *data_ptr;
+ int data_len;
+ struct icmphdr icmph;
+ unsigned long csum;
+ struct ip_options replyopts;
+ unsigned char optbuf[40];
+};
+
+struct sk_buff;
+
+extern void icmp_reply(struct icmp_bxm *, struct sk_buff *);
+
#endif
/*
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index d5b204c2c..02341868d 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -15,8 +15,10 @@
#define barrier() __asm__ __volatile__("": : :"memory")
#define INT_MAX ((int)(~0U>>1))
+#define INT_MIN (-INT_MAX - 1)
#define UINT_MAX (~0U)
#define LONG_MAX ((long)(~0UL>>1))
+#define LONG_MIN (-LONG_MAX - 1)
#define ULONG_MAX (~0UL)
#define STACK_MAGIC 0xdeadbeef
diff --git a/include/linux/module.h b/include/linux/module.h
index 915342edd..7507d6add 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -207,15 +207,13 @@ extern struct module __this_module;
#define MOD_DEC_USE_COUNT __MOD_DEC_USE_COUNT(THIS_MODULE)
#define MOD_IN_USE __MOD_IN_USE(THIS_MODULE)
-#ifndef __NO_VERSION__
#include <linux/version.h>
-const char __module_kernel_version[] __attribute__((section(".modinfo"))) =
+static const char __module_kernel_version[] __attribute__((section(".modinfo"))) =
"kernel_version=" UTS_RELEASE;
#ifdef MODVERSIONS
-const char __module_using_checksums[] __attribute__((section(".modinfo"))) =
+static const char __module_using_checksums[] __attribute__((section(".modinfo"))) =
"using_checksums=1";
#endif
-#endif
#else /* MODULE */
diff --git a/include/linux/mount.h b/include/linux/mount.h
index 86dc89c47..c2dcfe93f 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -30,14 +30,10 @@ struct vfsmount
kdev_t mnt_dev; /* Device this applies to */
char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */
char *mnt_dirname; /* Name of directory mounted on */
- unsigned int mnt_flags; /* Flags of this device */
struct super_block *mnt_sb; /* pointer to superblock */
- struct quota_mount_options mnt_dquot; /* Diskquota specific mount options */
struct vfsmount *mnt_next; /* pointer to next in linkedlist */
};
-struct vfsmount *lookup_vfsmnt(kdev_t dev);
-
/*
* Umount options
*/
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 9b72c14de..c18810e52 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -16,7 +16,8 @@
#define NF_ACCEPT 1
#define NF_STOLEN 2
#define NF_QUEUE 3
-#define NF_MAX_VERDICT NF_QUEUE
+#define NF_REPEAT 4
+#define NF_MAX_VERDICT NF_REPEAT
/* Generic cache responses from hook functions. */
#define NFC_ALTERED 0x8000
@@ -66,6 +67,10 @@ struct nf_sockopt_ops
int get_optmin;
int get_optmax;
int (*get)(struct sock *sk, int optval, void *user, int *len);
+
+ /* Number of users inside set() or get(). */
+ unsigned int use;
+ struct task_struct *cleanup_task;
};
/* Each queued (to userspace) skbuff has one of these. */
@@ -173,12 +178,4 @@ extern void nf_invalidate_cache(int pf);
#define SUMIN(a,b) ((size_t)(a)<(size_t)(b) ? (ssize_t)(a) : (ssize_t)(b))
#endif /*__KERNEL__*/
-enum nf_reason {
- /* Do not, NOT, reorder these. Add at end. */
- NF_REASON_NONE,
- NF_REASON_SET_BY_IPCHAINS,
- NF_REASON_FOR_ROUTING,
- NF_REASON_FOR_CLS_FW,
-};
-
#endif /*__LINUX_NETFILTER_H*/
diff --git a/include/linux/netfilter_ipv4.h b/include/linux/netfilter_ipv4.h
index 6111c47d8..3a41356db 100644
--- a/include/linux/netfilter_ipv4.h
+++ b/include/linux/netfilter_ipv4.h
@@ -49,6 +49,16 @@
#define NF_IP_POST_ROUTING 4
#define NF_IP_NUMHOOKS 5
+enum nf_ip_hook_priorities {
+ NF_IP_PRI_FIRST = INT_MIN,
+ NF_IP_PRI_CONNTRACK = -200,
+ NF_IP_PRI_MANGLE = -150,
+ NF_IP_PRI_NAT_DST = -100,
+ NF_IP_PRI_FILTER = 0,
+ NF_IP_PRI_NAT_SRC = 100,
+ NF_IP_PRI_LAST = INT_MAX,
+};
+
#ifdef CONFIG_NETFILTER_DEBUG
#ifdef __KERNEL__
void nf_debug_ip_local_deliver(struct sk_buff *skb);
diff --git a/include/linux/netfilter_ipv4/compat_firewall.h b/include/linux/netfilter_ipv4/compat_firewall.h
new file mode 100644
index 000000000..ed07ff91c
--- /dev/null
+++ b/include/linux/netfilter_ipv4/compat_firewall.h
@@ -0,0 +1,45 @@
+/* Minor modifications to fit on compatibility framework:
+ Rusty.Russell@rustcorp.com.au
+*/
+
+#ifndef __LINUX_FIREWALL_H
+#define __LINUX_FIREWALL_H
+
+/*
+ * Definitions for loadable firewall modules
+ */
+
+#define FW_QUEUE 0
+#define FW_BLOCK 1
+#define FW_ACCEPT 2
+#define FW_REJECT (-1)
+#define FW_REDIRECT 3
+#define FW_MASQUERADE 4
+#define FW_SKIP 5
+
+struct firewall_ops
+{
+ struct firewall_ops *next;
+ int (*fw_forward)(struct firewall_ops *this, int pf,
+ struct net_device *dev, void *phdr, void *arg,
+ struct sk_buff **pskb);
+ int (*fw_input)(struct firewall_ops *this, int pf,
+ struct net_device *dev, void *phdr, void *arg,
+ struct sk_buff **pskb);
+ int (*fw_output)(struct firewall_ops *this, int pf,
+ struct net_device *dev, void *phdr, void *arg,
+ struct sk_buff **pskb);
+ /* These may be NULL. */
+ int (*fw_acct_in)(struct firewall_ops *this, int pf,
+ struct net_device *dev, void *phdr, void *arg,
+ struct sk_buff **pskb);
+ int (*fw_acct_out)(struct firewall_ops *this, int pf,
+ struct net_device *dev, void *phdr, void *arg,
+ struct sk_buff **pskb);
+};
+
+extern int register_firewall(int pf, struct firewall_ops *fw);
+extern int unregister_firewall(int pf, struct firewall_ops *fw);
+
+extern int ip_fw_masq_timeouts(void *user, int len);
+#endif /* __LINUX_FIREWALL_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack.h b/include/linux/netfilter_ipv4/ip_conntrack.h
new file mode 100644
index 000000000..12cf75136
--- /dev/null
+++ b/include/linux/netfilter_ipv4/ip_conntrack.h
@@ -0,0 +1,177 @@
+#ifndef _IP_CONNTRACK_H
+#define _IP_CONNTRACK_H
+/* Connection state tracking for netfilter. This is separated from,
+ but required by, the NAT layer; it can also be used by an iptables
+ extension. */
+
+#include <linux/config.h>
+#include <linux/netfilter_ipv4/ip_conntrack_tuple.h>
+
+enum ip_conntrack_info
+{
+ /* Part of an established connection (either direction). */
+ IP_CT_ESTABLISHED,
+
+ /* Like NEW, but related to an existing connection, or ICMP error
+ (in either direction). */
+ IP_CT_RELATED,
+
+ /* Started a new connection to track (only
+ IP_CT_DIR_ORIGINAL); may be a retransmission. */
+ IP_CT_NEW,
+
+ /* >= this indicates reply direction */
+ IP_CT_IS_REPLY,
+
+ /* Number of distinct IP_CT types (no NEW in reply dirn). */
+ IP_CT_NUMBER = IP_CT_IS_REPLY * 2 - 1
+};
+
+#ifdef __KERNEL__
+
+#include <linux/types.h>
+#include <linux/skbuff.h>
+
+#ifdef CONFIG_NF_DEBUG
+#define IP_NF_ASSERT(x) \
+do { \
+ if (!(x)) \
+ /* Wooah! I'm tripping my conntrack in a frenzy of \
+ netplay... */ \
+ printk("NF_IP_ASSERT: %s:%i(%s)\n", \
+ __FILE__, __LINE__, __FUNCTION__); \
+} while(0)
+#else
+#define IP_NF_ASSERT(x)
+#endif
+
+/* Bitset representing status of connection. */
+enum ip_conntrack_status {
+ /* It's an expected connection: bit 0 set. This bit never changed */
+ IPS_EXPECTED = 0x01,
+
+ /* We've seen packets both ways: bit 1 set. Can be set, not unset. */
+ IPS_SEEN_REPLY = 0x02
+};
+
+struct ip_conntrack_expect
+{
+ /* Internal linked list */
+ struct list_head list;
+
+ /* We expect this tuple, but DON'T CARE ABOUT THE SOURCE
+ per-protocol part. */
+ struct ip_conntrack_tuple tuple;
+
+ /* The conntrack we are part of (set iff we're live) */
+ struct ip_conntrack *expectant;
+};
+
+#if defined(CONFIG_IP_NF_NAT) || defined(CONFIG_IP_NF_NAT_MODULE)
+#include <linux/netfilter_ipv4/ip_nat.h>
+#endif
+
+#if defined(CONFIG_IP_NF_FTP) || defined(CONFIG_IP_NF_FTP_MODULE)
+#include <linux/netfilter_ipv4/ip_conntrack_ftp.h>
+#if defined(CONFIG_IP_NF_NAT) || defined(CONFIG_IP_NF_NAT_MODULE)
+#include <linux/netfilter_ipv4/ip_nat_ftp.h>
+#endif
+#endif
+
+struct ip_conntrack
+{
+ /* Usage count in here is 1 for destruct timer, 1 per skb,
+ plus 1 for any connection(s) we are `master' for */
+ struct nf_conntrack ct_general;
+
+ /* These are my tuples; original and reply */
+ struct ip_conntrack_tuple_hash tuplehash[IP_CT_DIR_MAX];
+
+ /* Have we seen traffic both ways yet? (bitset) */
+ unsigned int status;
+
+ /* Timer function; drops refcnt when it goes off. */
+ struct timer_list timeout;
+
+ /* If we're expecting another related connection, this will be
+ in expected linked list */
+ struct ip_conntrack_expect expected;
+
+ /* If we were expected by another connection, this will be it */
+ struct nf_ct_info master;
+
+ /* Helper, if any. */
+ struct ip_conntrack_helper *helper;
+
+ /* Our various nf_ct_info structs specify *what* relation this
+ packet has to the conntrack */
+ struct nf_ct_info infos[IP_CT_NUMBER];
+
+ /* Storage reserved for other modules: */
+
+ union {
+ int /*enum tcp_conntrack*/ tcp_state;
+ } proto;
+
+ union {
+#if defined(CONFIG_IP_NF_FTP) || defined(CONFIG_IP_NF_FTP_MODULE)
+ struct ip_ct_ftp ct_ftp_info;
+#endif
+ } help;
+
+#if defined(CONFIG_IP_NF_NAT) || defined(CONFIG_IP_NF_NAT_MODULE)
+ struct {
+ struct ip_nat_info info;
+ union {
+#if defined(CONFIG_IP_NF_FTP) || defined(CONFIG_IP_NF_FTP_MODULE)
+ struct ip_nat_ftp_info ftp_info[IP_CT_DIR_MAX];
+#endif
+ } help;
+#if defined(CONFIG_IP_NF_TARGET_MASQUERADE) || \
+ defined(CONFIG_IP_NF_TARGET_MASQUERADE_MODULE)
+ int masq_index;
+#endif
+ } nat;
+#endif /* CONFIG_IP_NF_NAT || CONFIG_IP_NF_NAT_MODULE */
+
+};
+
+/* Alter reply tuple (maybe alter helper). If it's already taken,
+ return 0 and don't do alteration. */
+extern int
+ip_conntrack_alter_reply(struct ip_conntrack *conntrack,
+ const struct ip_conntrack_tuple *newreply);
+
+/* Is this tuple taken? (ignoring any belonging to the given
+ conntrack). */
+extern int
+ip_conntrack_tuple_taken(const struct ip_conntrack_tuple *tuple,
+ const struct ip_conntrack *ignored_conntrack);
+
+/* Return conntrack_info and tuple hash for given skb. */
+extern struct ip_conntrack *
+ip_conntrack_get(struct sk_buff *skb, enum ip_conntrack_info *ctinfo);
+
+extern struct module *ip_conntrack_module;
+
+extern int invert_tuplepr(struct ip_conntrack_tuple *inverse,
+ const struct ip_conntrack_tuple *orig);
+
+/* Refresh conntrack for this many jiffies */
+extern void ip_ct_refresh(struct ip_conntrack *ct,
+ unsigned long extra_jiffies);
+
+/* These are for NAT. Icky. */
+/* Call me when a conntrack is destroyed. */
+extern void (*ip_conntrack_destroyed)(struct ip_conntrack *conntrack);
+
+/* Returns new sk_buff, or NULL */
+struct sk_buff *
+ip_ct_gather_frags(struct sk_buff *skb);
+
+/* Delete all conntracks which match. */
+extern void
+ip_ct_selective_cleanup(int (*kill)(const struct ip_conntrack *i, void *data),
+ void *data);
+#endif /* __KERNEL__ */
+#endif /* _IP_CONNTRACK_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_core.h b/include/linux/netfilter_ipv4/ip_conntrack_core.h
new file mode 100644
index 000000000..9cb49afaf
--- /dev/null
+++ b/include/linux/netfilter_ipv4/ip_conntrack_core.h
@@ -0,0 +1,39 @@
+#ifndef _IP_CONNTRACK_CORE_H
+#define _IP_CONNTRACK_CORE_H
+#include <linux/netfilter_ipv4/lockhelp.h>
+
+/* This header is used to share core functionality between the
+ standalone connection tracking module, and the compatibility layer's use
+ of connection tracking. */
+extern unsigned int ip_conntrack_in(unsigned int hooknum,
+ struct sk_buff **pskb,
+ const struct net_device *in,
+ const struct net_device *out,
+ int (*okfn)(struct sk_buff *));
+
+extern int ip_conntrack_init(void);
+extern void ip_conntrack_cleanup(void);
+
+struct ip_conntrack_protocol;
+extern struct ip_conntrack_protocol *find_proto(u_int8_t protocol);
+/* Like above, but you already have conntrack read lock. */
+extern struct ip_conntrack_protocol *__find_proto(u_int8_t protocol);
+extern struct list_head protocol_list;
+
+/* Returns TRUE if it dealt with ICMP, and filled in skb->nfct */
+int icmp_error_track(struct sk_buff *skb);
+extern int get_tuple(const struct iphdr *iph, size_t len,
+ struct ip_conntrack_tuple *tuple,
+ struct ip_conntrack_protocol *protocol);
+
+/* Find a connection corresponding to a tuple. */
+struct ip_conntrack_tuple_hash *
+ip_conntrack_find_get(const struct ip_conntrack_tuple *tuple,
+ const struct ip_conntrack *ignored_conntrack);
+
+extern unsigned int ip_conntrack_htable_size;
+extern struct list_head *ip_conntrack_hash;
+extern struct list_head expect_list;
+DECLARE_RWLOCK_EXTERN(ip_conntrack_lock);
+#endif /* _IP_CONNTRACK_CORE_H */
+
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_ftp.h b/include/linux/netfilter_ipv4/ip_conntrack_ftp.h
new file mode 100644
index 000000000..a164aed4f
--- /dev/null
+++ b/include/linux/netfilter_ipv4/ip_conntrack_ftp.h
@@ -0,0 +1,41 @@
+#ifndef _IP_CONNTRACK_FTP_H
+#define _IP_CONNTRACK_FTP_H
+/* FTP tracking. */
+
+#ifndef __KERNEL__
+#error Only in kernel.
+#endif
+
+#include <linux/netfilter_ipv4/lockhelp.h>
+
+/* Protects ftp part of conntracks */
+DECLARE_LOCK_EXTERN(ip_ftp_lock);
+
+enum ip_ct_ftp_type
+{
+ /* PORT command from client */
+ IP_CT_FTP_PORT = IP_CT_DIR_ORIGINAL,
+ /* PASV response from server */
+ IP_CT_FTP_PASV = IP_CT_DIR_REPLY
+};
+
+/* Protected by ip_conntrack_lock */
+/* We record seq number and length of ftp ip/port text here: all in
+ host order. */
+struct ip_ct_ftp
+{
+ /* This tells NAT that this is an ftp connection */
+ int is_ftp;
+ u_int32_t seq;
+ /* 0 means not found yet */
+ u_int32_t len;
+ enum ip_ct_ftp_type ftptype;
+ /* Port that was to be used */
+ u_int16_t port;
+ /* Next valid seq position for cmd matching after newline */
+ u_int32_t seq_aft_nl[IP_CT_DIR_MAX];
+ /* 0 means seq_match_aft_nl not set */
+ int seq_aft_nl_set[IP_CT_DIR_MAX];
+};
+
+#endif /* _IP_CONNTRACK_FTP_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_helper.h b/include/linux/netfilter_ipv4/ip_conntrack_helper.h
new file mode 100644
index 000000000..006cedef5
--- /dev/null
+++ b/include/linux/netfilter_ipv4/ip_conntrack_helper.h
@@ -0,0 +1,30 @@
+/* IP connection tracking helpers. */
+#ifndef _IP_CONNTRACK_HELPER_H
+#define _IP_CONNTRACK_HELPER_H
+#include <linux/netfilter_ipv4/ip_conntrack.h>
+
+struct module;
+
+struct ip_conntrack_helper
+{
+ /* Internal use. */
+ struct list_head list;
+
+ /* Returns TRUE if it wants to help this connection (tuple is
+ the tuple of REPLY packets from server). */
+ int (*will_help)(const struct ip_conntrack_tuple *rtuple);
+
+ /* Function to call when data passes; return verdict, or -1 to
+ invalidate. */
+ int (*help)(const struct iphdr *, size_t len,
+ struct ip_conntrack *ct,
+ enum ip_conntrack_info conntrackinfo);
+};
+
+extern int ip_conntrack_helper_register(struct ip_conntrack_helper *);
+extern void ip_conntrack_helper_unregister(struct ip_conntrack_helper *);
+
+/* Add an expected connection. */
+extern int ip_conntrack_expect_related(struct ip_conntrack *related_to,
+ const struct ip_conntrack_tuple *tuple);
+#endif /*_IP_CONNTRACK_HELPER_H*/
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_protocol.h b/include/linux/netfilter_ipv4/ip_conntrack_protocol.h
new file mode 100644
index 000000000..3c1b4a4c6
--- /dev/null
+++ b/include/linux/netfilter_ipv4/ip_conntrack_protocol.h
@@ -0,0 +1,58 @@
+/* Header for use in defining a given protocol for connection tracking. */
+#ifndef _IP_CONNTRACK_PROTOCOL_H
+#define _IP_CONNTRACK_PROTOCOL_H
+#include <linux/netfilter_ipv4/ip_conntrack.h>
+
+struct ip_conntrack_protocol
+{
+ /* Next pointer. */
+ struct list_head list;
+
+ /* Protocol number. */
+ u_int8_t proto;
+
+ /* Protocol name */
+ const char *name;
+
+ /* Try to fill in the third arg; return true if possible. */
+ int (*pkt_to_tuple)(const void *datah, size_t datalen,
+ struct ip_conntrack_tuple *tuple);
+
+ /* Invert the per-proto part of the tuple: ie. turn xmit into reply.
+ * Some packets can't be inverted: return 0 in that case.
+ */
+ int (*invert_tuple)(struct ip_conntrack_tuple *inverse,
+ const struct ip_conntrack_tuple *orig);
+
+ /* Print out the per-protocol part of the tuple. */
+ unsigned int (*print_tuple)(char *buffer,
+ const struct ip_conntrack_tuple *);
+
+ /* Print out the private part of the conntrack. */
+ unsigned int (*print_conntrack)(char *buffer,
+ const struct ip_conntrack *);
+
+ /* Returns verdict for packet, or -1 for invalid. */
+ int (*packet)(struct ip_conntrack *conntrack,
+ struct iphdr *iph, size_t len,
+ enum ip_conntrack_info ctinfo);
+
+ /* Called when a new connection for this protocol found; returns
+ * TRUE if it's OK. If so, packet() called next. */
+ int (*new)(struct ip_conntrack *conntrack,
+ struct iphdr *iph, size_t len);
+
+ /* Module (if any) which this is connected to. */
+ struct module *me;
+};
+
+/* Protocol registration. */
+extern int ip_conntrack_protocol_register(struct ip_conntrack_protocol *proto);
+extern void ip_conntrack_protocol_unregister(struct ip_conntrack_protocol *proto);
+
+/* Existing built-in protocols */
+extern struct ip_conntrack_protocol ip_conntrack_protocol_tcp;
+extern struct ip_conntrack_protocol ip_conntrack_protocol_udp;
+extern struct ip_conntrack_protocol ip_conntrack_protocol_icmp;
+extern int ip_conntrack_protocol_tcp_init(void);
+#endif /*_IP_CONNTRACK_PROTOCOL_H*/
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_tuple.h b/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
new file mode 100644
index 000000000..c0a845caf
--- /dev/null
+++ b/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
@@ -0,0 +1,105 @@
+#ifndef _IP_CONNTRACK_TUPLE_H
+#define _IP_CONNTRACK_TUPLE_H
+
+/* A `tuple' is a structure containing the information to uniquely
+ identify a connection. ie. if two packets have the same tuple, they
+ are in the same connection; if not, they are not.
+
+ We divide the structure along "manipulatable" and
+ "non-manipulatable" lines, for the benefit of the NAT code.
+*/
+
+/* The protocol-specific manipulable parts of the tuple. */
+union ip_conntrack_manip_proto
+{
+ /* Add other protocols here. */
+ u_int16_t all;
+
+ struct {
+ u_int16_t port;
+ } tcp;
+ struct {
+ u_int16_t port;
+ } udp;
+ struct {
+ u_int16_t id;
+ } icmp;
+};
+
+/* The manipulable part of the tuple. */
+struct ip_conntrack_manip
+{
+ u_int32_t ip;
+ union ip_conntrack_manip_proto u;
+ u_int16_t pad; /* Must be set to 0 for memcmp. */
+};
+
+/* This contains the information to distinguish a connection. */
+struct ip_conntrack_tuple
+{
+ struct ip_conntrack_manip src;
+
+ /* These are the parts of the tuple which are fixed. */
+ struct {
+ u_int32_t ip;
+ union {
+ /* Add other protocols here. */
+ u_int16_t all;
+
+ struct {
+ u_int16_t port;
+ } tcp;
+ struct {
+ u_int16_t port;
+ } udp;
+ struct {
+ u_int8_t type, code;
+ } icmp;
+ } u;
+
+ /* The protocol. */
+ u_int16_t protonum;
+ } dst;
+};
+
+#define IP_PARTS_NATIVE(n) \
+(unsigned int)((n)>>24)&0xFF, \
+(unsigned int)((n)>>16)&0xFF, \
+(unsigned int)((n)>>8)&0xFF, \
+(unsigned int)((n)&0xFF)
+
+#define IP_PARTS(n) IP_PARTS_NATIVE(ntohl(n))
+
+#ifdef __KERNEL__
+
+#define DUMP_TUPLE(tp) \
+DEBUGP("tuple %p: %u %u.%u.%u.%u:%u -> %u.%u.%u.%u:%u\n", \
+ (tp), (tp)->dst.protonum, \
+ IP_PARTS((tp)->src.ip), ntohs((tp)->src.u.all), \
+ IP_PARTS((tp)->dst.ip), ntohs((tp)->dst.u.all))
+
+#define CTINFO2DIR(ctinfo) ((ctinfo) == IP_CT_IS_REPLY ? IP_CT_DIR_REPLY : IP_CT_DIR_ORIGINAL)
+
+/* If we're the first tuple, it's the original dir. */
+#define DIRECTION(h) ((enum ip_conntrack_dir)(&(h)->ctrack->tuplehash[1] == (h)))
+
+enum ip_conntrack_dir
+{
+ IP_CT_DIR_ORIGINAL,
+ IP_CT_DIR_REPLY,
+ IP_CT_DIR_MAX
+};
+
+/* Connections have two entries in the hash table: one for each way */
+struct ip_conntrack_tuple_hash
+{
+ struct list_head list;
+
+ struct ip_conntrack_tuple tuple;
+
+ /* this == &ctrack->tuplehash[DIRECTION(this)]. */
+ struct ip_conntrack *ctrack;
+};
+
+#endif /* __KERNEL__ */
+#endif /* _IP_CONNTRACK_TUPLE_H */
diff --git a/include/linux/netfilter_ipv4/ip_nat.h b/include/linux/netfilter_ipv4/ip_nat.h
new file mode 100644
index 000000000..8eb37d6d5
--- /dev/null
+++ b/include/linux/netfilter_ipv4/ip_nat.h
@@ -0,0 +1,117 @@
+#ifndef _IP_NAT_H
+#define _IP_NAT_H
+#include <linux/netfilter_ipv4.h>
+#include <linux/netfilter_ipv4/ip_conntrack_tuple.h>
+
+#define IP_NAT_MAPPING_TYPE_MAX_NAMELEN 16
+
+enum ip_nat_manip_type
+{
+ IP_NAT_MANIP_SRC,
+ IP_NAT_MANIP_DST
+};
+
+/* SRC manip occurs only on POST_ROUTING */
+#define HOOK2MANIP(hooknum) ((hooknum) != NF_IP_POST_ROUTING)
+
+/* 2.3.19 (I hope) will define this in linux/netfilter_ipv4.h. */
+#ifndef SO_ORIGINAL_DST
+#define SO_ORIGINAL_DST 80
+#endif
+
+#define IP_NAT_RANGE_MAP_IPS 1
+#define IP_NAT_RANGE_PROTO_SPECIFIED 2
+/* Used internally by get_unique_tuple(). */
+#define IP_NAT_RANGE_FULL 4
+
+/* Single range specification. */
+struct ip_nat_range
+{
+ /* Set to OR of flags above. */
+ unsigned int flags;
+
+ /* Inclusive: network order. */
+ u_int32_t min_ip, max_ip;
+
+ /* Inclusive: network order */
+ union ip_conntrack_manip_proto min, max;
+};
+
+/* A range consists of an array of 1 or more ip_nat_range */
+struct ip_nat_multi_range
+{
+ unsigned int rangesize;
+
+ /* hangs off end. */
+ struct ip_nat_range range[1];
+};
+
+#ifdef __KERNEL__
+#include <linux/list.h>
+#include <linux/netfilter_ipv4/lockhelp.h>
+
+/* Protects NAT hash tables, and NAT-private part of conntracks. */
+DECLARE_RWLOCK_EXTERN(ip_nat_lock);
+
+/* Hashes for by-source and IP/protocol. */
+struct ip_nat_hash
+{
+ struct list_head list;
+
+ /* conntrack we're embedded in: NULL if not in hash. */
+ struct ip_conntrack *conntrack;
+};
+
+/* Worst case: local-out manip + 1 post-routing, and reverse dirn. */
+#define IP_NAT_MAX_MANIPS (2*3)
+
+struct ip_nat_info_manip
+{
+ /* The direction. */
+ u_int8_t direction;
+
+ /* Which hook the manipulation happens on. */
+ u_int8_t hooknum;
+
+ /* The manipulation type. */
+ u_int8_t maniptype;
+
+ /* Manipulations to occur at each conntrack in this dirn. */
+ struct ip_conntrack_manip manip;
+};
+
+/* The structure embedded in the conntrack structure. */
+struct ip_nat_info
+{
+ /* Set to zero when conntrack created: bitmask of maniptypes */
+ int initialized;
+
+ unsigned int num_manips;
+
+ /* Manipulations to be done on this conntrack. */
+ struct ip_nat_info_manip manips[IP_NAT_MAX_MANIPS];
+
+ /* The mapping type which created us (NULL for null mapping). */
+ const struct ip_nat_mapping_type *mtype;
+
+ struct ip_nat_hash bysource, byipsproto;
+
+ /* Helper (NULL if none). */
+ struct ip_nat_helper *helper;
+};
+
+/* Set up the info structure to map into this range. */
+extern unsigned int ip_nat_setup_info(struct ip_conntrack *conntrack,
+ const struct ip_nat_multi_range *mr,
+ unsigned int hooknum);
+
+/* Is this tuple already taken? (not by us)*/
+extern int ip_nat_used_tuple(const struct ip_conntrack_tuple *tuple,
+ const struct ip_conntrack *ignored_conntrack);
+
+/* Calculate relative checksum. */
+extern u_int16_t ip_nat_cheat_check(u_int32_t oldvalinv,
+ u_int32_t newval,
+ u_int16_t oldcheck);
+#endif /*__KERNEL__*/
+#endif
diff --git a/include/linux/netfilter_ipv4/ip_nat_core.h b/include/linux/netfilter_ipv4/ip_nat_core.h
new file mode 100644
index 000000000..28735e0c1
--- /dev/null
+++ b/include/linux/netfilter_ipv4/ip_nat_core.h
@@ -0,0 +1,33 @@
+#ifndef _IP_NAT_CORE_H
+#define _IP_NAT_CORE_H
+#include <linux/list.h>
+#include <linux/netfilter_ipv4/ip_conntrack.h>
+
+/* This header used to share core functionality between the standalone
+ NAT module, and the compatibility layer's use of NAT for masquerading. */
+extern int ip_nat_init(void);
+extern void ip_nat_cleanup(void);
+
+extern unsigned int do_bindings(struct ip_conntrack *ct,
+ enum ip_conntrack_info conntrackinfo,
+ struct ip_nat_info *info,
+ unsigned int hooknum,
+ struct sk_buff **pskb);
+
+extern struct list_head protos;
+
+extern void icmp_reply_translation(struct sk_buff *skb,
+ struct ip_conntrack *conntrack,
+ unsigned int hooknum,
+ int dir);
+
+extern void replace_in_hashes(struct ip_conntrack *conntrack,
+ struct ip_nat_info *info);
+extern void place_in_hashes(struct ip_conntrack *conntrack,
+ struct ip_nat_info *info);
+
+/* Built-in protocols. */
+extern struct ip_nat_protocol ip_nat_protocol_tcp;
+extern struct ip_nat_protocol ip_nat_protocol_udp;
+extern struct ip_nat_protocol ip_nat_protocol_icmp;
+#endif /* _IP_NAT_CORE_H */
diff --git a/include/linux/netfilter_ipv4/ip_nat_ftp.h b/include/linux/netfilter_ipv4/ip_nat_ftp.h
new file mode 100644
index 000000000..d84015529
--- /dev/null
+++ b/include/linux/netfilter_ipv4/ip_nat_ftp.h
@@ -0,0 +1,21 @@
+#ifndef _IP_NAT_FTP_H
+#define _IP_NAT_FTP_H
+/* FTP extension for TCP NAT alteration. */
+
+#ifndef __KERNEL__
+#error Only in kernel.
+#endif
+
+/* Protects ftp part of conntracks */
+DECLARE_LOCK_EXTERN(ip_ftp_lock);
+
+/* We keep track of where the last SYN correction was, and the SYN
+ offsets before and after that correction. Two of these (indexed by
+ direction). */
+struct ip_nat_ftp_info
+{
+ u_int32_t syn_correction_pos;
+ int32_t syn_offset_before, syn_offset_after;
+};
+
+#endif /* _IP_NAT_FTP_H */
diff --git a/include/linux/netfilter_ipv4/ip_nat_helper.h b/include/linux/netfilter_ipv4/ip_nat_helper.h
new file mode 100644
index 000000000..1578d6efc
--- /dev/null
+++ b/include/linux/netfilter_ipv4/ip_nat_helper.h
@@ -0,0 +1,30 @@
+#ifndef _IP_NAT_HELPER_H
+#define _IP_NAT_HELPER_H
+/* NAT protocol helper routines. */
+
+#include <linux/netfilter_ipv4/ip_conntrack.h>
+
+struct sk_buff;
+
+struct ip_nat_helper
+{
+ /* Internal use */
+ struct list_head list;
+
+ /* Here's the protocol and dst we care about. */
+ u_int16_t protocol;
+ u_int16_t protocol_dst;
+
+ /* Helper function: returns verdict */
+ unsigned int (*help)(struct ip_conntrack *ct,
+ struct ip_nat_info *info,
+ enum ip_conntrack_info ctinfo,
+ unsigned int hooknum,
+ struct sk_buff **pskb);
+
+ const char *name;
+};
+
+extern int ip_nat_helper_register(struct ip_nat_helper *me);
+extern void ip_nat_helper_unregister(struct ip_nat_helper *me);
+#endif
diff --git a/include/linux/netfilter_ipv4/ip_nat_protocol.h b/include/linux/netfilter_ipv4/ip_nat_protocol.h
new file mode 100644
index 000000000..42e2ebf33
--- /dev/null
+++ b/include/linux/netfilter_ipv4/ip_nat_protocol.h
@@ -0,0 +1,57 @@
+/* Header for use in defining a given protocol. */
+#ifndef _IP_NAT_PROTOCOL_H
+#define _IP_NAT_PROTOCOL_H
+#include <linux/init.h>
+#include <linux/list.h>
+
+struct iphdr;
+struct ip_nat_range;
+
+struct ip_nat_protocol
+{
+ struct list_head list;
+
+ /* Protocol name */
+ const char *name;
+
+ /* Protocol number. */
+ unsigned int protonum;
+
+ /* Do a packet translation according to the ip_nat_proto_manip
+ * and manip type. */
+ void (*manip_pkt)(struct iphdr *iph, size_t len,
+ const struct ip_conntrack_manip *manip,
+ enum ip_nat_manip_type maniptype);
+
+ /* Is the manipable part of the tuple between min and max incl? */
+ int (*in_range)(const struct ip_conntrack_tuple *tuple,
+ enum ip_nat_manip_type maniptype,
+ const union ip_conntrack_manip_proto *min,
+ const union ip_conntrack_manip_proto *max);
+
+ /* Alter the per-proto part of the tuple (depending on
+ maniptype), to give a unique tuple in the given range if
+ possible; return false if not. Per-protocol part of tuple
+ is initialized to the incoming packet. */
+ int (*unique_tuple)(struct ip_conntrack_tuple *tuple,
+ const struct ip_nat_range *range,
+ enum ip_nat_manip_type maniptype,
+ const struct ip_conntrack *conntrack);
+
+ unsigned int (*print)(char *buffer,
+ const struct ip_conntrack_tuple *match,
+ const struct ip_conntrack_tuple *mask);
+
+ unsigned int (*print_range)(char *buffer,
+ const struct ip_nat_range *range);
+};
+
+/* Protocol registration. */
+extern int ip_nat_protocol_register(struct ip_nat_protocol *proto);
+extern void ip_nat_protocol_unregister(struct ip_nat_protocol *proto);
+
+extern int init_protocols(void) __init;
+extern void cleanup_protocols(void);
+extern struct ip_nat_protocol *find_nat_proto(u_int16_t protonum);
+
+#endif /*_IP_NAT_PROTO_H*/
diff --git a/include/linux/netfilter_ipv4/ip_nat_rule.h b/include/linux/netfilter_ipv4/ip_nat_rule.h
new file mode 100644
index 000000000..6c92b285d
--- /dev/null
+++ b/include/linux/netfilter_ipv4/ip_nat_rule.h
@@ -0,0 +1,35 @@
+#ifndef _IP_NAT_RULE_H
+#define _IP_NAT_RULE_H
+#include <linux/netfilter_ipv4/ip_conntrack.h>
+#include <linux/netfilter_ipv4/ip_tables.h>
+#include <linux/netfilter_ipv4/ip_nat.h>
+
+#ifdef __KERNEL__
+/* Want to be told when we first NAT an expected packet for a conntrack? */
+struct ip_nat_expect
+{
+ struct list_head list;
+
+ /* Returns 1 (and sets verdict) if it has setup NAT for this
+ connection */
+ int (*expect)(struct sk_buff **pskb,
+ unsigned int hooknum,
+ struct ip_conntrack *ct,
+ struct ip_nat_info *info,
+ struct ip_conntrack *master,
+ struct ip_nat_info *masterinfo,
+ unsigned int *verdict);
+};
+
+extern int ip_nat_expect_register(struct ip_nat_expect *expect);
+extern void ip_nat_expect_unregister(struct ip_nat_expect *expect);
+extern int ip_nat_rule_init(void) __init;
+extern void ip_nat_rule_cleanup(void);
+extern int ip_nat_rule_find(struct sk_buff **pskb,
+ unsigned int hooknum,
+ const struct net_device *in,
+ const struct net_device *out,
+ struct ip_conntrack *ct,
+ struct ip_nat_info *info);
+#endif
+#endif /* _IP_NAT_RULE_H */
diff --git a/include/linux/netfilter_ipv4/ip_queue.h b/include/linux/netfilter_ipv4/ip_queue.h
new file mode 100644
index 000000000..8bbd6230f
--- /dev/null
+++ b/include/linux/netfilter_ipv4/ip_queue.h
@@ -0,0 +1,86 @@
+/*
+ * This is a module which is used for queueing IPv4 packets and
+ * communicating with userspace via netlink.
+ *
+ * (C) 2000 James Morris
+ */
+#ifndef _IP_QUEUE_H
+#define _IP_QUEUE_H
+
+#ifdef __KERNEL__
+#ifdef DEBUG_IPQ
+#define QDEBUG(x...) printk(KERN_DEBUG ## x)
+#else
+#define QDEBUG(x...)
+#endif /* DEBUG_IPQ */
+#else
+#include <net/if.h>
+#endif /* ! __KERNEL__ */
+
+/* Messages sent from kernel */
+typedef struct ipq_packet_msg {
+ unsigned long packet_id; /* ID of queued packet */
+ unsigned long mark; /* Netfilter mark value */
+ long timestamp_sec; /* Packet arrival time (seconds) */
+ long timestamp_usec; /* Packet arrvial time (+useconds) */
+ unsigned int hook; /* Netfilter hook we rode in on */
+ char indev_name[IFNAMSIZ]; /* Name of incoming interface */
+ char outdev_name[IFNAMSIZ]; /* Name of outgoing interface */
+ size_t data_len; /* Length of packet data */
+ /* Optional packet data follows */
+} ipq_packet_msg_t;
+
+/* Messages sent from userspace */
+typedef struct ipq_mode_msg {
+ unsigned char value; /* Requested mode */
+ size_t range; /* Optional range of packet requested */
+} ipq_mode_msg_t;
+
+typedef struct ipq_verdict_msg {
+ unsigned int value; /* Verdict to hand to netfilter */
+ unsigned long id; /* Packet ID for this verdict */
+ size_t data_len; /* Length of replacement data */
+ /* Optional replacement data follows */
+} ipq_verdict_msg_t;
+
+typedef struct ipq_peer_msg {
+ union {
+ ipq_verdict_msg_t verdict;
+ ipq_mode_msg_t mode;
+ } msg;
+} ipq_peer_msg_t;
+
+/* Each queued packet has one of these states */
+enum {
+ IPQ_PS_NEW, /* Newly arrived packet */
+ IPQ_PS_WAITING, /* User has been notified of packet,
+ we're waiting for a verdict */
+ IPQ_PS_VERDICT /* Packet has been assigned verdict,
+ waiting to be reinjected */
+};
+#define IPQ_PS_MAX IPQ_PS_VERDICT
+
+/* The queue operates in one of these states */
+enum {
+ IPQ_QS_HOLD, /* Hold all packets in queue */
+ IPQ_QS_COPY, /* Copy metadata and/or packets to user */
+ IPQ_QS_FLUSH /* Flush and drop all queue entries */
+};
+#define IPQ_QS_MAX IPQ_QS_FLUSH
+
+/* Modes requested by peer */
+enum {
+ IPQ_COPY_NONE, /* Copy nothing */
+ IPQ_COPY_META, /* Copy metadata */
+ IPQ_COPY_PACKET /* Copy metadata + packet (range) */
+};
+#define IPQ_COPY_MAX IPQ_COPY_PACKET
+
+/* Types of messages */
+#define IPQM_BASE 0x10 /* standard netlink messages below this */
+#define IPQM_MODE (IPQM_BASE + 1) /* Mode request from peer */
+#define IPQM_VERDICT (IPQM_BASE + 2) /* Verdict from peer */
+#define IPQM_PACKET (IPQM_BASE + 3) /* Packet from kernel */
+#define IPQM_MAX (IPQM_BASE + 4)
+
+#endif /*_IP_QUEUE_H*/
diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h
new file mode 100644
index 000000000..20361b064
--- /dev/null
+++ b/include/linux/netfilter_ipv4/ip_tables.h
@@ -0,0 +1,420 @@
+/*
+ * 25-Jul-1998 Major changes to allow for ip chain table
+ *
+ * 3-Jan-2000 Named tables to allow packet selection for different uses.
+ */
+
+/*
+ * Format of an IP firewall descriptor
+ *
+ * src, dst, src_mask, dst_mask are always stored in network byte order.
+ * flags are stored in host byte order (of course).
+ * Port numbers are stored in HOST byte order.
+ */
+
+#ifndef _IPTABLES_H
+#define _IPTABLES_H
+
+#ifdef __KERNEL__
+#include <linux/if.h>
+#include <linux/types.h>
+#include <linux/in.h>
+#include <linux/ip.h>
+#include <linux/skbuff.h>
+#endif
+#include <linux/netfilter_ipv4.h>
+
+#define IPT_FUNCTION_MAXNAMELEN 32
+#define IPT_TABLE_MAXNAMELEN 32
+
+/* Yes, Virginia, you have to zero the padding. */
+struct ipt_ip {
+ /* Source and destination IP addr */
+ struct in_addr src, dst;
+ /* Mask for src and dest IP addr */
+ struct in_addr smsk, dmsk;
+ char iniface[IFNAMSIZ], outiface[IFNAMSIZ];
+ unsigned char iniface_mask[IFNAMSIZ], outiface_mask[IFNAMSIZ];
+
+ /* Protocol, 0 = ANY */
+ u_int16_t proto;
+
+ /* Flags word */
+ u_int8_t flags;
+ /* Inverse flags */
+ u_int8_t invflags;
+};
+
+struct ipt_entry_match
+{
+ /* Total length */
+ u_int16_t match_size;
+ union {
+ /* Used by userspace */
+ char name[IPT_FUNCTION_MAXNAMELEN];
+ /* Used inside the kernel */
+ struct ipt_match *match;
+ } u;
+
+ unsigned char data[0];
+};
+
+struct ipt_entry_target
+{
+ /* Total length */
+ u_int16_t target_size;
+ union {
+ /* Used by userspace */
+ char name[IPT_FUNCTION_MAXNAMELEN];
+ /* Used inside the kernel */
+ struct ipt_target *target;
+ } u;
+
+ unsigned char data[0];
+};
+
+struct ipt_standard_target
+{
+ struct ipt_entry_target target;
+ int verdict;
+};
+
+struct ipt_counters
+{
+ u_int64_t pcnt, bcnt; /* Packet and byte counters */
+};
+
+/* Values for "flag" field in struct ipt_ip (general ip structure). */
+#define IPT_F_FRAG 0x01 /* Set if rule is a fragment rule */
+#define IPT_F_MASK 0x01 /* All possible flag bits mask. */
+
+/* Values for "inv" field in struct ipt_ip. */
+#define IPT_INV_VIA_IN 0x01 /* Invert the sense of IN IFACE. */
+#define IPT_INV_VIA_OUT 0x02 /* Invert the sense of OUT IFACE */
+#define IPT_INV_TOS 0x04 /* Invert the sense of TOS. */
+#define IPT_INV_SRCIP 0x08 /* Invert the sense of SRC IP. */
+#define IPT_INV_DSTIP 0x10 /* Invert the sense of DST OP. */
+#define IPT_INV_FRAG 0x20 /* Invert the sense of FRAG. */
+#define IPT_INV_PROTO 0x40 /* Invert the sense of PROTO. */
+#define IPT_INV_MASK 0x7F /* All possible flag bits mask. */
+
+/* This structure defines each of the firewall rules. Consists of 3
+ parts which are 1) general IP header stuff 2) match specific
+ stuff 3) the target to perform if the rule matches */
+struct ipt_entry
+{
+ struct ipt_ip ip;
+
+ /* Mark with fields that we care about. */
+ unsigned int nfcache;
+
+ /* Size of ipt_entry + matches */
+ u_int16_t target_offset;
+ /* Size of ipt_entry + matches + target */
+ u_int16_t next_offset;
+
+ /* Back pointer */
+ unsigned int comefrom;
+
+ /* Packet and byte counters. */
+ struct ipt_counters counters;
+
+ /* The matches (if any), then the target. */
+ unsigned char elems[0];
+};
+
+/*
+ * New IP firewall options for [gs]etsockopt at the RAW IP level.
+ * Unlike BSD Linux inherits IP options so you don't have to use a raw
+ * socket for this. Instead we check rights in the calls. */
+#define IPT_BASE_CTL 64 /* base for firewall socket options */
+
+#define IPT_SO_SET_REPLACE (IPT_BASE_CTL)
+#define IPT_SO_SET_ADD_COUNTERS (IPT_BASE_CTL + 1)
+#define IPT_SO_SET_MAX IPT_SO_SET_ADD_COUNTERS
+
+#define IPT_SO_GET_INFO (IPT_BASE_CTL)
+#define IPT_SO_GET_ENTRIES (IPT_BASE_CTL + 1)
+#define IPT_SO_GET_MAX IPT_SO_GET_ENTRIES
+
+/* CONTINUE verdict for targets */
+#define IPT_CONTINUE 0xFFFFFFFF
+
+/* For standard target */
+#define IPT_RETURN (-NF_MAX_VERDICT - 1)
+
+/* TCP matching stuff */
+struct ipt_tcp
+{
+ u_int16_t spts[2]; /* Source port range. */
+ u_int16_t dpts[2]; /* Destination port range. */
+ u_int8_t option; /* TCP Option iff non-zero*/
+ u_int8_t flg_mask; /* TCP flags mask byte */
+ u_int8_t flg_cmp; /* TCP flags compare byte */
+ u_int8_t invflags; /* Inverse flags */
+};
+
+/* Values for "inv" field in struct ipt_tcp. */
+#define IPT_TCP_INV_SRCPT 0x01 /* Invert the sense of source ports. */
+#define IPT_TCP_INV_DSTPT 0x02 /* Invert the sense of dest ports. */
+#define IPT_TCP_INV_FLAGS 0x04 /* Invert the sense of TCP flags. */
+#define IPT_TCP_INV_OPTION 0x08 /* Invert the sense of option test. */
+#define IPT_TCP_INV_MASK 0x0F /* All possible flags. */
+
+/* UDP matching stuff */
+struct ipt_udp
+{
+ u_int16_t spts[2]; /* Source port range. */
+ u_int16_t dpts[2]; /* Destination port range. */
+ u_int8_t invflags; /* Inverse flags */
+};
+
+/* Values for "invflags" field in struct ipt_udp. */
+#define IPT_UDP_INV_SRCPT 0x01 /* Invert the sense of source ports. */
+#define IPT_UDP_INV_DSTPT 0x02 /* Invert the sense of dest ports. */
+#define IPT_UDP_INV_MASK 0x03 /* All possible flags. */
+
+/* ICMP matching stuff */
+struct ipt_icmp
+{
+ u_int8_t type; /* type to match */
+ u_int8_t code[2]; /* range of code */
+ u_int8_t invflags; /* Inverse flags */
+};
+
+/* Values for "inv" field for struct ipt_icmp. */
+#define IPT_ICMP_INV 0x01 /* Invert the sense of type/code test */
+
+/* The argument to IPT_SO_GET_INFO */
+struct ipt_getinfo
+{
+ /* Which table: caller fills this in. */
+ char name[IPT_TABLE_MAXNAMELEN];
+
+ /* Kernel fills these in. */
+ /* Which hook entry points are valid: bitmask */
+ unsigned int valid_hooks;
+
+ /* Hook entry points: one per netfilter hook. */
+ unsigned int hook_entry[NF_IP_NUMHOOKS];
+
+ /* Underflow points. */
+ unsigned int underflow[NF_IP_NUMHOOKS];
+
+ /* Number of entries */
+ unsigned int num_entries;
+
+ /* Size of entries. */
+ unsigned int size;
+};
+
+/* The argument to IPT_SO_SET_REPLACE. */
+struct ipt_replace
+{
+ /* Which table. */
+ char name[IPT_TABLE_MAXNAMELEN];
+
+ /* Which hook entry points are valid: bitmask. You can't
+ change this. */
+ unsigned int valid_hooks;
+
+ /* Number of entries */
+ unsigned int num_entries;
+
+ /* Total size of new entries */
+ unsigned int size;
+
+ /* Hook entry points. */
+ unsigned int hook_entry[NF_IP_NUMHOOKS];
+
+ /* Underflow points. */
+ unsigned int underflow[NF_IP_NUMHOOKS];
+
+ /* Information about old entries: */
+ /* Number of counters (must be equal to current number of entries). */
+ unsigned int num_counters;
+ /* The old entries' counters. */
+ struct ipt_counters *counters;
+
+ /* The entries (hang off end: not really an array). */
+ struct ipt_entry entries[0];
+};
+
+/* The argument to IPT_SO_ADD_COUNTERS. */
+struct ipt_counters_info
+{
+ /* Which table. */
+ char name[IPT_TABLE_MAXNAMELEN];
+
+ unsigned int num_counters;
+
+ /* The counters (actually `number' of these). */
+ struct ipt_counters counters[0];
+};
+
+/* The argument to IPT_SO_GET_ENTRIES. */
+struct ipt_get_entries
+{
+ /* Which table: user fills this in. */
+ char name[IPT_TABLE_MAXNAMELEN];
+
+ /* User fills this in: total entry size. */
+ unsigned int size;
+
+ /* The entries. */
+ unsigned char entries[0];
+};
+
+/* Standard return verdict, or do jump. */
+#define IPT_STANDARD_TARGET ""
+/* Error verdict. */
+#define IPT_ERROR_TARGET "ERROR"
+
+/* Helper functions */
+extern __inline__ struct ipt_entry_target *
+ipt_get_target(struct ipt_entry *e)
+{
+ return (void *)e + e->target_offset;
+}
+
+/* fn returns 0 to continue iteration */
+#define IPT_MATCH_ITERATE(e, fn, args...) \
+({ \
+ unsigned int __i; \
+ int __ret = 0; \
+ struct ipt_entry_match *__m; \
+ \
+ for (__i = sizeof(struct ipt_entry); \
+ __i < (e)->target_offset; \
+ __i += __m->match_size) { \
+ __m = (void *)(e) + __i; \
+ \
+ __ret = fn(__m , ## args); \
+ if (__ret != 0) \
+ break; \
+ } \
+ __ret; \
+})
+
+/* fn returns 0 to continue iteration */
+#define IPT_ENTRY_ITERATE(entries, size, fn, args...) \
+({ \
+ unsigned int __i; \
+ int __ret = 0; \
+ struct ipt_entry *__e; \
+ \
+ for (__i = 0; __i < (size); __i += __e->next_offset) { \
+ __e = (void *)(entries) + __i; \
+ \
+ __ret = fn(__e , ## args); \
+ if (__ret != 0) \
+ break; \
+ } \
+ __ret; \
+})
+
+/*
+ * Main firewall chains definitions and global var's definitions.
+ */
+#ifdef __KERNEL__
+
+#include <linux/init.h>
+extern void ipt_init(void) __init;
+
+struct ipt_match
+{
+ struct list_head list;
+
+ const char name[IPT_FUNCTION_MAXNAMELEN];
+
+ /* Return true or false: return FALSE and set *hotdrop = 1 to
+ force immediate packet drop. */
+ int (*match)(const struct sk_buff *skb,
+ const struct net_device *in,
+ const struct net_device *out,
+ const void *matchinfo,
+ int offset,
+ const void *hdr,
+ u_int16_t datalen,
+ int *hotdrop);
+
+ /* Called when user tries to insert an entry of this type. */
+ /* Should return true or false. */
+ int (*checkentry)(const char *tablename,
+ const struct ipt_ip *ip,
+ void *matchinfo,
+ unsigned int matchinfosize,
+ unsigned int hook_mask);
+
+ /* Set this to THIS_MODULE if you are a module, otherwise NULL */
+ struct module *me;
+};
+
+/* Registration hooks for targets. */
+struct ipt_target
+{
+ struct list_head list;
+
+ const char name[IPT_FUNCTION_MAXNAMELEN];
+
+ /* Returns verdict. */
+ unsigned int (*target)(struct sk_buff **pskb,
+ unsigned int hooknum,
+ const struct net_device *in,
+ const struct net_device *out,
+ const void *targinfo,
+ void *userdata);
+
+ /* Called when user tries to insert an entry of this type:
+ hook_mask is a bitmask of hooks from which it can be
+ called. */
+ /* Should return true or false. */
+ int (*checkentry)(const char *tablename,
+ const struct ipt_entry *e,
+ void *targinfo,
+ unsigned int targinfosize,
+ unsigned int hook_mask);
+
+ /* Set this to THIS_MODULE if you are a module, otherwise NULL */
+ struct module *me;
+};
+
+extern int ipt_register_target(struct ipt_target *target);
+extern void ipt_unregister_target(struct ipt_target *target);
+
+extern int ipt_register_match(struct ipt_match *match);
+extern void ipt_unregister_match(struct ipt_match *match);
+
+/* Furniture shopping... */
+struct ipt_table
+{
+ struct list_head list;
+
+ /* A unique name... */
+ char name[IPT_TABLE_MAXNAMELEN];
+
+ /* Seed table: copied in register_table */
+ struct ipt_replace *table;
+
+ /* What hooks you will enter on */
+ unsigned int valid_hooks;
+
+ /* Lock for the curtain */
+ rwlock_t lock;
+
+ /* Man behind the curtain... */
+ struct ipt_table_info *private;
+};
+
+extern int ipt_register_table(struct ipt_table *table);
+extern void ipt_unregister_table(struct ipt_table *table);
+extern unsigned int ipt_do_table(struct sk_buff **pskb,
+ unsigned int hook,
+ const struct net_device *in,
+ const struct net_device *out,
+ struct ipt_table *table,
+ void *userdata);
+
+#define IPT_ALIGN(s) (((s) + (__alignof__(struct ipt_match)-1)) & ~(__alignof__(struct ipt_match)-1))
+#endif /*__KERNEL__*/
+#endif /* _IPTABLES_H */
diff --git a/include/linux/netfilter_ipv4/ipchains_core.h b/include/linux/netfilter_ipv4/ipchains_core.h
new file mode 100644
index 000000000..13546ff8d
--- /dev/null
+++ b/include/linux/netfilter_ipv4/ipchains_core.h
@@ -0,0 +1,193 @@
+/*
+ * This code is heavily based on the code in ip_fw.h; see that file for
+ * copyrights and attributions. This code is basically GPL.
+ *
+ * 15-Feb-1997: Major changes to allow graphs for firewall rules.
+ * Paul Russell <Paul.Russell@rustcorp.com.au> and
+ * Michael Neuling <Michael.Neuling@rustcorp.com.au>
+ * 2-Nov-1997: Changed types to __u16, etc.
+ * Removed IP_FW_F_TCPACK & IP_FW_F_BIDIR.
+ * Added inverse flags field.
+ * Removed multiple port specs.
+ */
+
+/*
+ * Format of an IP firewall descriptor
+ *
+ * src, dst, src_mask, dst_mask are always stored in network byte order.
+ * flags are stored in host byte order (of course).
+ * Port numbers are stored in HOST byte order.
+ */
+
+#ifndef _IP_FWCHAINS_H
+#define _IP_FWCHAINS_H
+
+#ifdef __KERNEL__
+#include <linux/icmp.h>
+#include <linux/in.h>
+#include <linux/ip.h>
+#include <linux/tcp.h>
+#include <linux/udp.h>
+#endif /* __KERNEL__ */
+#define IP_FW_MAX_LABEL_LENGTH 8
+typedef char ip_chainlabel[IP_FW_MAX_LABEL_LENGTH+1];
+
+struct ip_fw
+{
+ struct in_addr fw_src, fw_dst; /* Source and destination IP addr */
+ struct in_addr fw_smsk, fw_dmsk; /* Mask for src and dest IP addr */
+ __u32 fw_mark; /* ID to stamp on packet */
+ __u16 fw_proto; /* Protocol, 0 = ANY */
+ __u16 fw_flg; /* Flags word */
+ __u16 fw_invflg; /* Inverse flags */
+ __u16 fw_spts[2]; /* Source port range. */
+ __u16 fw_dpts[2]; /* Destination port range. */
+ __u16 fw_redirpt; /* Port to redirect to. */
+ __u16 fw_outputsize; /* Max amount to output to
+ NETLINK */
+ char fw_vianame[IFNAMSIZ]; /* name of interface "via" */
+ __u8 fw_tosand, fw_tosxor; /* Revised packet priority */
+};
+
+struct ip_fwuser
+{
+ struct ip_fw ipfw;
+ ip_chainlabel label;
+};
+
+/* Values for "fw_flg" field . */
+#define IP_FW_F_PRN 0x0001 /* Print packet if it matches */
+#define IP_FW_F_TCPSYN 0x0002 /* For tcp packets-check SYN only */
+#define IP_FW_F_FRAG 0x0004 /* Set if rule is a fragment rule */
+#define IP_FW_F_MARKABS 0x0008 /* Set the mark to fw_mark, not add. */
+#define IP_FW_F_WILDIF 0x0010 /* Need only match start of interface name. */
+#define IP_FW_F_NETLINK 0x0020 /* Redirect to netlink: 2.1.x only */
+#define IP_FW_F_MASK 0x003F /* All possible flag bits mask */
+
+/* Values for "fw_invflg" field. */
+#define IP_FW_INV_SRCIP 0x0001 /* Invert the sense of fw_src. */
+#define IP_FW_INV_DSTIP 0x0002 /* Invert the sense of fw_dst. */
+#define IP_FW_INV_PROTO 0x0004 /* Invert the sense of fw_proto. */
+#define IP_FW_INV_SRCPT 0x0008 /* Invert the sense of source ports. */
+#define IP_FW_INV_DSTPT 0x0010 /* Invert the sense of destination ports. */
+#define IP_FW_INV_VIA 0x0020 /* Invert the sense of fw_vianame. */
+#define IP_FW_INV_SYN 0x0040 /* Invert the sense of IP_FW_F_TCPSYN. */
+#define IP_FW_INV_FRAG 0x0080 /* Invert the sense of IP_FW_F_FRAG. */
+
+/*
+ * New IP firewall options for [gs]etsockopt at the RAW IP level.
+ * Unlike BSD Linux inherits IP options so you don't have to use
+ * a raw socket for this. Instead we check rights in the calls. */
+
+#define IP_FW_BASE_CTL 64 /* base for firewall socket options */
+
+#define IP_FW_APPEND (IP_FW_BASE_CTL) /* Takes ip_fwchange */
+#define IP_FW_REPLACE (IP_FW_BASE_CTL+1) /* Takes ip_fwnew */
+#define IP_FW_DELETE_NUM (IP_FW_BASE_CTL+2) /* Takes ip_fwdelnum */
+#define IP_FW_DELETE (IP_FW_BASE_CTL+3) /* Takes ip_fwchange */
+#define IP_FW_INSERT (IP_FW_BASE_CTL+4) /* Takes ip_fwnew */
+#define IP_FW_FLUSH (IP_FW_BASE_CTL+5) /* Takes ip_chainlabel */
+#define IP_FW_ZERO (IP_FW_BASE_CTL+6) /* Takes ip_chainlabel */
+#define IP_FW_CHECK (IP_FW_BASE_CTL+7) /* Takes ip_fwtest */
+#define IP_FW_MASQ_TIMEOUTS (IP_FW_BASE_CTL+8) /* Takes 3 ints */
+#define IP_FW_CREATECHAIN (IP_FW_BASE_CTL+9) /* Takes ip_chainlabel */
+#define IP_FW_DELETECHAIN (IP_FW_BASE_CTL+10) /* Takes ip_chainlabel */
+#define IP_FW_POLICY (IP_FW_BASE_CTL+11) /* Takes ip_fwpolicy */
+/* Masquerade control, only 1 optname */
+
+#define IP_FW_MASQ_CTL (IP_FW_BASE_CTL+12) /* General ip_masq ctl */
+
+/* Builtin chain labels */
+#define IP_FW_LABEL_FORWARD "forward"
+#define IP_FW_LABEL_INPUT "input"
+#define IP_FW_LABEL_OUTPUT "output"
+
+/* Special targets */
+#define IP_FW_LABEL_MASQUERADE "MASQ"
+#define IP_FW_LABEL_REDIRECT "REDIRECT"
+#define IP_FW_LABEL_ACCEPT "ACCEPT"
+#define IP_FW_LABEL_BLOCK "DENY"
+#define IP_FW_LABEL_REJECT "REJECT"
+#define IP_FW_LABEL_RETURN "RETURN"
+#define IP_FW_LABEL_QUEUE "QUEUE"
+
+/* Files in /proc/net */
+#define IP_FW_PROC_CHAINS "ip_fwchains"
+#define IP_FW_PROC_CHAIN_NAMES "ip_fwnames"
+
+
+struct ip_fwpkt
+{
+ struct iphdr fwp_iph; /* IP header */
+ union {
+ struct tcphdr fwp_tcph; /* TCP header or */
+ struct udphdr fwp_udph; /* UDP header */
+ struct icmphdr fwp_icmph; /* ICMP header */
+ } fwp_protoh;
+ struct in_addr fwp_via; /* interface address */
+ char fwp_vianame[IFNAMSIZ]; /* interface name */
+};
+
+/* The argument to IP_FW_DELETE and IP_FW_APPEND */
+struct ip_fwchange
+{
+ struct ip_fwuser fwc_rule;
+ ip_chainlabel fwc_label;
+};
+
+/* The argument to IP_FW_CHECK. */
+struct ip_fwtest
+{
+ struct ip_fwpkt fwt_packet; /* Packet to be tested */
+ ip_chainlabel fwt_label; /* Block to start test in */
+};
+
+/* The argument to IP_FW_DELETE_NUM */
+struct ip_fwdelnum
+{
+ __u32 fwd_rulenum;
+ ip_chainlabel fwd_label;
+};
+
+/* The argument to IP_FW_REPLACE and IP_FW_INSERT */
+struct ip_fwnew
+{
+ __u32 fwn_rulenum;
+ struct ip_fwuser fwn_rule;
+ ip_chainlabel fwn_label;
+};
+
+/* The argument to IP_FW_POLICY */
+struct ip_fwpolicy
+{
+ ip_chainlabel fwp_policy;
+ ip_chainlabel fwp_label;
+};
+/*
+ * timeouts for ip masquerading
+ */
+
+extern int ip_fw_masq_timeouts(void *, int);
+
+
+/*
+ * Main firewall chains definitions and global var's definitions.
+ */
+
+#ifdef __KERNEL__
+
+#include <linux/config.h>
+#include <linux/version.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)
+#include <linux/init.h>
+extern void ip_fw_init(void) __init;
+#else /* 2.0.x */
+extern void ip_fw_init(void);
+#endif /* 2.1.x */
+extern int ip_fw_ctl(int, void *, int);
+#ifdef CONFIG_IP_MASQUERADE
+extern int ip_masq_uctl(int, char *, int);
+#endif
+#endif /* KERNEL */
+
+#endif /* _IP_FWCHAINS_H */
diff --git a/include/linux/netfilter_ipv4/ipfwadm_core.h b/include/linux/netfilter_ipv4/ipfwadm_core.h
new file mode 100644
index 000000000..8294efd7e
--- /dev/null
+++ b/include/linux/netfilter_ipv4/ipfwadm_core.h
@@ -0,0 +1,256 @@
+#ifndef _IPFWADM_CORE_H
+#define _IPFWADM_CORE_H
+/* Minor modifications to fit on compatibility framework:
+ Rusty.Russell@rustcorp.com.au
+*/
+
+/*
+ * IP firewalling code. This is taken from 4.4BSD. Please note the
+ * copyright message below. As per the GPL it must be maintained
+ * and the licenses thus do not conflict. While this port is subject
+ * to the GPL I also place my modifications under the original
+ * license in recognition of the original copyright.
+ *
+ * Ported from BSD to Linux,
+ * Alan Cox 22/Nov/1994.
+ * Merged and included the FreeBSD-Current changes at Ugen's request
+ * (but hey it's a lot cleaner now). Ugen would prefer in some ways
+ * we waited for his final product but since Linux 1.2.0 is about to
+ * appear it's not practical - Read: It works, it's not clean but please
+ * don't consider it to be his standard of finished work.
+ * Alan.
+ *
+ * Fixes:
+ * Pauline Middelink : Added masquerading.
+ * Jos Vos : Separate input and output firewall
+ * chains, new "insert" and "append"
+ * commands to replace "add" commands,
+ * add ICMP header to struct ip_fwpkt.
+ * Jos Vos : Add support for matching device names.
+ * Willy Konynenberg : Add transparent proxying support.
+ * Jos Vos : Add options for input/output accounting.
+ *
+ * All the real work was done by .....
+ */
+
+/*
+ * Copyright (c) 1993 Daniel Boulet
+ * Copyright (c) 1994 Ugen J.S.Antsilevich
+ *
+ * Redistribution and use in source forms, with and without modification,
+ * are permitted provided that this entire comment appears intact.
+ *
+ * Redistribution in binary form may occur without any restrictions.
+ * Obviously, it would be nice if you gave credit where credit is due
+ * but requiring it would be too onerous.
+ *
+ * This software is provided ``AS IS'' without any warranties of any kind.
+ */
+
+/*
+ * Format of an IP firewall descriptor
+ *
+ * src, dst, src_mask, dst_mask are always stored in network byte order.
+ * flags and num_*_ports are stored in host byte order (of course).
+ * Port numbers are stored in HOST byte order.
+ */
+
+#ifdef __KERNEL__
+#include <linux/icmp.h>
+#include <linux/in.h>
+#include <linux/ip.h>
+#include <linux/tcp.h>
+#include <linux/udp.h>
+#endif
+
+struct ip_fw
+{
+ struct ip_fw *fw_next; /* Next firewall on chain */
+ struct in_addr fw_src, fw_dst; /* Source and destination IP addr */
+ struct in_addr fw_smsk, fw_dmsk; /* Mask for src and dest IP addr */
+ struct in_addr fw_via; /* IP address of interface "via" */
+ struct net_device *fw_viadev; /* device of interface "via" */
+ __u16 fw_flg; /* Flags word */
+ __u16 fw_nsp, fw_ndp; /* N'of src ports and # of dst ports */
+ /* in ports array (dst ports follow */
+ /* src ports; max of 10 ports in all; */
+ /* count of 0 means match all ports) */
+#define IP_FW_MAX_PORTS 10 /* A reasonable maximum */
+ __u16 fw_pts[IP_FW_MAX_PORTS]; /* Array of port numbers to match */
+ unsigned long fw_pcnt,fw_bcnt; /* Packet and byte counters */
+ __u8 fw_tosand, fw_tosxor; /* Revised packet priority */
+ char fw_vianame[IFNAMSIZ]; /* name of interface "via" */
+};
+
+/*
+ * Values for "flags" field .
+ */
+
+#define IP_FW_F_ALL 0x0000 /* This is a universal packet firewall*/
+#define IP_FW_F_TCP 0x0001 /* This is a TCP packet firewall */
+#define IP_FW_F_UDP 0x0002 /* This is a UDP packet firewall */
+#define IP_FW_F_ICMP 0x0003 /* This is a ICMP packet firewall */
+#define IP_FW_F_KIND 0x0003 /* Mask to isolate firewall kind */
+#define IP_FW_F_ACCEPT 0x0004 /* This is an accept firewall (as *
+ * opposed to a deny firewall)*
+ * */
+#define IP_FW_F_SRNG 0x0008 /* The first two src ports are a min *
+ * and max range (stored in host byte *
+ * order). *
+ * */
+#define IP_FW_F_DRNG 0x0010 /* The first two dst ports are a min *
+ * and max range (stored in host byte *
+ * order). *
+ * (ports[0] <= port <= ports[1]) *
+ * */
+#define IP_FW_F_PRN 0x0020 /* In verbose mode print this firewall*/
+#define IP_FW_F_BIDIR 0x0040 /* For bidirectional firewalls */
+#define IP_FW_F_TCPSYN 0x0080 /* For tcp packets-check SYN only */
+#define IP_FW_F_ICMPRPL 0x0100 /* Send back icmp unreachable packet */
+#define IP_FW_F_MASQ 0x0200 /* Masquerading */
+#define IP_FW_F_TCPACK 0x0400 /* For tcp-packets match if ACK is set*/
+#define IP_FW_F_REDIR 0x0800 /* Redirect to local port fw_pts[n] */
+#define IP_FW_F_ACCTIN 0x1000 /* Account incoming packets only. */
+#define IP_FW_F_ACCTOUT 0x2000 /* Account outgoing packets only. */
+
+#define IP_FW_F_MASK 0x3FFF /* All possible flag bits mask */
+
+/*
+ * New IP firewall options for [gs]etsockopt at the RAW IP level.
+ * Unlike BSD Linux inherits IP options so you don't have to use
+ * a raw socket for this. Instead we check rights in the calls.
+ */
+
+#define IP_FW_BASE_CTL 64 /* base for firewall socket options */
+
+#define IP_FW_COMMAND 0x00FF /* mask for command without chain */
+#define IP_FW_TYPE 0x0300 /* mask for type (chain) */
+#define IP_FW_SHIFT 8 /* shift count for type (chain) */
+
+#define IP_FW_FWD 0
+#define IP_FW_IN 1
+#define IP_FW_OUT 2
+#define IP_FW_ACCT 3
+#define IP_FW_CHAINS 4 /* total number of ip_fw chains */
+#define IP_FW_MASQ 5
+
+#define IP_FW_INSERT (IP_FW_BASE_CTL)
+#define IP_FW_APPEND (IP_FW_BASE_CTL+1)
+#define IP_FW_DELETE (IP_FW_BASE_CTL+2)
+#define IP_FW_FLUSH (IP_FW_BASE_CTL+3)
+#define IP_FW_ZERO (IP_FW_BASE_CTL+4)
+#define IP_FW_POLICY (IP_FW_BASE_CTL+5)
+#define IP_FW_CHECK (IP_FW_BASE_CTL+6)
+#define IP_FW_MASQ_TIMEOUTS (IP_FW_BASE_CTL+7)
+
+#define IP_FW_INSERT_FWD (IP_FW_INSERT | (IP_FW_FWD << IP_FW_SHIFT))
+#define IP_FW_APPEND_FWD (IP_FW_APPEND | (IP_FW_FWD << IP_FW_SHIFT))
+#define IP_FW_DELETE_FWD (IP_FW_DELETE | (IP_FW_FWD << IP_FW_SHIFT))
+#define IP_FW_FLUSH_FWD (IP_FW_FLUSH | (IP_FW_FWD << IP_FW_SHIFT))
+#define IP_FW_ZERO_FWD (IP_FW_ZERO | (IP_FW_FWD << IP_FW_SHIFT))
+#define IP_FW_POLICY_FWD (IP_FW_POLICY | (IP_FW_FWD << IP_FW_SHIFT))
+#define IP_FW_CHECK_FWD (IP_FW_CHECK | (IP_FW_FWD << IP_FW_SHIFT))
+
+#define IP_FW_INSERT_IN (IP_FW_INSERT | (IP_FW_IN << IP_FW_SHIFT))
+#define IP_FW_APPEND_IN (IP_FW_APPEND | (IP_FW_IN << IP_FW_SHIFT))
+#define IP_FW_DELETE_IN (IP_FW_DELETE | (IP_FW_IN << IP_FW_SHIFT))
+#define IP_FW_FLUSH_IN (IP_FW_FLUSH | (IP_FW_IN << IP_FW_SHIFT))
+#define IP_FW_ZERO_IN (IP_FW_ZERO | (IP_FW_IN << IP_FW_SHIFT))
+#define IP_FW_POLICY_IN (IP_FW_POLICY | (IP_FW_IN << IP_FW_SHIFT))
+#define IP_FW_CHECK_IN (IP_FW_CHECK | (IP_FW_IN << IP_FW_SHIFT))
+
+#define IP_FW_INSERT_OUT (IP_FW_INSERT | (IP_FW_OUT << IP_FW_SHIFT))
+#define IP_FW_APPEND_OUT (IP_FW_APPEND | (IP_FW_OUT << IP_FW_SHIFT))
+#define IP_FW_DELETE_OUT (IP_FW_DELETE | (IP_FW_OUT << IP_FW_SHIFT))
+#define IP_FW_FLUSH_OUT (IP_FW_FLUSH | (IP_FW_OUT << IP_FW_SHIFT))
+#define IP_FW_ZERO_OUT (IP_FW_ZERO | (IP_FW_OUT << IP_FW_SHIFT))
+#define IP_FW_POLICY_OUT (IP_FW_POLICY | (IP_FW_OUT << IP_FW_SHIFT))
+#define IP_FW_CHECK_OUT (IP_FW_CHECK | (IP_FW_OUT << IP_FW_SHIFT))
+
+#define IP_ACCT_INSERT (IP_FW_INSERT | (IP_FW_ACCT << IP_FW_SHIFT))
+#define IP_ACCT_APPEND (IP_FW_APPEND | (IP_FW_ACCT << IP_FW_SHIFT))
+#define IP_ACCT_DELETE (IP_FW_DELETE | (IP_FW_ACCT << IP_FW_SHIFT))
+#define IP_ACCT_FLUSH (IP_FW_FLUSH | (IP_FW_ACCT << IP_FW_SHIFT))
+#define IP_ACCT_ZERO (IP_FW_ZERO | (IP_FW_ACCT << IP_FW_SHIFT))
+
+#define IP_FW_MASQ_INSERT (IP_FW_INSERT | (IP_FW_MASQ << IP_FW_SHIFT))
+#define IP_FW_MASQ_ADD (IP_FW_APPEND | (IP_FW_MASQ << IP_FW_SHIFT))
+#define IP_FW_MASQ_DEL (IP_FW_DELETE | (IP_FW_MASQ << IP_FW_SHIFT))
+#define IP_FW_MASQ_FLUSH (IP_FW_FLUSH | (IP_FW_MASQ << IP_FW_SHIFT))
+
+#define IP_FW_MASQ_INSERT (IP_FW_INSERT | (IP_FW_MASQ << IP_FW_SHIFT))
+#define IP_FW_MASQ_ADD (IP_FW_APPEND | (IP_FW_MASQ << IP_FW_SHIFT))
+#define IP_FW_MASQ_DEL (IP_FW_DELETE | (IP_FW_MASQ << IP_FW_SHIFT))
+#define IP_FW_MASQ_FLUSH (IP_FW_FLUSH | (IP_FW_MASQ << IP_FW_SHIFT))
+
+struct ip_fwpkt
+{
+ struct iphdr fwp_iph; /* IP header */
+ union {
+ struct tcphdr fwp_tcph; /* TCP header or */
+ struct udphdr fwp_udph; /* UDP header */
+ struct icmphdr fwp_icmph; /* ICMP header */
+ } fwp_protoh;
+ struct in_addr fwp_via; /* interface address */
+ char fwp_vianame[IFNAMSIZ]; /* interface name */
+};
+
+#define IP_FW_MASQCTL_MAX 256
+#define IP_MASQ_MOD_NMAX 32
+
+struct ip_fw_masqctl
+{
+ int mctl_action;
+ union {
+ struct {
+ char name[IP_MASQ_MOD_NMAX];
+ char data[1];
+ } mod;
+ } u;
+};
+
+/*
+ * timeouts for ip masquerading
+ */
+
+struct ip_fw_masq;
+
+/*
+ * Main firewall chains definitions and global var's definitions.
+ */
+
+#ifdef __KERNEL__
+
+/* Modes used in the ip_fw_chk() routine. */
+#define IP_FW_MODE_FW 0x00 /* kernel firewall check */
+#define IP_FW_MODE_ACCT_IN 0x01 /* accounting (incoming) */
+#define IP_FW_MODE_ACCT_OUT 0x02 /* accounting (outgoing) */
+#define IP_FW_MODE_CHK 0x04 /* check requested by user */
+
+#include <linux/config.h>
+#ifdef CONFIG_IP_FIREWALL
+extern struct ip_fw *ip_fw_in_chain;
+extern struct ip_fw *ip_fw_out_chain;
+extern struct ip_fw *ip_fw_fwd_chain;
+extern int ip_fw_in_policy;
+extern int ip_fw_out_policy;
+extern int ip_fw_fwd_policy;
+extern int ip_fw_ctl(int, void *, int);
+#endif
+#ifdef CONFIG_IP_ACCT
+extern struct ip_fw *ip_acct_chain;
+extern int ip_acct_ctl(int, void *, int);
+#endif
+#ifdef CONFIG_IP_MASQUERADE
+extern int ip_masq_ctl(int, void *, int);
+#endif
+#ifdef CONFIG_IP_MASQUERADE
+extern int ip_masq_ctl(int, void *, int);
+#endif
+
+extern int ip_fw_masq_timeouts(void *user, int len);
+
+extern int ip_fw_chk(struct iphdr *, struct net_device *, __u16 *,
+ struct ip_fw *, int, int);
+#endif /* KERNEL */
+#endif /* _IP_FW_H */
diff --git a/include/linux/netfilter_ipv4/ipt_LOG.h b/include/linux/netfilter_ipv4/ipt_LOG.h
new file mode 100644
index 000000000..481e12846
--- /dev/null
+++ b/include/linux/netfilter_ipv4/ipt_LOG.h
@@ -0,0 +1,15 @@
+#ifndef _IPT_LOG_H
+#define _IPT_LOG_H
+
+#define IPT_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */
+#define IPT_LOG_TCPOPT 0x02 /* Log TCP options */
+#define IPT_LOG_IPOPT 0x04 /* Log IP options */
+#define IPT_LOG_MASK 0x07
+
+struct ipt_log_info {
+ unsigned char level;
+ unsigned char logflags;
+ char prefix[30];
+};
+
+#endif /*_IPT_LOG_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_MARK.h b/include/linux/netfilter_ipv4/ipt_MARK.h
new file mode 100644
index 000000000..cc57ae7a3
--- /dev/null
+++ b/include/linux/netfilter_ipv4/ipt_MARK.h
@@ -0,0 +1,8 @@
+#ifndef _IPT_MARK_H_target
+#define _IPT_MARK_H_target
+
+struct ipt_mark_target_info {
+ unsigned long mark;
+};
+
+#endif /*_IPT_MARK_H_target*/
diff --git a/include/linux/netfilter_ipv4/ipt_REJECT.h b/include/linux/netfilter_ipv4/ipt_REJECT.h
new file mode 100644
index 000000000..1ceebe211
--- /dev/null
+++ b/include/linux/netfilter_ipv4/ipt_REJECT.h
@@ -0,0 +1,17 @@
+#ifndef _IPT_REJECT_H
+#define _IPT_REJECT_H
+
+enum ipt_reject_with {
+ IPT_ICMP_NET_UNREACHABLE,
+ IPT_ICMP_HOST_UNREACHABLE,
+ IPT_ICMP_PROT_UNREACHABLE,
+ IPT_ICMP_PORT_UNREACHABLE,
+ IPT_ICMP_ECHOREPLY,
+ IPT_TCP_RESET,
+};
+
+struct ipt_reject_info {
+ enum ipt_reject_with with; /* reject type */
+};
+
+#endif /*_IPT_REJECT_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_TOS.h b/include/linux/netfilter_ipv4/ipt_TOS.h
new file mode 100644
index 000000000..6bf9e1fdf
--- /dev/null
+++ b/include/linux/netfilter_ipv4/ipt_TOS.h
@@ -0,0 +1,12 @@
+#ifndef _IPT_TOS_H_target
+#define _IPT_TOS_H_target
+
+#ifndef IPTOS_NORMALSVC
+#define IPTOS_NORMALSVC 0
+#endif
+
+struct ipt_tos_target_info {
+ u_int8_t tos;
+};
+
+#endif /*_IPT_TOS_H_target*/
diff --git a/include/linux/netfilter_ipv4/ipt_limit.h b/include/linux/netfilter_ipv4/ipt_limit.h
new file mode 100644
index 000000000..256453409
--- /dev/null
+++ b/include/linux/netfilter_ipv4/ipt_limit.h
@@ -0,0 +1,21 @@
+#ifndef _IPT_RATE_H
+#define _IPT_RATE_H
+
+/* timings are in milliseconds. */
+#define IPT_LIMIT_SCALE 10000
+
+/* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490
+ seconds, or one every 59 hours. */
+struct ipt_rateinfo {
+ u_int32_t avg; /* Average secs between packets * scale */
+ u_int32_t burst; /* Period multiplier for upper limit. */
+
+ /* Used internally by the kernel */
+ unsigned long prev;
+ u_int32_t credit;
+ u_int32_t credit_cap, cost;
+
+ /* Ugly, ugly fucker. */
+ struct ipt_rateinfo *master;
+};
+#endif /*_IPT_RATE_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_mac.h b/include/linux/netfilter_ipv4/ipt_mac.h
new file mode 100644
index 000000000..f8d5b8e7c
--- /dev/null
+++ b/include/linux/netfilter_ipv4/ipt_mac.h
@@ -0,0 +1,8 @@
+#ifndef _IPT_MAC_H
+#define _IPT_MAC_H
+
+struct ipt_mac_info {
+ unsigned char srcaddr[ETH_ALEN];
+ int invert;
+};
+#endif /*_IPT_MAC_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_mark.h b/include/linux/netfilter_ipv4/ipt_mark.h
new file mode 100644
index 000000000..f3952b563
--- /dev/null
+++ b/include/linux/netfilter_ipv4/ipt_mark.h
@@ -0,0 +1,9 @@
+#ifndef _IPT_MARK_H
+#define _IPT_MARK_H
+
+struct ipt_mark_info {
+ unsigned long mark, mask;
+ u_int8_t invert;
+};
+
+#endif /*_IPT_MARK_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_multiport.h b/include/linux/netfilter_ipv4/ipt_multiport.h
new file mode 100644
index 000000000..f6e50ae92
--- /dev/null
+++ b/include/linux/netfilter_ipv4/ipt_multiport.h
@@ -0,0 +1,21 @@
+#ifndef _IPT_MULTIPORT_H
+#define _IPT_MULTIPORT_H
+#include <linux/netfilter_ipv4/ip_tables.h>
+
+enum ipt_multiport_flags
+{
+ IPT_MULTIPORT_SOURCE,
+ IPT_MULTIPORT_DESTINATION,
+ IPT_MULTIPORT_EITHER
+};
+
+#define IPT_MULTI_PORTS 15
+
+/* Must fit inside union ipt_matchinfo: 16 bytes */
+struct ipt_multiport
+{
+ u_int8_t flags; /* Type of comparison */
+ u_int8_t count; /* Number of ports */
+ u_int16_t ports[IPT_MULTI_PORTS]; /* Ports */
+};
+#endif /*_IPT_MULTIPORT_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_owner.h b/include/linux/netfilter_ipv4/ipt_owner.h
new file mode 100644
index 000000000..b014ef8b3
--- /dev/null
+++ b/include/linux/netfilter_ipv4/ipt_owner.h
@@ -0,0 +1,18 @@
+#ifndef _IPT_OWNER_H
+#define _IPT_OWNER_H
+
+/* match and invert flags */
+#define IPT_OWNER_UID 0x01
+#define IPT_OWNER_GID 0x02
+#define IPT_OWNER_PID 0x04
+#define IPT_OWNER_SID 0x08
+
+struct ipt_owner_info {
+ uid_t uid;
+ gid_t gid;
+ pid_t pid;
+ pid_t sid;
+ u_int8_t match, invert; /* flags */
+};
+
+#endif /*_IPT_OWNER_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_state.h b/include/linux/netfilter_ipv4/ipt_state.h
new file mode 100644
index 000000000..ad11d316a
--- /dev/null
+++ b/include/linux/netfilter_ipv4/ipt_state.h
@@ -0,0 +1,12 @@
+#ifndef _IPT_STATE_H
+#define _IPT_STATE_H
+
+#define _IPT_STATE_BIT(ctinfo) (1 << ((ctinfo)+1))
+#define IPT_STATE_BIT(ctinfo) ((ctinfo) >= IP_CT_IS_REPLY ? _IPT_STATE_BIT((ctinfo)-IP_CT_IS_REPLY) : _IPT_STATE_BIT(ctinfo))
+#define IPT_STATE_INVALID (1 << 0)
+
+struct ipt_state_info
+{
+ unsigned int statemask;
+};
+#endif /*_IPT_STATE_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_tos.h b/include/linux/netfilter_ipv4/ipt_tos.h
new file mode 100644
index 000000000..a21f5df23
--- /dev/null
+++ b/include/linux/netfilter_ipv4/ipt_tos.h
@@ -0,0 +1,13 @@
+#ifndef _IPT_TOS_H
+#define _IPT_TOS_H
+
+struct ipt_tos_info {
+ u_int8_t tos;
+ u_int8_t invert;
+};
+
+#ifndef IPTOS_NORMALSVC
+#define IPTOS_NORMALSVC 0
+#endif
+
+#endif /*_IPT_TOS_H*/
diff --git a/include/linux/netfilter_ipv4/listhelp.h b/include/linux/netfilter_ipv4/listhelp.h
new file mode 100644
index 000000000..e64a0eeb8
--- /dev/null
+++ b/include/linux/netfilter_ipv4/listhelp.h
@@ -0,0 +1,115 @@
+#ifndef _LISTHELP_H
+#define _LISTHELP_H
+#include <linux/config.h>
+#include <linux/list.h>
+#include <linux/netfilter_ipv4/lockhelp.h>
+
+/* Header to do more comprehensive job than linux/list.h; assume list
+ is first entry in structure. */
+
+/* Return pointer to first true entry, if any, or NULL. A macro
+ required to allow inlining of cmpfn. */
+#define LIST_FIND(head, cmpfn, type, args...) \
+({ \
+ const struct list_head *__i = (head); \
+ \
+ ASSERT_READ_LOCK(head); \
+ do { \
+ __i = __i->next; \
+ if (__i == (head)) { \
+ __i = NULL; \
+ break; \
+ } \
+ } while (!cmpfn((const type)__i , ## args)); \
+ (type)__i; \
+})
+
+#define LIST_FIND_W(head, cmpfn, type, args...) \
+({ \
+ const struct list_head *__i = (head); \
+ \
+ ASSERT_WRITE_LOCK(head); \
+ do { \
+ __i = __i->next; \
+ if (__i == (head)) { \
+ __i = NULL; \
+ break; \
+ } \
+ } while (!cmpfn((type)__i , ## args)); \
+ (type)__i; \
+})
+
+extern inline int
+__list_cmp_same(const void *p1, const void *p2) { return p1 == p2; }
+
+/* Is this entry in the list? */
+extern inline int
+list_inlist(struct list_head *head, const void *entry)
+{
+ return LIST_FIND(head, __list_cmp_same, void *, entry) != NULL;
+}
+
+/* Delete from list. */
+#ifdef CONFIG_NETFILTER_DEBUG
+#define LIST_DELETE(head, oldentry) \
+do { \
+ ASSERT_WRITE_LOCK(head); \
+ if (!list_inlist(head, oldentry)) \
+ printk("LIST_DELETE: %s:%u `%s'(%p) not in %s.\n", \
+ __FILE__, __LINE__, #oldentry, oldentry, #head); \
+ else list_del((struct list_head *)oldentry); \
+} while(0)
+#else
+#define LIST_DELETE(head, oldentry) list_del((struct list_head *)oldentry)
+#endif
+
+/* Append. */
+extern inline void
+list_append(struct list_head *head, void *new)
+{
+ ASSERT_WRITE_LOCK(head);
+ list_add((new), (head)->prev);
+}
+
+/* Prepend. */
+extern inline void
+list_prepend(struct list_head *head, void *new)
+{
+ ASSERT_WRITE_LOCK(head);
+ list_add(new, head);
+}
+
+/* Insert according to ordering function; insert before first true. */
+#define LIST_INSERT(head, new, cmpfn) \
+do { \
+ struct list_head *__i; \
+ ASSERT_WRITE_LOCK(head); \
+ for (__i = (head)->next; \
+ !cmpfn((new), (typeof (new))__i) && __i != (head); \
+ __i = __i->next); \
+ list_add((struct list_head *)(new), __i->prev); \
+} while(0)
+
+/* If the field after the list_head is a nul-terminated string, you
+ can use these functions. */
+extern inline int __list_cmp_name(const void *i, const char *name)
+{
+ return strcmp(name, i+sizeof(struct list_head)) == 0;
+}
+
+/* Returns false if same name already in list, otherwise does insert. */
+extern inline int
+list_named_insert(struct list_head *head, void *new)
+{
+ if (LIST_FIND(head, __list_cmp_name, void *,
+ new + sizeof(struct list_head)))
+ return 0;
+ list_prepend(head, new);
+ return 1;
+}
+
+/* Find this named element in the list. */
+#define list_named_find(head, name) \
+LIST_FIND(head, __list_cmp_name, void *, name)
+
+#endif /*_LISTHELP_H*/
diff --git a/include/linux/netfilter_ipv4/lockhelp.h b/include/linux/netfilter_ipv4/lockhelp.h
new file mode 100644
index 000000000..89dd63f9f
--- /dev/null
+++ b/include/linux/netfilter_ipv4/lockhelp.h
@@ -0,0 +1,129 @@
+#ifndef _LOCKHELP_H
+#define _LOCKHELP_H
+#include <linux/config.h>
+
+#include <linux/spinlock.h>
+#include <asm/atomic.h>
+#include <linux/interrupt.h>
+#include <linux/smp.h>
+
+/* Header to do help in lock debugging. */
+
+#ifdef CONFIG_NETFILTER_DEBUG
+struct spinlock_debug
+{
+ spinlock_t l;
+ atomic_t locked_by;
+};
+
+struct rwlock_debug
+{
+ rwlock_t l;
+ int read_locked_map;
+ int write_locked_map;
+};
+
+#define DECLARE_LOCK(l) \
+struct spinlock_debug l = { SPIN_LOCK_UNLOCKED, ATOMIC_INIT(-1) }
+#define DECLARE_LOCK_EXTERN(l) \
+extern struct spinlock_debug l
+#define DECLARE_RWLOCK(l) \
+struct rwlock_debug l = { RW_LOCK_UNLOCKED, 0, 0 }
+#define DECLARE_RWLOCK_EXTERN(l) \
+extern struct rwlock_debug l
+
+#define MUST_BE_LOCKED(l) \
+do { if (atomic_read(&(l)->locked_by) != smp_processor_id()) \
+ printk("ASSERT %s:%u %s unlocked\n", __FILE__, __LINE__, #l); \
+} while(0)
+
+#define MUST_BE_UNLOCKED(l) \
+do { if (atomic_read(&(l)->locked_by) == smp_processor_id()) \
+ printk("ASSERT %s:%u %s locked\n", __FILE__, __LINE__, #l); \
+} while(0)
+
+/* Write locked OK as well. */ \
+#define MUST_BE_READ_LOCKED(l) \
+do { if (!((l)->read_locked_map & (1 << smp_processor_id())) \
+ && !((l)->write_locked_map & (1 << smp_processor_id()))) \
+ printk("ASSERT %s:%u %s not readlocked\n", __FILE__, __LINE__, #l); \
+} while(0)
+
+#define MUST_BE_WRITE_LOCKED(l) \
+do { if (!((l)->write_locked_map & (1 << smp_processor_id()))) \
+ printk("ASSERT %s:%u %s not writelocked\n", __FILE__, __LINE__, #l); \
+} while(0)
+
+#define MUST_BE_READ_WRITE_UNLOCKED(l) \
+do { if ((l)->read_locked_map & (1 << smp_processor_id())) \
+ printk("ASSERT %s:%u %s readlocked\n", __FILE__, __LINE__, #l); \
+ else if ((l)->write_locked_map & (1 << smp_processor_id())) \
+ printk("ASSERT %s:%u %s writelocked\n", __FILE__, __LINE__, #l); \
+} while(0)
+
+#define LOCK_BH(lk) \
+do { \
+ MUST_BE_UNLOCKED(lk); \
+ spin_lock_bh(&(lk)->l); \
+ atomic_set(&(lk)->locked_by, smp_processor_id()); \
+} while(0)
+
+#define UNLOCK_BH(lk) \
+do { \
+ MUST_BE_LOCKED(lk); \
+ atomic_set(&(lk)->locked_by, -1); \
+ spin_unlock_bh(&(lk)->l); \
+} while(0)
+
+#define READ_LOCK(lk) \
+do { \
+ MUST_BE_READ_WRITE_UNLOCKED(lk); \
+ read_lock_bh(&(lk)->l); \
+ set_bit(smp_processor_id(), &(lk)->read_locked_map); \
+} while(0)
+
+#define WRITE_LOCK(lk) \
+do { \
+ MUST_BE_READ_WRITE_UNLOCKED(lk); \
+ write_lock_bh(&(lk)->l); \
+ set_bit(smp_processor_id(), &(lk)->write_locked_map); \
+} while(0)
+
+#define READ_UNLOCK(lk) \
+do { \
+ if (!((lk)->read_locked_map & (1 << smp_processor_id()))) \
+ printk("ASSERT: %s:%u %s not readlocked\n", \
+ __FILE__, __LINE__, #lk); \
+ clear_bit(smp_processor_id(), &(lk)->read_locked_map); \
+ read_unlock_bh(&(lk)->l); \
+} while(0)
+
+#define WRITE_UNLOCK(lk) \
+do { \
+ MUST_BE_WRITE_LOCKED(lk); \
+ clear_bit(smp_processor_id(), &(lk)->write_locked_map); \
+ write_unlock_bh(&(lk)->l); \
+} while(0)
+
+#else
+#define DECLARE_LOCK(l) spinlock_t l = SPIN_LOCK_UNLOCKED
+#define DECLARE_LOCK_EXTERN(l) extern spinlock_t l
+#define DECLARE_RWLOCK(l) rwlock_t l = RW_LOCK_UNLOCKED
+#define DECLARE_RWLOCK_EXTERN(l) extern rwlock_t l
+
+#define MUST_BE_LOCKED(l)
+#define MUST_BE_UNLOCKED(l)
+#define MUST_BE_READ_LOCKED(l)
+#define MUST_BE_WRITE_LOCKED(l)
+#define MUST_BE_READ_WRITE_UNLOCKED(l)
+
+#define LOCK_BH(l) spin_lock_bh(l)
+#define UNLOCK_BH(l) spin_unlock_bh(l)
+
+#define READ_LOCK(l) read_lock_bh(l)
+#define WRITE_LOCK(l) write_lock_bh(l)
+#define READ_UNLOCK(l) read_unlock_bh(l)
+#define WRITE_UNLOCK(l) write_unlock_bh(l)
+#endif /*CONFIG_NETFILTER_DEBUG*/
+
+#endif /* _LOCKHELP_H */
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
index a2f4897fc..42663e79b 100644
--- a/include/linux/nfsd/nfsd.h
+++ b/include/linux/nfsd/nfsd.h
@@ -172,6 +172,9 @@ void nfsd_lockd_unexport(struct svc_client *);
#define nfserr_badtype __constant_htonl(NFSERR_BADTYPE)
#define nfserr_jukebox __constant_htonl(NFSERR_JUKEBOX)
+/* Check for dir entries '.' and '..' */
+#define isdotent(n, l) (l < 3 && n[0] == '.' && (l == 1 || n[1] == '.'))
+
/*
* Time of server startup
*/
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 413def0a9..472c9d87e 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -293,8 +293,6 @@
#define PCI_DMA_FROMDEVICE 2
#define PCI_DMA_NONE 3
-#include <asm/pci.h>
-
#define DEVICE_COUNT_COMPATIBLE 4
#define DEVICE_COUNT_IRQ 2
#define DEVICE_COUNT_DMA 2
@@ -542,6 +540,10 @@ void pci_remove_device(struct pci_dev *);
struct pci_driver *pci_dev_driver(const struct pci_dev *);
const struct pci_device_id *pci_match_device(const struct pci_device_id *ids, const struct pci_dev *dev);
+/* Include architecture-dependent settings and functions */
+
+#include <asm/pci.h>
+
/*
* If the system does not have PCI, clearly these return errors. Define
* these as simple inline functions to avoid hair in drivers.
@@ -580,6 +582,7 @@ extern inline int pci_module_init(struct pci_driver *drv) { return -ENODEV; }
extern inline int pci_assign_resource(struct pci_dev *dev, int i) { return -EBUSY;}
extern inline int pci_register_driver(struct pci_driver *drv) { return 0;}
extern inline void pci_unregister_driver(struct pci_driver *drv) { }
+extern inline int scsi_to_pci_dma_dir(unsigned char scsi_dir) { return scsi_dir; }
#else
diff --git a/include/linux/ppp_channel.h b/include/linux/ppp_channel.h
index fdcfb8f75..d9ba188a0 100644
--- a/include/linux/ppp_channel.h
+++ b/include/linux/ppp_channel.h
@@ -61,8 +61,8 @@ extern int ppp_register_channel(struct ppp_channel *);
/* Detach a channel from its PPP unit (e.g. on hangup). */
extern void ppp_unregister_channel(struct ppp_channel *);
-/* Get the channel number for a channel */
-extern int ppp_channel_index(struct ppp_channel *);
+/* Get the unit number associated with a channel */
+extern int ppp_unit_number(struct ppp_channel *);
/*
* SMP locking notes:
diff --git a/include/linux/prctl.h b/include/linux/prctl.h
index ca7a8cd8b..c6c42a55b 100644
--- a/include/linux/prctl.h
+++ b/include/linux/prctl.h
@@ -16,4 +16,8 @@
# define PR_UNALIGN_NOPRINT 1 /* silently fix up unaligned user accesses */
# define PR_UNALIGN_SIGBUS 2 /* generate SIGBUS on unaligned user access */
+/* Get/set whether or not to drop capabilities on setuid() away from uid 0 */
+#define PR_GET_KEEPCAPS 7
+#define PR_SET_KEEPCAPS 8
+
#endif /* _LINUX_PRCTL_H */
diff --git a/include/linux/quota.h b/include/linux/quota.h
index ad2380019..9324b9a02 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -174,7 +174,7 @@ struct dquot {
int dq_count; /* Reference count */
/* fields after this point are cleared when invalidating */
- struct vfsmount *dq_mnt; /* VFS_mount_point this applies to */
+ struct super_block *dq_sb; /* superblock this applies to */
unsigned int dq_id; /* ID this applies to (uid, gid) */
kdev_t dq_dev; /* Device this applies to */
short dq_type; /* Type of quota */
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index 17371e58c..14ad1b7ca 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -20,7 +20,7 @@
extern void dquot_initialize(struct inode *inode, short type);
extern void dquot_drop(struct inode *inode);
extern void invalidate_dquots(kdev_t dev, short type);
-extern int quota_off(kdev_t dev, short type);
+extern int quota_off(struct super_block *sb, short type);
extern int sync_dquots(kdev_t dev, short type);
extern int dquot_alloc_block(const struct inode *inode, unsigned long number, char prealloc);
@@ -103,7 +103,7 @@ extern __inline__ int DQUOT_TRANSFER(struct dentry *dentry, struct iattr *iattr)
}
#define DQUOT_SYNC(dev) sync_dquots(dev, -1)
-#define DQUOT_OFF(dev) quota_off(dev, -1)
+#define DQUOT_OFF(sb) quota_off(sb, -1)
#else
@@ -118,7 +118,7 @@ extern __inline__ int DQUOT_TRANSFER(struct dentry *dentry, struct iattr *iattr)
#define DQUOT_FREE_BLOCK(sb, inode, nr) do { } while(0)
#define DQUOT_FREE_INODE(sb, inode) do { } while(0)
#define DQUOT_SYNC(dev) do { } while(0)
-#define DQUOT_OFF(dev) do { } while(0)
+#define DQUOT_OFF(sb) do { } while(0)
/*
* Special case expands to a simple notify_change.
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 48050ccb0..75d010ca4 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -326,6 +326,7 @@ struct task_struct {
int ngroups;
gid_t groups[NGROUPS];
kernel_cap_t cap_effective, cap_inheritable, cap_permitted;
+ int keep_capabilities:1;
struct user_struct *user;
/* limits */
struct rlimit rlim[RLIM_NLIMITS];
@@ -414,6 +415,7 @@ struct task_struct {
cap_effective: CAP_INIT_EFF_SET, \
cap_inheritable: CAP_INIT_INH_SET, \
cap_permitted: CAP_FULL_SET, \
+ keep_capabilities: 0, \
rlim: INIT_RLIMITS, \
comm: "swapper", \
thread: INIT_THREAD, \
diff --git a/include/linux/shm.h b/include/linux/shm.h
index c1ab5240b..bc56c5e20 100644
--- a/include/linux/shm.h
+++ b/include/linux/shm.h
@@ -11,8 +11,8 @@
#define SHMMAX 0x2000000 /* max shared seg size (bytes) */
#define SHMMIN 0 /* min shared seg size (bytes) */
-#define SHMMNI 128 /* max num of segs system wide */
-#define SHMALL (SHMMAX/PAGE_SIZE*SHMMNI) /* max shm system wide (pages) */
+#define SHMMNI 4096 /* max num of segs system wide */
+#define SHMALL (SHMMAX/PAGE_SIZE*(SHMMNI/16)) /* max shm system wide (pages) */
#define SHMSEG SHMMNI /* max shared segs per process */
#include <asm/shmparam.h>
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 6081b0890..429089cc5 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -122,8 +122,6 @@ struct sk_buff {
#ifdef CONFIG_NETFILTER
/* Can be used for communication between hooks. */
unsigned long nfmark;
- /* Reason for doing this to the packet (see netfilter.h) */
- __u32 nfreason;
/* Cache info */
__u32 nfcache;
/* Associated connection, if any */
diff --git a/include/linux/soundcard.h b/include/linux/soundcard.h
index 2d5128dc4..ca8ad780d 100644
--- a/include/linux/soundcard.h
+++ b/include/linux/soundcard.h
@@ -552,6 +552,7 @@ typedef struct {
# define AFMT_U16_LE 0x00000080 /* Little endian U16 */
# define AFMT_U16_BE 0x00000100 /* Big endian U16 */
# define AFMT_MPEG 0x00000200 /* MPEG (2) audio */
+# define AFMT_AC3 0x00000400 /* Dolby Digital AC3 */
/*
* Buffer status queries.
@@ -581,11 +582,14 @@ typedef struct audio_buf_info {
/* but usually not */
# define DSP_CAP_TRIGGER 0x00001000 /* Supports SETTRIGGER */
# define DSP_CAP_MMAP 0x00002000 /* Supports mmap() */
+# define DSP_CAP_MULTI 0x00004000 /* support multiple open */
+# define DSP_CAP_BIND 0x00008000 /* channel binding to front/rear/cneter/lfe */
+
#define SNDCTL_DSP_GETTRIGGER _SIOR ('P',16, int)
#define SNDCTL_DSP_SETTRIGGER _SIOW ('P',16, int)
# define PCM_ENABLE_INPUT 0x00000001
-# define PCM_ENABLE_OUTPUT 0x00000002
+# define PCM_ENABLE_OUTPUT 0x00000002
typedef struct count_info {
int bytes; /* Total # of bytes processed */
@@ -606,6 +610,19 @@ typedef struct buffmem_desc {
#define SNDCTL_DSP_SETDUPLEX _SIO ('P', 22)
#define SNDCTL_DSP_GETODELAY _SIOR ('P', 23, int)
+#define SNDCTL_DSP_GETCHANNELMASK _SIOWR('P', 64, int)
+#define SNDCTL_DSP_BIND_CHANNEL _SIOWR('P', 65, int)
+# define DSP_BIND_QUERY 0x00000000
+# define DSP_BIND_FRONT 0x00000001
+# define DSP_BIND_SURR 0x00000002
+# define DSP_BIND_CENTER_LFE 0x00000004
+# define DSP_BIND_HANDSET 0x00000008
+# define DSP_BIND_MIC 0x00000010
+# define DSP_BIND_MODEM1 0x00000020
+# define DSP_BIND_MODEM2 0x00000040
+# define DSP_BIND_I2S 0x00000080
+# define DSP_BIND_SPDIF 0x00000100
+
/*
* Application's profile defines the way how playback underrun situations should be handled.
*
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 569b8b6ea..dacdfa2a7 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -669,6 +669,8 @@ extern void tcp_v4_send_check(struct sock *sk,
struct tcphdr *th, int len,
struct sk_buff *skb);
+extern void tcp_v4_send_reset(struct sk_buff *skb);
+
extern int tcp_v4_conn_request(struct sock *sk,
struct sk_buff *skb);